@arcgis/core 4.33.0-next.20250422 → 4.33.0-next.20250424

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 (329) hide show
  1. package/Graphic.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/Analysis.d.ts +4 -0
  4. package/analysis/Analysis.js +1 -1
  5. package/analysis/SliceAnalysis.js +1 -1
  6. package/analysis/SlicePlane.js +1 -1
  7. package/analysis/support/AnalysisOriginWebScene.d.ts +4 -0
  8. package/analysis/support/AnalysisOriginWebScene.js +5 -0
  9. package/analysis/support/SliceAnalysisExcludedLayer.js +5 -0
  10. package/arcade/geometry/constructors.js +1 -1
  11. package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -0
  12. package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -0
  13. package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -0
  14. package/assets/components/assets/icon/mosaicMethodByAttribute16.json +1 -0
  15. package/assets/components/assets/icon/mosaicMethodByAttribute24.json +1 -0
  16. package/assets/components/assets/icon/mosaicMethodByAttribute32.json +1 -0
  17. package/assets/components/assets/icon/mosaicMethodClosestToCenter16.json +1 -0
  18. package/assets/components/assets/icon/mosaicMethodClosestToCenter24.json +1 -0
  19. package/assets/components/assets/icon/mosaicMethodClosestToCenter32.json +1 -0
  20. package/assets/components/assets/icon/mosaicMethodClosestToNadir16.json +1 -0
  21. package/assets/components/assets/icon/mosaicMethodClosestToNadir24.json +1 -0
  22. package/assets/components/assets/icon/mosaicMethodClosestToNadir32.json +1 -0
  23. package/assets/components/assets/icon/mosaicMethodFirst16.json +1 -0
  24. package/assets/components/assets/icon/mosaicMethodFirst24.json +1 -0
  25. package/assets/components/assets/icon/mosaicMethodFirst32.json +1 -0
  26. package/assets/components/assets/icon/mosaicMethodLast16.json +1 -0
  27. package/assets/components/assets/icon/mosaicMethodLast24.json +1 -0
  28. package/assets/components/assets/icon/mosaicMethodLast32.json +1 -0
  29. package/assets/components/assets/icon/mosaicMethodLockRaster16.json +1 -0
  30. package/assets/components/assets/icon/mosaicMethodLockRaster24.json +1 -0
  31. package/assets/components/assets/icon/mosaicMethodLockRaster32.json +1 -0
  32. package/assets/components/assets/icon/mosaicMethodMaximum16.json +1 -0
  33. package/assets/components/assets/icon/mosaicMethodMaximum24.json +1 -0
  34. package/assets/components/assets/icon/mosaicMethodMaximum32.json +1 -0
  35. package/assets/components/assets/icon/mosaicMethodMean16.json +1 -0
  36. package/assets/components/assets/icon/mosaicMethodMean24.json +1 -0
  37. package/assets/components/assets/icon/mosaicMethodMean32.json +1 -0
  38. package/assets/components/assets/icon/mosaicMethodMinimum16.json +1 -0
  39. package/assets/components/assets/icon/mosaicMethodMinimum24.json +1 -0
  40. package/assets/components/assets/icon/mosaicMethodMinimum32.json +1 -0
  41. package/assets/components/assets/icon/mosaicMethodNone16.json +1 -0
  42. package/assets/components/assets/icon/mosaicMethodNone24.json +1 -0
  43. package/assets/components/assets/icon/mosaicMethodNone32.json +1 -0
  44. package/assets/components/assets/icon/mosaicMethodNorthWest16.json +1 -0
  45. package/assets/components/assets/icon/mosaicMethodNorthWest24.json +1 -0
  46. package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -0
  47. package/assets/components/assets/icon/mosaicMethodSeamline16.json +1 -0
  48. package/assets/components/assets/icon/mosaicMethodSeamline24.json +1 -0
  49. package/assets/components/assets/icon/mosaicMethodSeamline32.json +1 -0
  50. package/assets/components/assets/icon/mosaicMethodSum16.json +1 -0
  51. package/assets/components/assets/icon/mosaicMethodSum24.json +1 -0
  52. package/assets/components/assets/icon/mosaicMethodSum32.json +1 -0
  53. package/assets/esri/core/workers/RemoteClient.js +1 -1
  54. package/assets/esri/core/workers/chunks/{b2f9f0767dadf185120c.js → 00612d6e05b1c8647668.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{d4d011eea16a89a5aad9.js → 0219c3f9408d3fa3c9a0.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{f54546c155fba2fd3a7e.js → 05d7d8ff3e4cbad32580.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 079434fe765c53d304f2.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{4f8782b3b6ad414409e8.js → 0a48b9734ab4c64a6f4f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{0eed612e82a279ac8d1e.js → 11b55e7e76e50fe11bbe.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{ccc50f28f217e50cc2c3.js → 1427e7953c3d8c87c5e8.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{184d7c8ea818bec5c462.js → 146b3699a9e8b1f2dcc2.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{8ba7d44eff348004f084.js → 1a6d2d090b643a87408a.js} +1 -1
  63. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +1 -0
  64. package/assets/esri/core/workers/chunks/{5e5225623977e61fd0ef.js → 213adc87c843d627c5d6.js} +1 -1
  65. package/assets/esri/core/workers/chunks/235efd948ae470a6f238.js +1 -0
  66. package/assets/esri/core/workers/chunks/{60d3b329e69f3cddb7f4.js → 265f69d153b7b6f07e42.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{769b66cca8347f0f84db.js → 279bbd61b32577693a4a.js} +1 -1
  68. package/assets/esri/core/workers/chunks/290b065b377f9d2ee058.js +1 -0
  69. package/assets/esri/core/workers/chunks/29d3245261a7223124ed.js +1 -0
  70. package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js → 30551c1d3e4fa7be86c1.js} +2 -2
  71. package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js.LICENSE.txt → 30551c1d3e4fa7be86c1.js.LICENSE.txt} +1 -1
  72. package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +1 -0
  73. package/assets/esri/core/workers/chunks/{78242f2bf742b33d99fa.js → 3795793643f4db64af0e.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js → 3cf001abca8ad933bccf.js} +2 -2
  75. package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js.LICENSE.txt → 3cf001abca8ad933bccf.js.LICENSE.txt} +1 -1
  76. package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js → 543eb46b55cacd6e1dbc.js} +2 -2
  77. package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js.LICENSE.txt → 543eb46b55cacd6e1dbc.js.LICENSE.txt} +1 -1
  78. package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js → 577f24923fa4d08360e4.js} +2 -2
  79. package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js.LICENSE.txt → 577f24923fa4d08360e4.js.LICENSE.txt} +1 -1
  80. package/assets/esri/core/workers/chunks/5958af341014e13475d2.js +1 -0
  81. package/assets/esri/core/workers/chunks/{f46c4a69ef2f763e905b.js → 5d63dfa5a60c88e03b28.js} +1 -1
  82. package/assets/esri/core/workers/chunks/60f7cd05e88701f43d3f.js +1 -0
  83. package/assets/esri/core/workers/chunks/{26e0a0a13060cd3e4291.js → 626ba3a7dee952308566.js} +1 -1
  84. package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +1 -0
  85. package/assets/esri/core/workers/chunks/7cd32b10ed0e18e44ef2.js +1 -0
  86. package/assets/esri/core/workers/chunks/7ffa68d69c138db1295d.js +1 -0
  87. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +319 -0
  88. package/assets/esri/core/workers/chunks/91f8547a13f0461045ef.js +1 -0
  89. package/assets/esri/core/workers/chunks/9661ee8569ee208e6237.js +1 -0
  90. package/assets/esri/core/workers/chunks/{c2f38c66fae2cdb57445.js → 96e5d192c8d23c1e324f.js} +1 -1
  91. package/assets/esri/core/workers/chunks/974742af7beb000c4b4a.js +1 -0
  92. package/assets/esri/core/workers/chunks/{e27fa1e84f16b7f19a90.js → 9850ff14bd9c7da81c65.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{796cf1c2ca9955595836.js → 9b2ab27159500315fbc1.js} +1 -1
  94. package/assets/esri/core/workers/chunks/{a276980c06d5d311a37e.js → 9f416cc5673665f8c37c.js} +1 -1
  95. package/assets/esri/core/workers/chunks/a0c51c4c30a5f749dfc6.js +1 -0
  96. package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +1 -0
  97. package/assets/esri/core/workers/chunks/{fdcbd28f38bc485ac5e3.js → ab6ecd8eeec5ff761b34.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js → ac9c6779771ec855da79.js} +2 -2
  99. package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js.LICENSE.txt → ac9c6779771ec855da79.js.LICENSE.txt} +1 -1
  100. package/assets/esri/core/workers/chunks/{ef6e805c49e1afdf966b.js → c054198c6438cb57f188.js} +1 -1
  101. package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
  102. package/assets/esri/core/workers/chunks/{5bdd5ae2d2f23ef6b331.js → c87e2a63b96e0da77dfe.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{601fc99426f0213b0769.js → cbec01223d51cdb9ee79.js} +1 -1
  104. package/assets/esri/core/workers/chunks/cc4dd739c4c7e3ccea3f.js +1 -0
  105. package/assets/esri/core/workers/chunks/{90c893959145827961ac.js → cd9343c78a7c3acdbbcd.js} +1 -1
  106. package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +1 -0
  107. package/assets/esri/core/workers/chunks/{26fcbe053194bd78fcc3.js → d8474dca270b25705699.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js → d8dc922f7466300b668f.js} +2 -2
  109. package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js.LICENSE.txt → d8dc922f7466300b668f.js.LICENSE.txt} +1 -1
  110. package/assets/esri/core/workers/chunks/{96cddbbeef61a4f33f29.js → db5913824d5e5a2a8365.js} +1 -1
  111. package/assets/esri/core/workers/chunks/{48a1bb1e171dd06a7c6e.js → dd94585508f49863dc15.js} +1 -1
  112. package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +2 -0
  113. package/assets/esri/core/workers/chunks/{02176f84d6d57f1bc1c8.js.LICENSE.txt → e524462c63834fae7e01.js.LICENSE.txt} +1 -1
  114. package/assets/esri/core/workers/chunks/{e7e987558cf017c62458.js → ebfa4a0334401f5e004a.js} +1 -1
  115. package/assets/esri/core/workers/chunks/{736a11e64e5f03e3936b.js → f2cef954b58c6604642c.js} +64 -64
  116. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  117. package/assets/esri/themes/dark/main.css +1 -1
  118. package/assets/esri/themes/light/main.css +1 -1
  119. package/assets/esri/themes/light/view.css +1 -1
  120. package/chunks/BloomBlur.glsl.js +7 -7
  121. package/chunks/BloomComposition.glsl.js +24 -25
  122. package/chunks/Bufferer-CicaNej1.js +1 -1
  123. package/chunks/Envelope.js +1 -1
  124. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  125. package/chunks/Geometry.js +1 -1
  126. package/chunks/OperatorGeodesicBuffer.js +1 -1
  127. package/chunks/OperatorGeodeticArea.js +1 -1
  128. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  129. package/chunks/OperatorGeodeticLength.js +1 -1
  130. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  131. package/chunks/OperatorProximityGeodesic.js +1 -1
  132. package/chunks/OperatorShapePreservingLength.js +1 -1
  133. package/chunks/OperatorShapePreservingProject.js +1 -1
  134. package/chunks/OperatorSimplifyOGC.js +5 -0
  135. package/chunks/Point2D.js +1 -1
  136. package/chunks/ProjectionTransformation.js +1 -1
  137. package/chunks/QuadraticBezier.js +1 -1
  138. package/chunks/cameraUtilsSpherical.js +1 -1
  139. package/chunks/languageUtils.js +1 -1
  140. package/chunks/relateOperator.js +1 -1
  141. package/chunks/sphere.js +1 -1
  142. package/chunks/vxlLayer.js +1 -1
  143. package/core/Collection.js +1 -1
  144. package/core/JSONSupport.js +1 -1
  145. package/core/SetUtils.js +1 -1
  146. package/{views/webgl/GLObjectType.js → core/support/jsonUtils.js} +1 -1
  147. package/core/urlUtils.js +1 -1
  148. package/geometry/Mesh.js +1 -1
  149. package/geometry/operators/extendOperator.js +1 -1
  150. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  151. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  152. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  153. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  154. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  155. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  156. package/geometry/operators/gx/operatorSimplifyOGC.js +5 -0
  157. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  158. package/geometry/operators/reshapeOperator.js +1 -1
  159. package/geometry/operators/simplifyOGCOperator.d.ts +6 -0
  160. package/geometry/operators/simplifyOGCOperator.js +5 -0
  161. package/geometry/operators/support/jsonConverter.js +1 -1
  162. package/geometry/support/normalizeUtilsSync.js +1 -1
  163. package/geometry/support/sphere.js +1 -1
  164. package/interfaces.d.ts +442 -113
  165. package/layers/DimensionLayer.js +1 -1
  166. package/layers/RouteLayer.js +1 -1
  167. package/layers/SubtypeGroupLayer.js +1 -1
  168. package/layers/ViewshedLayer.js +1 -1
  169. package/layers/graphics/data/QueryEngine.js +1 -1
  170. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  171. package/layers/orientedImagery/transformations/utils.js +1 -1
  172. package/layers/support/FieldsIndex.js +1 -1
  173. package/layers/support/VideoElement.js +1 -1
  174. package/layers/support/rasterDatasets/FunctionRaster.js +1 -1
  175. package/layers/support/rasterDatasets/TIFFRaster.js +1 -1
  176. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  177. package/layers/support/rasterFormats/{TiffTags.js → tiffTag.js} +1 -1
  178. package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
  179. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  180. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  181. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  182. package/layers/support/rasterFunctions/RemapFunction.js +1 -1
  183. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  184. package/layers/support/videoUtils.js +5 -0
  185. package/package.json +2 -2
  186. package/portal/schemas/definitions.js +1 -1
  187. package/renderers/UniqueValueRenderer.js +1 -1
  188. package/renderers/support/colorRampUtils.js +1 -1
  189. package/support/revision.js +1 -1
  190. package/symbols/IconSymbol3DLayer.js +1 -1
  191. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  192. package/versionManagement/utils.js +1 -1
  193. package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
  195. package/views/2d/engine/webgl/textureUtils.js +1 -1
  196. package/views/2d/layers/MediaLayerView2D.js +1 -1
  197. package/views/2d/layers/TileLayerView2D.js +1 -1
  198. package/views/2d/layers/support/DebugOverlay.js +1 -1
  199. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  200. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  201. package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
  202. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  203. package/views/3d/analysis/Viewshed/ViewshedAnalysisVisualization.js +1 -1
  204. package/views/3d/analysis/Viewshed/ViewshedVisualization.js +1 -1
  205. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  206. package/views/3d/camera/constraintUtils/distance.js +1 -1
  207. package/views/3d/camera/intersectionUtils.js +1 -1
  208. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  209. package/views/3d/environment/atmosphereUtils.js +1 -1
  210. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  211. package/views/3d/interactive/visualElements/EngineVisualElement.js +1 -1
  212. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  213. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  214. package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
  215. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  216. package/views/3d/interactive/visualElements/MarkerVisualElement.js +1 -1
  217. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  218. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  219. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  220. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  221. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  222. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  223. package/views/3d/interactive/visualElements/SlicePlaneVisualElement.js +1 -1
  224. package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
  225. package/views/3d/interactive/visualElements/ViewshedShapeVisualElement.js +1 -1
  226. package/views/3d/interactive/visualElements/VisualElement.js +1 -1
  227. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  228. package/views/3d/layers/I3SMeshView3D.js +1 -1
  229. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  230. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  231. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  232. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  233. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  234. package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +5 -0
  235. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  236. package/views/3d/state/ConstraintsManager.js +1 -1
  237. package/views/3d/state/NearFarHeuristic.js +1 -1
  238. package/views/3d/state/ViewState.js +1 -1
  239. package/views/3d/state/ViewStateManager.js +1 -1
  240. package/views/3d/state/utils/navigationUtils.js +1 -1
  241. package/views/3d/support/cameraUtilsSpherical.js +1 -1
  242. package/views/3d/support/geometryUtils/sphere.js +1 -1
  243. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  244. package/views/3d/webgl/ManagedDepthTexture.js +1 -1
  245. package/views/3d/webgl/ManagedFBO.js +1 -1
  246. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  247. package/views/3d/webgl-engine/core/FBOCacheFormats.js +5 -0
  248. package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +12 -14
  249. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +1 -1
  250. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  251. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  252. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  253. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  254. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  255. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  256. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  257. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  258. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  259. package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
  260. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  261. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  262. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  263. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  264. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  265. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  266. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  267. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  268. package/views/SceneView.js +1 -1
  269. package/views/VideoView.js +1 -1
  270. package/views/interactive/Tooltip.js +1 -1
  271. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  272. package/views/layers/LineOfSightLayerView.d.ts +4 -0
  273. package/views/layers/LineOfSightLayerView.js +5 -0
  274. package/views/webgl/FBOAttachmentType.js +5 -0
  275. package/views/webgl/FramebufferObject.js +1 -1
  276. package/views/webgl/Renderbuffer.js +1 -1
  277. package/views/webgl/RenderbufferDescriptor.js +1 -1
  278. package/views/webgl/Texture.js +1 -1
  279. package/views/webgl/TextureDescriptor.js +1 -1
  280. package/webscene/InitialViewProperties.js +1 -1
  281. package/webscene/Presentation.js +1 -1
  282. package/webscene/Slide.js +1 -1
  283. package/webscene/SlideLegendInfo.js +1 -1
  284. package/webscene/background/ColorBackground.js +1 -1
  285. package/webscene/spec-certification/api.js +1 -1
  286. package/webscene/spec-certification/compare.js +1 -1
  287. package/webscene/spec-certification/index.js +1 -1
  288. package/webscene/spec-certification/spec.js +1 -1
  289. package/webscene/spec-certification/utils.js +1 -1
  290. package/webscene/support/Description.js +1 -1
  291. package/webscene/support/SlideElements.js +1 -1
  292. package/webscene/support/SlideEnvironment.js +1 -1
  293. package/webscene/support/SlideGround.js +1 -1
  294. package/webscene/support/SlideVisibleLayer.js +1 -1
  295. package/webscene/support/Title.js +1 -1
  296. package/webscene/support/analysisUtils.js +5 -0
  297. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  298. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  299. package/widgets/Editor/EditorViewModel.js +1 -1
  300. package/widgets/Editor/UpdateWorkflow.js +1 -1
  301. package/widgets/Editor/support/SketchController.js +5 -0
  302. package/widgets/Editor/workflowUtils.js +1 -1
  303. package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
  304. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
  305. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  306. package/widgets/FeatureTable.js +1 -1
  307. package/widgets/LayerList/LayerListItem.js +1 -1
  308. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  309. package/widgets/Widget.js +1 -1
  310. package/widgets/support/SelectionList.js +1 -1
  311. package/widgets/support/SnappingControls.js +1 -1
  312. package/assets/esri/core/workers/chunks/02176f84d6d57f1bc1c8.js +0 -2
  313. package/assets/esri/core/workers/chunks/244d2196bac5ef279436.js +0 -1
  314. package/assets/esri/core/workers/chunks/32f2e0c88046b39916cc.js +0 -1
  315. package/assets/esri/core/workers/chunks/388a763da712ca71ccf4.js +0 -1
  316. package/assets/esri/core/workers/chunks/5ffc3ca6c6a4d32e1282.js +0 -1
  317. package/assets/esri/core/workers/chunks/642a595353a86f3717e3.js +0 -1
  318. package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +0 -1
  319. package/assets/esri/core/workers/chunks/873327fc41edd3830afa.js +0 -319
  320. package/assets/esri/core/workers/chunks/93e9dfd1ba8f393c6c47.js +0 -1
  321. package/assets/esri/core/workers/chunks/95379fdd6917c8a84c71.js +0 -1
  322. package/assets/esri/core/workers/chunks/9b21dc4659922cc577cb.js +0 -1
  323. package/assets/esri/core/workers/chunks/a197c86d42cc9ce21924.js +0 -1
  324. package/assets/esri/core/workers/chunks/d81bebbb6fe000200d35.js +0 -1
  325. package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +0 -1
  326. package/assets/esri/core/workers/chunks/dd8e72d6784a8ebc115d.js +0 -1
  327. package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +0 -1
  328. package/assets/esri/core/workers/chunks/e9fba86036b8fe700a41.js +0 -1
  329. package/views/3d/webgl/formats.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as l}from"../../../core/maybe.js";import d from"../../../core/PooledArray.js";import{ignoreAbortErrors as h,isAbortError as c,throwIfAborted as u,createResolver as _}from"../../../core/promiseUtils.js";import{initial as m,watch as f}from"../../../core/reactiveUtils.js";import{schedule as g}from"../../../core/scheduling.js";import{equals as p}from"../../../core/SetUtils.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{property as b}from"../../../core/accessorSupport/decorators/property.js";import{subclass as I}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as v,invert as C}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as w,getTranslation as x}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as R,create as E}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as O}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as j,t as S,q as A,a as D,g as T,h as F,d as N,H as V}from"../../../chunks/vec32.js";import{create as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as H}from"../../../chunks/vec42.js";import{fromValues as U}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as G}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as L}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as B}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as q}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as W}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as $,toRect as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as X,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as J}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{a as te,f as ie,g as se}from"../../../chunks/sphere.js";import{newUByteArray as re}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as oe}from"../../../layers/LayerConstants.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import le from"../../../layers/support/SceneModification.js";import{getColor as de,getOpacity as he}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as ce}from"../../../support/basemapUtils.js";import{getElevationOffset as ue}from"../../../support/elevationInfoUtils.js";import{isQuery as _e}from"../../../support/guards.js";import{loadArcade as me}from"../../../support/loadArcade.js";import fe from"../../../symbols/MeshSymbol3D.js";import ge from"../../../symbols/SimpleFillSymbol.js";import pe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as ye}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as be,toWasmModification as Ie}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ve,ForAllFeaturesReturnType as Ce,ForAllFeaturesMode as Me}from"./II3SMeshView3D.js";import{initialize as we,setModificationsSync as xe,filterObbsForModificationsSync as Re,interpretObbModificationResults as Ee}from"./SceneLayerWorker.js";import{overrideColor as Oe}from"./graphics/graphicUtils.js";import{areLabelsVisible as je}from"./graphics/Labeler.js";import{TextureUsage as Se,TextureEncoding as Ae}from"./i3s/enums.js";import De from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Te}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Fe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Ne,NodeCrossfadeMetaData as Ve}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Pe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as He}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ue,selectEncoding as ke,defaultMaterial as Ge,createTexture as Le,configureMaterial as Be}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as qe,NodeState as We}from"./i3s/I3SNode.js";import{I3SOverrides as ze}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as $e,checkSceneLayerValid as Qe,checkSceneLayerCompatibleWithView as Xe,whenGraphicAttributes as Ye,computeVisibilityObb as Je,filterInPlace as Ze,intersectBoundingRectWithMbs as et,MbsIntersectResult as tt,addWraparound as it,getSymbolInfo as st,transparentEdgeMaterial as rt,getClipRect as ot}from"./i3s/I3SUtil.js";import{IDBCache as at}from"./i3s/IDBCache.js";import{IDBMockCache as nt}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as lt}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as dt}from"./i3s/SymbologyInfo.js";import{attributeLookup as ht}from"./support/attributeUtils.js";import{emptyHighlightHandle as ct,normalizeHighlightTargetExceptQuery as ut}from"./support/highlightUtils.js";import{makeScheduleFunction as _t}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as mt}from"./support/symbolColorUtils.js";import{debugFlags as ft}from"../support/debugFlags.js";import{ElevationRange as gt}from"../support/ElevationRange.js";import{toBoundingRect as pt}from"../support/extentUtils.js";import{Obb as yt}from"../support/orientedBoundingBox.js";import{updatingProgress as bt}from"../support/updatingProperties.js";import{glLayout as It}from"../support/buffer/glUtil.js";import{ObjectParameters as vt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as Ct,GeometryParameters as Mt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as wt}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as xt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as Rt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as Et}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Ot}from"../../support/HighlightDefaults.js";import{alphaCutoff as jt}from"../../../webscene/support/AlphaCutoff.js";const St="esri.views.3d.layers.I3SMeshView3D",At=()=>a.getLogger(St),Dt=[1,1,1,1];class Tt extends Ve{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var Ft;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(Ft||(Ft={}));const Nt=26,Vt=100*o.MEGABYTES,Pt=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Ne(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>jt}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return $e(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?Se.AllTexturesPBR:Se.AllTextures:this._usePBR||this._hasLoadedPBRTextures?Se.GeometryTexturesPBR:Se.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ue(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new ei(ve.Absolute,0);const t=ue(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new ei(ve.Absolute,t);case"relative-to-ground":return new ei(ve.RelativeToGround,t);case"on-the-ground":return new ei(ve.OnTheGround,0);default:return new ei(ve.Absolute,0)}}get supportedTextureEncodings(){return Ue(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new gt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new nt(this.view,e):new at("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new ze({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new be(_t(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(h)),Qe(this.i3slayer),Xe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new ae({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const a=this._controller,n=this._nodeId2Meta,d=this._nodeId2MetaReloading,c=e=>{const t=a.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=n.get(i)||d.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new He({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new lt({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),m),this._updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this._updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),m),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ve.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),si):t&&this.removeHandles(si)}),m),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const u=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),u),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),m),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),m),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),m),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),m),this.addHandles([f((()=>ft.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ft.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ft.I3S_TREE_SHOW_TILES||(this._treeDebugger=l(this._treeDebugger))}),m),f((()=>ft.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),m)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>At().warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:_}=this,{viewingMode:g,renderCoordsHelper:p}=_;this._planetRadiusInGlobalMode="local"===g?0:p.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=l(this._elevationTask),this.i3sOverrides=l(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=l(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=l(this._labeler),this._treeDebugger=l(this._treeDebugger),this._controller=l(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=l(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=l(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=null!=t?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=null!=t?t.node.memory:0)),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(je(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new pe({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach((t=>null!=t&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=we().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=Ie(this._layerClippingArea,this._modifications,t);xe({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new d:null;this._nodeId2Meta.forEach(((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==qe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!ft.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new ge({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{c(e)||At().warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Ae.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&Rt()}_getVertexBufferLayout(e,t){return It(Ct(this._getGeometryParameters({hasTexture:zt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||oe}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=ht(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ht(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Pe(t,this._collection,s,J(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return q(r,o,0,r,a,0)?$(r):null}whenGraphicAttributes(e,t){return Ye(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${Nt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return oi;if(e===G(e))return ai;return this.i3slayer.spatialReference.equals(e)?ri:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=ke(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=yt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Qt(s.transformedGeometry,s.textureData),s.textureData.every($t)&&Xt(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>At().warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),u(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Kt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,anchorIds:n,anchors:l,transformedGeometry:d,globalTrafo:h}=s,c=j(ti,r.center.x,r.center.y,r.center.z);S(c,c,h);const u=new yt(c,[r.extents.x,r.extents.y,r.extents.z],O(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=n,t.geometryData.anchors=l;const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:d,globalTrafo:h,geometryObbData:u.data,byteSize:Qt(d,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&Xt(e,_)){const t=null!=_.textureData?_.textureData.map((e=>$t(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{..._,textureData:t}).catch((t=>At().warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new gt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?di(t,r,l):null!=d&&d[3]>=0&&hi(t,d,l),!1;const m=li;if(m.elevationRangeMin=1/0,m.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?di(m,r,l):null!=d&&hi(m,d,l),m.elevationRangeMin>=t.elevationRangeMin&&m.elevationRangeMax<=t.elevationRangeMax))return!1;const f=o.get(i.index);if(f){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return di(t,s,l),!1}const{objectHandle:e}=f,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(f?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Je(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let g=0;g<s.length;++g)r[g]=this._getVertexBufferLayout(s[g],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Ke(n,l,a,d,c),_=W(d,h),m=W(h,c);if(null==_||null==m)return Promise.resolve(null);const f={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(f,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ve.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const n=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>null!=e&&(e.encoding===Ae.Basis||e.encoding===Ae.KTX2)))&&await Rt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:f,indices:g,interleavedVertexData:p,positionData:y,hasColors:b}=o,{material:I,geometryParameters:O}=this._materialParameters(m,f),j=l||new Uint32Array([0,g?g.length:p.byteLength/f[0].stride]),S={vertices:{data:p,count:p.byteLength/f[0].stride,layoutParameters:O},positionData:{positions:Z(y.data),indices:ee(y.indices)},indices:g,componentOffsets:j},T=m.transformation?R(m.transformation):E();w(T,a,T);const F=x(P(),T),N=v(M(),T),V=this.view.renderSpatialReference,H=this.view.basemapTerrain.spatialReference,k=yt.fromData(t.geometryObbData).center,G=[1,1,1];L(k,V,G,H)||At().errorOnce("Unsupported coordinate system for IM overlay");const B=P();z(k,V,B,H);const q=M();C(q,N);const W=P();A(W,D(W,k,F),q);const K=B[0]-W[0]*G[0],$=B[1]-W[1]*G[1],Q=_.createObject(new vt(U(K,$,G[0],G[1]),new wt(F,N),yt.fromData(t.geometryObbData),S)),X=O.textureCoordinates===xt.Atlas,{textures:Y,texturePromise:J}=this._initMaterialAndTextures(Q,I,n,X);e.memory+=this._memEstimateGeometryAdded(Q),e.memory+=Y.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const te=!!I.hasParametersFromSource,ie="blend"!==I.alphaMode&&I.metallicRoughness.baseColorFactor[3]>=1,se=new Tt(e,h,Q,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:te,isOpaque:ie},Y,c,u);s.meta=se,this._hasTextures||=t.requiredTextures?.some((({usage:e})=>!!(e&Se.ColorTextures))),this._hasData=!0,this._hasColors||=b,this._hasTextures||=!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const re=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(se),J]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(se.objectHandle,!1).catch((e=>Ht(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,se),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Q,!0),t?.updateObjectVisibility(se.objectHandle,!0).catch((e=>Ht(e,this.i3slayer.title))),se.attributeInfo=i.attributeInfo;const s=se.cachedRendererVersion!==this._rendererVersion,r=re!==this.slicePlaneEnabled;this._updateElevationOffsets(se);const o=se.elevationOffsets;this._updateComponentData(se);const a=this._applyFiltersToNode(se);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(se),null!=this._labeler&&this._addMetaToLabeler(this._labeler,se),this._visibleGeometryChanged(se,Ut.ADD),this._highlights.objectCreated(se),this._updateMaterial(se),this._setNewNodeOpacity(se),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){At().error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Zt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ve.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=ti,d=ii,h=a===ve.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=J(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(j(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),T(l,l,te(e.node.serviceMbsInIndexSR)),z(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),j(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),A(l,l,n.rotationScale),T(l,l,n.position),s[a+2]=c.getAltitude(l),z(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),m=s.offset,f=e.elevationOffsets,g=(e,t)=>{const i=h?_[3*e+2]:0;f[e]=m+(t??0)-i};r.getElevations(_,u,g)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Te(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ve.Absolute,s=!!t&&t!==e&&t.mode!==ve.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Ut.UPDATE),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return u(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Ge(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=zt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Le(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Be(e,t,o,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new Mt(this._hasVertexColors,e.hasTexture?e.hasRegions?xt.Atlas:xt.Default:xt.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=_();s=new Jt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))}return s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=X();this._renderClippingArea=pt(this.view.clippingArea,i,e)?i:null;const s=X();this._layerClippingArea=pt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=fi(this._nodeId2Meta.values()),this._filteredIdCounts=fi(this._nodeId2Meta.values(),mi.Filtered),this._weaklyRemovedIdCounts=fi(this._nodeId2Meta.values(),mi.WeaklyRemoved),this.addHandles(f((()=>this._controller.updating),(e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())}),{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,_i(this._featureIdCounts,e.featureIds,t),_i(this._filteredIdCounts,e.filteredIds,t),_i(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,_i(this._filteredIdCounts,t,-1),_i(this._filteredIdCounts,e.filteredIds,1),_i(this._weaklyRemovedIdCounts,i,-1),_i(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&At().error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=fi(this._nodeId2Meta.values());n(this._featureIdCounts,t)||At().error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=fi(this._nodeId2Meta.values(),mi.Filtered);n(this._filteredIdCounts,i)||At().error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=fi(this._nodeId2Meta.values(),mi.WeaklyRemoved);n(this._weaklyRemovedIdCounts,s)||At().error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}p(e,this._mismatchShow)&&p(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach((e=>{if(!e?.filteredIds)return;const t=ui(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,Ut.UPDATE)})))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Ut.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Ze(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Fe(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Wt,this.view.renderSpatialReference),et(t,Wt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,kt),Q(kt,Gt),Y(i,Gt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===tt.INSIDE)return;if(r===tt.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Lt,i,t.objectHandle);Ze(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Zt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>Ht(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>Ht(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>Ht(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const t=e.filteredIds,i=e.weaklyRemovedIds;return!!this._applyFiltersToNodeComponents(e)&&(this._updateFilteredIdCounts(e,t,i),this._labeler?.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=ci(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every((e=>!this._mismatchHide?.has(e)))))return!r;const o=ui(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=l(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>Ht(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Ut.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===We.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=it(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return it(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=it(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await me()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:At().warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&At().error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;H(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,a=ce(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!a,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=t[r+4]&(1<<Ft.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<Ft.CastShadows),s.pickable=!!(t[r+4]&1<<Ft.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof fe))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=st(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?ne(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=re(5*e.featureIds.length));const d=new dt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=Et.OPAQUE,m=rt,f=0;for(let g=0;g<e.featureIds.length;g++){if(null!=o&&(i[o]=e.featureIds[g]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Fe(l[e],g);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=de(this._colorVariable,t,{color:qt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=he(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Oe(h,p,e.color,e.alpha,Dt,d.color):Oe(h,p,null,null,Dt,d.color)}if(h??=H(d.color,1,1,1,1),d.colorMixMode=r?.material?.colorMixMode??mt.Multiply,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=mt.Replace),d.pickable&&=h[3]>=jt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===mt.Replace)?Et.OPAQUE:Et.TRANSPARENT;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[g]=m}else e.cachedEdgeMaterials[g]=rt;e.cachedSymbology[f++]=Math.round(255*h[0]),e.cachedSymbology[f++]=Math.round(255*h[1]),e.cachedSymbology[f++]=Math.round(255*h[2]),e.cachedSymbology[f++]=Math.round(255*h[3]),e.cachedSymbology[f++]=d.colorMixMode|+d.castShadows<<Ft.CastShadows|+d.pickable<<Ft.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Zt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==rt)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?rt:(r=r||t!==rt,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Zt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Ut.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?Ce.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s.node.serviceMbsInIndexSR)){case Ce.EXIT:return;case Ce.SKIP:continue}}let r=Ce.CONTINUE;switch(i){case Me.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Me.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Me.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===Ce.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=Ce.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===Ce.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=Ce.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===Ce.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===tt.OUTSIDE)return Ce.CONTINUE;if(s===tt.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=Ce.CONTINUE,o=e.featureIds,a=e.objectHandle,n=ot(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===Ce.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Fe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(_e(e))return ct;const s=ut(e);if(0===s.length)return ct;const r=t?.name??Ot,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return ct;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>ht(t,e.attributes,i)))}resetHighlights(){l(this._highlights),this._highlights=new De({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Me.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=g((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new ye(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Zt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>Ht(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Yt(e);if(s){const t={context:i,buffer:s.buffer};Re(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Ee(i);e.imModificationImpact=s,s!==qe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running||this._needFilterResolve}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ve.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=P(),n=P(),l=(e,t)=>{T(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),T(e,e,F(n,n,t)),N(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Ut.REMOVE&&t!==Ut.UPDATE||r.events.remove(i),t!==Ut.ADD&&t!==Ut.UPDATE||r.events.add(i,s)}};return e([b()],o.prototype,"_hasLoadedPBRTextures",void 0),e([b()],o.prototype,"_asyncModuleLoading",void 0),e([b()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([b()],o.prototype,"view",void 0),e([b()],o.prototype,"i3slayer",void 0),e([b()],o.prototype,"_controller",void 0),e([b()],o.prototype,"_labeler",void 0),e([b()],o.prototype,"updating",void 0),e([b()],o.prototype,"suspended",void 0),e([b()],o.prototype,"contentVisible",null),e([b({readOnly:!0})],o.prototype,"legendEnabled",null),e([b()],o.prototype,"holeFilling",void 0),e([b(bt)],o.prototype,"updatingProgress",void 0),e([b()],o.prototype,"updatingProgressValue",null),e([b()],o.prototype,"hasTexturesOrVertexColors",null),e([b()],o.prototype,"rendererTextureUsage",null),e([b()],o.prototype,"elevationOffset",null),e([b()],o.prototype,"elevationInfo",null),e([b({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([b()],o.prototype,"supportedTextureEncodings",null),e([b({type:[le]})],o.prototype,"_modifications",void 0),e([b({readOnly:!0})],o.prototype,"clientGeometry",null),e([b()],o.prototype,"elevationRange",null),e([b()],o.prototype,"fullExtent",null),e([b()],o.prototype,"_elevationTask",void 0),e([b({readOnly:!0})],o.prototype,"_usePBR",null),o=e([I(St)],o),o};function Ht(e,t){c(e)||At().warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Ut;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Ut||(Ut={}));const kt=K(),Gt=X(),Lt=X(),Bt=new yt,qt=new t([0,0,0,0]),Wt=ie(0,0,0,0);function zt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Kt(e){return"geometryData"in e}function $t(e){return null!=e&&y(e.data)}function Qt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&y(s.data)&&(i+=s.data.byteLength);return i}function Xt(e,t){return t.byteSize>Vt?(At().warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Yt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll((e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Bt,t.center=te(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class Jt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Zt(e,t){e.forEach((e=>e.opacity=t))}class ei{constructor(e,t){this.mode=e,this.offset=t}}const ti=P(),ii=K(),si="elevation-change",ri="",oi="@null",ai="@ECEF",ni=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],li=new gt;function di(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(ni);for(const e of ni){const t=V(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(ni);for(const e of ni){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function hi(e,t,i){const s=te(t),r=i>0?V(s)-i:s[2],o=se(t);e.expandElevationRangeValues(r-o,r+o)}function ci(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function ui(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach(((e,a)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(a)}))}}else e.featureIds.forEach(((e,t)=>{r[s.length]===e&&s.push(t)}));return s}function _i(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}var mi;function fi(e,t=mi.All){const i=new Map;for(const s of e){_i(i,t===mi.All?s?.featureIds:t===mi.Filtered?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}!function(e){e[e.All=0]="All",e[e.Filtered=1]="Filtered",e[e.WeaklyRemoved=2]="WeaklyRemoved"}(mi||(mi={}));export{Pt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as l}from"../../../core/maybe.js";import d from"../../../core/PooledArray.js";import{ignoreAbortErrors as h,isAbortError as c,throwIfAborted as u,createResolver as _}from"../../../core/promiseUtils.js";import{initial as g,watch as m}from"../../../core/reactiveUtils.js";import{schedule as f}from"../../../core/scheduling.js";import{equals as p}from"../../../core/SetUtils.js";import{isArrayBuffer as y}from"../../../core/typedArrayUtil.js";import{property as b}from"../../../core/accessorSupport/decorators/property.js";import{subclass as I}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as v,invert as C}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as w,getTranslation as E}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as R}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as O}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as j,t as S,q as A,a as D,g as T,h as F,d as V,H as N}from"../../../chunks/vec32.js";import{create as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as H}from"../../../chunks/vec42.js";import{fromValues as U}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as k}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as L}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as B}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as q}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as W}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as $,toRect as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as X,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as J}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Z}from"../../../geometry/support/FloatArray.js";import{compactIndices as ee}from"../../../geometry/support/Indices.js";import{a as te,f as ie,g as se}from"../../../chunks/sphere.js";import{newUByteArray as re}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as oe}from"../../../layers/LayerConstants.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import le from"../../../layers/support/SceneModification.js";import{getColor as de,getOpacity as he}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as ce}from"../../../support/basemapUtils.js";import{getElevationOffset as ue}from"../../../support/elevationInfoUtils.js";import{isQuery as _e}from"../../../support/guards.js";import{loadArcade as ge}from"../../../support/loadArcade.js";import me from"../../../symbols/MeshSymbol3D.js";import fe from"../../../symbols/SimpleFillSymbol.js";import pe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as ye}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as be,toWasmModification as Ie}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ve,ForAllFeaturesReturnType as Ce,ForAllFeaturesMode as Me}from"./II3SMeshView3D.js";import{initialize as we,setModificationsSync as Ee,filterObbsForModificationsSync as xe,interpretObbModificationResults as Re}from"./SceneLayerWorker.js";import{overrideColor as Oe}from"./graphics/graphicUtils.js";import{areLabelsVisible as je}from"./graphics/Labeler.js";import{TextureUsage as Se,TextureEncoding as Ae}from"./i3s/enums.js";import De from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Te}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Fe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Ve,NodeCrossfadeMetaData as Ne}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Pe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as He}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ue,selectEncoding as ke,defaultMaterial as Le,createTexture as Ge,configureMaterial as Be}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as qe,NodeState as We}from"./i3s/I3SNode.js";import{I3SOverrides as ze}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as Ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as $e,checkSceneLayerValid as Qe,checkSceneLayerCompatibleWithView as Xe,whenGraphicAttributes as Ye,computeVisibilityObb as Je,filterInPlace as Ze,intersectBoundingRectWithMbs as et,MbsIntersectResult as tt,addWraparound as it,getSymbolInfo as st,transparentEdgeMaterial as rt,getClipRect as ot}from"./i3s/I3SUtil.js";import{IDBCache as at}from"./i3s/IDBCache.js";import{IDBMockCache as nt}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as lt}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as dt}from"./i3s/SymbologyInfo.js";import{attributeLookup as ht}from"./support/attributeUtils.js";import{emptyHighlightHandle as ct,normalizeHighlightTargetExceptQuery as ut}from"./support/highlightUtils.js";import{makeScheduleFunction as _t}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as gt}from"./support/symbolColorUtils.js";import{debugFlags as mt}from"../support/debugFlags.js";import{ElevationRange as ft}from"../support/ElevationRange.js";import{toBoundingRect as pt}from"../support/extentUtils.js";import{Obb as yt}from"../support/orientedBoundingBox.js";import{updatingProgress as bt}from"../support/updatingProperties.js";import{glLayout as It}from"../support/buffer/glUtil.js";import{ObjectParameters as vt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as Ct,GeometryParameters as Mt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as wt}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as Et}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as xt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as Rt}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Ot}from"../../support/HighlightDefaults.js";import{alphaCutoff as jt}from"../../../webscene/support/AlphaCutoff.js";const St=[1,1,1,1];class At extends Ne{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var Dt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(Dt||(Dt={}));const Tt=26,Ft=100*o.MEGABYTES,Vt=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new k,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._needFilterResolve=!1,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Ve(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get _isIntegratedMesh(){return"integrated-mesh"===this.i3slayer.type}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>jt}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return $e(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?Se.AllTexturesPBR:Se.AllTextures:this._usePBR||this._hasLoadedPBRTextures?Se.GeometryTexturesPBR:Se.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ue(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Xt(ve.Absolute,0);const t=ue(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Xt(ve.Absolute,t);case"relative-to-ground":return new Xt(ve.RelativeToGround,t);case"on-the-ground":return new Xt(ve.OnTheGround,0);default:return new Xt(ve.Absolute,0)}}get supportedTextureEncodings(){return Ue(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new ft;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new nt(this.view,e):new at("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new ze({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new be(_t(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(h)),Qe(this.i3slayer),Xe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new ae({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const n=this._controller,d=this._nodeId2Meta,c=this._nodeId2MetaReloading,u=e=>{const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=d.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new He({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:u}),this._elevationProvider=new lt({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),g),this._updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this._updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),g),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ve.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),Zt):t&&this.removeHandles(Zt)}),g),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const _=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),_),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),g),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),g),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),g),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),g),this.addHandles([m((()=>mt.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&mt.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||mt.I3S_TREE_SHOW_TILES||(this._treeDebugger=l(this._treeDebugger))}),g),m((()=>mt.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),g)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>a.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:f}=this,{viewingMode:p,renderCoordsHelper:y}=f;this._planetRadiusInGlobalMode="local"===p?0:y.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=l(this._elevationTask),this.i3sOverrides=l(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=l(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=l(this._labeler),this._treeDebugger=l(this._treeDebugger),this._controller=l(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=l(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=l(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=null!=t?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=null!=t?t.node.memory:0)),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(je(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new pe({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides,layerViewUid:this.uid});this._nodeId2Meta.forEach((t=>null!=t&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=we().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=Ie(this._layerClippingArea,this._modifications,t);Ee({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new d:null;this._nodeId2Meta.forEach(((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._updateFeatureIdCounts(e,-1),this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==qe.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._updateFeatureIdCounts(t,-1),this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!mt.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=[];for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new fe({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{c(e)||a.getLogger(this).warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.appliedFilters=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Ae.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&xt()}_getVertexBufferLayout(e,t){return It(Ct(this._getGeometryParameters({hasTexture:Bt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||oe}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=ht(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=ht(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Pe(t,this._collection,s,J(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return q(r,o,0,r,a,0)?$(r):null}whenGraphicAttributes(e,t){return Ye(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${Tt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return ti;if(e===L(e))return ii;return this.i3slayer.spatialReference.equals(e)?ei:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=ke(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=yt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=zt(s.transformedGeometry,s.textureData),s.textureData.every(Wt)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>a.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),u(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return qt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:n,anchorIds:l,anchors:d,transformedGeometry:h,globalTrafo:c}=s,u=j(Yt,r.center.x,r.center.y,r.center.z);S(u,u,c);const _=new yt(u,[r.extents.x,r.extents.y,r.extents.z],O(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=o,n&&(t.geometryData.featureIds=Array.from(n)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const g={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:zt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,g)){const t=null!=g.textureData?g.textureData.map((e=>Wt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{...g,textureData:t}).catch((t=>a.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,g,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new ft,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?oi(t,r,l):null!=d&&d[3]>=0&&ai(t,d,l),!1;const g=ri;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?oi(g,r,l):null!=d&&ai(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return oi(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Je(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let f=0;f<s.length;++f)r[f]=this._getVertexBufferLayout(s[f],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=Ke(n,l,a,d,c),_=W(d,h),g=W(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:g};return this._worker.invoke(m,i)}get _supportsNodeCrossFading(){return!this.view?.stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===ve.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ve.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const l=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&l.some((e=>null!=e&&(e.encoding===Ae.Basis||e.encoding===Ae.KTX2)))&&await xt(),e.memory=0;const{componentOffsets:d,geometries:h,featureIds:c,anchorIds:u,anchors:_}=r,g=this._collection,m=h[0],{layout:f,indices:p,interleavedVertexData:y,positionData:b,hasColors:I}=o,{material:O,geometryParameters:j}=this._materialParameters(m,f),S=d||new Uint32Array([0,p?p.length:y.byteLength/f[0].stride]),T={vertices:{data:y,count:y.byteLength/f[0].stride,layoutParameters:j},positionData:{positions:Z(b.data),indices:ee(b.indices)},indices:p,componentOffsets:S},F=m.transformation?x(m.transformation):R();w(F,n,F);const V=E(P(),F),N=v(M(),F),H=this.view.renderSpatialReference,k=this.view.basemapTerrain.spatialReference,L=yt.fromData(t.geometryObbData).center,B=[1,1,1];G(L,H,B,k)||a.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const q=P();z(L,H,q,k);const W=M();C(W,N);const K=P();A(K,D(K,L,V),W);const $=q[0]-K[0]*B[0],Q=q[1]-K[1]*B[1],X=g.createObject(new vt(U($,Q,B[0],B[1]),new wt(V,N),yt.fromData(t.geometryObbData),T)),Y=j.textureCoordinates===Et.Atlas,{textures:J,texturePromise:te}=this._initMaterialAndTextures(X,O,l,Y);e.memory+=this._memEstimateGeometryAdded(X),e.memory+=J.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const ie=!!O.hasParametersFromSource,se="blend"!==O.alphaMode&&O.metallicRoughness.baseColorFactor[3]>=1,re=new At(e,c,X,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ie,isOpaque:se},J,u,_);s.meta=re,this._hasTextures||=t.requiredTextures?.some((({usage:e})=>!!(e&Se.ColorTextures))),this._hasData=!0,this._hasColors||=I,this._hasTextures||=!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const oe=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(re),te]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(re.objectHandle,!1).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,re),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(X,!0),t?.updateObjectVisibility(re.objectHandle,!0).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),re.attributeInfo=i.attributeInfo;const s=re.cachedRendererVersion!==this._rendererVersion,r=oe!==this.slicePlaneEnabled;this._updateElevationOffsets(re);const o=re.elevationOffsets;this._updateComponentData(re);const a=this._applyFiltersToNode(re);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(re),null!=this._labeler&&this._addMetaToLabeler(this._labeler,re),this._visibleGeometryChanged(re,Nt.ADD),this._highlights.objectCreated(re),this._updateMaterial(re),this._setNewNodeOpacity(re),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){a.getLogger(this).error("Removing duplicated node");const t=this._nodeId2Meta.get(e);t&&(this._deleteComponentObject(t),this._updateFeatureIdCounts(t,-1))}else this._controller.updateLoadStatus(e,!0);t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Qt(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ve.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Yt,d=Jt,h=a===ve.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=J(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(j(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),T(l,l,te(e.node.serviceMbsInIndexSR)),z(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),j(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),A(l,l,n.rotationScale),T(l,l,n.position),s[a+2]=c.getAltitude(l),z(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),g=s.offset,m=e.elevationOffsets,f=(e,t)=>{const i=h?_[3*e+2]:0;m[e]=g+(t??0)-i};r.getElevations(_,u,f)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Te(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ve.Absolute,s=!!t&&t!==e&&t.mode!==ve.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Nt.UPDATE),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return u(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Le(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Bt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ge(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Be(e,t,o,i,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new Mt(this._hasVertexColors,e.hasTexture?e.hasRegions?Et.Atlas:Et.Default:Et.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=_();s=new $t(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))}return s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=X();this._renderClippingArea=pt(this.view.clippingArea,i,e)?i:null;const s=X();this._layerClippingArea=pt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e),this._assertFeatureIdNodeCounts(e)}_assertFeatureIdNodeCounts(e){e&&!this._featureIdCounts?(this._featureIdCounts=ci(this._nodeId2Meta.values()),this._filteredIdCounts=ci(this._nodeId2Meta.values(),hi.Filtered),this._weaklyRemovedIdCounts=ci(this._nodeId2Meta.values(),hi.WeaklyRemoved),this.addHandles(m((()=>this._controller.updating),(e=>{!e&&this._needFilterResolve&&(this.multiGeometryFilterResolve(),this._needFilterResolve=!1,this.notifyUpdate())}),{sync:!0}),"updateFinished")):!e&&this._featureIdCounts&&(this._featureIdCounts=null,this._filteredIdCounts=null,this._weaklyRemovedIdCounts=null,this._mismatchShow=null,this._mismatchHide=null,this.removeHandles("updateFinished"),this._needFilterResolve=!1,this.notifyUpdate())}_updateFeatureIdCounts(e,t){this._featureIdCounts&&(this._needFilterResolve=!0,di(this._featureIdCounts,e.featureIds,t),di(this._filteredIdCounts,e.filteredIds,t),di(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,di(this._filteredIdCounts,t,-1),di(this._filteredIdCounts,e.filteredIds,1),di(this._weaklyRemovedIdCounts,i,-1),di(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&a.getLogger(this).error("checkFeatureIdNodeCountInvariant()","LayerView should have feature id node counts if and only if it has a geometry filter",{layerView:this,hasNodeCounts:e}),!this._featureIdCounts||!this._filteredIdCounts)return;const t=ci(this._nodeId2Meta.values());n(this._featureIdCounts,t)||a.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ci(this._nodeId2Meta.values(),hi.Filtered);n(this._filteredIdCounts,i)||a.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ci(this._nodeId2Meta.values(),hi.WeaklyRemoved);n(this._weaklyRemovedIdCounts,s)||a.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _weaklyRemovedIdCounts",{layerView:this,counts:this._weaklyRemovedIdCounts,expected:i})}multiGeometryFilterResolve(){if(!this._featureIdCounts||!this._filteredIdCounts)return;let e=null,t=null;for(const[i,s]of this._filteredIdCounts){const r=this._featureIdCounts.get(i);if(r!==s){s+(this._weaklyRemovedIdCounts?.get(i)??0)===r?(e??=new Set,e.add(i)):(t??=new Set,t.add(i))}}p(e,this._mismatchShow)&&p(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach((e=>{if(!e?.filteredIds)return;const t=li(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,Nt.UPDATE)})))}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Nt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Ze(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Fe(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Gt,this.view.renderSpatialReference),et(t,Gt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Pt),Q(Pt,Ht),Y(i,Ht)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===tt.INSIDE)return;if(r===tt.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Ut,i,t.objectHandle);Ze(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Qt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const t=e.filteredIds,i=e.weaklyRemovedIds;return!!this._applyFiltersToNodeComponents(e)&&(this._updateFilteredIdCounts(e,t,i),this._labeler?.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(null!=e.filteredIds&&e.appliedFilters===this._filters||(e.weaklyRemovedIds=null,e.filteredIds=ni(e,this._filters),e.appliedFilters=this._filters),s&&e.filteredIds===e.featureIds&&(!this._mismatchHide||e.filteredIds.every((e=>!this._mismatchHide?.has(e)))))return!r;const o=li(e,this._mismatchShow,this._mismatchHide);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=l(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>this._logEdgeViewError(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Nt.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._updateFeatureIdCounts(s,-1),this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===We.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=it(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return it(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=it(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await ge()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:a.getLogger(this).warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&a.getLogger(this).error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;H(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=this.sublayerId?`${this.layerViewUid}_${this.sublayerId}`:this.layerViewUid,a=ce(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!a,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=t[r+4]&(1<<Dt.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<Dt.CastShadows),s.pickable=!!(t[r+4]&1<<Dt.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof me))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=st(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?ne(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=re(5*e.featureIds.length));const d=new dt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=Rt.OPAQUE,g=rt,m=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Fe(l[e],f);const r=s?this._getSymbolInfo(s,t):null;let h,p;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=de(this._colorVariable,t,{color:Lt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(p=e.a))}this._opacityVariable&&(p=he(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?Oe(h,p,e.color,e.alpha,St,d.color):Oe(h,p,null,null,St,d.color)}if(h??=H(d.color,1,1,1,1),d.colorMixMode=r?.material?.colorMixMode??gt.Multiply,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=gt.Replace),d.pickable&&=h[3]>=jt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===gt.Replace)?Rt.OPAQUE:Rt.TRANSPARENT;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=g}else e.cachedEdgeMaterials[f]=rt;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<Dt.CastShadows|+d.pickable<<Dt.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Qt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==rt)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?rt:(r=r||t!==rt,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Qt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Nt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?Ce.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s.node.serviceMbsInIndexSR)){case Ce.EXIT:return;case Ce.SKIP:continue}}let r=Ce.CONTINUE;switch(i){case Me.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Me.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Me.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===Ce.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=Ce.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===Ce.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=Ce.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===Ce.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===tt.OUTSIDE)return Ce.CONTINUE;if(s===tt.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=Ce.CONTINUE,o=e.featureIds,a=e.objectHandle,n=ot(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===Ce.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Fe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(_e(e))return ct;const s=ut(e);if(0===s.length)return ct;const r=t?.name??Ot,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return ct;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>ht(t,e.attributes,i)))}resetHighlights(){l(this._highlights),this._highlights=new De({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Me.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=f((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new ye(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}checkInvariants(){}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Qt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>this._logEdgeViewError(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Kt(e);if(s){const t={context:i,buffer:s.buffer};xe(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Re(i);e.imModificationImpact=s,s!==qe.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running||this._needFilterResolve}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ve.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=P(),n=P(),l=(e,t)=>{T(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),T(e,e,F(n,n,t)),V(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Nt.REMOVE&&t!==Nt.UPDATE||r.events.remove(i),t!==Nt.ADD&&t!==Nt.UPDATE||r.events.add(i,s)}_logEdgeViewError(e,t){c(e)||a.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>Ft?(a.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}};return e([b()],o.prototype,"_hasLoadedPBRTextures",void 0),e([b()],o.prototype,"_asyncModuleLoading",void 0),e([b()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([b()],o.prototype,"view",void 0),e([b()],o.prototype,"i3slayer",void 0),e([b()],o.prototype,"_controller",void 0),e([b()],o.prototype,"_labeler",void 0),e([b()],o.prototype,"updating",void 0),e([b()],o.prototype,"suspended",void 0),e([b()],o.prototype,"contentVisible",null),e([b({readOnly:!0})],o.prototype,"legendEnabled",null),e([b()],o.prototype,"holeFilling",void 0),e([b(bt)],o.prototype,"updatingProgress",void 0),e([b()],o.prototype,"updatingProgressValue",null),e([b()],o.prototype,"hasTexturesOrVertexColors",null),e([b()],o.prototype,"rendererTextureUsage",null),e([b()],o.prototype,"elevationOffset",null),e([b()],o.prototype,"elevationInfo",null),e([b({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([b()],o.prototype,"supportedTextureEncodings",null),e([b({type:[le]})],o.prototype,"_modifications",void 0),e([b({readOnly:!0})],o.prototype,"clientGeometry",null),e([b()],o.prototype,"elevationRange",null),e([b()],o.prototype,"fullExtent",null),e([b()],o.prototype,"_elevationTask",void 0),e([b({readOnly:!0})],o.prototype,"_usePBR",null),o=e([I("esri.views.3d.layers.I3SMeshView3D")],o),o};var Nt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Nt||(Nt={}));const Pt=K(),Ht=X(),Ut=X(),kt=new yt,Lt=new t([0,0,0,0]),Gt=ie(0,0,0,0);function Bt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function qt(e){return"geometryData"in e}function Wt(e){return null!=e&&y(e.data)}function zt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&y(s.data)&&(i+=s.data.byteLength);return i}function Kt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll((e=>{let t=e.serviceObbInIndexSR;null==t&&(t=kt,t.center=te(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class $t{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Qt(e,t){e.forEach((e=>e.opacity=t))}class Xt{constructor(e,t){this.mode=e,this.offset=t}}const Yt=P(),Jt=K(),Zt="elevation-change",ei="",ti="@null",ii="@ECEF",si=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],ri=new ft;function oi(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(si);for(const e of si){const t=N(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(si);for(const e of si){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function ai(e,t,i){const s=te(t),r=i>0?N(s)-i:s[2],o=se(t);e.expandElevationRangeValues(r-o,r+o)}function ni(e,t){const i=e.featureIds.slice();for(const s of t)if(s(i,e),0===i.length)break;return i.length===e.featureIds.length?e.featureIds:i}function li(e,t,i){const s=new Array,r=e.filteredIds;if(null==r||t?.size||i?.size){if(null!=r){let o=0;e.featureIds.forEach(((e,a)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(a)}))}}else e.featureIds.forEach(((e,t)=>{r[s.length]===e&&s.push(t)}));return s}function di(e,t,i){if(e&&t)for(const s of t){const t=(e.get(s)??0)+i;t>0?e.set(s,t):e.delete(s)}}var hi;function ci(e,t=hi.All){const i=new Map;for(const s of e){di(i,t===hi.All?s?.featureIds:t===hi.Filtered?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}!function(e){e[e.All=0]="All",e[e.Filtered=1]="Filtered",e[e.WeaklyRemoved=2]="WeaklyRemoved"}(hi||(hi={}));export{Vt as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../chunks/tslib.es6.js";import{createTask as i}from"../../../core/asyncUtils.js";import e from"../../../core/Error.js";import{destroyMaybe as a,abortMaybe as t}from"../../../core/maybe.js";import{isAborted as r}from"../../../core/promiseUtils.js";import{watch as n,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as w}from"./LayerView3D.js";import h from"../../layers/LayerView.js";const c="analysis-view-handles";let p=class extends(w(h)){constructor(s){super(s),this.type="line-of-sight-3d",this._analysisModule=null}initialize(){this.addHandles(n((()=>this.layer.analysis),(s=>{this._destroyAnalysisView(),null!=s&&this._createAnalysisView(s)}),l),c)}destroy(){this.removeHandles(c),this._destroyAnalysisView()}async whenAnalysisView(){if(null!=this.analysisView)return this.analysisView;if(null!=this._createAnalysisViewTask)return this._createAnalysisViewTask.promise;throw new e("layerview:no-analysisview-for-analysis","The analysis has not been set on the LineOfSightLayer of this layer view")}isUpdating(){return null!=this._createAnalysisViewTask||null!=this.analysisView&&this.analysisView.updating}_createAnalysisView(s){const e=i((async i=>(this.analysisView=await this._createAnalysisViewPromise(s,i),this._createAnalysisViewTask===e&&(this._createAnalysisViewTask=null),this.analysisView)));this._createAnalysisViewTask=e}_destroyAnalysisView(){this.analysisView=a(this.analysisView),this._createAnalysisViewTask=t(this._createAnalysisViewTask)}async _createAnalysisViewPromise(s,i){let a=this._analysisModule;if(null==a){const s=await this._loadAnalysisModule();this._analysisModule=s,a=s}const t=new a.default({analysis:s,view:this.view,parent:this});if(await t.when(),r(i))throw t.destroy(),new e("layerview:no-analysisview-for-analysis","The analysis has not been added to the LineOfSightLayer of this layer view",{analysis:s});return t}_loadAnalysisModule(){return import("../analysis/LineOfSightAnalysisView3D.js")}};s([o()],p.prototype,"type",void 0),s([o()],p.prototype,"layer",void 0),s([o()],p.prototype,"analysisView",void 0),s([o()],p.prototype,"_createAnalysisViewTask",void 0),p=s([y("esri.views.3d.layers.LineOfSightLayerView3D")],p);const d=p;export{d as default};
5
+ import{_ as s}from"../../../chunks/tslib.es6.js";import{createTask as i}from"../../../core/asyncUtils.js";import e from"../../../core/Error.js";import{destroyMaybe as a,abortMaybe as t}from"../../../core/maybe.js";import{isAborted as r}from"../../../core/promiseUtils.js";import{watch as n,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import{subclass as y}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerView3D as w}from"./LayerView3D.js";import h from"../../layers/LayerView.js";import c from"../../layers/LineOfSightLayerView.js";const p="analysis-view-handles";let d=class extends(w(c(h))){constructor(s){super(s),this.type="line-of-sight-3d",this._analysisModule=null}initialize(){this.addHandles(n((()=>this.layer.analysis),(s=>{this._destroyAnalysisView(),null!=s&&this._createAnalysisView(s)}),l),p)}destroy(){this.removeHandles(p),this._destroyAnalysisView()}async whenAnalysisView(){if(null!=this.analysisView)return this.analysisView;if(null!=this._createAnalysisViewTask)return this._createAnalysisViewTask.promise;throw new e("layerview:no-analysisview-for-analysis","The analysis has not been set on the LineOfSightLayer of this layer view")}isUpdating(){return null!=this._createAnalysisViewTask||null!=this.analysisView&&this.analysisView.updating}_createAnalysisView(s){const e=i((async i=>(this.analysisView=await this._createAnalysisViewPromise(s,i),this._createAnalysisViewTask===e&&(this._createAnalysisViewTask=null),this.analysisView)));this._createAnalysisViewTask=e}_destroyAnalysisView(){this.analysisView=a(this.analysisView),this._createAnalysisViewTask=t(this._createAnalysisViewTask)}async _createAnalysisViewPromise(s,i){let a=this._analysisModule;if(null==a){const s=await this._loadAnalysisModule();this._analysisModule=s,a=s}const t=new a.default({analysis:s,view:this.view,parent:this});if(await t.when(),r(i))throw t.destroy(),new e("layerview:no-analysisview-for-analysis","The analysis has not been added to the LineOfSightLayer of this layer view",{analysis:s});return t}_loadAnalysisModule(){return import("../analysis/LineOfSightAnalysisView3D.js")}};s([o()],d.prototype,"type",void 0),s([o()],d.prototype,"analysisView",void 0),s([o()],d.prototype,"_createAnalysisViewTask",void 0),d=s([y("esri.views.3d.layers.LineOfSightLayerView3D")],d);const V=d;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,h as x,j as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=I(),ii=I(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new y}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,!1),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator||(this._activeIterator=di(this._active)),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator||(this._visibleIterator=di(this._visible)),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator||(this._sortIterator=_i(this._visible,this._sortArray,this.visibilityGroup)),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return void(t.culled=!0);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}null==l?t.culled=!0:(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as e}from"../../../../core/mathUtils.js";import s from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{j as l,t as h,c as u,i as p,G as d,h as _}from"../../../../chunks/vec32.js";import{ZEROS as f,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g,t as m,b}from"../../../../chunks/vec42.js";import{create as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as w}from"../../../../geometry/ellipsoidUtils.js";import{create as G,empty as B,offset as N,width as D,height as S,expand as V,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{d as C,a as j,e as T}from"../../../../chunks/boundedPlane.js";import{create as O,fromPoints as A}from"../../../../geometry/support/ray.js";import{a as E,j as x,h as M,c as L}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as z,prepare as H,drawPoly as R}from"./deconflictorDebug.js";import{VisibilityGroup as F,VisibilityFlag as X}from"./enums.js";import Y from"../../webgl/RenderCamera.js";import{newIntersector as k}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as W}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{applyPrecomputedScaleFactor as U}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as q}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as J}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as K}from"../../webgl-engine/materials/ScaleInfo.js";const Q=v(),Z=v(),$=I(),ii=I(),ti=v(),ei=c(),si=L(),ri=O(),ai=v(),oi=G();class ci{constructor(){this.aabr=G(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1}}class ni{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.graphicPositionView=null,this._info=null,this._labelInfo=null}assertInfo(i){let t=this.getInfo(i);return t||(t=new ci,i===F.LABEL?this._labelInfo=t:this._info=t),t}getInfo(i){return i===F.LABEL?this._labelInfo:this._info}removeInfo(i){i===F.LABEL?this._labelInfo=null:this._info=null}}var li;!function(i){i[i.Idle=0]="Idle",i[i.VisibilityInactive=1]="VisibilityInactive",i[i.Process=2]="Process",i[i.Sort=3]="Sort",i[i.Deconflict=4]="Deconflict",i[i.NumStates=5]="NumStates"}(li||(li={}));class hi{constructor(){this.camera=new Y,this.slicePlane=C(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),j(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ui=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._viewState=new hi,this._state=li.Idle,this._inactive=new Map,this._active=new Map,this._visible=new Map,this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null,this._sortArray=new s({allocator:i=>i||new fi}),this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this._accNumTests=0,this._updatingHandles=new y}initialize(){this._updatingHandles.add((()=>(this.view?.map?.ground?.opacity??0)>0),(()=>this.setDirty()))}destroy(){this._updatingHandles.destroy(),this._inactive.clear(),this._active.clear(),this._visible.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._inactive.size>0)&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==li.Idle||this._dirty||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;const i=this._state/li.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case li.Idle:this._startUpdate(),i.madeProgress();case li.VisibilityInactive:if(this._state=li.VisibilityInactive,!this._processInactiveGraphics(i))return;case li.Process:if(this._state=li.Process,!this._processActiveGraphics(i))return;case li.Sort:if(this._state=li.Sort,!this._sortVisibleGraphics(i))return;case li.Deconflict:if(this._state=li.Deconflict,!this._deconflictVisibleGraphics(i))return;default:z((()=>({bins:this._accBins,numX:this._accBinsNumX,numY:this._accBinsNumY,sizeX:this._accBinsSizeX,sizeY:this._accBinsSizeY,numTests:this._accNumTests,numVisible:this._visible.size}))),this._state=li.Idle,this.notifyChange("updating")}}setGraphicsActive(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i)))}setGraphicsInactive(i,t){t?i.forEach((i=>this.addToInactiveGraphics(i))):i.forEach((i=>this.removeFromInactiveGraphics(i)))}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const e=t?.geometries[0],s=e?.material;return s instanceof J}_startUpdate(){H(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._viewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.assertInfo(this.visibilityGroup),this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),pi(i,this.visibilityGroup),i.removeInfo(this.visibilityGroup),this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}addToInactiveGraphics(i){this._inactive.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromInactiveGraphics(i){this._inactive.delete(i.graphics3DGraphic.graphic.uid)}_createIntersector(){const i=this.view.sceneIntersectionHelper,t=k(this.view.state.viewingMode);t.options.store=W.MIN,t.options.hud=!1,t.options.normalRequired=!1;const e=this.view.state.camera;return s=>{t.reset(e.eye,s,e),i.computeIntersection(A(e.eye,s,ri),t,{enableDraped:!1});const r=t.results.min.dist;return null!=r?r*l(s,e.eye):0}}_processInactiveGraphics(i){if(0===this._inactive.size)return!0;const t=this._ensureInactiveGraphicsIterator(),e=this._viewState.camera,s=this.view.renderCoordsHelper.getAltitude(e.eye),r=o(ei,e.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,c="global"===this.view.viewingMode&&a&&e.relativeElevation>0?si:null;let n=0;null!=c&&(h(E(c),f,e.viewMatrix),c[3]=w(this.view.spatialReference).radius,n=x(c,f));const l=a?this._createIntersector():null,u=G();for(;!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._inactiveIterator=null,!0;const o=a.value,p=o.graphics3DGraphic;if(p.destroyed)continue;if(!p.isVisible(F.GRAPHIC,X.DECONFLICTION))continue;const d=this.getGraphicsLayers(p);let _=null,f=!0;for(const i of d){if(!this.layerSupportsDeconfliction(i))continue;_=bi,this._getProjectionInfo(i,e,_),B(u);const t=i.stageObject.geometries[0].material;if(this._expandBoundingRect(u,e,i,t,_),u[0]>e.fullWidth||u[1]>e.fullHeight||u[2]<0||u[3]<0){f=!1;break}if(this._isCulledBySlice(o,_.positionView)){f=!1;break}if(null!=c&&mi(_,c,n)){f=!1;break}h(Z,_.positionView,r),_.altitude=this.view.renderCoordsHelper.getAltitude(Z),_.distanceToOccluder=l?.(Z)??0,f=this._occludedVisibility(_.distanceToOccluder,_.distance,_.altitude,s),this._setCachedGraphicPosition(o,_.positionView);break}R(u,f,!0),this._setGraphicVisibility(o,f)}return!1}_setCachedGraphicPosition(i,t){const e=this.visibilityGroup===F.LABEL||i.getInfo(F.LABEL);this.visibilityGroup===F.GRAPHIC&&e?i.graphicPositionView=u(i.graphicPositionView??v(),t):i.graphicPositionView&&!e?i.graphicPositionView=null:i.graphicPositionView&&p(i.graphicPositionView,NaN,NaN,NaN)}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),e=this._viewState.camera,s=o(ei,e.viewInverseTransposeMatrix),r=e.relativeElevation,a=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.map.ground.opacity>0,n="global"===this.view.viewingMode&&c&&r>0,l=c?this._createIntersector():null,u=n?si:null;let p=0;for(null!=u&&(h(E(u),f,e.viewMatrix),u[3]=w(this.view.spatialReference).radius,p=x(u,f));!i.done;){i.madeProgress();const r=t.next();if(!0===r.done)return this._activeIterator=null,!0;const o=r.value,c=o.assertInfo(this.visibilityGroup);this._collectGraphics3DGraphics(o,c,e,s,u,p,l),this._occludedVisibility(c.distanceToOccluder,c.distance,c.altitude,a)||(c.culled=!0),c.culled?(R(c.aabr,!1,!0),this._setGraphicVisibility(o,!1),this._visible.delete(o.graphics3DGraphic.graphic.uid)):this._visible.set(o.graphics3DGraphic.graphic.uid,o)}return!1}_occludedVisibility(i,t,e,s){return 0===i||t<=i+10+2*(Math.max(100,Math.abs(e-s))-100)}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const e=t.next();if(i.madeProgress(),!0===e.done)return this._sortIterator=null,!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),e=this.visibilityGroup===F.LABEL;for(;!i.done;){i.madeProgress();const s=t.next();if(!0===s.done)return this._visibleIterator=null,!0;const r=s.value,a=r.getInfo(this.visibilityGroup);if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!e||o.isVisible();a.visible=c&&!this._isConflicted(r.graphics3DGraphic.graphic.uid,a),a.visible&&this._addToBins(r,a),this._setGraphicVisibility(r,a.visible),R(a.aabr,a.visible)}return!1}_resetIterators(){this._inactiveIterator=null,this._activeIterator=null,this._visibleIterator=null,this._sortIterator=null}_ensureInactiveGraphicsIterator(){return this._inactiveIterator||(this._inactiveIterator=di(this._inactive)),this._inactiveIterator}_ensureActiveGraphicsIterator(){return this._activeIterator||(this._activeIterator=di(this._active)),this._activeIterator}_ensureVisibleGraphicsIterator(){return this._visibleIterator||(this._visibleIterator=di(this._visible)),this._visibleIterator}_ensureSortGraphicsIterator(){return this._sortIterator||(this._sortIterator=_i(this._visible,this._sortArray,this.visibilityGroup)),this._sortIterator}_collectGraphics3DGraphics(i,t,e,s,r,a,o){const c=i.graphics3DGraphic;if(c.destroyed)return;if(!c.isVisible(F.GRAPHIC,X.DECONFLICTION))return void(t.culled=!0);const n=this.getGraphicsLayers(c);B(t.aabr);let l=null;for(const u of n){if(!this.layerSupportsDeconfliction(u))continue;if(null==l){if(l=bi,this._getProjectionInfo(u,e,l),l.isOutsideScreen||this._isCulledBySlice(i,l.positionView)||null!=r&&mi(l,r,a))return void(t.culled=!0);const c=this.visibilityGroup===F.LABEL?i.getInfo(F.GRAPHIC):null;c&&i.graphicPositionView&&d(l.positionView,i.graphicPositionView)?(l.altitude=c.altitude,l.distanceToOccluder=c.distanceToOccluder):(h(Z,l.positionView,s),l.altitude=this.view.renderCoordsHelper.getAltitude(Z),l.distanceToOccluder=o?.(Z)??0,this._setCachedGraphicPosition(i,l.positionView))}const c=u.stageObject.geometries[0].material;this._expandBoundingRect(t.aabr,e,u,c,l)}null==l?t.culled=!0:(t.altitude=l.altitude,t.distance=l.distance,t.distanceToOccluder=l.distanceToOccluder,t.culled=!1)}_getProjectionInfo(i,t,e){const s=i.stageObject,r=s.geometries[0],a=r.material,o=E(s.boundingVolumeWorldSpace.bounds);h(Q,o,t.viewMatrix);const c=r.attributes,n=c.get(q.NORMAL).data,l=c.get(q.CENTEROFFSETANDDISTANCE).data;a.applyShaderOffsetsView(Q,n,s.transformation,l,t,e.scaleInfo,Q),g($,Q[0],Q[1],Q[2],1),m(ii,$,t.projectionMatrix),_(e.positionNDC,ii,1/ii[3]),a.applyShaderOffsetsNDC(e.positionNDC,l,t,e.positionNDC,ti),e.distanceWithoutPolygonOffset=t.depthNDCToWorld(ti[2]),e.distance=ti[2]===e.positionNDC[2]?e.distanceWithoutPolygonOffset:t.depthNDCToWorld(e.positionNDC[2]),g(ii,e.positionNDC[0],e.positionNDC[1],e.positionNDC[2],1),m($,ii,t.inverseProjectionMatrix),b($,$,1/$[3]),p(e.positionView,Q[0],Q[1],Q[2])}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&T(this._viewState.slicePlane,t)}_expandBoundingRect(i,t,s,r,{positionNDC:a,scaleInfo:o}){const c=s.getScreenSize(vi);U(c,o.factor,c),c[0]*=t.pixelRatio,c[1]*=t.pixelRatio;const n=N(r.calculateRelativeScreenBounds(c,o.factorAlignment.scale*t.pixelRatio,oi),e(0,t.fullWidth,.5+.5*a[0]),e(0,t.fullHeight,.5+.5*a[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(D(n),S(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}V(i,n,i)}_isConflicted(i,t){let e=!0;for(let s=Math.floor(t.aabr[0]/this._accBinsSizeX);s<=Math.floor(t.aabr[2]/this._accBinsSizeX);s++)if(!(s<0||s>=this._accBinsNumX))for(let r=Math.floor(t.aabr[1]/this._accBinsSizeY);r<=Math.floor(t.aabr[3]/this._accBinsSizeY);r++){if(r<0||r>=this._accBinsNumY)continue;e=!1;const a=this._accBins[s][r];for(let e=0;e<a.length;e++){const s=a.data[e],r=s.getInfo(this.visibilityGroup);if(r&&r.visible&&s.graphics3DGraphic.graphic.uid!==i&&(this._accNumTests++,P(r.aabr,t.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new s)}}else for(let e=0;e<this._accBinsNumX;e++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[e][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this._accNumTests=0}_addToBins(i,t){const e=Math.floor(t.aabr[0]/this._accBinsSizeX),s=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=e;o<=s;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const e=i.graphics3DGraphic;e.destroyed||(e.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===F.LABEL&&this.view.labeler.setLabelGraphicVisibility(e,t))}};function pi(i,t){const e=i.graphics3DGraphic;e.destroyed||e.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*di(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*_i(i,t,e){t.clear(),i.forEach(((i,s)=>{const r=t.pushNew();r.id=s,r.visible=i.graphics3DGraphic.getVisibilityFlag(e,X.DECONFLICTION);const a=i.getInfo(e);r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?.distance??Number.MAX_VALUE,r.behindTerrain=!!a&&0!==a.distanceToOccluder&&a.distance>a.distanceToOccluder})),yield;const s=t.iterableSort(((i,t)=>i.behindTerrain!==t.behindTerrain?+i.behindTerrain-+t.behindTerrain:i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?+t.visible-+i.visible:i.id-t.id));for(let r=s.next();!r.done;r=s.next())yield;t.forAll((t=>{const e=i.get(t.id);e&&(i.delete(t.id),i.set(t.id,e))})),t.clear()}i([r({constructOnly:!0})],ui.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ui.prototype,"updating",null),i([r({readOnly:!0})],ui.prototype,"_updatingHandles",void 0),ui=i([a("esri.views.3d.layers.graphics.Deconflictor")],ui);class fi{constructor(){this.id=0,this.visible=!1,this.behindTerrain=!1,this.prio=0,this.distance=0}}const vi=n();class gi{constructor(){this.positionView=v(),this.positionNDC=v(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new K}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1||i[2]>=1}}function mi(i,t,e){return u(ri.direction,i.positionView),p(ri.origin,0,0,0),!!M(t,ri,ai)&&i.distanceWithoutPolygonOffset>e}const bi=new gi;export{ui as Deconflictor,ni as DeconflictorGraphic,hi as DeconflictorViewState,li as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as c}from"../../../../../geometry/projection.js";import m from"../../../../../geometry/SpatialReference.js";import{QueryEngine as d}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:s,objectIdField:y,capabilities:C,fieldsIndex:w,timeInfo:S,elevationInfo:x,fullExtent:F}){const j=m.fromJSON(e),R=m.fromJSON(t);this._fetcher=new h(j,l.fromJSON(i),s,y,C),this._queryEngine=new d({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:w,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:S});const Q={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};this._renderer=new _({viewSpatialReference:j,renderSpatialReference:R,renderCoordsHelper:g.create(r,R),renderCommandContext:new f(r,Q),elevationInfo:x??{},mainThreadDelegate:Q}),this._defaultQueryJSON=new l({outSpatialReference:j}).toJSON();let E=null;if(null!=F){const e=o.fromJSON(F);await u(e.spatialReference,j),E=c(e,j)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:E}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),await this._renderer.load(),v}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),v}async onElevationChange(e){return v}async onLayerOpacityChange(e){const t=await this._renderer.createUpdateLayerOpacityCommand(e);return await t.execute(),v}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=await this._renderer.createAddCommand(e);return r(t),n.appendPipelineStateCommand((()=>{a.addTile(e)})),n}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,n=await a.createUpdateVisibilityCommand(e);return r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}};e([i()],C.prototype,"updating",null),C=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const w=C,v={result:void 0};export{w as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as n}from"../../../../../core/reactiveUtils.js";import{property as i}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as c,project as u}from"../../../../../geometry/projection.js";import m from"../../../../../geometry/SpatialReference.js";import{QueryEngine as d}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{joinCommands as p}from"./PipelineCommand.js";import{Tile3DManager as y}from"./Tile3DManager.js";import{TileActionSynchronizer as h,TileActionType as f}from"./TileActionSynchronizer.js";import{TiledFeatureStore as _}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as C}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as w}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as S}from"../../../support/RenderCoordsHelper.js";let v=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new _,this._actionSynchronizer=new h(p,(e=>this._createCommand(e))),this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:i,url:s,objectIdField:p,capabilities:h,fieldsIndex:f,timeInfo:_,elevationInfo:v,fullExtent:x}){const R=m.fromJSON(e),Q=m.fromJSON(t);this._fetcher=new g(R,l.fromJSON(i),s,p,h),this._queryEngine=new d({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:p,fieldsIndex:f,availableFields:[p],spatialReference:e,featureStore:this._featureStore,timeInfo:_});const F={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};this._renderer=new w({viewSpatialReference:R,renderSpatialReference:Q,renderCoordsHelper:S.create(r,Q),renderCommandContext:new C(r,F),elevationInfo:v??{},mainThreadDelegate:F}),this._defaultQueryJSON=new l({outSpatialReference:R}).toJSON();let E=null;if(null!=x){const e=o.fromJSON(x);await c(e.spatialReference,R),E=u(e,R)}return this._tileManager=new y({loadTile:(e,t)=>this._fetcher.fetch(e,t),synchronizer:this._actionSynchronizer,extent:E}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),n),await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),j}async onElevationChange(e){return j}async onLayerOpacityChange(e){const t=await this._renderer.createUpdateLayerOpacityCommand(e);return await t.execute(),j}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,n=await this._renderer.createAddCommand(e);return r(t),n.appendPipelineStateCommand((()=>{a.addTile(e)})),n}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,n=await a.createUpdateVisibilityCommand(e);return r(t),n}_ensureQuery(e){return e??this._defaultQueryJSON}async _createCommand(e){switch(e.type){case f.ADD:return await this._createAddFeatureDataCommand(e.data);case f.REMOVE:return await this._createRemoveFeatureDataCommand(e.data.id);case f.UPDATE_VISIBILITY:return await this._createUpdateFeatureDataVisibilityCommand(e.data)}}};e([i()],v.prototype,"updating",null),v=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],v);const x=v,j={result:void 0};export{x as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- class e{constructor(e,n,t){this.renderCommandContext=e,this.renderCommandBuffer=n,this.pipelineStateCommands=t}append(e){this.appendRenderCommands(e.renderCommandBuffer),this.appendPipelineStateCommands(e.pipelineStateCommands)}appendRenderCommands(e){this.renderCommandBuffer.commands.push(...e.commands),this.renderCommandBuffer.transferList.push(...e.transferList)}appendPipelineStateCommand(e){this.pipelineStateCommands.push(e)}appendPipelineStateCommands(e){for(const n of e)this.appendPipelineStateCommand(n)}async execute(){for(const e of this.pipelineStateCommands)e();await this.renderCommandContext.dispatchRenderCommands(this.renderCommandBuffer)}}export{e as PipelineCommand};
5
+ class e{constructor(e,n,t){this.renderCommandContext=e,this.renderCommandBuffer=n,this.pipelineStateCommands=t}append(e){this.appendRenderCommands(e.renderCommandBuffer),this.appendPipelineStateCommands(e.pipelineStateCommands)}appendRenderCommands(e){this.renderCommandBuffer.commands.push(...e.commands),this.renderCommandBuffer.transferList.push(...e.transferList)}appendPipelineStateCommand(e){this.pipelineStateCommands.push(e)}appendPipelineStateCommands(e){for(const n of e)this.appendPipelineStateCommand(n)}async execute(){for(const e of this.pipelineStateCommands)e();await this.renderCommandContext.dispatchRenderCommands(this.renderCommandBuffer)}}function n(e){if(0===e.length)return null;return e.reduce(((e,n)=>(e.append(n),e)))}export{e as PipelineCommand,n as joinCommands};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{isSome as a}from"../../../../../core/arrayUtils.js";import has from"../../../../../core/has.js";import{createAbortError as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import i from"../../../../../core/ReactiveMap.js";import{signal as s}from"../../../../../core/signal.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as d,intersects as c}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureData as u}from"./featureData/FeatureData.js";let f=class extends e{constructor(t){super(t),this._updatingCount=0,this.extent=null,this._tileHandles=new i,this._wanted=new i}destroy(){for(const t of this._tileHandles.values())t.abort();this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updatingCount>0}get _boundingRect(){const{extent:t}=this;return null==t?null:d(t)}get _missingTiles(){const t=new Array,e=this._wanted;for(const a of this._tileHandles.values())e.has(a.id)&&!h(a)&&t.push(a);return t}async onTileTreeChange(t){++this._updatingCount;try{const{added:e,removed:a}=t,o=this._tileHandles,{_boundingRect:n}=this,i=null!=n?e.filter((t=>c(n,t.extent))):e,s=this._wanted,r=new Array;for(const t of a){const{id:a}=t;s.delete(a);if(e.some((e=>m(e,t)||m(t,e))))continue;const n=o.get(a);null!=n&&r.push(this._removeTile(n))}for(const t of i)s.set(t.id,t),r.push(this._addTile(t));await Promise.allSettled(r)}finally{--this._updatingCount}}async _removeTile(t){this._tileHandles.delete(t.id),this._validate(),t.abort();const{featureData:e}=t,a=new _(t.untilSettled(),null!=e?this.createRemoveFeatureDataCommand(e.id):null);t.nextEvent=null;const{command:o}=await a.getCommand();o?.execute()}async _addTile(t){const{_tileHandles:e}=this,a=e.get(t.id);if(null!=a)return!h(a)||a.featureData.isFullyEnabled||(a.featureData.enableAll(),a.nextEvent=this._onTileLoad(a)),void await a.untilSettled();const n=new p(t);this._tileHandles.set(n.id,n);const i=this.loadTile(t,n.signal);n.nextEvent=i;const s=await i;if(n.aborted)throw o();n.featureData=new u(s),g(n),n.nextEvent=this._onTileLoad(n),await n.untilSettled()}async _onTileLoad(t){const{_wanted:e,_tileHandles:a,_missingTiles:o}=this,n=t.descriptor,i=new Array,s=new Array,r=new Set;for(const d of a.values()){if(d===t)continue;const{descriptor:l,id:c}=d;if(e.has(c)||o.some((({descriptor:t})=>m(t,l)||m(l,t)))){if(h(d)){if(m(n,l)){const t=d.featureData;for(const e of t.objectIds())r.add(e)}if(m(l,n)){const e=t.featureData,a=new Set(e.objectIds()),{featureData:o}=d;o.disableObjectIds(a);const n=AbortSignal.any([d.signal,t.signal]),r=d.untilSettled();i.push(new _(r,this.createUpdateFeatureDataVisibilityCommand(o),n)),s.push(d),this._validateRemoval(o,a)}}}else{d.abort(),a.delete(c);const{featureData:t}=d;null!=t&&i.push(new _(d.untilSettled(),this.createRemoveFeatureDataCommand(t.id))),d.nextEvent=null}}r.size>0&&(t.featureData.disableObjectIds(r),this._validateRemoval(t.featureData,r)),this._validate(),i.push(new _(t.untilSettled(),this.createAddFeatureDataCommand(t.featureData,t.signal),t.signal)),s.push(t);const l=this._joinCommands(i);for(const d of s)d.nextEvent=l;await l}async _joinCommands(t){const e=(await Promise.allSettled(t.map((async t=>t.getCommand())))).map((t=>"fulfilled"!==t.status||t.value.signal?.aborted?null:t.value.command)).filter(a);if(0===e.length)return;e.reduce(((t,e)=>(t.append(e),t))).execute()}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!h(e))continue;const{featureData:a}=e;t.push({featureData:a,objectIds:new Set(a.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:a,objectIds:o}=t[e];for(let n=e+1;n<t.length;++n){const{featureData:e,objectIds:i}=t[n];for(const t of i)if(o.has(t))throw new Error(`${a.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const a of t.enabledObjectIds())if(e.has(a))throw new Error(`Failed to remove ${a} from ${t.id}!`)}};function m({lij:[t,e,a]},{lij:[o,n,i]}){const s=o-t;return s>=0&&e===n>>s&&a===i>>s}t([r()],f.prototype,"updating",null),t([r({constructOnly:!0})],f.prototype,"loadTile",void 0),t([r({constructOnly:!0})],f.prototype,"createAddFeatureDataCommand",void 0),t([r({constructOnly:!0})],f.prototype,"createRemoveFeatureDataCommand",void 0),t([r({constructOnly:!0})],f.prototype,"createUpdateFeatureDataVisibilityCommand",void 0),t([r()],f.prototype,"_updatingCount",void 0),t([r()],f.prototype,"extent",void 0),t([r()],f.prototype,"_boundingRect",null),t([r()],f.prototype,"_missingTiles",null),f=t([l("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],f);class p{constructor(t){this.descriptor=t,this._controller=new AbortController,this._featureData=s(null),this.nextEvent=null}get id(){return this.descriptor.id}get featureData(){return this._featureData.value}set featureData(t){this._featureData.value=t}get signal(){return this._controller.signal}abort(){this._controller.abort()}get aborted(){return this._controller.signal.aborted}async untilSettled(){try{await this.nextEvent}catch(t){n(t)||console.error(t)}}}function h(t){return null!=t.featureData}function g(t){if(!h(t))throw new Error}class _{constructor(t,e,a){this.previousEventSettled=t,this.commandPromise=e,this.signal=a}async getCommand(){const{previousEventSettled:t,commandPromise:e,signal:a}=this,[n]=await Promise.all([e,t]);if(a?.aborted)throw o();return{command:n,signal:a}}}export{f as Tile3DManager};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{createTask as o}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as s,throwIfNotAbortError as i}from"../../../../../core/promiseUtils.js";import a from"../../../../../core/ReactiveMap.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as l,intersects as d}from"../../../../../geometry/support/aaBoundingRect.js";import{TileAction as c,TileActionType as u}from"./TileActionSynchronizer.js";import{FeatureData as f}from"./featureData/FeatureData.js";let p=class extends e{constructor(t){super(t),this._updatingCount=0,this.extent=null,this._tileHandles=new a,this._wanted=new a}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updatingCount>0}get _boundingRect(){const{extent:t}=this;return null==t?null:l(t)}get _missingTiles(){const t=new Array,e=this._wanted,o=this._tileHandles;for(const s of e.values())null==o.get(s.id)?.featureData&&t.push(s);return t}async onTileTreeChange(t){++this._updatingCount;try{const{added:e,removed:o}=t,s=this._tileHandles,{_boundingRect:i}=this,a=null!=i?e.filter((t=>d(i,t.extent))):e,r=this._wanted,n=new Array;for(const{id:t}of o)r.delete(t);for(const t of a)r.set(t.id,t);const l=this._missingTiles;for(const t of o){const{id:e}=t;if(l.some((e=>h(e,t)||h(t,e))))continue;const o=s.get(e);null!=o&&n.push(this._removeTile(o))}for(const t of a)n.push(this._addTile(t));const c=await Promise.allSettled(n);for(const t of c)"rejected"===t.status&&console.error(t.reason)}finally{--this._updatingCount}}async _removeTile(t){t.loadTask.abort(),this._tileHandles.delete(t.id),this._validate();const{featureData:e}=t;null!=e&&await this.synchronizer.enqueueActions([new c(t.id,u.REMOVE,e)])}async _addTile(t){const{_tileHandles:e}=this,a=e.get(t.id);if(null!=a){if(!_(a)||a.featureData.isFullyEnabled)return;return a.featureData.enableAll(),void await this._onTileLoad(a)}const r=new m(t,o((async e=>{const o=await this.loadTile(t,e);return s(e),new f(o)})));this._tileHandles.set(r.id,r);try{await r.loadTask.promise}catch(n){return void i(n)}w(r),await this._onTileLoad(r)}async _onTileLoad(t){const{_wanted:e,_tileHandles:o,_missingTiles:s}=this,i=t.descriptor,a=new Array,r=new Set;for(const n of o.values()){if(n===t)continue;const{descriptor:l,id:d}=n;if(e.has(d)||s.some((t=>h(t,l)||h(l,t)))){if(_(n)){if(h(i,l)){const t=n.featureData;for(const e of t.objectIds())r.add(e)}if(h(l,i)){const e=t.featureData,o=new Set(e.objectIds()),{featureData:s}=n;s.disableObjectIds(o),a.push(new c(d,u.UPDATE_VISIBILITY,s)),this._validateRemoval(s,o)}}}else{o.delete(d),n.loadTask.abort();const{featureData:t}=n;null!=t&&a.push(new c(d,u.REMOVE,t))}}r.size>0&&(t.featureData.disableObjectIds(r),this._validateRemoval(t.featureData,r)),this._validate(),a.push(new c(t.id,u.ADD,t.featureData)),await this.synchronizer.enqueueActions(a)}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!_(e))continue;const{featureData:o}=e;t.push({featureData:o,objectIds:new Set(o.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:o,objectIds:s}=t[e];for(let i=e+1;i<t.length;++i){const{featureData:e,objectIds:a}=t[i];for(const t of a)if(s.has(t))throw new Error(`${o.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const o of t.enabledObjectIds())if(e.has(o))throw new Error(`Failed to remove ${o} from ${t.id}!`)}};function h({lij:[t,e,o]},{lij:[s,i,a]}){const r=s-t;return r>=0&&e===i>>r&&o===a>>r}t([r()],p.prototype,"updating",null),t([r({constructOnly:!0})],p.prototype,"loadTile",void 0),t([r({constructOnly:!0})],p.prototype,"synchronizer",void 0),t([r()],p.prototype,"_updatingCount",void 0),t([r()],p.prototype,"extent",void 0),t([r()],p.prototype,"_boundingRect",null),t([r()],p.prototype,"_missingTiles",null),p=t([n("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],p);class m{constructor(t,e){this.descriptor=t,this.loadTask=e}get id(){return this.descriptor.id}get featureData(){return this.loadTask.value}}function _(t){return null!=t.featureData}function w(t){if(!_(t))throw new Error}export{p as Tile3DManager};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{isSome as e}from"../../../../../core/arrayUtils.js";import{createResolver as t}from"../../../../../core/promiseUtils.js";class s{constructor(e,t){this._joinCommands=e,this._createCommand=t,this._executing=new Set,this._nextEvents=new Map}async enqueueActions(e){const{_executing:t}=this;return e.every((e=>!t.has(e.tileId)))?await this._executeActions(e):await this._scheduleActions(e)}async _scheduleActions(t){const{_nextEvents:s}=this,o=new Set(t.map((e=>s.get(e.tileId))).filter(e));let i;if(0!==o.size){const e=new Array,r=new Array;for(const t of o)e.push(t.actions),r.push(t.resolver);e.push(t);for(const t of e)for(const e of t)s.delete(e.tileId);const a=e.reduce(c);i=new n(a),i.resolver.promise.then((()=>{for(const e of r)e.resolve()}),(e=>{for(const t of r)t.reject(e)}))}else i=new n(t);for(const e of i.actions)s.set(e.tileId,i);return this._validate(),await i.resolver.promise}async _executeActions(t){const s=t.map((e=>e.tileId)),{_executing:n}=this;for(const e of s)n.add(e);this._validate();try{const s=(await Promise.allSettled(t.map(this._createCommand))).map((e=>"fulfilled"===e.status?e.value:null)).filter(e);if(0===s.length)return;const n=this._joinCommands(s);await(n?.execute())}finally{for(const e of s)n.delete(e);this._executeTails(s)}}_executeTails(t){const{_nextEvents:s}=this,n=new Set(t.map((e=>s.get(e))).filter(e));if(0===n.size)return;const{_executing:o}=this;for(const e of n){if(!e.actions.some((e=>o.has(e.tileId)))){for(const t of e.actions)s.delete(t.tileId);this._executeActions(e.actions).then((()=>{e.resolver.resolve()}),(t=>{e.resolver.reject(t)}))}}}_validate(){const{_nextEvents:e}=this,t=Array.from(new Set(e.values()));if(0===t.length)return;if(t.some((t=>t.actions.some((({tileId:s})=>e.get(s)!==t)))))throw new Error("Mismatch between map and event")}}class n{constructor(e){this.actions=e,this.resolver=t()}}class o{constructor(e,t,s){this.tileId=e,this.type=t,this.data=s}toString(){return`${this.tileId}: ${this.type}`}}var i,r;function c(e,t){const s=new Array(e.length).fill(!0),n=new Array(t.length).fill(!0);e:for(let i=0;i<e.length;++i){const o=e[i];for(let e=0;e<t.length;++e){if(!n[e])continue;switch(a(o,t[e])){case r.NONE:break;case r.OVERWRITE:s[i]=!1;continue e;case r.REDUNDANT:n[e]=!1;break;case r.ANNIHILATE:s[i]=!1,n[e]=!1;continue e}}}const o=new Array;for(let i=0;i<e.length;++i)s[i]&&o.push(e[i]);for(let i=0;i<t.length;++i)n[i]&&o.push(t[i]);return o}function a(e,t){if(e.tileId!==t.tileId)return r.NONE;if(e.type===i.ADD&&t.type===i.REMOVE)return r.ANNIHILATE;if(e.type===i.ADD&&t.type===i.UPDATE_VISIBILITY)return r.REDUNDANT;if(e.type===i.REMOVE&&t.type===i.ADD)return r.ANNIHILATE;if(e.type===i.UPDATE_VISIBILITY&&t.type===i.REMOVE)return r.OVERWRITE;if(e.type===i.UPDATE_VISIBILITY&&t.type===i.UPDATE_VISIBILITY)return r.OVERWRITE;throw new Error("Impossible sequence of actions")}!function(e){e.ADD="ADD",e.REMOVE="REMOVE",e.UPDATE_VISIBILITY="UPDATE_VISIBILITY"}(i||(i={})),function(e){e.NONE="NONE",e.ANNIHILATE="ANNIHILATE",e.OVERWRITE="OVERWRITE",e.REDUNDANT="REDUNDANT"}(r||(r={}));export{r as JoinResult,o as TileAction,s as TileActionSynchronizer,i as TileActionType,c as joinActionLists,a as joinActions};