//>>built define(["dojo/_base/array","dojo/_base/lang","dojo/_base/declare","./ModelRefController"],function(h,g,k,l){function f(a){for(var c in{_listModelWatchHandle:1,_tableModelWatchHandle:1})a[c]&&(a[c].unwatch(),a[c]=null)}function m(a,c,b){f(a);b&&c!==b&&(b.watchElements?a._listModelWatchHandle=b.watchElements(function(b,c,d){if(c&&d){var e=a.get("cursorIndex");c&&e>=b&&e=b&&a.set(a._refCursorProp,a.get("cursor"))}else a.set(a._refCursorProp, a.get(a._refCursorProp))}):b.set&&b.watch&&(0>a.get("cursorIndex")&&a._set("cursorIndex",""),a._tableModelWatchHandle=b.watch(function(b,c,d){c!==d&&b==a.get("cursorIndex")&&a.set(a._refCursorProp,d)})));a._setCursorIndexAttr(a.cursorIndex)}return k("dojox.mvc.ListController",l,{idProperty:"uniqueId",cursorId:null,cursorIndex:-1,cursor:null,model:null,_listModelWatchHandle:null,_tableModelWatchHandle:null,_refCursorProp:"cursor",_refModelProp:"cursor",destroy:function(){f(this);this.inherited(arguments)}, set:function(a,c){var b=this[this._refCursorProp],n=this[this._refInModelProp];this.inherited(arguments);if(a==this._refCursorProp)a:{var e=c,d=this[this._refInModelProp];if(d&&b!==e)if(g.isArray(d))b=h.indexOf(d,e),0>b?(b=this.get("cursorIndex"),0<=b&&b