// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/FeatureTable/storeUtils","./dataUtils dojo/_base/array dojo/_base/lang dojo/store/Cache dojo/store/Memory dojo/store/Observable dojo/store/util/QueryResults ../FeatureLayerQueryStore".split(" "),function(m,p,x,q,n,r,t,u){return{generateMemoryStore:function(a){var b=a.idProperty;a=p.map(a.features,function(a){return a.attributes});return new r(new n({data:a,idProperty:b}))},generateCacheStore:function(a){var b=a.grid,h=a.layer,c=a.ids||null,l=c&&c.length?c.length:b.featureCount,
k=a.orderByFields,v=a.where||null,w=a.batchCount||25,g=a.getAttachments||!1;a=a.getRelatedRecords||!1;b=new n({idProperty:b.idProperty});h=new u({layer:h,objectIds:c,totalCount:l,batchCount:w,where:v||"1\x3d1",orderByFields:k,getAttachments:g,getRelatedRecords:a});return new q(h,b)},generateSort:function(a,b,h,c){var l=function(){return function(b,c){var g=k[0],d=parseInt(g.columnId,10),e=g.attribute,f;"esriAttachments"!==e&&"esriRelatedRecords"!==g.fieldType||"undefined"===typeof d?(f=b[e]&&b[e].toLowerCase?
b[e].toLowerCase():b[e],d=c[e]&&c[e].toLowerCase?c[e].toLowerCase():c[e]):(f=a.columns[d].get(b),d=a.columns[d].get(c));f=m.isValueEmpty(f)?null:f.valueOf();d=m.isValueEmpty(d)?null:d.valueOf();return null===f&&null!==d?g.descending?-1:1:null!==f&&null===d?g.descending?1:-1:f===d?0:(f>d?1:-1)*(g.descending?-1:1)}},k=c&&c.sort;k&&"function"!==typeof k&&(c.sort=l());return new t(b.queryEngine(h,c)(b.data))}}});