/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import { c as i } from "../../chunks/runtime.js";
import { css as a, html as o } from "lit";
import "@arcgis/toolkit/intl";
import "lodash-es";
import "luxon";
import "d3-array";
import "@arcgis/toolkit/type";
import "../../chunks/series-types.js";
import { f as r } from "../../chunks/rest-js-object-literals.js";
import "../../chunks/index.js";
import "@arcgis/core/Graphic.js";
import "@arcgis/core/renderers/support/jsonUtils.js";
import "@arcgis/core/symbols/support/symbolUtils.js";
import "@esri/arcgis-html-sanitizer";
import "@arcgis/core/intl.js";
import "@arcgis/core/layers/support/FeatureFilter.js";
import "@arcgis/core/smartMapping/statistics/histogram.js";
import "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
import "simple-statistics";
import "@arcgis/core/request.js";
import "@arcgis/core/core/sql.js";
import "@arcgis/core/AttributeBinsGraphic.js";
import "@arcgis/core/geometry/support/jsonUtils.js";
import "@arcgis/core/rest/support/AttributeBinsQuery.js";
import "@arcgis/core/rest/support/StatisticDefinition.js";
import "@arcgis/core/time/TimeExtent.js";
import "@arcgis/core/core/promiseUtils.js";
import "@arcgis/toolkit/dom";
import { e as l } from "../../chunks/popover-ui-utils.js";
import { u as p } from "../../chunks/useT9n.js";
import { createRef as n, ref as m } from "lit/directives/ref.js";
import { LitElement as c, createEvent as s, safeClassMap as h } from "@arcgis/lumina";
const g = {
  jsAppFlyout: "js-app-flyout"
}, C = a``;
class f extends c {
  constructor() {
    super(...arguments), this._messages = p(), this.popoverElement = n(), this.placement = "leading", this.arcgisChartsConfigFormatPopoverColorChange = s(), this.arcgisChartsConfigFormatPopoverSymbolChange = s(), this.arcgisChartsConfigFormatPopoverTextChange = s(), this.arcgisChartsConfigPopoverClose = s();
  }
  static {
    this.properties = { messageOverrides: 0, selectedElement: 0, referenceElement: 0, placement: 1, open: 5 };
  }
  static {
    this.styles = C;
  }
  async reposition() {
    await this.popoverElement.value?.reposition();
  }
  updated() {
    l(this.popoverElement.value, this.open);
  }
  closePopover() {
    this.open = !1, this.arcgisChartsConfigPopoverClose.emit();
  }
  updateSymbolProperties(e) {
    this.selectedElement = e.target.lineStyle, this.arcgisChartsConfigFormatPopoverSymbolChange.emit(e.detail);
  }
  updateTextProperties(e) {
    this.selectedElement = e.target.fontStyle, this.arcgisChartsConfigFormatPopoverTextChange.emit(e.detail);
  }
  updateColorProperties(e) {
    this.selectedElement = e.detail, this.arcgisChartsConfigFormatPopoverColorChange.emit(e.detail);
  }
  render() {
    const e = this.selectedElement, t = this.selectedElement;
    return o`<div class=${h(g.jsAppFlyout)}><calcite-popover .referenceElement=${this.referenceElement ?? document.body} .placement=${this.placement} .open=${this.open} label @calcitePopoverClose=${this.closePopover} pointer-disabled auto-close ${m(this.popoverElement)}>${Array.isArray(e) ? o`<arcgis-charts-config-color-style .header=${this._messages.backgroundElement} enable-close .open=${this.open} .selectedColor=${e} @arcgisChartsConfigColorStyleClose=${this.closePopover} @arcgisChartsConfigColorStyleChange=${this.updateColorProperties}></arcgis-charts-config-color-style>` : null}${t?.type === r.SLS ? o`<arcgis-charts-config-line-style .header=${this._messages.lineStyle} .open=${this.open} enable-close .lineStyle=${t} @arcgisChartsConfigLineStyleClose=${this.closePopover} @arcgisChartsConfigLineStyleChange=${this.updateSymbolProperties}></arcgis-charts-config-line-style>` : null}${t?.type === r.TS ? o`<arcgis-charts-config-font-style .header=${this._messages.textStyle} .open=${this.open} enable-close .fontStyle=${t} @arcgisChartsConfigFontStyleClose=${this.closePopover} @arcgisChartsConfigFontStyleChange=${this.updateTextProperties}></arcgis-charts-config-font-style>` : null}</calcite-popover></div>`;
  }
}
i("arcgis-charts-config-format-popover", f);
export {
  f as ArcgisChartsConfigFormatPopover
};
