//>>built
define("dojox/mvc/StatefulArray",["dojo/_base/lang","dojo/Stateful"],function(a,h){function l(a){a._watchElementCallbacks&&a._watchElementCallbacks(void 0,[],[]);return a}var e=function(k){k=a._toArray(k||[]);k.constructor=e;return a.mixin(k,{pop:function(){return this.splice(this.get("length")-1,1)[0]},push:function(){this.splice.apply(this,[this.get("length"),0].concat(a._toArray(arguments)));return this.get("length")},reverse:function(){return l([].reverse.apply(this,a._toArray(arguments)))},shift:function(){return this.splice(0,
1)[0]},sort:function(){return l([].sort.apply(this,a._toArray(arguments)))},splice:function(d,c){var b=this.get("length");d+=0>d?b:0;var m=Math.min(d,b),g=this.slice(d,d+c),f=a._toArray(arguments).slice(2);[].splice.apply(this,[d,c].concat(Array(f.length)));for(var e=0;e<f.length;e++)this[m+e]=f[e];this._watchElementCallbacks&&this._watchElementCallbacks(d,g,f);this._watchCallbacks&&this._watchCallbacks("length",b,b-g.length+f.length);return g},unshift:function(){this.splice.apply(this,[0,0].concat(a._toArray(arguments)));
return this.get("length")},concat:function(d){return new e([].concat.apply(this,arguments))},join:function(d){for(var c=[],b=this.get("length"),a=0;a<b;a++)c.push(this.get(a));return c.join(d)},slice:function(d,c){var b=this.get("length");c=(void 0===c?b:c)+(0>c?b:0);for(var a=[],b=d+(0>d?b:0)||0;b<Math.min(c,this.get("length"));b++)a.push(this.get(b));return new e(a)},watchElements:function(d){var c=this._watchElementCallbacks,b=this;c||(c=this._watchElementCallbacks=function(a,d,e){for(var f=[].concat(c.list),
g=0;g<f.length;g++)f[g].call(b,a,d,e)},c.list=[]);c.list.push(d);var a={};a.unwatch=a.remove=function(){for(var a=c.list,b=0;b<a.length;b++)if(a[b]==d){a.splice(b,1);break}};return a}},h.prototype,{set:function(a,c){if("length"==a){var b=this.get("length");b<c?this.splice.apply(this,[b,0].concat(Array(c-b))):c<b&&this.splice.apply(this,[c,b-c])}else b=this.length,h.prototype.set.call(this,a,c),b!=this.length&&h.prototype.set.call(this,"length",this.length);return this},isInstanceOf:function(a){return h.prototype.isInstanceOf.apply(this,
arguments)||a==e}})};e._meta={bases:[h]};return a.setObject("dojox.mvc.StatefulArray",e)});