/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as t}from"tslib";import{watch as e,sync as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as n}from"../../../draw/plugins/PluginBase.js";var a;const p=Symbol("viewshed-placement-point-plugin-marker");let r=class extends n{static{a=p}constructor(t){super(t),this[a]=!0,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.outputMapPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol("viewshed-placement-point-vertex")}start(t){super.start(t);const{positionOfLastUserInput:e,session:i}=t,o=this._getInitialMapPoint(e);!o||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||(i.appendOrReplacePoint(this._vertexId,o),this.outputMapPosition=o.clone()),this._ensureInteractiveHandle(t,o)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(t,o){this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?o:void 0}),this.addHandles(e(()=>this._interactiveHandle?.outputMapPosition,t=>{this.outputMapPosition=t?.clone(),t&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,t)},i),this._ownHandlesKey))}_getInitialMapPoint(t){return"grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??t:this.inputMapPosition??t}};function d(t){return{uniqueId:Symbol(`viewshed-${t}-plugin`),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new r({step:t})}}t([o({constructOnly:!0})],r.prototype,"step",void 0),t([o()],r.prototype,"defaultCaptureMode",void 0),t([o()],r.prototype,"inputMapPosition",void 0),t([o()],r.prototype,"outputMapPosition",void 0),t([o()],r.prototype,"hasCommittedPoint",void 0),t([o()],r.prototype,"_interactiveHandle",void 0),r=t([s("esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin")],r);export{r as ViewshedPlacementPointPlugin,d as createViewshedPlacementPointPluginConfiguration};
