//>>built define("dojox/rpc/JsonRest",["dojo","dojox","dojox/json/ref","dojox/rpc/Rest"],function(p,g){function u(a,c,b,d){(c=c.ioArgs&&c.ioArgs.xhr&&c.ioArgs.xhr.getResponseHeader("Last-Modified"))&&q._timeStamps&&(q._timeStamps[d]=c);var e=a._schema&&a._schema.hrefProperty;e&&(g.json.ref.refAttribute=e);b=b&&g.json.ref.resolveJson(b,{defaultId:d,index:q._index,timeStamps:c&&q._timeStamps,time:c,idPrefix:a._store.allowNoTrailingSlash?a.servicePath+"/":a.servicePath.replace(/[^\/]*$/,""),idAttribute:l.getIdAttribute(a), schemas:l.schemas,loader:l._loader,idAsRef:a.idAsRef,assignAbsoluteIds:!0});g.json.ref.refAttribute="$ref";return b}var m=[],q=g.rpc.Rest,l;l=g.rpc.JsonRest={serviceClass:g.rpc.Rest,conflictDateHeader:"If-Unmodified-Since",commit:function(a){a=a||{};for(var c=[],b={},d=[],e=0;e=c.length&&(c=b);if(c)return{service:l.services[c],id:a.substring(c.length)};a=a.match(/^(.*\/)([^\/]*)$/);return{service:new l.serviceClass(a[1],!0),id:a[2]}},services:{},schemas:{},registerService:function(a, c,b){c=a.servicePath=c||a.servicePath;a._schema=l.schemas[c]=b||a._schema||{};l.services[c]=a},byId:function(a,c){var b=q._index[(a.servicePath||"")+c];return b&&!b._loadObject?(a=new p.Deferred,a.callback(b),a):this.query(a,c)},query:function(a,c,b){var d=a(c,b);d.addCallback(function(e){return e.nodeType&&e.cloneNode?e:u(a,d,e,"string"!=typeof c||b&&(b.start||b.count)?void 0:c)});return d},_loader:function(a){var c=l.getServiceAndId(this.__id),b=this;l.query(c.service,c.id).addBoth(function(c){c== b?(delete c.$ref,delete c._loadObject):b._loadObject=function(a){a(c)};a(c)})},isDirty:function(a,c){return a?a.__isDirty:c?p.some(m,function(a){return g.data._getStoreForItem(a.object||a.old)==c}):!!m.length}};return g.rpc.JsonRest});