@arcgis/core 4.34.0-next.30 → 4.34.0-next.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0ca8d6516323fc28dd58.js +1 -0
- package/assets/esri/core/workers/chunks/{031c4b4bf78079d0002d.js → 36024406932b0a44a74a.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e267a813e8b10d10b3b.js → 37bfc1a771792b6697fd.js} +121 -140
- package/assets/esri/core/workers/chunks/42c5d957813080143e5a.js +1 -0
- package/assets/esri/core/workers/chunks/6269c4bbf0f224a954e9.js +1 -0
- package/assets/esri/core/workers/chunks/871da12fb3029177df6f.js +1 -0
- package/assets/esri/core/workers/chunks/8abcf9d3343dd8d45103.js +1 -0
- package/assets/esri/core/workers/chunks/ac88e0aabbd6c1f1ec98.js +1 -0
- package/assets/esri/core/workers/chunks/{e7209654ecdfde926272.js → eec36628e638e244f452.js} +1 -1
- package/chunks/ComponentShader.glsl.js +34 -33
- package/chunks/DefaultMaterial.glsl.js +25 -25
- package/chunks/Path.glsl.js +20 -24
- package/chunks/RealisticTree.glsl.js +18 -20
- package/chunks/Terrain.glsl.js +32 -33
- package/chunks/WaterSurface.glsl.js +16 -16
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/interfaces.d.ts +22 -25
- package/kernel.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +5 -0
- package/views/3d/support/flow/FlowWorkerHandle.js +5 -0
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/flow/loadUtils.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -5
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToReadShadowMap.glsl.js +7 -0
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepthToWriteShadowMap.glsl.js +11 -0
- package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +6 -2
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/TextureUpdater.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/checkWebGLError.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileInteraction.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/278df50f2c557be81808.js +0 -1
- package/assets/esri/core/workers/chunks/2931fd6bb123200622c2.js +0 -1
- package/assets/esri/core/workers/chunks/4cf2894bda9e38af8790.js +0 -1
- package/assets/esri/core/workers/chunks/6a0777cf1270fcab4574.js +0 -1
- package/assets/esri/core/workers/chunks/9723512bc9db4a301c72.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import o from"../../core/Error.js";import i from"../../core/Evented.js";import{drainHandles as a}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as r,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l,ignoreAbortErrors as h}from"../../core/promiseUtils.js";import{on as c,watch as d,syncAndInitial as u,when as m,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as _}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as b,isLoaded as w,load as G,project as O}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as T}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import S from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import A from"../../symbols/MeshSymbol3D.js";import C from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/SimpleLineSymbol.js";import j from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as D}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as U}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as R}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as I}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as L}from"../../views/input/InputManager.js";import{sketchKeys as F}from"../../views/interactive/keybindings.js";import V from"../../views/interactive/sketch/SketchLabelOptions.js";import K from"../../views/interactive/sketch/SketchOptions.js";import W from"../../views/interactive/sketch/SketchTooltipOptions.js";import Z from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as q}from"../../views/interactive/snapping/SnappingManager.js";import N from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as z}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as B}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as $}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Y}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as J}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as Q}from"../../views/support/screenUtils.js";import{CreateOperationHandle as X,UpdateOperationHandle as ee}from"./support/OperationHandle.js";import{getModeFromCreateOptions as te,getDrawToolGeometryTypeFromCreateTool as oe}from"./support/sketchUtils.js";const ie={defaultZ:0},ae={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Y},tool:"transform"};let se=class extends i.EventedAccessor{constructor(e){super(e),this._defaultSnappingManager=null,this._updatingHandles=new f,this._internalGraphicsLayer=new S({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new C({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new H({color:[130,130,130,1],width:2}),this.meshSymbol=new A({symbolLayers:new t([new k])}),this.updateGraphics=new t,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new K,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._originalPopupEnabled=null,this.defaultCreateOptions=ie,this.defaultUpdateOptions=ae,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N}initialize(){this.addHandles([c(()=>this.view?.map?.layers,"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),c(()=>this.layer?.graphics,"change",e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())}),d(()=>this.layer?.elevationInfo??null,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u),d(()=>this.view,e=>{this._defaultSnappingManager=r(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new q({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),z(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=r(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get updating(){return this._updatingHandles.updating||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ie,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ae,...e,reshapeOptions:{...ae.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ae.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=r(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new q({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&(t.cursor=null),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(m(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const s=()=>{if(a===this._operationHandle){const o=this.createGraphic,s=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==o||i.add(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:s?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),s||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(h(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(h(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const s=Array.isArray(e)?e:[e];if(null==e||!s?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(s.some(e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const r=await this._updatingHandles.addPromise(this._setupUpdateOperation(s,t));this.destroyed||null==r||ye(r)||(x(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(r,t),this.emit("update",{graphics:s,state:"start",aborted:!1,tool:r.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(b(o.geometry.spatialReference,t.spatialReference)||w()||await G(),o.geometry=O(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return J(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e.type)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?_(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},L.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(Q(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||i.layer===this.layer?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:s,geometryToPlace:r,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=te(p,e),c=oe(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:r,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:s,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),B(),$()]);return ye(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:pe(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}async _makeDrawGraphicTool3D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ye(t)||this.destroyed)return null;const{elevationInfo:a}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:a,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,s=e.centered,r=[t.on("key-down",t=>{if(t.key===F.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===F.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==F.vertexAdd||t.repeat)t.key===F.undo?(t.stopPropagation(),n.undo()):t.key===F.redo?(t.stopPropagation(),n.redo()):t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===F.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},L.WIDGET),t.on("key-up",t=>{t.key===F.pan?e.enabled=!0:t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===F.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},L.WIDGET),e.on("vertex-add",t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()}),d(()=>this._getGraphicSymbolFromTool(e.geometryType),t=>{e.graphicSymbol=t})],n=new X({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{a(r),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let s=a.tool??ae.tool;for(const r of e)o.remove(r),o.add(r);if("3d"===i.type){if(0===e.length)return null;switch(s){case"move":return this._setupMove3DOperation(e,a,i,s);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(s){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,s,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(s="reshape")}return this._setupTransformOrReshape2DOperation(e,s,a,i)}}async _setupMove3DOperation(e,t,o,i,s=!1){const[r,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ye(r))return r;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=r.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const a of e){const e=new p({view:o,graphic:a}),t=R(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${U(t)}).`),null;h.set(a,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),s||this.updateGraphics.addMany(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),me(o,d),c()},undo:()=>{de(this.view,d),le(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{he(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!ye(a)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(a,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===P(e[0])){const a=e[0],s=a.geometry;if(null!=s&&("point"===s.type||"mesh"===s.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=s&&("polygon"===s.type||"polyline"===s.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:s,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(ye(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:s,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),me(o,d),c.destroy()},undo:()=>{de(this.view,d),le(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{he(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ye(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const s="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ye(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(F.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),i||this.updateGraphics.add(e);const v=[],f=new ee({activeComponent:g,tool:s,type:"update",onEnd:()=>{a(v),me(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),f.onEnd(),f.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ye(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!ye(i)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(i,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),L.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),L.WIDGET),o.on("key-down",e=>{e.key!==F.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET)),f}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s=await this._getGraphicMover(e,t,o);if(ye(s))return s;const r=new ee({activeComponent:s,tool:i,type:"update",onEnd:()=>{this._displayDefaultCursor(),a(l),a(p),s.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();le(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();he(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),s.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==F.constraint||e.repeat||(n=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&n&&(n=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const s="reshape",[r,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ye(r))return r;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=r.module,c=new l({view:o,graphic:e}),d=I(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${U(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),i||this.updateGraphics.add(c.graphic);const y=[],g=new ee({activeComponent:m,tool:s,type:"update",onEnd:()=>{a(y),me(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ye(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);ye(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},L.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(ye(s))return s;const r=new ee({activeComponent:s,type:"update",onEnd:()=>{a(p),a(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{le(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{he(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(ye(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let s=null;"transform"===r.tool?s=await this._getReshape([e],o,i):"reshape"===r.tool&&(s=await this._getBox([e],o,i)),ye(s)||(r.activeComponent?.destroy(),r.activeComponent=s,r.activeComponent&&(a(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),L.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===F.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET),i.on("key-up",e=>{if(e.key===F.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,s=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return ye(s)?s:new s.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayGrabbingCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayPointerCursor(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayMoveCursor(),onGraphicPointerOut:()=>this._displayDefaultCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:s,preserveAspectRatio:r}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),$()]);if(ye(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(F.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:s?.name,highlightsEnabled:!!s?.enabled,preserveAspectRatio:!!r!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,s="split"===a?.edgeOperation,r="move"===a?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),B(),$()]);return ye(n)?n:new n.module.default({enableMidpoints:s,enableMovement:r,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>T(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>T(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(ue(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(ue(t.graphics))),o.on("rotate-start",t=>e.addToHistory(ue(t.graphics))),o.on("scale-start",t=>e.addToHistory(ue(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(ue([t.mover]))),o.on("reshape-start",t=>e.addToHistory(ue([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(ue([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(ue([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=Q(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===F.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===F.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===F.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&F.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=r(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_displayPointerCursor(){this.view?.container&&"pointer"!==this.view.cursor&&(this.view.cursor="pointer")}_displayGrabbingCursor(){this.view?.container&&"grabbing"!==this.view.cursor&&(this.view.cursor="grabbing")}_displayMoveCursor(){this.view?.container&&"move"!==this.view.cursor&&(this.view.cursor="move")}_displayDefaultCursor(){this.view?.container&&null!==this.view.cursor&&(this.view.cursor=null)}_logError(e,t,i){s.getLogger(this).error(new o(e,t,i))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){}wait(){return y(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",ne("view"))}_logMissingLayer(){this._logError(re,ne("layer"))}};e([g()],se.prototype,"_defaultSnappingManager",void 0),e([g()],se.prototype,"updating",null),e([g({readOnly:!0})],se.prototype,"_updatingHandles",void 0),e([g()],se.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],se.prototype,"activeTool",null),e([g({readOnly:!0})],se.prototype,"activeCreateToolDrawMode",null),e([g()],se.prototype,"activeTooltip",null),e([g({types:D})],se.prototype,"activeFillSymbol",void 0),e([g()],se.prototype,"activeLineSymbol",void 0),e([g()],se.prototype,"activeVertexSymbol",void 0),e([g()],se.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],se.prototype,"createGraphic",null),e([g()],se.prototype,"defaultCreateOptions",null),e([g()],se.prototype,"defaultUpdateOptions",null),e([g({type:V,nonNullable:!0})],se.prototype,"labelOptions",null),e([g()],se.prototype,"layer",void 0),e([g({types:D})],se.prototype,"pointSymbol",void 0),e([g({types:D})],se.prototype,"polygonSymbol",void 0),e([g({types:D})],se.prototype,"polylineSymbol",void 0),e([g()],se.prototype,"meshSymbol",void 0),e([g({type:N,nonNullable:!0})],se.prototype,"snappingOptions",null),e([g()],se.prototype,"snappingManager",null),e([g({readOnly:!0})],se.prototype,"state",null),e([g({type:W,nonNullable:!0})],se.prototype,"tooltipOptions",null),e([g({readOnly:!0})],se.prototype,"updateGraphics",void 0),e([g()],se.prototype,"updateOnGraphicClick",void 0),e([g()],se.prototype,"creationMode",void 0),e([g({type:Z,nonNullable:!0})],se.prototype,"valueOptions",null),e([g({types:D})],se.prototype,"vertexSymbol",void 0),e([g({value:null})],se.prototype,"view",null),e([g({constructOnly:!0,type:K})],se.prototype,"sketchOptions",void 0),se=e([v("esri.widgets.Sketch.SketchViewModel")],se);const re="sketch:missing-property",ne=e=>`Property '${e}' is missing on SketchViewModel.`;function pe(e){return"polygon"===e||"rectangle"===e||"circle"===e}function le(e,t){ce("undo",e.history.undo,e.history.redo,t)}function he(e,t){ce("redo",e.history.redo,e.history.undo,t)}function ce(e,t,o,i){const a=t.pop();if(!a)return;const s=a.updates,r=[];i.forEach((t,o)=>{const i=s[o];null!=i&&("geometry"in i&&null!=i.geometry&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(r.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(r.push(i),i[e](t)))}),o.push({updates:r})}function de(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function ue(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function me(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function ye(e){return"requireError"in e&&"aborted"===e.requireError}export{se as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import o from"../../core/Error.js";import i from"../../core/Evented.js";import{drainHandles as a}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as r,abortMaybe as n}from"../../core/maybe.js";import{createAbortError as p,whenOrAbort as l,ignoreAbortErrors as h}from"../../core/promiseUtils.js";import{on as c,watch as d,syncAndInitial as u,when as m,whenOnce as y}from"../../core/reactiveUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as _}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as b,isLoaded as w,load as G,project as O}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as T}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import S from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import k from"../../symbols/FillSymbol3DLayer.js";import A from"../../symbols/MeshSymbol3D.js";import C from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/SimpleLineSymbol.js";import j from"../../symbols/SimpleMarkerSymbol.js";import{symbolTypes as U}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as D}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as R}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as I}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as P}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as x}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as L}from"../../views/input/InputManager.js";import{sketchKeys as F}from"../../views/interactive/keybindings.js";import V from"../../views/interactive/sketch/SketchLabelOptions.js";import K from"../../views/interactive/sketch/SketchOptions.js";import W from"../../views/interactive/sketch/SketchTooltipOptions.js";import Z from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as q}from"../../views/interactive/snapping/SnappingManager.js";import N from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as z}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as B}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as $}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Y}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as J}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as Q}from"../../views/support/screenUtils.js";import{CreateOperationHandle as X,UpdateOperationHandle as ee}from"./support/OperationHandle.js";import{getModeFromCreateOptions as te,getDrawToolGeometryTypeFromCreateTool as oe}from"./support/sketchUtils.js";const ie={defaultZ:0},ae={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move"},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Y},tool:"transform"},se=Symbol();let re=class extends i.EventedAccessor{constructor(e){super(e),this._defaultSnappingManager=null,this._updatingHandles=new f,this._internalGraphicsLayer=new S({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new C({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new H({color:[130,130,130,1],width:2}),this.meshSymbol=new A({symbolLayers:new t([new k])}),this.updateGraphics=new t,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new j({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new K,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._originalPopupEnabled=null,this.defaultCreateOptions=ie,this.defaultUpdateOptions=ae,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new N}initialize(){this.addHandles([c(()=>this.view?.map?.layers,"change",e=>{e.removed.includes(this.layer)&&this.cancel()}),c(()=>this.layer?.graphics,"change",e=>{if(null!=this._operationHandle)for(const t of e.removed)this.updateGraphics.includes(t)&&(this.updateGraphics.length>1?this._operationHandle.removeFromSelection(t):this._operationHandle.cancel())}),d(()=>this.layer?.elevationInfo??null,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer.elevationInfo=e)},u),d(()=>this.view,e=>{this._defaultSnappingManager=r(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new q({view:e,options:this.snappingOptions})),"2d"===e.type?import("../../views/2d/interactive/editingTools.js"):"3d"===e.type&&(import("../../views/3d/interactive/editingTools.js"),import("../../views/3d/layers/GraphicsLayerView3D.js")))},u),d(()=>this.view?.spatialReference,(e,t)=>{e&&t&&!e.equals(t)&&this.cancel()})]),z(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=r(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get updating(){return this._updatingHandles.updating||null!=this.snappingManager&&this.snappingManager.updating}get activeTool(){return this._operationHandle?.tool??null}get activeCreateToolDrawMode(){return"create"===this._operationHandle?.type&&this._operationHandle.activeComponent&&"mode"in this._operationHandle.activeComponent?this._operationHandle.activeComponent.mode:null}get activeTooltip(){const{activeComponent:e,destroyed:t}=this,o=!t&&e&&"tooltip"in e?e.tooltip:null;return o?.visible?o:null}get activeComponent(){return this._operationHandle?.activeComponent??null}get createGraphic(){return null==this.activeComponent||"draw-3d"!==this.activeComponent.type&&"draw-2d"!==this.activeComponent.type?this._get("createGraphic"):this.activeComponent.graphic}get defaultCreateOptions(){return this._get("defaultCreateOptions")}set defaultCreateOptions(e){this._set("defaultCreateOptions",{...ie,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...ae,...e,reshapeOptions:{...ae.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...ae.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get snappingOptions(){return this.snappingManager?.options??this._get("snappingOptions")}set snappingOptions(e){null!=this._defaultSnappingManager&&(this._defaultSnappingManager.options=e),this._set("snappingOptions",e)}get snappingManager(){return this._isOverridden("snappingManager")&&this._get("snappingManager"),this._defaultSnappingManager}set snappingManager(e){if(e)this._isOverridden("snappingManager")||(this._defaultSnappingManager=r(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new q({options:this.snappingOptions,view:e})),this._clearOverride("snappingManager")}}get state(){const e=!(!this.view?.ready||!this.layer),t=this._operationHandle;return e&&t?"active":e?"ready":"disabled"}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}get view(){return this._get("view")}set view(e){const t=this._get("view");if(t){const{container:e,map:o}=t;e&&this._clearCursor(),o?.remove(this._internalGraphicsLayer),this.removeHandles(this._viewHandlesKey),this.cancel()}const o="view-ready";this.removeHandles(o),e&&this.addHandles(m(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}cancel(){this._moduleLoaderAbortController=n(this._moduleLoaderAbortController),this._viewReadyAbortController=n(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle&&this._operationHandle.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e,layer:o}=this,i=t.toArray();o.removeMany(i),this.cancel(),this._emitDeleteEvent({graphics:i,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.layer.addMany(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:i}=this;if(!o||"disabled"===this.state)throw i||this._logMissingLayer(),p();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");x(o,this._internalGraphicsLayer);const a=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==a||this.destroyed)return void o.map.remove(this._internalGraphicsLayer);const s=()=>{if(a===this._operationHandle){const o=this.createGraphic,s=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map&&this.view.map.remove(this._internalGraphicsLayer),a.cancelled||null==o||i.add(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:s?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),s||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(h(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(h(this.update([o])))}};a.on("complete",s),this._operationHandle=a,o.ready&&o.focus()}async place(e,t){return this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:i,state:a}=this;if(!i||"disabled"===a)throw o||this._logMissingLayer(),p();null!=i.activeTool&&(i.activeTool=null);const s=Array.isArray(e)?e:[e];if(null==e||!s?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(s.some(e=>e.layer!==o?(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0):null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0)))return;const r=await this._updatingHandles.addPromise(this._setupUpdateOperation(s,t));this.destroyed||null==r||ge(r)||(x(i,this._internalGraphicsLayer),this._setUpdateOperationHandle(r,t),this.emit("update",{graphics:s,state:"start",aborted:!1,tool:r.tool,toolEventInfo:null,type:"update"}))}async _updateSpatialReference(e){const t=this.view;if(t){e=Array.isArray(e)?e:[e];for(const o of e)null==o.geometry||"mesh"===o.geometry.type||E(o.geometry.spatialReference,t.spatialReference)||(b(o.geometry.spatialReference,t.spatialReference)||w()||await G(),o.geometry=O(o.geometry,t.spatialReference))}else this._logMissingView()}undo(){this.canUndo()&&this._operationHandle?.undo()}redo(){this.canRedo()&&this._operationHandle?.redo()}canUndo(){return!!this._operationHandle?.canUndo()}canRedo(){return!!this._operationHandle?.canRedo()}toggleUpdateTool(){this._operationHandle?.toggleTool()}async _getFirstHit(e){const t=this.view;if(!t)return this._logMissingView(),null;if("2d"===t.type){const o=[];t.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const i=await t.hitTest(e,{exclude:o});return J(i.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e.type)&&o.push(e)});const i=await t.hitTest(e,{exclude:o});if(i.results.length>0){const e=i.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!i.ground.mapPoint||t.map.ground.opacity<1||i.ground.distance-(e.distance??0)>-Math.min(3*i.ground.distance,"global"===t.viewingMode?_(t.renderCoordsHelper.spatialReference).radius/t.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY)))return e}return null}_generateViewHandles(e){return[e.on("immediate-click",async e=>{const t="active"===this.state&&"create"===this._operationHandle?.type;"disabled"!==this.state&&!t&&this.updateOnGraphicClick&&await this._updatingHandles.addPromise(this._handleImmediateClick(e))},L.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(Q(e)));let o=null;if(null!=t){const i=t.graphic;this.updateGraphics.includes(i)||i.layer===this.layer?(e.stopPropagation(),o=i):"2d"!==this.view?.type||this._isComponentGraphic(i)||"active"!==this.state||this.cancel()}else"active"===this.state&&this.cancel();null==o||this.updateGraphics.includes(o)||await this.update([o],{...this.defaultUpdateOptions,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions}})}async _setupCreateOperation(e,t){const o=this.view;if(!o)return this._logMissingView(),null;const i={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},a=await this._setupDrawGraphicTool(e,o,i);return null==a?null:(o.tools.add(a),o.activeTool=a,this._setupCreateOperationHandle(a))}async _setupDrawGraphicTool(e,t,o){if("multipoint"===e&&"3d"===t.type)return this._logError("sketch:create","Multipoint geometries are not supported in SceneView."),null;if(!t)return this._logMissingView(),null;const{cursor:i,defaultZ:a,hasZ:s,geometryToPlace:r,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=te(p,e),c=oe(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:i,defaultZ:a,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:r,geometryType:c,mode:h,graphicSymbol:this._getGraphicSymbolFromTool(e),hasZ:s,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),B(),$()]);return ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:le(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}async _makeDrawGraphicTool3D(e){const[t,o,i]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(t)||this.destroyed)return null;const{elevationInfo:a}=this.layer;return new t.module.DrawGraphicTool3D({...e,elevationInfo:a,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:i})}_setupCreateOperationHandle(e){const t=this.view;if(!t)return this._logMissingView(),null;let o=null;const i=e.forceUniformSize,s=e.centered,r=[t.on("key-down",t=>{if(t.key===F.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===F.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==F.vertexAdd||t.repeat)t.key===F.undo?(t.stopPropagation(),n.undo()):t.key===F.redo?(t.stopPropagation(),n.redo()):t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===F.center&&(t.repeat||(e.centered=!s,t.stopPropagation())):(e.forceUniformSize=!i,t.stopPropagation());else{const o=e.drawOperation.geometryType;"polyline"!==o&&"polygon"!==o&&"multipoint"!==o||(t.stopPropagation(),e.drawOperation.commitStagedVertex())}},L.WIDGET),t.on("key-up",t=>{t.key===F.pan?e.enabled=!0:t.key!==F.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===F.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},L.WIDGET),e.on("vertex-add",t=>{switch(o=null==o?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:o,tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("cursor-update",t=>{e.drawOperation.numCommittedVertices>0&&this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:{coordinates:t.vertices[0].coordinates,type:"cursor-update"},type:"create"})}),e.on("vertex-remove",t=>{switch(t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:"active",tool:this.activeTool,toolEventInfo:t,type:"create"});break;case"undo":this._emitUndoEvent({graphics:[e.graphic],tool:e.geometryType});break;case"redo":this._emitRedoEvent({graphics:[e.graphic],tool:e.geometryType})}}),e.on("complete",e=>{this._set("createGraphic",e.graphic),o="complete",e.aborted?n&&n.cancel():n&&n.complete()}),d(()=>this._getGraphicSymbolFromTool(e.geometryType),t=>{e.graphicSymbol=t})],n=new X({activeComponent:e,tool:e.geometryType,type:"create",onEnd:()=>{a(r),t.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return n}_getGraphicSymbolFromTool(e){switch(e){case"point":case"multipoint":return this.pointSymbol;case"polyline":case"freehandPolyline":return this.polylineSymbol;case"circle":case"rectangle":case"polygon":case"freehandPolygon":return this.polygonSymbol;case"mesh":return this.meshSymbol}}async _setupUpdateOperation(e,t){const{layer:o,view:i}=this;if(!i)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let s=a.tool??ae.tool;for(const r of e)o.remove(r),o.add(r);if("3d"===i.type){if(0===e.length)return null;switch(s){case"move":return this._setupMove3DOperation(e,a,i,s);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,i);case"transform":return this._setupGraphicTransform3DOperation(e,a,i)}}switch(s){case"move":return this._setupMove2DOperation(e,a,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,s,a,i);case"transform":if(1===e.length){const t=e[0].geometry?.type;"point"!==t&&"multipoint"!==t||(s="reshape")}return this._setupTransformOrReshape2DOperation(e,s,a,i)}}async _setupMove3DOperation(e,t,o,i,s=!1){const[r,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=r.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const a of e){const e=new p({view:o,graphic:a}),t=R(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${D(t)}).`),null;h.set(a,e)}const d=new l({view:o,enableZ:t.enableZ,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,autoLengthMeasurementUtils:n});o.tools.add(d),d.objects.addMany(Array.from(h.values())),s||this.updateGraphics.addMany(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:e=>{this.updateGraphics.push(e);const t=new p({view:o,graphic:e});h.set(e,t),d.objects.push(t),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);if(m.history.undo.forEach(e=>e.updates.splice(t,1)),m.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0===this.updateGraphics.length)return void m.complete();const o=h.get(e);o&&(d.objects.remove(o),o.destroy(),h.delete(e))},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;if("transform"!==i)return;const e=this.updateGraphics.at(0),a=await this._setupReshape3DOperation(e,t,o,!0);a&&!ge(a)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(a,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,i=!1){if(1===e.length&&0===P(e[0])){const a=e[0],s=a.geometry;if(null!=s&&("point"===s.type||"mesh"===s.type))return this._setupPointTransform3DOperation(a,t,o);if(null!=s&&("polygon"===s.type||"polyline"===s.type))return this._setupPolyTransform3DOperation(a,t,o,i)}return this._setupMove3DOperation(e,t,o,"transform",i)}async _setupPointTransform3DOperation(e,t,o){const i="transform",{enableRotation:s,enableScaling:r,enableZ:n}=t,p=await this._requireModule(import("../../views/3d/interactive/editingTools.js"));if(ge(p))return p;const{TransformTool3D:l,ManipulatedObject3DGraphic:h}=p.module,c=new h({graphic:e,view:o}),d=new l({object:c,view:o,enableRotation:s,enableScaling:r,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ee({activeComponent:d,tool:i,type:"update",onEnd:()=>{a(u),ye(o,d),c.destroy()},undo:()=>{ue(this.view,d),he(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i})},redo:()=>{ce(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:i})},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),m.onEnd(),m.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),m.complete()},toggleTool:()=>{}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},L.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,i=!1){const s="transform",{enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),$()]);if(ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(F.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:r,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),i||this.updateGraphics.add(e);const v=[],f=new ee({activeComponent:g,tool:s,type:"update",onEnd:()=>{a(v),ye(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),f.onEnd(),f.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),f.complete()},toggleTool:async()=>{if(1!==this.updateGraphics.length||!1===t.toggleToolOnClick)return;const i=await this._setupReshape3DOperation(e,t,o,!0);i&&!ge(i)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(i,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),L.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),L.WIDGET),o.on("key-down",e=>{e.key!==F.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},L.WIDGET)),f}async _setupMove2DOperation(e,t,o){const i="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s=await this._getGraphicMover(e,t,o);if(ge(s))return s;const r=new ee({activeComponent:s,tool:i,type:"update",onEnd:()=>{this._clearCursor(),a(l),a(p),s.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();he(r,e),r.refreshComponent(),this._emitUndoEvent({graphics:e,tool:i})},redo:()=>{const e=this.updateGraphics.toArray();ce(r,e),r.refreshComponent(),this._emitRedoEvent({graphics:e,tool:i})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),s.graphics=this.updateGraphics.toArray(),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),0!==this.updateGraphics.length?s.graphics=o:r.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key!==F.constraint||e.repeat||(n=!0,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET),o.on("key-up",e=>{e.key===F.constraint&&n&&(n=!1,s.enableMoveAllGraphics=!s.enableMoveAllGraphics)},L.WIDGET)],l=this._getHandlesForComponent(r,t);return r}async _setupReshape3DOperation(e,t,o,i=!1){const s="reshape",[r,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),B(),$()]);if(ge(r))return r;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=r.module,c=new l({view:o,graphic:e}),d=I(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${D(d)}).`),null;const u=t.reshapeOptions,m=new h({view:o,object:c,enableZVertex:t.enableZ&&"move"===u?.vertexOperation,enableZShape:t.enableZ&&"move"===u?.shapeOperation,enableMoveObject:"move"===u?.shapeOperation||"move-xy"===u?.shapeOperation,enableMidpoints:"split"===u?.edgeOperation,enableEdgeOffset:"offset"===u?.edgeOperation,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:p});o.tools.add(m),i||this.updateGraphics.add(c.graphic);const y=[],g=new ee({activeComponent:m,tool:s,type:"update",onEnd:()=>{a(y),ye(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s}))},addToSelection:async e=>{this.updateGraphics.add(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"}),g.onEnd(),g.destroy();const i=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);ge(i)||this._setUpdateOperationHandle(i,t)},removeFromSelection:e=>{this.updateGraphics.remove(e),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"}),g.complete()},toggleTool:async()=>{if(!1===t.toggleToolOnClick)return;g.onEnd(),g.destroy();const e=await this._setupGraphicTransform3DOperation(this.updateGraphics.toArray(),t,o,!0);ge(e)||this._setUpdateOperationHandle(e,t)}});return y.push(...this._getHandlesForComponent(g,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(g,e,t),L.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},L.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,i){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const s="transform"===t?await this._getBox(e,o,i):await this._getReshape(e,o,i);if(ge(s))return s;const r=new ee({activeComponent:s,type:"update",onEnd:()=>{a(p),a(n),r.activeComponent&&!r.activeComponent.destroyed&&r.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{he(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},redo:()=>{ce(r,this.updateGraphics.toArray()),r.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:r.tool})},addToSelection:async e=>{let t=r.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),r.onEnd(),r.destroy();const a=await this._setupTransformOrReshape2DOperation(t,"transform",o,i);if(ge(a))return;this._setUpdateOperationHandle(a,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),r.resetHistory();this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[e],removed:[],type:"selection-change"},type:"update"})},removeFromSelection:async e=>{const t=this.updateGraphics.indexOf(e);r.history.undo.forEach(e=>e.updates.splice(t,1)),r.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();if(0===o.length)r.complete();else{const e=o[0].geometry;1!==o.length||null==e||"point"!==e.type&&"multipoint"!==e.type?r.activeComponent.graphics=o:r.toggleTool()}this.emit("update",{graphics:o,state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:[],removed:[e],type:"selection-change"},type:"update"})},toggleTool:async()=>{if(this.updateGraphics.length>1)return;const e=this.updateGraphics.at(0),t=e.geometry;if(null!=t&&("reshape"===r.tool&&("point"===t.type||"multipoint"===t.type)||"transform"===r.tool&&"extent"===t.type))return;let s=null;"transform"===r.tool?s=await this._getReshape([e],o,i):"reshape"===r.tool&&(s=await this._getBox([e],o,i)),ge(s)||(r.activeComponent?.destroy(),r.activeComponent=s,r.activeComponent&&(a(p),p=this._getHandlesForComponent(r,o)))}}),n=[i.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(r,e,o),L.WIDGET),i.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(r,e),e.key===F.constraint&&!e.repeat&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET),i.on("key-up",e=>{if(e.key===F.constraint&&r){const e=r.activeComponent;e&&"box"===e.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},L.WIDGET)];let p=this._getHandlesForComponent(r,o);return r}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:i,highlightOptions:a}=t,s=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return ge(s)?s:new s.module.default({enableMoveAllGraphics:i,highlightName:a?.name,highlightsEnabled:!!a?.enabled,indicatorsEnabled:!1,graphics:e,view:o,callbacks:{onGraphicMoveStart:({dx:e,dy:t,graphic:o})=>{this._displayCursor("grabbing"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-start"},type:"update"})},onGraphicMove:({dx:e,dy:t,graphic:o})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move"},type:"update"}),onGraphicMoveStop:({dx:e,dy:t,graphic:o})=>{this._displayCursor("pointer"),this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:"move-stop"},type:"update"})},onGraphicPointerOver:()=>this._displayCursor("move"),onGraphicPointerOut:()=>this._clearCursor()}})}async _getBox(e,t,o){const{enableRotation:i,enableScaling:a,highlightOptions:s,preserveAspectRatio:r}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),$()]);if(ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(F.constraint);return new n.module.default({graphics:e,enableRotation:i,enableScaling:a,highlightName:s?.name,highlightsEnabled:!!s?.enabled,preserveAspectRatio:!!r!=!!l,layer:this._internalGraphicsLayer,view:o,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:p,callbacks:{onMoveStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMove:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onMoveStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScale:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onScaleStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotate:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onRotateStop:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"})}})}async _getReshape(e,t,o){const{highlightOptions:i,reshapeOptions:a}=t,s="split"===a?.edgeOperation,r="move"===a?.shapeOperation,[n,p,l]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),B(),$()]);return ge(n)?n:new n.module.default({enableMidpoints:s,enableMovement:r,graphic:e[0],highlightName:i?.name,highlightsEnabled:!!i?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:p,automaticLengthMeasurementUtils:l,view:o,callbacks:{onReshapeStart:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshape:e=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e},type:"update"}),onReshapeStop:({mover:e,type:t})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e,type:t},type:"update"}),onMoveStart:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:i})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:i},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const i=e.map(e=>T(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:i,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const i=e.map(e=>T(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:i,vertices:o,type:t},type:"update"})}}})}_getHandlesForComponent(e,t){const o=e.activeComponent;if(!o)return[];switch(o.type){case"graphic-mover":return[o.on("graphic-click",({graphic:o,viewEvent:i})=>{i.native?.shiftKey&&t.multipleSelectionEnabled&&(i.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(me(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me(t.graphics))),o.on("rotate-start",t=>e.addToHistory(me(t.graphics))),o.on("scale-start",t=>e.addToHistory(me(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(me([t.mover]))),o.on("reshape-start",t=>e.addToHistory(me([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(me([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(me([t.oldGraphic])))];case"move-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("move-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-start"},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e.dx,dy:e.dy,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move"},type:"update"})}),o.events.on("move-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:0,dy:0,mover:e.objects.length>0?e.objects[0].graphic:null,type:"move-stop"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"transform-3d":return[o.events.on("record-undo",({updates:t})=>{e.addToHistory({updates:t})}),o.events.on("translate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-start"},type:"update"})}),o.events.on("translate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move-stop"},type:"update"})}),o.events.on("rotate-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-start"},type:"update"})}),o.events.on("rotate-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate-stop"},type:"update"})}),o.events.on("scale-start",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-start"},type:"update"})}),o.events.on("scale-stop",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale-stop"},type:"update"})}),o.events.on("translate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,dx:e.dxScreen,dy:e.dyScreen,type:"move"},type:"update"})}),o.events.on("rotate",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,angle:e.angle,type:"rotate"},type:"update"})}),o.events.on("scale",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{mover:e.object.graphic,xScale:e.xScale,yScale:e.yScale,type:"scale"},type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})];case"reshape-3d":return[o.events.on("reshape",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("move",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{...e,mover:e.object.graphic},type:"update"})}),o.events.on("vertex-add",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("vertex-remove",e=>{this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:e,type:"update"})}),o.events.on("immediate-click",o=>{o.shiftKey?this._toggleSelection([o.object.graphic],e,t):e.toggleTool()})]}}_onTransformOrReshape2DGraphicClick(e,t,o){const{graphic:i,viewEvent:a}=o;return a.native?.shiftKey&&i.layer===this.layer?(a.stopPropagation(),e.removeFromSelection(i)):t.toggleToolOnClick?(a.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const i=()=>{if(e===this._operationHandle){const i=this.updateGraphics.toArray(),a=this._operationHandle.tool;this._operationHandle.destroy(),this._operationHandle=null,this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray()),this.updateGraphics.removeAll(),o&&o.remove(this._internalGraphicsLayer),this._restorePopup(t),this.emit("update",{graphics:i,state:"complete",aborted:e.cancelled,tool:a,toolEventInfo:null,type:"update"})}};e.on("complete",i)}async _getCommonUpdateOperationClickHandlers(e,t,o){const i=Q(t),a=await t.defer(()=>this._getFirstHit(i));if(null==a)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([a.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(a.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const i=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!i||e.layer!==this.layer)&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===F.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===F.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===F.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&F.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){if(!this._operationHandle||"update"!==this._operationHandle.type)return;const t=this.activeComponent,o=this.updateGraphics.toArray();null!=t&&("reshape"!==t.type||1===o.length&&"point"===o[0].geometry?.type)&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=r(this._internalGraphicsLayer))}_isComponentGraphic(e){const{activeComponent:t}=this;return!(!e||null==t)&&(e.attributes?.esriSketchTool||"draw-2d"===t.type&&t.graphic===e||("box"===t.type||"reshape"===t.type)&&t.isUIGraphic(e))}_clearCursor(){this.removeHandles(se)}_displayCursor(e){this.removeHandles(se),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),se)}_logError(e,t,i){s.getLogger(this).error(new o(e,t,i))}async _requireModule(e){const t=new AbortController;this._moduleLoaderAbortController=t;const o=await e;return this._moduleLoaderAbortController!==t||t.signal.aborted?{requireError:"aborted"}:{module:o}}_emitUndoEvent(e){this.emit("undo",{...e,type:"undo"})}_emitRedoEvent(e){this.emit("redo",{...e,type:"redo"})}_emitDeleteEvent(e){this.emit("delete",{...e,type:"delete"})}get test(){}wait(){return y(()=>!this.updating)}_disablePopupEnabled(e){return"3d"!==this.view?.type||this.updateOnGraphicClick||(e?.toggleToolOnClick??!1)}_disablePopup(e){this._disablePopupEnabled(e)&&this.view&&null==this._originalPopupEnabled&&(this._originalPopupEnabled=this.view.popupEnabled,this.view.popupEnabled=!1)}_restorePopup(e){this._disablePopupEnabled(e)&&this.view&&null!=this._originalPopupEnabled&&(this.view.popupEnabled=this._originalPopupEnabled,this._originalPopupEnabled=null)}async _waitViewReady(){const e=this.view;e?(n(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await l(y(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",pe("view"))}_logMissingLayer(){this._logError(ne,pe("layer"))}};e([g()],re.prototype,"_defaultSnappingManager",void 0),e([g()],re.prototype,"updating",null),e([g({readOnly:!0})],re.prototype,"_updatingHandles",void 0),e([g()],re.prototype,"_operationHandle",void 0),e([g({readOnly:!0})],re.prototype,"activeTool",null),e([g({readOnly:!0})],re.prototype,"activeCreateToolDrawMode",null),e([g()],re.prototype,"activeTooltip",null),e([g({types:U})],re.prototype,"activeFillSymbol",void 0),e([g()],re.prototype,"activeLineSymbol",void 0),e([g()],re.prototype,"activeVertexSymbol",void 0),e([g()],re.prototype,"allowDeleteKey",void 0),e([g({readOnly:!0})],re.prototype,"createGraphic",null),e([g()],re.prototype,"defaultCreateOptions",null),e([g()],re.prototype,"defaultUpdateOptions",null),e([g({type:V,nonNullable:!0})],re.prototype,"labelOptions",null),e([g()],re.prototype,"layer",void 0),e([g({types:U})],re.prototype,"pointSymbol",void 0),e([g({types:U})],re.prototype,"polygonSymbol",void 0),e([g({types:U})],re.prototype,"polylineSymbol",void 0),e([g()],re.prototype,"meshSymbol",void 0),e([g({type:N,nonNullable:!0})],re.prototype,"snappingOptions",null),e([g()],re.prototype,"snappingManager",null),e([g({readOnly:!0})],re.prototype,"state",null),e([g({type:W,nonNullable:!0})],re.prototype,"tooltipOptions",null),e([g({readOnly:!0})],re.prototype,"updateGraphics",void 0),e([g()],re.prototype,"updateOnGraphicClick",void 0),e([g()],re.prototype,"creationMode",void 0),e([g({type:Z,nonNullable:!0})],re.prototype,"valueOptions",null),e([g({types:U})],re.prototype,"vertexSymbol",void 0),e([g({value:null})],re.prototype,"view",null),e([g({constructOnly:!0,type:K})],re.prototype,"sketchOptions",void 0),re=e([v("esri.widgets.Sketch.SketchViewModel")],re);const ne="sketch:missing-property",pe=e=>`Property '${e}' is missing on SketchViewModel.`;function le(e){return"polygon"===e||"rectangle"===e||"circle"===e}function he(e,t){de("undo",e.history.undo,e.history.redo,t)}function ce(e,t){de("redo",e.history.redo,e.history.undo,t)}function de(e,t,o,i){const a=t.pop();if(!a)return;const s=a.updates,r=[];i.forEach((t,o)=>{const i=s[o];null!=i&&("geometry"in i&&null!=i.geometry&&(r.push({geometry:t.geometry}),t.geometry=i.geometry),"symbol"in i&&null!=i.symbol&&(r.push({symbol:t.symbol}),t.symbol=i.symbol),"undo"in i&&(r.push(i),i[e](t)))}),o.push({updates:r})}function ue(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function me(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function ye(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function ge(e){return"requireError"in e&&"aborted"===e.requireError}export{re as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{deprecatedFunction as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{watch as i,on as r,initial as o,when as a}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../core/support/UpdatingHandles.js";import d from"../layers/support/CodedValueDomain.js";import{isSubtypeGroupLayer as u}from"../layers/support/layerUtils.js";import h from"../rest/support/Query.js";import p from"./Widget.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{storeNode as _}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as v}from"./support/jsxFactory.js";import y from"./UtilityNetworkTrace/UtilityNetworkTraceFeature.js";import f from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{defaultSwatchColors as S}from"./UtilityNetworkTrace/support/GraphicHandler.js";const T="esri-utility-network-trace",k={base:T,addButtonContainer:`${T}__add-button-container`,blockContainer:`${T}__block-container`,blockContent:`${T}__block-content`,clearPrompt:`${T}__reset-prompt`,doublePaddingTop:`${T}__double-pad-top`,flow:`${T}__flow`,listContainer:`${T}__list-container`,noticeContainer:`${T}__notice-container`,numberInput:`${T}__number-input`,promptDivider:`${T}__divider`};function F(e){return{height:e+"px"}}function C(e){return{width:e+"px"}}function A(){return{width:"75%"}}function R(e){return{width:"100%",height:window.getComputedStyle(e).getPropertyValue("max-height")}}function N(e){return{display:"flex",flexDirection:e}}function M(e){return e instanceof d}const x={noExtension:-2147208474};let I=class extends p{constructor(e,t){super(e,t),this._activeTab="input",this._activeTrace=null,this._activeSwatch="",this._addNonspatialObjectActive=!1,this._alertRemoveModal=!1,this._assetGroupHeader="",this._assetTypeHeader="",this._confirmReset=!1,this._errorMessage="",this._swatchNode=null,this._selectToolActive=!1,this._showFeatureInfoActive=!1,this._traceHeaderForFlow="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._traceResultsState="result",this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._findNonspatialFeatureWidget=new y({mode:"add-nso"}),this._individualResultNode=null,this._loadUnError=!0,this._resultDisplayField="objectid",this._resultFeatureWidget=new y({mode:"show-feature-info"}),this._resultObjectIdField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._showResultOptions=!1,this._symbolStartFlag=null,this._symbolBarrier=null,this._traceLocationType="starting-point",this._updatingHandles=new c,this._warningNoBarrierAssetFound=!1,this._warningNoBarrierAssetNsoFound=!1,this._warningNoStartAssetFound=!1,this._warningNoStartAssetNsoFound=!1,this._warningNoTerminal=!1,this._wasPopupEnabled=!1,this._watchHandler=null,this.disabled=!0,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new f,this._afterComponentCreate=this._afterComponentCreate.bind(this)}initialize(){this._utilityNetworkTraceInitialized(),this.addHandles([i(()=>this.view,()=>this._viewChangeHandle(),o),i(()=>this.viewModel?.resultAreaProperties,()=>this.scheduleRender()),i(()=>this._addNonspatialObjectActive,e=>{this._findNonspatialFeatureWidget.feature=null,e?this._changeCursor("crosshair"):this.view.popupEnabled=this._wasPopupEnabled}),i(()=>this._showFeatureInfoActive,e=>{e||(this._resultFeatureWidget.feature=null,this.view.popupEnabled=this._wasPopupEnabled)}),r(()=>this._findNonspatialFeatureWidget,"add-nso-trace-location",({featureWidget:e})=>{this.viewModel.addNonspatialTraceLocation(e.graphic,this._traceLocationType),this._warningNoFlag=!1,this._addNonspatialObjectActive=!1}),r(()=>this._findNonspatialFeatureWidget,"close-un-trace-feature-block",()=>{this._changeCursor("default"),this._addNonspatialObjectActive=!1,this.viewModel.cancelAddFlagByHit()}),r(()=>this._resultFeatureWidget,"close-un-trace-feature-block",()=>{this._showFeatureInfoActive=!1}),r(()=>this._resultFeatureWidget,"close",()=>{this._resetResultFeatureWidget()})])}destroy(){this._findNonspatialFeatureWidget?.destroy(),this._resultFeatureWidget?.destroy()}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get enableResultArea(){return this.viewModel.enableResultArea}set enableResultArea(e){this.viewModel.enableResultArea=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return t(s.getLogger(this),"gdbVersion will be removed and the gdbVersion of the UtilityNetwork will be consumed directly.",{replacement:"UtilityNetwork.gdbVersion",version:"4.31"}),this.viewModel.gdbVersion}set gdbVersion(e){t(s.getLogger(this),"gdbVersion will be removed and the gdbVersion of the UtilityNetwork will be consumed directly.",{replacement:"UtilityNetwork.gdbVersion",version:"4.31"}),this.viewModel.gdbVersion=e}get icon(){return"utility-network-trace"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get resultAreaProperties(){return this.viewModel.resultAreaProperties}set resultAreaProperties(e){this.viewModel.resultAreaProperties=e}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1,this._resetResultFeatureWidget();const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._traceResultsState="result",this.switchTab("results"),this.viewModel._activeProgress=!0,this.viewModel.removeAllResultAreaGraphics(),await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach(e=>{switch(e){case"noStartingPoints":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}})}confirmReset(){this._confirmReset=!0}render(){return this._mixCustomStrings(),this._overrideFlagSymbol(),v("div",{class:this.classes(k.base,m.widget,m.panel,{[m.widgetDisabled]:this.disabled})},this._renderUtilityNetworkTrace())}loadDependencies(){return g({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-pad":()=>import("@esri/calcite-components/dist/components/calcite-action-pad"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),"color-picker-swatch":()=>import("@esri/calcite-components/dist/components/calcite-color-picker-swatch"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),fab:()=>import("@esri/calcite-components/dist/components/calcite-flow"),flow:()=>import("@esri/calcite-components/dist/components/calcite-fab"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),"split-button":()=>import("@esri/calcite-components/dist/components/calcite-split-button"),tab:()=>import("@esri/calcite-components/dist/components/calcite-tab"),"tab-nav":()=>import("@esri/calcite-components/dist/components/calcite-tab-nav"),"tab-title":()=>import("@esri/calcite-components/dist/components/calcite-tab-title"),tabs:()=>import("@esri/calcite-components/dist/components/calcite-tabs")})}switchTab(e){this._activeTab=e}switchToFromAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._traceResultsState=s}switchToFromAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._traceResultsState=s}switchToFromFunctions(e,t){this._traceResultsFunctions=e,this._traceResultsState=t}switchToFromIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._traceResultsState=s}_renderAddNonspatialLocationBlock(){const{messages:e}=this;return v("calcite-block",{expanded:!0,key:`${this.id}__add-spatial-location-block`,label:e.inputsStrings.addNonspatialOption},this._findNonspatialFeatureWidget.render())}_renderAddSpatialLocationBlock(){const{messages:e,messagesCommon:t}=this;return v("calcite-block",{class:k.blockContent,expanded:!0,heading:"starting-point"===this._traceLocationType?e.inputsStrings.headerStartingPoint:e.inputsStrings.headerBarrier,key:`${this.id}__add-nonspatial-location-block`,label:"starting-point"===this._traceLocationType?e.inputsStrings.headerStartingPoint:e.inputsStrings.headerBarrier},v("calcite-action",{icon:"x",onclick:()=>{this.viewModel.removeClickHandler(),this.view?.popup&&(this.view.popupEnabled=this._wasPopupEnabled),this._changeCursor("default"),this._selectToolActive=!1},slot:"control",text:t.close}),v("calcite-notice",{icon:"starting-point"===this._traceLocationType?"pin-plus":"x-circle-f",kind:"info",open:!0},v("div",{slot:"message"},e.inputsStrings.addPointHint)))}_renderClearTraceResultsBlock(){const{messages:e,messagesCommon:t}=this;return v("calcite-scrim",{key:"prompt"},v("div",{class:k.clearPrompt},v("h3",{slot:"header"},e.resultsStrings.startOverButton),v("div",{slot:"content"},e.resultsStrings.startOverValidation),v("div",{class:k.promptDivider}),v("div",{styles:N("row")},v("calcite-button",{appearance:"outline",onclick:()=>{this._confirmReset=!1},slot:"secondary",width:"full"},t.cancel),v("calcite-button",{onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")},slot:"primary",width:"full"},t.form.ok))))}_renderExecutingTraceBlock(){const{messages:e}=this;return v("calcite-loader",{label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"})}_renderInputBlock(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__inputs-block`,label:e.inputsStrings.headerTabInputs},v("calcite-flow",{class:k.flow},v("calcite-flow-item",{key:`${this.id}__inputs-flow-item`,selected:!this._selectToolActive&&!this._addNonspatialObjectActive},this._warningNoFlag?this._renderWarningMessage("flag",!0):null,this._warningNoTerminal?this._renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this._renderWarningMessage("trace",!0):null,this._renderTraceSelectorContainer(),this._renderStartFlagsContainer(),this._renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?v("div",{styles:F(10)}):null,v("calcite-fab",{appearance:"solid",icon:"utility-network-trace",kind:"brand",onclick:()=>{this.checkCanTrace()},slot:"fab",text:e.tracingStrings.runTrace,textEnabled:!0,title:e.tracingStrings.runTrace,type:"button"}))))}_renderInputsTab(){const{messagesCommon:e}=this;let t="input";return this._selectToolActive&&!this._addNonspatialObjectActive&&(t="add-spatial-location"),!this._selectToolActive&&this._addNonspatialObjectActive&&(t="add-nso-location"),this.disabled&&(t="loading"),v("calcite-tab",{key:`${this.id}__inputs-tab-item`,selected:"input"===this._activeTab},"loading"===t?v("calcite-loader",{label:e.loading,type:"indeterminate"}):null,"input"===t?this._renderInputBlock():null,"add-spatial-location"===t?this._renderAddSpatialLocationBlock():null,"add-nso-location"===t?this._renderAddNonspatialLocationBlock():null)}_renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter(e=>"barrier"===e.type),s.forEach(e=>{e.displayValue&&t.push(this._renderFlagRow(e,"barrier"))});let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:e.inputsStrings.headerBarrier+" ("+s.length+")",overlayPositioning:"fixed"},v("div",{slot:"icon"},i||v("calcite-icon",{icon:"x-circle-f",scale:"s"})),v("div",null,e.inputsStrings.barrierPointHint),v("div",{class:k.listContainer},t),this._warningNoBarrierAssetFound?this._renderWarningMessage("noBarrierAsset",!0):null,this._warningNoBarrierAssetNsoFound?this._renderWarningMessage("noBarrierAssetNso",!0):null,v("div",{class:k.addButtonContainer},v("calcite-split-button",{appearance:"outline-fill",primaryIconStart:"select",primaryText:e.inputsStrings.addPointOption,onCalciteSplitButtonPrimaryClick:()=>{this._setupAddTraceLocation("barrier")}},v("calcite-dropdown-group",{selectionMode:"none"},v("calcite-dropdown-item",{onCalciteDropdownItemSelect:()=>{this._setupAddNonspatialObject("barrier")}},e.inputsStrings.addNonspatialOption)))))}_renderFlagRow(e,t){const{messages:s,messagesCommon:i}=this,r=[];let o=!1;return null!=e.allTerminals&&e.allTerminals.terminals.length>0&&(o=!0,e.allTerminals.terminals.forEach(t=>{let s=!1;e?.selectedTerminals?.includes(t.id)&&(s=!0),r.push(v("calcite-combobox-item",{key:t.name,selected:s,textLabel:t.name,value:t.id}))})),v("calcite-block",{collapsible:null!==e.allTerminals||"barrier"===e.type,heading:e.displayValue?.value??"",key:"pop"+e.globalId+e.type+e.id+t,overlayPositioning:"fixed"},v("calcite-action",{icon:"trash",label:i.remove,onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",slot:"header-menu-actions",text:i.remove,textEnabled:!0}),e.mapGraphic&&e.mapPoint?v("calcite-action",{icon:"zoom-to-object",label:s.globalStrings.zoomToFeature,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,textEnabled:!0}):null,"barrier"===e.type?v("calcite-label",{layout:"inline",scale:"s"},v("calcite-checkbox",{checked:e.isFilterBarrier,onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)},scale:"s"}),s.inputsStrings.barrierFilter):null,o?v("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,maxItems:0,overlayPositioning:"fixed",placeholder:s.globalStrings.selectTerminalPlaceholder,scale:"s",selectionMode:"multiple",onCalciteComboboxChange:t=>{t.currentTarget.selectedItems.length>0?(e.selectedTerminals=[],t.currentTarget.selectedItems.forEach(t=>{this.viewModel.addTerminal(t.value,e)})):e.selectedTerminals=[]},onCalciteComboboxChipClose:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.currentTarget.value,e)}},r):null)}_renderHighlightColorPicker(e,t,s){const{messages:i}=this,{graphicHandler:r}=this.viewModel,o=[],a=new RegExp(`^${e.hex}$`,"i"),l=r.highlightColor.length>S.length?5:4;for(const n of r.highlightColor)o.push(v("calcite-action",{active:a.test(n.hex),key:n.hex,label:i.resultsStrings.graphicColor,onclick:()=>{"aggregate"===s?this.viewModel.changeResultGraphicColor(n,t):this.viewModel.changeResultAreaColor(t,n)},scale:"s",text:i.resultsStrings.graphicColor},v("calcite-color-picker-swatch",{active:a.test(n.hex),color:n.hex,scale:"s"})));return v("calcite-action-pad",{expandDisabled:!0,layout:"grid",position:"start"},v("calcite-action-group",{columns:l},o))}_renderRemoveTraceContainer(e){const{messages:t}=this;return v("calcite-action",{icon:"trash",label:t.globalStrings.clearResults,onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",slot:"header-menu-actions",text:t.globalStrings.clearResults,textEnabled:!0})}_renderResultsTab(){let e="results";return this._showFeatureInfoActive&&(e="show-feature-info"),this.viewModel._activeProgress&&(e="executing"),this._confirmReset&&(e="clear-trace-results"),v("calcite-tab",{key:`${this.id}__results-tab-item`},"executing"===e?this._renderExecutingTraceBlock():null,"results"===e?this.viewModel.traceResults.length?this._renderResultsPanel():this._renderWarningMessage("noTraceExecuted",!1):null,"show-feature-info"===e?this._renderShowFeatureInfoBlock():null,"clear-trace-results"===e?this._renderClearTraceResultsBlock():null)}_renderResultsPanel(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__results-block`,label:e.resultsStrings.headerTabResults},v("calcite-flow",{class:k.flow},this._renderTraceResults(),this._renderTraceResultFunctions(),this._renderTraceResultByAssetGroup(),this._renderTraceResultByAssetType(),this._renderTraceResultIndividual()))}_renderResultRowFunctions(e){return v("calcite-block",{collapsible:!1,heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,overlayPositioning:"fixed"})}_renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return v("calcite-list-item",{key:`${t}-${e.assetGroupCode}`,label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToFromAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")","assetType")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return v("calcite-list-item",{key:`${t}-${e.assetTypeCode}`,label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this._updatingHandles.addPromise(this.viewModel.queryFeaturesById(e).then(s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToFromIndividualRecords(i,t+" ("+e.length+")","records")}else this.switchToFromIndividualRecords(e,t+" ("+e.length+")","records")}))}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderResultRowIndividual(e){const{messages:t}=this;let s,i=null;if(i=e?.details?.fields.find(({name:e})=>e===this._resultDisplayField),"date"===i?.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if("assetgroup"===this._resultDisplayField.toLowerCase())s=this._getAssetGroupName(e);else if("assettype"===this._resultDisplayField.toLowerCase())s=this._getAssetTypeName(e);else if(i?.domain&&M(i.domain)){const t=i.domain.codedValues.find(({code:t})=>t===e.details.attributes[this._resultDisplayField]);s=t?.name}else s=e.details?.attributes[this._resultDisplayField]??e.objectId;return s&&""!==s&&null!==s?"string"==typeof s&&(s.trim()||(s=t.resultsStrings.noValue)):s=t.resultsStrings.noValue,v("calcite-list-item",{key:e.details.uid,label:s,onCalciteListItemSelect:async()=>{this._disablePopup(),this._showFeatureInfoActive=!0;const t=u(e.details?.layer)?e.details?.layer:null;if(t){const s=Object.keys(e.details.attributes).find(e=>e.toLowerCase()===t.subtypeField.toLowerCase())??"assetgroup",i=t.sublayers.find(t=>t.subtypeCode===e.details.attributes[s]),r=Object.keys(e.details.attributes).find(e=>e.toLowerCase()===t.objectIdField.toLowerCase())??"objectid",o=new h;o.outFields=["*"],o.returnGeometry=!0,o.where=r+" = "+e.details.attributes[r];const a=await(i?.queryFeatures(o));a&&this._resultFeatureWidget.open(a.features[0])}else this._resultFeatureWidget.open(e.details)}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderShowFeatureInfoBlock(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__show-feature-info-block`,label:e.resultsStrings.headerFeatureInfo},this._resultFeatureWidget.render())}_renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter(e=>"starting-point"===e.type),s.forEach(e=>{e.displayValue&&t.push(this._renderFlagRow(e,"start"))});let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",overlayPositioning:"fixed"},v("div",{slot:"icon"},i||v("calcite-icon",{icon:"pin",scale:"s"})),v("div",null,e.inputsStrings.startingPointHint),v("div",{class:k.listContainer},t),this._warningNoStartAssetFound?this._renderWarningMessage("noStartAsset",!0):null,this._warningNoStartAssetNsoFound?this._renderWarningMessage("noStartAssetNso",!0):null,v("div",{class:k.addButtonContainer},v("calcite-split-button",{appearance:"outline-fill",primaryIconStart:"select",primaryText:e.inputsStrings.addPointOption,onCalciteSplitButtonPrimaryClick:()=>{this._setupAddTraceLocation("starting-point")}},v("calcite-dropdown-group",{selectionMode:"none"},v("calcite-dropdown-item",{onCalciteDropdownItemSelect:()=>{this._setupAddNonspatialObject("starting-point")}},e.inputsStrings.addNonspatialOption)))))}_renderStartOverContainer(){const{messages:e}=this;return v("calcite-fab",{appearance:"solid",icon:"trash",kind:"brand",onclick:()=>{this.confirmReset()},slot:"fab",text:e.resultsStrings.startOverButton,textEnabled:!0,title:e.resultsStrings.startOverButton,type:"button"})}_renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this._renderResultRowAssetGroup(i[e]))}return v("calcite-flow-item",{heading:this._traceHeaderForFlow,key:"assetGroupResultMultiple",selected:"assetGroup"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromAssetGroup([],"","result")}},v("calcite-list",{label:""},t),this._renderStartOverContainer())}_renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this._renderResultRowAssetType(e[s]));return v("calcite-flow-item",{heading:this._assetGroupHeader,key:"assetTypeResult",loading:this._updatingHandles.updating,selected:"assetType"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromAssetType([],"","assetGroup")}},v("calcite-list",{label:"",selectionMode:"none"},t),this._renderStartOverContainer())}_renderTraceResultFunctions(){if("functions"!==this._traceResultsState)return null;const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach(e=>{s.push(this._renderResultRowFunctions(e))}),v("calcite-flow-item",{heading:e.resultsStrings.functionHeader,key:"functionResultMultiple",selected:"functions"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromFunctions([],"result")}},s,this._renderStartOverContainer())}_renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){(t[0].details?.fields.some(({name:e})=>e.toLowerCase()===this._resultDisplayField.toLocaleLowerCase())??!1)||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach(e=>{e?.details&&s.push(this._renderResultRowIndividual(e))}),0===s.length&&s.push(v("calcite-list-item",{label:e.resultsStrings.noFeaturesInMap}))}return v("calcite-flow-item",{heading:this._assetTypeHeader,key:"individualResult",selected:"records"===this._traceResultsState,onCalciteFlowItemBack:()=>{this._showResultOptions=!1,this.switchToFromIndividualRecords([],"","assetType")}},v("calcite-action",{afterCreate:_,bind:this,"data-node-ref":"_individualResultNode",icon:"gear",id:"field_options"+this.id,label:e.resultsStrings.displayAttribute,onclick:()=>{this._showResultOptions=!0},slot:"header-actions-end",text:e.resultsStrings.displayAttribute}),this._renderTraceResultIndividualPopover(),v("calcite-list",{label:"",selectionMode:"none"},s),this._renderStartOverContainer())}_renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&(t[0].details?t[0].details.fields.forEach(({name:e,alias:t})=>{s.push(v("calcite-option",{key:`display-${e}`,label:t??e,selected:e===this._resultDisplayField,value:e})),i.push(v("calcite-option",{key:`sort-${e}`,label:t??e,selected:e===this._resultSortField,value:e}))}):(s.push(v("calcite-option",{key:`display-${this._resultDisplayField}`,label:this._resultDisplayField,value:this._resultDisplayField})),i.push(v("calcite-option",{key:`sort-${this._resultDisplayField}`,label:this._resultDisplayField,value:this._resultDisplayField})))),v("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,overlayPositioning:"fixed",placement:"left-start",referenceElement:this._individualResultNode,styles:null!==this.domNode?C(.75*this.domNode.clientWidth):A()},v("calcite-block",{expanded:!0,label:e.resultsStrings.displayAttribute,overlayPositioning:"fixed"},v("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,v("calcite-select",{label:e.resultsStrings.displayAttribute,scale:"s",onCalciteSelectChange:e=>{const t=e.currentTarget;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),v("calcite-label",{scale:"s"},e.resultsStrings.sortBy,v("calcite-select",{label:e.resultsStrings.sortBy,scale:"s",onCalciteSelectChange:e=>{const s=e.currentTarget;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}_renderTraceResults(){const{messages:e,messagesCommon:t}=this,{selectFeatures:s}=e.resultsStrings,i=this.viewModel.traceResults,r=[];return i.forEach((t,i)=>{let o=[],a=[],l=!1,n=!1,c=!1,d="";null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(n=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(a=t.results.globalFunctionResults,a.length>0&&(c=!0)),t.results.elements&&t.results.elements.length>0&&(o=t.results.elements,o.length>0&&(l=!0)),(n||l)&&(d=this.messagesUnits.units[t.resultArea?.unit]?.abbr),r.push(v("calcite-block",{class:k.blockContent,collapsible:!0,description:t.trace.description??"",expanded:!0,heading:t.trace.title,key:`${t.trace.title}${i}`,overlayPositioning:"fixed"},this._renderRemoveTraceContainer(t),v("calcite-list",{label:""},c?v("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+a.length+")",onCalciteListItemSelect:()=>{this.switchToFromFunctions(a,"functions")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,l&&this.viewModel.showSelectionAttributes?v("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+o.length+")",onCalciteListItemSelect:()=>{this.switchToFromAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+o.length+")","assetGroup")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?v("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),l?v("div",{class:k.doublePaddingTop},v("calcite-label",{layout:"inline",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)},scale:"s"},v("calcite-checkbox",{checked:t.selectionEnabled,onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?s:`${s} (${o.length})`)):null,n?v("calcite-block-section",{expanded:t.graphicEnabled,key:`aggregate-${t.trace.title}-${i}`,text:e.resultsStrings.highlightTrace,toggleDisplay:"switch",onCalciteBlockSectionToggle:e=>{e.currentTarget.expanded?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},v("calcite-list",{label:e.resultsStrings.graphicColor,selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.graphicColor,onclick:e=>{this._swatchNode=e.currentTarget,this._activeSwatch="aggGeom_"+i}},v("calcite-color-picker-swatch",{color:t.graphicColor.hex,scale:"s",slot:"actions-end"})))):null,this.enableResultArea&&(n||l)?v("calcite-block-section",{expanded:t.resultArea?.show,key:`area-${t.trace.title}-${i}`,text:e.resultsStrings.resultAreaHeader,toggleDisplay:"switch",onCalciteBlockSectionToggle:e=>{e.currentTarget.expanded?t.resultAreaGraphic?this.viewModel.addResultAreaToMap(t,t.resultAreaGraphic):this.viewModel.addResultAreaToMap(t):this.viewModel.removeResultAreaFromMap(t)}},v("calcite-list",{label:"",selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.graphicColor,onclick:e=>{const t=e.currentTarget;this._swatchNode=t,this._activeSwatch="resultArea_"+i}},v("calcite-color-picker-swatch",{color:t.resultArea?.color.hex,scale:"s",slot:"actions-end"}))),v("calcite-list",{label:"",selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.resultAreaBuffer},v("calcite-input-number",{afterCreate:this._afterComponentCreate,class:k.numberInput,max:999999,min:0,scale:"s",slot:"actions-end",suffixText:d,value:t.resultArea?.distance.toString(),onCalciteInputNumberChange:e=>{if(!this.view?.popup)return;this.view.popup.visible&&this.view.closePopup();const s=e.currentTarget;t.resultArea.distance>=0?(t.resultArea.distance=parseInt(s.value,10),this.viewModel.removeResultAreaFromMap(t),this.viewModel.addResultAreaToMap(t)):(t.resultArea.distance=0,this.viewModel.removeResultAreaFromMap(t),this.viewModel.addResultAreaToMap(t))}})))):null,v("calcite-popover",{autoClose:!0,closable:!0,label:e.resultsStrings.graphicColor,offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i||this._activeSwatch==="resultArea_"+i,overlayPositioning:"fixed",placement:"auto-start",referenceElement:this._swatchNode,scale:"s",onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this._renderHighlightColorPicker(this._activeSwatch==="resultArea_"+i?t.resultArea?.color:t.graphicColor,t,this._activeSwatch==="resultArea_"+i?"resultArea":"aggregate"))))):r.push(v("calcite-block",{collapsible:!1,expanded:!0,heading:t.trace.title,key:"error-"+i,overlayPositioning:"fixed"},this._renderRemoveTraceContainer(t),this._renderWarningMessage("noController",!1,t.status)))}),v("calcite-flow-item",{key:"traceResults",selected:"result"===this._traceResultsState},r,this._renderStartOverContainer(),this._alertRemoveModal?v("calcite-scrim",{key:"prompt"},v("div",{class:k.clearPrompt},v("h3",{slot:"header"},e.globalStrings.clearResults),v("div",{slot:"content"},e.alertsStrings.clearResultsAlert),v("div",{class:k.promptDivider}),v("div",{styles:N("row")},v("calcite-button",{appearance:"outline",onclick:()=>{this._alertRemoveModal=!1},slot:"secondary",width:"full"},t.cancel),v("calcite-button",{onclick:()=>{this._activeTrace&&this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel.traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel.traceResults[0].trace,this._traceResultsState="result")},slot:"primary",width:"full"},t.form.ok)))):null)}_renderTraceSelectorContainer(){const{messages:e}=this,t=this.viewModel.traces.map(e=>this._renderComboboxItem({value:e.globalId,text:e.title,selected:e.selected??!1})),s=this.viewModel.traces.filter(e=>e.selected),i=e.tracingStrings.traceOperation+` (${s.length})`;return v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:i,overlayPositioning:"fixed"},v("calcite-icon",{icon:"utility-network-trace",scale:"s",slot:"icon"}),v("calcite-combobox",{label:e.inputsStrings.selectTraces,maxItems:0,overlayPositioning:"fixed",placeholder:e.inputsStrings.selectTraces,scale:"s",selectionMode:"multiple",onCalciteComboboxChange:e=>{this.viewModel.traces.forEach(t=>{t.selected=e.currentTarget.selectedItems.some(e=>e.value===t.globalId)}),e.currentTarget.selectedItems.length&&(this._warningNoTraceSelected=!1)}},t))}_renderUtilityNetworkTrace(){const{viewModel:e,viewModel:{utilityNetwork:t}}=this,s=e.view?.map,{messages:i}=this;let r=v("calcite-tabs",{layout:"center",position:"top",styles:R(this.container)},v("calcite-tab-nav",{slot:"title-group"},v("calcite-tab-title",{onclick:()=>{this.switchTab("input")},selected:"input"===this._activeTab},i.inputsStrings.headerTabInputs),v("calcite-tab-title",{onclick:()=>{this.switchTab("results")},selected:"results"===this._activeTab},i.resultsStrings.headerTabResults)),this._renderInputsTab(),this._renderResultsTab());return(!s.utilityNetworks?.length&&!t||t&&!t.sharedNamedTraceConfigurations.length)&&(r=v("calcite-panel",null,this._renderWarningMessage("noTraceConfig",!1))),this._loadUnError||(r=v("calcite-panel",null,this._renderWarningMessage("loadUNError",!1,this._errorMessage))),r}_renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,o=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,o=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,o=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,o=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,o=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,o=i.alertsStrings.noAssetFound;break;case"noBarrierAssetNso":case"noStartAssetNso":r="",o=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",o=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,o=s||""}return v("div",{class:k.noticeContainer,key:e},v("calcite-notice",{closable:t,icon:!0,key:e,kind:"danger",open:!0,scale:"s",width:"auto",onCalciteNoticeClose:()=>this._handleWarningNoticeClose(e)},v("div",{slot:"title"},r),v("div",{slot:"message"},o)))}_afterComponentCreate(e){"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"})}_appendAttributes(e,t,s){const i=[];return e.forEach(e=>{t.forEach(t=>{t.featureSet.features.forEach(r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))})})}),i}_changeCursor(e="default"){const t=this.view?.container?.style;t&&(t.cursor=e)}_disablePopup(){const{view:e}=this;e.popupEnabled=!1,e.closePopup()}_compare(e,t){return(s,i)=>{let r=0,o=s.details?.attributes[e]??s.objectId,a=i.details?.attributes[e]??i.objectId;return isNaN(o)&&(o=o.toLowerCase()),isNaN(a)&&(a=a.toLowerCase()),"desc"===t?o>a?r=1:o<a&&(r=-1):o<a?r=1:o>a&&(r=-1),r}}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find(t=>t.sourceId===e.networkSourceId);if(i){const e=i.assetGroups.find(e=>e.assetGroupCode===s);e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find(t=>t.sourceId===e.networkSourceId);if(i){const r=i.assetGroups.find(e=>e.assetGroupCode===s);if(r){const s=r.assetTypes.find(t=>t.assetTypeCode===e.assetTypeCode);s&&(t=s.assetTypeName)}}return t}_getSymbolIcon(e){return"picture-marker"===e.type?v("img",{height:e.height,src:e.url??void 0,width:e.width}):null}_groupBy(e,t){return e.reduce((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e),{})}_groupResultsByAssetGroup(e){const t=[],s=e.results?.elements,i=this._groupBy(s??[],"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_handleWarningNoticeClose(e){switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noStartAssetNso":this._warningNoStartAssetNsoFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1;break;case"noBarrierAssetNso":this._warningNoBarrierAssetNsoFound=!1}}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach(t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)})}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach(e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)})}_processFlagOnLoad(){return this.view?.when().then(()=>{this._watchHandler=a(()=>!this.view?.updating,async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()})})}_registerWatchers(){this.addHandles([i(()=>this.selectedTraces,()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()}),i(()=>this.defaultGraphicColor,()=>{this.viewModel.traceResults.length>0&&this.viewModel.traceResults.forEach(e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)}),this.scheduleRender()})])}_renderComboboxItem({text:e,value:t,selected:s}){return v("calcite-combobox-item",{key:t,selected:s,textLabel:e,value:t})}_resetResultFeatureWidget(){this._showFeatureInfoActive=!1,this._resultFeatureWidget.feature=null,this.view.popupEnabled=this._wasPopupEnabled}_resetTraceLocationWarnings(){this._warningNoBarrierAssetFound=!1,this._warningNoBarrierAssetNsoFound=!1,this._warningNoStartAssetFound=!1,this._warningNoStartAssetNsoFound=!1}_setupAddNonspatialObject(e){this._disablePopup(),this._traceLocationType=e,this._addNonspatialObjectActive=!0,this._resetTraceLocationWarnings(),this.viewModel.getNonspatialTraceLocationInitialFeature().then(e=>{this._findNonspatialFeatureWidget.feature=null;const t=e.graphic;this._findNonspatialFeatureWidget.open(t)}).catch(()=>{this._warningNoStartAssetNsoFound="starting-point"===e,this._warningNoBarrierAssetNsoFound="barrier"===e,this._addNonspatialObjectActive=!1}).finally(()=>this._changeCursor("default"))}_setupAddTraceLocation(e){this._traceLocationType=e,this._changeCursor("crosshair"),this._selectToolActive=!0,this._addNonspatialObjectActive=!1,this._resetTraceLocationWarnings(),this.viewModel.addFlagByHit(this._traceLocationType,this._symbolStartFlag).then(e=>{this._changeCursor("default"),e?this._warningNoFlag=!1:(this._warningNoStartAssetFound="starting-point"===this._traceLocationType,this._warningNoBarrierAssetFound="barrier"===this._traceLocationType),this._selectToolActive=!1})}_utilityNetworkTraceInitialized(){this.viewModel.loadUtilityNetwork().then(e=>{e&&(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel.flags.length>0&&this._processFlagOnLoad()),this.disabled=!1}).catch(e=>{const{messages:t}=this;this._loadUnError=!1,"utility-network:no-user-type-extension"===e.name||e.details.raw?.extendedCode===x.noExtension?this._errorMessage=t.alertsStrings.noUserExtension:this._errorMessage=e.message,this.disabled=!1})}_viewChangeHandle(){this._wasPopupEnabled=this.view?.popupEnabled??!1,this._findNonspatialFeatureWidget.view=this.view,this._resultFeatureWidget.view=this.view}};e([l()],I.prototype,"_activeTab",void 0),e([l()],I.prototype,"_activeTrace",void 0),e([l()],I.prototype,"_activeSwatch",void 0),e([l()],I.prototype,"_addNonspatialObjectActive",void 0),e([l()],I.prototype,"_alertRemoveModal",void 0),e([l()],I.prototype,"_assetGroupHeader",void 0),e([l()],I.prototype,"_assetTypeHeader",void 0),e([l()],I.prototype,"_confirmReset",void 0),e([l()],I.prototype,"_errorMessage",void 0),e([l()],I.prototype,"_swatchNode",void 0),e([l()],I.prototype,"_selectToolActive",void 0),e([l()],I.prototype,"_showFeatureInfoActive",void 0),e([l()],I.prototype,"_traceHeaderForFlow",void 0),e([l()],I.prototype,"_traceResultsFunctions",void 0),e([l()],I.prototype,"_traceResultsAssetGroup",void 0),e([l()],I.prototype,"_traceResultsAssetType",void 0),e([l()],I.prototype,"_traceResultsIndividual",void 0),e([l()],I.prototype,"_traceResultsState",void 0),e([l()],I.prototype,"_warningNoFlag",void 0),e([l()],I.prototype,"_warningNoTraceSelected",void 0),e([l()],I.prototype,"_updatingHandles",void 0),e([l()],I.prototype,"defaultGraphicColor",null),e([l()],I.prototype,"disabled",void 0),e([l()],I.prototype,"enableResultArea",null),e([l()],I.prototype,"flags",null),e([l()],I.prototype,"gdbVersion",null),e([l()],I.prototype,"icon",null),e([l()],I.prototype,"inputSettings",void 0),e([l()],I.prototype,"label",null),e([l(),b("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],I.prototype,"messages",void 0),e([l(),b("esri/t9n/common")],I.prototype,"messagesCommon",void 0),e([l(),b("esri/core/t9n/Units")],I.prototype,"messagesUnits",void 0),e([l()],I.prototype,"resultAreaProperties",null),e([l()],I.prototype,"selectedTraces",null),e([l()],I.prototype,"selectOnComplete",null),e([l()],I.prototype,"showGraphicsOnComplete",null),e([l()],I.prototype,"showSelectionAttributes",null),e([l()],I.prototype,"utilityNetwork",null),e([l()],I.prototype,"view",null),e([w(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection","add-result-area","remove-result-area","create-result-area","reset"]),l({type:f})],I.prototype,"viewModel",void 0),I=e([n("esri.widgets.UtilityNetworkTrace")],I);const B=I;export{B as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{deprecatedFunction as t}from"../core/deprecate.js";import s from"../core/Logger.js";import{watch as i,on as r,initial as o,when as a}from"../core/reactiveUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../core/support/UpdatingHandles.js";import d from"../layers/support/CodedValueDomain.js";import{isSubtypeGroupLayer as u}from"../layers/support/layerUtils.js";import h from"../rest/support/Query.js";import p from"./Widget.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{storeNode as _}from"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as w}from"./support/decorators/vmEvent.js";import{tsx as v}from"./support/jsxFactory.js";import y from"./UtilityNetworkTrace/UtilityNetworkTraceFeature.js";import f from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{defaultSwatchColors as S}from"./UtilityNetworkTrace/support/GraphicHandler.js";const T="esri-utility-network-trace",k={base:T,addButtonContainer:`${T}__add-button-container`,blockContainer:`${T}__block-container`,blockContent:`${T}__block-content`,clearPrompt:`${T}__reset-prompt`,doublePaddingTop:`${T}__double-pad-top`,flow:`${T}__flow`,listContainer:`${T}__list-container`,noticeContainer:`${T}__notice-container`,numberInput:`${T}__number-input`,promptDivider:`${T}__divider`};function F(e){return{height:e+"px"}}function C(e){return{width:e+"px"}}function A(){return{width:"75%"}}function R(e){return{width:"100%",height:window.getComputedStyle(e).getPropertyValue("max-height")}}function N(e){return{display:"flex",flexDirection:e}}function M(e){return e instanceof d}const x={noExtension:-2147208474},I=Symbol();let B=class extends p{constructor(e,t){super(e,t),this._activeTab="input",this._activeTrace=null,this._activeSwatch="",this._addNonspatialObjectActive=!1,this._alertRemoveModal=!1,this._assetGroupHeader="",this._assetTypeHeader="",this._confirmReset=!1,this._errorMessage="",this._swatchNode=null,this._selectToolActive=!1,this._showFeatureInfoActive=!1,this._traceHeaderForFlow="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._traceResultsState="result",this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._findNonspatialFeatureWidget=new y({mode:"add-nso"}),this._individualResultNode=null,this._loadUnError=!0,this._resultDisplayField="objectid",this._resultFeatureWidget=new y({mode:"show-feature-info"}),this._resultObjectIdField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._showResultOptions=!1,this._symbolStartFlag=null,this._symbolBarrier=null,this._traceLocationType="starting-point",this._updatingHandles=new c,this._warningNoBarrierAssetFound=!1,this._warningNoBarrierAssetNsoFound=!1,this._warningNoStartAssetFound=!1,this._warningNoStartAssetNsoFound=!1,this._warningNoTerminal=!1,this._wasPopupEnabled=!1,this._watchHandler=null,this.disabled=!0,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.viewModel=new f,this._afterComponentCreate=this._afterComponentCreate.bind(this)}initialize(){this._utilityNetworkTraceInitialized(),this.addHandles([i(()=>this.view,()=>this._viewChangeHandle(),o),i(()=>this.viewModel?.resultAreaProperties,()=>this.scheduleRender()),i(()=>this._addNonspatialObjectActive,e=>{this._findNonspatialFeatureWidget.feature=null,e?this._changeCursor("crosshair"):this.view.popupEnabled=this._wasPopupEnabled}),i(()=>this._showFeatureInfoActive,e=>{e||(this._resultFeatureWidget.feature=null,this.view.popupEnabled=this._wasPopupEnabled)}),r(()=>this._findNonspatialFeatureWidget,"add-nso-trace-location",({featureWidget:e})=>{this.viewModel.addNonspatialTraceLocation(e.graphic,this._traceLocationType),this._warningNoFlag=!1,this._addNonspatialObjectActive=!1}),r(()=>this._findNonspatialFeatureWidget,"close-un-trace-feature-block",()=>{this._changeCursor("default"),this._addNonspatialObjectActive=!1,this.viewModel.cancelAddFlagByHit()}),r(()=>this._resultFeatureWidget,"close-un-trace-feature-block",()=>{this._showFeatureInfoActive=!1}),r(()=>this._resultFeatureWidget,"close",()=>{this._resetResultFeatureWidget()})])}destroy(){this._findNonspatialFeatureWidget?.destroy(),this._resultFeatureWidget?.destroy()}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get enableResultArea(){return this.viewModel.enableResultArea}set enableResultArea(e){this.viewModel.enableResultArea=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return t(s.getLogger(this),"gdbVersion will be removed and the gdbVersion of the UtilityNetwork will be consumed directly.",{replacement:"UtilityNetwork.gdbVersion",version:"4.31"}),this.viewModel.gdbVersion}set gdbVersion(e){t(s.getLogger(this),"gdbVersion will be removed and the gdbVersion of the UtilityNetwork will be consumed directly.",{replacement:"UtilityNetwork.gdbVersion",version:"4.31"}),this.viewModel.gdbVersion=e}get icon(){return"utility-network-trace"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get resultAreaProperties(){return this.viewModel.resultAreaProperties}set resultAreaProperties(e){this.viewModel.resultAreaProperties=e}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get utilityNetwork(){return this.viewModel.utilityNetwork}set utilityNetwork(e){this.viewModel.utilityNetwork=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1,this._resetResultFeatureWidget();const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._traceResultsState="result",this.switchTab("results"),this.viewModel._activeProgress=!0,this.viewModel.removeAllResultAreaGraphics(),await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach(e=>{switch(e){case"noStartingPoints":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}})}confirmReset(){this._confirmReset=!0}render(){return this._mixCustomStrings(),this._overrideFlagSymbol(),v("div",{class:this.classes(k.base,m.widget,m.panel,{[m.widgetDisabled]:this.disabled})},this._renderUtilityNetworkTrace())}loadDependencies(){return g({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group"),"action-pad":()=>import("@esri/calcite-components/dist/components/calcite-action-pad"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),"color-picker-swatch":()=>import("@esri/calcite-components/dist/components/calcite-color-picker-swatch"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),fab:()=>import("@esri/calcite-components/dist/components/calcite-flow"),flow:()=>import("@esri/calcite-components/dist/components/calcite-fab"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),option:()=>import("@esri/calcite-components/dist/components/calcite-option"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim"),select:()=>import("@esri/calcite-components/dist/components/calcite-select"),"split-button":()=>import("@esri/calcite-components/dist/components/calcite-split-button"),tab:()=>import("@esri/calcite-components/dist/components/calcite-tab"),"tab-nav":()=>import("@esri/calcite-components/dist/components/calcite-tab-nav"),"tab-title":()=>import("@esri/calcite-components/dist/components/calcite-tab-title"),tabs:()=>import("@esri/calcite-components/dist/components/calcite-tabs")})}switchTab(e){this._activeTab=e}switchToFromAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._traceResultsState=s}switchToFromAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._traceResultsState=s}switchToFromFunctions(e,t){this._traceResultsFunctions=e,this._traceResultsState=t}switchToFromIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._traceResultsState=s}_renderAddNonspatialLocationBlock(){const{messages:e}=this;return v("calcite-block",{expanded:!0,key:`${this.id}__add-spatial-location-block`,label:e.inputsStrings.addNonspatialOption},this._findNonspatialFeatureWidget.render())}_renderAddSpatialLocationBlock(){const{messages:e,messagesCommon:t}=this;return v("calcite-block",{class:k.blockContent,expanded:!0,heading:"starting-point"===this._traceLocationType?e.inputsStrings.headerStartingPoint:e.inputsStrings.headerBarrier,key:`${this.id}__add-nonspatial-location-block`,label:"starting-point"===this._traceLocationType?e.inputsStrings.headerStartingPoint:e.inputsStrings.headerBarrier},v("calcite-action",{icon:"x",onclick:()=>{this.viewModel.removeClickHandler(),this.view?.popup&&(this.view.popupEnabled=this._wasPopupEnabled),this._changeCursor("default"),this._selectToolActive=!1},slot:"control",text:t.close}),v("calcite-notice",{icon:"starting-point"===this._traceLocationType?"pin-plus":"x-circle-f",kind:"info",open:!0},v("div",{slot:"message"},e.inputsStrings.addPointHint)))}_renderClearTraceResultsBlock(){const{messages:e,messagesCommon:t}=this;return v("calcite-scrim",{key:"prompt"},v("div",{class:k.clearPrompt},v("h3",{slot:"header"},e.resultsStrings.startOverButton),v("div",{slot:"content"},e.resultsStrings.startOverValidation),v("div",{class:k.promptDivider}),v("div",{styles:N("row")},v("calcite-button",{appearance:"outline",onclick:()=>{this._confirmReset=!1},slot:"secondary",width:"full"},t.cancel),v("calcite-button",{onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")},slot:"primary",width:"full"},t.form.ok))))}_renderExecutingTraceBlock(){const{messages:e}=this;return v("calcite-loader",{label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"})}_renderInputBlock(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__inputs-block`,label:e.inputsStrings.headerTabInputs},v("calcite-flow",{class:k.flow},v("calcite-flow-item",{key:`${this.id}__inputs-flow-item`,selected:!this._selectToolActive&&!this._addNonspatialObjectActive},this._warningNoFlag?this._renderWarningMessage("flag",!0):null,this._warningNoTerminal?this._renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this._renderWarningMessage("trace",!0):null,this._renderTraceSelectorContainer(),this._renderStartFlagsContainer(),this._renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?v("div",{styles:F(10)}):null,v("calcite-fab",{appearance:"solid",icon:"utility-network-trace",kind:"brand",onclick:()=>{this.checkCanTrace()},slot:"fab",text:e.tracingStrings.runTrace,textEnabled:!0,title:e.tracingStrings.runTrace,type:"button"}))))}_renderInputsTab(){const{messagesCommon:e}=this;let t="input";return this._selectToolActive&&!this._addNonspatialObjectActive&&(t="add-spatial-location"),!this._selectToolActive&&this._addNonspatialObjectActive&&(t="add-nso-location"),this.disabled&&(t="loading"),v("calcite-tab",{key:`${this.id}__inputs-tab-item`,selected:"input"===this._activeTab},"loading"===t?v("calcite-loader",{label:e.loading,type:"indeterminate"}):null,"input"===t?this._renderInputBlock():null,"add-spatial-location"===t?this._renderAddSpatialLocationBlock():null,"add-nso-location"===t?this._renderAddNonspatialLocationBlock():null)}_renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter(e=>"barrier"===e.type),s.forEach(e=>{e.displayValue&&t.push(this._renderFlagRow(e,"barrier"))});let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:e.inputsStrings.headerBarrier+" ("+s.length+")",overlayPositioning:"fixed"},v("div",{slot:"icon"},i||v("calcite-icon",{icon:"x-circle-f",scale:"s"})),v("div",null,e.inputsStrings.barrierPointHint),v("div",{class:k.listContainer},t),this._warningNoBarrierAssetFound?this._renderWarningMessage("noBarrierAsset",!0):null,this._warningNoBarrierAssetNsoFound?this._renderWarningMessage("noBarrierAssetNso",!0):null,v("div",{class:k.addButtonContainer},v("calcite-split-button",{appearance:"outline-fill",primaryIconStart:"select",primaryText:e.inputsStrings.addPointOption,onCalciteSplitButtonPrimaryClick:()=>{this._setupAddTraceLocation("barrier")}},v("calcite-dropdown-group",{selectionMode:"none"},v("calcite-dropdown-item",{onCalciteDropdownItemSelect:()=>{this._setupAddNonspatialObject("barrier")}},e.inputsStrings.addNonspatialOption)))))}_renderFlagRow(e,t){const{messages:s,messagesCommon:i}=this,r=[];let o=!1;return null!=e.allTerminals&&e.allTerminals.terminals.length>0&&(o=!0,e.allTerminals.terminals.forEach(t=>{let s=!1;e?.selectedTerminals?.includes(t.id)&&(s=!0),r.push(v("calcite-combobox-item",{key:t.name,selected:s,textLabel:t.name,value:t.id}))})),v("calcite-block",{collapsible:null!==e.allTerminals||"barrier"===e.type,heading:e.displayValue?.value??"",key:"pop"+e.globalId+e.type+e.id+t,overlayPositioning:"fixed"},v("calcite-action",{icon:"trash",label:i.remove,onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",slot:"header-menu-actions",text:i.remove,textEnabled:!0}),e.mapGraphic&&e.mapPoint?v("calcite-action",{icon:"zoom-to-object",label:s.globalStrings.zoomToFeature,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,textEnabled:!0}):null,"barrier"===e.type?v("calcite-label",{layout:"inline",scale:"s"},v("calcite-checkbox",{checked:e.isFilterBarrier,onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)},scale:"s"}),s.inputsStrings.barrierFilter):null,o?v("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,maxItems:0,overlayPositioning:"fixed",placeholder:s.globalStrings.selectTerminalPlaceholder,scale:"s",selectionMode:"multiple",onCalciteComboboxChange:t=>{t.currentTarget.selectedItems.length>0?(e.selectedTerminals=[],t.currentTarget.selectedItems.forEach(t=>{this.viewModel.addTerminal(t.value,e)})):e.selectedTerminals=[]},onCalciteComboboxChipClose:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.currentTarget.value,e)}},r):null)}_renderHighlightColorPicker(e,t,s){const{messages:i}=this,{graphicHandler:r}=this.viewModel,o=[],a=new RegExp(`^${e.hex}$`,"i"),l=r.highlightColor.length>S.length?5:4;for(const n of r.highlightColor)o.push(v("calcite-action",{active:a.test(n.hex),key:n.hex,label:i.resultsStrings.graphicColor,onclick:()=>{"aggregate"===s?this.viewModel.changeResultGraphicColor(n,t):this.viewModel.changeResultAreaColor(t,n)},scale:"s",text:i.resultsStrings.graphicColor},v("calcite-color-picker-swatch",{active:a.test(n.hex),color:n.hex,scale:"s"})));return v("calcite-action-pad",{expandDisabled:!0,layout:"grid",position:"start"},v("calcite-action-group",{columns:l},o))}_renderRemoveTraceContainer(e){const{messages:t}=this;return v("calcite-action",{icon:"trash",label:t.globalStrings.clearResults,onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",slot:"header-menu-actions",text:t.globalStrings.clearResults,textEnabled:!0})}_renderResultsTab(){let e="results";return this._showFeatureInfoActive&&(e="show-feature-info"),this.viewModel._activeProgress&&(e="executing"),this._confirmReset&&(e="clear-trace-results"),v("calcite-tab",{key:`${this.id}__results-tab-item`},"executing"===e?this._renderExecutingTraceBlock():null,"results"===e?this.viewModel.traceResults.length?this._renderResultsPanel():this._renderWarningMessage("noTraceExecuted",!1):null,"show-feature-info"===e?this._renderShowFeatureInfoBlock():null,"clear-trace-results"===e?this._renderClearTraceResultsBlock():null)}_renderResultsPanel(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__results-block`,label:e.resultsStrings.headerTabResults},v("calcite-flow",{class:k.flow},this._renderTraceResults(),this._renderTraceResultFunctions(),this._renderTraceResultByAssetGroup(),this._renderTraceResultByAssetType(),this._renderTraceResultIndividual()))}_renderResultRowFunctions(e){return v("calcite-block",{collapsible:!1,heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,overlayPositioning:"fixed"})}_renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return v("calcite-list-item",{key:`${t}-${e.assetGroupCode}`,label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this.switchToFromAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")","assetType")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return v("calcite-list-item",{key:`${t}-${e.assetTypeCode}`,label:t+" ("+e.length+")",onCalciteListItemSelect:()=>{this._updatingHandles.addPromise(this.viewModel.queryFeaturesById(e).then(s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToFromIndividualRecords(i,t+" ("+e.length+")","records")}else this.switchToFromIndividualRecords(e,t+" ("+e.length+")","records")}))}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderResultRowIndividual(e){const{messages:t}=this;let s,i=null;if(i=e?.details?.fields.find(({name:e})=>e===this._resultDisplayField),"date"===i?.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if("assetgroup"===this._resultDisplayField.toLowerCase())s=this._getAssetGroupName(e);else if("assettype"===this._resultDisplayField.toLowerCase())s=this._getAssetTypeName(e);else if(i?.domain&&M(i.domain)){const t=i.domain.codedValues.find(({code:t})=>t===e.details.attributes[this._resultDisplayField]);s=t?.name}else s=e.details?.attributes[this._resultDisplayField]??e.objectId;return s&&""!==s&&null!==s?"string"==typeof s&&(s.trim()||(s=t.resultsStrings.noValue)):s=t.resultsStrings.noValue,v("calcite-list-item",{key:e.details.uid,label:s,onCalciteListItemSelect:async()=>{this._disablePopup(),this._showFeatureInfoActive=!0;const t=u(e.details?.layer)?e.details?.layer:null;if(t){const s=Object.keys(e.details.attributes).find(e=>e.toLowerCase()===t.subtypeField.toLowerCase())??"assetgroup",i=t.sublayers.find(t=>t.subtypeCode===e.details.attributes[s]),r=Object.keys(e.details.attributes).find(e=>e.toLowerCase()===t.objectIdField.toLowerCase())??"objectid",o=new h;o.outFields=["*"],o.returnGeometry=!0,o.where=r+" = "+e.details.attributes[r];const a=await(i?.queryFeatures(o));a&&this._resultFeatureWidget.open(a.features[0])}else this._resultFeatureWidget.open(e.details)}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderShowFeatureInfoBlock(){const{messages:e}=this;return v("calcite-block",{class:k.blockContainer,expanded:!0,key:`${this.id}__show-feature-info-block`,label:e.resultsStrings.headerFeatureInfo},this._resultFeatureWidget.render())}_renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter(e=>"starting-point"===e.type),s.forEach(e=>{e.displayValue&&t.push(this._renderFlagRow(e,"start"))});let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",overlayPositioning:"fixed"},v("div",{slot:"icon"},i||v("calcite-icon",{icon:"pin",scale:"s"})),v("div",null,e.inputsStrings.startingPointHint),v("div",{class:k.listContainer},t),this._warningNoStartAssetFound?this._renderWarningMessage("noStartAsset",!0):null,this._warningNoStartAssetNsoFound?this._renderWarningMessage("noStartAssetNso",!0):null,v("div",{class:k.addButtonContainer},v("calcite-split-button",{appearance:"outline-fill",primaryIconStart:"select",primaryText:e.inputsStrings.addPointOption,onCalciteSplitButtonPrimaryClick:()=>{this._setupAddTraceLocation("starting-point")}},v("calcite-dropdown-group",{selectionMode:"none"},v("calcite-dropdown-item",{onCalciteDropdownItemSelect:()=>{this._setupAddNonspatialObject("starting-point")}},e.inputsStrings.addNonspatialOption)))))}_renderStartOverContainer(){const{messages:e}=this;return v("calcite-fab",{appearance:"solid",icon:"trash",kind:"brand",onclick:()=>{this.confirmReset()},slot:"fab",text:e.resultsStrings.startOverButton,textEnabled:!0,title:e.resultsStrings.startOverButton,type:"button"})}_renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this._renderResultRowAssetGroup(i[e]))}return v("calcite-flow-item",{heading:this._traceHeaderForFlow,key:"assetGroupResultMultiple",selected:"assetGroup"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromAssetGroup([],"","result")}},v("calcite-list",{label:""},t),this._renderStartOverContainer())}_renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this._renderResultRowAssetType(e[s]));return v("calcite-flow-item",{heading:this._assetGroupHeader,key:"assetTypeResult",loading:this._updatingHandles.updating,selected:"assetType"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromAssetType([],"","assetGroup")}},v("calcite-list",{label:"",selectionMode:"none"},t),this._renderStartOverContainer())}_renderTraceResultFunctions(){if("functions"!==this._traceResultsState)return null;const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach(e=>{s.push(this._renderResultRowFunctions(e))}),v("calcite-flow-item",{heading:e.resultsStrings.functionHeader,key:"functionResultMultiple",selected:"functions"===this._traceResultsState,onCalciteFlowItemBack:()=>{this.switchToFromFunctions([],"result")}},s,this._renderStartOverContainer())}_renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){(t[0].details?.fields.some(({name:e})=>e.toLowerCase()===this._resultDisplayField.toLocaleLowerCase())??!1)||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach(e=>{e?.details&&s.push(this._renderResultRowIndividual(e))}),0===s.length&&s.push(v("calcite-list-item",{label:e.resultsStrings.noFeaturesInMap}))}return v("calcite-flow-item",{heading:this._assetTypeHeader,key:"individualResult",selected:"records"===this._traceResultsState,onCalciteFlowItemBack:()=>{this._showResultOptions=!1,this.switchToFromIndividualRecords([],"","assetType")}},v("calcite-action",{afterCreate:_,bind:this,"data-node-ref":"_individualResultNode",icon:"gear",id:"field_options"+this.id,label:e.resultsStrings.displayAttribute,onclick:()=>{this._showResultOptions=!0},slot:"header-actions-end",text:e.resultsStrings.displayAttribute}),this._renderTraceResultIndividualPopover(),v("calcite-list",{label:"",selectionMode:"none"},s),this._renderStartOverContainer())}_renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&(t[0].details?t[0].details.fields.forEach(({name:e,alias:t})=>{s.push(v("calcite-option",{key:`display-${e}`,label:t??e,selected:e===this._resultDisplayField,value:e})),i.push(v("calcite-option",{key:`sort-${e}`,label:t??e,selected:e===this._resultSortField,value:e}))}):(s.push(v("calcite-option",{key:`display-${this._resultDisplayField}`,label:this._resultDisplayField,value:this._resultDisplayField})),i.push(v("calcite-option",{key:`sort-${this._resultDisplayField}`,label:this._resultDisplayField,value:this._resultDisplayField})))),v("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,overlayPositioning:"fixed",placement:"left-start",referenceElement:this._individualResultNode,styles:null!==this.domNode?C(.75*this.domNode.clientWidth):A()},v("calcite-block",{expanded:!0,label:e.resultsStrings.displayAttribute,overlayPositioning:"fixed"},v("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,v("calcite-select",{label:e.resultsStrings.displayAttribute,scale:"s",onCalciteSelectChange:e=>{const t=e.currentTarget;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),v("calcite-label",{scale:"s"},e.resultsStrings.sortBy,v("calcite-select",{label:e.resultsStrings.sortBy,scale:"s",onCalciteSelectChange:e=>{const s=e.currentTarget;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}_renderTraceResults(){const{messages:e,messagesCommon:t}=this,{selectFeatures:s}=e.resultsStrings,i=this.viewModel.traceResults,r=[];return i.forEach((t,i)=>{let o=[],a=[],l=!1,n=!1,c=!1,d="";null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(n=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(a=t.results.globalFunctionResults,a.length>0&&(c=!0)),t.results.elements&&t.results.elements.length>0&&(o=t.results.elements,o.length>0&&(l=!0)),(n||l)&&(d=this.messagesUnits.units[t.resultArea?.unit]?.abbr),r.push(v("calcite-block",{class:k.blockContent,collapsible:!0,description:t.trace.description??"",expanded:!0,heading:t.trace.title,key:`${t.trace.title}${i}`,overlayPositioning:"fixed"},this._renderRemoveTraceContainer(t),v("calcite-list",{label:""},c?v("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+a.length+")",onCalciteListItemSelect:()=>{this.switchToFromFunctions(a,"functions")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,l&&this.viewModel.showSelectionAttributes?v("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+o.length+")",onCalciteListItemSelect:()=>{this.switchToFromAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+o.length+")","assetGroup")}},v("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?v("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),l?v("div",{class:k.doublePaddingTop},v("calcite-label",{layout:"inline",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)},scale:"s"},v("calcite-checkbox",{checked:t.selectionEnabled,onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?s:`${s} (${o.length})`)):null,n?v("calcite-block-section",{expanded:t.graphicEnabled,key:`aggregate-${t.trace.title}-${i}`,text:e.resultsStrings.highlightTrace,toggleDisplay:"switch",onCalciteBlockSectionToggle:e=>{e.currentTarget.expanded?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},v("calcite-list",{label:e.resultsStrings.graphicColor,selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.graphicColor,onclick:e=>{this._swatchNode=e.currentTarget,this._activeSwatch="aggGeom_"+i}},v("calcite-color-picker-swatch",{color:t.graphicColor.hex,scale:"s",slot:"actions-end"})))):null,this.enableResultArea&&(n||l)?v("calcite-block-section",{expanded:t.resultArea?.show,key:`area-${t.trace.title}-${i}`,text:e.resultsStrings.resultAreaHeader,toggleDisplay:"switch",onCalciteBlockSectionToggle:e=>{e.currentTarget.expanded?t.resultAreaGraphic?this.viewModel.addResultAreaToMap(t,t.resultAreaGraphic):this.viewModel.addResultAreaToMap(t):this.viewModel.removeResultAreaFromMap(t)}},v("calcite-list",{label:"",selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.graphicColor,onclick:e=>{const t=e.currentTarget;this._swatchNode=t,this._activeSwatch="resultArea_"+i}},v("calcite-color-picker-swatch",{color:t.resultArea?.color.hex,scale:"s",slot:"actions-end"}))),v("calcite-list",{label:"",selectionMode:"none"},v("calcite-list-item",{label:e.resultsStrings.resultAreaBuffer},v("calcite-input-number",{afterCreate:this._afterComponentCreate,class:k.numberInput,max:999999,min:0,scale:"s",slot:"actions-end",suffixText:d,value:t.resultArea?.distance.toString(),onCalciteInputNumberChange:e=>{if(!this.view?.popup)return;this.view.popup.visible&&this.view.closePopup();const s=e.currentTarget;t.resultArea.distance>=0?(t.resultArea.distance=parseInt(s.value,10),this.viewModel.removeResultAreaFromMap(t),this.viewModel.addResultAreaToMap(t)):(t.resultArea.distance=0,this.viewModel.removeResultAreaFromMap(t),this.viewModel.addResultAreaToMap(t))}})))):null,v("calcite-popover",{autoClose:!0,closable:!0,label:e.resultsStrings.graphicColor,offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i||this._activeSwatch==="resultArea_"+i,overlayPositioning:"fixed",placement:"auto-start",referenceElement:this._swatchNode,scale:"s",onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this._renderHighlightColorPicker(this._activeSwatch==="resultArea_"+i?t.resultArea?.color:t.graphicColor,t,this._activeSwatch==="resultArea_"+i?"resultArea":"aggregate"))))):r.push(v("calcite-block",{collapsible:!1,expanded:!0,heading:t.trace.title,key:"error-"+i,overlayPositioning:"fixed"},this._renderRemoveTraceContainer(t),this._renderWarningMessage("noController",!1,t.status)))}),v("calcite-flow-item",{key:"traceResults",selected:"result"===this._traceResultsState},r,this._renderStartOverContainer(),this._alertRemoveModal?v("calcite-scrim",{key:"prompt"},v("div",{class:k.clearPrompt},v("h3",{slot:"header"},e.globalStrings.clearResults),v("div",{slot:"content"},e.alertsStrings.clearResultsAlert),v("div",{class:k.promptDivider}),v("div",{styles:N("row")},v("calcite-button",{appearance:"outline",onclick:()=>{this._alertRemoveModal=!1},slot:"secondary",width:"full"},t.cancel),v("calcite-button",{onclick:()=>{this._activeTrace&&this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel.traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel.traceResults[0].trace,this._traceResultsState="result")},slot:"primary",width:"full"},t.form.ok)))):null)}_renderTraceSelectorContainer(){const{messages:e}=this,t=this.viewModel.traces.map(e=>this._renderComboboxItem({value:e.globalId,text:e.title,selected:e.selected??!1})),s=this.viewModel.traces.filter(e=>e.selected),i=e.tracingStrings.traceOperation+` (${s.length})`;return v("calcite-block",{class:k.blockContent,collapsible:!0,expanded:!0,heading:i,overlayPositioning:"fixed"},v("calcite-icon",{icon:"utility-network-trace",scale:"s",slot:"icon"}),v("calcite-combobox",{label:e.inputsStrings.selectTraces,maxItems:0,overlayPositioning:"fixed",placeholder:e.inputsStrings.selectTraces,scale:"s",selectionMode:"multiple",onCalciteComboboxChange:e=>{this.viewModel.traces.forEach(t=>{t.selected=e.currentTarget.selectedItems.some(e=>e.value===t.globalId)}),e.currentTarget.selectedItems.length&&(this._warningNoTraceSelected=!1)}},t))}_renderUtilityNetworkTrace(){const{viewModel:e,viewModel:{utilityNetwork:t}}=this,s=e.view?.map,{messages:i}=this;let r=v("calcite-tabs",{layout:"center",position:"top",styles:R(this.container)},v("calcite-tab-nav",{slot:"title-group"},v("calcite-tab-title",{onclick:()=>{this.switchTab("input")},selected:"input"===this._activeTab},i.inputsStrings.headerTabInputs),v("calcite-tab-title",{onclick:()=>{this.switchTab("results")},selected:"results"===this._activeTab},i.resultsStrings.headerTabResults)),this._renderInputsTab(),this._renderResultsTab());return(!s.utilityNetworks?.length&&!t||t&&!t.sharedNamedTraceConfigurations.length)&&(r=v("calcite-panel",null,this._renderWarningMessage("noTraceConfig",!1))),this._loadUnError||(r=v("calcite-panel",null,this._renderWarningMessage("loadUNError",!1,this._errorMessage))),r}_renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,o=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,o=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,o=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,o=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,o=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,o=i.alertsStrings.noAssetFound;break;case"noBarrierAssetNso":case"noStartAssetNso":r="",o=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",o=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,o=s||""}return v("div",{class:k.noticeContainer,key:e},v("calcite-notice",{closable:t,icon:!0,key:e,kind:"danger",open:!0,scale:"s",width:"auto",onCalciteNoticeClose:()=>this._handleWarningNoticeClose(e)},v("div",{slot:"title"},r),v("div",{slot:"message"},o)))}_afterComponentCreate(e){"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"})}_appendAttributes(e,t,s){const i=[];return e.forEach(e=>{t.forEach(t=>{t.featureSet.features.forEach(r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))})})}),i}_changeCursor(e="default"){this.removeHandles(I),this.view&&"default"!==e&&this.addHandles(this.view.acquireCursor(e),I)}_disablePopup(){const{view:e}=this;e.popupEnabled=!1,e.closePopup()}_compare(e,t){return(s,i)=>{let r=0,o=s.details?.attributes[e]??s.objectId,a=i.details?.attributes[e]??i.objectId;return isNaN(o)&&(o=o.toLowerCase()),isNaN(a)&&(a=a.toLowerCase()),"desc"===t?o>a?r=1:o<a&&(r=-1):o<a?r=1:o>a&&(r=-1),r}}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find(t=>t.sourceId===e.networkSourceId);if(i){const e=i.assetGroups.find(e=>e.assetGroupCode===s);e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find(t=>t.sourceId===e.networkSourceId);if(i){const r=i.assetGroups.find(e=>e.assetGroupCode===s);if(r){const s=r.assetTypes.find(t=>t.assetTypeCode===e.assetTypeCode);s&&(t=s.assetTypeName)}}return t}_getSymbolIcon(e){return"picture-marker"===e.type?v("img",{height:e.height,src:e.url??void 0,width:e.width}):null}_groupBy(e,t){return e.reduce((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e),{})}_groupResultsByAssetGroup(e){const t=[],s=e.results?.elements,i=this._groupBy(s??[],"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_handleWarningNoticeClose(e){switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noStartAssetNso":this._warningNoStartAssetNsoFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1;break;case"noBarrierAssetNso":this._warningNoBarrierAssetNsoFound=!1}}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach(t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)})}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach(e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)})}_processFlagOnLoad(){return this.view?.when().then(()=>{this._watchHandler=a(()=>!this.view?.updating,async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()})})}_registerWatchers(){this.addHandles([i(()=>this.selectedTraces,()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()}),i(()=>this.defaultGraphicColor,()=>{this.viewModel.traceResults.length>0&&this.viewModel.traceResults.forEach(e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)}),this.scheduleRender()})])}_renderComboboxItem({text:e,value:t,selected:s}){return v("calcite-combobox-item",{key:t,selected:s,textLabel:e,value:t})}_resetResultFeatureWidget(){this._showFeatureInfoActive=!1,this._resultFeatureWidget.feature=null,this.view.popupEnabled=this._wasPopupEnabled}_resetTraceLocationWarnings(){this._warningNoBarrierAssetFound=!1,this._warningNoBarrierAssetNsoFound=!1,this._warningNoStartAssetFound=!1,this._warningNoStartAssetNsoFound=!1}_setupAddNonspatialObject(e){this._disablePopup(),this._traceLocationType=e,this._addNonspatialObjectActive=!0,this._resetTraceLocationWarnings(),this.viewModel.getNonspatialTraceLocationInitialFeature().then(e=>{this._findNonspatialFeatureWidget.feature=null;const t=e.graphic;this._findNonspatialFeatureWidget.open(t)}).catch(()=>{this._warningNoStartAssetNsoFound="starting-point"===e,this._warningNoBarrierAssetNsoFound="barrier"===e,this._addNonspatialObjectActive=!1}).finally(()=>this._changeCursor("default"))}_setupAddTraceLocation(e){this._traceLocationType=e,this._changeCursor("crosshair"),this._selectToolActive=!0,this._addNonspatialObjectActive=!1,this._resetTraceLocationWarnings(),this.viewModel.addFlagByHit(this._traceLocationType,this._symbolStartFlag).then(e=>{this._changeCursor("default"),e?this._warningNoFlag=!1:(this._warningNoStartAssetFound="starting-point"===this._traceLocationType,this._warningNoBarrierAssetFound="barrier"===this._traceLocationType),this._selectToolActive=!1})}_utilityNetworkTraceInitialized(){this.viewModel.loadUtilityNetwork().then(e=>{e&&(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel.flags.length>0&&this._processFlagOnLoad()),this.disabled=!1}).catch(e=>{const{messages:t}=this;this._loadUnError=!1,"utility-network:no-user-type-extension"===e.name||e.details.raw?.extendedCode===x.noExtension?this._errorMessage=t.alertsStrings.noUserExtension:this._errorMessage=e.message,this.disabled=!1})}_viewChangeHandle(){this._wasPopupEnabled=this.view?.popupEnabled??!1,this._findNonspatialFeatureWidget.view=this.view,this._resultFeatureWidget.view=this.view}};e([l()],B.prototype,"_activeTab",void 0),e([l()],B.prototype,"_activeTrace",void 0),e([l()],B.prototype,"_activeSwatch",void 0),e([l()],B.prototype,"_addNonspatialObjectActive",void 0),e([l()],B.prototype,"_alertRemoveModal",void 0),e([l()],B.prototype,"_assetGroupHeader",void 0),e([l()],B.prototype,"_assetTypeHeader",void 0),e([l()],B.prototype,"_confirmReset",void 0),e([l()],B.prototype,"_errorMessage",void 0),e([l()],B.prototype,"_swatchNode",void 0),e([l()],B.prototype,"_selectToolActive",void 0),e([l()],B.prototype,"_showFeatureInfoActive",void 0),e([l()],B.prototype,"_traceHeaderForFlow",void 0),e([l()],B.prototype,"_traceResultsFunctions",void 0),e([l()],B.prototype,"_traceResultsAssetGroup",void 0),e([l()],B.prototype,"_traceResultsAssetType",void 0),e([l()],B.prototype,"_traceResultsIndividual",void 0),e([l()],B.prototype,"_traceResultsState",void 0),e([l()],B.prototype,"_warningNoFlag",void 0),e([l()],B.prototype,"_warningNoTraceSelected",void 0),e([l()],B.prototype,"_updatingHandles",void 0),e([l()],B.prototype,"defaultGraphicColor",null),e([l()],B.prototype,"disabled",void 0),e([l()],B.prototype,"enableResultArea",null),e([l()],B.prototype,"flags",null),e([l()],B.prototype,"gdbVersion",null),e([l()],B.prototype,"icon",null),e([l()],B.prototype,"inputSettings",void 0),e([l()],B.prototype,"label",null),e([l(),b("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],B.prototype,"messages",void 0),e([l(),b("esri/t9n/common")],B.prototype,"messagesCommon",void 0),e([l(),b("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),e([l()],B.prototype,"resultAreaProperties",null),e([l()],B.prototype,"selectedTraces",null),e([l()],B.prototype,"selectOnComplete",null),e([l()],B.prototype,"showGraphicsOnComplete",null),e([l()],B.prototype,"showSelectionAttributes",null),e([l()],B.prototype,"utilityNetwork",null),e([l()],B.prototype,"view",null),e([w(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection","add-result-area","remove-result-area","create-result-area","reset"]),l({type:f})],B.prototype,"viewModel",void 0),B=e([n("esri.widgets.UtilityNetworkTrace")],B);const P=B;export{P as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7656],{7656:(e,t,r)=>{r.r(t),r.d(t,{default:()=>q});var i=r(31635),s=r(78888),a=r(49186),o=r(81583),n=r(92071),l=r(74887),d=r(10107),u=r(56507),p=(r(44208),r(87811),r(36005)),y=r(40608),m=r(43937),c=r(35666),h=r(5443),f=r(83960),g=r(21325),v=r(4146),b=r(52136),x=r(98534),I=r(18768),w=r(63074),S=r(69208),C=r(16131),T=r(8303),M=r(54310),O=r(25036),Z=r(91921),E=r(82935),N=r(10873),L=r(69622),A=r(39516);function F(e,t){return"floorInfo"in t&&t.floorInfo?.floorField?function(e,t){if(!e?.length)return null;const r=e.filter(e=>""!==e).map(e=>`'${e}'`);return r.push("''"),`${t} IN (${r.join(",")}) OR ${t} IS NULL`}(e,t.floorInfo.floorField):null}r(53966);var P=r(63389);const j={visible:"visibleSublayers",definitionExpression:"layerDefs",labelingInfo:"hasDynamicLayers",labelsVisible:"hasDynamicLayers",opacity:"hasDynamicLayers",minScale:"visibleSublayers",maxScale:"visibleSublayers",renderer:"hasDynamicLayers",source:"hasDynamicLayers"};let U=class extends L.A{constructor(e){super(e),this.floors=null,this.scale=0}destroy(){this.layer=null}get dynamicLayers(){if(!this.hasDynamicLayers)return null;const e=this.visibleSublayers.map(e=>{const t=F(this.floors,e);return e.toExportImageJSON(t)});return e.length?JSON.stringify(e):null}get hasDynamicLayers(){return this.layer&&(0,P.Sk)(this.visibleSublayers,this.layer.serviceSublayers,this.layer.gdbVersion)}set layer(e){this._get("layer")!==e&&(this._set("layer",e),this.removeHandles("layer"),e&&this.addHandles([e.allSublayers.on("change",()=>this.notifyChange("visibleSublayers")),e.on("sublayer-update",e=>this.notifyChange(j[e.propertyName]))],"layer"))}get layers(){const e=this.visibleSublayers;return e?e.length?"show:"+e.map(e=>e.id).join(","):"show:-1":null}get layerDefs(){const e=!!this.floors?.length,t=this.visibleSublayers.filter(t=>null!=t.definitionExpression||e&&null!=t.floorInfo);return t.length?JSON.stringify(t.reduce((e,t)=>{const r=F(this.floors,t),i=(0,A.mA)(r,t.definitionExpression);return null!=i&&(e[t.id]=i),e},{})):null}get version(){this.commitProperty("layers"),this.commitProperty("layerDefs"),this.commitProperty("dynamicLayers");const e=this.layer;return e&&(e.commitProperty("dpi"),e.commitProperty("imageFormat"),e.commitProperty("imageTransparency"),e.commitProperty("gdbVersion")),(this._get("version")||0)+1}get visibleSublayers(){const e=[];if(!this.layer)return e;const t=this.layer.sublayers,r=this.scale,i=t=>{t.visible&&(0===r||(0,f.zx)(r,t.minScale,t.maxScale))&&(t.sublayers?t.sublayers.forEach(i):e.unshift(t))};t&&t.forEach(i);const s=this._get("visibleSublayers");return!s||s.length!==e.length||s.some((t,r)=>e[r]!==t)?e:s}toJSON(){const e=this.layer;let t={dpi:e.dpi,format:e.imageFormat,transparent:e.imageTransparency,gdbVersion:e.gdbVersion||null};return this.hasDynamicLayers&&this.dynamicLayers?t.dynamicLayers=this.dynamicLayers:t={...t,layers:this.layers,layerDefs:this.layerDefs},t}};(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"dynamicLayers",null),(0,i.Cg)([(0,d.MZ)()],U.prototype,"floors",void 0),(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"hasDynamicLayers",null),(0,i.Cg)([(0,d.MZ)()],U.prototype,"layer",null),(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"layers",null),(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"layerDefs",null),(0,i.Cg)([(0,d.MZ)({type:Number})],U.prototype,"scale",void 0),(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"version",null),(0,i.Cg)([(0,d.MZ)({readOnly:!0})],U.prototype,"visibleSublayers",null),U=(0,i.Cg)([(0,y.$)("esri.layers.support.ExportImageParameters")],U);var D=r(33446),_=r(60410),J=r(91908),k=r(88625),R=r(64272),V=r(56400);let $=class extends((0,w.dM)((0,E.e)((0,O.j)((0,Z.I)((0,x.V)((0,I.b)((0,C.q)((0,T.A)((0,n.P)((0,M.J)((0,b.p)((0,S.d)(v.A))))))))))))){constructor(...e){super(...e),this._exportImageParameters=new U({layer:this}),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.elevationInfo=new k.A({mode:"on-the-ground"}),this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null,this._debouncedSaveOperations=(0,l.sg)(async(e,t,i)=>{const{save:s,saveAs:a}=await r.e(390).then(r.bind(r,10390));switch(e){case 0:return s(this,t);case 1:return a(this,i,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(l.QP).then(()=>this._fetchService(t))),Promise.resolve(this)}destroy(){this._exportImageParameters.destroy()}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("PNG32")?"png32":"png24"}writeSublayers(e,t,r,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).toArray();let a=!1;const o=(0,c.aB)(i.origin);let n;if(this.capabilities?.operations.supportsExportMap&&this.capabilities?.exportMap?.supportsDynamicLayers)if(3===o){const e=this.createSublayersForOrigin("service").sublayers;a=(0,P.Zx)(s,e,2)}else if(o>3){const e=this.createSublayersForOrigin("portal-item");a=(0,P.Zx)(s,e.sublayers,(0,c.aB)(e.origin)),n=e.originWithPartialOverrides}const l=[],d={writeSublayerStructure:a,...i,minimumWritableOrigin:n};let u=a||this.hasVisibleLayersForOrigin(o);s.forEach(e=>{const t=e.write({},d);l.push(t),u=u||"user"===e.originOf("visible")}),l.some(e=>Object.keys(e).length>1)&&(t.layers=l),u&&(t.visibleLayers=s.filter(e=>e.visible).map(e=>e.id))}createExportImageParameters(e,t,r,i){const s=i?.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian()),this._exportImageParameters.floors=i?.floors??null,this._exportImageParameters.scale=(0,f.X_)({extent:e,width:t})*s;const a=this._exportImageParameters.toJSON(),o=!i?.rotation||this.version<10.3?{}:{rotation:-i.rotation},n=e?.spatialReference,l=(0,g.YX)(n);a.dpi*=s;const d={};if(i?.timeExtent){const{start:e,end:t}=i.timeExtent.toJSON();d.time=e&&t&&e===t?""+e:`${e??"null"},${t??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(d.time="null,null");return{bbox:e?e.xmin+","+e.ymin+","+e.xmax+","+e.ymax:void 0,bboxSR:l,imageSR:l,size:t+","+r,...a,...o,...d}}async fetchImage(e,t,r,i){const{data:s}=await this._fetchImage("image",e,t,r,i);return s}async fetchImageBitmap(e,t,r,i){const{data:s,url:a}=await this._fetchImage("blob",e,t,r,i);return(0,D.m)(s,a,i?.signal)}async fetchRecomputedExtents(e={}){const t={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:r}=await(0,s.A)(this.url,t),{extent:i,fullExtent:a,timeExtent:o}=r,n=i||a;return{fullExtent:n&&h.A.fromJSON(n),timeExtent:o&&R.T.fromJSON({start:o[0],end:o[1]})}}loadAll(){return(0,o.g)(this,e=>{e(this.allSublayers),e(this.subtables)})}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}serviceSupportsSpatialReference(e){return(0,J.D)(this,e)}async _fetchImage(e,t,r,i,o){const n={responseType:e,signal:o?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(t,r,i,o),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},d=this.parsedUrl.path+"/export";if(null!=n.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new a.A("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:n.query});try{const{data:e}=await(0,s.A)(d,n);return{data:e,url:d}}catch(e){if((0,l.zf)(e))throw e;throw new a.A("mapimagelayer:image-fetch-error",`Unable to load image: ${d}`,{error:e})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:r}=await(0,s.A)(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});r&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})}hasVisibleLayersForOrigin(e){return!(null==e||!this.sublayersSourceJSON[e]?.visibleLayers)}};(0,i.Cg)([(0,d.MZ)((0,V.P6)("dateFieldsTimeReference"))],$.prototype,"dateFieldsTimeZone",void 0),(0,i.Cg)([(0,d.MZ)({type:Boolean})],$.prototype,"datesInUnknownTimezone",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"dpi",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"elevationInfo",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"gdbVersion",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"imageFormat",void 0),(0,i.Cg)([(0,p.w)("imageFormat",["supportedImageFormatTypes"])],$.prototype,"readImageFormat",null),(0,i.Cg)([(0,d.MZ)({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],$.prototype,"imageMaxHeight",void 0),(0,i.Cg)([(0,d.MZ)({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],$.prototype,"imageMaxWidth",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"imageTransparency",void 0),(0,i.Cg)([(0,d.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],$.prototype,"isReference",void 0),(0,i.Cg)([(0,d.MZ)({json:{read:!1,write:!1}})],$.prototype,"labelsVisible",void 0),(0,i.Cg)([(0,d.MZ)({type:["ArcGISMapServiceLayer"]})],$.prototype,"operationalLayerType",void 0),(0,i.Cg)([(0,d.MZ)({json:{read:!1,write:!1}})],$.prototype,"popupEnabled",void 0),(0,i.Cg)([(0,d.MZ)((0,V.P6)("preferredTimeReference"))],$.prototype,"preferredTimeZone",void 0),(0,i.Cg)([(0,d.MZ)()],$.prototype,"sourceJSON",void 0),(0,i.Cg)([(0,d.MZ)({json:{write:{ignoreOrigin:!0}}})],$.prototype,"sublayers",void 0),(0,i.Cg)([(0,m.K)("sublayers",{layers:{type:[_.A]},visibleLayers:{type:[u.jz]}})],$.prototype,"writeSublayers",null),(0,i.Cg)([(0,d.MZ)({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],$.prototype,"listMode",void 0),(0,i.Cg)([(0,d.MZ)({json:{read:!1},readOnly:!0,value:"map-image"})],$.prototype,"type",void 0),(0,i.Cg)([(0,d.MZ)(N.OZ)],$.prototype,"url",void 0),$=(0,i.Cg)([(0,y.$)("esri.layers.MapImageLayer")],$);const q=$},26253:(e,t,r)=>{r.d(t,{T:()=>p});var i=r(31635),s=r(69540),a=r(25482),o=r(88930),n=r(10107),l=(r(44208),r(53966),r(87811),r(93223)),d=r(40608),u=r(73133);let p=class extends(s.A.ClonableMixin(a.A)){constructor(e){super(e),this.unit="milliseconds",this.value=0}toMilliseconds(){return(0,o.t)(this.value,this.unit,"milliseconds")}};(0,i.Cg)([(0,l.e)(u.j,{nonNullable:!0})],p.prototype,"unit",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{write:!0},nonNullable:!0})],p.prototype,"value",void 0),p=(0,i.Cg)([(0,d.$)("esri.time.TimeInterval")],p)},73133:(e,t,r)=>{r.d(t,{j:()=>i});const i=(0,r(66552).O)()({esriTimeUnitsMilliseconds:"milliseconds",esriTimeUnitsSeconds:"seconds",esriTimeUnitsMinutes:"minutes",esriTimeUnitsHours:"hours",esriTimeUnitsDays:"days",esriTimeUnitsWeeks:"weeks",esriTimeUnitsMonths:"months",esriTimeUnitsYears:"years",esriTimeUnitsDecades:"decades",esriTimeUnitsCenturies:"centuries",esriTimeUnitsUnknown:void 0})},82935:(e,t,r)=>{r.d(t,{B:()=>m,e:()=>c});var i=r(31635),s=r(10107),a=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),n=r(89317),l=r(30524),d=r(96184),u=r(73133),p=r(64272),y=r(26253);const m={type:Boolean,json:{read:{source:"timeAnimation"},write:{target:"timeAnimation",layerContainerTypes:n.K}}},c=e=>{const t=e;let r=class extends t{constructor(){super(...arguments),this.timeExtent=null,this.timeOffset=null,this.useViewTime=!0}readOffset(e,t){const r=t.timeInfo.exportOptions;if(!r)return null;const i=r.timeOffset,s=u.j.fromJSON(r.timeOffsetUnits);return i&&s?new y.T({value:i,unit:s}):null}set timeInfo(e){(0,l.sv)(e,this.fieldsIndex),this._set("timeInfo",e)}};return(0,i.Cg)([(0,s.MZ)({type:p.T,json:{write:!1}})],r.prototype,"timeExtent",void 0),(0,i.Cg)([(0,s.MZ)({type:y.T})],r.prototype,"timeOffset",void 0),(0,i.Cg)([(0,a.w)("service","timeOffset",["timeInfo.exportOptions"])],r.prototype,"readOffset",null),(0,i.Cg)([(0,s.MZ)({value:null,type:d.A,json:{write:!0,origins:{"web-document":{read:!1,write:!1},"portal-item":{read:!1,write:!1}}}})],r.prototype,"timeInfo",null),(0,i.Cg)([(0,s.MZ)(m)],r.prototype,"useViewTime",void 0),r=(0,i.Cg)([(0,o.$)("esri.layers.mixins.TemporalLayer")],r),r}},83960:(e,t,r)=>{r.d(t,{X_:()=>o,oW:()=>l,zx:()=>n});var i=r(34727),s=r(83047);const a=96;function o(e,t){const r=t||e.extent,i=e.width,o=(0,s.GA)(r?.spatialReference);return r&&i?r.width/i*o*s.dy*a:0}function n(e,t,r){return function(e,t){return 0===t||(0,i.Sp)(e,t)||e<t}(e,t)&&function(e,t){return 0===t||(0,i.Sp)(e,t)||e>t}(e,r)}function l(e,t){return(0,i.Sp)(e,t)?0:(e||Number.POSITIVE_INFINITY)>(t||Number.POSITIVE_INFINITY)?1:-1}},91908:(e,t,r)=>{r.d(t,{D:()=>a});var i=r(60694);const s=[];function a(e,t){if((0,i.Wo)(e.url??""))return!0;const{wkid:r}=t;for(const t of s){if((e.version??0)>=t[0])return!0;if("function"==typeof t[1]&&(t[1]=t[1]()),t[1].has(r))return!1}return!0}s.push([10.91,()=>{const e=new Set([9709,9716,9741,9761,9766]);for(let t=9712;t<=9713;t++)e.add(t);for(let t=9748;t<=9749;t++)e.add(t);for(let t=20904;t<=20932;t++)e.add(t);for(let t=21004;t<=21032;t++)e.add(t);for(let t=21207;t<=21264;t++)e.add(t);for(let t=21307;t<=21364;t++)e.add(t);for(let t=23301;t<=23333;t++)e.add(t);for(let t=102759;t<=102760;t++)e.add(t);for(let t=102934;t<=102955;t++)e.add(t);return e}]),s.push([10.9,()=>{const e=new Set([9300,9354,9364,9367,9373,9377,9387,9456,9473,9498,9678,9680,29874,103599,103872,104028]);for(let t=9356;t<=9360;t++)e.add(t);for(let t=9404;t<=9407;t++)e.add(t);for(let t=9476;t<=9482;t++)e.add(t);for(let t=9487;t<=9494;t++)e.add(t);for(let t=9697;t<=9699;t++)e.add(t);return e}]),s.push([10.81,()=>{const e=new Set([9265,9333,103598,103699]);for(let t=9248;t<=9254;t++)e.add(t);for(let t=9271;t<=9273;t++)e.add(t);for(let t=9284;t<=9285;t++)e.add(t);for(let t=21453;t<=21463;t++)e.add(t);return e}]),s.push([10.8,()=>{const e=new Set([8088,8395,8428,8433,8531,8687,8692,8694,8699,8900,9003,9006,9009,9012,9017,9191]);for(let t=8035;t<=8036;t++)e.add(t);for(let t=8455;t<=8456;t++)e.add(t);for(let t=8518;t<=8529;t++)e.add(t);for(let t=8533;t<=8536;t++)e.add(t);for(let t=8538;t<=8540;t++)e.add(t);for(let t=8677;t<=8679;t++)e.add(t);for(let t=8902;t<=8903;t++)e.add(t);for(let t=8907;t<=8910;t++)e.add(t);for(let t=8949;t<=8951;t++)e.add(t);for(let t=8972;t<=8987;t++)e.add(t);for(let t=9039;t<=9040;t++)e.add(t);for(let t=9068;t<=9069;t++)e.add(t);for(let t=9140;t<=9141;t++)e.add(t);for(let t=9148;t<=9150;t++)e.add(t);for(let t=9153;t<=9159;t++)e.add(t);for(let t=9205;t<=9218;t++)e.add(t);for(let t=9221;t<=9222;t++)e.add(t);for(let t=54098;t<=54101;t++)e.add(t);return e}]),s.push([10.71,()=>{const e=new Set([6316]);for(let t=8351;t<=8353;t++)e.add(t);for(let t=9294;t<=9297;t++)e.add(t);for(let t=22619;t<=22621;t++)e.add(t);for(let t=103586;t<=103594;t++)e.add(t);return e}])},96184:(e,t,r)=>{r.d(t,{A:()=>c});var i=r(31635),s=r(69540),a=r(25482),o=r(10107),n=(r(44208),r(53966),r(87811),r(36005)),l=r(40608),d=r(43937),u=r(64272),p=r(26253),y=r(56400);function m(e,t){return p.T.fromJSON({value:e,unit:t})}let c=class extends(s.A.ClonableMixin(a.A)){constructor(e){super(e),this.cumulative=!1,this.endField=null,this.fullTimeExtent=null,this.hasLiveData=!1,this.interval=null,this.startField=null,this.timeZone=null,this.trackIdField=null,this.useTime=!0,this.stops=null}readFullTimeExtent(e,t){return t.timeExtent&&Array.isArray(t.timeExtent)&&2===t.timeExtent.length?u.T.fromArray(t.timeExtent):null}writeFullTimeExtent(e,t){null!=e?.start&&null!=e.end?t.timeExtent=e.toArray():t.timeExtent=null}readInterval(e,t){return t.timeInterval&&t.timeIntervalUnits?m(t.timeInterval,t.timeIntervalUnits):t.defaultTimeInterval&&t.defaultTimeIntervalUnits?m(t.defaultTimeInterval,t.defaultTimeIntervalUnits):null}writeInterval(e,t){t.timeInterval=e?.toJSON().value??null,t.timeIntervalUnits=e?.toJSON().unit??null}};(0,i.Cg)([(0,o.MZ)({type:Boolean,json:{name:"exportOptions.timeDataCumulative",write:!0}})],c.prototype,"cumulative",void 0),(0,i.Cg)([(0,o.MZ)({type:String,json:{name:"endTimeField",write:{enabled:!0,allowNull:!0}}})],c.prototype,"endField",void 0),(0,i.Cg)([(0,o.MZ)({type:u.T,json:{write:{enabled:!0,allowNull:!0}}})],c.prototype,"fullTimeExtent",void 0),(0,i.Cg)([(0,n.w)("fullTimeExtent",["timeExtent"])],c.prototype,"readFullTimeExtent",null),(0,i.Cg)([(0,d.K)("fullTimeExtent")],c.prototype,"writeFullTimeExtent",null),(0,i.Cg)([(0,o.MZ)({type:Boolean,json:{write:!0}})],c.prototype,"hasLiveData",void 0),(0,i.Cg)([(0,o.MZ)({type:p.T,json:{write:{enabled:!0,allowNull:!0}}})],c.prototype,"interval",void 0),(0,i.Cg)([(0,n.w)("interval",["timeInterval","timeIntervalUnits","defaultTimeInterval","defaultTimeIntervalUnits"])],c.prototype,"readInterval",null),(0,i.Cg)([(0,d.K)("interval")],c.prototype,"writeInterval",null),(0,i.Cg)([(0,o.MZ)({type:String,json:{name:"startTimeField",write:{enabled:!0,allowNull:!0}}})],c.prototype,"startField",void 0),(0,i.Cg)([(0,o.MZ)((0,y.P6)("timeReference",!0))],c.prototype,"timeZone",void 0),(0,i.Cg)([(0,o.MZ)({type:String,json:{write:{enabled:!0,allowNull:!0}}})],c.prototype,"trackIdField",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,json:{name:"exportOptions.useTime",write:!0}})],c.prototype,"useTime",void 0),(0,i.Cg)([(0,o.MZ)({type:[Date],json:{read:!1}})],c.prototype,"stops",void 0),c=(0,i.Cg)([(0,l.$)("esri.layers.support.TimeInfo")],c)}}]);
|