/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{O as o,U as r,a as c,b as n}from"./IWZQMWZ5.js";import"./ALDX5YZO.js";export default $arcgis.t(([{watch:p}])=>{var d=c`.scale-input-container{display:flex;align-items:center;padding-bottom:var(--calcite-spacing-md)}.scale-input-container .scale-input{flex-grow:1}`,l=class extends o{constructor(){super(...arguments),this._scale=0,this._scaleEnabled=!1}static{this.properties={_scale:16,_scaleEnabled:16,viewModel:0,messages:0}}static{this.styles=d}loaded(){this.manager.onLifecycle(()=>[p(()=>[this.viewModel.templateOptions.scale,this.viewModel.templateOptions.scaleEnabled],()=>{let{scale:e,scaleEnabled:t}=this.viewModel.templateOptions;this._scale=e,this._scaleEnabled=t},{initial:!0}),p(()=>this.viewModel.view?.scale,e=>{e&&(!this.viewModel.templateOptions.scaleEnabled||!this.viewModel.templateOptions.scale)&&(this.viewModel.templateOptions.scale=e)},{initial:!0})])}_resetToCurrentScale(){this.viewModel.templateOptions.scale=this.viewModel.view?.scale}render(){let{messages:e,_scale:t,_scaleEnabled:s}=this;return n`<div class="scale-info-container"><calcite-label layout=inline><calcite-checkbox .checked=${s} @calciteCheckboxChange=${a=>{this.viewModel.templateOptions.scaleEnabled=a.target.checked,this._resetToCurrentScale()}}></calcite-checkbox>${e.scale}</calcite-label><div class="scale-input-container"><calcite-input-number .ariaLabel=${e.scaleLabel} .ariaValueNow=${`${t}`} class="scale-input" .disabled=${!s} .value=${`${t}`} .max=${Number.MAX_SAFE_INTEGER} @calciteInputNumberInput=${a=>{let i=Number(a.target.value);if(Number.isNaN(i)||i<0||!Number.isFinite(i)){a.target.value=`${t}`;return}this.viewModel.templateOptions.scale=i}}></calcite-input-number><calcite-button appearance=outline .ariaLabel=${e.reset} .disabled=${!s} icon-start=refresh kind=neutral @click=${()=>this._resetToCurrentScale()}></calcite-button></div></div>`}};r("arcgis-print-scale-section",l);return l},"core/reactiveUtils")