/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import a from"./OOHXOPMN.js";import{a as r}from"./ELJCWFP4.js";import{e as o}from"./EH5576ZY.js";import"./7QZVR2UR.js";import"./ZNBKMZP7.js";import{O as i,U as c,a as s,b as l}from"./GRFF5Y4R.js";import"./ALDX5YZO.js";export default $arcgis.t(([{watch:d},{b:n,c:m,d:p}])=>{var h=s`.template-select-container{border:1px solid var(--calcite-color-border-1);cursor:pointer}.template-select-container .template-select-error,.template-select-container .template-select-arrow{display:flex;align-self:center;margin-right:var(--calcite-spacing-md)}`,a=class extends i{constructor(){super(...arguments),this._handles=r("disconnect"),this._direction=o(),this._templateState="not-loaded"}static{this.properties={_selectedTemplate:16,_templateState:16,viewModel:0,messages:0,showTemplateSelector:0}}static{this.styles=h}loaded(){this.manager.onLifecycle(()=>[d(()=>this.viewModel.templateOptions.id,e=>{this._handles.removeHandles("template-handle"),this._selectedTemplate=e?this.viewModel.getLayoutTemplateById(e)??void 0:void 0,this._handles.addHandles(d(()=>this._selectedTemplate?.state,t=>this._templateState=t??"not-loaded",{initial:!0}),"template-handle")},{initial:!0})])}render(){let e=this._selectedTemplate?m(this._selectedTemplate,this.messages):this.messages.selectTemplate;return l`<calcite-block class="template-select-container" .description=${n(this._selectedTemplate)} .heading=${e} .label=${e} .loading=${this._templateState==="loading"} @click=${this.showTemplateSelector} @keydown=${t=>{(t.key==="Enter"||t.key===" ")&&this.showTemplateSelector()}} tabindex=0><calcite-icon .icon=${(this._selectedTemplate?.layout?p(this._selectedTemplate.layout):null)||"custom-print"} scale=l slot=content-start></calcite-icon>${this._templateState==="error"?l`<calcite-icon class="template-select-error" icon=exclamation-mark-circle scale=s slot=actions-end></calcite-icon>`:null}<calcite-icon class="template-select-arrow" .icon=${this._direction==="rtl"?"chevron-left":"chevron-right"} scale=s slot=actions-end></calcite-icon></calcite-block>`}};c("arcgis-print-template-select",a);return a},"core/reactiveUtils",a)