/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{a as c}from"./WCESLPME.js";import{N as h,O as p,R as s,U as g,a as l,b as t,x as r}from"./GRFF5Y4R.js";import"./ALDX5YZO.js";var d=l`:host{--arcgis-unit-select-inline-size: 180px}calcite-popover[calcite-hydrated-hidden]{inset-block-start:-999999px;inset-inline-start:-999999px}.popover-content{display:flex;flex-direction:column;gap:var(--calcite-spacing-md);padding:var(--calcite-spacing-md);max-width:300px}.uniform-chart-scaling-label{--calcite-label-margin-bottom: 0}.uniform-chart-scaling-checkbox-wrapper{width:var(--arcgis-unit-select-inline-size);flex-shrink:0}`,o=class extends p{constructor(){super(...arguments),this._onUniformChartScalingChange=e=>{this.arcgisElevationProfileSettingsUniformChartScalingChange.emit(e.currentTarget.checked)},this._onActionRef=e=>{this._actionElement=e??void 0},this._popoverIsOpen=!1,this.hideDistanceDisplayUnitSelect=!1,this.hideElevationDisplayUnitSelect=!1,this.hideUniformChartScalingToggle=!1,this.arcgisElevationProfileSettingsUniformChartScalingChange=r()}static{this.properties={_popoverIsOpen:16,_actionElement:16,viewModel:0,hideDistanceDisplayUnitSelect:5,hideElevationDisplayUnitSelect:5,hideUniformChartScalingToggle:5,messages:0,uniformChartScaling:5,unitOptionsDistance:0,unitOptionsElevation:0}}static{this.styles=d}async destroy(){await this.manager.destroy()}_onPopoverClose(){this._popoverIsOpen=!1}_onPopoverOpen(){this._popoverIsOpen=!0}render(){let{messages:e}=this;if(!e||this.hideDistanceDisplayUnitSelect&&this.hideElevationDisplayUnitSelect&&this.hideUniformChartScalingToggle)return;let i=(this._popoverIsOpen?e.hideSettings:e.showSettings)??"";return t`<calcite-action data-testid=settings-button icon=gear .text=${i} title=${i??s} ${h(this._onActionRef)}></calcite-action>${this._actionElement?t`<calcite-popover auto-close .label=${i} placement=bottom-end .referenceElement=${this._actionElement} @calcitePopoverOpen=${this._onPopoverOpen} @calcitePopoverClose=${this._onPopoverClose}><div class="popover-content">${this._renderUnitSelector()}${this._renderUniformChartScalingToggle()}</div></calcite-popover>`:void 0}`}_renderUnitSelector(){let{viewModel:e,messages:i}=this;if(!e||this.hideDistanceDisplayUnitSelect&&this.hideElevationDisplayUnitSelect)return;let n="inline-space-between";return t`${c({hidden:this.hideDistanceDisplayUnitSelect,children:t`<arcgis-unit-select .options=${this.unitOptionsDistance} .selectLabel=${i.unitDistanceSelectLabel} .value=${e.distanceUnit} .layout=${n} @arcgisUnitSelectChange=${a=>{e.distanceUnit=a.detail}}></arcgis-unit-select>`})}${c({hidden:this.hideElevationDisplayUnitSelect,children:t`<arcgis-unit-select .options=${this.unitOptionsElevation} .selectLabel=${i.unitElevationSelectLabel} .value=${e.elevationUnit} .layout=${n} @arcgisUnitSelectChange=${a=>{e.elevationUnit=a.detail}}></arcgis-unit-select>`})}`}_renderUniformChartScalingToggle(){let{messages:e,hideUniformChartScalingToggle:i,uniformChartScaling:n}=this;if(i)return;let a=e?.[n?"uniformChartScalingDisable":"uniformChartScalingEnable"]??"";return t`<calcite-label class="uniform-chart-scaling-label" layout=inline-space-between>${e?.uniformChartScalingLabel}<div class="uniform-chart-scaling-checkbox-wrapper"><calcite-checkbox .checked=${n} title=${a??s} @calciteCheckboxChange=${this._onUniformChartScalingChange}></calcite-checkbox></div></calcite-label>`}};g("arcgis-elevation-profile-settings",o);export{o as ArcgisElevationProfileSettings};
