import { c as a } from "../../chunks/runtime.js";
import { html as t } from "lit-html";
import { keyed as i } from "lit-html/directives/keyed.js";
import { watch as s } from "@arcgis/core/core/reactiveUtils.js";
import { LitElement as n, safeClassMap as o } from "@arcgis/lumina";
import { css as r } from "@lit/reactive-element/css-tag.js";
import { u as l } from "../../chunks/useHandles.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.16 */
const c = r`.arcgis-print__advanced-options-container{padding:var(--calcite-spacing-xxs);display:flex;flex-direction:column;gap:var(--calcite-spacing-xs)}`, h = "arcgis-print", p = {
  advancedOptionsContainer: `${h}__advanced-options-container`
};
class d extends n {
  constructor() {
    super(...arguments), this._handles = l("disconnect");
  }
  static {
    this.properties = { _selectedTemplate: 16, _showAuthorInput: 16, _showCopyrightInput: 16, _showLegendInput: 16, _showNorthArrowInput: 16, _showScaleBarInput: 16, viewModel: 0, messages: 0 };
  }
  static {
    this.styles = c;
  }
  loaded() {
    this.manager.onLifecycle(() => [
      s(() => this.viewModel.templateOptions.id, (e) => {
        this._handles.removeHandles("template-handle"), this._selectedTemplate = e ? this.viewModel.getLayoutTemplateById(e) ?? void 0 : void 0, this._handles.addHandles(s(() => [
          this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText,
          this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText,
          this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend,
          this._selectedTemplate?.mapSurroundInfoOptions?.northArrow?.length,
          this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar?.length
        ], () => {
          this._showAuthorInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasAuthorText ?? !0, this._showCopyrightInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasCopyrightText ?? !0, this._showLegendInput = this._selectedTemplate?.layoutTemplateInfo?.layoutOptions?.hasLegend ?? !0, this._showNorthArrowInput = !!this._selectedTemplate?.mapSurroundInfoOptions?.northArrow.length, this._showScaleBarInput = !!this._selectedTemplate?.mapSurroundInfoOptions?.scaleBar.length;
        }, { initial: !0 }), "template-handle");
      }, { initial: !0 })
    ]);
  }
  render() {
    return t`<div aria-labelledby=${`${this.el.id}__advancedOptionsForLayout`} class=${o(p.advancedOptionsContainer)}>${this._renderScaleSection()}${this._renderAuthorSection()}${this._renderCopyrightSection()}${this._renderDpiSection()}${this._renderOutSpatialReferenceSection()}${this._renderCustomTextElementSection()}${this._renderLegendSection()}${this._renderNorthArrowSection()}${this._renderScaleBarSection()}</div>`;
  }
  _renderScaleSection() {
    return t`<arcgis-print-scale-section .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-scale-section>`;
  }
  _renderAuthorSection() {
    return this._showAuthorInput ? i("author-info", t`<div><calcite-label>${this.messages.author}<calcite-input .value=${this.viewModel.templateOptions.author ?? ""} @calciteInputInput=${(e) => this.viewModel.templateOptions.author = e.target.value}></calcite-input></calcite-label></div>`) : null;
  }
  _renderCopyrightSection() {
    return this._showCopyrightInput ? i("copyright-text", t`<div><calcite-label>${this.messages.copyright}<calcite-input .value=${this.viewModel.templateOptions.copyright ?? ""} @calciteInputInput=${(e) => this.viewModel.templateOptions.copyright = e.target.value}></calcite-input></calcite-label></div>`) : null;
  }
  _renderDpiSection() {
    return t`<arcgis-print-dpi-input .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-dpi-input>`;
  }
  _renderOutSpatialReferenceSection() {
    return t`<arcgis-print-out-spatial-reference-input .messages=${this.messages} .viewModel=${this.viewModel}></arcgis-print-out-spatial-reference-input>`;
  }
  _renderCustomTextElementSection() {
    return t`<arcgis-print-custom-text-elements .viewModel=${this.viewModel}></arcgis-print-custom-text-elements>`;
  }
  _renderLegendSection() {
    return this._showLegendInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.legendEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.legendEnabled = e.target.checked}></calcite-checkbox>${this.messages.legend}</calcite-label></div>` : null;
  }
  _renderNorthArrowSection() {
    return this._showNorthArrowInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.northArrowEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.northArrowEnabled = e.target.checked}></calcite-checkbox>${this.messages.northArrow}</calcite-label></div>` : null;
  }
  _renderScaleBarSection() {
    return this._showScaleBarInput ? t`<div><calcite-label layout=inline><calcite-checkbox .checked=${!!this.viewModel.templateOptions.scaleBarEnabled} @calciteCheckboxChange=${(e) => this.viewModel.templateOptions.scaleBarEnabled = e.target.checked}></calcite-checkbox>${this.messages.scaleBar}</calcite-label></div>` : null;
  }
}
a("arcgis-print-layout-advanced-options", d);
export {
  d as PrintLayoutAdvancedOptions
};
