@arcgis/core 4.33.0-next.20250212 → 4.33.0-next.20250214

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 (290) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/arcadeEnvironment.js +1 -1
  4. package/arcade/arcadeRuntime.js +1 -1
  5. package/arcade/featureSetUtils.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/actions/OrderBy.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/fieldStats.js +1 -1
  15. package/arcade/functions/geomasync.js +1 -1
  16. package/arcade/functions/geometry.js +1 -1
  17. package/arcade/functions/geomsync.js +1 -1
  18. package/arcade/functions/knowledgegraph.js +1 -1
  19. package/arcade/functions/maths.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/arcade.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/01f8f52a3f9e6fb72f64.js +1 -0
  26. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 041eebac192855fbf919.js} +1 -1
  27. package/assets/esri/core/workers/chunks/09cbf45dc7b026957d3e.js +1 -0
  28. package/assets/esri/core/workers/chunks/{1a286d43daa3b811c30d.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/197dc75a1c10c0fbf65a.js +1 -0
  30. package/assets/esri/core/workers/chunks/219b06cca6aa1e041f40.js +1 -0
  31. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +1 -0
  32. package/assets/esri/core/workers/chunks/{efded84870064c3d8210.js → 23a045fccc005079bd58.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2dc35c1c5d83174a2c06.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e4651d577d297386268e.js → 32035bc69ee18b19623d.js} +1 -1
  35. package/assets/esri/core/workers/chunks/32fee5446ee0b0a6c4bd.js +1 -0
  36. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/39c595734a9e9cd67e41.js +1 -0
  38. package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +1 -0
  39. package/assets/esri/core/workers/chunks/3eacb4d1275f2d87825f.js +1 -0
  40. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{c061cad8323f0469e7e4.js → 42f21349f488a14198e4.js} +1 -1
  42. package/assets/esri/core/workers/chunks/48eb5cbb4555acc56984.js +1 -0
  43. package/assets/esri/core/workers/chunks/4927b33f7e9daf059765.js +1 -0
  44. package/assets/esri/core/workers/chunks/50bab11c32bf4001edd7.js +1 -0
  45. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +1 -0
  46. package/assets/esri/core/workers/chunks/5c9a7b1dedd146cc65d2.js +1 -0
  47. package/assets/esri/core/workers/chunks/5d8120c84e5a164cb1bc.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7a9e1696dc6120df15b0.js → 60ca6a2e9f1e2c969aab.js} +1 -1
  49. package/assets/esri/core/workers/chunks/679cc23be07ededb3992.js +1 -0
  50. package/assets/esri/core/workers/chunks/{9f122278e917c9ce5f95.js → 67c1e2c17ea3ca27248c.js} +1 -1
  51. package/assets/esri/core/workers/chunks/69b55259f90e8e4bc2aa.js +1 -0
  52. package/assets/esri/core/workers/chunks/69e0ff74e44962d97049.js +1 -0
  53. package/assets/esri/core/workers/chunks/6c64ccf5f64b5025b239.js +1 -0
  54. package/assets/esri/core/workers/chunks/6ca4b5d1a076c6079472.js +1 -0
  55. package/assets/esri/core/workers/chunks/{7058001bf66f9f3d5d45.js → 6d02d66234a7b74e5c14.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  57. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  58. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  59. package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{8b6580329e1e35ea4190.js → 7c03489438f51a5170f3.js} +1 -1
  61. package/assets/esri/core/workers/chunks/7e77e4288ed205128b87.js +1 -0
  62. package/assets/esri/core/workers/chunks/80c3e933b43ea79b30de.js +1 -0
  63. package/assets/esri/core/workers/chunks/830844f7fb7557d30f34.js +1 -0
  64. package/assets/esri/core/workers/chunks/8a66d06132c8803033c9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{e9993d4f2bfdc434fbcc.js → 8f4bcca8b0525e19374f.js} +1 -1
  66. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  67. package/assets/esri/core/workers/chunks/9968c6654d048c9add0c.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b50176897ffadc53573e.js → 9bbfa8dc4124b5273d28.js} +1 -1
  69. package/assets/esri/core/workers/chunks/9be12d0df67e2c4c3787.js +1 -0
  70. package/assets/esri/core/workers/chunks/a2b548fbfa2eb5e6f2a7.js +1 -0
  71. package/assets/esri/core/workers/chunks/a37825705e49b60e5d4b.js +1 -0
  72. package/assets/esri/core/workers/chunks/a80c3ada9e09b8832e9b.js +1 -0
  73. package/assets/esri/core/workers/chunks/a8457210711b663059f0.js +1 -0
  74. package/assets/esri/core/workers/chunks/aebbaa7ab7a6b3b1579c.js +314 -0
  75. package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +1 -0
  76. package/assets/esri/core/workers/chunks/{a39977478a6c57d2e8fb.js → bd2dcc55ac3418421ee5.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{83fe9a8002a4fc96e534.js → bd38717780fffa49d36c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{c77ade444aa2f3f2b599.js → bdc9dec6a359d2e3705c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +1 -0
  80. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  81. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +1 -0
  82. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  83. package/assets/esri/core/workers/chunks/cbba0b6bd41d16eacb5c.js +1 -0
  84. package/assets/esri/core/workers/chunks/cdf942020b7054628dc9.js +1 -0
  85. package/assets/esri/core/workers/chunks/d6c3df07cfaa6bb639e9.js +1 -0
  86. package/assets/esri/core/workers/chunks/ea4c7560e64335f155f9.js +1 -0
  87. package/assets/esri/core/workers/chunks/eac791e3a0bb056a28f3.js +1 -0
  88. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +1 -0
  89. package/assets/esri/core/workers/chunks/ee5b82873ff80cb4ba34.js +1 -0
  90. package/assets/esri/core/workers/chunks/{08980b1ad3d5d67c6390.js → f419aaf3bab086060894.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → f976233ad5e5b718ba83.js} +1 -1
  92. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  93. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  94. package/assets/esri/themes/dark/main.css +1 -1
  95. package/assets/esri/themes/light/main.css +1 -1
  96. package/assets/esri/themes/light/view.css +1 -1
  97. package/chunks/ComponentShader.glsl.js +6 -6
  98. package/chunks/arcade.js +1 -1
  99. package/chunks/array.js +1 -1
  100. package/chunks/languageUtils.js +1 -1
  101. package/copyright.txt +26 -19
  102. package/core/colorUtils.js +1 -1
  103. package/core/deprecate.js +1 -1
  104. package/core/libs/gl-matrix-2/factories/mat2df32.js +1 -1
  105. package/core/libs/gl-matrix-2/factories/mat2df64.js +1 -1
  106. package/core/libs/gl-matrix-2/factories/mat2f32.js +1 -1
  107. package/core/libs/gl-matrix-2/factories/mat2f64.js +1 -1
  108. package/core/libs/gl-matrix-2/factories/mat3f32.js +1 -1
  109. package/core/libs/gl-matrix-2/factories/mat3f64.js +1 -1
  110. package/core/libs/gl-matrix-2/factories/mat4f32.js +1 -1
  111. package/core/libs/gl-matrix-2/factories/mat4f64.js +1 -1
  112. package/core/libs/gl-matrix-2/factories/quat2f64.js +1 -1
  113. package/core/libs/gl-matrix-2/factories/vec2f32.js +1 -1
  114. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  115. package/core/libs/gl-matrix-2/factories/vec3f32.js +1 -1
  116. package/core/libs/gl-matrix-2/factories/vec3f64.js +1 -1
  117. package/core/libs/gl-matrix-2/factories/vec4f32.js +1 -1
  118. package/core/libs/gl-matrix-2/factories/vec4f64.js +1 -1
  119. package/editing/templateUtils.js +1 -1
  120. package/geohash/geohashUtils.js +1 -1
  121. package/interfaces.d.ts +634 -129
  122. package/intl/locale.js +1 -1
  123. package/layers/FeatureLayer.js +1 -1
  124. package/layers/GeoJSONLayer.js +1 -1
  125. package/layers/ImageryTileLayer.js +1 -1
  126. package/layers/OGCFeatureLayer.js +1 -1
  127. package/layers/RouteLayer.js +1 -1
  128. package/layers/SubtypeGroupLayer.js +1 -1
  129. package/layers/WFSLayer.js +1 -1
  130. package/layers/graphics/data/queryUtils.js +1 -1
  131. package/layers/mixins/ArcGISImageService.js +1 -1
  132. package/layers/mixins/ImageryTileMixin.js +1 -1
  133. package/layers/mixins/TrackableLayer.d.ts +4 -0
  134. package/layers/save/imageryUtils.js +1 -1
  135. package/layers/support/ExportImageServiceParameters.js +1 -1
  136. package/layers/support/SubtypeSublayer.js +1 -1
  137. package/layers/support/TitleCreator.js +5 -0
  138. package/layers/support/TrackInfo.d.ts +4 -0
  139. package/layers/support/TrackInfo.js +1 -1
  140. package/layers/support/TrackPartInfo.d.ts +4 -0
  141. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  142. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  143. package/layers/support/rasterDatasets/datasetUtils.js +5 -0
  144. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  145. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  146. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  147. package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
  148. package/layers/support/rasterFunctions/creators/createStatisticsFunctions.js +1 -1
  149. package/networks/UtilityNetwork.js +1 -1
  150. package/networks/support/networkFieldUtils.js +5 -0
  151. package/package.json +1 -1
  152. package/renderers/support/rasterRendererHelper.js +1 -1
  153. package/rest/query/executeForIds.js +1 -1
  154. package/rest/support/BinParametersBase.js +1 -1
  155. package/support/arcadeUtils.js +1 -1
  156. package/support/revision.js +1 -1
  157. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  158. package/symbols/cim/rasterizingUtils.js +1 -1
  159. package/symbols/support/previewCIMSymbol.js +1 -1
  160. package/symbols/support/previewSymbol2D.js +1 -1
  161. package/symbols/support/symbolUtils.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  163. package/views/2d/layers/RouteLayerView2D.js +1 -1
  164. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  165. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  166. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  167. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  168. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  169. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  170. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  171. package/views/3d/environment/EnvironmentManager.js +1 -1
  172. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  173. package/views/3d/environment/Fog.js +1 -1
  174. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  175. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  176. package/views/3d/layers/I3SMeshView3D.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  179. package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
  180. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  181. package/views/3d/layers/i3s/SymbologyInfo.js +5 -0
  182. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  183. package/views/3d/state/utils/navigationUtils.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -14
  188. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  189. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  190. package/views/3d/webgl-engine/core/renderPasses/RenderPassIdentifier.js +5 -0
  191. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  193. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  194. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  195. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  196. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  197. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  198. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  199. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  200. package/views/SceneView.js +1 -1
  201. package/views/View.js +1 -1
  202. package/views/draw/DrawAction.js +1 -1
  203. package/views/layers/FeatureLayerView.js +1 -1
  204. package/views/layers/ImageryTileLayerView.js +1 -1
  205. package/views/support/RequiredFieldsOptions.js +5 -0
  206. package/views/webgl/Texture.js +1 -1
  207. package/widgets/BasemapGallery.js +1 -1
  208. package/widgets/BasemapToggle.js +1 -1
  209. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  210. package/widgets/BatchAttributeForm.js +1 -1
  211. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  212. package/widgets/Compass/CompassViewModel.js +1 -1
  213. package/widgets/DirectionalPad.js +1 -1
  214. package/widgets/Directions/DirectionsViewModel.js +1 -1
  215. package/widgets/Directions.js +1 -1
  216. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  217. package/widgets/Editor/EditorViewModel.js +1 -1
  218. package/widgets/Editor.js +1 -1
  219. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  220. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  221. package/widgets/Fullscreen.js +1 -1
  222. package/widgets/Home.js +1 -1
  223. package/widgets/LayerList/LayerListItem.js +1 -1
  224. package/widgets/LayerList/ListItem.js +1 -1
  225. package/widgets/LayerList/support/layerListUtils.js +1 -1
  226. package/widgets/Legend/LegendViewModel.js +1 -1
  227. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  228. package/widgets/Legend.js +1 -1
  229. package/widgets/Locate.js +1 -1
  230. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  231. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
  232. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  233. package/widgets/OrientedImageryViewer/constants.js +1 -1
  234. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  235. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  236. package/widgets/OrientedImageryViewer.js +1 -1
  237. package/widgets/ScaleBar.js +1 -1
  238. package/widgets/Swipe.js +1 -1
  239. package/widgets/TableList/ListItem.js +1 -1
  240. package/widgets/TableList.js +1 -1
  241. package/widgets/Track.js +1 -1
  242. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  243. package/widgets/UtilityNetworkTrace.js +1 -1
  244. package/widgets/support/GoTo.js +1 -1
  245. package/widgets/support/goToUtils.js +5 -0
  246. package/assets/esri/core/workers/chunks/03f51ea011ffbcfb7c7d.js +0 -1
  247. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  248. package/assets/esri/core/workers/chunks/1249fd2f83caeaefd8ce.js +0 -1
  249. package/assets/esri/core/workers/chunks/144e534d4ac1aafab60d.js +0 -1
  250. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  251. package/assets/esri/core/workers/chunks/1d282700e76285a1684c.js +0 -1
  252. package/assets/esri/core/workers/chunks/35392bf8f21005ad6170.js +0 -1
  253. package/assets/esri/core/workers/chunks/37cfd102b6ab5b959f9d.js +0 -1
  254. package/assets/esri/core/workers/chunks/3ba85f1d660b8887f963.js +0 -314
  255. package/assets/esri/core/workers/chunks/3c8e5b5fb52611e30ed6.js +0 -1
  256. package/assets/esri/core/workers/chunks/5eceedac9b2b4d1ef133.js +0 -1
  257. package/assets/esri/core/workers/chunks/6a9a1cd8134a903dd05a.js +0 -1
  258. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +0 -1
  259. package/assets/esri/core/workers/chunks/7485588bd24217669578.js +0 -1
  260. package/assets/esri/core/workers/chunks/74e0116ae84def626c87.js +0 -1
  261. package/assets/esri/core/workers/chunks/7e3b374f906441cd7fb0.js +0 -1
  262. package/assets/esri/core/workers/chunks/80d3aa3f27ad5b2b969b.js +0 -1
  263. package/assets/esri/core/workers/chunks/84c1c3336011a1b79669.js +0 -1
  264. package/assets/esri/core/workers/chunks/8939479cd433cc53f6c1.js +0 -1
  265. package/assets/esri/core/workers/chunks/8a2f3ce46eeac853b3a9.js +0 -1
  266. package/assets/esri/core/workers/chunks/8f31fbb1d549230ee3db.js +0 -1
  267. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  268. package/assets/esri/core/workers/chunks/9421ae38fdf986b9b107.js +0 -1
  269. package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +0 -1
  270. package/assets/esri/core/workers/chunks/99c136b800e5fc7e04f4.js +0 -1
  271. package/assets/esri/core/workers/chunks/9b74635d80d029498da1.js +0 -1
  272. package/assets/esri/core/workers/chunks/9e7895e8201127ffe0a8.js +0 -1
  273. package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +0 -1
  274. package/assets/esri/core/workers/chunks/a6ec3665bde2af8a96e6.js +0 -1
  275. package/assets/esri/core/workers/chunks/a9274c9132e7a2691abb.js +0 -1
  276. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  277. package/assets/esri/core/workers/chunks/bf0bf2b912d668575a9b.js +0 -1
  278. package/assets/esri/core/workers/chunks/ca6180e572e69540c183.js +0 -1
  279. package/assets/esri/core/workers/chunks/cccd215b0a4890551957.js +0 -1
  280. package/assets/esri/core/workers/chunks/d074c916b414432a7b6a.js +0 -1
  281. package/assets/esri/core/workers/chunks/d7b260d6187f29e0c136.js +0 -1
  282. package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +0 -1
  283. package/assets/esri/core/workers/chunks/debfb75a94b66b58cbbc.js +0 -1
  284. package/assets/esri/core/workers/chunks/e490f70f192780d7ad50.js +0 -1
  285. package/assets/esri/core/workers/chunks/e6633f0326a44477f630.js +0 -1
  286. package/assets/esri/core/workers/chunks/e71b780d1e6a32f303b7.js +0 -1
  287. package/assets/esri/core/workers/chunks/eb0ce7937813d1be1284.js +0 -1
  288. package/assets/esri/core/workers/chunks/f285ed5425b31123d2bc.js +0 -1
  289. package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +0 -1
  290. package/assets/esri/core/workers/chunks/f4ba823c8acd60c7c82d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as g}from"../../../core/reactiveUtils.js";import{schedule as m}from"../../../core/scheduling.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as y,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as I}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as C}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as O}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as E}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as w,t as j,q as R,a as S,g as A,h as T,d as D,H as N}from"../../../chunks/vec32.js";import{create as F}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as V}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as H}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as k}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as B}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as q}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as W,toRect as z}from"../../../geometry/support/aaBoundingBox.js";import{create as $,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Y}from"../../../geometry/support/FloatArray.js";import{compactIndices as J}from"../../../geometry/support/Indices.js";import{a as Z,f as ee,g as te}from"../../../chunks/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as ne,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as de}from"../../../support/arcadeOnDemand.js";import{isBasemapLayer as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{isQuery as ue}from"../../../support/guards.js";import _e from"../../../symbols/MeshSymbol3D.js";import ge from"../../../symbols/SimpleFillSymbol.js";import me from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as fe,toWasmModification as be}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ye,ForAllFeaturesReturnType as ve,ForAllFeaturesMode as Ie}from"./II3SMeshView3D.js";import{initialize as Me,setModificationsSync as Ce,filterObbsForModificationsSync as xe,interpretObbModificationResults as Oe}from"./SceneLayerWorker.js";import{overrideColor as Ee}from"./graphics/graphicUtils.js";import{areLabelsVisible as we}from"./graphics/Labeler.js";import{TextureUsage as je,TextureEncoding as Re}from"./i3s/enums.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ae}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as Te,NodeCrossfadeMetaData as De}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ne}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as Pe,defaultMaterial as He,createTexture as Ue,configureMaterial as Ge}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Le,NodeState as ke}from"./i3s/I3SNode.js";import{I3SOverrides as Be}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as qe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ke,checkSceneLayerValid as We,checkSceneLayerCompatibleWithView as ze,whenGraphicAttributes as $e,computeVisibilityObb as Qe,filterInPlace as Xe,getCachedAttributeValue as Ye,intersectBoundingRectWithMbs as Je,MbsIntersectResult as Ze,addWraparound as et,getSymbolInfo as tt,transparentEdgeMaterial as it,getClipRect as st}from"./i3s/I3SUtil.js";import{IDBCache as rt}from"./i3s/IDBCache.js";import{IDBMockCache as ot}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as at}from"./i3s/LayerElevationProvider.js";import{attributeLookup as nt}from"./support/attributeUtils.js";import{emptyHighlightHandle as lt,normalizeHighlightTargetExceptQuery as dt}from"./support/highlightUtils.js";import{makeScheduleFunction as ht}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as ct}from"./support/symbolColorUtils.js";import{debugFlags as ut}from"../support/debugFlags.js";import{ElevationRange as _t}from"../support/ElevationRange.js";import{toBoundingRect as gt}from"../support/extentUtils.js";import{Obb as mt}from"../support/orientedBoundingBox.js";import{updatingProgress as pt}from"../support/updatingProperties.js";import{glLayout as ft}from"../support/buffer/glUtil.js";import{ObjectParameters as bt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as yt,GeometryParameters as vt}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as It}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as Mt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as Ct}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as xt}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Ot}from"../../support/HighlightDefaults.js";const Et="esri.views.3d.layers.I3SMeshView3D",wt=()=>a.getLogger(Et),jt=[1,1,1,1];class Rt extends De{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var St;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(St||(St={}));const At=26,Tt=100*o.MEGABYTES,Dt=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new H,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Te(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible}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 Ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?je.AllTexturesPBR:je.AllTextures:this._usePBR||this._hasLoadedPBRTextures?je.GeometryTexturesPBR:je.GeometryTextures}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 Yt(ye.Absolute,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Yt(ye.Absolute,t);case"relative-to-ground":return new Yt(ye.RelativeToGround,t);case"on-the-ground":return new Yt(ye.OnTheGround,0);default:return new Yt(ye.Absolute,0)}}get supportedTextureEncodings(){return Ve(this.view._stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new _t;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new ot(this.view,e):new rt("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Be({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new fe(ht(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),We(this.i3slayer),ze(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const a=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=a.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._updatingHandles.add((()=>this.layerUid),(e=>this._intersectionHandler.layerUid=e)),this._updatingHandles.add((()=>this.sublayerUid),(e=>this._intersectionHandler.sublayerUid=e)),this._elevationProvider=new at({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),_),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)),_),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ye.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),ei):t&&this.removeHandles(ei)}),_),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const u=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),u),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),_),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),_),this.addHandles([g((()=>ut.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&ut.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||ut.I3S_TREE_SHOW_TILES||(this._treeDebugger=n(this._treeDebugger))}),_),g((()=>ut.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>wt().warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:m}=this,{viewingMode:p,renderCoordsHelper:f}=m;this._planetRadiusInGlobalMode="local"===p?0:f.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=n(this._elevationTask),this.i3sOverrides=n(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=n(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=n(this._labeler),this._treeDebugger=n(this._treeDebugger),this._controller=n(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=n(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=n(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 me({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});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=Me().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=be(this._layerClippingArea,this._modifications,t);Ce({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=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._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Le.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(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),!ut.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=new Array;for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new ge({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{h(e)||wt().warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Re.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&Ct()}_getVertexBufferLayout(e,t){return ft(yt(this._getGeometryParameters({hasTexture:Bt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=nt(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=nt(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ne(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return k(r,o,0,r,a,0)?W(r):null}whenGraphicAttributes(e,t){return $e(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${At}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return ii;if(e===U(e))return si;return this.i3slayer.spatialReference.equals(e)?ti:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Pe(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=mt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=Wt(s.transformedGeometry,s.textureData),s.textureData.every(Kt)&&zt(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>wt().warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),c(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return qt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,anchorIds:n,anchors:l,transformedGeometry:d,globalTrafo:h}=s,c=w(Jt,r.center.x,r.center.y,r.center.z);j(c,c,h);const u=new mt(c,[r.extents.x,r.extents.y,r.extents.z],E(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=n,t.geometryData.anchors=l;const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:d,globalTrafo:h,geometryObbData:u.data,byteSize:Wt(d,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&zt(e,_)){const t=null!=_.textureData?_.textureData.map((e=>Kt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{..._,textureData:t}).catch((t=>wt().warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new _t,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?ai(t,r,l):null!=d&&d[3]>=0&&ni(t,d,l),!1;const g=oi;if(g.elevationRangeMin=1/0,g.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?ai(g,r,l):null!=d&&ni(g,d,l),g.elevationRangeMin>=t.elevationRangeMin&&g.elevationRangeMax<=t.elevationRangeMax))return!1;const m=o.get(i.index);if(m){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return ai(t,s,l),!1}const{objectHandle:e}=m,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(m?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return 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 p=0;p<s.length;++p)r[p]=this._getVertexBufferLayout(s[p],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=qe(n,l,a,d,c),_=B(d,h),g=B(h,c);if(null==_||null==g)return Promise.resolve(null);const m={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:g};return this._worker.invoke(m,i)}get _supportsNodeCrossFading(){return!this.view?._stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ye.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const n=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>null!=e&&(e.encoding===Re.Basis||e.encoding===Re.KTX2)))&&await Ct(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,g=d[0],{layout:m,indices:p,interleavedVertexData:f,positionData:b,hasColors:E}=o,{material:w,geometryParameters:j}=this._materialParameters(g,m),A=l||new Uint32Array([0,p?p.length:f.byteLength/m[0].stride]),T={vertices:{data:f,count:f.byteLength/m[0].stride,layoutParameters:j},positionData:{positions:Y(b.data),indices:J(b.indices)},indices:p,componentOffsets:A},D=g.transformation?x(g.transformation):O();M(D,a,D);const N=C(F(),D),V=y(I(),D),H=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,L=mt.fromData(t.geometryObbData).center,k=[1,1,1];G(L,H,k,U)||wt().errorOnce("Unsupported coordinate system for IM overlay");const B=F();q(L,H,B,U);const K=I();v(K,V);const W=F();R(W,S(W,L,N),K);const z=B[0]-W[0]*k[0],$=B[1]-W[1]*k[1],Q=_.createObject(new bt(P(z,$,k[0],k[1]),new It(N,V),mt.fromData(t.geometryObbData),T)),X=j.textureCoordinates===Mt.Atlas,{textures:Z,texturePromise:ee}=this._initMaterialAndTextures(Q,w,n,X);e.memory+=this._memEstimateGeometryAdded(Q),e.memory+=Z.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const te=!!w.hasParametersFromSource,ie="blend"!==w.alphaMode&&w.metallicRoughness.baseColorFactor[3]>=1,se=new Rt(e,h,Q,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:te,isOpaque:ie},Z,c,u);s.meta=se,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>!!(e&je.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||E,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const re=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(se),ee]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(se.objectHandle,!1).catch((e=>Nt(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,se),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Q,!0),t?.updateObjectVisibility(se.objectHandle,!0).catch((e=>Nt(e,this.i3slayer.title))),se.attributeInfo=i.attributeInfo;const s=se.cachedRendererVersion!==this._rendererVersion,r=re!==this.slicePlaneEnabled;this._updateElevationOffsets(se);const o=se.elevationOffsets;this._updateComponentData(se);const a=this._applyFiltersToNode(se);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(se),null!=this._labeler&&this._addMetaToLabeler(this._labeler,se),this._visibleGeometryChanged(se,Ft.ADD),this._highlights.objectCreated(se),this._updateMaterial(se),this._setNewNodeOpacity(se),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){wt().error("Removing duplicated node");const t=this._nodeId2Meta.get(e);null!=t&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);null!=t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Xt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ye.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Jt,d=Zt,h=a===ye.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=X(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(w(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),A(l,l,Z(e.node.serviceMbsInIndexSR)),q(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),w(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),R(l,l,n.rotationScale),A(l,l,n.position),s[a+2]=c.getAltitude(l),q(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),g=s.offset,m=e.elevationOffsets,p=(e,t)=>{const i=h?_[3*e+2]:0;m[e]=g+(t??0)-i};r.getElevations(_,u,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ae(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ye.Absolute,s=!!t&&t!==e&&t.mode!==ye.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Ft.UPDATE),this._elevationProvider.objectChanged(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:He(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=Bt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ue(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ge(e,t,o,i,this.view._stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new vt(this._hasVertexColors,e.hasTexture?e.hasRegions?Mt.Atlas:Mt.Default:Mt.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Qt(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=$();this._renderClippingArea=gt(this.view.clippingArea,i,e)?i:null;const s=$();this._layerClippingArea=gt(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)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{null!=e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Ft.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Ye(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,kt,this.view.renderSpatialReference),Je(t,kt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Vt),z(Vt,Pt),Q(i,Pt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ze.INSIDE)return;if(r===Ze.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Ht,i,t.objectHandle);Xe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Xt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>Nt(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>Nt(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>Nt(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(null!=this._labeler&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(this._updateCachedFilteredIds(e),s&&e.filteredIds===e.featureIds)return!r;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return null!=i&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_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=n(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=>Nt(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Ft.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===ke.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=et(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return et(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=et(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 de()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:wt().warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&wt().error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(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=he(this.view.map,this.layerUid);o.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!r,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid+"_"+this.sublayerId})}s.externalColorMixMode=t[r+4]&(1<<St.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<St.CastShadows),s.pickable=!!(t[r+4]&1<<St.Pickable),s.elevationOffset=e.elevationOffsets?.[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=tt(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?oe(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=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(5*e.featureIds.length));const d={color:Gt,castShadows:!0,pickable:!0,colorMixMode:ct.Multiply,edgeMaterial:null},h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=xt.OPAQUE,g=it,m=0;for(let p=0;p<e.featureIds.length;p++){if(null!=o&&(i[o]=e.featureIds[p]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Ye(l[e],p);const r=s?this._getSymbolInfo(s,t):null;let h=null,f=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=ne(this._colorVariable,t,{color:Lt,arcade:this._arcade});e&&(h=Gt,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(f=e.a))}this._opacityVariable&&(f=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==f?Ee(h,f,e.color,e.alpha,jt,Gt):Ee(h,f,null,null,jt,Gt)}if(null==h&&(h=Gt,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r?.material?r.material.colorMixMode:ct.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,null!=this._symbologyOverride&&(d.color=h,this._symbologyOverride(t,d),h=d.color),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=ct.Replace),null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===ct.Replace)?xt.OPAQUE:xt.TRANSPARENT;d.edgeMaterial===u&&t===_||(g={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[p]=g}else e.cachedEdgeMaterials[p]=it;e.cachedSymbology[m++]=Math.round(255*h[0]),e.cachedSymbology[m++]=Math.round(255*h[1]),e.cachedSymbology[m++]=Math.round(255*h[2]),e.cachedSymbology[m++]=Math.round(255*h[3]),e.cachedSymbology[m++]=d.colorMixMode|+d.castShadows<<St.CastShadows|+d.pickable<<St.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Xt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==it)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?it:(r=r||t!==it,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Xt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Ft.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?ve.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s)){case ve.EXIT:return;case ve.SKIP:continue}}let r=ve.CONTINUE;switch(i){case Ie.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Ie.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Ie.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===ve.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ve.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ve.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===Ze.OUTSIDE)return ve.CONTINUE;if(s===Ze.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=ve.CONTINUE,o=e.featureIds,a=e.objectHandle,n=st(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===ve.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ye(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(ue(e))return lt;const s=dt(e);if(0===s.length)return lt;const r=t?.name??Ot,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return lt;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>nt(t,e.attributes,i)))}resetHighlights(){n(this._highlights),this._highlights=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Ie.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=m((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(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)}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Xt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>Nt(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=$t(e);if(s){const t={context:i,buffer:s.buffer};xe(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Oe(i);e.imModificationImpact=s,s!==Le.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ye.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=F(),n=F(),l=(e,t)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),A(e,e,T(n,n,t)),D(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Ft.REMOVE&&t!==Ft.UPDATE||r.events.remove(i),t!==Ft.ADD&&t!==Ft.UPDATE||r.events.add(i,s)}};return e([f()],o.prototype,"_hasLoadedPBRTextures",void 0),e([f()],o.prototype,"_asyncModuleLoading",void 0),e([f()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([f()],o.prototype,"view",void 0),e([f()],o.prototype,"i3slayer",void 0),e([f()],o.prototype,"_controller",void 0),e([f()],o.prototype,"_labeler",void 0),e([f()],o.prototype,"updating",void 0),e([f()],o.prototype,"suspended",void 0),e([f()],o.prototype,"contentVisible",null),e([f({readOnly:!0})],o.prototype,"legendEnabled",null),e([f()],o.prototype,"holeFilling",void 0),e([f(pt)],o.prototype,"updatingProgress",void 0),e([f()],o.prototype,"updatingProgressValue",null),e([f()],o.prototype,"hasTexturesOrVertexColors",null),e([f()],o.prototype,"rendererTextureUsage",null),e([f()],o.prototype,"elevationOffset",null),e([f()],o.prototype,"elevationInfo",null),e([f({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([f()],o.prototype,"supportedTextureEncodings",null),e([f({type:[ae]})],o.prototype,"_modifications",void 0),e([f({readOnly:!0})],o.prototype,"clientGeometry",null),e([f()],o.prototype,"elevationRange",null),e([f()],o.prototype,"fullExtent",null),e([f()],o.prototype,"_elevationTask",void 0),e([f({readOnly:!0})],o.prototype,"_usePBR",null),o=e([b(Et)],o),o};function Nt(e,t){h(e)||wt().warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Ft;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Ft||(Ft={}));const Vt=K(),Pt=$(),Ht=$(),Ut=new mt,Gt=[0,0,0,0],Lt=new t([0,0,0,0]),kt=ee(0,0,0,0);function Bt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function qt(e){return"geometryData"in e}function Kt(e){return null!=e&&p(e.data)}function Wt(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&&p(s.data)&&(i+=s.data.byteLength);return i}function zt(e,t){return t.byteSize>Tt?(wt().warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function $t(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=Ut,t.center=Z(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class Qt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Xt(e,t){e.forEach((e=>e.opacity=t))}class Yt{constructor(e,t){this.mode=e,this.offset=t}}const Jt=F(),Zt=K(),ei="elevation-change",ti="",ii="@null",si="@ECEF",ri=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],oi=new _t;function ai(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(ri);for(const e of ri){const t=N(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(ri);for(const e of ri){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function ni(e,t,i){const s=Z(t),r=i>0?N(s)-i:s[2],o=te(t);e.expandElevationRangeValues(r-o,r+o)}export{Dt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as m}from"../../../core/reactiveUtils.js";import{schedule as g}from"../../../core/scheduling.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as y,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as I}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as C}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as O}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as E}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as j,t as w,q as R,a as S,g as A,h as T,d as D,H as N}from"../../../chunks/vec32.js";import{create as F}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as V}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as H}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as k}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as B}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as q}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as W,toRect as z}from"../../../geometry/support/aaBoundingBox.js";import{create as $,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Y}from"../../../geometry/support/FloatArray.js";import{compactIndices as J}from"../../../geometry/support/Indices.js";import{a as Z,f as ee,g as te}from"../../../chunks/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as ne,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as de}from"../../../support/arcadeOnDemand.js";import{isBasemapLayer as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{isQuery as ue}from"../../../support/guards.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import ge from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as fe,toWasmModification as be}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ye,ForAllFeaturesReturnType as ve,ForAllFeaturesMode as Ie}from"./II3SMeshView3D.js";import{initialize as Me,setModificationsSync as Ce,filterObbsForModificationsSync as xe,interpretObbModificationResults as Oe}from"./SceneLayerWorker.js";import{overrideColor as Ee}from"./graphics/graphicUtils.js";import{areLabelsVisible as je}from"./graphics/Labeler.js";import{TextureUsage as we,TextureEncoding as Re}from"./i3s/enums.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ae}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as Te,NodeCrossfadeMetaData as De}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ne}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as Pe,defaultMaterial as He,createTexture as Ue,configureMaterial as Ge}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Le,NodeState as ke}from"./i3s/I3SNode.js";import{I3SOverrides as Be}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as qe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ke,checkSceneLayerValid as We,checkSceneLayerCompatibleWithView as ze,whenGraphicAttributes as $e,computeVisibilityObb as Qe,filterInPlace as Xe,getCachedAttributeValue as Ye,intersectBoundingRectWithMbs as Je,MbsIntersectResult as Ze,addWraparound as et,getSymbolInfo as tt,transparentEdgeMaterial as it,getClipRect as st}from"./i3s/I3SUtil.js";import{IDBCache as rt}from"./i3s/IDBCache.js";import{IDBMockCache as ot}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as at}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as nt}from"./i3s/SymbologyInfo.js";import{attributeLookup as lt}from"./support/attributeUtils.js";import{emptyHighlightHandle as dt,normalizeHighlightTargetExceptQuery as ht}from"./support/highlightUtils.js";import{makeScheduleFunction as ct}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as ut}from"./support/symbolColorUtils.js";import{debugFlags as _t}from"../support/debugFlags.js";import{ElevationRange as mt}from"../support/ElevationRange.js";import{toBoundingRect as gt}from"../support/extentUtils.js";import{Obb as pt}from"../support/orientedBoundingBox.js";import{updatingProgress as ft}from"../support/updatingProperties.js";import{glLayout as bt}from"../support/buffer/glUtil.js";import{ObjectParameters as yt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as vt,GeometryParameters as It}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Mt}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as Ct}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as xt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as Ot}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Et}from"../../support/HighlightDefaults.js";import{alphaCutoff as jt}from"../../../webscene/support/AlphaCutoff.js";const wt="esri.views.3d.layers.I3SMeshView3D",Rt=()=>a.getLogger(wt),St=[1,1,1,1];class At extends De{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var Tt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(Tt||(Tt={}));const Dt=26,Nt=100*o.MEGABYTES,Ft=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new H,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new Te(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible}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 Ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?we.AllTexturesPBR:we.AllTextures:this._usePBR||this._hasLoadedPBRTextures?we.GeometryTexturesPBR:we.GeometryTextures}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 Jt(ye.Absolute,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Jt(ye.Absolute,t);case"relative-to-ground":return new Jt(ye.RelativeToGround,t);case"on-the-ground":return new Jt(ye.OnTheGround,0);default:return new Jt(ye.Absolute,0)}}get supportedTextureEncodings(){return Ve(this.view._stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new mt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new ot(this.view,e):new rt("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Be({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new fe(ct(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),We(this.i3slayer),ze(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const a=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=a.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._updatingHandles.add((()=>this.layerUid),(e=>this._intersectionHandler.layerUid=e)),this._updatingHandles.add((()=>this.sublayerUid),(e=>this._intersectionHandler.sublayerUid=e)),this._elevationProvider=new at({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),_),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)),_),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ye.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),ti):t&&this.removeHandles(ti)}),_),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const u=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),u),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),_),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),_),this.addHandles([m((()=>_t.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&_t.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||_t.I3S_TREE_SHOW_TILES||(this._treeDebugger=n(this._treeDebugger))}),_),m((()=>_t.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>Rt().warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:g}=this,{viewingMode:p,renderCoordsHelper:f}=g;this._planetRadiusInGlobalMode="local"===p?0:f.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=n(this._elevationTask),this.i3sOverrides=n(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=n(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=n(this._labeler),this._treeDebugger=n(this._treeDebugger),this._controller=n(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=n(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=n(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=null!=t?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=null!=t?t.node.memory:0)),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(je(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new ge({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});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=Me().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=be(this._layerClippingArea,this._modifications,t);Ce({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=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._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Le.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(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),!_t.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=new Array;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._attributeValuesChanged(s)),i).catch((e=>{h(e)||Rt().warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Re.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&xt()}_getVertexBufferLayout(e,t){return bt(vt(this._getGeometryParameters({hasTexture:qt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=lt(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=lt(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ne(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return k(r,o,0,r,a,0)?W(r):null}whenGraphicAttributes(e,t){return $e(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${Dt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return si;if(e===U(e))return ri;return this.i3slayer.spatialReference.equals(e)?ii:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Pe(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=pt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=zt(s.transformedGeometry,s.textureData),s.textureData.every(Wt)&&$t(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>Rt().warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),c(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Kt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,anchorIds:n,anchors:l,transformedGeometry:d,globalTrafo:h}=s,c=j(Zt,r.center.x,r.center.y,r.center.z);w(c,c,h);const u=new pt(c,[r.extents.x,r.extents.y,r.extents.z],E(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=n,t.geometryData.anchors=l;const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:d,globalTrafo:h,geometryObbData:u.data,byteSize:zt(d,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&$t(e,_)){const t=null!=_.textureData?_.textureData.map((e=>Wt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{..._,textureData:t}).catch((t=>Rt().warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new mt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?ni(t,r,l):null!=d&&d[3]>=0&&li(t,d,l),!1;const m=ai;if(m.elevationRangeMin=1/0,m.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?ni(m,r,l):null!=d&&li(m,d,l),m.elevationRangeMin>=t.elevationRangeMin&&m.elevationRangeMax<=t.elevationRangeMax))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return ni(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 p=0;p<s.length;++p)r[p]=this._getVertexBufferLayout(s[p],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=qe(n,l,a,d,c),_=B(d,h),m=B(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:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.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(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ye.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const n=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>null!=e&&(e.encoding===Re.Basis||e.encoding===Re.KTX2)))&&await xt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:p,interleavedVertexData:f,positionData:b,hasColors:E}=o,{material:j,geometryParameters:w}=this._materialParameters(m,g),A=l||new Uint32Array([0,p?p.length:f.byteLength/g[0].stride]),T={vertices:{data:f,count:f.byteLength/g[0].stride,layoutParameters:w},positionData:{positions:Y(b.data),indices:J(b.indices)},indices:p,componentOffsets:A},D=m.transformation?x(m.transformation):O();M(D,a,D);const N=C(F(),D),V=y(I(),D),H=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,L=pt.fromData(t.geometryObbData).center,k=[1,1,1];G(L,H,k,U)||Rt().errorOnce("Unsupported coordinate system for IM overlay");const B=F();q(L,H,B,U);const K=I();v(K,V);const W=F();R(W,S(W,L,N),K);const z=B[0]-W[0]*k[0],$=B[1]-W[1]*k[1],Q=_.createObject(new yt(P(z,$,k[0],k[1]),new Mt(N,V),pt.fromData(t.geometryObbData),T)),X=w.textureCoordinates===Ct.Atlas,{textures:Z,texturePromise:ee}=this._initMaterialAndTextures(Q,j,n,X);e.memory+=this._memEstimateGeometryAdded(Q),e.memory+=Z.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const te=!!j.hasParametersFromSource,ie="blend"!==j.alphaMode&&j.metallicRoughness.baseColorFactor[3]>=1,se=new At(e,h,Q,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:te,isOpaque:ie},Z,c,u);s.meta=se,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>!!(e&we.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||E,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const re=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(se),ee]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(se.objectHandle,!1).catch((e=>Vt(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,se),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Q,!0),t?.updateObjectVisibility(se.objectHandle,!0).catch((e=>Vt(e,this.i3slayer.title))),se.attributeInfo=i.attributeInfo;const s=se.cachedRendererVersion!==this._rendererVersion,r=re!==this.slicePlaneEnabled;this._updateElevationOffsets(se);const o=se.elevationOffsets;this._updateComponentData(se);const a=this._applyFiltersToNode(se);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(se),null!=this._labeler&&this._addMetaToLabeler(this._labeler,se),this._visibleGeometryChanged(se,Pt.ADD),this._highlights.objectCreated(se),this._updateMaterial(se),this._setNewNodeOpacity(se),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){Rt().error("Removing duplicated node");const t=this._nodeId2Meta.get(e);null!=t&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);null!=t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Yt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ye.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Zt,d=ei,h=a===ye.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=X(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(j(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),A(l,l,Z(e.node.serviceMbsInIndexSR)),q(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),j(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),R(l,l,n.rotationScale),A(l,l,n.position),s[a+2]=c.getAltitude(l),q(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),m=s.offset,g=e.elevationOffsets,p=(e,t)=>{const i=h?_[3*e+2]:0;g[e]=m+(t??0)-i};r.getElevations(_,u,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ae(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ye.Absolute,s=!!t&&t!==e&&t.mode!==ye.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Pt.UPDATE),this._elevationProvider.objectChanged(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:He(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=qt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ue(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ge(e,t,o,i,this.view._stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new It(this._hasVertexColors,e.hasTexture?e.hasRegions?Ct.Atlas:Ct.Default:Ct.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Xt(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=$();this._renderClippingArea=gt(this.view.clippingArea,i,e)?i:null;const s=$();this._layerClippingArea=gt(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)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{null!=e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Ye(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Bt,this.view.renderSpatialReference),Je(t,Bt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ht),z(Ht,Ut),Q(i,Ut)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ze.INSIDE)return;if(r===Ze.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Gt,i,t.objectHandle);Xe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Yt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>Vt(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>Vt(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>Vt(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(null!=this._labeler&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(this._updateCachedFilteredIds(e),s&&e.filteredIds===e.featureIds)return!r;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return null!=i&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_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=n(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=>Vt(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Pt.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===ke.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=et(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return et(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=et(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 de()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:Rt().warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&Rt().error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(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=he(this.view.map,this.layerUid);o.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!r,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid+"_"+this.sublayerId})}s.externalColorMixMode=t[r+4]&(1<<Tt.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<Tt.CastShadows),s.pickable=!!(t[r+4]&1<<Tt.Pickable),s.elevationOffset=e.elevationOffsets?.[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=tt(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?oe(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(5*e.featureIds.length));const d=new nt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=Ot.OPAQUE,m=it,g=0;for(let p=0;p<e.featureIds.length;p++){if(null!=o&&(i[o]=e.featureIds[p]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Ye(l[e],p);const r=s?this._getSymbolInfo(s,t):null;let h,f;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=ne(this._colorVariable,t,{color:kt,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||(f=e.a))}this._opacityVariable&&(f=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==f?Ee(h,f,e.color,e.alpha,St,d.color):Ee(h,f,null,null,St,d.color)}if(h??=V(d.color,1,1,1,1),d.colorMixMode=r?.material?.colorMixMode??ut.Multiply,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=ut.Replace),d.pickable&&=h[3]>=jt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===ut.Replace)?Ot.OPAQUE:Ot.TRANSPARENT;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[p]=m}else e.cachedEdgeMaterials[p]=it;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<<Tt.CastShadows|+d.pickable<<Tt.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Yt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==it)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?it:(r=r||t!==it,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Yt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?ve.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s)){case ve.EXIT:return;case ve.SKIP:continue}}let r=ve.CONTINUE;switch(i){case Ie.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Ie.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Ie.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===ve.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ve.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ve.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===Ze.OUTSIDE)return ve.CONTINUE;if(s===Ze.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=ve.CONTINUE,o=e.featureIds,a=e.objectHandle,n=st(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===ve.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ye(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(ue(e))return dt;const s=ht(e);if(0===s.length)return dt;const r=t?.name??Et,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return dt;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>lt(t,e.attributes,i)))}resetHighlights(){n(this._highlights),this._highlights=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Ie.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=g((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new 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)}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Yt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>Vt(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=Qt(e);if(s){const t={context:i,buffer:s.buffer};xe(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Oe(i);e.imModificationImpact=s,s!==Le.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ye.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=F(),n=F(),l=(e,t)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),A(e,e,T(n,n,t)),D(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Pt.REMOVE&&t!==Pt.UPDATE||r.events.remove(i),t!==Pt.ADD&&t!==Pt.UPDATE||r.events.add(i,s)}};return e([f()],o.prototype,"_hasLoadedPBRTextures",void 0),e([f()],o.prototype,"_asyncModuleLoading",void 0),e([f()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([f()],o.prototype,"view",void 0),e([f()],o.prototype,"i3slayer",void 0),e([f()],o.prototype,"_controller",void 0),e([f()],o.prototype,"_labeler",void 0),e([f()],o.prototype,"updating",void 0),e([f()],o.prototype,"suspended",void 0),e([f()],o.prototype,"contentVisible",null),e([f({readOnly:!0})],o.prototype,"legendEnabled",null),e([f()],o.prototype,"holeFilling",void 0),e([f(ft)],o.prototype,"updatingProgress",void 0),e([f()],o.prototype,"updatingProgressValue",null),e([f()],o.prototype,"hasTexturesOrVertexColors",null),e([f()],o.prototype,"rendererTextureUsage",null),e([f()],o.prototype,"elevationOffset",null),e([f()],o.prototype,"elevationInfo",null),e([f({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([f()],o.prototype,"supportedTextureEncodings",null),e([f({type:[ae]})],o.prototype,"_modifications",void 0),e([f({readOnly:!0})],o.prototype,"clientGeometry",null),e([f()],o.prototype,"elevationRange",null),e([f()],o.prototype,"fullExtent",null),e([f()],o.prototype,"_elevationTask",void 0),e([f({readOnly:!0})],o.prototype,"_usePBR",null),o=e([b(wt)],o),o};function Vt(e,t){h(e)||Rt().warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Pt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Pt||(Pt={}));const Ht=K(),Ut=$(),Gt=$(),Lt=new pt,kt=new t([0,0,0,0]),Bt=ee(0,0,0,0);function qt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Kt(e){return"geometryData"in e}function Wt(e){return null!=e&&p(e.data)}function zt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function $t(e,t){return t.byteSize>Nt?(Rt().warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Qt(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=Lt,t.center=Z(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class Xt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Yt(e,t){e.forEach((e=>e.opacity=t))}class Jt{constructor(e,t){this.mode=e,this.offset=t}}const Zt=F(),ei=K(),ti="elevation-change",ii="",si="@null",ri="@ECEF",oi=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],ai=new mt;function ni(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(oi);for(const e of oi){const t=N(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(oi);for(const e of oi){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function li(e,t,i){const s=Z(t),r=i>0?N(s)-i:s[2],o=te(t);e.expandElevationRangeValues(r-o,r+o)}export{Ft as I3SMeshView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as r,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as s,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as h,g as p,h as d,t as g,q as x,n as _,b as T,f as b,d as y,e as v}from"../../../../chunks/vec32.js";import{ZEROS as w,ONES as R,create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as P}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as E}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,fromBuffer as I,intersectsClippingArea as N}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as S}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as U,getContinuousIndexArray as B}from"../../../../geometry/support/Indices.js";import F from"../../../../geometry/support/MeshComponent.js";import D from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import G from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as L,isAbsoluteVertexSpace as V}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as $,isPlateCarree as H}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as k}from"../../../../chunks/vec3.js";import{transformNormal as q,transformVectorENUPlateCarree as z,VectorType as W,transformVectorWMPlateCarree as Y,projectNormalToPCPF as J,transformTangent as K,projectTangentToPCPF as Q}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as X}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as Z}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as ee}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as te}from"../../../ViewingMode.js";import{isEncodedMeshTexture as re}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as oe}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as ne}from"./ElevationAligners.js";import{needsElevationUpdates3D as ae,evaluateElevationInfoAtPoint as se}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ce}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ue,MeshFastUpdateProcessor as me}from"./MeshFastUpdateProcessor.js";import{createMaterial as fe}from"../support/edgeUtils.js";import{parseColorMixMode as he,encodeSymbolColor as pe}from"../support/symbolColorUtils.js";import{debugFlags as de}from"../../support/debugFlags.js";import{Attribute as ge}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as xe,CullFaceOptions as _e}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Te}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as be}from"../../webgl-engine/lib/Geometry.js";import{Object3D as ye}from"../../webgl-engine/lib/Object3D.js";import{Texture as ve}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as we}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Re}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Me}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as je,advancedMRRFactors as Ae,schematicMRRFactors as Ce}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Pe}from"../../../webgl/enums.js";const Ee=["mesh"];class Oe extends ce{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ue,this._fastUpdateProcessor=new me,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){de.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Me({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Me({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Me({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ee,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ae)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case ee.EnableFastUpdates:if(n)return!0;break;case ee.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,ee.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=ot,{origin:i,transform:l}=r;if(!C(t,h(Xe,i.x,i.y,i.z??0),s,a))return!1;switch(o){case ee.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case ee.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case ee.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>se(e,u,c,m,t);return e.alignedSampledElevation=ne(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,ee.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=We(n),h=We(a),p=Ye(s),d=We(i),g=Ye(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${h},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof D){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,h=We(n),p=Ye(a),d=We(i),g=We(c),x=Ye(u),_=We(m),T=Ye(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=Ve(s),o.normalTextureTransform=Ve(l),o.emissiveTextureTransform=Ve(u),o.occlusionTextureTransform=Ve(f),o.metallicRoughnessTextureTransform=Ve(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${h},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTextureId(e){const t=this._getInternalTexture(e,xe.Opaque);return t?.id}_getInternalTexture(e,t){const r=ze(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let n=this._textures.get(o);if(!n){let a=null;const s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:$e(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};re(r)?(a=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(a=r,i.preMultiplyAlpha=t!==xe.Opaque),n=new ve(a,i),this._textures.set(o,n),n.load(this._context.stage.renderView.renderingContext),this._context.stage.add(n),n.events.on("unloaded",(()=>{this._textures.delete(o)}))}return n}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture))}_setInternalMaterialParameters(e,t){null!=e.color&&qe(e.color,t),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=oe(e.colorTextureTransform),t.normalTextureTransformMatrix=oe(e.normalTextureTransform);const r=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:f;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=oe(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=oe(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=oe(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=j;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=j)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(ke(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=je({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:w,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:_e.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled};f.mrrFactors=m?Ce:[l.metallic,l.roughness,Ae[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?_e.None:_e.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const h=new Re(f,this._context);return u.material=h,this._materialInfoCache.set(l.uid,u),this._context.stage.add(h),h}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?xe.MaskBlend:xe.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?xe.Opaque:"mask"===t.alphaMode?xe.Mask:xe.Blend}_createFaceDebugNormals(e,t){const o=t.length,a=e.spatialReference.isGeographic?20015077/180:1,s=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=r(n(),c);for(let r=0;r<o;r++){const e=t[r].attributes.get(we.POSITION);if(!e)continue;const o=e.data,n=e.indices;for(let t=0;t<n.length;t+=3)Ge(o,n,t,tt),De(o,n,t,Xe,Ze,et),p(Xe,Xe,Ze),p(Xe,Xe,et),d(Xe,Xe,1/3),g(Xe,Xe,c),i.push(...Xe),x(tt,tt,u),_(tt,tt),T(Xe,Xe,tt,s),i.push(...Xe),l.push(l.length),l.push(l.length)}return i.length?new be(this._debugFaceNormalMaterial,[[we.POSITION,new ge(i,l,3,!0)]],null,Te.Line):null}_createPerVertexDebugVectors(e,t,a,s,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,d=r(n(),p);a===we.TANGENT&&o(d,p);for(let r=0;r<l;r++){const e=t[r],o=e.attributes.get(we.POSITION),n=e.attributes.get(a);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;h(Xe,s[e+0],s[e+1],s[e+2]),g(Xe,Xe,p),m.push(...Xe),h(Ze,l[r+0],l[r+1],l[r+2]),x(Ze,Ze,d),_(Ze,Ze),T(Xe,Xe,Ze,u),m.push(...Xe),f.push(f.length),f.push(f.length)}}return m.length?new be(s,[[we.POSITION,new ge(m,f,3,!0)]],null,Te.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(de.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,we.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,we.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new ye({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=fe(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new le(s[0].material,c,this._context.slicePlaneEnabled):null,m=new ie(this,l,s,null,null,ne,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=ae(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:h}=this._context,p=(e,t)=>se(e,f,r,h,t);return m.alignedSampledElevation=ne(m,r,f.spatialReference,p,h),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!L(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===te.Global&&"local"===o||a===te.Local&&$(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=Z(0,0,0,this._context.elevationProvider.spatialReference??null);return E([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===st.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(t.reprojection===st.NONE)return{position:n,georeferencedPositionBuffer:o};const a=t.reprojection===st.RENDER?t.transformBeforeProject:null;a&&(n=k(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return P(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=q(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return J(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===st.RENDER?o.transformBeforeProject:null;s&&(a=K(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===st.NONE)return a;if("local"===i){if(!H(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return z(a,W.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return Y(a,W.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return Q(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=he(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return pe(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),u=Je(e),m=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),h=this._createTangentBuffer(e,i,l,s),p=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:h}:this._transformOriginLocal(e,i,f,h);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:p,colorBuffer:u,symbolColorBuffer:m,objectTransformation:d,geometryTransformation:s.reprojection===st.NONE&&s.geometryTransformation?s.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?$(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?st.NONE:st.RENDER:st.NONE;if(V(t))return{reprojection:r};const o=t.origin,n=c(),i=e.transform?.localMatrix??u;if(r===st.NONE){C(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:m(i)}}const l=a(c(),o);return s(l,l,i),{reprojection:r,transformBeforeProject:l}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Qe[0]=a.x,Qe[1]=a.y,Qe[2]=a.z??0;const s=c();C(e.spatialReference,Qe,s,n),i(rt,s);const{position:l,normal:u,tangent:m}=e.vertexAttributes,f=t===l?new Float64Array(t.length):t;k(f,t,rt);const h=r?r===u?new Float32Array(r.length):r:null,p=o?o===m?new Float32Array(o.length):o:null;return r&&h&&q(r,h,rt),o&&p&&K(o,p,rt),{transformation:s,position:f,normal:h,tangent:p}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=X(e,r??e.spatialReference);return!!o&&(I(o,nt),!N(nt,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!A(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:f}=o,h=Le(e),p=new Array;let d=!1;const g=l(Xe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of h){if(!this._validateFaces(e,l))return null;const t=Ne(e,l);if(0===t.length)continue;const o=Se(n,c,l,t);o.didFlipNormals&&(d=!0);const m=[[we.POSITION,new ge(n,t,3,!0)],[we.NORMAL,new ge(o.normals,o.indices,3,!0)]];s&&m.push([we.COLOR,new ge(s,t,4,!0)]),i&&m.push([we.SYMBOLCOLOR,new ge(i,U(t.length),4,!0)]),a&&m.push([we.UV0,new ge(a,t,2,!0)]),u&&m.push([we.TANGENT,new ge(u,t,4,!0)]);const h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new be(g,m,null,Te.Mesh,h);_.transformation=f,_.localOrigin=x,p.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:p,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==te.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ne(e,t){return t.faces??B(e.vertexAttributes.position.length/3)}function Se(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Be(e,t,r,o);case"flat":return Ue(e,o);case"smooth":return Fe(e,o)}}function Ue(e,t){const r=S(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Ge(e,t,n,tt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Be(e,t,r,o){if(null==t)return Ue(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Ge(e,o,a,tt);for(let e=0;e<3;e++){const r=3*o[a+e];Xe[0]=t[r],Xe[1]=t[r+1],Xe[2]=t[r+2],b(tt,Xe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function Fe(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Ge(e,t,a,tt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),p(s.normal,s.normal,o),s.count++}}const o=S(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(_(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Ie(o,n,!1)}function De(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Ge(e,t,r,o){return De(e,t,r,Xe,Ze,et),y(Ze,Ze,Xe),y(et,et,Xe),v(Xe,Ze,et),_(o,Xe),o}function Le(e){return e.components??at}function Ve(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function $e(e="repeat"){if("string"==typeof e){const t=He(e);return{s:t,t}}return{s:He(e.horizontal),t:He(e.vertical)}}function He(e){switch(e){case"clamp":return Pe.CLAMP_TO_EDGE;case"mirror":return Pe.MIRRORED_REPEAT;default:return Pe.REPEAT}}function ke(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function qe(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function ze(e){return e.data??e.url}function We(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Ye(e){const{offset:t,scale:r,rotation:o}=e??Ke;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Je(e){return e.vertexAttributes.color}const Ke=new G,Qe=M(),Xe=M(),Ze=M(),et=M(),tt=M(),rt=c(),ot=c(),nt=O(),at=[new F];var st;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(st||(st={}));export{Oe as Graphics3DMeshFillSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{releaseMaybe as r}from"../../../../core/maybe.js";import{isPromiseLike as o}from"../../../../core/promiseUtils.js";import{normalFromMat4 as n,fromMat4 as a}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as i,multiply as l,invert as c,getTranslation as u}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as m,IDENTITY as f,clone as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as d,g,h as x,t as _,q as T,n as b,b as y,f as v,d as w,e as R}from"../../../../chunks/vec32.js";import{ZEROS as j,ONES as M,create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as P}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as E}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as O}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as N}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as I,fromBuffer as S,intersectsClippingArea as U}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as B}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as F,getContinuousIndexArray as D}from"../../../../geometry/support/Indices.js";import G from"../../../../geometry/support/MeshComponent.js";import V from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import L from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as $,isAbsoluteVertexSpace as H}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as k,isPlateCarree as q}from"../../../../geometry/support/spatialReferenceUtils.js";import{t as z}from"../../../../chunks/vec3.js";import{transformNormal as W,transformVectorENUPlateCarree as Y,VectorType as J,transformVectorWMPlateCarree as K,projectNormalToPCPF as Q,transformTangent as X,projectTangentToPCPF as Z}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as ee}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{makeDehydratedPoint as te}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as re}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as oe}from"../../../ViewingMode.js";import{isEncodedMeshTexture as ne}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ae}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as se}from"./ElevationAligners.js";import{needsElevationUpdates3D as ie,evaluateElevationInfoAtPoint as le}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ce}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ue}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as me}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as fe,MeshFastUpdateProcessor as pe}from"./MeshFastUpdateProcessor.js";import{createMaterial as he}from"../support/edgeUtils.js";import{parseColorMixMode as de,encodeSymbolColor as ge}from"../support/symbolColorUtils.js";import{debugFlags as xe}from"../../support/debugFlags.js";import{Attribute as _e}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as Te,CullFaceOptions as be}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as ye}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as ve}from"../../webgl-engine/lib/Geometry.js";import{Object3D as we}from"../../webgl-engine/lib/Object3D.js";import{Texture as Re}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Me}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as Ae}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ce,advancedMRRFactors as Pe,schematicMRRFactors as Ee}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Oe}from"../../../webgl/enums.js";const Ne=["mesh"];class Ie extends me{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new fe,this._fastUpdateProcessor=new pe,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){xe.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new Ae({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new Ae({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new Ae({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Ne,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,ie)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case re.EnableFastUpdates:if(n)return!0;break;case re.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,re.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,re.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=nt,{origin:i,transform:l}=r;if(!E(t,d(Ze,i.x,i.y,i.z??0),s,a))return!1;switch(o){case re.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case re.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case re.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>le(e,u,c,m,t);return e.alignedSampledElevation=se(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,re.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=Ye(n),p=Ye(a),h=Je(s),d=Ye(i),g=Je(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof V){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=Ye(n),h=Je(a),d=Ye(i),g=Ye(c),x=Je(u),_=Ye(m),T=Je(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(u),o.occlusionTextureTransform=$e(f),o.metallicRoughnessTextureTransform=$e(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTexture(e,t=Te.Opaque){const n=We(e);if(!n)return null;const a=`${e.contentHash}/${t}`;let s=this._textures.get(a);if(s){const e=this._context.stage.renderView.textures;let t=null;const n=e.acquire(s.id);return null==n||o(n)||(s.events.on("unloaded",(()=>t=r(t))),t=n),s}let i=null;const l=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:He(e.wrap),noUnpackFlip:!0,maxAnisotropy:l,mipmap:l>1};return ne(n)?(i=n.data,c.preMultiplyAlpha=!1,c.encoding=n.encoding):(i=n,c.preMultiplyAlpha=t!==Te.Opaque),s=new Re(i,c),this._textures.set(a,s),s.load(this._context.stage.renderView.renderingContext),this._context.stage.add(s),s.events.on("unloaded",(()=>{this._textures.delete(a)})),s}_setInternalMaterialTextureParameters(t,r){if(null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTexture(t.normalTexture)?.id),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTexture(t.emissiveTexture)?.id),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTexture(t.occlusionTexture)?.id),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTexture(t.metallicRoughnessTexture)?.id)}_setInternalMaterialParameters(e,t){null!=e.color&&ze(e.color,t),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=ae(e.colorTextureTransform),t.normalTextureTransformMatrix=ae(e.normalTextureTransform);const r=null!=e.normalTextureTransform?.scale?e.normalTextureTransform?.scale:h;t.scale=[r[0],r[1]],t.occlusionTextureTransformMatrix=ae(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=ae(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=ae(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=C;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=C)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(qe(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return this._setInternalMaterialTextureParameters(l,c.material.parameters),c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Ce({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:j,diffuse:M,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:be.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled};f.mrrFactors=m?Ee:[l.metallic,l.roughness,Pe[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?be.None:be.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const p=new Me(f,this._context);return u.material=p,this._materialInfoCache.set(l.uid,u),this._context.stage.add(p),p}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?Te.MaskBlend:Te.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?Te.Opaque:"mask"===t.alphaMode?Te.Mask:Te.Blend}_createFaceDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=n(s(),c);for(let n=0;n<r;n++){const e=t[n].attributes.get(je.POSITION);if(!e)continue;const r=e.data,o=e.indices;for(let t=0;t<o.length;t+=3)Le(r,o,t,rt),Ve(r,o,t,Ze,et,tt),g(Ze,Ze,et),g(Ze,Ze,tt),x(Ze,Ze,1/3),_(Ze,Ze,c),i.push(...Ze),T(rt,rt,u),b(rt,rt),y(Ze,Ze,rt,a),i.push(...Ze),l.push(l.length),l.push(l.length)}return i.length?new ve(this._debugFaceNormalMaterial,[[je.POSITION,new _e(i,l,3,!0)]],null,ye.Line):null}_createPerVertexDebugVectors(e,t,r,o,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],p=t[0].transformation,h=n(s(),p);r===je.TANGENT&&a(h,p);for(let n=0;n<l;n++){const e=t[n],o=e.attributes.get(je.POSITION),a=e.attributes.get(r);if(!o||!a)continue;const s=o.data,i=o.indices,l=a.data,c=a.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*a.stride;d(Ze,s[e+0],s[e+1],s[e+2]),_(Ze,Ze,p),m.push(...Ze),d(et,l[r+0],l[r+1],l[r+2]),T(et,et,h),b(et,et),y(Ze,Ze,et,u),m.push(...Ze),f.push(f.length),f.push(f.length)}}return m.length?new ve(o,[[je.POSITION,new _e(m,f,3,!0)]],null,ye.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(xe.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,je.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,je.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new we({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=he(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new ue(s[0].material,c,this._context.slicePlaneEnabled):null,m=new ce(this,l,s,null,null,se,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=ie(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:p}=this._context,h=(e,t)=>le(e,f,r,p,t);return m.alignedSampledElevation=se(m,r,f.spatialReference,h,p),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!$(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===oe.Global&&"local"===o||a===oe.Local&&k(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=te(0,0,0,this._context.elevationProvider.spatialReference??null);return N([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===it.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o,n=r;if(t.reprojection===it.NONE)return{position:n,georeferencedPositionBuffer:o};const a=t.reprojection===it.RENDER?t.transformBeforeProject:null;a&&(n=z(new Float64Array(n.length),n,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(o=n);const l=n===r||n===o?new Float64Array(n.length):n;return O(n,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:o}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=W(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!q(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return Y(a,J.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return K(a,J.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return Q(a,r,e.spatialReference,t,c,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=X(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!q(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return Y(a,J.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return K(a,J.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a,c=this._context.renderCoordsHelper.spatialReference;return Z(a,r,e.spatialReference,t,c,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=de(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ge(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),c=Ke(e),u=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:d,position:g,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:g,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:c,symbolColorBuffer:u,objectTransformation:d,geometryTransformation:s.reprojection===it.NONE&&s.geometryTransformation?s.geometryTransformation:m()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?k(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?it.NONE:it.RENDER:it.NONE;if(H(t))return{reprojection:r};const o=t.origin,n=m(),a=e.transform?.localMatrix??f;if(r===it.NONE){E(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:p(a)}}const s=i(m(),o);return l(s,s,a),{reprojection:r,transformBeforeProject:s}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.origin;Xe[0]=a.x,Xe[1]=a.y,Xe[2]=a.z??0;const s=m();E(e.spatialReference,Xe,s,n),c(ot,s);const{position:i,normal:l,tangent:u}=e.vertexAttributes,f=t===i?new Float64Array(t.length):t;z(f,t,ot);const p=r?r===l?new Float32Array(r.length):r:null,h=o?o===u?new Float32Array(o.length):o:null;return r&&p&&W(r,p,ot),o&&h&&X(o,h,ot),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=ee(e,r??e.spatialReference);return!!o&&(S(o,at),!U(at,this._context.clippingExtent))}_createGeometryInfo(e,t,r){if(!P(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:m,geometryTransformation:f}=o,p=e.components??st,h=new Array;let d=!1;const g=u(Ze,m),x=this._context.localOriginFactory.getOrigin(g);for(const u of p){if(!this._validateFaces(e,u))return null;const t=Ue(e,u);if(0===t.length)continue;const o=Be(n,l,u,t);o.didFlipNormals&&(d=!0);const m=[[je.POSITION,new _e(n,t,3,!0)],[je.NORMAL,new _e(o.normals,o.indices,3,!0)]];s&&m.push([je.COLOR,new _e(s,t,4,!0)]),i&&m.push([je.SYMBOLCOLOR,new _e(i,F(t.length),4,!0)]),a&&m.push([je.UV0,new _e(a,t,2,!0)]),c&&m.push([je.TANGENT,new _e(c,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,u),_=new ve(g,m,null,ye.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return d&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==oe.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Se{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Ue(e,t){return t.faces??D(e.vertexAttributes.position.length/3)}function Be(e,t,r,o){switch(r.shading||"flat"){default:case"source":return De(e,t,r,o);case"flat":return Fe(e,o);case"smooth":return Ge(e,o)}}function Fe(e,t){const r=B(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Le(e,t,n,rt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Se(r,o,!1)}function De(e,t,r,o){if(null==t)return Fe(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Le(e,o,a,rt);for(let e=0;e<3;e++){const r=3*o[a+e];Ze[0]=t[r],Ze[1]=t[r+1],Ze[2]=t[r+2],v(rt,Ze)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Se(t,o,n)}function Ge(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Le(e,t,a,rt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:A(),count:0},r[n]=s),g(s.normal,s.normal,o),s.count++}}const o=B(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(b(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Se(o,n,!1)}function Ve(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Le(e,t,r,o){return Ve(e,t,r,Ze,et,tt),w(et,et,Ze),w(tt,tt,Ze),R(Ze,et,tt),b(o,Ze),o}function $e(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function He(e="repeat"){if("string"==typeof e){const t=ke(e);return{s:t,t}}return{s:ke(e.horizontal),t:ke(e.vertical)}}function ke(e){switch(e){case"clamp":return Oe.CLAMP_TO_EDGE;case"mirror":return Oe.MIRRORED_REPEAT;default:return Oe.REPEAT}}function qe(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function ze(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function We(e){return e.data??e.url}function Ye(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Je(e){const{offset:t,scale:r,rotation:o}=e??Qe;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Ke(e){return e.vertexAttributes.color}const Qe=new L,Xe=A(),Ze=A(),et=A(),tt=A(),rt=A(),ot=m(),nt=m(),at=I(),st=[new G];var it;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(it||(it={}));export{Ie as Graphics3DMeshFillSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,ONES as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as l}from"../../../../chunks/vec42.js";import{clone as u,ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as c}from"../../../../geometry/projection.js";import{width as m,depth as p,height as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as y}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as g}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as v,clonePoint as z}from"../../../../layers/graphics/hydratedFeatures.js";function b(t,e){if("point"===t.type)return P(t,e,!1);if(v(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(w(t),e,!0);case"mesh":return P(d(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return P(M(t),e,!0);case"polygon":return P(R(t),e,!0);case"polyline":return P(w(t),e,!0);case"multipoint":return}}function w(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=x(e,g(e)/2);return j(r[0],r[1],r[2],t.spatialReference)}function M(t){return j(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function R(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=y(t.rings,!!t.hasZ);return j(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:z(t);return e&&t?c(t,n,e)?n:null:n}function F(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function S(t,e,r,n=0){if(t){e||(e=h());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),l(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function A(t,e,r=null){const n=u(a);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),null!=e?n[3]=e:null!=t&&t.length>3&&(n[3]=t[3]),r&&(n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r),n}function B(t,e,r,n,i,o=[0,0,0,0]){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function D(t=s,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return o(i)}function I(t){return null!=t.isPrimitive}function U(t){return Z(I(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function Z(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function k(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function E(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=m(e)*i,s=p(e)*i,l=f(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{b as computeCentroid,F as computeMaxZ,k as computeObjectRotation,D as computeObjectScale,E as demResolutionForBoundingBox,S as enlargeExtent,Z as isValidSize,A as mixinColorAndOpacity,B as overrideColor,U as validateSymbolLayerSize};
5
+ import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{rotateZ as e,rotateX as r,rotateY as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,ONES as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as l}from"../../../../chunks/vec42.js";import{clone as u,ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectPoint as c}from"../../../../geometry/projection.js";import{width as m,depth as p,height as f}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as y}from"../../../../geometry/support/centroid.js";import{getPointOnPath as x,getPathLength as g}from"../../../../geometry/support/coordsUtils.js";import{vertexSpaceOriginToPoint as d}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{makeDehydratedPoint as j}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as v,clonePoint as z}from"../../../../layers/graphics/hydratedFeatures.js";function b(t,e){if("point"===t.type)return P(t,e,!1);if(v(t))switch(t.type){case"extent":return P(t.center,e,!1);case"polygon":return P(t.centroid,e,!1);case"polyline":return P(w(t),e,!0);case"mesh":return P(d(t.vertexSpace,t.spatialReference)??t.extent.center,e,!1);case"multipoint":return}else switch(t.type){case"extent":return P(M(t),e,!0);case"polygon":return P(R(t),e,!0);case"polyline":return P(w(t),e,!0);case"multipoint":return}}function w(t){const e=t.paths[0];if(!e||0===e.length)return null;const r=x(e,g(e)/2);return j(r[0],r[1],r[2],t.spatialReference)}function M(t){return j(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function R(t){const e=t.rings[0];if(!e||0===e.length)return null;const r=y(t.rings,!!t.hasZ);return j(r[0],r[1],r[2],t.spatialReference)}function P(t,e,r){const n=r?t:z(t);return e&&t?c(t,n,e)?n:null:n}function F(t){if(!t)return 0;switch(t.type){case"point":return t.z;case"extent":return t.zmax;case"polygon":return t.hasZ?t.rings.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"polyline":return t.hasZ?t.paths.reduce(((t,e)=>e.reduce(((t,e)=>Math.max(t,e[2])),t)),-1/0):void 0;case"mesh":return t.extent.zmax;case"multipoint":return}}function S(t,e,r,n=0){if(t){e||(e=h());const i=t;let o=.5*i.width*(r-1),s=.5*i.height*(r-1);return i.width<1e-7*i.height?o+=s/20:i.height<1e-7*i.width&&(s+=o/20),l(e,i.xmin-o-n,i.ymin-s-n,i.xmax+o+n,i.ymax+s+n),e}return null}function A(t,e,r=null){const n=u(a);return null!=t&&(n[0]=t[0],n[1]=t[1],n[2]=t[2]),null!=e?n[3]=e:null!=t&&t.length>3&&(n[3]=t[3]),r&&(n[0]*=r,n[1]*=r,n[2]*=r,n[3]*=r),n}function B(t,e,r,n,i,o){for(let s=0;s<3;++s)o[s]=null!=t?.[s]?t[s]:null!=r?.[s]?r[s]:i[s];return o[3]=null!=e?e:null!=n?n:i[3],o}function D(t=s,e,r,n=1){const i=new Array(3);if(null==e||null==r)i[0]=1,i[1]=1,i[2]=1;else{let n,o=0;for(let s=2;s>=0;s--){const l=t[s],u=null!=l,a=0===s&&!n&&!u,c=r[s];let m;"symbol-value"===l||a?m=0!==c?e[s]/c:1:u&&"proportional"!==l&&isFinite(l)&&(m=0!==c?l/c:1),null!=m&&(i[s]=m,n=m,o=Math.max(o,Math.abs(m)))}for(let t=2;t>=0;t--)null==i[t]?i[t]=n:0===i[t]&&(i[t]=.001*o)}for(let o=2;o>=0;o--)i[o]/=n;return o(i)}function I(t){return null!=t.isPrimitive}function U(t){return Z(I(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function Z(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function k(t,o,s,l=i()){return t&&e(l,l,-t/180*Math.PI),o&&r(l,l,o/180*Math.PI),s&&n(l,l,s/180*Math.PI),l}function E(e,r,n){if(null!=n.minDemResolution)return n.minDemResolution;const i=t(r),o=m(e)*i,s=p(e)*i,l=f(e)*(r.isGeographic?1:i);return 0===o&&0===s&&0===l?n.minDemResolutionForPoints:.01*Math.max(o,s,l)}export{b as computeCentroid,F as computeMaxZ,k as computeObjectRotation,D as computeObjectScale,E as demResolutionForBoundingBox,S as enlargeExtent,Z as isValidSize,A as mixinColorAndOpacity,B as overrideColor,U as validateSymbolLayerSize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{createMaterialFromEdges as r}from"../support/edgeUtils.js";import{ColorMixModeEnum as o}from"../support/symbolColorUtils.js";var a;!function(e){e[e.Solid=0]="Solid",e[e.WireFrame=1]="WireFrame",e[e.XRay=2]="XRay"}(a||(a={}));const l=.15,t=.5*l;function i(e){switch(e.filterMode.type){case"solid":return{mode:a.Solid};case"wire-frame":return{mode:a.WireFrame,edgeMaterial:r(e.filterMode.edges,{})};case"x-ray":return{mode:a.XRay}}}function c(e,r){if(null==r)return e.color[3]=0,e.edgeMaterial=null,void(e.pickable=!1);switch(r.mode){case a.Solid:return;case a.WireFrame:return e.color[3]=0,e.edgeMaterial=r.edgeMaterial,void(e.pickable=!1);case a.XRay:return e.color[0]=1,e.color[1]=1,e.color[2]=1,e.color[3]*=l,e.colorMixMode=o.Replace,e.castShadows=!1,e.pickable=!1,void(e.edgeMaterial=n(e.edgeMaterial))}}function n(e){return null==e?null:(d.lastMaterial!==e&&(d.cachedMaterial=s(e),d.lastMaterial=e),d.cachedMaterial)}function s(r){const o=e(r.color);return o[3]*=t,{...r,color:o}}const d={cachedMaterial:null,lastMaterial:null};export{a as FilterModeEnum,c as applyFilterMode,i as parseFilterMode};
5
+ import"../../../../core/has.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{createMaterialFromEdges as r}from"../support/edgeUtils.js";import{ColorMixModeEnum as o}from"../support/symbolColorUtils.js";var a;!function(e){e[e.Solid=0]="Solid",e[e.WireFrame=1]="WireFrame",e[e.XRay=2]="XRay"}(a||(a={}));const l=.15,t=.5*l;function i(e){switch(e.filterMode.type){case"solid":return{mode:a.Solid};case"wire-frame":return{mode:a.WireFrame,edgeMaterial:r(e.filterMode.edges,{})};case"x-ray":return{mode:a.XRay}}}function c(e,r){if(null==r)return e.color[3]=0,void(e.edgeMaterial=null);switch(r.mode){case a.Solid:return;case a.WireFrame:return e.color[3]=0,void(e.edgeMaterial=r.edgeMaterial);case a.XRay:return e.color[0]=1,e.color[1]=1,e.color[2]=1,e.color[3]*=l,e.colorMixMode=o.Replace,e.castShadows=!1,e.pickable=!1,void(e.edgeMaterial=s(e.edgeMaterial))}}function s(e){return null==e?null:(d.lastMaterial!==e&&(d.cachedMaterial=n(e),d.lastMaterial=e),d.cachedMaterial)}function n(r){const o=e(r.color);return o[3]*=t,{...r,color:o}}const d={cachedMaterial:null,lastMaterial:null};export{a as FilterModeEnum,c as applyFilterMode,i as parseFilterMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{TextureEncoding as o,TextureUsage as r}from"./enums.js";import{RenderTexture as a}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as s}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{TextureEncodingMimeType as t,CullFaceOptions as l,AlphaDiscardMode as n}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as i}from"../../webgl-engine/lib/Texture.js";import{useSchematicPBRI3S as u,useSchematicPBR as c,schematicMRRFactors as m,advancedMRRFactors as d}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as g}from"../../../webgl/enums.js";import{alphaCutoff as p}from"../../../../webscene/support/AlphaCutoff.js";function h(e,o,a){const s=new Map,t=(e,o)=>{if(null==e)return-1;const r=s.get(e.id);if(r)return r.usage|=o,r.id;const a=s.size;return s.set(e.id,{id:a,usage:o}),a},n=o.pbrMetallicRoughness,i=n?.baseColorFactor,g=o.emissiveFactor,p=has("disable-feature:diffuse-rendering-i3s")||a?u({normalTexture:o.normalTexture,emissiveTexture:o.emissiveTexture,emissiveFactor:o.emissiveFactor,occlusionTexture:o.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}):c({normalTexture:o.normalTexture,emissiveTexture:o.emissiveTexture,emissiveFactor:o.emissiveFactor,occlusionTexture:o.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}),h=p?m[0]:n?.metallicFactor??d[0],x=p?m[1]:n?.roughnessFactor??d[1],F="mask"===o.alphaMode?r.Color|r.AlphaMask:r.Color,b={baseColorFactor:i?[i[0],i[1],i[2],i[3]]:[1,1,1,1],baseColorTextureId:t(n?.baseColorTexture,F),metallicRoughnessTextureId:t(n?.metallicRoughnessTexture,r.MetallicRoughness),metallicFactor:h,roughnessFactor:x},C={alphaMode:o.alphaMode,alphaCutoff:o.alphaCutoff,doubleSided:o.doubleSided,cullFace:"none"===o.cullFace?l.None:"back"===o.cullFace?l.Back:"front"===o.cullFace?l.Front:l.None,normalTextureId:t(o.normalTexture,r.Normal),emissiveTextureId:t(o.emissiveTexture,r.Emissive),occlusionTextureId:t(o.occlusionTexture,r.Occlusion),emissiveFactor:g?[g[0],g[1],g[2]]:[0,0,0],metallicRoughness:b,wrapTextures:!1,hasParametersFromSource:p},P=[];return s.forEach((({usage:o},r)=>{const a=null!=e&&e[r]&&e[r].formats,s=a?T(a.map((({name:e,format:o})=>({name:e,encoding:f[o]})))):[];P.push({id:r,usage:o,encodings:s})})),{material:C,textures:P}}function T(e){return e.sort(((e,o)=>e.encoding-o.encoding))}const f={ktx2:o.KTX2,basis:o.Basis,dds:o.DDS_S3TC,png:o.PNG,jpg:o.JPG,"ktx-etc2":o.KTX_ETC2},x={[t.KTX2_ENCODING]:o.Basis,[t.BASIS_ENCODING]:o.Basis,[t.DDS_ENCODING]:o.DDS_S3TC,"image/png":o.PNG,"image/jpg":o.JPG,"image/jpeg":o.JPG,"image/ktx":o.KTX_ETC2};function F(o){const a=o?.materialDefinitions?Object.keys(o.materialDefinitions)[0]:null,s=o?.textureDefinitions?Object.keys(o.textureDefinitions)[0]:null,t=a?o.materialDefinitions?.[a]:null,n=s?o.textureDefinitions?.[s]:null,i=b();if(null!=t){const o=t.params;o.diffuse&&(i.metallicRoughness.baseColorFactor=[o.diffuse[0],o.diffuse[1],o.diffuse[2],1]),null!=o.doubleSided&&(i.doubleSided=o.doubleSided,i.cullFace=o.doubleSided?l.None:l.Back),"none"!==o.cullFace&&"front"!==o.cullFace&&"back"!==o.cullFace||(i.cullFace="none"===o.cullFace?l.None:"back"===o.cullFace?l.Back:l.Front),o.transparency&&(i.metallicRoughness.baseColorFactor[3]=e(1-o.transparency,0,1)),(o.useVertexColorAlpha||i.metallicRoughness.baseColorFactor[3]<1)&&(i.alphaMode="blend")}const u=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(i.wrapTextures=!0);let o=r.Color;"rgba"===n.channels&&(i.alphaMode="blend",o|=r.AlphaMask);const a=n.images.length-1,s=n.images[a],t=e=>e?.split("/").pop(),l=Array.isArray(n.encoding)?T(n.encoding.map(((e,o)=>({name:t(s.href[o]),encoding:x[e]||0})))):[{name:t(s.href),encoding:x[n.encoding]||0}];u.push({id:e,usage:o,encodings:l}),i.metallicRoughness.baseColorTextureId=e}return{material:i,textures:u}}const b=()=>({alphaMode:"opaque",alphaCutoff:p,doubleSided:!0,cullFace:l.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function C(e,o,a,s){if(null==e?.data)return null;const t=e.data,l=s.renderingContext.parameters.maxMaxAnisotropy,n=l>1,u=a||!o.wrapTextures?P:S,c=N(e.encoding),m=e.usage&r.Color?"opaque"===o.alphaMode?3:4:3;return new i(t,{mipmap:n,maxAnisotropy:l,encoding:c,wrap:u,components:m,noUnpackFlip:!0})}const P={s:g.CLAMP_TO_EDGE,t:g.CLAMP_TO_EDGE},S={s:g.REPEAT,t:g.REPEAT};function M(o,t,l,i,u,c){const g=c.rendererTextureUsage,h=e=>w(i,l,e&g),T=t.metallicRoughness.baseColorFactor,f=e(t.metallicRoughness.baseColorFactor[3],0,1);o.baseColor=[T[0],T[1],T[2],f],o.hasParametersFromSource=!!t.hasParametersFromSource,o.usePBR=c.usePBR,o.mrrFactors=[t.metallicRoughness.metallicFactor,t.metallicRoughness.roughnessFactor,t.hasParametersFromSource?m[2]:d[2]],o.emissiveFactor=t.emissiveFactor,o.isIntegratedMesh=c.isIntegratedMesh,o.textureAlphaCutoff="mask"===t.alphaMode?t.alphaCutoff:p,o.alphaDiscardMode="opaque"===t.alphaMode?n.Opaque:"mask"===t.alphaMode?n.Mask:n.MaskBlend;const x=[],F=h(r.Color|r.AlphaMask);null!=F&&(o.baseColorTexture=new a(u,F),x.push(o.baseColorTexture.loadPromise));const b=h(r.MetallicRoughness);null!=b&&(o.metallicRoughnessTexture=new a(u,b),x.push(o.metallicRoughnessTexture.loadPromise));const C=h(r.Emissive);null!=C&&(o.emissionTexture=new a(u,C),x.push(o.emissionTexture.loadPromise));const P=h(r.Occlusion);null!=P&&(o.occlusionTexture=new a(u,P),x.push(o.occlusionTexture.loadPromise));const S=h(r.Normal);return null!=S&&(o.normalTexture=new a(u,S),x.push(o.normalTexture.loadPromise)),o.commonMaterialParameters.hasSlicePlane=c.slicePlaneEnabled,o.commonMaterialParameters.doubleSided=t.doubleSided,o.commonMaterialParameters.cullFace=t.cullFace,o.ellipsoidMode=s(c.viewSpatialReference),Promise.all(x)}function R(e){const r=!!e.compressedTextureS3TC,a=!!e.compressedTextureETC,s=has("disable-feature:i3s-basis")?0:o.Basis|o.KTX2,t=o.JPG|o.PNG,l=s|o.DDS_S3TC;return t|(r?l:0)|(a?s:0)}function D(e,o){if(null!=o)return e.find((e=>!!(e.encoding&o)))}function w(e,o,a){if(null==e||a===r.None)return null;for(let r=0;r<e.length;r++){const s=e[r];if(null!=s&&s.usage&a){const e=o[r];return null!=e?e.id:null}}return null}function N(e){switch(e){case o.KTX2:return t.KTX2_ENCODING;case o.Basis:return t.BASIS_ENCODING;case o.DDS_S3TC:return t.DDS_ENCODING;case o.PNG:return"image/png";case o.JPG:return"image/jpeg";case o.KTX_ETC2:return"image/ktx";default:return""}}export{M as configureMaterial,C as createTexture,b as defaultMaterial,h as getMaterialAndTextures,F as getMaterialAndTexturesFromShared,R as getSupportedEncodings,D as selectEncoding};
5
+ import{validateColorAndOpacity as e,validateColor as o}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as r}from"../../../../core/mathUtils.js";import{TextureEncoding as a,TextureUsage as s}from"./enums.js";import{RenderTexture as t}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as l}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{TextureEncodingMimeType as n,CullFaceOptions as i,AlphaDiscardMode as u}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as c}from"../../webgl-engine/lib/Texture.js";import{useSchematicPBRI3S as m,useSchematicPBR as d,schematicMRRFactors as p,advancedMRRFactors as g}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as h}from"../../../webgl/enums.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";function T(o,r,a){const t=new Map,l=(e,o)=>{if(null==e)return-1;const r=t.get(e.id);if(r)return r.usage|=o,r.id;const a=t.size;return t.set(e.id,{id:a,usage:o}),a},n=r.pbrMetallicRoughness,u=n?.baseColorFactor?e(n.baseColorFactor):null,c=r.emissiveFactor,h=has("disable-feature:diffuse-rendering-i3s")||a?m({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}):d({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}),f=h?p[0]:n?.metallicFactor??g[0],T=h?p[1]:n?.roughnessFactor??g[1],b="mask"===r.alphaMode?s.Color|s.AlphaMask:s.Color,C={baseColorFactor:u?[u[0],u[1],u[2],u[3]]:[1,1,1,1],baseColorTextureId:l(n?.baseColorTexture,b),metallicRoughnessTextureId:l(n?.metallicRoughnessTexture,s.MetallicRoughness),metallicFactor:f,roughnessFactor:T},P={alphaMode:r.alphaMode,alphaCutoff:r.alphaCutoff,doubleSided:r.doubleSided,cullFace:"none"===r.cullFace?i.None:"back"===r.cullFace?i.Back:"front"===r.cullFace?i.Front:i.None,normalTextureId:l(r.normalTexture,s.Normal),emissiveTextureId:l(r.emissiveTexture,s.Emissive),occlusionTextureId:l(r.occlusionTexture,s.Occlusion),emissiveFactor:c?[c[0],c[1],c[2]]:[0,0,0],metallicRoughness:C,wrapTextures:!1,hasParametersFromSource:h},S=[];return t.forEach((({usage:e},r)=>{const a=null!=o&&o[r]&&o[r].formats,s=a?x(a.map((({name:e,format:o})=>({name:e,encoding:F[o]})))):[];S.push({id:r,usage:e,encodings:s})})),{material:P,textures:S}}function x(e){return e.sort(((e,o)=>e.encoding-o.encoding))}const F={ktx2:a.KTX2,basis:a.Basis,dds:a.DDS_S3TC,png:a.PNG,jpg:a.JPG,"ktx-etc2":a.KTX_ETC2},b={[n.KTX2_ENCODING]:a.Basis,[n.BASIS_ENCODING]:a.Basis,[n.DDS_ENCODING]:a.DDS_S3TC,"image/png":a.PNG,"image/jpg":a.JPG,"image/jpeg":a.JPG,"image/ktx":a.KTX_ETC2};function C(e){const a=e?.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,t=e?.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,l=a?e.materialDefinitions?.[a]:null,n=t?e.textureDefinitions?.[t]:null,u=P();if(null!=l){const e=l.params;e.diffuse&&(o(e.diffuse),u.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(u.doubleSided=e.doubleSided,u.cullFace=e.doubleSided?i.None:i.Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(u.cullFace="none"===e.cullFace?i.None:"back"===e.cullFace?i.Back:i.Front),e.transparency&&(u.metallicRoughness.baseColorFactor[3]=r(1-e.transparency,0,1)),(e.useVertexColorAlpha||u.metallicRoughness.baseColorFactor[3]<1)&&(u.alphaMode="blend")}const c=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(u.wrapTextures=!0);let o=s.Color;"rgba"===n.channels&&(u.alphaMode="blend",o|=s.AlphaMask);const r=n.images.length-1,a=n.images[r],t=e=>e?.split("/").pop(),l=Array.isArray(n.encoding)?x(n.encoding.map(((e,o)=>({name:t(a.href[o]),encoding:b[e]||0})))):[{name:t(a.href),encoding:b[n.encoding]||0}];c.push({id:e,usage:o,encodings:l}),u.metallicRoughness.baseColorTextureId=e}return{material:u,textures:c}}const P=()=>({alphaMode:"opaque",alphaCutoff:f,doubleSided:!0,cullFace:i.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function S(e,o,r,a){if(null==e?.data)return null;const t=e.data,l=a.renderingContext.parameters.maxMaxAnisotropy,n=l>1,i=r||!o.wrapTextures?M:D,u=I(e.encoding),m=e.usage&s.Color?"opaque"===o.alphaMode?3:4:3;return new c(t,{mipmap:n,maxAnisotropy:l,encoding:u,wrap:i,components:m,noUnpackFlip:!0})}const M={s:h.CLAMP_TO_EDGE,t:h.CLAMP_TO_EDGE},D={s:h.REPEAT,t:h.REPEAT};function R(o,r,a,n,i,c){const m=c.rendererTextureUsage,d=e=>E(n,a,e&m),h=e(r.metallicRoughness.baseColorFactor);o.baseColor=[h[0],h[1],h[2],h[3]],o.hasParametersFromSource=!!r.hasParametersFromSource,o.usePBR=c.usePBR,o.mrrFactors=[r.metallicRoughness.metallicFactor,r.metallicRoughness.roughnessFactor,r.hasParametersFromSource?p[2]:g[2]],o.emissiveFactor=r.emissiveFactor,o.isIntegratedMesh=c.isIntegratedMesh,o.textureAlphaCutoff="mask"===r.alphaMode?r.alphaCutoff:f,o.alphaDiscardMode="opaque"===r.alphaMode?u.Opaque:"mask"===r.alphaMode?u.Mask:u.MaskBlend;const T=[],x=d(s.Color|s.AlphaMask);null!=x&&(o.baseColorTexture=new t(i,x),T.push(o.baseColorTexture.loadPromise));const F=d(s.MetallicRoughness);null!=F&&(o.metallicRoughnessTexture=new t(i,F),T.push(o.metallicRoughnessTexture.loadPromise));const b=d(s.Emissive);null!=b&&(o.emissionTexture=new t(i,b),T.push(o.emissionTexture.loadPromise));const C=d(s.Occlusion);null!=C&&(o.occlusionTexture=new t(i,C),T.push(o.occlusionTexture.loadPromise));const P=d(s.Normal);return null!=P&&(o.normalTexture=new t(i,P),T.push(o.normalTexture.loadPromise)),o.commonMaterialParameters.hasSlicePlane=c.slicePlaneEnabled,o.commonMaterialParameters.doubleSided=r.doubleSided,o.commonMaterialParameters.cullFace=r.cullFace,o.ellipsoidMode=l(c.viewSpatialReference),Promise.all(T)}function w(e){const o=!!e.compressedTextureS3TC,r=!!e.compressedTextureETC,s=has("disable-feature:i3s-basis")?0:a.Basis|a.KTX2,t=a.JPG|a.PNG,l=s|a.DDS_S3TC;return t|(o?l:0)|(r?s:0)}function N(e,o){if(null!=o)return e.find((e=>!!(e.encoding&o)))}function E(e,o,r){if(null==e||r===s.None)return null;for(let a=0;a<e.length;a++){const s=e[a];if(null!=s&&s.usage&r){const e=o[a];return null!=e?e.id:null}}return null}function I(e){switch(e){case a.KTX2:return n.KTX2_ENCODING;case a.Basis:return n.BASIS_ENCODING;case a.DDS_S3TC:return n.DDS_ENCODING;case a.PNG:return"image/png";case a.JPG:return"image/jpeg";case a.KTX_ETC2:return"image/ktx";default:return""}}export{R as configureMaterial,S as createTexture,P as defaultMaterial,T as getMaterialAndTextures,C as getMaterialAndTexturesFromShared,w as getSupportedEncodings,N as selectEncoding};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ColorMixModeEnum as s}from"../support/symbolColorUtils.js";class t{constructor(){this.color=o(),this.castShadows=!0,this.pickable=!0,this.colorMixMode=s.Multiply}}export{t as SymbologyInfo};