/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{ignoreAbortErrors as i}from"../core/promiseUtils.js";import{property as o,subclass as n}from"../core/accessorSupport/decorators.js";import r from"../views/interactive/snapping/SnappingOptions.js";import p from"./Widget.js";import a from"./DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{MeasurementWidgetContent as u}from"./support/MeasurementWidgetContent.js";import{messageBundle as m,tsx as d}from"./support/widget.js";const c="esri-distance-measurement-2d",v={base:c,newMeasurementButton:`${c}__clear-button`};let g=class extends p{constructor(e,i){super(e,i),this.messages=null,this.messagesCommon=null,this.viewModel=new a,t(s.getLogger(this),"Distance Measurement 2D","arcgis-distance-measurement-2d",{version:"5.0"})}get active(){return this.viewModel.active}get icon(){return"measure-line"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){const{messages:e,messagesCommon:t,unit:s,unitOptions:o,viewModel:n}=this,{active:r,measurementLabel:p,state:a,supported:m}=n;return d("div",{"aria-label":this.messages.widgetLabel,class:this.classes(v.base,l.widget,l.panel),key:this,role:"presentation"},this.visible?d(u,{active:r,measurementItems:[{key:"distance",title:e.distance,value:p}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:v.newMeasurementButton,state:a,supported:m,unit:s,unitOptions:o,onNewMeasurementClick:()=>{i(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};e([o({readOnly:!0})],g.prototype,"active",null),e([o()],g.prototype,"icon",null),e([o()],g.prototype,"label",null),e([o(),m("esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D")],g.prototype,"messages",void 0),e([o(),m("esri/t9n/common")],g.prototype,"messagesCommon",void 0),e([o({type:r})],g.prototype,"snappingOptions",null),e([o()],g.prototype,"uiStrings",void 0),e([o()],g.prototype,"unit",null),e([o()],g.prototype,"unitOptions",null),e([o()],g.prototype,"view",null),e([o({type:a})],g.prototype,"viewModel",void 0),e([o({type:Boolean})],g.prototype,"visible",null),g=e([n("esri.widgets.DistanceMeasurement2D")],g);const w=g;export{w as default};
