/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import i from"../../../core/ReactiveMap.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";let n=class extends e{constructor(){super(...arguments),this._values=new i,this.availablePlugins=()=>[]}get availableSettingDefinitions(){const t=new Map;for(const e of this.availablePlugins()){const i=e.settings;if(i)for(const e of Object.getOwnPropertySymbols(i)){const s=i[e];s&&t.set(e,s)}}return t}get hasSettings(){return this.availableSettingDefinitions.size>0}get settings(){return Array.from(this.availableSettingDefinitions.entries()).map(([t,e])=>{const i=this.getValue(t);return null==i?null:{settingKey:t,definition:e,value:i}}).filter(t=>null!=t)}getValue(t){const e=this.availableSettingDefinitions.get(t);if(e)return this._values.get(t)??e.default}getDefinition(t){return this.availableSettingDefinitions.get(t)}setValue(t,e){this.availableSettingDefinitions.get(t)&&"boolean"==typeof e&&this._values.get(t)!==e&&this._values.set(t,e)}};t([s()],n.prototype,"availablePlugins",void 0),t([s()],n.prototype,"availableSettingDefinitions",null),t([s()],n.prototype,"hasSettings",null),t([s()],n.prototype,"settings",null),n=t([o("esri.widgets.Sketch.support.SettingsManager")],n);export{n as SettingsManager};
