@arcgis/core 5.0.0-next.27 → 5.0.0-next.29

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 (95) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{aca72ca7f43f70eb8077.js → 0bfb7db0a151a5e85dd1.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2d0d8243ed0c21f8a498.js +1 -0
  6. package/assets/esri/core/workers/chunks/{e873359e00e0866d4ef6.js → 66853ecdebfc2aa68ce7.js} +21 -22
  7. package/assets/esri/core/workers/chunks/6c8f5a56e94fdbe6a4a5.js +1 -0
  8. package/assets/esri/core/workers/chunks/6ce7ca6bebdc61d8eada.js +1 -0
  9. package/assets/esri/core/workers/chunks/{8b33732e3c2924c1f60d.js → e615983fab688d515205.js} +1 -1
  10. package/assets/esri/core/workers/chunks/e6fa6f9c278589c8a713.js +1 -0
  11. package/chunks/CheckerBoard.glsl.js +2 -2
  12. package/chunks/ColorMaterial.glsl.js +2 -2
  13. package/chunks/ComponentShader.glsl.js +2 -2
  14. package/chunks/DefaultMaterial.glsl.js +2 -2
  15. package/chunks/ImageMaterial.glsl.js +2 -2
  16. package/chunks/LineMarker.glsl.js +2 -2
  17. package/chunks/NativeLine.glsl.js +2 -2
  18. package/chunks/Path.glsl.js +3 -3
  19. package/chunks/Pattern.glsl.js +2 -2
  20. package/chunks/RealisticTree.glsl.js +2 -2
  21. package/chunks/RibbonLine.glsl.js +2 -2
  22. package/chunks/ShadedColorMaterial.glsl.js +2 -2
  23. package/chunks/Terrain.glsl.js +27 -37
  24. package/chunks/WaterSurface.glsl.js +2 -2
  25. package/config.js +1 -1
  26. package/core/accessorSupport/decorators/property.js +1 -1
  27. package/core/has.js +1 -1
  28. package/geometry/Circle.js +1 -1
  29. package/geometry/support/MeshMaterial.js +1 -1
  30. package/geometry/support/MeshMaterialMetallicRoughness.js +1 -1
  31. package/interfaces.d.ts +29 -23
  32. package/kernel.js +1 -1
  33. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  34. package/package.json +2 -2
  35. package/renderers/support/UniqueValueClass.js +1 -1
  36. package/renderers/visualVariables/SizeVariable.js +1 -1
  37. package/support/revision.js +1 -1
  38. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  39. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  40. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  41. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  42. package/views/3d/state/ViewState.js +1 -1
  43. package/views/3d/state/ViewStateManager.js +1 -1
  44. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  45. package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
  46. package/views/3d/support/QualityProfile.js +1 -1
  47. package/views/3d/terrain/TerrainRenderer.js +1 -1
  48. package/views/3d/terrain/TerrainSurface.js +1 -1
  49. package/views/3d/webgl-engine/Stage.js +1 -1
  50. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  51. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  52. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  53. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  54. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  55. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
  56. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  57. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  58. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  59. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  60. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  61. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  62. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  63. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  64. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  65. package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
  66. package/views/3d/webgl-engine/shaders/{OutputColorHighlightOID.glsl.js → OutputColorHighlightOLID.glsl.js} +2 -3
  67. package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
  68. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  69. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  70. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  71. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  72. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  73. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  74. package/views/SceneView.js +1 -1
  75. package/views/View.js +1 -1
  76. package/views/View2D.js +1 -1
  77. package/views/Viewport2DMixin.js +1 -1
  78. package/views/navigation/Momentum.js +1 -1
  79. package/views/video/VideoOperationalDataView.js +1 -1
  80. package/webscene/Slide.js +1 -1
  81. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  82. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  83. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  84. package/widgets/FeatureTable.js +1 -1
  85. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  86. package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
  87. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  88. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  89. package/widgets/UtilityNetworkTrace.js +1 -1
  90. package/widgets/Widget.js +1 -1
  91. package/assets/esri/core/workers/chunks/3f2b1d2102eef7ac29b4.js +0 -1
  92. package/assets/esri/core/workers/chunks/7532e819d2f4ee4813be.js +0 -1
  93. package/assets/esri/core/workers/chunks/76f2ce14d0d3001620a9.js +0 -1
  94. package/assets/esri/core/workers/chunks/ab5c386100b84bc564dd.js +0 -1
  95. package/views/3d/webgl-engine/lib/ComponentUtils.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/5.0/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/units.js";import{property as T,cast as R,subclass as x}from"../core/accessorSupport/decorators.js";import{ensureType as O,ensureClass as E}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as A}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as H}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as I}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as P}from"../core/support/OwningCollection.js";import{initialize as F}from"../core/workers/workers.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{makeDehydratedPoint as J}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as K,isTiledLayer as X,isVoxelLayer as ee,isIntegratedMeshLayer as te}from"../layers/support/layerUtils.js";import{TilemapCache as ie}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as re}from"../portal/portalDefault.js";import{AnalysesCollection as se}from"../support/AnalysesCollection.js";import{WebSceneTag as ne}from"../support/tagSymbols.js";import{BreakpointsOwner as ae}from"./BreakpointsOwner.js";import{DOMContainer as oe}from"./DOMContainer.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{GroundView3D as ce}from"./3d/GroundView3D.js";import{layerView3DImporter as ge}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as me}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as ye}from"./3d/camera/intersectionUtils.js";import{Constraints as fe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as we}from"./3d/environment/EnvironmentManager.js";import ve from"./3d/environment/SceneViewEnvironment.js";import _e from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as be}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Me}from"./3d/layers/graphics/Labeler.js";import Se from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Ve}from"./3d/layers/support/StageLayerElevationProvider.js";import{ScreenSizePerspective as je}from"./3d/state/ScreenSizePerspective.js";import Ce from"./3d/state/ViewState.js";import{ViewStateManager as Te,cleanupViewStateManager as Re}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as xe}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Oe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Ee}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Ae}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Le}from"./3d/support/debugFlags.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Ie,hitTest as Pe}from"./3d/support/hitTest.js";import{popupHitTest as Fe}from"./3d/support/popupHitTest.js";import{getQualityProfileSettings as De,getDefaultQualityProfileName as Ue}from"./3d/support/QualityProfile.js";import Ge from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as We}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as qe}from"./3d/support/ResourceController.js";import ze from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as ke}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Be}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Ne}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Qe from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ye,getTiledLayerInfo as Ze,checkIfTileInfoSupportedForView as $e}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Je}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ke}from"./3d/terrain/TileRenderer.js";import{Stage as Xe}from"./3d/webgl-engine/Stage.js";import{olidEnabled as et}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as tt}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as it}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as rt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as st}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as nt}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import at from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as ot}from"./support/drapedUtils.js";import{defaultHighlightName as lt}from"./support/HighlightDefaults.js";import pt from"./support/HighlightOptions.js";import{occludeesSupported as ht}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as dt,createScreenPointFromSupportedEvent as ut}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ct}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as gt,destroyTextureCompressionWorker as mt}from"./support/TextureCompressionHelper.js";import{check as yt}from"./support/WebGLRequirements.js";import ft from"./ui/DefaultUI.js";import wt from"./ui/3d/DefaultUI3D.js";import vt from"../webscene/Environment.js";import{clearVNodeCache as _t}from"../widgets/support/vnodeCache.js";var bt;const Mt=Symbol(),St=Symbol();let Vt=class extends(ae(le(oe(pe)))){static{bt=this}constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=qe(this),this.deconflictor=new be({view:this}),this.labeler=new Me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new se,this.animationsEnabled=!0,this.basemapTerrain=null,this.elevationProvider=new Ae({view:this}),this._canvas=null,this.constraints=new fe,this._environment=new ve,this.environmentManager=new we,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new at({importAnalysisViewModule:e=>me(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Ce({view:this}),this.slice=new Be,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new wt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,F();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 _e({view:this}),this.stateManager=new Te({view:this}),this.screenSizePerspective=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=gt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ce({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||(mt(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,this.screenSizePerspective.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}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=jt(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:jt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=jt(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=jt(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 ve?e:e instanceof vt?this.environment?.cloneWithWebsceneEnvironment(e)??ve.fromWebsceneEnvironment(e):O(ve,e):new ve}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 layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return bt._layerToLayerview}static{this._layerToLayerview=pe._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}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&&ne 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){const t=De(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ge(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ue()}_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 terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}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||Ye(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):ct(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===lt)??new pt}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===lt)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 ze(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=dt(e)?ut(this,e):e;return Ie(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;let t=e;return null==e.z&&(t=xt,t.x=e.x,t.y=e.y,t.z=He(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),N(t,Ct,this.renderSpatialReference),this.state.camera.projectToScreen(Ct,Tt),V(Tt[0],Tt[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,Ct,i);const r=this.state.camera.computeScreenPixelSizeAt(Ct);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.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=dt(e)?ut(this,e):e;return Pe(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(!et())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 ge.importLayerView(e)}hasLayerViewModule(e){return ge.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}getSurface(){return this.surface}async validate(){let e=yt(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!!ct(e,i)&&(null==t||(!!K(t)||(!X(t)||null!=Ze(t,e,i))&&(!ee(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(K(t)&&(r||s)){return!s||2===i||null===$e(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return X(t)||ee(t)||!r&&!s?X(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&&ht(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 Ot[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 Qe({view:this})),this.elevationProvider.register(0,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 Ne({view:this})),this.addHandles([this.updatingHandles.add(()=>Le.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Le.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.updatingHandles.addPromise(this._ensureFeatureTileTree()):this._featureTiles=p(this._featureTiles)},w)],Mt),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(St),this.removeHandles(Mt),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",We.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,Rt,t)||(this.renderCoordsHelper.extent=Rt)},w),St),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(it/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(St),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 Oe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Xe({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([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(it/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(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new ke({view:this,resourceController:this._resourceController})}_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(){1===ue(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),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 e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?A(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.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(st);for(const t of this.allLayerViews)te(t.layer)&&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(st);for(const t of this.allLayerViews)te(t.layer)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){_t(),L(),j(),nt(),Re(),ye(),Ve(),k(),ot(),re(),Ke(),rt(),xe(),Ee(),I(),M(),tt(),Je(),Se.cleanupI3SLodHandling(),ie.cleanupTilemapCache(),Ce.cleanupViewstate(),Qe.cleanupTerrainSurface()}};function jt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([T()],Vt.prototype,"_userClippingArea",void 0),e([T()],Vt.prototype,"_resourceController",void 0),e([T()],Vt.prototype,"stage",null),e([T({readOnly:!0})],Vt.prototype,"deconflictor",void 0),e([T({readOnly:!0})],Vt.prototype,"labeler",void 0),e([T(P(se,"analyses"))],Vt.prototype,"analyses",void 0),e([T({type:he,readOnly:!0})],Vt.prototype,"animation",null),e([T()],Vt.prototype,"animationsEnabled",void 0),e([T({readOnly:!0})],Vt.prototype,"basemapTerrain",void 0),e([T({readOnly:!0})],Vt.prototype,"overlayManager",null),e([T({readOnly:!0})],Vt.prototype,"elevationProvider",void 0),e([T()],Vt.prototype,"camera",null),e([T({type:t})],Vt.prototype,"contentCamera",null),e([T({readOnly:!0})],Vt.prototype,"canvas",null),e([T({type:G})],Vt.prototype,"center",null),e([T({type:D})],Vt.prototype,"clippingArea",null),e([T({type:fe,nonNullable:!0})],Vt.prototype,"constraints",void 0),e([T({type:D,readOnly:!0})],Vt.prototype,"renderDataExtent",null),e([T({readOnly:!0})],Vt.prototype,"tileInfo",null),e([T({type:D,readOnly:!0})],Vt.prototype,"dataExtent",null),e([T({type:D,readOnly:!0})],Vt.prototype,"_groundAndLayersExtent",null),e([T({type:ve})],Vt.prototype,"environment",null),e([R("environment")],Vt.prototype,"castEnvironment",null),e([T({readOnly:!0})],Vt.prototype,"environmentManager",void 0),e([T({type:D})],Vt.prototype,"extent",null),e([T({type:r})],Vt.prototype,"floors",void 0),e([T()],Vt.prototype,"screenCenter",null),e([T()],Vt.prototype,"frustum",null),e([T({type:Number,readOnly:!0})],Vt.prototype,"fullOpacity",void 0),e([T({readOnly:!0})],Vt.prototype,"graphicsView",void 0),e([T()],Vt.prototype,"analysisViewManager",void 0),e([T()],Vt.prototype,"groundView",void 0),e([T({readOnly:!0})],Vt.prototype,"layerviewCollections",null),e([T({type:Boolean})],Vt.prototype,"initialExtentRequired",null),e([T()],Vt.prototype,"defaultsFromMapSettings",null),e([T()],Vt.prototype,"interacting",null),e([T()],Vt.prototype,"stationary",null),e([T()],Vt.prototype,"navigating",null),e([T()],Vt.prototype,"map",void 0),e([T()],Vt.prototype,"padding",null),e([T({type:Ne,readOnly:!0})],Vt.prototype,"pointsOfInterest",void 0),e([T()],Vt.prototype,"_featureTiles",void 0),e([T()],Vt.prototype,"featureTiles",null),e([T()],Vt.prototype,"_featureTreeDebugger",void 0),e([T({constructOnly:!0})],Vt.prototype,"deactivatedWebGLExtensions",void 0),e([T({constructOnly:!0})],Vt.prototype,"debugWebGLExtensions",void 0),e([T({constructOnly:!0})],Vt.prototype,"renderCanvas",void 0),e([T({constructOnly:!0})],Vt.prototype,"state",void 0),e([T()],Vt.prototype,"screenSizePerspective",void 0),e([T({readOnly:!0})],Vt.prototype,"inputManager",void 0),e([T({readOnly:!0})],Vt.prototype,"stateManager",void 0),e([T({type:["low","medium","high"]})],Vt.prototype,"qualityProfile",null),e([T({type:Ge,get(){let e=this._get("qualitySettings");if(!e){const t=De(this.qualityProfile);e=new Ge(t)}return e}})],Vt.prototype,"qualitySettings",void 0),e([T()],Vt.prototype,"slice",void 0),e([T({readOnly:!0})],Vt.prototype,"typeSpecificPreconditionsReady",null),e([T({readOnly:!0})],Vt.prototype,"renderCoordsHelper",void 0),e([T({readOnly:!0})],Vt.prototype,"sceneIntersectionHelper",void 0),e([T({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Vt.prototype,"resolution",null),e([T({type:Number})],Vt.prototype,"scale",null),e([T({readOnly:!0,type:Number})],Vt.prototype,"terrainLevel",null),e([T()],Vt.prototype,"heightModelInfo",null),e([T()],Vt.prototype,"spatialReference",void 0),e([T({type:Boolean,value:!1})],Vt.prototype,"alphaCompositingEnabled",null),e([T({constructOnly:!0})],Vt.prototype,"preserveDrawingBufferEnabled",void 0),e([T({type:Boolean})],Vt.prototype,"supersampleScreenshotsEnabled",void 0),e([T({readOnly:!0})],Vt.prototype,"type",void 0),e([T(),R(e=>e instanceof ft?e:E(wt,e))],Vt.prototype,"ui",void 0),e([T({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"]})],Vt.prototype,"updating",null),e([T()],Vt.prototype,"_updatingObjects",null),e([T()],Vt.prototype,"_updatingObjectsWithProgress",null),e([T({type:Number,readOnly:!0,dependsOn:["updating"]})],Vt.prototype,"updatingProgress",void 0),e([T({type:["global","local"]})],Vt.prototype,"viewingMode",null),e([T({type:i})],Vt.prototype,"viewpoint",null),e([T({readOnly:!0})],Vt.prototype,"visibleArea",null),e([T({type:Number})],Vt.prototype,"zoom",null),e([T({type:pt})],Vt.prototype,"highlightOptions",null),e([T({readOnly:!0})],Vt.prototype,"quality",null),e([T({readOnly:!0})],Vt.prototype,"resolutionScale",null),e([T()],Vt.prototype,"focusAreasView",void 0),e([T()],Vt.prototype,"_defaultToMapOptions",null),e([T()],Vt.prototype,"_defaultHitTestOptions",null),Vt=bt=e([x("esri.views.SceneView")],Vt);const Ct=H(),Tt=S(),Rt=Y(),xt=J(0,0,0,z.WebMercator),Ot={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Et=Vt;export{Et 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/units.js";import{property as T,cast as R,subclass as x}from"../core/accessorSupport/decorators.js";import{ensureType as O,ensureClass as A}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as E}from"../core/accessorSupport/overrideDefaultsFrom.js";import{drainNotificationQueue as L}from"../core/accessorSupport/trackingUtils.js";import{create as H}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as I}from"../core/libs/rbush/PooledRBush.js";import{owningCollectionProperty as P}from"../core/support/OwningCollection.js";import{initialize as F}from"../core/workers/workers.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{makeDehydratedPoint as J}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as K,isTiledLayer as X,isVoxelLayer as ee,isIntegratedMeshLayer as te}from"../layers/support/layerUtils.js";import{TilemapCache as ie}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as re}from"../portal/portalDefault.js";import{AnalysesCollection as se}from"../support/AnalysesCollection.js";import{WebSceneTag as ne}from"../support/tagSymbols.js";import{BreakpointsOwner as ae}from"./BreakpointsOwner.js";import{DOMContainer as oe}from"./DOMContainer.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{GroundView3D as ce}from"./3d/GroundView3D.js";import{layerView3DImporter as ge}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as me}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as ye}from"./3d/camera/intersectionUtils.js";import{Constraints as fe}from"./3d/constraints/Constraints.js";import{EnvironmentManager as we}from"./3d/environment/EnvironmentManager.js";import ve from"./3d/environment/SceneViewEnvironment.js";import _e from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as be}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Me}from"./3d/layers/graphics/Labeler.js";import Se from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Ve}from"./3d/layers/support/StageLayerElevationProvider.js";import{ScreenSizePerspective as je}from"./3d/state/ScreenSizePerspective.js";import Ce from"./3d/state/ViewState.js";import{ViewStateManager as Te,cleanupViewStateManager as Re}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as xe}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Oe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Ae}from"./3d/state/utils/navigationUtils.js";import{CombinedElevationProvider as Ee}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Le}from"./3d/support/debugFlags.js";import{getElevationAtPoint as He}from"./3d/support/ElevationProvider.js";import{toMap as Ie,hitTest as Pe}from"./3d/support/hitTest.js";import{popupHitTest as Fe}from"./3d/support/popupHitTest.js";import{getQualityProfileSettings as De,getDefaultQualityProfileName as Ue}from"./3d/support/QualityProfile.js";import Ge from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as We}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as qe}from"./3d/support/ResourceController.js";import ze from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as ke}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Be}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Ne}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Qe from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ye,getTiledLayerInfo as Ze,checkIfTileInfoSupportedForView as $e}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Je}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Ke}from"./3d/terrain/TileRenderer.js";import{Stage as Xe}from"./3d/webgl-engine/Stage.js";import{olidEnabled as et}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as tt}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as it}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as rt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as st}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as nt}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import at from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as ot}from"./support/drapedUtils.js";import{defaultHighlightName as lt}from"./support/HighlightDefaults.js";import pt from"./support/HighlightOptions.js";import{occludeesSupported as ht}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as dt,createScreenPointFromSupportedEvent as ut}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ct}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as gt,destroyTextureCompressionWorker as mt}from"./support/TextureCompressionHelper.js";import{check as yt}from"./support/WebGLRequirements.js";import ft from"./ui/DefaultUI.js";import wt from"./ui/3d/DefaultUI3D.js";import vt from"../webscene/Environment.js";import{clearVNodeCache as _t}from"../widgets/support/vnodeCache.js";var bt;const Mt=Symbol(),St=Symbol();let Vt=class extends(ae(le(oe(pe)))){static{bt=this}constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=qe(this),this.deconflictor=new be({view:this}),this.labeler=new Me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new se,this.basemapTerrain=null,this.elevationProvider=new Ee({view:this}),this._canvas=null,this.constraints=new fe,this._environment=new ve,this.environmentManager=new we,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new at({importAnalysisViewModule:e=>me(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new g,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Ce({view:this}),this.slice=new Be,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new wt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,F();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 _e({view:this}),this.stateManager=new Te({view:this}),this.screenSizePerspective=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=gt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ce({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||(mt(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,this.screenSizePerspective.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}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=O(G,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=jt(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:jt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||z.WGS84,i=jt(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=jt(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 ve?e:e instanceof vt?this.environment?.cloneWithWebsceneEnvironment(e)??ve.fromWebsceneEnvironment(e):O(ve,e):new ve}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 layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return bt._layerToLayerview}static{this._layerToLayerview=pe._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}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&&ne 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){const t=De(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ge(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ue()}_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 terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}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||Ye(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):ct(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===lt)??new pt}set highlightOptions(e){for(let t=0;t<this.highlights.length;++t){if(this.highlights.at(t).name===lt)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 ze(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=dt(e)?ut(this,e):e;return Ie(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;let t=e;return null==e.z&&(t=xt,t.x=e.x,t.y=e.y,t.z=He(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),N(t,Ct,this.renderSpatialReference),this.state.camera.projectToScreen(Ct,Tt),V(Tt[0],Tt[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,Ct,i);const r=this.state.camera.computeScreenPixelSizeAt(Ct);return t&&i!==t?r*C(i)/C(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.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=dt(e)?ut(this,e):e;return Pe(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(!et())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 ge.importLayerView(e)}hasLayerViewModule(e){return ge.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}getSurface(){return this.surface}async validate(){let e=yt(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!!ct(e,i)&&(null==t||(!!K(t)||(!X(t)||null!=Ze(t,e,i))&&(!ee(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(K(t)&&(r||s)){return!s||2===i||null===$e(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:z.WebMercator,viewingMode:i}]:[{spatialReference:r?z.WGS84:z.WebMercator,viewingMode:i}]}return X(t)||ee(t)||!r&&!s?X(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&&ht(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 Ot[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 Qe({view:this})),this.elevationProvider.register(0,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 Ne({view:this})),this.addHandles([this.updatingHandles.add(()=>Le.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Le.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.updatingHandles.addPromise(this._ensureFeatureTileTree()):this._featureTiles=p(this._featureTiles)},w)],Mt),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(St),this.removeHandles(Mt),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",We.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,Rt,t)||(this.renderCoordsHelper.extent=Rt)},w),St),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(it/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(St),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 Oe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Xe({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([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(it/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(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new ke({view:this,resourceController:this._resourceController})}_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(){1===ue(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),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 e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?E(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.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(st);for(const t of this.allLayerViews)te(t.layer)&&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(st);for(const t of this.allLayerViews)te(t.layer)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){_t(),L(),j(),nt(),Re(),ye(),Ve(),k(),ot(),re(),Ke(),rt(),xe(),Ae(),I(),M(),tt(),Je(),Se.cleanupI3SLodHandling(),ie.cleanupTilemapCache(),Ce.cleanupViewstate(),Qe.cleanupTerrainSurface()}};function jt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([T()],Vt.prototype,"_userClippingArea",void 0),e([T()],Vt.prototype,"_resourceController",void 0),e([T()],Vt.prototype,"stage",null),e([T({readOnly:!0})],Vt.prototype,"deconflictor",void 0),e([T({readOnly:!0})],Vt.prototype,"labeler",void 0),e([T(P(se,"analyses"))],Vt.prototype,"analyses",void 0),e([T({type:he,readOnly:!0})],Vt.prototype,"animation",null),e([T({readOnly:!0})],Vt.prototype,"basemapTerrain",void 0),e([T({readOnly:!0})],Vt.prototype,"overlayManager",null),e([T({readOnly:!0})],Vt.prototype,"elevationProvider",void 0),e([T()],Vt.prototype,"camera",null),e([T({type:t})],Vt.prototype,"contentCamera",null),e([T({readOnly:!0})],Vt.prototype,"canvas",null),e([T({type:G,useTypeForAutocast:!1})],Vt.prototype,"center",null),e([T({type:D})],Vt.prototype,"clippingArea",null),e([T({type:fe,nonNullable:!0})],Vt.prototype,"constraints",void 0),e([T({type:D,readOnly:!0})],Vt.prototype,"renderDataExtent",null),e([T({readOnly:!0})],Vt.prototype,"tileInfo",null),e([T({type:D,readOnly:!0})],Vt.prototype,"dataExtent",null),e([T({type:D,readOnly:!0})],Vt.prototype,"_groundAndLayersExtent",null),e([T({type:ve})],Vt.prototype,"environment",null),e([R("environment")],Vt.prototype,"castEnvironment",null),e([T({readOnly:!0})],Vt.prototype,"environmentManager",void 0),e([T({type:D})],Vt.prototype,"extent",null),e([T({type:r})],Vt.prototype,"floors",void 0),e([T()],Vt.prototype,"screenCenter",null),e([T()],Vt.prototype,"frustum",null),e([T({type:Number,readOnly:!0})],Vt.prototype,"fullOpacity",void 0),e([T({readOnly:!0})],Vt.prototype,"graphicsView",void 0),e([T()],Vt.prototype,"analysisViewManager",void 0),e([T()],Vt.prototype,"groundView",void 0),e([T({readOnly:!0})],Vt.prototype,"layerviewCollections",null),e([T({type:Boolean})],Vt.prototype,"initialExtentRequired",null),e([T()],Vt.prototype,"defaultsFromMapSettings",null),e([T()],Vt.prototype,"interacting",null),e([T()],Vt.prototype,"stationary",null),e([T()],Vt.prototype,"navigating",null),e([T()],Vt.prototype,"map",void 0),e([T()],Vt.prototype,"padding",null),e([T({type:Ne,readOnly:!0})],Vt.prototype,"pointsOfInterest",void 0),e([T()],Vt.prototype,"_featureTiles",void 0),e([T()],Vt.prototype,"featureTiles",null),e([T()],Vt.prototype,"_featureTreeDebugger",void 0),e([T({constructOnly:!0})],Vt.prototype,"deactivatedWebGLExtensions",void 0),e([T({constructOnly:!0})],Vt.prototype,"debugWebGLExtensions",void 0),e([T({constructOnly:!0})],Vt.prototype,"renderCanvas",void 0),e([T({constructOnly:!0})],Vt.prototype,"state",void 0),e([T()],Vt.prototype,"screenSizePerspective",void 0),e([T({readOnly:!0})],Vt.prototype,"inputManager",void 0),e([T({readOnly:!0})],Vt.prototype,"stateManager",void 0),e([T({type:["low","medium","high"]})],Vt.prototype,"qualityProfile",null),e([T({type:Ge,get(){let e=this._get("qualitySettings");if(!e){const t=De(this.qualityProfile);e=new Ge(t)}return e}})],Vt.prototype,"qualitySettings",void 0),e([T()],Vt.prototype,"slice",void 0),e([T({readOnly:!0})],Vt.prototype,"typeSpecificPreconditionsReady",null),e([T({readOnly:!0})],Vt.prototype,"renderCoordsHelper",void 0),e([T({readOnly:!0})],Vt.prototype,"sceneIntersectionHelper",void 0),e([T({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Vt.prototype,"resolution",null),e([T({type:Number})],Vt.prototype,"scale",null),e([T({readOnly:!0,type:Number})],Vt.prototype,"terrainLevel",null),e([T()],Vt.prototype,"heightModelInfo",null),e([T()],Vt.prototype,"spatialReference",void 0),e([T({type:Boolean,value:!1})],Vt.prototype,"alphaCompositingEnabled",null),e([T({constructOnly:!0})],Vt.prototype,"preserveDrawingBufferEnabled",void 0),e([T({type:Boolean})],Vt.prototype,"supersampleScreenshotsEnabled",void 0),e([T({readOnly:!0})],Vt.prototype,"type",void 0),e([T(),R(e=>e instanceof ft?e:A(wt,e))],Vt.prototype,"ui",void 0),e([T({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"]})],Vt.prototype,"updating",null),e([T()],Vt.prototype,"_updatingObjects",null),e([T()],Vt.prototype,"_updatingObjectsWithProgress",null),e([T({type:Number,readOnly:!0,dependsOn:["updating"]})],Vt.prototype,"updatingProgress",void 0),e([T({type:["global","local"]})],Vt.prototype,"viewingMode",null),e([T({type:i})],Vt.prototype,"viewpoint",null),e([T({readOnly:!0})],Vt.prototype,"visibleArea",null),e([T({type:Number})],Vt.prototype,"zoom",null),e([T({type:pt})],Vt.prototype,"highlightOptions",null),e([T({readOnly:!0})],Vt.prototype,"quality",null),e([T({readOnly:!0})],Vt.prototype,"resolutionScale",null),e([T()],Vt.prototype,"focusAreasView",void 0),e([T()],Vt.prototype,"_defaultToMapOptions",null),e([T()],Vt.prototype,"_defaultHitTestOptions",null),Vt=bt=e([x("esri.views.SceneView")],Vt);const Ct=H(),Tt=S(),Rt=Y(),xt=J(0,0,0,z.WebMercator),Ot={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},At=Vt;export{At as default};
package/views/View.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{referenceSetter as s}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as d}from"../core/Loadable.js";import h from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,sync as f,whenOnce as w,when as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as M,subclass as V}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import T from"../geometry/Extent.js";import b from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as j}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as L}from"../support/GraphicsCollection.js";import{system as x}from"../time/constants.js";import k from"../time/TimeExtent.js";import{isTimeZoneValid as C}from"../time/timeZoneUtils.js";import O from"./BasemapView.js";import H from"./Magnifier.js";import q from"./SelectionManager.js";import P from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as Z}from"./3d/support/DefaultHighlights.js";import I from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import A from"./navigation/Navigation.js";import{DefaultsFromMap as U}from"./support/DefaultsFromMap.js";import z from"./support/HighlightOptions.js";import N from"./support/LayerViewManager.js";import G from"./support/RequiredFieldsOptions.js";var $;let B=class extends(n(m)){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new a({getCollections:()=>this.layerviewCollections,getChildrenFunction:Q}),this.analyses=new F,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new L,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new H,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new I,this.navigation=new A,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new r,this.requiredFieldsOptions=new G,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this.analysisViewManager?.attach(),this.toolViewManager.attach()}},f))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this._validateWithErrorDisplay()]).then(()=>(this._isValid=!0,w(()=>this.ready)))),this.basemapView=new O({view:this}),this.layerViewManager=new N({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new W({view:this}),this.selectionManager=new q({view:this}),this.addHandles([v(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{h.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),g(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},_),g(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},f),g(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},_)])}get _layerToLayerviewMapping(){return $._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.layerViews?.forEach(e=>e.destroy()),this.layerViews.length=0,this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return h.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new U({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??Z()}set highlights(e){this._set("highlights",s(e,this._get("highlights"),r.ofType(z)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!this.destroying&&!this.destroyed&&!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(h.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),d(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!j(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??x}set timeZone(e){this._userTimeZone=e,C(e)||h.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},a=p(()=>i.remove(r));return i.add(r),this.addHandles(a),a}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new P}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&h.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}async _validateWithErrorDisplay(){try{await this.validate()}catch(e){const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const a=document.createElement("a");a.innerHTML="https://esriurl.com/webgl-faq",a.target="_blank",a.setAttribute("style","font-size: 18px;"),a.href="https://esriurl.com/webgl-faq",t.appendChild(i),t.appendChild(r),t.appendChild(a);const s=this.getSurface();throw s&&s.appendChild(t),e}}};e([M()],B.prototype,"_userSpatialReference",void 0),e([M()],B.prototype,"activeTool",null),e([M({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([M({readOnly:!0})],B.prototype,"layerviewCollections",null),e([M(R(F,"analyses"))],B.prototype,"analyses",void 0),e([M()],B.prototype,"animation",null),e([M()],B.prototype,"basemapView",void 0),e([M()],B.prototype,"center",null),e([M()],B.prototype,"defaultsFromMapSettings",null),e([M()],B.prototype,"defaultsFromMap",null),e([M()],B.prototype,"dependencies",void 0),e([M()],B.prototype,"displayFilterEnabled",void 0),e([M({type:T})],B.prototype,"extent",null),e([M()],B.prototype,"fatalError",void 0),e([M(R(L,"graphics"))],B.prototype,"graphics",void 0),e([M({readOnly:!0,type:b})],B.prototype,"heightModelInfo",null),e([M({type:r.ofType(z)})],B.prototype,"highlights",null),e([M({readOnly:!0})],B.prototype,"interacting",null),e([M({constructOnly:!0})],B.prototype,"layerViewFilter",void 0),e([M({readOnly:!0})],B.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([M({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:r,readOnly:!0})],B.prototype,"layerViews",void 0),e([M()],B.prototype,"resolution",null),e([M({type:H})],B.prototype,"magnifier",void 0),e([M({value:null,type:t})],B.prototype,"map",null),e([M()],B.prototype,"padding",void 0),e([M({readOnly:!0})],B.prototype,"ready",void 0),e([M()],B.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],B.prototype,"readyState",null),e([M({type:E})],B.prototype,"spatialReference",null),e([M()],B.prototype,"stationary",null),e([M({type:k})],B.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([M()],B.prototype,"tools",null),e([M()],B.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],B.prototype,"type",void 0),e([M({type:Number})],B.prototype,"scale",void 0),e([M({readOnly:!0})],B.prototype,"updating",void 0),e([M({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],B.prototype,"initialExtent",null),e([M()],B.prototype,"cursor",null),e([M({readOnly:!0})],B.prototype,"input",void 0),e([M({type:A,nonNullable:!0})],B.prototype,"navigation",void 0),e([M()],B.prototype,"layerViewManager",void 0),e([M()],B.prototype,"analysisViewManager",void 0),e([M()],B.prototype,"selectionManager",void 0),e([M()],B.prototype,"width",void 0),e([M()],B.prototype,"height",void 0),e([M({readOnly:!0})],B.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],B.prototype,"size",null),e([M({readOnly:!0})],B.prototype,"suspended",void 0),e([M({readOnly:!0})],B.prototype,"viewEvents",void 0),e([M({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([M()],B.prototype,"_isValid",void 0),e([M()],B.prototype,"_readyCycleForced",void 0),e([M()],B.prototype,"_lockedSpatialReference",void 0),e([M()],B.prototype,"_userTimeZone",void 0),e([M()],B.prototype,"_lockedTimeZone",void 0),e([M()],B.prototype,"_userTimeExtent",void 0),e([M()],B.prototype,"_lockedTimeExtent",void 0),e([M({type:P})],B.prototype,"theme",void 0),e([M({readOnly:!0,type:P})],B.prototype,"effectiveTheme",null),B=$=e([V("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
5
+ import{__decorate as e}from"tslib";import t from"../Map.js";import{createTask as i}from"../core/asyncUtils.js";import r from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import{referenceSetter as s}from"../core/collectionUtils.js";import o from"../core/Error.js";import{EventedMixin as n}from"../core/Evented.js";import l from"../core/Handles.js";import{makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isLoadable as d}from"../core/Loadable.js";import h from"../core/Logger.js";import{destroyMaybe as y,abortMaybe as u}from"../core/maybe.js";import{EsriPromise as m}from"../core/Promise.js";import{after as c}from"../core/promiseUtils.js";import{watch as g,sync as f,whenOnce as w,when as v,syncAndInitial as _}from"../core/reactiveUtils.js";import{property as M,subclass as V}from"../core/accessorSupport/decorators.js";import{owningCollectionProperty as R}from"../core/support/OwningCollection.js";import{UpdatingHandles as S}from"../core/support/UpdatingHandles.js";import b from"../geometry/Extent.js";import T from"../geometry/HeightModelInfo.js";import E from"../geometry/SpatialReference.js";import{equals as j}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as F}from"../support/AnalysesCollection.js";import{GraphicsCollection as L}from"../support/GraphicsCollection.js";import{system as x}from"../time/constants.js";import k from"../time/TimeExtent.js";import{isTimeZoneValid as C}from"../time/timeZoneUtils.js";import O from"./BasemapView.js";import H from"./Magnifier.js";import q from"./SelectionManager.js";import P from"./Theme.js";import{ToolViewManager as W}from"./ToolViewManager.js";import{makeDefaultHighlightOptions as Z}from"./3d/support/DefaultHighlights.js";import I from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import A from"./navigation/Navigation.js";import{DefaultsFromMap as U}from"./support/DefaultsFromMap.js";import z from"./support/HighlightOptions.js";import N from"./support/LayerViewManager.js";import G from"./support/RequiredFieldsOptions.js";var $;let B=class extends(n(m)){static{$=this}constructor(e){super(e),this._userSpatialReference=null,this.handles=new l,this.updatingHandles=new S,this.allLayerViews=new a({getCollections:()=>this.layerviewCollections,getChildrenFunction:Q}),this.analyses=new F,this.animationsEnabled=!0,this.basemapView=null,this.dependencies={popup:void 0},this.displayFilterEnabled=!0,this.fatalError=null,this.graphics=new L,this.typeSpecificPreconditionsReady=!0,this.layerViews=new r,this.magnifier=new H,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this._readyStateWaitingTask=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this._lowPriorityCursorHandles=new r,this._highPriorityCursorHandles=new r,this.input=new I,this.navigation=new A,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new r,this.requiredFieldsOptions=new G,this._isValid=!1,this._readyCycleForced=!1,this._lockedSpatialReference=null,this._userTimeZone=null,this._lockedTimeZone=null,this._userTimeExtent=null,this._lockedTimeExtent=null,this.theme=null,this.handles.add(g(()=>this.preconditionsReady,e=>{const t=this.ready;if(e?(this._lockedSpatialReference=this.spatialReference,this._lockedTimeZone=this.timeZone,this._lockedTimeExtent=this.timeExtent,$.views.add(this)):(this._lockedSpatialReference=null,$.views.remove(this)),this.notifyChange("spatialReference"),!e&&t)this.toolViewManager?.detach(),this.analysisViewManager?.detach(),this.layerViewManager?.clear(),this._teardown();else if(e&&!t){try{this._startup()}catch(i){return void queueMicrotask(()=>{this.fatalError=new o("view:startup-error","View._startup failed",i)})}this.analysisViewManager?.attach(),this.toolViewManager.attach()}},f))}initialize(){this.addResolvingPromise(Promise.all([this.loadAsyncDependencies(),this._validateWithErrorDisplay()]).then(()=>(this._isValid=!0,w(()=>this.ready)))),this.basemapView=new O({view:this}),this.layerViewManager=new N({view:this,layerViewFilter:e=>this.layerViewFilter?.(e)??!0,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},layerviewMapping:this._layerToLayerviewMapping}),this.toolViewManager=new W({view:this}),this.selectionManager=new q({view:this}),this.addHandles([v(()=>"map-content-error"===this.readyState&&!this.spatialReference,()=>{h.getLogger(this).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")}),g(()=>this.initialExtentRequired,e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e},_),g(()=>this.ready,e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)},f),g(()=>this._userSpatialReference,e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)},_)])}get _layerToLayerviewMapping(){return $._layerToLayerview}static{this._layerToLayerview=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.basemap.groundLayers","view.basemapView.groundLayerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"],["view.map.layers","view.layerViews"]]}destroy(){this.destroyed||($.views.remove(this),this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=y(this.graphics),this.analyses=y(this.analyses),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.analysisViewManager=y(this.analysisViewManager),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.selectionManager=y(this.selectionManager),this.basemapView=y(this.basemapView),this.layerViews?.forEach(e=>e.destroy()),this.layerViews.length=0,this.invalidate(),this.handles.destroy(),this.map=y(this.map),this.updatingHandles.destroy())}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return h.getLogger(this).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get center(){return null}get defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new U({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:(e,t)=>this.getSpatialReferenceSupport(e,t),...this.defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get highlights(){return this._get("highlights")??Z()}set highlights(e){this._set("highlights",s(e,this._get("highlights"),r.ofType(z)))}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!this.destroying&&!this.destroyed&&!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||d(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._lockedSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}get resolution(){return 0}set map(e){e!==this._get("map")&&(e?.destroyed&&(h.getLogger(this).warn("#map","The provided map is already destroyed",{map:e}),e=null),d(e)&&e.load().catch(()=>{}),this.constructed&&!this.destroyed&&(this.forceReadyCycle(),this._lockedSpatialReference=null),this._set("map",e))}get readyState(){if(this.destroyed)return this._get("readyState");if(!this.map)return"missing-map";if("container"in this&&!this.container)return"missing-container";if(this.fatalError)return"rendering-error";if((this.defaultsFromMap?.ready??!1)&&!this.spatialReference){const e=!("loaded"in this.map)||this.map.loaded,t=this.map.ground.loaded,r=this.map.basemap?.loaded??!0;return e&&r&&t&&!this.map?.allLayers.length?"empty-map":(this._readyStateWaitingTask||(this._readyStateWaitingTask=i(e=>c(has("view-readyState-waiting-delay"),null,e)),this.addHandles(this._readyStateWaitingTask),this.addHandles(this._readyStateWaitingTask,"ready-state-task")),this._readyStateWaitingTask?.finished?"map-content-error":"loading")}return this._readyStateWaitingTask=u(this._readyStateWaitingTask),this.removeHandles("ready-state-task"),this.ready?"ready":"loading"}get spatialReference(){const e=this._userSpatialReference||this._lockedSpatialReference||this.getDefaultSpatialReference()||null;if(e&&this.defaultsFromMap?.required?.heightModelInfo){const t=e.clone();return t.vcsWkid=this.defaultsFromMap.vcsWkid,t.latestVcsWkid=this.defaultsFromMap.latestVcsWkid,t}return e}set spatialReference(e){const t=!j(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get timeExtent(){return this._userTimeExtent??this._lockedTimeExtent??this.getDefaultTimeExtent()??null}set timeExtent(e){this._userTimeExtent=e}get timeZone(){return this._userTimeZone??this._lockedTimeZone??this.getDefaultTimeZone()??x}set timeZone(e){this._userTimeZone=e,C(e)||h.getLogger(this).warn("#timeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){return this.toolViewManager?.cursor??this._highPriorityCursorHandles.at(-1)?.cursor??this._lowPriorityCursorHandles.at(-1)?.cursor??"default"}acquireCursor(e,t="low"){const i="high"===t?this._highPriorityCursorHandles:this._lowPriorityCursorHandles,r={cursor:e},a=p(()=>i.remove(r));return i.add(r),this.addHandles(a),a}get size(){return[this.width,this.height]}get effectiveTheme(){return this.theme??new P}whenLayerView(e){return this.layerViewManager?.whenLayerView(e)??Promise.reject()}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}getDefaultTimeZone(){return null}getDefaultTimeExtent(){return null}getSurface(){return null}importLayerView(e){throw new o("view:importLayerView-missing","importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}async loadAsyncDependencies(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return null!=this.getSpatialReferenceSupport(e)}when(e,t){return this.isResolved()&&!this.ready&&h.getLogger(this).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(v(()=>this.destroyed||!1===this.preconditionsReady,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}on(e,t){return super.on(e,t)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}static{this.views=new r}async _validateWithErrorDisplay(){try{await this.validate()}catch(e){const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const a=document.createElement("a");a.innerHTML="https://esriurl.com/webgl-faq",a.target="_blank",a.setAttribute("style","font-size: 18px;"),a.href="https://esriurl.com/webgl-faq",t.appendChild(i),t.appendChild(r),t.appendChild(a);const s=this.getSurface();throw s&&s.appendChild(t),e}}};e([M()],B.prototype,"_userSpatialReference",void 0),e([M()],B.prototype,"activeTool",null),e([M({readOnly:!0})],B.prototype,"allLayerViews",void 0),e([M({readOnly:!0})],B.prototype,"layerviewCollections",null),e([M(R(F,"analyses"))],B.prototype,"analyses",void 0),e([M()],B.prototype,"animation",null),e([M()],B.prototype,"animationsEnabled",void 0),e([M()],B.prototype,"basemapView",void 0),e([M()],B.prototype,"center",null),e([M()],B.prototype,"defaultsFromMapSettings",null),e([M()],B.prototype,"defaultsFromMap",null),e([M()],B.prototype,"dependencies",void 0),e([M()],B.prototype,"displayFilterEnabled",void 0),e([M({type:b})],B.prototype,"extent",null),e([M()],B.prototype,"fatalError",void 0),e([M(R(L,"graphics"))],B.prototype,"graphics",void 0),e([M({readOnly:!0,type:T})],B.prototype,"heightModelInfo",null),e([M({type:r.ofType(z)})],B.prototype,"highlights",null),e([M({readOnly:!0})],B.prototype,"interacting",null),e([M({constructOnly:!0})],B.prototype,"layerViewFilter",void 0),e([M({readOnly:!0})],B.prototype,"navigating",null),e([M({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_lockedSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],B.prototype,"preconditionsReady",null),e([M({readOnly:!0})],B.prototype,"typeSpecificPreconditionsReady",void 0),e([M({type:r,readOnly:!0})],B.prototype,"layerViews",void 0),e([M()],B.prototype,"resolution",null),e([M({type:H})],B.prototype,"magnifier",void 0),e([M({value:null,type:t})],B.prototype,"map",null),e([M()],B.prototype,"padding",void 0),e([M({readOnly:!0})],B.prototype,"ready",void 0),e([M()],B.prototype,"_readyStateWaitingTask",void 0),e([M({readOnly:!0})],B.prototype,"readyState",null),e([M({type:E})],B.prototype,"spatialReference",null),e([M()],B.prototype,"stationary",null),e([M({type:k})],B.prototype,"timeExtent",null),e([M({type:String,nonNullable:!0})],B.prototype,"timeZone",null),e([M()],B.prototype,"tools",null),e([M()],B.prototype,"toolViewManager",void 0),e([M({readOnly:!0})],B.prototype,"type",void 0),e([M({type:Number})],B.prototype,"scale",void 0),e([M({readOnly:!0})],B.prototype,"updating",void 0),e([M({readOnly:!0})],B.prototype,"initialExtentRequired",void 0),e([M({readOnly:!0})],B.prototype,"initialExtent",null),e([M()],B.prototype,"cursor",null),e([M({readOnly:!0})],B.prototype,"input",void 0),e([M({type:A,nonNullable:!0})],B.prototype,"navigation",void 0),e([M()],B.prototype,"layerViewManager",void 0),e([M()],B.prototype,"analysisViewManager",void 0),e([M()],B.prototype,"selectionManager",void 0),e([M()],B.prototype,"width",void 0),e([M()],B.prototype,"height",void 0),e([M({readOnly:!0})],B.prototype,"resizing",void 0),e([M({value:null,readOnly:!0})],B.prototype,"size",null),e([M({readOnly:!0})],B.prototype,"suspended",void 0),e([M({readOnly:!0})],B.prototype,"viewEvents",void 0),e([M({readOnly:!0})],B.prototype,"persistableViewModels",void 0),e([M()],B.prototype,"_isValid",void 0),e([M()],B.prototype,"_readyCycleForced",void 0),e([M()],B.prototype,"_lockedSpatialReference",void 0),e([M()],B.prototype,"_userTimeZone",void 0),e([M()],B.prototype,"_lockedTimeZone",void 0),e([M()],B.prototype,"_userTimeExtent",void 0),e([M()],B.prototype,"_lockedTimeExtent",void 0),e([M({type:P})],B.prototype,"theme",void 0),e([M({readOnly:!0,type:P})],B.prototype,"effectiveTheme",null),B=$=e([V("esri.views.View")],B);const J=globalThis.$arcgis;J&&!J.views&&Object.defineProperty(J,"views",{configurable:!1,enumerable:!0,writable:!1,value:B.views});const K=B;function Q(e){return e.layerViews}export{K as default};
package/views/View2D.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as p,cast as h,subclass as g}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import{initialize as c}from"../core/workers/workers.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import w from"../layers/support/TileInfo.js";import{AnalysesCollection as f}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as v}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import L from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as k}from"./2d/engine/ManagedCanvas.js";import C from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as P,setDefaultHighlightOptions as A}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as U}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import I from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import B from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as H}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(M(v(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new I({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analyses=new f,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new B,this.animationsEnabled=!0,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},c()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new C(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return P(this)}set highlightOptions(e){A(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return U(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>x(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new k(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new H(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>{this.stage.animationsEnabled=e},l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new L(w.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([p({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([p({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([p({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([p({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([p()],se.prototype,"graphicsView",void 0),e([p()],se.prototype,"constraintsInfo",null),e([p()],se.prototype,"initialExtentRequired",null),e([p()],se.prototype,"labelManager",void 0),e([p({type:I,nonNullable:!0})],se.prototype,"navigation",void 0),e([p({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([p()],se.prototype,"renderingOptions",void 0),e([p({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([p()],se.prototype,"defaultsFromMapSettings",null),e([p({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([p(u(f,"analyses"))],se.prototype,"analyses",void 0),e([p()],se.prototype,"analysisViewManager",void 0),e([p({type:J})],se.prototype,"background",null),e([p()],se.prototype,"center",null),e([p({type:i})],se.prototype,"floors",void 0),e([p()],se.prototype,"grid",void 0),e([p({type:W})],se.prototype,"highlightOptions",null),e([p()],se.prototype,"map",void 0),e([p()],se.prototype,"padding",null),e([p({readOnly:!0})],se.prototype,"rendering",null),e([p({readOnly:!0})],se.prototype,"resolution",null),e([p()],se.prototype,"scale",null),e([p({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([p({readOnly:!0})],se.prototype,"tileInfo",null),e([p({type:G,readOnly:!0})],se.prototype,"timeline",void 0),e([p({readOnly:!0})],se.prototype,"type",void 0),e([p({readOnly:!0})],se.prototype,"updating",null),e([p({readOnly:!0})],se.prototype,"view2dType",void 0),e([p({readOnly:!0})],se.prototype,"visibleArea",null),e([p()],se.prototype,"zoom",null),e([p({readOnly:!0})],se.prototype,"navigating",null),e([p(),h(e=>e instanceof F?e:d(B,e))],se.prototype,"ui",void 0),e([p()],se.prototype,"animationsEnabled",void 0),se=e([g("esri.views.View2D")],se);const ae=se;export{ae as default};
5
+ import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as p,cast as h,subclass as g}from"../core/accessorSupport/decorators.js";import{ensureClass as d}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import{initialize as c}from"../core/workers/workers.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import w from"../layers/support/TileInfo.js";import{AnalysesCollection as f}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as v}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import L from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as k}from"./2d/engine/ManagedCanvas.js";import C from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as D}from"./2d/layers/support/util.js";import{clipContainsPoint as x}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as P,setDefaultHighlightOptions as A}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as U}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import I from"./navigation/Navigation.js";import q from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import B from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as H}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(M(v(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new I({actionMap:new q({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analyses=new f,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new B,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},c()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new C(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return P(this)}set highlightOptions(e){A(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return U(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}getSurface(){return this.surface}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>x(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new k(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new H(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=D(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l),o(()=>this.animationsEnabled,e=>this.stage.animationsEnabled=e,l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new L(w.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([p({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([p({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([p({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([p({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([p()],se.prototype,"graphicsView",void 0),e([p()],se.prototype,"constraintsInfo",null),e([p()],se.prototype,"initialExtentRequired",null),e([p()],se.prototype,"labelManager",void 0),e([p({type:I,nonNullable:!0})],se.prototype,"navigation",void 0),e([p({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([p()],se.prototype,"renderingOptions",void 0),e([p({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([p()],se.prototype,"defaultsFromMapSettings",null),e([p({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([p(u(f,"analyses"))],se.prototype,"analyses",void 0),e([p()],se.prototype,"analysisViewManager",void 0),e([p({type:J})],se.prototype,"background",null),e([p()],se.prototype,"center",null),e([p({type:i})],se.prototype,"floors",void 0),e([p()],se.prototype,"grid",void 0),e([p({type:W})],se.prototype,"highlightOptions",null),e([p()],se.prototype,"map",void 0),e([p()],se.prototype,"padding",null),e([p({readOnly:!0})],se.prototype,"rendering",null),e([p({readOnly:!0})],se.prototype,"resolution",null),e([p()],se.prototype,"scale",null),e([p({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([p({readOnly:!0})],se.prototype,"tileInfo",null),e([p({type:G,readOnly:!0})],se.prototype,"timeline",void 0),e([p({readOnly:!0})],se.prototype,"type",void 0),e([p({readOnly:!0})],se.prototype,"updating",null),e([p({readOnly:!0})],se.prototype,"view2dType",void 0),e([p({readOnly:!0})],se.prototype,"visibleArea",null),e([p()],se.prototype,"zoom",null),e([p({readOnly:!0})],se.prototype,"navigating",null),e([p(),h(e=>e instanceof F?e:d(B,e))],se.prototype,"ui",void 0),se=e([g("esri.views.View2D")],se);const ae=se;export{ae 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as e,subclass as r}from"../core/accessorSupport/decorators.js";import{GoToManager as n}from"./2d/GoToManager.js";import i from"./2d/input/MapViewInputManager.js";import{isSupportedScreenPointEvent as o,createScreenPointFromSupportedEvent as s}from"./support/screenUtils.js";const a=a=>{const p=a;let g=class extends p{constructor(...t){super(...t),this.goToManager=new n({view:this}),this.animationsEnabled=!0,this.inputManager=new i({view:this}),this.addHandles([this.on("resize",t=>this.stateManager.resize(t.width,t.height))])}get interacting(){return this.navigating}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}on(t,e,r,n){const i=this.viewEvents.on(t,e,r,n);return i||super.on(t,e)}hasEventListener(t){return super.hasEventListener(t)||this.viewEvents.hasHandler(t)}goTo(t,e){return this.goToManager.goTo(t,e)}toMap(t){if(!this.ready)return null;const e=o(t)?s(this,t):t;return this.stateManager.toMap(e)}};return t([e()],g.prototype,"goToManager",void 0),t([e({readOnly:!0})],g.prototype,"interacting",null),t([e()],g.prototype,"stationary",null),t([e()],g.prototype,"animationsEnabled",void 0),t([e({readOnly:!0})],g.prototype,"inputManager",void 0),g=t([r("esri.views.Viewport2DMixin")],g),g};export{a as Viewport2DMixin};
5
+ import{__decorate as t}from"tslib";import{property as r,subclass as e}from"../core/accessorSupport/decorators.js";import{GoToManager as n}from"./2d/GoToManager.js";import i from"./2d/input/MapViewInputManager.js";import{isSupportedScreenPointEvent as s,createScreenPointFromSupportedEvent as o}from"./support/screenUtils.js";const a=a=>{const p=a;let g=class extends p{constructor(...t){super(...t),this.goToManager=new n({view:this}),this.inputManager=new i({view:this}),this.addHandles([this.on("resize",t=>this.stateManager.resize(t.width,t.height))])}get interacting(){return this.navigating}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}on(t,r,e,n){const i=this.viewEvents.on(t,r,e,n);return i||super.on(t,r)}hasEventListener(t){return super.hasEventListener(t)||this.viewEvents.hasHandler(t)}goTo(t,r){return this.goToManager.goTo(t,r)}toMap(t){if(!this.ready)return null;const r=s(t)?o(this,t):t;return this.stateManager.toMap(r)}};return t([r()],g.prototype,"goToManager",void 0),t([r({readOnly:!0})],g.prototype,"interacting",null),t([r()],g.prototype,"stationary",null),t([r({readOnly:!0})],g.prototype,"inputManager",void 0),g=t([e("esri.views.Viewport2DMixin")],g),g};export{a as Viewport2DMixin};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{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};
5
+ import{Seconds as t}from"../../core/time.js";class i{constructor(i,o,s){this._initialVelocity=i,this._stopVelocity=o,this.friction=s,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}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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Viewpoint.js";import i from"../../core/CollectionFlattener.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as r,watch as a,syncAndInitial as o}from"../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../core/accessorSupport/decorators.js";import{initialize as p}from"../../core/workers/workers.js";import{isLoadedOrLoadFor as h}from"../../geometry/projectionUtils.js";import d from"../../layers/support/TileInfo.js";import g from"../View.js";import{Viewport2DBaseMixin as m}from"../Viewport2DBaseMixin.js";import c from"../2d/AnimationManager.js";import{GoToManager as u}from"../2d/GoToManager.js";import{layerView2DImporter as w}from"../2d/layerViewModuleImportUtils.js";import y from"../2d/tiling/TileInfoView.js";import"../2d/tiling/TileKey.js";import"../2d/tiling/TileQueue.js";import"../2d/tiling/TileStrategy.js";import{extentToScale as f}from"../2d/viewpointUtils.js";import V from"../2d/layers/features/support/TileStore.js";import{hitTest as v}from"../2d/support/hitTestUtils.js";import{Timeline as M}from"../2d/support/Timeline.js";let T,j,_,S;async function b(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s}]=await Promise.all([import("../2d/webglDeps.js"),import("../2d/mapViewDeps.js")]);T=e,j=t,_=i,S=s}let D=class extends(m(g)){constructor(e){super(e),this.stage=null,this.rootLayerViews=new i({getCollections:()=>[this.layerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.timeline=new M,this.goToManager=new u({view:this}),this.labelManager=null,this.animationsEnabled=!0,this.map=null,this.surface=null,this.padding={top:0,right:0,bottom:0,left:0},p()}initialize(){this.addResolvingPromise(r(()=>this.ready))}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=s(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy()}get graphicsTileStore(){return new V(this.featuresTilingScheme)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return h(t.spatialReference,i)}async hitTest(e,t){return v(this,e,t)}goTo(e,t){return this.goToManager.goTo(e,t)}toMap(e){return this.stateManager.toMap(e)}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return b()}hasLayerViewModule(e){return w.hasLayerViewModule(e)}importLayerView(e){return w.importLayerView(e)}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:s,padding:r,size:a}=this;if(!e)return null;const o=s&&"initialViewProperties"in s?s.initialViewProperties:void 0,n=this.stateManager.getUserStartupOptions(this.size),l=o?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&f(p,[a[0]-r.left-r.right,a[1]-r.top-r.bottom]),m=n.center??h,c=n.rotation??d,u=n.scale??g;return m&&u?new t({targetGeometry:m,scale:u,rotation:c}):null}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container)}_startup(){this.timeline.begin("VideoOperationalDataView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new _({view:this});this._set("labelManager",t);const i=new c({view:this});this._set("animationManager",i);const s=new S({view:this,animationManager:i});this._set("mapViewNavigation",s);const r=new y(d.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",r);const n=new T({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new j(r)});this._set("graphicsView",n),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),this.stage.on("webgl-error",e=>this.fatalError=e.error),a(()=>this.stationary,e=>this.stage.stationary=e,o),a(()=>this.state.id,()=>this.stage.state=this.state,o)],"video-graphics-view"),this._updateStageChildren(),this.timeline.end("VideoOperationalDataView Startup"),this.frameTask.start(),this.stage.viewIsReady=!0,this._set("ready",!0)}_teardown(){this.removeHandles("video-graphics-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.stage.destroy(),this.stage=null;const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}};e([n()],D.prototype,"stage",void 0),e([n({readOnly:!0})],D.prototype,"featuresTilingScheme",void 0),e([n({readOnly:!0})],D.prototype,"graphicsTileStore",null),e([n()],D.prototype,"graphicsView",void 0),e([n({type:M,readOnly:!0})],D.prototype,"timeline",void 0),e([n()],D.prototype,"goToManager",void 0),e([n()],D.prototype,"labelManager",void 0),e([n()],D.prototype,"animationsEnabled",void 0),e([n()],D.prototype,"map",void 0),e([n({readOnly:!0})],D.prototype,"typeSpecificPreconditionsReady",null),e([n({readOnly:!0})],D.prototype,"surface",void 0),D=e([l("esri.views.video.VideoOperationalDataView")],D);const C=D;export{C as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Viewpoint.js";import i from"../../core/CollectionFlattener.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as r,watch as a,syncAndInitial as o}from"../../core/reactiveUtils.js";import{property as n,subclass as l}from"../../core/accessorSupport/decorators.js";import{initialize as p}from"../../core/workers/workers.js";import{isLoadedOrLoadFor as h}from"../../geometry/projectionUtils.js";import d from"../../layers/support/TileInfo.js";import g from"../View.js";import{Viewport2DBaseMixin as m}from"../Viewport2DBaseMixin.js";import c from"../2d/AnimationManager.js";import{GoToManager as u}from"../2d/GoToManager.js";import{layerView2DImporter as w}from"../2d/layerViewModuleImportUtils.js";import y from"../2d/tiling/TileInfoView.js";import"../2d/tiling/TileKey.js";import"../2d/tiling/TileQueue.js";import"../2d/tiling/TileStrategy.js";import{extentToScale as f}from"../2d/viewpointUtils.js";import V from"../2d/layers/features/support/TileStore.js";import{hitTest as v}from"../2d/support/hitTestUtils.js";import{Timeline as M}from"../2d/support/Timeline.js";let T,j,_,S;async function b(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:s}]=await Promise.all([import("../2d/webglDeps.js"),import("../2d/mapViewDeps.js")]);T=e,j=t,_=i,S=s}let D=class extends(m(g)){constructor(e){super(e),this.stage=null,this.rootLayerViews=new i({getCollections:()=>[this.layerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.timeline=new M,this.goToManager=new u({view:this}),this.labelManager=null,this.map=null,this.surface=null,this.padding={top:0,right:0,bottom:0,left:0},p()}initialize(){this.addResolvingPromise(r(()=>this.ready))}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=s(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy()}get graphicsTileStore(){return new V(this.featuresTilingScheme)}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return h(t.spatialReference,i)}async hitTest(e,t){return v(this,e,t)}goTo(e,t){return this.goToManager.goTo(e,t)}toMap(e){return this.stateManager.toMap(e)}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}loadAsyncDependencies(){return b()}hasLayerViewModule(e){return w.hasLayerViewModule(e)}importLayerView(e){return w.importLayerView(e)}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:s,padding:r,size:a}=this;if(!e)return null;const o=s&&"initialViewProperties"in s?s.initialViewProperties:void 0,n=this.stateManager.getUserStartupOptions(this.size),l=o?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,d=l?.rotation??0,g=l?.scale||p&&f(p,[a[0]-r.left-r.right,a[1]-r.top-r.bottom]),m=n.center??h,c=n.rotation??d,u=n.scale??g;return m&&u?new t({targetGeometry:m,scale:u,rotation:c}):null}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container)}_startup(){this.timeline.begin("VideoOperationalDataView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new _({view:this});this._set("labelManager",t);const i=new c({view:this});this._set("animationManager",i);const s=new S({view:this,animationManager:i});this._set("mapViewNavigation",s);const r=new y(d.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",r);const n=new T({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new j(r)});this._set("graphicsView",n),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),this.stage.on("webgl-error",e=>this.fatalError=e.error),a(()=>this.stationary,e=>this.stage.stationary=e,o),a(()=>this.state.id,()=>this.stage.state=this.state,o)],"video-graphics-view"),this._updateStageChildren(),this.timeline.end("VideoOperationalDataView Startup"),this.frameTask.start(),this.stage.viewIsReady=!0,this._set("ready",!0)}_teardown(){this.removeHandles("video-graphics-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.stage.destroy(),this.stage=null;const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}};e([n()],D.prototype,"stage",void 0),e([n({readOnly:!0})],D.prototype,"featuresTilingScheme",void 0),e([n({readOnly:!0})],D.prototype,"graphicsTileStore",null),e([n()],D.prototype,"graphicsView",void 0),e([n({type:M,readOnly:!0})],D.prototype,"timeline",void 0),e([n()],D.prototype,"goToManager",void 0),e([n()],D.prototype,"labelManager",void 0),e([n()],D.prototype,"map",void 0),e([n({readOnly:!0})],D.prototype,"typeSpecificPreconditionsReady",null),e([n({readOnly:!0})],D.prototype,"surface",void 0),D=e([l("esri.views.video.VideoOperationalDataView")],D);const C=D;export{C as default};
package/webscene/Slide.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{JSONSupport as a}from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w,cast as f,subclass as T}from"../core/accessorSupport/decorators.js";import{ensureType as L}from"../core/accessorSupport/ensureType.js";import{s as j}from"../chunks/vec32.js";import{create as _}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as k}from"../views/support/Scheduler.js";import{SlideThumbnail as A}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as O}from"./support/SlideVisibleLayer.js";import P from"./support/Title.js";let q=0;const B=s.ofType(O),M=["caption","cover","none"];let N=class extends(r(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+q++,this.title=new P,this.description=new F,this.hidden=!1,this.thumbnail=new A,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=null,this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new B}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements.destroy()}castTitle(e){return"string"==typeof e?new P({text:e}):L(P,e)}castDescription(e){return"string"==typeof e?new F({text:e}):L(F,e)}castThumbnail(e){return"string"==typeof e?new A({url:e}):L(A,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),B))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map(e=>{if("string"==typeof e)return{id:e};if(e instanceof C){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)}):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map(i=>e.whenLayerView(i).then(e=>{if(e.visible){const n=H(i);t.push(new O({id:e.layer.id,sublayerIds:n}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=new s(e.focusAreasView?.enabledAreas.map(({id:e})=>e)??[]),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new A({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,()=>i?.abort()),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y(()=>e.ready,i.signal)}catch(c){throw s(),c}if(i.signal.aborted)throw s(),d();const o=e.resourceController.scheduler.registerTask(k.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule(async()=>a=await this._setViewpointOfInterest(e,l)),o.schedule(()=>this._applyBasemap(e,l),l.signal),o.schedule(()=>this._loadLayersWithSublayerVisibility(e))]),await Promise.all([o.schedule(()=>this._applyLayerVisibility(e),l.signal),o.schedule(()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas)),o.schedule(()=>this._applyGround(e),l.signal),o.schedule(()=>this.elements.analyses.applyTo(e),l.signal),o.schedule(()=>this._applyViewpoint(e,l),l.signal),o.schedule(()=>e.timeExtent=this.timeExtent?.clone()??null,l.signal),o.schedule(()=>e.environment.weather=this.environment.weather.clone())])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach(e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(e=>{const t=this.visibleLayers.find(t=>t.id===e.id)?.sublayerIds;return t?e.load():null}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach(e=>{const t=this.visibleLayers.find(t=>t.id===e.id);e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach(e=>e.visible=i.includes(e.id))})}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t}).finally(()=>{c(i)})}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=_();p.toRenderCoords(e.camera.position,m);const c=_(),h=_();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g(()=>e.camera,e=>{p.toRenderCoords(e.position,h);const i=j(m,h),n=j(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(d,u,y)})}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],N.prototype,"id",void 0),e([w({type:P,json:{default:()=>new P({text:""}),write:{isRequired:!0}}})],N.prototype,"title",void 0),e([f("title")],N.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],N.prototype,"description",void 0),e([f("description")],N.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],N.prototype,"hidden",void 0),e([w({type:A,json:{default:()=>new A({url:""}),write:{isRequired:!0}}})],N.prototype,"thumbnail",void 0),e([f("thumbnail")],N.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],N.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],N.prototype,"basemap",void 0),e([f("basemap")],N.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],N.prototype,"ground",void 0),e([w({type:M,json:{write:!0,default:"caption"},nonNullable:!0})],N.prototype,"layout",void 0),e([w({type:B,json:{write:{isRequired:!0}}})],N.prototype,"visibleLayers",null),e([f("visibleLayers")],N.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],N.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],N.prototype,"environment",void 0),e([w(V)],N.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],N.prototype,"elements",void 0),N=e([T("esri.webscene.Slide")],N);const G=N;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter(e=>e.visible).map(e=>e.id)}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{G as default};
5
+ import{__decorate as e}from"tslib";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import{ClonableMixin as r}from"../core/Clonable.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import{JSONSupport as a}from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as h}from"../core/maybe.js";import{onAbortOrThrow as c,createAbortError as u,isAbortError as d}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w,cast as f,subclass as T}from"../core/accessorSupport/decorators.js";import{ensureType as _}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as j}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as A}from"../views/support/Scheduler.js";import{SlideThumbnail as k}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import F from"./VirtualLighting.js";import x from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as R}from"./support/SlideEnvironment.js";import D from"./support/SlideGround.js";import{SlideVisibleLayer as O}from"./support/SlideVisibleLayer.js";import P from"./support/Title.js";let q=0;const M=s.ofType(O),N=["caption","cover","none"];let B=class extends(r(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+q++,this.hidden=!1,this.viewpoint=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=null,this.environment=new R,this.timeExtent=null,this.elements=new I,this.title=new P,this.description=new x,this.thumbnail=new k,this.visibleLayers=new M}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements.destroy()}get title(){return this._get("title")}set title(e){e="string"==typeof e?new P({text:e}):_(P,e),this._set("title",e)}get description(){return this._get("description")}set description(e){e="string"==typeof e?new x({text:e}):_(x,e),this._set("description",e)}get thumbnail(){return this._get("thumbnail")}set thumbnail(e){e="string"==typeof e?new k({url:e}):_(k,e),this._set("thumbnail",e)}get basemap(){return this._get("basemap")}set basemap(e){this._set("basemap",E(e))}set visibleLayers(e){this._set("visibleLayers",o(e,this._get("visibleLayers"),M))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map(e=>{if("string"==typeof e)return{id:e};if(e instanceof C){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)}):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map(i=>e.whenLayerView(i).then(e=>{if(e.visible){const n=H(i);t.push(new O({id:e.layer.id,sublayerIds:n}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?F.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=new s(e.focusAreasView?.enabledAreas.map(({id:e})=>e)??[]),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?D.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new k({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=c(t,()=>i?.abort()),s=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y(()=>e.ready,i.signal)}catch(h){throw s(),h}if(i.signal.aborted)throw s(),u();const o=e.resourceController.scheduler.registerTask(A.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([o.schedule(async()=>a=await this._setViewpointOfInterest(e,l)),o.schedule(()=>this._applyBasemap(e,l),l.signal),o.schedule(()=>this._loadLayersWithSublayerVisibility(e))]),await Promise.all([o.schedule(()=>this._applyLayerVisibility(e),l.signal),o.schedule(()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas)),o.schedule(()=>this._applyGround(e),l.signal),o.schedule(()=>this.elements.analyses.applyTo(e),l.signal),o.schedule(()=>this._applyViewpoint(e,l),l.signal),o.schedule(()=>e.timeExtent=this.timeExtent?.clone()??null,l.signal),o.schedule(()=>e.environment.weather=this.environment.weather.clone())])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),o.remove(),s(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(d(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new s;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach(e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(e=>{const t=this.visibleLayers.find(t=>t.id===e.id)?.sublayerIds;return t?e.load():null}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach(e=>{const t=this.visibleLayers.find(t=>t.id===e.id);e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach(e=>e.visible=i.includes(e.id))})}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t}).finally(()=>{h(i)})}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,s]=this._getTime(n),[o,a]=this._getTime(i.date),l=K(s,a),p=e.renderCoordsHelper,m=j();p.toRenderCoords(e.camera.position,m);const h=j(),c=j();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,h);const u=new Date;return g(()=>e.camera,e=>{p.toRenderCoords(e.position,c);const i=L(m,c),n=L(h,c);let a=0;i+n!==0&&(a=i/(i+n));const d=r+(o-r)*a,y=Q(s,v(l*a));t.date=this._setTime(u,d,y)})}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],B.prototype,"id",void 0),e([w({type:P,useTypeForAutocast:!1,json:{default:()=>new P({text:""}),write:{isRequired:!0}}})],B.prototype,"title",null),e([w({type:x,useTypeForAutocast:!1,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],B.prototype,"description",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],B.prototype,"hidden",void 0),e([w({type:k,useTypeForAutocast:!1,json:{default:()=>new k({url:""}),write:{isRequired:!0}}})],B.prototype,"thumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],B.prototype,"viewpoint",void 0),e([w({type:t,useTypeForAutocast:!1,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],B.prototype,"basemap",null),e([w({type:D,json:{write:!0}})],B.prototype,"ground",void 0),e([w({type:N,json:{write:!0,default:"caption"},nonNullable:!0})],B.prototype,"layout",void 0),e([w({type:M,json:{write:{isRequired:!0}}})],B.prototype,"visibleLayers",null),e([f("visibleLayers")],B.prototype,"castVisibleLayers",null),e([w({type:s.ofType(String),json:{write:!0},clonable:e=>e?new s(e.items):null})],B.prototype,"enabledFocusAreas",void 0),e([w({type:R,json:{write:!0}})],B.prototype,"environment",void 0),e([w(V)],B.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],B.prototype,"elements",void 0),B=e([T("esri.webscene.Slide")],B);const G=B;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter(e=>e.visible).map(e=>e.id)}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{G 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Basemap.js";import i from"../../core/Collection.js";import{Loadable as s,isLoadable as a}from"../../core/Loadable.js";import{watch as r,on as o,when as n}from"../../core/reactiveUtils.js";import{property as p,cast as c,subclass as m}from"../../core/accessorSupport/decorators.js";import{canProjectWithoutEngine as l,isLoaded as u,load as d}from"../../geometry/projectionUtils.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{isLinkChartView as y}from"../../linkChart/utils.js";import{basemapEnsureType as f}from"../../support/basemapEnsureType.js";import{contentEquals as v}from"../../support/basemapUtils.js";import{default3DCompatibility as b,default2DCompatibility as w}from"./support/basemapCompatibilityUtils.js";import B from"./support/BasemapGalleryItem.js";import g from"./support/LocalBasemapsSource.js";import j from"./support/PortalBasemapsSource.js";const _=i.ofType(B);function I(e){return e&&"esri.portal.Portal"===e.declaredClass}function R(e){return e&&!(e instanceof j)&&(!!e.portal||!!e.query)}function E(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let F=class extends s{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new _,this.source=new j,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([r(()=>"ready"===this.state?this.compatibilityFunction:null,()=>this._updateItems()),o(()=>this.source?.basemaps,"change",e,{onListenerAdd:e}),n(()=>this.view,()=>{this.source instanceof j&&(this.source.viewType=this.view?.type)},{once:!0})])}destroy(){const e=this.source.basemaps.find(e=>e===this.activeBasemap);e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const t=this.view;if(!t?.map)return;if(!e||!t.ready)return t.map.basemap=e,void this._clearOverride("activeBasemap");const i=e.spatialReference||this.items?.find(t=>this.basemapEquals(e,t.basemap))?.spatialReference;if(i&&"spatialReferenceLocked"in t&&!t.spatialReferenceLocked){const s=t.spatialReference;if(null!=i&&!h(s,i)&&!l(t.spatialReference,i)&&!u())return this._override("activeBasemap",e),this._loadingProjectionEngine=!0,void d().then(()=>{this._get("activeBasemap")===e&&(t.map.basemap=e,t.spatialReference=i,this._clearOverride("activeBasemap"))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});t.map.basemap=e,this._clearOverride("activeBasemap"),null==i||h(t.spatialReference,i)||(t.spatialReference=i)}else t.map.basemap=e,this._clearOverride("activeBasemap")}castActiveBasemap(e){return f(e)}get activeBasemapIndex(){const{state:e,activeBasemap:t}=this;return"ready"!==e?-1:this._findBasemapIndex(t)}get compatibilityFunction(){return"3d"===this.view?.type?b:w}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||i.isCollection(e)?new g({basemaps:Array.isArray(e)?new i(e):e}):I(e)?new j({portal:e}):R(e)?new j(e):E(e)?e:null}get state(){return this.view?.ready&&this.source?y(this.view)&&!this.view.inGeographicLayout?"unsupported":this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return v(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(a(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:t}=this,i=t.findIndex(t=>t.basemap===e);return-1===i?t.findIndex(t=>this.basemapEquals(t.basemap,e)):i}_recreateItems(){const e=this.source?.basemaps??[],{view:t,compatibilityFunction:i}=this,s=new Map(this.items.map(e=>[e.basemap,e])),a=e.map(e=>{const a=s.get(e);return a?(s.delete(e),a):new B({basemap:e,compatibilityFunction:i,view:t})});this.items.removeAll(),this.items.addMany(a),s.forEach(e=>e.destroy())}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([p()],F.prototype,"_loadingProjectionEngine",void 0),e([p({type:t})],F.prototype,"activeBasemap",null),e([c("activeBasemap")],F.prototype,"castActiveBasemap",null),e([p({readOnly:!0})],F.prototype,"activeBasemapIndex",null),e([p()],F.prototype,"compatibilityFunction",null),e([p({readOnly:!0,type:_})],F.prototype,"items",void 0),e([p()],F.prototype,"source",void 0),e([c("source")],F.prototype,"castSource",null),e([p({readOnly:!0})],F.prototype,"state",null),e([p()],F.prototype,"view",void 0),F=e([m("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],F);const P=F;export{P as default};
5
+ import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import{Loadable as i,isLoadable as s}from"../../core/Loadable.js";import{watch as a,on as r,when as o}from"../../core/reactiveUtils.js";import{property as n,cast as p,subclass as c}from"../../core/accessorSupport/decorators.js";import{canProjectWithoutEngine as m,isLoaded as l,load as u}from"../../geometry/projectionUtils.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{isLinkChartView as h}from"../../linkChart/utils.js";import{basemapEnsureType as y}from"../../support/basemapEnsureType.js";import{contentEquals as f}from"../../support/basemapUtils.js";import{default3DCompatibility as v,default2DCompatibility as b}from"./support/basemapCompatibilityUtils.js";import w from"./support/BasemapGalleryItem.js";import g from"./support/LocalBasemapsSource.js";import B from"./support/PortalBasemapsSource.js";const j=t.ofType(w);function _(e){return e&&"esri.portal.Portal"===e.declaredClass}function I(e){return e&&!(e instanceof B)&&(!!e.portal||!!e.query)}function R(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let E=class extends i{constructor(e){super(e),this._loadingProjectionEngine=!1,this.items=new j,this.source=new B,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([a(()=>"ready"===this.state?this.compatibilityFunction:null,()=>this._updateItems()),r(()=>this.source?.basemaps,"change",e,{onListenerAdd:e}),o(()=>this.view,()=>{this.source instanceof B&&(this.source.viewType=this.view?.type)},{once:!0})])}destroy(){const e=this.source.basemaps.find(e=>e===this.activeBasemap);e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const t=this.view;if(!t?.map)return;if(!(e=y(e))||!t.ready)return t.map.basemap=e,void this._clearOverride("activeBasemap");const i=e.spatialReference||this.items?.find(t=>this.basemapEquals(e,t.basemap))?.spatialReference;if(i&&"spatialReferenceLocked"in t&&!t.spatialReferenceLocked){const s=t.spatialReference;if(null!=i&&!d(s,i)&&!m(t.spatialReference,i)&&!l())return this._override("activeBasemap",e),this._loadingProjectionEngine=!0,void u().then(()=>{this._get("activeBasemap")===e&&(t.map.basemap=e,t.spatialReference=i,this._clearOverride("activeBasemap"))},()=>{}).then(()=>{this._loadingProjectionEngine=!1});t.map.basemap=e,this._clearOverride("activeBasemap"),null==i||d(t.spatialReference,i)||(t.spatialReference=i)}else t.map.basemap=e,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:t}=this;return"ready"!==e?-1:this._findBasemapIndex(t)}get compatibilityFunction(){return"3d"===this.view?.type?v:b}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||t.isCollection(e)?new g({basemaps:Array.isArray(e)?new t(e):e}):_(e)?new B({portal:e}):I(e)?new B(e):R(e)?e:null}get state(){return this.view?.ready&&this.source?h(this.view)&&!this.view.inGeographicLayout?"unsupported":this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return f(e,t)}refresh(){this._recreateItems()}load(){return this.loadSource()}loadSource(e){return this.addResolvingPromise(s(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:t}=this,i=t.findIndex(t=>t.basemap===e);return-1===i?t.findIndex(t=>this.basemapEquals(t.basemap,e)):i}_recreateItems(){const e=this.source?.basemaps??[],{view:t,compatibilityFunction:i}=this,s=new Map(this.items.map(e=>[e.basemap,e])),a=e.map(e=>{const a=s.get(e);return a?(s.delete(e),a):new w({basemap:e,compatibilityFunction:i,view:t})});this.items.removeAll(),this.items.addMany(a),s.forEach(e=>e.destroy())}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([n()],E.prototype,"_loadingProjectionEngine",void 0),e([n()],E.prototype,"activeBasemap",null),e([n({readOnly:!0})],E.prototype,"activeBasemapIndex",null),e([n()],E.prototype,"compatibilityFunction",null),e([n({readOnly:!0,type:j})],E.prototype,"items",void 0),e([n()],E.prototype,"source",void 0),e([p("source")],E.prototype,"castSource",null),e([n({readOnly:!0})],E.prototype,"state",null),e([n()],E.prototype,"view",void 0),E=e([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],E);const F=E;export{F 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import a from"../../core/Accessor.js";import{watch as t,initial as s,whenOnce as i}from"../../core/reactiveUtils.js";import{property as n,cast as p,subclass as r}from"../../core/accessorSupport/decorators.js";import{isLoaded as o,canProjectWithoutEngine as l,load as c}from"../../geometry/projectionUtils.js";import{equals as m}from"../../geometry/support/spatialReferenceUtils.js";import{basemapEnsureType as h,destroyCache as f}from"../../support/basemapEnsureType.js";import{findSpatialReference as d,getBasemapThumbnailUrl as u}from"../../support/basemapUtils.js";let g=class extends a{constructor(e){super(e),this._basemapCache={},this._loadingProjectionEngine=!1,this.nextBasemap=h("hybrid",this._basemapCache),this.view=null}initialize(){t(()=>this.nextBasemap,e=>{e&&!e.loaded&&e.load().catch(()=>{})},s)}destroy(){this.view=null,f(this._basemapCache),this._basemapCache=null}get _nextBasemapSpatialReferenceTask(){return d(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){const{view:e}=this;return!e||!("spatialReferenceLocked"in e)||e.spatialReferenceLocked}get activeBasemap(){return h(this.view?.map?.basemap??"topo-vector",this._basemapCache)}castNextBasemap(e){return h(e,this._basemapCache)}get state(){const{view:e}=this;if(!e?.ready)return"disabled";if(this._nextBasemapSpatialReferenceTask.updating)return"disabled";const{spatialReference:a}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&null!=a&&!e.spatialReference.equals(a)?"incompatible-next-basemap":this._loadingProjectionEngine?"loading":"ready"}async toggle(){const{activeBasemap:e,nextBasemap:a,state:t,view:s}=this;if(!s||"disabled"===t||"incompatible-next-basemap"===t)return;const n=this._viewSpatialReferenceLocked;if(!n){if(await i(()=>!this._nextBasemapSpatialReferenceTask.updating),a!==this.nextBasemap||e!==this.activeBasemap)return;const{spatialReference:t}=this._nextBasemapSpatialReferenceTask;if(null==t||m(s.spatialReference,t)||o()||l(s.spatialReference,t)||(this._loadingProjectionEngine=!0,await c(),this._loadingProjectionEngine=!1),a!==this.nextBasemap||e!==this.activeBasemap)return}s.map.basemap=a,n||null==this._nextBasemapSpatialReferenceTask.spatialReference||m(s.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)||(s.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference),this.nextBasemap=e}static getThumbnailUrl(e){return u(e)}};e([n()],g.prototype,"_loadingProjectionEngine",void 0),e([n({readOnly:!0})],g.prototype,"_nextBasemapSpatialReferenceTask",null),e([n({readOnly:!0})],g.prototype,"_viewSpatialReferenceLocked",null),e([n({readOnly:!0})],g.prototype,"activeBasemap",null),e([n()],g.prototype,"nextBasemap",void 0),e([p("nextBasemap")],g.prototype,"castNextBasemap",null),e([n({readOnly:!0})],g.prototype,"state",null),e([n()],g.prototype,"view",void 0),e([n()],g.prototype,"toggle",null),g=e([r("esri.widgets.BasemapToggle.BasemapToggleViewModel")],g);const B=g;export{B as default};
5
+ import{__decorate as e}from"tslib";import a from"../../core/Accessor.js";import{watch as t,initial as s,whenOnce as i}from"../../core/reactiveUtils.js";import{property as n,subclass as p}from"../../core/accessorSupport/decorators.js";import{isLoaded as r,canProjectWithoutEngine as o,load as l}from"../../geometry/projectionUtils.js";import{equals as c}from"../../geometry/support/spatialReferenceUtils.js";import{basemapEnsureType as m,destroyCache as h}from"../../support/basemapEnsureType.js";import{findSpatialReference as f,getBasemapThumbnailUrl as d}from"../../support/basemapUtils.js";let u=class extends a{constructor(e){super(e),this._basemapCache={},this._loadingProjectionEngine=!1,this.view=null,this.nextBasemap=m("hybrid",this._basemapCache)}initialize(){t(()=>this.nextBasemap,e=>{e&&!e.loaded&&e.load().catch(()=>{})},s)}destroy(){this.view=null,h(this._basemapCache),this._basemapCache=null}get _nextBasemapSpatialReferenceTask(){return f(this.view,this.nextBasemap)}get _viewSpatialReferenceLocked(){const{view:e}=this;return!e||!("spatialReferenceLocked"in e)||e.spatialReferenceLocked}get activeBasemap(){return m(this.view?.map?.basemap??"topo-vector",this._basemapCache)}get nextBasemap(){return this._get("nextBasemap")}set nextBasemap(e){this._set("nextBasemap",m(e,this._basemapCache))}get state(){const{view:e}=this;if(!e?.ready)return"disabled";if(this._nextBasemapSpatialReferenceTask.updating)return"disabled";const{spatialReference:a}=this._nextBasemapSpatialReferenceTask;return this._viewSpatialReferenceLocked&&null!=a&&!e.spatialReference.equals(a)?"incompatible-next-basemap":this._loadingProjectionEngine?"loading":"ready"}async toggle(){const{activeBasemap:e,nextBasemap:a,state:t,view:s}=this;if(!s||"disabled"===t||"incompatible-next-basemap"===t)return;const n=this._viewSpatialReferenceLocked;if(!n){if(await i(()=>!this._nextBasemapSpatialReferenceTask.updating),a!==this.nextBasemap||e!==this.activeBasemap)return;const{spatialReference:t}=this._nextBasemapSpatialReferenceTask;if(null==t||c(s.spatialReference,t)||r()||o(s.spatialReference,t)||(this._loadingProjectionEngine=!0,await l(),this._loadingProjectionEngine=!1),a!==this.nextBasemap||e!==this.activeBasemap)return}s.map.basemap=a,n||null==this._nextBasemapSpatialReferenceTask.spatialReference||c(s.spatialReference,this._nextBasemapSpatialReferenceTask.spatialReference)||(s.spatialReference=this._nextBasemapSpatialReferenceTask.spatialReference),this.nextBasemap=e}static getThumbnailUrl(e){return d(e)}};e([n()],u.prototype,"_loadingProjectionEngine",void 0),e([n({readOnly:!0})],u.prototype,"_nextBasemapSpatialReferenceTask",null),e([n({readOnly:!0})],u.prototype,"_viewSpatialReferenceLocked",null),e([n({readOnly:!0})],u.prototype,"activeBasemap",null),e([n()],u.prototype,"nextBasemap",null),e([n({readOnly:!0})],u.prototype,"state",null),e([n()],u.prototype,"view",void 0),e([n()],u.prototype,"toggle",null),u=e([p("esri.widgets.BasemapToggle.BasemapToggleViewModel")],u);const g=u;export{g as default};