/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ import{_ as s}from"./chunks/tslib.es6.js";import e from"./Basemap.js";import r from"./Ground.js";import t from"./core/Accessor.js";import o from"./core/CollectionFlattener.js";import a from"./core/Evented.js";import{isNone as i}from"./core/maybe.js";import{property as p}from"./core/accessorSupport/decorators/property.js";import"./core/arrayUtils.js";import{cast as l}from"./core/accessorSupport/decorators/cast.js";import{subclass as n}from"./core/accessorSupport/decorators/subclass.js";import{isEditableLayer as m}from"./layers/support/editableLayers.js";import{createCache as d,destroyCache as c,ensureType as y}from"./support/basemapUtils.js";import{createFlattenedTablesCollection as u}from"./support/collectionUtils.js";import{ensureType as h}from"./support/groundUtils.js";import{LayersMixin as b}from"./support/LayersMixin.js";import{TablesMixin as f}from"./support/TablesMixin.js";let j=class extends(f(b(a.EventedMixin(t)))){constructor(s){super(s),this.allLayers=new o({getCollections:()=>[this.basemap?.baseLayers,this.ground?.layers,this.layers,this.basemap?.referenceLayers],getChildrenFunction:s=>"layers"in s?s.layers:null}),this.allTables=u(this),this.basemap=null,this.editableLayers=new o({getCollections:()=>[this.allLayers],itemFilterFunction:m}),this.ground=new r,this._basemapCache=d()}destroy(){this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),this.ground?.destroy(),this.basemap?.destroy(),c(this._basemapCache),this._basemapCache=null}castBasemap(s){return y(s,this._basemapCache)}castGround(s){const e=h(s);return i(e)?this._get("ground"):e}findLayerById(s){return this.allLayers.find((e=>e.id===s))}findTableById(s){return this.allTables.find((e=>e.id===s))}};s([p({readOnly:!0,dependsOn:[]})],j.prototype,"allLayers",void 0),s([p({readOnly:!0})],j.prototype,"allTables",void 0),s([p({type:e})],j.prototype,"basemap",void 0),s([l("basemap")],j.prototype,"castBasemap",null),s([p({readOnly:!0})],j.prototype,"editableLayers",void 0),s([p({type:r,nonNullable:!0})],j.prototype,"ground",void 0),s([l("ground")],j.prototype,"castGround",null),j=s([n("esri.Map")],j);const L=j;export{L as default};