import { c as r } from "../../chunks/runtime.js";
import { html as e } from "lit-html";
import { classes as c } from "@arcgis/components-utils";
import { watch as l } from "@geoscene/core/core/reactiveUtils.js";
import { LitElement as p, safeClassMap as i } from "@arcgis/lumina";
import { css as d } from "@lit/reactive-element/css-tag.js";
import { u as m } from "../../chunks/useHandles.js";
/*! All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
See https://js.geoscene.cn/4.33/geoscene/copyright.txt for details.
v4.33.18 */
const h = d`.geoscene-print__advanced-options-section{border:1px solid var(--calcite-color-border-1);margin-bottom:var(--calcite-spacing-sm)}.geoscene-print__layout-section{padding:var(--calcite-spacing-sm) var(--calcite-spacing-sm)}.geoscene-print__panel-container{display:flex;flex:1 0;flex-direction:column;gap:var(--calcite-spacing-sm)}`, a = "geoscene-print", s = {
  advancedOptionsSection: `${a}__advanced-options-section`,
  layoutSection: `${a}__layout-section`,
  panelContainer: `${a}__panel-container`
};
class u extends p {
  constructor() {
    super(...arguments), this._handles = m("disconnect");
  }
  static {
    this.properties = { _selectedTemplate: 16, _showSelectedTemplateTitleText: 16, viewModel: 0, messages: 0, showTemplateSelector: 0, selectExportsTab: 0 };
  }
  static {
    this.styles = h;
  }
  loaded() {
    this.manager.onLifecycle(() => [
      l(() => this.viewModel.templateOptions.id, (t) => {
        this._handles.removeHandles("template-handle"), this._selectedTemplate = t ? this.viewModel.getLayoutTemplateById(t) ?? void 0 : void 0, this._handles.addHandles(l(() => this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText, () => {
          this._showSelectedTemplateTitleText = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasTitleText ?? !0;
        }, { initial: !0 }), "template-handle");
      }, { initial: !0 })
    ]);
  }
  render() {
    return e`<section class=${i(s.layoutSection)} role=tabpanel><div class=${i(s.panelContainer)}>${this._renderTitleInput()}${this._renderTemplateSelect()}${this._renderFileFormatSection()}${this._renderAdvancedSection()}${this._renderExportButton()}</div></section>`;
  }
  _renderTitleInput() {
    if (!this._showSelectedTemplateTitleText)
      return null;
    const { title: t, titlePlaceHolder: n } = this.messages;
    return e`<calcite-label>${t}<calcite-input .placeholder=${n} .value=${this.viewModel.templateOptions.title ?? ""} @calciteInputInput=${(o) => {
      this.viewModel.templateOptions.title = o.currentTarget.value;
    }}></calcite-input></calcite-label>`;
  }
  _renderTemplateSelect() {
    return e`<div><calcite-label>${this.messages.template}<geoscene-print-template-select .messages=${this.messages} .viewModel=${this.viewModel} .showTemplateSelector=${this.showTemplateSelector}></geoscene-print-template-select></calcite-label><geoscene-print-preview-input .viewModel=${this.viewModel} .messages=${this.messages}></geoscene-print-preview-input></div>`;
  }
  _renderFileFormatSection() {
    return e`<geoscene-print-format-select .viewModel=${this.viewModel} .messages=${this.messages}></geoscene-print-format-select>`;
  }
  _renderAdvancedSection() {
    return e`<calcite-block .ariaLabel=${this.messages.advancedOptions} class=${i(c(s.panelContainer, s.advancedOptionsSection))} collapsible .disabled=${!this._selectedTemplate} .heading=${this.messages.advancedOptions}><geoscene-print-layout-advanced-options .messages=${this.messages} .viewModel=${this.viewModel}></geoscene-print-layout-advanced-options></calcite-block>`;
  }
  _renderExportButton() {
    return e`<geoscene-print-export-button .fileName=${this.viewModel.templateOptions.title ?? void 0} .messages=${this.messages} .viewModel=${this.viewModel} .selectExportsTab=${this.selectExportsTab}></geoscene-print-export-button>`;
  }
}
r("geoscene-print-layout-panel", u);
export {
  u as PrintLayoutPanel
};