//>>built
define("dijit/tree/ObjectStoreModel","dojo/_base/array dojo/aspect dojo/_base/declare dojo/Deferred dojo/_base/lang dojo/when ../Destroyable".split(" "),function(m,t,n,p,h,l,q){return n("dijit.tree.ObjectStoreModel",q,{store:null,labelAttr:"name",labelType:"text",root:null,query:null,constructor:function(a){h.mixin(this,a);this.childrenCache={}},getRoot:function(a,b){if(this.root)a(this.root);else{var c=this.store.query(this.query);c.then&&this.own(c);l(c,h.hitch(this,function(d){if(1!=d.length)throw Error("dijit.tree.ObjectStoreModel: root query returned "+
d.length+" items, but must return exactly one");this.root=d[0];a(this.root);c.observe&&c.observe(h.hitch(this,function(e){this.onChange(e)}),!0)}),b)}},mayHaveChildren:function(){return!0},getChildren:function(a,b,c){var d=this.store.getIdentity(a);if(this.childrenCache[d])l(this.childrenCache[d],b,c);else{var e=this.childrenCache[d]=this.store.getChildren(a);e.then&&this.own(e);e.observe&&this.own(e.observe(h.hitch(this,function(k,f,g){this.onChange(k);f!=g&&l(e,h.hitch(this,"onChildrenChange",a))}),
!0));l(e,b,c)}},isItem:function(){return!0},getIdentity:function(a){return this.store.getIdentity(a)},getLabel:function(a){return a[this.labelAttr]},newItem:function(a,b,c,d){return this.store.put(a,{parent:b,before:d})},pasteItem:function(a,b,c,d,e,k){var f=new p;if(b===c&&!d&&!k)return f.resolve(!0),f;b&&!d?this.getChildren(b,h.hitch(this,function(g){g=[].concat(g);var r=m.indexOf(g,a);g.splice(r,1);this.onChildrenChange(b,g);f.resolve(this.store.put(a,{overwrite:!0,parent:c,oldParent:b,before:k,
isCopy:!1}))})):f.resolve(this.store.put(a,{overwrite:!0,parent:c,oldParent:b,before:k,isCopy:!0}));return f},onChange:function(){},onChildrenChange:function(){},onDelete:function(){}})});