@arcgis/core 5.2.0-next.126 → 5.2.0-next.128

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 (234) hide show
  1. package/WebScene.js +1 -1
  2. package/applications/Components/basemapToggleUtils.d.ts +53 -0
  3. package/applications/Components/basemapToggleUtils.js +2 -0
  4. package/applications/SceneViewer/sceneViewerUtils.d.ts +14 -1
  5. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  6. package/applications/WebEditor/sketchUtils.js +1 -1
  7. package/arcgisGlobal.d.ts +1 -0
  8. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  9. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/{e35eb93c0fb1f6de8db0.js → 00d9e41deecf5828975c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/038d2b80d96237c25b6f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{ab8a1140bf31f46f8ebf.js → 1262918b2161d79851c0.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{d3ef23923424ad8c5048.js → 1c2723f9630e7d597843.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9ca98fffd43e63d5ade3.js → 1c33aa349beea9a3792f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js → 2226c20c38e20713bcb5.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js.LICENSE.txt → 2226c20c38e20713bcb5.js.LICENSE.txt} +2 -2
  18. package/assets/esri/core/workers/chunks/{4d18451e0ea6ca54101a.js → 2ebad7e588b26e74cefe.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{a8258636096416c837a2.js → 3b7dff15a0058ea29886.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{4716693eca44e8f89f5c.js → 3bf56c33876ba56c4b21.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +1 -0
  22. package/assets/esri/core/workers/chunks/3f045f09ac95e7f22a97.js +1 -0
  23. package/assets/esri/core/workers/chunks/500f6d6f0ffa235cae85.js +1 -0
  24. package/assets/esri/core/workers/chunks/{56acda1eed3a013430e2.js → 58fb92775d668cfd295c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{e6637f9176566382ed3e.js → 606cca69eaea84bfcdc6.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{fdbda3d2afea25142b86.js → 6267a1fe1603daa399b4.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{b013b70e40dfb6ce013e.js → 668ec0bdfb2095e90c9e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{806f96ad09e882be41af.js → 67fd2cdb2e6834bfa710.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{5fe5ef5ccf480634d159.js → 75294f515c7f8393181c.js} +1 -1
  30. package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +1 -0
  31. package/assets/esri/core/workers/chunks/761ea719ec1b4d562db2.js +1 -0
  32. package/assets/esri/core/workers/chunks/{24673aac70d6c949b6fa.js → 86d7a3ae672a51b75fcc.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{30604a29df320d7a4c6b.js → 88e11b645a1361f1bdbe.js} +1 -1
  34. package/assets/esri/core/workers/chunks/89dad6c1bfd81e4d7f8e.js +1 -0
  35. package/assets/esri/core/workers/chunks/{8daed13400d9e63e65ae.js → 8a842cde240aef12e417.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{c692e583e87af58f6d91.js → 8b0d6205ceeec1ab446f.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{57ab87e70ef85b9405f9.js → 8cb216404a6254bc695c.js} +1 -0
  38. package/assets/esri/core/workers/chunks/92509dd25996c6390a31.js +1 -0
  39. package/assets/esri/core/workers/chunks/9ccc2c8f7416943cc373.js +29 -0
  40. package/assets/esri/core/workers/chunks/a0a9c41400ae98df1912.js +1 -0
  41. package/assets/esri/core/workers/chunks/{b96358d475dc98034aa4.js → a15ed056e7493ddf3b4c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{25e212fe9a2ea37c9e81.js → a3a33ffa34f4d645ddfe.js} +1 -1
  43. package/assets/esri/core/workers/chunks/af0704494398f33aa315.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ce1ccf9ec90b786591e5.js → b396c4b4bb144200acc7.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{97602019a1ccad22a03a.js → bbfb80a6983574007ce5.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{d5f72670634e73c0b53a.js → bcf2e5cf6b9c6d0442bb.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{17218d714cb07b607c2f.js → c35e9dee87937f483a3d.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{85739ed6af0f0a3cb302.js → c94bdfed831c775e04c0.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{2e3fd81653dc0d86456c.js → cfeba0ffb7fdc2a9af05.js} +1 -1
  50. package/assets/esri/core/workers/chunks/d1187ad6cc4959683819.js +1 -0
  51. package/assets/esri/core/workers/chunks/d94a2b3b2ef49af9c2e3.js +1 -0
  52. package/assets/esri/core/workers/chunks/{cb7cb7d57c4e7f76600f.js → dc92710a8fdfb9135e55.js} +1 -1
  53. package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +1 -0
  54. package/assets/esri/core/workers/chunks/eec5a93dbc258a90b6de.js +1 -0
  55. package/assets/esri/core/workers/chunks/{e1ae83ff3e0225708d4d.js → f479b4a4cee4bb2e046c.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{78abd6c42f39e6f6ffbb.js → f983296b6f4a62a911eb.js} +1 -1
  57. package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
  58. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  59. package/assets/esri/images/portal/propresentation16.png +0 -0
  60. package/assets/esri/images/portal/urbanproject16.png +0 -0
  61. package/assets/esri/images/support/loading-throb.gif +0 -0
  62. package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
  63. package/assets/esri/themes/base/icons/style.scss +0 -0
  64. package/assets/esri/themes/base/icons/variables.scss +0 -0
  65. package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
  66. package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
  67. package/assets/esri/themes/base/images/files/code-32.svg +0 -0
  68. package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
  69. package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
  70. package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
  71. package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
  72. package/assets/esri/themes/base/images/files/image-32.svg +0 -0
  73. package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
  74. package/assets/esri/themes/base/images/files/report-32.svg +0 -0
  75. package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
  76. package/assets/esri/themes/base/images/files/text-32.svg +0 -0
  77. package/assets/esri/themes/base/images/files/video-32.svg +0 -0
  78. package/assets/esri/themes/base/images/files/word-32.svg +0 -0
  79. package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
  80. package/assets/esri/themes/base/images/loading-throb.gif +0 -0
  81. package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
  82. package/assets/esri/themes/base/widgets/_Tooltip.scss +42 -3
  83. package/assets/esri/themes/dark/main.css +1 -1
  84. package/assets/esri/themes/light/main.css +1 -1
  85. package/assets/esri/themes/light/view.css +1 -1
  86. package/assets/esri/views/interactive/tooltip/t9n/messages.en.json +1 -1
  87. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  88. package/chunks/GlobalIllumination.glsl.js +1 -0
  89. package/config.js +1 -1
  90. package/core/Accessor.d.ts +1 -1
  91. package/core/lang.js +1 -1
  92. package/core/units.js +1 -1
  93. package/geometry/HeightModelInfo.js +1 -1
  94. package/geometry/ellipsoidUtils.js +1 -1
  95. package/geometry/support/heightModelInfoUtils.js +1 -1
  96. package/interfaces.d.ts +1 -0
  97. package/kernel.js +1 -1
  98. package/layers/ElevationLayer.js +1 -1
  99. package/layers/OrientedImageryLayer.js +1 -1
  100. package/layers/ParquetLayer.d.ts +21 -13
  101. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  102. package/layers/graphics/dehydratedFeatures.js +1 -1
  103. package/layers/graphics/transferFeatures.js +2 -0
  104. package/layers/mixins/FeatureLayerBase.js +1 -1
  105. package/layers/mixins/HeightModelInfoMixin.js +2 -0
  106. package/layers/mixins/SceneService.js +1 -1
  107. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  108. package/layers/raster/datasets/RasterFactory.js +1 -1
  109. package/package.json +3 -3
  110. package/popup/FeatureContentCollection.d.ts +15 -25
  111. package/popup/FeatureContentCollection.js +1 -1
  112. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  113. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  114. package/support/revision.js +1 -1
  115. package/symbols/cim/callouts/calloutAnalysisUtils.js +2 -0
  116. package/symbols/cim/callouts/effects/BackgroundCallout.js +1 -1
  117. package/symbols/cim/callouts/effects/BalloonCallout.js +1 -1
  118. package/symbols/cim/callouts/effects/PointSymbolCallout.js +1 -1
  119. package/symbols/cim/callouts/effects/SimpleLineCallout.js +1 -1
  120. package/symbols/cim/callouts/effects/calloutUtils.js +1 -1
  121. package/symbols/cim/cimAnalyzer.js +1 -1
  122. package/views/2d/engine/webgl/ClipMesh.js +1 -1
  123. package/views/2d/engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js +1 -1
  124. package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
  125. package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
  126. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  127. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  128. package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
  129. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  130. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  131. package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
  132. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
  133. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  134. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
  137. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
  138. package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
  139. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  140. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  144. package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
  145. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  146. package/views/2d/layers/LayerView2D.js +1 -1
  147. package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
  148. package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +1 -1
  149. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  150. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  151. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  152. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  153. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  154. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  155. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  156. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +5 -3
  157. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  158. package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +1 -1
  159. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  160. package/views/3d/camera/intersectionUtils.js +1 -1
  161. package/views/3d/interactive/editingTools/manipulatedObjectUtils.js +1 -1
  162. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  163. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  164. package/views/3d/layers/I3SMeshView3D.js +1 -1
  165. package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
  166. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  167. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  169. package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
  170. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  171. package/views/3d/layers/support/FeatureMemory.js +2 -0
  172. package/views/3d/layers/support/FeatureTile.js +1 -1
  173. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  174. package/views/3d/layers/support/featureReference.js +1 -1
  175. package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
  176. package/views/3d/state/Constraints.js +1 -1
  177. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  178. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  179. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  180. package/views/3d/support/PBFDecoder.js +1 -1
  181. package/views/3d/support/PBFDecoderWorker.js +1 -1
  182. package/views/3d/support/QualityProfile.js +1 -1
  183. package/views/3d/support/popupHitTest.js +1 -1
  184. package/views/3d/terrain/TerrainRenderer.js +1 -1
  185. package/views/3d/terrain/TerrainSurface.js +1 -1
  186. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  187. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  188. package/views/DOMContainer.d.ts +2 -2
  189. package/views/DOMContainer.js +1 -1
  190. package/views/PopupView.d.ts +1 -1
  191. package/views/SceneView.js +1 -1
  192. package/views/ToolViewManager.js +1 -1
  193. package/views/interactive/options/TooltipVisibleElements.d.ts +11 -1
  194. package/views/interactive/options/TooltipVisibleElements.js +1 -1
  195. package/views/interactive/tooltip/components/ElevationModeSelect.js +2 -0
  196. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  197. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  198. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  199. package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
  200. package/views/support/hitTestSelectUtils.js +1 -1
  201. package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +1 -0
  202. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  203. package/widgets/BasemapToggle.js +1 -1
  204. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +9 -1
  205. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  206. package/widgets/BatchAttributeForm.js +1 -1
  207. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -0
  208. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  209. package/widgets/DirectionalPad.js +1 -1
  210. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  211. package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +1 -1
  212. package/widgets/Editor/workflowUtils.js +1 -1
  213. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  214. package/widgets/OrientedImageryViewer/utils.js +1 -1
  215. package/widgets/Popup/types.d.ts +0 -7
  216. package/widgets/Popup.d.ts +7 -7
  217. package/widgets/TimeSlider/TimeSliderViewModel.d.ts +2 -0
  218. package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
  219. package/widgets/TimeSlider.js +1 -1
  220. package/assets/esri/core/workers/chunks/0a2b7c691a577cb3d189.js +0 -1
  221. package/assets/esri/core/workers/chunks/2146c25c01c9fc11b16c.js +0 -1
  222. package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +0 -1
  223. package/assets/esri/core/workers/chunks/56e97b98dcb8a3f2bcb7.js +0 -1
  224. package/assets/esri/core/workers/chunks/6c3535aa7250c08b9e5b.js +0 -1
  225. package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +0 -1
  226. package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +0 -1
  227. package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +0 -1
  228. package/assets/esri/core/workers/chunks/82ce034b5ba54de9b970.js +0 -29
  229. package/assets/esri/core/workers/chunks/ba435cc73956d9c64a11.js +0 -1
  230. package/assets/esri/core/workers/chunks/c77496c350004ee66eb2.js +0 -1
  231. package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +0 -1
  232. package/assets/esri/core/workers/chunks/dc52e036547612949d32.js +0 -1
  233. package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +0 -1
  234. package/views/2d/engine/webgl/mesh/bufcut.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{removeMaybe as h,destroyMaybe as d}from"../../../core/maybe.js";import{MemCachePool as p}from"../../../core/MemCachePool.js";import u from"../../../core/ObjectPool.js";import c from"../../../core/PooledArray.js";import{throwIfAborted as g,isAbortError as _,isAborted as m}from"../../../core/promiseUtils.js";import{watch as y,syncAndInitial as f,initial as T,sync as v}from"../../../core/reactiveUtils.js";import"../../../core/scheduling.js";import{getMetersPerUnitForSR as w}from"../../../core/units.js";import{property as S,subclass as C}from"../../../core/accessorSupport/decorators.js";import{exactEquals as E,set as b,copy as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as U}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as P,radiusModifier as R}from"../../../geometry/ellipsoidUtils.js";import M from"../../../geometry/SpatialReference.js";import{getProjector as D}from"../../../geometry/projection/projectors.js";import{projectPointToVector as j}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as V,equals as A,intersection as k,intersectsSphere as B}from"../../../geometry/support/aaBoundingRect.js";import{copy as G,create as O}from"../../../geometry/support/frustumPlanes.js";import{createSpatialReferenceCyclical as q}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as F}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as H}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as N}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as W}from"../../../layers/support/layerUtils.js";import{queueHighPriority as z}from"../../../request/queue.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as Y}from"../support/ElevationRange.js";import{ElevationUpdateEvent as $}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as X}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{ElevationData as ee,sampleElevation as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{Queue as ne}from"./Queue.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ye,isVectorTileLayerView as fe,internalAssert as Te,oppositeEdge as ve,neighborEdgeIndices as we,isSurfaceLayerView as Se,isGroupLayerView as Ce,isMapTileLayerView as Ee,isBlendableLayerView as be,isElevationLayerView as xe,releaseTerrainData as Ue,oppositeCorner as Le,enableTerrainInternalChecks as Pe,enableWaterproofTests as Re,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as De,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ie,lijEquals as Ve}from"./Tile.js";import{printAllocations as Ae}from"./TilePerLayerInfo.js";import{sortTiles as ke,IteratorPreorder as Be,IteratorPostorder as Ge,compareTilesByLij as Oe,hasLoadableSiblings as qe,sortTilesByPOI as Fe,traverseTilesPreorder as He}from"./tileUtils.js";import{TilingSchemeLogic as Ne}from"./TilingSchemeLogic.js";import{getGroundTransparencyModeFromOpacity as We}from"./TransparencyMode.js";import{UpsampleInfo as ze}from"./UpsampleInfo.js";import{isCompositeBlendMode as Qe,blendModeFromString as Ye}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as $e}from"../../support/layerViewUtils.js";import{ImmediateTask as Xe,TaskPriority as Ke,noBudget as Je}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ze}from"../../support/TextureCompressionTracker.js";import{Yield as et}from"../../support/Yield.js";var tt;let it=class extends n{static{tt=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return ke(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=w(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Ze,this._iteratorPool=new u(()=>new Be,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ge,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new me,this._waterproofnessErrorHandle=null,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new he,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._updatingHandles=new L,this._poiWatchHandle=null,this._frameTask=Xe,this._allTiles=new c,this._upsampleInfoPool=new u(()=>new ze),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=V(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=M.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new Y(1/0,-1/0),this._rootTileElevationRange=new Y(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new se({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=P(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),$e()||(this._scaleRangeQueries=new le)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new p((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new N(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([y(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),y(()=>this.renderer.visible,e=>this.freeze=!e),y(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},f)],"overlayManager"),this._updatingHandles.add(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)},T),this.addHandles([y(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},f),y(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),f),y(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},v),y(()=>this.snapLevel,()=>this._viewChanged=!0,v),y(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._poiWatchHandle=h(this._poiWatchHandle),e&&(this._poiWatchHandle=this._updatingHandles.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:E}))}),y(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=d(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Ne({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(Ke.TERRAIN_SURFACE,this),this.addHandles([y(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),y(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),v),y(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),y(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),f),y(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),y(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),y(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),y(()=>this.userClippingExtent,()=>this._updateClippingExtent(),v)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._updatingHandles?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._waterproofnessErrorHandle?.remove(),this._waterproofnessErrorHandle=null,this._frameTask.remove(),this._frameTask=Xe,this._updatingHandles?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",d(this.overlayManager)),this._tileCache=d(this._tileCache),this._allTiles.prune(),Ie.prune(),this._treeDebugger=d(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=d(this._iteratorPool),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("view",null),this._extentHelper=d(this._extentHelper),this._upsampleInfoPool=d(this._upsampleInfoPool),Ae(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=V(),r=K(t,i,e)?i:null,s=this._get("userClippingExtent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=k(this.fullGroundExtent,this.userClippingExtent,V()),t=this._get("groundExtent");return A(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._updatingHandles?.updating||this._asyncWorkItems>0)&&this.ready&&!this.freeze||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._hasElevationSourceUpdates||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.freeze}get _hasElevationSourceUpdates(){return this._allTiles.some(e=>e.needsElevationSourceUpdate())}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set freeze(e){this._set("freeze",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersectRay(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return q(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=D(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=b(st,e,t,i);a(n,0,n,0);return ht(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,ht(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!j(e,st,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(st)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;st[0]>t[2]&&(i+=1),st[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=D(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;at.copyFrom(e),i(at.center,0,at.center,0);const r=new Y,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,at))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new Y(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*R;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,at.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;at.radius=t;let i=null;const r=e=>{if(e&&B(e.extent,at)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?We(0,t):e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;ye(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??M.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&F(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(tt._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=nt;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void l.getLogger(this).warn(pe);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ve);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ve(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(l.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map(e=>this._newRootTile(e)));A(i,this._rootTilesExtent)||(this._rootTilesExtent=V(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness("root-tiles-updated")}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));0!==e.length?(e.sort(Oe),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()):this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){const t=e.filter(e=>this._canUpdateTileGeometry(e));if(0===t.length)return;const i=this.renderer;for(const r of t)i.updateGeometryIfNeeded(r);for(const r of t)this._pendingTilesForElevationUpdateEvent.add(r)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.freeze&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=qe(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new Z(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new Z(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=G(this._splitLimits.frustum??O(),t.frustum):this._splitLimits.frustum=null,x(this._eyePosRenderSR,t.eye),I(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();const t=this._renderer.updateTileGeometryState(e);e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate()),t&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(fe)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){const t=new Float64Array(4*e.size);let i=0;for(const r of e)t.set(r.extent,4*i),++i;e.clear();for(const e of X(t,this.spatialReference)){const t=new $(this.spatialReference,e,"ground");this.emit("elevation-change",t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e),this._updateElevationSources(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();const i=this._pendingTilesToUpdate.size>0,r=i&&this._hasPendingGeometryWithoutIndices();if(e.done&&!r||this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||i&&!r)&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),!e.hasProgressed)return et}_checkTileInvariant(){}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1;const i=new ne(this._allTiles.length);i.pushAll(this._rootTiles);const r=this.snapLevel,s=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const n=this.view.state.contentCamera.viewProjectionMatrix;for(;!i.empty;){const e=i.pop(),l=e.parent,o=l?.hasPendingUpdate(4),h=o?4:e.shouldSplit(s,a,r),d=1===h;e.leaf?dt(e,d):i.pushAll(e.children),o?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(n)):d?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===h&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0))}this._allTilesDirty=t,this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Fe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(const e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&null==e.renderData?.vao?.indexBuffer)return!0;return!1}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),0===t.length)return void e.clear();const i=(i,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(we[t]),t=>!!this._canUpdateTileGeometry(t)&&(Te(e.has(t)||Oe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Pe&&Re&&this.checkAllTilesWaterproofness("pending-geometries-updated")}_mergeAndSplit(e,t){if(this.freeze||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(we[r],e);null!=a&&i-a.level===ce&&(t=!1,Pe&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&0===e.unmergableChildCount),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateElevationSources(e){e.done||this._allTiles.some(t=>(t.needsElevationSourceUpdate()&&(t.updateAgents(0),t.markElevationSourceUpdateRequested(),e.madeProgress()),e.done))}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?ut(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(tt._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){ye(e.leaf,"Tile that is already split should not be split again!"),ye(e.rendered,"Tile marked to split is not rendered"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),ye(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>dt(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){ot.spatialReference=this.spatialReference,ot.extent=e.extent,ot.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",ot)}createTile(e,t,i,r){ye(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){ye(!e.hasPendingUpdate(1),"_mergeTile sanity check"),ye(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),ye(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),dt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Je){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ee(e)&&!W(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Ce(e))&&Qe(Ye[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return xe(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Ce(e))&&t.push(y(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(y(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(y(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(y(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){null!=this._rootTiles&&(He(this._rootTiles,i=>i.removeLayerAgent(e,t)),He(this._rootTiles,i=>{i.invalidateLayerData(e,t),i.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||fe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw g(r),_(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?xe(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ee(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{_(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...z,...i}).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new ee(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Ue(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return Ue(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(e="render-patch-groups"){}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Me(e)}enableWaterproofnessChecks(e){De(e)}static cleanupTerrainSurface(){lt.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.freeze=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.freeze=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([S()],it.prototype,"_renderer",void 0),e([S({constructOnly:!0})],it.prototype,"_scaleRangeQueries",void 0),e([S({constructOnly:!0})],it.prototype,"view",void 0),e([S({constructOnly:!0})],it.prototype,"overlayManager",void 0),e([S({constructOnly:!0})],it.prototype,"terrainTextureCompressionTracker",void 0),e([S()],it.prototype,"_hasPendingUpdates",void 0),e([S()],it.prototype,"_asyncWorkItems",void 0),e([S()],it.prototype,"_allTilesDirty",void 0),e([S()],it.prototype,"_allTilesSorted",void 0),e([S()],it.prototype,"allTilesCreated",null),e([S()],it.prototype,"_allTilesCreated",void 0),e([S()],it.prototype,"_viewChanged",void 0),e([S({type:Number})],it.prototype,"heading",void 0),e([S()],it.prototype,"_splitLimits",void 0),e([S()],it.prototype,"_frameTask",void 0),e([S()],it.prototype,"demResolution",null),e([S({readOnly:!0})],it.prototype,"snapLevel",null),e([S({readOnly:!0})],it.prototype,"lodSnappingEnabled",null),e([S({readOnly:!0})],it.prototype,"userClippingExtent",null),e([S()],it.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],it.prototype,"groundExtent",null),e([S({readOnly:!0})],it.prototype,"fullGroundExtent",null),e([S({readOnly:!0})],it.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],it.prototype,"updating",null),e([S({readOnly:!0})],it.prototype,"readyToRun",null),e([S(J)],it.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],it.prototype,"updatingProgressValue",null),e([S()],it.prototype,"_maxNumUpdating",void 0),e([S()],it.prototype,"baseOpacity",null),e([S()],it.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],it.prototype,"viewingMode",null),e([S()],it.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],it.prototype,"ready",null),e([S({readOnly:!0})],it.prototype,"rootTiles",null),e([S()],it.prototype,"_rootTiles",void 0),e([S({readOnly:!0})],it.prototype,"spatialReference",null),e([S({type:t})],it.prototype,"backgroundColor",null),e([S({value:!1})],it.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],it.prototype,"tilingScheme",void 0),e([S({readOnly:!0})],it.prototype,"tilingSchemeLocked",null),e([S({readOnly:!0})],it.prototype,"tilingSchemeLogic",void 0),e([S()],it.prototype,"wireframe",null),e([S()],it.prototype,"opaque",null),e([S()],it.prototype,"invisible",null),e([S({value:!1})],it.prototype,"freeze",null),e([S()],it.prototype,"fadeDuration",null),e([S()],it.prototype,"_xNormalizer",null),e([S()],it.prototype,"visibleElevationRange",void 0),e([S()],it.prototype,"_rootTileElevationRange",void 0),e([S()],it.prototype,"_layerViewsDirty",void 0),e([S()],it.prototype,"renderPatchBorders",null),e([S()],it.prototype,"renderingDisabled",null),e([S({readOnly:!0})],it.prototype,"enabled",void 0),it=tt=e([C("esri.views.3d.terrain.TerrainSurface")],it);const rt=it,st=U(),at=new H,nt=V(),lt=new c,ot={spatialReference:null,extent:null,scale:0};function ht(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return te(t,i,s)}return null}function dt(e,t){!e.leaf||e.level<ce||gt(e,e=>{t&&pt(e);const i=ct(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ct(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function pt(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ce||gt(e,e=>{pt(e)})}function ut(e){e.level<ce||gt(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ct(t));)t=t.parent}})}function ct(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function gt(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(we[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{rt as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as i,difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as n}from"../../../core/Evented.js";import"../../../core/has.js";import l from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{removeMaybe as h,destroyMaybe as d}from"../../../core/maybe.js";import{MemCachePool as p}from"../../../core/MemCachePool.js";import u from"../../../core/ObjectPool.js";import c from"../../../core/PooledArray.js";import{throwIfAborted as g,isAbortError as _,isAborted as m}from"../../../core/promiseUtils.js";import{watch as y,syncAndInitial as f,initial as T,sync as v}from"../../../core/reactiveUtils.js";import"../../../core/scheduling.js";import{getMetersPerUnitForSR as w}from"../../../core/units.js";import{property as S,subclass as C}from"../../../core/accessorSupport/decorators.js";import{exactEquals as E,set as b,copy as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as U}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as L}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as R,radiusModifier as P}from"../../../geometry/ellipsoidUtils.js";import M from"../../../geometry/SpatialReference.js";import{getProjector as D}from"../../../geometry/projection/projectors.js";import{projectPointToVector as j}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as I}from"../../../geometry/projection/projectVectorToVector.js";import{create as V,equals as A,intersection as k,intersectsSphere as B}from"../../../geometry/support/aaBoundingRect.js";import{copy as G,create as O}from"../../../geometry/support/frustumPlanes.js";import{createSpatialReferenceCyclical as q}from"../../../geometry/support/normalizeUtils.js";import{isPlateCarree as H}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as N}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as W}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as F}from"../../../layers/support/layerUtils.js";import{queueHighPriority as z}from"../../../request/queue.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as Y}from"../support/ElevationRange.js";import{ElevationUpdateEvent as $}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as X}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{ElevationData as ee,sampleElevation as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{Queue as ne}from"./Queue.js";import{ScaleRangeQueries as le}from"./ScaleRangeQueries.js";import{SphericalPatch as oe}from"./SphericalPatch.js";import{SplitLimits as he}from"./SplitLimits.js";import{maxRootTiles as de,tooManyRootTilesAfterChangeError as pe,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as ce,maxMemoryLodBias as ge}from"./TerrainConst.js";import{TerrainRenderer as _e}from"./TerrainRenderer.js";import me from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as ye,isVectorTileLayerView as fe,internalAssert as Te,oppositeEdge as ve,neighborEdgeIndices as we,isSurfaceLayerView as Se,isGroupLayerView as Ce,isMapTileLayerView as Ee,isBlendableLayerView as be,isElevationLayerView as xe,releaseTerrainData as Ue,oppositeCorner as Le,enableTerrainInternalChecks as Re,enableWaterproofTests as Pe,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as De,neighborCornerIndices as je}from"./terrainUtils.js";import{Tile as Ie,lijEquals as Ve}from"./Tile.js";import{printAllocations as Ae}from"./TilePerLayerInfo.js";import{sortTiles as ke,IteratorPreorder as Be,IteratorPostorder as Ge,compareTilesByLij as Oe,hasLoadableSiblings as qe,sortTilesByPOI as He,traverseTilesPreorder as Ne}from"./tileUtils.js";import{TilingSchemeLogic as We}from"./TilingSchemeLogic.js";import{getGroundTransparencyModeFromOpacity as Fe}from"./TransparencyMode.js";import{UpsampleInfo as ze}from"./UpsampleInfo.js";import{isCompositeBlendMode as Qe,blendModeFromString as Ye}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as $e}from"../../support/layerViewUtils.js";import{ImmediateTask as Xe,TaskPriority as Ke,noBudget as Je}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ze}from"../../support/TextureCompressionTracker.js";import{Yield as et}from"../../support/Yield.js";var tt;let it=class extends n{static{tt=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return ke(i(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=w(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Ze,this._iteratorPool=new u(()=>new Be,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ge,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new me,this._waterproofnessErrorHandle=null,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=U(),this._eyePosSurfaceSR=U(),this._splitLimits=new he,this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._updatingHandles=new L,this._poiWatchHandle=null,this._frameTask=Xe,this._allTiles=new c,this._upsampleInfoPool=new u(()=>new ze),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=V(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=M.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new Y(1/0,-1/0),this._rootTileElevationRange=new Y(1/0,-1/0),this._projectorCache=new Map,this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;const{view:t}=e;this.overlayManager=new se({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?oe:ae,this._ellipsoid=R(t.spatialReference),this._renderer=new _e(this.overlayManager.renderer,t.stage,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),$e()||(this._scaleRangeQueries=new le)}initialize(){const{view:e}=this,{resourceController:t}=e,{memoryController:i}=t;this._tileCache=new p((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new W(i.newCache("elevation-query"));const r=this.overlayManager;this.addHandles([y(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),y(()=>this.renderer.visible,e=>this.freeze=!e),y(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},f)],"overlayManager"),this._updatingHandles.add(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)},T),this.addHandles([y(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},f),y(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),f),y(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},v),y(()=>this.snapLevel,()=>this._viewChanged=!0,v),y(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._poiWatchHandle=h(this._poiWatchHandle),e&&(this._poiWatchHandle=this._updatingHandles.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:E}))}),y(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=d(this._treeDebugger))},T)]);const{spatialReference:a}=e;this._extentHelper=ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new We({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme();const o=t.scheduler;this._frameTask=o.registerTask(Ke.TERRAIN_SURFACE,this),this.addHandles([y(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),T),y(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),v),y(()=>this.groundExtent,()=>this._updateRootTiles(),T),e.on("resize",()=>this._viewChangeUpdate()),y(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),f),y(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,T),y(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,T),y(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),y(()=>this.userClippingExtent,()=>this._updateClippingExtent(),v)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._updatingHandles?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._waterproofnessErrorHandle?.remove(),this._waterproofnessErrorHandle=null,this._frameTask.remove(),this._frameTask=Xe,this._updatingHandles?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",d(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set("overlayManager",d(this.overlayManager)),this._tileCache=d(this._tileCache),this._allTiles.prune(),Ie.prune(),this._treeDebugger=d(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=d(this._iteratorPool),this._upsampleMapCache=d(this._upsampleMapCache),this._elevationQueryCache=d(this._elevationQueryCache),this._set("view",null),this._extentHelper=d(this._extentHelper),this._upsampleInfoPool=d(this._upsampleInfoPool),Ae(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return this._extentHelper.stencilEnabledExtents.length>0}get userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=V(),r=K(t,i,e)?i:null,s=this._get("userClippingExtent");return A(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){const e=k(this.fullGroundExtent,this.userClippingExtent,V()),t=this._get("groundExtent");return A(e,t)?t:e}get fullGroundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._updatingHandles?.updating||this._asyncWorkItems>0)&&this.ready&&!this.freeze||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._hasElevationSourceUpdates||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.freeze}get _hasElevationSourceUpdates(){return this._allTiles.some(e=>e.needsElevationSourceUpdate())}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||null!=this._rootTiles}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set freeze(e){this._set("freeze",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersectRay(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return q(this._spatialReference)}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this.enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=D(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return l.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const n=b(st,e,t,i);a(n,0,n,0);return ht(s,this._xNormalizer?.normalize(n[0])??n[0],n[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this.enabled)for(let a=0;a<t;++a){const t=3*a;i(a,ht(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!j(e,st,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(st)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;st[0]>t[2]&&(i+=1),st[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=D(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationRange(e,t){if(!this.enabled||null==this._rootTiles)return null;const i=this._ensureProjector(t);if(null==i)return l.getLogger(this).error("TerrainSurface.getSphereElevationRange(): could not project given point to tiling scheme coordinate system"),null;at.copyFrom(e),i(at.center,0,at.center,0);const r=new Y,s=this._rootTiles;if(null!=s){const e=[];for(const i of s)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,at))continue;const s=i.children;if(null==s[0]||i.rendered)r.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of s)e.push(t)}}return r}getRootElevationRange(){return this.enabled&&null!=this._rootTiles?new Y(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*P;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!j(e,at.center,this.spatialReference))return l.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;at.radius=t;let i=null;const r=e=>{if(e&&B(e.extent,at)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?Fe(0,t):e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r&&(this.notifyChange("opaque"),this.notifyChange("invisible"),!0)}_updateTilingScheme(){const{tilingScheme:e}=this.tilingSchemeLogic;if(!(e!==this.tilingScheme))return;ye(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??M.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&H(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(tt._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled)return void this._setRootTiles(null);const i=nt;let s=t.rootTilesInExtent(e,i,5*de);if(null!=this._rootTiles){if(s.length>de)return void l.getLogger(this).warn(pe);const e=this._rootTiles.map(e=>e.lij),t=r(e,s,Ve);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Ve(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>de&&(l.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,i,de)),this._setRootTiles(s.map(e=>this._newRootTile(e)));A(i,this._rootTilesExtent)||(this._rootTilesExtent=V(i)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness("root-tiles-updated")}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));0!==e.length?(e.sort(Oe),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()):this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){const t=e.filter(e=>this._canUpdateTileGeometry(e));if(0===t.length)return;const i=this.renderer;for(const r of t)i.updateGeometryIfNeeded(r);for(const r of t)this._pendingTilesForElevationUpdateEvent.add(r)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.freeze&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=qe(e),i=this.visibleElevationRange;let r=t?i.minElevation:1/0,s=t?i.maxElevation:-1/0;const a=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.minElevation!==r||i.maxElevation!==s)&&(this.visibleElevationRange=new Z(r,s))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this._rootTileElevationRange;r.minElevation===e&&r.maxElevation===t||(this._rootTileElevationRange=new Z(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=G(this._splitLimits.frustum??O(),t.frustum):this._splitLimits.frustum=null,x(this._eyePosRenderSR,t.eye),I(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();const t=this._renderer.updateTileGeometryState(e);e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate()),t&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(fe)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){const t=new Float64Array(4*e.size);let i=0;for(const r of e)t.set(r.extent,4*i),++i;e.clear();for(const e of X(t,this.spatialReference)){const t=new $(this.spatialReference,e,"ground");this.emit("elevation-change",t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);const t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e),this._updateElevationSources(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();const i=this._pendingTilesToUpdate.size>0,r=i&&this._hasPendingGeometryWithoutIndices();if(e.done&&!r||this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||i&&!r)&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),!e.hasProgressed)return et}_checkTileInvariant(){}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1;const i=new ne(this._allTiles.length);i.pushAll(this._rootTiles);const r=this.snapLevel,s=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const n=this.view.state.contentCamera.viewProjectionMatrix;for(;!i.empty;){const e=i.pop(),l=e.parent,o=l?.hasPendingUpdate(4),h=o?4:e.shouldSplit(s,a,r),d=1===h;e.leaf?dt(e,d):i.pushAll(e.children),o?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(n)):d?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===h&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0))}this._allTilesDirty=t,this.requestUpdate(),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(He(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(const e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&null==e.renderData?.vao?.indexBuffer)return!0;return!1}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),0===t.length)return void e.clear();const i=(i,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Oe);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=je[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(we[t]),t=>!!this._canUpdateTileGeometry(t)&&(Te(e.has(t)||Oe(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Re&&Pe&&this.checkAllTilesWaterproofness("pending-geometries-updated")}_mergeAndSplit(e,t){if(this.freeze||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ce){const e=e=>e.leaf||i-e.level<ce;for(let r=0;r<4;++r){const a=s.findNeighborTile(we[r],e);null!=a&&i-a.level===ce&&(t=!1,Re&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&0===e.unmergableChildCount),this._sortTiles(e)}_updateElevation(e){e.done||this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done))}_updateElevationSources(e){e.done||this._allTiles.some(t=>(t.needsElevationSourceUpdate()&&(t.updateAgents(0),t.markElevationSourceUpdateRequested(),e.madeProgress()),e.done))}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*ge}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=o(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),null!=this._rootTiles&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange("ready")),this._allTiles.clear(),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){const t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?ut(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(tt._tileMemcacheKey,e),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){ye(e.leaf,"Tile that is already split should not be split again!"),ye(e.rendered,"Tile marked to split is not rendered"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),ye(e.rendered,"parent should be rendered"),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>dt(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){ot.spatialReference=this.spatialReference,ot.extent=e.extent,ot.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",ot)}createTile(e,t,i,r){ye(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.groundExtent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){ye(!e.hasPendingUpdate(1),"_mergeTile sanity check"),ye(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),ye(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),dt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=Je){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),Se(e)||Ce(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Ce(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(const e of this.view.allLayerViews.items)if(Ee(e)&&!F(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Ce(e))&&Qe(Ye[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return xe(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Ce(e))&&t.push(y(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Ce(e)){const i=this._layerClassFromLayerView(e);t.push(y(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(y(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(y(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!Se(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){null!=this._rootTiles&&(Ne(this._rootTiles,i=>i.removeLayerAgent(e,t)),Ne(this._rootTiles,i=>{i.invalidateLayerData(e,t),i.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||fe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw g(r),_(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();return 0===t?xe(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ee(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!m(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{_(i)||(l.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...z,...i}).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void l.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new ee(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],n=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,n),e.computeElevationBounds()}0===n&&this._updateRootTileElevationRange(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Ue(s),m(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(i)?Ue(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return Ue(i),void l.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):l.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(this._usedMemory=this._recalculateUsedMemory()),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(e="render-patch-groups"){}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Me(e)}enableWaterproofnessChecks(e){De(e)}static cleanupTerrainSurface(){lt.prune()}enable(e){e!==this.enabled&&(this._set("enabled",e),e?(this._updateRootTiles(),this.freeze=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.freeze=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange("ready"))}updateOverlayParameters(){const{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([S()],it.prototype,"_renderer",void 0),e([S({constructOnly:!0})],it.prototype,"_scaleRangeQueries",void 0),e([S({constructOnly:!0})],it.prototype,"view",void 0),e([S({constructOnly:!0})],it.prototype,"overlayManager",void 0),e([S({constructOnly:!0})],it.prototype,"terrainTextureCompressionTracker",void 0),e([S()],it.prototype,"_hasPendingUpdates",void 0),e([S()],it.prototype,"_asyncWorkItems",void 0),e([S()],it.prototype,"_allTilesDirty",void 0),e([S()],it.prototype,"_allTilesSorted",void 0),e([S()],it.prototype,"allTilesCreated",null),e([S()],it.prototype,"_allTilesCreated",void 0),e([S()],it.prototype,"_viewChanged",void 0),e([S({type:Number})],it.prototype,"heading",void 0),e([S()],it.prototype,"_splitLimits",void 0),e([S()],it.prototype,"_frameTask",void 0),e([S()],it.prototype,"demResolution",null),e([S({readOnly:!0})],it.prototype,"snapLevel",null),e([S({readOnly:!0})],it.prototype,"lodSnappingEnabled",null),e([S({readOnly:!0})],it.prototype,"userClippingExtent",null),e([S()],it.prototype,"_rootTilesExtent",void 0),e([S({readOnly:!0})],it.prototype,"groundExtent",null),e([S({readOnly:!0})],it.prototype,"fullGroundExtent",null),e([S({readOnly:!0})],it.prototype,"_tilingSchemeExtent",null),e([S({readOnly:!0})],it.prototype,"updating",null),e([S({readOnly:!0})],it.prototype,"readyToRun",null),e([S(J)],it.prototype,"updatingProgress",void 0),e([S({readOnly:!0})],it.prototype,"updatingProgressValue",null),e([S()],it.prototype,"_maxNumUpdating",void 0),e([S()],it.prototype,"baseOpacity",null),e([S()],it.prototype,"hasCompositeBlendMode",void 0),e([S({readOnly:!0})],it.prototype,"viewingMode",null),e([S()],it.prototype,"maxTextureScale",void 0),e([S({readOnly:!0})],it.prototype,"ready",null),e([S({readOnly:!0})],it.prototype,"rootTiles",null),e([S()],it.prototype,"_rootTiles",void 0),e([S({readOnly:!0})],it.prototype,"spatialReference",null),e([S({type:t})],it.prototype,"backgroundColor",null),e([S({value:!1})],it.prototype,"slicePlaneEnabled",null),e([S({readOnly:!0})],it.prototype,"tilingScheme",void 0),e([S({readOnly:!0})],it.prototype,"tilingSchemeLocked",null),e([S({readOnly:!0})],it.prototype,"tilingSchemeLogic",void 0),e([S()],it.prototype,"wireframe",null),e([S()],it.prototype,"opaque",null),e([S()],it.prototype,"invisible",null),e([S({value:!1})],it.prototype,"freeze",null),e([S()],it.prototype,"fadeDuration",null),e([S()],it.prototype,"_xNormalizer",null),e([S()],it.prototype,"visibleElevationRange",void 0),e([S()],it.prototype,"_rootTileElevationRange",void 0),e([S()],it.prototype,"_layerViewsDirty",void 0),e([S()],it.prototype,"renderPatchBorders",null),e([S()],it.prototype,"renderingDisabled",null),e([S({readOnly:!0})],it.prototype,"enabled",void 0),it=tt=e([C("esri.views.3d.terrain.TerrainSurface")],it);const rt=it,st=U(),at=new N,nt=V(),lt=new c,ot={spatialReference:null,extent:null,scale:0};function ht(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return te(t,i,s)}return null}function dt(e,t){!e.leaf||e.level<ce||gt(e,e=>{t&&pt(e);const i=ct(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ct(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function pt(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<ce||gt(e,e=>{pt(e)})}function ut(e){e.level<ce||gt(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ct(t));)t=t.parent}})}function ct(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function gt(e,t){if(e.level<ce)return;const i=e.level-ce,r=e.lij[1]>>ce,s=e.lij[2]>>ce,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(we[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{rt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,copy as s,nan as o,fromValues as i}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{createPositionReader as l}from"./PositionReader.js";import{MeshIntersectionOptions as h,intersectRayTriangles as g}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as m}from"./screenPolygonTriangleIntersections.js";const d=40,u=.8,y=10,_=1e-6;class p{constructor(e,r,s){this.globalTriangleVertexIndices=e,this.numTriangles=r,this.positions=s,this._rayDirection=n(),this._callback=M,this._intersectionOptions=T,this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(r),this._readPosition=l(s.data,e,s.stride);const o=b(e,r,s.data,s.stride),i=t(Math.log2(r/d),2,y),a=(t,e,n)=>{const r=x(this.triangleIndexMap,o,t,e),s=e-t;if(s<=d){const n=new P(r,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=I(r),h=f(this.triangleIndexMap,o,t,e,c,l),g=(t,e)=>{if(n>i)return;const r=e-t;return r<d||r>=u*s?void 0:a(t,e,n+1)},m=new P(r,c,l,h.next,h.mid);return this.bspNodeTree.push(m),m.leftNode=g(t,h.next),m.rightNode=g(h.mid,e),m};a(0,r,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:r}=this.positions;g(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),p.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,r,s){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=s,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,r){p.numFacesTested=0;const s=t,o=e,i=o[0]-s[0],a=o[1]-s[1],c=o[2]-s[2];if(i*i+a*a+c*c<_)return;this._rayFrom=s;const l=this._rayDirection;l[0]=i,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=M,this._intersectionOptions=T}intersectRayBSP(t,e,n){const r=this._rayFrom,s=this._rayDirection;this._traverseBSP(t,e,n,t=>S(t.aabb,r,s),t=>{const e=t.axis;return r[e]<t.d||s[e]<0},t=>{const e=t.axis;return r[e]>t.d||s[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(null!=n&&null!=r)for(const s of m(n,this._screenPolygonTransformation,r,t,e,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(s.distance,s.primitiveIndex,s.point)}_intersectScreenPolygonBSP(t,e,n){const r=this._screenPolygonIntersector,s=this._screenPolygonQuery;null!=r?.camera&&null!=s&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,r,s,o,i){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();r(t)&&(s(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,i),i(t.midStartIndex,t.rightStartIndex),o(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,i))}}_traverseBSPRange(t,e,n,r,s){n>=r||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:r}):s(n,r))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,r=n?n.applyToAabb(s(B,t)):t;return a(e.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class P{constructor(t,e,n,r,s){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=r,this.rightStartIndex=s}}function f(t,e,n,r,s,o){const i=s+3;let a=n,c=n,l=r;for(;c<l;){const n=t[c],r=6*n;e[r+i]<=o?(t[c]=t[a],t[a]=n,++a,++c):e[r+s]>=o?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function x(t,e,n,r){if(r<=n)return o;let s=6*t[n],a=e[s++],c=e[s++],l=e[s++],h=e[s++],g=e[s++],m=e[s];for(let o=n+1;o<r;++o)s=6*t[o],a=Math.min(a,e[s++]),c=Math.min(c,e[s++]),l=Math.min(l,e[s++]),h=Math.max(h,e[s++]),g=Math.max(g,e[s++]),m=Math.max(m,e[s]);return i(a,c,l,h,g,m)}function I(t){const e=t[3]-t[0],n=t[4]-t[1],r=t[5]-t[2],s=e>n?e>r?0:n>r?1:2:n>r?1:r>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function b(t,e,n,r){const s=new Float64Array(6*e);for(let o=0;o<e;++o){const e=3*o,i=t[e]*r,a=t[e+1]*r,c=t[e+2]*r;for(let t=0;t<3;++t){const e=n[i+t],r=n[a+t],l=n[c+t];s[6*o+t]=Math.min(e,r,l),s[6*o+3+t]=Math.max(e,r,l)}}return s}function S(t,e,n){const r=e,s=n;let o=0,i=1/0;for(let a=0;a<3;++a){{const e=t[a];if(r[a]<e){if(s[a]<=_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]<=-_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}{const e=t[a+3];if(r[a]>e){if(s[a]>=-_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]>=_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}}return!0}const T=new h,M=()=>{},R=()=>{},B=r();export{p as TriangleIntersectionData};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{isFloat32Array as n}from"../../../../core/typedArrayUtil.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,copy as o,nan as i,fromValues as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{intersectsTransformedAabb as h}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{createPositionReader as m}from"./PositionReader.js";import{MeshIntersectionOptions as d,intersectRayTriangles as u}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as y}from"./screenPolygonTriangleIntersections.js";const p=40,_=.8,f=10,P=1e-6;class x{constructor(e,n,s){this.globalTriangleVertexIndices=e,this.numTriangles=n,this.positions=s,this._rayDirection=r(),this._callback=j,this._intersectionOptions=B,this._screenPolygonCallback=v,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=g(n),this._readPosition=m(s.data,e,s.stride);const o=M(e,n,s.data,s.stride),i=t(Math.log2(n/p),2,f),a=(t,e,n)=>{const r=S(this.triangleIndexMap,o,t,e),s=e-t;if(s<=p){const n=new b(r,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=T(r),h=I(this.triangleIndexMap,o,t,e,c,l),g=(t,e)=>{if(n>i)return;const r=e-t;return r<p||r>=_*s?void 0:a(t,e,n+1)},m=new b(r,c,l,h.next,h.mid);return this.bspNodeTree.push(m),m.leftNode=g(t,h.next),m.rightNode=g(h.mid,e),m};a(0,n,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:r}=this.positions;u(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),x.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,r,s){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=s,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=v,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,r){x.numFacesTested=0;const s=t,o=e,i=o[0]-s[0],a=o[1]-s[1],c=o[2]-s[2];if(i*i+a*a+c*c<P)return;this._rayFrom=s;const l=this._rayDirection;l[0]=i,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=j,this._intersectionOptions=B}intersectRayBSP(t,e,n){const r=this._rayFrom,s=this._rayDirection;this._traverseBSP(t,e,n,t=>R(t.aabb,r,s),t=>{const e=t.axis;return r[e]<t.d||s[e]<0},t=>{const e=t.axis;return r[e]>t.d||s[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(null!=n&&null!=r)for(const s of y(n,this._screenPolygonTransformation,r,t,e,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(s.distance,s.primitiveIndex,s.point)}_intersectScreenPolygonBSP(t,e,n){const r=this._screenPolygonIntersector,s=this._screenPolygonQuery;null!=r?.camera&&null!=s&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,r,s,o,i){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();r(t)&&(s(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,i),i(t.midStartIndex,t.rightStartIndex),o(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,i))}}_traverseBSPRange(t,e,n,r,s){n>=r||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:r}):s(n,r))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,r=n?n.applyToAabb(o(D,t)):t;return h(e.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class b{constructor(t,e,n,r,s){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=r,this.rightStartIndex=s}}function I(t,e,n,r,s,o){const i=s+3;let a=n,c=n,l=r;for(;c<l;){const n=t[c],r=6*n;e[r+i]<=o?(t[c]=t[a],t[a]=n,++a,++c):e[r+s]>=o?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function S(t,e,n,r){if(r<=n)return i;let s=6*t[n],o=e[s++],c=e[s++],l=e[s++],h=e[s++],g=e[s++],m=e[s];for(let i=n+1;i<r;++i)s=6*t[i],o=Math.min(o,e[s++]),c=Math.min(c,e[s++]),l=Math.min(l,e[s++]),h=Math.max(h,e[s++]),g=Math.max(g,e[s++]),m=Math.max(m,e[s]);return a(o,c,l,h,g,m)}function T(t){const e=t[3]-t[0],n=t[4]-t[1],r=t[5]-t[2],s=e>n?e>r?0:n>r?1:2:n>r?1:r>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function M(t,e,r,s){const o=n(r)?l(6*e,!0):c(6*e);for(let n=0;n<e;++n){const e=3*n,i=t[e]*s,a=t[e+1]*s,c=t[e+2]*s;for(let t=0;t<3;++t){const e=r[i+t],s=r[a+t],l=r[c+t];o[6*n+t]=Math.min(e,s,l),o[6*n+3+t]=Math.max(e,s,l)}}return o}function R(t,e,n){const r=e,s=n;let o=0,i=1/0;for(let a=0;a<3;++a){{const e=t[a];if(r[a]<e){if(s[a]<=P)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]<=-P){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}{const e=t[a+3];if(r[a]>e){if(s[a]>=-P)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]>=P){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}}return!0}const B=new d,j=()=>{},v=()=>{},D=s();export{x as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isImagePattern as t}from"./lineStippleUtils.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelType as r,SizedPixelFormat as o}from"../../../webgl/enums.js";import n from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function a(a,p){return new e(e=>{if(t(e))return s(a,e.image);const{data:p,textureSize:l}=u(e),m=new i(l,1);return m.dataType=r.FLOAT,m.pixelFormat=6403,m.internalFormat=o.R16F,m.wrapMode=10497,new n(a,m,p)},e=>t(e)?`image-${e.uuid}`:`${e.pattern.join(",")}-r${e.pixelRatio}`,p)}function u(t){const e=p(t),r=1/t.pixelRatio,o=l(t),n=[];let i=1;for(const u of e){for(let t=0;t<u;t++){const e=i*(Math.min(t,u-1-t)+.5)*r;n.push(e)}i=-i}const a=Math.round(e[0]/2);return{data:new Float32Array([...n.slice(a),...n.slice(0,a)]),textureSize:o}}function p(t){return t.pattern.map(e=>Math.round(e*t.pixelRatio))}function l(t){if(null==t)return 1;const e=p(t);return Math.floor(e.reduce((t,e)=>t+e))}function s(t,e){const{data:a,width:u,height:p}=e,l=new i(u,p);return l.dataType=r.UNSIGNED_BYTE,l.pixelFormat=6408,l.internalFormat=o.RGBA8,l.wrapMode={s:10497,t:33071},l.hasMipmap=!0,l.samplingMode=9987,new n(t,l,a)}export{l as computeTextureSize,a as createStippleTextureRepository,s as imageToTexture};
2
+ import{isImagePattern as t}from"./lineStippleUtils.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelType as r,SizedPixelFormat as n}from"../../../webgl/enums.js";import o from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";const a=65504;function l(a,l){return new e(e=>{if(t(e))return m(a,e.image);const{data:l,textureSize:u}=p(e),s=new i(u,1);return s.dataType=r.FLOAT,s.pixelFormat=6403,s.internalFormat=n.R16F,s.wrapMode=10497,new o(a,s,l)},e=>t(e)?`image-${e.uuid}`:`${e.pattern.join(",")}-r${e.pixelRatio}`,l)}function p(t){const e=u(t),r=1/t.pixelRatio,n=s(t),o=[];let i=0,l=0,p=0,m=1;for(const a of e)a>0&&(l!==m&&(o.push(p),i||=m),l=m,p+=a),m=-m;o.length>1&&i===l&&(o[0]=o.pop());const f=Math.round(e[0]/2),c=new Float32Array(n);if(1===o.length)c.fill(i*a);else if(o.length>1){let t=0,e=i,a=0===o[0]?0:o[0]-n,l=o[1];for(let i=0;i<n;i++){const p=i+f+.5;if(p>=l){t=(t+1)%o.length,e=-e,a=l;l+=(o[(t+1)%o.length]-o[t]+n)%n}c[i]=e*Math.min(p-a,l-p)*r}}return{data:c,textureSize:n}}function u(t){return t.pattern.map(e=>Math.round(e*t.pixelRatio))}function s(t){if(null==t)return 1;const e=u(t);return Math.floor(e.reduce((t,e)=>t+e,0))}function m(t,e){const{data:a,width:l,height:p}=e,u=new i(l,p);return u.dataType=r.UNSIGNED_BYTE,u.pixelFormat=6408,u.internalFormat=n.RGBA8,u.wrapMode={s:10497,t:33071},u.hasMipmap=!0,u.samplingMode=9987,new o(t,u,a)}export{s as computeTextureSize,l as createStippleTextureRepository,m as imageToTexture,p as patternToTextureData};
@@ -22,7 +22,7 @@ export interface DOMContainerProperties extends Partial<Pick<DOMContainer, "aria
22
22
  /**
23
23
  * Indicates whether the focus region is currently enabled.
24
24
  *
25
- * Set this property to `true` to show the centered focus region, or `false` to hide it.
25
+ * Set this property to `true` to show the centered focus region once the view is ready, or `false` to hide it.
26
26
  *
27
27
  * @default false
28
28
  * @since 5.2
@@ -126,7 +126,7 @@ export abstract class DOMContainer {
126
126
  /**
127
127
  * Indicates whether the focus region is currently enabled.
128
128
  *
129
- * Set this property to `true` to show the centered focus region, or `false` to hide it.
129
+ * Set this property to `true` to show the centered focus region once the view is ready, or `false` to hide it.
130
130
  *
131
131
  * @default false
132
132
  * @since 5.2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{byId as e,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as r,removeMaybe as a}from"../core/maybe.js";import{watch as l,initial as h,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as g}from"./Attribution.js";import m from"./overlay/FocusRegionOverlayItem.js";import f from"./overlay/ViewOverlay.js";const y=[0,0];function v(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return y[0]=i.left+(e?.pageXOffset??0),y[1]=i.top+(e?.pageYOffset??0),y}function _(t){t&&(t.textContent="",t.parentNode&&t.parentNode.removeChild(t))}const b="test"===process.env.NODE_ENV,R=b?0:16,w=b?0:750,O=b?0:512,E=2,I=50,C={left:0,top:0,right:0,bottom:0},H={toggle:"KeyO",resizeLarger:"ArrowUp",resizeSmaller:"ArrowDown",select:new Set(["Enter","Space"])},z=y=>{const b=y;let z=class extends b{constructor(...t){super(...t),this._freqInfo={freq:R,time:w},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new m,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([l(()=>[this.focusRegionEnabled,this.overlay],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),{initial:!0}),l(()=>this.cursor,t=>{const{surface:e}=this;e&&e.setAttribute("data-cursor",t)}),l(()=>this.navigating,t=>{const{surface:e}=this;e&&e.setAttribute("data-navigating",t.toString())}),l(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),l(()=>{const{left:t,top:e,right:i,bottom:s}=this.padding??C;return[this.width,this.height,t,e,i,s]},([t,e,i,s,o,n])=>{const{_focusRegionOverlayItem:r}=this;r.backgroundHeight=e,r.backgroundWidth=t,r.padding={left:i,top:s,right:o,bottom:n},r.updateBoxSize()})])}initialize(){const t=this;this.addHandles([l(()=>this.ui,(t,e)=>this._handleUIChange(t,e),h),t.on("focus",()=>this.notifyChange("focused")),t.on("blur",()=>this.notifyChange("focused")),t.on("key-down",e=>{const{shiftKey:i,altKey:s,code:o,defaultPrevented:n}=e.native,{toggle:r,resizeLarger:a,resizeSmaller:l,select:h}=H,u=this.focusRegionEnabled&&i&&s&&(o===a||o===l);if(!e.repeat||u){if(!n&&i&&s&&o===r)return this._toggleFocusRegion(),void e.preventDefault();if(!n&&u){const{_focusRegionOverlayItem:t}=this;return t.resizeBoxSize(o===a?I:-I),e.preventDefault(),e.native.stopPropagation(),void e.stopPropagation()}!n&&this.focusRegionEnabled&&h.has(o)&&this._selectFocusRegion(e,t)}})])}destroy(){this.destroyed||(this.focusRegionEnabled=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get("container")??null}set container(t){const s=this._get("container"),o=e(t);if(o||"string"!=typeof t||n.getLogger(this).error("#container",`element with id '${t}' not found`),s===o)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=r(this._attribution),this.root&&(_(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),_(this.userContent),this._set("userContent",null))),!o)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);o.classList.add("esri-view");const c=document.createElement("div");c.className="esri-view-user-storage",i(o,c),o.appendChild(c),this._set("userContent",c);const p=document.createElement("div");p.className="esri-view-root",o.insertBefore(p,o.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new f;p.appendChild(y.surface),this._set("overlay",y),this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled),this.addHandles(l(()=>y.needsRender,t=>{t&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=d({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)},h),"container"),this.addHandles([l(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:t,items:e,mode:i})=>{t?(this._attribution||(this._attribution=new g({attributionItems:this.attributionItems,mode:this.attributionMode})),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=e,this._attribution.mode=i):this._attribution=r(this._attribution)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",o),this._startMeasuring()}get focused(){const t=document.activeElement===this.surface;return document.hasFocus()&&t}get focusRegion(){return this.focusRegionEnabled?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get("ui")}set ui(t){const e=this._get("ui");e!==t&&e?.destroy(),this._set("ui",t)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(t,e,i){const s=this.position;return t-=s?s[0]:0,e-=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}containerToPage(t,e,i){const s=this.position;return t+=s?s[0]:0,e+=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}_updateAria(){const{surface:t,aria:e}=this;t&&(t.ariaLabelledByElements=e?.labelledByElements??null,t.ariaDescribedByElements=e?.describedByElements??null,t.ariaLabel=e?.label??null,t.ariaDescription=e?.description??null)}_selectFocusRegion(t,e){const i=this._makeFocusRegionSelectEvent(t);e.emit("focus-region-select",i),t.preventDefault()}_makeFocusRegionSelectEvent(t){const e={type:"focus-region-select",native:t.native,defaultPrevented:!1,preventDefault:()=>{e.defaultPrevented=!0},stopPropagation:()=>{t.stopPropagation()}};return e}_toggleFocusRegion(){this.focusRegionEnabled=!this.focusRegionEnabled}_updateFocusRegionOverlayItem(){const{_focusRegionOverlayItem:t}=this;t.backgroundHeight=this.height,t.backgroundWidth=this.width,t.padding=this.padding??C,t.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(t){const{_focusRegionOverlayItem:e,overlay:i}=this,s=t;e.visible=s,i&&(i.removeItem(e),s&&(this._updateFocusRegionOverlayItem(),i.addItem(e)))}_handleUIChange(t,e){this.removeHandles("ui"),e&&e!==t&&e.destroy(),t&&(t.view=this,this.addHandles(l(()=>this.root,e=>{if(e){const i=document.createElement("div");e.insertBefore(i,this._attribution?.surface??null),t.container=i}else t.container=null},h),"ui")),this._set("ui",t)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const t=this._freqInfo;t.freq=R,t.time=w;const e=d({prepare:t=>{const i=this._measure(),s=this._freqInfo;if(s.time+=t.deltaTime,i&&(s.freq=R,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const o=this._position();s.freq=o||i?R:Math.min(w,s.freq*E),!i&&s.freq>=O&&(e.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{t.freq=R,t.time=w,e.resume()});null!=this.container&&i.observe(this.container);const n=o(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{t.freq=R,t.time=w,e.resume()}),n,e],"measuring"),this._measure(),this._position()}_measure(){const t=this.container,e=t?t.clientWidth:0,i=t?t.clientHeight:0;if(0===e||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;if(e===s&&i===o)return this.suspended&&this._set("suspended",!1),!1;this._set("width",e),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:o,width:e,height:i}),!0}_position(){const t=this.container,e=this.position,i=t&&v(t);return!!i&&((!e||i[0]!==e[0]||i[1]!==e[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return t([c()],z.prototype,"_attribution",void 0),t([c()],z.prototype,"aria",void 0),t([c()],z.prototype,"attributionHeight",null),t([c()],z.prototype,"attributionMode",void 0),t([c()],z.prototype,"container",null),t([c({readOnly:!0})],z.prototype,"focused",null),t([c({readOnly:!0})],z.prototype,"height",void 0),t([c()],z.prototype,"focusRegionEnabled",void 0),t([c()],z.prototype,"focusRegion",null),t([c()],z.prototype,"messagesCommon",void 0),t([c({type:f})],z.prototype,"overlay",void 0),t([c({readOnly:!0})],z.prototype,"position",void 0),t([c({readOnly:!0})],z.prototype,"resizing",void 0),t([c({readOnly:!0})],z.prototype,"root",void 0),t([c({value:null,readOnly:!0})],z.prototype,"size",null),t([c({readOnly:!0})],z.prototype,"surface",void 0),t([c({readOnly:!0})],z.prototype,"suspended",void 0),t([c({nonNullable:!0})],z.prototype,"ui",null),t([c({readOnly:!0})],z.prototype,"userContent",void 0),t([c({readOnly:!0})],z.prototype,"width",void 0),t([c()],z.prototype,"widthBreakpoint",void 0),z=t([p("esri.views.DOMContainer")],z),z};export{z as DOMContainer};
2
+ import{__decorate as t}from"tslib";import{byId as e,reparent as i}from"../core/domUtils.js";import{on as s}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import n from"../core/Logger.js";import{destroyMaybe as r,removeMaybe as a}from"../core/maybe.js";import{watch as l,initial as h,syncAndInitial as u}from"../core/reactiveUtils.js";import{addFrameTask as d}from"../core/scheduling.js";import{property as c,subclass as p}from"../core/accessorSupport/decorators.js";import{Attribution as g}from"./Attribution.js";import m from"./overlay/FocusRegionOverlayItem.js";import f from"./overlay/ViewOverlay.js";const y=[0,0];function v(t){const e=(t.ownerDocument||window.document).defaultView,i=t.getBoundingClientRect();return y[0]=i.left+(e?.pageXOffset??0),y[1]=i.top+(e?.pageYOffset??0),y}function _(t){t&&(t.textContent="",t.parentNode&&t.parentNode.removeChild(t))}const b="test"===process.env.NODE_ENV,R=b?0:16,w=b?0:750,O=b?0:512,I=2,C=50,E={left:0,top:0,right:0,bottom:0},H={toggle:"KeyO",resizeLarger:"ArrowUp",resizeSmaller:"ArrowDown",select:new Set(["Enter","Space"])},z=y=>{const b=y;let z=class extends b{constructor(...t){super(...t),this._freqInfo={freq:R,time:w},this._overlayRenderTaskHandle=null,this._focusRegionOverlayItem=new m,this.aria={},this.attributionMode=null,this.height=0,this.focusRegionEnabled=!1,this.messagesCommon=null,this.overlay=null,this.position=null,this.resizing=!1,this.root=null,this.surface=null,this.suspended=!0,this.userContent=null,this.width=0,this.widthBreakpoint=null,this.addHandles([l(()=>[this.focusRegionEnabled,this.overlay,this.ready],()=>this._syncFocusRegionOverlayItemVisibility(this.focusRegionEnabled&&this.ready),{initial:!0}),l(()=>this.cursor,t=>{const{surface:e}=this;e&&e.setAttribute("data-cursor",t)}),l(()=>this.navigating,t=>{const{surface:e}=this;e&&e.setAttribute("data-navigating",t.toString())}),l(()=>[this.aria,this.surface],()=>this._updateAria(),{initial:!0}),l(()=>{const{left:t,top:e,right:i,bottom:s}=this.padding??E;return[this.width,this.height,t,e,i,s]},([t,e,i,s,o,n])=>{const{_focusRegionOverlayItem:r}=this;r.backgroundHeight=e,r.backgroundWidth=t,r.padding={left:i,top:s,right:o,bottom:n},r.updateBoxSize()})])}initialize(){const t=this;this.addHandles([l(()=>this.ui,(t,e)=>this._handleUIChange(t,e),h),t.on("focus",()=>this.notifyChange("focused")),t.on("blur",()=>this.notifyChange("focused")),t.on("key-down",e=>{const{shiftKey:i,altKey:s,code:o,defaultPrevented:n}=e.native,{toggle:r,resizeLarger:a,resizeSmaller:l,select:h}=H,u=this.focusRegionEnabled&&i&&s&&(o===a||o===l);if(!e.repeat||u){if(!n&&i&&s&&o===r)return this._toggleFocusRegion(),void e.preventDefault();if(!n&&u){const{_focusRegionOverlayItem:t}=this;return t.resizeBoxSize(o===a?C:-C),e.preventDefault(),e.native.stopPropagation(),void e.stopPropagation()}!n&&this.focusRegionEnabled&&h.has(o)&&this._selectFocusRegion(e,t)}})])}destroy(){this.destroyed||(this.focusRegionEnabled=!1,this._syncFocusRegionOverlayItemVisibility(!1),this.ui?.destroy(),this.container=null)}get attributionHeight(){return this._attribution?.height??0}get container(){return this._get("container")??null}set container(t){const s=this._get("container"),o=e(t);if(o||"string"!=typeof t||n.getLogger(this).error("#container",`element with id '${t}' not found`),s===o)return;if(this._stopMeasuring(),this.removeHandles("container"),s&&(s.classList.remove("esri-view"),this._overlayRenderTaskHandle&&(this._overlayRenderTaskHandle.remove(),this._overlayRenderTaskHandle=null),this.overlay&&(this.overlay.destroy(),this._set("overlay",null)),this._attribution=r(this._attribution),this.root&&(_(this.root),this._set("root",null)),this.userContent&&(i(this.userContent,s),_(this.userContent),this._set("userContent",null))),!o)return this._set("width",0),this._set("height",0),this._set("position",null),this._set("suspended",!0),this._set("surface",null),void this._set("container",null);o.classList.add("esri-view");const c=document.createElement("div");c.className="esri-view-user-storage",i(o,c),o.appendChild(c),this._set("userContent",c);const p=document.createElement("div");p.className="esri-view-root",o.insertBefore(p,o.firstChild),this._set("root",p);const m=document.createElement("div");m.className="esri-view-surface",m.setAttribute("role","application"),m.tabIndex=0,p.appendChild(m),this._set("surface",m);const y=new f;p.appendChild(y.surface),this._set("overlay",y),this._syncFocusRegionOverlayItemVisibility(!1),this.addHandles(l(()=>y.needsRender,t=>{t&&!this._overlayRenderTaskHandle?this._overlayRenderTaskHandle=d({render:()=>this.overlay?.render()}):this._overlayRenderTaskHandle=a(this._overlayRenderTaskHandle)},h),"container"),this.addHandles([l(()=>({visible:this.attributionVisible,items:this.attributionItems,mode:this.attributionMode}),({visible:t,items:e,mode:i})=>{t?(this._attribution||(this._attribution=new g({attributionItems:this.attributionItems,mode:this.attributionMode})),this._attribution.appendBefore(p,this.ui?.container??null),this._attribution.attributionItems=e,this._attribution.mode=i):this._attribution=r(this._attribution)},u)],"container"),this.forceDOMReadyCycle(),this._set("container",o),this._startMeasuring()}get focused(){const t=document.activeElement===this.surface;return document.hasFocus()&&t}get focusRegion(){return this.focusRegionEnabled?this._focusRegionOverlayItem.getScreenRect():null}get size(){return[this.width,this.height]}get ui(){return this._get("ui")}set ui(t){const e=this._get("ui");e!==t&&e?.destroy(),this._set("ui",t)}blur(){this.surface?.blur()}focus(){this.surface?.focus()}pageToContainer(t,e,i){const s=this.position;return t-=s?s[0]:0,e-=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}containerToPage(t,e,i){const s=this.position;return t+=s?s[0]:0,e+=s?s[1]:0,i?(i[0]=t,i[1]=e):i=[t,e],i}_updateAria(){const{surface:t,aria:e}=this;t&&(t.ariaLabelledByElements=e?.labelledByElements??null,t.ariaDescribedByElements=e?.describedByElements??null,t.ariaLabel=e?.label??null,t.ariaDescription=e?.description??null)}_selectFocusRegion(t,e){const i=this._makeFocusRegionSelectEvent(t);e.emit("focus-region-select",i),t.preventDefault()}_makeFocusRegionSelectEvent(t){const e={type:"focus-region-select",native:t.native,defaultPrevented:!1,preventDefault:()=>{e.defaultPrevented=!0},stopPropagation:()=>{t.stopPropagation()}};return e}_toggleFocusRegion(){this.focusRegionEnabled=!this.focusRegionEnabled}_updateFocusRegionOverlayItem(){const{_focusRegionOverlayItem:t}=this;t.backgroundHeight=this.height,t.backgroundWidth=this.width,t.padding=this.padding??E,t.updateBoxSize()}_syncFocusRegionOverlayItemVisibility(t){const{_focusRegionOverlayItem:e,overlay:i}=this,s=t;e.visible=s,i&&(i.removeItem(e),s&&(this._updateFocusRegionOverlayItem(),i.addItem(e)))}_handleUIChange(t,e){this.removeHandles("ui"),e&&e!==t&&e.destroy(),t&&(t.view=this,this.addHandles(l(()=>this.root,e=>{if(e){const i=document.createElement("div");e.insertBefore(i,this._attribution?.surface??null),t.container=i}else t.container=null},h),"ui")),this._set("ui",t)}_stopMeasuring(){this.removeHandles("measuring"),this._get("resizing")&&this._set("resizing",!1)}_startMeasuring(){const t=this._freqInfo;t.freq=R,t.time=w;const e=d({prepare:t=>{const i=this._measure(),s=this._freqInfo;if(s.time+=t.deltaTime,i&&(s.freq=R,this._get("resizing")||this._set("resizing",!0)),s.time<s.freq)return;s.time=0;const o=this._position();s.freq=o||i?R:Math.min(w,s.freq*I),!i&&s.freq>=O&&(e.pause(),this._get("resizing")&&this._set("resizing",!1))}}),i=new ResizeObserver(i=>{t.freq=R,t.time=w,e.resume()});null!=this.container&&i.observe(this.container);const n=o(()=>i.disconnect());this.addHandles([s(window,"resize",()=>{t.freq=R,t.time=w,e.resume()}),n,e],"measuring"),this._measure(),this._position()}_measure(){const t=this.container,e=t?t.clientWidth:0,i=t?t.clientHeight:0;if(0===e||0===i)return this.suspended||this._set("suspended",!0),!1;const s=this.width,o=this.height;if(e===s&&i===o)return this.suspended&&this._set("suspended",!1),!1;this._set("width",e),this._set("height",i),this.suspended&&this._set("suspended",!1);return this.emit("resize",{oldWidth:s,oldHeight:o,width:e,height:i}),!0}_position(){const t=this.container,e=this.position,i=t&&v(t);return!!i&&((!e||i[0]!==e[0]||i[1]!==e[1])&&(this._set("position",[i[0],i[1]]),!0))}forceDOMReadyCycle(){}};return t([c()],z.prototype,"_attribution",void 0),t([c()],z.prototype,"aria",void 0),t([c()],z.prototype,"attributionHeight",null),t([c()],z.prototype,"attributionMode",void 0),t([c()],z.prototype,"container",null),t([c({readOnly:!0})],z.prototype,"focused",null),t([c({readOnly:!0})],z.prototype,"height",void 0),t([c()],z.prototype,"focusRegionEnabled",void 0),t([c()],z.prototype,"focusRegion",null),t([c()],z.prototype,"messagesCommon",void 0),t([c({type:f})],z.prototype,"overlay",void 0),t([c({readOnly:!0})],z.prototype,"position",void 0),t([c({readOnly:!0})],z.prototype,"resizing",void 0),t([c({readOnly:!0})],z.prototype,"root",void 0),t([c({value:null,readOnly:!0})],z.prototype,"size",null),t([c({readOnly:!0})],z.prototype,"surface",void 0),t([c({readOnly:!0})],z.prototype,"suspended",void 0),t([c({nonNullable:!0})],z.prototype,"ui",null),t([c({readOnly:!0})],z.prototype,"userContent",void 0),t([c({readOnly:!0})],z.prototype,"width",void 0),t([c()],z.prototype,"widthBreakpoint",void 0),z=t([p("esri.views.DOMContainer")],z),z};export{z as DOMContainer};
@@ -245,7 +245,7 @@ export abstract class PopupView {
245
245
  openPopup(options?: ViewPopupOpenOptions): Promise<void>;
246
246
  }
247
247
 
248
- export type ViewPopupOpenOptions = Pick<PopupOpenOptions, "actions" | "content" | "diagnostics" | "features" | "featureStream" | "fetchFeatures" | "location" | "promises" | "title" | "updateLocationEnabled" | "shouldFocus">;
248
+ export type ViewPopupOpenOptions = Pick<PopupOpenOptions, "actions" | "content" | "features" | "featureStream" | "fetchFeatures" | "location" | "promises" | "title" | "updateLocationEnabled" | "shouldFocus">;
249
249
 
250
250
  /**
251
251
  * Options for the [fetchPopupFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/PopupView/#fetchPopupFeatures) method. See properties below for object specifications.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- 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{destroyHandle as o,makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{mapCollectionAsync as h}from"../core/mapCollectionUtils.js";import{destroyMaybe as d,maybeProperty as u}from"../core/maybe.js";import{throwIfDestroyed as c,throwIfAborted as g,createAbortError as m}from"../core/promiseUtils.js";import y from"../core/ReactiveSet.js";import{on as f,watch as w,initial as v,sync as _,whenOnce as b,syncAndInitial as M}from"../core/reactiveUtils.js";import{setFrameDuration as S,cleanupScheduling as V}from"../core/scheduling.js";import{createScreenPoint as j,createScreenPointArray as C}from"../core/screenUtils.js";import{cleanupWhereClauseCache as T}from"../core/sql.js";import{getMetersPerUnitForSR as R}from"../core/units.js";import{property as x,cast as A,subclass as O}from"../core/accessorSupport/decorators.js";import{ensureType as E,ensureClass as L}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as I}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as H}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as P}from"../core/accessorSupport/trackingUtils.js";import{create as D}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as F}from"../core/libs/rbush/PooledRBush.js";import{initialize as U}from"../core/workers/workers.js";import G from"../geometry/Extent.js";import W from"../geometry/HeightModelInfo.js";import z from"../geometry/Point.js";import{project as q,canProjectWithoutEngine as k}from"../geometry/projectionUtils.js";import B from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as N}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Z}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Q}from"../geometry/projection/projectPointToVector.js";import{toExtent as Y,create as $}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as J}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as K}from"../geometry/support/scaleUtils.js";import{wgs84 as X,webMercator as ee}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as te}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as ie,isTiledLayer as re,isVoxelLayer as se,isIntegratedMeshLayer as ne,isGaussianSplatLayer as ae}from"../layers/support/layerUtils.js";import{TilemapCache as oe}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as le}from"../portal/portalDefault.js";import{WebSceneTag as pe}from"../support/tagSymbols.js";import{BreakpointsOwner as he}from"./BreakpointsOwner.js";import{DOMContainer as de}from"./DOMContainer.js";import{PopupView as ue}from"./PopupView.js";import ce from"./View.js";import ge from"./ViewAnimation.js";import{stringFromViewingMode as me,viewingModeFromString as ye}from"./ViewingMode.js";import{GroundView3D as fe}from"./3d/GroundView3D.js";import{layerView3DImporter as we}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ve}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as _e}from"./3d/camera/intersectionUtils.js";import be from"./3d/constraints/Constraints.js";import Me from"./3d/environment/Environment.js";import{EnvironmentManager as Se}from"./3d/environment/EnvironmentManager.js";import Ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as je}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ce}from"./3d/layers/graphics/Labeler.js";import Te from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as Re}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as xe}from"./3d/state/ScreenSizePerspective.js";import Ae from"./3d/state/ViewState.js";import{ViewStateManager as Oe,cleanupViewStateManager as Ee}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Le}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ie}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as He}from"./3d/state/utils/navigationUtils.js";import Pe from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as De}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Fe}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Ue}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as Ge}from"./3d/support/GroundAndIMSurface.js";import{toMap as We,hitTest as ze}from"./3d/support/hitTest.js";import{popupHitTest as qe}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as ke,getQualityProfileSettings as Be}from"./3d/support/QualityProfile.js";import Ne from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ze}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Qe}from"./3d/support/ResourceController.js";import Ye from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as $e}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Je}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Ke}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Xe from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as et,getTiledLayerInfo as tt,checkIfTileInfoSupportedForView as it}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as rt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as st}from"./3d/terrain/TileRenderer.js";import{Stage as nt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as at}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as ot}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as lt}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as pt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as ht}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as dt}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import ut from"./interactive/options/ViewOptions.js";import ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as gt}from"./support/drapedUtils.js";import{occludeesSupported as mt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as yt,createScreenPointFromSupportedEvent as ft}from"./support/screenUtils.js";import{isSpatialReferenceSupported as wt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as vt,destroyTextureCompressionWorker as _t}from"./support/TextureCompressionHelper.js";import bt from"./ui/DefaultUI.js";import Mt from"./ui/3d/DefaultUI3D.js";import St from"../webscene/Environment.js";import{clearVNodeCache as Vt}from"../widgets/support/vnodeCache.js";var jt;const Ct=Symbol(),Tt=Symbol();function Rt(e){const t=L(ut,e);return t!==e&&null==e.snapping?.enabled&&(t.snapping.enabled=!0),t}let xt=class extends(he(ue(de(ce)))){static{jt=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new ut({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Qe(this),this.deconflictor=new je({view:this}),this.attribution3D=new Pe({view:this}),this.labeler=new Ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new Re({view:this}),this.basemapTerrain=null,this.elevationProvider=new De({view:this}),this._canvas=null,this.constraints=new be,this._environment=new Me,this.environmentManager=new Se,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ct({importAnalysisViewModule:e=>ve(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new y,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Ae({view:this}),this.slice=new Je,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,U();const t=()=>this._updatingChanged();this.addHandles(o(h(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,"after-changes",t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),w(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ve({view:this}),this.stateManager=new Oe({view:this}),this.screenSizePerspective=new xe({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=vt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new fe({view:this}),this.groundAndIMSurface=new Ge({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>S(e>0?1e3/Math.ceil(e):0),v),this.addHandles([w(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),_),w(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),_)])}destroy(){this.destroyed||(_t(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set("analysisViewManager",d(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=d(this.sharedSymbolResources),this._set("labeler",d(this.labeler)),this._set("deconflictor",d(this.deconflictor)),this._resourceController=d(this._resourceController),this._set("stateManager",d(this.stateManager)),this._set("inputManager",d(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",d(this.environmentManager)),this._set("environment",d(this.environment)),this.groundView=d(this.groundView),this.groundAndIMSurface.destroy(),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(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}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(z,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||u(e,"clippingArea");return!this._userClippingArea&&!u(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof G?this.spatialReference&&(t=At(t,this.spatialReference),null==t)?(p.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):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.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:At(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||B.WGS84,i=At(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||B.WGS84;let t;const i=i=>{const r=At(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new G({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(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 o=this._get("_groundAndLayersExtent");return t.equals(o)?o: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 Me?e:e instanceof St?this.environment?.cloneWithWebsceneEnvironment(e)??Me.fromWebsceneEnvironment(e):E(Me,e):new Me}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 jt._layerToLayerview}static{this._layerToLayerview=ce._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&&pe 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=Be(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ne(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ke()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?H(()=>K(e,t)):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?W.deriveUnitFromSR(e,this.spatialReference):null}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&p.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;if(!this.initialized)return!0;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||et(r))return;++i,e+=r.updatingProgress}}else++i});const r=.1;for(const n of this._updatingObjects)n?.updating&&(i+=r,e+=.5*r);for(const n of this._updatingObjectsWithProgress)n?.updating&&(++i,e+=n.updatingProgress);const s=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||s||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 Fe.UPDATING&&console.log("Updating:",this._updatingObjectsToDebug.filter(e=>null!=e&&e.updating).map(({declaredClass:e})=>e)),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,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return Fe.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return me(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?me(this.defaultsFromMap.viewingMode):wt(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?p.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 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 Ye(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 p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=yt(e)?ft(this,e):e;return We(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=It,t.x=e.x,t.y=e.y,t.z=Ue(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Q(t,Ot,this.renderSpatialReference),this.state.camera.projectToScreen(Ot,Et),j(Et[0],Et[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Q(e,Ot,i);const r=this.state.camera.computeScreenPixelSizeAt(Ot);return t&&i!==t?r*R(i)/R(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=yt(e)?ft(this,e):e;return ze(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return qe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}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(!at())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)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return we.importLayerView(e)}hasLayerViewModule(e){return we.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ye(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,i):null,s=i?r(i):[...r(1)??[],...r(2)??[]];return s?.length?{constraints:s}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!wt(e,i)&&(null==t||(!!ie(t)||(!re(t)||null!=tt(t,e,i))&&(!se(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i,r){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:s,isWGS84:n,vcsWkid:a,latestVcsWkid:o}=e,l=()=>null==a?s?B.WGS84:B.WebMercator:new B({...s?X:ee,vcsWkid:a,latestVcsWkid:o});if(ie(t)&&(s||n)){return!n||2===r||null===it(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]:[{spatialReference:l(),viewingMode:i}]}return re(t)||se(t)||!s&&!n?re(t)&&s&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${me(i)} viewing mode.`):e.isGeographic&&p.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 p.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(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return p.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&&mt(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{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 b(()=>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),l(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Ht[e]();if(t&&(c(this),g(i.signal),await t(i.signal)),this.destroyed)throw m();return g(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 Xe({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 Ke({view:this})),this.addHandles([this.updatingHandles.add(()=>Fe.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=d(this._featureTreeDebugger))},M),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.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?q(Y(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},M),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=d(this._featureTiles)},_)],Ct),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(Tt),this.removeHandles(Ct),this._featureTiles=d(this.featureTiles),this._set("pointsOfInterest",d(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=J(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ze.create(this.state.viewingMode,i)),t||this.addHandles(w(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!Z(e,this.groundView.spatialReference,Lt,t)||(this.renderCoordsHelper.extent=Lt)},_),Tt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(lt/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(Tt),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(w(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),_),"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 Ie(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new nt({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||"WebGL context lost")})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(lt/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=d(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new $e({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=>b(()=>this.groundView?.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=d(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===ye(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(f(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>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?I(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.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(ht);for(const t of this.allLayerViews)(ne(t.layer)&&(!has("enable-feature:im-as-ground")||t.layer.isUsedAsGroundLayer)||ae(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(ht);for(const t of this.allLayerViews)(has("enable-feature:im-as-ground")?ne(t.layer)&&t.layer.isUsedAsGroundLayer:ne(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){Vt(),P(),T(),dt(),Ee(),_e(),N(),gt(),le(),st(),pt(),Le(),He(),F(),V(),ot(),rt(),Te.cleanupI3SLodHandling(),oe.cleanupTilemapCache(),Ae.cleanupViewstate(),Xe.cleanupTerrainSurface()}};function At(e,t){return null!=e&&k(e.spatialReference,t)?q(e,t):null}e([x({nonNullable:!0}),A(Rt)],xt.prototype,"options",void 0),e([x()],xt.prototype,"_userClippingArea",void 0),e([x()],xt.prototype,"_resourceController",void 0),e([x()],xt.prototype,"stage",null),e([x({readOnly:!0})],xt.prototype,"deconflictor",void 0),e([x({readOnly:!0})],xt.prototype,"labeler",void 0),e([x()],xt.prototype,"navigation",void 0),e([x({type:ge,readOnly:!0})],xt.prototype,"animation",null),e([x({readOnly:!0})],xt.prototype,"basemapTerrain",void 0),e([x({readOnly:!0})],xt.prototype,"overlayManager",null),e([x({readOnly:!0})],xt.prototype,"elevationProvider",void 0),e([x()],xt.prototype,"camera",null),e([x({type:t})],xt.prototype,"contentCamera",null),e([x({readOnly:!0})],xt.prototype,"canvas",null),e([x({type:z,useTypeForAutocast:!1})],xt.prototype,"center",null),e([x({type:G})],xt.prototype,"clippingArea",null),e([x({type:be,nonNullable:!0})],xt.prototype,"constraints",void 0),e([x({type:G,readOnly:!0})],xt.prototype,"renderDataExtent",null),e([x({readOnly:!0})],xt.prototype,"tileInfo",null),e([x({type:G,readOnly:!0})],xt.prototype,"dataExtent",null),e([x({type:G,readOnly:!0})],xt.prototype,"_groundAndLayersExtent",null),e([x({type:Me})],xt.prototype,"environment",null),e([A("environment")],xt.prototype,"castEnvironment",null),e([x({readOnly:!0})],xt.prototype,"environmentManager",void 0),e([x({type:G})],xt.prototype,"extent",null),e([x({type:r})],xt.prototype,"floors",void 0),e([x()],xt.prototype,"screenCenter",null),e([x()],xt.prototype,"frustum",null),e([x({type:Number,readOnly:!0})],xt.prototype,"fullOpacity",void 0),e([x({readOnly:!0})],xt.prototype,"graphicsView",void 0),e([x()],xt.prototype,"analysisViewManager",void 0),e([x()],xt.prototype,"groundView",void 0),e([x({readOnly:!0})],xt.prototype,"layerviewCollections",null),e([x({type:Boolean})],xt.prototype,"initialExtentRequired",null),e([x()],xt.prototype,"defaultsFromMapSettings",null),e([x()],xt.prototype,"interacting",null),e([x()],xt.prototype,"stationary",null),e([x()],xt.prototype,"navigating",null),e([x()],xt.prototype,"map",void 0),e([x()],xt.prototype,"padding",null),e([x({type:Ke,readOnly:!0})],xt.prototype,"pointsOfInterest",void 0),e([x()],xt.prototype,"_featureTiles",void 0),e([x()],xt.prototype,"featureTiles",null),e([x()],xt.prototype,"_featureTreeDebugger",void 0),e([x({constructOnly:!0})],xt.prototype,"deactivatedWebGLExtensions",void 0),e([x({constructOnly:!0})],xt.prototype,"debugWebGLExtensions",void 0),e([x({constructOnly:!0})],xt.prototype,"renderCanvas",void 0),e([x({constructOnly:!0})],xt.prototype,"state",void 0),e([x()],xt.prototype,"screenSizePerspective",void 0),e([x({readOnly:!0})],xt.prototype,"inputManager",void 0),e([x({readOnly:!0})],xt.prototype,"stateManager",void 0),e([x({type:["low","medium","high"]})],xt.prototype,"qualityProfile",null),e([x({type:Ne,get(){let e=this._get("qualitySettings");if(!e){const t=Be(this.qualityProfile);e=new Ne(t)}return e}})],xt.prototype,"qualitySettings",void 0),e([x()],xt.prototype,"slice",void 0),e([x({readOnly:!0})],xt.prototype,"typeSpecificPreconditionsReady",null),e([x({readOnly:!0})],xt.prototype,"renderCoordsHelper",void 0),e([x({readOnly:!0})],xt.prototype,"sceneIntersectionHelper",void 0),e([x({type:Number,readOnly:!0})],xt.prototype,"resolution",null),e([x({type:Number})],xt.prototype,"scale",null),e([x({readOnly:!0,type:Number})],xt.prototype,"terrainLevel",null),e([x()],xt.prototype,"heightModelInfo",null),e([x({type:B})],xt.prototype,"spatialReference",void 0),e([x({type:Boolean,value:!1})],xt.prototype,"alphaCompositingEnabled",null),e([x({constructOnly:!0})],xt.prototype,"preserveDrawingBufferEnabled",void 0),e([x({type:Boolean})],xt.prototype,"supersampleScreenshotsEnabled",void 0),e([x({readOnly:!0})],xt.prototype,"type",void 0),e([x(),A(e=>e instanceof bt?e:L(Mt,e))],xt.prototype,"ui",void 0),e([x({type:Boolean,readOnly:!0})],xt.prototype,"updating",null),e([x()],xt.prototype,"_updatingObjects",null),e([x()],xt.prototype,"_updatingObjectsWithProgress",null),e([x()],xt.prototype,"_updatingObjectsToDebug",null),e([x({type:Number,readOnly:!0})],xt.prototype,"updatingProgress",void 0),e([x({type:["global","local"]})],xt.prototype,"viewingMode",null),e([x({type:i})],xt.prototype,"viewpoint",null),e([x({readOnly:!0})],xt.prototype,"visibleArea",null),e([x({type:Number})],xt.prototype,"zoom",null),e([x({readOnly:!0})],xt.prototype,"quality",null),e([x({readOnly:!0})],xt.prototype,"resolutionScale",null),e([x()],xt.prototype,"focusAreasView",void 0),e([x()],xt.prototype,"_defaultToMapOptions",null),e([x()],xt.prototype,"_defaultHitTestOptions",null),xt=jt=e([O("esri.views.SceneView")],xt);const Ot=D(),Et=C(),Lt=$(),It=te(0,0,0,B.WebMercator),Ht={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Pt=xt;export{Pt as default};
2
+ 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{destroyHandle as o,makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{mapCollectionAsync as h}from"../core/mapCollectionUtils.js";import{destroyMaybe as d,maybeProperty as u}from"../core/maybe.js";import{throwIfDestroyed as c,throwIfAborted as g,createAbortError as m}from"../core/promiseUtils.js";import y from"../core/ReactiveSet.js";import{on as f,watch as w,initial as v,sync as _,whenOnce as b,syncAndInitial as M}from"../core/reactiveUtils.js";import{setFrameDuration as S,cleanupScheduling as V}from"../core/scheduling.js";import{createScreenPoint as j,createScreenPointArray as C}from"../core/screenUtils.js";import{cleanupWhereClauseCache as T}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as R,getMetersPerUnitForSR as x}from"../core/units.js";import{property as A,cast as O,subclass as E}from"../core/accessorSupport/decorators.js";import{ensureType as L,ensureClass as I}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as P}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as D}from"../core/accessorSupport/trackingUtils.js";import{create as F}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as U}from"../core/libs/rbush/PooledRBush.js";import{initialize as G}from"../core/workers/workers.js";import W from"../geometry/Extent.js";import z from"../geometry/HeightModelInfo.js";import q from"../geometry/Point.js";import{project as k,canProjectWithoutEngine as B}from"../geometry/projectionUtils.js";import N from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Z}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Q}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Y}from"../geometry/projection/projectPointToVector.js";import{toExtent as $,create as J}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as K}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as X}from"../geometry/support/scaleUtils.js";import{wgs84 as ee,webMercator as te}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as ie}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as re,isTiledLayer as se,isVoxelLayer as ne,isIntegratedMeshLayer as ae,isGaussianSplatLayer as oe}from"../layers/support/layerUtils.js";import{TilemapCache as le}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as pe}from"../portal/portalDefault.js";import{WebSceneTag as he}from"../support/tagSymbols.js";import{BreakpointsOwner as de}from"./BreakpointsOwner.js";import{DOMContainer as ue}from"./DOMContainer.js";import{PopupView as ce}from"./PopupView.js";import ge from"./View.js";import me from"./ViewAnimation.js";import{stringFromViewingMode as ye,viewingModeFromString as fe}from"./ViewingMode.js";import{GroundView3D as we}from"./3d/GroundView3D.js";import{layerView3DImporter as ve}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as _e}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as be}from"./3d/camera/intersectionUtils.js";import Me from"./3d/constraints/Constraints.js";import Se from"./3d/environment/Environment.js";import{EnvironmentManager as Ve}from"./3d/environment/EnvironmentManager.js";import je from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as Ce}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Te}from"./3d/layers/graphics/Labeler.js";import Re from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as xe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Ae}from"./3d/state/ScreenSizePerspective.js";import Oe from"./3d/state/ViewState.js";import{ViewStateManager as Ee,cleanupViewStateManager as Le}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ie}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as He}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Pe}from"./3d/state/utils/navigationUtils.js";import De from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as Fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ue}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Ge}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as We}from"./3d/support/GroundAndIMSurface.js";import{toMap as ze,hitTest as qe}from"./3d/support/hitTest.js";import{popupHitTest as ke}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as Be,getQualityProfileSettings as Ne}from"./3d/support/QualityProfile.js";import Ze from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Qe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ye}from"./3d/support/ResourceController.js";import $e from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Je}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Ke}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import et from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as tt,getTiledLayerInfo as it,checkIfTileInfoSupportedForView as rt}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as st}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as nt}from"./3d/terrain/TileRenderer.js";import{Stage as at}from"./3d/webgl-engine/Stage.js";import{olidEnabled as ot}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as lt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as pt}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as ht}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as dt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as ut}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import ct from"./interactive/options/ViewOptions.js";import gt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as mt}from"./support/drapedUtils.js";import{occludeesSupported as yt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as ft,createScreenPointFromSupportedEvent as wt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as vt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as _t,destroyTextureCompressionWorker as bt}from"./support/TextureCompressionHelper.js";import Mt from"./ui/DefaultUI.js";import St from"./ui/3d/DefaultUI3D.js";import Vt from"../webscene/Environment.js";import{clearVNodeCache as jt}from"../widgets/support/vnodeCache.js";var Ct;const Tt=Symbol(),Rt=Symbol();function xt(e){const t=I(ct,e);return t!==e&&null==e.snapping?.enabled&&(t.snapping.enabled=!0),t}let At=class extends(de(ce(ue(ge)))){static{Ct=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new ct({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ye(this),this.deconflictor=new Ce({view:this}),this.attribution3D=new De({view:this}),this.labeler=new Te({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new xe({view:this}),this.basemapTerrain=null,this.elevationProvider=new Fe({view:this}),this._canvas=null,this.constraints=new Me,this._environment=new Se,this.environmentManager=new Ve,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new gt({importAnalysisViewModule:e=>_e(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new y,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Oe({view:this}),this.slice=new Ke,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new St,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,G();const t=()=>this._updatingChanged();this.addHandles(o(h(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,"after-changes",t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),w(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new je({view:this}),this.stateManager=new Ee({view:this}),this.screenSizePerspective=new Ae({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=_t(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new we({view:this}),this.groundAndIMSurface=new We({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>S(e>0?1e3/Math.ceil(e):0),v),this.addHandles([w(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),_),w(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),_)])}destroy(){this.destroyed||(bt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set("analysisViewManager",d(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=d(this.sharedSymbolResources),this._set("labeler",d(this.labeler)),this._set("deconflictor",d(this.deconflictor)),this._resourceController=d(this._resourceController),this._set("stateManager",d(this.stateManager)),this._set("inputManager",d(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",d(this.environmentManager)),this._set("environment",d(this.environment)),this.groundView=d(this.groundView),this.groundAndIMSurface.destroy(),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(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}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=L(q,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||u(e,"clippingArea");return!this._userClippingArea&&!u(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof W?this.spatialReference&&(t=Ot(t,this.spatialReference),null==t)?(p.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):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.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:Ot(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||N.WGS84,i=Ot(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||N.WGS84;let t;const i=i=>{const r=Ot(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new W({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(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 o=this._get("_groundAndLayersExtent");return t.equals(o)?o: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 Se?e:e instanceof Vt?this.environment?.cloneWithWebsceneEnvironment(e)??Se.fromWebsceneEnvironment(e):L(Se,e):new Se}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 Ct._layerToLayerview}static{this._layerToLayerview=ge._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&&he 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=Ne(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ze(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Be()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?P(()=>X(e,t)):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();if(!e)return null;const t=R(this.spatialReference);return t&&e.heightUnit!==t?new z({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS}):e}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&p.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;if(!this.initialized)return!0;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||tt(r))return;++i,e+=r.updatingProgress}}else++i});const r=.1;for(const n of this._updatingObjects)n?.updating&&(i+=r,e+=.5*r);for(const n of this._updatingObjectsWithProgress)n?.updating&&(++i,e+=n.updatingProgress);const s=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||s||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 Ue.UPDATING&&console.log("Updating:",this._updatingObjectsToDebug.filter(e=>null!=e&&e.updating).map(({declaredClass:e})=>e)),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,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return Ue.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ye(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ye(this.defaultsFromMap.viewingMode):vt(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?p.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 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 $e(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 p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ft(e)?wt(this,e):e;return ze(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=Ht,t.x=e.x,t.y=e.y,t.z=Ge(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Y(t,Et,this.renderSpatialReference),this.state.camera.projectToScreen(Et,Lt),j(Lt[0],Lt[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Y(e,Et,i);const r=this.state.camera.computeScreenPixelSizeAt(Et);return t&&i!==t?r*x(i)/x(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ft(e)?wt(this,e):e;return qe(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return ke(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}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(!ot())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)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return ve.importLayerView(e)}hasLayerViewModule(e){return ve.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?fe(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,i):null,s=i?r(i):[...r(1)??[],...r(2)??[]];return s?.length?{constraints:s}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!vt(e,i)&&(null==t||(!!re(t)||(!se(t)||null!=it(t,e,i))&&(!ne(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i,r){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:s,isWGS84:n,vcsWkid:a,latestVcsWkid:o}=e,l=()=>null==a?s?N.WGS84:N.WebMercator:new N({...s?ee:te,vcsWkid:a,latestVcsWkid:o});if(re(t)&&(s||n)){return!n||2===r||null===rt(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]:[{spatialReference:l(),viewingMode:i}]}return se(t)||ne(t)||!s&&!n?se(t)&&s&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ye(i)} viewing mode.`):e.isGeographic&&p.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 p.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(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return p.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&&yt(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{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 b(()=>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),l(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Pt[e]();if(t&&(c(this),g(i.signal),await t(i.signal)),this.destroyed)throw m();return g(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 et({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 Xe({view:this})),this.addHandles([this.updatingHandles.add(()=>Ue.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ue.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=d(this._featureTreeDebugger))},M),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.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?k($(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},M),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=d(this._featureTiles)},_)],Tt),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(Rt),this.removeHandles(Tt),this._featureTiles=d(this.featureTiles),this._set("pointsOfInterest",d(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=K(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Qe.create(this.state.viewingMode,i)),t||this.addHandles(w(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!Q(e,this.groundView.spatialReference,It,t)||(this.renderCoordsHelper.extent=It)},_),Rt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(pt/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(Rt),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(w(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),_),"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 He(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new at({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||"WebGL context lost")})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(pt/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=d(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Je({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=>b(()=>this.groundView?.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=d(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===fe(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(f(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>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?H(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.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(dt);for(const t of this.allLayerViews)(ae(t.layer)&&(!has("enable-feature:im-as-ground")||t.layer.isUsedAsGroundLayer)||oe(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(dt);for(const t of this.allLayerViews)(has("enable-feature:im-as-ground")?ae(t.layer)&&t.layer.isUsedAsGroundLayer:ae(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){jt(),D(),T(),ut(),Le(),be(),Z(),mt(),pe(),nt(),ht(),Ie(),Pe(),U(),V(),lt(),st(),Re.cleanupI3SLodHandling(),le.cleanupTilemapCache(),Oe.cleanupViewstate(),et.cleanupTerrainSurface()}};function Ot(e,t){return null!=e&&B(e.spatialReference,t)?k(e,t):null}e([A({nonNullable:!0}),O(xt)],At.prototype,"options",void 0),e([A()],At.prototype,"_userClippingArea",void 0),e([A()],At.prototype,"_resourceController",void 0),e([A()],At.prototype,"stage",null),e([A({readOnly:!0})],At.prototype,"deconflictor",void 0),e([A({readOnly:!0})],At.prototype,"labeler",void 0),e([A()],At.prototype,"navigation",void 0),e([A({type:me,readOnly:!0})],At.prototype,"animation",null),e([A({readOnly:!0})],At.prototype,"basemapTerrain",void 0),e([A({readOnly:!0})],At.prototype,"overlayManager",null),e([A({readOnly:!0})],At.prototype,"elevationProvider",void 0),e([A()],At.prototype,"camera",null),e([A({type:t})],At.prototype,"contentCamera",null),e([A({readOnly:!0})],At.prototype,"canvas",null),e([A({type:q,useTypeForAutocast:!1})],At.prototype,"center",null),e([A({type:W})],At.prototype,"clippingArea",null),e([A({type:Me,nonNullable:!0})],At.prototype,"constraints",void 0),e([A({type:W,readOnly:!0})],At.prototype,"renderDataExtent",null),e([A({readOnly:!0})],At.prototype,"tileInfo",null),e([A({type:W,readOnly:!0})],At.prototype,"dataExtent",null),e([A({type:W,readOnly:!0})],At.prototype,"_groundAndLayersExtent",null),e([A({type:Se})],At.prototype,"environment",null),e([O("environment")],At.prototype,"castEnvironment",null),e([A({readOnly:!0})],At.prototype,"environmentManager",void 0),e([A({type:W})],At.prototype,"extent",null),e([A({type:r})],At.prototype,"floors",void 0),e([A()],At.prototype,"screenCenter",null),e([A()],At.prototype,"frustum",null),e([A({type:Number,readOnly:!0})],At.prototype,"fullOpacity",void 0),e([A({readOnly:!0})],At.prototype,"graphicsView",void 0),e([A()],At.prototype,"analysisViewManager",void 0),e([A()],At.prototype,"groundView",void 0),e([A({readOnly:!0})],At.prototype,"layerviewCollections",null),e([A({type:Boolean})],At.prototype,"initialExtentRequired",null),e([A()],At.prototype,"defaultsFromMapSettings",null),e([A()],At.prototype,"interacting",null),e([A()],At.prototype,"stationary",null),e([A()],At.prototype,"navigating",null),e([A()],At.prototype,"map",void 0),e([A()],At.prototype,"padding",null),e([A({type:Xe,readOnly:!0})],At.prototype,"pointsOfInterest",void 0),e([A()],At.prototype,"_featureTiles",void 0),e([A()],At.prototype,"featureTiles",null),e([A()],At.prototype,"_featureTreeDebugger",void 0),e([A({constructOnly:!0})],At.prototype,"deactivatedWebGLExtensions",void 0),e([A({constructOnly:!0})],At.prototype,"debugWebGLExtensions",void 0),e([A({constructOnly:!0})],At.prototype,"renderCanvas",void 0),e([A({constructOnly:!0})],At.prototype,"state",void 0),e([A()],At.prototype,"screenSizePerspective",void 0),e([A({readOnly:!0})],At.prototype,"inputManager",void 0),e([A({readOnly:!0})],At.prototype,"stateManager",void 0),e([A({type:["low","medium","high"]})],At.prototype,"qualityProfile",null),e([A({type:Ze,get(){let e=this._get("qualitySettings");if(!e){const t=Ne(this.qualityProfile);e=new Ze(t)}return e}})],At.prototype,"qualitySettings",void 0),e([A()],At.prototype,"slice",void 0),e([A({readOnly:!0})],At.prototype,"typeSpecificPreconditionsReady",null),e([A({readOnly:!0})],At.prototype,"renderCoordsHelper",void 0),e([A({readOnly:!0})],At.prototype,"sceneIntersectionHelper",void 0),e([A({type:Number,readOnly:!0})],At.prototype,"resolution",null),e([A({type:Number})],At.prototype,"scale",null),e([A({readOnly:!0,type:Number})],At.prototype,"terrainLevel",null),e([A()],At.prototype,"heightModelInfo",null),e([A({type:N})],At.prototype,"spatialReference",void 0),e([A({type:Boolean,value:!1})],At.prototype,"alphaCompositingEnabled",null),e([A({constructOnly:!0})],At.prototype,"preserveDrawingBufferEnabled",void 0),e([A({type:Boolean})],At.prototype,"supersampleScreenshotsEnabled",void 0),e([A({readOnly:!0})],At.prototype,"type",void 0),e([A(),O(e=>e instanceof Mt?e:I(St,e))],At.prototype,"ui",void 0),e([A({type:Boolean,readOnly:!0})],At.prototype,"updating",null),e([A()],At.prototype,"_updatingObjects",null),e([A()],At.prototype,"_updatingObjectsWithProgress",null),e([A()],At.prototype,"_updatingObjectsToDebug",null),e([A({type:Number,readOnly:!0})],At.prototype,"updatingProgress",void 0),e([A({type:["global","local"]})],At.prototype,"viewingMode",null),e([A({type:i})],At.prototype,"viewpoint",null),e([A({readOnly:!0})],At.prototype,"visibleArea",null),e([A({type:Number})],At.prototype,"zoom",null),e([A({readOnly:!0})],At.prototype,"quality",null),e([A({readOnly:!0})],At.prototype,"resolutionScale",null),e([A()],At.prototype,"focusAreasView",void 0),e([A()],At.prototype,"_defaultToMapOptions",null),e([A()],At.prototype,"_defaultHitTestOptions",null),At=Ct=e([E("esri.views.SceneView")],At);const Et=F(),Lt=C(),It=J(),Ht=ie(0,0,0,N.WebMercator),Pt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Dt=At;export{Dt as default};