define("dojo/data/ItemFileWriteStore",["../_base/lang","../_base/declare","../_base/array","../_base/json","../_base/kernel","./ItemFileReadStore","../date/stamp"],function(_1,_2,_3,_4,_5,_6,_7){return_2("dojo.data.ItemFileWriteStore",_6,{constructor:function(_8){this._features["dojo.data.api.Write"]=true;this._features["dojo.data.api.Notification"]=true;this._pending={_newItems:{},_modifiedItems:{},_deletedItems:{}};if(!this._datatypeMap["Date"].serialize){this._datatypeMap["Date"].serialize=function(_9){return_7.toISOString(_9,{zulu:true});};}if(_8&&(_8.referenceIntegrity===false)){this.referenceIntegrity=false;}this._saveInProgress=false;},referenceIntegrity:true,_assert:function(_a){if(!_a){thrownewError("assertion failed in ItemFileWriteStore");}},_getIdentifierAttribute:function(){returnthis.getFeatures()["dojo.data.api.Identity"];},newItem:function(_b,_c){this._assert(!this._saveInProgress);if(!this._loadFinished){this._forceLoad();}if(typeof_b!="object"&&typeof_b!="undefined"){thrownewError("newItem() was passed something other than an object");}var_d=null;var_e=this._getIdentifierAttribute();if(_e===Number){_d=this._arrayOfAllItems.length;}else{_d=_b[_e];if(typeof_d==="undefined"){thrownewError("newItem() was not passed an identity for the new item");}if(_1.isArray(_d)){thrownewError("newItem() was not passed an single-valued identity");}}if(this._itemsByIdentity){this._assert(typeofthis._itemsByIdentity[_d]==="undefined");}this._assert(typeofthis._pending._newItems[_d]==="undefined");this._assert(typeofthis._pending._deletedItems[_d]==="undefined");var_f={};_f[this._storeRefPropName]=this;_f[this._itemNumPropName]=this._arrayOfAllItems.length;if(this._itemsByIdentity){this._itemsByIdentity[_d]=_f;_f[_e]=[_d];}this._arrayOfAllItems.push(_f);var_10=null;if(_c&&_c.parent&&_c.attribute){_10={item:_c.parent,attribute:_c.attribute,oldValue:undefined};var_11=this.getValues(_c.parent,_c.attribute);if(_11&&_11.length>0){var_12=_11.slice(0,_11.length);if(_11.length===1){_10.oldValue=_11[0];}else{_10.oldValue=_11.slice(0,_11.length);}_12.push(_f);this._setValueOrValues(_c.parent,_c.attribute,_12,false);_10.newValue=this.getValues(_c.parent,_c.attribute);}else{this._setValueOrValues(_c.parent,_c.attribute,_f,false);_10.newValue=_f;}}else{_f[this._rootItemPropName]=true;this._arrayOfTopLevelItems.push(_f);}this._pending._newItems[_d]=_f;for(varkeyin_b){if(key===this._storeRefPropName||key===this._itemNumPropName){thrownewError("encountered bug in ItemFileWriteStore.newItem");}var_13=_b[key];if(!_1.isArray(_13)){_13=[_13];}_f[key]=_13;if(this.referenceIntegrity){for(vari=0;i<_13.length;i++){varval=_13[i];if(this.isItem(val)){this._addReferenceToMap(val,_f,key);}}}}this.onNew(_f,_10);return_f;},_removeArrayElement:function(_14,_15){var_16=_3.indexOf(_14,_15);if(_16!=-1){_14.splice(_16,1);returntrue;}returnfalse;},deleteItem:function(_17){this._assert(!this._saveInProgress);this._assertIsItem(_17);var_18=_17[this._itemNumPropName];var_19=this.getIdentity(_17);if(this.referenceIntegrity){var_1a=this.getAttributes(_17);if(_17[this._reverseRefMap]){_17["backup_"+this._reverseRefMap]=_1.clone(_17[this._reverseRefMap]);}_3.forEach(_1a,function(_1b){_3.forEach(this.getValues(_17,_1b),function(_1c){if(this.isItem(_1c)){if(!_17["backupRefs_"+this._reverseRefMap]){_17["backupRefs_"+this._reverseRefMap]=[];}_17["backupRefs_"+this._reverseRefMap].push({id:this.getIdentity(_1c),attr:_1b});this._removeReferenceFromMap(_1c,_17,_1b);}},this);},this);var_1d=_17[this._reverseRefMap];if(_1d){for(var_1ein_1d){var_1f=null;if(this._itemsByIdentity){_1f=this._itemsByIdentity[_1e];}else{_1f=this._arrayOfAllItems[_1e];}if(_1f){for(var_20in_1d[_1e]){var_21=this.getValues(_1f,_20)||[];var_22=_3.filter(_21,function(_23){return!(this.isItem(_23)&&this.getIdentity(_23)==_19);},this);this._removeReferenceFromMap(_17,_1f,_20);if(_22.length<_21.length){this._setValueOrValues(_1f,_20,_22,true);}}}}}}this._arrayOfAllItems[_18]=null;_17[this._storeRefPropName]=null;if(this._itemsByIdentity){deletethis._itemsByI