@arcgis/core 4.34.0-next.70 → 4.34.0-next.72

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.
Files changed (85) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{f47a0b9e500af2b9453b.js → 1f51c94d392826fdbdf4.js} +1 -1
  3. package/assets/esri/core/workers/chunks/ada8e07ff12bc5d4a1d9.js +1 -0
  4. package/assets/esri/core/workers/chunks/{6f4079b7a2b45f304ee6.js → e21eeb4e78a46fb7e32e.js} +1 -1
  5. package/assets/esri/core/workers/chunks/ed8a85efbd90241512bb.js +1 -0
  6. package/config.js +1 -1
  7. package/geometry/support/aaBoundingBox.js +1 -1
  8. package/geometry/support/aaBoundingRect.js +1 -1
  9. package/geometry/support/rotate.js +1 -1
  10. package/interfaces.d.ts +10 -10
  11. package/kernel.js +1 -1
  12. package/layers/BaseElevationLayer.js +1 -1
  13. package/layers/graphics/sources/support/uploadAssets.js +1 -1
  14. package/networks/CircuitManager.js +1 -1
  15. package/networks/support/Circuit.js +5 -0
  16. package/networks/support/CircuitLocation.js +5 -0
  17. package/networks/support/CircuitPath.js +5 -0
  18. package/networks/support/CircuitPathConnectivityElement.js +5 -0
  19. package/networks/support/CircuitSection.js +5 -0
  20. package/networks/support/Subcircuit.js +5 -0
  21. package/networks/support/typeUtils.js +1 -1
  22. package/package.json +1 -1
  23. package/rest/networks/circuits/support/CircuitTraceResult.js +5 -0
  24. package/rest/networks/circuits/support/CircuitVerifyResult.js +1 -1
  25. package/rest/networks/circuits/support/CreateAlterCircuitParameters.js +1 -1
  26. package/rest/networks/circuits/support/QueryCircuitsParameters.js +1 -1
  27. package/rest/networks/circuits/support/QueryCircuitsResult.js +1 -1
  28. package/rest/networks/support/TraceLocation.js +1 -1
  29. package/rest/networks/support/TraceResult.js +1 -1
  30. package/rest/print.js +1 -1
  31. package/smartMapping/heuristics/scaleRange.js +1 -1
  32. package/smartMapping/heuristics/sizeRange.js +1 -1
  33. package/support/revision.js +1 -1
  34. package/views/2d/navigation/actions/Pan.js +1 -1
  35. package/views/2d/navigation/actions/Pinch.js +1 -1
  36. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  37. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  38. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  39. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  40. package/views/3d/camera/intersectionUtils.js +1 -1
  41. package/views/3d/constraints/Constraints.js +1 -1
  42. package/views/3d/layers/FlowSubView3D.js +1 -1
  43. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  44. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  45. package/views/3d/state/ConstraintsManager.js +1 -1
  46. package/views/3d/state/NearFarHeuristic.js +1 -1
  47. package/views/3d/state/ViewState.js +1 -1
  48. package/views/3d/state/ViewStateManager.js +1 -1
  49. package/views/3d/state/controllers/CameraController.js +1 -1
  50. package/views/3d/state/controllers/InteractiveController.js +1 -1
  51. package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
  52. package/views/3d/state/controllers/SurfaceCollisionCorrectionController.js +1 -1
  53. package/views/3d/state/controllers/momentum/MomentumController.js +1 -1
  54. package/views/3d/state/controllers/momentum/RotationMomentumController.js +1 -1
  55. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  56. package/views/3d/state/controllers/momentum/ZoomSphericalMomentumController.js +1 -1
  57. package/views/3d/support/MemoryController.js +1 -1
  58. package/views/3d/support/flow/loadUtils.js +1 -1
  59. package/views/3d/{support → terrain}/ElevationUpdateEvent.js +1 -1
  60. package/views/3d/terrain/Overlay.js +1 -1
  61. package/views/3d/terrain/OverlayManager.js +1 -1
  62. package/views/3d/terrain/TerrainSurface.js +1 -1
  63. package/views/3d/webgl/RenderCamera.js +1 -1
  64. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  65. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  66. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  67. package/views/SceneView.js +1 -1
  68. package/views/draw/support/Reshape.js +1 -1
  69. package/views/draw/support/drawUtils.js +1 -1
  70. package/views/draw/support/reshapeTooltipUtils.js +1 -1
  71. package/views/draw/support/reshapeUtils.js +5 -0
  72. package/views/interactive/tooltip/content/TooltipContentElevation.js +5 -0
  73. package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
  74. package/views/interactive/tooltip/infos/ElevationTooltipInfo.js +5 -0
  75. package/views/navigation/Momentum.js +1 -1
  76. package/widgets/Editor/Upload.js +1 -1
  77. package/assets/esri/core/workers/chunks/57a579b0cbc1bcf0d903.js +0 -1
  78. package/assets/esri/core/workers/chunks/dd120d562b63618e71c0.js +0 -1
  79. package/rest/networks/support/Circuit.js +0 -5
  80. package/rest/networks/support/CircuitLocation.js +0 -5
  81. package/rest/networks/support/CircuitPath.js +0 -5
  82. package/rest/networks/support/CircuitPathConnectivityElement.js +0 -5
  83. package/rest/networks/support/CircuitSection.js +0 -5
  84. package/rest/networks/support/CircuitTraceResult.js +0 -5
  85. package/rest/networks/support/Subcircuit.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{throwIfDestroyed as d,throwIfAborted as u,createAbortError as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{on as m,watch as y,initial as f,sync as w,whenOnce as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as b,cleanupScheduling as M}from"../core/scheduling.js";import{createScreenPointArray as S,createScreenPoint as V}from"../core/screenUtils.js";import{cleanupWhereClauseCache as j}from"../core/sql.js";import{getMetersPerUnitForSR as C}from"../core/unitUtils.js";import{initialize as T}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as O}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as A,ensureClass as E}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as I}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as F}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as P}from"../core/support/OwningCollection.js";import D from"../geometry/Extent.js";import U from"../geometry/HeightModelInfo.js";import G from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import z from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as k}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as B}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as N}from"../geometry/projection/projectPointToVector.js";import{toExtent as Q,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as J,isTiledLayer as K,isVoxelLayer as X,isIntegratedMeshLayer as ee}from"../layers/support/layerUtils.js";import{TilemapCache as te}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as ie}from"../portal/portalDefault.js";import{AnalysesCollection as re}from"../support/AnalysesCollection.js";import{WebSceneTag as se}from"../support/tagSymbols.js";import{BreakpointsOwner as ne}from"./BreakpointsOwner.js";import{DOMContainer as ae}from"./DOMContainer.js";import oe from"./GroundView.js";import{PopupView as le}from"./PopupView.js";import pe from"./View.js";import he from"./ViewAnimation.js";import{stringFromViewingMode as de,viewingModeFromString as ue}from"./ViewingMode.js";import{layerView3DImporter as ce}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ge}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as me}from"./3d/camera/intersectionUtils.js";import{Constraints as ye}from"./3d/constraints/Constraints.js";import{EnvironmentManager as fe}from"./3d/environment/EnvironmentManager.js";import we from"./3d/environment/SceneViewEnvironment.js";import ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as _e}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as be}from"./3d/layers/graphics/Labeler.js";import Me from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Se}from"./3d/layers/support/StageLayerElevationProvider.js";import Ve from"./3d/state/ViewState.js";import{ViewStateManager as je,cleanupViewStateManager as Ce}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Te}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Re}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as xe}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Oe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ae}from"./3d/support/debugFlags.js";import Ee from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Le,hitTest as Ie}from"./3d/support/hitTest.js";import{popupHitTest as Fe}from"./3d/support/popupHitTest.js";import Pe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as De}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ue}from"./3d/support/ResourceController.js";import Ge from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as We}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as qe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as ze}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import ke from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Be,getTiledLayerInfo as Ne,checkIfTileInfoSupportedForView as Qe}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Ye}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ze}from"./3d/terrain/TileRenderer.js";import{Stage as $e}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Je}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as Ke}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as Xe}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as et}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as tt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as it}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import rt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as st}from"./support/drapedUtils.js";import{defaultHighlightName as nt}from"./support/HighlightDefaults.js";import at from"./support/HighlightOptions.js";import{occludeesSupported as ot}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as lt,createScreenPointFromSupportedEvent as pt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ht}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as dt,destroyTextureCompressionWorker as ut}from"./support/TextureCompressionHelper.js";import{check as ct}from"./support/WebGLRequirements.js";import gt from"./ui/DefaultUI.js";import mt from"./ui/3d/DefaultUI3D.js";import yt from"../webscene/Environment.js";import{clearVNodeCache as ft}from"../widgets/support/vnodeCache.js";const wt=Symbol(),vt=Symbol();let _t=class extends(ne(le(ae(pe)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ue(this),this.deconflictor=new _e({view:this}),this.labeler=new be({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new re,this.basemapTerrain=null,this.elevationProvider=new Oe({view:this}),this._canvas=null,this.constraints=new ye,this._environment=new we,this.environmentManager=new fe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new rt({importAnalysisViewModule:e=>ge(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.screenSizePerspectiveEnabled=!0,this.state=new Ve({view:this}),this.slice=new qe,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,T();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([m(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),y(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new ve({view:this}),this.stateManager=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new oe({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>b(e>0?1e3/Math.ceil(e):0),f),this.addHandles([y(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),w),y(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),w)])}destroy(){this.destroyed||(ut(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null)}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof D?this.spatialReference&&(t=bt(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:bt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=bt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||z.WGS84;let t;const i=i=>{const r=bt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{basemapTerrain:r}=this;if(r?.spatialReference){const e=r.groundExtent;i(new D({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>s(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof we?e:e instanceof yt?this.environment?.cloneWithWebsceneEnvironment(e)??we.fromWebsceneEnvironment(e):A(we,e):new we}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&se in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){Ee.isValidProfile(e)&&(Ee.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ee.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?U.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Be(r))return;++i,e+=r.updatingProgress}}else++i});for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return de(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?de(this.defaultsFromMap.viewingMode):ht(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find(({name:e})=>e===nt)??new at}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===nt)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ge(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Le(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?He(this.elevationProvider,e):null)??0;return N(e,Mt,this.renderSpatialReference,t),this.state.camera.projectToScreen(Mt,St),V(St[0],St[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;N(e,Mt,i);const r=this.state.camera.computeScreenPixelSizeAt(Mt);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Ie(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Fe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Je())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ce.importLayerView(e)}hasLayerViewModule(e){return ce.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=ct(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ue(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ht(e,i)&&(null==t||(!!J(t)||(!K(t)||null!=Ne(t,e,i))&&(!X(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(J(t)&&(r||s)){return!s||2===i||null===Qe(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return K(t)||X(t)||!r&&!s?K(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:z.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${de(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ot(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await v(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await jt[e]();if(t&&(d(this),u(i.signal),await t(i.signal)),this.destroyed)throw c();return u(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new ke({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new ze({view:this})),this.addHandles([this.updatingHandles.add(()=>Ae.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ae.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.basemapTerrain?.extent,basemapSpatialReference:this.basemapTerrain?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Q(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this._ensureFeatureTileTree():this._featureTiles=p(this._featureTiles)},w)],wt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(vt),this.removeHandles(wt),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=Z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",De.create(this.state.viewingMode,i)),t||this.addHandles(y(()=>this.basemapTerrain?.extent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!B(e,this.basemapTerrain.spatialReference,Vt,t)||(this.renderCoordsHelper.extent=Vt)},w),vt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(vt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(y(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),w),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new Re(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new $e({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,e=>this.stage.renderer.setParameters({highQualityTransparency:e}),f),this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new We({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>v(()=>this.basemapTerrain?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=ue(this.viewingMode);1===e&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(y(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?H(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){ft(),L(),j(),it(),Ce(),me(),Se(),k(),st(),ie(),Ze(),et(),Te(),xe(),F(),M(),Ke(),Ye(),Me.cleanupI3SLodHandling(),te.cleanupTilemapCache(),Ve.cleanupViewstate(),ke.cleanupTerrainSurface()}};function bt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],_t.prototype,"_userClippingArea",void 0),e([R()],_t.prototype,"_resourceController",void 0),e([R()],_t.prototype,"stage",null),e([R({readOnly:!0})],_t.prototype,"deconflictor",void 0),e([R({readOnly:!0})],_t.prototype,"labeler",void 0),e([R(P(re,"analyses"))],_t.prototype,"analyses",void 0),e([R({type:he,readOnly:!0})],_t.prototype,"animation",null),e([R({readOnly:!0})],_t.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],_t.prototype,"elevationProvider",void 0),e([R()],_t.prototype,"camera",null),e([R({type:t})],_t.prototype,"contentCamera",null),e([R({readOnly:!0})],_t.prototype,"canvas",null),e([R({type:G})],_t.prototype,"center",null),e([R({type:D})],_t.prototype,"clippingArea",null),e([R({type:ye})],_t.prototype,"constraints",void 0),e([R({type:D,readOnly:!0})],_t.prototype,"renderDataExtent",null),e([R({readOnly:!0})],_t.prototype,"tileInfo",null),e([R({type:D,readOnly:!0})],_t.prototype,"dataExtent",null),e([R({type:D,readOnly:!0})],_t.prototype,"_groundAndLayersExtent",null),e([R({type:we})],_t.prototype,"environment",null),e([x("environment")],_t.prototype,"castEnvironment",null),e([R({readOnly:!0})],_t.prototype,"environmentManager",void 0),e([R({type:D})],_t.prototype,"extent",null),e([R({type:r})],_t.prototype,"floors",void 0),e([R()],_t.prototype,"screenCenter",null),e([R()],_t.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],_t.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],_t.prototype,"graphicsView",void 0),e([R()],_t.prototype,"analysisViewManager",void 0),e([R()],_t.prototype,"groundView",void 0),e([R({type:Boolean})],_t.prototype,"initialExtentRequired",null),e([R()],_t.prototype,"defaultsFromMapSettings",null),e([R()],_t.prototype,"interacting",null),e([R()],_t.prototype,"stationary",null),e([R()],_t.prototype,"navigating",null),e([R()],_t.prototype,"map",void 0),e([R()],_t.prototype,"padding",null),e([R({type:ze,readOnly:!0})],_t.prototype,"pointsOfInterest",void 0),e([R()],_t.prototype,"_featureTiles",void 0),e([R()],_t.prototype,"featureTiles",null),e([R()],_t.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],_t.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],_t.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],_t.prototype,"state",void 0),e([R({readOnly:!0})],_t.prototype,"inputManager",void 0),e([R({readOnly:!0})],_t.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],_t.prototype,"qualityProfile",null),e([R({type:Pe,get(){let e=this._get("qualitySettings");return e||(e=new Pe,Ee.apply(this.qualityProfile,e)),e}})],_t.prototype,"qualitySettings",void 0),e([R()],_t.prototype,"slice",void 0),e([R({readOnly:!0})],_t.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],_t.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],_t.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],_t.prototype,"resolution",null),e([R({type:Number})],_t.prototype,"scale",null),e([R()],_t.prototype,"heightModelInfo",null),e([R()],_t.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],_t.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],_t.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],_t.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],_t.prototype,"type",void 0),e([R(),x(e=>e instanceof gt?e:E(mt,e))],_t.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],_t.prototype,"updating",null),e([R()],_t.prototype,"_updatingObjects",null),e([R()],_t.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],_t.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],_t.prototype,"viewingMode",null),e([R({type:i})],_t.prototype,"viewpoint",null),e([R({readOnly:!0})],_t.prototype,"visibleArea",null),e([R({type:Number})],_t.prototype,"zoom",null),e([R({type:at})],_t.prototype,"highlightOptions",null),e([R({readOnly:!0})],_t.prototype,"quality",null),e([R({readOnly:!0})],_t.prototype,"resolutionScale",null),e([R()],_t.prototype,"focusAreasView",void 0),e([R()],_t.prototype,"_defaultToMapOptions",null),e([R()],_t.prototype,"_defaultHitTestOptions",null),_t=e([O("esri.views.SceneView")],_t);const Mt=I(),St=S(),Vt=Y(),jt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Ct=_t;export{Ct as default};
5
+ import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{throwIfDestroyed as d,throwIfAborted as u,createAbortError as c}from"../core/promiseUtils.js";import g from"../core/ReactiveSet.js";import{on as m,watch as y,initial as f,sync as w,whenOnce as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as b,cleanupScheduling as M}from"../core/scheduling.js";import{createScreenPointArray as S,createScreenPoint as V}from"../core/screenUtils.js";import{cleanupWhereClauseCache as j}from"../core/sql.js";import{getMetersPerUnitForSR as C}from"../core/unitUtils.js";import{initialize as T}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as x}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as O}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as E,ensureClass as A}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as I}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as F}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as P}from"../core/support/OwningCollection.js";import D from"../geometry/Extent.js";import U from"../geometry/HeightModelInfo.js";import G from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import z from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as k}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as B}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as N}from"../geometry/projection/projectPointToVector.js";import{toExtent as Q,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Z}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as $}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as J,isTiledLayer as K,isVoxelLayer as X,isIntegratedMeshLayer as ee}from"../layers/support/layerUtils.js";import{TilemapCache as te}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as ie}from"../portal/portalDefault.js";import{AnalysesCollection as re}from"../support/AnalysesCollection.js";import{WebSceneTag as se}from"../support/tagSymbols.js";import{BreakpointsOwner as ne}from"./BreakpointsOwner.js";import{DOMContainer as ae}from"./DOMContainer.js";import oe from"./GroundView.js";import{PopupView as le}from"./PopupView.js";import pe from"./View.js";import he from"./ViewAnimation.js";import{stringFromViewingMode as de,viewingModeFromString as ue}from"./ViewingMode.js";import{layerView3DImporter as ce}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ge}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as me}from"./3d/camera/intersectionUtils.js";import{Constraints as ye}from"./3d/constraints/Constraints.js";import{EnvironmentManager as fe}from"./3d/environment/EnvironmentManager.js";import we from"./3d/environment/SceneViewEnvironment.js";import ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as _e}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as be}from"./3d/layers/graphics/Labeler.js";import Me from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Se}from"./3d/layers/support/StageLayerElevationProvider.js";import Ve from"./3d/state/ViewState.js";import{ViewStateManager as je,cleanupViewStateManager as Ce}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Te}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Re}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as xe}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Oe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ee}from"./3d/support/debugFlags.js";import Ae from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Le,hitTest as Ie}from"./3d/support/hitTest.js";import{popupHitTest as Fe}from"./3d/support/popupHitTest.js";import Pe from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as De}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ue}from"./3d/support/ResourceController.js";import Ge from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as We}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as qe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as ze}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import ke from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Be,getTiledLayerInfo as Ne,checkIfTileInfoSupportedForView as Qe}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Ye}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ze}from"./3d/terrain/TileRenderer.js";import{Stage as $e}from"./3d/webgl-engine/Stage.js";import{olidEnabled as Je}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as Ke}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as Xe}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as et}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as tt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as it}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import rt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as st}from"./support/drapedUtils.js";import{defaultHighlightName as nt}from"./support/HighlightDefaults.js";import at from"./support/HighlightOptions.js";import{occludeesSupported as ot}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as lt,createScreenPointFromSupportedEvent as pt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ht}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as dt,destroyTextureCompressionWorker as ut}from"./support/TextureCompressionHelper.js";import{check as ct}from"./support/WebGLRequirements.js";import gt from"./ui/DefaultUI.js";import mt from"./ui/3d/DefaultUI3D.js";import yt from"../webscene/Environment.js";import{clearVNodeCache as ft}from"../widgets/support/vnodeCache.js";const wt=Symbol(),vt=Symbol();let _t=class extends(ne(le(ae(pe)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ue(this),this.deconflictor=new _e({view:this}),this.labeler=new be({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new re,this.basemapTerrain=null,this.elevationProvider=new Oe({view:this}),this._canvas=null,this.constraints=new ye,this._environment=new we,this.environmentManager=new fe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new rt({importAnalysisViewModule:e=>ge(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.screenSizePerspectiveEnabled=!0,this.state=new Ve({view:this}),this.slice=new qe,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,T();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([m(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),y(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new ve({view:this}),this.stateManager=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new oe({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},f),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>b(e>0?1e3/Math.ceil(e):0),f),this.addHandles([y(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),w),y(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),w)])}destroy(){this.destroyed||(ut(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null)}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof D?this.spatialReference&&(t=bt(t,this.spatialReference),null==t)?(l.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:bt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=bt(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||z.WGS84;let t;const i=i=>{const r=bt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{basemapTerrain:r}=this;if(r?.spatialReference){const e=r.groundExtent;i(new D({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}const s=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>s(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const n=this._get("_groundAndLayersExtent");return t.equals(n)?n:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof we?e:e instanceof yt?this.environment?.cloneWithWebsceneEnvironment(e)??we.fromWebsceneEnvironment(e):E(we,e):new we}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&se in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){Ae.isValidProfile(e)&&(Ae.apply(e,this.qualitySettings),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ae.getDefaultProfile()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?$(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?U.deriveUnitFromSR(e,this.spatialReference):null}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn("alphaCompositingEnabled cannot be changed after the view has become ready"),this._set("alphaCompositingEnabled",e)}get updating(){if(this.destroying||this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Be(r))return;++i,e+=r.updatingProgress}}else++i});for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return de(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?de(this.defaultsFromMap.viewingMode):ht(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get highlightOptions(){return this.highlights.find(({name:e})=>e===nt)??new at}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===nt)return void this.highlights.items[t].assignFrom(e)}}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ge(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Le(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?He(this.elevationProvider,e):null)??0;return N(e,Mt,this.renderSpatialReference,t),this.state.camera.projectToScreen(Mt,St),V(St[0],St[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;N(e,Mt,i);const r=this.state.camera.computeScreenPixelSizeAt(Mt);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e)):1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=lt(e)?pt(this,e):e;return Ie(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Fe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!Je())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ce.importLayerView(e)}hasLayerViewModule(e){return ce.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=ct(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw l.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ue(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ht(e,i)&&(null==t||(!!J(t)||(!K(t)||null!=Ne(t,e,i))&&(!X(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(J(t)&&(r||s)){return!s||2===i||null===Qe(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return K(t)||X(t)||!r&&!s?K(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:z.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${de(i)} viewing mode.`):e.isGeographic&&l.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&ot(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),o(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await v(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await jt[e]();if(t&&(d(this),u(i.signal),await t(i.signal)),this.destroyed)throw c();return u(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new ke({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new ze({view:this})),this.addHandles([this.updatingHandles.add(()=>Ee.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ee.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.basemapTerrain?.extent,basemapSpatialReference:this.basemapTerrain?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Q(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this._ensureFeatureTileTree():this._featureTiles=p(this._featureTiles)},w)],wt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(vt),this.removeHandles(wt),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=Z(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",De.create(this.state.viewingMode,i)),t||this.addHandles(y(()=>this.basemapTerrain?.extent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!B(e,this.basemapTerrain.spatialReference,Vt,t)||(this.renderCoordsHelper.extent=Vt)},w),vt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(vt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(y(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),w),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new Re(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new $e({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.updatingHandles.add(()=>this.qualitySettings.highQualityTransparency,e=>this.stage.renderer.setParameters({highQualityTransparency:e}),f),this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Xe/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new We({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>v(()=>this.basemapTerrain?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){const e=ue(this.viewingMode);1===e&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(y(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const t=this.scene?.initialViewProperties??null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?H(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,t?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(tt);for(const t of this.allLayerViews)ee(t.layer.type)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){ft(),L(),j(),it(),Ce(),me(),Se(),k(),st(),ie(),Ze(),et(),Te(),xe(),F(),M(),Ke(),Ye(),Me.cleanupI3SLodHandling(),te.cleanupTilemapCache(),Ve.cleanupViewstate(),ke.cleanupTerrainSurface()}};function bt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],_t.prototype,"_userClippingArea",void 0),e([R()],_t.prototype,"_resourceController",void 0),e([R()],_t.prototype,"stage",null),e([R({readOnly:!0})],_t.prototype,"deconflictor",void 0),e([R({readOnly:!0})],_t.prototype,"labeler",void 0),e([R(P(re,"analyses"))],_t.prototype,"analyses",void 0),e([R({type:he,readOnly:!0})],_t.prototype,"animation",null),e([R({readOnly:!0})],_t.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],_t.prototype,"elevationProvider",void 0),e([R()],_t.prototype,"camera",null),e([R({type:t})],_t.prototype,"contentCamera",null),e([R({readOnly:!0})],_t.prototype,"canvas",null),e([R({type:G})],_t.prototype,"center",null),e([R({type:D})],_t.prototype,"clippingArea",null),e([R({type:ye,nonNullable:!0})],_t.prototype,"constraints",void 0),e([R({type:D,readOnly:!0})],_t.prototype,"renderDataExtent",null),e([R({readOnly:!0})],_t.prototype,"tileInfo",null),e([R({type:D,readOnly:!0})],_t.prototype,"dataExtent",null),e([R({type:D,readOnly:!0})],_t.prototype,"_groundAndLayersExtent",null),e([R({type:we})],_t.prototype,"environment",null),e([x("environment")],_t.prototype,"castEnvironment",null),e([R({readOnly:!0})],_t.prototype,"environmentManager",void 0),e([R({type:D})],_t.prototype,"extent",null),e([R({type:r})],_t.prototype,"floors",void 0),e([R()],_t.prototype,"screenCenter",null),e([R()],_t.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],_t.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],_t.prototype,"graphicsView",void 0),e([R()],_t.prototype,"analysisViewManager",void 0),e([R()],_t.prototype,"groundView",void 0),e([R({type:Boolean})],_t.prototype,"initialExtentRequired",null),e([R()],_t.prototype,"defaultsFromMapSettings",null),e([R()],_t.prototype,"interacting",null),e([R()],_t.prototype,"stationary",null),e([R()],_t.prototype,"navigating",null),e([R()],_t.prototype,"map",void 0),e([R()],_t.prototype,"padding",null),e([R({type:ze,readOnly:!0})],_t.prototype,"pointsOfInterest",void 0),e([R()],_t.prototype,"_featureTiles",void 0),e([R()],_t.prototype,"featureTiles",null),e([R()],_t.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],_t.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],_t.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],_t.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],_t.prototype,"state",void 0),e([R({readOnly:!0})],_t.prototype,"inputManager",void 0),e([R({readOnly:!0})],_t.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],_t.prototype,"qualityProfile",null),e([R({type:Pe,get(){let e=this._get("qualitySettings");return e||(e=new Pe,Ae.apply(this.qualityProfile,e)),e}})],_t.prototype,"qualitySettings",void 0),e([R()],_t.prototype,"slice",void 0),e([R({readOnly:!0})],_t.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],_t.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],_t.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],_t.prototype,"resolution",null),e([R({type:Number})],_t.prototype,"scale",null),e([R()],_t.prototype,"heightModelInfo",null),e([R()],_t.prototype,"spatialReference",void 0),e([R({type:Boolean,value:!1})],_t.prototype,"alphaCompositingEnabled",null),e([R({constructOnly:!0})],_t.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],_t.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],_t.prototype,"type",void 0),e([R(),x(e=>e instanceof gt?e:A(mt,e))],_t.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],_t.prototype,"updating",null),e([R()],_t.prototype,"_updatingObjects",null),e([R()],_t.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],_t.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],_t.prototype,"viewingMode",null),e([R({type:i})],_t.prototype,"viewpoint",null),e([R({readOnly:!0})],_t.prototype,"visibleArea",null),e([R({type:Number})],_t.prototype,"zoom",null),e([R({type:at})],_t.prototype,"highlightOptions",null),e([R({readOnly:!0})],_t.prototype,"quality",null),e([R({readOnly:!0})],_t.prototype,"resolutionScale",null),e([R()],_t.prototype,"focusAreasView",void 0),e([R()],_t.prototype,"_defaultToMapOptions",null),e([R()],_t.prototype,"_defaultHitTestOptions",null),_t=e([O("esri.views.SceneView")],_t);const Mt=I(),St=S(),Vt=Y(),jt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Ct=_t;export{Ct as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,assertIsSome as h,abortMaybe as p}from"../../../core/maybe.js";import{pausable as c,when as l,watch as d,initial as m,sync as v}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import{closeRingsAndFixWinding as u,getMidpoint as f,geometryToCoordinates as x}from"../../../geometry/support/coordsUtils.js";import{isPoint as G}from"../../../geometry/support/typeUtils.js";import M from"../../../layers/GraphicsLayer.js";import b from"../../../symbols/SimpleMarkerSymbol.js";import{SnappingVisualizer2D as V}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as S}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as w,cloneMove as E}from"./drawUtils.js";import I from"./GraphicMover.js";import O from"./HighlightHelper.js";import{addUniqueLayer as C,isConnectedReshapeSupportedLayer as k}from"./layerUtils.js";import{createTooltipInfos as T,connectTooltip as H,updateTranslateTooltipInfo as R,updateTranslateVertexTooltipInfo as j}from"./reshapeTooltipUtils.js";import{settings as A}from"./settings.js";import{ViewEventPriorities as U}from"../../input/InputManager.js";import{createCoordinateHelper as L}from"../../interactive/coordinateHelper.js";import{sketchKeys as z}from"../../interactive/keybindings.js";import{EditGeometryOperations as D}from"../../interactive/editGeometry/EditGeometryOperations.js";import F from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as P}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as N,enterInputModeIfAvailable as Z}from"../../interactive/tooltip/tooltipCommonUtils.js";const X=A.reshapeGraphics,Y={vertices:{default:new b({style:"circle",size:X.vertex.size,color:X.vertex.color,outline:{color:X.vertex.outlineColor,width:1}}),hover:new b({style:"circle",size:X.vertex.hoverSize,color:X.vertex.hoverColor,outline:{color:X.vertex.hoverOutlineColor,width:1}}),selected:new b({style:"circle",size:X.selected.size,color:X.selected.color,outline:{color:X.selected.outlineColor,width:1}})},midpoints:{default:new b({style:"circle",size:X.midpoint.size,color:X.midpoint.color,outline:{color:X.midpoint.outlineColor,width:1}}),hover:new b({style:"circle",size:X.midpoint.size,color:X.midpoint.color,outline:{color:X.midpoint.outlineColor,width:1}})}},q=Symbol();let K=class extends r{constructor(e){super(e),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.midpointGraphics=new s,this.midpointSymbol=new b({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=new s,this.snappingManager=null,this.symbols=Y,this.sketchOptions=new F,this.type="reshape",this.vertexGraphics=new s,this.view=null}initialize(){const e=this.view;this._highlightHelper=new O({view:e}),this._setup(),this._updateHandlesOnExternalGeometryChange=c(()=>this.graphic?.geometry,e=>{if(!e)return;const t=new Set(this.selectedVertices.map(e=>e.attributes?.pointIndex));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(e=>t.has(e.attributes.pointIndex)).forEach(e=>this._addToSelection(e));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n}=this,a=n.concat(r).items;i&&a.push(o),s?.set("graphics",a)},v),this.tooltip=N(()=>({view:e,options:this.sketchOptions.tooltips})),this.tooltipInfos=T(this.sketchOptions),this.addHandles([l(()=>e?.ready,()=>{const{layer:e,view:t}=this;C(t,e),this.addHandles(t.on("key-down",e=>this._keyDownHandler(e),U.TOOL))},{once:!0,initial:!0}),d(()=>this.graphic,()=>this.refresh()),d(()=>this.layer,(e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()}),d(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),d(()=>this.enableMidpoints,()=>this.refresh()),H(this.tooltip,()=>this._tooltipsContext),d(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),m),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=a(this._connectedReshapeManager),this.tooltip=a(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??L(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedVertex(){return 1===this.selectedVertices.length?this.selectedVertices.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedVertex,automaticAreaMeasurementUtils:e,automaticLengthMeasurementUtils:t,updateGeometry:(e,t,i,s,o)=>{this._setUpGeometryHelper();const r=e===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(e);const n=!0;if(this._syncGeometryAfterVertexMove(e,t,s,o,n),r){const{view:e}=this,s=e.toScreen(i),o=e.toScreen(t),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(e),this._emitReshapeStopEvent(e);this._editGeometryOperations=a(this._editGeometryOperations)}}}get state(){const e=this.view.ready,t=!(!this.graphic||!this.layer);return e&&t?"active":e?"ready":"disabled"}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length>0&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedVertices:e}=this;e.length&&this._removeVertices(e)}_setup(){const{graphic:e,layer:t}=this;if(!t||null==e?.geometry)return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&u(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const e=this.graphic.geometry;null!=e&&"mesh"!==e.type&&"extent"!==e.type?this._editGeometryOperations=D.fromGeometry(e,2):this._logGeometryTypeError()}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new M({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;h(i),this._snappingContext=new P({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new V(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(q)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this.selectedVertices.removeAll(),this._updateTooltip()}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach(e=>e.destroy()),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach(e=>e.destroy()),this.vertexGraphics.removeAll()}_setupGraphics(){const e=this.graphic.geometry;if(null!=e&&("polyline"===e.type||"polygon"===e.type||"multipoint"===e.type)){const t=B(e);this.enableMidpoints&&"multipoint"!==e.type&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];return e?.forEach((e,r)=>{e.forEach((e,n)=>{o.push(new t({geometry:this._coordinateHelper.arrayToPoint(e),symbol:s?.vertices?.default,attributes:{...i,pathIndex:r,pointIndex:n}}))})}),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s}=this,o=[];for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++){const a=(e+1)%n.length;if("polyline"===this.graphic.geometry?.type&&0===a)continue;const h=n[e],p=n[a],c=this._getMidpoint(h,p);o.push(new t({geometry:c,symbol:s.midpoints.default,attributes:{...i,pathIndex:r,pointIndexStart:e,pointIndexEnd:a}}))}}return o}_updateSymbolsForTheme(){const e=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",e),hover:this.symbols.vertices.hover?.clone().set("color",e)},midpoints:{...this.symbols.midpoints}};for(const t of this.vertexGraphics)this._isSelected(t)?t.symbol=this.symbols.vertices.selected:this._hoverGraphic===t?t.symbol=this.symbols.vertices.hover:t.symbol=this.symbols.vertices.default}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map(({geometry:e})=>({x:e.x,y:e.y}));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i).items;e&&"multipoint"!==t.geometry?.type&&r.push(t),this._mover=new I({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:e}=this;null!=e&&0!==e.length&&(this._connectedReshapeManager=new S({providerFactories:e,view:this.view}))}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick?.(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const{dx:t,dy:i,graphic:s}=e,o=this._connectedReshapeManager,r=o?W(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(e),this._emitMoveStartEvent(t,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(t,i)}))}const{selectedVertices:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),t=this._createVertexFromMidpoint(s);this._emitVertexAddEvent([s],e,t)}this._addToSelection(s)}this._setUpOperation(e),r&&o?.startVertexMove(r,$(n)),this._emitReshapeStartEvent(s),this._onHandleMove(s,t,i,e,()=>{this._updateTooltip(s,e.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e;t.totalDx+=i,t.totalDy+=s;const{operationType:r}=t,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(o,e.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,e,()=>{this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const t=B(n);this._updateVertexGraphicLocations(t);const{dxMap:o,dyMap:r}=w(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,e.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(e){const t=this._activeOperationInfo;if(!t)return;const{dx:i,dy:s,graphic:o}=e,{operationType:r}=t;t.totalDx+=i,t.totalDy+=s,this._onHandleMove(o,i,s,e,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(e){const{_coordinateHelper:t}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=t.arrayToPoint(e[s][o])}this._updateMidpointGraphicLocations(e)}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,r=e[i];t.geometry=this._getMidpoint(r[s],r[o])}}_getMidpoint(e,t){const{_coordinateHelper:i}=this,s=i.arrayToVector(e),o=i.arrayToVector(t),r=i.toXYZ(s),n=i.toXYZ(o),[a,h,p]=f(r,n),c=i.hasM()?0:void 0;return new g({x:a,y:h,z:p,m:c,spatialReference:i.spatialReference})}_getVertexFromEditGeometry(e){h(this._editGeometryOperations);const[t,i]=J(e);return this._editGeometryOperations.data.parts[t].vertices[i]}_onHandleMove(e,t,s,o,r){p(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=e.geometry,h="graphic-move-stop"===o.type;if(a&&G(a))if(null!=this.snappingManager&&this.selectedVertices.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(e,new g(this._stagedVertex),t,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(e,i,t,s,h),r()}}_syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(t),h=this._getVertexFromEditGeometry(e),p=n.getZ(a),c=a[0]-h.pos[0],l=a[1]-h.pos[1],d=null!=p?p-h.pos[2]:0;if(this._editGeometryOperations?.moveVertices([h],c,l,d),this._connectedReshapeManager?.translate(c,l,d),"point"===r.type)e.geometry=t;else if("mesh"===r.type)e.geometry=r.centerAt(t);else{const[a,h]=J(e);let p=x(r);const c=p[a].length-1,l=n.pointToArray(t);if(p[a][h]=l,"polygon"===r.type&&(0===h?p[a][c]=l:h===c&&(p[a][0]=l)),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,l),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p)),"multipoint"===r.type&&r.points)for(let e=0;e<p.length;e++)r.points[e]=p[e][0];this._updateGraphicGeometry(r.clone()),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i){const{relatedGraphicIndices:s}=t.attributes;for(const o of s){const s=this.vertexGraphics.at(o),{pathIndex:r,pointIndex:n}=s.attributes;e[r][n]=i,s.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=r.attributes,h=E(r.geometry,i,s,this.view),p=x(h),c=e[t].length-1;e[t][n]=p,r.geometry=h,o&&(0===n?e[t][c]=p:n===c&&(e[t][0]=p));for(const i of a){const t=this.vertexGraphics.at(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=p,t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._hoverGraphic=t;const i=this._isVertex(t);i&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateTooltip(i?t:null),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._hoverGraphic=null,this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.removeHandles(q),this._updateTooltip()}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(null==s||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:h}=e.attributes,p=x(e.geometry),c=0===h?a+1:h,l=x(o);return l[n].splice(c,0,p),e.attributes={...t,pathIndex:n,pointIndex:c,relatedGraphicIndices:[]},r.push({coordinates:l[n][c],componentIndex:n,vertexIndex:c}),this._updateGraphicGeometry(o),r}_addToSelection(e){const t=Q(e);for(const i of t)i.symbol=this.symbols.vertices.selected,this.selectedVertices.add(i),this._updateTooltip(i);this._emitSelectEvent(t)}_removeFromSelection(e,t){const{vertices:i}=this.symbols,s=t?i.hover:i.default;this.selectedVertices.remove(e),e.symbol=s,this._emitDeselectEvent([e]),this._updateTooltip()}_clearSelection(){const e=this.selectedVertices.toArray();if(e.length>0){for(const t of e)t.set("symbol",this.symbols.vertices.default);this.selectedVertices.removeAll(),this._emitDeselectEvent(e),this._updateTooltip()}}_keyDownHandler(e){null==this._activeOperationInfo&&Z(e,this.tooltip)||z.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const t=this.graphic.geometry,i=this.vertexGraphics.length;if(null==t||"polygon"!==t.type&&"polyline"!==t.type&&"multipoint"!==t.type)return;if("polygon"===t.type&&i<4||"multipoint"===t.type&&i<2||"polyline"===t.type&&i<3)return;const s=this.graphic.clone(),o=t.clone();let r=x(o);const n=[],a=Q(e);for(const h of a){const{x:e,y:t}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=s[o];e===a&&t===h&&(n.push({coordinates:r[i][o],componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1))}}}if("polygon"===o.type)r=r.filter(e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,o]=e[e.length-1];return(2!==e.length||t!==s||i!==o)&&(t===s&&i===o||e.push(e[0]),!0)}),o.rings=r;else if("polyline"===o.type){for(const e of r)1===e.length&&r.splice(r.indexOf(e),1);o.paths=r}else o.points=r.flat();this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){const t=this._isMidpoint(e)?"copy":"move";this.addHandles(this.view.acquireCursor(t,"high"),q)}_updateTooltip(e,t){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedVertex?i=r.selectedVertex:e===this.graphic?(i=r.translateGraphic,R(i,o,this._tooltipsContext,t)):e&&this.selectedVertices.length>1&&(i=r.translateVertices,j(i,o,n,this._tooltipsContext,t)),this.activeTooltipInfo=i}_updateGraphicGeometry(e){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=e,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(e,t){const i={type:"move-start",mover:this.graphic,dx:e,dy:t};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(e,t){const i={type:"move",mover:this.graphic,dx:e,dy:t};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(e,t){if(null==e||null==t){const i=this._activeOperationInfo;if(!i)return;e=i.totalDx,t=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:e,dy:t};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(e){const t={type:"reshape-start",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-start",t),this.callbacks.onReshapeStart?.(t)}_emitReshapeEvent(e){const t={type:"reshape",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape",t),this.callbacks.onReshape?.(t)}_emitReshapeStopEvent(e){const t={type:"reshape-stop",graphic:this.graphic,mover:e,selected:this.selectedVertices.toArray()};this.emit("reshape-stop",t),this.callbacks.onReshapeStop?.(t)}_emitSelectEvent(e){const t={type:"vertex-select",added:e};this.emit("select",t),this.callbacks.onVertexSelect?.(t)}_emitDeselectEvent(e){const t={type:"vertex-deselect",removed:e};this.emit("deselect",t),this.callbacks.onVertexDeselect?.(t)}_emitVertexAddEvent(e,t,i){const s={type:"vertex-add",added:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(e,t,i){const s={type:"vertex-remove",removed:e,graphic:this.graphic,oldGraphic:t,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function B(e){const t=x(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}function J({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}function Q(e){return e instanceof t?[e]:[...e]}function W(e){const t=e.sourceLayer??e.layer;return k(t)?{graphic:e,layer:t}:null}function $(e){return e.toArray().map(e=>({pathIndex:e.attributes.pathIndex,vertexIndex:e.attributes.pointIndex}))}e([y()],K.prototype,"_activeOperationInfo",void 0),e([y()],K.prototype,"_connectedReshapeManager",void 0),e([y()],K.prototype,"_coordinateHelper",null),e([y()],K.prototype,"_editGeometryOperations",void 0),e([y()],K.prototype,"tooltip",void 0),e([y()],K.prototype,"tooltipInfos",void 0),e([y()],K.prototype,"activeTooltipInfo",void 0),e([y({constructOnly:!0})],K.prototype,"automaticAreaMeasurementUtils",void 0),e([y({constructOnly:!0})],K.prototype,"automaticLengthMeasurementUtils",void 0),e([y()],K.prototype,"_selectedVertex",null),e([y()],K.prototype,"_tooltipsContext",null),e([y()],K.prototype,"callbacks",void 0),e([y()],K.prototype,"connectedReshapeProviders",void 0),e([y()],K.prototype,"enableMidpoints",void 0),e([y()],K.prototype,"enableMovement",void 0),e([y()],K.prototype,"enableVertices",void 0),e([y()],K.prototype,"graphic",void 0),e([y()],K.prototype,"highlightName",void 0),e([y()],K.prototype,"highlightsEnabled",void 0),e([y()],K.prototype,"layer",void 0),e([y({readOnly:!0})],K.prototype,"midpointGraphics",void 0),e([y()],K.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],K.prototype,"selectedVertices",void 0),e([y()],K.prototype,"snappingManager",void 0),e([y({readOnly:!0})],K.prototype,"state",null),e([y()],K.prototype,"symbols",void 0),e([y({type:F})],K.prototype,"sketchOptions",void 0),e([y({readOnly:!0})],K.prototype,"type",void 0),e([y({readOnly:!0})],K.prototype,"vertexGraphics",void 0),e([y()],K.prototype,"view",void 0),K=e([_("esri.views.draw.support.Reshape")],K);const ee=K;export{ee as default};
5
+ import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as p,assertIsSome as h,abortMaybe as c}from"../../../core/maybe.js";import{pausable as l,when as d,watch as m,initial as v,sync as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import f from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as M}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as x,geometryToCoordinates as b}from"../../../geometry/support/coordsUtils.js";import{isPoint as C}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as S}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as w,toEllipticArc7 as E}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as O,isCircularArc as V,isEllipticArc4 as P,isBezierCurve as H,isCoordinate as k,isEllipticArc7 as R}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as I}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import j from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as L}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as U}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as A,cloneMove as F}from"./drawUtils.js";import D from"./GraphicMover.js";import z from"./HighlightHelper.js";import{addUniqueLayer as N,isConnectedReshapeSupportedLayer as K}from"./layerUtils.js";import{createTooltipInfos as q,connectTooltip as Z,updateTranslateTooltipInfo as $,updateTranslateVertexTooltipInfo as B}from"./reshapeTooltipUtils.js";import{defaultSymbols as J,createMidpointGraphics as Q,createVertexGraphics as W,createCurveControlPointGraphics as X,createCurveConstructionLineGraphics as Y,attributeKeys as tt,getMidpoint as et,controlPointKinds as it,saveUpdatedCurveOrCoordinate as st,toolIdAttribute as ot,splitCurve as rt,isSingleSegmentCircle as nt,isSingleSegmentEllipse as at}from"./reshapeUtils.js";import{ViewEventPriorities as pt}from"../../input/InputManager.js";import{createCoordinateHelper as ht}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as lt}from"../../interactive/editGeometry/EditGeometryOperations.js";import dt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as mt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as ut}from"../../interactive/tooltip/tooltipCommonUtils.js";const yt=Symbol();let _t=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=J,this.sketchOptions=new dt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new z({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=l(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(Et));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(Et(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,p=n.concat(r,a).items;i&&p.push(o),s?.set("graphics",p)},u),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=q(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;N(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),pt.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),Z(this.tooltip,()=>this._tooltipsContext),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=p(this._connectedReshapeManager),this.tooltip=p(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??ht(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t);this._editGeometryOperations=p(this._editGeometryOperations)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&x(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;null!=t&&"mesh"!==t.type&&"extent"!==t.type?this._editGeometryOperations??=lt.fromGeometry(t,2,{allowCurves:!0}):this._logGeometryTypeError()}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new j({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;h(i),this._snappingContext=new mt({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new L(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(yt)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=p(this._editGeometryOperations),this._snappingTask=c(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(p)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(p)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(p),i.drain(p)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=gt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=Q(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=W(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=X(t,this.symbols,this._coordinateHelper),i=Y(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(e),this.layer.addMany(i)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("outline.color",t),hover:this.symbols.controlPoints.hover?.clone().set("outline.color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[tt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new D({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new U({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Vt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&this._emitVertexAddEvent([s],e,i)}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,Pt(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=gt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=A(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(tt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=et(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=wt(s);null!=t&&null!=e&&s.getAttribute(tt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=wt(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(V(r)||P(r)){const i=O(t[e][o-1]),n=V(r)?w(i,r):I(i,r),[a,p]=S(n,.25);s.geometry=new g({x:a,y:p,spatialReference:this._coordinateHelper.spatialReference})}else if(H(r)){const t=s.getAttribute(tt.controlPointKind),[e,i]=t===it.bezier.cp1?r.b[1]:r.b[2];s.geometry=new g({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(tt.controlPointKind),[o,r]=wt(s),n=t[o],a=O(n[r-1]),p=O(n[r]),h=t[o][r];i===it.bezier.line1?s.geometry=new f({paths:[[[a[0],a[1]],[...h.b[1]]]],spatialReference:e}):s.geometry=new f({paths:[[[p[0],p[1]],[...h.b[2]]]],spatialReference:e})}}_getVertexFromEditGeometry(t){const[e,i]=wt(t);return h(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){c(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,p="graphic-move-stop"===o.type;if(a&&C(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!p){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,p),r(),this._snappingTask=i(async i=>{const h=await o.snap({point:a,context:n,signal:i});h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,p),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,p),r()}}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),p=this._getVertexFromEditGeometry(t);if(p){const t=n.getZ(a),e=a[0]-p.pos[0],i=a[1]-p.pos[1],s=null!=t?t-p.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([p],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,p]=wt(t);let h=ft(r);const c=n.pointToArray(e);this._updateGeometryFromGraphic(t,h,a,p,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(h=this._moveRelatedCoordinates(h,t,c),h=this._moveSelectedHandleCoordinates(h,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(h),this._updateCurveGraphicLocations(h)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(h),st(r,h)}this._updateGraphicGeometry(r.clone()),this._editGeometryOperations=lt.fromGeometry(r,2,{allowCurves:!0}),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=wt(s);St(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=wt(n),p=n.getAttribute(tt.relatedGraphicIndices),h=F(n.geometry,i,s,this.view),c=b(h);if(n.geometry=h,this._updateGeometryFromGraphic(n,t,e,a,c,r,o),p?.length)for(const i of p){const e=this.vertexGraphics.at(i),[s,o]=wt(e);St(t,s,o,c,r),e.geometry=h}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?Mt(e,i,s,[o[0],o[1]],t.getAttribute(tt.controlPointKind)):(St(e,i,s,o,r),n&&(0===s?St(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(yt),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[tt.pathIndex]:r,[tt.pointIndexStart]:n,[tt.pointIndexEnd]:a}=e.attributes,p=b(e.geometry),h=0===a?n+1:a;e.attributes={[tt.tool]:ot,[tt.pathIndex]:r,[tt.pointIndex]:h,[tt.relatedGraphicIndices]:[]};const c=ft(s),l=c[r][a];if(k(l)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(c[r][h]),i=this._getPerpendicularOffset(t,p);c[r].splice(h,1,{c:[t,i]}),e.setAttribute(tt.controlPointKind,it.circle.interior),e.setAttribute(tt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),st(s,c)}else c[r].splice(h,0,p),o.push({coordinates:c[r][h],componentIndex:r,vertexIndex:h})}else{const t=O(c[r][n]),e=rt(t,l,.5,this._coordinateHelper);c[r].splice(a,1,...e),o.push({coordinates:O(c[r][h]),componentIndex:r,vertexIndex:h})}return this._updateGraphicGeometry(s),o}_getPerpendicularOffset(t,e){const i=t[0]-e[0],s=t[1]-e[1],o=Math.hypot(i,s);if(Number.isNaN(o)||o<1e-8)return[e[0],e[1]];const r=this.view.pixelSizeAt(this._coordinateHelper.arrayToPoint(e)),n=[-s/o,i/o];return[e[0]+n[0]*r,e[1]+n[1]*r]}_addToSelection(t){const e=Ot(t);for(const i of e)i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&ut(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&this._removeVertices(this.selectedManipulators)}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=ft(o);const n=[],a=Ot(t);for(const p of a){if(this._isCurveControlPoint(p))continue;const{x:t,y:e}=p.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,p]=O(s[o]);if(t===a&&e===p){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!k(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const p of r)1===p.length&&r.splice(r.indexOf(p),1);st(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),yt)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,$(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,B(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function gt(t){const e=ft(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!k(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function ft(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Gt(t,e,i,s){const o=t[e][i];if(V(o))o.c[1]=s;else if(P(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function Mt(t,e,i,s,o){switch(o){case it.circle.interior:Gt(t,e,i,s);break;case it.bezier.cp1:t[e][i].b[1]=s;break;case it.bezier.cp2:t[e][i].b[2]=s}}function xt(t,e){return t<1e-8*e}function bt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[p,h]=t,[c,l]=n,d=c-p,m=l-h;e-=p,i-=h;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],M=_*G-g*f,x=(d**2+m**2)/2;if(xt(Math.abs(M),x))return[(p+c)/2,(h+l)/2];const[b,C]=[G/M*x,-f/M*x],S=b**2+C**2,[w,E]=[d/2-b,m/2-C];if(xt(w**2+E**2,S)){const[t,e]=v?[-C,b]:[C,-b];return[t+b+p,e+C+h]}const O=Math.sqrt((b**2+C**2)/(w**2+E**2))*Math.sign(d*u+m*y);return[w*O+b+p,E*O+C+h]}function Ct(t,e,i){const s=G(new f({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=M(s,i),r=o[0][1];return R(r)?r:E(t,r)}function St(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(nt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(at(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,p=Math.hypot(n-o,a-r),[h,c]=[n-o,a-r],l=T(c,h);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,l,p,i.a[6]]})}const a=O(r);if(k(r))r.splice(0,r.length,...s);else if(H(r))r.b[0].splice(0,r.b[0].length,...s);else if(V(r)||P(r)){const o=O(t[e][i-1]),n=V(r)?w(o,r):I(o,r);t[e].splice(i,1,{c:[[...s],bt(o,n,s,!0)]})}else if(R(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Ct(n,r,o).a}if(n&&!k(n)&&!H(r))if(V(n)||P(n)){const o=O(n),r=V(n)?w(a,n):I(a,n);t[e].splice(i+1,1,{c:[o,bt(o,r,s,!1)]})}else if(R(n)){const t=O(r);n.a=Ct(t,n,o).a}}function wt({attributes:t}){return[t?.[tt.pathIndex]||0,t?.[tt.pointIndex]||0]}function Et({attributes:t}){return`${t?.[tt.pathIndex]}-${t?.[tt.pointIndex]}`}function Ot(t){return t instanceof e?[t]:[...t]}function Vt(t){const e=t.sourceLayer??t.layer;return K(e)?{graphic:t,layer:e}:null}function Pt(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[tt.pathIndex],vertexIndex:t[tt.pointIndex]}))}t([y()],_t.prototype,"_activeOperationInfo",void 0),t([y()],_t.prototype,"_connectedReshapeManager",void 0),t([y()],_t.prototype,"_coordinateHelper",null),t([y()],_t.prototype,"_editGeometryOperations",void 0),t([y()],_t.prototype,"tooltip",void 0),t([y()],_t.prototype,"tooltipInfos",void 0),t([y()],_t.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],_t.prototype,"_selectedManipulator",null),t([y()],_t.prototype,"_tooltipsContext",null),t([y()],_t.prototype,"callbacks",void 0),t([y()],_t.prototype,"connectedReshapeProviders",void 0),t([y()],_t.prototype,"enableMidpoints",void 0),t([y()],_t.prototype,"enableCurveOnMidpoint",void 0),t([y()],_t.prototype,"enableMovement",void 0),t([y()],_t.prototype,"enableVertices",void 0),t([y()],_t.prototype,"graphic",void 0),t([y()],_t.prototype,"highlightName",void 0),t([y()],_t.prototype,"highlightsEnabled",void 0),t([y()],_t.prototype,"layer",void 0),t([y()],_t.prototype,"snappingManager",void 0),t([y({readOnly:!0})],_t.prototype,"state",null),t([y()],_t.prototype,"symbols",void 0),t([y({type:dt})],_t.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],_t.prototype,"type",void 0),t([y({readOnly:!0})],_t.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"selectedManipulators",void 0),t([y()],_t.prototype,"view",void 0),_t=t([_("esri.views.draw.support.Reshape")],_t);const Ht=_t;export{Ht as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t}from"../../../core/mathUtils.js";import{create as n,center as r}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as o}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as e}from"../../../geometry/support/coordsUtils.js";import{toEllipticArc7 as i}from"../../../geometry/support/curves/circularArcUtils.js";import{isCurvedGeometry as s,getEndpoint as c,isCoordinate as u,isBezierCurve as m,isCircularArc as a}from"../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as l}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{getScaleTransform as p}from"../../interactive/editGeometry/operations/curveOperationUtils.js";function f(t,n,r,o){if(null==o||t.hasZ||(o=void 0),"point"===t.type)return t.x+=n,t.y+=r,t.hasZ&&null!=o&&(t.z+=o),t;if("multipoint"===t.type){const e=t.points;for(let t=0;t<e.length;t++)e[t]=h(e[t],n,r,o);return t}if("extent"===t.type)return t.xmin+=n,t.xmax+=n,t.ymin+=r,t.ymax+=r,null!=o&&(t.zmin??=0,t.zmin+=o,t.zmax??=0,t.zmax+=o),t;const e="polyline"===t.type?t.curvePaths??t.paths:t.curveRings??t.rings,i=s(t);for(let s=0;s<e.length;s++){const t=e[s];for(let e=0;e<t.length;e++)t[e]=g(t[e],n,r,o)}return"paths"in t?i?t.curvePaths=e:t.paths=e:i?t.curveRings=e:t.rings=e,t}function y(t,n,r,o,e){const i=t.clone();if(e){const{resolution:t}=o;f(i,n*t,-r*t)}else{const{dxMap:t,dyMap:e}=x(n,r,o);f(i,t,e)}return i}function x(t,n,r){const o=r.state.inverseTransform;return{dxMap:o[0]*t+o[2]*n,dyMap:o[1]*t+o[3]*n}}function h(t,n,r,o){return b(t,t[0]+n,t[1]+r,null!=t[2]&&null!=o?t[2]+o:void 0)}function g(t,n,r,o){const e=h(c(t),n,r,o);if(u(t))return e;if(m(t)){const[,o,i]=t.b;return{b:[e,[o[0]+n,o[1]+r],[i[0]+n,i[1]+r]]}}if(a(t)){const[,o]=t.c;return{c:[e,[o[0]+n,o[1]+r]]}}const[,i,...s]=t.a;return{a:[e,[i[0]+n,i[1]+r],...s]}}function v(t,i,s,c){if("point"===t.type){const{x:n,y:r}=t,o=c?c[0]:n,e=c?c[1]:r,u=t.clone(),m=(n-o)*i+o,a=(r-e)*s+e;return u.x=m,u.y=a,u}if("extent"===t.type){const{xmin:n,xmax:r,ymin:o,ymax:e}=t,u=c?c[0]:(n+r)/2,m=c?c[1]:(e+o)/2,a=t.clone();if(a.xmin=(n-u)*i+u,a.ymax=(e-m)*s+m,a.xmax=(r-u)*i+u,a.ymin=(o-m)*s+m,a.xmin>a.xmax){const t=a.xmin,n=a.xmax;a.xmin=n,a.xmax=t}if(a.ymin>a.ymax){const t=a.ymin,n=a.ymax;a.ymin=n,a.ymax=t}return a}let u=null;if(!c){u=e(t);const r=n(),i=o(r,u);if(!i)return t.clone();const[s,m,a,l]=i;c=[(s+a)/2,(m+l)/2]}const[m,a]=c;if("multipoint"===t.type){const n=t.clone(),r=n.points;for(let t=0;t<r.length;t++){const n=r[t],[o,e]=n,c=(o-m)*i+m,u=(e-a)*s+a;r[t]=b(n,c,u,void 0)}return n.points=r,n}const l=t.clone();u??=e(t);const p="polygon"===l.type?l.curveRings??l.rings:l.curvePaths??l.paths;if(!c){const t=n(),e=o(t,p,!1,!1);if(!e)return l;c=r(e)}for(const n of p){let t=null;for(let r=0;r<n.length;r++){const o=n[r];n[r]=d(o,i,s,m,a,t),t=o}}return l}function M(t,n,r,o,e){const[i,s,...c]=t;return[(i-o)*n+o,(s-e)*r+e,...c]}function d(t,n,r,o,e,s){if(u(t))return M(t,n,r,o,e);if(m(t)){const[i,s,c]=t.b.map(t=>M(t,n,r,o,e));return{b:[i,s,c]}}if(!s)return t;const f=c(s),y=a(t)?i(f,t):t,[x,h,g,v,d,j,U]=y.a,b=d??0,z=j??Math.hypot(x[0]-h[0],x[1]-h[1]),R=U??1,P=p(o,e,1,0,0,1,n,r);return l(f,{a:[[...x],[...h],g,v,b,z,R]},P)}function j(t,n,r,o,e,i){const s=Math.sqrt((r-t)*(r-t)+(o-n)*(o-n));return Math.sqrt((e-t)*(e-t)+(i-n)*(i-n))/s}function U(n,r,o,e=!1){const i=Math.atan2(r.y-o.y,r.x-o.x)-Math.atan2(n.y-o.y,n.x-o.x),s=Math.atan2(Math.sin(i),Math.cos(i));return e?s:t(s)}function b(t,n,r,o){const e=[n,r];return t.length>2&&e.push(null!=o?o:t[2]),t.length>3&&e.push(t[3]),e}export{y as cloneMove,U as getRotationAngle,j as getScaleRatio,f as move,v as scale,x as screenDeltaToMapDelta};
5
+ import{equals as t}from"../../../core/arrayUtils.js";import{rad2deg as n}from"../../../core/mathUtils.js";import{create as r,center as o}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as e}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as i}from"../../../geometry/support/coordsUtils.js";import{toEllipticArc7 as s}from"../../../geometry/support/curves/circularArcUtils.js";import{isCurvedGeometry as c,getEndpoint as u,isCoordinate as a,isBezierCurve as m,isCircularArc as l}from"../../../geometry/support/curves/curveUtils.js";import{transformEllipticArc as p}from"../../../geometry/support/curves/ellipticArc7Utils.js";import{getScaleTransform as f}from"../../interactive/editGeometry/operations/curveOperationUtils.js";function y(t,n,r,o){if(null==o||t.hasZ||(o=void 0),"point"===t.type)return t.x+=n,t.y+=r,t.hasZ&&null!=o&&(t.z+=o),t;if("multipoint"===t.type){const e=t.points;for(let t=0;t<e.length;t++)e[t]=g(e[t],n,r,o);return t}if("extent"===t.type)return t.xmin+=n,t.xmax+=n,t.ymin+=r,t.ymax+=r,null!=o&&(t.zmin??=0,t.zmin+=o,t.zmax??=0,t.zmax+=o),t;const e="polyline"===t.type?t.curvePaths??t.paths:t.curveRings??t.rings,i=c(t);for(let s=0;s<e.length;s++){const t=e[s];for(let e=0;e<t.length;e++)t[e]=v(t[e],n,r,o)}return"paths"in t?i?t.curvePaths=e:t.paths=e:i?t.curveRings=e:t.rings=e,t}function x(t,n,r,o,e){const i=t.clone();if(e){const{resolution:t}=o;y(i,n*t,-r*t)}else{const{dxMap:t,dyMap:e}=h(n,r,o);y(i,t,e)}return i}function h(t,n,r){const o=r.state.inverseTransform;return{dxMap:o[0]*t+o[2]*n,dyMap:o[1]*t+o[3]*n}}function g(t,n,r,o){return z(t,t[0]+n,t[1]+r,null!=t[2]&&null!=o?t[2]+o:void 0)}function v(t,n,r,o){const e=g(u(t),n,r,o);if(a(t))return e;if(m(t)){const[,o,i]=t.b;return{b:[e,[o[0]+n,o[1]+r],[i[0]+n,i[1]+r]]}}if(l(t)){const[,o]=t.c;return{c:[e,[o[0]+n,o[1]+r]]}}const[,i,...s]=t.a;return{a:[e,[i[0]+n,i[1]+r],...s]}}function M(n,s,c,a){if("point"===n.type){const{x:t,y:r}=n,o=a?a[0]:t,e=a?a[1]:r,i=n.clone(),u=(t-o)*s+o,m=(r-e)*c+e;return i.x=u,i.y=m,i}if("extent"===n.type){const{xmin:t,xmax:r,ymin:o,ymax:e}=n,i=a?a[0]:(t+r)/2,u=a?a[1]:(e+o)/2,m=n.clone();if(m.xmin=(t-i)*s+i,m.ymax=(e-u)*c+u,m.xmax=(r-i)*s+i,m.ymin=(o-u)*c+u,m.xmin>m.xmax){const t=m.xmin,n=m.xmax;m.xmin=n,m.xmax=t}if(m.ymin>m.ymax){const t=m.ymin,n=m.ymax;m.ymin=n,m.ymax=t}return m}let m=null;if(!a){m=i(n);const t=r(),o=e(t,m);if(!o)return n.clone();const[s,c,u,l]=o;a=[(s+u)/2,(c+l)/2]}const[l,p]=a;if("multipoint"===n.type){const t=n.clone(),r=t.points;for(let n=0;n<r.length;n++){const t=r[n],[o,e]=t,i=(o-l)*s+l,u=(e-p)*c+p;r[n]=z(t,i,u,void 0)}return t.points=r,t}const f=n.clone();m??=i(n);const y="polygon"===f.type,x=y?f.curveRings??f.rings:f.curvePaths??f.paths;if(!a){const t=r(),n=e(t,x,!1,!1);if(!n)return f;a=o(n)}for(const r of x){let n=null;const o=y&&r.length>0&&t(u(r[0]),u(r.at(-1)));for(let t=0;t<r.length;t++){const o=r[t];r[t]=j(o,s,c,l,p,n),n=o}o&&(r[0]=[...u(r.at(-1))])}return f}function d(t,n,r,o,e){const[i,s,...c]=t;return[(i-o)*n+o,(s-e)*r+e,...c]}function j(t,n,r,o,e,i){if(a(t))return d(t,n,r,o,e);if(m(t)){const[i,s,c]=t.b.map(t=>d(t,n,r,o,e));return{b:[i,s,c]}}if(!i)return t;const c=u(i),y=l(t)?s(c,t):t,[x,h,g,v,M,j,U]=y.a,b=M??0,z=j??Math.hypot(x[0]-h[0],x[1]-h[1]),R=U??1,P=f(o,e,1,0,0,1,n,r);return p(c,{a:[[...x],[...h],g,v,b,z,R]},P)}function U(t,n,r,o,e,i){const s=Math.sqrt((r-t)*(r-t)+(o-n)*(o-n));return Math.sqrt((e-t)*(e-t)+(i-n)*(i-n))/s}function b(t,r,o,e=!1){const i=Math.atan2(r.y-o.y,r.x-o.x)-Math.atan2(t.y-o.y,t.x-o.x),s=Math.atan2(Math.sin(i),Math.cos(i));return e?s:n(s)}function z(t,n,r,o){const e=[n,r];return t.length>2&&e.push(null!=o?o:t[2]),t.length>3&&e.push(t[3]),e}export{x as cloneMove,b as getRotationAngle,U as getScaleRatio,y as move,M as scale,h as screenDeltaToMapDelta};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{connectPasteEvent as s,getXYZDeltasFromTooltipInfo as c}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as l}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as p}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as m}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as u}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as f}from"../../support/euclideanLengthMeasurementUtils.js";function y(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new l(e),selectedVertex:new p(e),translateGraphic:new m(e),translateVertices:new u(e)}}function v(e,r){function a(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let c=!1;function l(t){c||(c=!0,t(),c=!1)}return t([o(()=>{const t=a();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}},({context:t})=>{l(()=>{g(t),e.info=t.activeTooltipInfo})},n),o(()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}},(t,e)=>{t&&e&&t.key!==e.key&&l(()=>T(t.context))},i),s(e,{onBeforePaste:()=>{c=!0},onAfterPaste:()=>{T(a()),c=!1}})])}function g(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return h(e,t);case"selected-vertex":return d(e,t)}e.sketchOptions=t.sketchOptions}}function h(t,{graphic:e}){x(t,e,e?.geometry)}function d(t,{graphic:e,selectedVertex:o,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:i}){x(t,e,o?.geometry);const r=e?.geometry;switch(r?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=n.autoArea2D(r);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=i.autoLength2D(r),t.area.visible=!1;break;case"multipoint":t.geometryType="multipoint",t.area.visible=!1,t.totalLength.visible=!1}}function x(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=f(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function T(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:s}=c(e,n);if(0===i&&0===r&&0===s)return;const{x:l,y:p,z:m,m:u,spatialReference:f}=n,y=new a({x:l+i,y:p+r,z:null!=m?m+s:void 0,m:u,spatialReference:f});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function j(t,e,o,n){t.clear(),w(t,e,n,o)}function k(t,e,o,n,i){t.clear();const{automaticAreaMeasurementUtils:r,automaticLengthMeasurementUtils:a}=n;"polygon"===o?.type?t.area=r.autoArea2D(o):"polyline"===o?.type&&(t.totalLength=a.autoLength2D(o)),w(t,e,i,n)}function w(t,o,n,{automaticLengthMeasurementUtils:i}){if(!n)return;const{x:a,y:s}=n.origin,c=o.toMap(n),l=o.toMap(r(a,s)),p=i.autoDistanceBetweenPoints2D(l,c);t.distance=null!=p?p:e}export{v as connectTooltip,y as createTooltipInfos,j as updateTranslateTooltipInfo,k as updateTranslateVertexTooltipInfo};
5
+ import{handlesGroup as t}from"../../../core/handleUtils.js";import{zeroMeters as e}from"../../../core/quantityUtils.js";import{watch as o,syncAndInitial as n,sync as i}from"../../../core/reactiveUtils.js";import{createScreenPoint as r}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{isCurvedGeometry as s}from"../../../geometry/support/curves/curveUtils.js";import{connectPasteEvent as c,getXYZDeltasFromTooltipInfo as l}from"../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as p}from"../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{SelectedVertexTooltipInfo as m}from"../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as u}from"../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateVertexTooltipInfo as f}from"../../interactive/tooltip/infos/TranslateVertexTooltipInfo.js";import{elevationFromPoint as y}from"../../support/euclideanLengthMeasurementUtils.js";function v(t){const e={sketchOptions:t,viewType:"2d"};return{movePoint:new p(e),selectedVertex:new m(e),translateGraphic:new u(e),translateVertices:new f(e)}}function g(e,r){function a(){const t=r(),e=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:e}}let s=!1;function l(t){s||(s=!0,t(),s=!1)}return t([o(()=>{const t=a();return{context:t,geometry:t.graphic?.geometry,vertexGeometry:t.selectedVertex?.geometry}},({context:t})=>{l(()=>{h(t),e.info=t.activeTooltipInfo})},n),o(()=>{const t=a(),{activeTooltipInfo:e}=t;if(e&&"key"in e)return{context:t,key:e.key}},(t,e)=>{t&&e&&t.key!==e.key&&l(()=>j(t.context))},i),c(e,{onBeforePaste:()=>{s=!0},onAfterPaste:()=>{j(a()),s=!1}})])}function h(t){const e=t.activeTooltipInfo;if(e){switch(e?.type){case"move-point":return d(e,t);case"selected-vertex":return x(e,t)}e.sketchOptions=t.sketchOptions}}function d(t,{graphic:e}){T(t,e,e?.geometry)}function x(t,{graphic:e,selectedVertex:o,automaticAreaMeasurementUtils:n,automaticLengthMeasurementUtils:i}){T(t,e,o?.geometry);const r=e?.geometry;if(!r||!s(r))switch(r?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=n.autoArea2D(r);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=i.autoLength2D(r),t.area.visible=!1;break;case"multipoint":t.geometryType="multipoint",t.area.visible=!1,t.totalLength.visible=!1}}function T(t,e,o){e&&"point"===o?.type&&(t.setLocationFromPoint(o),t.elevation.actual=y(o),t.elevation.visible=!!e.geometry?.hasZ,t.elevation.readOnly=!1,t.elevation.showAsZ=!0)}function j(t){function e(e,o){const n=o?.geometry;if(!n||"point"!==n.type)return;const{dx:i,dy:r,dz:s}=l(e,n);if(0===i&&0===r&&0===s)return;const{x:c,y:p,z:m,m:u,spatialReference:f}=n,y=new a({x:c+i,y:p+r,z:null!=m?m+s:void 0,m:u,spatialReference:f});t.updateGeometry(o,y,n,i,r)}const{activeTooltipInfo:o,graphic:n,selectedVertex:i}=t;switch(o?.type){case"move-point":return e(o,n);case"selected-vertex":return e(o,i)}}function U(t,e,o,n){t.clear(),w(t,e,n,o)}function k(t,e,o,n,i){if(t.clear(),o&&s(o))return;const{automaticAreaMeasurementUtils:r,automaticLengthMeasurementUtils:a}=n;"polygon"===o?.type?t.area=r.autoArea2D(o):"polyline"===o?.type&&(t.totalLength=a.autoLength2D(o)),w(t,e,i,n)}function w(t,o,n,{automaticLengthMeasurementUtils:i}){if(!n)return;const{x:a,y:s}=n.origin,c=o.toMap(n),l=o.toMap(r(a,s)),p=i.autoDistanceBetweenPoints2D(l,c);t.distance=null!=p?p:e}export{g as connectTooltip,v as createTooltipInfos,U as updateTranslateTooltipInfo,k as updateTranslateVertexTooltipInfo};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import e from"../../../Graphic.js";import{equals as t}from"../../../core/arrayUtils.js";import o from"../../../geometry/Point.js";import r from"../../../geometry/Polyline.js";import{getMidpoint as i}from"../../../geometry/support/coordsUtils.js";import{isMultipoint as n,isPolygon as s,isPolyline as c}from"../../../geometry/support/typeUtils.js";import{interpolateBezierCurve as l,splitBezierCurve as a}from"../../../geometry/support/curves/bezierCurveUtils.js";import{interpolateCircle as p}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as u,splitCircularArc as m}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as d,isCoordinate as f,isBezierCurve as h,isEllipticArc4 as y,isCircularArc as v,isEllipticArc as g,isEllipticArc7 as x}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as b,splitEllipticArc4 as w}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{deriveEllipse as z,interpolateEllipse as I,splitEllipticArc7 as j}from"../../../geometry/support/curves/ellipticArc7Utils.js";import P from"../../../symbols/SimpleLineSymbol.js";import S from"../../../symbols/SimpleMarkerSymbol.js";import{settings as C}from"./settings.js";const R={pathIndex:"pathIndex",pointIndex:"pointIndex",pointIndexStart:"pointIndexStart",pointIndexEnd:"pointIndexEnd",controlPointKind:"kind",relatedGraphicIndices:"relatedGraphicIndices",curveFromStraightEdgeFlag:"curveFromStraightEdgeFlag",tool:"esriSketchTool"},U={bezier:{cp1:"bezier-cp-1",cp2:"bezier-cp-2",line1:"bezier-line-1",line2:"bezier-line-2"},circle:{interior:"circle-interior"}},k="box",E=C.reshapeGraphics,T={vertices:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},controlPoints:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.outlineColor,outline:{color:E.vertex.color,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverOutlineColor,outline:{color:E.vertex.hoverColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.outlineColor,outline:{color:E.selected.color,width:1}})},midpoints:{default:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}}),hover:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}})},constructionLines:new P({style:"solid",width:1,color:E.vertex.color})};function K(t,o,r){const i=[];return t?.forEach((t,n)=>{t.forEach((t,s)=>{i.push(new e({geometry:r.arrayToPoint(d(t)),symbol:o?.vertices?.default,attributes:{[R.tool]:k,[R.pathIndex]:n,[R.pointIndex]:s}}))})}),i}function F(t,o,r){const i=[];for(let n=0;n<t.length;n++){const s=t[n];if(!Z(t,n))for(let t=1;t<s.length;t++){const c=s[t];if(f(c))continue;const l=d(s[t-1]),a={[R.tool]:k,[R.pathIndex]:n,[R.pointIndex]:t};if(h(c)){const t=c.b.slice(1);i.push(...t.map((t,i)=>new e({geometry:r.arrayToPoint(t),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:0===i?U.bezier.cp1:U.bezier.cp2}})))}const m=v(c),g=y(c);if(m||g){const t=m?u(l,c):b(l,c),n=p(t,.25);i.push(new e({geometry:r.arrayToPoint(n),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:U.circle.interior}}))}}}return i}function G(t,o,i){const n=[],{spatialReference:s}=i;for(let c=0;c<t.length;c++){const i=t[c];for(let t=1;t<i.length;t++){const l=i[t];if(!h(l))continue;const[a,p,u]=l.b,m=d(i[t-1]),f={[R.tool]:k,[R.pathIndex]:c,[R.pointIndex]:t};n.push(new e({geometry:new r({paths:[[[m[0],m[1]],p]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line1}}),new e({geometry:new r({paths:[[[a[0],a[1]],u]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line2}}))}}return n}function L(t,o,r,i){const n=[];for(let s=0;s<t.length;s++){const c=t[s],l=O(t,s);for(let t=0;t<c.length;t++){const a=(t+1)%c.length;if((!i||l)&&0===a)continue;const p=M(c[t],c[a],r);n.push(new e({geometry:p,symbol:o.midpoints.default,attributes:{[R.tool]:k,[R.pathIndex]:s,[R.pointIndexStart]:t,[R.pointIndexEnd]:a}}))}}return n}function M(e,t,r){const n=d(e),s=d(t),{spatialReference:c}=r,a=r.arrayToVector(n),m=r.arrayToVector(s),g=r.toXYZ(a),x=r.toXYZ(m),[w,j,P]=i(g,x),S=r.hasM()?0:void 0;if(f(t))return new o({x:w,y:j,z:P,m:S,spatialReference:c});if(h(t)){const[e,r]=l(n,t,.5);return new o({x:e,y:r,z:P,m:S,spatialReference:c})}if(v(t)){const e=u(n,t),[r,i]=p(e,.5);return new o({x:r,y:i,z:P,m:S,spatialReference:c})}if(y(t)){const e=b(n,t),[r,i]=p(e,.5);return new o({x:r,y:i,z:P,m:S,spatialReference:c})}const C=z(n,t),[R,U]=I(C,.5);return new o({x:R,y:U,z:P,m:S,spatialReference:c})}function Z(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&y(r[1])}function A(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&x(r[1])}function O(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&g(r[1])}function V(e,t){if(n(e))return void(e.points=t.flat());const o=t.some(e=>e.some(e=>!f(e)));s(e)?o?(e.curveRings=t,e.rings=[]):(e.rings=t,e.curveRings=void 0):c(e)&&(o?(e.curvePaths=t,e.paths=[]):(e.curvePaths=void 0,e.paths=t))}function X(e,t,o,r){const i=d(t);let n=[];switch(!0){case h(t):n=a(e,t,o);break;case v(t):{const r=u(e,t);n=m(r,t,o);break}case y(t):{const r=b(e,t);n=w(r,t,o);break}default:{const r=z(e,t);n=j(r,t,o);break}}if(n.length<2)return n;if(r.hasZ()){const t=e.at(2)??0,r=i.at(2)??0,s=t+(r-t)*o;d(n[0])[2]=s,d(n[1])[2]=r}if(r.hasM()){const e=r.hasZ()?3:2;d(n[0])[e]=0,d(n[1])[e]=i.at(-1)??0}return n}export{R as attributeKeys,U as controlPointKinds,G as createCurveConstructionLineGraphics,F as createCurveControlPointGraphics,L as createMidpointGraphics,K as createVertexGraphics,T as defaultSymbols,M as getMidpoint,Z as isSingleSegmentCircle,A as isSingleSegmentEllipse,O as isSingleSegmentPolygon,V as saveUpdatedCurveOrCoordinate,X as splitCurve,k as toolIdAttribute};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as o}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{Fields as e}from"./Fields.js";import{TooltipContent as r}from"./TooltipContent.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as i}from"../../../../widgets/support/jsxFactory.js";import"@arcgis/toolkit/dom";let s=class extends r{_renderContent(){const{fieldContext:o,info:t,mode:r}=this,{visibleElements:s}=t;return i(e,{context:o,fields:[s.elevation?t.elevation:void 0],mode:r})}};s=o([t("esri.views.interactive.tooltip.content.TooltipContentElevation")],s);export{s as TooltipContentElevation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{TooltipContentDrawCircle as t}from"./TooltipContentDrawCircle.js";import{TooltipContentDrawMesh as o}from"./TooltipContentDrawMesh.js";import{TooltipContentDrawPoint as n}from"./TooltipContentDrawPoint.js";import{TooltipContentDrawPolygon as e}from"./TooltipContentDrawPolygon.js";import{TooltipContentDrawPolyline as r}from"./TooltipContentDrawPolyline.js";import{TooltipContentDrawRectangle as i}from"./TooltipContentDrawRectangle.js";import{TooltipContentExtentRotate as a}from"./TooltipContentExtentRotate.js";import{TooltipContentExtentScale as l}from"./TooltipContentExtentScale.js";import{TooltipContentMovePoint as p}from"./TooltipContentMovePoint.js";import{TooltipContentReshapeEdgeOffset as s}from"./TooltipContentReshapeEdgeOffset.js";import{TooltipContentSelectedVertex as c}from"./TooltipContentSelectedVertex.js";import{TooltipContentTransformMesh as f}from"./TooltipContentTransformMesh.js";import{TooltipContentTransformPoint as m}from"./TooltipContentTransformPoint.js";import{TooltipContentTranslate as w}from"./TooltipContentTranslate.js";import{TooltipContentTranslateVertex as u}from"./TooltipContentTranslateVertex.js";import{TooltipContentTranslateXY as T}from"./TooltipContentTranslateXY.js";import{TooltipContentTranslateZ as C}from"./TooltipContentTranslateZ.js";function j(j,d){if(null==d)return null;const x=document.createElement("div");switch(d.type){case"draw-point":case"draw-multipoint":return new n({tooltip:j,info:d,container:x});case"draw-polygon":return new e({tooltip:j,info:d,container:x});case"draw-polyline":return new r({tooltip:j,info:d,container:x});case"draw-mesh":return new o({tooltip:j,info:d,container:x});case"draw-rectangle":return new i({tooltip:j,info:d,container:x});case"draw-circle":return new t({tooltip:j,info:d,container:x});case"extent-rotate":return new a({tooltip:j,info:d,container:x});case"extent-scale":return new l({tooltip:j,info:d,container:x});case"move-point":return new p({tooltip:j,info:d,container:x});case"selected-vertex":return new c({tooltip:j,info:d,container:x});case"transform-point":return new m({tooltip:j,info:d,container:x});case"transform-mesh":return new f({tooltip:j,info:d,container:x});case"translate":return new w({tooltip:j,info:d,container:x});case"translate-vertex":return new u({tooltip:j,info:d,container:x});case"translate-z":return new C({tooltip:j,info:d,container:x});case"translate-xy":return new T({tooltip:j,info:d,container:x});case"reshape-edge-offset":return new s({tooltip:j,info:d,container:x})}}export{j as tooltipContentFactory};
5
+ import{TooltipContentDrawCircle as t}from"./TooltipContentDrawCircle.js";import{TooltipContentDrawMesh as o}from"./TooltipContentDrawMesh.js";import{TooltipContentDrawPoint as n}from"./TooltipContentDrawPoint.js";import{TooltipContentDrawPolygon as e}from"./TooltipContentDrawPolygon.js";import{TooltipContentDrawPolyline as r}from"./TooltipContentDrawPolyline.js";import{TooltipContentDrawRectangle as i}from"./TooltipContentDrawRectangle.js";import{TooltipContentElevation as a}from"./TooltipContentElevation.js";import{TooltipContentExtentRotate as l}from"./TooltipContentExtentRotate.js";import{TooltipContentExtentScale as p}from"./TooltipContentExtentScale.js";import{TooltipContentMovePoint as s}from"./TooltipContentMovePoint.js";import{TooltipContentReshapeEdgeOffset as c}from"./TooltipContentReshapeEdgeOffset.js";import{TooltipContentSelectedVertex as f}from"./TooltipContentSelectedVertex.js";import{TooltipContentTransformMesh as m}from"./TooltipContentTransformMesh.js";import{TooltipContentTransformPoint as w}from"./TooltipContentTransformPoint.js";import{TooltipContentTranslate as u}from"./TooltipContentTranslate.js";import{TooltipContentTranslateVertex as T}from"./TooltipContentTranslateVertex.js";import{TooltipContentTranslateXY as C}from"./TooltipContentTranslateXY.js";import{TooltipContentTranslateZ as j}from"./TooltipContentTranslateZ.js";function d(d,x){if(null==x)return null;const h=document.createElement("div");switch(x.type){case"draw-point":case"draw-multipoint":return new n({tooltip:d,info:x,container:h});case"draw-polygon":return new e({tooltip:d,info:x,container:h});case"draw-polyline":return new r({tooltip:d,info:x,container:h});case"draw-mesh":return new o({tooltip:d,info:x,container:h});case"draw-rectangle":return new i({tooltip:d,info:x,container:h});case"draw-circle":return new t({tooltip:d,info:x,container:h});case"elevation":return new a({tooltip:d,info:x,container:h});case"extent-rotate":return new l({tooltip:d,info:x,container:h});case"extent-scale":return new p({tooltip:d,info:x,container:h});case"move-point":return new s({tooltip:d,info:x,container:h});case"selected-vertex":return new f({tooltip:d,info:x,container:h});case"transform-point":return new w({tooltip:d,info:x,container:h});case"transform-mesh":return new m({tooltip:d,info:x,container:h});case"translate":return new u({tooltip:d,info:x,container:h});case"translate-vertex":return new T({tooltip:d,info:x,container:h});case"translate-z":return new j({tooltip:d,info:x,container:h});case"translate-xy":return new C({tooltip:d,info:x,container:h});case"reshape-edge-offset":return new c({tooltip:d,info:x,container:h})}}export{d as tooltipContentFactory};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
+ */
5
+ import{__decorate as o}from"tslib";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{SketchTooltipInfo as e}from"./SketchTooltipInfo.js";import{TooltipInfoWithCoordinates as s}from"./TooltipInfoWithCoordinates.js";let i=class extends(s(e)){constructor(o){super(o),this.type="elevation",this.allFields.forEach(o=>{o.lockable=!1,o.setActual(null)})}get allFields(){return[this.elevation]}};o([t()],i.prototype,"type",void 0),o([t()],i.prototype,"allFields",null),i=o([r("esri.views.interactive.tooltip.infos.ElevationTooltipInfo")],i);export{i as ElevationTooltipInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- class t{constructor(t,i,o){this._initialVelocity=t,this._stopVelocity=i,this._friction=o,this._duration=Math.abs(Math.log(Math.abs(this._initialVelocity)/this._stopVelocity)/Math.log(1-this._friction))}get duration(){return this._duration}isFinished(t){return t>this.duration}get friction(){return this._friction}value(t){return this.valueFromInitialVelocity(this._initialVelocity,t)}valueDelta(t,i){const o=this.value(t);return this.value(t+i)-o}valueFromInitialVelocity(t,i){i=Math.min(i,this.duration);const o=1-this.friction;return t*(o**i-1)/Math.log(o)}}export{t as Momentum};
5
+ import{Seconds as t}from"../../core/time.js";class i{constructor(i,o,r){this._initialVelocity=i,this._stopVelocity=o,this._friction=r,this._duration=t(Math.abs(Math.log(Math.abs(this._initialVelocity)/this._stopVelocity)/Math.log(1-this._friction)))}get duration(){return this._duration}isFinished(t){return t>this.duration}get friction(){return this._friction}value(t){return this.valueFromInitialVelocity(this._initialVelocity,t)}valueDelta(t,i){const o=this.value(t);return this.value(t+i)-o}valueFromInitialVelocity(t,i){i=Math.min(i,this.duration);const o=1-this.friction;return t*(o**i-1)/Math.log(o)}}export{i as Momentum};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import{createTask as t}from"../../core/asyncUtils.js";import o from"../../core/Error.js";import{on as s}from"../../core/events.js";import has from"../../core/has.js";import{throwIfAborted as i,createResolver as a}from"../../core/promiseUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{initializeProjection as c,project as u}from"../../geometry/projectionUtils.js";import{equalsWithProjectionEngine as f}from"../../geometry/support/spatialReferenceUtils.js";import{uploadProgressWeights as m}from"../../layers/graphics/sources/support/uploadProgressWeights.js";import{getSupportedExtensions as d}from"../../layers/support/infoFor3D.js";import{makeProgressManager as h,estimatedTransferTime as y}from"../../support/progressUtils.js";let g=class extends r{constructor(){super({}),this.files=[],this.progress=0,this._uploadTask=null,this._layer=null}destroy(){this.cancel(),this.files=[],this._layer=null,this._uploadTask=null}get state(){const e=this._uploadTask;return e&&0!==this.files.length?e.finished?e.error?"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(e){this.cancel(),this.files=[],this._layer=e,this._uploadTask=t(async r=>{const t=await v(e);i(r),this.progress=0,this.files=t;const s=h(m.upload,e=>{this.progress=e},"Upload.uploadTo");if(0===t.length)return null;i(r);const a=await e.extractAndFilterFiles(t);i(r),a.length>0&&(this.files=a);const l=await e.convertMesh(a,{signal:r,onProgress:s.makeOnProgress("createFromFiles")});if(i(r),!l)throw new o("editor:upload","could not upload or convert model");const n=a.reduce((e,r)=>e+r.size,0),p=s.simulate("loadMesh",y(n));try{await l.load()}finally{p.remove()}if(has("enable-feature:georeferenced-uploads")&&l.metadata.georeferenced){if(await f(e.spatialReference,l.origin?.spatialReference))return{type:"georeferenced",mesh:l};if((e.spatialReference.isWebMercator||e.spatialReference.isWGS84)&&await R(l,e.spatialReference))return{type:"georeferenced-reprojected",mesh:l}}return l.spatialReference=e.spatialReference,l.vertexSpace.origin=[0,0,0],{type:"non-georeferenced",mesh:l}})}retry(){this._layer&&this.uploadTo(this._layer)}cancel(){this._uploadTask?.abort()}};e([l()],g.prototype,"files",void 0),e([l()],g.prototype,"progress",void 0),e([l()],g.prototype,"state",null),e([l()],g.prototype,"result",null),e([l()],g.prototype,"error",null),e([l()],g.prototype,"_uploadTask",void 0),e([l()],g.prototype,"_layer",void 0),g=e([n("esri.widgets.Editor.Upload")],g);let j=null;async function v(e){const{resolve:r,promise:t}=a(),o=document.createElement("input");o.type="file",o.multiple=!1,o.accept=[...d(e.infoFor3D),".zip"].join(","),o.style.display="none",document.body.appendChild(o);const i=s(o,"change",()=>r(o.files?Array.from(o.files):[]));return j?j(o):o.click(),t.finally(()=>{i.remove(),o.remove()})}function _(e,r){j=t=>{r?.(),Promise.resolve().then(()=>e).then(e=>{if(!j)return;const r=new DataTransfer;e.forEach(e=>r.items.add(e)),t.files=r.files,t.dispatchEvent(new Event("change"))})}}function w(){j=null}async function R(e,r){if(await c(e.spatialReference,r),!e.vertexSpace.origin)return!1;const[t,o,s]=e.vertexSpace.origin,i=new p({x:t,y:o,z:s,spatialReference:e.spatialReference}),a=u(i,r);return!!a&&(e.vertexSpace.origin=[a.x,a.y,a.z??0],e.spatialReference=r,!0)}export{g as Upload,w as clearPromptForFilesStub,_ as stubFilePickerToSelect};
5
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import{createTask as t}from"../../core/asyncUtils.js";import o from"../../core/Error.js";import{on as s}from"../../core/events.js";import has from"../../core/has.js";import{throwIfAborted as i,createResolver as a}from"../../core/promiseUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{initializeProjection as c,project as u}from"../../geometry/projectionUtils.js";import{equalsWithProjectionEngine as f}from"../../geometry/support/spatialReferenceUtils.js";import{uploadProgressWeights as d}from"../../layers/graphics/sources/support/uploadProgressWeights.js";import{getSupportedExtensions as m}from"../../layers/support/infoFor3D.js";import{makeProgressManager as h,estimatedTransferTime as y}from"../../support/progressUtils.js";let g=class extends r{constructor(){super({}),this.files=[],this.progress=0,this._uploadTask=null,this._layer=null}destroy(){this.cancel(),this.files=[],this._layer=null,this._uploadTask=null}get state(){const e=this._uploadTask;return e&&0!==this.files.length?e.finished?e.error?"error":"success":"pending":"default"}get result(){return this._uploadTask?.value??null}get error(){return this._uploadTask?.error??null}uploadTo(e){this.cancel(),this.files=[],this._layer=e,this._uploadTask=t(async r=>{const t=await v(e);i(r),this.progress=0,this.files=t;const s=h(d.upload,e=>{this.progress=e},"Upload.uploadTo");if(0===t.length)return null;i(r);const a=await e.extractAndFilterFiles(t);i(r),a.length>0&&(this.files=a);const l=await e.convertMesh(a,{signal:r,onProgress:s.makeOnProgress("createFromFiles")});if(i(r),!l)throw new o("editor:upload","could not upload or convert model");const n=a.reduce((e,r)=>e+r.size,0),p=s.simulate("loadMesh",y(n));try{await l.load()}finally{p.remove()}if(!has("disable-feature:georeferenced-uploads")&&l.metadata.georeferenced){if(await f(e.spatialReference,l.origin?.spatialReference))return{type:"georeferenced",mesh:l};if((e.spatialReference.isWebMercator||e.spatialReference.isWGS84)&&await R(l,e.spatialReference))return{type:"georeferenced-reprojected",mesh:l}}return l.spatialReference=e.spatialReference,l.vertexSpace.origin=[0,0,0],{type:"non-georeferenced",mesh:l}})}retry(){this._layer&&this.uploadTo(this._layer)}cancel(){this._uploadTask?.abort()}};e([l()],g.prototype,"files",void 0),e([l()],g.prototype,"progress",void 0),e([l()],g.prototype,"state",null),e([l()],g.prototype,"result",null),e([l()],g.prototype,"error",null),e([l()],g.prototype,"_uploadTask",void 0),e([l()],g.prototype,"_layer",void 0),g=e([n("esri.widgets.Editor.Upload")],g);let j=null;async function v(e){const{resolve:r,promise:t}=a(),o=document.createElement("input");o.type="file",o.multiple=!1,o.accept=[...m(e.infoFor3D),".zip"].join(","),o.style.display="none",document.body.appendChild(o);const i=s(o,"change",()=>r(o.files?Array.from(o.files):[]));return j?j(o):o.click(),t.finally(()=>{i.remove(),o.remove()})}function _(e,r){j=t=>{r?.(),Promise.resolve().then(()=>e).then(e=>{if(!j)return;const r=new DataTransfer;e.forEach(e=>r.items.add(e)),t.files=r.files,t.dispatchEvent(new Event("change"))})}}function w(){j=null}async function R(e,r){if(await c(e.spatialReference,r),!e.vertexSpace.origin)return!1;const[t,o,s]=e.vertexSpace.origin,i=new p({x:t,y:o,z:s,spatialReference:e.spatialReference}),a=u(i,r);return!!a&&(e.vertexSpace.origin=[a.x,a.y,a.z??0],e.spatialReference=r,!0)}export{g as Upload,w as clearPromptForFilesStub,_ as stubFilePickerToSelect};
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1384],{31384:(e,s,t)=>{t.d(s,{uploadAssets:()=>R});var o=t(78888),r=t(44208),n=t(53966),a=t(74887),i=t(78659),c=t(84952),l=t(13069),u=t(16930),p=t(63579),d=t(55726);const f={upload:{createFromFiles:.8,loadMesh:.2},uploadAssetBlobs:{prepareAssetItems:.9,uploadAssetItems:.1},uploadConvertibleSource:{uploadEditSource:.5,serviceAssetsToGlb:.5},uploadLocalMesh:{meshToAssetBlob:.5,uploadAssetBlobs:.5}};var m=t(60694),g=t(36563),h=t(91869);function w(e,s=e=>{},t){return new y(e,s,t)}class y{constructor(e,s=e=>{},t){if(this.onProgress=s,this.taskName=t,this._progressMap=new Map,this._startTime=void 0,this._timingsMap=new Map,"number"==typeof e){this._weights={};for(let s=0;s<e;s++){const t=s,o=1/e;this._weights[t]=o,this._progressMap.set(t,0)}}else this._weights=e;this.emitProgress()}emitProgress(){let e=0;for(const[s,t]of this._progressMap.entries())e+=t*this._weights[s];if(1===e&&(0,r.A)("enable-feature:esri-3dofl-upload-timings")){const e=Math.round(performance.now()-(this._startTime??0))/1e3;console.log(`${this.taskName} done in ${e} sec`);for(const[s,t]of this._timingsMap){const o=Math.round(t.end-t.start)/1e3,r=Math.round(o/e*100);console.log(this.taskName??"Task",{stepKey:s,stepTime:o,relativeTime:r})}}this.onProgress(e)}setProgress(e,s){if(this._progressMap.set(e,s),(0,r.A)("enable-feature:esri-3dofl-upload-timings")){const t=performance.now();this._startTime??=t;const o=(0,h.tE)(this._timingsMap,e,()=>({start:t,end:0}));1===s&&(o.end=t)}this.emitProgress()}simulate(e,s){return A(s=>this.setProgress(e,s),s)}makeOnProgress(e){return s=>this.setProgress(e,s)}}function A(e=e=>{},s=j){const t=performance.now();e(0);const o=setInterval(()=>{const o=performance.now()-t,r=1-Math.exp(-o/s);e(r)},x);return(0,g.hA)(()=>{clearInterval(o),e(1)})}function T(e,s=b){return(0,i.gr)((0,i.Kp)(e*P/s))}const b=10,v=10,P=8e-6,x=(0,i.l5)(50),j=(0,i.l5)(1e3),F=1e6,$=20*F,D=2e9,M=3;async function N({data:e,name:s,description:t},r,n){let i=null;try{const u=(0,c.fj)(r,"uploads"),p=(0,c.fj)(u,"info"),{data:d}=await(0,o.A)(p,{query:{f:"json"},responseType:"json"});(0,a.Te)(n);const f=(0,m.Wo)(r),g=d.maxUploadFileSize*F,h=f?D:g,y=f?Math.min($,g):$;if(e.size>h)throw new Error("Data too large");const A=(0,c.fj)(u,"register"),{data:b}=await(0,o.A)(A,{query:{f:"json",itemName:(l=s,l.replaceAll("/","_").replaceAll("\\","_")),description:t},responseType:"json",method:"post"});if((0,a.Te)(n),!b.success)throw new Error("Registration failed");const{itemID:v}=b.item;i=(0,c.fj)(u,v);const P=(0,c.fj)(i,"uploadPart"),x=Math.ceil(e.size/y),j=new Array;for(let s=0;s<x;++s)j.push(e.slice(s*y,Math.min((s+1)*y,e.size)));const N=j.slice().reverse(),S=new Array,E=w(x,n?.onProgress,"uploadItem"),k=async()=>{for(;0!==N.length;){const e=j.length-N.length,s=N.pop(),t=new FormData,r=E.simulate(e,T(s.size));try{t.append("f","json"),t.append("file",s),t.append("partId",`${e}`);const{data:r}=await(0,o.A)(P,{timeout:0,body:t,responseType:"json",method:"post"});if((0,a.Te)(n),!r.success)throw new Error("Part upload failed")}finally{r.remove()}}};for(let e=0;e<M&&0!==N.length;++e)S.push(k());await Promise.all(S);const R=(0,c.fj)(i,"commit"),{data:C}=await(0,o.A)(R,{query:{f:"json",parts:j.map((e,s)=>s).join(",")},responseType:"json",method:"post"});if((0,a.Te)(n),!C.success)throw new Error("Commit failed");return C.item}catch(e){if(null!=i){const e=(0,c.fj)(i,"delete");await(0,o.A)(e,{query:{f:"json"},responseType:"json",method:"post"})}throw e}var l}var S=t(20557),E=t(86390),k=t(77793);async function R(e,s,t){const o=e.length;if(!o)return t?.onProgress?.(1),[];const n=w(o,t?.onProgress,"uploadAssets");return Promise.all(e.map((e,o)=>async function(e,{layer:s,ongoingUploads:t},o){const n=t.get(e);if(n)return n;if(!function(e){return!!e.infoFor3D&&!!e.url}(s))throw new d.Wt;if(function(e,s){const{parsedUrl:t}=s;return null!=t&&e.metadata.externalSources.some(e=>(0,p.eN)(e,t))}(e,s))return o?.onProgress?.(1),e;const m=async function(e,s,t){const{metadata:o}=e,{displaySource:n}=o,m=C(n?.source,s,{checkForConversionRequired:(0,r.A)("enable-feature:georeferenced-uploads")}),g=null!=m?async function(e,s,t){return{source:{type:"service",assets:await I(e,s,t)},original:!0,unitConversionDisabled:!0}}(m,s,t):o.externalSources.length>0?async function(e,s,t){const o=q(s),{externalSources:n}=e.metadata,a=function(e,s){for(const t of e){const e=C(t.source,s);if(e)return e}return null}(n,s);if(!a)throw new d.xY;const l=w(f.uploadConvertibleSource,t?.onProgress,"uploadConvertibleSource"),m={type:"service",assets:await I(a,s,{onProgress:l.makeOnProgress("uploadEditSource")})};e.addExternalSources([{source:m,original:!0}]);const g=a.reduce((e,{asset:s})=>s instanceof File?e+s.size:e,0),h=l.simulate("serviceAssetsToGlb",function(e,s=v){return(0,i.gr)((0,i.Kp)(e*P/s))}(g));try{const{source:n,transform:a,origin:i}=await async function({assets:e},s,t){const o=e.map(({assetName:e,parts:s})=>({assetName:e,assetHash:s[0].partHash}));let n;try{const e=(0,c.fj)(s.parsedUrl.path,"convert3D"),r=s.capabilities?.operations.supportsAsyncConvert3D;n=(await(r?Z:Y)(e,{query:{f:"json",assets:JSON.stringify(o),transportType:"esriTransportTypeUrl",targetFormat:t,async:r},responseType:"json",timeout:0})).data}catch(e){throw new d.MT}return function(e,s){const t={source:{type:"service",assets:s.assets.map(s=>{const t=(0,S.R_)(s.contentType,e.infoFor3D.supportedFormats);if(!t)throw new d.H2(t);return new p.Qp(s.assetName,s.contentType,[new p.Bq(s.assetURL,s.assetHash)])})},origin:void 0,transform:void 0};if((0,r.A)("enable-feature:georeferenced-uploads")&&s.transform){if(t.transform=(0,k.f)(s.transform),s.spatialReference){const e=u.A.fromJSON(s.spatialReference);t.origin=(0,k.V)(s.transform,e)}}else t.transform=(0,E.Z)(e.spatialReference);return t}(s,n)}(m,s,o);return e.transform=a,i&&(e.metadata.georeferenced=!0,t?.useAssetOrigin&&(e.vertexSpace.origin=[i.x,i.y,i.z??0],e.spatialReference=i.spatialReference)),{source:n,unitConversionDisabled:!0}}finally{h.remove()}}(e,s,t):async function(e,s,t){const o=w(f.uploadLocalMesh,t?.onProgress,"uploadLocalMesh"),r=async function(e,s,t){const o=q(s),r=await e.load(t),n=await r.toBinaryGLTF({origin:r.origin,signal:t?.signal,ignoreLocalTransform:!0,unitConversionDisabled:!0});return(0,a.Te)(t),{blob:new Blob([n],{type:"model/gltf-binary"}),assetName:`${(0,l.yS)()}.glb`,assetType:o}}(e,s,{...t,onProgress:o.makeOnProgress("meshToAssetBlob")});return{source:{type:"service",assets:await U([r],s,{...t,onProgress:o.makeOnProgress("uploadAssetBlobs")})},extent:e.extent.clone(),original:!0}}(e,s,t),h=await g;return(0,a.Te)(t),e.addExternalSources([h]),e}(e,s,o);t.set(e,m);try{await m}finally{t.delete(e)}return e}(e,s,{...t,onProgress:n.makeOnProgress(o)})))}function C(e,{infoFor3D:s},t={}){if(!e)return null;const o=(0,p.WN)(e);if(!o)return null;const{supportedFormats:r,editFormats:n}=s,a=new Array,i=(0,S.ND)(s),c=(0,S.nr)(s);let l=!1;for(const e of o){const s=_(e,r);if(!s)return null;const{assetType:o}=s;if(t.checkForConversionRequired&&(o===i||o===c))return null;n.includes(o)&&(l=!0),a.push(s)}return l?a:null}function _(e,s){const t=(0,p.fH)(e,s);return t?{asset:e,assetType:t}:null}async function I(e,s,t){return U(e.map(e=>async function(e,s){const{asset:t,assetType:o}=e;if(t instanceof File)return{blob:t,assetName:t.name,assetType:o};const r=await t.toBlob(s);return(0,a.Te)(s),{blob:r,assetName:t.assetName,assetType:o}}(e,t)),s,t)}async function U(e,s,t){const o=w(f.uploadAssetBlobs,t?.onProgress,"uploadAssetBlobs"),r=await function(e,s,t){const o=w(e.length,t?.onProgress,"prepareAssetItems");return Promise.all(e.map(async(e,r)=>{const i=async function(e,s,t){const{blob:o,assetType:r,assetName:i}=e;let l=null;try{const e=await N({data:o,name:i},s.url,t);(0,a.Te)(t),l={assetType:r,assetUploadId:e.itemID}}catch(e){(0,a.QP)(e),n.A.getLogger("esri.layers.graphics.sources.support.uploadAssets").warnOnce(`Service ${s.url} does not support the REST Uploads API.`)}if(!l){const e=await(0,c._0)(o);if((0,a.Te)(t),!e.isBase64)throw new d.$1;l={assetType:r,assetData:e.data}}if(!l)throw new d.WF;return{item:l,assetName:i}}(await e,s,{...t,onProgress:o.makeOnProgress(r)});return(0,a.Te)(t),i}))}(e,s,{...t,onProgress:o.makeOnProgress("prepareAssetItems")});(0,a.Te)(t);const i=r.map(({item:e})=>e),{uploadResults:l}=await B(i,s,{...t,onProgress:o.makeOnProgress("uploadAssetItems")});return(0,a.Te)(t),e.map((e,t)=>function(e,s,t){const{success:o}=s;if(!o){const{error:t}=s;throw new d.hK(e.assetName,t)}const{assetHash:r}=s,{assetName:n,item:{assetType:a}}=e,{infoFor3D:{supportedFormats:i}}=t,c=(0,S.Fm)(a,i);if(!c)throw new d.H2(a);return new p.Qp(n,c,[new p.Bq(`${t.parsedUrl.path}/assets/${r}`,r)])}(r[t],l[t],s))}async function B(e,s,t){const r=A(t?.onProgress);try{const r=await(0,o.A)((0,c.fj)(s.parsedUrl.path,"uploadAssets"),{timeout:0,query:{f:"json",assets:JSON.stringify(e)},method:"post",responseType:"json"});if((0,a.Te)(t),r.data.uploadResults.length!==e.length)throw new d.nS(e.length,r.data.uploadResults.length);return r.data}finally{r.remove()}}function Y(e,s){return(0,o.A)(e,s)}async function Z(e,s){const t=(await(0,o.A)(e,s)).data.statusUrl;for(;;){const e=(await(0,o.A)(t,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return(0,o.A)(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new Error(e.status);case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new Error}await(0,a.Pl)(O)}}function q({infoFor3D:e}){const s=(0,S.U9)(e);if(!s)throw new d.uh;return s}const O=(0,i.l5)(1e3)},55726:(e,s,t)=>{t.d(s,{$1:()=>l,H2:()=>f,MT:()=>m,VP:()=>g,WF:()=>u,Wt:()=>a,XQ:()=>h,hK:()=>d,nS:()=>p,uh:()=>i,xY:()=>c});var o=t(49186);const r="upload-assets",n=()=>new Error;class a extends o.A{constructor(){super(`${r}:unsupported`,"Layer does not support asset uploads.",n())}}class i extends o.A{constructor(){super(`${r}:no-glb-support`,"Layer does not support glb.",n())}}class c extends o.A{constructor(){super(`${r}:no-supported-source`,"No supported external source found",n())}}class l extends o.A{constructor(){super(`${r}:not-base-64`,"Expected gltf data in base64 format after conversion.",n())}}class u extends o.A{constructor(){super(`${r}:unable-to-prepare-options`,"Unable to prepare uploadAsset request options.",n())}}class p extends o.A{constructor(e,s){super(`${r}:bad-response`,`Bad response. Uploaded ${e} items and received ${s} results.`,n())}}class d extends o.A{constructor(e,s){super(`${r}-layer:upload-failed`,`Failed to upload mesh file ${e}. Error code: ${s?.code??"-1"}. Error message: ${s?.messages??"unknown"}`,n())}}class f extends o.A{constructor(e){super(`${r}-layer:unsupported-format`,`The service allowed us to upload an asset of FormatID ${e}, but it does not list it in its supported formats.`,n())}}class m extends o.A{constructor(){super(`${r}:convert3D-failed`,"convert3D failed.")}}class g extends o.A{constructor(){super("invalid-input:no-model","No supported model found")}}class h extends o.A{constructor(){super("invalid-input:multiple-models","Multiple supported models found")}}},77793:(e,s,t)=>{t.d(s,{V:()=>n,f:()=>a});var o=t(86738),r=t(73836);function n(e,s,t=i){return new o.A({x:e[t.originX],y:e[t.originY],z:e[t.originZ],spatialReference:s})}function a(e,s=i){return new r.A({translation:[e[s.translationX],-e[s.translationZ],e[s.translationY]],rotationAxis:[e[s.rotationX],-e[s.rotationZ],e[s.rotationY]],rotationAngle:e[s.rotationDeg],scale:[e[s.scaleX],e[s.scaleZ],e[s.scaleY]]})}const i={originX:"originX",originY:"originY",originZ:"originZ",translationX:"translationX",translationY:"translationY",translationZ:"translationZ",scaleX:"scaleX",scaleY:"scaleY",scaleZ:"scaleZ",rotationX:"rotationX",rotationY:"rotationY",rotationZ:"rotationZ",rotationDeg:"rotationDeg"}},86390:(e,s,t)=>{t.d(s,{Z:()=>n});var o=t(83047),r=t(73836);function n(e){const s=1/(0,o.GA)(e,1);return 1!==s?new r.A({scale:[s,s,s]}):void 0}}}]);