/*
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/HandleOwner","../../core/Identifiable","../../core/reactiveUtils","../../core/accessorSupport/decorators/aliasOf","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/property","../../core/accessorSupport/decorators/subclass","../../support/actions/ActionBase","../../support/actions/ActionButton","../../support/actions/ActionSlider","../../support/actions/ActionToggle"],(function(e,t,o,r,i,s,n,a,c,l,p,d,u,y,h,_,f){"use strict";var v;const b=r.ofType({key:"type",defaultKeyValue:"button",base:y,typeMap:{button:h,toggle:f,slider:_}}),g=r.ofType(b),w="layer",m="esri.widgets.TableList.ListItem";let I=v=function(t){function o(e){var o;return(o=t.call(this,e)||this).actionsSections=new g,o.actionsOpen=!1,o.error=null,o.hidden=!1,o.layer=null,o.listItemCreatedFunction=null,o}e._inheritsLoose(o,t);var r=o.prototype;return r.initialize=function(){if(this.handles.add(n.watch((()=>this.layer),(e=>this._watchLayerProperties(e)),n.initial)),"function"==typeof this.listItemCreatedFunction){const e={item:this};this.listItemCreatedFunction.call(null,e)}},r.clone=function(){return new v({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,title:this.title})},r._watchLayerProperties=function(e){this.handles&&(this.handles.remove(w),e&&this.handles.add(n.watch((()=>e.listMode),(()=>this._watchLayerProperties(e))),w))},e._createClass(o,[{key:"title",get:function(){const e=this.get("layer.layer");return(!e||e&&this.get("layer.layer.loaded"))&&this.get("layer.title")||""},set:function(e){void 0!==e?this._override("title",e):this._clearOverride("title")}}]),o}(s.IdentifiableMixin(i.HandleOwnerMixin(o)));t.__decorate([d.property({type:g})],I.prototype,"actionsSections",void 0),t.__decorate([d.property()],I.prototype,"actionsOpen",void 0),t.__decorate([a.aliasOf("layer.loadError?")],I.prototype,"error",void 0),t.__decorate([d.property()],I.prototype,"hidden",void 0),t.__decorate([d.property()],I.prototype,"layer",void 0),t.__decorate([d.property()],I.prototype,"listItemCreatedFunction",void 0),t.__decorate([d.property()],I.prototype,"title",null),I=v=t.__decorate([u.subclass(m)],I);return I}));
