//>>built define(["dojo/_base/declare","dojo/_base/lang","dojo/when","./getStateful","./ModelRefController"],function(h,e,f,g,k){return h("dojox.mvc.StoreRefController",k,{store:null,getStatefulOptions:null,_refSourceModelProp:"model",queryStore:function(a,b){if((this.store||{}).query){this._queryObserveHandle&&this._queryObserveHandle.cancel();var c=this;a=this.store.query(a,b);b=f(a,function(a){if(!c._beingDestroyed)return a=g(a,c.getStatefulOptions),c.set(c._refSourceModelProp,a),a});b.then&&(b=e.delegate(b)); for(var d in a)isNaN(d)&&a.hasOwnProperty(d)&&e.isFunction(a[d])&&(b[d]=a[d]);return b}},getStore:function(a,b){if((this.store||{}).get){this._queryObserveHandle&&this._queryObserveHandle.cancel();var c=this;return result=f(this.store.get(a,b),function(a){if(!c._beingDestroyed)return a=g(a,c.getStatefulOptions),c.set(c._refSourceModelProp,a),a})}},putStore:function(a,b){if((this.store||{}).put)return this.store.put(a,b)},addStore:function(a,b){if((this.store||{}).add)return this.store.add(a,b)},removeStore:function(a, b){if((this.store||{}).remove)return this.store.remove(a,b)}})});