//>>built
define("dojox/data/util/JsonQuery",["dojo","dojox"],function(h,g){return h.declare("dojox.data.util.JsonQuery",null,{useFullIdInQueries:!1,_toJsonQuery:function(a,b){function g(b,e){var m=e.__id;if(m){var c={};c[k.idAttribute]=k.useFullIdInQueries?e.__id:e[k.idAttribute];e=c}for(var d in e){var c=e[d],n=b+(/^[a-zA-Z_][\w_]*$/.test(d)?"."+d:"["+h._escapeString(d)+"]");c&&"object"==typeof c?g(n,c):"*"!=c&&(l+=(f?"":"\x26")+n+(!m&&"string"==typeof c&&a.queryOptions&&a.queryOptions.ignoreCase?"~":"\x3d")+
(k.simplifiedQuery?encodeURIComponent(c):h.toJson(c)),f=!1)}}var f=!0,k=this;if(a.query&&"object"==typeof a.query){var l="[?(";g("@",a.query);l=f?"":l+")]";a.queryStr=l.replace(/\\"|"/g,function(a){return'"'==a?"'":a})}else a.query&&"*"!=a.query||(a.query="");var d=a.sort;if(d){a.queryStr=a.queryStr||("string"==typeof a.query?a.query:"");f=!0;for(i=0;i<d.length;i++)a.queryStr+=(f?"[":",")+(d[i].descending?"\\":"/")+"@["+h._escapeString(d[i].attribute)+"]",f=!1;a.queryStr+="]"}b&&(a.start||a.count)&&
(a.queryStr=(a.queryStr||("string"==typeof a.query?a.query:""))+"["+(a.start||"")+":"+(a.count?(a.start||0)+a.count:"")+"]");return"string"==typeof a.queryStr?(a.queryStr=a.queryStr.replace(/\\"|"/g,function(a){return'"'==a?"'":a}),a.queryStr):a.query},jsonQueryPagination:!0,fetch:function(a){this._toJsonQuery(a,this.jsonQueryPagination);return this.inherited(arguments)},isUpdateable:function(){return!0},matchesQuery:function(a,b){b._jsonQuery=b._jsonQuery||g.json.query(this._toJsonQuery(b));return b._jsonQuery([a]).length},
clientSideFetch:function(a,b){a._jsonQuery=a._jsonQuery||g.json.query(this._toJsonQuery(a));return this.clientSidePaging(a,a._jsonQuery(b))},querySuperSet:function(a,b){return a.query?this.inherited(arguments):b.query}})});