/*! 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 */
import b from"./Q7U6VVKV.js";import{a as _}from"./5VSM5EDQ.js";import{a as l}from"./PBTK3Z7K.js";import"./LYMDZ73M.js";import"./MG6XDMQJ.js";import{P as o,Q as a,U as n,j as r,k as t}from"./3VKC6PRK.js";export default $geoscene.t(([{watch:g},{b:m,c:p,d:d,e:h}])=>{var $=r`.geoscene-print__template-select-container{border:1px solid var(--calcite-color-border-1);cursor:pointer}.geoscene-print__template-select-container .geoscene-print__template-select-error,.geoscene-print__template-select-container .geoscene-print__template-select-arrow{display:flex;align-self:center;margin-right:var(--calcite-spacing-md)}`,s="geoscene-print",i={templateSelectContainer:`${s}__template-select-container`,templateSelectError:`${s}__template-select-error`,templateSelectArrow:`${s}__template-select-arrow`},c=class extends o{constructor(){super(...arguments),this._handles=_("disconnect"),this._templateState="not-loaded"}static{this.properties={_selectedTemplate:16,_templateState:16,viewModel:0,messages:0,showTemplateSelector:0}}static{this.styles=$}loaded(){this.manager.onLifecycle(()=>[g(()=>this.viewModel.templateOptions.id,e=>{this._handles.removeHandles("template-handle"),this._selectedTemplate=e?this.viewModel.getLayoutTemplateById(e)??void 0:void 0,this._handles.addHandles(g(()=>this._selectedTemplate?.state,S=>this._templateState=S??"not-loaded",{initial:!0}),"template-handle")},{initial:!0})])}render(){return t`<calcite-block class=${a(i.templateSelectContainer)} .description=${p(this._selectedTemplate)} .heading=${this._selectedTemplate?d(this._selectedTemplate,this.messages):this.messages.selectTemplate} .loading=${this._templateState==="loading"} @click=${this.showTemplateSelector} @keydown=${e=>{(e.key==="Enter"||e.key===" ")&&this.showTemplateSelector()}} tabindex=0>${l("template-select-icon",t`<calcite-icon .icon=${(this._selectedTemplate?.layout?h(this._selectedTemplate.layout):null)||"custom-print"} scale=l slot=content-start></calcite-icon>`)}${this._templateState==="error"?l("template-select-error",t`<calcite-icon class=${a(i.templateSelectError)} icon=exclamation-mark-circle scale=s slot=actions-end></calcite-icon>`):null}${l("template-select-arrow",t`<calcite-icon class=${a(i.templateSelectArrow)} .icon=${m()?"chevron-left":"chevron-right"} scale=s slot=actions-end></calcite-icon>`)}</calcite-block>`}};n("geoscene-print-template-select",c);return c},"core/reactiveUtils",b)