import { c as s } from "../../chunks/runtime.js";
import { ref as c } from "lit/directives/ref.js";
import { css as r, html as a } from "lit";
import { LitElement as l, createEvent as h, nothing as o } from "@arcgis/lumina";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.7 */
const g = r`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(--esri-widget-padding);min-width:180px}.uniform-chart-scaling-label{--calcite-label-margin-bottom: 0}`;
class p extends l {
  constructor() {
    super(...arguments), this._onUniformChartScalingChange = (e) => {
      this.arcgisElevationProfileSettingsUniformChartScalingChange.emit(e.currentTarget.checked);
    }, this._onActionRef = (e) => {
      this._actionElement = e ?? void 0;
    }, this._popoverIsOpen = !1, this.hideUniformChartScalingToggle = !1, this.hideUnitSelector = !1, this.arcgisElevationProfileSettingsUniformChartScalingChange = h();
  }
  static {
    this.properties = { _popoverIsOpen: 16, _actionElement: 16, analysis: 0, hideUniformChartScalingToggle: 5, hideUnitSelector: 5, messages: 0, uniformChartScaling: 5, unitOptionsDistance: 0, unitOptionsElevation: 0 };
  }
  static {
    this.styles = g;
  }
  async destroy() {
    await this.manager.destroy();
  }
  _onPopoverClose() {
    this._popoverIsOpen = !1;
  }
  _onPopoverOpen() {
    this._popoverIsOpen = !0;
  }
  render() {
    const { messages: e } = this;
    if (!e || this.hideUnitSelector && this.hideUniformChartScalingToggle)
      return;
    const t = (this._popoverIsOpen ? e.hideSettings : e.showSettings) ?? "";
    return a`<calcite-action appearance=transparent data-testid=settings-button icon=gear scale=s .text=${t} title=${t ?? o} ${c(this._onActionRef)}></calcite-action>${this._actionElement ? a`<calcite-popover auto-close .label=${t} 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() {
    const { messages: e, hideUnitSelector: t } = this;
    if (t)
      return;
    const i = this.analysis.displayUnits;
    return a`<arcgis-unit-select .options=${this.unitOptionsDistance} .selectLabel=${e.unitDistanceSelectLabel} .value=${i.distance ?? void 0} @arcgisUnitSelectChange=${(n) => {
      i.distance = n.detail;
    }}></arcgis-unit-select><arcgis-unit-select .options=${this.unitOptionsElevation} .selectLabel=${e.unitElevationSelectLabel} .value=${i.elevation ?? void 0} @arcgisUnitSelectChange=${(n) => {
      i.elevation = n.detail;
    }}></arcgis-unit-select>`;
  }
  _renderUniformChartScalingToggle() {
    const { messages: e, hideUniformChartScalingToggle: t, uniformChartScaling: i } = this;
    if (t)
      return;
    const n = e?.[i ? "uniformChartScalingDisable" : "uniformChartScalingEnable"] ?? "";
    return a`<calcite-label class="uniform-chart-scaling-label" layout=inline><calcite-checkbox .checked=${i} class="uniform-chart-scaling-checkbox" title=${n ?? o} @calciteCheckboxChange=${this._onUniformChartScalingChange}></calcite-checkbox>${e?.uniformChartScalingLabel}</calcite-label>`;
  }
}
s("arcgis-elevation-profile-settings", p);
export {
  p as ArcgisElevationProfileSettings
};
