//>>built
define("dojox/data/RailsStore",["dojo","dojox","dojox/data/JsonRestStore"],function(d,k){return d.declare("dojox.data.RailsStore",k.data.JsonRestStore,{constructor:function(){},preamble:function(a){if("string"==typeof a.target&&!a.service){var f=a.target.replace(/\/$/g,"");a.service=k.rpc.Rest(this.target,!0,null,function(c,b){b=b||{};var h=f;if(d.isObject(c)){var e="";var g="?"+d.objectToQuery(c)}else b.queryStr&&-1!=b.queryStr.indexOf("?")?(e=b.queryStr.replace(/\?.*/,""),g=b.queryStr.replace(/[^?]*\?/g,
"?")):d.isString(b.query)&&-1!=b.query.indexOf("?")?(e=b.query.replace(/\?.*/,""),g=b.query.replace(/[^?]*\?/g,"?")):(e=c?c.toString():"",g="");-1!=e.indexOf("\x3d")&&(g=e,e="");var l=k.rpc._sync;k.rpc._sync=!1;return{url:e?h+"/"+e+".json"+g:h+".json"+g,handleAs:"json",contentType:"application/json",sync:l,headers:{Accept:"application/json,application/javascript",Range:b&&(0<=b.start||0<=b.count)?"items\x3d"+(b.start||"0")+"-"+(b.count&&b.count+(b.start||0)-1||""):void 0}}})}},fetch:function(a){function f(b){null==
a.queryStr&&(null==a.queryStr&&(a.queryStr=""),d.isObject(a.query)?a.queryStr="?"+d.objectToQuery(a.query):d.isString(a.query)&&(a.queryStr=a.query));var h=a,e=a.queryStr;var g=-1==a.queryStr.indexOf("?")?"?":"\x26";h.queryStr=e+g+d.objectToQuery(b)}a=a||{};if(a.start||a.count){if((a.start||0)%a.count)throw Error("The start parameter must be a multiple of the count parameter");f({page:(a.start||0)/a.count+1,per_page:a.count})}if(a.sort){var c={sortBy:[],sortDir:[]};d.forEach(a.sort,function(b){c.sortBy.push(b.attribute);
c.sortDir.push(b.descending?"DESC":"ASC")});f(c);delete a.sort}return this.inherited(arguments)},_processResults:function(a,f){if("undefined"==typeof this.rootAttribute&&a[0])if(a[0][this.idAttribute])this.rootAttribute=!1;else for(c in a[0])a[0][c][this.idAttribute]&&(this.rootAttribute=c);var c=this.rootAttribute?d.map(a,function(h){return h[this.rootAttribute]},this):a;var b=a.length;return{totalCount:f.fullLength||(f.request.count==b?(f.request.start||0)+2*b:b),items:c}}})});