//>>built
define("dijit/tree/ObjectStoreModel",["dojo/_base/array","dojo/aspect","dojo/_base/declare","dojo/_base/lang","dojo/when"],function(h,j,i,e,f){return i("dijit.tree.ObjectStoreModel",null,{store:null,labelAttr:"name",root:null,query:null,constructor:function(a){e.mixin(this,a);this.childrenCache={}},destroy:function(){for(var a in this.childrenCache)this.childrenCache[a].close&&this.childrenCache[a].close()},getRoot:function(a,c){if(this.root)a(this.root);else{var d;f(d=this.store.query(this.query),
e.hitch(this,function(b){if(1!=b.length)throw Error("dijit.tree.ObjectStoreModel: root query returned "+b.length+" items, but must return exactly one");this.root=b[0];a(this.root);d.observe&&d.observe(e.hitch(this,function(a){this.onChange(a)}),!0)}),c)}},mayHaveChildren:function(){return!0},getChildren:function(a,c,d){var b=this.store.getIdentity(a);if(this.childrenCache[b])f(this.childrenCache[b],c,d);else{var g=this.childrenCache[b]=this.store.getChildren(a);f(g,c,d);g.observe&&g.observe(e.hitch(this,
function(b,c,d){this.onChange(b);c!=d&&f(g,e.hitch(this,"onChildrenChange",a))}),!0)}},isItem:function(){return!0},fetchItemByIdentity:function(a){this.store.get(a.identity).then(e.hitch(a.scope,a.onItem),e.hitch(a.scope,a.onError))},getIdentity:function(a){return this.store.getIdentity(a)},getLabel:function(a){return a[this.labelAttr]},newItem:function(a,c,d,b){return this.store.put(a,{parent:c,before:b})},pasteItem:function(a,c,d,b,e,f){b||(b=[].concat(this.childrenCache[this.getIdentity(c)]),e=
h.indexOf(b,a),b.splice(e,1),this.onChildrenChange(c,b));return this.store.put(a,{overwrite:!0,parent:d,before:f})},onChange:function(){},onChildrenChange:function(){},onDelete:function(){}})});