// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../../chunks/tslib.es6 ../../Graphic ../../UndoRedo ../../core/asyncUtils ../../core/Evented ../../core/handleUtils ../../core/maybe ../../core/reactiveUtils ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/RandomLCG ../../core/accessorSupport/decorators/subclass ../../geometry/coordinateFormatter ../../layers/GraphicsLayer ../../layers/graphics/dehydratedFeatureComparison ./support/CreateOperationGeometry ./support/createUtils ./support/surfaceCoordinateSystems ./support/tooltipUtils ../interactive/InteractiveToolBase ../interactive/sketch/SketchOptions ../interactive/tooltip/Tooltip ../interactive/tooltip/tooltipCommonUtils ../../core/accessorSupport/trackingUtils".split(" "), function(b,d,E,F,G,H,v,w,z,e,S,T,U,I,J,K,L,M,m,N,p,O,A,P,B,C){b.DrawGraphicTool=class extends H.EventedMixin(O.InteractiveToolBase){constructor(a){super(a);this._createOperationGeometry=this._coordinateFormatterLoadTask=this._graphic=null;this.defaultZ=0;this.geometryType=this.directionOptions=null;this.hasZ=!0;this.snappingManager=this.geometryToPlace=null;this.snapToScene=!1;this.sketchOptions=new A}initialize(){const {view:a}=this;this.internalGraphicsLayer=new K({listMode:"hide",internal:!0}); this.view.map.layers.add(this.internalGraphicsLayer);const c=this.drawOperation=this.makeDrawOperation();this.tooltipInfos=p.createTooltipInfos(a.type,this.sketchOptions);const n=this.tooltip=new P.Tooltip({view:a});p.initializeConstraints(this._tooltipsContext);this._coordinateFormatterLoadTask=G.createTask(()=>J.load());this.addHandles([c.on("vertex-add",g=>this.onVertexAdd(g)),c.on("vertex-remove",g=>this.onVertexRemove(g)),c.on("vertex-update",g=>this.onVertexUpdate(g)),c.on("cursor-update",g=> this.onCursorUpdate(g)),c.on("cursor-remove",()=>this._updateGraphic()),c.on("complete",g=>this.onComplete(g)),this._coordinateFormatterLoadTask,n.on("paste",g=>B.pasteLocation(g,this.activeTooltipInfo)),z.watch(()=>this.cursor,g=>{c.cursor=g},z.syncAndInitial),C.autorun(()=>{const {activeTooltipInfo:g,sketchOptions:u}=this;p.updateTooltipInfo(g,this._tooltipsContext);n.info=u.tooltips.effectiveEnabled?g:null}),C.autorun(()=>{c.constraintZ=p.getConstraintZ(this._tooltipsContext)})]);this.finishToolCreation()}destroy(){this.drawOperation= w.destroyMaybe(this.drawOperation);this.tooltip=w.destroyMaybe(this.tooltip);this._destroyAllVisualizations();this.view.map.remove(this.internalGraphicsLayer);this.internalGraphicsLayer=w.destroyMaybe(this.internalGraphicsLayer);this._set("view",null)}get _drawSpatialReference(){return this.drawOperation.coordinateHelper.spatialReference}get _tooltipsContext(){return{createOperationGeometry:this._createOperationGeometry,defaultZ:this.defaultZ,directionOptions:this.directionOptions,drawOperation:this.drawOperation, forceUniformSize:this.forceUniformSize,geometryType:this.geometryType,graphic:this.graphic,sketchOptions:this.sketchOptions,tooltipInfos:this.tooltipInfos,view:this.view}}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(a){this._set("centered",a);this._updateGraphic()}get cursor(){return this._get("cursor")}set cursor(a){this._set("cursor",a)}set enabled(a){this.drawOperation.interactive=a;this._set("enabled",a)}set forceUniformSize(a){this._set("forceUniformSize", a);this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(a){this._set("graphicSymbol",a);null!=this._graphic&&(this._graphic.symbol=a)}set mode(a){const c=this.drawOperation;c&&(c.drawingMode=a);this._set("mode",a)}get updating(){return this.drawOperation?.updating??!1}get undoRedo(){const {view:{type:a,map:c}}=this;return"2d"===a&&c&&"undoRedo"in c&&c.undoRedo instanceof F.UndoRedo?c.undoRedo:null}set undoRedo(a){this._override("undoRedo",a)}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(a){if(!this.destroyed&& !B.enterInputModeIfAvailable(a,this.tooltip))this.drawOperation.onInputEvent(a)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo();0===this.drawOperation.numCommittedVertices&&p.initializeConstraints(this._tooltipsContext)}_destroyAllVisualizations(){this.removeHandles(h.outline);this.removeHandles(h.regularVertices);this.removeHandles(h.activeVertex);this.removeHandles(h.activeEdge);this.removeHandles(x)}_createOrUpdateGraphic(a){if(null!=this._graphic)return this.updateGraphicGeometry(a), this._graphic;const c=new E({...this.graphicProperties,symbol:this.graphicSymbol});this._graphic=c;this.updateGraphicGeometry(a);this.internalGraphicsLayer.add(c);this.addHandles(this.initializeGraphic(c));this.notifyChange("graphic");this.addHandles(v.makeHandle(()=>{this.internalGraphicsLayer.remove(c);this._graphic===c&&(this._graphic=null)}),x);return c}updateGraphicGeometry(a){this._graphic.geometry=a}_getCreateOperationGeometry(a={operationComplete:!1}){if(null!=this.drawOperation){var {coordinateHelper:c, view:n,visualizationCursorVertex:g,lastVertex:u,committedVertices:D,geometryIncludingUncommittedVertices:Q,numCommittedVertices:R}=this.drawOperation;if(0