@arcgis/core 5.0.0-next.50 → 5.0.0-next.51
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/PopupTemplate.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/2c3b65a756439a93b4d6.js +1 -0
- package/assets/esri/core/workers/chunks/{ed550bf27f2bbf8d30fa.js → 45fe2b6cbb957c521291.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8511e71c5108a0ba9eb.js → 99baa5f97131e8689887.js} +1 -1
- package/assets/esri/core/workers/chunks/a1b8722c6acafdf1c2bf.js +1 -0
- package/config.js +1 -1
- package/core/accessorSupport/Properties.js +1 -1
- package/core/accessorSupport/Property.js +1 -1
- package/core/accessorSupport/decorators/subclass.js +1 -1
- package/interfaces.d.ts +0 -12
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/396a95b800a0bdc398b9.js +0 -1
- package/assets/esri/core/workers/chunks/bd4e959be3a0ce3ba41e.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as h,ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as u,on as m,when as y,whenOnce as g}from"../../core/reactiveUtils.js";import{property as v,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as w,isLoaded as G,load as O,project as T}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as S}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import C from"../../symbols/FillSymbol3DLayer.js";import k from"../../symbols/MeshSymbol3D.js";import H from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleMarkerSymbol.js";import D from"../../symbols/TextSymbol.js";import{symbolTypes as I}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as R}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as x}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as P}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as L}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as F}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as V}from"../../views/input/InputManager.js";import{sketchKeys as K}from"../../views/interactive/keybindings.js";import W from"../../views/interactive/sketch/SketchLabelOptions.js";import Z from"../../views/interactive/sketch/SketchOptions.js";import q from"../../views/interactive/sketch/SketchTooltipOptions.js";import N from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as z}from"../../views/interactive/snapping/SnappingManager.js";import B from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as $}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as Y}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as J}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Q}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as X}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as ee}from"../../views/support/screenUtils.js";import te from"./adapters/layer/GraphicsLayerAdapter.js";import oe from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,UpdateOperationHandle as ie}from"./support/OperationHandle.js";import{getModeFromCreateOptions as re,getDrawToolGeometryTypeFromCreateTool as se,graphicsHaveTooFewVerticesForBox as ne}from"./support/sketchUtils.js";const pe={defaultZ:0},le={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Q},tool:"transform"},he=Symbol(),ce=Symbol();let de=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._updatingHandles=new _,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new H({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new k({symbolLayers:new o([new C])}),this.textSymbol=new D({text:"text"}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Z,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ce),!e)return;const o=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),d(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},u)].filter(t);this.addHandles(o,ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=pe,this.defaultUpdateOptions=le,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new B}initialize(){this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),d(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),u),d(()=>this.view,e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new z({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()})]),$(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new te(e);case"map-notes":return new oe(e);default:return null}}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",{...pe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...le,...e,reshapeOptions:{...le.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...le.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=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new z({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 updating(){return!(!this._updatingHandles.updating&&!this.snappingManager?.updating)}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(y(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:a}=this;if(!o||"disabled"===this.state)throw a||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");F(o,this._internalGraphicsLayer);const i=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==i||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=()=>{if(i===this._operationHandle){const o=this.createGraphic,a=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),i.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:a?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),a||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(c(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(c(this.update([o])))}};i.on("complete",r),this._operationHandle=i,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:a,state:i}=this;if(!a||"disabled"===i)throw o||this._logMissingLayer(),l();null!=a.activeTool&&(a.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Ge(s)||(F(a,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.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)||(w(o.geometry.spatialReference,t.spatialReference)||G()||await O(),o.geometry=T(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 a=await t.hitTest(e,{exclude:o});return X(a.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e)&&o.push(e)});const a=await t.hitTest(e,{exclude:o});if(a.results.length>0){const e=a.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!a.ground.mapPoint||t.map.ground.opacity<1||a.ground.distance-(e.distance??0)>-Math.min(3*a.ground.distance,"global"===t.viewingMode?b(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))},V.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(ee(e)));let o=null;if(null!=t){const a=t.graphic;this.updateGraphics.includes(a)||this.hasGraphic(a)?(e.stopPropagation(),o=a):"2d"!==this.view?.type||this._isComponentGraphic(a)||"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 a={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,o,a);return null==i?null:(o.tools.add(i),o.activeTool=i,this._setupCreateOperationHandle(i,e))}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:a,defaultZ:i,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=re(p,e),c=se(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:a,defaultZ:i,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ye(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}async _makeDrawGraphicTool3D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let a=null;const i=e.forceUniformSize,s=e.centered,n=[o.on("key-down",t=>{if(t.key===K.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===K.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==K.vertexAdd||t.repeat)t.key===K.undo?(t.stopPropagation(),p.undo()):t.key===K.redo?(t.stopPropagation(),p.redo()):t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===K.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())}},V.WIDGET),o.on("key-up",t=>{t.key===K.pan?e.enabled=!0:t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===K.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},V.WIDGET),e.on("vertex-add",t=>{switch(a=null==a?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:a,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),a="complete",e.aborted?p&&p.cancel():p&&p.complete()}),d(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{r(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_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;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let i=a.tool??le.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(i){case"move":return this._setupMove3DOperation(e,a,o,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,o);case"transform":return this._setupGraphicTransform3DOperation(e,a,o)}}switch(i){case"move":return this._setupMove2DOperation(e,a,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,i,a,o);case"transform":return ne(e)&&(i="reshape"),this._setupTransformOrReshape2DOperation(e,i,a,o)}}async _setupMove3DOperation(e,t,o,a,i=!1){const[s,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=s.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const r of e){const e=new p({view:o,graphic:r}),t=x(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${R(t)}).`),null;h.set(r,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())),i||this.updateGraphics.addMany(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},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"!==a)return;const e=this.updateGraphics.at(0),i=await this._setupReshape3DOperation(e,t,o,!0);i&&!Ge(i)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(i,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,a=!1){if(1===e.length&&0===L(e[0])){const i=e[0],r=i.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(i,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(i,t,o,a)}return this._setupMove3DOperation(e,t,o,"transform",a)}async _setupPointTransform3DOperation(e,t,o){const a="transform",{enableRotation:i,enableScaling:s,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:i,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c.destroy()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},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 a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,a=!1){const i="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(K.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),a||this.updateGraphics.add(e);const v=[],f=new ie({activeComponent:g,tool:i,type:"update",onEnd:()=>{r(v),we(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),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"}),f.onEnd(),f.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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 a=await this._setupReshape3DOperation(e,t,o,!0);a&&!Ge(a)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(a,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),V.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),V.WIDGET),o.on("key-down",e=>{e.key!==K.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET)),f}async _setupMove2DOperation(e,t,o){const a="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i=await this._getGraphicMover(e,t,o);if(Ge(i))return i;const s=new ie({activeComponent:i,tool:a,type:"update",onEnd:()=>{this._clearCursor(),r(l),r(p),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ge(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:a})},redo:()=>{const e=this.updateGraphics.toArray();ve(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:a})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.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?i.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==K.constraint||e.repeat||(n=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&n&&(n=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,a=!1){const i="reshape",[s,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=s.module,c=new l({view:o,graphic:e}),d=P(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${R(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),a||this.updateGraphics.add(c.graphic);const y=[],g=new ie({activeComponent:m,tool:i,type:"update",onEnd:()=>{r(y),we(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),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"}),g.onEnd(),g.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},V.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,a){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i="transform"===t?await this._getBox(e,o,a):await this._getReshape(e,o,a);if(Ge(i))return i;const s=new ie({activeComponent:i,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ge(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ve(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const i=await this._setupTransformOrReshape2DOperation(t,"transform",o,a);if(Ge(i))return;this._setUpdateOperationHandle(i,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.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:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?s.complete():ne(o)?s.toggleTool():s.activeComponent.graphics=o,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"===s.tool&&"point"===t.type||"transform"===s.tool&&"extent"===t.type))return;let i=null;"transform"===s.tool?i=await this._getReshape([e],o,a):"reshape"===s.tool&&(i=await this._getBox([e],o,a)),Ge(i)||(s.activeComponent?.destroy(),s.activeComponent=i,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[a.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,o),V.WIDGET),a.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===K.constraint&&!e.repeat&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET),a.on("key-up",e=>{if(e.key===K.constraint&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:a,highlightOptions:i}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ge(r)?r:new r.module.default({enableMoveAllGraphics:a,highlightName:i?.name,highlightsEnabled:!!i?.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:a,enableScaling:i,highlightOptions:r,preserveAspectRatio:s}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),J()]);if(Ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(K.constraint);return new n.module.default({graphics:e,enableRotation:a,enableScaling:i,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!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:a,reshapeOptions:i}=t,r="split"===i?.edgeOperation,s="move"===i?.shapeOperation,n=!!i?.enableCreateCurveFromStraightEdge,[p,l,h]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),Y(),J()]);return Ge(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:a?.name,highlightsEnabled:!!a?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:l,automaticLengthMeasurementUtils:h,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:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:a,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:a,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:a})=>{a.native?.shiftKey&&t.multipleSelectionEnabled&&(a.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(be(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be(t.graphics))),o.on("rotate-start",t=>e.addToHistory(be(t.graphics))),o.on("scale-start",t=>e.addToHistory(be(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be([t.mover]))),o.on("reshape-start",t=>e.addToHistory(be([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(be([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(be([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:a,viewEvent:i}=o;return i.native?.shiftKey&&this.hasGraphic(a)?(i.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(i.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const a=()=>{if(e===this._operationHandle){const a=this.updateGraphics.toArray(),i=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:a,state:"complete",aborted:e.cancelled,tool:i,toolEventInfo:null,type:"update"})}};e.on("complete",a)}async _getCommonUpdateOperationClickHandlers(e,t,o){const a=ee(t),i=await t.defer(()=>this._getFirstHit(a));if(null==i)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([i.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(i.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const a=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!a||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===K.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===K.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===K.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&K.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(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(he)}_displayCursor(e){this.removeHandles(he),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),he)}_logError(e,t,o){s.getLogger(this).error(new a(e,t,o))}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"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}get test(){}wait(){return g(()=>!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?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await h(g(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",me("view"))}_logMissingLayer(){this._logError(ue,me("layer"))}};e([v()],de.prototype,"_defaultSnappingManager",void 0),e([v()],de.prototype,"_layerAdapter",null),e([v()],de.prototype,"_operationHandle",void 0),e([v({readOnly:!0})],de.prototype,"_updatingHandles",void 0),e([v({readOnly:!0})],de.prototype,"activeTool",null),e([v({readOnly:!0})],de.prototype,"activeCreateToolDrawMode",null),e([v()],de.prototype,"activeTooltip",null),e([v({types:I})],de.prototype,"activeFillSymbol",void 0),e([v()],de.prototype,"activeLineSymbol",void 0),e([v()],de.prototype,"activeVertexSymbol",void 0),e([v()],de.prototype,"allowDeleteKey",void 0),e([v({readOnly:!0})],de.prototype,"createGraphic",null),e([v()],de.prototype,"defaultCreateOptions",null),e([v()],de.prototype,"defaultUpdateOptions",null),e([v({type:W,nonNullable:!0})],de.prototype,"labelOptions",null),e([v()],de.prototype,"layer",void 0),e([v({types:I})],de.prototype,"pointSymbol",void 0),e([v({types:I})],de.prototype,"polygonSymbol",void 0),e([v({types:I})],de.prototype,"polylineSymbol",void 0),e([v()],de.prototype,"meshSymbol",void 0),e([v({type:D})],de.prototype,"textSymbol",void 0),e([v({type:B,nonNullable:!0})],de.prototype,"snappingOptions",null),e([v()],de.prototype,"snappingManager",null),e([v({readOnly:!0})],de.prototype,"state",null),e([v({type:q,nonNullable:!0})],de.prototype,"tooltipOptions",null),e([v({readOnly:!0})],de.prototype,"updateGraphics",void 0),e([v()],de.prototype,"updateOnGraphicClick",void 0),e([v()],de.prototype,"updating",null),e([v()],de.prototype,"creationMode",void 0),e([v({type:N,nonNullable:!0})],de.prototype,"valueOptions",null),e([v({types:I})],de.prototype,"vertexSymbol",void 0),e([v({value:null})],de.prototype,"view",null),e([v({constructOnly:!0,type:Z})],de.prototype,"sketchOptions",void 0),de=e([f("esri.widgets.Sketch.SketchViewModel")],de);const ue="sketch:missing-property",me=e=>`Property '${e}' is missing on SketchViewModel.`;function ye(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ge(e,t){fe("undo",e.history.undo,e.history.redo,t)}function ve(e,t){fe("redo",e.history.redo,e.history.undo,t)}function fe(e,t,o,a){const i=t.pop();if(!i)return;const r=i.updates,s=[];a.forEach((t,o)=>{const a=r[o];null!=a&&("geometry"in a&&null!=a.geometry&&(s.push({geometry:t.geometry}),t.geometry=a.geometry),"symbol"in a&&null!=a.symbol&&(s.push({symbol:t.symbol}),t.symbol=a.symbol),"undo"in a&&(s.push(a),a[e](t)))}),o.push({updates:s})}function _e(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function be(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function we(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ge(e){return"requireError"in e&&"aborted"===e.requireError}export{de as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import a from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import{drainHandles as r}from"../../core/handleUtils.js";import"../../core/has.js";import s from"../../core/Logger.js";import{destroyMaybe as n,abortMaybe as p}from"../../core/maybe.js";import{createAbortError as l,whenOrAbort as h,ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{watch as d,syncAndInitial as u,on as m,when as y,whenOnce as g}from"../../core/reactiveUtils.js";import{property as v,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as _}from"../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b}from"../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as w,isLoaded as G,load as O,project as T}from"../../geometry/projectionUtils.js";import{geometryToCoordinates as S}from"../../geometry/support/coordsUtils.js";import{equals as E}from"../../geometry/support/spatialReferenceUtils.js";import A from"../../layers/GraphicsLayer.js";import{isIntegratedMeshLayer as M}from"../../layers/support/layerUtils.js";import C from"../../symbols/FillSymbol3DLayer.js";import k from"../../symbols/MeshSymbol3D.js";import H from"../../symbols/SimpleFillSymbol.js";import j from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleMarkerSymbol.js";import D from"../../symbols/TextSymbol.js";import{symbolTypes as I}from"../../symbols/support/typeUtils.js";import{isSupportedObjectResultMessage as R}from"../../views/3d/interactive/editingTools/isSupportedObjectUtils.js";import{isSupportedObject as x}from"../../views/3d/interactive/editingTools/move/isSupportedObject.js";import{isSupportedObject as P}from"../../views/3d/interactive/editingTools/reshape/isSupportedObject.js";import{isSupportedGraphic as L}from"../../views/3d/interactive/editingTools/transform/isSupportedGraphic.js";import{addUniqueLayer as F}from"../../views/draw/support/layerUtils.js";import{ViewEventPriorities as V}from"../../views/input/InputManager.js";import{sketchKeys as K}from"../../views/interactive/keybindings.js";import W from"../../views/interactive/sketch/SketchLabelOptions.js";import Z from"../../views/interactive/sketch/SketchOptions.js";import q from"../../views/interactive/sketch/SketchTooltipOptions.js";import N from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as z}from"../../views/interactive/snapping/SnappingManager.js";import B from"../../views/interactive/snapping/SnappingOptions.js";import{setupSnappingToggleHandles as $}from"../../views/interactive/snapping/snappingUtils.js";import{loadAutomaticAreaMeasurementUtils as Y}from"../../views/support/automaticAreaMeasurementUtils.js";import{loadAutomaticLengthMeasurementUtils as J}from"../../views/support/automaticLengthMeasurementUtils.js";import{defaultHighlightName as Q}from"../../views/support/HighlightDefaults.js";import{findFirstGraphicHit as X}from"../../views/support/hitTestSelectUtils.js";import{createScreenPointFromEvent as ee}from"../../views/support/screenUtils.js";import te from"./adapters/layer/GraphicsLayerAdapter.js";import oe from"./adapters/layer/MapNotesLayerAdapter.js";import{CreateOperationHandle as ae,UpdateOperationHandle as ie}from"./support/OperationHandle.js";import{getModeFromCreateOptions as re,getDrawToolGeometryTypeFromCreateTool as se,graphicsHaveTooFewVerticesForBox as ne}from"./support/sketchUtils.js";const pe={defaultZ:0},le={reshapeOptions:{edgeOperation:"split",shapeOperation:"move",vertexOperation:"move",enableCreateCurveFromStraightEdge:!0},enableMoveAllGraphics:!0,enableRotation:!0,enableScaling:!0,multipleSelectionEnabled:!0,preserveAspectRatio:!1,toggleToolOnClick:!0,enableZ:!0,highlightOptions:{enabled:!0,name:Q},tool:"transform"},he=Symbol(),ce=Symbol();let de=class extends i{constructor(e){super(e),this._defaultSnappingManager=null,this._internalGraphicsLayer=new A({listMode:"hide",internal:!0,title:"SVM Internal"}),this._operationHandle=null,this._updatingHandles=new _,this._viewHandlesKey="viewHandles",this.activeFillSymbol=null,this.activeLineSymbol=null,this.activeVertexSymbol=null,this.allowDeleteKey=!0,this.layer=null,this.pointSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.polygonSymbol=new H({color:[150,150,150,.2],outline:{color:[50,50,50],width:2}}),this.polylineSymbol=new j({color:[130,130,130,1],width:2}),this.meshSymbol=new k({symbolLayers:new o([new C])}),this.updateGraphics=new o,this.updateOnGraphicClick=!0,this.creationMode="single",this.vertexSymbol=new U({style:"circle",size:6,color:[255,255,255],outline:{color:[50,50,50],width:1}}),this.sketchOptions=new Z,this._moduleLoaderAbortController=null,this._viewReadyAbortController=null,this._sketchContinuationFlag=!1,this._onLayerAdapterChange=async()=>{const{_layerAdapter:e}=this;if(this.removeHandles(ce),!e)return;const o=[e.onGraphicsChange(e=>this._onLayerGraphicsChangeCallback(e)),d(()=>e.elevationInfo,e=>{e!==this._internalGraphicsLayer.elevationInfo&&(this.cancel(),this._internalGraphicsLayer&&(this._internalGraphicsLayer.elevationInfo=e))},u)].filter(t);this.addHandles(o,ce)},this._originalPopupEnabled=null,this.defaultCreateOptions=pe,this.defaultUpdateOptions=le,this.snappingOptions=e?.snappingManager?.options??e?.snappingOptions??new B,this.textSymbol=new D({text:"text"})}initialize(){this.addHandles([m(()=>this.view?.map?.layers,"change",e=>{this.layer&&e.removed.includes(this.layer)&&this.cancel()}),d(()=>this._layerAdapter,()=>this._onLayerAdapterChange(),u),d(()=>this.view,e=>{this._defaultSnappingManager=n(this._defaultSnappingManager),e&&(this.snappingManager||(this._defaultSnappingManager=new z({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()})]),$(this)}destroy(){this.cancel(),this._removeDefaultLayer(),this._defaultSnappingManager=n(this._defaultSnappingManager),this._set("snappingManager",null),this._set("view",null),this._updatingHandles.destroy(),this.emit("destroy")}get _layerAdapter(){const{layer:e}=this;switch(e?.type){case"graphics":return new te(e);case"map-notes":return new oe(e);default:return null}}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",{...pe,...e})}get defaultUpdateOptions(){return this._get("defaultUpdateOptions")}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",{...le,...e,reshapeOptions:{...le.reshapeOptions,...e?.reshapeOptions},highlightOptions:{...le.highlightOptions,...e?.highlightOptions}})}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get textSymbol(){return this._get("textSymbol")}set textSymbol(e){this._set("textSymbol",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=n(this._defaultSnappingManager)),this._override("snappingManager",e);else{const{view:e}=this;!this._defaultSnappingManager&&e&&(this._defaultSnappingManager=new z({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 updating(){return!(!this._updatingHandles.updating&&!this.snappingManager?.updating)}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(y(()=>e.ready,t=>{this.removeHandles(this._viewHandlesKey),t&&this.addHandles(this._generateViewHandles(e),this._viewHandlesKey)},u),o),this._set("view",e)}addGraphic(e){this._layerAdapter?.add(e)}addGraphics(e){this._layerAdapter?.addMany(e)}hasGraphic(e){return!!this._layerAdapter?.has(e)}removeGraphic(e){this._layerAdapter?.remove(e)}removeGraphics(e){this._layerAdapter?.removeMany(e)}removeAllGraphics(){this._layerAdapter?.removeAll()}cancel(){this._moduleLoaderAbortController=p(this._moduleLoaderAbortController),this._viewReadyAbortController=p(this._viewReadyAbortController),this._sketchContinuationFlag=!0,this._operationHandle&&this._operationHandle.cancel()}complete(){this._operationHandle?.complete()}delete(){const{state:e,updateGraphics:t}=this;if("active"===e&&t.length){const{activeTool:e}=this,o=t.toArray();this.removeGraphics(o),this.cancel(),this._emitDeleteEvent({graphics:o,tool:e})}}duplicate(){if("active"===this.state&&this.updateGraphics.length){const e=this.updateGraphics.map(e=>e.clone()).toArray();return this.addGraphics(e),this.emit("duplicate",{graphics:e,type:"duplicate"}),e}return[]}async create(e,t){this.cancel(),await this._waitViewReady();const{view:o,layer:a}=this;if(!o||"disabled"===this.state)throw a||this._logMissingLayer(),l();if(null!=o.activeTool&&(o.activeTool=null),!e)return void this._logError("sketch:missing-parameter","Missing parameter 'tool'.");F(o,this._internalGraphicsLayer);const i=await this._updatingHandles.addPromise(this._setupCreateOperation(e,t));if(null==i||this.destroyed)return void o.map?.remove(this._internalGraphicsLayer);const r=()=>{if(i===this._operationHandle){const o=this.createGraphic,a=this._operationHandle.cancelled;if(this._operationHandle.destroy(),this._operationHandle=null,this._set("createGraphic",null),this.view?.map?.remove(this._internalGraphicsLayer),i.cancelled||null==o||this.addGraphic(o),this._sketchContinuationFlag=!1,this.emit("create",{graphic:o,state:a?"cancel":"complete",tool:e,toolEventInfo:null,type:"create"}),a||this._sketchContinuationFlag)return;const{creationMode:r}=this;if("continuous"===r){if(t?.geometryToPlace)return;this._updatingHandles.addPromise(c(this.create(e,t)))}else"update"===r&&o&&this._updatingHandles.addPromise(c(this.update([o])))}};i.on("complete",r),this._operationHandle=i,o.ready&&o.focus()}async place(e,t){return await e.load(),this.create("mesh",{mode:"click",hasZ:e.hasZ,geometryToPlace:e,...t})}async update(e,t){this.cancel(),await this._waitViewReady();const{layer:o,view:a,state:i}=this;if(!a||"disabled"===i)throw o||this._logMissingLayer(),l();null!=a.activeTool&&(a.activeTool=null);const r=Array.isArray(e)?e:[e];if(null==e||!r?.length)return void this._logError("sketch:missing-parameter","Missing parameter 'graphics'.");if(r.some(e=>this.hasGraphic(e)?null==e.geometry&&(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics with an unsupported geometry."),!0):(this._logError("sketch:invalid-parameter","Parameter 'graphics' contains one or more graphics missing from the supplied GraphicsLayer."),!0)))return;const s=await this._updatingHandles.addPromise(this._setupUpdateOperation(r,t));this.destroyed||null==s||Ge(s)||(F(a,this._internalGraphicsLayer),this._setUpdateOperationHandle(s,t),this.emit("update",{graphics:r,state:"start",aborted:!1,tool:s.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)||(w(o.geometry.spatialReference,t.spatialReference)||G()||await O(),o.geometry=T(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 a=await t.hitTest(e,{exclude:o});return X(a.results)}const o=[t.map.ground];t.map.allLayers.forEach(e=>{M(e)&&o.push(e)});const a=await t.hitTest(e,{exclude:o});if(a.results.length>0){const e=a.results[0];if(null!=e&&"graphic"===e.type&&e.graphic&&(!a.ground.mapPoint||t.map.ground.opacity<1||a.ground.distance-(e.distance??0)>-Math.min(3*a.ground.distance,"global"===t.viewingMode?b(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))},V.WIDGET)]}async _handleImmediateClick(e){const t=await e.defer(()=>this._getFirstHit(ee(e)));let o=null;if(null!=t){const a=t.graphic;this.updateGraphics.includes(a)||this.hasGraphic(a)?(e.stopPropagation(),o=a):"2d"!==this.view?.type||this._isComponentGraphic(a)||"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 a={hasZ:"3d"===o.type,...this.defaultCreateOptions,...t},i=await this._setupDrawGraphicTool(e,o,a);return null==i?null:(o.tools.add(i),o.activeTool=i,this._setupCreateOperationHandle(i,e))}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:a,defaultZ:i,hasZ:r,geometryToPlace:s,graphicProperties:n,mode:p,preserveAspectRatio:l}=o,h=re(p,e),c=se(e),d=o?.optionsPerTool?.has(e)?o.optionsPerTool.get(e):{},u=d?.preserveAspectRatio??l??"rectangle"!==e,m={centered:"rectangle"!==e&&!("circle"===e&&!u),cursor:a,defaultZ:i,forceUniformSize:u,graphicProperties:{...n,attributes:{...n?.attributes}},geometryToPlace:s,geometryType:c,mode:h,graphicSymbol:o.graphicSymbol??this._getGraphicSymbolFromTool(e),hasZ:r,snappingManager:this.snappingManager,snapToScene:!1,view:t,...d};return"2d"===t.type?this._makeDrawGraphicTool2D(m):this._makeDrawGraphicTool3D(m)}async _makeDrawGraphicTool2D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/2d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool2D({...e,activeVertexSymbol:this.activeVertexSymbol,regularVerticesSymbol:this.vertexSymbol,activeLineSymbol:this.activeLineSymbol,activeFillSymbol:ye(e.geometryType)?this.activeFillSymbol:null,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}async _makeDrawGraphicTool3D(e){const[t,o,a]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);return Ge(t)||this.destroyed?null:new t.module.DrawGraphicTool3D({...e,elevationInfo:this._layerAdapter?.elevationInfo,snapToScene:!0,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:o,automaticLengthMeasurementUtils:a})}_setupCreateOperationHandle(e,t){const o=this.view;if(!o)return this._logMissingView(),null;let a=null;const i=e.forceUniformSize,s=e.centered,n=[o.on("key-down",t=>{if(t.key===K.pan)t.stopPropagation(),t.repeat||(e.enabled=!1);else if(t.key===K.complete)t.stopPropagation(),e.completeCreateOperation();else if(t.key!==K.vertexAdd||t.repeat)t.key===K.undo?(t.stopPropagation(),p.undo()):t.key===K.redo?(t.stopPropagation(),p.redo()):t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType||t.repeat?t.key===K.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())}},V.WIDGET),o.on("key-up",t=>{t.key===K.pan?e.enabled=!0:t.key!==K.constraint||"rectangle"!==e.geometryType&&"circle"!==e.geometryType?t.key===K.center&&(e.centered=s,t.stopPropagation()):(e.forceUniformSize=i,t.stopPropagation())},V.WIDGET),e.on("vertex-add",t=>{switch(a=null==a?"start":"active",t.operation){case"apply":this.emit("create",{graphic:e.graphic,state:a,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),a="complete",e.aborted?p&&p.cancel():p&&p.complete()}),d(()=>this._getGraphicSymbolFromTool(t),t=>{e.graphicSymbol=t})],p=new ae({activeComponent:e,type:"create",onEnd:()=>{r(n),o.tools?.remove(e)},undo:()=>{e.canUndo&&e.undo()},redo:()=>{e.canRedo&&e.redo()},canUndo:()=>e.canUndo,canRedo:()=>e.canRedo});return p}_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;case"text":return this.textSymbol}}async _setupUpdateOperation(e,t){const{view:o}=this;if(!o)return this._logMissingView(),null;const a={...this.defaultUpdateOptions,...t,reshapeOptions:{...this.defaultUpdateOptions.reshapeOptions,...t?.reshapeOptions},highlightOptions:{...this.defaultUpdateOptions.highlightOptions,...t?.highlightOptions}};let i=a.tool??le.tool;if(this.removeGraphics(e),this.addGraphics(e),"3d"===o.type){if(0===e.length)return null;switch(i){case"move":return this._setupMove3DOperation(e,a,o,i);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupReshape3DOperation(e[0],a,o);case"transform":return this._setupGraphicTransform3DOperation(e,a,o)}}switch(i){case"move":return this._setupMove2DOperation(e,a,o);case"reshape":return e.length>1?(this._logError("sketch:reshape-multiple","Reshape operation does not support multiple graphics."),null):this._setupTransformOrReshape2DOperation(e,i,a,o);case"transform":return ne(e)&&(i="reshape"),this._setupTransformOrReshape2DOperation(e,i,a,o)}}async _setupMove3DOperation(e,t,o,a,i=!1){const[s,n]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:p,MoveTool3D:l}=s.module,h=new Map,c=()=>{h.forEach(e=>e.destroy()),h.clear()};for(const r of e){const e=new p({view:o,graphic:r}),t=x(e);if(0!==t)return c(),this._logError("sketch:move",`Move operation not supported for provided graphic(s) (${R(t)}).`),null;h.set(r,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())),i||this.updateGraphics.addMany(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},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"!==a)return;const e=this.updateGraphics.at(0),i=await this._setupReshape3DOperation(e,t,o,!0);i&&!Ge(i)&&(m.onEnd(),m.destroy(),this._setUpdateOperationHandle(i,t))}});return u.push(...this._getHandlesForComponent(m,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(m,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}_setupGraphicTransform3DOperation(e,t,o,a=!1){if(1===e.length&&0===L(e[0])){const i=e[0],r=i.geometry;if(null!=r&&("point"===r.type||"mesh"===r.type))return this._setupPointTransform3DOperation(i,t,o);if(null!=r&&("polygon"===r.type||"polyline"===r.type))return this._setupPolyTransform3DOperation(i,t,o,a)}return this._setupMove3DOperation(e,t,o,"transform",a)}async _setupPointTransform3DOperation(e,t,o){const a="transform",{enableRotation:i,enableScaling:s,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:i,enableScaling:s,enableZ:n,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions});o.tools.add(d),this.updateGraphics.add(e);const u=[],m=new ie({activeComponent:d,tool:a,type:"update",onEnd:()=>{r(u),we(o,d),c.destroy()},undo:()=>{_e(this.view,d),ge(m,this.updateGraphics.toArray()),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:a})},redo:()=>{ve(m,this.updateGraphics.toArray()),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:a})},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 a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(m,e)},V.WIDGET)),m}async _setupPolyTransform3DOperation(e,t,o,a=!1){const i="transform",{enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:l}=t,[h,c]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),J()]);if(Ge(h))return h;const{ManipulatedObject3DGraphic:d,ExtentTransformTool:u}=h.module,m=this.view?.inputManager?.isModifierKeyDown(K.constraint),y=new d({view:o,graphic:e}),g=new u({object:y,view:o,enableRotation:s,enableScaling:n,enableZ:p,preserveAspectRatio:!!l!=!!m,sketchOptions:this.sketchOptions,automaticLengthMeasurementUtils:c});o.tools.add(g),a||this.updateGraphics.add(e);const v=[],f=new ie({activeComponent:g,tool:i,type:"update",onEnd:()=>{r(v),we(o,g),y.destroy()},canUndo:()=>!g.destroyed&&g.canUndo,undo:()=>{g.destroyed||(g.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!g.destroyed&&g.canRedo,redo:()=>{g.destroyed||(g.redo(),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"}),f.onEnd(),f.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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 a=await this._setupReshape3DOperation(e,t,o,!0);a&&!Ge(a)&&(f.onEnd(),f.destroy(),this._setUpdateOperationHandle(a,t))}});return v.push(...this._getHandlesForComponent(f,t),o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(f,e,t),V.WIDGET),o.on("key-down",e=>this._getCommonUpdateOperationKeyDownHandlers(f,e),V.WIDGET),o.on("key-down",e=>{e.key!==K.constraint||e.repeat||(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&(g.preserveAspectRatio=!g.preserveAspectRatio,e.stopPropagation())},V.WIDGET)),f}async _setupMove2DOperation(e,t,o){const a="move";this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i=await this._getGraphicMover(e,t,o);if(Ge(i))return i;const s=new ie({activeComponent:i,tool:a,type:"update",onEnd:()=>{this._clearCursor(),r(l),r(p),i.destroy(),this._internalGraphicsLayer?.removeMany([...this.updateGraphics.toArray()])},undo:()=>{const e=this.updateGraphics.toArray();ge(s,e),s.refreshComponent(),this._emitUndoEvent({graphics:e,tool:a})},redo:()=>{const e=this.updateGraphics.toArray();ve(s,e),s.refreshComponent(),this._emitRedoEvent({graphics:e,tool:a})},addToSelection:async e=>{await this._updatingHandles.addPromise(this._updateSpatialReference(e)),this.updateGraphics.push(e),i.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);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.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?i.graphics=o:s.complete()}});let n=!1;const p=[o.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,t),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key!==K.constraint||e.repeat||(n=!0,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET),o.on("key-up",e=>{e.key===K.constraint&&n&&(n=!1,i.enableMoveAllGraphics=!i.enableMoveAllGraphics)},V.WIDGET)],l=this._getHandlesForComponent(s,t);return s}async _setupReshape3DOperation(e,t,o,a=!1){const i="reshape",[s,n,p]=await Promise.all([this._requireModule(import("../../views/3d/interactive/editingTools.js")),Y(),J()]);if(Ge(s))return s;const{ManipulatedObject3DGraphic:l,ReshapeTool3D:h}=s.module,c=new l({view:o,graphic:e}),d=P(c);if(0!==d)return c.destroy(),this._logError("sketch:reshape",`Reshape operation not supported for provided graphic(s) (${R(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),a||this.updateGraphics.add(c.graphic);const y=[],g=new ie({activeComponent:m,tool:i,type:"update",onEnd:()=>{r(y),we(o,m),c.destroy()},canUndo:()=>!m.destroyed&&m.canUndo,undo:()=>{m.destroyed||(m.undo(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:i}))},canRedo:()=>!m.destroyed&&m.canRedo,redo:()=>{m.destroyed||(m.redo(),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"}),g.onEnd(),g.destroy();const a=await this._setupMove3DOperation(this.updateGraphics.toArray(),t,o,"transform",!0);Ge(a)||this._setUpdateOperationHandle(a,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),V.WIDGET),o.on("key-down",e=>{this._getCommonUpdateOperationKeyDownHandlers(g,e)},V.WIDGET)),g}async _setupTransformOrReshape2DOperation(e,t,o,a){this.updateGraphics.addMany(e),await this._updatingHandles.addPromise(this._updateSpatialReference(e));const i="transform"===t?await this._getBox(e,o,a):await this._getReshape(e,o,a);if(Ge(i))return i;const s=new ie({activeComponent:i,type:"update",onEnd:()=>{r(p),r(n),s.activeComponent&&!s.activeComponent.destroyed&&s.activeComponent.destroy(),this._internalGraphicsLayer.removeMany(this.updateGraphics.toArray())},undo:()=>{ge(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitUndoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},redo:()=>{ve(s,this.updateGraphics.toArray()),s.refreshComponent(),this._emitRedoEvent({graphics:this.updateGraphics.toArray(),tool:s.tool})},addToSelection:async e=>{let t=s.activeComponent;if("reshape"===t?.type){const t=[...this.updateGraphics,e];this.updateGraphics.removeAll(),s.onEnd(),s.destroy();const i=await this._setupTransformOrReshape2DOperation(t,"transform",o,a);if(Ge(i))return;this._setUpdateOperationHandle(i,o)}else this.updateGraphics.add(e),t.graphics=this.updateGraphics.toArray(),t.refresh(),s.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:e=>{const t=this.updateGraphics.indexOf(e);s.history.undo.forEach(e=>e.updates.splice(t,1)),s.history.redo.forEach(e=>e.updates.splice(t,1)),this.updateGraphics.remove(e);const o=this.updateGraphics.toArray();0===o.length?s.complete():ne(o)?s.toggleTool():s.activeComponent.graphics=o,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"===s.tool&&"point"===t.type||"transform"===s.tool&&"extent"===t.type))return;let i=null;"transform"===s.tool?i=await this._getReshape([e],o,a):"reshape"===s.tool&&(i=await this._getBox([e],o,a)),Ge(i)||(s.activeComponent?.destroy(),s.activeComponent=i,s.activeComponent&&(r(p),p=this._getHandlesForComponent(s,o)))}}),n=[a.on("immediate-click",e=>this._getCommonUpdateOperationClickHandlers(s,e,o),V.WIDGET),a.on("key-down",e=>{if(this._getCommonUpdateOperationKeyDownHandlers(s,e),e.key===K.constraint&&!e.repeat&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET),a.on("key-up",e=>{if(e.key===K.constraint&&s){const e=s.activeComponent;"box"===e?.type&&(e.preserveAspectRatio=!e.preserveAspectRatio)}},V.WIDGET)];let p=this._getHandlesForComponent(s,o);return s}async _getGraphicMover(e,t,o){const{enableMoveAllGraphics:a,highlightOptions:i}=t,r=await this._requireModule(import("../../views/draw/support/GraphicMover.js"));return Ge(r)?r:new r.module.default({enableMoveAllGraphics:a,highlightName:i?.name,highlightsEnabled:!!i?.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:a,enableScaling:i,highlightOptions:r,preserveAspectRatio:s}=t,[n,p]=await Promise.all([this._requireModule(import("../../views/draw/support/Box.js")),J()]);if(Ge(n))return n;const l=this.view?.inputManager?.isModifierKeyDown(K.constraint);return new n.module.default({graphics:e,enableRotation:a,enableScaling:i,highlightName:r?.name,highlightsEnabled:!!r?.enabled,preserveAspectRatio:!!s!=!!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:a,reshapeOptions:i}=t,r="split"===i?.edgeOperation,s="move"===i?.shapeOperation,n=!!i?.enableCreateCurveFromStraightEdge,[p,l,h]=await Promise.all([this._requireModule(import("../../views/draw/support/Reshape.js")),Y(),J()]);return Ge(p)?p:new p.module.default({enableMidpoints:r,enableMovement:s,enableCurveOnMidpoint:n,graphic:e[0],highlightName:a?.name,highlightsEnabled:!!a?.enabled,layer:this._internalGraphicsLayer,snappingManager:this.snappingManager,sketchOptions:this.sketchOptions,automaticAreaMeasurementUtils:l,automaticLengthMeasurementUtils:h,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:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMove:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onMoveStop:({dx:e,dy:t,mover:o,type:a})=>this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{dx:e,dy:t,mover:o,type:a},type:"update"}),onVertexAdd:({added:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{added:a,vertices:o,type:t},type:"update"})},onVertexRemove:({removed:e,type:t,vertices:o})=>{const a=e.map(e=>S(e.geometry));this.emit("update",{graphics:this.updateGraphics.toArray(),state:"active",aborted:!1,tool:this.activeTool,toolEventInfo:{removed:a,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:a})=>{a.native?.shiftKey&&t.multipleSelectionEnabled&&(a.stopPropagation(),e.removeFromSelection(o))}),o.on("graphic-move-start",t=>e.addToHistory(be(t.allGraphics)))];case"box":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be(t.graphics))),o.on("rotate-start",t=>e.addToHistory(be(t.graphics))),o.on("scale-start",t=>e.addToHistory(be(t.graphics)))];case"reshape":return[o.on("graphic-click",o=>this._onTransformOrReshape2DGraphicClick(e,t,o)),o.on("move-start",t=>e.addToHistory(be([t.mover]))),o.on("reshape-start",t=>e.addToHistory(be([t.graphic]))),o.on("vertex-add",t=>e.addToHistory(be([t.oldGraphic]))),o.on("vertex-remove",t=>e.addToHistory(be([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:a,viewEvent:i}=o;return i.native?.shiftKey&&this.hasGraphic(a)?(i.stopPropagation(),e.removeFromSelection(a)):t.toggleToolOnClick?(i.stopPropagation(),e.toggleTool()):void 0}_setUpdateOperationHandle(e,t){this._operationHandle=e;const o=this.view?.map;this._disablePopup(t);const a=()=>{if(e===this._operationHandle){const a=this.updateGraphics.toArray(),i=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:a,state:"complete",aborted:e.cancelled,tool:i,toolEventInfo:null,type:"update"})}};e.on("complete",a)}async _getCommonUpdateOperationClickHandlers(e,t,o){const a=ee(t),i=await t.defer(()=>this._getFirstHit(a));if(null==i)return void e.complete();if(t.native.shiftKey&&this._toggleSelection([i.graphic],e,o))return void t.stopPropagation();this.updateGraphics.includes(i.graphic)?t.stopPropagation():e.complete()}_toggleSelection(e,t,o){const a=!!o.multipleSelectionEnabled;return e.some(e=>null!=e&&(!(!a||!this.hasGraphic(e))&&(this.updateGraphics.includes(e)?t.removeFromSelection(e):t.addToSelection(e),!0)))}_getCommonUpdateOperationKeyDownHandlers(e,t){if(!e)return;const o=t.key;o===K.undo&&e.canUndo()?(t.stopPropagation(),e.undo()):o===K.redo&&e.canRedo()?(t.stopPropagation(),e.redo()):o===K.cancel?(t.stopPropagation(),e.cancel()):this.allowDeleteKey&&K.delete.includes(o)&&this._onDeleteKey(t)}_onDeleteKey(e){this._operationHandle&&"update"===this._operationHandle.type&&null!=this.activeComponent&&(e.stopPropagation(),this.delete())}_removeDefaultLayer(){this._internalGraphicsLayer&&(this.view?.map?.remove(this._internalGraphicsLayer),this._internalGraphicsLayer=n(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(he)}_displayCursor(e){this.removeHandles(he),this.view?.container&&null!=e&&this.addHandles(this.view.acquireCursor(e,"high"),he)}_logError(e,t,o){s.getLogger(this).error(new a(e,t,o))}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"})}_onLayerGraphicsChangeCallback(e){if(null!=this._operationHandle){const{updateGraphics:t}=this;for(const o of e.removed)if(t.includes(o)){if(!(t.length>1)){this._operationHandle.cancel();break}this._operationHandle.removeFromSelection(o)}}}get test(){}wait(){return g(()=>!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?(p(this._viewReadyAbortController),this._viewReadyAbortController=new AbortController,await h(g(()=>e?.ready),this._viewReadyAbortController.signal)):this._logMissingView()}_logMissingView(){this._logError("sketch:missing-property",me("view"))}_logMissingLayer(){this._logError(ue,me("layer"))}};e([v()],de.prototype,"_defaultSnappingManager",void 0),e([v()],de.prototype,"_layerAdapter",null),e([v()],de.prototype,"_operationHandle",void 0),e([v({readOnly:!0})],de.prototype,"_updatingHandles",void 0),e([v({readOnly:!0})],de.prototype,"activeTool",null),e([v({readOnly:!0})],de.prototype,"activeCreateToolDrawMode",null),e([v()],de.prototype,"activeTooltip",null),e([v({types:I})],de.prototype,"activeFillSymbol",void 0),e([v()],de.prototype,"activeLineSymbol",void 0),e([v()],de.prototype,"activeVertexSymbol",void 0),e([v()],de.prototype,"allowDeleteKey",void 0),e([v({readOnly:!0})],de.prototype,"createGraphic",null),e([v()],de.prototype,"defaultCreateOptions",null),e([v()],de.prototype,"defaultUpdateOptions",null),e([v({type:W,nonNullable:!0})],de.prototype,"labelOptions",null),e([v()],de.prototype,"layer",void 0),e([v({types:I})],de.prototype,"pointSymbol",void 0),e([v({types:I})],de.prototype,"polygonSymbol",void 0),e([v({types:I})],de.prototype,"polylineSymbol",void 0),e([v()],de.prototype,"meshSymbol",void 0),e([v({type:D})],de.prototype,"textSymbol",null),e([v({type:B,nonNullable:!0})],de.prototype,"snappingOptions",null),e([v()],de.prototype,"snappingManager",null),e([v({readOnly:!0})],de.prototype,"state",null),e([v({type:q,nonNullable:!0})],de.prototype,"tooltipOptions",null),e([v({readOnly:!0})],de.prototype,"updateGraphics",void 0),e([v()],de.prototype,"updateOnGraphicClick",void 0),e([v()],de.prototype,"updating",null),e([v()],de.prototype,"creationMode",void 0),e([v({type:N,nonNullable:!0})],de.prototype,"valueOptions",null),e([v({types:I})],de.prototype,"vertexSymbol",void 0),e([v({value:null})],de.prototype,"view",null),e([v({constructOnly:!0,type:Z})],de.prototype,"sketchOptions",void 0),de=e([f("esri.widgets.Sketch.SketchViewModel")],de);const ue="sketch:missing-property",me=e=>`Property '${e}' is missing on SketchViewModel.`;function ye(e){return"polygon"===e||"rectangle"===e||"circle"===e}function ge(e,t){fe("undo",e.history.undo,e.history.redo,t)}function ve(e,t){fe("redo",e.history.redo,e.history.undo,t)}function fe(e,t,o,a){const i=t.pop();if(!i)return;const r=i.updates,s=[];a.forEach((t,o)=>{const a=r[o];null!=a&&("geometry"in a&&null!=a.geometry&&(s.push({geometry:t.geometry}),t.geometry=a.geometry),"symbol"in a&&null!=a.symbol&&(s.push({symbol:t.symbol}),t.symbol=a.symbol),"undo"in a&&(s.push(a),a[e](t)))}),o.push({updates:s})}function _e(e,t){null!=e&&t.hasGrabbedManipulators&&(e.activeTool=null)}function be(e){return{updates:e.map(({geometry:e})=>"mesh"===e?.type?{geometry:e.cloneShallow()}:{geometry:e})}}function we(e,t){e.tools?.remove(t),t.destroyed||t.destroy()}function Ge(e){return"requireError"in e&&"aborted"===e.requireError}export{de as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2869],{37838:(t,e,o)=>{o.d(e,{A:()=>te});var i,s=o(31635),r=o(69540),n=o(7762),l=o(25482),a=o(4718),p=o(53966),d=o(74887),c=o(91429),u=o(56507),y=o(30524),h=o(89893),m=o(84424);let g=i=class extends m.A{constructor(t){super(t),this.creator=null,this.destroyer=null,this.outFields=null,this.type="custom"}clone(){return new i({creator:this.creator,destroyer:this.destroyer,outFields:Array.isArray(this.outFields)?(0,a.o8)(this.outFields):null})}};(0,s.Cg)([(0,c.MZ)()],g.prototype,"creator",void 0),(0,s.Cg)([(0,c.MZ)()],g.prototype,"destroyer",void 0),(0,s.Cg)([(0,c.MZ)()],g.prototype,"outFields",void 0),(0,s.Cg)([(0,c.MZ)({type:["custom"],readOnly:!0})],g.prototype,"type",void 0),g=i=(0,s.Cg)([(0,c.$K)("esri.popup.content.CustomContent")],g);const f=g;var v;let w=v=class extends l.o{constructor(t){super(t),this.title=null,this.expression=null,this.returnType="dictionary"}clone(){return new v({title:this.title,expression:this.expression})}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],w.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],w.prototype,"expression",void 0),(0,s.Cg)([(0,c.MZ)({type:["dictionary"],readOnly:!0,json:{read:!1,write:!0}})],w.prototype,"returnType",void 0),w=v=(0,s.Cg)([(0,c.$K)("esri.popup.ElementExpressionInfo")],w);const C=w;var M;let x=M=class extends m.A{constructor(t){super(t),this.expressionInfo=null,this.type="expression"}clone(){return new M({expressionInfo:this.expressionInfo?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:C,json:{write:!0}})],x.prototype,"expressionInfo",void 0),(0,s.Cg)([(0,c.MZ)({type:["expression"],readOnly:!0,json:{read:!1,write:!0}})],x.prototype,"type",void 0),x=M=(0,s.Cg)([(0,c.$K)("esri.popup.content.ExpressionContent")],x);const F=x;var Z=o(66159);let I=class extends l.o{constructor(t){super(t),this.altText=null,this.caption="",this.title="",this.type=null}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],I.prototype,"altText",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],I.prototype,"caption",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],I.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)({type:["image","bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],I.prototype,"type",void 0),I=(0,s.Cg)([(0,c.$K)("esri.popup.content.mixins.MediaInfo")],I);const j=I;var b,A=o(68197),N=o(69622);let S=b=class extends N.A{constructor(t){super(t),this.color=null,this.fieldName=null,this.tooltip=null,this.value=null}clone(){return new b({color:this.color?.clone(),fieldName:this.fieldName,tooltip:this.tooltip,value:this.value})}};(0,s.Cg)([(0,c.MZ)()],S.prototype,"color",void 0),(0,s.Cg)([(0,c.MZ)()],S.prototype,"fieldName",void 0),(0,s.Cg)([(0,c.MZ)()],S.prototype,"tooltip",void 0),(0,s.Cg)([(0,c.MZ)()],S.prototype,"value",void 0),S=b=(0,s.Cg)([(0,c.$K)("esri.popup.content.support.ChartMediaInfoValueSeries")],S);const R=S;var _;let O=_=class extends l.o{constructor(t){super(t),this.colors=null,this.fields=[],this.normalizeField=null,this.series=[],this.tooltipField=null}clone(){return new _({colors:(0,a.o8)(this.colors),fields:(0,a.o8)(this.fields),normalizeField:this.normalizeField,series:(0,a.o8)(this.series),tooltipField:this.tooltipField})}};(0,s.Cg)([(0,c.MZ)({type:[A.A],json:{type:[[u.jz]],write:!0}})],O.prototype,"colors",void 0),(0,s.Cg)([(0,c.MZ)({type:[String],json:{write:{isRequired:!0}}})],O.prototype,"fields",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],O.prototype,"normalizeField",void 0),(0,s.Cg)([(0,c.MZ)({type:[R],json:{read:!1}})],O.prototype,"series",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],O.prototype,"tooltipField",void 0),O=_=(0,s.Cg)([(0,c.$K)("esri.popup.content.support.ChartMediaInfoValue")],O);const T=O;let $=class extends j{constructor(t){super(t),this.type=null,this.value=void 0}};(0,s.Cg)([(0,c.MZ)({type:["bar-chart","column-chart","line-chart","pie-chart"],readOnly:!0,json:{read:!1,write:!0}})],$.prototype,"type",void 0),(0,s.Cg)([(0,c.MZ)({type:T,json:{write:{isRequired:!0}}})],$.prototype,"value",void 0),$=(0,s.Cg)([(0,c.$K)("esri.popup.content.mixins.ChartMediaInfo")],$);const K=$,E=(0,o(66552).O)()({barchart:"bar-chart",columnchart:"column-chart",linechart:"line-chart",piechart:"pie-chart"});var B;let k=B=class extends K{constructor(t){super(t),this.type="bar-chart"}clone(){return new B({altText:this.altText,title:this.title,caption:this.caption,value:this.value?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:["bar-chart"],readOnly:!0,json:{type:["barchart"],read:!1,write:{writer:E.write,isRequired:!0}}})],k.prototype,"type",void 0),k=B=(0,s.Cg)([(0,c.$K)("esri.popup.content.BarChartMediaInfo")],k);const J=k;var q;let D=q=class extends K{constructor(t){super(t),this.type="column-chart"}clone(){return new q({altText:this.altText,title:this.title,caption:this.caption,value:this.value?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:["column-chart"],readOnly:!0,json:{type:["columnchart"],read:!1,write:{writer:E.write,isRequired:!0}}})],D.prototype,"type",void 0),D=q=(0,s.Cg)([(0,c.$K)("esri.popup.content.ColumnChartMediaInfo")],D);const U=D;var L;let W=L=class extends l.o{constructor(t){super(t),this.linkURL=null,this.sourceURL=null}clone(){return new L({linkURL:this.linkURL,sourceURL:this.sourceURL})}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],W.prototype,"linkURL",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:{isRequired:!0}}})],W.prototype,"sourceURL",void 0),W=L=(0,s.Cg)([(0,c.$K)("esri.popup.content.support.ImageMediaInfoValue")],W);const z=W;var P;let G=P=class extends j{constructor(t){super(t),this.refreshInterval=0,this.type="image",this.value=void 0}clone(){return new P({altText:this.altText,title:this.title,caption:this.caption,refreshInterval:this.refreshInterval,value:this.value?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:Number,json:{write:!0}})],G.prototype,"refreshInterval",void 0),(0,s.Cg)([(0,c.MZ)({type:["image"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],G.prototype,"type",void 0),(0,s.Cg)([(0,c.MZ)({type:z,json:{write:{isRequired:!0}}})],G.prototype,"value",void 0),G=P=(0,s.Cg)([(0,c.$K)("esri.popup.content.ImageMediaInfo")],G);const V=G;var H;let X=H=class extends K{constructor(t){super(t),this.type="line-chart"}clone(){return new H({altText:this.altText,title:this.title,caption:this.caption,value:this.value?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:["line-chart"],readOnly:!0,json:{type:["linechart"],read:!1,write:{writer:E.write,isRequired:!0}}})],X.prototype,"type",void 0),X=H=(0,s.Cg)([(0,c.$K)("esri.popup.content.LineChartMediaInfo")],X);const Q=X;var Y;let tt=Y=class extends K{constructor(t){super(t),this.type="pie-chart"}clone(){return new Y({altText:this.altText,title:this.title,caption:this.caption,value:this.value?.clone()})}};(0,s.Cg)([(0,c.MZ)({type:["pie-chart"],readOnly:!0,json:{type:["piechart"],read:!1,write:{writer:E.write,isRequired:!0}}})],tt.prototype,"type",void 0),tt=Y=(0,s.Cg)([(0,c.$K)("esri.popup.content.PieChartMediaInfo")],tt);const et=tt,ot={base:j,key:"type",defaultKeyValue:"image",typeMap:{"bar-chart":J,"column-chart":U,"line-chart":Q,"pie-chart":et,image:V}};var it,st=o(36005),rt=o(43937);let nt=it=class extends m.A{constructor(t){super(t),this.activeMediaInfoIndex=null,this.attributes=null,this.description=null,this.mediaInfos=null,this.title=null,this.type="media"}readMediaInfos(t){return t&&t.map(t=>"image"===t.type?V.fromJSON(t):"barchart"===t.type?J.fromJSON(t):"columnchart"===t.type?U.fromJSON(t):"linechart"===t.type?Q.fromJSON(t):"piechart"===t.type?et.fromJSON(t):void 0).filter(Boolean)}writeMediaInfos(t,e){e.mediaInfos=t&&t.map(t=>t.toJSON())}clone(){return new it((0,a.o8)({activeMediaInfoIndex:this.activeMediaInfoIndex,attributes:this.attributes,description:this.description,mediaInfos:this.mediaInfos,title:this.title}))}};(0,s.Cg)([(0,c.MZ)()],nt.prototype,"activeMediaInfoIndex",void 0),(0,s.Cg)([(0,c.MZ)({type:Object,json:{write:!0}})],nt.prototype,"attributes",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],nt.prototype,"description",void 0),(0,s.Cg)([(0,c.MZ)({types:[ot]})],nt.prototype,"mediaInfos",void 0),(0,s.Cg)([(0,st.w)("mediaInfos")],nt.prototype,"readMediaInfos",null),(0,s.Cg)([(0,rt.K)("mediaInfos")],nt.prototype,"writeMediaInfos",null),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],nt.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)({type:["media"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],nt.prototype,"type",void 0),nt=it=(0,s.Cg)([(0,c.$K)("esri.popup.content.MediaContent")],nt);const lt=nt;var at=o(49852);let pt=class extends((0,r.OU)(m.A)){constructor(t){super(t),this.description=null,this.displayCount=null,this.displayType="list",this.orderByFields=null,this.relationshipId=null,this.title=null,this.type="relationship"}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],pt.prototype,"description",void 0),(0,s.Cg)([(0,c.MZ)({type:Number,json:{type:u.jz,write:!0}})],pt.prototype,"displayCount",void 0),(0,s.Cg)([(0,c.MZ)({type:["list"],json:{write:{isRequired:!0}}})],pt.prototype,"displayType",void 0),(0,s.Cg)([(0,c.MZ)({type:[at.A],json:{write:!0}})],pt.prototype,"orderByFields",void 0),(0,s.Cg)([(0,c.MZ)({type:Number,json:{type:u.jz,write:{isRequired:!0}}})],pt.prototype,"relationshipId",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],pt.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)({type:["relationship"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],pt.prototype,"type",void 0),pt=(0,s.Cg)([(0,c.$K)("esri.popup.content.RelationshipContent")],pt);const dt=pt;var ct;let ut=ct=class extends m.A{constructor(t){super(t),this.text=null,this.type="text"}clone(){return new ct({text:this.text})}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],ut.prototype,"text",void 0),(0,s.Cg)([(0,c.MZ)({type:["text"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],ut.prototype,"type",void 0),ut=ct=(0,s.Cg)([(0,c.$K)("esri.popup.content.TextContent")],ut);const yt=ut;var ht=o(83342),mt=o(93223);let gt=class extends((0,r.OU)(m.A)){constructor(t){super(t),this.description=null,this.displayCount=null,this.title=null,this.associationTypes=[],this.type="utility-network-associations"}};(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],gt.prototype,"description",void 0),(0,s.Cg)([(0,c.MZ)({type:Number,json:{type:u.jz,write:!0}})],gt.prototype,"displayCount",void 0),(0,s.Cg)([(0,c.MZ)({type:String,json:{write:!0}})],gt.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)({type:[ht.A],json:{write:!0}})],gt.prototype,"associationTypes",void 0),(0,s.Cg)([(0,mt.e)({utilityNetworkAssociations:"utility-network-associations"})],gt.prototype,"type",void 0),gt=(0,s.Cg)([(0,c.$K)("esri.popup.content.UtilityNetworkAssociationsContent")],gt);const ft=gt,vt=h.A,wt=m.A,Ct=f,Mt=F,xt=Z.A,Ft=lt,Zt=dt,It=yt,jt=ft,bt={base:null,key:"type",typeMap:{attachment:vt,media:Ft,text:It,expression:Mt,field:xt,relationship:Zt,utilityNetworkAssociations:jt}},At={base:null,key:"type",typeMap:{attachment:vt,media:Ft,text:It,expression:Mt,field:xt,relationship:Zt}};var Nt,St=o(93705),Rt=o(41227);let _t=Nt=class extends l.o{constructor(t){super(t),this.returnTopmostRaster=null,this.showNoDataRecords=null}clone(){return new Nt({showNoDataRecords:this.showNoDataRecords,returnTopmostRaster:this.returnTopmostRaster})}};(0,s.Cg)([(0,c.MZ)({type:Boolean,json:{write:!0}})],_t.prototype,"returnTopmostRaster",void 0),(0,s.Cg)([(0,c.MZ)({type:Boolean,json:{write:!0}})],_t.prototype,"showNoDataRecords",void 0),_t=Nt=(0,s.Cg)([(0,c.$K)("esri.popup.LayerOptions")],_t);const Ot=_t;var Tt;let $t=Tt=class extends l.o{constructor(t){super(t),this.showRelatedRecords=null,this.orderByFields=null}clone(){return new Tt({showRelatedRecords:this.showRelatedRecords,orderByFields:this.orderByFields?(0,a.o8)(this.orderByFields):null})}};(0,s.Cg)([(0,c.MZ)({type:Boolean,json:{write:!0}})],$t.prototype,"showRelatedRecords",void 0),(0,s.Cg)([(0,c.MZ)({type:[at.A],json:{write:!0}})],$t.prototype,"orderByFields",void 0),$t=Tt=(0,s.Cg)([(0,c.$K)("esri.popup.RelatedRecordsInfo")],$t);const Kt=$t;var Et,Bt=o(4902);let kt=Et=class extends((0,Bt.s)(N.A)){constructor(t){super(t),this.active=!1,this.className=null,this.disabled=!1,this.icon=null,this.id=null,this.indicator=!1,this.title=null,this.type=null,this.visible=!0}clone(){return new Et({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible})}};(0,s.Cg)([(0,c.MZ)()],kt.prototype,"active",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"className",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"disabled",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"icon",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"id",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"indicator",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"title",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"type",void 0),(0,s.Cg)([(0,c.MZ)()],kt.prototype,"visible",void 0),kt=Et=(0,s.Cg)([(0,c.$K)("esri.support.actions.ActionBase")],kt);const Jt=kt;var qt;let Dt=qt=class extends Jt{constructor(t){super(t),this.image=null,this.type="button"}clone(){return new qt({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image})}};(0,s.Cg)([(0,c.MZ)()],Dt.prototype,"image",void 0),Dt=qt=(0,s.Cg)([(0,c.$K)("esri.support.actions.ActionButton")],Dt);const Ut=Dt;var Lt;let Wt=Lt=class extends Jt{constructor(t){super(t),this.image=null,this.type="toggle",this.value=!1}clone(){return new Lt({active:this.active,className:this.className,disabled:this.disabled,icon:this.icon,id:this.id,indicator:this.indicator,title:this.title,visible:this.visible,image:this.image,value:this.value})}};(0,s.Cg)([(0,c.MZ)()],Wt.prototype,"image",void 0),(0,s.Cg)([(0,c.MZ)()],Wt.prototype,"value",void 0),Wt=Lt=(0,s.Cg)([(0,c.$K)("esri.support.actions.ActionToggle")],Wt);const zt=Wt,Pt="relationships/",Gt="expression/",Vt=n.A.ofType({key:"type",defaultKeyValue:"button",base:Jt,typeMap:{button:Ut,toggle:zt}}),Ht={base:wt,key:"type",typeMap:{media:Ft,custom:Ct,text:It,attachments:vt,fields:xt,expression:Mt,relationship:Zt,utilityNetworkAssociations:jt}},Xt=new Set(["attachments","fields","media","text","expression","relationship"]),Qt=new Set([...Xt,"utility-network-associations"]);let Yt=class extends((0,r.OU)(l.o)){constructor(t){super(t),this.actions=null,this.content="",this.expressionInfos=null,this.fieldInfos=null,this.layerOptions=null,this.lastEditInfoEnabled=!0,this.outFields=null,this.overwriteActions=!1,this.returnGeometry=!1,this.title=""}castContent(t){return Array.isArray(t)?t.map(t=>(0,u.aq)(Ht,t)):"string"==typeof t||"function"==typeof t||t instanceof HTMLElement||(0,d.$X)(t)?t:(p.A.getLogger(this).error("content error","unsupported content value",{value:t}),null)}readContent(t,e){const{popupElements:o}=e;return Array.isArray(o)&&o.length>0?this._readPopupInfoElements(e.description,e.mediaInfos,o):this._readPopupInfo(e)}writeWebSceneContent(t,e,o,i){this._writePopupTemplateContent(t,e,i)}writeWebMapContent(t,e,o,i){this._writePopupTemplateContent(t,e,i)}writeFieldInfos(t,e,o,i){const{content:s}=this,r=Array.isArray(s)?s:null,{writeFieldFormat:n,...l}=i||{};if(t){const o=r?r.filter(t=>"fields"===t.type):[],i=o.length&&o.every(t=>t.fieldInfos?.length);e.fieldInfos=t.filter(Boolean).map(t=>{const e=t.toJSON(l);return i&&(e.visible=!1),e})}if(r)for(const t of r)"fields"===t.type&&this._writeFieldsContent(t,e,l)}writeLayerOptions(t,e,o,i){e[o]=!t||null===t.showNoDataRecords&&null===t.returnTopmostRaster?null:t.toJSON(i)}writeTitle(t,e){e.title=t||""}async collectRequiredFields(t,e,o){const i=this.expressionInfos||[];await this._collectExpressionInfoFields(t,e,o,[...i,...this._getContentExpressionInfos(this.content,i)]),(0,y._w)(t,e,[...this.outFields||[],...this._getActionsFields(this.actions),...this._getTitleFields(this.title),...this._getContentFields(this.content)])}async getRequiredFields(t,e){const o=new Set;return await this.collectRequiredFields(o,t,e),[...o].sort()}_writePopupTemplateContent(t,e,o){"string"!=typeof t?Array.isArray(t)&&(e.popupElements=t.filter(t=>"web-scene"===o?.origin?Xt.has(t.type):Qt.has(t.type)).map(t=>t?.toJSON(o)),e.popupElements.forEach(t=>{"attachments"===t.type?this._writeAttachmentContent(e):"media"===t.type?this._writeMediaContent(t,e):"text"===t.type?this._writeTextContent(t,e):"relationship"===t.type&&this._writeRelationshipContent(t,e)})):e.description=t}_writeFieldsContent(t,e,o){const i=t.fieldInfos;if(!Array.isArray(i)||!i.length)return;const s=e.fieldInfos;if(Array.isArray(s))for(const t of i){const e=s.find(e=>e.fieldName?.toLowerCase()===t.fieldName?.toLowerCase());e?e.visible=!0:s.push(t.toJSON(o))}else e.fieldInfos=i.map(t=>t.toJSON(o))}_writeAttachmentContent(t){t.showAttachments||(t.showAttachments=!0)}_writeRelationshipContent(t,e){const o=t.orderByFields?.map(e=>this._toFieldOrderJSON(e,t.relationshipId))||[],i=[...e.relatedRecordsInfo?.orderByFields||[],...o];e.relatedRecordsInfo={showRelatedRecords:!0,...i?.length&&{orderByFields:i}}}_writeTextContent(t,e){!e.description&&t.text&&(e.description=t.text)}_writeMediaContent(t,e){if(!Array.isArray(t.mediaInfos)||!t.mediaInfos.length)return;const o=(0,a.o8)(t.mediaInfos);Array.isArray(e.mediaInfos)?e.mediaInfos=[...e.mediaInfos,...o]:e.mediaInfos=o}_readPopupInfoElements(t,e,o){const i={description:!1,mediaInfos:!1};return o.map(o=>"media"===o.type?(o.mediaInfos||!e||i.mediaInfos||(o.mediaInfos=e,i.mediaInfos=!0),Ft.fromJSON(o)):"text"===o.type?(o.text||!t||i.description||(o.text=t,i.description=!0),It.fromJSON(o)):"attachments"===o.type?vt.fromJSON(o):"fields"===o.type?xt.fromJSON(o):"expression"===o.type?Mt.fromJSON(o):"relationship"===o.type?Zt.fromJSON(o):"utilityNetworkAssociations"===o.type?jt.fromJSON(o):void 0).filter(Boolean)}_toRelationshipContent(t){const{field:e,order:o}=t;if(!e?.startsWith(Pt))return null;const i=e.replace(Pt,"").split("/");if(2!==i.length)return null;const s=parseInt(i[0],10),r=i[1];return!Number.isNaN(s)&&r?Zt.fromJSON({relationshipId:s,orderByFields:[{field:r,order:o}]}):null}_toFieldOrderJSON(t,e){const{order:o,field:i}=t;return{field:`${Pt}${e}/${i}`,order:o}}_readPopupInfo({description:t,mediaInfos:e,showAttachments:o,relatedRecordsInfo:i={showRelatedRecords:!1}}){const s=[];t?s.push(new It({text:t})):s.push(new xt),Array.isArray(e)&&e.length&&s.push(Ft.fromJSON({mediaInfos:e})),o&&s.push(vt.fromJSON({displayType:"auto"}));const{showRelatedRecords:r,orderByFields:n}=i;return r&&n?.length&&n.forEach(t=>{const e=this._toRelationshipContent(t);e&&s.push(e)}),s.length?s:t}_getContentElementFields(t){const e=t?.type;if("attachments"===e)return[...this._extractFieldNames(t.title),...this._extractFieldNames(t.description)];if("custom"===e)return t.outFields||[];if("fields"===e)return[...this._extractFieldNames(t.title),...this._extractFieldNames(t.description),...this._getFieldInfoFields(t.fieldInfos??this.fieldInfos)];if("media"===e){const e=t.mediaInfos||[];return[...this._extractFieldNames(t.title),...this._extractFieldNames(t.description),...e.reduce((t,e)=>[...t,...this._getMediaInfoFields(e)],[])]}return"text"===e?this._extractFieldNames(t.text):"relationship"===e||"utility-network-associations"===e?[...this._extractFieldNames(t.title),...this._extractFieldNames(t.description)]:[]}_getMediaInfoFields(t){const{caption:e,title:o,value:i}=t,s=i||{},{fields:r,normalizeField:n,tooltipField:l,sourceURL:a,linkURL:p}=s,d=[...this._extractFieldNames(o),...this._extractFieldNames(e),...this._extractFieldNames(a),...this._extractFieldNames(p),...r??[]];return n&&d.push(n),l&&d.push(l),d}_getContentExpressionInfos(t,e){return Array.isArray(t)?t.reduce((t,e)=>[...t,..."expression"===e.type&&e.expressionInfo?[e.expressionInfo]:[]],e):[]}_getContentFields(t){return"string"==typeof t?this._extractFieldNames(t):Array.isArray(t)?t.reduce((t,e)=>[...t,...this._getContentElementFields(e)],[]):[]}async _collectExpressionInfoFields(t,e,o,i){i&&await Promise.all(i.map(i=>(0,y.Dx)(t,e,o,i.expression)))}_getFieldInfoFields(t){return t?t.filter(({fieldName:t,visible:e})=>!(void 0!==e&&!e||!t||t.startsWith(Pt)||t.startsWith(Gt))).map(t=>t.fieldName):[]}_getActionsFields(t){return t?t.toArray().reduce((t,e)=>[...t,...this._getActionFields(e)],[]):[]}_getActionFields(t){const{className:e,title:o,type:i}=t,s="button"===i||"toggle"===i?t.image:"";return[...this._extractFieldNames(o),...this._extractFieldNames(e),...this._extractFieldNames(s)]}_getTitleFields(t){return"string"==typeof t?this._extractFieldNames(t):[]}_extractFieldNames(t){return(0,y.nw)(t).filter(t=>!(t.startsWith(Pt)||t.startsWith(Gt)))}};(0,s.Cg)([(0,c.MZ)({type:Vt})],Yt.prototype,"actions",void 0),(0,s.Cg)([(0,c.MZ)()],Yt.prototype,"content",void 0),(0,s.Cg)([(0,c.wg)("content")],Yt.prototype,"castContent",null),(0,s.Cg)([(0,st.w)("content",["description","fieldInfos","popupElements","mediaInfos","showAttachments","relatedRecordsInfo"])],Yt.prototype,"readContent",null),(0,s.Cg)([(0,rt.K)("web-scene","content",{popupElements:{type:n.A.ofType(At)},showAttachments:{type:Boolean},mediaInfos:{type:n.A.ofType(ot)},description:{type:String},relatedRecordsInfo:{type:Kt}})],Yt.prototype,"writeWebSceneContent",null),(0,s.Cg)([(0,rt.K)("content",{popupElements:{type:n.A.ofType(bt)},showAttachments:{type:Boolean},mediaInfos:{type:n.A.ofType(ot)},description:{type:String},relatedRecordsInfo:{type:Kt}})],Yt.prototype,"writeWebMapContent",null),(0,s.Cg)([(0,c.MZ)({type:[St.A],json:{write:!0}})],Yt.prototype,"expressionInfos",void 0),(0,s.Cg)([(0,c.MZ)({type:[Rt.A]})],Yt.prototype,"fieldInfos",void 0),(0,s.Cg)([(0,rt.K)("fieldInfos")],Yt.prototype,"writeFieldInfos",null),(0,s.Cg)([(0,c.MZ)({type:Ot})],Yt.prototype,"layerOptions",void 0),(0,s.Cg)([(0,rt.K)("layerOptions")],Yt.prototype,"writeLayerOptions",null),(0,s.Cg)([(0,c.MZ)({type:Boolean,json:{read:{source:"showLastEditInfo"},write:{target:"showLastEditInfo"},default:!0}})],Yt.prototype,"lastEditInfoEnabled",void 0),(0,s.Cg)([(0,c.MZ)()],Yt.prototype,"outFields",void 0),(0,s.Cg)([(0,c.MZ)()],Yt.prototype,"overwriteActions",void 0),(0,s.Cg)([(0,c.MZ)()],Yt.prototype,"returnGeometry",void 0),(0,s.Cg)([(0,c.MZ)({json:{type:String}})],Yt.prototype,"title",void 0),(0,s.Cg)([(0,rt.K)("title")],Yt.prototype,"writeTitle",null),Yt=(0,s.Cg)([(0,c.$K)("esri.PopupTemplate")],Yt);const te=Yt},39663:(t,e,o)=>{o.d(e,{$P:()=>J,iu:()=>x,HK:()=>F,PK:()=>O,fg:()=>M,qH:()=>Z});var i=o(31635),s=o(10107),r=o(64108),n=o(69540),l=o(25482);let a=class extends((0,n.OU)(l.o)){constructor(t){super(t),this.type=null}};(0,i.Cg)([(0,s.MZ)({type:["date-time","number"],nonNullable:!0,readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],a.prototype,"type",void 0),a=(0,i.Cg)([(0,r.$)("esri.layers.support.FieldFormat")],a);const p=a,d="auto";let c=class extends p{constructor(t){super(t),this.dateStyle=null,this.hour12=d,this.month=null,this.timeStyle=null,this.type="date-time",this.year=null}};(0,i.Cg)([(0,s.MZ)({type:["full","long","medium","short"],json:{write:!0}})],c.prototype,"dateStyle",void 0),(0,i.Cg)([(0,s.MZ)({type:["always","auto","never"],nonNullable:!0,json:{default:d,write:!0}})],c.prototype,"hour12",void 0),(0,i.Cg)([(0,s.MZ)({type:["long","short"],json:{write:!0}})],c.prototype,"month",void 0),(0,i.Cg)([(0,s.MZ)({type:["full","long","medium","short"],json:{write:!0}})],c.prototype,"timeStyle",void 0),(0,i.Cg)([(0,s.MZ)({type:["date-time"]})],c.prototype,"type",void 0),(0,i.Cg)([(0,s.MZ)({type:["numeric"],json:{write:!0}})],c.prototype,"year",void 0),c=(0,i.Cg)([(0,r.$)("esri.layers.support.DateTimeFieldFormat")],c);const u=c;var y=o(30524),h=o(56507);const m={min:0,max:20},g="decimal",f="auto";let v=class extends p{constructor(t){super(t),this.maximumFractionDigits=2,this.minimumFractionDigits=0,this.style=g,this.type="number",this.useGrouping=f}};(0,i.Cg)([(0,s.MZ)({type:h.jz,nonNullable:!0,range:m,json:{default:2,write:!0}})],v.prototype,"maximumFractionDigits",void 0),(0,i.Cg)([(0,s.MZ)({type:h.jz,nonNullable:!0,range:m,json:{default:0,write:!0}})],v.prototype,"minimumFractionDigits",void 0),(0,i.Cg)([(0,s.MZ)({type:["decimal"],nonNullable:!0,json:{default:g,write:!0}})],v.prototype,"style",void 0),(0,i.Cg)([(0,s.MZ)({type:["number"]})],v.prototype,"type",void 0),(0,i.Cg)([(0,s.MZ)({type:["always","auto","never"],nonNullable:!0,json:{default:f,write:!0}})],v.prototype,"useGrouping",void 0),v=(0,i.Cg)([(0,r.$)("esri.layers.support.NumberFieldFormat")],v);const w=v;var C=o(68780);const M={base:p,key:"type",errorContext:"field-configuration-field-format",typeMap:{"date-time":u,number:w}};function x(t,e){const{format:o}=t;return e&&Z(e)?o?F(o,e):J(e,{hour12:"always",useGrouping:"always"}):null}function F(t,e){const{dateFormat:o}=t;if(!e)return o?b(t):j(t);if(!Z(e))return;const i={hour12:"always"};switch(e.type){case"integer":case"small-integer":case"big-integer":case"long":return I(t);case"single":case"double":return j(t);case"date":case"timestamp-offset":return o?b(t):J(e,i);case"date-only":return o?function(t){return new u({dateStyle:A(t),year:_(t),month:S(t)})}(t):J(e);case"time-only":return o?function(t){return new u({timeStyle:R(t),hour12:N(t)})}(t):J(e,i)}}function Z(t){return(0,y.WA)(t)||(0,y.vE)(t)||(0,y.zD)(t)||(0,y.OH)(t)||(0,y.Ah)(t)}function I(t){return new w({useGrouping:t.digitSeparator?"always":"never"})}function j(t){const e=I(t),{places:o}=t;return e.minimumFractionDigits=o??0,e.maximumFractionDigits=o??2,e}function b(t){return new u({dateStyle:A(t),year:_(t),month:S(t),timeStyle:R(t),hour12:N(t)})}function A(t){const{dateFormat:e}=t;return e?e.startsWith("short-date")?"short":e.startsWith("day-short-month-year")?"medium":e.startsWith("long-month-day-year")?"long":e.startsWith("long-date")?"full":null:null}function N(t){return t.dateFormat?.endsWith("-24")?"never":"always"}function S(t){switch(t.dateFormat){case"short-month-year":return"short";case"long-month-year":return"long";default:return null}}function R(t){const{dateFormat:e}=t;return e?e.includes("short-time")?"short":e.includes("long-time")?"medium":null:null}function _(t){switch(t.dateFormat){case"short-month-year":case"long-month-year":case"year":return"numeric";default:return null}}function O(t,e){const o="number"===t.type,i="date-time"===t.type;if(!e)return o?$(t):i?K(t):null;if(Z(e))switch(e.type){case"integer":case"small-integer":case"big-integer":case"long":return o?T(t):null;case"single":case"double":return o?$(t):null;case"date":case"timestamp-offset":return i?K(t):null;case"date-only":return i?function(t){let e;const o=E(t),i="numeric"===t.year?"year":null,s=k(t);return o?e=o:i&&s?e=`${s}-${i}`:i&&(e=i),e?new C.A({dateFormat:e}):null}(t):null;case"time-only":return i?function(t){let e;const o=B(t),i="never"===t.hour12?"24":null;return o&&i?e=`short-date-${o}-${i}`:o&&(e=`short-date-${o}`),e?new C.A({dateFormat:e}):null}(t):null}}function T(t){return new C.A({digitSeparator:"never"!==t.useGrouping})}function $(t){const e=T(t);return e.places=t.maximumFractionDigits,e}function K(t){let e;const o=E(t),i=B(t),s="never"===t.hour12?"24":null,r="numeric"===t.year?"year":null,n=k(t);return o&&i&&s?e=`${o}-${i}-${s}`:o&&i?e=`${o}-${i}`:o?e=o:r&&n?e=`${n}-${r}`:r&&(e=r),e?new C.A({dateFormat:e}):null}function E(t){switch(t.dateStyle){case"short":return"short-date";case"medium":return"day-short-month-year";case"long":return"long-month-day-year";case"full":return"long-date";default:return}}function B(t){return t.timeStyle&&("short"===t.timeStyle?"short-time":"long-time")}function k(t){switch(t.month){case"short":return"short-month";case"long":return"long-month";default:return}}function J(t,e){if(!Z(t))return;const o=e?.useGrouping??"auto",i=e?.hour12??"auto";switch(t.type){case"integer":case"small-integer":case"big-integer":case"long":return new w({minimumFractionDigits:0,maximumFractionDigits:0,useGrouping:o});case"single":case"double":return new w({minimumFractionDigits:0,maximumFractionDigits:2,useGrouping:o});case"date":case"timestamp-offset":return new u({dateStyle:"short",timeStyle:"short",hour12:i});case"date-only":return new u({dateStyle:"short"});case"time-only":return new u({timeStyle:"short",hour12:i})}}},41227:(t,e,o)=>{o.d(e,{A:()=>y});var i=o(31635),s=o(69540),r=o(66552),n=o(25482),l=o(91429),a=o(39663),p=o(68780),d=o(36005),c=o(93223);let u=class extends((0,s.OU)(n.o)){constructor(t){super(t),this.fieldName=null,this.isEditable=!0,this.label=null,this.statisticType=null,this.stringFieldOption="text-box",this.tooltip=null,this.visible=!0}set fieldFormat(t){this._set("fieldFormat",t),this._set("format",t?(0,a.PK)(t):null)}set format(t){this._set("format",t),this._set("fieldFormat",t?(0,a.HK)(t):null)}readFormat(t,e){if(!e.fieldFormat)return t?p.A.fromJSON(t):null}clone(){const t=super.clone();return t._set("format",this.format?.clone()),t._set("fieldFormat",this.fieldFormat?.clone()),t}};(0,i.Cg)([(0,l.MZ)({value:null,clonable:!1,types:a.fg,json:{write:{overridePolicy(t,e,o){const{fieldName:i}=this;return{enabled:!(!i||i.startsWith("expression/")||i.startsWith("relationships/")||!o?.writeFieldFormat)}}}}})],u.prototype,"fieldFormat",null),(0,i.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],u.prototype,"fieldName",void 0),(0,i.Cg)([(0,l.MZ)({value:null,clonable:!1,type:p.A,json:{write:!0}})],u.prototype,"format",null),(0,i.Cg)([(0,d.w)("format")],u.prototype,"readFormat",null),(0,i.Cg)([(0,l.MZ)({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],u.prototype,"isEditable",void 0),(0,i.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],u.prototype,"label",void 0),(0,i.Cg)([(0,l.MZ)({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],u.prototype,"statisticType",void 0),(0,i.Cg)([(0,c.e)(new r.J({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],u.prototype,"stringFieldOption",void 0),(0,i.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],u.prototype,"tooltip",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,json:{write:!0}})],u.prototype,"visible",void 0),u=(0,i.Cg)([(0,l.$K)("esri.popup.FieldInfo")],u);const y=u},49852:(t,e,o)=>{o.d(e,{A:()=>a});var i,s=o(31635),r=o(25482),n=o(91429);let l=i=class extends r.o{constructor(t){super(t),this.field=null,this.order=null}clone(){return new i({field:this.field,order:this.order})}};(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],l.prototype,"field",void 0),(0,s.Cg)([(0,n.MZ)({type:["asc","desc"],json:{write:!0}})],l.prototype,"order",void 0),l=i=(0,s.Cg)([(0,n.$K)("esri.popup.support.RelatedRecordsInfoFieldOrder")],l);const a=l},60950:(t,e,o)=>{o.d(e,{E_:()=>s,ym:()=>i});const i=Symbol("popupProvider");function s(t){return function(t){return!!t&&i in t}(t)?t[i]:null}},66159:(t,e,o)=>{o.d(e,{A:()=>d});var i,s=o(31635),r=o(4718),n=o(91429),l=o(41227),a=o(84424);let p=i=class extends a.A{constructor(t){super(t),this.attributes=null,this.description=null,this.fieldInfos=null,this.title=null,this.type="fields"}clone(){return new i((0,r.o8)({attributes:this.attributes,description:this.description,fieldInfos:this.fieldInfos,title:this.title}))}};(0,s.Cg)([(0,n.MZ)({type:Object,json:{write:!0}})],p.prototype,"attributes",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],p.prototype,"description",void 0),(0,s.Cg)([(0,n.MZ)({type:[l.A],json:{write:!0}})],p.prototype,"fieldInfos",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],p.prototype,"title",void 0),(0,s.Cg)([(0,n.MZ)({type:["fields"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],p.prototype,"type",void 0),p=i=(0,s.Cg)([(0,n.$K)("esri.popup.content.FieldsContent")],p);const d=p},68780:(t,e,o)=>{o.d(e,{A:()=>c});var i=o(31635),s=o(69540),r=o(25482),n=o(91429),l=o(56507),a=o(97770),p=o(93223);let d=class extends((0,s.OU)(r.o)){constructor(t){super(t),this.dateFormat=null,this.digitSeparator=!1,this.places=null}};(0,i.Cg)([(0,p.e)(a._v)],d.prototype,"dateFormat",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,json:{write:!0}})],d.prototype,"digitSeparator",void 0),(0,i.Cg)([(0,n.MZ)({type:l.jz,json:{write:!0}})],d.prototype,"places",void 0),d=(0,i.Cg)([(0,n.$K)("esri.popup.support.FieldInfoFormat")],d);const c=d},78553:(t,e,o)=>{o.d(e,{D:()=>r,p:()=>s});var i=o(56507);function s(t){const e=(0,i.Vr)(100*(1-t));return Math.max(0,Math.min(e,100))}function r(t){const e=1-t/100;return Math.max(0,Math.min(e,1))}},83342:(t,e,o)=>{o.d(e,{A:()=>p});var i=o(31635),s=o(69540),r=o(25482),n=o(91429),l=o(56507);let a=class extends((0,s.OU)(r.o)){constructor(t){super(t),this.title=null,this.description=null,this.type=null,this.associatedNetworkSourceId=null,this.associatedAssetGroup=null,this.associatedAssetType=null}};(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],a.prototype,"title",void 0),(0,i.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],a.prototype,"description",void 0),(0,i.Cg)([(0,n.MZ)({type:["attachment","connectivity","container","content","structure"],json:{write:!0}})],a.prototype,"type",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{type:l.jz,write:!0}})],a.prototype,"associatedNetworkSourceId",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{type:l.jz,write:!0}})],a.prototype,"associatedAssetGroup",void 0),(0,i.Cg)([(0,n.MZ)({type:Number,json:{type:l.jz,write:!0}})],a.prototype,"associatedAssetType",void 0),a=(0,i.Cg)([(0,n.$K)("esri.popup.support.UtilityNetworkAssociationType")],a);const p=a},84424:(t,e,o)=>{o.d(e,{A:()=>l});var i=o(31635),s=o(25482),r=o(91429);let n=class extends s.o{constructor(t){super(t),this.type=null}};(0,i.Cg)([(0,r.MZ)({type:["attachments","custom","fields","media","text","expression","relationship","utility-network-associations"],readOnly:!0,json:{read:!1,write:!0}})],n.prototype,"type",void 0),n=(0,i.Cg)([(0,r.$K)("esri.popup.content.Content")],n);const l=n},89893:(t,e,o)=>{o.d(e,{A:()=>y});var i=o(31635),s=o(69540),r=o(91429),n=o(84424),l=o(66552),a=o(25482);const p=new l.J({asc:"ascending",desc:"descending"});let d=class extends((0,s.OU)(a.o)){constructor(t){super(t),this.field=null,this.order="ascending"}};(0,i.Cg)([(0,r.MZ)({type:String,json:{write:!0}})],d.prototype,"field",void 0),(0,i.Cg)([(0,r.MZ)({type:p.apiValues,json:{type:p.jsonValues,read:p.read,write:p.write}})],d.prototype,"order",void 0),d=(0,i.Cg)([(0,r.$K)("esri.popup.support.AttachmentsOrderByInfo")],d);const c=d;let u=class extends((0,s.OU)(n.A)){constructor(t){super(t),this.attachmentKeywords=null,this.attachmentTypes=null,this.description=null,this.displayType="auto",this.orderByFields=null,this.title=null,this.type="attachments"}};(0,i.Cg)([(0,r.MZ)({type:[String],json:{write:!0}})],u.prototype,"attachmentKeywords",void 0),(0,i.Cg)([(0,r.MZ)({type:[["application","audio","image","model","text","video"]],json:{write:!0}})],u.prototype,"attachmentTypes",void 0),(0,i.Cg)([(0,r.MZ)({type:String,json:{write:!0}})],u.prototype,"description",void 0),(0,i.Cg)([(0,r.MZ)({type:["auto","preview","list"],json:{write:!0}})],u.prototype,"displayType",void 0),(0,i.Cg)([(0,r.MZ)({type:[c],json:{write:!0}})],u.prototype,"orderByFields",void 0),(0,i.Cg)([(0,r.MZ)({type:String,json:{write:!0}})],u.prototype,"title",void 0),(0,i.Cg)([(0,r.MZ)({type:["attachments"],readOnly:!0,json:{read:!1,write:{isRequired:!0}}})],u.prototype,"type",void 0),u=(0,i.Cg)([(0,r.$K)("esri.popup.content.AttachmentsContent")],u);const y=u},93705:(t,e,o)=>{o.d(e,{A:()=>a});var i,s=o(31635),r=o(25482),n=o(91429);let l=i=class extends r.o{constructor(t){super(t),this.name=null,this.title=null,this.expression=null,this.returnType=null}clone(){return new i({name:this.name,title:this.title,expression:this.expression,returnType:this.returnType})}};(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],l.prototype,"name",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],l.prototype,"title",void 0),(0,s.Cg)([(0,n.MZ)({type:String,json:{write:!0}})],l.prototype,"expression",void 0),(0,s.Cg)([(0,n.MZ)({type:["string","number"],json:{write:!0}})],l.prototype,"returnType",void 0),l=i=(0,s.Cg)([(0,n.$K)("esri.popup.ExpressionInfo")],l);const a=l}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5482],{5479:(e,t,r)=>{function s(e){const t=[];return function*(){yield*t;let r,s=t.length;for(;!(r=e.next()).done;)for(t.push(r.value),yield r.value;++s<t.length;)yield t[s]}}r.d(t,{I6:()=>o,N5:()=>n,PP:()=>s,xZ:()=>a});const i=Object.freeze({done:!0,value:void 0});function n(e){const t=[];let r=null,s=null,n=!1;async function o(){if(n)return i;if(null!=s)return s;s=e.next();try{const e=await s;return s=null,e.done?(n=!0,i):(t.push(e.value),e)}catch(e){throw n=!0,s=null,r=e,e}}return async function*(){yield*t;let e,s=t.length;for(;!(e=await o()).done;)for(yield e.value;++s<t.length;)yield t[s];if(null!=r)throw r}}function o(e,t){for(const r of e)if(null!=r&&t(r))return r}function a(e){return null!=e&&"function"==typeof e[Symbol.iterator]}},11406:(e,t,r)=>{r.d(t,{T:()=>o});var s=r(36563),i=r(4576);class n{constructor(e,t){this._observers=e,this._observer=t}remove(){(0,i.TF)(this._observers,this._observer)}}class o{constructor(){this._observers=null,this.destroyed=!1}observe(e){if(this.destroyed||e.destroyed)return a;null==this._observers&&(this._observers=[]);const t=this._observers;let r=!1,s=!1;const i=t.length;for(let n=0;n<i;++n){const i=t[n];if(i.destroyed)s=!0;else if(i===e){r=!0;break}}return r||(t.push(e),s&&this._removeDestroyedObservers()),new n(t,e)}_removeDestroyedObservers(){const e=this._observers;if(!e||0===e.length)return;const t=e.length;let r=0;for(let s=0;s<t;++s){for(;s+r<t&&e[s+r].destroyed;)++r;if(r>0){if(!(s+r<t))break;e[s]=e[s+r]}}e.length=t-r}destroy(){if(this.destroyed)return;this.destroyed=!0;const e=this._observers;if(null!=e){for(const t of e)t.onCommitted();this._observers=null}}}const a=(0,s.hA)()},14012:(e,t,r)=>{r.d(t,{iS:()=>w,wB:()=>N,Cn:()=>S});var s=r(98291),i=r(36563),n=r(4718),o=r(93687);class a extends o.A{constructor(){super(...arguments),this._set=new Set}destroy(){super.destroy(),this._set=null}acquire(...e){const t=super.acquire(...e);return this._set.delete(t),t}release(e){e&&!this._set.has(e)&&(super.release(e),this._set.add(e))}_dispose(e){this._set.delete(e),super._dispose(e)}}var c=r(76030),l=r(24326),u=r(16649),h=r(85537),d=r(80559),f=r(88620);class p{constructor(){this.uid=(0,l.c)(),this.removed=!1,this.type=null,this.oldValue=null,this.callback=null,this.getValue=null,this.target=null,this.path=null,this.equals=null}static{this.pool=new a(()=>new p)}static acquireUntracked(e,t,r,s,i){return this.pool.acquire(0,e,t,r,s,i,n.aI)}static acquireTracked(e,t,r,s){return this.pool.acquire(1,e,t,r,null,null,s)}notify(e,t){0===this.type?this.callback.call(this.target,e,t,this.path,this.target):this.callback.call(null,e,t,void 0,void 0)}acquire(e,t,r,s,i,n,o){this.uid=(0,l.c)(),this.removed=!1,this.type=e,this.oldValue=t,this.callback=r,this.getValue=s,this.target=i,this.path=n,this.equals=o}release(){this.target=this.path=this.oldValue=this.callback=this.getValue=null,this.uid=(0,l.c)(),this.removed=!0}}const g=new s.A,_=new Set;let m;function v(e){_.delete(e),_.add(e),m||(m=(0,c._)(O))}function y(e){if(e.removed)return;const t=e.oldValue,r=e.getValue();e.equals(t,r)||(e.oldValue=r,e.notify(r,t))}function w(e){for(const t of _.values())t.target===e&&(t.removed=!0)}function O(){let e=10;for(;m&&e--;){m=null;const e=A(),t=g.acquire();for(const r of e){const e=r.uid;y(r),e===r.uid&&r.removed&&t.push(r)}for(const e of _)e.removed&&(t.push(e),_.delete(e));for(const e of t)p.pool.release(e);g.release(t),g.release(e),b.forEach(e=>e())}}function A(){const e=g.acquire();e.length=_.size;let t=0;for(const r of _)e[t]=r,++t;return _.clear(),e}const b=new Set;function N(e,t,r,s=!1){return e.__accessor__&&e.__accessor__.lifecycle!==h.v.DESTROYED?s?function(e,t,r){const s=(0,f.qg)(e,t,r,(e,t,r)=>{let i=!1;return(0,d.mJ)(()=>(0,u.RP)(e,t),(o,a)=>{e.__accessor__.lifecycle!==h.v.DESTROYED?i||(i=!0,(0,n.aI)(a,o)||r.call(e,o,a,t,e),i=!1):s.remove()})});return s}(e,t,r):function(e,t,r){let s=(0,f.qg)(e,t,r,(e,t,r)=>{let n,o,a=(0,d.Df)(()=>(0,u.RP)(e,t),(i,a)=>{e.__accessor__?.lifecycle===h.v.DESTROYED||n&&n.uid!==o?s.remove():(n||(n=p.acquireUntracked(i,r,a,e,t),o=n.uid),v(n))});return(0,i.hA)(()=>{a.remove(),n&&(n.uid!==o||n.removed||(n.removed=!0,v(n)),n=null),s=a=null})});return s}(e,t,r):(0,i.hA)()}function S(e,t,r=!1,s=n.gh){return r?function(e,t,r){let s=!1;return(0,d.mJ)(e,(e,i)=>{s||(s=!0,r(i,e)||t(e,i),s=!1)})}(e,t,s):function(e,t,r){let s,n,o=(0,d.Df)(e,(e,i)=>{s&&s.uid!==n?o.remove():(s||(s=p.acquireTracked(e,t,i,r),n=s.uid),v(s))});return(0,i.hA)(()=>{o.remove(),s&&(s.uid!==n||s.removed||(s.removed=!0,v(s)),s=null),o=null})}(e,t,s)}},25482:(e,t,r)=>{r.d(t,{o:()=>g,T:()=>f});var s=r(31635),i=r(69622),n=r(4718);class o{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const t=new o;return this._values.forEach((r,s)=>{e&&e.has(s)||t.set(s,(0,n.o8)(r.value),r.origin)}),t}get(e,t){t=this._normalizeOrigin(t);const r=this._values.get(e);return null==t||r?.origin===t?r?.value:void 0}originOf(e){return this._values.get(e)?.origin??7}keys(e){e=this._normalizeOrigin(e);const t=[...this._values.keys()];return null==e?t:t.filter(t=>this._values.get(t)?.origin===e)}set(e,t,r){if(0===(r=this._normalizeOrigin(r))){const t=this._values.get(e);if(null!=t?.origin&&t.origin>r)return}this._values.set(e,new a(t,r))}delete(e,t){null!=(t=this._normalizeOrigin(t))&&this._values.get(e)?.origin!==t||this._values.delete(e)}has(e,t){return null!=(t=this._normalizeOrigin(t))?this._values.get(e)?.origin===t:this._values.has(e)}isAtOrigin(e,t){return t=this._normalizeOrigin(t),this.has(e,t)&&this.originOf(e)===t}isBelowOrigin(e,t){return t=this._normalizeOrigin(t),!this.has(e)||this.originOf(e)<t}forEach(e){this._values.forEach(({value:t},r)=>e(t,r))}_normalizeOrigin(e){if(null!=e)return 0===e?e:7}}class a{constructor(e,t){this.value=e,this.origin=t}}var c=r(76953),l=r(45917),u=r(88620),h=r(49422),d=r(64108);const f=e=>{const t=e;let r=class extends t{constructor(...e){super(...e);const t=(0,u.oY)(this),r=t.store,s=new o;t.store=s,(0,c.k)(t,r,s)}read(e,t){(0,l.L)(this,e,t)}write(e,t){return(0,h.M)(this,e??{},t)}toJSON(e){return this.write({},e)}static fromJSON(e,t){return p.call(this,e,t)}};return r=(0,s.Cg)([(0,d.$)("esri.core.JSONSupport")],r),r.prototype.toJSON.isDefaultToJSON=!0,r};function p(e,t){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");const r=new this;return r.read(e,t),r}const g=f(i.A)},35666:(e,t,r)=>{r.d(t,{AU:()=>s,OL:()=>n,aB:()=>i,in:()=>o});const s=8;function i(e){switch(e){case"defaults":return 0;case"service":return 2;case"portal-item":return 3;case"web-scene":return 4;case"web-map":return 5;case"link-chart":return 6;case"user":return 7;default:return null}}function n(e){switch(e){case 0:return"defaults";case 2:return"service";case 3:return"portal-item";case 4:return"web-scene";case 5:return"web-map";case 6:return"link-chart";case 7:return"user"}}function o(e){return n(e)}},45917:(e,t,r)=>{r.d(t,{L:()=>u,t:()=>h});var s=r(16649),i=r(88620),n=r(7142);function o(e,t,r){if(!e?.read||!1===e.read.enabled||!e.read.source)return!1;const i=e.read.source;if("string"==typeof i){if(i===t)return!0;if(i.includes(".")&&i.startsWith(t)&&(0,s.t2)(i,r))return!0}else for(const e of i){if(e===t)return!0;if(e.includes(".")&&e.startsWith(t)&&(0,s.t2)(e,r))return!0}return!1}function a(e,t,r,s,i){let a=(0,n.N5)(t[r],i);(function(e){return e&&(!e.read||!1!==e.read.enabled&&!e.read.source)})(a)&&(e[r]=!0);for(const c of Object.getOwnPropertyNames(t))a=(0,n.N5)(t[c],i),o(a,r,s)&&(e[c]=!0)}function c(e,t,r,s){const i=r.metadata,o=(0,n.xF)(i[t],s),a=o?.default;if(void 0===a)return;const c="function"==typeof a?a.call(e,t,s):a;void 0!==c&&r.set(t,c)}const l={origin:"service"};function u(e,t,r=l){if(!t||"object"!=typeof t)return;const o=(0,i.oY)(e),u=o.metadata,h={};for(const e of Object.getOwnPropertyNames(t))a(h,u,e,t,r);o.setDefaultOrigin(r.origin);for(const i of Object.getOwnPropertyNames(h)){const a=(0,n.N5)(u[i],r).read,c=a?.source;let l;l=c&&"string"==typeof c?(0,s.RP)(t,c):t[i],a?.reader&&(l=a.reader.call(e,l,t,r)),void 0!==l&&o.set(i,l)}if(!r||!r.ignoreDefaults){o.setDefaultOrigin("defaults");for(const t of Object.getOwnPropertyNames(u))h[t]||c(e,t,o,r)}o.setDefaultOrigin("user")}function h(e,t,r,s=l){const i={...s,messages:[]};r(i),i.messages?.forEach(t=>{"warning"!==t.type||e.loaded?s?.messages&&s.messages.push(t):e.loadWarnings.push(t)})}},49422:(e,t,r)=>{r.d(t,{M:()=>f,R:()=>d});var s=r(4576),i=r(49186),n=r(53966),o=r(16649),a=r(35666),c=r(88620),l=r(7142);function u(e,t,r,s,i){const n={};return t.write?.writer?.call(e,s,n,r,i),n}function h(e,t,r,c,l,u){if(!c?.write)return!1;const h=(0,o.Jt)(e,r);if(!l&&c.write.overridePolicy){const t=c.write.overridePolicy.call(e,h,r,u??void 0);void 0!==t&&(l=t)}if(l||(l=c.write),!l||!1===l.enabled)return!1;if(l.layerContainerTypes&&u?.layerContainerType&&!l.layerContainerTypes.includes(u.layerContainerType))return!1;if((null===h&&!l.allowNull&&!l.writerEnsuresNonNull||void 0===h)&&l.isRequired){const t=new i.A("web-document-write:property-required",`Missing value for required property '${r}' on '${e.declaredClass}'`,{propertyName:r,target:e});return t&&u?.messages?u.messages.push(t):t&&!u&&n.A.getLogger("esri.core.accessorSupport.write").error(t.name,t.message),!1}return!(void 0===h||null===h&&!l.allowNull&&!l.writerEnsuresNonNull||!(l.alwaysWriteDefaults||t.store.multipleOriginsSupported&&0!==t.store.originOf(r))&&function(e,t,r,i,n){const o=i.default;if(void 0===o)return!1;if(null!=i.defaultEquals)return i.defaultEquals(n);if("function"==typeof o){if(Array.isArray(n)){const i=o.call(e,t,r??void 0);return(0,s.aI)(i,n)}return!1}return o===n}(e,r,u,c,h)||!l.ignoreOrigin&&u?.origin&&t.store.multipleOriginsSupported&&t.store.originOf(r)<(0,a.aB)(u.origin))}function d(e,t,r,s){const i=(0,c.oY)(e),n=i.metadata,o=(0,l.k4)(n[t],s);return!!o&&h(e,i,t,o,r,s)}function f(e,t,r){if(e&&"function"==typeof e.toJSON&&(!e.toJSON.isDefaultToJSON||!e.write))return(0,c.h1)(t,e.toJSON(r));const s=(0,c.oY)(e),i=s.metadata;for(const n in i){const d=(0,l.k4)(i[n],r);if(!h(e,s,n,d,void 0,r))continue;const f=(0,o.Jt)(e,n),p=u(e,d,d.write&&"string"==typeof d.write.target?d.write.target:n,f,r);Object.keys(p).length>0&&(t=(0,c.h1)(t,p),r?.resources?.pendingOperations?.length&&r.resources.pendingOperations.push(Promise.all(r.resources.pendingOperations).then(()=>(0,c.h1)(t,p,()=>"replace-arrays"))),r?.writtenProperties&&r.writtenProperties.push({target:e,propName:n,oldOrigin:(0,a.in)(s.store.originOf(n)),newOrigin:r.origin}))}return t}},51447:(e,t,r)=>{r.d(t,{Lx:()=>c,eF:()=>l,eO:()=>a,io:()=>u,uW:()=>o});var s=r(44208);const i=new WeakMap;function n(e,t,r=!1){const s=`🛑 DEPRECATED - ${t}`;if(!r)return void e.warn(s);let n=i.get(e);n||(n=new Set,i.set(e,n)),n.has(t)||(n.add(t),e.warn(s))}function o(e,t,r={}){(0,s.A)("esri-deprecation-warnings")&&u(e,`Module: ${t}`,r)}function a(e,t,r={}){if((0,s.A)("esri-deprecation-warnings")){const{moduleName:s}=r;u(e,"Function: "+(s?s+"::":"")+t+"()",r)}}function c(e,t,r={}){if((0,s.A)("esri-deprecation-warnings")){const{moduleName:s}=r;u(e,"Property: "+(s?s+"::":"")+t,r)}}function l(e,t,r={}){(0,s.A)("esri-deprecation-warnings")&&u(e,`Multiple argument constructor: ${t}`,{warnOnce:!0,replacement:`new ${t}({ <your properties here> })`,...r})}function u(e,t,r={}){if((0,s.A)("esri-deprecation-warnings")){const{replacement:s,version:i,see:o,warnOnce:a}=r;let c=t;if(s&&(c+=`\n\t🛠️ Replacement: ${s}`),i&&(c+=`\n\t⚙️ Version: ${i}`),o)if(Array.isArray(o)){c+="\n\t🔗 See for more details:";for(const e of o)c+=`\n\t\t${e}`}else c+=`\n\t🔗 See ${o} for more details.`;n(e,c,a)}}},69622:(e,t,r)=>{r.d(t,{A:()=>B});var s=r(51447),i=r(71511),n=r(53966),o=r(97768),a=r(56454),c=r(16649),l=r(85537),u=r(96156),h=(r(44208),r(4718)),d=r(93687),f=r(11406),p=r(62788),g=r(47328),_=r(67867);class m extends f.T{constructor(e,t){super(),this.propertyName=e,this.metadata=t,this.trackingTarget=new _.R(this),this.flags=0,this.flags=g.i.Dirty|(t.nonNullable?g.i.NonNullable:0)|(t.hasOwnProperty("value")?g.i.HasDefaultValue:0)|(void 0===t.get?g.i.DepTrackingInitialized:0)|(void 0===t.dependsOn?g.i.AutoTracked:0)}destroy(){this.flags&g.i.Dirty&&this.onCommitted(),super.destroy(),this.trackingTarget.destroy()}getComputed(e){e.mutable&&(0,p.gc)(this);const t=e.store,r=this.propertyName,s=this.flags,i=t.get(r);if(s&g.i.Computing)return i;if(~s&g.i.Dirty&&t.has(r))return i;this.flags|=g.i.Computing;const n=e.host;let o;s&g.i.AutoTracked?o=(0,p.a)(this.trackingTarget,this.metadata.get,n):((0,p.Xr)(n,this),o=this.metadata.get.call(n)),this.flags|=g.i.DepTrackingInitialized,t.set(r,o,1);const a=t.get(r);return a===i?this.flags&=~g.i.Dirty:(0,p.F_)(this.commit,this),this.flags&=~g.i.Computing,a}notifyChange(){this.onInvalidated(),this.onCommitted()}invalidate(){this.onInvalidated()}commit(){this.flags&=~g.i.Dirty,this.onCommitted()}onInvalidated(){~this.flags&g.i.Overridden&&(this.flags|=g.i.Dirty);const e=this._observers;if(e&&e.length>0)for(const t of e)t.onInvalidated()}onCommitted(){const e=this._observers;if(e&&e.length>0){const t=e.slice();for(const e of t)e.onCommitted()}}}var v=r(35666);class y{constructor(){this._values=new Map,this.multipleOriginsSupported=!1}clone(e){const t=new y;return this._values.forEach((r,s)=>{e&&e.has(s)||t.set(s,(0,h.o8)(r))}),t}get(e){return this._values.get(e)}originOf(){return 7}keys(){return[...this._values.keys()]}set(e,t){this._values.set(e,t)}delete(e){this._values.delete(e)}has(e){return this._values.has(e)}isAtOrigin(e,t){return this.has(e)}isBelowOrigin(e,t){return!this.has(e)}forEach(e){this._values.forEach(e)}}function w(e,t,r){return void 0!==e}function O(e,t,r,s){return!(void 0===e||null==r&&e.flags&g.i.NonNullable&&(s.lifecycle,l.v.INITIALIZING,1))}class A{constructor(e){this.host=e,this.propertiesByName=new Map,this.ctorArgs=null,this.lifecycle=l.v.INITIALIZING,this.store=new y,this.mutable=!0,this._origin=7;const t=this.host.constructor.__accessorMetadata__;for(const e in t){const r=new m(e,t[e]);this.propertiesByName.set(e,r)}this.metadata=t}initialize(){this.lifecycle=l.v.CONSTRUCTING}constructed(){this.lifecycle=l.v.CONSTRUCTED}destroy(){this.lifecycle=l.v.DESTROYED,this.propertiesByName.forEach(e=>e.destroy())}get initialized(){return this.lifecycle!==l.v.INITIALIZING}get(e){const t=this.propertiesByName.get(e);if(!w(t))return;if(t.metadata.get)return t.getComputed(this);this.mutable&&(0,p.gc)(t);const r=this.store;return r.has(e)?r.get(e):t.metadata.value}originOf(e){const t=this.store.originOf(e);if(void 0===t){const t=this.propertiesByName.get(e);if(void 0!==t&&t.flags&g.i.HasDefaultValue)return"defaults"}return(0,v.OL)(t)}has(e){return this.propertiesByName.has(e)&&this.store.has(e)}keys(){return[...this.propertiesByName.keys()]}internalGet(e){const t=this.propertiesByName.get(e);if(w(t))return this.store.has(e)?this.store.get(e):t.metadata.value}internalSet(e,t){const r=this.propertiesByName.get(e);w(r)&&this._internalSet(r,t)}getDependsInfo(e,t,r){const s=this.propertiesByName.get(t);if(!w(s))return"";const i=new _.R,n=(0,p.a)(i,()=>s.metadata.get?.call(e));let o=`${r}${e.declaredClass.split(".").pop()}.${t}: ${n}\n`;const a=i.accessed??new Set;if(0===a.size)return o;r+=" ";for(const e of a)e instanceof m&&(o+=`${r}${e.propertyName}: undefined\n`);return o}setAtOrigin(e,t,r){const s=this.propertiesByName.get(e);if(w(s))return this._setAtOrigin(s,t,r)}isOverridden(e){const t=this.propertiesByName.get(e);return void 0!==t&&!!(t.flags&g.i.Overridden)}clearOrigin(e,t){const r=this.store,s=this.propertiesByName.get(e);if(!w(s))return;const i=r.isAtOrigin(e,t)&&!(s.flags&g.i.Overridden);r.delete(e,t),i&&s.notifyChange()}clearOverride(e){const t=this.propertiesByName.get(e);t&&t.flags&g.i.Overridden&&(t.flags&=~g.i.Overridden,t.notifyChange())}override(e,t){const r=this.propertiesByName.get(e);if(!O(r,0,t,this))return;const s=r.metadata.cast;if(s){const e=this._cast(s,t),{valid:r,value:i}=e;if(N.release(e),!r)return;t=i}r.flags|=g.i.Overridden,this._internalSet(r,t)}set(e,t){const r=this.propertiesByName.get(e);if(!O(r,0,t,this))return;const s=r.metadata.cast;if(s){const e=this._cast(s,t),{valid:r,value:i}=e;if(N.release(e),!r)return;t=i}const i=r.metadata.set;i?i.call(this.host,t):this._internalSet(r,t)}setDefaultOrigin(e){this._origin=(0,v.aB)(e)}getDefaultOrigin(){return(0,v.OL)(this._origin)}notifyChange(e){const t=this.propertiesByName.get(e);void 0!==t&&t.notifyChange()}invalidate(e){const t=this.propertiesByName.get(e);void 0!==t&&t.invalidate()}commit(e){const t=this.propertiesByName.get(e);void 0!==t&&t.commit()}_internalSet(e,t){const r=this.lifecycle!==l.v.INITIALIZING?this._origin:0;this._setAtOrigin(e,t,r)}_setAtOrigin(e,t,r){const s=this.store,i=e.propertyName;if(s.isAtOrigin(i,r)&&(0,h.aI)(t,s.get(i))&&~e.flags&g.i.Overridden)return;const n=s.isBelowOrigin(i,r)||s.isAtOrigin(i,r);n&&e.invalidate(),s.set(i,t,r),n&&e.commit(),(0,p.fE)(this.host,e)}_cast(e,t){const r=N.acquire();return r.valid=!0,r.value=t,e&&(r.value=e.call(this.host,t,r)),r}}class b{constructor(){this.value=null,this.valid=!0}acquire(){this.valid=!0}release(){this.value=null}}const N=new d.A(()=>new b);var S=r(47821);var k,D,C=r(14012),T=r(10107),E=r(64108);function I(e){if(null==e)return{value:e};if(Array.isArray(e))return{type:[e[0]],value:null};switch(typeof e){case"object":return e.constructor?.__accessorMetadata__||e instanceof Date?{type:e.constructor,value:e}:e;case"boolean":return{type:Boolean,value:e};case"string":return{type:String,value:e};case"number":return{type:Number,value:e};case"function":return{type:e,value:null};default:return}}const q=Symbol("Accessor-Handles"),z=Symbol("Accessor-Initialized");class B{static{k=q,D=z}static createSubclass(e={}){if(Array.isArray(e))throw new Error("Multi-inheritance unsupported since 4.16");const{properties:t,declaredClass:r,constructor:s}=e;delete e.declaredClass,delete e.properties,delete e.constructor;const i=this;class n extends i{constructor(...e){super(...e),this.inherited=null,s&&s.apply(this,e)}}(0,u.tD)(n.prototype);for(const t in e){const r=e[t];n.prototype[t]="function"==typeof r?function(...e){const s=this.inherited;let n;this.inherited=function(...e){if(i.prototype[t])return i.prototype[t].apply(this,e)};try{n=r.apply(this,e)}catch(e){throw this.inherited=s,e}return this.inherited=s,n}:e[t]}for(const e in t){const r=I(t[e]);(0,T.MZ)(r)(n.prototype,e)}return(0,E.$)(r)(n)}static freeze(e){return e instanceof B?e.__accessor__.mutable=!1:Object.freeze(e),e}static isFrozen(e){return e instanceof B?!e.__accessor__.mutable:Object.isFrozen(e)}constructor(...e){if(this[k]=null,this[D]=!1,this.constructor===B)throw new Error("[accessor] cannot instantiate Accessor. This can be fixed by creating a subclass of Accessor");const t=new A(this);Object.defineProperty(this,"__accessor__",{enumerable:!1,value:t}),e.length>0&&(t.ctorArgs=this.normalizeCtorArgs?.apply(this,e)??e[0])}postscript(){const e=this.__accessor__,t=e.ctorArgs;e.initialize(),t&&(this.set(t),e.ctorArgs=null),e.constructed(),this.initialize(),this[z]=!0}initialize(){}[a.G](){this[q]=(0,o.pR)(this[q])}destroy(){this.destroyed||((0,C.iS)(this),this.__accessor__.destroy())}[Symbol.dispose](){this.destroy()}get constructed(){return this.__accessor__&&this.__accessor__.initialized||!1}get initialized(){return this[z]}get destroyed(){return this.__accessor__?.lifecycle===l.v.DESTROYED||!1}get destroying(){return this.__accessor__?.lifecycle===l.v.DESTROYING||!1}commitProperty(e){(0,c.Jt)(this,e)}hasOwnProperty(e){return this.__accessor__?this.__accessor__.has(e):Object.prototype.hasOwnProperty.call(this,e)}keys(){return this.__accessor__?this.__accessor__.keys():[]}set(e,t){return(0,S.h)(this,e,t),this}watch(e,t,r){return(0,s.eO)(n.A.getLogger(this),"`watch` is deprecated in favor of reactiveUtils.watch",{replacement:"reactiveUtils.watch",version:"4.32",see:"https://arcg.is/1vaqf42#watch",warnOnce:!0}),(0,C.wB)(this,e,t,r)}addHandles(e,t){if(this.destroyed){const t=Array.isArray(e)?e:[e];for(const e of t)e.remove();return}(this[q]??=new i.A).add(e,t)}removeHandles(e){this[q]?.remove(e)}removeAllHandles(){this[q]?.removeAll()}removeHandlesReference(e){this[q]?.removeReference(e)}hasHandles(e){return!0===this[q]?.has(e)}_override(e,t){void 0===t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_clearOverride(e){return this.__accessor__.clearOverride(e)}_overrideIfSome(e,t){null==t?this.__accessor__.clearOverride(e):this.__accessor__.override(e,t)}_isOverridden(e){return this.__accessor__.isOverridden(e)}notifyChange(e){this.__accessor__.notifyChange(e)}_get(e){return this.__accessor__.internalGet(e)}_set(e,t){return this.__accessor__.internalSet(e,t),this}}},71429:(e,t,r)=>{r.d(t,{r:()=>i});var s=r(67867);class i extends s.R{constructor(e){super(new n(e)),this._observer&&o.register(this,new WeakRef(this._observer),this)}destroy(){this._observer&&o.unregister(this._observer),this.accessed?.clear(),this.clear(),this._observer?.destroy()}}class n{constructor(e){this._notify=e,this._invalidCount=0,this.destroyed=!1}onInvalidated(){this._invalidCount++}onCommitted(){if(this.destroyed)return;const e=this._invalidCount;if(1===e)return this._invalidCount=0,void this._notify();this._invalidCount=e>0?e-1:0}destroy(){this.destroyed=!0,this._notify=a}}const o=new FinalizationRegistry(e=>{e.deref()?.destroy()});function a(){}},71511:(e,t,r)=>{r.d(t,{A:()=>i});var s=r(5479);class i{constructor(){this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach(t=>{e+=t.length}),e}add(e,t){if((0,s.xZ)(e)){const r=this._getOrCreateGroup(t);for(const t of e)a(t)&&r.push(t)}else a(e)&&this._getOrCreateGroup(t).push(e);return this}forEach(e,t){if("function"==typeof e)this._groups.forEach(t=>t.forEach(e));else{const r=this._getGroup(e);r&&t&&r.forEach(t)}}has(e){return this._groups.has(n(e))}remove(e){if("string"!=typeof e&&(0,s.xZ)(e)){for(const t of e)this.remove(t);return this}return this.has(e)?(o(this._getGroup(e)),this._groups.delete(n(e)),this):this}removeAll(){return this._groups.forEach(o),this._groups.clear(),this}removeReference(e){return this._groups.delete(e),this}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const t=[];return this._groups.set(n(e),t),t}_getGroup(e){return this._groups.get(n(e))}}function n(e){return e||"_default_"}function o(e){for(const t of e)t instanceof i?t.removeAll():t.remove()}function a(e){return null!=e&&(!!e.remove||e instanceof i)}},76030:(e,t,r)=>{r.d(t,{_:()=>_,$m:()=>N,NO:()=>b,md:()=>A});var s=r(26390);function i(e,t,r,s,i){console.timeStamp(e,t,r,i,s)}class n{constructor(e,t=30){this.name=e,this._counter=0,this._samples=new Array(t)}push(e){null!=e&&(this._samples[++this._counter%this._samples.length]=e)}set(e){null!=e&&(this._samples[this._counter%this._samples.length]=e)}get median(){return this._samples.slice().sort((e,t)=>e-t)[Math.floor(this._samples.length/2)]}get average(){return this._samples.reduce((e,t)=>e+t,0)/this._samples.length}get last(){return this._samples[this._counter%this._samples.length]}}var o=r(15142),a=r(74887),c=r(78659);class l{constructor(e){this.callback=e,this.isActive=!0}remove(){this.isActive=!1}}let u=0;const h={time:(0,c.l5)(0),deltaTime:(0,c.l5)(0),elapsedFrameTime:(0,c.l5)(0),frameDuration:(0,c.l5)(0)},d=["prepare","preRender","render","postRender","update","finish"],f=[],p=new o.A,g={frameTasks:p,willDispatch:!1,clearFrameTasks:function(e=!1){p.forAll(e=>{e.removed=!0}),e&&w()},dispatch:O,executeFrameTasks:function(e){const t=(0,c.l5)(e-u);u=e;const r=1e3/60,s=Math.max(0,t-r);h.time=e,h.frameDuration=(0,c.l5)(r-s);for(let r=0;r<d.length;r++){const s=performance.now(),n=d[r];p.forAll(s=>{s.paused||s.removed||(0===r&&s.ticks++,s.phases[n]&&(h.elapsedFrameTime=(0,c.l5)(performance.now()-e),h.deltaTime=0===s.ticks?(0,c.l5)(0):t,s.phases[n]?.call(s,h)))});const o=performance.now();S[r].push(o-s),i(n,s,o,"Maps SDK","Scheduling")}w();const n=performance.now();k.push(n-e),i("Animation Frame",e,n,"Maps SDK","Scheduling")},reschedule:function(){null!=m&&(cancelAnimationFrame(m),m=requestAnimationFrame(v))}};function _(e){const t=new l(e);return f.push(t),g.willDispatch||(g.willDispatch=!0,(0,s.d)(O)),t}let m=null;function v(){const e=performance.now();m=null;const t=p.some(e=>!e.paused&&!e.removed);m=t?requestAnimationFrame(v):null,g.executeFrameTasks(e)}const y=new o.A;function w(){p.forAll(e=>{e.removed&&y.push(e)}),p.removeUnorderedMany(y.data,y.length),y.clear()}function O(){for(;f.length;){const e=f.shift();e.isActive&&e.callback()}g.willDispatch=!1}function A(e=1,t){const r=(0,a.Tw)(),i=()=>{(0,a.G4)(t)?r.reject((0,a.NK)()):0===e?r():(--e,(0,s.d)(()=>i()))};return i(),r.promise}function b(e){return A(1,e)}async function N(e){await b(e),await new Promise(t=>requestAnimationFrame(()=>{e?.aborted||t()}))}const S=d.map(e=>new n(e)),k=new n("total")},76953:(e,t,r)=>{function s(e,t,r){t.keys().forEach(e=>{r.set(e,t.get(e),0)});const s=e.metadata;Object.keys(s).forEach(t=>{e.internalGet(t)&&r.set(t,e.internalGet(t),0)})}r.d(t,{k:()=>s})},78659:(e,t,r)=>{function s(e){return e}function i(e){return 1e3*e}function n(e){return e}r.d(t,{Kp:()=>n,gr:()=>i,l5:()=>s})},80559:(e,t,r)=>{r.d(t,{Df:()=>l,fm:()=>u,mJ:()=>c});var s=r(36563),i=r(62788),n=r(71429);let o=!1;const a=[];function c(e,t){let r=new n.r(function s(){if(!r||c)return;if(o)return void h(s);const n=a;r.clear(),o=!0,c=!0,a=(0,i.a)(r,e),c=!1,o=!1,t(a,n),d()}),a=null,c=!1;return c=!0,a=(0,i.a)(r,e),c=!1,(0,s.hA)(function(){r&&(r.destroy(),r=null,a=null)})}function l(e,t){let r=new n.r(function(){t(o,a)}),o=null;function a(){return r?(r.clear(),o=(0,i.a)(r,e),o):null}return a(),(0,s.hA)(function(){r&&(r.destroy(),r=null),o=null})}function u(e,t){let r=!1,a=!1;const c=!!t?.sync;let l=new n.r(()=>{r||a||(a=!0,c?u():queueMicrotask(u))});function u(){a=!1,l&&!r&&(o?h(u):(l.clear(),o=!0,r=!0,(0,i.a)(l,e),r=!1,o=!1,d()))}return r=!0,(0,i.a)(l,e),r=!1,(0,s.hA)(function(){l&&(l.destroy(),l=null)})}function h(e){a.includes(e)||a.unshift(e)}function d(){for(;a.length;)a.pop()()}},98291:(e,t,r)=>{r.d(t,{A:()=>n});var s=r(93687);function i(e){e.length=0}class n{constructor(e=50,t=50){this._pool=new s.A(()=>[],void 0,i,t,e)}acquire(){return this._pool.acquire()}release(e){this._pool.release(e)}prune(){this._pool.prune(0)}static acquire(){return o.acquire()}static release(e){return o.release(e)}static prune(){o.prune()}}const o=new n(100)}}]);
|