import { c as n } from "../../chunks/runtime.js";
import { css as h, html as e } from "lit";
import d from "@arcgis/core/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js";
import { usePropertyChange as m } from "@arcgis/lumina/controllers";
import { m as g } from "../../chunks/useViewModel.js";
import { u as p } from "../../chunks/useT9n.js";
import { reEmitEvent as u } from "@arcgis/lumina/controllers/accessor";
import { LitElement as y, createEvent as w, safeClassMap as b } 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 v = h``, c = {
  basicLayoutCategory: [
    "basic-grid"
    /* SIMPLE */
  ],
  organicLayoutCategory: [
    "organic-standard",
    "organic-community",
    "geographic-organic-standard"
    /* GEOGRAPHIC */
  ],
  treeLayoutCategory: [
    "tree-left-to-right",
    "radial-root-centric"
    /* RADIAL_TREE */
  ],
  hierarchicalLayoutCategory: [
    "hierarchical-bottom-to-top"
    /* HIERARCHICAL */
  ],
  chronologicalLayoutCategory: [
    "chronological-mono-timeline",
    "chronological-multi-timeline"
    /* CHRONOLOGICAL_MULTIPLE */
  ]
}, s = {
  "organic-standard": "force-directed-link-chart-layout",
  "organic-community": "community-link-chart-layout",
  "basic-grid": "simple-link-chart-layout",
  "hierarchical-bottom-to-top": "hierarchical-link-chart-layout",
  "radial-root-centric": "radial-tree-link-chart-layout",
  "tree-left-to-right": "smart-tree-link-chart-layout",
  "geographic-organic-standard": "geographic-link-chart-layout",
  "chronological-mono-timeline": "single-timeline",
  "chronological-multi-timeline": "multi-timeline"
}, l = {
  "organic-standard": "forceDirected",
  "organic-community": "community",
  "basic-grid": "simple",
  "hierarchical-bottom-to-top": "hierarchical",
  "radial-root-centric": "radialTree",
  "tree-left-to-right": "smartTree",
  "geographic-organic-standard": "geographic",
  "chronological-mono-timeline": "chronologicalSingle",
  "chronological-multi-timeline": "chronologicalMultiple"
}, L = {
  base: "link-chart-layout-switcher"
}, $ = g(d);
class f extends y {
  constructor() {
    super(...arguments), this.messages = p(), this.viewModel = $(this), this.view = this.viewModel.view, this.appearance = "dropdown", this.autoDestroyDisabled = !1, this.closeOnSelectDisabled = !1, this.icon = "nodes-link", this.layout = this.viewModel.layout, this.preventExtentUpdate = this.viewModel.preventExtentUpdate, this.state = this.viewModel.state, this.arcgisSwitchLayout = u(() => this.viewModel, "switchLayout"), this.arcgisPropertyChange = m()("state"), this.arcgisReady = w();
  }
  static {
    this.properties = { view: 0, appearance: 1, autoDestroyDisabled: 5, closeOnSelectDisabled: 5, icon: 1, label: 1, layout: 32, messageOverrides: 0, position: 3, preventExtentUpdate: 5, referenceElement: 1, state: 3 };
  }
  static {
    this.styles = v;
  }
  async destroy() {
    await this.manager.destroy();
  }
  async switchLayout(t) {
    this.viewModel.switchLayout(t);
  }
  _renderDropdown() {
    const { messages: t, icon: a } = this;
    return e`<calcite-dropdown scale=s width=m max-items=9 .closeOnSelectDisabled=${this.closeOnSelectDisabled}><calcite-action slot=trigger .disabled=${this.viewModel.state === "disabled"} .icon=${a ?? void 0} .label=${t.layoutOptions ?? "Layout"} appearance=solid scale=s .text=${t.layoutOptions ?? "Layout"}></calcite-action>${Object.entries(c).map(([r, i]) => e`<calcite-dropdown-group selection-mode=single .groupTitle=${this.messages[r]}>${i.map((o) => e`<calcite-dropdown-item .iconStart=${s[o]} .selected=${o === this.layout ? !0 : void 0} @click=${() => void this.switchLayout(o)}>${t[l[o]]}</calcite-dropdown-item>`)}</calcite-dropdown-group>`)}</calcite-dropdown>`;
  }
  _renderMenuBar() {
    const { messages: t } = this;
    return e`<calcite-action-bar scale=s floating overflow-actions-disabled>${Object.entries(c).map(([a, r]) => e`<calcite-action-group .label=${this.messages[a]}>${r.map((i) => e`<calcite-action scale=s .icon=${s[i]} .active=${i === this.layout ? !0 : void 0} @click=${() => void this.switchLayout(i)} .text=${t[l[i]]}></calcite-action>`)}</calcite-action-group>`)}</calcite-action-bar>`;
  }
  render() {
    const { appearance: t } = this, a = t === "menu-bar" ? this._renderMenuBar() : this._renderDropdown();
    return e`<div class=${b(L.base)}>${a}</div>`;
  }
}
n("arcgis-link-chart-layout-switcher", f);
export {
  f as ArcgisLinkChartLayoutSwitcher
};
