/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import{property as t,subclass as o}from"../../core/accessorSupport/decorators.js";import s from"../Widget.js";import{SettingsManager as i}from"../Sketch/support/SettingsManager.js";import{loadCalciteComponents as n}from"./componentsUtils.js";import{globalCss as l}from"./globalCss.js";import{loadLabeledSwitchComponents as r,LabeledSwitch as a}from"./LabeledSwitch.js";import{messageBundle as c,tsx as d}from"./widget.js";const p="esri-plugin-settings-controls",g={base:p,block:`${p}__block`,blockContent:`${p}__block-content`,controlRow:`${p}__control-row`};let b=class extends s{constructor(e,t){super(e,t),this._blockExpanded=!1,this.viewModel=null}loadDependencies(){return Promise.all([n({block:()=>import("@esri/calcite-components/dist/components/calcite-block")}),r()])}render(){const e=this.settingsManager.settings,t=this._resolveMessage("settings.toolOptionsHeading");return d("div",{"aria-label":t,class:this.classes(g.base,l.widget)},e.length?d("calcite-block",{class:g.block,collapsible:!0,expanded:this._blockExpanded,heading:t,label:t,onCalciteBlockClose:()=>this._blockExpanded=!1,onCalciteBlockOpen:()=>this._blockExpanded=!0},d("div",{class:g.blockContent},e.map(e=>this._renderSetting(e)))):void 0)}_renderSetting(e){const{definition:t,settingKey:o,value:s}=e;return d("div",{class:g.controlRow,key:String(o)},d(a,{checked:s,hint:t.descriptionLocalizationKey?this._resolveMessage(t.descriptionLocalizationKey):void 0,key:`${String(o)}-toggle`,label:this._resolveMessage(t.titleLocalizationKey),topLayerDisabled:this.topLayerDisabled,onChange:e=>this.settingsManager.setValue(o,e)}))}_resolveMessage(e){const t=e.split(".").reduce((e,t)=>e?.[t],this.messages);return"string"==typeof t?t:e}};e([t({nonNullable:!0,type:i})],b.prototype,"settingsManager",void 0),e([t()],b.prototype,"_blockExpanded",void 0),e([t(),c("esri/widgets/Sketch/t9n/Sketch")],b.prototype,"messages",void 0),b=e([o("esri.widgets.support.PluginSettingsControls")],b);const m=b;export{m as default};
