@arcgis/core 6.0.0-next.14 → 6.0.0-next.16

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 (398) hide show
  1. package/analysis/LineOfSightAnalysis.d.ts +49 -32
  2. package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
  3. package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
  4. package/analysis/Viewshed.d.ts +23 -3
  5. package/analysis/ViewshedAnalysis.d.ts +33 -13
  6. package/arcade/geometry/operatorsWorkerConnection.js +1 -1
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
  10. package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
  11. package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
  12. package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
  13. package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
  16. package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
  17. package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
  18. package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
  20. package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
  21. package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
  22. package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
  25. package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
  26. package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
  27. package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
  28. package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
  29. package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
  30. package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
  31. package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
  32. package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
  33. package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
  34. package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
  35. package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
  36. package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
  37. package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
  38. package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
  39. package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
  40. package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
  41. package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
  42. package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
  43. package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
  44. package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
  45. package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
  46. package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
  49. package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
  50. package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
  51. package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
  58. package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
  59. package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
  61. package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
  62. package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
  63. package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
  64. package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
  65. package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
  66. package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
  71. package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
  72. package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
  73. package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
  75. package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
  78. package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
  79. package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
  81. package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
  82. package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
  83. package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
  84. package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
  85. package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
  86. package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
  88. package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
  89. package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
  90. package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
  91. package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
  92. package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
  93. package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
  94. package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
  95. package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
  96. package/assets/esri/core/workers/chunks/{aadfe34a99c9ec7a0e11.js → f9c5aa0bbf23e780fecc.js} +1 -1
  97. package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
  98. package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
  100. package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
  101. package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
  102. package/chunks/Envelope.js +1 -1
  103. package/chunks/MultiPathImpl.js +1 -1
  104. package/chunks/OperatorGeodeticArea.js +1 -1
  105. package/chunks/OperatorShapePreservingLength.js +1 -1
  106. package/chunks/OperatorShapePreservingProject.js +1 -1
  107. package/chunks/UnitFactory.js +1 -1
  108. package/chunks/basis_encoder.js +1 -1
  109. package/chunks/basis_transcoder.js +1 -1
  110. package/chunks/index.js +1 -1
  111. package/chunks/lclayout.js +1 -1
  112. package/config.d.ts +2 -0
  113. package/config.js +1 -1
  114. package/core/ObjectPool.js +1 -1
  115. package/core/PooledArray.js +1 -1
  116. package/core/accessorSupport/DefaultsStore.js +1 -1
  117. package/core/accessorSupport/MultiOriginStore.js +1 -1
  118. package/core/accessorSupport/Store.js +1 -1
  119. package/core/accessorSupport/decorators/reader.js +1 -1
  120. package/core/accessorSupport/decorators/writer.js +1 -1
  121. package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
  122. package/core/workers/WorkerOwner.js +1 -1
  123. package/core/workers/workerFactory.js +1 -1
  124. package/core/workers/workers.js +2 -2
  125. package/core/workers.d.ts +9 -0
  126. package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
  127. package/geometry/Mesh.js +1 -1
  128. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  129. package/geometry/operators/gx/operatorOffset.js +1 -1
  130. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  131. package/geometry/operators/support/jsonConverter.js +1 -1
  132. package/geometry/support/buffer/BufferPool.js +1 -1
  133. package/geometry/support/coordsUtils.js +1 -1
  134. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  135. package/geometry/support/curves/ellipticArc7Utils.js +1 -1
  136. package/geometry/support/meshUtils/merge.js +1 -1
  137. package/geometry/support/meshUtils/rotate.js +1 -1
  138. package/geometry/support/meshUtils.d.ts +5 -6
  139. package/geometry/support/polygonExtentClipping.js +1 -1
  140. package/identity/Credential.js +1 -1
  141. package/interfaces.d.ts +18 -9
  142. package/kernel.js +1 -1
  143. package/layers/AnnotationFeatureLayer.d.ts +2 -2
  144. package/layers/AnnotationFeatureLayer.js +1 -1
  145. package/layers/CatalogLayer.d.ts +2 -2
  146. package/layers/CatalogLayer.js +1 -1
  147. package/layers/DimensionFeatureLayer.d.ts +2 -2
  148. package/layers/DimensionFeatureLayer.js +1 -1
  149. package/layers/FeatureLayer.d.ts +4 -4
  150. package/layers/FeatureLayer.js +1 -1
  151. package/layers/GeospatialPDFLayer.d.ts +154 -4
  152. package/layers/ImageryTileLayer.js +1 -1
  153. package/layers/Layer.d.ts +2 -0
  154. package/layers/LineOfSightLayer.d.ts +10 -8
  155. package/layers/SceneLayer.js +1 -1
  156. package/layers/SubtypeGroupLayer.d.ts +2 -2
  157. package/layers/SubtypeGroupLayer.js +1 -1
  158. package/layers/ViewshedLayer.d.ts +1 -1
  159. package/layers/VoxelLayer.js +1 -1
  160. package/layers/WMSLayer.js +1 -1
  161. package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
  162. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
  163. package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
  164. package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
  165. package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
  166. package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
  167. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  168. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  169. package/layers/graphics/data/QueryEngineResult.js +1 -1
  170. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  171. package/layers/graphics/sources/parquet/FileProvider.js +1 -1
  172. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  173. package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
  174. package/layers/mixins/ReloadableLayer.js +2 -0
  175. package/layers/raster/datasets/BaseRaster.js +1 -1
  176. package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
  177. package/layers/raster/datasets/ImageAuxRaster.js +2 -2
  178. package/layers/raster/datasets/ImageServerRaster.js +1 -1
  179. package/layers/raster/datasets/InMemoryRaster.js +1 -1
  180. package/layers/raster/datasets/MRFRaster.js +1 -1
  181. package/layers/raster/datasets/TIFFRaster.js +1 -1
  182. package/layers/raster/datasets/WCSRaster.js +1 -1
  183. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  184. package/layers/raster/formats/RasterCodec.js +1 -1
  185. package/layers/raster/formats/TiffDecoder.js +1 -1
  186. package/layers/raster/formats/Zlib.js +1 -1
  187. package/layers/raster/functions/stretchUtils.js +1 -1
  188. package/layers/raster/functions/vectorFieldUtils.js +1 -1
  189. package/layers/support/FieldsIndex.js +1 -1
  190. package/layers/support/LabelClass.d.ts +3 -2
  191. package/layers/support/PortalItemData.d.ts +31 -8
  192. package/layers/support/RasterWorker.js +1 -1
  193. package/layers/support/featureReductionProperties.js +1 -1
  194. package/layers/support/kmlUtils.js +1 -1
  195. package/layers/support/types.d.ts +4 -1
  196. package/layers/video/VideoController.js +10 -10
  197. package/libs/maquette/projection.js +1 -1
  198. package/networks/UtilityNetworkTraceAnalysis.js +1 -1
  199. package/package.json +5 -5
  200. package/popup/FeatureModel.js +1 -1
  201. package/popup/FeaturesModel.js +1 -1
  202. package/portal/Portal.js +1 -1
  203. package/request/process.js +1 -1
  204. package/request/types.d.ts +7 -0
  205. package/rest/knowledgeGraph/ObjectValue.js +1 -1
  206. package/rest/knowledgeGraphService.js +1 -1
  207. package/rest/networks/trace.js +1 -1
  208. package/rest/query/executeQuery.js +1 -1
  209. package/smartMapping/raster/renderers/shadedRelief.js +1 -1
  210. package/smartMapping/renderers/univariateColorSize.js +1 -1
  211. package/smartMapping/statistics/support/statsWorker.js +1 -1
  212. package/smartMapping/statistics/support/utils.js +1 -1
  213. package/smartMapping/support/clusterUtils.js +1 -1
  214. package/statistics/utils.js +1 -1
  215. package/symbols/cim/CIMCursor.js +1 -1
  216. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  217. package/symbols/cim/cimAnalyzer.js +1 -1
  218. package/symbols/support/ElevationInfo.d.ts +4 -3
  219. package/undoredo/support/Services.js +1 -1
  220. package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
  221. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  222. package/views/2d/grid/GridView2D.js +1 -1
  223. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  224. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  225. package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
  226. package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
  227. package/views/2d/viewpointUtils.js +1 -1
  228. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  229. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  230. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  231. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  232. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  233. package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
  234. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  235. package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
  236. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
  237. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  238. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  239. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  240. package/views/3d/analysis/Viewshed/types.d.ts +7 -0
  241. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
  242. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  243. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  244. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  245. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  246. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  247. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  248. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  249. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  250. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  251. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  252. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  253. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  254. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  255. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  256. package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
  257. package/views/3d/layers/i3s/I3SNode.js +1 -1
  258. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  259. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  260. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  261. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  262. package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
  263. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  264. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  265. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  266. package/views/3d/support/MemoryController.js +1 -1
  267. package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
  268. package/views/3d/support/elevationUpdateUtils.js +1 -1
  269. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  270. package/views/3d/support/sphereExtentUtils.js +2 -0
  271. package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
  272. package/views/3d/terrain/OverlayRenderer.js +1 -1
  273. package/views/3d/terrain/PatchRenderData.js +1 -1
  274. package/views/3d/terrain/TerrainData.js +1 -1
  275. package/views/3d/terrain/terrainUtils.js +1 -1
  276. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  277. package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
  278. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  279. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  280. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  281. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  282. package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
  283. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  284. package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
  285. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  286. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  287. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  288. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  289. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  290. package/views/SceneView.js +1 -1
  291. package/views/ToolViewManager.js +1 -1
  292. package/views/draw/DrawOperation.js +1 -1
  293. package/views/draw/support/InteractiveHandle.js +1 -1
  294. package/views/draw/support/Reshape.js +1 -1
  295. package/views/draw/support/createUtils.js +1 -1
  296. package/views/draw/support/editingSessionUtils.js +1 -1
  297. package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
  298. package/views/interactive/SegmentLabels.js +1 -1
  299. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  300. package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
  301. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  302. package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
  303. package/views/interactive/options/TooltipOptions.d.ts +2 -0
  304. package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
  305. package/views/interactive/sketch/constraintUtils.js +1 -1
  306. package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
  307. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  308. package/views/layers/LayerView.js +1 -1
  309. package/views/layers/LineOfSightLayerView.d.ts +35 -13
  310. package/views/layers/SketchLayerView.d.ts +1 -0
  311. package/views/layers/ViewshedLayerView.d.ts +36 -12
  312. package/views/webgl/Program.js +1 -1
  313. package/views/webgl/Texture.js +1 -1
  314. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  315. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  316. package/widgets/BatchAttributeForm.js +1 -1
  317. package/widgets/Directions.js +1 -1
  318. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  319. package/widgets/Editor/EditorViewModel.d.ts +10 -1
  320. package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
  321. package/widgets/Editor.d.ts +10 -1
  322. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  323. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  324. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  325. package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
  326. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  327. package/widgets/HistogramRangeSlider.d.ts +2 -2
  328. package/widgets/HistogramRangeSlider.js +1 -1
  329. package/widgets/Legend.d.ts +1 -0
  330. package/widgets/Print.js +1 -1
  331. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
  332. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  333. package/widgets/ScaleRangeSlider.js +1 -1
  334. package/widgets/Slice.js +1 -1
  335. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  336. package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
  337. package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
  338. package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
  339. package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
  340. package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
  341. package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
  342. package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
  343. package/widgets/ValuePicker/types.d.ts +2 -0
  344. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  345. package/widgets/support/SelectionList.js +1 -1
  346. package/widgets/support/componentsUtils.js +1 -1
  347. package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
  348. package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
  349. package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
  350. package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
  351. package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
  352. package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
  353. package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
  354. package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
  355. package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
  356. package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
  357. package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
  358. package/assets/esri/core/workers/chunks/22e8c0aad2fe75943865.js +0 -1
  359. package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
  360. package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
  361. package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
  362. package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
  363. package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
  364. package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
  365. package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
  366. package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
  367. package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
  368. package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
  369. package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
  370. package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
  371. package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
  372. package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
  373. package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
  374. package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
  375. package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
  376. package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
  377. package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
  378. package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
  379. package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
  380. package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
  381. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
  382. package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
  383. package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
  384. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
  385. package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
  386. package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
  387. package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
  388. package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
  389. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
  390. package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
  391. package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
  392. package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
  393. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
  394. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
  395. package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
  396. package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
  397. package/layers/mixins/FeatureLayerReload.js +0 -2
  398. /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{fromValues as t,clone as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumCircleProfileSubdivisions as r}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";const i=r,a={0:{indexCount:i*2,poleCount:1,vertexCount:i},1:{indexCount:8,poleCount:4,vertexCount:8}};class o{constructor(e){this.type=e,this.vertices=[],this.normals=[],this.indices=[],this.poles=[],this.poleIndices=[]}addVertex(e,t){return this.vertices.push(n(e)),this.normals.push(n(t)),this.vertices.length-1}addPole(e,t=null){return this.poles.push({position:n(e),normal:t?n(t):null}),this.poles.length-1}addSegment(e,t=null){this.indices.push(e.v0),this.indices.push(e.v1),t&&(this.poleIndices.push(t.v0),this.poleIndices.push(t.v1))}get numSegments(){return this.indices.length/2}translate(e,t){for(let n of this.vertices)n[0]+=e,n[1]+=t;for(let n of this.poles)n.position[0]+=e,n.position[1]+=t}get usedMemory(){return this.vertices.length*e(this.vertices[0])*2+e(this.indices)}}const s={top:[0,-.5],bottom:[0,.5]};function c(e){let n=.5,i=r,a=new o(0),c={v0:0,v1:0};a.addPole(t(0,0));for(let e=0;e<i;++e){let r=e*2*Math.PI/i,o=Math.cos(r),s=Math.sin(r),c=t(o*n,s*n),l=t(o,s);a.addVertex(c,l)}for(let e=0;e<i-1;++e){let t={v0:e,v1:e+1};a.addSegment(t,c)}let l={v0:i-1,v1:0};if(a.addSegment(l,c),e!==`center`){let t=s[e];a.translate(t[0],t[1])}return a}const l={center:c(`center`),top:c(`top`),bottom:c(`bottom`)},u={center:d(`center`),top:d(`top`),bottom:d(`bottom`)};function d(e){let n=new o(1),r=t(-.5,-.5),i=t(.5,-.5),a=t(.5,.5),c=t(-.5,.5),l=t(0,-1),u=t(1,0),d=t(0,1),f=t(-1,0);if(n.addPole(t(0,.5),d),n.addPole(t(0,.5)),n.addPole(t(0,-.5)),n.addPole(t(0,-.5),l),n.addVertex(r,l),n.addVertex(i,l),n.addSegment({v0:0,v1:1},{v0:3,v1:3}),n.addVertex(i,u),n.addVertex(a,u),n.addSegment({v0:2,v1:3},{v0:2,v1:1}),n.addVertex(a,d),n.addVertex(c,d),n.addSegment({v0:4,v1:5},{v0:0,v1:0}),n.addVertex(c,f),n.addVertex(r,f),n.addSegment({v0:6,v1:7},{v0:1,v1:2}),e!==`center`){let t=s[e];n.translate(t[0],t[1])}return n}export{o as PathProfile,l as circleProfiles,a as pathProfileUniformLayout,u as quadProfiles};
