/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../chunks/_rollupPluginBabelHelpers","../../../../chunks/tslib.es6","../../../../core/Accessor","../../../../core/Collection","../../../../core/accessorSupport/decorators/property","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/ensureType","../../../../core/accessorSupport/decorators/subclass"],(function(e,t,r,n,o,c,i,a,s){"use strict";const u="esri.widgets.FeatureTable.Grid.support.LocalStore";let p=function(t){function r(){var e;return(e=t.apply(this,arguments)||this).itemCache=new n,e.state="ready",e}e._inheritsLoose(r,t);var o=r.prototype;return o.destroy=function(){this.itemCache.destroy(),this._set("itemCache",null)},o.addItems=function(){var t=e._asyncToGenerator((function*(e){this.itemCache.addMany(null==e?void 0:e.items)}));function r(e){return t.apply(this,arguments)}return r}(),o.fetchItems=function(){var t=e._asyncToGenerator((function*(e){const{page:t,pageSize:r}=e,n=t*r;return this.itemCache.items.slice(n,n+r)}));function r(e){return t.apply(this,arguments)}return r}(),o.getLocalItemAt=function(e){return this.itemCache.getItemAt(e)},o.getItemAt=function(e){return Promise.resolve(this.itemCache.getItemAt(e))},o.load=function(){var t=e._asyncToGenerator((function*(){}));function r(){return t.apply(this,arguments)}return r}(),o.query=function(e){return this.fetchItems(e)},o.removeItemAt=function(){var t=e._asyncToGenerator((function*(e){this.itemCache.removeAt(e)}));function r(e){return t.apply(this,arguments)}return r}(),o.reset=function(){var t=e._asyncToGenerator((function*(){this.itemCache.removeAll()}));function r(){return t.apply(this,arguments)}return r}(),o.updateItem=function(){var t=e._asyncToGenerator((function*(e){const{index:t,name:r,value:n}=e,o=this.itemCache.getItemAt(t);o&&r&&o[r]&&(o[r]=n)}));function r(e){return t.apply(this,arguments)}return r}(),e._createClass(r,[{key:"count",get:function(){var e;return(null==(e=this.itemCache)?void 0:e.length)||0}}]),r}(r);t.__decorate([o.property({readOnly:!0})],p.prototype,"count",null),t.__decorate([o.property()],p.prototype,"itemCache",void 0),t.__decorate([o.property({readOnly:!0})],p.prototype,"state",void 0),p=t.__decorate([s.subclass(u)],p);return p}));
