(function(){"use strict";u8.Base.ObservableList=function(e){this._list=e&&e.list||[];this.bind(e)};u8.Base.ObservableList.makeClass({name:"ObservableList",events:["Change"],mixins:[u8.Base.Collection,u8.Base.List]});$.extend(u8.Base.ObservableList.prototype,{attach:function(e){if(!e||!u8.tools.isArray(e)){return this._list}var t=this._list;this._list=e;this.raise("Change",{reason:"Attach"});return t},at:function(e,t){if(typeof t=="undefined"){return this._list.at(e)}else{this._list.at(e,t);this.raise("Change",{reason:"Change",index:e,value:t});return t}},removeAt:function(e,t){var i=typeof e;if(i=="object"&&u8.tools.isArray(e)){var s,n=e,r=n.length;n.sort(u8._.compare);for(s=0;s<r;s++){this.removeAt(n[s]-s,true)}this.raise("Change",{reason:"Remove",index:e});return undefined}var a=this._list.removeAt(e);if(i=="undefined"){e=this._list.size()}if(!t){this.raise("Change",{reason:"Remove",index:e,value:a})}return a},iterate:function(e){var t=false;var i=this;var s={remove:function(){if(!t){i.removeAt(n);n--;t=true}}};for(var n=0;n<this.size();n++){t=false;s.key=n;s.value=this.at(n);s.collection=this;if(e.apply(s)===false){break}}},size:function(){return this._list.size()},insert:function(e,t){this._list.insert(e,t);if(typeof t=="undefined"&&typeof e!="undefined"){t=e;e=undefined}if(typeof e=="undefined"){e=this._list.size()-1}this.raise("Change",{reason:"Insert",index:e,value:t})}})})();