/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{ignoreAbortErrors as t}from"../core/promiseUtils.js";import{property as s,subclass as i}from"../core/accessorSupport/decorators.js";import n from"../views/interactive/snapping/SnappingOptions.js";import o from"./Widget.js";import r from"./DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";import{globalCss as p}from"./support/globalCss.js";import{MeasurementWidgetContent as l}from"./support/MeasurementWidgetContent.js";import{messageBundle as a,tsx as u}from"./support/widget.js";const m="esri-distance-measurement-2d",d={base:m,newMeasurementButton:`${m}__clear-button`};let v=class extends o{constructor(e,t){super(e,t),this.messages=null,this.messagesCommon=null,this.viewModel=new r}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:s,unit:i,unitOptions:n,viewModel:o}=this,{active:r,measurementLabel:a,state:m,supported:v}=o;return u("div",{"aria-label":this.messages.widgetLabel,class:this.classes(d.base,p.widget,p.panel),key:this,role:"presentation"},this.visible?u(l,{active:r,measurementItems:[{key:"distance",title:e.distance,value:a}],messages:{...e,notApplicable:s.notApplicable},newMeasurementButtonClass:d.newMeasurementButton,state:m,supported:v,unit:i,unitOptions:n,onNewMeasurementClick:()=>{t(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};e([s({readOnly:!0})],v.prototype,"active",null),e([s()],v.prototype,"icon",null),e([s()],v.prototype,"label",null),e([s(),a("esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D")],v.prototype,"messages",void 0),e([s(),a("esri/t9n/common")],v.prototype,"messagesCommon",void 0),e([s({type:n})],v.prototype,"snappingOptions",null),e([s()],v.prototype,"uiStrings",void 0),e([s()],v.prototype,"unit",null),e([s()],v.prototype,"unitOptions",null),e([s()],v.prototype,"view",null),e([s({type:r})],v.prototype,"viewModel",void 0),e([s({type:Boolean})],v.prototype,"visible",null),v=e([i("esri.widgets.DistanceMeasurement2D")],v);const c=v;export{c as default};