2
+ import{cyclical2PI as e}from"../../../../core/Cyclical.js";import{estimateNumberArrayMemory as t}from"../../../../core/memoryEstimations.js";import{exactEquals as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as r,clone as i,UNIT_X as a,ZEROS as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{pathNumJoinSubdivisions as s,pathNumCircleProfileSubdivisions as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{needsJoinSubdivisions as l,classificationTolerance as u}from"./pathGeometryUtils.js";const d=Math.acos(-2*u),f=c,p={0:{indexCount:f*2,poleCount:1,vertexCount:f},1:{indexCount:8,poleCount:4,vertexCount:8}};class m{constructor(e){this.type=e,this.vertices=[],this.normals=[],this.indices=[],this.poles=[],this.poleIndices=[],this.joinTriangleBudgets={0:{0:0,1:0,2:0},1:{0:0,1:0,2:0}}}addVertex(e,t){return this.vertices.push(i(e)),this.normals.push(i(t)),this.vertices.length-1}addPole(e,t=null){return this.poles.push({position:i(e),normal:t?i(t):null}),this.poles.length-1}addSegment(e,t=null){this.indices.push(e.v0),this.indices.push(e.v1),t&&(this.poleIndices.push(t.v0),this.poleIndices.push(t.v1))}get numSegments(){return this.indices.length/2}translate(e,t){for(let n of this.vertices)n[0]+=e,n[1]+=t;for(let n of this.poles)n.position[0]+=e,n.position[1]+=t}get usedMemory(){return this.vertices.length*t(this.vertices[0])*2+t(this.indices)}}const h={top:[0,-.5],bottom:[0,.5]};function g(e){let t=.5,n=c,i=new m(0),a={v0:0,v1:0};i.addPole(r(0,0));for(let e=0;e<n;++e){let a=e*2*Math.PI/n,o=Math.cos(a),s=Math.sin(a),c=r(o*t,s*t),l=r(o,s);i.addVertex(c,l)}for(let e=0;e<n-1;++e){let t={v0:e,v1:e+1};i.addSegment(t,a)}let o={v0:n-1,v1:0};if(i.addSegment(o,a),e!==`center`){let t=h[e];i.translate(t[0],t[1])}return b(i,2)}const _={center:g(`center`),top:g(`top`),bottom:g(`bottom`)},v={center:y(`center`),top:y(`top`),bottom:y(`bottom`)};function y(e){let t=new m(1),n=r(-.5,-.5),i=r(.5,-.5),a=r(.5,.5),o=r(-.5,.5),s=r(0,-1),c=r(1,0),l=r(0,1),u=r(-1,0);if(t.addPole(r(0,.5),l),t.addPole(r(0,.5)),t.addPole(r(0,-.5)),t.addPole(r(0,-.5),s),t.addVertex(n,s),t.addVertex(i,s),t.addSegment({v0:0,v1:1},{v0:3,v1:3}),t.addVertex(i,c),t.addVertex(a,c),t.addSegment({v0:2,v1:3},{v0:2,v1:1}),t.addVertex(a,l),t.addVertex(o,l),t.addSegment({v0:4,v1:5},{v0:0,v1:0}),t.addVertex(o,u),t.addVertex(n,u),t.addSegment({v0:6,v1:7},{v0:1,v1:2}),e!==`center`){let n=h[e];t.translate(n[0],n[1])}return b(t,1)}function b(e,t){let n=x(e,t),r=S(e,t);return e.joinTriangleBudgets={0:{0:n,1:n,2:s*n},1:{0:r,1:r,2:s*r}},e}function x(e,t){let n=0,r=0;for(let i=0;i<e.vertices.length;++i){let o=e.vertices[i];n+=l(o,a,1)?t:0,r+=l(o,a,-1)?t:0}return Math.max(n,r)}function S(t,r){let i=[],a=0;for(let s=0;s<t.vertices.length;++s){let c=t.vertices[s];if(n(c,o))continue;let l=Math.atan2(c[1],c[0]),u=e.normalize(l-d,0,!0),f=e.normalize(l+d,0,!0);i.push({angle:u,diff:r},{angle:f,diff:-r}),u>f&&(a+=r)}i.sort((e,t)=>e.angle-t.angle||t.diff-e.diff);let s=a;for(let e of i)a+=e.diff,s=Math.max(s,a);return s}export{m as PathProfile,_ as circleProfiles,p as pathProfileUniformLayout,v as quadProfiles};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),!Oe&&(c===2||c===0)&&this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
2
+ import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as n}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as o,releaseReferencedMaybe as s}from"../../../../core/maybe.js";import{throwIfAborted as c}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as u,initial as d,sync as f}from"../../../../core/reactiveUtils.js";import{signal as p}from"../../../../core/signal.js";import{property as m,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{equals as g,invert as _,multiply as v,copy as y}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as x}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as ee}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as te,ZEROS as S}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as ne}from"../../../../geometry/support/Indices.js";import{InternalRenderCategory as C,RenderNodeOutput as w,AllRenderNodeOutputs as T,AllInternalRenderNodeOutputs as E}from"../../webgl.js";import{minNearDistanceInMeters as re}from"../../state/NearFarHeuristic.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{FBOCache as ae}from"../core/FBOCache.js";import{RenderPassManager as oe}from"../core/renderPasses/RenderPassManager.js";import{isColor as se}from"../core/shaderLibrary/ShaderOutput.js";import{RenderNodes as ce}from"../effects/RenderNodes.js";import{RenderPluginManager as le}from"../effects/RenderPluginManager.js";import{WeatherFader as ue}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as de}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as fe}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as pe,renderHighlightBuffer as D}from"../effects/highlight/Highlight.js";import{OITBlend as me}from"../effects/transparency/OITBlend.js";import{AnimationTimer as he}from"./AnimationTimer.js";import{AnimationTimeStep as ge}from"./AnimationTimeStep.js";import{BoundingInfo as _e}from"./BoundingInfo.js";import{Compositor as ve}from"./Compositor.js";import{DepthRange as O}from"./DepthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{MainFramebuffer as ye}from"./MainFramebuffer.js";import{NavigationDepthCache as be}from"./NavigationDepthCache.js";import{blendingColorAlphaClear as A}from"./OrderIndependentTransparency.js";import{RenderContext as j,defaultRenderOccludedMask as M}from"./RenderContext.js";import{RendererBase as N}from"./RendererBase.js";import{setupFeatureDefaults as P}from"./RenderFeature.js";import{RenderPluginInput as xe}from"./RenderPluginInput.js";import{ShadowMap as Se}from"./ShadowMap.js";import Ce from"./SliceHelper.js";import{MergedRenderer as we}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as F}from"../parts/renderUtils.js";import{RendererPerformanceInfo as Te,PerformanceCategory as I}from"../statistics/RendererPerformanceInfo.js";import{PixelType as Ee,ColorAttachment0 as L,ColorAttachment1 as R,ColorAttachment2 as z,DrawBufferNone as De}from"../../../webgl/enums.js";const Oe=has(`disable-feature:async-navigation-3d-depth-readback`);let B=class extends N{constructor(e,t,n,r,i){super({stage:e}),this._techniques=n,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new oe,this._isRendering=!1,this._backgroundColor=te(0,0,0,1),this._sliceHelper=new Ce,this._shadowAccumulator=null,this._shadowCastOptions=null,this.sceneDepthRange=p(O.Infinite),this._state=p(2),this._hasAnimations=!1,this._animationTimestep=new ge,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=p(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new xe,this._hasTransparentGeometry=!1,this._releaseNodeInputs=e=>{for(let t of je)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._testsNeedsDepth=!1,this._fboCache=new ae(r),this._compositor=new ve(r,n),this._renderStateFeatures=p(P(e.view.qualityProfile));let a=new Se(this._fboCache,e.viewingMode);this._renderContext=new j(this._rctx,a,n),this._framebuffer=new ye(this._fboCache,this._bindParameters),this._performanceInfo=new Te(this._rctx),this._blit=new fe(n),this.navigationDepthCache=new be(this._rctx,this._fboCache,n,()=>this._requestRender(0)),this._nodes=new ce(this._renderContext),this._plugins=new le({renderContext:this._renderContext,techniques:n,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new ue({view:e.view,context:this._renderContext}),this.addHandles([l(()=>e.view.state.camera,()=>i(),u),l(()=>ie.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},d),l(()=>e.view.environment.background?.color,e=>{let t=e?e.toUnitRGBA():S;ee(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},u),l(()=>e.view.environmentView.shadowsAvailable,e=>{this._bindParameters.shadowMap.enabled=e,this._requestRender(1)},u),l(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},f),l(()=>this._bindParameters.clouds.data?.state,()=>i(),f),l(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},d),l(()=>e.view.environment.lighting?.type===`sun`,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},u)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowAccumulator=null,this._shadowCastOptions=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this.weatherFader=a(this.weatherFader),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.navigationDepthCache.destroy(),this._fboCache.destroy(),this._fboCache=null,this._renderContext.destroy(),this._plugins.destroy(),this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._performanceInfo=null,_e.prune(),we.prune(),ne()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new me(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=P(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,n){this.isFeatureEnabled(e,t)!==n&&(this._renderStateFeatures.mutate(r=>r.set(t,e,n)),this._requestRender())}setTime(e){this._renderContext.time=e}get hasReflections(){return this._bindParameters.screenSpaceReflections.enabled=this._pluginsHas.water&&this.isFeatureEnabled(4),this._bindParameters.screenSpaceReflections.enabled}get _hasHighlights(){return this._plugins.produces(10,2,4,18,12,13,14)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(10,12,13,14)}get hasAmbientIllumination(){return this._nodes.produces(C.AMBIENT_ILLUMINATION)}get hasGlobalIllumination(){return this.stage.renderView?.globalIllumination?.enabled??!1}get hasGlobalIlluminationHighQuality(){let e=this.stage.renderView?.globalIllumination;return this.hasGlobalIllumination&&e?.hasHighQuality===!0}get hasSMAA(){return this.isFeatureEnabled(0)}get _emissions(){let e=this._plugins.emissions;return this._hasTransparentGeometry?e:+(e===1||e===3)}get hasFloatBlend(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(9)}get highResolutionAtmosphere(){return this.isFeatureEnabled(2)}get fboCache(){return this._fboCache}setShadowAccumulator(e){this._shadowAccumulator=e,this._shadowCastOptions&&e.setParameters(this._shadowCastOptions)}_releaseFBOs(){this._bindParameters.hudOcclusion=o(this._bindParameters.hudOcclusion),this._bindParameters.depth=null}_disposeOffscreenBuffers(){this._framebuffer.dispose();let e=this._bindParameters;e.globalIllumination=o(e.globalIllumination),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),this._disposeBindBuffers()}_disposeBindBuffers(){this._bindParameters.shadowMap.disposeOutputs()}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._plugins.updating||this.weatherFader?.readyToRun||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||=n(async e=>{let{EdgeView:t}=await import(`./edgeRendering/EdgeView.js`);c(e);let n=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Me(this.stage.view.resourceController)});return this.addHandles(l(()=>n.updating,()=>this._requestRender(),f)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(n)),this._edgeViewCallbacks.length=0,n}),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView().catch(()=>{}),this._edgeView==null?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.reprojection.matrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.reprojection.matrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._bindParameters.shadowMap.enabled}setParameters(e){e.shadowCast&&(this._shadowCastOptions={...this._shadowCastOptions,...e.shadowCast},this._shadowAccumulator?.setParameters(e.shadowCast))}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}commit(e,t){return this._isRendering&&console.warn(`Renderer.modify called while rendering`),super.commit(e,t,this._plugins.context)?(this.updateHasFlags(),!0):!1}addRenderer(e){this._plugins.add(e)}removeRenderer(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this._occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get _occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(this.plugins.renderOccludedFlags&8)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,9)}updateHasFlags(){let has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,13),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...q),has.water=this._plugins.produces(4,19),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new he(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);let n=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==n&&(this._gpuTimerHandle=n?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,n=!1){try{return this._isRendering=!0,this._render(e,t,n)}catch(e){console.error(`Exception during rendering: ${e}:\n${e.stack}`)}finally{this._isRendering=!1}return new F(this._pluginInput.get(w.FINAL),null)}_render(e,t,n){let r=t===0;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=r,this._disposeBindBuffers();let{camera:i,contentCamera:a,mode:c,alignPixelEnabled:l}=e;this._state.value=c,this._bindParameters.frameRendererTarget=t,this._bindParameters.output=0,this._bindParameters.emissions=this._emissions,this._bindParameters.alignPixelEnabled=l,this._bindParameters.metersPerRenderUnit=this.stage.view.renderCoordsHelper.unitInMeters,this._bindParameters.decorations=!n,this._bindParameters.mainDepth=null,this._bindParameters.useFloatBlend.value=this.hasFloatBlend;let u=!n||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=u?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(C.VIEWSHED),this._bindParameters.laserlinesEnabled=this._nodes.produces(C.LASERLINES),this._bindParameters.shadowAnalysisEnabled=!!this._shadowAccumulator?.active,this._bindParameters.cutFillComputationEnabled=this._nodes.produces(C.CUTFILL_COMPUTATION),this._bindParameters.cutFillVisualizationEnabled=this._nodes.produces(C.CUTFILL),this._ensureBindParameters(i,a),this._plugins.sortTestsTransparentOrderedSlots(J),this._plugins.prepareRender(),this._hasTransparentGeometry=this._plugins.produces(1,...H),this._renderOverlay(),i.setGLViewport(this._rctx);let d=this._framebuffer,f=d.initialize(i.fullWidth,i.fullHeight,this._backgroundColor),p=this._needsLastFrameColor;p?(f?.retain(p-1),f?.setName(`last frame color`),this._bindParameters.reprojection.lastFrameColor?.release(),this._bindParameters.reprojection.lastFrameColor=f):f?.release(),this._bindParameters.hasShadowHighlights=this._needsShadowHighlight&&!n,this._precompilePrepasses(),this.performanceInfo.advance(I.PREPARE);let m=this._computeShadowDepthRange(i);this._pluginInput.set(`normals`,this._renderNormals()),this._renderAmbientIlluminationAndDepth(),this._renderShadowMap(i,a,this._bindParameters.lighting.mainLight.direction,m),this._renderShadowAccumulation(m),d.bind(),this._bindParameters.mainDepth=d.depth.attachment,this._precompileShaders(r),this._bindParameters.output=0,this._renderOpaque(),this._renderPreTransparent(),this._renderTransparent(),this._3dGeometryRendered(),d.update(e=>this._renderNodes(C.CUTFILL_COMPUTATION,e)),this._pluginInput.set(C.FOCUSAREA_MASK,this._renderFocusAreaMask()),d.update(e=>this._renderNodes(C.TRANSPARENT_ENVIRONMENT,e)),d.update(e=>this._renderNodes(C.VIEWSHED,e)),d.update(e=>this._renderNodes(C.LASERLINES,e)),this._nodes.requireGeometryDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),d.update(e=>this._renderNodes(C.FOCUSAREA,e)),this._pluginInput.release(C.FOCUSAREA_MASK),d.update(e=>this._renderNodes(C.CUTFILL,e)),this._pluginInput.release(C.GROUND_DEPTH),d.update(e=>this._renderNodes(C.OCCLUDED,e)),this._pluginInput.set(`highlights`,this._renderHighlightPrepass());let h=t===2?this._renderObjectAndLayerIdColor():null;d.update(e=>this._renderNodes(w.COMPOSITE,e)),this._bindParameters.shadowMap.disposeOutputs(),this._bindParameters.shadowHighlight=o(this._bindParameters.shadowHighlight),d.update(e=>this._renderNodes(C.ANTIALIASING,e));let g=this._hasTransparentGeometry?2:1,_=this._bindParameters.emissions;this._bindParameters.emissions=0,this._hasHUDHighlights&&d.update(e=>this._renderHUD(g,e)),d.update(e=>this._renderNodes(C.HIGHLIGHT,e)),this._hasHUDHighlights||d.update(e=>this._renderHUD(g,e)),this._bindParameters.emissions=_,d.update(e=>this._renderNodes(C.MAGNIFIER,e)),d.update(e=>this._renderNodes(w.FINAL,e)),r&&(this._blit.toFramebuffer(d.color,this._bindParameters),Oe||c!==2&&c!==0||this.navigationDepthCache.update(this._bindParameters,d.depth.attachment,this._renderContext.time)),this._bindParameters.reprojection.lastFrameDepth?.release(),this.hasGlobalIllumination&&(this._bindParameters.reprojection.lastFrameDepth=this._bindParameters.depth),this._testsNeedsDepth&&(this._bindParameters.depth=s(this._bindParameters.depth)),this._releaseFBOs(),d.releaseDepth(),this._bindParameters.reprojection.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd();let v;return r||(v=d.color,v.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new F(v,h)}_precompileShaders(e){++this._plugins.context.techniques.precompiling;let t=this._bindParameters;t.output=0;let n=t.emissions;if(this._precompileOpaqueGeometry(),this._nodes.precompile(C.OPAQUE_ENVIRONMENT,C.GAUSSIAN_SPLAT,C.OPAQUE_OCCLUSION_QUERY,C.VOXEL),this._precompileOpaqueGeometry(),t.output=3,this._plugins.precompile(...U),t.output=0,this._plugins.precompile(...U),this._hasTransparentGeometry){let e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(t,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(t,!1,1),this._precompileTransparentGeometry(),t.hasTransparentEmission&&(t.emissions=3)}this._nodes.precompile(C.FOCUSAREA_MASK),this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,t),this._hasTransparentGeometry||this._plugins.precompile(15),this._nodes.precompile(C.TRANSPARENT_ENVIRONMENT,C.VIEWSHED,C.CUTFILL_COMPUTATION,C.CUTFILL,C.LASERLINES,C.FOCUSAREA,C.OCCLUDED,C.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.emissions=0,this._precompileHUD(0),this._precompileHUD(1),t.emissions=n,this._hasHighlights&&(t.highlights.forEach((e,n)=>{t.highlightLevel=n,this._precompileAllGeometry(10),this._hasHUDHighlights&&this._plugins.precompile(13,12)}),t.highlightLevel=null,this._nodes.precompile(C.HIGHLIGHT)),t.highlightMixTexture=null,this._nodes.precompile(w.COMPOSITE,C.MAGNIFIER),this._nodes.precompile(C.TRANSPARENT_NO_DEPTH),this._plugins.precompile(8),t.hasOpaqueEmission&&(t.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.precompile(8),t.transparentWithoutDepthEmissionDimmingPass=!1),e&&this._blit.precompile(),--this._plugins.context.techniques.precompiling}_renderFocusAreaMask(){let e=this._nodes.produce(C.FOCUSAREA_MASK,this._pluginInput);return e&&this.performanceInfo.advance(I.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces(C.OBJECT_AND_LAYER_ID_COLOR))return null;let e=this._bindParameters.output;++this._techniques.precompiling;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,C.OBJECT_AND_LAYER_ID_COLOR).acquireDepth(14);return r=this._renderNodes(C.OBJECT_AND_LAYER_ID_COLOR,r),--this._techniques.precompiling,this._bindParameters.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();let t=this.performanceInfo.gpuSamplingEnabled,n=e===0,r=n?this.performanceInfo.elapsedTime:0;if(n||t){let e=0;t?e=this.performanceInfo.totalGPUTimeSampler.last:(this._rctx.gl.finish(),e=this.performanceInfo.elapsedTime);let i=Math.max(r,e);this._animationTimestep.frame(i,n)}}readAccumulatedShadow(e){return this._shadowAccumulator?.readAccumulatedShadow(e[0],e[1])??0}readMainDepth(e,t){let{mainDepth:n,camera:r}=this._bindParameters;if(!n)return;let i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,`linear depth`);this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(S),this._compositor.blitDepthToLinearDepth(this._bindParameters,n),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,Ee.UNSIGNED_BYTE,t),i.release()}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){let t=this._needsEdges;if(!t)return;let{width:n,height:r}=this._framebuffer.size,i=this.fboCache.acquire(n,r,`edges`);i.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(i.fbo),this._rctx.clearFramebuffer(S),t.render(this._bindParameters,e),i.detachDepth(),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(e===1?I.OPAQUE_EDGES:I.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(I.OVERLAY)}_renderShadowMap(e,t,n,r){if(!this.shadowsEnabled)return;let i=this._bindParameters.shadowMap;if(i.start(e,n,r,this.isFeatureEnabled(5),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight){this._renderShadowCascades(6,i),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t);let n=this._bindParameters.output;this._bindParameters.output=0,this._bindParameters.shadowHighlight=this._nodes.produce(C.SHADOW_HIGHLIGHT,this._pluginInput),this._bindParameters.output=n,i.disposeOutput(6),i.clear(),this._renderShadowCascades(7,i)}else this._renderShadowCascades(5);e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this._needsShadowHighlight&&(this._bindParameters.depth=s(this._bindParameters.depth)),this.performanceInfo.advance(C.SHADOWMAP)}_precompileShadowCascades(e){this._bindParameters.shadowMap.cascades.length!==0&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._bindParameters.shadowMap){let n=this._bindParameters.output,r=e!==6;t.bindFramebuffer();for(let n of t.cascades)n.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(n.camera,n.camera),this.renderAllGeometry(e),r&&this._renderShadowNodes(t.renderTarget);t.finish(e),this._bindParameters.output=n}_renderShadowNodes(e){this._renderInternalNodeCategory(C.SHADOWMAP,e)}get _needsLastFrameColor(){return+this.hasReflections+ +this.hasGlobalIllumination}get _needsDepth(){return+this._nodes.requireGeometryDepth+ +this.hasReflections+ +this.hasGlobalIllumination+ +this._testsNeedsDepth+ +this._needsShadowHighlight}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements}_renderAmbientIlluminationAndDepth(){let e=this._bindParameters;e.depth=o(this._bindParameters.depth);let t=this._pluginInput.get(`normals`);if(t){let n=this._nodes.produce(C.AMBIENT_ILLUMINATION,this._pluginInput);this._pluginInput.set(C.AMBIENT_ILLUMINATION,n),this._releaseGlobalIlluminationBuffers(),e.ssao=this.hasGlobalIllumination?null:n,e.globalIllumination=this.hasGlobalIllumination?n:null,e.globalIlluminationEnabled=e.globalIllumination!=null,n&&this.performanceInfo.advance(this.hasGlobalIlluminationHighQuality?I.AMBIENT_ILLUMINATION_HIGH_QUALITY:I.AMBIENT_ILLUMINATION);let r=this._needsDepth;if(r){let n=t.obtainAttachment(L);this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(3),e.depth=t.obtainDepthTexture(),e.depth?.retain(r-1),t.attachColor(n,L),n?.release(),this.performanceInfo.advance(I.DEPTH)}else t.detachDepth();this.hasAmbientIllumination&&this._pluginInput.release(`normals`)}else this._releaseGlobalIlluminationBuffers(),e.ssao=null,this._pluginInput.set(C.AMBIENT_ILLUMINATION,null),this._renderAllGeometryDepth()}_renderAllGeometryDepth(){let e=this._needsDepth;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`geometry depth`,14);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this.renderAllGeometry(3),this._renderGaussianSplatPrepassDepth(r),this._bindParameters.depth=r.obtainDepthTexture(),this._bindParameters.depth?.retain(e-1),r.release(),this.performanceInfo.advance(I.DEPTH)}_renderGaussianSplatPrepassDepth(e){let t=this._shadowAccumulator;if(!t?.active||!t.requireGeometryDepth)return;let n=this._bindParameters.output;this._bindParameters.output=3,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=n}_renderGaussianSplatDepthAndNormals(e){let t=this._bindParameters.output;this._bindParameters.output=4,this._renderInternalNodeCategory(C.GAUSSIAN_SPLAT_DEPTH,e),this._bindParameters.output=t}get _needsShadowDepthRange(){return this._bindParameters.shadowMap.enabled||!!this._shadowAccumulator?.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return O.Zero;let t=k(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.union(this._nodes.queryDepthRange(C.SHADOWMAP,e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal||(this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<de){this.sceneDepthRange.value=O.Infinite;return}let t=e.clone();t.near=re,t.far=1e10;let n=k(t,this._plugins.plugins,this.stage.layers,1);n.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(n)||(this.sceneDepthRange.value=n)}get _normalsRequired(){return this._nodes.require(`normals`,...T,C.VIEWSHED,C.LASERLINES)+ +!!this.hasAmbientIllumination}_precompilePrepasses(){let e=!!this._normalsRequired;if(e?(this._precompilePlugins(4,W),this._needsDepth&&this._precompilePlugins(3,G)):this._needsDepth&&this._precompileAllGeometry(3),this.shadowsEnabled&&(this._needsShadowHighlight?(this._nodes.precompile(C.SHADOW_HIGHLIGHT),this._precompileShadowCascades(6),this._precompileShadowCascades(7)):this._precompileShadowCascades(5)),this._shadowAccumulator?.active&&(this._nodes.precompile(C.SHADOW_ACCUMULATION),this._precompileAllGeometry(5)),this._shadowAccumulator?.active||e){let t=this._bindParameters.output;this._bindParameters.output=e?4:3,this._nodes.precompile(C.GAUSSIAN_SPLAT_DEPTH),this._bindParameters.output=t}(this.shadowsEnabled||this._shadowAccumulator?.active)&&this._nodes.precompile(C.SHADOWMAP),this.hasAmbientIllumination&&e&&this._nodes.precompile(C.AMBIENT_ILLUMINATION)}_renderNormals(){let e=this._normalsRequired;if(e===0)return;let{width:t,height:n}=this._framebuffer.size,r=this.fboCache.acquire(t,n,`normals`);r.acquireDepth(14),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(S,!0,!0),this._bindParameters.output=4,this._plugins.render(...W),this._renderGaussianSplatDepthAndNormals(r);let i=this._nodes.optional(`normals`,...T,C.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(I.NORMALS),r}_releaseGlobalIlluminationBuffers(){let e=this._bindParameters;this.hasGlobalIllumination&&(e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.reprojection.lastFrameDepth=o(e.reprojection.lastFrameDepth),e.reprojection.lastFrameEmission=o(e.reprojection.lastFrameEmission),e.globalIllumination=s(e.globalIllumination),e.globalIlluminationEnabled=!1}_precompileAllGeometry(e){let t=this._bindParameters.output;this._bindParameters.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...U),this._bindParameters.output=t}renderAllGeometry(e){this._bindParameters.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(let n of t)this._renderContext.renderOccludedMask=n,this.precompileSlots(e,...K);this._renderContext.renderOccludedMask=M}renderSlots(e,...t){for(let n of t)this._bindParameters.slot=n,e.forAll(e=>{let t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(9),this.renderSlots(e,...K),this._renderContext.renderOccludedMask=M}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Ae[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(16),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(14)}precompileViewshedShadowMap(){let e=this._bindParameters.output;this._bindParameters.output=8,this._precompileAllGeometry(8),this._nodes.precompile(C.SHADOWMAP),this._bindParameters.output=e}precompileCutFillDepth(){this._precompilePlugins(9,Y)}_precompilePlugins(e,t){let n=this._bindParameters.output;this._bindParameters.output=e,this._plugins.precompile(...t),this._bindParameters.output=n}renderViewshedShadowMap(e,t){let{camera:n,contentCamera:r}=this._bindParameters,i=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(8),this._renderShadowNodes(t),this._ensureBindParametersCamera(n,r),this._bindParameters.camera.setGLViewport(this._rctx),this._bindParameters.output=i}renderCutFillDepth(e){let{camera:t,contentCamera:n}=this._bindParameters,r=this._bindParameters.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._bindParameters.output=9,this._plugins.render(...Y),this._ensureBindParametersCamera(t,n),t.setGLViewport(this._rctx),this._bindParameters.output=r}get _needsGroundDepth(){return this._bindParameters.cutFillVisualizationEnabled}_blitGroundDepth(){if(!this._needsGroundDepth)return null;let{width:e,height:t}=this._framebuffer.size,n=this.fboCache.acquire(e,t,C.GROUND_DEPTH,14);return this._rctx.blitFramebuffer(this._framebuffer.color.fbo,n.fbo,256),this._framebuffer.bind(),n}_renderOpaqueAndTransparentGeometry(e){this._bindParameters.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._bindParameters.output=e,this._plugins.render(...G)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...V),this._nodes.precompile(`opaque-color`))}_renderOpaqueGeometry(){this._plugins.render(...V)}_renderTransparentGeometry(){this._plugins.render(...H),this._hasTransparentGeometry&&this._plugins.render(15)}_renderTransparentGround(){this._plugins.render(...U)}_precompileHUD(e){if(!this._pluginsHas.hudElements)return;let t=this._bindParameters.output,n=this._bindParameters.hudRenderStyle,r=this._bindParameters.emissions;this._bindParameters.emissions=0,this._bindParameters.hudRenderStyle=e,this._bindParameters.output=1,this._plugins.precompile(...q),this._bindParameters.output=2,this._plugins.precompile(...q),this._bindParameters.output=0,this._oitBlend.precompile(this._bindParameters,!1,1),this._hasHighlights&&(this._bindParameters.output=10,this._plugins.precompile(...q)),this._bindParameters.emissions=r,this._bindParameters.output=t,this._bindParameters.hudRenderStyle=n}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;let n=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);let r=!!t.getTexture(R);return this._compositor.compositePreMultipliedAlpha(this._bindParameters,n.getTexture(),r),n.release(),this.performanceInfo.advance(e===0?I.HUD_OCCLUDED:I.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(6,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;let{fboCache:e,_rctx:t,_bindParameters:n}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=n,o=a.length>pe?3:1,s=e.acquire(r,i,`highlights`,o);s.acquireDepth(14);let c=this._plugins.produces(10,0);return c&&this._framebuffer.color.fbo&&s.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,s.fbo,1024),t.bindFramebuffer(s.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),c||t.clear(1024),this._bindParameters.output=10,t.bindFramebuffer(s.fbo),D(t,e,r,i,n,()=>this._renderHighlightGeometries()),s.detachDepth(),this.performanceInfo.advance(I.HIGHLIGHTS),s.retain(this._nodes.require(`highlights`,...E)+this._nodes.optional(`highlights`,...E)-1),s}_renderHighlightGeometries(){this._plugins.render(...ke),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e){let t=this._shadowAccumulator;if(!t)return;t.updateDepthRange(e);let n=t.requireGeometryDepth;this._bindParameters.output=0;let r=this._nodes.produce(C.SHADOW_ACCUMULATION,this._pluginInput);t.didAccumulate&&this.performanceInfo.advance(I.ACCUMULATED_SHADOWS),this._pluginInput.set(C.SHADOW_ACCUMULATION,null),r?.release(),n&&(this._bindParameters.depth=s(this._bindParameters.depth))}renderShadowAccumulationShadowMap(e,t,n,r,i){let a=this.stage.view.qualitySettings.maximumPixelRatio;n.start(e,r,i,!0,a),this._renderShadowCascades(5,n),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,t)}_precompileTransparentGeometry(){se(this._bindParameters.output)?(this._bindParameters.output=1,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=2,this._plugins.precompile(...H),this._hasTransparentGeometry&&this._plugins.precompile(15),this._bindParameters.output=0):this._plugins.precompile(...H)}_renderOIT(e,t=2){let n=e===1,{width:r,height:i}=this._framebuffer.size,a=n?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),s=this._bindParameters,c=s.useFloatBlend.value?8:5,l=s.output;s.output=1;let u=n?`oit hud`:`oit`,d=this.fboCache.acquire(r,i,u,c).acquireColor(R,this.hasFloatBlend?7:0,`oit alpha`),f=s.hasEmission&&(e===0||t!==1);f&&d.acquireColor(z,c,`oit emissive`),n||d.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(d.fbo),this._rctx.clearFramebuffer(A),f&&this._rctx.clearBuffer(2,A),a(),d.detachDepth(),s.output=2;let p=this.fboCache.acquire(r,i,n?`oit front hud`:`oit front`);f&&p.acquireColor(R,c,`oit front emissive`),n?p.acquireDepth(this._hudDepthFormat):p.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(p.fbo),this._rctx.clearFramebuffer(S,n),a(),p.detachDepth();let m=this._pluginsHas.occludedHudElements&&!n,h=m&&s.emissions!==0?z:R;s.hudOcclusion=o(this._bindParameters.hudOcclusion),s.output=0;let g;return n?(g=this.fboCache.acquire(r,i,`oit composite hud`),this._rctx.bindFramebuffer(g.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(s.emissions!==0&&this._framebuffer.ensureEmissionAttachment(),m&&(this._framebuffer.color.acquireColor(h,0,`hud occlusion`),this._rctx.clearBuffer(h-L,S)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,d,p,s,m,e,this._fboCache.debugCallback),g?.detachDepth(),n||(f&&(this._bindParameters.emissions=3),m&&(s.hudOcclusion=this._framebuffer.color.obtainAttachment(h))),p.release(),d.release(),s.output=l,g}get _hudDepthFormat(){return this.isFeatureEnabled(7)?14:13}get _needsOpaquePass(){return this.plugins.produces(0,...V)||this.plugins.produces(5,...V)||this.plugins.produces(3,3)}_renderOpaque(){let e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._pluginInput.set(C.GROUND_DEPTH,this._blitGroundDepth()),this._plugins.render(2,3));let t=this._framebuffer;t.update(t=>this._renderNodes(w.OPAQUE,t,e)),this.fboCache.debugCallback?.(w.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(C.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(C.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderPreTransparent(){this._framebuffer.update(e=>this._renderNodes(C.GAUSSIAN_SPLAT,e)),this.fboCache.debugCallback?.(C.GAUSSIAN_SPLAT,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.OPAQUE_OCCLUSION_QUERY,e)),this.fboCache.debugCallback?.(C.OPAQUE_OCCLUSION_QUERY,this._framebuffer.color.fbo),this._framebuffer.update(e=>this._renderNodes(C.VOXEL,e)),this.fboCache.debugCallback?.(C.VOXEL,this._framebuffer.color.fbo)}_renderTransparent(){let e=this._framebuffer;if(this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&this._renderOIT(0),e.update(e=>this._renderNodes(w.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(w.TRANSPARENT,e.color.fbo),this._hasTransparentGeometry||this._plugins.render(15),this._renderEdges(0),this._bindParameters.ssao=o(this._bindParameters.ssao),e.update(e=>this._renderNodes(C.TRANSPARENT_NO_DEPTH,e)),this.fboCache.debugCallback?.(C.TRANSPARENT_NO_DEPTH,e.color.fbo),this._framebuffer.bind(),this._plugins.render(8),this._bindParameters.hasEmission){let e=this._rctx.setDrawBuffers([De,R]);this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!0,this._plugins.render(8),this._bindParameters.transparentWithoutDepthEmissionDimmingPass=!1,this._rctx.setDrawBuffers(e)}this.performanceInfo.advance(I.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,n=!1){if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return n&&this.performanceInfo.advance(e),t;let r=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),this._fboCache.debugCallback?.(e,r.fbo),r}_renderInternalNodeCategory(e,t){if(!t)return;let n=t.name;try{this._renderNodes(e,t)}finally{this._pluginInput.set(e,null),t.setName(n)}}_3dGeometryRendered(){let e=this._bindParameters;this.hasReflections&&(e.depth=s(e.depth),e.reprojection.lastFrameColor=s(e.reprojection.lastFrameColor)),e.shadowMap.disposeOutput(5);let t=this._framebuffer.color.getAttachment(R)?.attachment;if(this.hasGlobalIllumination&&t){let{width:n,height:r}=this._framebuffer.size,i=e.useFloatBlend.value?8:5;e.reprojection.lastFrameEmission=this.fboCache.acquire(n,r,`emissive`,i),this._blit.blitTexture(t,e,e.reprojection.lastFrameEmission.fbo)}}_ensureBindParameters(e,t){this._ensureBindParametersCamera(e,t),this._ensureBindParametersWeatherFader(),this._ensureBindParametersScreenSpaceReflections(),this._ensureBindParametersReprojection()}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersWeatherFader(){this.stage.viewingMode===1&&(this._bindParameters.clouds.data&&(this._bindParameters.clouds.fade(this._bindParameters.camera,this.renderContext.time,this.stage.view.qualitySettings.fadeDuration,this.stage.view.state.stationary),this.weatherFader?.cleanupCubemap()),this._bindParameters.snowCover=this.weatherFader?.snowCover??0)}_ensureBindParametersScreenSpaceReflections(){let{time:e}=this.renderContext,{screenSpaceReflections:t}=this._bindParameters;if(this.hasReflections){this._ssrEnableTime??=e;let n=this.stage.view.qualitySettings.fadeDuration;t.fadeFactor=n>0?Math.min(n,e-this._ssrEnableTime)/n:1,t.fadeFactor<1&&this._requestRender()}else this._ssrEnableTime=null}_ensureBindParametersReprojection(){if(!(this.hasReflections||this.hasGlobalIllumination)){this._reprojectionMatrix=b;return}let{reprojection:e,camera:t}=this._bindParameters,{lastFrameCamera:n}=e,r=!n.equals(t);if(r?(_(Z,t.viewMatrix),_(X,t.projectionMatrix),v(Q,Z,X),v(Q,n.viewMatrix,Q),v(Q,n.projectionMatrix,Q),this._reprojectionMatrix=Q):this._reprojectionMatrix=b,this.hasGlobalIllumination){let{viewMatrix:t}=e;r?(v($,n.viewMatrix,Z),y(t,$)):y(t,b)}}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,n,r){this._bindParameters.updateLighting(e,t,n,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0,clouds:this.weatherFader?.usedMemory??0}}get test(){}};e([m({readOnly:!0})],B.prototype,`highResolutionAtmosphere`,null),e([m()],B.prototype,`_edgeView`,void 0),e([m()],B.prototype,`updating`,null),B=e([h(`esri.views.3d.webgl-engine.lib.Renderer`)],B);const V=[0,1,2,3],H=[7,6,4,5],U=[7,6],W=[0,1,2,4,...U],G=[3,5],K=[2,4,8],q=[16,12,14,13],ke=[4,5,2,3,0,1,...U],J=[4,8,5,11],Ae={0:[13],1:[12],2:[13,12],3:[13,12]},Y=[0,1,...U],je=[`normals`,`highlights`],X=x(),Z=x(),Q=x(),$=x();function Me(e){return t=>e.immediate.schedule(t)}export{B as Renderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{fromRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,add as a,negate as o,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as d,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class m{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(e){let t=e?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*t}textureResizeModulo(e){return Math.ceil(e/this.textureSizeMultiple)*this.textureSizeMultiple}}const h=[`front`,`left`,`right`,`back`,`top`,`bottom`];function g(e){return![`top`,`bottom`].includes(e)}class _{constructor(e){this._fbos=e,this._faces={},this._width=0,this._height=0,this.settings=new m,this._maxTextureSize=Math.min(has(`esri-mobile`)?4096:16384,e.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(d)}get renderTarget(){return this._fbo}get ready(){return this.depthTexture!=null&&this._width!==0&&this._height!==0}get nearFar(){let e=this.faces;return e.length===0?null:e[0].nearFar}get numActiveFaces(){return h.values().reduce((e,t)=>e+ +!!this._faces[t],0)}get faces(){let e=this._faces,t=[];for(let n of h){let r=e[n];r&&t.push(r)}return t}get atlasRegions(){return this.faces.map(e=>[e.x/this._width,(e.x+e.width)/this._width,e.y/this._height,(e.y+e.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(e=>e.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(e=>e.viewMatrix)}_setupFaceCamera(t,l,d,f){let{effectiveObserverRenderSpace:p,effectiveTargetRenderSpace:m,tiltedUpVector:h,farDistanceRenderSpace:_,horizontalFieldOfView:v,verticalFieldOfView:y}=l,b=c();i(b,m,p);let x=c(),S=c(),C=(e,t)=>{let i=c(),o=r();return n(o,e,t),s(i,b,o),a(i,p,i),i},w,T=h,E=Math.min(90,v),D=Math.min(90,Math.max(0,(v-90)/2)),O=-45,k=45,A=-45,j=45;if(g(t)){let t=t=>e(t,-45,45);A=t(-y/2)-this.settings.toleranceBottomTop,j=t(y/2)+this.settings.toleranceBottomTop}switch(t){case`front`:w=m,O=-E/2,k=E/2;break;case`left`:w=C(Math.PI/2,h),O=45-D;break;case`right`:w=C(-Math.PI/2,h),k=-45+D;break;case`top`:w=a(x,p,h),T=o(S,b);break;case`bottom`:w=i(x,p,h),T=b;break;case`back`:w=C(Math.PI,h)}let M=new u({center:w,eye:p,up:T,far:_});M.sectionAnglesDeg=[O-this.settings.toleranceSides,k+this.settings.toleranceSides,A,j],M.fovY=Math.PI/2;let N=M.setViewport(d,f);return this._faces[t]=M,N}isActive(e){return this._computeActiveFaces(e).size>0}_computeActiveFaces(e){let t=new Set,{horizontalFieldOfView:n,verticalFieldOfView:r}=e,i=-r/2,a=r/2;return n===0||r===0||(i<=45&&a>=-45&&t.add(`front`),n>90&&(t.add(`left`),t.add(`right`)),n>270&&t.add(`back`),a>45-this.settings.toleranceBottomTop&&t.add(`top`),i<-45+this.settings.toleranceBottomTop&&t.add(`bottom`)),t}_computeBaseTextureSize({pixelRatio:e,fullWidth:t,fullHeight:n},r,i,a){let o=r/e,s=this.settings.textureSizeModifier(i);return l(Math.max(t,n)*o*s,this._maxTextureSize/a)}_ensureFBO(e){let t=this._width,n=this._height,r=this._fbo?.fbo;(!r||r.width!==t||r.height!==n||e!==p(r.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16))&&(this._fbo?.release(),this._fbo=this._allocateFBO(e))}_allocateFBO(e){let{_width:t,_height:n}=this,r=e?14:13,i=this._fbos.acquire(t,n,`viewshed shadow map`,r);return i.getTexture(d)?.setShadowFiltering(!1),i}clearFBO(e){let t=this._fbos.rctx;this._ensureFBO(e),t.bindFramebuffer(this._fbo?.fbo),t.setClearColor(1,1,1,1),t.clear(16640)}dispose(){this._fbo=t(this._fbo)}releaseFBO(){this._debugFBO||(this._fbo=t(this._fbo))}start(e,t,n,r,i=!1){this._faces={};let a=this._computeActiveFaces(t),o=a.size;if(o===0)return!1;let s=this._computeBaseTextureSize(e,r,n,o),c=0,l=0,u=0;for(let e of a){let n=v(e,o);n>l&&(u=Math.max(u,c),c=0),l=n;let r=n*s;c+=this._setupFaceCamera(e,t,[c,r],s)}return u=Math.max(u,c),this._width=this.settings.textureResizeModulo(u),this._height=y(o)*s,this.clearFBO(i),!0}finish(){}get test(){}}function v(e,t){if(t<4)return 0;let n=e===`front`||e===`left`;return t===4?+!n:n||e===`right`?0:1}function y(e){return e<4?1:2}export{_ as ViewshedShadowMap};
2
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{fromRotation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as i,add as a,negate as o,transformMat4 as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{applyTextureResizeModulo as l}from"./textureUtils.js";import{ViewshedFaceCamera as u}from"./ViewshedFaceCamera.js";import{DepthStencilAttachment as d,SizedDepthFormat as f}from"../../../webgl/enums.js";import{isSizedDepthStencilFormat as p}from"../../../webgl/textureUtils.js";class m{constructor(){this.textureSizeQuality=1,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.textureSizeMultiple=128,this.toleranceSides=5,this.toleranceBottomTop=10}textureSizeModifier(e){let t=e?this.textureSizeModHighQuality:this.textureSizeModLowQuality;return this.textureSizeQuality*t}textureResizeModulo(e){return Math.ceil(e/this.textureSizeMultiple)*this.textureSizeMultiple}}const h=[`front`,`left`,`right`,`back`,`top`,`bottom`];function g(e){return![`top`,`bottom`].includes(e)}class _{constructor(e){this._fbos=e,this._faces={},this._width=0,this._height=0,this.settings=new m,this._maxTextureSize=Math.min(has(`esri-mobile`)?4096:16384,e.rctx.parameters.maxTextureSize)}get depthTexture(){return this._fbo?.getTexture(d)}get renderTarget(){return this._fbo}get ready(){return this.depthTexture!=null&&this._width!==0&&this._height!==0}get nearFar(){let e=this.faces;return e.length===0?null:e[0].nearFar}get numActiveFaces(){return h.values().reduce((e,t)=>e+ +!!this._faces[t],0)}get faces(){let e=this._faces,t=[];for(let n of h){let r=e[n];r&&t.push(r)}return t}get atlasRegions(){return this.faces.map(e=>[e.x/this._width,(e.x+e.width)/this._width,e.y/this._height,(e.y+e.height)/this._height])}get viewshedProjectionMatrices(){return this.faces.map(e=>e.projectionMatrix)}get viewshedViewMatrices(){return this.faces.map(e=>e.viewMatrix)}_setupFaceCamera(t,l,d,f){let{effectiveObserverRenderSpace:p,effectiveTargetRenderSpace:m,tiltedUpVector:h,farDistanceRenderSpace:_,horizontalFieldOfView:v,verticalFieldOfView:y}=l,b=c();i(b,m,p);let x=c(),S=c(),C=(e,t)=>{let i=c(),o=r();return n(o,e,t),s(i,b,o),a(i,p,i),i},w,T=h,E=Math.min(90,v),D=Math.min(90,Math.max(0,(v-90)/2)),O=-45,k=45,A=-45,j=45;if(g(t)){let t=t=>e(t,-45,45);A=t(-y/2)-this.settings.toleranceBottomTop,j=t(y/2)+this.settings.toleranceBottomTop}switch(t){case`front`:w=m,O=-E/2,k=E/2;break;case`left`:w=C(Math.PI/2,h),O=45-D;break;case`right`:w=C(-Math.PI/2,h),k=-45+D;break;case`top`:w=a(x,p,h),T=o(S,b);break;case`bottom`:w=i(x,p,h),T=b;break;case`back`:w=C(Math.PI,h)}let M=new u({center:w,eye:p,up:T,far:_});M.sectionAnglesDeg=[O-this.settings.toleranceSides,k+this.settings.toleranceSides,A,j],M.fovY=Math.PI/2;let N=M.setViewport(d,f);return this._faces[t]=M,N}isActive(e){return this._computeActiveFaces(e).size>0}_computeActiveFaces(e){let t=new Set,{horizontalFieldOfView:n,verticalFieldOfView:r}=e,i=-r/2,a=r/2;return n===0||r===0||(i<=45&&a>=-45&&t.add(`front`),n>90&&(t.add(`left`),t.add(`right`)),n>270&&t.add(`back`),a>45-this.settings.toleranceBottomTop&&t.add(`top`),i<-45+this.settings.toleranceBottomTop&&t.add(`bottom`)),t}_computeBaseTextureSize({pixelRatio:e,fullWidth:t,fullHeight:n},r,i,a){let o=r/e,s=this.settings.textureSizeModifier(i);return l(Math.max(t,n)*o*s,this._maxTextureSize/a)}_ensureFBO(e){let t=this._width,n=this._height,r=this._fbo?.fbo;r&&r.width===t&&r.height===n&&e===p(r.depthStencilTexture?.descriptor?.internalFormat??f.DEPTH_COMPONENT16)||(this._fbo?.release(),this._fbo=this._allocateFBO(e))}_allocateFBO(e){let{_width:t,_height:n}=this,r=e?14:13,i=this._fbos.acquire(t,n,`viewshed shadow map`,r);return i.getTexture(d)?.setShadowFiltering(!1),i}clearFBO(e){let t=this._fbos.rctx;this._ensureFBO(e),t.bindFramebuffer(this._fbo?.fbo),t.setClearColor(1,1,1,1),t.clear(16640)}dispose(){this._fbo=t(this._fbo)}releaseFBO(){this._debugFBO||(this._fbo=t(this._fbo))}start(e,t,n,r,i=!1){this._faces={};let a=this._computeActiveFaces(t),o=a.size;if(o===0)return!1;let s=this._computeBaseTextureSize(e,r,n,o),c=0,l=0,u=0;for(let e of a){let n=v(e,o);n>l&&(u=Math.max(u,c),c=0),l=n;let r=n*s;c+=this._setupFaceCamera(e,t,[c,r],s)}return u=Math.max(u,c),this._width=this.settings.textureResizeModulo(u),this._height=y(o)*s,this.clearFBO(i),!0}finish(){}get test(){}}function v(e,t){if(t<4)return 0;let n=e===`front`||e===`left`;return t===4?+!n:n||e===`right`?0:1}function y(e){return e<4?1:2}export{_ as ViewshedShadowMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{copy as e,set as t,add as n,length as r,normalize as i,cross as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromPositionAndNormal as c,intersectRay as l}from"../../../../geometry/support/plane.js";import{wrap as u}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as d}from"./GeometryUtil.js";function f(f,m){let h=null,g=f.vertices.length,_=.99619469809,v=o(),y=o(),b=o(),x=o(),S=o(),C=o(),w=s(),T=f.vertices[0];e(y,m),t(v,0,1,0),d(T.vRight,y,v,v,b,y,_),e(T.frame.up,y),e(T.frame.right,b);let E=f.positions,D=f.offset;h=T;for(let o=1;o<g;++o){T=f.vertices[o],n(S,T.vLeft,T.vRight);let s=r(S);s>0?(s=1/Math.sqrt(s),S[0]*=s,S[1]*=s,S[2]*=s):(S[0]=T.vRight[0],S[1]=T.vRight[1],S[2]=T.vRight[2]),C[0]=E[D]+h.frame.up[0],C[1]=E[D+1]+h.frame.up[1],C[2]=E[D+2]+h.frame.up[2],D+=3;let m=t(p,E[D],E[D+1],E[D+2]);c(m,S,w),l(w,u(C,T.vLeft),x)?(x[0]-=E[D],x[1]-=E[D+1],x[2]-=E[D+2],i(y,x),a(b,S,y),i(b,b)):d(S,h.frame.up,h.frame.right,v,b,y,_),e(T.frame.up,y),e(T.frame.right,b),h=T}}const p=o();export{f as computeMinimumRotationTangentFrame};
2
+ import{set as e,exactEquals as t,dot as n,length as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{dot as a,scale as o,add as s,normalize as c,copy as l,set as u,length as d,cross as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as m,fromPositionAndNormal as h,intersectRay as g}from"../../../../geometry/support/plane.js";import{wrap as _}from"../../../../geometry/support/ray.js";import{makeOrthoBasisDirUpFallback as v}from"./GeometryUtil.js";function y(e,t){let n=null,r=e.vertices.length,i=.99619469809,a=p(),o=p(),y=p(),b=p(),x=p(),S=p(),C=m(),T=e.vertices[0];l(o,t),u(a,0,1,0),v(T.vRight,o,a,a,y,o,i),l(T.frame.up,o),l(T.frame.right,y);let E=e.positions,D=e.offset;n=T;for(let t=1;t<r;++t){T=e.vertices[t],s(x,T.vLeft,T.vRight);let r=d(x);r>0?(r=1/Math.sqrt(r),x[0]*=r,x[1]*=r,x[2]*=r):(x[0]=T.vRight[0],x[1]=T.vRight[1],x[2]=T.vRight[2]),S[0]=E[D]+n.frame.up[0],S[1]=E[D+1]+n.frame.up[1],S[2]=E[D+2]+n.frame.up[2],D+=3;let p=u(w,E[D],E[D+1],E[D+2]);h(p,x,C),g(C,_(S,T.vLeft),b)?(b[0]-=E[D],b[1]-=E[D+1],b[2]-=E[D+2],c(o,b),f(y,x,o),c(y,y)):v(x,n.frame.up,n.frame.right,a,y,o,i),l(T.frame.up,o),l(T.frame.right,y),n=T}}const b=.001;function x(t,n,r,i){if(!i)return e(t,1,0);let l=a(r,n.up),u=a(r,n.right);return o(w,n.right,l),o(T,n.up,-u),s(w,w,T),c(w,w),e(t,a(w,n.right),a(w,n.up))}function S(e,t,i,a=0){return n(e,t)*Math.sign(i)>=-a*r(e)}function C(e,n,r){return r!==0&&!t(e,i)&&S(e,n,r,b)}const w=p(),T=p();export{b as classificationTolerance,y as computeMinimumRotationTangentFrame,x as constructPathRotationRight,S as isOuterJoinVertex,C as needsJoinSubdivisions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{makeArrayEquals as e}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{ScreenSizePerspectiveEvaluator as n}from"../../lib/screenSizePerspectiveUtils.js";function r(e,n,r,i,a,o){let c=r.screenLength*e.pixelRatio;a!=null&&(s.update(i,n,a,o),c=s.apply(c));let l=c*Math.tan(.5*e.fovY)/(e.fullHeight*.5);return t(l*n,r.minWorldLength,r.maxWorldLength)}const i=e();function a(e,t){let n=!1;for(let r in t){let a=t[r];a!==void 0&&(Array.isArray(a)?(!Array.isArray(e[r])||!i(a,e[r]))&&(e[r]=a.slice(),n=!0):e[r]!==a&&(n=!0,e[r]=a))}return n}const o={multiply:1,ignore:2,replace:3,tint:4},s=new n;export{o as colorMixModes,a as updateParameters,r as verticalOffsetAtDistance};
2
+ import{makeArrayEquals as e}from"../../../../../core/arrayUtils.js";import{clamp as t}from"../../../../../core/mathUtils.js";import{ScreenSizePerspectiveEvaluator as n}from"../../lib/screenSizePerspectiveUtils.js";function r(e,n,r,i,a,o){let c=r.screenLength*e.pixelRatio;a!=null&&(s.update(i,n,a,o),c=s.apply(c));let l=c*Math.tan(.5*e.fovY)/(e.fullHeight*.5);return t(l*n,r.minWorldLength,r.maxWorldLength)}const i=e();function a(e,t){let n=!1;for(let r in t){let a=t[r];a!==void 0&&(Array.isArray(a)?Array.isArray(e[r])&&i(a,e[r])||(e[r]=a.slice(),n=!0):e[r]!==a&&(n=!0,e[r]=a))}return n}const o={multiply:1,ignore:2,replace:3,tint:4},s=new n;export{o as colorMixModes,a as updateParameters,r as verticalOffsetAtDistance};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{assert as n}from"../../lib/Util.js";import{bufferRangePool as r,mergeAdjacentRanges as i}from"./BufferRange.js";import{DrawCommand as a}from"./DrawCommand.js";import{Instance as o}from"./Instance.js";import{InstancedCommandVAO as s}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as c}from"./InstancedCommandVAOs.js";import{defaultHighlightName as l}from"../../../../support/HighlightDefaults.js";class u{constructor(e,t){this.isInstanced=e,this.targetBuffers=t,this.vao=null,this.textureBuffer=null,this.endElements={geometry:0,texture:0,index:0},this._instances=new Map,this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=f(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=f(),this.drawCommandsShadowHighlightRest=f(),this._instancedCommandVAOs=null;let n={},r={};for(let e of t)n[e]=0,r[e]=[];this._numElements=n,this._holes=r,this.useIndexing=t.includes(`index`),this._drawRangesTarget=this.useIndexing?`index`:`geometry`}getTargetBuffer(e){return e===`geometry`?this.vao?.buffer(`geometry`):e===`texture`?this.textureBuffer:this.vao?.indexBuffer}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get indexType(){return this.vao?.indexBuffer?.indexType}clearHoles(){for(let e of this.targetBuffers){let t=this._holes[e];for(let e of t)r.release(e);t.length=0}}get holes(){return this._holes}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}get _drawTargetHoles(){return this._holes[this._drawRangesTarget]}get _drawTargetEndElement(){return this.endElements[this._drawRangesTarget]}get usedMemory(){return(this.vao?.usedMemory??0)+(this.textureBuffer?.usedMemory??0)}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateDirtyDrawCommands(e){if(this.drawCommandsDirty){this.resetInstanceSummary();for(let e of this.instances.values())this.updateDrawState(e);this.updateDrawCommands(e)}}createInstance(e,t,n=this._makeEmptyRanges()){let r=new o(e,n,t,this._drawRangesTarget);return this.addInstance(e.id,r),r}addInstance(e,t){n(!this._instances.has(e)),this._instances.set(e,t);for(let e of this.targetBuffers)this._numElements[e]+=t.targetRanges[e].numElements}deleteInstance(e){let t=this._instances.get(e);if(t){for(let e of this.targetBuffers){let n=t.targetRanges[e];this._numElements[e]-=n.numElements,r.release(n)}this._instances.delete(e)}}updateInstances(){let{targetBuffers:e}=this,t={};for(let n of e)t[n]=0;for(let n of this._instances.values()){for(let r of e)t[r]+=n.targetRanges[r].numElements;this.updateDrawState(n)}this._numElements=t}updateDrawState(e){if(e.isVisible){let{highlightName:t}=e;t&&this.highlightNames.add(t),e.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(e){this._updateDrawCommands(e),this._updateInstancedCommandVAOs()}_updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;let{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(e,t),!this.needsMultipleCommands){let e=this.drawCommandsDefault.pushNew(),t=this._drawTargetHoles,n=t.at(0);if(this.vao&&t.length===1&&n.to===this._drawTargetEndElement){e.first=0,e.count=n.from;return}e.first=1/0,e.count=0,this._instances.forEach(t=>{e.first=Math.min(e.first,t.drawRange.from),e.count=Math.max(e.count,t.drawRange.to)}),e.count-=e.first}else for(let e of t)e.isVisible&&this.addOrMerge(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort(({drawRange:e},{drawRange:t})=>e.from===t.from?e.to-t.to:e.from-t.from)}updateHighlights(e){this.highlightNames.clear();let t=this.sortedInstances;for(let n of t)n.updateHighlightOptions(e),n.isVisible&&n.highlightName&&this.highlightNames.add(n.highlightName);this._updateHighlightDrawCommands(e,t),this._updateInstancedCommandVAOs()}mergeHoles(){let e=this._holes;for(let t of this.targetBuffers)i(e[t])}_updateHighlightDrawCommands(t,n){let{drawCommandsHighlights:r,drawCommandsShadowHighlightRest:i}=this;r.clear(),i.clear();for(let a of n){if(a.updateHighlightOptions(t),!a.isVisible)continue;let{highlightName:n}=a;if(n){this.highlightNames.add(n);let t=e(r,n,f);this.addOrMerge(t,a)}(!n||n!==l)&&this.addOrMerge(i,a)}}_updateInstancedCommandVAOs(){let e=this.vao;if(!this.isInstanced||e==null)return;this._instancedCommandVAOs??=new c;let t=this._instancedCommandVAOs,n=t.commandVAOs.clone();t.clear();let r=t.commandVAOs,i=(t,i)=>{for(let a of t){let{first:t,count:o}=a,c=r.get(t,o)??n.pop(t,o)??new s(e.shallowCloneWithBaseInstances(new Map([[`geometry`,a.first]])),a.count);r.set(t,o,c),i.push(c)}};i(this.drawCommandsDefault,t.drawCommandsDefault);for(let[e,n]of this.drawCommandsHighlights){let r=[];i(n,r),t.drawCommandsHighlights.set(e,r)}i(this.drawCommandsOccludees,t.drawCommandsOccludees),i(this.drawCommandsShadowHighlightRest,t.drawCommandsShadowHighlightRest);for(let e of n.values())e.dispose();n.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}addOrMerge(e,{drawRange:t}){let n=e.back();if(n==null){let n=e.pushNew();n.first=t.from,n.count=t.numElements}else if(p(n,t))n.count=t.from-n.first+t.numElements;else{let n=e.pushNew();n.first=t.from,n.count=t.numElements}}_makeEmptyRanges(){let e={};for(let t of this.targetBuffers)e[t]=r.acquire(0,0);return e}}function d(e){return e.vao!=null}function f(){return new t({allocator:e=>e||new a,deallocator:e=>e})}function p(e,t){return e.first+e.count>=t.from}export{u as PerBufferData,d as hasVao};
2
+ import{getOrCreateMapValue as e}from"../../../../../core/MapUtils.js";import t from"../../../../../core/PooledArray.js";import{assert as n}from"../../lib/Util.js";import{bufferRangePool as r,mergeAdjacentRanges as i}from"./BufferRange.js";import{DrawCommand as a}from"./DrawCommand.js";import{Instance as o}from"./Instance.js";import{InstancedCommandVAO as s}from"./InstancedCommandVAO.js";import{InstancedCommandVAOs as c}from"./InstancedCommandVAOs.js";import{defaultHighlightName as l}from"../../../../support/HighlightDefaults.js";class u{constructor(e,t){this.isInstanced=e,this.targetBuffers=t,this.vao=null,this.textureBuffer=null,this.endElements={geometry:0,texture:0,index:0},this._instances=new Map,this.hasHiddenInstances=!1,this.hasOccludees=!1,this.drawCommandsDirty=!0,this.highlightNames=new Set,this.drawCommandsDefault=f(),this.drawCommandsHighlights=new Map,this.drawCommandsOccludees=f(),this.drawCommandsShadowHighlightRest=f(),this._instancedCommandVAOs=null;let n={},r={};for(let e of t)n[e]=0,r[e]=[];this._numElements=n,this._holes=r,this.useIndexing=t.includes(`index`),this._drawRangesTarget=this.useIndexing?`index`:`geometry`}getTargetBuffer(e){return e===`geometry`?this.vao?.buffer(`geometry`):e===`texture`?this.textureBuffer:this.vao?.indexBuffer}get numElements(){return this._numElements}get instances(){return this._instances}get writeableInstances(){return this._instances}get indexType(){return this.vao?.indexBuffer?.indexType}clearHoles(){for(let e of this.targetBuffers){let t=this._holes[e];for(let e of t)r.release(e);t.length=0}}get holes(){return this._holes}get hasHighlights(){return this.highlightNames.size>0}get instancedCommandVAOs(){return this._instancedCommandVAOs}get _drawTargetHoles(){return this._holes[this._drawRangesTarget]}get _drawTargetEndElement(){return this.endElements[this._drawRangesTarget]}get usedMemory(){return(this.vao?.usedMemory??0)+(this.textureBuffer?.usedMemory??0)}resetInstanceSummary(){this.hasHiddenInstances=!1,this.hasOccludees=!1,this.highlightNames.clear()}updateDirtyDrawCommands(e){if(this.drawCommandsDirty){this.resetInstanceSummary();for(let e of this.instances.values())this.updateDrawState(e);this.updateDrawCommands(e)}}createInstance(e,t,n=this._makeEmptyRanges()){let r=new o(e,n,t,this._drawRangesTarget);return this.addInstance(e.id,r),r}addInstance(e,t){n(!this._instances.has(e)),this._instances.set(e,t);for(let e of this.targetBuffers)this._numElements[e]+=t.targetRanges[e].numElements}deleteInstance(e){let t=this._instances.get(e);if(t){for(let e of this.targetBuffers){let n=t.targetRanges[e];this._numElements[e]-=n.numElements,r.release(n)}this._instances.delete(e)}}updateInstances(){let{targetBuffers:e}=this,t={};for(let n of e)t[n]=0;for(let n of this._instances.values()){for(let r of e)t[r]+=n.targetRanges[r].numElements;this.updateDrawState(n)}this._numElements=t}updateDrawState(e){if(e.isVisible){let{highlightName:t}=e;t&&this.highlightNames.add(t),e.hasOccludees&&(this.hasOccludees=!0)}else this.hasHiddenInstances=!0}updateDrawCommands(e){this._updateDrawCommands(e),this._updateInstancedCommandVAOs()}_updateDrawCommands(e){if(this.drawCommandsDefault.clear(),this.drawCommandsOccludees.clear(),this.drawCommandsDirty=!1,this._instances.size===0)return;let{sortedInstances:t}=this;if(this._updateHighlightDrawCommands(e,t),!this.needsMultipleCommands){let e=this.drawCommandsDefault.pushNew(),t=this._drawTargetHoles,n=t.at(0);if(this.vao&&t.length===1&&n.to===this._drawTargetEndElement){e.first=0,e.count=n.from;return}e.first=1/0,e.count=0,this._instances.forEach(t=>{e.first=Math.min(e.first,t.drawRange.from),e.count=Math.max(e.count,t.drawRange.to)}),e.count-=e.first}else for(let e of t)e.isVisible&&this.addOrMerge(e.hasOccludees?this.drawCommandsOccludees:this.drawCommandsDefault,e)}get sortedInstances(){return Array.from(this._instances.values()).sort(({drawRange:e},{drawRange:t})=>e.from===t.from?e.to-t.to:e.from-t.from)}updateHighlights(e){this.highlightNames.clear();let t=this.sortedInstances;for(let n of t)n.updateHighlightOptions(e),n.isVisible&&n.highlightName&&this.highlightNames.add(n.highlightName);this._updateHighlightDrawCommands(e,t),this._updateInstancedCommandVAOs()}mergeHoles(){let e=this._holes;for(let t of this.targetBuffers)i(e[t])}_updateHighlightDrawCommands(t,n){let{drawCommandsHighlights:r,drawCommandsShadowHighlightRest:i}=this;r.clear(),i.clear();for(let a of n){if(a.updateHighlightOptions(t),!a.isVisible)continue;let{highlightName:n}=a;if(n){this.highlightNames.add(n);let t=e(r,n,f);this.addOrMerge(t,a)}n&&n===l||this.addOrMerge(i,a)}}_updateInstancedCommandVAOs(){let e=this.vao;if(!this.isInstanced||e==null)return;this._instancedCommandVAOs??=new c;let t=this._instancedCommandVAOs,n=t.commandVAOs.clone();t.clear();let r=t.commandVAOs,i=(t,i)=>{for(let a of t){let{first:t,count:o}=a,c=r.get(t,o)??n.pop(t,o)??new s(e.shallowCloneWithBaseInstances(new Map([[`geometry`,a.first]])),a.count);r.set(t,o,c),i.push(c)}};i(this.drawCommandsDefault,t.drawCommandsDefault);for(let[e,n]of this.drawCommandsHighlights){let r=[];i(n,r),t.drawCommandsHighlights.set(e,r)}i(this.drawCommandsOccludees,t.drawCommandsOccludees),i(this.drawCommandsShadowHighlightRest,t.drawCommandsShadowHighlightRest);for(let e of n.values())e.dispose();n.clear()}get needsMultipleCommands(){return this.hasOccludees||this.hasHighlights||this.hasHiddenInstances}addOrMerge(e,{drawRange:t}){let n=e.back();if(n==null){let n=e.pushNew();n.first=t.from,n.count=t.numElements}else if(p(n,t))n.count=t.from-n.first+t.numElements;else{let n=e.pushNew();n.first=t.from,n.count=t.numElements}}_makeEmptyRanges(){let e={};for(let t of this.targetBuffers)e[t]=r.acquire(0,0);return e}}function d(e){return e.vao!=null}function f(){return new t({allocator:e=>e||new a,deallocator:e=>e})}function p(e,t){return e.first+e.count>=t.from}export{u as PerBufferData,d as hasVao};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentView as He}from"./3d/environment/EnvironmentView.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentView=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>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)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(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=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent!=null&&(e.type!==`graphics`||!e.internal)&&n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)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);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}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 q._layerToLayerview}static{this._layerToLayerview=A._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){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get 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 ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(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(e.parent==null)throw new a(`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){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`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 N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.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 V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{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 B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let 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(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({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`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>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=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(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`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
2
+ import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentView as He}from"./3d/environment/EnvironmentView.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentView=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>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)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(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=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent==null||e.type===`graphics`&&e.internal||n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)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);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}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 q._layerToLayerview}static{this._layerToLayerview=A._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){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get 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 ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(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(e.parent==null)throw new a(`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){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`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 N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.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 V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{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 B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let 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(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({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`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>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=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(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`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{clock as n}from"../core/clock.js";import r from"../core/Collection.js";import"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{watch as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as u}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as f,areToolManipulatorsEditable as p,isCancelEvent as m}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as h}from"./interactive/ToolViewManagerManipulatorState.js";const g=`attached`,_=`tools`,v=1e3;let y=class extends t{constructor(e){super(e),this._updatingHandles=new l,this._clock=n,this._manipulatorState=new h,this.tools=new r,this._interacting=!1,this._interactingTimeout=v,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(d,e=>{this._handleInputEvent(e)},u.TOOL),...f(this.tools),this.tools.on(`before-add`,({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on(`before-remove`,({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)}),this.tools.on(`change`,()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(e){if(e!=null&&!this.view.ready){i.getLogger(this).error(`Cannot set active tool while view is not ready.`);return}if(e===this.activeTool)return;let t=this.activeTool;this._set(`activeTool`,e),t?.deactivate(),e?.activate(),this._removeIncompleteTools(e);for(let e of this.tools){this._updateToolEditableFlag(e);let t=p(e);(this.activeTool==null||!t)&&this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!t)}}get cursor(){let e=this._manipulatorState.cursor;if(e!=null)return e;for(let e of this.tools)if(e.visible&&e.cursor!=null)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=a(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){this.view.type===`3d`?this.addHandles([o(()=>{let{state:e}=this.view;return`camera`in e&&e.camera},()=>this._forEachManipulator(e=>e.onViewChange())),this.view.elevationProvider.on(`elevation-change`,e=>this._forEachManipulator(t=>t.onElevationChange(e)))],g):this.addHandles(o(()=>this.view.extent,()=>this._forEachManipulator(e=>e.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){for(let t of this.tools)t.manipulators&&t.manipulators.forEach(({manipulator:n})=>e(n,t))}_handleInputEvent(e){let t=!1;m(e)&&this.activeTool&&e.preventDefault();let n={...e,stopPropagation:()=>{t=!0,e.stopPropagation()}};if(this.activeTool!=null)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(n);else for(let e of this.tools)!t&&e.visible&&e.handleInputEvent(n);!t&&m(e)&&this.activeTool&&(e.stopPropagation(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(n,this._manipulatorStateEventArgs),!t&&this.activeTool!=null&&this.activeTool.handleInputEventAfter(n),this._manipulatorState.handleHoverEvent(n,this.tools),e.type===`pointer-move`&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(let e of this.tools){if(e instanceof t){let t=o(()=>[e.cursor,e.visible,e.editable],()=>{p(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)});this.addHandles(t,_)}e.manipulators&&this.addHandles([e.manipulators.on(`after-remove`,t=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,t.item.manipulator)}),e.manipulators.on(`change`,()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(e){e.setEditableFlag?.(1,this.activeTool==null||e===this.activeTool)}_removeIncompleteTools(e){this.tools.filter(t=>(e==null||t!==e)&&!t.created&&t.removeIncompleteOnCancel).forEach(e=>{this.tools.remove(e)})}get test(){if(process.env.NODE_ENV!==`test`)return;let e=this;return{setClock:e=>this._clock=e,set interactingTimeoutEnabled(t){e._interactingTimeout=t?v:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};e([s({constructOnly:!0,nonNullable:!0})],y.prototype,`view`,void 0),e([s({value:null})],y.prototype,`activeTool`,null),e([s({readOnly:!0,type:r})],y.prototype,`tools`,void 0),e([s()],y.prototype,`cursor`,null),e([s({readOnly:!0})],y.prototype,`updating`,null),e([s()],y.prototype,`_interacting`,void 0),e([s({readOnly:!0})],y.prototype,`interacting`,null),y=e([c(`esri.views.ToolViewManager`)],y);export{y as ToolViewManager,v as interactingTimeout};
2
+ import{__decorate as e}from"tslib";import t from"../core/Accessor.js";import{clock as n}from"../core/clock.js";import r from"../core/Collection.js";import"../core/has.js";import i from"../core/Logger.js";import{removeMaybe as a}from"../core/maybe.js";import{watch as o}from"../core/reactiveUtils.js";import{property as s,subclass as c}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as u}from"./input/InputManager.js";import{eventTypes as d}from"./input/ViewEvents.js";import{getToolCollectionHandles as f,areToolManipulatorsEditable as p,isCancelEvent as m}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as h}from"./interactive/ToolViewManagerManipulatorState.js";const g=`attached`,_=`tools`,v=1e3;let y=class extends t{constructor(e){super(e),this._updatingHandles=new l,this._clock=n,this._manipulatorState=new h,this.tools=new r,this._interacting=!1,this._interactingTimeout=v,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(d,e=>{this._handleInputEvent(e)},u.TOOL),...f(this.tools),this.tools.on(`before-add`,({item:e})=>{this._updateToolEditableFlag(e)}),this.tools.on(`before-remove`,({item:e})=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)}),this.tools.on(`change`,()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(e=>e.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:e=>{this.activeTool=e},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(e){if(e!=null&&!this.view.ready){i.getLogger(this).error(`Cannot set active tool while view is not ready.`);return}if(e===this.activeTool)return;let t=this.activeTool;this._set(`activeTool`,e),t?.deactivate(),e?.activate(),this._removeIncompleteTools(e);for(let e of this.tools){this._updateToolEditableFlag(e);let t=p(e);this.activeTool!=null&&t||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!t)}}get cursor(){let e=this._manipulatorState.cursor;if(e!=null)return e;for(let e of this.tools)if(e.visible&&e.cursor!=null)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(e=>e.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=a(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){this.view.type===`3d`?this.addHandles([o(()=>{let{state:e}=this.view;return`camera`in e&&e.camera},()=>this._forEachManipulator(e=>e.onViewChange())),this.view.elevationProvider.on(`elevation-change`,e=>this._forEachManipulator(t=>t.onElevationChange(e)))],g):this.addHandles(o(()=>this.view.extent,()=>this._forEachManipulator(e=>e.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(e){for(let t of this.tools)t.manipulators&&t.manipulators.forEach(({manipulator:n})=>e(n,t))}_handleInputEvent(e){let t=!1;m(e)&&this.activeTool&&e.preventDefault();let n={...e,stopPropagation:()=>{t=!0,e.stopPropagation()}};if(this.activeTool!=null)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(n);else for(let e of this.tools)!t&&e.visible&&e.handleInputEvent(n);!t&&m(e)&&this.activeTool&&(e.stopPropagation(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(n,this._manipulatorStateEventArgs),!t&&this.activeTool!=null&&this.activeTool.handleInputEventAfter(n),this._manipulatorState.handleHoverEvent(n,this.tools),e.type===`pointer-move`&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(let e of this.tools){if(e instanceof t){let t=o(()=>[e.cursor,e.visible,e.editable],()=>{p(e)||this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs)});this.addHandles(t,_)}e.manipulators&&this.addHandles([e.manipulators.on(`after-remove`,t=>{this._manipulatorState.clearPointers(e,this._manipulatorStateEventArgs,!0,t.item.manipulator)}),e.manipulators.on(`change`,()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(e){e.setEditableFlag?.(1,this.activeTool==null||e===this.activeTool)}_removeIncompleteTools(e){this.tools.filter(t=>(e==null||t!==e)&&!t.created&&t.removeIncompleteOnCancel).forEach(e=>{this.tools.remove(e)})}get test(){if(process.env.NODE_ENV!==`test`)return;let e=this;return{setClock:e=>this._clock=e,set interactingTimeoutEnabled(t){e._interactingTimeout=t?v:0},get interactingTimeoutEnabled(){return e._interactingTimeout!==0}}}};e([s({constructOnly:!0,nonNullable:!0})],y.prototype,`view`,void 0),e([s({value:null})],y.prototype,`activeTool`,null),e([s({readOnly:!0,type:r})],y.prototype,`tools`,void 0),e([s()],y.prototype,`cursor`,null),e([s({readOnly:!0})],y.prototype,`updating`,null),e([s()],y.prototype,`_interacting`,void 0),e([s({readOnly:!0})],y.prototype,`interacting`,null),y=e([c(`esri.views.ToolViewManager`)],y);export{y as ToolViewManager,v as interactingTimeout};