@arcgis/core 4.24.0-next.20220508 → 4.24.0-next.20220511

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 (338) hide show
  1. package/AggregateGraphic.js +1 -1
  2. package/analysis/Analysis.js +1 -1
  3. package/analysis/DimensioningAnalysis.js +1 -1
  4. package/analysis/LengthDimension.d.ts +4 -0
  5. package/analysis/LengthDimension.js +5 -0
  6. package/analysis/dimensionUtils.js +5 -0
  7. package/arcade/Dictionary.js +1 -1
  8. package/arcade/Feature.js +1 -1
  9. package/arcade/arcade.js +1 -1
  10. package/arcade/arcadeAsyncRuntime.js +1 -1
  11. package/arcade/arcadeCompiler.js +1 -1
  12. package/arcade/credentials.js +1 -1
  13. package/arcade/featureSetCollection.js +1 -1
  14. package/arcade/featureSetUtils.js +1 -1
  15. package/arcade/featureset/actions/Adapted.js +1 -1
  16. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  17. package/arcade/featureset/actions/GroupBy.js +1 -1
  18. package/arcade/featureset/actions/OrderBy.js +1 -1
  19. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  20. package/arcade/featureset/actions/Top.js +1 -1
  21. package/arcade/featureset/sources/Empty.js +1 -1
  22. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  23. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  24. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  25. package/arcade/featureset/support/FeatureSet.js +1 -1
  26. package/arcade/featureset/support/FeatureSetIterator.js +1 -1
  27. package/arcade/featureset/support/shared.js +1 -1
  28. package/arcade/featureset/support/stats.js +1 -1
  29. package/arcade/functions/featuresetbase.js +1 -1
  30. package/arcade/functions/featuresetgeom.js +1 -1
  31. package/arcade/functions/featuresetstats.js +1 -1
  32. package/arcade/functions/featuresetstring.js +1 -1
  33. package/arcade/functions/geomasync.js +1 -1
  34. package/arcade/languageUtils.js +1 -1
  35. package/arcade/request.js +1 -1
  36. package/assets/esri/core/workers/RemoteClient.js +1 -1
  37. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +1 -0
  38. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +1 -0
  39. package/assets/esri/core/workers/chunks/0a6977144ea1abf96fbf.js +1 -0
  40. package/assets/esri/core/workers/chunks/13387f56acbc3291561a.js +1 -0
  41. package/assets/esri/core/workers/chunks/16c4e0a32d50d4db984d.js +1 -0
  42. package/assets/esri/core/workers/chunks/{076d1b1101b59af0d389.js → 1c010202b4c7e1d15f23.js} +1 -1
  43. package/assets/esri/core/workers/chunks/26827ec144676e6385f8.js +1 -0
  44. package/assets/esri/core/workers/chunks/287c484fd40eee643f3a.js +1 -0
  45. package/assets/esri/core/workers/chunks/5210f0b42dba27945226.js +1 -0
  46. package/assets/esri/core/workers/chunks/{db6c5b3b4efe8d804f9c.js → 52478ee2d2a1354b6900.js} +1 -1
  47. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b85218d44c6094b7e5e6.js → 6d7e2a23a0a5dd9ded1d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/70b6356357e7640c4e8b.js +1 -0
  50. package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +1 -0
  51. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +1 -0
  52. package/assets/esri/core/workers/chunks/7e5c22b5a32ac74b1b6e.js +1 -0
  53. package/assets/esri/core/workers/chunks/8102bb78fe96e6197e4e.js +1 -0
  54. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +1 -0
  55. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +1 -0
  56. package/assets/esri/core/workers/chunks/{1eecae5227318f491263.js → 9f4d892abf55e8625bc9.js} +3 -3
  57. package/assets/esri/core/workers/chunks/{98607a0da63626cc4614.js → a054a52712a118c6d505.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{69a20e4d9e28c3e599fc.js → a3bb600bfcb0282622f1.js} +1 -1
  59. package/assets/esri/core/workers/chunks/aa49841b14c6e6df2a07.js +1 -0
  60. package/assets/esri/core/workers/chunks/b089058b64db3912478f.js +1 -0
  61. package/assets/esri/core/workers/chunks/b28539c5a6bedb71b038.js +1 -0
  62. package/assets/esri/core/workers/chunks/b4f171db73355c6f766e.js +1 -0
  63. package/assets/esri/core/workers/chunks/b7572b0921b23aef8b9d.js +1 -0
  64. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +1 -0
  65. package/assets/esri/core/workers/chunks/c3e7290fb128d4fefd44.js +1 -0
  66. package/assets/esri/core/workers/chunks/c51c9b5da855f84b9a48.js +1 -0
  67. package/assets/esri/core/workers/chunks/c66ac36da6392b6bf331.js +1 -0
  68. package/assets/esri/core/workers/chunks/d16b328d32a6ddc2fdb9.js +1 -0
  69. package/assets/esri/core/workers/chunks/d94c5f36d52cf71f0bb9.js +1 -0
  70. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +1 -0
  71. package/assets/esri/core/workers/chunks/{66cd99e91dad60c5274c.js → dc3ed59f450283d97a19.js} +1 -1
  72. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +2 -0
  73. package/assets/esri/core/workers/chunks/{31df729c17470245288c.js.LICENSE.txt → dcd0653191cd4a1ccaae.js.LICENSE.txt} +2 -2
  74. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +1 -0
  75. package/assets/esri/core/workers/chunks/e51f0e71f2a55af604d3.js +1 -0
  76. package/assets/esri/core/workers/chunks/eb3855d3753d6b8334bd.js +1 -0
  77. package/assets/esri/core/workers/chunks/{7c290763920f52a1f504.js → eeed138930a4a805691d.js} +1 -1
  78. package/assets/esri/core/workers/chunks/f435dc615fdc8917f6ca.js +1 -0
  79. package/assets/esri/core/workers/chunks/{d5c5b9f7f5401f36a3a5.js → f7f3dde4c8f9c687cc1e.js} +1 -1
  80. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +1 -0
  81. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  82. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -0
  83. package/assets/esri/themes/base/widgets/_Weather.scss +1 -2
  84. package/assets/esri/themes/dark/main.css +1 -1
  85. package/assets/esri/themes/light/main.css +1 -1
  86. package/assets/esri/themes/light/view.css +1 -1
  87. package/chunks/BlendLayers.glsl.js +6 -6
  88. package/chunks/arcade.js +1 -1
  89. package/chunks/array.js +1 -1
  90. package/chunks/languageUtils.js +1 -1
  91. package/config.js +1 -1
  92. package/core/sql/StandardizedFunctions.js +1 -1
  93. package/geohash/GeohashTree.js +1 -1
  94. package/geometry/support/contains.js +1 -1
  95. package/geometry/support/heightModelInfoUtils.js +1 -1
  96. package/geometry/support/intersects.js +1 -1
  97. package/geometry/support/intersectsBase.js +1 -1
  98. package/geometry/support/normalizeUtilsCommon.js +1 -1
  99. package/geometry/support/spatialReferenceUtils.js +1 -1
  100. package/interfaces.d.ts +685 -37
  101. package/layers/MediaLayer.d.ts +4 -0
  102. package/layers/MediaLayer.js +5 -0
  103. package/layers/VoxelLayer.js +1 -1
  104. package/layers/VoxelWasmPerSceneView.js +5 -0
  105. package/layers/graphics/OptimizedGeometry.js +1 -1
  106. package/layers/graphics/data/BoundsStore.js +1 -1
  107. package/layers/support/CornersGeoreference.d.ts +4 -0
  108. package/layers/support/CornersGeoreference.js +5 -0
  109. package/layers/support/ExtentAndRotationGeoreference.d.ts +4 -0
  110. package/layers/support/ExtentAndRotationGeoreference.js +5 -0
  111. package/layers/support/FeatureReduction.js +1 -1
  112. package/layers/support/FeatureReductionBinning.js +5 -0
  113. package/layers/support/GeoreferenceBase.js +5 -0
  114. package/layers/support/ImageElement.d.ts +4 -0
  115. package/layers/support/ImageElement.js +5 -0
  116. package/layers/support/LocalMediaElementSource.d.ts +4 -0
  117. package/layers/support/LocalMediaElementSource.js +5 -0
  118. package/layers/support/MediaElementBase.d.ts +4 -0
  119. package/layers/support/MediaElementBase.js +5 -0
  120. package/layers/support/RouteStopSymbols.d.ts +4 -0
  121. package/layers/support/RouteSymbols.d.ts +4 -0
  122. package/layers/support/VoxelFormat.d.ts +4 -0
  123. package/layers/support/VoxelStyle.d.ts +4 -0
  124. package/layers/support/VoxelVariable.d.ts +4 -0
  125. package/layers/support/VoxelVolume.d.ts +4 -0
  126. package/layers/support/VoxelVolumeStyle.d.ts +4 -0
  127. package/layers/support/arcgisLayerUrl.js +1 -1
  128. package/layers/support/featureReductionUtils.js +1 -1
  129. package/layers/support/fieldUtils.js +1 -1
  130. package/layers/support/rasterFormats/Lerc.js +1 -1
  131. package/package.json +3 -3
  132. package/request.js +1 -1
  133. package/support/requestUtils.js +1 -1
  134. package/support/revision.js +1 -1
  135. package/symbols/Font.js +1 -1
  136. package/symbols/support/textUtils.js +1 -1
  137. package/views/2d/engine/brushes.js +1 -1
  138. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  139. package/views/2d/engine/webgl/Overlay.js +5 -0
  140. package/views/2d/engine/webgl/OverlayContainer.js +5 -0
  141. package/views/2d/engine/webgl/brushes/BrushOverlay.js +5 -0
  142. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  143. package/views/2d/engine/webgl/shaders/OverlayPrograms.js +5 -0
  144. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  145. package/views/2d/layerViewModuleImportUtils.js +1 -1
  146. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  147. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  148. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  149. package/views/2d/layers/MediaLayerView2D.js +5 -0
  150. package/views/2d/layers/StreamLayerView2D.js +1 -1
  151. package/views/2d/layers/WMTSLayerView2D.js +1 -1
  152. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  153. package/views/2d/layers/features/Pipeline.js +1 -1
  154. package/views/2d/layers/features/Store2D.js +1 -1
  155. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  156. package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
  157. package/views/2d/layers/features/schemaUtils.js +1 -1
  158. package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
  159. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  160. package/views/2d/layers/features/support/BinStore.js +5 -0
  161. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  162. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  163. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  164. package/views/2d/layers/support/clusterUtils.js +1 -1
  165. package/views/2d/magnifier/MagnifierView2D.js +1 -1
  166. package/views/2d/navigation/actions/Pinch.js +1 -1
  167. package/views/2d/viewpointUtils.js +1 -1
  168. package/views/3d/analysis/AnalysisView3D.js +1 -1
  169. package/views/3d/analysis/Dimensioning/DimensioningTool.js +5 -0
  170. package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +1 -1
  171. package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +5 -0
  172. package/views/3d/analysis/Dimensioning/{LinearDimensionVisualization.js → LengthDimensionVisualization.js} +1 -1
  173. package/views/3d/analysis/Dimensioning/settings.js +5 -0
  174. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  175. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  176. package/views/3d/interactive/SegmentLabels3D.js +5 -0
  177. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  178. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  179. package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
  180. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  181. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  182. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  183. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
  184. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  185. package/views/3d/layerViewModuleImportUtils.js +1 -1
  186. package/views/3d/layers/I3SMeshView3D.js +1 -1
  187. package/views/3d/layers/MediaLayerView3D.js +5 -0
  188. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  189. package/views/3d/layers/i3s/IDBCache.js +1 -1
  190. package/views/3d/state/controllers/RotateController.js +1 -1
  191. package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
  192. package/views/3d/state/controllers/local/ZoomController.js +1 -1
  193. package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
  194. package/views/3d/support/ResourceController.js +1 -1
  195. package/views/3d/support/sunUtils.js +1 -1
  196. package/views/3d/terrain/TerrainRenderer.js +1 -1
  197. package/views/3d/terrain/TerrainSurface.js +1 -1
  198. package/views/3d/terrain/TileCompositor.js +1 -1
  199. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  200. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  201. package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
  202. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  203. package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
  204. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  205. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  206. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  207. package/views/DOMContainer.js +1 -1
  208. package/views/GroundView.js +1 -1
  209. package/views/SceneView.js +1 -1
  210. package/views/ToolViewManager.js +1 -1
  211. package/views/View.js +1 -1
  212. package/views/draw/DrawOperation.js +1 -1
  213. package/views/draw/support/Reshape.js +1 -1
  214. package/views/interactive/GraphicManipulator.js +1 -1
  215. package/views/interactive/InteractiveToolBase.js +1 -1
  216. package/views/interactive/SegmentLabels.js +5 -0
  217. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  218. package/views/interactive/snapping/LineSnapper.js +1 -1
  219. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  220. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  221. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  222. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  223. package/views/interactive/snapping/SnappingManager.js +1 -1
  224. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  225. package/views/interactive/snapping/snappingUtils.js +1 -1
  226. package/views/interactive/support/viewUtils.js +5 -0
  227. package/views/interactive/tooltip/DrawPointTooltipInfo.js +5 -0
  228. package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +5 -0
  229. package/views/interactive/tooltip/DrawPolylineTooltipInfo.js +5 -0
  230. package/views/interactive/tooltip/Tooltip.js +1 -1
  231. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  232. package/views/interactive/tooltip/support/measurements.js +5 -0
  233. package/views/layers/FeatureLayerView.js +1 -1
  234. package/views/layers/GroupLayerView.js +1 -1
  235. package/views/overlay/TextOverlayItem.js +1 -1
  236. package/views/support/Scheduler.js +1 -1
  237. package/views/support/screenUtils.js +1 -1
  238. package/webscene/Slide.js +1 -1
  239. package/widgets/Attribution/AttributionViewModel.js +1 -1
  240. package/widgets/Bookmarks.js +1 -1
  241. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  242. package/widgets/Editor/EditorViewModel.js +1 -1
  243. package/widgets/Editor/UpdateWorkflow.js +1 -1
  244. package/widgets/Editor/workflowUtils.js +1 -1
  245. package/widgets/Editor.js +1 -1
  246. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  247. package/widgets/ElevationProfile.js +1 -1
  248. package/widgets/Feature/FeatureAttachments.js +1 -1
  249. package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
  250. package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
  251. package/widgets/Feature/FeatureExpression.js +1 -1
  252. package/widgets/Feature/FeatureFields.js +1 -1
  253. package/widgets/Feature/FeatureViewModel.js +1 -1
  254. package/widgets/Feature.js +1 -1
  255. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  256. package/widgets/FeatureForm.js +1 -1
  257. package/widgets/FeatureTable/FieldColumn.js +1 -1
  258. package/widgets/FeatureTable/Grid/Column.js +1 -1
  259. package/widgets/FeatureTable/Grid/Grid.js +11 -11
  260. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  261. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  262. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  263. package/widgets/FeatureTemplates.js +1 -1
  264. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  265. package/widgets/FloorFilter.js +1 -1
  266. package/widgets/HistogramRangeSlider.js +1 -1
  267. package/widgets/LayerList/LayerListViewModel.js +1 -1
  268. package/widgets/LayerList/ListItem.js +1 -1
  269. package/widgets/LayerList/ListItemPanel.js +1 -1
  270. package/widgets/LayerList.js +1 -1
  271. package/widgets/Legend/LegendViewModel.js +1 -1
  272. package/widgets/Legend/styles/Card.js +1 -1
  273. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  274. package/widgets/Legend.js +1 -1
  275. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  276. package/widgets/Measurement.js +1 -1
  277. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  278. package/widgets/Popup/PopupViewModel.js +1 -1
  279. package/widgets/Popup.js +1 -1
  280. package/widgets/Print/FileLink.js +1 -1
  281. package/widgets/Print.js +1 -1
  282. package/widgets/ScaleBar.js +1 -1
  283. package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
  284. package/widgets/ScaleRangeSlider.js +1 -1
  285. package/widgets/Search/SearchViewModel.js +1 -1
  286. package/widgets/Search.js +1 -1
  287. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  288. package/widgets/Sketch/SketchViewModel.js +1 -1
  289. package/widgets/Sketch.js +1 -1
  290. package/widgets/TableList/ListItem.js +1 -1
  291. package/widgets/Weather/LabeledSlider.js +1 -1
  292. package/widgets/Weather/VisibleElements.js +5 -0
  293. package/widgets/Weather/css.js +1 -1
  294. package/widgets/Weather.js +1 -1
  295. package/widgets/support/AnalysisViewModel.js +1 -1
  296. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  297. package/analysis/LinearDimension.d.ts +0 -4
  298. package/analysis/LinearDimension.js +0 -5
  299. package/assets/esri/core/workers/chunks/0018053ac16a09feba70.js +0 -1
  300. package/assets/esri/core/workers/chunks/042938ca73f0b9e5a7e2.js +0 -1
  301. package/assets/esri/core/workers/chunks/048645611caa28dca7cd.js +0 -1
  302. package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +0 -1
  303. package/assets/esri/core/workers/chunks/13b04d5bf348ab5054c2.js +0 -1
  304. package/assets/esri/core/workers/chunks/215007e7c44811d90777.js +0 -1
  305. package/assets/esri/core/workers/chunks/31df729c17470245288c.js +0 -2
  306. package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +0 -1
  307. package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +0 -1
  308. package/assets/esri/core/workers/chunks/37c428489c59df4b597b.js +0 -1
  309. package/assets/esri/core/workers/chunks/493169fd978fd543ef3b.js +0 -1
  310. package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +0 -1
  311. package/assets/esri/core/workers/chunks/58e4c6ce1580427e7b55.js +0 -1
  312. package/assets/esri/core/workers/chunks/6c5441da675a8af35be2.js +0 -1
  313. package/assets/esri/core/workers/chunks/6ea16f6a0df946de480b.js +0 -1
  314. package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +0 -1
  315. package/assets/esri/core/workers/chunks/88193e61072d7bf957f5.js +0 -1
  316. package/assets/esri/core/workers/chunks/8ccbde593c86c872e525.js +0 -1
  317. package/assets/esri/core/workers/chunks/9c6be39f1f21ab8b1c2d.js +0 -1
  318. package/assets/esri/core/workers/chunks/a73795cce722ba15b3da.js +0 -1
  319. package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +0 -1
  320. package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +0 -1
  321. package/assets/esri/core/workers/chunks/adcc5bce6c0971c1b592.js +0 -1
  322. package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +0 -1
  323. package/assets/esri/core/workers/chunks/b340c9bdabdb37995c8f.js +0 -1
  324. package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +0 -1
  325. package/assets/esri/core/workers/chunks/c180c40838246985479d.js +0 -1
  326. package/assets/esri/core/workers/chunks/caed2365bd296fcc8a75.js +0 -1
  327. package/assets/esri/core/workers/chunks/d85b5b73a151c6fbb658.js +0 -1
  328. package/assets/esri/core/workers/chunks/da6261673c3e1537b6a6.js +0 -1
  329. package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +0 -1
  330. package/assets/esri/core/workers/chunks/ec6d138e8183e193f977.js +0 -1
  331. package/assets/esri/core/workers/chunks/ed4519ac9533a4d340f1.js +0 -1
  332. package/assets/esri/core/workers/chunks/f206300eef4560611728.js +0 -1
  333. package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +0 -1
  334. package/layers/GeoreferencedImageLayer.d.ts +0 -4
  335. package/layers/GeoreferencedImageLayer.js +0 -5
  336. package/layers/VoxelWasmManager.js +0 -5
  337. package/layers/VoxelWasmPerScene.js +0 -5
  338. package/views/3d/interactive/measurementTools/support/viewUtils.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/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{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import a from"../../../core/has.js";import n from"../../../core/Logger.js";import{someMap as l}from"../../../core/MapUtils.js";import{unwrapOr as d,destroyMaybe as h,isSome as c,isNone as u,applySome as _,unwrap as m}from"../../../core/maybe.js";import g from"../../../core/PooledArray.js";import{throwIfAborted as f,createResolver as p}from"../../../core/promiseUtils.js";import{initial as b,watch as y}from"../../../core/reactiveUtils.js";import{schedule as v}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as M}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as O}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as S}from"../../../chunks/mat3f32.js";import{m as E,B as j}from"../../../chunks/mat4.js";import{b as w,c as T}from"../../../chunks/mat4f64.js";import{m as D,s as R,t as N,a as A,c as F}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{s as V}from"../../../chunks/vec4.js";import{f as U}from"../../../chunks/vec4f64.js";import{projectBuffer as H,getProjectorName as G,localLinearScaleFactors as L,projectVectorToVector as B,projectBoundingRect as k,projectBoundingSphere as q}from"../../../geometry/projection.js";import{create as z,empty as K,expandWithBuffer as W,toRect as $}from"../../../geometry/support/aaBoundingBox.js";import{create as X,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import Q from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as J}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as Z}from"../../../layers/support/layerUtils.js";import ee from"../../../layers/support/SceneModification.js";import{getColor as te,getOpacity as ie}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as se}from"../../../support/arcadeOnDemand.js";import re from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as oe}from"../../../symbols/support/unitConversionUtils.js";import ae from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as ne,toWasmModification as le}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as de,ForAllFeaturesReturnType as he}from"./II3SMeshView3D.js";import{initialize as ce,setModificationsSync as ue,filterObbsForModificationsSync as _e,interpretObbModificationResults as me}from"./SceneLayerWorker.js";import{overrideColor as ge}from"./graphics/graphicUtils.js";import{TextureUsage as fe,TextureEncoding as pe}from"./i3s/enums.js";import be from"./i3s/Highlights.js";import{I3SAttributeOverrides as ye}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ve,NodeCrossfadeMetaData as Ie}from"./i3s/I3SCrossfadeHelper.js";import Me from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Ce}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Oe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as xe,selectEncoding as Se,defaultMaterial as Ee,createTexture as je,configureMaterial as we}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Te,NodeState as De}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Re,getLocalOrigin as Ne}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ae,checkSceneLayerValid as Fe,checkSceneLayerCompatibleWithView as Pe,getCacheKeySuffix as Ve,whenGraphicAttributes as Ue,computeVisibilityObb as He,filterInPlace as Ge,getCachedAttributeValue as Le,intersectBoundingRectWithMbs as Be,MbsIntersectResult as ke,addWraparound as qe,getSymbolInfo as ze,transparentEdgeMaterial as Ke,getClipRect as We}from"./i3s/I3SUtil.js";import{IDBCache as $e}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{attributeLookup as Ye}from"./support/attributeUtils.js";import{ColorMixModeEnum as Qe}from"./support/symbolColorUtils.js";import Je from"../support/debugFlags.js";import{toBoundingRect as Ze}from"../support/extentUtils.js";import{create as et,clone as tt}from"../support/orientedBoundingBox.js";import{updatingProgress as it}from"../support/updatingProperties.js";import{glLayout as st}from"../support/buffer/glUtil.js";import{State as rt}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as ot}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as at}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as nt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as lt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const dt=n.getLogger("esri.views.3d.layers.SceneLayerView3D"),ht=[1,1,1,1];class ct extends Ie{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ut;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ut||(ut={}));const _t=19,mt=100*r.MEGABYTES,gt=t=>{let r=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,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._idbCache=a("enable-feature:idb-mock-cache")?new Xe:new $e("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._elvationChangedHandle=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ve(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 hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ae(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?fe.AllTexturesPBR:fe.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?fe.GeometryTexturesPBR:fe.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=M(this.i3slayer.spatialReference),i=oe(e.unit);return d(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Nt.Absolute,offset:0};const t=M(this.i3slayer.spatialReference),i=oe(e.unit),s=d(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Nt.Absolute,offset:s};case"relative-to-ground":return{mode:Nt.RelativeToGround,offset:s};case"on-the-ground":return{mode:Nt.OnTheGround,offset:0};default:return{mode:Nt.Absolute,offset:0}}}get supportedTextureEncodings(){return xe(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&pe.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new ye(this.i3slayer,e.memoryController),this._worker=new ne((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Fe(this.i3slayer),Pe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new Q({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new be({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,de.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>c(this._controller.index)&&c(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,c(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Oe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new Me({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),b),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),(()=>this._elevationInfoChanged())),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),b),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),b),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),b),this.handles.add([y((()=>Je.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Je.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Je.I3S_TREE_SHOW_TILES||(this._treeDebugger=h(this._treeDebugger))}),b),y((()=>Je.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),b)]),this._cacheKeySuffix=Ve(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._elvationChangedHandle=this.view.basemapTerrain.on("elevation-change",(e=>this._elevationChanged(e))),this._idbCache.init().catch((e=>dt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this._elvationChangedHandle&&(this._elvationChangedHandle.remove(),this._elvationChangedHandle=null),this.attributeOverrides=h(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=h(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=h(this._labeler),this._treeDebugger=h(this._treeDebugger),this._controller=h(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(c(e)){const t=e.estimatedTexMemRequired;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)}getUsedMemory(){let e=c(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=c(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=c(t)?t.node.memory:0)),e}getUnloadedMemory(){return(c(this._controller)?this._controller.unloadedMemoryEstimate:0)+(c(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(Z(this.i3slayer)&&this._supportsLabeling))return void(c(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(c(this._labeler))return;const e=new ae({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>c(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=ce().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=le(this._layerClippingArea,this._modifications,t);ue({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new g:null;this._nodeId2Meta.forEach(((e,t)=>{u(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):c(s)&&s.push(e.node)})),c(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),c(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Te.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),c(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):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(c(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Je.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={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);c(i)&&c(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);c(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,c(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){c(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>c(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!a("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&pe.Basis)&&_(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&nt()}_getVertexBufferLayout(e,t){const i={hasTexture:xt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return st(ot(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Ye(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return l(this._nodeId2Meta,(e=>{if(u(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(u(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ye(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._nodeId2Meta.get(t.node.index);if(u(i))return Promise.reject();const s=i.objectHandle,r=Ce(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(H(r,o,0,r,a,0,8)){const e=K();return W(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ue(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(c)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return u(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${_t}/${e.id}${this._cacheKeySuffix}`}_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 c(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){c(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(u(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,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(u(t))return!0;const s=Se(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(u(r)||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),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&c(s.textureData)&&(s.byteSize=jt(s.transformedGeometry,s.textureData),s.textureData.every(Et)&&wt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>dt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),f(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return St(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(u(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,h=Re(e.mbs,this.elevationOffset,l,d);e.geometryObb=et([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),D(e.geometryObb.center,e.geometryObb.center,h),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:h,geometryObb:e.geometryObb,byteSize:jt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&wt(e,_)){const t=c(_.textureData)?_.textureData.map((e=>Et(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>dt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return He(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let u=0;u<s.length;++u)r[u]=this._getVertexBufferLayout(s[u],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ne(o,a,n),c=Re(o,a,n,d),_=G(n,l),m=G(l,d);if(u(_)||u(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:c,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){return!this.view?._stage?.renderView.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(e.geometryObb=tt(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);c(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,rt.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),c(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(u(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=c(t.textureData)?t.textureData.filter((e=>c(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!a("disable-feature:i3s-basis")&&l.some((e=>c(e)&&(e.encoding===pe.Basis||e.encoding===pe.KTX2)))&&await nt(),e.memory=0;const{componentOffsets:d,geometries:h,featureIds:_}=r,g=this._collection,f=h[0],{layout:p,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=o,M=this._materialParameters(f,p),C=d||new Uint32Array([0,b?b.length:y.byteLength/p[0].stride]),O={vertices:{data:y,count:y.byteLength/p[0].stride,layoutParameters:M.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:C},D=f.transformation?w(f.transformation):T();E(D,n,D);const R=j(P(),D),N=x(S(),D),A=this.view.renderSpatialReference,F=this.view.basemapTerrain.spatialReference,V=P(),H=[1,1,1];L(R,A,H,F)||dt.errorOnce("Unsupported coordinate system for IM overlay"),B(R,A,V,F);const G=g.createObject({toMapSpace:U(V[0],V[1],H[0],H[1]),geometry:O,obb:m(e.geometryObb),transform:{position:R,rotationScale:N}}),k=M.geometryParams.textureCoordinates===at.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(G,M.material,l,k);e.memory+=this._memEstimateGeometryAdded(G),e.memory+=q.reduce(((e,t)=>e+(c(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!M.material.hasParametersFromSource,W="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,$=new ct(e,_,G,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);this._updateElevationOffsets($),s.meta=$,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&fe.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(c(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(c(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(G,rt.Visible),c(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||c(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($,ft.ADD),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),c(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw c(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){dt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);c(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);c(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Rt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo;if(u(t)||i.mode===Nt.Absolute)return void(e.elevationOffsets=null);const s=this.view.basemapTerrain,r=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const o=At,a=Ft;for(let n=0;n<e.featureIds.length;n++){this._collection.getComponentAabb(e.objectHandle,n,a),R(o,(a[0]+a[3])/2,(a[1]+a[4])/2,a[2]),N(o,o,r.rotationScale),A(o,o,r.position);const l=s.getElevation(o[0],o[1],o[2],t),d=i.mode===Nt.OnTheGround?this.view.renderCoordsHelper.getAltitude(o):0;e.elevationOffsets[n]=i.offset+(c(l)?l-d:0)}}_elevationChanged(e){const t=this._controller.crsIndex;k(e.extent,e.spatialReference,Ot,t);const i=this._controller.updateElevationChanged(Ot,t);u(i)||i.forAll((e=>{const t=this._nodeId2Meta.get(e);c(t)&&(this._updateElevationOffsets(t),this._setObjectSymbolColors(t))}))}_elevationInfoChanged(){this._nodeId2Meta.forEach((e=>{c(e)&&(this._updateElevationOffsets(e),this._setObjectSymbolColors(e))}))}_safeReschedule(e,t){return f(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=c(e.params.material)?e.params.material:Ee(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=xt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>je(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=we(e,t,o,i,this.view._stage.renderView.textureRepository,{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{textureCoordinates:e.hasTexture?e.hasRegions?at.Atlas:at.Default:at.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{c(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=X();this._renderClippingArea=Ze(this.view.clippingArea,i,e)?i:null;const s=X();this._layerClippingArea=Ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{c(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return c(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(c(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=c(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Ge(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Le(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return q(e.node.mbs,this._controller.crsIndex,Ct,this.view.renderSpatialReference),Be(t,Ct)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,pt),$(pt,bt),Y(i,bt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===ke.INSIDE)return;if(r===ke.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(yt,i,t.objectHandle);Ge(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}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(u(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Rt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(c(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!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;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&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)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);u(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,rt.Hidden),c(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s,ft.REMOVE),c(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),c(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(c(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);c(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===De.Hole))}_invalidateAllSymbols(){this._rendererVersion=qe(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return qe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=qe(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 se()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:dt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&dt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),s.externalColorMixMode=t[r+4]&(1<<ut.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<ut.CastShadows),s.pickable=0!=(t[r+4]&1<<ut.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof re))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=ze(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=c(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?c(this._rendererFields)&&this._rendererFields.length>0?J(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=c(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&c(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&c(this._symbologyFields))for(const c of this._symbologyFields){const e=r[c];e&&(n.push(c),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:It,castShadows:!0,pickable:!0,colorMixMode:Qe.Multiply,edgeMaterial:null},h=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let m=null,g=lt.OPAQUE,f=Ke,p=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Le(l[e],b);const r=this._getSymbolInfo(s,t);let h=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=te(this._colorVariable,t,{color:Mt,arcade:this._arcade});e&&(h=It,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=ie(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;h=u(h)||u(y)?ge(h,y,e.color,e.alpha,ht,It):ge(h,y,null,null,ht,It)}if(u(h)&&(h=It,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:Qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,c(this._symbologyOverride)&&(d.color=h,this._symbologyOverride(t,d),h=d.color),c(d.edgeMaterial)){const t=h[3]<=0?lt.INVISIBLE:h[3]>=1&&(e.material.isOpaque||d.colorMixMode===Qe.Replace)?lt.OPAQUE:lt.TRANSPARENT;d.edgeMaterial===m&&t===g||(f={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=f}else e.cachedEdgeMaterials[b]=Ke;e.cachedSymbology[p+0]=Math.round(255*h[0]),e.cachedSymbology[p+1]=Math.round(255*h[1]),e.cachedSymbology[p+2]=Math.round(255*h[2]),e.cachedSymbology[p+3]=Math.round(255*h[3]),e.cachedSymbology[p+4]=d.colorMixMode|+d.castShadows<<ut.CastShadows|+d.pickable<<ut.Pickable,p+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Rt(t,this.fullOpacity),u(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ke)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ke:(s=s||t!==Ke,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(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=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Rt(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._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),c(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{u(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){c(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=de.VISIBLE_ONLY){l(this._nodeId2Meta,(s=>{if(u(s))return!1;if(c(t)){switch(t(s)){case he.EXIT:return!0;case he.SKIP:return!1}}let r=he.CONTINUE;switch(i){case de.ALL:r=this._forAllFeaturesOfNode(s,e);break;case de.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case de.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===he.EXIT}))}_forAllFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===he.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===he.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(u(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===ke.OUTSIDE)return he.CONTINUE;if(i===ke.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=he.CONTINUE,r=e.featureIds,o=e.objectHandle,a=We(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===he.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=c(t.attributeInfo)&&t.attributeInfo.attributeData;if(c(s))for(const r of Object.keys(s))i[r]=Le(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ye(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Dt}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=v((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return c(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),he.CONTINUE)),null,de.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return c(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(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);c(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);c(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(u(this._edgeView)||!e.cachedEdgeMaterials)return;Rt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&c(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.i3slayer.uid,s=Tt(e);if(c(s)){const t={context:i,buffer:s.buffer};_e(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=me(i);e.imModificationImpact=s,s!==Te.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||c(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(u(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return{locations:o,type:"components",objectIds:s.featureIds,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{u(t)||e.add(i,t.node.renderMbs)})),t}_updateSnappingSources(e,t){const{index:i,renderMbs:s}=e.node;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([C()],r.prototype,"_hasLoadedPBRTextures",void 0),e([C()],r.prototype,"_asyncModuleLoading",void 0),e([C()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([C()],r.prototype,"view",void 0),e([C()],r.prototype,"i3slayer",void 0),e([C()],r.prototype,"_controller",void 0),e([C()],r.prototype,"_labeler",void 0),e([C()],r.prototype,"updating",void 0),e([C()],r.prototype,"suspended",void 0),e([C()],r.prototype,"holeFilling",void 0),e([C(it)],r.prototype,"updatingProgress",void 0),e([C({readOnly:!0,aliasOf:"_controller.updatingProgress"})],r.prototype,"updatingProgressValue",void 0),e([C({readOnly:!0})],r.prototype,"hasTexturesOrVertexColors",null),e([C({readOnly:!0})],r.prototype,"rendererTextureUsage",null),e([C()],r.prototype,"filter",void 0),e([C({readOnly:!0})],r.prototype,"elevationOffset",null),e([C({readOnly:!0})],r.prototype,"elevationInfo",null),e([C({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([C()],r.prototype,"supportedTextureEncodings",null),e([C()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([C({type:[ee]})],r.prototype,"_modifications",void 0),r=e([O("esri.views.3d.layers.I3SMeshView3D")],r),r};var ft;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(ft||(ft={}));const pt=z(),bt=X(),yt=X(),vt=et(),It=[0,0,0,0],Mt=new t([0,0,0,0]),Ct=[0,0,0,0],Ot=X();function xt(e){if(u(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 St(e){return"geometryData"in e}function Et(e){return c(e)&&I(e.data)}function jt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(c(t))for(const s of t)c(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function wt(e,t){return t.byteSize>mt?(dt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Tt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;u(s)&&(s=vt,F(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Dt={remove(){},pause(){},resume(){}};function Rt(e,t){e.forEach((e=>e.opacity=t))}var Nt;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Nt||(Nt={}));const At=P(),Ft=z();export{Nt as ElevationMode,gt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import a from"../../../core/has.js";import n from"../../../core/Logger.js";import{someMap as l}from"../../../core/MapUtils.js";import{unwrapOr as d,destroyMaybe as h,isSome as c,isNone as u,applySome as _,unwrap as m}from"../../../core/maybe.js";import g from"../../../core/PooledArray.js";import{throwIfAborted as f,createResolver as p}from"../../../core/promiseUtils.js";import{initial as b,watch as y}from"../../../core/reactiveUtils.js";import{schedule as v}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as M}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as O}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as S}from"../../../chunks/mat3f32.js";import{m as E,B as j}from"../../../chunks/mat4.js";import{b as w,c as T}from"../../../chunks/mat4f64.js";import{m as D,s as R,t as N,a as A,c as F}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{s as V}from"../../../chunks/vec4.js";import{f as U}from"../../../chunks/vec4f64.js";import{projectBuffer as H,getProjectorName as G,localLinearScaleFactors as L,projectVectorToVector as B,projectBoundingRect as k,projectBoundingSphere as q}from"../../../geometry/projection.js";import{create as z,empty as K,expandWithBuffer as W,toRect as $}from"../../../geometry/support/aaBoundingBox.js";import{create as X,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import Q from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as J}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as Z}from"../../../layers/support/layerUtils.js";import ee from"../../../layers/support/SceneModification.js";import{getColor as te,getOpacity as ie}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as se}from"../../../support/arcadeOnDemand.js";import re from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as oe}from"../../../symbols/support/unitConversionUtils.js";import ae from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as ne,toWasmModification as le}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as de,ForAllFeaturesReturnType as he}from"./II3SMeshView3D.js";import{initialize as ce,setModificationsSync as ue,filterObbsForModificationsSync as _e,interpretObbModificationResults as me}from"./SceneLayerWorker.js";import{overrideColor as ge}from"./graphics/graphicUtils.js";import{TextureUsage as fe,TextureEncoding as pe}from"./i3s/enums.js";import be from"./i3s/Highlights.js";import{I3SAttributeOverrides as ye}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ve,NodeCrossfadeMetaData as Ie}from"./i3s/I3SCrossfadeHelper.js";import Me from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Ce}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Oe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as xe,selectEncoding as Se,defaultMaterial as Ee,createTexture as je,configureMaterial as we}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Te,NodeState as De}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Re,getLocalOrigin as Ne}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ae,checkSceneLayerValid as Fe,checkSceneLayerCompatibleWithView as Pe,getCacheKeySuffix as Ve,whenGraphicAttributes as Ue,computeVisibilityObb as He,filterInPlace as Ge,getCachedAttributeValue as Le,intersectBoundingRectWithMbs as Be,MbsIntersectResult as ke,addWraparound as qe,getSymbolInfo as ze,transparentEdgeMaterial as Ke,getClipRect as We}from"./i3s/I3SUtil.js";import{IDBCache as $e}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{attributeLookup as Ye}from"./support/attributeUtils.js";import{ColorMixModeEnum as Qe}from"./support/symbolColorUtils.js";import Je from"../support/debugFlags.js";import{toBoundingRect as Ze}from"../support/extentUtils.js";import{create as et,clone as tt}from"../support/orientedBoundingBox.js";import{updatingProgress as it}from"../support/updatingProperties.js";import{glLayout as st}from"../support/buffer/glUtil.js";import{State as rt}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as ot}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as at}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as nt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as lt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const dt=n.getLogger("esri.views.3d.layers.SceneLayerView3D"),ht=[1,1,1,1];class ct extends Ie{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ut;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ut||(ut={}));const _t=19,mt=100*r.MEGABYTES,gt=t=>{let r=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,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._idbCache=a("enable-feature:idb-mock-cache")?new Xe:new $e("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ve(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 hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ae(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?fe.AllTexturesPBR:fe.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?fe.GeometryTexturesPBR:fe.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=M(this.i3slayer.spatialReference),i=oe(e.unit);return d(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Nt.Absolute,offset:0};const t=M(this.i3slayer.spatialReference),i=oe(e.unit),s=d(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Nt.Absolute,offset:s};case"relative-to-ground":return{mode:Nt.RelativeToGround,offset:s};case"on-the-ground":return{mode:Nt.OnTheGround,offset:0};default:return{mode:Nt.Absolute,offset:0}}}get supportedTextureEncodings(){return xe(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&pe.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new ye(this.i3slayer,e.memoryController),this._worker=new ne((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Fe(this.i3slayer),Pe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new Q({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new be({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,de.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>c(this._controller.index)&&c(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,c(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Oe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new Me({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),b),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),(()=>this._elevationInfoChanged()),b),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),b),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),b),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),b),this.handles.add([y((()=>Je.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Je.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Je.I3S_TREE_SHOW_TILES||(this._treeDebugger=h(this._treeDebugger))}),b),y((()=>Je.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),b)]),this._cacheKeySuffix=Ve(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>dt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=h(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=h(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=h(this._labeler),this._treeDebugger=h(this._treeDebugger),this._controller=h(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(c(e)){const t=e.estimatedTexMemRequired;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)}getUsedMemory(){let e=c(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=c(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=c(t)?t.node.memory:0)),e}getUnloadedMemory(){return(c(this._controller)?this._controller.unloadedMemoryEstimate:0)+(c(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(Z(this.i3slayer)&&this._supportsLabeling))return void(c(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(c(this._labeler))return;const e=new ae({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>c(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=ce().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=le(this._layerClippingArea,this._modifications,t);ue({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new g:null;this._nodeId2Meta.forEach(((e,t)=>{u(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):c(s)&&s.push(e.node)})),c(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),c(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Te.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),c(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):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(c(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Je.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={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);c(i)&&c(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);c(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,c(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){c(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>c(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!a("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&pe.Basis)&&_(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&nt()}_getVertexBufferLayout(e,t){const i={hasTexture:xt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return st(ot(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Ye(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return l(this._nodeId2Meta,(e=>{if(u(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(u(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ye(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._nodeId2Meta.get(t.node.index);if(u(i))return Promise.reject();const s=i.objectHandle,r=Ce(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(H(r,o,0,r,a,0,8)){const e=K();return W(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ue(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(c)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return u(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${_t}/${e.id}${this._cacheKeySuffix}`}_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 c(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){c(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(u(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,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(u(t))return!0;const s=Se(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(u(r)||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),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&c(s.textureData)&&(s.byteSize=jt(s.transformedGeometry,s.textureData),s.textureData.every(Et)&&wt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>dt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),f(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return St(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(u(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,h=Re(e.mbs,this.elevationOffset,l,d);e.geometryObb=et([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),D(e.geometryObb.center,e.geometryObb.center,h),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:h,geometryObb:e.geometryObb,byteSize:jt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&wt(e,_)){const t=c(_.textureData)?_.textureData.map((e=>Et(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>dt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return He(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let u=0;u<s.length;++u)r[u]=this._getVertexBufferLayout(s[u],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ne(o,a,n),c=Re(o,a,n,d),_=G(n,l),m=G(l,d);if(u(_)||u(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:c,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){return!this.view?._stage?.renderView.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(e.geometryObb=tt(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);c(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,rt.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),c(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(u(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=c(t.textureData)?t.textureData.filter((e=>c(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!a("disable-feature:i3s-basis")&&l.some((e=>c(e)&&(e.encoding===pe.Basis||e.encoding===pe.KTX2)))&&await nt(),e.memory=0;const{componentOffsets:d,geometries:h,featureIds:_}=r,g=this._collection,f=h[0],{layout:p,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=o,M=this._materialParameters(f,p),C=d||new Uint32Array([0,b?b.length:y.byteLength/p[0].stride]),O={vertices:{data:y,count:y.byteLength/p[0].stride,layoutParameters:M.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:C},D=f.transformation?w(f.transformation):T();E(D,n,D);const R=j(P(),D),N=x(S(),D),A=this.view.renderSpatialReference,F=this.view.basemapTerrain.spatialReference,V=P(),H=[1,1,1];L(R,A,H,F)||dt.errorOnce("Unsupported coordinate system for IM overlay"),B(R,A,V,F);const G=g.createObject({toMapSpace:U(V[0],V[1],H[0],H[1]),geometry:O,obb:m(e.geometryObb),transform:{position:R,rotationScale:N}}),k=M.geometryParams.textureCoordinates===at.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(G,M.material,l,k);e.memory+=this._memEstimateGeometryAdded(G),e.memory+=q.reduce(((e,t)=>e+(c(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!M.material.hasParametersFromSource,W="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,$=new ct(e,_,G,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);this._updateElevationOffsets($),s.meta=$,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&fe.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(c(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(c(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(G,rt.Visible),c(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||c(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($,ft.ADD),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),c(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw c(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){dt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);c(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);c(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Rt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo;if(u(t)||i.mode===Nt.Absolute)return void(e.elevationOffsets=null);const s=this.view.basemapTerrain,r=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const o=At,a=Ft;for(let n=0;n<e.featureIds.length;n++){this._collection.getComponentAabb(e.objectHandle,n,a),R(o,(a[0]+a[3])/2,(a[1]+a[4])/2,a[2]),N(o,o,r.rotationScale),A(o,o,r.position);const l=s.getElevation(o[0],o[1],o[2],t),d=i.mode===Nt.OnTheGround?this.view.renderCoordsHelper.getAltitude(o):0;e.elevationOffsets[n]=i.offset+(c(l)?l-d:0)}}_elevationChanged(e){const t=this._controller.crsIndex;k(e.extent,e.spatialReference,Ot,t);const i=this._controller.updateElevationChanged(Ot,t);u(i)||i.forAll((e=>{const t=this._nodeId2Meta.get(e);c(t)&&(this._updateElevationOffsets(t),this._setObjectSymbolColors(t))}))}_elevationInfoChanged(){this.handles.remove("elevation"),this.elevationInfo.mode!==Nt.Absolute&&this.handles.add(this.view.basemapTerrain.on("elevation-change",(e=>this._elevationChanged(e))),"elevation"),this._nodeId2Meta.forEach((e=>{c(e)&&(this._updateElevationOffsets(e),this._setObjectSymbolColors(e))}))}_safeReschedule(e,t){return f(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=c(e.params.material)?e.params.material:Ee(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=xt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>je(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=we(e,t,o,i,this.view._stage.renderView.textureRepository,{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{textureCoordinates:e.hasTexture?e.hasRegions?at.Atlas:at.Default:at.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{c(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=X();this._renderClippingArea=Ze(this.view.clippingArea,i,e)?i:null;const s=X();this._layerClippingArea=Ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{c(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return c(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(c(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=c(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Ge(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Le(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return q(e.node.mbs,this._controller.crsIndex,Ct,this.view.renderSpatialReference),Be(t,Ct)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,pt),$(pt,bt),Y(i,bt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===ke.INSIDE)return;if(r===ke.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(yt,i,t.objectHandle);Ge(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}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(u(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Rt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(c(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!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;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&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)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);u(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,rt.Hidden),c(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s,ft.REMOVE),c(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),c(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(c(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);c(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===De.Hole))}_invalidateAllSymbols(){this._rendererVersion=qe(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return qe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=qe(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 se()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:dt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&dt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),s.externalColorMixMode=t[r+4]&(1<<ut.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<ut.CastShadows),s.pickable=0!=(t[r+4]&1<<ut.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof re))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=ze(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=c(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?c(this._rendererFields)&&this._rendererFields.length>0?J(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=c(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&c(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&c(this._symbologyFields))for(const c of this._symbologyFields){const e=r[c];e&&(n.push(c),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:It,castShadows:!0,pickable:!0,colorMixMode:Qe.Multiply,edgeMaterial:null},h=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let m=null,g=lt.OPAQUE,f=Ke,p=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Le(l[e],b);const r=this._getSymbolInfo(s,t);let h=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=te(this._colorVariable,t,{color:Mt,arcade:this._arcade});e&&(h=It,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=ie(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;h=u(h)||u(y)?ge(h,y,e.color,e.alpha,ht,It):ge(h,y,null,null,ht,It)}if(u(h)&&(h=It,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:Qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,c(this._symbologyOverride)&&(d.color=h,this._symbologyOverride(t,d),h=d.color),c(d.edgeMaterial)){const t=h[3]<=0?lt.INVISIBLE:h[3]>=1&&(e.material.isOpaque||d.colorMixMode===Qe.Replace)?lt.OPAQUE:lt.TRANSPARENT;d.edgeMaterial===m&&t===g||(f={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=f}else e.cachedEdgeMaterials[b]=Ke;e.cachedSymbology[p+0]=Math.round(255*h[0]),e.cachedSymbology[p+1]=Math.round(255*h[1]),e.cachedSymbology[p+2]=Math.round(255*h[2]),e.cachedSymbology[p+3]=Math.round(255*h[3]),e.cachedSymbology[p+4]=d.colorMixMode|+d.castShadows<<ut.CastShadows|+d.pickable<<ut.Pickable,p+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Rt(t,this.fullOpacity),u(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ke)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ke:(s=s||t!==Ke,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(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=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Rt(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._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),c(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{u(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){c(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=de.VISIBLE_ONLY){l(this._nodeId2Meta,(s=>{if(u(s))return!1;if(c(t)){switch(t(s)){case he.EXIT:return!0;case he.SKIP:return!1}}let r=he.CONTINUE;switch(i){case de.ALL:r=this._forAllFeaturesOfNode(s,e);break;case de.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case de.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===he.EXIT}))}_forAllFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===he.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===he.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(u(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===ke.OUTSIDE)return he.CONTINUE;if(i===ke.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=he.CONTINUE,r=e.featureIds,o=e.objectHandle,a=We(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===he.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=c(t.attributeInfo)&&t.attributeInfo.attributeData;if(c(s))for(const r of Object.keys(s))i[r]=Le(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ye(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Dt}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=v((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return c(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),he.CONTINUE)),null,de.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return c(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(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);c(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);c(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(u(this._edgeView)||!e.cachedEdgeMaterials)return;Rt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&c(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.i3slayer.uid,s=Tt(e);if(c(s)){const t={context:i,buffer:s.buffer};_e(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=me(i);e.imModificationImpact=s,s!==Te.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||c(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(u(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return{locations:o,type:"components",objectIds:s.featureIds,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{u(t)||e.add(i,t.node.renderMbs)})),t}_updateSnappingSources(e,t){const{index:i,renderMbs:s}=e.node;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([C()],r.prototype,"_hasLoadedPBRTextures",void 0),e([C()],r.prototype,"_asyncModuleLoading",void 0),e([C()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([C()],r.prototype,"view",void 0),e([C()],r.prototype,"i3slayer",void 0),e([C()],r.prototype,"_controller",void 0),e([C()],r.prototype,"_labeler",void 0),e([C()],r.prototype,"updating",void 0),e([C()],r.prototype,"suspended",void 0),e([C()],r.prototype,"holeFilling",void 0),e([C(it)],r.prototype,"updatingProgress",void 0),e([C({readOnly:!0,aliasOf:"_controller.updatingProgress"})],r.prototype,"updatingProgressValue",void 0),e([C({readOnly:!0})],r.prototype,"hasTexturesOrVertexColors",null),e([C({readOnly:!0})],r.prototype,"rendererTextureUsage",null),e([C()],r.prototype,"filter",void 0),e([C({readOnly:!0})],r.prototype,"elevationOffset",null),e([C({readOnly:!0})],r.prototype,"elevationInfo",null),e([C({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([C()],r.prototype,"supportedTextureEncodings",null),e([C()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([C({type:[ee]})],r.prototype,"_modifications",void 0),r=e([O("esri.views.3d.layers.I3SMeshView3D")],r),r};var ft;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(ft||(ft={}));const pt=z(),bt=X(),yt=X(),vt=et(),It=[0,0,0,0],Mt=new t([0,0,0,0]),Ct=[0,0,0,0],Ot=X();function xt(e){if(u(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 St(e){return"geometryData"in e}function Et(e){return c(e)&&I(e.data)}function jt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(c(t))for(const s of t)c(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function wt(e,t){return t.byteSize>mt?(dt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Tt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;u(s)&&(s=vt,F(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Dt={remove(){},pause(){},resume(){}};function Rt(e,t){e.forEach((e=>e.opacity=t))}var Nt;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Nt||(Nt={}));const At=P(),Ft=z();export{Nt as ElevationMode,gt as I3SMeshView3D};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import{makeHandle as r,handlesGroup as t}from"../../../core/handleUtils.js";import{isNone as a,isSome as i}from"../../../core/maybe.js";import{debounce as s,isPromiseLike as n}from"../../../core/promiseUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{toExtent as m}from"../../../geometry/support/aaBoundingRect.js";import{DrapeSourceType as l}from"./interfaces.js";import{LayerView3D as p}from"./LayerView3D.js";import{DRAPED_Z as c}from"../terrain/OverlayRenderer.js";import{UpdatePolicy as h,PowerOfTwoResizeMode as y}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as u}from"../webgl-engine/lib/Geometry.js";import{ModelDirty as _}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as g}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as f}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as w}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as E}from"../webgl-engine/materials/ImageMaterial.js";import D from"../../layers/LayerView.js";import{TextureWrapMode as R}from"../../webgl/enums.js";let v=class extends(p(D)){constructor(){super(...arguments),this.type="media-3d",this.drapeSourceType=l.RasterImage,this.updatePolicy=h.ASYNC,this._renderedElements=new Map,this._update=s((async(e,r,t)=>{const a=await this._collectMediaElements(e,r,t);this._synchronizeRenderElements(a)}),0)}initialize(){this._renderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this),this.handles.add(r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))))}setDrapingExtent(e,r){this.updatingHandles.addPromise(this._update(e,r).catch((()=>{})))}async _collectMediaElements(e,r,t){const i=this.layer.source;return a(i)?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(m(e.extent,r),{signal:t}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){const r=new Set,t=[];this._renderedElements.forEach(((a,s)=>{e.has(s)||(r.add(s),i(a.renderData)&&t.push(a.renderData.renderGeometry),this._removeElement(s,a))})),this._renderer.removeGeometries(t,_.Geometry.REMOVE)}_synchronizeRenderElementsAdd(e){for(const r of e)this._renderedElements.has(r)||this._createRenderElement(r)}_removeElement(e,{renderData:r,handle:t}){this._destroyRenderData(r),this._renderedElements.delete(e),t.remove()}async _createRenderElement(e){const r={renderData:null,handle:t([this.updatingHandles.add((()=>e.opacity),(e=>{i(r.renderData)&&r.renderData.material.setParameters({opacity:e})})),this.updatingHandles.add((()=>i(e.georeference)?e.georeference.coords:null),(t=>{i(r.renderData)?this._updateGeometry(r,r.renderData,t):this._initializeRenderData(e,r)})),this.updatingHandles.add((()=>e.loadedImage),(()=>this._initializeRenderData(e,r)))])};this._renderedElements.set(e,r),this.updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(e,r)}_initializeRenderData(e,r){const{georeference:t,loadedImage:s}=e;if(a(t)||a(t.coords)||a(s))return void(r.renderData=this._destroyRenderData(r.renderData));if(i(r.renderData))return;const o=this._createTexture(s);this.view._stage.add(o);const d=this.view._stage.loadImmediate(o);n(d)&&this.updatingHandles.addPromise(d);const m=new E({initTextureTransparent:!0,textureId:o.id,opacity:e.opacity,transparent:!0}),l=this._positionVertexBufferFromCoordinates(t.coords),p=[0,0,0,1,1,1,1,0],c=new Uint16Array([0,1,2,0,2,3]),h=new u([[w.POSITION,{data:l,size:3,exclusive:!0}],[w.UV0,{data:p,size:2,exclusive:!0}]],[[w.POSITION,c],[w.UV0,c]]),y=new g(h,m,{layerUid:this.layer.uid});this._renderer.addGeometries([y],_.Geometry.ADD),r.renderData={renderGeometry:y,texture:o,material:m}}_updateGeometry(e,r,t){if(a(t))return void(e.renderData=this._destroyRenderData(e.renderData));const i=this._positionVertexBufferFromCoordinates(t);r.renderGeometry.vertexAttributes.get(w.POSITION).data=i,this._renderer.modifyGeometries([r.renderGeometry],_.State.VERTEXATTRS)}_positionVertexBufferFromCoordinates(e){const[r,t,a,i]=e;return new Float64Array([r[0],r[1],c,t[0],t[1],c,a[0],a[1],c,i[0],i[1],c])}_destroyRenderData(e){return a(e)||(this.view._stage.remove(e.texture),this._renderer.removeGeometries([e.renderGeometry],_.Geometry.REMOVE),e.material.dispose()),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,t=e instanceof HTMLImageElement?e.naturalHeight:e.height;return new f(e,{wrap:{s:R.CLAMP_TO_EDGE,t:R.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:t,mipmap:!0,powerOfTwoResizeMode:y.STRETCH})}};e([o({readOnly:!0})],v.prototype,"type",void 0),e([o()],v.prototype,"layer",void 0),v=e([d("esri.views.3d.layers.MediaLayerView3D")],v);const T=v;export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Error.js";import{isSome as t}from"../../../core/maybe.js";import{watch as s,initial as i}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as n}from"../../../geometry/support/spatialReferenceUtils.js";import l from"../../../layers/VoxelWasmManager.js";import{LayerView3D as d}from"./LayerView3D.js";import m from"../../layers/LayerView.js";import{ContextType as p}from"../../webgl/context-util.js";let c=class extends(d(m)){constructor(){super(...arguments),this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this._wasmLayerId=-1}initialize(){if("local"!==this.view.viewingMode)throw new r("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(this.view._stage.renderView.renderingContext.type!==p.WEBGL2)throw new r("voxel:unsupported-context","Voxel layers are supported in WebGL2 rendering contexts only.",{});if(!!!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new r("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!n(e,this.view.spatialReference))throw new r("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const o=this.layer.style.currentVariableId,a=this.layer.getVolume(o),d=this.layer.getVariable(o);if(t(a)&&t(d)){const e=a.dimensions[0],r=a.dimensions[1],t=a.getZDimension();if(t>1){const s=a.dimensions[t],i=e.size*r.size*s.size;let o=1;switch(d.renderingFormat.type){case"Int16":case"UInt16":o=2;break;case"Int32":case"UInt32":case"Float32":o=4}this._futureMemory=o*i}}const m=l.getInstance(),c=m.addLayer(this.view,this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=s((()=>this.suspended),(e=>{l.getInstance().setLayerEnabled(this.view,this,!e)}),i)})).catch((e=>{if(m.removeLayer(this.view,this),this._wasmLayerId=-1,-1===e)throw new r("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new r("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(c)}destroy(){l.getInstance().removeLayer(this.view,this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null)}isUpdating(){return!(this._wasmLayerId<0)&&l.getInstance().isUpdating(this.view,this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}getUsedMemory(){return this._usedMemory}getUnloadedMemory(){return this._futureMemory}ignoresMemoryFactor(){return!0}get performanceInfo(){return{nodes:0,displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null}}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}};e([o()],c.prototype,"layer",void 0),e([o({readOnly:!0,aliasOf:"layer.parsedUrl.path"})],c.prototype,"baseUrl",void 0),c=e([a("esri.views.3d.layers.VoxelLayerView3D")],c);const h=c;export{h as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../core/Error.js";import t from"../../../core/Handles.js";import r from"../../../core/Logger.js";import{isSome as i,destroyMaybe as a,isNone as o}from"../../../core/maybe.js";import{watch as l,initial as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{equals as m}from"../../../geometry/support/spatialReferenceUtils.js";import{LayerView3D as c}from"./LayerView3D.js";import u from"../../layers/LayerView.js";import{ContextType as y}from"../../webgl/context-util.js";var p;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(p||(p={}));const f=r.getLogger(" esri.views.3d.layers.VoxelLayerView3D");let g=class extends(c(u)){constructor(){super(...arguments),this._usedMemory=0,this._futureMemory=0,this.type="voxel-3d",this._wasmLayerId=-1,this._handles=new t,this._dbgFlags=new Set}get wasmLayerId(){return this._wasmLayerId}initialize(){if("local"!==this.view.viewingMode)throw new s("voxel:unsupported-viewingMode","Voxel layers support local viewingMode only.",{});if(this.view._stage.renderView.renderingContext.type!==y.WEBGL2)throw new s("voxel:unsupported-context","Voxel layers are supported in WebGL2 rendering contexts only.",{});if(!!!this.view._stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new s("voxel:missing-color-buffer-float","Voxel layers require the WebGL2 extension EXT_color_buffer_float",{});const e=this.layer.spatialReference;if(!m(e,this.view.spatialReference))throw new s("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const t=this.layer.style.currentVariableId,r=this.layer.getVolume(t),a=this.layer.getVariable(t);if(i(r)&&i(a)){const e=r.dimensions[0],s=r.dimensions[1],t=r.getZDimension();if(t>1){const i=r.dimensions[t],o=e.size*s.size*i.size;let l=1;switch(a.renderingFormat.type){case"Int16":case"UInt16":l=2;break;case"Int32":case"UInt32":case"Float32":l=4}this._futureMemory=l*o}}const o=this.view.addVoxelLayerViewToWasm(this).then((e=>{this._wasmLayerId=e,this._suspendedHandle=l((()=>this.suspended),(e=>{const s=this.view.voxelWasm;i(s)&&s.setEnabled(this,!e)}),n),this._handles.add([l((()=>this.layer.getRenderMode()),(e=>this._pushRenderModeToWasm(e))),l((()=>this.layer.getCurrentVariableId()),(e=>this._pushCurrentVariableIdToWasm(e))),l((()=>this.layer.getDynamicSections()),(e=>this._pushDynamicSectionsToWasm(e))),l((()=>this.layer.getSlices()),(e=>this._pushSlicesToWasm(e))),l((()=>this.layer.getSections()),(e=>this._pushSectionsToWasm(e))),l((()=>this.layer.getVerticalExaggeration()),(e=>this._pushVerticalExaggerationToWasm(e))),l((()=>this.layer.getVerticalOffset()),(e=>this._pushVerticalOffsetToWasm(e)))])})).catch((e=>{if(this.view.removeVoxelLayerViewFromWasm(this),this._wasmLayerId=-1,-1===e)throw new s("voxel:addLayer-failure","The voxel layer description was invalid.",{});if(-2===e)throw new s("voxel:addLayer-failure","The voxel layer web assembly module failed to download.",{})}));this.addResolvingPromise(o)}destroy(){this.view.removeVoxelLayerViewFromWasm(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._handles=a(this._handles)}isUpdating(){const e=this.view.voxelWasm;return!(this._wasmLayerId<0||!i(e))&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}getUsedMemory(){return this._usedMemory}getUnloadedMemory(){return this._futureMemory}ignoresMemoryFactor(){return!0}get performanceInfo(){return{nodes:0,displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null}}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}_pushRenderModeToWasm(e){const s=this.view.voxelWasm;this._dbg(p.VerboseAPI,"VoxelLayerView3D._pushRenderModeToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setRenderMode(this,e)||this._dbg(p.Error,"VoxelLayerView3D._pushRenderModeToWasm() failed!")}_pushSlicesToWasm(e){const s=this.view.voxelWasm;this._dbg(p.VerboseAPI,"VoxelLayerView3D._pushSlicesToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setSlices(this,e)||this._dbg(p.Error,"VoxelLayerView3D._pushSlicesToWasm() failed!")}_pushSectionsToWasm(e){const s=this.view.voxelWasm;this._dbg(p.VerboseAPI,"VoxelLayerView3D._pushSectionsToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setStaticSections(this,e)||this._dbg(p.Error,"VoxelLayerView3D._pushSectionsToWasm() failed!")}_pushDynamicSectionsToWasm(e){const s=this.view.voxelWasm;this._dbg(p.VerboseAPI,"VoxelLayerView3D._pushDynamicSectionsToWasm() called, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setDynamicSections(this,e)||this._dbg(p.Error,"VoxelLayer._updateDynamicSections() failed!")}_pushCurrentVariableIdToWasm(e){const s=this.view.voxelWasm;this._dbg(p.VerboseAPI,"VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, "+(i(s)?"have WASM":"don't have WASM!!!"));!!i(s)&&s.setCurrentVariable(this,e)||this._dbg(p.Error,"VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!")}_pushVerticalExaggerationToWasm(e){const s=this.layer.getVolumeStyle(null),t=this.view.voxelWasm;if(this._dbg(p.VerboseAPI,`VoxelLayerView3D._pushVerticalExaggerationToWasm() called, ${i(t)?"have WASM":"don't have WASM!!!"}, ${i(s)?"have style":"don't have style!!!"}`),o(s))return;!!i(t)&&t.setVerticalExaggerationAndOffset(this,s.volumeId,e,s.verticalOffset)||this._dbg(p.Error,"VoxelLayerView3D._pushVerticalExaggerationToWasm() failed!")}_pushVerticalOffsetToWasm(e){const s=this.layer.getVolumeStyle(null),t=this.view.voxelWasm;if(this._dbg(p.VerboseAPI,`VoxelLayerView3D._pushVerticalOffsetToWasm() called, ${i(t)?"have WASM":"don't have WASM!!!"}, ${i(s)?"have style":"don't have style!!!"}`),o(s))return;!!i(t)&&t.setVerticalExaggerationAndOffset(this,s.volumeId,s.verticalExaggeration,e)||this._dbg(p.Error,"VoxelLayerView3D._pushVerticalOffsetToWasm() failed!")}_dbg(e,s){this._dbgFlags.has(e)&&(e===p.Error?f.error(s):f.warn(s))}};e([h()],g.prototype,"layer",void 0),e([h({readOnly:!0,aliasOf:"layer.parsedUrl.path"})],g.prototype,"baseUrl",void 0),g=e([d("esri.views.3d.layers.VoxelLayerView3D")],g);const V=g;export{V as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{ByteSizeUnit as e}from"../../../../core/byteSizeEstimations.js";import t from"../../../../core/Error.js";import{isSome as s}from"../../../../core/maybe.js";import{onAbort as r,throwIfAborted as i}from"../../../../core/promiseUtils.js";const o=14;class n{constructor(t,s,r=o){this._version=r,this._db=null,this._quotaReductionPromise=null,this._gcCounter=0,this._hit=0,this._miss=0,this._destroyed=!1,this.gcFrequency=50,this.maxByteSize=e.GIGABYTES,this.quotaReductionFactor=.2,this._dbName=t,this._storeName=s}init(){return Promise.resolve().then((()=>{const e=indexedDB.open(this._dbName,this._version);return e.onupgradeneeded=t=>{const s=e.result,r=e.transaction,i=s.objectStoreNames.contains(this._storeName)?r.objectStore(this._storeName):s.createObjectStore(this._storeName),o=s.objectStoreNames.contains("last_access")?r.objectStore("last_access"):s.createObjectStore("last_access");o.indexNames.contains("date")||o.createIndex("date","date",{unique:!1}),o.indexNames.contains("byteSize")||o.createIndex("byteSize","byteSize",{unique:!1}),t.oldVersion<this._version&&(i.clear(),o.clear())},a(e)})).then((e=>{this._destroyed?e.close():this._db=e}))}destroy(){this._db&&(this._db.close(),this._db=null),this._destroyed=!0}get initialized(){return null!=this._db}getHitRate(){return this._hit/(this._hit+this._miss)}put(e,s){if(null==this._db)return Promise.reject(new t("indexedb:not-initialized","IndexedDB Cache is not initialized"));return(null!=this._quotaReductionPromise?this._quotaReductionPromise:Promise.resolve()).then((()=>this._put(e,s))).catch((t=>{if(t&&"QuotaExceededError"===t.name)return null==this._quotaReductionPromise&&(this._quotaReductionPromise=this._getCacheSize().then((e=>this._removeLeastRecentlyAccessed(s.byteSize+Math.ceil(e*this.quotaReductionFactor)))),this._quotaReductionPromise.then((()=>this._quotaReductionPromise=null),(()=>this._quotaReductionPromise=null))),this._quotaReductionPromise.then((()=>this._put(e,s)));throw t})).then((()=>{this._gcCounter--,this._gcCounter<0&&null!=this._db&&(this._gcCounter=this.gcFrequency,this._getCacheSize().then((e=>this._removeLeastRecentlyAccessed(e-this.maxByteSize))))}))}get(e,t){if(null==this._db)return Promise.resolve(null);let o=null;return Promise.resolve().then((()=>{const s=this._db.transaction(this._storeName,"readonly");o=r(t,(()=>{s.abort()}));return a(s.objectStore(this._storeName).get(e))})).then((t=>{if(null==t)++this._miss;else if(this._db){++this._hit;this._db.transaction("last_access","readwrite").objectStore("last_access").put({date:Date.now(),byteSize:t.byteSize},e)}return s(o)&&o.remove(),t})).catch((()=>(++this._miss,i(t),s(o)&&o.remove(),null)))}remove(e){return null==this._db?Promise.resolve():Promise.resolve().then((async()=>{const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),r=t.objectStore("last_access"),i=s.delete(e),o=r.delete(e);await Promise.all([a(i),a(o),c(t)])}))}_put(e,t){const s=this._db.transaction([this._storeName,"last_access"],"readwrite"),r=s.objectStore(this._storeName),i=s.objectStore("last_access"),o=r.put(t,e),n=i.put({date:Date.now(),byteSize:t.byteSize},e);return Promise.all([a(o),a(n),c(s)])}_removeLeastRecentlyAccessed(e){if(e<=0)return;const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),r=t.objectStore("last_access");let i=0;const o=r.index("date").openCursor(null,"next");return o.onsuccess=()=>{const t=o.result;null!=t&&(null!=t.value.byteSize&&(i+=t.value.byteSize),s.delete(t.primaryKey),r.delete(t.primaryKey),i<e&&t.continue())},c(t)}_getCacheSize(){const e=this._db.transaction("last_access"),t=e.objectStore("last_access");let s=0;const r=t.index("byteSize").openKeyCursor();return r.onsuccess=()=>{const e=r.result;if(!e)return;const t=e.key;null!=t&&(s+=t),e.continue()},c(e).then((()=>s))}}function c(e){return new Promise(((t,s)=>{e.oncomplete=()=>t(),e.onerror=()=>s(e.error),e.onabort=()=>s(e.error)}))}function a(e){return new Promise(((t,s)=>{"done"===e.readyState?null!=e.error?s(e.error):t(e.result):(e.onsuccess=()=>t(e.result),e.onerror=()=>s(e.error))}))}export{n as IDBCache,a as whenRequest,c as whenTransaction};
5
+ import{ByteSizeUnit as e}from"../../../../core/byteSizeEstimations.js";import t from"../../../../core/Error.js";import{isSome as s}from"../../../../core/maybe.js";import{onAbort as r,throwIfAborted as i}from"../../../../core/promiseUtils.js";const o=14;class n{constructor(t,s,r=o){this._version=r,this._db=null,this._quotaReductionPromise=null,this._gcCounter=0,this._hit=0,this._miss=0,this._destroyed=!1,this.gcFrequency=50,this.maxByteSize=e.GIGABYTES,this.quotaReductionFactor=.2,this._dbName=t,this._storeName=s}init(){return Promise.resolve().then((()=>{const e=indexedDB.open(this._dbName,this._version);return e.onupgradeneeded=t=>{const s=e.result,r=e.transaction,i=s.objectStoreNames.contains(this._storeName)?r.objectStore(this._storeName):s.createObjectStore(this._storeName),o=s.objectStoreNames.contains("last_access")?r.objectStore("last_access"):s.createObjectStore("last_access");o.indexNames.contains("date")||o.createIndex("date","date",{unique:!1}),o.indexNames.contains("byteSize")||o.createIndex("byteSize","byteSize",{unique:!1}),t.oldVersion<this._version&&(i.clear(),o.clear())},a(e)})).then((e=>{this._destroyed?e.close():this._db=e}))}destroy(){this._db&&(this._db.close(),this._db=null),this._destroyed=!0}get initialized(){return null!=this._db}getHitRate(){return this._hit/(this._hit+this._miss)}put(e,s){if(null==this._db)return Promise.reject(new t("indexedb:not-initialized","IndexedDB Cache is not initialized"));return(null!=this._quotaReductionPromise?this._quotaReductionPromise:Promise.resolve()).then((()=>this._put(e,s))).catch((t=>{if(t&&"QuotaExceededError"===t.name)return null==this._quotaReductionPromise&&(this._quotaReductionPromise=this._getCacheSize().then((e=>this._removeLeastRecentlyAccessed(s.byteSize+Math.ceil(e*this.quotaReductionFactor)))),this._quotaReductionPromise.then((()=>this._quotaReductionPromise=null),(()=>this._quotaReductionPromise=null))),this._quotaReductionPromise.then((()=>this._put(e,s)));throw t})).then((()=>{this._gcCounter--,this._gcCounter<0&&null!=this._db&&(this._gcCounter=this.gcFrequency,this._getCacheSize().then((e=>this._removeLeastRecentlyAccessed(e-this.maxByteSize))))}))}get(e,t){if(null==this._db)return Promise.resolve(null);let o=null;return Promise.resolve().then((()=>{const s=this._db.transaction(this._storeName,"readonly");o=r(t,(()=>{s.abort()}));return a(s.objectStore(this._storeName).get(e))})).then((t=>{if(null==t)++this._miss;else if(this._db){++this._hit;this._db.transaction("last_access","readwrite").objectStore("last_access").put({date:Date.now(),byteSize:t.byteSize},e)}return s(o)&&o.remove(),t})).catch((()=>(++this._miss,i(t),s(o)&&o.remove(),null)))}remove(e){return null==this._db?Promise.resolve():Promise.resolve().then((async()=>{const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),r=t.objectStore("last_access"),i=s.delete(e),o=r.delete(e);await Promise.all([a(i),a(o),c(t)])}))}_put(e,t){const s=this._db.transaction([this._storeName,"last_access"],"readwrite"),r=s.objectStore(this._storeName),i=s.objectStore("last_access"),o=r.put(t,e),n=i.put({date:Date.now(),byteSize:t.byteSize},e);return Promise.all([a(o),a(n),c(s)])}_removeLeastRecentlyAccessed(e){if(e<=0||!this._db)return;const t=this._db.transaction([this._storeName,"last_access"],"readwrite"),s=t.objectStore(this._storeName),r=t.objectStore("last_access");let i=0;const o=r.index("date").openCursor(null,"next");return o.onsuccess=()=>{const t=o.result;null!=t&&(null!=t.value.byteSize&&(i+=t.value.byteSize),s.delete(t.primaryKey),r.delete(t.primaryKey),i<e&&t.continue())},c(t)}_getCacheSize(){const e=this._db.transaction("last_access"),t=e.objectStore("last_access");let s=0;const r=t.index("byteSize").openKeyCursor();return r.onsuccess=()=>{const e=r.result;if(!e)return;const t=e.key;null!=t&&(s+=t),e.continue()},c(e).then((()=>s))}}function c(e){return new Promise(((t,s)=>{e.oncomplete=()=>t(),e.onerror=()=>s(e.error),e.onabort=()=>s(e.error)}))}function a(e){return new Promise(((t,s)=>{"done"===e.readyState?null!=e.error?s(e.error):t(e.result):(e.onsuccess=()=>t(e.result),e.onerror=()=>s(e.error))}))}export{n as IDBCache,a as whenRequest,c as whenTransaction};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as a,e as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{c as p}from"../../../../chunks/vec2.js";import{a as c}from"../../../../chunks/vec2f64.js";import{c as m,b as l,l as v,n as u,a as C,g as P,e as f,f as E,m as d}from"../../../../chunks/vec3.js";import{c as w}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as R}from"../../../../geometry/projectionEllipsoid.js";import{applyAll as T}from"../../camera/constraintUtils.js";import{ConstraintTypes as j,InteractionType as y,TiltMode as O}from"../../camera/constraintUtils/common.js";import{TiltDefault as U}from"../Constraints.js";import{InteractiveController as M}from"./InteractiveController.js";import{normalizeCoordinate as D,decideNavigationMode as V,NavigationMode as g}from"../utils/navigationUtils.js";var x;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(x||(x={}));const N=7,k=90;let A=class extends M{constructor(t){super(t),this.view=null,this.pivot=x.CENTER,this.lastPoint=c(),this.tmpWorldUp=w(),this.tmpViewDir=w(),this.tmpRotCurPoint=c(),this.tmpTransf=h(),this.tmpAxis=w(),this.tmpPivotPoint=w(),this.pivotPos=w(),this.constraintOptions={selection:j.ALL,interactionType:y.TUMBLE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:O.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}initialize(){this.rotScale=this.pivot===x.CENTER?3:1.5}begin(t){if(this.active){switch(this.pivot){case x.EYE:m(this.pivotPos,this.startCamera.eye),this.constraintOptions.interactionType=y.LOOK_AROUND,this.constraintOptions.tiltMode=O.LOOK_AROUND,this.constraintOptions.selection=j.NONE;break;case x.CENTER:{const i=this.intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this.pivotPos);i||m(this.pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this.pivotPos,this.constraintOptions.interactionType=y.TUMBLE,this.constraintOptions.tiltMode=O.TUMBLE,this.constraintOptions.selection=j.ALL&~j.DISTANCE;break}}this.constraintOptions.interactionStartCamera=this.startCamera,D(this.startCamera,t,this.lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,e=w();l(e,this.pivotPos,s.eye);const r=v(e);let a=Math.min(r,N*Math.abs(this.view.camera.position.z));const n=R(this.view.spatialReference),h=o(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),p=V(this.startCamera,h,!0,n);let c=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*k,k),f=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),t[0],t[1],s,k);void 0===c&&void 0===f||(c=void 0===c?f:c,f=void 0===f||p===g.Horizontal?c:f,a=c>f?f:c,a=i?Math.min(a,r):a),u(e,e),m(this.pivotPos,C(this.tmpPivotPoint,s.eye,P(this.tmpPivotPoint,e,a)))}update(t){if(this.active){switch(this.pivot){case x.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this.pivotPos);break;case x.CENTER:this.currentCamera.center=this.pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this.pivotPos)}T(this.view,this.currentCamera,this.constraintOptions)}}end(){this.active&&this.finishController()}_applyRotation(t,o,e,r){this.view.renderCoordsHelper.worldUpAtPosition(r,this.tmpWorldUp),D(t,o,this.tmpRotCurPoint);let h=(this.lastPoint[1]-this.tmpRotCurPoint[1])*this.rotScale,c=(this.tmpRotCurPoint[0]-this.lastPoint[0])*this.rotScale;l(this.tmpViewDir,e,r);const m=v(this.tmpViewDir),u=i(f(this.tmpViewDir,this.tmpWorldUp)/m);if(this.pivot===x.EYE){h*=-.5;const t=.5*Math.PI-u,i=.5*Math.PI*.99;h=t-Math.max(-i,Math.min(i,t+h))}return h=s(h+u,U.min,U.max)-u,E(this.tmpAxis,t.up,this.tmpViewDir),this.pivot===x.CENTER&&(c=-c),a(this.tmpTransf,c,this.tmpWorldUp),n(this.tmpTransf,this.tmpTransf,h,this.tmpAxis),d(this.tmpViewDir,this.tmpViewDir,this.tmpTransf),t.up=d(S,t.up,this.tmpTransf),C(S,r,this.tmpViewDir),p(this.lastPoint,this.tmpRotCurPoint),S}};t([e({constructOnly:!0})],A.prototype,"view",void 0),t([e()],A.prototype,"pivot",void 0),A=t([r("esri.views.3d.state.controllers.RotateController")],A);const S=w();export{x as PivotPoint,A as RotateController};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{acosClamped as i,clamp as s}from"../../../../core/mathUtils.js";import{createScreenPointArray as o}from"../../../../core/screenUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as a,e as n}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{c as p}from"../../../../chunks/vec2.js";import{a as c}from"../../../../chunks/vec2f64.js";import{c as m,b as l,l as v,n as u,a as C,g as f,e as P,f as E,m as d}from"../../../../chunks/vec3.js";import{c as w}from"../../../../chunks/vec3f64.js";import{getReferenceEllipsoid as R}from"../../../../geometry/projectionEllipsoid.js";import{applyAll as T}from"../../camera/constraintUtils.js";import{ConstraintTypes as j,InteractionType as y,TiltMode as O}from"../../camera/constraintUtils/common.js";import{TiltDefault as U}from"../Constraints.js";import{InteractiveController as M}from"./InteractiveController.js";import{normalizeCoordinate as D,decideNavigationMode as x,NavigationMode as N}from"../utils/navigationUtils.js";var g;!function(t){t[t.CENTER=0]="CENTER",t[t.EYE=1]="EYE"}(g||(g={}));const k=7,A=90;let L=class extends M{constructor(t){super(t),this.view=null,this.pivot=g.CENTER,this.lastPoint=c(),this.tmpWorldUp=w(),this.tmpViewDir=w(),this.tmpRotCurPoint=c(),this.tmpTransf=h(),this.tmpAxis=w(),this.tmpPivotPoint=w(),this.pivotPos=w(),this.constraintOptions={selection:j.ALL,interactionType:y.TUMBLE,interactionFactor:0,interactionStartCamera:null,interactionDirection:null,tiltMode:O.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}initialize(){this.rotScale=this.pivot===g.CENTER?3:1.5}begin(t){if(this.active){switch(this.pivot){case g.EYE:m(this.pivotPos,this.startCamera.eye),this.constraintOptions.interactionType=y.LOOK_AROUND,this.constraintOptions.tiltMode=O.LOOK_AROUND,this.constraintOptions.selection=j.NONE;break;case g.CENTER:{const i=this.intersectionHelper.intersectRayFreePointFallback(this.startCamera.ray,this.pivotPos);i||m(this.pivotPos,this.startCamera.center),this._constrainPivotPoint(t,i),this.startCamera.center=this.pivotPos,this.constraintOptions.interactionType=y.TUMBLE,this.constraintOptions.tiltMode=O.TUMBLE,this.constraintOptions.selection=j.ALL&~j.DISTANCE;break}}this.constraintOptions.interactionStartCamera=this.startCamera,D(this.startCamera,t,this.lastPoint)}}_constrainPivotPoint(t,i){const s=this.startCamera,r=w();l(r,this.pivotPos,s.eye);const e=v(r);let a=Math.min(e,k*Math.abs(this.view.camera.position.z));const n=R(this.view.spatialReference),h=o(s.width/s.pixelRatio*.5,s.height/s.pixelRatio*.5),p=x(this.startCamera,h,!0,n);let c=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,s.fullWidth/s.pixelRatio*.5,s.fullHeight/s.pixelRatio*.5,s,2.5*A,A),P=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,t[0],t[1],s,A);void 0===c&&void 0===P||(c=void 0===c?P:c,P=void 0===P||p===N.Horizontal?c:P,a=c>P?P:c,a=i?Math.min(a,e):a),u(r,r),m(this.pivotPos,C(this.tmpPivotPoint,s.eye,f(this.tmpPivotPoint,r,a)))}update(t){if(this.active){switch(this.pivot){case g.EYE:this.currentCamera.center=this._applyRotation(this.currentCamera,t,this.currentCamera.center,this.pivotPos);break;case g.CENTER:this.currentCamera.center=this.pivotPos,this.currentCamera.eye=this._applyRotation(this.currentCamera,t,this.currentCamera.eye,this.pivotPos)}T(this.view,this.currentCamera,this.constraintOptions)}}end(){this.active&&this.finishController()}_applyRotation(t,o,r,e){this.view.renderCoordsHelper.worldUpAtPosition(e,this.tmpWorldUp),D(t,o,this.tmpRotCurPoint);let h=(this.lastPoint[1]-this.tmpRotCurPoint[1])*this.rotScale,c=(this.tmpRotCurPoint[0]-this.lastPoint[0])*this.rotScale;l(this.tmpViewDir,r,e);const m=v(this.tmpViewDir),u=i(P(this.tmpViewDir,this.tmpWorldUp)/m);if(this.pivot===g.EYE){h*=-.5;const t=.5*Math.PI-u,i=.5*Math.PI*.99;h=t-Math.max(-i,Math.min(i,t+h))}return h=s(h+u,U.min,U.max)-u,E(this.tmpAxis,t.up,this.tmpViewDir),this.pivot===g.CENTER&&(c=-c),a(this.tmpTransf,c,this.tmpWorldUp),n(this.tmpTransf,this.tmpTransf,h,this.tmpAxis),d(this.tmpViewDir,this.tmpViewDir,this.tmpTransf),t.up=d(V,t.up,this.tmpTransf),C(V,e,this.tmpViewDir),p(this.lastPoint,this.tmpRotCurPoint),V}};t([r({constructOnly:!0})],L.prototype,"view",void 0),t([r()],L.prototype,"pivot",void 0),L=t([e("esri.views.3d.state.controllers.RotateController")],L);const V=w();export{g as PivotPoint,L as RotateController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as r,c as a,e as m,g as h,b as c,n as l,l as p,a as u}from"../../../../../chunks/vec3.js";import{c as d,f as C}from"../../../../../chunks/vec3f64.js";import{wrapAxisAngle as g}from"../../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as M,setOffsetFromPoint as w,negate as b,normal as f}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as S,applyAll as V}from"../../../camera/constraintUtils.js";import{ConstraintTypes as E,InteractionType as P,TiltMode as j}from"../../../camera/constraintUtils/common.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{InteractiveController as H}from"../InteractiveController.js";import{PanPlanarMomentumController as O}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as T}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as A,centroid as F,applyZoomToPoint as L,applyPanPlanar as x,normalizeRotationDelta as R,applyRotation as U,intersectPlaneFromScreenPointAtEye as D}from"../../utils/navigationUtils.js";import{Camera as N}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as _}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as k}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as I}from"../../../../navigation/ZoomMomentumEstimator.js";const G=C(0,0,1),Z={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI},B=80;let W=class extends H{constructor(t){super(t),this.view=null,this.rotationValueSmooth=new z(.05),this.scalingValueSmooth=new z(.05),this.planeHorizontal=v(),this.planeVertical=v(),this.rotationMomentumEstimator=new k,this.panMomentumEstimator=new _(300,12,.9),this.zoomMomentumEstimator=new I,this.beginCenter=d(),this.tmpPoints=[],this.beginCenterScreen=e(),this.tmpCentroid3d=d(),this.tmpCentroid2d=e(),this.tmp2d=e(),this.constraintOptions={selection:E.ALL,interactionType:P.NONE,interactionFactor:0,interactionStartCamera:new N,interactionDirection:null,tiltMode:j.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this.zoomMomentumEstimator.enabled=e,this.rotationMomentumEstimator.enabled=e,this.panMomentumEstimator.enabled=e,this.beginRadius=t.radius,this.pointerCount=t.pointers.size,this.beginAngle=t.angle,this.rotationValueSmooth.reset(),this.scalingValueSmooth.reset(),n(t.center,this.beginCenterScreen),M(G,0,this.planeHorizontal);const o=d(),s=this.intersectionHelper.intersectScreenFreePointFallback(this.beginCenterScreen,o),C=d();r(C,this.startCamera.viewForward);const g=d();a(g,G);const v=m(C,g),f=i(v<0?-v:v);if(this.panMode=f>=Z.ANGLE_THRESHOLD?A.Horizontal:A.Vertical,w(this.planeHorizontal,this.planeHorizontal,o),this.startCamera.aboveGround||b(this.planeHorizontal,this.planeHorizontal),this.panMode===A.Vertical){h(g,g,v),c(this.planeVertical,C,g),l(this.planeVertical,this.planeVertical),w(this.planeVertical,this.planeVertical,o);const i=d(),e=d(),n=d();c(i,o,this.currentCamera.eye);const r=p(i);l(i,i);const M=5*Math.max(Math.abs(this.view.camera.position.z),50),b=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),this.beginCenterScreen[0],this.beginCenterScreen[1],this.view.state.camera,B);let f=b?Math.min(b,M):M;f=s?Math.min(f,r):f,a(n,u(e,this.currentCamera.eye,h(e,i,f))),this.planeVertical[3]=-m(this.planeVertical,n),this.computePlanePoints(t.pointers,this.planeVertical,this.startCamera,this.tmpPoints),F(this.tmpPoints,this.beginCenter)}else this.computePlanePoints(t.pointers,this.planeHorizontal,this.startCamera,this.tmpPoints),F(this.tmpPoints,this.beginCenter);this.constraintOptions.interactionStartCamera.copyFrom(this.startCamera)}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,e=this.panMode===A.Horizontal?this.planeHorizontal:this.planeVertical,o=this.beginCenter;if(i){const i=this.beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this.scalingValueSmooth.gain=e,this.scalingValueSmooth.update(i),L(this.currentCamera,o,this.scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this.zoomMomentumEstimator.add(this.scalingValueSmooth.value,.001*t.timestamp),this.constraintOptions.interactionType=P.ZOOM,this.constraintOptions.interactionFactor=S(Math.abs(t.radius-this.beginRadius)),V(this.view,this.currentCamera,this.constraintOptions)}if(this.computePlanePoints(t.pointers,e,this.currentCamera,this.tmpPoints),F(this.tmpPoints,this.tmpCentroid3d),n(t.center,this.tmpCentroid2d),x(this.currentCamera,o,this.tmpCentroid3d),this.panMomentumEstimator.add(this.tmpCentroid2d,this.tmpCentroid3d,.001*t.timestamp),this.constraintOptions.interactionType=P.PAN,this.constraintOptions.interactionFactor=S(this.beginCenterScreen,this.tmpCentroid2d),V(this.view,this.currentCamera,this.constraintOptions),i){const i=this.planeHorizontal,e=o,n=this.rotationValueSmooth.value,s=n+R(t.angle-n),r=.00125*Math.min(Math.max(t.radius,40),120);this.rotationValueSmooth.gain=r,this.rotationValueSmooth.update(s);const a=this.rotationValueSmooth.value-this.beginAngle;this.rotationMomentumEstimator.add(a,.001*t.timestamp),U(this.currentCamera,e,g(i,a)),this.constraintOptions.interactionType=P.TUMBLE,this.constraintOptions.interactionFactor=S(Math.abs(t.radius*a)),V(this.view,this.currentCamera,this.constraintOptions)}}end(t){t.pointers.size===this.pointerCount&&this.update(t),this.finishController();const i=this.zoomMomentumEstimator.evaluateMomentum();if(i)return new T({view:this.view,momentum:i,zoomCenter:this.beginCenter});const e=this.rotationMomentumEstimator.evaluateMomentum();if(e)return new y({view:this.view,momentum:e,center:this.beginCenter,axis:f(this.planeHorizontal)});const n=this.panMomentumEstimator.evaluateMomentum();return n?new O({view:this.view,momentum:n}):null}computePlanePoints(t,i,e,n){n.length=t.size;const o=this.tmp2d;let s=0;return t.forEach((t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=d()),D(i,e,o,n[s]),s+=1})),n}};t([o({constructOnly:!0})],W.prototype,"view",void 0),W=t([s("esri.views.3d.state.controllers.local.PinchAndPanController")],W);export{W as PinchAndPanController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{asinClamped as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as e,screenPointObjectToArray as n}from"../../../../../core/screenUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as r,c as a,e as m,g as h,b as c,n as l,l as p,a as u}from"../../../../../chunks/vec3.js";import{c as d,f as C}from"../../../../../chunks/vec3f64.js";import{wrapAxisAngle as g}from"../../../../../geometry/support/axisAngle.js";import{create as v,fromNormalAndOffset as M,setOffsetFromPoint as b,negate as f,normal as w}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as E,applyAll as S}from"../../../camera/constraintUtils.js";import{ConstraintTypes as P,InteractionType as V,TiltMode as j}from"../../../camera/constraintUtils/common.js";import{ExponentialFalloff as z}from"../../../input/util.js";import{InteractiveController as H}from"../InteractiveController.js";import{PanPlanarMomentumController as O}from"../momentum/PanPlanarMomentumController.js";import{RotationMomentumController as y}from"../momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as T}from"../momentum/ZoomPlanarMomentumController.js";import{NavigationMode as A,centroid as F,applyZoomToPoint as L,applyPanPlanar as x,normalizeRotationDelta as R,applyRotation as U,intersectPlaneFromScreenPointAtEye as D}from"../../utils/navigationUtils.js";import{Camera as N}from"../../../webgl-engine/lib/Camera.js";import{PanPlanarMomentumEstimator as _}from"../../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as k}from"../../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as I}from"../../../../navigation/ZoomMomentumEstimator.js";const G=C(0,0,1),Z={ELEVATION_THRESHOLD:3e4,ANGLE_THRESHOLD:16/180*Math.PI},B=80;let W=class extends H{constructor(t){super(t),this.view=null,this.rotationValueSmooth=new z(.05),this.scalingValueSmooth=new z(.05),this.planeHorizontal=v(),this.planeVertical=v(),this.rotationMomentumEstimator=new k,this.panMomentumEstimator=new _(300,12,.9),this.zoomMomentumEstimator=new I,this.beginCenter=d(),this.tmpPoints=[],this.beginCenterScreen=e(),this.tmpCentroid3d=d(),this.tmpCentroid2d=e(),this.tmp2d=e(),this.constraintOptions={selection:P.ALL,interactionType:V.NONE,interactionFactor:0,interactionStartCamera:new N,interactionDirection:null,tiltMode:j.TUMBLE}}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;const e=this.view.navigation.momentumEnabled;this.zoomMomentumEstimator.enabled=e,this.rotationMomentumEstimator.enabled=e,this.panMomentumEstimator.enabled=e,this.beginRadius=t.radius,this.pointerCount=t.pointers.size,this.beginAngle=t.angle,this.rotationValueSmooth.reset(),this.scalingValueSmooth.reset(),n(t.center,this.beginCenterScreen),M(G,0,this.planeHorizontal);const o=d(),s=this.intersectionHelper.intersectScreenFreePointFallback(this.beginCenterScreen,o),C=d();r(C,this.startCamera.viewForward);const g=d();a(g,G);const v=m(C,g),w=i(v<0?-v:v);if(this.panMode=w>=Z.ANGLE_THRESHOLD?A.Horizontal:A.Vertical,b(this.planeHorizontal,this.planeHorizontal,o),this.startCamera.aboveGround||f(this.planeHorizontal,this.planeHorizontal),this.panMode===A.Vertical){h(g,g,v),c(this.planeVertical,C,g),l(this.planeVertical,this.planeVertical),b(this.planeVertical,this.planeVertical,o);const i=d(),e=d(),n=d();c(i,o,this.currentCamera.eye);const r=p(i);l(i,i);const M=5*Math.max(Math.abs(this.view.camera.position.z),50),f=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,this.beginCenterScreen[0],this.beginCenterScreen[1],this.view.state.camera,B);let w=f?Math.min(f,M):M;w=s?Math.min(w,r):w,a(n,u(e,this.currentCamera.eye,h(e,i,w))),this.planeVertical[3]=-m(this.planeVertical,n),this.computePlanePoints(t.pointers,this.planeVertical,this.startCamera,this.tmpPoints),F(this.tmpPoints,this.beginCenter)}else this.computePlanePoints(t.pointers,this.planeHorizontal,this.startCamera,this.tmpPoints),F(this.tmpPoints,this.beginCenter);this.constraintOptions.interactionStartCamera.copyFrom(this.startCamera)}update(t){if(!this.active)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,e=this.panMode===A.Horizontal?this.planeHorizontal:this.planeVertical,o=this.beginCenter;if(i){const i=this.beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this.scalingValueSmooth.gain=e,this.scalingValueSmooth.update(i),L(this.currentCamera,o,this.scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this.zoomMomentumEstimator.add(this.scalingValueSmooth.value,.001*t.timestamp),this.constraintOptions.interactionType=V.ZOOM,this.constraintOptions.interactionFactor=E(Math.abs(t.radius-this.beginRadius)),S(this.view,this.currentCamera,this.constraintOptions)}if(this.computePlanePoints(t.pointers,e,this.currentCamera,this.tmpPoints),F(this.tmpPoints,this.tmpCentroid3d),n(t.center,this.tmpCentroid2d),x(this.currentCamera,o,this.tmpCentroid3d),this.panMomentumEstimator.add(this.tmpCentroid2d,this.tmpCentroid3d,.001*t.timestamp),this.constraintOptions.interactionType=V.PAN,this.constraintOptions.interactionFactor=E(this.beginCenterScreen,this.tmpCentroid2d),S(this.view,this.currentCamera,this.constraintOptions),i){const i=this.planeHorizontal,e=o,n=this.rotationValueSmooth.value,s=n+R(t.angle-n),r=.00125*Math.min(Math.max(t.radius,40),120);this.rotationValueSmooth.gain=r,this.rotationValueSmooth.update(s);const a=this.rotationValueSmooth.value-this.beginAngle;this.rotationMomentumEstimator.add(a,.001*t.timestamp),U(this.currentCamera,e,g(i,a)),this.constraintOptions.interactionType=V.TUMBLE,this.constraintOptions.interactionFactor=E(Math.abs(t.radius*a)),S(this.view,this.currentCamera,this.constraintOptions)}}end(t){t.pointers.size===this.pointerCount&&this.update(t),this.finishController();const i=this.zoomMomentumEstimator.evaluateMomentum();if(i)return new T({view:this.view,momentum:i,zoomCenter:this.beginCenter});const e=this.rotationMomentumEstimator.evaluateMomentum();if(e)return new y({view:this.view,momentum:e,center:this.beginCenter,axis:w(this.planeHorizontal)});const n=this.panMomentumEstimator.evaluateMomentum();return n?new O({view:this.view,momentum:n}):null}computePlanePoints(t,i,e,n){n.length=t.size;const o=this.tmp2d;let s=0;return t.forEach((t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=d()),D(i,e,o,n[s]),s+=1})),n}};t([o({constructOnly:!0})],W.prototype,"view",void 0),W=t([s("esri.views.3d.state.controllers.local.PinchAndPanController")],W);export{W as PinchAndPanController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as s}from"../../../../../core/screenUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as a}from"../../../../../chunks/vec2.js";import{a as o}from"../../../../../chunks/vec2f64.js";import{b as n,l as m,n as c,g as h,a as p,o as l,c as u,h as P}from"../../../../../chunks/vec3.js";import{c as v}from"../../../../../chunks/vec3f64.js";import{create as C,fromPositionAndNormal as f}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as y,applyAll as D}from"../../../camera/constraintUtils.js";import{ConstraintTypes as g,InteractionType as d,TiltMode as j}from"../../../camera/constraintUtils/common.js";import{InteractiveController as w}from"../InteractiveController.js";import{normalizeCoordinate as M,DISTANCE_CLAMP_VALUES as O,PIVOT_DISTANCE_MODIFIER as b,SCREEN_PIXEL_AREA as N,intersectPlaneFromScreenPoint as S}from"../../utils/navigationUtils.js";import{TERRAIN_ID as U}from"../../../webgl-engine/lib/verticalOffsetUtils.js";let R=class extends w{constructor(t){super(t),this.view=null,this.tmpP=v(),this.tmpDir=v(),this.tmpN=v(),this.tmpP0=o(),this.tmpPoi=v(),this.tmpRayDir=v(),this.dragBeginPoint=s(),this.normalizedAnchorPoint=o(),this.constraintOptions={selection:g.ALL,interactionType:d.ZOOM,interactionFactor:0,interactionStartCamera:null,interactionDirection:v(),tiltMode:j.TUMBLE},this.plane=C()}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;a(this.dragBeginPoint,t),M(this.startCamera,t,this.normalizedAnchorPoint);const s=this.intersectionHelper.intersectScreenFreePointFallback(t,this.tmpP,0===this.view.map.ground.opacity?A:{});n(this.tmpDir,this.tmpP,this.startCamera.eye);const r=m(this.tmpDir);let e;c(this.tmpDir,this.tmpDir),this.view.camera.position.hasZ&&(e=Math.abs(this.view.camera.position.z));let o=i(b*e,O[0],O[1]);const u=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),t[0],t[1],this.view.state.camera,N);o=u?Math.min(o,u):o,o=s?Math.min(o,r):o,h(this.tmpDir,this.tmpDir,o),p(this.tmpP,this.startCamera.eye,this.tmpDir),n(this.tmpN,this.startCamera.eye,this.startCamera.center),c(this.tmpN,this.tmpN),this.tmpN[1]<0&&l(this.tmpN,this.tmpN),f(this.tmpP,this.tmpN,this.plane),this.constraintOptions.interactionStartCamera=this.startCamera}update(t){if(!this.active)return;S(this.plane,this.currentCamera,this.dragBeginPoint,this.tmpPoi)||u(this.tmpPoi,this.currentCamera.center),M(this.currentCamera,t,this.tmpP0);let i=4*(this.tmpP0[1]-this.normalizedAnchorPoint[1]);a(this.normalizedAnchorPoint,this.tmpP0),n(this.tmpRayDir,this.tmpPoi,this.currentCamera.eye);const s=m(this.tmpRayDir);let r=s*(1-i);u(this.constraintOptions.interactionDirection,this.tmpRayDir),h(this.constraintOptions.interactionDirection,this.constraintOptions.interactionDirection,Math.sign(i)/s);const e=this.view.state.constraints.minimumPoiDistance;i>=0&&r<e&&(r=e,i=-(r-s)/s),Math.abs(s-r)<1e-6||(h(this.tmpRayDir,this.tmpRayDir,i),this.currentCamera.eye=p(k,this.currentCamera.eye,this.tmpRayDir),P(k,this.currentCamera.center,this.tmpPoi,i),this.tmpPoi[2]>this.startCamera.center[2]?k[2]=Math.max(this.startCamera.center[2],k[2]):k[2]=Math.min(this.startCamera.center[2],k[2]),this.currentCamera.center=k,this.constraintOptions.interactionFactor=y(this.dragBeginPoint,t),D(this.view,this.currentCamera,this.constraintOptions))}end(){this.active&&this.finishController()}};t([r({constructOnly:!0})],R.prototype,"view",void 0),R=t([e("esri.views.3d.state.controllers.local.ZoomController")],R);const k=v(),A={exclude:new Set([U])};export{R as ZoomController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{createScreenPointArray as s}from"../../../../../core/screenUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as a}from"../../../../../chunks/vec2.js";import{a as o}from"../../../../../chunks/vec2f64.js";import{b as n,l as m,n as h,g as c,a as p,o as l,c as u,h as P}from"../../../../../chunks/vec3.js";import{c as v}from"../../../../../chunks/vec3f64.js";import{create as C,fromPositionAndNormal as f}from"../../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as y,applyAll as D}from"../../../camera/constraintUtils.js";import{ConstraintTypes as d,InteractionType as g,TiltMode as j}from"../../../camera/constraintUtils/common.js";import{InteractiveController as w}from"../InteractiveController.js";import{normalizeCoordinate as M,DISTANCE_CLAMP_VALUES as O,PIVOT_DISTANCE_MODIFIER as b,SCREEN_PIXEL_AREA as N,intersectPlaneFromScreenPoint as U}from"../../utils/navigationUtils.js";import{TERRAIN_ID as R}from"../../../webgl-engine/lib/verticalOffsetUtils.js";let S=class extends w{constructor(t){super(t),this.view=null,this.tmpP=v(),this.tmpDir=v(),this.tmpN=v(),this.tmpP0=o(),this.tmpPoi=v(),this.tmpRayDir=v(),this.dragBeginPoint=s(),this.normalizedAnchorPoint=o(),this.constraintOptions={selection:d.ALL,interactionType:g.ZOOM,interactionFactor:0,interactionStartCamera:null,interactionDirection:v(),tiltMode:j.TUMBLE},this.plane=C()}get intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.active)return;a(this.dragBeginPoint,t),M(this.startCamera,t,this.normalizedAnchorPoint);const s=this.intersectionHelper.intersectScreenFreePointFallback(t,this.tmpP,0===this.view.map.ground.opacity?A:{});n(this.tmpDir,this.tmpP,this.startCamera.eye);const r=m(this.tmpDir);let e;h(this.tmpDir,this.tmpDir),this.view.camera.position.hasZ&&(e=Math.abs(this.view.camera.position.z));let o=i(b*e,O[0],O[1]);const u=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,t[0],t[1],this.view.state.camera,N);o=u?Math.min(o,u):o,o=s?Math.min(o,r):o,c(this.tmpDir,this.tmpDir,o),p(this.tmpP,this.startCamera.eye,this.tmpDir),n(this.tmpN,this.startCamera.eye,this.startCamera.center),h(this.tmpN,this.tmpN),this.tmpN[1]<0&&l(this.tmpN,this.tmpN),f(this.tmpP,this.tmpN,this.plane),this.constraintOptions.interactionStartCamera=this.startCamera}update(t){if(!this.active)return;U(this.plane,this.currentCamera,this.dragBeginPoint,this.tmpPoi)||u(this.tmpPoi,this.currentCamera.center),M(this.currentCamera,t,this.tmpP0);let i=4*(this.tmpP0[1]-this.normalizedAnchorPoint[1]);a(this.normalizedAnchorPoint,this.tmpP0),n(this.tmpRayDir,this.tmpPoi,this.currentCamera.eye);const s=m(this.tmpRayDir);let r=s*(1-i);u(this.constraintOptions.interactionDirection,this.tmpRayDir),c(this.constraintOptions.interactionDirection,this.constraintOptions.interactionDirection,Math.sign(i)/s);const e=this.view.state.constraints.minimumPoiDistance;i>=0&&r<e&&(r=e,i=-(r-s)/s),Math.abs(s-r)<1e-6||(c(this.tmpRayDir,this.tmpRayDir,i),this.currentCamera.eye=p(k,this.currentCamera.eye,this.tmpRayDir),P(k,this.currentCamera.center,this.tmpPoi,i),this.tmpPoi[2]>this.startCamera.center[2]?k[2]=Math.max(this.startCamera.center[2],k[2]):k[2]=Math.min(this.startCamera.center[2],k[2]),this.currentCamera.center=k,this.constraintOptions.interactionFactor=y(this.dragBeginPoint,t),D(this.view,this.currentCamera,this.constraintOptions))}end(){this.active&&this.finishController()}};t([r({constructOnly:!0})],S.prototype,"view",void 0),S=t([e("esri.views.3d.state.controllers.local.ZoomController")],S);const k=v(),A={exclude:new Set([R])};export{S as ZoomController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{Milliseconds as e}from"../../../../../core/time.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/set.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o,b as s,n as a,e as r,l as n,a as m,g as c,h as p}from"../../../../../chunks/vec3.js";import{c as h,f as l}from"../../../../../chunks/vec3f64.js";import{applyAll as C}from"../../../camera/constraintUtils.js";import{ConstraintTypes as y,InteractionType as u,TiltMode as f}from"../../../camera/constraintUtils/common.js";import{PointToPointAnimationController as g}from"../PointToPointAnimationController.js";import{Camera as w}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as j}from"../../../webgl-engine/lib/Intersector.js";import{TERRAIN_ID as b}from"../../../webgl-engine/lib/verticalOffsetUtils.js";import{outExpo as v}from"../../../../animation/easing.js";const L=.6,d=4,z=60,M=14,S=200;let F=class extends g{constructor(){super(...arguments),this.zoomLocation=h(),this.tmpCamera=new w,this.tmpRayDir=h(),this.tmpCenter=h(),this.constraintOptions={selection:y.ALL,interactionType:u.ZOOM,interactionFactor:null,interactionStartCamera:new w,interactionDirection:null,tiltMode:f.TUMBLE}}zoomStep(t,e){if(!this.active)return;const i=this.view.state,{interactionStartCamera:p}=this.constraintOptions;this.animation.finished?p.copyFrom(i.camera):this.animation.cameraAt(1,p),this.tmpCamera.copyFrom(i.camera);const l=j(this.view.state.viewingMode);t>0?(0===this.view.map.ground.opacity?this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation,O):this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation),this.intersectionHelper.intersectRay(this.tmpCamera.ray,l,this.tmpCenter)&&(this.tmpCamera.center=this.tmpCenter)):this.intersectionHelper.intersectRay(this.tmpCamera.ray,l,this.zoomLocation)?this.tmpCamera.center=this.zoomLocation:o(this.zoomLocation,this.tmpCamera.center);const C=L**t;let y=this.view._stage.renderView.getMinimalDepthForArea(this.view.getVoxelWasmPerSceneView(),e[0],e[1],this.view.state.camera,z);s(x,this.tmpCamera.eye,this.zoomLocation),a(x,x);const u=Math.max(Math.min(M,1/Math.abs(r(R,x)))*Math.abs(this.view.camera.position.z),S);if(y=y?Math.min(y,u):u,y){const t=h();s(t,this.zoomLocation,this.tmpCamera.eye),y<n(t)&&(a(t,t),m(this.zoomLocation,this.tmpCamera.eye,c(t,t,y)))}this._updateCamera(this.tmpCamera,C,this.zoomLocation),this.begin(this.tmpCamera)}animationSettings(){return{apex:null,duration:e(600),easing:v}}_updateCamera(t,e,i){s(this.tmpRayDir,i,t.eye);const o=n(this.tmpRayDir);let a=o*e;const r=e<=1,m=Math.max(d,1.01*t.nearFar[0]);r&&a<m&&(a=m,e=a/o),Math.abs(o-a)<1e-6||(c(this.tmpRayDir,this.tmpRayDir,e),t.eye=s(D,i,this.tmpRayDir),t.center=p(D,t.center,i,1-e),C(this.view,t,this.constraintOptions))}};F=t([i("esri.views.3d.state.controllers.local.ZoomStepController")],F);const D=h(),R=l(0,0,1),x=h(),O={exclude:new Set([b])};export{F as ZoomStepController};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{Milliseconds as e}from"../../../../../core/time.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/set.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{c as o,b as s,n as a,e as r,l as n,a as m,g as c,h as p}from"../../../../../chunks/vec3.js";import{c as h,f as l}from"../../../../../chunks/vec3f64.js";import{applyAll as C}from"../../../camera/constraintUtils.js";import{ConstraintTypes as y,InteractionType as u,TiltMode as f}from"../../../camera/constraintUtils/common.js";import{PointToPointAnimationController as g}from"../PointToPointAnimationController.js";import{Camera as j}from"../../../webgl-engine/lib/Camera.js";import{newIntersector as w}from"../../../webgl-engine/lib/Intersector.js";import{TERRAIN_ID as b}from"../../../webgl-engine/lib/verticalOffsetUtils.js";import{outExpo as v}from"../../../../animation/easing.js";const L=.6,d=4,z=60,M=14,S=200;let F=class extends g{constructor(){super(...arguments),this.zoomLocation=h(),this.tmpCamera=new j,this.tmpRayDir=h(),this.tmpCenter=h(),this.constraintOptions={selection:y.ALL,interactionType:u.ZOOM,interactionFactor:null,interactionStartCamera:new j,interactionDirection:null,tiltMode:f.TUMBLE}}zoomStep(t,e){if(!this.active)return;const i=this.view.state,{interactionStartCamera:p}=this.constraintOptions;this.animation.finished?p.copyFrom(i.camera):this.animation.cameraAt(1,p),this.tmpCamera.copyFrom(i.camera);const l=w(this.view.state.viewingMode);t>0?(0===this.view.map.ground.opacity?this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation,O):this.intersectionHelper.intersectScreenFreePointFallback(e,this.zoomLocation),this.intersectionHelper.intersectRay(this.tmpCamera.ray,l,this.tmpCenter)&&(this.tmpCamera.center=this.tmpCenter)):this.intersectionHelper.intersectRay(this.tmpCamera.ray,l,this.zoomLocation)?this.tmpCamera.center=this.zoomLocation:o(this.zoomLocation,this.tmpCamera.center);const C=L**t;let y=this.view._stage.renderView.getMinimalDepthForArea(this.view.voxelWasm,e[0],e[1],this.view.state.camera,z);s(x,this.tmpCamera.eye,this.zoomLocation),a(x,x);const u=Math.max(Math.min(M,1/Math.abs(r(R,x)))*Math.abs(this.view.camera.position.z),S);if(y=y?Math.min(y,u):u,y){const t=h();s(t,this.zoomLocation,this.tmpCamera.eye),y<n(t)&&(a(t,t),m(this.zoomLocation,this.tmpCamera.eye,c(t,t,y)))}this._updateCamera(this.tmpCamera,C,this.zoomLocation),this.begin(this.tmpCamera)}animationSettings(){return{apex:null,duration:e(600),easing:v}}_updateCamera(t,e,i){s(this.tmpRayDir,i,t.eye);const o=n(this.tmpRayDir);let a=o*e;const r=e<=1,m=Math.max(d,1.01*t.nearFar[0]);r&&a<m&&(a=m,e=a/o),Math.abs(o-a)<1e-6||(c(this.tmpRayDir,this.tmpRayDir,e),t.eye=s(D,i,this.tmpRayDir),t.center=p(D,t.center,i,1-e),C(this.view,t,this.constraintOptions))}};F=t([i("esri.views.3d.state.controllers.local.ZoomStepController")],F);const D=h(),R=l(0,0,1),x=h(),O={exclude:new Set([b])};export{F as ZoomStepController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as s,removeMaybe as a}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../core/scheduling.js";import{secondsFromMilliseconds as l}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as d,downloadSlotsPerClient as u}from"./index.js";import{newMemoryController as c}from"./MemoryController.js";import{StreamDataLoader as _}from"./StreamDataLoader.js";import{ImmediateTask as p,State as y,newScheduler as g,TaskPriority as C}from"../../support/Scheduler.js";let T=class extends t{constructor(){super(...arguments),this.updating=!1}};function f(e,t=(()=>performance.now())){return new w.ResourceController({view:e,now:t})}var w;e([n({readOnly:!0})],T.prototype,"updating",void 0),T=e([m("esri.views.3d.support.ResourceController")],T),function(t){let f=class extends T{constructor(){super(...arguments),this._scheduler=null,this._memoryController=null,this._streamDataLoader=null,this._scheduleTask=p,this._cameraChangeTime=0,this._handles=new r,this._frameTask=null,this._state=y.IDLE}initialize(){this._cameraChangeTime=this.now(),this._scheduler=g(this.now),this._memoryController=c(this.view),this._streamDataLoader=new _,this._streamDataLoader.setup(d,u,this._scheduler),this._handles.add([o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),i),o((()=>this.view.stationary),(()=>this._stationaryChangedHandler()))]),this._frameTask=h({update:e=>this._frame(e)}),this._scheduleTask=this._scheduler.registerTask(C.RESOURCE_CONTROLLER)}destroy(){this._handles=s(this._handles),this._scheduleTask.remove(),this._frameTask=a(this._frameTask),this._streamDataLoader=s(this._streamDataLoader),this._memoryController=s(this._memoryController),this._scheduler=s(this._scheduler)}get updating(){return!!(this._memoryController?.updating||this._streamDataLoader?.updating||this._scheduleTask?.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}schedule(e,t,r){return this._scheduleTask.schedule(e,t,r)}createStreamDataRequester(e){const t=this._streamDataLoader;return{request:(r,s,a)=>t.request(r,s,e,a),get busy(){return!t.hasDownloadSlots(e)}}}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(l(e.deltaTime)),!this._scheduler)||(this._updateState(),this._scheduler.state=this._state,this._scheduler.updateBudget(e)?(this._memoryController.update(),this._scheduler.frame()):this._memoryController.updating&&this._memoryController.update())}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=this._scheduler.now,this._updateState(),this._scheduler.state=this._state)}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}_updateState(){this.view.animation?this._state=y.ANIMATING:this.view.interacting?this._state=y.INTERACTING:(this._state===y.ANIMATING&&(this._cameraChangeTime=0),this._scheduler.now-this._cameraChangeTime<=w?this._state=y.INTERACTING:this._state=y.IDLE)}get test(){return{getQueueStats:e=>this._streamDataLoader.test.loadQueue.getStatsForType(e),state:this._state}}};e([n({constructOnly:!0})],f.prototype,"view",void 0),e([n({constructOnly:!0})],f.prototype,"now",void 0),e([n()],f.prototype,"_scheduler",void 0),e([n()],f.prototype,"_memoryController",void 0),e([n()],f.prototype,"_streamDataLoader",void 0),e([n()],f.prototype,"_scheduleTask",void 0),e([n({readOnly:!0})],f.prototype,"updating",null),f=e([m("esri.views.3d.support.ResourceController")],f),t.ResourceController=f;const w=300}(w||(w={}));export{T as ResourceControllerMain,f as newResourceController};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as s,removeMaybe as a}from"../../../core/maybe.js";import{watch as o,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as h}from"../../../core/scheduling.js";import{secondsFromMilliseconds as l}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as d,downloadSlotsPerClient as u}from"./index.js";import{newMemoryController as c}from"./MemoryController.js";import{StreamDataLoader as _}from"./StreamDataLoader.js";import{ImmediateTask as p,State as y,newScheduler as g,TaskPriority as C}from"../../support/Scheduler.js";let T=class extends t{constructor(){super(...arguments),this.updating=!1}};function f(e){return new v.ResourceController({view:e})}var v;e([n({readOnly:!0})],T.prototype,"updating",void 0),T=e([m("esri.views.3d.support.ResourceController")],T),function(t){let f=class extends T{constructor(){super(...arguments),this._scheduler=null,this._memoryController=null,this._streamDataLoader=null,this._scheduleTask=p,this._cameraChangeTime=0,this._handles=new r,this._frameTask=null,this._state=y.IDLE}initialize(){this._cameraChangeTime=performance.now(),this._scheduler=g(),this._memoryController=c(this.view),this._streamDataLoader=new _,this._streamDataLoader.setup(d,u,this._scheduler),this._handles.add([o((()=>this.view.state?.camera),((e,t)=>this._cameraChangedHandler(e,t)),i),o((()=>this.view.stationary),(()=>this._stationaryChangedHandler()))]),this._frameTask=h({update:e=>this._frame(e)}),this._scheduleTask=this._scheduler.registerTask(C.RESOURCE_CONTROLLER)}destroy(){this._handles=s(this._handles),this._scheduleTask.remove(),this._frameTask=a(this._frameTask),this._streamDataLoader=s(this._streamDataLoader),this._memoryController=s(this._memoryController),this._scheduler=s(this._scheduler)}get updating(){return!!(this._memoryController?.updating||this._streamDataLoader?.updating||this._scheduleTask?.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}schedule(e,t,r){return this._scheduleTask.schedule(e,t,r)}createStreamDataRequester(e){const t=this._streamDataLoader;return{request:(r,s,a)=>t.request(r,s,e,a),get busy(){return!t.hasDownloadSlots(e)}}}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(l(e.deltaTime)),!this._scheduler)||(this._updateState(),this._scheduler.state=this._state,this._scheduler.updateBudget(e)?(this._memoryController.update(),this._scheduler.frame()):this._memoryController.updating&&this._memoryController.update())}_cameraChangedHandler(e,t){e&&t&&e.almostEquals(t)||(this._cameraChangeTime=performance.now(),this._updateState(),this._scheduler.state=this._state)}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}_updateState(){this.view.animation?this._state=y.ANIMATING:this.view.interacting?this._state=y.INTERACTING:(this._state===y.ANIMATING&&(this._cameraChangeTime=0),performance.now()-this._cameraChangeTime<=v?this._state=y.INTERACTING:this._state=y.IDLE)}get test(){return{getQueueStats:e=>this._streamDataLoader.test.loadQueue.getStatsForType(e),state:this._state}}};e([n({constructOnly:!0})],f.prototype,"view",void 0),e([n()],f.prototype,"_scheduler",void 0),e([n()],f.prototype,"_memoryController",void 0),e([n()],f.prototype,"_streamDataLoader",void 0),e([n()],f.prototype,"_scheduleTask",void 0),e([n({readOnly:!0})],f.prototype,"updating",null),f=e([m("esri.views.3d.support.ResourceController")],f),t.ResourceController=f;const v=300}(v||(v={}));export{T as ResourceControllerMain,f as newResourceController};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{d as i,i as n,r as o,o as a,g as r}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{s as c,h as s,n as u,m}from"../../../chunks/vec3.js";import{f as d,c as g,a as h}from"../../../chunks/vec3f64.js";import{ViewingMode as b}from"../../ViewingMode.js";import{S as f}from"../../../chunks/SunCalc.js";const y={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};function p(i,n,o,a,r,l,u){c(u.ambient.color,1,1,1),u.ambient.intensity=y.global.ambient,c(u.direct.color,1,1,1),u.direct.intensity=y.global.direct;const m=n[2],g=e((Math.abs(m)-y.local.altitude)/(y.global.altitude-y.local.altitude),0,1);let h;if(u.globalFactor=g,"sun"===l&&(h=f.getTimes(i,n[1],n[0])),g<1){let e;if("sun"===l)e=D(i,h,a);else{const t=x(a);e={direct:{intensity:y.local.directAtNoon*t.direct,color:d(1,1,1)},ambient:{intensity:y.local.ambientAtNoon*t.ambient,color:d(1,1,1)},timeOfDay:"early afternoon"}}s(u.ambient.color,e.ambient.color,u.ambient.color,g),u.ambient.intensity=t(e.ambient.intensity,u.ambient.intensity,g),s(u.direct.color,e.direct.color,u.direct.color,g),u.direct.intensity=t(e.direct.intensity,u.direct.intensity,g),u.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,u.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}u.noonFactor="sun"===l?P(i,h):1,"sun"===l?N(i,n,o,u.direct.directionToLightSource):A(r,o,u.direct.directionToLightSource)}function A(t,e,n){e===b.Global?u(G,t.eye):c(G,0,0,1),i(j,H,t.viewRight),m(n,G,j),i(j,k,G),m(n,n,j)}function N(t,i,l,s){const u=O,d=n(S);if(l===b.Global)f.getPosition(t,0,0,u),c(s,0,0,-1),o(d,d,-u.azimuth),a(d,d,-u.altitude),m(s,s,d);else{const n=y.planarDirection,a=n.globalAngles,l=i[2];let g=(Math.abs(l)-n.localAltitude)/(n.globalAltitude-n.localAltitude);g=e(g,0,1),g<1?(f.getPosition(t,i[1],i[0],u),u.azimuth=(1-g)*u.azimuth+g*a.azimuth,u.altitude=(1-g)*u.altitude+g*a.altitude):(u.azimuth=a.azimuth,u.altitude=a.altitude),c(s,0,-1,0),r(d,d,-u.azimuth),o(d,d,-u.altitude),m(s,s,d)}}function T(t,e){if(e===b.Global)return!0;const i=y.planarDirection;return Math.abs(t)<i.localAltitude}function w(t,e,i,n,o){const a=t.getTime(),r=e.getTime()-a,l=Math.floor(r/i)+1,c=new Array(l);for(let s=0;s<l;++s)I.setTime(a+i*s),c[s]=g(),N(I,n,o,c[s]);return c}const M=d(.5773502691896258,-.5773502691896258,.5773502691896258);class v{constructor(){this.ambient={color:d(1,1,1),intensity:.55},this.direct={color:d(1,1,1),intensity:.55,directionToLightSource:h(M)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const S=l(),O={azimuth:0,altitude:0};function P(t,i){const n=t.valueOf();let o,a;i.polarException===f.PolarException.MIDNIGHT_SUN?(o=n-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=o+432e6):i.polarException===f.PolarException.POLAR_NIGHT?(o=n-2,a=n-1):(o=i.sunrise.valueOf(),a=i.sunset.valueOf());const r=o+(a-o)/2;return 1-e(Math.abs(n-r)/432e5,0,1)}function x(t){switch(t){case"disabled":case"sunny":case"cloudy":return{direct:1,ambient:1};case"rainy":return{direct:.4,ambient:1.2};case"snowy":return{direct:.5,ambient:1.3};case"foggy":return{direct:.2,ambient:1.6}}}function z(t,e){const i=(t[0]+t[1]+t[2])/3;for(let n=0;n<3;n++)t[n]=t[n]+(i-t[n])*e;return t}function D(t,e,i){const n=t.valueOf();let o,a;e.polarException===f.PolarException.MIDNIGHT_SUN?(o=n-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=o+432e6):e.polarException===f.PolarException.POLAR_NIGHT?(o=n-2,a=n-1):(o=e.sunrise.valueOf(),a=e.sunset.valueOf());const r=a-o,l=o+r/2,c=r/4,s=l-c,u=l+c,m=.06*r,g=o-m/2,h=o+m/2,b=a-m/2,p=a+m/2,A=y.local,N=[.01,A.ambientAtNight],T=[.8,.8,1],w=[.01,.01,.01],M=[A.directAtTwilight,A.ambientAtTwilight],v=[1,.6,.5],S=[.8,.8,1],O=[.9*A.directAtNoon,A.ambientAtNoon],P=[1,.98,.98],D=[.98,.98,1],I=[A.directAtNoon,A.ambientAtNoon],j=[1,1,1],G=[1,1,1],H=O,k=P,L=D,F=M,_=v,R=S;let U,C,V=[0,0],q=[0,0,0],B=[0,0,0];n<g||n>p?(V=N,q=w,B=T,C="night"):n<h?(U=h-g,V=E(n-g,U,N,M),q=E(n-g,U,w,v),B=E(n-g,U,T,S),C="sun rising"):n<s?(U=s-h,V=E(n-h,U,M,O),q=E(n-h,U,v,P),B=E(n-h,U,S,D),C="early morning"):n<l?(U=l-s,V=E(n-s,U,O,I),q=E(n-s,U,P,j),B=E(n-s,U,D,G),C="late morning"):n<u?(U=u-l,V=E(n-l,U,I,H),q=E(n-l,U,j,k),B=E(n-l,U,G,L),C="early afternoon"):n<b?(U=b-u,V=E(n-u,U,H,F),q=E(n-u,U,k,_),B=E(n-u,U,L,R),C="late afternoon"):n<p&&(U=p-b,V=E(n-b,U,F,N),q=E(n-b,U,_,w),B=E(n-b,U,R,T),C="sun setting");let J=0;switch(i){case"rainy":case"foggy":J=.9;case"snowy":J=.5}J>0&&(q=z(q,J),B=z(B,J));const K=d(q[0],q[1],q[2]),Q=d(B[0],B[1],B[2]),W=x(i);return{direct:{intensity:V[0]*W.direct,color:K},ambient:{intensity:V[1]*W.ambient,color:Q},timeOfDay:C}}function E(t,e,i,n){const o=[];for(let a=0;a<i.length;a++)o[a]=(n[a]-i[a])*t/e+i[a];return o}const I=new Date(0),j=l(),G=g(),H=.35,k=-.5;export{v as ColorAndIntensity,p as computeColorAndIntensity,w as computeDirectionsOverTime,T as computeShadowsEnabled};
5
+ import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{d as i,i as n,r as o,o as a,g as r}from"../../../chunks/mat4.js";import{c as l}from"../../../chunks/mat4f64.js";import{s as c,h as s,n as u,g as m,m as d,a as g}from"../../../chunks/vec3.js";import{f as h,c as b,a as f}from"../../../chunks/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{S as p}from"../../../chunks/SunCalc.js";import{angle as A}from"./mathUtils.js";const w={local:{altitude:1500,ambientAtNight:.1,ambientAtNoon:.45,ambientAtTwilight:.2,directAtNoon:.65,directAtTwilight:.7},global:{altitude:8e5,ambient:.015,direct:.75},planarDirection:{localAltitude:1e4,globalAltitude:1e6,globalAngles:{azimuth:1.3*Math.PI,altitude:.6*Math.PI}}};function N(i,n,o,a,r,l,u){c(u.ambient.color,1,1,1),u.ambient.intensity=w.global.ambient,c(u.direct.color,1,1,1),u.direct.intensity=w.global.direct;const m=n[2],d=e((Math.abs(m)-w.local.altitude)/(w.global.altitude-w.local.altitude),0,1);let g;if(u.globalFactor=d,"sun"===l&&(g=p.getTimes(i,n[1],n[0])),d<1){let e;if("sun"===l)e=I(i,g,a);else{const t=D(a);e={direct:{intensity:w.local.directAtNoon*t.direct,color:h(1,1,1)},ambient:{intensity:w.local.ambientAtNoon*t.ambient,color:h(1,1,1)},timeOfDay:"early afternoon"}}s(u.ambient.color,e.ambient.color,u.ambient.color,d),u.ambient.intensity=t(e.ambient.intensity,u.ambient.intensity,d),s(u.direct.color,e.direct.color,u.direct.color,d),u.direct.intensity=t(e.direct.intensity,u.direct.intensity,d),u.specularStrength="rainy"===a||"snowy"===a||"foggy"===a?0:1,u.environmentStrength="rainy"===a?.7:"snowy"===a||"foggy"===a?.75:1}u.noonFactor="sun"===l?j(i,g):1,"sun"===l?v(i,n,o,u.direct.directionToLightSource):T(r,o,u.direct.directionToLightSource)}function T(t,e,n){e===y.Global?u(F,t.eye):c(F,0,0,1),m(L,t.viewForward,-1);const o=A(L,F),a=Math.max(U,o-U);i(k,-a,t.viewRight),d(n,L,k),g(n,n,m(R,t.viewRight,_)),u(n,n)}function v(t,i,l,s){const u=z,m=n(P);if(l===y.Global)p.getPosition(t,0,0,u),c(s,0,0,-1),o(m,m,-u.azimuth),a(m,m,-u.altitude),d(s,s,m);else{const n=w.planarDirection,a=n.globalAngles,l=i[2];let g=(Math.abs(l)-n.localAltitude)/(n.globalAltitude-n.localAltitude);g=e(g,0,1),g<1?(p.getPosition(t,i[1],i[0],u),u.azimuth=(1-g)*u.azimuth+g*a.azimuth,u.altitude=(1-g)*u.altitude+g*a.altitude):(u.azimuth=a.azimuth,u.altitude=a.altitude),c(s,0,-1,0),r(m,m,-u.azimuth),o(m,m,-u.altitude),d(s,s,m)}}function M(t,e){if(e===y.Global)return!0;const i=w.planarDirection;return Math.abs(t)<i.localAltitude}function S(t,e,i,n,o){const a=t.getTime(),r=e.getTime()-a,l=Math.floor(r/i)+1,c=new Array(l);for(let s=0;s<l;++s)H.setTime(a+i*s),c[s]=b(),v(H,n,o,c[s]);return c}const x=h(.5773502691896258,-.5773502691896258,.5773502691896258);class O{constructor(){this.ambient={color:h(1,1,1),intensity:.55},this.direct={color:h(1,1,1),intensity:.55,directionToLightSource:f(x)},this.noonFactor=.5,this.globalFactor=0,this.specularStrength=1,this.environmentStrength=1}}const P=l(),z={azimuth:0,altitude:0};function j(t,i){const n=t.valueOf();let o,a;i.polarException===p.PolarException.MIDNIGHT_SUN?(o=n-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=o+432e6):i.polarException===p.PolarException.POLAR_NIGHT?(o=n-2,a=n-1):(o=i.sunrise.valueOf(),a=i.sunset.valueOf());const r=o+(a-o)/2;return 1-e(Math.abs(n-r)/432e5,0,1)}function D(t){switch(t){case"disabled":case"sunny":case"cloudy":return{direct:1,ambient:1};case"rainy":return{direct:.4,ambient:1.2};case"snowy":return{direct:.5,ambient:1.3};case"foggy":return{direct:.2,ambient:1.6}}}function E(t,e){const i=(t[0]+t[1]+t[2])/3;for(let n=0;n<3;n++)t[n]=t[n]+(i-t[n])*e;return t}function I(t,e,i){const n=t.valueOf();let o,a;e.polarException===p.PolarException.MIDNIGHT_SUN?(o=n-60*(t.getHours()+48)*60*1e3-60*t.getMinutes()*1e3,a=o+432e6):e.polarException===p.PolarException.POLAR_NIGHT?(o=n-2,a=n-1):(o=e.sunrise.valueOf(),a=e.sunset.valueOf());const r=a-o,l=o+r/2,c=r/4,s=l-c,u=l+c,m=.06*r,d=o-m/2,g=o+m/2,b=a-m/2,f=a+m/2,y=w.local,A=[.01,y.ambientAtNight],N=[.8,.8,1],T=[.01,.01,.01],v=[y.directAtTwilight,y.ambientAtTwilight],M=[1,.6,.5],S=[.8,.8,1],x=[.9*y.directAtNoon,y.ambientAtNoon],O=[1,.98,.98],P=[.98,.98,1],z=[y.directAtNoon,y.ambientAtNoon],j=[1,1,1],I=[1,1,1],H=x,k=O,F=P,L=v,R=M,U=S;let _,C,V=[0,0],q=[0,0,0],B=[0,0,0];n<d||n>f?(V=A,q=T,B=N,C="night"):n<g?(_=g-d,V=G(n-d,_,A,v),q=G(n-d,_,T,M),B=G(n-d,_,N,S),C="sun rising"):n<s?(_=s-g,V=G(n-g,_,v,x),q=G(n-g,_,M,O),B=G(n-g,_,S,P),C="early morning"):n<l?(_=l-s,V=G(n-s,_,x,z),q=G(n-s,_,O,j),B=G(n-s,_,P,I),C="late morning"):n<u?(_=u-l,V=G(n-l,_,z,H),q=G(n-l,_,j,k),B=G(n-l,_,I,F),C="early afternoon"):n<b?(_=b-u,V=G(n-u,_,H,L),q=G(n-u,_,k,R),B=G(n-u,_,F,U),C="late afternoon"):n<f&&(_=f-b,V=G(n-b,_,L,A),q=G(n-b,_,R,T),B=G(n-b,_,U,N),C="sun setting");let J=0;switch(i){case"rainy":case"foggy":J=.9;case"snowy":J=.5}J>0&&(q=E(q,J),B=E(B,J));const K=h(q[0],q[1],q[2]),Q=h(B[0],B[1],B[2]),W=D(i);return{direct:{intensity:V[0]*W.direct,color:K},ambient:{intensity:V[1]*W.ambient,color:Q},timeOfDay:C}}function G(t,e,i,n){const o=[];for(let a=0;a<i.length;a++)o[a]=(n[a]-i[a])*t/e+i[a];return o}const H=new Date(0),k=l(),F=b(),L=b(),R=b(),U=.25,_=.2;export{O as ColorAndIntensity,N as computeColorAndIntensity,S as computeDirectionsOverTime,M as computeShadowsEnabled};