@arcgis/core 5.1.0-next.71 → 5.1.0-next.73

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 (439) hide show
  1. package/PopupTemplate.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003fd7745966fe03510c.js +1 -0
  4. package/assets/esri/core/workers/chunks/00bae4b7e179336e0362.js +1 -0
  5. package/assets/esri/core/workers/chunks/{36031cb53c486630f3c9.js → 026d3fa331caec1ea3d2.js} +1 -1
  6. package/assets/esri/core/workers/chunks/027c3ea756db68e51f0a.js +1 -0
  7. package/assets/esri/core/workers/chunks/041c372e98a6fba90b36.js +1 -0
  8. package/assets/esri/core/workers/chunks/{a5a46d0a0831497cf1b4.js → 0783890816bac45277b9.js} +1 -1
  9. package/assets/esri/core/workers/chunks/07aac6245a0d1adbb2d4.js +1 -0
  10. package/assets/esri/core/workers/chunks/0839da55707f7c4cf780.js +1 -0
  11. package/assets/esri/core/workers/chunks/0ae360bf253adee46737.js +1 -0
  12. package/assets/esri/core/workers/chunks/0c00e5e4bd18467bcecd.js +1 -0
  13. package/assets/esri/core/workers/chunks/0dad0bca8d58b2c63d22.js +1 -0
  14. package/assets/esri/core/workers/chunks/0ef93722524620023f69.js +1 -0
  15. package/assets/esri/core/workers/chunks/127cd8fee3717a473fc5.js +1 -0
  16. package/assets/esri/core/workers/chunks/1286f41f245ef22b3a26.js +1 -0
  17. package/assets/esri/core/workers/chunks/12e575a6d2b008b8fc2b.js +1 -0
  18. package/assets/esri/core/workers/chunks/{c92352b0e39576ca317a.js → 13e60f19f436b8d683ae.js} +1 -1
  19. package/assets/esri/core/workers/chunks/161d60fdac2013c15543.js +1 -0
  20. package/assets/esri/core/workers/chunks/1661684357912726a72a.js +1 -0
  21. package/assets/esri/core/workers/chunks/168de44a789d1cecc1f8.js +1 -0
  22. package/assets/esri/core/workers/chunks/1961b59756933e0a82f2.js +1 -0
  23. package/assets/esri/core/workers/chunks/1d9d7915cf7449e5d468.js +1 -0
  24. package/assets/esri/core/workers/chunks/1f85646936200a399c15.js +1 -0
  25. package/assets/esri/core/workers/chunks/{deb8a0b306d7b9c86b97.js → 2171aaa147aa4d9fc5b5.js} +1 -1
  26. package/assets/esri/core/workers/chunks/235cb82952a18ff8d206.js +1 -0
  27. package/assets/esri/core/workers/chunks/260d4571722cb1ff1366.js +1 -0
  28. package/assets/esri/core/workers/chunks/{3e972ae291df1844017d.js → 266ba61b72a278d93a26.js} +1 -1
  29. package/assets/esri/core/workers/chunks/27b80c386cebadcaca3c.js +1 -0
  30. package/assets/esri/core/workers/chunks/29d3890a5a43d934067a.js +1 -0
  31. package/assets/esri/core/workers/chunks/{7e6ccf9f3e756186e93e.js → 29e76256e3e867e80520.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{333a0038d782d8a34d58.js → 2abf124e2956e4f76688.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2f17438d215bea3ce70f.js +1 -0
  34. package/assets/esri/core/workers/chunks/{f6d5dd2eef0d9918096e.js → 30e710ec4d22c43d4e7e.js} +1 -1
  35. package/assets/esri/core/workers/chunks/30f04dc001eaf838d64c.js +1 -0
  36. package/assets/esri/core/workers/chunks/356cb86606b8c674f947.js +1 -0
  37. package/assets/esri/core/workers/chunks/398e0dd2bc7e1ab84831.js +1 -0
  38. package/assets/esri/core/workers/chunks/3b1052aa30af3f6186cc.js +1 -0
  39. package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +1 -0
  40. package/assets/esri/core/workers/chunks/3e87e3ad857d72f6ecbb.js +1 -0
  41. package/assets/esri/core/workers/chunks/{7cb6d8f7eaf762279632.js → 3ea5a18b264628dc37f0.js} +1 -1
  42. package/assets/esri/core/workers/chunks/41809c16544ec25120fa.js +1 -0
  43. package/assets/esri/core/workers/chunks/41913575dd45c65d645e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{628f56c09838eb9c573b.js → 422824e407b550170c8c.js} +1 -1
  45. package/assets/esri/core/workers/chunks/42e483fde18f12da32a6.js +1 -0
  46. package/assets/esri/core/workers/chunks/43ab44d37bc0ea97ef98.js +1 -0
  47. package/assets/esri/core/workers/chunks/46e622857ba92a72a317.js +1 -0
  48. package/assets/esri/core/workers/chunks/47f2113357b2aa4f4f37.js +1 -0
  49. package/assets/esri/core/workers/chunks/488ed9584b527ec47be3.js +1 -0
  50. package/assets/esri/core/workers/chunks/4ad32580e0c0699fde1f.js +1 -0
  51. package/assets/esri/core/workers/chunks/4d0f793dee4ad919221b.js +1 -0
  52. package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +1 -0
  53. package/assets/esri/core/workers/chunks/{916a8f3eed1fafdc7242.js → 54d07eadf113f0e4e506.js} +1 -1
  54. package/assets/esri/core/workers/chunks/54ed37ec9682ea739deb.js +1 -0
  55. package/assets/esri/core/workers/chunks/{9187d1caca1fd2d713e0.js → 55369c5bd65bcaf78da1.js} +1 -1
  56. package/assets/esri/core/workers/chunks/56fd3da911c2c4511e5d.js +1 -0
  57. package/assets/esri/core/workers/chunks/59592bb25f226865e88a.js +1 -0
  58. package/assets/esri/core/workers/chunks/{e77d958cb62536b8eebc.js → 5a4d7ba6dc1d4b41d80d.js} +1 -1
  59. package/assets/esri/core/workers/chunks/5c663d5f98bdfa29151b.js +1 -0
  60. package/assets/esri/core/workers/chunks/5d55b4449bcb24cd72b6.js +1 -0
  61. package/assets/esri/core/workers/chunks/5d8fe41a3c06ddb4094b.js +1 -0
  62. package/assets/esri/core/workers/chunks/{fe68c28d3c61f116ff23.js → 5ef37f37e405b3bb5450.js} +1 -1
  63. package/assets/esri/core/workers/chunks/608d707fd9d9f9088473.js +1 -0
  64. package/assets/esri/core/workers/chunks/{ae0a572cbbdd9815ee2e.js → 62b3e933f548ce354b99.js} +1 -1
  65. package/assets/esri/core/workers/chunks/656d6963e8f837fbf28f.js +1 -0
  66. package/assets/esri/core/workers/chunks/{a5afcd633b32e6ee31a7.js → 6a0352d20596ca3f4b64.js} +1 -1
  67. package/assets/esri/core/workers/chunks/6c7ff968bd4fc816442d.js +1 -0
  68. package/assets/esri/core/workers/chunks/6e526c06825ecc6c99c0.js +1 -0
  69. package/assets/esri/core/workers/chunks/6ea8b0d68881d16a2432.js +1 -0
  70. package/assets/esri/core/workers/chunks/7027d93dc5a4595d70c6.js +1 -0
  71. package/assets/esri/core/workers/chunks/70b35b2446558d5280e3.js +1 -0
  72. package/assets/esri/core/workers/chunks/7349cb45a93e6916f115.js +1 -0
  73. package/assets/esri/core/workers/chunks/751609831b283903ba48.js +1 -0
  74. package/assets/esri/core/workers/chunks/76edaeaf8fe344bb77a8.js +1 -0
  75. package/assets/esri/core/workers/chunks/76fe5b821d6b54db5721.js +1 -0
  76. package/assets/esri/core/workers/chunks/7951d93f5f15aa76f49c.js +1 -0
  77. package/assets/esri/core/workers/chunks/80ace1c7203c5059525d.js +1 -0
  78. package/assets/esri/core/workers/chunks/81d30c9062ad0120a863.js +1 -0
  79. package/assets/esri/core/workers/chunks/84772b023d04e415f17f.js +1 -0
  80. package/assets/esri/core/workers/chunks/{123e920e4460124ec3bb.js → 88b480a1d1fb01778798.js} +9 -30
  81. package/assets/esri/core/workers/chunks/88c5f7c712c6b89b5109.js +1 -0
  82. package/assets/esri/core/workers/chunks/88e469b82d2594f23649.js +1 -0
  83. package/assets/esri/core/workers/chunks/8a14e3db28c403b046cf.js +1 -0
  84. package/assets/esri/core/workers/chunks/8a664451845a47048859.js +1 -0
  85. package/assets/esri/core/workers/chunks/8a8242e7cc7e6a9e7876.js +1 -0
  86. package/assets/esri/core/workers/chunks/{4d51261d6131c07402cd.js → 8acee3fba488f202f82f.js} +1 -1
  87. package/assets/esri/core/workers/chunks/{31071a43e2c03984d619.js → 8d75f6f27c1c17c33992.js} +1 -1
  88. package/assets/esri/core/workers/chunks/9444ed8ea117861ae89b.js +1 -0
  89. package/assets/esri/core/workers/chunks/95d82c619dcbec2e1050.js +1 -0
  90. package/assets/esri/core/workers/chunks/96bba4d93a32ad34a1c8.js +1 -0
  91. package/assets/esri/core/workers/chunks/9a38fd68b02b617c45d3.js +1 -0
  92. package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +1 -0
  93. package/assets/esri/core/workers/chunks/9eb4ae556950e1d0124d.js +2 -0
  94. package/assets/esri/core/workers/chunks/9f4b97204def91567e3c.js +1 -0
  95. package/assets/esri/core/workers/chunks/a37c28e3c4a2be9fd1d5.js +1 -0
  96. package/assets/esri/core/workers/chunks/{c06d021180418f2014de.js → a78bc340a794fd332667.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{1edd39c7c4acdc591d10.js → a809b811121099a87a98.js} +1 -1
  98. package/assets/esri/core/workers/chunks/a8d7f59927bdad564141.js +1 -0
  99. package/assets/esri/core/workers/chunks/{f89976ec97938bf86996.js → abc06d10c7ac8ba5b0e4.js} +1 -1
  100. package/assets/esri/core/workers/chunks/abdf146b35e179b5b245.js +1 -0
  101. package/assets/esri/core/workers/chunks/abe22ae8ee0dcc9efbb7.js +1 -0
  102. package/assets/esri/core/workers/chunks/{fef5dc19736f12dfa99a.js → af5db0372d526e592fcc.js} +1 -1
  103. package/assets/esri/core/workers/chunks/{3b7cda16e656db450f11.js → afc0baf86ece710ef867.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{6ac5ec3ecbca8860338b.js → b54b7cc6b23a70fed700.js} +1 -1
  105. package/assets/esri/core/workers/chunks/b6cadb8a579241adcb86.js +1 -0
  106. package/assets/esri/core/workers/chunks/b702279c48f3009f6dd8.js +1 -0
  107. package/assets/esri/core/workers/chunks/b9848bdbaf3d9ac93d54.js +1 -0
  108. package/assets/esri/core/workers/chunks/be1d6a571f76933dfbb0.js +1 -0
  109. package/assets/esri/core/workers/chunks/{eb3cdc4ff45243fc3cc5.js → bef27a25fbc4a6e19ec0.js} +1 -1
  110. package/assets/esri/core/workers/chunks/bfcdc5c315131aae34d8.js +1 -0
  111. package/assets/esri/core/workers/chunks/c0f624a2ca0d07ef8f8c.js +1 -0
  112. package/assets/esri/core/workers/chunks/c3381b9a36299210ee47.js +1 -0
  113. package/assets/esri/core/workers/chunks/{c2882a9e67124b7c18be.js → c503c79ba5761f7abbeb.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{a65d576e90179a2b5400.js → c5507480344176fad241.js} +1 -1
  115. package/assets/esri/core/workers/chunks/c70df6ed190f9ebcf6aa.js +1 -0
  116. package/assets/esri/core/workers/chunks/cb5e4b9b4a59c2622eb5.js +1 -0
  117. package/assets/esri/core/workers/chunks/cd7159600ce132e32d04.js +1 -0
  118. package/assets/esri/core/workers/chunks/cfe246adb5e6cb6f0cfc.js +1 -0
  119. package/assets/esri/core/workers/chunks/d17fcfc502f0e0fa6523.js +596 -0
  120. package/assets/esri/core/workers/chunks/d201a5dff18a5bb467ab.js +1 -0
  121. package/assets/esri/core/workers/chunks/d65b1234867f7d773d50.js +2 -0
  122. package/assets/esri/core/workers/chunks/{4d8670f6fa8952b7bab6.js → d950d5c2844206502ff0.js} +1 -1
  123. package/assets/esri/core/workers/chunks/db3c484bfa607dec6050.js +1 -0
  124. package/assets/esri/core/workers/chunks/db588bf3256e95c977b7.js +1 -0
  125. package/assets/esri/core/workers/chunks/{967758a05170545cd371.js → dcc719e15b2e0cce1f3b.js} +1 -1
  126. package/assets/esri/core/workers/chunks/{6bb090f3e5c18604cb39.js → dd5b362bded458afa2d6.js} +1 -1
  127. package/assets/esri/core/workers/chunks/dfdd474fddcd1d6091ce.js +1 -0
  128. package/assets/esri/core/workers/chunks/{aa1a3a849aba84cf585b.js → e1bc9ad767e08dc18bbc.js} +1 -1
  129. package/assets/esri/core/workers/chunks/e235ea4293d5d463acfb.js +1 -0
  130. package/assets/esri/core/workers/chunks/e25a684eb9f025bdcc01.js +1 -0
  131. package/assets/esri/core/workers/chunks/e272411e2c9378aa8496.js +1312 -0
  132. package/assets/esri/core/workers/chunks/e43486113aaf72ac4dc1.js +1 -0
  133. package/assets/esri/core/workers/chunks/ea4c3393c5757e309a71.js +1 -0
  134. package/assets/esri/core/workers/chunks/ed216ddeb7f59f510bd0.js +1 -0
  135. package/assets/esri/core/workers/chunks/ef8886dff54063928bcb.js +1 -0
  136. package/assets/esri/core/workers/chunks/{231f502cd15f30d12be2.js → f1673e723b336204ad77.js} +1 -1
  137. package/assets/esri/core/workers/chunks/{d69110ec4078c583a05e.js → f207b3be0714cc50030a.js} +1 -1
  138. package/assets/esri/core/workers/chunks/f5223ffb3be548c9b0a1.js +1 -0
  139. package/assets/esri/core/workers/chunks/f53805c7a84203305b2c.js +1 -0
  140. package/assets/esri/core/workers/chunks/f5c57ff48ca505ed701d.js +1 -0
  141. package/assets/esri/core/workers/chunks/fae147d03ed723ab234d.js +1 -0
  142. package/chunks/CheckerBoard.glsl.js +3 -5
  143. package/chunks/ColorMaterial.glsl.js +4 -6
  144. package/chunks/ComponentShader.glsl.js +42 -44
  145. package/chunks/DefaultMaterial.glsl.js +21 -23
  146. package/chunks/EdgeShader.glsl.js +9 -11
  147. package/chunks/GaussianSplat.glsl.js +8 -8
  148. package/chunks/GlobalIllumination.glsl.js +186 -116
  149. package/chunks/GlobalIlluminationBlur.glsl.js +81 -61
  150. package/chunks/GlobalIlluminationUpscale.glsl.js +66 -0
  151. package/chunks/ImageMaterial.glsl.js +5 -7
  152. package/chunks/LineCallout.glsl.js +9 -12
  153. package/chunks/LineMarker.glsl.js +24 -26
  154. package/chunks/Path.glsl.js +15 -17
  155. package/chunks/Pattern.glsl.js +25 -27
  156. package/chunks/RealisticTree.glsl.js +11 -13
  157. package/chunks/RibbonLine.glsl.js +42 -45
  158. package/chunks/ShadedColorMaterial.glsl.js +8 -9
  159. package/chunks/Water.glsl.js +18 -20
  160. package/config.js +1 -1
  161. package/form/elements/FieldElement.d.ts +3 -2
  162. package/form/elements/inputs/Input.d.ts +1 -1
  163. package/form/elements/inputs/MultipleChoiceInput.d.ts +65 -0
  164. package/form/elements/inputs/MultipleChoiceInput.js +2 -0
  165. package/form/elements/inputs/inputUtils.js +1 -1
  166. package/form/elements/inputs/multipleChoice/Choice.d.ts +30 -0
  167. package/form/elements/inputs/multipleChoice/Choice.js +2 -0
  168. package/form/elements/inputs/multipleChoice/OtherChoice.d.ts +28 -0
  169. package/form/elements/inputs/multipleChoice/OtherChoice.js +2 -0
  170. package/form/elements/inputs.d.ts +11 -2
  171. package/form/elements/inputs.js +1 -1
  172. package/form/support/formUtils.js +1 -1
  173. package/interfaces.d.ts +28 -0
  174. package/kernel.js +1 -1
  175. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  176. package/layers/VoxelWasmPerSceneView.js +1 -1
  177. package/layers/graphics/FlatFeature.js +1 -1
  178. package/layers/graphics/FlatFeatureSet.js +1 -1
  179. package/layers/graphics/OptimizedFeature.js +1 -1
  180. package/layers/graphics/data/AttributesBuilder.js +1 -1
  181. package/layers/graphics/data/QueryEngineResult.js +1 -1
  182. package/layers/graphics/data/flatFeatureQueryEngineAdapter.js +1 -1
  183. package/layers/graphics/data/optimizedFeatureQueryEngineAdapter.js +1 -1
  184. package/layers/graphics/featureConversionUtils.js +1 -1
  185. package/layers/support/LabelClass.js +1 -1
  186. package/layers/support/featureLayerUtils.js +1 -1
  187. package/layers/support/labelUtils.js +1 -1
  188. package/layers/video/videoUtils.js +1 -1
  189. package/package.json +2 -2
  190. package/popupTemplateUtils.js +2 -0
  191. package/renderers/visualVariables/SizeVariable.js +1 -1
  192. package/renderers/visualVariables/support/sizeVariableUtils.js +1 -1
  193. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  194. package/rest/support/OutDistance.js +2 -0
  195. package/rest/support/Query.js +1 -1
  196. package/smartMapping/statistics/support/utils.js +1 -1
  197. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  198. package/support/arcadeUtils.js +1 -1
  199. package/support/revision.js +1 -1
  200. package/third-party-notices.txt +7 -29
  201. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
  202. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  203. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  204. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  205. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  206. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  207. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  208. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  209. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  210. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  211. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  212. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  213. package/views/3d/environment/EnvironmentManager.js +1 -1
  214. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  215. package/views/3d/layers/I3SMeshView3D.js +1 -1
  216. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  217. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  218. package/views/3d/layers/StreamLayerView3D.js +1 -1
  219. package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
  220. package/views/3d/state/ViewStateManager.js +1 -1
  221. package/views/3d/support/orientedBoundingBox.js +1 -1
  222. package/views/3d/terrain/OverlayRenderer.js +1 -1
  223. package/views/3d/terrain/TerrainRenderer.js +1 -1
  224. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  225. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialGlobalParameters.js +1 -1
  226. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  227. package/views/3d/webgl-engine/collections/Component/Material/ComponentShader.glsl.js +1 -1
  228. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  229. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +20 -32
  230. package/views/3d/webgl-engine/core/shaderLibrary/shading/GlobalIlluminationWeights.glsl.js +21 -0
  231. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +11 -7
  232. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +5 -3
  233. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  234. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  235. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  236. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +2 -0
  237. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  238. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +2 -0
  239. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +1 -1
  240. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +1 -1
  241. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscale.glsl.js +2 -0
  242. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationUpscaleTechnique.js +2 -0
  243. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  244. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  245. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  246. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  247. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  250. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  251. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  252. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  253. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  254. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  255. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  256. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  257. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  258. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  259. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  260. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  261. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  262. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  263. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  264. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  265. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  266. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  267. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  268. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  269. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  270. package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
  271. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  272. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  273. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  274. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  275. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  276. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  277. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  278. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  279. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  280. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  281. package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
  282. package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
  283. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  284. package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
  285. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  286. package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
  287. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  288. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  289. package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
  290. package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
  291. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  292. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  293. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  294. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  295. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  296. package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
  297. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  298. package/views/3d/webgl-engine/statistics/RendererPerformanceInfo.js +1 -1
  299. package/views/VideoView.js +1 -1
  300. package/views/interactive/sketch/SketchOptions.d.ts +3 -1
  301. package/views/interactive/sketch/SketchTooltipOptions.d.ts +6 -0
  302. package/views/layers/FeatureLikeLayerView.js +1 -1
  303. package/views/support/Scheduler.js +1 -1
  304. package/views/video/VideoOperationalDataView.js +1 -1
  305. package/views/webgl/ShaderBuilder.js +1 -1
  306. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  307. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  308. package/widgets/BatchAttributeForm/inputs/SingleFeatureInputAdapter.js +2 -0
  309. package/widgets/BatchAttributeForm/inputs/TextElementInput.d.ts +28 -4
  310. package/widgets/BatchAttributeForm/inputs/TextElementInput.js +1 -1
  311. package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +2 -0
  312. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  313. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  314. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  315. package/widgets/FeatureTable/FeatureTableViewModel.d.ts +19 -3
  316. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  317. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  318. package/widgets/FeatureTable/VisibleElements.d.ts +15 -1
  319. package/widgets/FeatureTable/VisibleElements.js +1 -1
  320. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  321. package/widgets/FeatureTable.d.ts +15 -1
  322. package/widgets/FeatureTable.js +1 -1
  323. package/widgets/Search/SearchViewModel.js +1 -1
  324. package/widgets/Search/support/layerSearchUtils.js +1 -1
  325. package/widgets/support/widgetUtils.js +1 -1
  326. package/assets/esri/core/workers/chunks/09ecb36e44096e577af8.js +0 -1
  327. package/assets/esri/core/workers/chunks/0ca06ea649bbdb93ff49.js +0 -1
  328. package/assets/esri/core/workers/chunks/10308c9f3f0d709d96bc.js +0 -1
  329. package/assets/esri/core/workers/chunks/141edf5ed890105a079b.js +0 -1
  330. package/assets/esri/core/workers/chunks/160b9a76b75875507c86.js +0 -1
  331. package/assets/esri/core/workers/chunks/16dfdee05704df249e95.js +0 -1
  332. package/assets/esri/core/workers/chunks/17ef955dc48e329aa184.js +0 -1
  333. package/assets/esri/core/workers/chunks/18001536ed345955121a.js +0 -1
  334. package/assets/esri/core/workers/chunks/20e715e3aeb1c3265901.js +0 -1
  335. package/assets/esri/core/workers/chunks/238f51d0b36f998017b8.js +0 -1
  336. package/assets/esri/core/workers/chunks/2cee6d751c5e73fe09d4.js +0 -1
  337. package/assets/esri/core/workers/chunks/314140e2e9b813191907.js +0 -1
  338. package/assets/esri/core/workers/chunks/3158a3487d3e8a61b680.js +0 -1
  339. package/assets/esri/core/workers/chunks/3b1446286a9b87f34761.js +0 -1
  340. package/assets/esri/core/workers/chunks/3f7fd58ee7d71989fc83.js +0 -1
  341. package/assets/esri/core/workers/chunks/41396724040180d2537f.js +0 -1
  342. package/assets/esri/core/workers/chunks/416e031bafc0189544fa.js +0 -1
  343. package/assets/esri/core/workers/chunks/55ee78923987ed17ea8c.js +0 -1
  344. package/assets/esri/core/workers/chunks/56c7d7c7217557375fb6.js +0 -1
  345. package/assets/esri/core/workers/chunks/58b3c888c8bfedbe6443.js +0 -1
  346. package/assets/esri/core/workers/chunks/5a1d975b3e9e6b7eff67.js +0 -1
  347. package/assets/esri/core/workers/chunks/5f6942ac94acd7842926.js +0 -1
  348. package/assets/esri/core/workers/chunks/6118706b9a038e9a06b8.js +0 -1
  349. package/assets/esri/core/workers/chunks/6d15229b3fa84a7acf4d.js +0 -599
  350. package/assets/esri/core/workers/chunks/7314c0131403cac84ad7.js +0 -1
  351. package/assets/esri/core/workers/chunks/73545bb13c70f6a347a4.js +0 -1
  352. package/assets/esri/core/workers/chunks/73a045061e69a22b6869.js +0 -1
  353. package/assets/esri/core/workers/chunks/75669912cddcb5db52c8.js +0 -1
  354. package/assets/esri/core/workers/chunks/7ca32806e47be15109a4.js +0 -1
  355. package/assets/esri/core/workers/chunks/7d6ed65bbcd279448191.js +0 -1
  356. package/assets/esri/core/workers/chunks/81f149e45c79b9b086fb.js +0 -1
  357. package/assets/esri/core/workers/chunks/84fa25f66a6949290221.js +0 -1
  358. package/assets/esri/core/workers/chunks/852aabbf671d2ca9cd33.js +0 -1
  359. package/assets/esri/core/workers/chunks/854fe80272b59fafc2e9.js +0 -1
  360. package/assets/esri/core/workers/chunks/85edbb072a2ce6c1bb30.js +0 -2
  361. package/assets/esri/core/workers/chunks/861817be5e050e9522ab.js +0 -1
  362. package/assets/esri/core/workers/chunks/89345a682dea60ef1643.js +0 -1
  363. package/assets/esri/core/workers/chunks/8985402c328b90af5724.js +0 -1
  364. package/assets/esri/core/workers/chunks/89fdf9ad10ca8fbb08a5.js +0 -1
  365. package/assets/esri/core/workers/chunks/8b094330323d9b16fb5d.js +0 -1
  366. package/assets/esri/core/workers/chunks/90aed8c4b266832f84ca.js +0 -1
  367. package/assets/esri/core/workers/chunks/943cf0653a2b7de16a4f.js +0 -1
  368. package/assets/esri/core/workers/chunks/9776c2db337222ceceef.js +0 -1
  369. package/assets/esri/core/workers/chunks/990853e9df38fdfc58b5.js +0 -1
  370. package/assets/esri/core/workers/chunks/9a21ba0c45a96b94c05e.js +0 -1
  371. package/assets/esri/core/workers/chunks/9a235c92f21df2c17aa8.js +0 -1
  372. package/assets/esri/core/workers/chunks/9b56162ac67c992193ce.js +0 -1
  373. package/assets/esri/core/workers/chunks/9f1f5fb648302c43ad12.js +0 -1
  374. package/assets/esri/core/workers/chunks/a1e6187c239fdc7553ed.js +0 -1
  375. package/assets/esri/core/workers/chunks/a4b6fdbc995be03d2afb.js +0 -1
  376. package/assets/esri/core/workers/chunks/a760be8fa6c6ea6b745c.js +0 -1
  377. package/assets/esri/core/workers/chunks/a8782286ce3c0d6c20e6.js +0 -1
  378. package/assets/esri/core/workers/chunks/a96692514dcaa50340dd.js +0 -1
  379. package/assets/esri/core/workers/chunks/a994a3c912a33b2f4100.js +0 -1
  380. package/assets/esri/core/workers/chunks/aa7aaeae31ddb259e55e.js +0 -1
  381. package/assets/esri/core/workers/chunks/abcc5fb71be2bd94878c.js +0 -1
  382. package/assets/esri/core/workers/chunks/aecb05df4ad1454f5435.js +0 -1
  383. package/assets/esri/core/workers/chunks/aecb105db7cec2c9c4c5.js +0 -1
  384. package/assets/esri/core/workers/chunks/b19f33e026a2a43b17c4.js +0 -1
  385. package/assets/esri/core/workers/chunks/b3950d5f1f3352521504.js +0 -1
  386. package/assets/esri/core/workers/chunks/b3f0600729227b458a75.js +0 -1
  387. package/assets/esri/core/workers/chunks/b5922991d2f450e6a9d9.js +0 -1
  388. package/assets/esri/core/workers/chunks/b8643976a7f984552d94.js +0 -1
  389. package/assets/esri/core/workers/chunks/b8a11d32a4847513619b.js +0 -1
  390. package/assets/esri/core/workers/chunks/b8acb6c2538053c01cc6.js +0 -1
  391. package/assets/esri/core/workers/chunks/ba4259aa050169c1d523.js +0 -1
  392. package/assets/esri/core/workers/chunks/bbaf1d9835671c0165ca.js +0 -1
  393. package/assets/esri/core/workers/chunks/bcefdf9753d9d2f6f1be.js +0 -1
  394. package/assets/esri/core/workers/chunks/c178e2cfc34603661b1d.js +0 -1
  395. package/assets/esri/core/workers/chunks/c3e80c0e29ac6a7a6f80.js +0 -1
  396. package/assets/esri/core/workers/chunks/c79827f879d1d58d3f1b.js +0 -1
  397. package/assets/esri/core/workers/chunks/c92b40a532e708e506cc.js +0 -1
  398. package/assets/esri/core/workers/chunks/cb903ccbce87172a0757.js +0 -1
  399. package/assets/esri/core/workers/chunks/cda2e445eb2ac269abdf.js +0 -1
  400. package/assets/esri/core/workers/chunks/ce44e172e2847fd8df14.js +0 -1
  401. package/assets/esri/core/workers/chunks/cff7e921649aef715c78.js +0 -1
  402. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +0 -1
  403. package/assets/esri/core/workers/chunks/d315098b038a96084ff5.js +0 -1
  404. package/assets/esri/core/workers/chunks/d4a9eb4470cc6a1f67fc.js +0 -2
  405. package/assets/esri/core/workers/chunks/d8c0d18f0132872decd3.js +0 -1
  406. package/assets/esri/core/workers/chunks/db0061a6d5bf454cc509.js +0 -1
  407. package/assets/esri/core/workers/chunks/dca595fdd5e1a571e441.js +0 -1
  408. package/assets/esri/core/workers/chunks/dcfafcf4386f2940d000.js +0 -1
  409. package/assets/esri/core/workers/chunks/df8143b72ef94806c992.js +0 -1
  410. package/assets/esri/core/workers/chunks/e2b034c391c603f7f825.js +0 -1
  411. package/assets/esri/core/workers/chunks/e3a73d9acebccd3ba49b.js +0 -1
  412. package/assets/esri/core/workers/chunks/e67bdd8bf38ebe89a344.js +0 -1
  413. package/assets/esri/core/workers/chunks/e797d45eba0884dc7e6f.js +0 -1
  414. package/assets/esri/core/workers/chunks/e81a3da05fcff97b4752.js +0 -1
  415. package/assets/esri/core/workers/chunks/e957d52cb9643961a843.js +0 -1127
  416. package/assets/esri/core/workers/chunks/e9dd60d0220036545ebb.js +0 -1
  417. package/assets/esri/core/workers/chunks/ea6d3b7c7d720aa7bc94.js +0 -1
  418. package/assets/esri/core/workers/chunks/eb9982bc866976fef960.js +0 -1
  419. package/assets/esri/core/workers/chunks/ec4669a0edeca94710e0.js +0 -1
  420. package/assets/esri/core/workers/chunks/ef013a77950c1902de11.js +0 -1
  421. package/assets/esri/core/workers/chunks/ef9d74f8d5a502fda809.js +0 -1
  422. package/assets/esri/core/workers/chunks/f09446b9ff937a84d6d3.js +0 -1
  423. package/assets/esri/core/workers/chunks/f0bc5e8e44d53b73d431.js +0 -1
  424. package/assets/esri/core/workers/chunks/f653970d983f17fb764b.js +0 -1
  425. package/assets/esri/core/workers/chunks/f9edc685099f51363f41.js +0 -1
  426. package/assets/esri/core/workers/chunks/fa687ba2d66fcc2501da.js +0 -1
  427. package/assets/esri/core/workers/chunks/fb9a889ec9fd23739a14.js +0 -1
  428. package/assets/esri/core/workers/chunks/fe1b67ab7748a3aef231.js +0 -1
  429. package/chunks/HUDCompositing.glsl.js +0 -2
  430. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +0 -7
  431. package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +0 -5
  432. package/views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js +0 -8
  433. package/views/3d/webgl-engine/effects/fboFormatUtils.js +0 -2
  434. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +0 -2
  435. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +0 -2
  436. package/views/3d/webgl-engine/shaders/HUDCompositing.glsl.js +0 -2
  437. package/views/3d/webgl-engine/shaders/HUDCompositingTechnique.js +0 -2
  438. /package/assets/esri/core/workers/chunks/{85edbb072a2ce6c1bb30.js.LICENSE.txt → 9eb4ae556950e1d0124d.js.LICENSE.txt} +0 -0
  439. /package/assets/esri/core/workers/chunks/{d4a9eb4470cc6a1f67fc.js.LICENSE.txt → d65b1234867f7d773d50.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c}from"../../../core/promiseUtils.js";import{initial as u,watch as _}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as g}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as x,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as S,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{set as R,transformMat4 as j,transformMat3 as V,sub as F,add as D,scale as A,subtract as T,len as H}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as N}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}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 z}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as W}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as $,toRect as K,create as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as J,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X,ensurePackedMat4f64 as Z}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as ee}from"../../../geometry/support/FloatArray.js";import{compactIndices as te}from"../../../geometry/support/Indices.js";import{Sphere as ie}from"../../../geometry/support/sphere.js";import{newUByteArray as se}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as re}from"../../../layers/LayerConstants.js";import oe from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as le,getOpacity as de}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{loadArcade as ue}from"../../../support/loadArcade.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import fe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as ye,setModificationsSync as be,filterObbsForModificationsSync as ve,interpretObbModificationResults as Ie}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ce,toWasmModification as Me}from"./SceneLayerWorkerHandle.js";import{overrideColor as xe}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ee}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Oe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Re,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ve}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as De,selectEncoding as Ae,defaultMaterial as Te,createTexture as He,configureMaterial as Ne}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Pe}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ue,checkSceneLayerValid as Le,checkSceneLayerCompatibleWithView as Ge,whenGraphicAttributes as Be,computeVisibilityObb as qe,filterInPlace as ze,intersectBoundingRectWithMbs as We,addWraparound as $e,getSymbolInfo as Ke,transparentEdgeMaterial as Qe,getClipRect as Je}from"./i3s/I3SUtil.js";import{IDBCache as Ye}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Ze}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as et}from"./i3s/SymbologyInfo.js";import{attributeLookup as tt}from"./support/attributeUtils.js";import{normalizeHighlightTarget as it,emptyHighlightHandle as st}from"./support/highlightUtils.js";import{makeScheduleFunction as rt}from"./support/makeScheduleFunction.js";import{debugFlags as ot}from"../support/debugFlags.js";import{ElevationRange as nt}from"../support/ElevationRange.js";import{toBoundingRect as at}from"../support/extentUtils.js";import{Obb as lt,ensurePackedObbData as dt}from"../support/orientedBoundingBox.js";import{updatingProgress as ht}from"../support/updatingProperties.js";import{glLayout as ct}from"../support/buffer/glUtil.js";import{ObjectParameters as ut}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as _t,ComponentGeometryParameters as mt,SourceGeometry as gt,VertexBufferLayoutCreationParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class xt extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const wt=27,St=104857600,Et=t=>{const f=t;let H=class extends f{constructor(){super(...arguments),this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,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 Re(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return 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>Ct}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 Ue(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ce(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Lt(0,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Lt(0,t);case"relative-to-ground":return new Lt(1,t);case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return De(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new nt;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Xe(this.view,e):new Ye("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Pe({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new Ce(rt(t)),this.addResolvingPromise(this._workerHandle.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),Le(this.i3slayer),Ge(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new oe({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection;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 n=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=n;const l=this._controller,h=this._nodeId2Meta,c=this._nodeId2MetaReloading,m=e=>{const t=l.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=h.get(i)||c.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:m}),this._elevationProvider=new Ze({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),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),u),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},u),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const g=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,g),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),u),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([_(()=>ot.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&ot.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||ot.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),_(()=>ot.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.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=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(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._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(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(!(we(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new fe({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=ye().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=Me(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{be({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l: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!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){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),!ot.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 me({...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._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.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")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return ct(_t(this._getGeometryParameters({hasTexture:At(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||re}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=tt(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 n of t){const e=tt(o,n.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=Ve(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return q(r,o,0,r,n,0)?$(r):null}whenGraphicAttributes(e,t){return Be(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(s))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${wt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===L(e))return $t;return this.i3slayer.spatialReference.equals(e)?zt: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(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Ae(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.globalTrafo=Z(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=lt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Tt(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);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s;e.hasModifications=h.hasModifications;const c=Z(s.globalTrafo),u=R(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new lt(u,[r.extents.x,r.extents.y,r.extents.z],O(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,m)){const t=null!=m.textureData?m.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...m,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,m,i)},i))):Promise.reject()}getElevationRange(e){const t=new nt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=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=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.calculateServiceMbsInRenderSRElevationAdjusted(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Jt(t,r,l):d?.isValid&&Yt(t,d,l),!1;const m=Qt;if(m.minElevation=1/0,m.maxElevation=-1/0,(null!=r||null!=d)&&(null!=r?Jt(m,r,l):null!=d&&Yt(m,d,l),m.minElevation>=t.minElevation&&m.maxElevation<=t.maxElevation))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Jt(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return qe(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,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=ke(a,l,n,d,c),_=z(d,h),m=z(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:m};return this._workerHandle.invoke(g,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(0===this.elevationInfo.mode&&(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),0!==this.elevationInfo.mode&&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:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:f,interleavedVertexData:p,positionData:y,hasColors:O}=n,{material:R,geometryParameters:j}=this._materialParameters(m,g),D=p.byteLength/g[0].stride,A=l||new Uint32Array([0,f?f.length:D]),T=m.transformation?S(m.transformation):E(),H=Z(t.globalTrafo);x(T,H,T);const P=w(N(),T),U=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(U,M),z=new mt(g,L,B,q?1:0,0),$=new gt({interleavedVertexData:p,vertexCount:D,indexData:f},{positions:ee(y.data),indices:te(y.indices)},A,z),K=this.view.renderSpatialReference,Q=this.view.basemapTerrain.spatialReference,J=lt.fromData(dt(t.geometryObbData)).center,Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const X=N();W(J,K,X,Q);const ie=C();I(ie,U);const se=N();V(se,F(se,J,P),ie);const re=X[0]-se[0]*Y[0],oe=X[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(R,a,ne,e),he=_.createObject(new ut(k(re,oe,Y[0],Y[1]),new pt(P,U),lt.fromData(dt(t.geometryObbData)),$,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!R.hasParametersFromSource,ue="blend"!==R.alphaMode&&R.metallicRoughness.baseColorFactor[3]>=1,_e=new xt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u);s.meta=_e,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=O,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(_e),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(_e.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,_e),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(he,!0),t?.updateObjectVisibility(_e.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),_e.attributeInfo=i.attributeInfo;const s=_e.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(_e);const o=_e.elevationOffsets;this._updateComponentData(_e);const n=this._applyFiltersToNode(_e);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(_e),null!=this._labeler&&this._addMetaToLabeler(this._labeler,_e),this._visibleGeometryChanged(_e,0),this._highlights?.objectCreated(_e),this._updateMaterial(_e),this._setNewNodeOpacity(_e),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)){o.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&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(null==n||null==o||0===a)return void(e.elevationOffsets=null);const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Gt,h=Bt,c=2===a,u=this.view.renderCoordsHelper,_=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=X(3*_);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<_;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(R(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),D(d,d,i),W(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),R(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),D(d,d,l.position),t[a+2]=u.getAltitude(d),W(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),g=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=g+(t??0)-i};r.getElevations(m,_,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ee(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=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;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,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Te(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=At(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>He(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Ne(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();s=new kt(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=J();this._renderClippingArea=at(this.view.clippingArea,i,e)?i:null;const s=J();this._layerClippingArea=at(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=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(_(()=>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,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.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=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.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))}}g(e,this._mismatchShow)&&g(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_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,2))})}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={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&ze(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Oe(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),We(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,Rt),Y(i,Rt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(jt,i,t.objectHandle);ze(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_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 n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(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 n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_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=Xt(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=Zt(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=a(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,1),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.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}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=$e(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return $e(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=$e(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 ue()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.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&&o.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=i*e.cachedSymbologyStride;P(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,n=he(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(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,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=se(e.featureIds.length*e.cachedSymbologyStride));const d=new et,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,m=Qe,g=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Oe(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=le(this._colorVariable,t,{color:Ft,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=de(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?xe(h,p,e.color,e.alpha,Mt,d.color):xe(h,p,null,null,Mt,d.color)}h??=P(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Qe;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Qe),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Qe:(r=r||t!==Qe,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const{objectHandle:t}=e,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.updateObjectOpacity(t.objectHandle,e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&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)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_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(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Je(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_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]=Oe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=it(e);if(0===s.length)return st;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return st;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>tt(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=Q();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(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.getObjectOpacity(e.objectHandle):0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}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.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(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=Pt(e);if(s){const t={context:i,buffer:s.buffer};ve(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ie(i);e.imModificationImpact=s,0!==s&&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.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}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||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=N(),a=N(),l=(e,t)=>{D(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),D(e,e,A(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>St?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([p()],H.prototype,"_hasLoadedPBRTextures",void 0),e([p()],H.prototype,"_asyncModuleLoading",void 0),e([p()],H.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],H.prototype,"view",void 0),e([p()],H.prototype,"i3slayer",void 0),e([p()],H.prototype,"_controller",void 0),e([p()],H.prototype,"_labeler",void 0),e([p()],H.prototype,"updating",void 0),e([p()],H.prototype,"suspended",void 0),e([p()],H.prototype,"contentVisible",null),e([p({readOnly:!0})],H.prototype,"legendEnabled",null),e([p(ht)],H.prototype,"updatingProgress",void 0),e([p()],H.prototype,"updatingProgressValue",null),e([p()],H.prototype,"hasTexturesOrVertexColors",null),e([p()],H.prototype,"rendererTextureUsage",null),e([p()],H.prototype,"elevationOffset",null),e([p()],H.prototype,"elevationInfo",null),e([p({type:Boolean})],H.prototype,"slicePlaneEnabled",void 0),e([p()],H.prototype,"supportedTextureEncodings",null),e([p({type:[ae]})],H.prototype,"_modifications",void 0),e([p({readOnly:!0})],H.prototype,"clientGeometry",null),e([p()],H.prototype,"elevationRange",null),e([p()],H.prototype,"fullExtent",null),e([p()],H.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],H.prototype,"_usePBR",null),H=e([y("esri.views.3d.layers.I3SMeshView3D")],H),H},Ot=Q(),Rt=J(),jt=J(),Vt=new lt,Ft=new t([0,0,0,0]),Dt=new ie(0,0,0,0);function At(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 Tt(e){return"geometryData"in e}function Ht(e){return null!=e&&f(e.data)}function Nt(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&&f(s.data)&&(i+=s.data.byteLength);return i}function Pt(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=Vt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());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 kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=N(),Bt=Q(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new nt;function Jt(e,t,i){let s=e.minElevation,r=e.maxElevation;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=H(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Yt(e,t,i){const{center:s,radius:r}=t,o=i>0?H(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Xt(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 Zt(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,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(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)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{Et as I3SMeshView3D};
2
+ import{__decorate as e}from"tslib";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import has from"../../../core/has.js";import o from"../../../core/Logger.js";import{equals as n}from"../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c}from"../../../core/promiseUtils.js";import{initial as u,watch as _}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{equals as g}from"../../../core/SetUtils.js";import{isArrayBuffer as f}from"../../../core/typedArrayUtil.js";import{property as p,subclass as y}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as b,exactEquals as v,invert as I}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as C,IDENTITY as M}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as x,getTranslation as w}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as S,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{set as R,transformMat4 as j,transformMat3 as V,sub as F,add as D,scale as A,subtract as T,len as H}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as N}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as P}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as U}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 z}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as W}from"../../../geometry/projection/projectVectorToVector.js";import{fromBuffer as $,toRect as K,create as Q}from"../../../geometry/support/aaBoundingBox.js";import{create as J,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X,ensurePackedMat4f64 as Z}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as ee}from"../../../geometry/support/FloatArray.js";import{compactIndices as te}from"../../../geometry/support/Indices.js";import{Sphere as ie}from"../../../geometry/support/sphere.js";import{newUByteArray as se}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as re}from"../../../layers/LayerConstants.js";import oe from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as ne}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as le,getOpacity as de}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{isBasemapLayerView as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{loadArcade as ue}from"../../../support/loadArcade.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import{ContentGeometryUpdateEvent as ge}from"./ContentGeometryLayerView.js";import fe from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{initialize as ye,setModificationsSync as be,filterObbsForModificationsSync as ve,interpretObbModificationResults as Ie}from"./SceneLayerWorker.js";import{SceneLayerWorkerHandle as Ce,toWasmModification as Me}from"./SceneLayerWorkerHandle.js";import{overrideColor as xe}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ee}from"./i3s/I3SAsyncElevationUpdater.js";import{getCachedAttributeValue as Oe}from"./i3s/I3SBinaryReader.js";import{I3SCrossfadeHelper as Re,NodeCrossfadeMetaData as je}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ve}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as De,selectEncoding as Ae,defaultMaterial as Te,createTexture as He,configureMaterial as Ne}from"./i3s/I3SMaterialUtil.js";import{I3SOverrides as Pe}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as ke}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ue,checkSceneLayerValid as Le,checkSceneLayerCompatibleWithView as Ge,whenGraphicAttributes as Be,computeVisibilityObb as qe,filterInPlace as ze,intersectBoundingRectWithMbs as We,addWraparound as $e,getSymbolInfo as Ke,transparentEdgeMaterial as Qe,getClipRect as Je}from"./i3s/I3SUtil.js";import{IDBCache as Ye}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as Ze}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as et}from"./i3s/SymbologyInfo.js";import{attributeLookup as tt}from"./support/attributeUtils.js";import{normalizeHighlightTarget as it,emptyHighlightHandle as st}from"./support/highlightUtils.js";import{makeScheduleFunction as rt}from"./support/makeScheduleFunction.js";import{debugFlags as ot}from"../support/debugFlags.js";import{ElevationRange as nt}from"../support/ElevationRange.js";import{toBoundingRect as at}from"../support/extentUtils.js";import{Obb as lt,ensurePackedObbData as dt}from"../support/orientedBoundingBox.js";import{updatingProgress as ht}from"../support/updatingProperties.js";import{glLayout as ct}from"../support/buffer/glUtil.js";import{ObjectParameters as ut}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as _t,ComponentGeometryParameters as mt,SourceGeometry as gt,VertexBufferLayoutCreationParameters as ft}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as pt}from"../webgl-engine/collections/Component/Transform.js";import{emissiveStrengthDefault as yt}from"../webgl-engine/core/shaderLibrary/output/Emissions.glsl.js";import{loadBasisTranscoder as bt}from"../webgl-engine/lib/BasisUtil.js";import{getHighlightName as vt}from"../../support/highlightOptionsUtils.js";import{TextureCompressionTracker as It}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Ct}from"../../../webscene/support/AlphaCutoff.js";const Mt=[1,1,1,1];class xt extends je{constructor(e,t,i,s,r,o,n,a,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=n,this.anchorIds=a,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbologyStride=5}get usedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}const wt=27,St=104857600,Et=t=>{const f=t;let H=class extends f{constructor(){super(...arguments),this._applySSAO=!0,this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._updatingHandles=new U,this._highlights=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._compressionTracker=new It,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 Re(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerViewUid(){return this.uid}get layerId(){return 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>Ct}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 Ue(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?63:53:this._usePBR||this._hasLoadedPBRTextures?44:36}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ce(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Lt(0,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Lt(0,t);case"relative-to-ground":return new Lt(1,t);case"on-the-ground":return new Lt(2,0);default:return new Lt(0,0)}}get supportedTextureEncodings(){return De(this.view.stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new nt;for(const i of e.values()){const e=i?.node.serviceMbsInIndexSR;e&&t.expandElevationRangeValues(e.center[2]-e.radius,e.center[2]+e.radius)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new Xe(this.view,e):new Ye("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Pe({view:this.view,layer:this.i3slayer,memoryController:i}),this._workerHandle=new Ce(rt(t)),this.addResolvingPromise(this._workerHandle.promise),Le(this.i3slayer),Ge(this.i3slayer,this.view);const s=this.i3slayer.store.defaultGeometrySchema;if(this.addResolvingPromise(this._workerHandle.setLegacySchema(this.uid,s).catch(d)),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new oe({layerView:this,worker:this._workerHandle}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view.stage,this._collection=this._stage.renderView.componentObjectCollection,this._isIntegratedMesh||!s)this._hasComponentData=!1;else{const e=s.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(s?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const r=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,e=>this._deleteComponentObject(e));this._memCache=r;const n=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=n.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerViewUid:this.layerViewUid,sublayerId:this.sublayerId,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._elevationProvider=new Ze({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add(()=>this.view.clippingArea,()=>this._clippingAreaChanged(),u),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),u),this._updatingHandles.add(()=>!this.suspended&&0!==this.elevationInfo.mode,(e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",({extent:e})=>this._ensureElevationTask().addExtent(e)),qt):t&&this.removeHandles(qt)},u),this._updatingHandles.add(()=>this._usePBR,e=>this._updatePBR(e));const m=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add(()=>this.rendererTextureUsage,m),this._updatingHandles.add(()=>this.contentVisible,e=>this._contentVisibleChanged(e),u),this._updatingHandles.add(()=>this.i3slayer.labelsVisible,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this.i3slayer.labelingInfo,()=>this._labelingChanged(),u),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged(),u),this.addHandles([_(()=>ot.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then(({I3STreeDebugger:t})=>{!this._treeDebugger&&ot.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else e||ot.I3S_TREE_SHOW_TILES||(this._treeDebugger=a(this._treeDebugger))},u),_(()=>ot.I3S_SHOW_MODIFICATIONS,()=>this._showModifications(),u)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch(e=>o.getLogger(this).warn(`Failed to initialize IndexedDB cache: ${e}`));const{view:g}=this,{viewingMode:f,renderCoordsHelper:p}=g;this._planetRadiusInGlobalMode="local"===f?0:p.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=a(this._elevationTask),this.i3sOverrides=a(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.notifyObjectsChanged(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._workerHandle;e&&(e.destroyContextAndSelf(this.uid),this._workerHandle=null),this._removeAllNodeDataFromStage(),this._memCache=a(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=a(this._labeler),this._treeDebugger=a(this._treeDebugger),this._controller=a(this._controller),this._highlights=a(this._highlights),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=a(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=a(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(!(we(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new fe({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=ye().then(()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()}),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=e=>o.getLogger(this).error("set-modifications-error","Error when setting modifications:",e),t=this.uid,i=this.i3slayer.spatialReference,s=i.isGeographic,r=Me(this._layerClippingArea,this._modifications,i);this._workerHandle.setModifications(t,r,s).catch(e);try{be({context:t,modifications:r,isGeodetic:s})}catch(a){e(a)}this._controller.modificationsChanged();const n=this.hasModifications?new l: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!=n&&n.push(e.node)}),this.notifyChange("elevationRange"),null!=n&&this._nodeId2MetaReloading.forEach(e=>n.push(e.node)),null!=n&&n.length>0&&(this.updateNodeModificationStatus(n),n.forAll(e=>{if(2!==e.imModificationImpact){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),!ot.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 me({...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._nodeId2Meta.get(e)===s&&this._attributeValuesChanged(s)},i).catch(e=>{h(e)||o.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")&&2&this.supportedTextureEncodings&&this.i3slayer.textureSetDefinitions?.some(e=>e.formats.some(e=>"basis"===e.format||"ktx2"===e.format))&&bt()}_getVertexBufferLayout(e,t){return ct(_t(this._getGeometryParameters({hasTexture:At(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||re}_getGlobalIdField(){return this.i3slayer.globalIdField}_findGraphicNodeAndIndex(e){const t=tt(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 n of t){const e=tt(o,n.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=Ve(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,n=this.view.spatialReference;return q(r,o,0,r,n,0)?$(r):null}whenGraphicAttributes(e,t){return Be(this.i3slayer,e,this._getObjectIdField(),t,()=>[...this._nodeId2Meta.values()].filter(s))}getGraphicFromIntersectorTarget(e,t){if(null==e.nodeIndex||null==e.componentIndex)return null;const i=this._nodeId2Meta.get(e.nodeIndex);if(null==i?.featureIds||e.componentIndex>=i.featureIds.length)return null;const s=this._createLayerGraphic(this._createAttributes(e.componentIndex,i));return s?t.defer?(t.defer(async()=>(s.geometry=(await import("./i3s/meshUtils.js")).createMesh({layerView:this,nodeIndex:e.nodeIndex,featureIndex:e.componentIndex}),s)),null):s:null}_getCacheKey(e){return`${this._layerUrl}/v${wt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return Wt;if(e===L(e))return $t;return this.i3slayer.spatialReference.equals(e)?zt: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(0===(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Ae(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.globalTrafo=Z(s.globalTrafo),s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=lt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then(i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Nt(s.transformedGeometry,s.textureData),s.textureData.every(Ht)&&this._indexedDbSizeCheck(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch(t=>o.getLogger(this).warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`))),c(t),s))))):Promise.resolve(null)}addNode(e,t,i){return Tt(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);const{obb:r,componentOffsets:n,featureIds:a,anchorIds:l,anchors:d,transformedGeometry:h}=s;e.hasModifications=h.hasModifications;const c=Z(s.globalTrafo),u=R(Gt,r.center.x,r.center.y,r.center.z);j(u,u,c);const _=new lt(u,[r.extents.x,r.extents.y,r.extents.z],O(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));0===this.elevationInfo.mode&&(e.geometryObbInRenderSR=_),t.geometryData.componentOffsets=n,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=l,t.geometryData.anchors=d;const m={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:h,globalTrafo:c,geometryObbData:_.data,byteSize:Nt(h,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&this._indexedDbSizeCheck(e,m)){const t=null!=m.textureData?m.textureData.map(e=>Ht(e)?e:null):null;this._idbCache.put(this._getCacheKey(e.id),{...m,textureData:t}).catch(t=>o.getLogger(this).warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`))}return this._addCachedNodeData(e,m,i)},i))):Promise.reject()}getElevationRange(e){const t=new nt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,n=e.radius,a=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=a.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=a.calculateServiceMbsInRenderSRElevationAdjusted(i),d&&(_=d.radius);if(_>=0&&n>=1*_)return null!=r?Jt(t,r,l):d?.isValid&&Yt(t,d,l),!1;const m=Qt;if(m.minElevation=1/0,m.maxElevation=-1/0,(null!=r||null!=d)&&(null!=r?Jt(m,r,l):null!=d&&Yt(m,d,l),m.minElevation>=t.minElevation&&m.maxElevation<=t.maxElevation))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(n>0*s.radius)return Jt(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return qe(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,n=t.normalReferenceFrame??o??"none",a=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=ke(a,l,n,d,c),_=z(d,h),m=z(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:a.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid||this._imVertexNormals,computeNormals:this._isIntegratedMesh&&this._imVertexNormals,normalReferenceFrame:n,indexToVertexProjector:_,vertexToRenderProjector:m};return this._workerHandle.invoke(g,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(0===this.elevationInfo.mode&&(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),0!==this.elevationInfo.mode&&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:n}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const a=null!=t.textureData?t.textureData.filter(e=>null!=e&&0!==(e.usage&this.rendererTextureUsage)):[];!has("disable-feature:i3s-basis")&&a.some(e=>null!=e&&(2===e.encoding||1===e.encoding))&&await bt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:f,interleavedVertexData:p,positionData:y,hasColors:O}=n,{material:R,geometryParameters:j}=this._materialParameters(m,g),D=p.byteLength/g[0].stride,A=l||new Uint32Array([0,f?f.length:D]),T=m.transformation?S(m.transformation):E(),H=Z(t.globalTrafo);x(T,H,T);const P=w(N(),T),U=b(C(),T),L=this._isIntegratedMesh?this._imShading?2:0:1,B=j.textureCoordinateType,q=!v(U,M),z=new mt(g,L,B,q?1:0,0),$=new gt({interleavedVertexData:p,vertexCount:D,indexData:f},{positions:ee(y.data),indices:te(y.indices)},A,z),K=this.view.renderSpatialReference,Q=this.view.basemapTerrain.spatialReference,J=lt.fromData(dt(t.geometryObbData)).center,Y=[1,1,1];G(J,K,Y,Q)||o.getLogger(this).errorOnce("Unsupported coordinate system for IM overlay");const X=N();W(J,K,X,Q);const ie=C();I(ie,U);const se=N();V(se,F(se,J,P),ie);const re=X[0]-se[0]*Y[0],oe=X[1]-se[1]*Y[1],ne=2===j.textureCoordinateType,{textures:ae,texturePromise:le,materialParameters:de}=this._initMaterialAndTextures(R,a,ne,e),he=_.createObject(new ut(k(re,oe,Y[0],Y[1]),new pt(P,U),lt.fromData(dt(t.geometryObbData)),$,!this._isIntegratedMesh),de);e.memory+=this._memEstimateGeometryAdded(he),e.memory+=ae.reduce((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0),0);const ce=!!R.hasParametersFromSource,ue="blend"!==R.alphaMode&&R.metallicRoughness.baseColorFactor[3]>=1,_e=new xt(e,h,he,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:ce,isOpaque:ue},ae,c,u);s.meta=_e,this._hasTextures||=t.requiredTextures?.some(({usage:e})=>!!(19&e))||!!e.resources.texture,this._hasData=!0,this._hasColors||=O,this.notifyChange("hasTexturesOrVertexColors");const me=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(_e),le]).then(([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(_e.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,_e),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(he,!0),t?.updateObjectVisibility(_e.objectHandle,!0).catch(e=>this._logEdgeViewError(e,this.i3slayer.title)),_e.attributeInfo=i.attributeInfo;const s=_e.cachedRendererVersion!==this._rendererVersion,r=me!==this.slicePlaneEnabled;this._updateElevationOffsets(_e);const o=_e.elevationOffsets;this._updateComponentData(_e);const n=this._applyFiltersToNode(_e);(s||null!=t&&(r||n||o))&&this._addOrUpdateEdgeRendering(_e),null!=this._labeler&&this._addMetaToLabeler(this._labeler,_e),this._visibleGeometryChanged(_e,0),this._highlights?.objectCreated(_e),this._updateMaterial(_e),this._setNewNodeOpacity(_e),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)){o.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&&Ut(t.cachedEdgeMaterials,0),this._updateFeatureIdCounts(t,1)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){if(!e.node.serviceMbsInIndexSR)return;const{view:t,elevationInfo:i}=this,s=this._controller.crsIndex,{groundView:r,groundSpatialReference:o,renderSpatialReference:n}=t,a=i.mode;if(null==n||null==o||0===a)return void(e.elevationOffsets=null);const l=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const d=Gt,h=Bt,c=2===a,u=this.view.renderCoordsHelper,_=e.featureIds.length,m=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const t=X(3*_);e.cachedElevationAnchors=t;const{center:i}=e.node.serviceMbsInIndexSR;for(let r=0;r<_;r++){const a=3*r,c=e.anchorIds?.indexOf(r)??-1;e.anchors&&c>=0?(R(d,e.anchors[3*c],e.anchors[3*c+1],e.anchors[3*c+2]),D(d,d,i),W(d,s,d,o),t[a]=d[0],t[a+1]=d[1],t[a+2]=u.getAltitude(d)):(this._collection.getComponentAabb(e.objectHandle,r,h,!0),R(d,(h[0]+h[3])/2,(h[1]+h[4])/2,h[2]),V(d,d,l.rotationScale),D(d,d,l.position),t[a+2]=u.getAltitude(d),W(d,n,d,o),t[a]=d[0],t[a+1]=d[1])}return t})(),g=i.offset,f=e.elevationOffsets,p=(e,t)=>{const i=c?m[3*e+2]:0;f[e]=g+(t??0)-i};r.getElevations(m,_,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ee(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=0!==e.mode,s=!!t&&t!==e&&0!==t.mode;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,2),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:Te(),s=t.some(({name:e})=>"uvRegion"===e),r=t.some(({name:e})=>"normalCompressed"===e),o=At(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=e=>{this._gpuMemoryEstimate-=e,this._texMemoryEstimate-=e,s.memory-=e},n=t.map(t=>He(t,e,i,r,this._compressionTracker,o));this._stage.addTextures(n);const{materialParameters:a,texturePromise:l}=Ne(e,n,t,this.view.stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference,applySSAO:this._applySSAO});return{textures:n,texturePromise:l,materialParameters:a}}_getGeometryParameters(e){return new ft(this._hasVertexColors,e.hasNormals,e.hasTexture?e.hasRegions?2:1:0)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=Promise.withResolvers();s=new kt(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=J();this._renderClippingArea=at(this.view.clippingArea,i,e)?i:null;const s=J();this._layerClippingArea=at(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=ti(this._nodeId2Meta.values()),this._filteredIdCounts=ti(this._nodeId2Meta.values(),1),this._weaklyRemovedIdCounts=ti(this._nodeId2Meta.values(),2),this.addHandles(_(()=>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,ei(this._featureIdCounts,e.featureIds,t),ei(this._filteredIdCounts,e.filteredIds,t),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,t))}_updateFilteredIdCounts(e,t,i){this._filteredIdCounts&&(this._needFilterResolve=!0,ei(this._filteredIdCounts,t,-1),ei(this._filteredIdCounts,e.filteredIds,1),ei(this._weaklyRemovedIdCounts,i,-1),ei(this._weaklyRemovedIdCounts,e.weaklyRemovedIds,1))}_checkFeatureIdNodeCountInvariant(){const e=null!=this._featureIdCounts;if(this.hasGeometryFilter!==e&&o.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=ti(this._nodeId2Meta.values());n(this._featureIdCounts,t)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _featureIdCounts",{layerView:this,counts:this._featureIdCounts,expected:t});const i=ti(this._nodeId2Meta.values(),1);n(this._filteredIdCounts,i)||o.getLogger(this).error("checkFeatureIdNodeCountInvariant()","Incorrect _filteredIdCounts",{layerView:this,counts:this._filteredIdCounts,expected:i});const s=ti(this._nodeId2Meta.values(),2);n(this._weaklyRemovedIdCounts,s)||o.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))}}g(e,this._mismatchShow)&&g(t,this._mismatchHide)||(this._mismatchShow=e,this._mismatchHide=t,this._nodeId2Meta.forEach(e=>{if(!e?.filteredIds)return;const t=Zt(e,this._mismatchShow,this._mismatchHide);this._collection.setAllComponentVisibilities(e.objectHandle,t),this._visibleGeometryChanged(e,2)}))}_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,2))})}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={},n=this._createLayerGraphic(o);if(!n)return;const a=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every(e=>e===a||null!=d?.[e])&&ze(e,l,e=>{o[a]=l[e];for(const i of s)i!==a&&(o[i]=d?Oe(d[i],e):null);try{return i.testFeature(n)}catch(t){return r(t),!1}})}_boundingRectNodeTest(e,t){return B(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Dt,this.view.renderSpatialReference),We(t,Dt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ot),K(Ot,Rt),Y(i,Rt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(3===r)return;if(0===r)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const n=this._transformClippingArea(jt,i,t.objectHandle);ze(e,t.featureIds,e=>this._boundingRectFeatureTest(t,e,n))}_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 n=o.hasObject(i);if(s){if(n){if(this.nodeCrossfadingEnabled){Ut(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 n&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){const{filteredIds:t,weaklyRemovedIds:i}=e,s=this._applyFiltersToNodeComponents(e);return this._updateFilteredIdCounts(e,t,i),s&&this._labeler?.applyFilterChange(e),s}_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=Xt(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=Zt(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=a(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,1),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.removeTexture(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&i.objectHandle.updateMaterial({polygonOffset:0===t?1:0})}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=$e(this._rendererVersion,1),this._controller?.requestUpdate()}_getInvalidRendererVersion(){return $e(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=$e(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 ue()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:o.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&&o.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=i*e.cachedSymbologyStride;P(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,n=he(this.view,this.uid);o.setUidToObjectAndLayerId(t,t,this.layerId,r,this.layerPopupEnabledAndHasTemplate&&!n,e.node.resources.attributes,i,this.sublayerId),s.olidColor=o.getObjectAndLayerIdColor({graphicUid:t,layerViewUid:r})}s.externalColorMixMode=15&t[r+4],s.castShadows=!!(16&t[r+4]),s.pickable=!!(32&t[r+4]),s.elevationOffset=e.elevationOffsets?.[i]??0,s.emissiveStrength=e.emissiveStrengths?.[i]??1,s.emissiveSource=e.emissiveSources?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(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,n=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let a=null,l=null;if(n&&null!=this._symbologyFields){a=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(a.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=se(e.featureIds.length*e.cachedSymbologyStride));const d=new et,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=1,m=Qe,g=0;for(let f=0;f<e.featureIds.length;f++){if(null!=o&&(i[o]=e.featureIds[f]),n&&a)for(let e=0;e<a.length;e++)i[a[e]]=Oe(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=le(this._colorVariable,t,{color:Ft,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=de(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==p?xe(h,p,e.color,e.alpha,Mt,d.color):xe(h,p,null,null,Mt,d.color)}h??=P(d.color,1,1,1,1);const y=r?.material;if(d.colorMixMode=y?.colorMixMode??1,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=3),d.pickable&&=h[3]>=Ct,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||3===d.colorMixMode)?1:0;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[f]=m}else e.cachedEdgeMaterials[f]=Qe;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<4|+d.pickable<<5;const b=y?.emissive?.strength??yt;b===yt||e.emissiveStrengths||(e.emissiveStrengths=new Array(e.featureIds.length).fill(yt)),e.emissiveStrengths&&(e.emissiveStrengths[f]=b);const v=y?.emissive?.source||0;0===v||e.emissiveSources||(e.emissiveSources=new Array(e.featureIds.length).fill(0)),e.emissiveSources&&(e.emissiveSources[f]=v)}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Ut(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some(e=>e!==Qe),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map((t,o)=>e.featureIds[o]!==i[s]?Qe:(r=r||t!==Qe,s++,t));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const{objectHandle:t}=e,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.updateObjectOpacity(t.objectHandle,e),Ut(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))})}_updateMaterial(e){e.objectHandle.updateMaterial({slicePlaneEnabled:this.slicePlaneEnabled,usePBR:this._usePBR})}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,2)}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._foreachMeta(t=>{t.objectHandle.updateMaterial({slicePlaneEnabled:e}),this._updateEdgeRendering(t,!1)})}_updatePBR(e){this._foreachMeta(t=>t.objectHandle.updateMaterial({usePBR:e})),this._hasLoadedPBRTextures=!0}_foreachMeta(e){this._nodeId2Meta.forEach(t=>{null!=t&&e(t)})}get _usePBR(){return this._imShading&&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)?0:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values())if(!(null==s||t&&s.node.serviceMbsInIndexSR&&1===t(s.node.serviceMbsInIndexSR)))switch(i){case 1:this._forAllFeaturesOfNode(s,e);break;case 0:this._forAllVisibleFeaturesOfNode(s,e);break;case 2:this._forAllQueryableFeaturesOfNode(s,e)}}_forAllFeaturesOfNode(e,t){e.featureIds.forEach((i,s)=>t(i,s,e))}_forAllVisibleFeaturesOfNode(e,t){const i=e.featureIds;this._collection.forEachVisibleComponent(e.objectHandle,s=>0===t(i[s],s,e))}_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(0===s)return;if(3===s)return this._forAllFeaturesOfNode(e,i);const r=e.featureIds,o=e.objectHandle,n=Je(this._renderClippingArea,this._collection.getObjectTransform(o));for(let a=0;a<r.length;a++)this._boundingRectFeatureTest(e,a,n)&&i(r[a],a,e)}_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]=Oe(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){const s=it(e);if(0===s.length)return st;const r=vt(t),o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return st;const n=this._ensureHighlights(),{set:a,handle:l}=n.acquireSet(r);return n.setFeatureIds(a,o),l}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map(e=>tt(t,e.attributes,i))}_ensureHighlights(){return this._highlights??=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,1),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._highlights}resetHighlights(){this._highlights=a(this._highlights)}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m(()=>{const{node:t}=e,i=t.visibilityObbInRenderSR??t.geometryObbInRenderSR??t.serviceObbInRenderSR;if(null!=i){const e=Q();i.toAaBoundingBox(e),this.emit("visible-geometry-changed",new ge(e))}else this.emit("visible-geometry-changed");this._visibleGeometryChangedSchedulerHandle=null})),this._updateSnappingSources(e,t),this._elevationProvider.notifyObjectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(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.getObjectOpacity(e.objectHandle):0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}getNodeComponentHandle(e){return this._nodeId2Meta.get(e)?.objectHandle}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.updateObjectOpacity(e.objectHandle,t),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Ut(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=Pt(e);if(s){const t={context:i,buffer:s.buffer};ve(t);const r=new Float64Array(s.buffer);e.forAll((e,t)=>{const i=r[t],s=Ie(i);e.imModificationImpact=s,0!==s&&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.readyToRun||this._needFilterResolve||this._compressionTracker.compressing}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||0===this.elevationInfo.mode)return;const s=t.position0,r=t.position1,o=t.componentIndex,n=N(),a=N(),l=(e,t)=>{D(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,a),D(e,e,A(a,a,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,n),l(n,t),s.setVec(d,n),r.getVec(d,n),l(n,t),r.setVec(d,n)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)1!==t&&2!==t||r.events.remove(i),0!==t&&2!==t||r.events.add(i,s)}_logEdgeViewError(e,t){h(e)||o.getLogger(this).warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}_indexedDbSizeCheck(e,t){return t.byteSize>St?(o.getLogger(this).warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}get elevationProvider(){return this._elevationProvider}};return e([p()],H.prototype,"_hasLoadedPBRTextures",void 0),e([p()],H.prototype,"_asyncModuleLoading",void 0),e([p()],H.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([p()],H.prototype,"view",void 0),e([p()],H.prototype,"i3slayer",void 0),e([p()],H.prototype,"_controller",void 0),e([p()],H.prototype,"_labeler",void 0),e([p()],H.prototype,"updating",void 0),e([p()],H.prototype,"suspended",void 0),e([p()],H.prototype,"contentVisible",null),e([p({readOnly:!0})],H.prototype,"legendEnabled",null),e([p(ht)],H.prototype,"updatingProgress",void 0),e([p()],H.prototype,"updatingProgressValue",null),e([p()],H.prototype,"hasTexturesOrVertexColors",null),e([p()],H.prototype,"rendererTextureUsage",null),e([p()],H.prototype,"elevationOffset",null),e([p()],H.prototype,"elevationInfo",null),e([p({type:Boolean})],H.prototype,"slicePlaneEnabled",void 0),e([p()],H.prototype,"supportedTextureEncodings",null),e([p({type:[ae]})],H.prototype,"_modifications",void 0),e([p({readOnly:!0})],H.prototype,"clientGeometry",null),e([p()],H.prototype,"elevationRange",null),e([p()],H.prototype,"fullExtent",null),e([p()],H.prototype,"_elevationTask",void 0),e([p({readOnly:!0})],H.prototype,"_usePBR",null),H=e([y("esri.views.3d.layers.I3SMeshView3D")],H),H},Ot=Q(),Rt=J(),jt=J(),Vt=new lt,Ft=new t([0,0,0,0]),Dt=new ie(0,0,0,0);function At(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 Tt(e){return"geometryData"in e}function Ht(e){return null!=e&&f(e.data)}function Nt(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&&f(s.data)&&(i+=s.data.byteLength);return i}function Pt(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=Vt,e.serviceMbsInIndexSR?(t.center=e.serviceMbsInIndexSR.center,t.halfSize=[e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius,e.serviceMbsInIndexSR.radius]):t.invalidate());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 kt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Ut(e,t){e.forEach(e=>e.opacity=t)}class Lt{constructor(e,t){this.mode=e,this.offset=t}}const Gt=N(),Bt=Q(),qt="elevation-change",zt="",Wt="@null",$t="@ECEF",Kt=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Qt=new nt;function Jt(e,t,i){let s=e.minElevation,r=e.maxElevation;const o=i;if(o>0){t.getCorners(Kt);for(const e of Kt){const t=H(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(Kt);for(const e of Kt){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function Yt(e,t,i){const{center:s,radius:r}=t,o=i>0?H(s)-i:s[2];e.expandElevationRangeValues(o-r,o+r)}function Xt(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 Zt(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,n)=>{if(r[o]===e)++o;else if(!t?.has(e))return;i?.has(e)||s.push(n)})}}else e.featureIds.forEach((e,t)=>{r[s.length]===e&&s.push(t)});return s}function ei(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)}}function ti(e,t=0){const i=new Map;for(const s of e){ei(i,0===t?s?.featureIds:1===t?s?.filteredIds:s?.weaklyRemovedIds,1)}return i}export{Et as I3SMeshView3D};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as c,subclass as d}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as m,fromQuat as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,add as w,length as j,transformMat3 as x,set as C,abs as M,max as E}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as T,fromValues as R,clone as U,ZEROS as V}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as S,clone as H,fromValues as A}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as I,SphericalECEFSpatialReferenceLike as P}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as D}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as F}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as G}from"../../../geometry/projection/projectVectorToVector.js";import{create as B}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as z}from"../../../geometry/support/Indices.js";import{isCGCS2000 as N}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec2f as q,BufferViewVec4f as W,BufferViewVec4u8 as $,BufferViewVec4u16 as Z,BufferViewVec3f as J,BufferViewVec3u8 as X,BufferViewVec3u16 as Y,BufferViewInt16 as K,BufferViewUint32 as Q,BufferViewUint16 as ee}from"../../../geometry/support/buffer/BufferView.js";import te from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ie}from"../../../support/elevationInfoUtils.js";import{addNormals as se}from"./IntegratedMeshNormals.js";import{LayerView3D as re}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as oe}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as ne,removeLayerViewFromWasm as ae,getLyr3DWasm as le}from"./Lyr3DWasm.js";import{toWasmModification as ce}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as de}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as he}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as me,alphaModeConversion as ue,faceCullingConversion as pe,wrapModeConversion as fe,lyr3DTypeToByteSize as be}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as ye}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as ge}from"../state/Frustum.js";import{ElevationRange as _e}from"../support/ElevationRange.js";import{toBoundingRect as ve}from"../support/extentUtils.js";import{Obb as we,compute as je}from"../support/orientedBoundingBox.js";import{glLayout as xe}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as Ce,createVertexBufferLayout as Me,ComponentGeometryParameters as Ee,SourceGeometry as Oe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Te}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Re}from"../webgl-engine/core/material/RenderTexture.js";import{Vertices as Ue,Attribute as Ve}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Se}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as He}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ae}from"../webgl-engine/materials/pbrUtils.js";import{writeAttribute as Le,writeBufferVec2 as ke}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Ie from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Pe,isInEffectiveScaleRange as De,validateScaleRange as Fe}from"../../support/layerViewUtils.js";import{TaskPriority as Ge}from"../../support/Scheduler.js";import{TextureCompressionTracker as Be}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as ze}from"../../../webscene/support/AlphaCutoff.js";var Ne;let qe=class extends(re(Ie)){static{Ne=he}constructor(e){super(e),this[Ne]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Be,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Ge.TILES3D),this._frustum=new ge(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Pe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=ne(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new ye(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new de({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),ae(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ce(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=B();this._layerClippingArea=ve(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,ie(e))}get _wasm(){return le(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||De(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Fe(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new oe(this.usedMemory,r,o,Ze(t),Ze(e),Ze(s),Ze(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ie(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new _e(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new _e;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||N(i)||L(i)||k(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=I(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(O(),n),c=500,d=Math.max(o[2],c),h=d+r,m=Math.sqrt(h**2-r**2),u=Math.abs(Math.atan2(m,r))*r,p=d>.5*r?.5*Math.PI*r:u,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){return this._frameTask.schedule(()=>this._createRenderable(e))}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=T(...t.desc.origin),s=this.view.basemapTerrain.spatialReference;let r=f;if(this.view.state.isGlobal){const e=b();D(P,i,e,s),r=h(p(),e)}const o=O();if(null==t.desc.obb)throw new Error("meshData.desc.obb undefined");const n=Ye(t.desc.obb);let a=0;const l={textureMemoryUsage:0},c=new Array,d=new Map,u=t.desc.prims.length,y=new Array,g=new _e;try{const e=this.view.state.isGlobal,h=e?I(this.view.spatialReference).radius:0,b=O();for(let y=0;y<u;y++){const u=t.desc.prims[y];this._dbg(2,JSON.stringify(u));if(null==me[u.ptype]||null==t.data){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+u.ptype+"). Skipping primitive.");continue}const _=t.desc?.materials&&null!=u.materialId?t.desc.materials[u.materialId]:null,v=null!=_?_.lightingModel:"Unlit",{positionView:M,positionAttr:E,normalsView:T,normalsAttr:V,colorAttr:L,texCoord0Attr:k,indicesView:I}=this.getBufferViews(u,t.data.buffer,r);if(null==E||null==M||null==I)continue;const P=M.count,D=(e,t)=>!e||e.data.length/e.size===P||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!D(k,"numTexcoord")||!D(L,"numColors")||!D(V,"normals"))continue;const B=new Ce(null!=L,null!=T,k?1:0),z=Me(B);for(let t=0;t<M.count;t++){M.getVec(t,o),w(o,o,i);const s=e?j(o)-h:o[2];g.expandElevationRangeValues(s,s)}if(n){et(n,b,new Ue(E.data,3),i)}const N=n?.clone()??Xe(E,i);if(r!==f)for(let e=0;e<M.count;e++)M.getVec(e,o),x(o,o,r),M.setVec(e,o);const W=z.createBuffer(P);if(Le("position",E,null,null,W,0),null!=k){const e=W.getField("uv0",q);ke(k,e,0)}null!=L&&Le("color",L,null,null,W,0),null!=V&&Le("normalCompressed",V,null,null,W,0);const $=new Uint32Array([0,I.typedBuffer.length]),Z=xe(z),J=this._imVertexNormals,X=r===f?f:m(p(),r)??f,Y=se(new Uint8Array(W.buffer),I.typedBuffer,Z,J,J?X:void 0),K=new Ee(Z,this._imShading?2:0,B.textureCoordinateType,r!==f?1:0,0),Q=new Oe({interleavedVertexData:Y.data,vertexCount:Y.data.byteLength/Z[0].stride,indexData:Y.indices},{positions:M.typedBuffer,indices:I.typedBuffer},$,K),ee=this.view.renderSpatialReference,te=O(),ie=[1,1,1];F(i,ee,ie,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),G(i,ee,te,s);let re=Promise.resolve(Qe),oe=S,ne=ze,ae=null,le=null,ce=null,de=null,he=null,fe=1,be=!1,ye=2,ge=!1,_e=R(0,0,0);const ve=U(Ae),we="Pbr"===v;if(_){const e=e=>this._getTexture(e,t,d,l);ae=e(_.baseColorTex),he=we?e(_.metalTex):null,le=we?e(_.emissiveTex):null,de=we?e(_.occlusionTex):null,ce=we?e(_.normalTex):null;const i=[ae,he,le,de,ce].map(e=>e?.loadPromise??null);re=Promise.all(i),oe=H(_.baseColorFactor),ne=_.alphaCutoff??ze,we&&(C(ve,_.metallicFactor,_.roughnessFactor,0),_.emissiveFactor&&(_e=_.emissiveFactor)),fe=ue[_.alphaMode],be=_.isDoubleSided,ye=pe[_.faceCulling??"NotSet"],ge=this.layer.replacesTerrain}const je=re.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ae||this._dbg(3,"No colour texture 1");const e=this._collection.createObject({toMapSpace:A(te[0],te[1],ie[0],ie[1]),transform:new Te(i,X),obb:N,geometry:Q,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:oe,textureAlphaCutoff:ne,mrrFactors:ve,baseColorTexture:ae,metallicRoughnessTexture:he,normalTexture:ce,occlusionTexture:de,emissionTexture:le,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:fe,doubleSided:be,cullFace:ye,isGround:ge,emissiveBaseColor:_e,usePBR:we,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});return l.textureMemoryUsage+=ae?.texture?.usedMemory??0,we&&(l.textureMemoryUsage+=(he?.texture?.usedMemory??0)+(le?.texture?.usedMemory??0)+(de?.texture?.usedMemory??0)+(ce?.texture?.usedMemory??0)),a+=this._collection.getObjectGPUMemoryUsage(e),e});c.push(je)}if(y.push(...await Promise.all(c)),this.destroyed){const e="IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call";throw this._dbg(3,e),new Error(e)}}catch(k){throw d.forEach(e=>this._stage.removeTexture(e)),k}const _=y.map(e=>e()),v=new Array;d.forEach(e=>v.push(e));const{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(g.minElevation=Math.max(g.minElevation,M.zmin),g.maxElevation=Math.min(g.maxElevation,M.zmax));const E=_.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0),V=new $e(e.handle,_,v,E,a,l.textureMemoryUsage,n,e.stableNodeId,e.nodeDepth,g);this._lyrHandleToObjects.set(e.handle,V),this._memCache.put(Ke(V.handle),V);const{usedMemory:L}=V;return this._cacheMemory+=L,{memUsageBytes:L}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Ke(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Ke(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Ke(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new Re(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,c=fe[e.wrapMode??"None"];let d=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let m=null,u=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(m=h,d=6403,u=""):"Rgb8"===r.pixelFormat?(m=h,d=6407,u=""):"Rgba8"===r.pixelFormat&&(m=h,d=6408,u="");break;case"Dxt1":m=h,d=6407,u="image/vnd-ms.dds";break;case"Dxt5":m=h,d=6408,u="image/vnd-ms.dds";break;case"Basis":m=h,d=6407,u="image/ktx2";break;case"Png":u="image/png",p=document.createElement("img");break;case"Jpeg":u="image/jpeg",p=document.createElement("img");break;case"Etc2":u="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&u){const e=new Blob([h],{type:u});p.src=URL.createObjectURL(e),m=p}if(m&&null!=u){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new Se(m,{mipmap:l,maxAnisotropy:a,encoding:u,wrap:c,pixelFormat:d,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,c,d=null;for(let m=0;m<e.atrbs.length;m++){const c=e.atrbs[m],{view:u}=c,p=void 0,f=u.byteOffset+u.byteCount,b=u.byteCount/be[u.type],y=z(b);try{switch(c.sem){case"Position":3!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+u+")"):(s=new J(t,u.byteOffset,p,f),r=new Ve(s.typedBuffer,y,3));break;case"Normal":if(3!==u.ncomp||"F32"!==u.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+u+")");else{const e=new J(t,u.byteOffset,p,f),s=He(e.typedBuffer,i);a=new K(s.buffer),l=new Ve(a.typedBuffer,y,2)}break;case"TexCoord":2!==u.ncomp||"F32"!==u.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+u+")"):void 0===n&&(n=new Ve(new q(t,u.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===u.ncomp?("F32"===u.type&&(d=new W(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new $(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Z(t,u.byteOffset,p,f))):3===u.ncomp&&("F32"===u.type&&(d=new J(t,u.byteOffset,p,f)),"U8"===u.type&&(d=new X(t,u.byteOffset,p,f)),"U16"===u.type&&(d=new Y(t,u.byteOffset,p,f))),null==d?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+u+")"):o=new Ve(d.typedBuffer,y,u.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+c.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":c=new ee(t,i.byteOffset,s,r);break;case"U32":c=new Q(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==c&&null!=s){const e=s.count;c=c=e<65535?new ee(new Uint16Array(e).buffer):new Q(new Uint32Array(e).buffer);for(let t=0;t<e;t++)c.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:c,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([c()],qe.prototype,"fullOpacity",null),e([c({readOnly:!0})],qe.prototype,"ready",null),e([c({type:[te]})],qe.prototype,"_modifications",void 0),e([c()],qe.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([c()],qe.prototype,"layer",void 0),e([c({readOnly:!0})],qe.prototype,"visibleAtCurrentScale",null),e([c({readOnly:!0})],qe.prototype,"_collection",null),e([c()],qe.prototype,"elevationOffset",null),e([c({readOnly:!0})],qe.prototype,"visibleElevationRange",null),qe=e([d("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],qe);const We=qe;class $e{constructor(e,t,i,s,r,o,n,a,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();n?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const m=n?.halfSize;this._obbShortestHalfsize=m?Math.min(m[0],m[1],m[2]):0,this._mbsCenter=n?U(n.center):V}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ze(e){return Math.round(e/1048.576)/1e3}const Je=O();function Xe(e,t){const i=je(e);return w(Je,i.center,t),i.center=Je,i}function Ye(e){return new we(e.center,e.halfSize,y(...e.quaternion))}function Ke(e){return`${e}`}const Qe=new Array;function et(e,t,i,s){const{center:r}=e,o=u(st,e.quaternionConjugate),n=x(tt,r,o),{data:a}=i,l=a.length/i.stride,c=it;for(let d=0;d<l;++d){const e=3*d;for(let t=0;t<3;++t)c[t]=a[e+t]+s[t];x(c,c,o),_(c,c,n),M(c,c),E(t,t,c)}e.halfSize=t}const tt=O(),it=O(),st=p();export{We as default};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{destroyMaybe as i,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{initial as o,watch as n,when as a}from"../../../core/reactiveUtils.js";import{schedule as l}from"../../../core/scheduling.js";import{property as d,subclass as c}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as h,invert as u,fromQuat as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p,IDENTITY as f}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as y}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as g,sub as _,dot as v,set as w,transformMat3 as j,add as x}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C,freeze as M,fromValues as T,clone as O,ZEROS as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as E,clone as U,fromValues as V}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as S,isMars as A,getReferenceEllipsoid as H,SphericalECEFSpatialReferenceLike as L}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as k}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as I}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as P}from"../../../geometry/projection/projectVectorToVector.js";import{create as F}from"../../../geometry/support/aaBoundingRect.js";import{getContinuousIndexArray as D}from"../../../geometry/support/Indices.js";import{isCGCS2000 as B}from"../../../geometry/support/spatialReferenceUtils.js";import{BufferViewVec4f as G,BufferViewVec4u8 as z,BufferViewVec4u16 as N,BufferViewVec3f as q,BufferViewVec3u8 as W,BufferViewVec3u16 as $,BufferViewVec2f as Q,BufferViewInt16 as Z,BufferViewUint32 as J,BufferViewUint16 as X,BufferViewVec2i16 as Y}from"../../../geometry/support/buffer/BufferView.js";import K from"../../../layers/support/SceneModification.js";import{getElevationOffsetInMeters as ee}from"../../../support/elevationInfoUtils.js";import{addNormals as te}from"./IntegratedMeshNormals.js";import{LayerView3D as ie}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as se}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as re,removeLayerViewFromWasm as oe,getLyr3DWasm as ne}from"./Lyr3DWasm.js";import{toWasmModification as ae}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as le}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as de}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ce,alphaModeConversion as he,faceCullingConversion as ue,wrapModeConversion as me,lyr3DTypeToByteSize as pe}from"./support/lyr3dTypeConversions.js";import{Tiles3DMeshIntersectionHandler as fe}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as be}from"../state/Frustum.js";import{ElevationRange as ye}from"../support/ElevationRange.js";import{toBoundingRect as ge}from"../support/extentUtils.js";import{Obb as _e,compute as ve}from"../support/orientedBoundingBox.js";import{glLayout as we}from"../support/buffer/glUtil.js";import{VertexBufferLayoutCreationParameters as je,createVertexBufferLayout as xe,ComponentGeometryParameters as Ce,SourceGeometry as Me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Te}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Oe}from"../webgl-engine/core/material/RenderTexture.js";import{Attribute as Re}from"../webgl-engine/lib/Attribute.js";import{ManagedTexture as Ee}from"../webgl-engine/lib/ManagedTexture.js";import{compressAndTransformNormals as Ue}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ve}from"../webgl-engine/materials/pbrUtils.js";import Se from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Ae,isInEffectiveScaleRange as He,validateScaleRange as Le}from"../../support/layerViewUtils.js";import{PromiseQueue as ke}from"../../support/PromiseQueue.js";import{TaskPriority as Ie}from"../../support/Scheduler.js";import{TextureCompressionTracker as Pe}from"../../support/TextureCompressionTracker.js";import{alphaCutoff as Fe}from"../../../webscene/support/AlphaCutoff.js";var De;let Be=class extends(ie(Se)){static{De=de}constructor(e){super(e),this[De]=!0,this.type="integrated-mesh-3dtiles",this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this.drapeTargetType=1,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Pe,this._createRenderableQueue=new ke,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Ie.TILES3D,this),this._frustum=new be(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{r(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),o),!this._canProjectWithoutEngine())throw Ae("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);const t=re(this).then(t=>{this._wasmLayerId=t,this._intersectionHandler=new fe(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),o),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),o),this._elevationProvider=new le({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([n(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.fullOpacity,()=>this._opacityChange()),n(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),o)])});this.layer.queryElevationCallback=(e,t)=>this._wasm.queryElevation(this,e,t),this.addResolvingPromise(t)}destroy(){this._dbg(2,"Tiles3DLayerView3D destroy() called"),oe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>this.forEachComponentObject(t=>e(t.obb))),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._createRenderableQueue.destroy(),this.notifyChange("readyToRun"),this._frameTask.remove(),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const{fullOpacity:e}=this;this.forEachComponentObject(t=>this._collection.updateObjectOpacity(t,e))}_cameraChanged(){const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(s=>{const r=s.obb?.intersectsFrustum(e)??!1;r!==s.isVisible&&(s.isVisible=r,r?t.add(s):t.delete(s),s.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,r)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(r,s.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,s){this._intersectionHandler.intersect(e,t,i,s,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.layer.spatialReference,t=ae(this._layerClippingArea,this._modifications,e);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=F();this._layerClippingArea=ge(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=l(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,ee(e))}get _wasm(){return ne(this.view)}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||He(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||Le(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,s=0,r=0,o=0;return this._lyrHandleToObjects.forEach(n=>{n.isLoaded?(e+=n.textureMemoryUsage,t+=n.vboMemoryUsage,r++):(i+=n.textureMemoryUsage,s+=n.vboMemoryUsage,o++)}),new se(this.usedMemory,r,o,Ne(t),Ne(e),Ne(s),Ne(i))}_canProjectWithoutEngine(){if(this.view.state.isLocal){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return ee(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ye(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new ye;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,s=i.isWGS84||i.isWebMercator||B(i)||S(i)||A(i);if(this.view.state.isGlobal||!s)return this.forEachVisibleTile(e);const r=H(i).radius,{eye:o,viewForward:n,near:a}=t.state.camera,l=g(C(),n),d=500,c=Math.max(o[2],d),h=c+r,u=Math.sqrt(h**2-r**2),m=Math.abs(Math.atan2(u,r))*r,p=c>.5*r?.5*Math.PI*r:m,f=C();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:s}=t;if(i<0)return;_(f,s,o);const r=v(f,l);Math.abs(r)<p&&r+i>a&&r-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}isUpdating(){const e=this._wasm;return this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return this._createRenderableQueue.readyToRun}runTask(e){this._createRenderableQueue.runTask(e),this.notifyChange("readyToRun")}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const t=this._createRenderableQueue.push(()=>this._createRenderable(e),null);return this.notifyChange("readyToRun"),t}async _createRenderable(e){if(this.destroyed){const e=`IntegratedMesh3DTilesLayerView3D[${this.layer?.title}]: createRenderable called on destroyed instance`;throw this._dbg(3,e),new Error(e)}const{meshData:t}=e;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=M(...t.desc.origin),s=this.view.basemapTerrain.spatialReference;let r=f;if(this.view.state.isGlobal){const e=b();k(L,i,e,s),r=h(p(),e)}if(null==t.desc.obb)throw new Error("meshData.desc.obb undefined");const o=$e(t.desc.obb);let n=0;const a={textureMemoryUsage:0},l=new Array,d=new Map,c=t.desc.prims.length,m=new Array,y=new ye;try{const e=this.view.state.isGlobal,h=e?H(this.view.spatialReference).radius:0,b=r!==f,g=b?u(p(),r)??f:f,_=t.desc.materials,v=o?C():null;for(let u=0;u<c;u++){const c=t.desc.prims[u];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(c));if(null==ce[c.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+c.ptype+"). Skipping primitive.");continue}const m=_&&null!=c.materialId?_[c.materialId]:null,p=null!=m?m.lightingModel:"Unlit",{positionView:f,positionAttr:j,normalsView:x,normalsAttr:M,colorAttr:R,texCoord0Attr:S,indicesView:A}=this.getBufferViews(c,t.data.buffer,r);if(null==j||null==f||null==A)continue;const H=f.count,L=(e,t)=>!e||e.data.length/e.size===H||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);if(!L(S,"numTexcoord")||!L(R,"numColors")||!L(M,"normals"))continue;const k=new je(null!=R,null!=x,S?1:0),F=xe(k),D=F.createBuffer(H);Je({origin:i,ellipsoidRadius:h,isGlobal:e,ecefRotation:r},{texCoord0Attr:S,colorAttr:R,normalsAttr:M},D,{positionView:f,tileObb:o,obbHalfSizeAccumulator:v,elevationRange:y});const B=o?.clone()??We(j,i),G=new Uint32Array([0,A.typedBuffer.length]),z=we(F),N=this._imVertexNormals,q=te(new Uint8Array(D.buffer),A.typedBuffer,z,N,N?g:void 0),W=new Ce(z,this._imShading?2:0,k.textureCoordinateType,b?1:0,0),$=new Me({interleavedVertexData:q.data,vertexCount:q.data.byteLength/z[0].stride,indexData:q.indices},{positions:f.typedBuffer,indices:A.typedBuffer},G,W),Q=this.view.renderSpatialReference,Z=C(),J=[1,1,1];I(i,Q,J,s)||this._dbg(3,"Unsupported coordinate system for IM overlay"),P(i,Q,Z,s);let X=Promise.resolve(Ze),Y=E,K=Fe,ee=null,ie=null,se=null,re=null,oe=null,ne=1,ae=!1,le=2,de=!1,me=T(0,0,0);const pe=O(Ve),fe="Pbr"===p;if(m){const e=e=>this._getTexture(e,t,d,a);ee=e(m.baseColorTex),oe=fe?e(m.metalTex):null,ie=fe?e(m.emissiveTex):null,re=fe?e(m.occlusionTex):null,se=fe?e(m.normalTex):null;const i=[ee,oe,ie,re,se].map(e=>e?.loadPromise??null);X=Promise.all(i),Y=U(m.baseColorFactor),K=m.alphaCutoff??Fe,fe&&(w(pe,m.metallicFactor,m.roughnessFactor,0),m.emissiveFactor&&(me=m.emissiveFactor)),ne=he[m.alphaMode],ae=m.isDoubleSided,le=ue[m.faceCulling??"NotSet"],de=this.layer.replacesTerrain}const be=X.then(()=>()=>{if(this.destroyed){const e="Trying to add object to destroyed layer view";throw this._dbg(3,`${e} !== numPos. Skipping primitive.`),new Error(e)}ee||this._dbg(3,"No colour texture 1");const e=this._collection.createObject({toMapSpace:V(Z[0],Z[1],J[0],J[1]),transform:new Te(i,g),obb:B,geometry:$,elevationAlignable:!1},{isIntegratedMesh:!0,baseColor:Y,textureAlphaCutoff:K,mrrFactors:pe,baseColorTexture:ee,metallicRoughnessTexture:oe,normalTexture:se,occlusionTexture:re,emissionTexture:ie,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:ne,doubleSided:ae,cullFace:le,isGround:de,emissiveBaseColor:me,usePBR:fe,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this.fullOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO});return a.textureMemoryUsage+=ee?.texture?.usedMemory??0,fe&&(a.textureMemoryUsage+=(oe?.texture?.usedMemory??0)+(ie?.texture?.usedMemory??0)+(re?.texture?.usedMemory??0)+(se?.texture?.usedMemory??0)),n+=this._collection.getObjectGPUMemoryUsage(e),e});l.push(be)}if(m.push(...await Promise.all(l)),this.destroyed){const e="IntegratedMesh3DTilesLayerView3D: createRenderable object destroyed during call";throw this._dbg(3,e),new Error(e)}}catch(S){throw d.forEach(e=>this._stage.removeTexture(e)),S}const g=m.map(e=>e()),_=new Array;d.forEach(e=>_.push(e));const{fullExtent:v}=this.layer;v?.hasZ&&v.zmax&&v.zmin&&(y.minElevation=Math.max(y.minElevation,v.zmin),y.maxElevation=Math.min(y.maxElevation,v.zmax));const j=g.reduceRight((e,t)=>e+t.intersectionGeometry.usedMemory,0),x=new ze(e.handle,g,_,j,n,a.textureMemoryUsage,o,e.stableNodeId,e.nodeDepth,y);this._lyrHandleToObjects.set(e.handle,x),this._memCache.put(Qe(x.handle),x);const{usedMemory:R}=x;return this._cacheMemory+=R,{memUsageBytes:R}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=Qe(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const s=this._frustum,r=new Array;let o=!1,n=!1;for(let a=0;a<i;++a){if(!t[a])continue;const i=e[a],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}o=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(s)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),e&&l.obb&&r.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(Qe(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let a=0;a<i;++a){const i=e[a];if(t[a])continue;const s=this._lyrHandleToObjects.get(i);if(s){if(!s.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${s.stableNodeId}`);continue}const e=s.isVisible;this._visibleObjects.delete(s),s.isVisible=!1,s.isLoaded=!1,this._loadedObjects.delete(s),this._intersectionHandler.removeTile(s),e&&(this._visibleGeometryChanged(),n||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,s.elevationRange)),this._usedMemory-=s.usedMemory,this._cacheMemory+=s.usedMemory,e&&s.obb&&r.push(s.obb),s.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(Qe(i),s)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}o&&this._visibleGeometryChanged(),this._elevationProvider.notifyObjectsChanged(r),n&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:s,maxElevation:r}=t;return e?s<i.minElevation||r>i.maxElevation:s===i.minElevation||r===i.maxElevation}_getTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=i.get(r)??this._createTexture(e,t,i,s);return o?new Oe(this._stage.renderView.textures,o.id):null}_createTexture(e,t,i,s){const r=e&&t.desc?.images?.[e.imageId];if(!r||!t.data?.buffer)return null;const o=this._stage,{renderView:n}=o,a=n.renderingContext.parameters.maxMaxAnisotropy,l=!!r.mipCount||a>1,d=me[e.wrapMode??"None"];let c=r.alpha?6408:6407;const h=new Uint8Array(t.data.buffer,r.data.byteOffset,r.data.byteCount);let u=null,m=null,p=null;switch(r.format){case"Raw":"R8"===r.pixelFormat?(u=h,c=6403,m=""):"Rgb8"===r.pixelFormat?(u=h,c=6407,m=""):"Rgba8"===r.pixelFormat&&(u=h,c=6408,m="");break;case"Dxt1":u=h,c=6407,m="image/vnd-ms.dds";break;case"Dxt5":u=h,c=6408,m="image/vnd-ms.dds";break;case"Basis":u=h,c=6407,m="image/ktx2";break;case"Png":m="image/png",p=document.createElement("img");break;case"Jpeg":m="image/jpeg",p=document.createElement("img");break;case"Etc2":m="image/ktx",p=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(p&&m){const e=new Blob([h],{type:m});p.src=URL.createObjectURL(e),u=p}if(u&&null!=m){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker,compressionCallback:e=>{e&&e>0&&(s.textureMemoryUsage-=e)}}:void 0,t=new Ee(u,{mipmap:l,maxAnisotropy:a,encoding:m,wrap:d,pixelFormat:c,compressionOptions:e,noUnpackFlip:!0,width:r.mip0Width,height:r.mip0Height});return this._stage.addTexture(t),i.set(r,t),t}return null}getBufferViews(e,t,i){let s,r,o,n,a,l,d,c=null;for(let u=0;u<e.atrbs.length;u++){const d=e.atrbs[u],{view:m}=d,p=void 0,f=m.byteOffset+m.byteCount,b=m.byteCount/pe[m.type],y=D(b);try{switch(d.sem){case"Position":3!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+m+")"):(s=new q(t,m.byteOffset,p,f),r=new Re(s.typedBuffer,y,3));break;case"Normal":if(3!==m.ncomp||"F32"!==m.type)this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+m+")");else{const e=new q(t,m.byteOffset,p,f),s=Ue(e.typedBuffer,i);a=new Z(s.buffer),l=new Re(a.typedBuffer,y,2)}break;case"TexCoord":2!==m.ncomp||"F32"!==m.type?this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+m+")"):void 0===n&&(n=new Re(new Q(t,m.byteOffset,p,f).typedBuffer,y,2));break;case"Color":4===m.ncomp?("F32"===m.type&&(c=new G(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new z(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new N(t,m.byteOffset,p,f))):3===m.ncomp&&("F32"===m.type&&(c=new q(t,m.byteOffset,p,f)),"U8"===m.type&&(c=new W(t,m.byteOffset,p,f)),"U16"===m.type&&(c=new $(t,m.byteOffset,p,f))),null==c?this._dbg(2,"[Unsupported Feature] Unsupported view for Color ("+m+")"):o=new Re(c.typedBuffer,y,m.ncomp);break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+d.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(2,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const i=e.index.view,s=void 0,r=i.byteOffset+i.byteCount;switch(e.index.view.type){case"U16":d=new X(t,i.byteOffset,s,r);break;case"U32":d=new J(t,i.byteOffset,s,r);break;default:this._dbg(3,"[Unsupported Feature] index type not supported ("+i.type+").")}}if(null==d&&null!=s){const e=s.count;d=d=e<65535?new X(new Uint16Array(e).buffer):new J(new Uint32Array(e).buffer);for(let t=0;t<e;t++)d.set(t,t)}return{positionView:s,positionAttr:r,colorAttr:o,texCoord0Attr:n,indicesView:d,normalsView:a,normalsAttr:l}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},o),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([d()],Be.prototype,"fullOpacity",null),e([d({readOnly:!0})],Be.prototype,"ready",null),e([d({type:[K]})],Be.prototype,"_modifications",void 0),e([d()],Be.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([d()],Be.prototype,"layer",void 0),e([d({readOnly:!0})],Be.prototype,"visibleAtCurrentScale",null),e([d({readOnly:!0})],Be.prototype,"_collection",null),e([d()],Be.prototype,"elevationOffset",null),e([d({readOnly:!0})],Be.prototype,"visibleElevationRange",null),Be=e([c("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Be);const Ge=Be;class ze{constructor(e,t,i,s,r,o,n,a,l,d){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=s,this.vboMemoryUsage=r,this.textureMemoryUsage=o,this.obb=n,this.stableNodeId=a,this.nodeDepth=l,this.elevationRange=d,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const c=C();n?.getCenter(c),this._obbCenterX=c[0],this._obbCenterY=c[1],this._obbCenterZ=c[2];const h=n?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h;const u=n?.halfSize;this._obbShortestHalfsize=u?Math.min(u[0],u[1],u[2]):0,this._mbsCenter=n?O(n.center):R}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:s,_obbCenterZ:r}=this,o=i-e[0],n=s-e[1],a=r-e[2],l=o*t[0]+n*t[1]+a*t[2];return o*o+n*n+a*a-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,s=e.radius,r=t+s,o=this._obbCenterX-i[0];if(o>r)return!1;const n=this._obbCenterY-i[1];if(n>r)return!1;const a=this._obbCenterZ-i[2];if(a>r)return!1;const l=o*o+n*n+a*a;if(l>r*r)return!1;if(l<=(this._obbShortestHalfsize+s)**2)return!0;return Math.sqrt(l)+t<=s||(this.obb?.intersectSphere(e)??!0)}}function Ne(e){return Math.round(e/1048.576)/1e3}const qe=C();function We(e,t){const i=ve(e);return x(qe,i.center,t),i.center=qe,i}function $e(e){return new _e(e.center,e.halfSize,y(...e.quaternion))}function Qe(e){return`${e}`}const Ze=new Array;function Je(e,t,i,s){const{origin:r,ellipsoidRadius:o,isGlobal:n,ecefRotation:a}=e,{texCoord0Attr:l,colorAttr:d,normalsAttr:c}=t,{positionView:h,tileObb:u,obbHalfSizeAccumulator:p,elevationRange:b}=s,y=i.getField("position",q),g=y.typedBuffer,_=y.typedBufferStride,v=l?.data,w=null!=l?i.getField("uv0",Q):null,x=w?.typedBuffer,C=w?.typedBufferStride??0,M=d?.data,T=d?.size??0,O=null!=d?i.getField("color",z):null,E=O?.typedBuffer,U=O?.typedBufferStride??0,V=c?.data,S=null!=c?i.getField("normalCompressed",Y):null,A=S?.typedBuffer,H=S?.typedBufferStride??0,L=null!=u?m(Ye,u.quaternionConjugate):f,k=j(Xe,u?.center??R,L),I=L[0],P=L[1],F=L[2],D=L[3],B=L[4],G=L[5],N=L[6],W=L[7],$=L[8],Z=k[0],J=k[1],X=k[2],K=a[0],ee=a[1],te=a[2],ie=a[3],se=a[4],re=a[5],oe=a[6],ne=a[7],ae=a[8],le=a!==f,de=r[0],ce=r[1],he=r[2],ue=h.count,me=h.typedBufferStride,pe=h.typedBuffer,fe=null!=x&&null!=v,be=null!=E&&null!=M&&(3===T||4===T),ye=4===T,ge=null!=A&&null!=V,_e=null!=p;let ve=_e?p[0]:0,we=_e?p[1]:0,je=_e?p[2]:0;for(let m=0;m<ue;++m){const e=m*me,t=pe[e],i=pe[e+1],s=pe[e+2],r=t+de,a=i+ce,l=s+he,d=n?Math.sqrt(r*r+a*a+l*l)-o:l;if(b.expandElevationRangeValues(d,d),_e){const e=Math.abs(r*I+a*D+l*N-Z),t=Math.abs(r*P+a*B+l*W-J),i=Math.abs(r*F+a*G+l*$-X);ve=Math.max(ve,e),we=Math.max(we,t),je=Math.max(je,i)}const c=m*_;if(le){const r=t*K+i*ie+s*oe,o=t*ee+i*se+s*ne,n=t*te+i*re+s*ae;pe[e]=r,pe[e+1]=o,pe[e+2]=n,g[c]=r,g[c+1]=o,g[c+2]=n}else g[c]=t,g[c+1]=i,g[c+2]=s;if(fe){const e=2*m,t=m*C;x[t]=v[e],x[t+1]=v[e+1]}if(be){const e=m*U;if(ye){const t=4*m;E[e]=M[t],E[e+1]=M[t+1],E[e+2]=M[t+2],E[e+3]=M[t+3]}else{const t=3*m;E[e]=M[t],E[e+1]=M[t+1],E[e+2]=M[t+2],E[e+3]=255}}if(ge){const e=2*m,t=m*H;A[t]=V[e],A[t+1]=V[e+1]}}u&&_e&&(p[0]=ve,p[1]=we,p[2]=je,u.setHalfSize(ve,we,je))}const Xe=C(),Ye=p();export{Ge as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{transformMat3 as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{decompressNormal as o,compressNormal as r}from"../webgl-engine/lib/Normals.js";import{DataType as n}from"../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../webgl/VertexElementDescriptor.js";class c{constructor(e,t){this.data=e,this.indices=t}}function f(f,i,d,m,u){if(!m||d.some(({name:e})=>"normal"===e)||d.some(({name:e})=>"normalCompressed"===e)){const n=new c(f.slice().buffer,i);if(u){const s=d[0].stride,c=n.data.byteLength/s;for(const f of d)if("normalCompressed"===f.name){const{offset:a}=f,l=new Int16Array(n.data),i=t();for(let t=0;t<c;++t)o(i,l,t,s/2,a/2),e(i,i,u),r(l,t,i[0],i[1],i[2],s/2,a/2)}else if("normal"===f.name){const{offset:o}=f,r=new Float32Array(n.data),a=t();for(let t=0;t<c;++t){const n=(t*s+o)/4;a[0]=r[n],a[1]=r[n+1],a[2]=r[n+2],e(a,a,u),r[n]=a[0],r[n+1]=a[1],r[n+2]=a[2]}}}return n}const w=d[0].stride,y=w/4,A=new Float32Array(f.buffer,f.byteOffset,f.byteLength/4),h=i.length/3,$=f.byteLength/w,{faceNormals:b,faceAreas:v,faceEdges:x,edgeFaces:F,vertexFaces:U,vertexFaceCountAndOffset:p}=a(A,y,$,i,h,u);l(i,h,b,v,x,F);const E=w+4;d.forEach(e=>e.stride=E),d.push(new s("normalCompressed",2,n.SHORT,w,E,!0));const M=3*h,I=E/4,j=new Float32Array(M*I),C=new(M<256?Uint8Array:M<65536?Uint16Array:Uint32Array)(i);let O=$;const q=new Int16Array(j.buffer),L=w/2,N=E/2;let k=0,D=0;const H=new Uint32Array(h);let P=0;for(let e=0;e<$;++e){const t=e*I,o=e*y;for(let e=0;e<y;++e)j[t+e]=A[o+e];k=p[2*e+1],D=k+p[2*e];let n=e;for(;k<D;){{const e=U[--D],t=b[3*e],o=b[3*e+1],s=b[3*e+2];P=0,H[P++]=e;for(let r=k;r<D;++r){const e=U[r],n=b[3*e],c=b[3*e+1],f=b[3*e+2];Math.abs(1-(t*n+o*c+s*f))<g&&(H[P++]=e,r<D-1&&(U[r]=U[--D]))}let c=0,f=0,a=0;if(1===P)c=t,f=o,a=s;else{for(let t=0;t<P;++t){const e=H[t],o=v[e];c+=b[3*e]*o,f+=b[3*e+1]*o,a+=b[3*e+2]*o}const e=Math.sqrt(c*c+f*f+a*a)||1;c/=e,f/=e,a/=e}r(q,n,c,f,a,N,L)}if(n!==e)for(let o=0;o<P;++o){const t=H[o];for(let o=3*t;o<3*t+3;++o)C[o]===e&&(C[o]=n)}if(k>=D)break;n=O++;const t=n*I;for(let e=0;e<y;++e)j[t+e]=A[o+e]}}const R=O<M?j.slice(0,O*I).buffer:j.buffer;return new c(R,C)}function a(e,t,o,r,n,s){const c=new Float32Array(3*n),f=new Float32Array(n),a=new Uint32Array(3*n),l=new Int32Array(2*(3*n)),i=3*n,d=new Uint32Array(i),m=new Uint32Array(2*o);for(let u=0;u<n;++u){const e=3*u;for(let t=0;t<3;++t){++m[2*r[e+t]]}}{let e=0;for(let t=0;t<o;++t){m[2*t+1]=e;e+=m[2*t]}for(let t=0;t<n;++t){const e=3*t;for(let o=0;o<3;++o){d[m[2*r[e+o]+1]++]=t}}for(let t=0;t<o;++t)m[2*t+1]-=m[2*t]}let g=0;{const n=new Uint32Array(2*i*2),d=new Uint32Array(2*o);for(let e=0;e<o;++e){const t=2*m[2*e+1]*2;d[2*e]=t,d[2*e+1]=t}const u=(e,t,o)=>{const r=Math.min(e,t),s=Math.max(e,t),c=e<t?0:1,f=d[2*r],a=d[2*r+1];let i=-1;for(let l=f;l<a;l+=2)if(n[l]===s){i=n[l+1];break}return-1===i&&(i=g++,n[a]=s,n[a+1]=i,d[2*r+1]+=2,l[2*i+(1-c)]=-1),l[2*i+c]=o,i};for(let o=0;o<r.length;o+=3){const n=r[o],l=n*t,i=e[l],d=e[l+1],m=e[l+2],g=r[o+1],w=g*t,y=e[w],A=e[w+1],h=e[w+2],$=r[o+2],b=$*t,v=i-y,x=d-A,F=m-h,U=i-e[b],p=d-e[b+1],E=m-e[b+2],M=x*E-F*p,I=F*U-v*E,j=v*p-x*U,C=Math.sqrt(M*M+I*I+j*j)||1,O=o/3;f[O]=.5*C;const q=1/C;if(s){const e=s[0]*M+s[3]*I+s[6]*j,t=s[1]*M+s[4]*I+s[7]*j,o=s[2]*M+s[5]*I+s[8]*j;c[3*O]=e*q,c[3*O+1]=t*q,c[3*O+2]=o*q}else c[3*O]=M*q,c[3*O+1]=I*q,c[3*O+2]=j*q;const L=u(n,g,O),N=u(g,$,O),k=u($,n,O);a[3*O]=L,a[3*O+1]=N,a[3*O+2]=k}}return{faceNormals:c,faceAreas:f,faceEdges:a,vertexFaces:d,vertexFaceCountAndOffset:m,edgeFaces:l}}function l(e,t,o,r,n,s){const c=new Uint8Array(t),f=new Uint32Array(t),a=new Uint32Array(3*t);let l=0;const i=new Uint32Array(t);let d=0;for(let g=0;g<e.length;g+=3){const e=g/3;if(1===c[e])continue;c[e]=1;const t=o[3*e],u=o[3*e+1],w=o[3*e+2];for(d=0,i[d++]=e,a[0]=n[3*e],a[1]=n[3*e+1],a[2]=n[3*e+2],l=3,f[e]=e+1;l>0;){const r=a[--l];for(let g=0;g<2;++g){const y=s[2*r+g];if(-1===y||f[y]===e+1)continue;f[y]=e+1;const A=o[3*y],h=o[3*y+1],$=o[3*y+2];if(Math.abs(1-(t*A+u*h+w*$))<m){i[d++]=y,c[y]=1;for(let e=0;e<3;++e){const t=n[3*y+e];t!==r&&(a[l++]=t)}}}}if(d>1){let e=0,t=0,n=0,s=0;for(let f=0;f<d;++f){const c=i[f],a=r[c];e+=a,t+=o[3*c]*a,n+=o[3*c+1]*a,s+=o[3*c+2]*a}const c=Math.sqrt(t*t+n*n+s*s)||1;t/=c,n/=c,s/=c;for(let f=0;f<d;++f){const c=i[f];o[3*c]=t,o[3*c+1]=n,o[3*c+2]=s,r[c]=e}}}}function i(e,t,o,r,n,s,c,f,a,l){const i=new Uint32Array(2*r);for(let d=0;d<o;++d){const e=a[2*d],t=a[2*d+1];for(let n=e;n<t;n+=2){const e=l[n],t=l[n+1];t>=r||t<0?console.error(`Invalid edge index ${t} for vertex ${d}`):e>=o||e<0||e<d?console.error(`Invalid vertex ${e} for edge ${t}`):(i[2*t]=d,i[2*t+1]=e)}}for(let m=0;m<t;++m){const t=[e[3*m],e[3*m+1],e[3*m+2]],o=[f[3*m],f[3*m+1],f[3*m+2]];for(const e of t){const t=n[2*e+1];d(s,t,t+n[2*e],1,m)||console.error(`Face ${m} not found in vertexFaces for vertex ${e}`)}for(const e of o){const t=c[2*e],o=c[2*e+1];-1!==t||-1!==o?m!==t&&m!==o&&console.error(`Edge ${e} of face ${m} does not list it as a face`):console.error(`Edge ${e} of face ${m} has no faces`)}}for(let m=0;m<r;++m){const e=c[2*m],t=c[2*m+1];if(-1===e&&-1===t){console.error(`Edge ${m} has no faces`);continue}for(const s of[e,t].filter(e=>-1!==e)){const e=f[3*s],t=f[3*s+1],o=f[3*s+2];m!==e&&m!==t&&m!==o&&console.error(`Edge ${m} not found in edgesPerFace for face ${s}`)}const o=i[2*m],r=i[2*m+1];o===r&&console.error(`Edge ${m} is degenerate with identical vertices ${o}`);const n=Math.min(o,r);d(l,a[2*n]+1,a[2*n+1],2,m)||console.error(`Edge ${m} not found in edgeMap for vertex ${n}`)}for(let m=0;m<o;++m){const o=n[2*m+1],r=n[2*m];for(let n=o;n<o+r;++n){const o=s[n];(o<0||o>=t)&&console.error(`Invalid face ${o} in vertexFaces for vertex ${m}`),d(e,3*o,3*o+3,1,m)||console.error(`Face ${o} in vertexFaces for vertex ${m} does not reference it in indices`)}}}function d(e,t,o,r,n){for(let s=t;s<o;s+=r)if(e[s]===n)return!0;return!1}const m=.04,g=.8;export{f as addNormals,i as checkTopology};
2
+ import{transformMat3 as e}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{decompressNormal as r,compressNormal as n}from"../webgl-engine/lib/Normals.js";import{DataType as o}from"../../webgl/enums.js";import{VertexElementDescriptor as s}from"../../webgl/VertexElementDescriptor.js";class c{constructor(e,t){this.data=e,this.indices=t}}function f(e,t,r,n,o){return!n||r.some(({name:e})=>"normal"===e||"normalCompressed"===e)?a(e,t,r,o):i(e,t,r,o)}function a(o,s,f,a){const i=new c(o.slice().buffer,s);if(a){const o=f[0].stride,s=i.data.byteLength/o;for(const c of f)if("normalCompressed"===c.name){const{offset:f}=c,l=new Int16Array(i.data),d=t();for(let t=0;t<s;++t)r(d,l,t,o/2,f/2),e(d,d,a),n(l,t,d[0],d[1],d[2],o/2,f/2)}else if("normal"===c.name){const{offset:r}=c,n=new Float32Array(i.data),f=t();for(let t=0;t<s;++t){const s=(t*o+r)/4;f[0]=n[s],f[1]=n[s+1],f[2]=n[s+2],e(f,f,a),n[s]=f[0],n[s+1]=f[1],n[s+2]=f[2]}}}return i}function i(e,t,r,n){const c=r[0].stride,f=c/4,a=new Float32Array(e.buffer,e.byteOffset,e.byteLength/4),i=t.length/3,y=e.byteLength/c,{faceNormals:m,faceAreas:A,faceEdges:w,edgeFaces:h,vertexFaces:g,vertexFaceCountAndOffset:b}=d(a,f,y,t,i,n);u(t,i,m,A,w,h);const $=c+4;return r.forEach(e=>e.stride=$),r.push(new s("normalCompressed",2,o.SHORT,c,$,!0)),l(a,f,i,y,t,c,$,m,A,g,b)}function l(e,t,r,n,o,s,f,a,i,l,d){const u=3*r,y=new(u<256?Uint8Array:u<65536?Uint16Array:Uint32Array)(o);let m=n;const A=new(n<256?Uint8Array:n<65536?Uint16Array:Uint32Array)(u-n),h=new ArrayBuffer(4*u),g=new Int16Array(h),b=new Uint32Array(h),$=new Uint32Array(e.buffer,e.byteOffset,e.length);let U=0,v=0;const x=new Uint32Array(r);let F=0;const M=1-w;for(let c=0;c<n;++c){U=d[2*c+1],v=U+d[2*c];let e=c;for(;U<v;){{const t=l[--v],r=3*t,n=a[r],o=a[r+1],s=a[r+2];F=0,x[F++]=t;let c=U;for(;c<v;){const e=l[c],t=3*e;if(n*a[t]+o*a[t+1]+s*a[t+2]>M){x[F++]=e;const t=--v;if(c<t){l[c]=l[t];continue}}++c}let f=0,d=0,u=0;if(1===F)f=n,d=o,u=s;else{for(let t=0;t<F;++t){const e=x[t],r=i[e],n=3*e;f+=a[n]*r,d+=a[n+1]*r,u+=a[n+2]*r}const e=Math.sqrt(f*f+d*d+u*u)||1;f/=e,d/=e,u/=e}{const t=1/(Math.abs(f)+Math.abs(d)+Math.abs(u)),r=f*t,n=d*t;let o=r,s=n;u<=0&&(o=(r>=0?1:-1)*(1-Math.abs(n)),s=(n>=0?1:-1)*(1-Math.abs(r)));const c=2*e,a=Math.round(32767*o),i=Math.round(32767*s);g[c]=a<-32767?-32767:a>32767?32767:a,g[c+1]=i<-32767?-32767:i>32767?32767:i}}if(e!==c)for(let t=0;t<F;++t){const r=3*x[t];y[r]===c&&(y[r]=e),y[r+1]===c&&(y[r+1]=e),y[r+2]===c&&(y[r+2]=e)}if(U>=v)break;e=m++,A[e-n]=c}}const p=m,E=f/4,I=new Float32Array(p*E),j=new Uint32Array(I.buffer),C=s/4;for(let c=0;c<n;++c){const e=c*t,r=c*E;for(let n=0;n<t;++n)j[r+n]=$[e+n];j[r+C]=b[c]}for(let c=n;c<p;++c){const e=A[c-n]*t,r=c*E;for(let n=0;n<t;++n)j[r+n]=$[e+n];j[r+C]=b[c]}return new c(I.buffer,y)}function d(e,t,r,n,o,s){const c=new Float32Array(3*o),f=new Float32Array(o),a=new Uint32Array(3*o),i=new Int32Array(2*(3*o)),l=3*o,d=new Uint32Array(l),u=new Uint32Array(2*r);for(let m=0;m<o;++m){const A=3*m;for(let w=0;w<3;++w){++u[2*n[A+w]]}}{let h=0;for(let g=0;g<r;++g){const b=2*g;u[b+1]=h;h+=u[b]}for(let $=0;$<o;++$){const U=3*$;for(let v=0;v<3;++v){d[u[2*n[U+v]+1]++]=$}}for(let x=0;x<r;++x)u[2*x+1]-=u[2*x]}let y=0;{const F=new Uint32Array(2*l*2),M=new Uint32Array(2*r);for(let E=0;E<r;++E){const I=2*E,j=4*u[I+1];M[I]=j,M[I+1]=j}function p(e,t,r){const n=Math.min(e,t),o=Math.max(e,t),s=e<t?0:1,c=2*n,f=M[c],a=M[c+1];let l=-1;for(let i=f;i<a;i+=2)if(F[i]===o){l=F[i+1];break}return-1===l&&(l=y++,F[a]=o,F[a+1]=l,M[c+1]=a+2,i[2*l+(1-s)]=-1),i[2*l+s]=r,l}for(let C=0;C<n.length;C+=3){const O=n[C],q=O*t,L=e[q],N=e[q+1],k=e[q+2],B=n[C+1],D=B*t,H=e[D],P=e[D+1],R=e[D+2],S=n[C+2],T=S*t,V=L-H,z=N-P,G=k-R,J=L-e[T],K=N-e[T+1],Q=k-e[T+2],W=z*Q-G*K,X=G*J-V*Q,Y=V*K-z*J,Z=Math.sqrt(W*W+X*X+Y*Y)||1,_=C/3;f[_]=.5*Z;const ee=1/Z;if(s){const oe=s[0]*W+s[3]*X+s[6]*Y,se=s[1]*W+s[4]*X+s[7]*Y,ce=s[2]*W+s[5]*X+s[8]*Y;c[3*_]=oe*ee,c[3*_+1]=se*ee,c[3*_+2]=ce*ee}else c[3*_]=W*ee,c[3*_+1]=X*ee,c[3*_+2]=Y*ee;const te=p(O,B,_),re=p(B,S,_),ne=p(S,O,_);a[3*_]=te,a[3*_+1]=re,a[3*_+2]=ne}}return{faceNormals:c,faceAreas:f,faceEdges:a,vertexFaces:d,vertexFaceCountAndOffset:u,edgeFaces:i}}function u(e,t,r,n,o,s){const c=new Uint8Array(t),f=new Uint32Array(t),a=new Uint32Array(3*t);let i=0;const l=new Uint32Array(t);let d=0;for(let u=0;u<e.length;u+=3){const e=u/3;if(1===c[e])continue;c[e]=1;const t=r[3*e],y=r[3*e+1],m=r[3*e+2];for(d=0,l[d++]=e,a[0]=o[3*e],a[1]=o[3*e+1],a[2]=o[3*e+2],i=3,f[e]=e+1;i>0;){const n=a[--i];for(let u=0;u<2;++u){const w=s[2*n+u];if(-1===w||f[w]===e+1)continue;f[w]=e+1;const h=r[3*w],g=r[3*w+1],b=r[3*w+2];if(Math.abs(1-(t*h+y*g+m*b))<A){l[d++]=w,c[w]=1;for(let e=0;e<3;++e){const t=o[3*w+e];t!==n&&(a[i++]=t)}}}}if(d>1){let e=0,t=0,o=0,s=0;for(let f=0;f<d;++f){const c=l[f],a=n[c];e+=a,t+=r[3*c]*a,o+=r[3*c+1]*a,s+=r[3*c+2]*a}const c=Math.sqrt(t*t+o*o+s*s)||1;t/=c,o/=c,s/=c;for(let f=0;f<d;++f){const c=l[f];r[3*c]=t,r[3*c+1]=o,r[3*c+2]=s,n[c]=e}}}}function y(e,t,r,n,o,s,c,f,a,i){const l=new Uint32Array(2*n);for(let d=0;d<r;++d){const e=a[2*d],t=a[2*d+1];for(let o=e;o<t;o+=2){const e=i[o],t=i[o+1];t>=n||t<0?console.error(`Invalid edge index ${t} for vertex ${d}`):e>=r||e<0||e<d?console.error(`Invalid vertex ${e} for edge ${t}`):(l[2*t]=d,l[2*t+1]=e)}}for(let d=0;d<t;++d){const t=[e[3*d],e[3*d+1],e[3*d+2]],r=[f[3*d],f[3*d+1],f[3*d+2]];for(const e of t){const t=o[2*e+1];m(s,t,t+o[2*e],1,d)||console.error(`Face ${d} not found in vertexFaces for vertex ${e}`)}for(const e of r){const t=c[2*e],r=c[2*e+1];-1!==t||-1!==r?d!==t&&d!==r&&console.error(`Edge ${e} of face ${d} does not list it as a face`):console.error(`Edge ${e} of face ${d} has no faces`)}}for(let d=0;d<n;++d){const e=c[2*d],t=c[2*d+1];if(-1===e&&-1===t){console.error(`Edge ${d} has no faces`);continue}for(const s of[e,t].filter(e=>-1!==e)){const e=f[3*s],t=f[3*s+1],r=f[3*s+2];d!==e&&d!==t&&d!==r&&console.error(`Edge ${d} not found in edgesPerFace for face ${s}`)}const r=l[2*d],n=l[2*d+1];r===n&&console.error(`Edge ${d} is degenerate with identical vertices ${r}`);const o=Math.min(r,n);m(i,a[2*o]+1,a[2*o+1],2,d)||console.error(`Edge ${d} not found in edgeMap for vertex ${o}`)}for(let d=0;d<r;++d){const r=o[2*d+1],n=o[2*d];for(let o=r;o<r+n;++o){const r=s[o];(r<0||r>=t)&&console.error(`Invalid face ${r} in vertexFaces for vertex ${d}`),m(e,3*r,3*r+3,1,d)||console.error(`Face ${r} in vertexFaces for vertex ${d} does not reference it in indices`)}}}function m(e,t,r,n,o){for(let s=t;s<r;s+=n)if(e[s]===o)return!0;return!1}const A=.04,w=.8;export{f as addNormals,y as checkTopology};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../core/accessorSupport/decorators.js";import o from"../../../rest/support/Query.js";import{isNumber as n}from"../../../support/guards.js";import{FeatureLikeLayerViewBase3D as a}from"./FeatureLikeLayerViewBase3D.js";import{StreamController as p}from"./graphics/StreamController.js";import{StreamGraphics3DGraphicsPipeline as c}from"./graphics/StreamGraphics3DGraphicsPipeline.js";import l from"../../layers/StreamLayerView.js";let h=class extends(a(l)){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=0,this.hasZ=!0,this.hasM=!1}initialize(){this.addHandles(t(()=>this.suspended,e=>{this.graphicsPipeline&&this._onSuspendedChange(e)}))}get connectionError(){const e=this.graphicsPipeline?.connection?.errorString;return e?new r("stream-controller",e):null}get graphicOrigin(){return this.layer.graphicOrigin}createQuery(){return new o({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(e,r){return this.graphicsPipeline.graphicsQuery.executeQueryForLatestObservations(this._ensureQuery(e),r?.signal)}async queryObjectIds(e,r){return(await super.queryObjectIds(e,r)).filter(n)}setVisibility(e,r){}get _streamConnectionStatus(){return this.graphicsPipeline?.connection?.connectionStatus??"disconnected"}async createGraphicsPipeline(){return new c({layerView:this})}createController(){return new p({layer:this.layer,layerView:this})}beforeSetController(){}_doPause(){this.graphicsPipeline?.pause()}_doResume(){this.graphicsPipeline?.resume()}_doDisconnect(){this.graphicsPipeline?.disconnect(),this._doPause()}_doConnect(){this.graphicsPipeline?.connect(),this.resume()}_doClear(){this.graphicsPipeline?.clear()}};e([i({readOnly:!0})],h.prototype,"updatePolicy",void 0),e([i({readOnly:!0})],h.prototype,"connectionError",null),e([i()],h.prototype,"graphicsPipeline",void 0),e([i({readOnly:!0})],h.prototype,"hasZ",void 0),e([i({readOnly:!0})],h.prototype,"hasM",void 0),e([i()],h.prototype,"graphicOrigin",null),e([i({readOnly:!0})],h.prototype,"_streamConnectionStatus",null),h=e([s("esri.views.3d.layers.StreamLayerView3D")],h);const u=h;export{u as default};
2
+ import{__decorate as e}from"tslib";import r from"../../../core/Error.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../core/accessorSupport/decorators.js";import o from"../../../rest/support/Query.js";import{isNumber as n}from"../../../support/guards.js";import{FeatureLikeLayerViewBase3D as a}from"./FeatureLikeLayerViewBase3D.js";import{StreamController as p}from"./graphics/StreamController.js";import{StreamGraphics3DGraphicsPipeline as c}from"./graphics/StreamGraphics3DGraphicsPipeline.js";import l from"../../layers/StreamLayerView.js";let u=class extends(a(l)){constructor(){super(...arguments),this.type="stream-3d",this.updatePolicy=0}initialize(){this.addHandles(t(()=>this.suspended,e=>{this.graphicsPipeline&&this._onSuspendedChange(e)}))}get connectionError(){const e=this.graphicsPipeline?.connection?.errorString;return e?new r("stream-controller",e):null}get graphicOrigin(){return this.layer.graphicOrigin}createQuery(){return new o({outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference})}queryLatestObservations(e,r){return this.graphicsPipeline.graphicsQuery.executeQueryForLatestObservations(this._ensureQuery(e),r?.signal)}async queryObjectIds(e,r){return(await super.queryObjectIds(e,r)).filter(n)}setVisibility(e,r){}get _streamConnectionStatus(){return this.graphicsPipeline?.connection?.connectionStatus??"disconnected"}async createGraphicsPipeline(){return new c({layerView:this})}createController(){return new p({layer:this.layer,layerView:this})}beforeSetController(){}_doPause(){this.graphicsPipeline?.pause()}_doResume(){this.graphicsPipeline?.resume()}_doDisconnect(){this.graphicsPipeline?.disconnect(),this._doPause()}_doConnect(){this.graphicsPipeline?.connect(),this.resume()}_doClear(){this.graphicsPipeline?.clear()}};e([i({readOnly:!0})],u.prototype,"updatePolicy",void 0),e([i({readOnly:!0})],u.prototype,"connectionError",null),e([i()],u.prototype,"graphicsPipeline",void 0),e([i()],u.prototype,"graphicOrigin",null),e([i({readOnly:!0})],u.prototype,"_streamConnectionStatus",null),u=e([s("esri.views.3d.layers.StreamLayerView3D")],u);const h=u;export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{hydrateGeometry as r}from"../../../../layers/graphics/hydratedFeatures.js";import{loadArcade as n}from"../../../../support/loadArcade.js";const c=()=>e.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function o(e){return{cachedResult:e.cachedResult,arcade:e.arcade?{func:e.arcade.func,context:e.arcade.modules.arcadeUtils.createExecContext(null,{sr:e.arcade.context.spatialReference}),modules:e.arcade.modules}:null}}function u(e){const t=e?.expression;if("string"==typeof t){const e=m(t);if(null!=e)return{cachedResult:e}}return null}async function a(e,r,c,o){const u=e?.expression;if("string"!=typeof u)return null;const a=m(u);if(null!=a)return{cachedResult:a};const s=await n();t(c);const l=s.arcadeUtils,i=l.createSyntaxTree(u);return l.dependsOnView(i)?(null!=o&&o.error("Expressions containing '$view' are not supported on ElevationInfo"),{cachedResult:0}):{arcade:{func:l.createFunction(i),context:l.createExecContext(null,{sr:r}),modules:s}}}function s(e,t,r){return e.arcadeUtils.createFeature(t.attributes,t.geometry,r)}function l(e,t){if(null!=e&&!p(e)){if(!t||!e.arcade)return void c().errorOncePerTick("Arcade support required but not provided");const n=t;n._geometry&&(n._geometry=r(n._geometry)),e.arcade.modules.arcadeUtils.updateExecContext(e.arcade.context,t)}}function i(e){if(null!=e){if(p(e))return e.cachedResult;const t=e.arcade;let r=t?.modules.arcadeUtils.executeFunction(t.func,t.context);return"number"!=typeof r&&(e.cachedResult=0,r=0),r}return 0}function d(e,t=!1){let r=e?.featureExpressionInfo;const n=r?.expression;return t||"0"===n||(r=null),r??null}const f={cachedResult:0};function p(e){return null!=e.cachedResult}function m(e){return"0"===e?0:null}export{o as clone,a as createContext,u as createContextWithoutExpressionSupport,s as createFeature,i as execute,d as extractExpressionInfo,l as setContextFeature,f as zeroContext};
2
+ import e from"../../../../core/Logger.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{hydrateGeometry as r}from"../../../../layers/graphics/hydratedFeatures.js";import{loadArcade as n}from"../../../../support/loadArcade.js";const c=()=>e.getLogger("esri.views.3d.layers.graphics.featureExpressionInfoUtils");function o(e){return{cachedResult:e.cachedResult,arcade:e.arcade?{func:e.arcade.func,context:e.arcade.modules.arcadeUtils.createExecContext(null,{sr:e.arcade.context.spatialReference}),modules:e.arcade.modules}:null}}function u(e){const t=e?.expression;if("string"==typeof t){const e=m(t);if(null!=e)return{cachedResult:e}}return null}async function s(e,r,c,o){const u=e?.expression;if("string"!=typeof u)return null;const s=m(u);if(null!=s)return{cachedResult:s};const a=await n();t(c);const l=a.arcadeUtils,i=l.createSyntaxTree(u);if(!i)return null;if(l.dependsOnView(i))return null!=o&&o.error("Expressions containing '$view' are not supported on ElevationInfo"),{cachedResult:0};const d=l.createFunction(i);if(!d)return null;return{arcade:{modules:a,func:d,context:l.createExecContext(null,{sr:r})}}}function a(e,t,r){return e.arcadeUtils.createFeature(t.attributes,t.geometry,r)}function l(e,t){if(null!=e&&!p(e)){if(!t||!e.arcade)return void c().errorOncePerTick("Arcade support required but not provided");const n=t;n._geometry&&(n._geometry=r(n._geometry)),e.arcade.modules.arcadeUtils.updateExecContext(e.arcade.context,t)}}function i(e){if(null!=e){if(p(e))return e.cachedResult;const t=e.arcade;let r=t?.modules.arcadeUtils.executeFunction(t.func,t.context);return"number"!=typeof r&&(e.cachedResult=0,r=0),r}return 0}function d(e,t=!1){let r=e?.featureExpressionInfo;const n=r?.expression;return t||"0"===n||(r=null),r??null}const f={cachedResult:0};function p(e){return null!=e.cachedResult}function m(e){return"0"===e?0:null}export{o as clone,s as createContext,u as createContextWithoutExpressionSupport,a as createFeature,i as execute,d as extractExpressionInfo,l as setContextFeature,f as zeroContext};