define("dojo/store/DataStore",["../_base/lang","../_base/declare","../Deferred","../_base/array","./util/QueryResults","./util/SimpleQueryEngine"],function(_1,_2,_3,_4,_5,_6){var_7=null;return_2("dojo.store.DataStore",_7,{target:"",constructor:function(_8){_1.mixin(this,_8);if(!("idProperty"in_8)){var_9;try{_9=this.store.getIdentityAttributes();}catch(e){}this.idProperty=(_1.isArray(_9)?_9[0]:_9)||this.idProperty;}var_a=this.store.getFeatures();if(!_a["dojo.data.api.Read"]){this.get=null;}if(!_a["dojo.data.api.Identity"]){this.getIdentity=null;}if(!_a["dojo.data.api.Write"]){this.put=this.add=null;}},idProperty:"id",store:null,queryEngine:_6,_objectConverter:function(_b){var_c=this.store;var_d=this.idProperty;function_e(_f){var_10={};var_11=_c.getAttributes(_f);for(vari=0;i<_11.length;i++){var_12=_11[i];var_13=_c.getValues(_f,_12);if(_13.length>1){for(varj=0;j<_13.length;j++){var_14=_13[j];if(typeof_14=="object"&&_c.isItem(_14)){_13[j]=_e(_14);}}_14=_13;}else{var_14=_c.getValue(_f,_12);if(typeof_14=="object"&&_c.isItem(_14)){_14=_e(_14);}}_10[_11[i]]=_14;}if(!(_din_10)&&_c.getIdentity){_10[_d]=_c.getIdentity(_f);}return_10;};returnfunction(_15){return_b(_15&&_e(_15));};},get:function(id,_16){var_17,_18;var_19=new_3();this.store.fetchItemByIdentity({identity:id,onItem:this._objectConverter(function(_1a){_19.resolve(_17=_1a);}),onError:function(_1b){_19.reject(_18=_1b);}});if(_17!==undefined){return_17==null?undefined:_17;}if(_18){throw_18;}return_19.promise;},put:function(_1c,_1d){_1d=_1d||{};varid=typeof_1d.id!="undefined"?_1d.id:this.getIdentity(_1c);var_1e=this.store;var_1f=this.idProperty;var_20=new_3();if(typeofid=="undefined"){var_21=_1e.newItem(_1c);_1e.save({onComplete:function(){_20.resolve(_21);},onError:function(_22){_20.reject(_22);}});}else{_1e.fetchItemByIdentity({identity:id,onItem:function(_23){if(_23){if(_1d.overwrite===false){return_20.reject(newError("Overwriting existing object not allowed"));}for(variin_1c){if(i!=_1f&&_1c.hasOwnProperty(i)&&_1e.getValue(_23,i)!=_1c[i]){_1e.setValue(_23,i,_1c[i]);}}}else{if(_1d.overwrite===true){return_20.reject(newError("Creating new object not allowed"));}var_23=_1e.newItem(_1c);}_1e.save({onComplete:function(){_20.resolve(_23);},onError:function(_24){_20.reject(_24);}});},onError:function(_25){_20.reject(_25);}});}return_20.promise;},add:function(_26,_27){(_27=_27||{}).overwrite=false;returnthis.put(_26,_27);},remove:function(id){var_28=this.store;var_29=new_3();this.store.fetchItemByIdentity({identity:id,onItem:function(_2a){try{if(_2a==null){_29.resolve(false);}else{_28.deleteItem(_2a);_28.save();_29.resolve(true);}}catch(error){_29.reject(error);}},onError:function(_2b){_29.reject(_2b);}});return_29.promise;},query:function(_2c,_2d){var_2e;var_2f=new_3(function(){_2e.abort&&_2e.abort();});_2f.total=new_3();var_30=this._objectConverter(function(_31){return_31;});_2e=this.store.fetch(_1.mixin({query:_2c,onBegin:function(_32){_2f.total.resolve(_32);},onComplete:function(_33){_2f.resolve(_4.map(_33,_30));},onError:function(_34){_2f.reject(_34);}},_2d));return_5(_2f);},getIdentity:function(_35){return_35[this.idProperty];}});});