@arcgis/core 5.2.0-next.61 → 5.2.0-next.63

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 (253) hide show
  1. package/WebDocument2D.d.ts +17 -1
  2. package/WebDocument2D.js +1 -1
  3. package/WebLinkChart.js +1 -1
  4. package/WebMap.js +1 -1
  5. package/WebScene.js +1 -1
  6. package/applications/Components/imageryUtils.d.ts +10 -0
  7. package/applications/Components/imageryUtils.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  9. package/arcgisGlobal.d.ts +7 -0
  10. package/assets/esri/core/workers/RemoteClient.js +1 -1
  11. package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +1 -0
  12. package/assets/esri/core/workers/chunks/04ffe788d2efc0a076dd.js +1 -0
  13. package/assets/esri/core/workers/chunks/0623acb2bd14a61b65c9.js +29 -0
  14. package/assets/esri/core/workers/chunks/08c2bf9defcece9e049a.js +1 -0
  15. package/assets/esri/core/workers/chunks/0d61c8d348b09179777a.js +1 -0
  16. package/assets/esri/core/workers/chunks/{3abc12d2407e4214963d.js → 13033178de9f637a2356.js} +1 -1
  17. package/assets/esri/core/workers/chunks/14cd8bb1ad4da8d1d2ca.js +1 -0
  18. package/assets/esri/core/workers/chunks/23a3d8f91caf3136b2aa.js +1 -0
  19. package/assets/esri/core/workers/chunks/{3157f85bb319294878ca.js → 2426601b8cae7f06af4d.js} +2 -2
  20. package/assets/esri/core/workers/chunks/2a1c6df073e6ca6a6365.js +1 -0
  21. package/assets/esri/core/workers/chunks/{a615a644086e98a90579.js → 3f775deea48e268411f1.js} +3 -3
  22. package/assets/esri/core/workers/chunks/{e3623e557ab463580fd2.js → 41e821ce229bc56dc1a1.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{17acbf40e7c1cb42d9bd.js → 44b1cdf28269b4fa8a39.js} +1 -1
  24. package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +1 -0
  25. package/assets/esri/core/workers/chunks/456e616f32e7de696d38.js +1 -0
  26. package/assets/esri/core/workers/chunks/{127b111ee53e4b9184f8.js → 4dcd4a052b40047a9230.js} +1 -1
  27. package/assets/esri/core/workers/chunks/54b9667450d066c6f6ce.js +1 -0
  28. package/assets/esri/core/workers/chunks/{aaa66a04b882b0ba2961.js → 5600fc334d20c4f0c83d.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5dbd8ca7e7b8eb9a0bf7.js +1 -0
  30. package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +1 -0
  31. package/assets/esri/core/workers/chunks/62f3ca0719ac6bc76512.js +1 -0
  32. package/assets/esri/core/workers/chunks/{14c066c31fe37b7f6e63.js → 638ed1297efdb24f4711.js} +1 -1
  33. package/assets/esri/core/workers/chunks/63ede7295938f7010808.js +1 -0
  34. package/assets/esri/core/workers/chunks/687cf21e027f49b44d22.js +1 -0
  35. package/assets/esri/core/workers/chunks/6c98a64d92c9bca78203.js +1 -0
  36. package/assets/esri/core/workers/chunks/{e7402dfd683f82878360.js → 752343d92ed48e674351.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7538a0fe0cec3156769e.js +1 -0
  38. package/assets/esri/core/workers/chunks/{42692a4ce3fb364e321e.js → 763cbb6716e398436a6d.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{d6aad815fc0ee8e24bb5.js → 7ce52b850dd785bfa33f.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{64247e439ef3e1f712e9.js → 7fdd6a5fa062778be55d.js} +1 -1
  41. package/assets/esri/core/workers/chunks/8369edafab7bdc59b95a.js +1 -0
  42. package/assets/esri/core/workers/chunks/{94e9cf8e729ec36de5be.js → 8c535c6a39d2be2ed655.js} +1 -1
  43. package/assets/esri/core/workers/chunks/8e1d4867406753c5483c.js +1 -0
  44. package/assets/esri/core/workers/chunks/92696cce2b980373f9ad.js +1 -0
  45. package/assets/esri/core/workers/chunks/{580451761cadfe308919.js → 9954149def644c371894.js} +1 -1
  46. package/assets/esri/core/workers/chunks/9f65cc6d9f7390bb1d5b.js +1 -0
  47. package/assets/esri/core/workers/chunks/a09ce34fc7c8abe64ed5.js +1 -0
  48. package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js → a12803108c3b12808698.js} +2 -2
  49. package/assets/esri/core/workers/chunks/{83991475aa54fd5aa008.js → a965d151515b76dd7566.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{128799741dd3c6fc69b9.js → ac4131121230cfc14f21.js} +1 -1
  51. package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +1 -0
  52. package/assets/esri/core/workers/chunks/b13d2da33ec07e9d41ff.js +1 -0
  53. package/assets/esri/core/workers/chunks/{33bd9785bd0b6ccef21b.js → b2cf1d3f0d48eac23a84.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{498d29e8c8be4a12ba12.js → b958f87f23f984131d09.js} +1 -1
  55. package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +1 -0
  56. package/assets/esri/core/workers/chunks/{edf87407dd20685c82ab.js → c82ab4f0908290e70ee9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{4e2f3dd158a5228c87ba.js → c85ba0700eafdc8d6f9e.js} +1 -1
  58. package/assets/esri/core/workers/chunks/d456520e4b119a2816b6.js +1 -0
  59. package/assets/esri/core/workers/chunks/d83ea3e4e9ab45334068.js +1 -0
  60. package/assets/esri/core/workers/chunks/{4f59357f535f30a6b5cc.js → d9b83d7dd7d1f7729a91.js} +1 -1
  61. package/assets/esri/core/workers/chunks/dbcec48c4ba104a6d0b5.js +1 -0
  62. package/assets/esri/core/workers/chunks/e02f02040b63d9c2e654.js +1 -0
  63. package/assets/esri/core/workers/chunks/e08c64e4ae5a68eae2be.js +1 -0
  64. package/assets/esri/core/workers/chunks/e2ddfc96ddba92302e0c.js +1 -0
  65. package/assets/esri/core/workers/chunks/{61d3fcb419d6bf7e355e.js → e65ee26feca0564aeb9b.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{35cbf00f0c37a86517af.js → ed1de8b7406269e217b9.js} +1 -1
  67. package/assets/esri/core/workers/chunks/ed4ac5568dc2815b066d.js +1 -0
  68. package/assets/esri/core/workers/chunks/f029c12f1afee0e9b2a1.js +1 -0
  69. package/assets/esri/core/workers/chunks/{461c2de938bf4c9b1442.js → f6715b8765cd36d81ec8.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{4fb549f11e176fc2f24a.js → f7fa932ade85cb2847b6.js} +1 -1
  71. package/assets/esri/core/workers/chunks/f9a4f4efd63b8189a4eb.js +1 -0
  72. package/assets/esri/core/workers/chunks/{26a2d4b95cda0a41d980.js → fa1c58e5b582d61a03ab.js} +1 -1
  73. package/assets/esri/core/workers/chunks/fa377112ef3b78f6ed18.js +1 -0
  74. package/chunks/VolumeMask.glsl.js +3 -0
  75. package/chunks/persistableUrlUtils.js +1 -1
  76. package/config.js +1 -1
  77. package/core/Collection.d.ts +42 -6
  78. package/core/Collection.js +1 -1
  79. package/core/screenUtils.js +1 -1
  80. package/geometry/SpatialReference.d.ts +1 -4
  81. package/geometry/support/intersectsBase.js +1 -1
  82. package/interfaces.d.ts +14 -0
  83. package/kernel.js +1 -1
  84. package/layers/BaseElevationLayer.js +1 -1
  85. package/layers/ElevationLayer.js +1 -1
  86. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  87. package/layers/KnowledgeGraphLayer.js +1 -1
  88. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  89. package/layers/StreamLayer.js +1 -1
  90. package/layers/VoxelWasmPerSceneView.js +1 -1
  91. package/layers/graphics/sources/connections/createConnection.js +1 -1
  92. package/layers/graphics/sources/parquet/ParquetFileStatistics.js +1 -1
  93. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  94. package/layers/graphics/sources/support/QueryTask.js +1 -1
  95. package/layers/mixins/SceneService.js +1 -1
  96. package/layers/raster/datasets/BaseRaster.js +1 -1
  97. package/layers/save/groupLayerUtils.js +1 -1
  98. package/layers/save/mediaLayerUtils.js +1 -1
  99. package/layers/support/ElevationQueryTileCache.js +1 -1
  100. package/layers/video/types.d.ts +17 -1
  101. package/linkChart/LinkChartProperties.js +1 -1
  102. package/package.json +3 -3
  103. package/popup/FeatureContent.d.ts +311 -0
  104. package/popup/FeatureContent.js +2 -0
  105. package/popup/FeatureContentCollection.d.ts +569 -0
  106. package/popup/FeatureContentCollection.js +2 -0
  107. package/portal/support/jsonContext.js +1 -1
  108. package/support/persistableUrlUtils.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  111. package/views/2d/layers/BaseLayerView2D.d.ts +2 -2
  112. package/views/2d/layers/BaseLayerViewGL2D.d.ts +2 -2
  113. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
  115. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  116. package/views/2d/support/hitTestUtils.js +1 -1
  117. package/views/3d/GroundView3D.js +1 -1
  118. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  119. package/views/3d/layers/FlowSubView3D.js +1 -1
  120. package/views/3d/layers/I3SMeshView3D.js +1 -1
  121. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  122. package/views/3d/layers/MediaLayerView3D.js +1 -1
  123. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  124. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  125. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  126. package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
  127. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  128. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  129. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  130. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  131. package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
  132. package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
  133. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  134. package/views/3d/support/buffer/glUtil.js +1 -1
  135. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  136. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  137. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  138. package/views/3d/support/gaussianSplatting/GaussianSplatHeaderTexture.js +1 -1
  139. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  140. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  141. package/views/3d/support/hitTest.js +1 -1
  142. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  143. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  144. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  145. package/views/3d/terrain/TerrainRenderer.js +1 -1
  146. package/views/3d/terrain/TerrainSurface.js +1 -1
  147. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticBVH.js +1 -1
  148. package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
  149. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  150. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  151. package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
  152. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +11 -11
  153. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.js +1 -1
  154. package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
  155. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  156. package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
  157. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  158. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  159. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  160. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  161. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
  162. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  163. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  164. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  165. package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
  166. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  168. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  169. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  170. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  171. package/views/3d/webgl-engine/materials/intersectWithPolygonOffset.js +1 -1
  172. package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +1 -1
  173. package/views/3d/webgl-engine/shaders/{CutFillMask.glsl.js → VolumeMask.glsl.js} +1 -1
  174. package/views/3d/webgl-engine/shaders/VolumeMaskTechnique.js +2 -0
  175. package/views/View2D.d.ts +2 -2
  176. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  177. package/views/webgl/FramebufferObject.js +1 -1
  178. package/webdoc/support/resourceUtils.js +1 -1
  179. package/webdoc/support/types.d.ts +2 -0
  180. package/webdoc/support/utils.js +2 -0
  181. package/webdoc/support/webdocLoadUtils.js +1 -1
  182. package/webdoc/support/webdocSaveUtils.js +1 -1
  183. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  184. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  185. package/widgets/BatchAttributeForm/expressions/ArcadeExecutorProvider.js +1 -1
  186. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  187. package/widgets/BatchAttributeForm/expressions/ExpressionsModel.js +1 -1
  188. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  189. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  190. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  191. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  192. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  193. package/widgets/BatchAttributeForm/rendered-content/RelationshipDetails.js +1 -1
  194. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  195. package/widgets/BatchAttributeForm.js +1 -1
  196. package/widgets/Editor/UpdateWorkflow.js +1 -1
  197. package/widgets/Editor.js +1 -1
  198. package/widgets/FeatureForm.js +1 -1
  199. package/widgets/FeatureTable/Grid/Column.d.ts +6 -0
  200. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  201. package/widgets/Legend/support/heatmapRampUtils.js +1 -1
  202. package/widgets/Sketch/SketchViewModel.js +1 -1
  203. package/widgets/support/SelectionList/FeatureItem.d.ts +116 -0
  204. package/widgets/support/SelectionList/GroupLayerItem.d.ts +94 -0
  205. package/widgets/support/SelectionList/ItemBase.d.ts +70 -0
  206. package/widgets/support/SelectionList/LayerItem.d.ts +140 -0
  207. package/widgets/support/SelectionList/LayerItem.js +1 -1
  208. package/widgets/support/SelectionList/SelectionListViewModel.d.ts +265 -0
  209. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  210. package/widgets/support/SelectionList/types.d.ts +42 -0
  211. package/widgets/support/forms/formUtils.js +1 -1
  212. package/assets/esri/core/workers/chunks/003a87b16f8a4b476e14.js +0 -1
  213. package/assets/esri/core/workers/chunks/0a50efb07eee36237e21.js +0 -1
  214. package/assets/esri/core/workers/chunks/129fdd1636e67997337c.js +0 -1
  215. package/assets/esri/core/workers/chunks/12e0c5b7cc5c3f9e6f0f.js +0 -1
  216. package/assets/esri/core/workers/chunks/26f1fd3f2be5102aae1d.js +0 -1
  217. package/assets/esri/core/workers/chunks/34fbeeeeef4bd01672c6.js +0 -1
  218. package/assets/esri/core/workers/chunks/36fe6adf6517d8f80125.js +0 -1
  219. package/assets/esri/core/workers/chunks/403f08e0c1a9203f7fba.js +0 -1
  220. package/assets/esri/core/workers/chunks/4f2170609742b51bd7b8.js +0 -1
  221. package/assets/esri/core/workers/chunks/5133083222588799493f.js +0 -1
  222. package/assets/esri/core/workers/chunks/52993a9dc0c56e9bda19.js +0 -1
  223. package/assets/esri/core/workers/chunks/5527b2da4abe0faa98bb.js +0 -1
  224. package/assets/esri/core/workers/chunks/5e35828216020f33e26b.js +0 -1
  225. package/assets/esri/core/workers/chunks/5f0d6c853873a7f32527.js +0 -1
  226. package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +0 -1
  227. package/assets/esri/core/workers/chunks/6823ba1688dfedba0107.js +0 -1
  228. package/assets/esri/core/workers/chunks/705d6b108fd121cea887.js +0 -1
  229. package/assets/esri/core/workers/chunks/73aa1bfa6e1dc271c9d7.js +0 -1
  230. package/assets/esri/core/workers/chunks/825eb845216762a1ed2f.js +0 -1
  231. package/assets/esri/core/workers/chunks/88df19742edb0cdc3e67.js +0 -1
  232. package/assets/esri/core/workers/chunks/8977c85aecc7e08ab13c.js +0 -1
  233. package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +0 -29
  234. package/assets/esri/core/workers/chunks/8c5726c7ce40a92901e6.js +0 -1
  235. package/assets/esri/core/workers/chunks/8c5e65982c3f9295e844.js +0 -1
  236. package/assets/esri/core/workers/chunks/8ce649e55fefc8eca55c.js +0 -1
  237. package/assets/esri/core/workers/chunks/90ae80b797642bff0efa.js +0 -1
  238. package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +0 -1
  239. package/assets/esri/core/workers/chunks/a8ade34612e73862de6f.js +0 -1
  240. package/assets/esri/core/workers/chunks/a9d391071803b1e9e8a0.js +0 -1
  241. package/assets/esri/core/workers/chunks/aa3abc07de2921ef6ca1.js +0 -1
  242. package/assets/esri/core/workers/chunks/b03f09ee2224f0cc526a.js +0 -1
  243. package/assets/esri/core/workers/chunks/b3f1a442d6b7826e917f.js +0 -1
  244. package/assets/esri/core/workers/chunks/b819a9187426d0c146df.js +0 -1
  245. package/assets/esri/core/workers/chunks/d205edd949f3e6e24eb9.js +0 -1
  246. package/assets/esri/core/workers/chunks/f0225829f7d941914815.js +0 -1
  247. package/assets/esri/core/workers/chunks/fb34d6d96c8c0d53fcf6.js +0 -1
  248. package/chunks/CutFillMask.glsl.js +0 -3
  249. package/chunks/FocusAreaMask.glsl.js +0 -3
  250. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMask.glsl.js +0 -2
  251. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskTechnique.js +0 -2
  252. package/views/3d/webgl-engine/shaders/CutFillMaskTechnique.js +0 -2
  253. /package/assets/esri/core/workers/chunks/{81659d121ed732bda907.js.LICENSE.txt → a12803108c3b12808698.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{id as e}from"../kernel.js";import{makeAbsolute as t,makeRelative as r,isAbsolute as s,normalize as o,isDataProtocol as l,hasSameOrigin as n,changeDomain as a,getAppUrl as c,splitPathExtension as i}from"../core/urlUtils.js";import{normalizeArcGISOnlineOrgDomain as u}from"../portal/support/urlUtils.js";function p(e,s){const o=s?.url?.path;if(e&&o&&(e=t(e,o,{preserveProtocolRelative:!0}),s.portalItem&&s.readResourcePaths)){const t=r(e,s.portalItem.itemUrl);null!=t&&t.startsWith(U)&&s.readResourcePaths.push(s.portalItem.resourceFromPath(t).path)}return(e=I(e,s?.portal))&&d.test(e)?R(e):e}function m(e,n,a=0){if(null==(e=e&&d.test(e)?w(e):e))return e;!s(e)&&n?.blockedRelativeUrls&&n.blockedRelativeUrls.push(e);let c=t(e);if(n){const t=n.verifyItemRelativeUrls?.rootPath||n.url?.path;if(t){const s=I(t,n.portal),o=I(c,n.portal);c=r(o,s,s);null!=c&&c!==o&&c!==e&&n.verifyItemRelativeUrls&&n.verifyItemRelativeUrls.writtenUrls.push(c)}}return c=x(c,n?.portal),s(c)&&(c=o(c)),n?.resources&&n?.portalItem&&!s(c)&&!l(c)&&0===a&&n.resources.toKeep.push({resource:n.portalItem.resourceFromPath(c),compress:!1}),c}function f(e,t,r){return p(e,r)}function h(e,t,r,s){const o=m(e,s);void 0!==o&&(t[r]=o)}const d=/\/items\/([^/]+)\/resources\/(.*)/,U="./resources/";function v(e){const t=e?.match(d)??null;return t?.[1]??null}function g(e){const t=e?.match(d)??null;if(null==t)return null;const r=t[2],s=r.lastIndexOf("/");if(-1===s){const{path:e,extension:t}=i(r);return{prefix:null,filename:e,extension:t}}const{path:o,extension:l}=i(r.slice(s+1));return{prefix:r.slice(0,s),filename:o,extension:l}}function x(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?a(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}function I(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const r=`${t.urlKey}.${t.customBaseUrl}`,s=c();return n(s,`${s.scheme}://${r}`)?a(e,t.portalHostname,r):a(e,r,t.portalHostname)}function R(t){if(!t)return t||null;let r=t;return r&&e&&!e.findCredential(r)&&(r=u(r),r=r.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),r=r.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),r=r.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),r}function w(t){if(!t)return t||null;let r=t;return r=r.replace(/^https?:\/\/cdn\.arcgis\.com/,"https://www.arcgis.com"),r=r.replace(/^https?:\/\/cdndev\.arcgis\.com/,"https://devext.arcgis.com"),r=r.replace(/^https?:\/\/cdnqa\.arcgis\.com/,"https://qaext.arcgis.com"),r&&e&&!e.findCredential(r)&&(r=u(r)),r}const y=Object.freeze(Object.defineProperty({__proto__:null,ensureMainOnlineDomain:x,fromCDNUrl:w,fromJSON:p,itemIdFromResourceUrl:v,prefixAndFilenameFromResourceUrl:g,read:f,toCDNUrl:R,toJSON:m,write:h},Symbol.toStringTag,{value:"Module"}));export{R as a,y as b,w as c,x as e,p as f,v as i,g as p,f as r,m as t,h as w};
2
+ import{id as t}from"../kernel.js";import{makeAbsolute as e,makeRelative as r,isAbsolute as s,normalize as o,isDataProtocol as n,hasSameOrigin as l,changeDomain as c,getAppUrl as a,splitPathExtension as i}from"../core/urlUtils.js";import{normalizeArcGISOnlineOrgDomain as u}from"../portal/support/urlUtils.js";function p(t,s){const o=s?.url?.path;if(t&&o&&(t=e(t,o,{preserveProtocolRelative:!0}),s.portalItem&&s.readResourcePaths)){const e=r(t,s.portalItem.itemUrl);null!=e&&e.startsWith(U)&&s.readResourcePaths.push(s.portalItem.resourceFromPath(e).path)}return(t=w(t,s?.portal))&&d.test(t)?y(t):t}function m(t,l,c=0){if(null==(t=t&&d.test(t)?P(t):t))return t;!s(t)&&l?.blockedRelativeUrls&&l.blockedRelativeUrls.push(t);let a=e(t);if(l){const e=l.verifyItemRelativeUrls?.rootPath||l.url?.path;if(e){const s=w(e,l.portal),o=w(a,l.portal);a=r(o,s,s);null!=a&&a!==o&&a!==t&&l.verifyItemRelativeUrls&&l.verifyItemRelativeUrls.writtenUrls.push(a)}}return a=I(a,l?.portal),s(a)&&(a=o(a)),l?.resources&&l?.portalItem&&!s(a)&&!n(a)&&0===c&&l.resources.toKeep.push({resource:l.portalItem.resourceFromPath(a),compress:!1}),a}function f(t,e,r){return p(t,r)}function h(t,e,r,s){const o=m(t,s);void 0!==o&&(e[r]=o)}const d=/\/items\/([^/]+)\/resources\/(.*)/,U="./resources/";function v(t){const e=t?.match(d)??null;return e?.[1]??null}const g=/http.+\/items\/[^/]+/i;function x(t){const e=t&&d.test(t)?t.match(g):null;return e?.[0]??null}function R(t){const e=t?.match(d)??null;if(null==e)return null;const r=e[2],s=r.lastIndexOf("/");if(-1===s){const{path:t,extension:e}=i(r);return{prefix:null,filename:t,extension:e}}const{path:o,extension:n}=i(r.slice(s+1));return{prefix:r.slice(0,s),filename:o,extension:n}}function I(t,e){return e&&!e.isPortal&&e.urlKey&&e.customBaseUrl?c(t,`${e.urlKey}.${e.customBaseUrl}`,e.portalHostname):t}function w(t,e){if(!e||e.isPortal||!e.urlKey||!e.customBaseUrl)return t;const r=`${e.urlKey}.${e.customBaseUrl}`,s=a();return l(s,`${s.scheme}://${r}`)?c(t,e.portalHostname,r):c(t,r,e.portalHostname)}function y(e){if(!e)return e||null;let r=e;return r&&t&&!t.findCredential(r)&&(r=u(r),r=r.replace(/^https?:\/\/www\.arcgis\.com/,"https://cdn.arcgis.com"),r=r.replace(/^https?:\/\/devext\.arcgis\.com/,"https://cdndev.arcgis.com"),r=r.replace(/^https?:\/\/qaext\.arcgis\.com/,"https://cdnqa.arcgis.com")),r}function P(e){if(!e)return e||null;let r=e;return r=r.replace(/^https?:\/\/cdn\.arcgis\.com/,"https://www.arcgis.com"),r=r.replace(/^https?:\/\/cdndev\.arcgis\.com/,"https://devext.arcgis.com"),r=r.replace(/^https?:\/\/cdnqa\.arcgis\.com/,"https://qaext.arcgis.com"),r&&t&&!t.findCredential(r)&&(r=u(r)),r}const b=Object.freeze(Object.defineProperty({__proto__:null,ensureMainOnlineDomain:I,fromCDNUrl:P,fromJSON:p,itemIdFromResourceUrl:v,itemUrlFromResourceUrl:x,prefixAndFilenameFromResourceUrl:R,read:f,toCDNUrl:y,toJSON:m,write:h},Symbol.toStringTag,{value:"Module"}));export{y as a,b,x as c,P as d,I as e,p as f,v as i,R as p,f as r,m as t,h as w};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.61";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.63";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -393,9 +393,8 @@ export default class Collection<T = any> extends EventedAccessor {
393
393
  */
394
394
  filter(callback: ItemTestCallback<T>, thisArg?: any): Collection<T>;
395
395
  /**
396
- * Returns an item in the Collection if that item passes a test as
397
- * defined in the `callback` function. Each item is passed into the
398
- * `callback` function, which
396
+ * Returns the first item in the Collection that passes a test defined by the
397
+ * `callback` function. Each item is passed into the `callback` function, which
399
398
  * returns `true` if the item passes the test and `false` if it does not.
400
399
  *
401
400
  * @param callback - The testing function that will assess
@@ -413,8 +412,8 @@ export default class Collection<T = any> extends EventedAccessor {
413
412
  */
414
413
  find(callback: ItemTestCallback<T>, thisArg?: any): T | undefined;
415
414
  /**
416
- * Returns the index of an item in the Collection if that item passes a test as
417
- * defined in the `callback` function. Each item is passed into the `callback` function, which
415
+ * Returns the index of the first item in the Collection that passes a test defined by the
416
+ * `callback` function. Each item is passed into the `callback` function, which
418
417
  * returns `true` if the item passes the test and `false` if it does not.
419
418
  *
420
419
  * @param callback - The testing function that will assess each
@@ -432,6 +431,43 @@ export default class Collection<T = any> extends EventedAccessor {
432
431
  * });
433
432
  */
434
433
  findIndex(callback: ItemTestCallback<T>, thisArg?: any): number;
434
+ /**
435
+ * Returns the last item in the Collection that passes a test defined by the
436
+ * `callback` function. Each item is passed into the `callback` function in reverse order.
437
+ *
438
+ * @param callback - The testing function that will assess
439
+ * each item in the Collection. Returns `true` if an item passes the test
440
+ * and `false` if it fails.
441
+ * @param thisArg - Value to use as `this` when executing `callback`.
442
+ * @returns The last item in the Collection that satisfies the test function.
443
+ * @since 5.2
444
+ * @see [Array.prototype.findLast()](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast)
445
+ * @example
446
+ * // Find the last layer in the collection that is visible
447
+ * const visibleLayer = map.layers.findLast(function(layer) {
448
+ * return layer.visible;
449
+ * });
450
+ */
451
+ findLast(callback: ItemTestCallback<T>, thisArg?: any): T | undefined;
452
+ /**
453
+ * Returns the index of the last item in the Collection that passes a test defined by the
454
+ * `callback` function. Each item is passed into the `callback` function in reverse order.
455
+ *
456
+ * @param callback - The testing function that will assess each
457
+ * item in the Collection. Returns `true` if an item passes the test and
458
+ * `false` if it fails.
459
+ * @param thisArg - Value to use as `this` when executing `callback`.
460
+ * @returns The index of the last Collection item that satisfies the test function.
461
+ * If no item satisfies the test, `-1` is returned.
462
+ * @since 5.2
463
+ * @see [Array.prototype.findLastIndex()](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex)
464
+ * @example
465
+ * // Find the index of the last visible layer in the collection
466
+ * const visibleLayerIndex = map.layers.findLastIndex(function(layer) {
467
+ * return layer.visible;
468
+ * });
469
+ */
470
+ findLastIndex(callback: ItemTestCallback<T>, thisArg?: any): number;
435
471
  /**
436
472
  * Flattens a hierarchical Collection containing at least one child collection.
437
473
  * Each item in the collection is passed into the `callback` function, which
@@ -823,7 +859,7 @@ export default class Collection<T = any> extends EventedAccessor {
823
859
  unshift(...items: T[]): number;
824
860
  }
825
861
 
826
- export interface ReadonlyCollection<T> extends EventedMixin, Pick<Collection<T>, "addHandles" | "at" | "clone" | "concat" | "declaredClass" | "destroyed" | "every" | "filter" | "find" | "findIndex" | "flatten" | "forEach" | "getItemAt" | "hasHandles" | "includes" | "initialized" | "indexOf" | "join" | "lastIndexOf" | "map" | "reduce" | "reduceRight" | "removeHandles" | "slice" | "some" | "toArray" | "toString" | "watch" | typeof Symbol.iterator> {
862
+ export interface ReadonlyCollection<T> extends EventedMixin, Pick<Collection<T>, "addHandles" | "at" | "clone" | "concat" | "declaredClass" | "destroyed" | "every" | "filter" | "find" | "findLast" | "findIndex" | "findLastIndex" | "flatten" | "forEach" | "getItemAt" | "hasHandles" | "includes" | "initialized" | "indexOf" | "join" | "lastIndexOf" | "map" | "reduce" | "reduceRight" | "removeHandles" | "slice" | "some" | "toArray" | "toString" | "watch" | typeof Symbol.iterator> {
827
863
  readonly "@eventTypes": Collection<T>["@eventTypes"];
828
864
  readonly length: number;
829
865
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"./ArrayPool.js";import{isArrayWithReadonly as s}from"./arrayUtils.js";import{EventedAccessor as i}from"./Evented.js";import{makeHandle as r}from"./handleUtils.js";import{clone as n}from"./lang.js";import h from"./Logger.js";import o from"./ObjectPool.js";import{schedule as l}from"./scheduling.js";import{ensureType as a,ensureOneOfType as c}from"./accessorSupport/ensureType.js";import{trackAccess as f}from"./accessorSupport/tracking.js";import{property as _}from"./accessorSupport/decorators/property.js";import{shared as u}from"./accessorSupport/decorators/shared.js";import{subclass as g}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as m}from"./accessorSupport/tracking/SimpleObservable.js";import{isSerializable as p}from"./support/jsonUtils.js";var d;class b{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class v{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const y=new o(()=>new b,void 0,e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1});function C(e){e&&"object"==typeof e&&"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}function A(e){return e?e instanceof I?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function x(e){if(e?.length)return e[0]}function j(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function E(e,t,s,i){t&&t.forEach((t,r,n)=>{e.push(t),E(e,s.call(i,t,r,n),s,i)})}const w=new Set,L=new Set,S=new Set,B=new Map;let O=0,I=d=class extends i{static ofType(t){if(!t)return d;if(B.has(t))return B.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends d{};return e([u({Type:t,ensureType:"function"==typeof t?a(t):c(t)})],i.prototype,"itemType",void 0),i=e([g(`esri.core.Collection<${s}>`)],i),B.set(t,i),i}static isCollection(e){return null!=e&&e instanceof d}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._updating=!1,this._timer=null,this._observable=new m,this._length=0,this._items=[],Object.defineProperty(this,"uid",{value:O++})}normalizeCtorArgs(e){return e?s(e)||e instanceof d?{items:e}:e:{}}destroy(){this._removeAllRaw(),this._timer&&this._timer.remove(),super.destroy(),this._notifications=null}*[Symbol.iterator](){yield*this.items}get length(){return this._length}set length(e){e>this._length?h.getLogger(this).error("#length=","Cannot increase the length of the collection by assigning to the length property."):this.splice(e,Math.max(0,this._length-e))}get items(){return f(this._observable),this._items}set items(e){this._emitBeforeChanges(1)||(this._splice(0,this.length,A(e)),this._emitAfterChanges(1))}hasEventListener(e){return!this.destroyed&&("change"===e?this._chgListeners.length>0:super.hasEventListener(e))}on(e,t){if(this.destroyed)return r();if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),r(()=>{s.removed=!0,e.splice(e.indexOf(s),1)})}return super.on(e,t)}once(e,t){const s="deref"in t?()=>t.deref():()=>t,i=this.on(e,e=>{s()?.call(null,e),i.remove()});return i}add(e,t){if(f(this._observable),this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(1),this}addMany(e,t=this._items.length){if(f(this._observable),!e?.length)return this;if(this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t);return this._splice(s,0,A(e)),this._emitAfterChanges(1),this}at(e){if(f(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return[];const e=this._removeAllRaw();return this._emitAfterChanges(2),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return f(this._observable),this._createNewInstance({items:this._items.map(n)})}concat(...e){f(this._observable);const t=e.map(A);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(2)}destroyAll(){this.drain(C)}destroyMany(e){const t=this.removeMany(e);return t.forEach(C),t}every(e,t){return f(this._observable),this._items.every(e,t)}filter(e,t){f(this._observable);const s=2===arguments.length?this._items.filter(e,t):this._items.filter(e);return this._createNewInstance({items:s})}find(e,t){return f(this._observable),this._items.find(e,t)}findIndex(e,t){return f(this._observable),this._items.findIndex(e,t)}flatten(e,t){f(this._observable);const s=[];return E(s,this,e,t),new d(s)}forEach(e,t){return f(this._observable),this._items.forEach(e,t)}getItemAt(e){return f(this._observable),this._items[e]}getNextIndex(e){f(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return f(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return f(this._observable),this._items.indexOf(e,t)}join(e=","){return f(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return f(this._observable),this._items.lastIndexOf(e,t)}map(e,t){f(this._observable);const s=this._items.map(e,t);return new d({items:s})}reorder(e,t=this.length-1){f(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(4))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(4)}return e}}pop(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(this.length-1,1));return this._emitAfterChanges(2),e}push(...e){return f(this._observable),this._emitBeforeChanges(1)||(this._splice(this.length,0,e),this._emitAfterChanges(1)),this.length}reduce(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return f(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(f(this._observable),e<0||e>=this.length||this._emitBeforeChanges(2))return;const t=x(this._splice(e,1));return this._emitAfterChanges(2),t}removeMany(e){if(f(this._observable),!e?.length||this._emitBeforeChanges(2))return[];const t=e instanceof d?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+j(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(2),i}reverse(){if(f(this._observable),this._emitBeforeChanges(4))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(4),this}shift(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(0,1));return this._emitAfterChanges(2),e}slice(e=0,t=this.length){return f(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return f(this._observable),this._items.some(e,t)}sort(e){if(f(this._observable),!this.length||this._emitBeforeChanges(4)||!this._requiresSort(e))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(4),this}_requiresSort(e=(e,t)=>e===t?0:e<t?-1:1){const t=this.length-1;for(let s=0;s<t;s++){if(e(this.items[s],this.items[s+1])>0)return!0}return!1}splice(e,t,...s){f(this._observable),1===arguments.length&&(t=this.length),t??=0;const i=(t?2:0)|(s.length?1:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return f(this._observable),this._items.slice()}toJSON(e){f(this._observable);return this.toArray().map(t=>p(t)?t.toJSON(e):t)}toLocaleString(){return f(this._observable),this._items.toLocaleString()}toString(){return f(this._observable),this._items.toString()}unshift(...e){return f(this._observable),!e.length||this._emitBeforeChanges(1)||(this._splice(0,0,e),this._emitAfterChanges(1)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._updating=!0,this._timer=l(()=>this._dispatchChange())),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=y.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);y.release(t)}if(this._length=this._items.length,this.hasEventListener("after-remove")){const e=y.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);y.release(e)}}if(s?.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=y.acquire();r.target=this,r.cancellable=!0;const o=y.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._length=i.length,n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._length=i.length,o.reset(l),this.emit("after-add",o));y.release(o),y.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._length=i.length}}if((s?.length||h?.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new v(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=y.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,y.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=y.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),y.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}get updating(){return this._updating}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),this._updating=!1,!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;w.clear(),L.clear(),S.clear();for(const{added:t,removed:s}of e){if(t)if(0===S.size&&0===L.size)for(const e of t)w.add(e);else for(const e of t)L.has(e)?(S.add(e),L.delete(e)):S.has(e)||w.add(e);if(s)if(0===S.size&&0===w.size)for(const e of s)L.add(e);else for(const e of s)w.has(e)?w.delete(e):(S.delete(e),L.add(e))}const i=t.acquire();w.forEach(e=>{i.push(e)});const r=t.acquire();L.forEach(e=>{r.push(e)});const n=this._items,h=s.items,o=t.acquire();if(S.forEach(e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)}),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}w.clear(),L.clear(),S.clear()}};e([_()],I.prototype,"_updating",void 0),e([_()],I.prototype,"_length",void 0),e([_()],I.prototype,"length",null),e([_()],I.prototype,"items",null),e([_({readOnly:!0})],I.prototype,"updating",null),I=d=e([g("esri.core.Collection")],I);const q=I;export{q as default};
2
+ import{__decorate as e}from"tslib";import t from"./ArrayPool.js";import{isArrayWithReadonly as s}from"./arrayUtils.js";import{EventedAccessor as i}from"./Evented.js";import{makeHandle as r}from"./handleUtils.js";import{clone as n}from"./lang.js";import h from"./Logger.js";import o from"./ObjectPool.js";import{schedule as l}from"./scheduling.js";import{ensureType as a,ensureOneOfType as c}from"./accessorSupport/ensureType.js";import{trackAccess as f}from"./accessorSupport/tracking.js";import{property as _}from"./accessorSupport/decorators/property.js";import{shared as u}from"./accessorSupport/decorators/shared.js";import{subclass as m}from"./accessorSupport/decorators/subclass.js";import{SimpleObservable as g}from"./accessorSupport/tracking/SimpleObservable.js";import{isSerializable as d}from"./support/jsonUtils.js";var p;class b{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}}class v{constructor(e,t,s,i,r){this.target=e,this.added=t,this.removed=s,this.start=i,this.deleteCount=r}}const y=new o(()=>new b,void 0,e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1});function C(e){e&&"object"==typeof e&&"destroy"in e&&"function"==typeof e.destroy&&e.destroy()}function A(e){return e?e instanceof I?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function x(e){if(e?.length)return e[0]}function L(e,t,s,i){const r=Math.min(e.length-s,t.length-i);let n=0;for(;n<r&&e[s+n]===t[i+n];)n++;return n}function j(e,t,s,i){t&&t.forEach((t,r,n)=>{e.push(t),j(e,s.call(i,t,r,n),s,i)})}const E=new Set,w=new Set,S=new Set,B=new Map;let O=0,I=p=class extends i{static ofType(t){if(!t)return p;if(B.has(t))return B.get(t);let s=null;if("function"==typeof t)s=t.prototype.declaredClass;else if(t.base)s=t.base.prototype.declaredClass;else for(const e in t.typeMap){const i=t.typeMap[e].prototype.declaredClass;s?s+=` | ${i}`:s=i}let i=class extends p{};return e([u({Type:t,ensureType:"function"==typeof t?a(t):c(t)})],i.prototype,"itemType",void 0),i=e([m(`esri.core.Collection<${s}>`)],i),B.set(t,i),i}static isCollection(e){return null!=e&&e instanceof p}constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._updating=!1,this._timer=null,this._observable=new g,this._length=0,this._items=[],Object.defineProperty(this,"uid",{value:O++})}normalizeCtorArgs(e){return e?s(e)||e instanceof p?{items:e}:e:{}}destroy(){this._removeAllRaw(),this._timer&&this._timer.remove(),super.destroy(),this._notifications=null}*[Symbol.iterator](){yield*this.items}get length(){return this._length}set length(e){e>this._length?h.getLogger(this).error("#length=","Cannot increase the length of the collection by assigning to the length property."):this.splice(e,Math.max(0,this._length-e))}get items(){return f(this._observable),this._items}set items(e){this._emitBeforeChanges(1)||(this._splice(0,this.length,A(e)),this._emitAfterChanges(1))}hasEventListener(e){return!this.destroyed&&("change"===e?this._chgListeners.length>0:super.hasEventListener(e))}on(e,t){if(this.destroyed)return r();if("change"===e){const e=this._chgListeners,s={removed:!1,callback:t};return e.push(s),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),r(()=>{s.removed=!0,e.splice(e.indexOf(s),1)})}return super.on(e,t)}once(e,t){const s="deref"in t?()=>t.deref():()=>t,i=this.on(e,e=>{s()?.call(null,e),i.remove()});return i}add(e,t){if(f(this._observable),this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t??null);return this._splice(s,0,[e]),this._emitAfterChanges(1),this}addMany(e,t=this._items.length){if(f(this._observable),!e?.length)return this;if(this._emitBeforeChanges(1))return this;const s=this.getNextIndex(t);return this._splice(s,0,A(e)),this._emitAfterChanges(1),this}at(e){if(f(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return[];const e=this._removeAllRaw();return this._emitAfterChanges(2),e}_removeAllRaw(){return 0===this.length?[]:this._splice(0,this.length)||[]}clone(){return f(this._observable),this._createNewInstance({items:this._items.map(n)})}concat(...e){f(this._observable);const t=e.map(A);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const s=this._splice(0,this.length),i=s.length;for(let r=0;r<i;r++)e.call(t,s[r],r,s);this._emitAfterChanges(2)}destroyAll(){this.drain(C)}destroyMany(e){const t=this.removeMany(e);return t.forEach(C),t}every(e,t){return f(this._observable),this._items.every(e,t)}filter(e,t){f(this._observable);const s=2===arguments.length?this._items.filter(e,t):this._items.filter(e);return this._createNewInstance({items:s})}find(e,t){return f(this._observable),this._items.find(e,t)}findIndex(e,t){return f(this._observable),this._items.findIndex(e,t)}findLast(e,t){return f(this._observable),this._items.findLast(e,t)}findLastIndex(e,t){return f(this._observable),this._items.findLastIndex(e,t)}flatten(e,t){f(this._observable);const s=[];return j(s,this,e,t),new p(s)}forEach(e,t){return f(this._observable),this._items.forEach(e,t)}getItemAt(e){return f(this._observable),this._items[e]}getNextIndex(e){f(this._observable);const t=this.length;return(e=e??t)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return f(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return f(this._observable),this._items.indexOf(e,t)}join(e=","){return f(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return f(this._observable),this._items.lastIndexOf(e,t)}map(e,t){f(this._observable);const s=this._items.map(e,t);return new p({items:s})}reorder(e,t=this.length-1){f(this._observable);const s=this.indexOf(e);if(-1!==s){if(t<0?t=0:t>=this.length&&(t=this.length-1),s!==t){if(this._emitBeforeChanges(4))return e;this._splice(s,1),this._splice(t,0,[e]),this._emitAfterChanges(4)}return e}}pop(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(this.length-1,1));return this._emitAfterChanges(2),e}push(...e){return f(this._observable),this._emitBeforeChanges(1)||(this._splice(this.length,0,e),this._emitAfterChanges(1)),this.length}reduce(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduce(e,t):s.reduce(e)}reduceRight(e,t){f(this._observable);const s=this._items;return 2===arguments.length?s.reduceRight(e,t):s.reduceRight(e)}remove(e){return f(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if(f(this._observable),e<0||e>=this.length||this._emitBeforeChanges(2))return;const t=x(this._splice(e,1));return this._emitAfterChanges(2),t}removeMany(e){if(f(this._observable),!e?.length||this._emitBeforeChanges(2))return[];const t=e instanceof p?e.toArray():e,s=this._items,i=[],r=t.length;for(let n=0;n<r;n++){const e=t[n],r=s.indexOf(e);if(r>-1){const e=1+L(t,s,n+1,r+1),h=this._splice(r,e);h&&h.length>0&&i.push.apply(i,h),n+=e-1}}return this._emitAfterChanges(2),i}reverse(){if(f(this._observable),this._emitBeforeChanges(4))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(4),this}shift(){if(f(this._observable),!this.length||this._emitBeforeChanges(2))return;const e=x(this._splice(0,1));return this._emitAfterChanges(2),e}slice(e=0,t=this.length){return f(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return f(this._observable),this._items.some(e,t)}sort(e){if(f(this._observable),!this.length||this._emitBeforeChanges(4)||!this._requiresSort(e))return this;const t=this._splice(0,this.length);return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(4),this}_requiresSort(e=(e,t)=>e===t?0:e<t?-1:1){const t=this.length-1;for(let s=0;s<t;s++){if(e(this.items[s],this.items[s+1])>0)return!0}return!1}splice(e,t,...s){f(this._observable),1===arguments.length&&(t=this.length),t??=0;const i=(t?2:0)|(s.length?1:0);if(this._emitBeforeChanges(i))return[];const r=this._splice(e,t,s)||[];return this._emitAfterChanges(i),r}toArray(){return f(this._observable),this._items.slice()}toJSON(e){f(this._observable);return this.toArray().map(t=>d(t)?t.toJSON(e):t)}toLocaleString(){return f(this._observable),this._items.toLocaleString()}toString(){return f(this._observable),this._items.toString()}unshift(...e){return f(this._observable),!e.length||this._emitBeforeChanges(1)||(this._splice(0,0,e),this._emitAfterChanges(1)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,s){const i=this._items,r=this.itemType;let n,h;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._updating=!0,this._timer=l(()=>this._dispatchChange())),e<0&&(e+=this.length),t){if(h=i.splice(e,t),this.hasEventListener("before-remove")){const t=y.acquire();t.target=this,t.cancellable=!0;for(let s=0,r=h.length;s<r;s++)n=h[s],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(h.splice(s,1),i.splice(e,0,n),e+=1,s-=1,r-=1);y.release(t)}if(this._length=this._items.length,this.hasEventListener("after-remove")){const e=y.acquire();e.target=this,e.cancellable=!1;const t=h.length;for(let s=0;s<t;s++)e.reset(h[s]),this.emit("after-remove",e);y.release(e)}}if(s?.length){if(r){const e=[];for(const t of s){const s=r.ensureType(t);null==s&&null!=t||e.push(s)}s=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),h=e===this.length;if(t||n){const r=y.acquire();r.target=this,r.cancellable=!0;const o=y.acquire();o.target=this,o.cancellable=!1;for(const l of s)t?(r.reset(l),this.emit("before-add",r),r.defaultPrevented||(h?i.push(l):i.splice(e++,0,l),this._length=i.length,n&&(o.reset(l),this.emit("after-add",o)))):(h?i.push(l):i.splice(e++,0,l),this._length=i.length,o.reset(l),this.emit("after-add",o));y.release(o),y.release(r)}else{if(h)for(const e of s)i.push(e);else i.splice(e,0,...s);this._length=i.length}}if((s?.length||h?.length)&&this._notifyChangeEvent(s,h),this.hasEventListener("after-splice")){const i=new v(this,s,h,e,t);this.emit("after-splice",i)}return h}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const s=y.acquire();s.target=this,s.cancellable=!0,s.type=e,this.emit("before-changes",s),t=s.defaultPrevented,y.release(s)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=y.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),y.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}get updating(){return this._updating}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),this._updating=!1,!this._notifications)return;const e=this._notifications;this._notifications=null;for(const s of e){const e=s.changes;E.clear(),w.clear(),S.clear();for(const{added:t,removed:s}of e){if(t)if(0===S.size&&0===w.size)for(const e of t)E.add(e);else for(const e of t)w.has(e)?(S.add(e),w.delete(e)):S.has(e)||E.add(e);if(s)if(0===S.size&&0===E.size)for(const e of s)w.add(e);else for(const e of s)E.has(e)?E.delete(e):(S.delete(e),w.add(e))}const i=t.acquire();E.forEach(e=>{i.push(e)});const r=t.acquire();w.forEach(e=>{r.push(e)});const n=this._items,h=s.items,o=t.acquire();if(S.forEach(e=>{h.indexOf(e)!==n.indexOf(e)&&o.push(e)}),s.listeners&&(i.length||r.length||o.length)){const e={target:this,added:i,removed:r,moved:o},t=s.listeners.length;for(let i=0;i<t;i++){const t=s.listeners[i];t.removed||t.callback.call(this,e)}}t.release(i),t.release(r),t.release(o)}E.clear(),w.clear(),S.clear()}};e([_()],I.prototype,"_updating",void 0),e([_()],I.prototype,"_length",void 0),e([_()],I.prototype,"length",null),e([_()],I.prototype,"items",null),e([_({readOnly:!0})],I.prototype,"updating",null),I=p=e([m("esri.core.Collection")],I);const q=I;export{q as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import t from"../geometry/Polygon.js";const n=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,r="screenUtils.toPt: input not recognized!",i=96;function e(t){return t?t/72*i:0}function u(t){return t?72*t/i:0}function o(t){if("string"==typeof t){const i=t.match(n);if(i){const n=Number(i[1]),r=i[3]&&i[3].toLowerCase(),e=t.startsWith("-"),o="px"===r?u(n):n;return e?-o:o}return console.warn(r),null}return t}function c(t=0,n=0){return{x:t,y:n}}function h(t=0,n=0,r=0,i=0){return{x:t,y:n,width:r,height:i}}function y(t){return t?c(t.x,t.y):null}function f(t=0,n=0){return[t,n]}function x(t=0,n=0){return{x:t,y:n}}function a(t=0,n=0){return m([t,n])}function s(t=0,n=0,r=0){return g([t,n,r])}function m(t){return t}function g(t){return t}function l(t){return t}function p(t,n){return n?(n.x=t[0],n.y=t[1],n):{x:t[0],y:t[1]}}function d(t,n){return n?(n[0]=t.x,n[1]=t.y,n.length>2&&(n[2]=0),n):[t.x,t.y]}function w(t,n){return t===n||null==t&&null==n||t?.x===n?.x&&t?.y===n?.y}function M(t,n){const r=t.x-n.x,i=t.y-n.y;return r*r+i*i}function b(t,n){return Math.sqrt(M(t,n))}function A(t){return t&&"x"in t&&"y"in t&&"width"in t&&"height"in t}function N(t){return Array.isArray(t)}function F(t){return t&&"x"in t&&"y"in t&&!A(t)}function P(t,n){return!(t.x+t.width<n.x||n.x+n.width<t.x||t.y+t.height<n.y||n.y+n.height<t.y)}function R(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)}function j(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)}function q(n,r){const{x:i,y:e,width:u,height:o}=r,h=n.toMap(c(i,e)),y=n.toMap(c(i+u,e)),f=n.toMap(c(i+u,e+o)),x=n.toMap(c(i,e+o));return new t({rings:[[h.toArray(),y.toArray(),f.toArray(),x.toArray(),h.toArray()]],spatialReference:h.spatialReference})}function z(t,n,r){const i=Math.max(0,t.x),e=Math.max(0,t.y),u=Math.min(n,t.x+t.width)-i,o=Math.min(r,t.y+t.height)-e;return{x:i,y:e,width:Math.max(0,u),height:Math.max(0,o)}}export{m as castRenderScreenPointArray,g as castRenderScreenPointArray3,l as castScreenPointArray,z as clipRectToView,y as cloneScreenPoint,x as createRenderScreenPoint,a as createRenderScreenPointArray,s as createRenderScreenPointArray3,c as createScreenPoint,f as createScreenPointArray,h as createScreenRect,F as isScreenPoint,N as isScreenPolygon,A as isScreenRect,R as isValidScreenPoint,j as isValidScreenRect,e as pt2px,u as px2pt,b as screenDistance,p as screenPointArrayToObject,w as screenPointEqual,d as screenPointObjectToArray,P as screenRectIntersects,q as screenRectToPolygon,M as squaredScreenDistance,o as toPt};
2
+ import t from"../geometry/Polygon.js";const n=/^-?(\d+(\.\d+)?)\s*((px)|(pt))?$/i,r="screenUtils.toPt: input not recognized!",i=96;function e(t){return t?t/72*i:0}function u(t){return t?72*t/i:0}function o(t){if("string"==typeof t){const i=t.match(n);if(i){const n=Number(i[1]),r=i[3]&&i[3].toLowerCase(),e=t.startsWith("-"),o="px"===r?u(n):n;return e?-o:o}return console.warn(r),null}return t}function c(t=0,n=0){return{x:t,y:n}}function y(t=0,n=0,r=0,i=0){return{x:t,y:n,width:r,height:i}}function h(t){return t?c(t.x,t.y):null}function a(t=0,n=0){return[t,n]}function f(t=0,n=0){return{x:t,y:n}}function x(t=0,n=0){return m([t,n])}function s(t=0,n=0,r=0){return g([t,n,r])}function m(t){return t}function g(t){return t}function l(t){return t}function p(t,n){return n?(n.x=t[0],n.y=t[1],n):{x:t[0],y:t[1]}}function d(t,n){return n?(n[0]=t.x,n[1]=t.y,n.length>2&&(n[2]=0),n):[t.x,t.y]}function w(t,n){return t===n||null==t&&null==n||t?.x===n?.x&&t?.y===n?.y}function M(t,n){const r=t.x-n.x,i=t.y-n.y;return r*r+i*i}function A(t,n){return Math.sqrt(M(t,n))}function b(t){return"x"in t&&"y"in t&&"width"in t&&"height"in t&&!N(t)}function N(t){return Array.isArray(t)}function F(t){return!Array.isArray(t)&&"x"in t&&"y"in t&&!b(t)&&!N(t)}function P(t,n){return!(t.x+t.width<n.x||n.x+n.width<t.x||t.y+t.height<n.y||n.y+n.height<t.y)}function R(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)}function j(t){return t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)}function q(n,r){const{x:i,y:e,width:u,height:o}=r,y=n.toMap(c(i,e)),h=n.toMap(c(i+u,e)),a=n.toMap(c(i+u,e+o)),f=n.toMap(c(i,e+o));return new t({rings:[[y.toArray(),h.toArray(),a.toArray(),f.toArray(),y.toArray()]],spatialReference:y.spatialReference})}function z(t,n,r){const i=Math.max(0,t.x),e=Math.max(0,t.y),u=Math.min(n,t.x+t.width)-i,o=Math.min(r,t.y+t.height)-e;return{x:i,y:e,width:Math.max(0,u),height:Math.max(0,o)}}export{m as castRenderScreenPointArray,g as castRenderScreenPointArray3,l as castScreenPointArray,z as clipRectToView,h as cloneScreenPoint,f as createRenderScreenPoint,x as createRenderScreenPointArray,s as createRenderScreenPointArray3,c as createScreenPoint,a as createScreenPointArray,y as createScreenRect,F as isScreenPoint,N as isScreenPolygon,b as isScreenRect,R as isValidScreenPoint,j as isValidScreenRect,e as pt2px,u as px2pt,A as screenDistance,p as screenPointArrayToObject,w as screenPointEqual,d as screenPointObjectToArray,P as screenRectIntersects,q as screenRectToPolygon,M as squaredScreenDistance,o as toPt};
@@ -134,10 +134,7 @@ export default class SpatialReference extends JSONSupport {
134
134
  * `102113`, `102100`, `3857`.
135
135
  */
136
136
  get isWebMercator(): boolean;
137
- /**
138
- * Indicates if the [wkid](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/#wkid) of the spatial reference object is
139
- * `4326`.
140
- */
137
+ /** Indicates if the [wkid](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/#wkid) of the spatial reference object is `4326`. */
141
138
  get isWGS84(): boolean;
142
139
  /**
143
140
  * Indicates if the spatial reference of the map supports wrapping around the International
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{extentContainsCoords2D as n,extentContainsPoint as t,ringsContainsCoords as e,extentContainsCoords3D as r}from"./contains.js";function o(n,e){return t(n,e)}function i(n,t){const e=n.hasZ&&t.hasZ;let r,o,i;if(n.xmin<=t.xmin){if(r=t.xmin,n.xmax<r)return!1}else if(r=n.xmin,t.xmax<r)return!1;if(n.ymin<=t.ymin){if(o=t.ymin,n.ymax<o)return!1}else if(o=n.ymin,t.ymax<o)return!1;if(e&&t.hasZ)if(n.zmin<=t.zmin){if(i=t.zmin,n.zmax<i)return!1}else if(i=n.zmin,t.zmax<i)return!1;return!0}function f(t,e){const{points:o,hasZ:i}=e,f=i?r:n;for(const n of o)if(f(t,n))return!0;return!1}const s=[0,0],c=[0,0],u=[0,0],m=[0,0],a=[s,c,u,m],l=[[u,s],[s,c],[c,m],[m,u]];function x(n,t){return h(n,t.rings)}function h(t,r){s[0]=t.xmin,s[1]=t.ymax,c[0]=t.xmax,c[1]=t.ymax,u[0]=t.xmin,u[1]=t.ymin,m[0]=t.xmax,m[1]=t.ymin;for(const n of a)if(e(r,n))return!0;for(const e of r){if(!e.length)continue;let r=e[0];if(n(t,r))return!0;for(let o=1;o<e.length;o++){const i=e[o];if(n(t,i)||g(r,i,l))return!0;r=i}}return!1}function y(t,e){s[0]=t.xmin,s[1]=t.ymax,c[0]=t.xmax,c[1]=t.ymax,u[0]=t.xmin,u[1]=t.ymin,m[0]=t.xmax,m[1]=t.ymin;const r=e.paths;for(const o of r){if(!r.length)continue;let e=o[0];if(n(t,e))return!0;for(let r=1;r<o.length;r++){const i=o[r];if(n(t,i)||g(e,i,l))return!0;e=i}}return!1}function g(n,t,e){for(let r=0;r<e.length;r++)if(p(n,t,e[r][0],e[r][1]))return!0;return!1}function p(n,t,e,r,o){const[i,f]=n,[s,c]=t,[u,m]=e,[a,l]=r,x=a-u,h=i-u,y=s-i,g=l-m,p=f-m,z=c-f,G=g*y-x*z;if(0===G)return!1;const M=(x*p-g*h)/G,P=(y*p-z*h)/G;return M>=0&&M<=1&&P>=0&&P<=1&&(o&&(o[0]=i+M*(s-i),o[1]=f+M*(c-f)),!0)}function z(n,t,e){for(const r of t){const t=r.length;for(let o=1;o<t;o++){const t=r[o-1],i=r[o];let f=(i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1]);if(0===f)continue;f=Math.sqrt(f);const s=((i[0]-t[0])*(n[1]-t[1])-(i[1]-t[1])*(n[0]-t[0]))/f;if(Math.abs(s)<e){const r=((i[0]-t[0])*(n[0]-t[0])+(i[1]-t[1])*(n[1]-t[1]))/f;if(r>-e&&r<f+e)return!0}}}return!1}function G(n){const t=1e-6,e=n[0],r=n[n.length-1];return Math.abs(e[0]-r[0])<=t&&Math.abs(e[1]-r[1])<=t}function M(n,t){let e=0;for(const r of t){const t=r.length;for(let o=1;o<t;o++){const t=r[o-1],i=r[o];if(t[1]>n[1]==i[1]>n[1])continue;(i[0]-t[0])*(n[1]-t[1])-(i[1]-t[1])*(n[0]-t[0])>0?e++:e--}}return 0!==e}function P(n,t){n.length>1&&!G(n)&&(n=[...n,n[0]]);for(let e=0;e<t.length;e++){const r=t[e],o=r.length;for(const t of r)if(M(t,[n]))return!0;if(G(r))for(const e of n)if(M(e,t))return!0;for(let t=1;t<o;t++){const e=r[t-1],o=r[t];for(let t=0;t<n.length;t++){if(p(e,o,n[t],n[(t+1)%n.length]))return!0}}}return!1}function Z(n){switch(n){case"esriGeometryEnvelope":case"extent":return i;case"esriGeometryMultipoint":case"multipoint":return f;case"esriGeometryPoint":case"point":return o;case"esriGeometryMultiPatch":case"multipatch":case"esriGeometryPolygon":case"polygon":return x;case"esriGeometryPolyline":case"polyline":return y}}export{i as extentIntersectsExtent,f as extentIntersectsMultipoint,o as extentIntersectsPoint,x as extentIntersectsPolygon,y as extentIntersectsPolyline,Z as getFeatureExtentIntersector,z as nearLine,M as pointInPolygon,p as segmentIntersects,P as targetIntersectsPolygon};
2
+ import{extentContainsCoords2D as n,extentContainsPoint as t,ringsContainsCoords as e,extentContainsCoords3D as r}from"./contains.js";function o(n,e){return t(n,e)}function i(n,t){const e=n.hasZ&&t.hasZ;let r,o,i;if(n.xmin<=t.xmin){if(r=t.xmin,n.xmax<r)return!1}else if(r=n.xmin,t.xmax<r)return!1;if(n.ymin<=t.ymin){if(o=t.ymin,n.ymax<o)return!1}else if(o=n.ymin,t.ymax<o)return!1;if(e&&t.hasZ)if(n.zmin<=t.zmin){if(i=t.zmin,n.zmax<i)return!1}else if(i=n.zmin,t.zmax<i)return!1;return!0}function f(t,e){const{points:o,hasZ:i}=e,f=i?r:n;for(const n of o)if(f(t,n))return!0;return!1}const s=[0,0],c=[0,0],u=[0,0],m=[0,0],a=[s,c,u,m],l=[[u,s],[s,c],[c,m],[m,u]];function x(n,t){return h(n,t.rings)}function h(t,r){s[0]=t.xmin,s[1]=t.ymax,c[0]=t.xmax,c[1]=t.ymax,u[0]=t.xmin,u[1]=t.ymin,m[0]=t.xmax,m[1]=t.ymin;for(const n of a)if(e(r,n))return!0;for(const e of r){if(!e.length)continue;let r=e[0];if(n(t,r))return!0;for(let o=1;o<e.length;o++){const i=e[o];if(n(t,i)||g(r,i,l))return!0;r=i}}return!1}function y(t,e){s[0]=t.xmin,s[1]=t.ymax,c[0]=t.xmax,c[1]=t.ymax,u[0]=t.xmin,u[1]=t.ymin,m[0]=t.xmax,m[1]=t.ymin;const r=e.paths;for(const o of r){if(!r.length)continue;let e=o[0];if(n(t,e))return!0;for(let r=1;r<o.length;r++){const i=o[r];if(n(t,i)||g(e,i,l))return!0;e=i}}return!1}function g(n,t,e){for(let r=0;r<e.length;r++)if(p(n,t,e[r][0],e[r][1]))return!0;return!1}function p(n,t,e,r,o){const[i,f]=n,[s,c]=t,[u,m]=e,[a,l]=r,x=a-u,h=i-u,y=s-i,g=l-m,p=f-m,z=c-f,G=g*y-x*z;if(0===G)return!1;const M=(x*p-g*h)/G,P=(y*p-z*h)/G;return M>=0&&M<=1&&P>=0&&P<=1&&(o&&(o[0]=i+M*(s-i),o[1]=f+M*(c-f)),!0)}function z(n,t,e){for(const r of t){const t=r.length;for(let o=1;o<t;o++){const t=r[o-1],i=r[o];let f=(i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1]);if(0===f)continue;f=Math.sqrt(f);const s=((i[0]-t[0])*(n[1]-t[1])-(i[1]-t[1])*(n[0]-t[0]))/f;if(Math.abs(s)<e){const r=((i[0]-t[0])*(n[0]-t[0])+(i[1]-t[1])*(n[1]-t[1]))/f;if(r>-e&&r<f+e)return!0}}}return!1}function G(n){const t=1e-6,e=n[0],r=n[n.length-1];return Math.abs(e[0]-r[0])<=t&&Math.abs(e[1]-r[1])<=t}function M(n,t){let e=0;for(const r of t){const t=r.length;for(let o=1;o<t;o++){const t=r[o-1],i=r[o];if(t[1]>n[1]==i[1]>n[1])continue;(i[0]-t[0])*(n[1]-t[1])-(i[1]-t[1])*(n[0]-t[0])>0?e++:e--}}return 0!==e}function P(n,t){const e=n.length>1&&!G(n)?[...n,n[0]]:n;for(const r of t){if(r.some(n=>M(n,[e])))return!0;if(G(r))for(const n of e)if(M(n,t))return!0;for(let n=1;n<r.length;n++){const t=r[n-1],o=r[n];for(let n=0;n<e.length;n++){if(p(t,o,e[n],e[(n+1)%e.length]))return!0}}}return!1}function Z(n){switch(n){case"esriGeometryEnvelope":case"extent":return i;case"esriGeometryMultipoint":case"multipoint":return f;case"esriGeometryPoint":case"point":return o;case"esriGeometryMultiPatch":case"multipatch":case"esriGeometryPolygon":case"polygon":return x;case"esriGeometryPolyline":case"polyline":return y}}export{i as extentIntersectsExtent,f as extentIntersectsMultipoint,o as extentIntersectsPoint,x as extentIntersectsPolygon,y as extentIntersectsPolyline,Z as getFeatureExtentIntersector,z as nearLine,M as pointInPolygon,p as segmentIntersects,P as targetIntersectsPolygon};
package/interfaces.d.ts CHANGED
@@ -6390,6 +6390,20 @@ declare namespace __esri {
6390
6390
  export type PopupFeature = import("./popup/Feature.js").default;
6391
6391
  export const PopupFeature: typeof import("./popup/Feature.js").default;
6392
6392
 
6393
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
6394
+ export type PopupFeatureContentProperties = import("./popup/FeatureContent.js").FeatureContentProperties;
6395
+
6396
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
6397
+ export type PopupFeatureContent = import("./popup/FeatureContent.js").default;
6398
+ export const PopupFeatureContent: typeof import("./popup/FeatureContent.js").default;
6399
+
6400
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
6401
+ export type PopupFeatureContentCollectionProperties = import("./popup/FeatureContentCollection.js").FeatureContentCollectionProperties;
6402
+
6403
+ /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
6404
+ export type PopupFeatureContentCollection = import("./popup/FeatureContentCollection.js").default;
6405
+ export const PopupFeatureContentCollection: typeof import("./popup/FeatureContentCollection.js").default;
6406
+
6393
6407
  /** @deprecated since 5.0. Refactor using \@arcgis/codemod */
6394
6408
  export type PopupFeaturesProperties = import("./popup/Features.js").FeaturesProperties;
6395
6409
 
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.61",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.63",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../core/Error.js";import{property as o,subclass as r}from"../core/accessorSupport/decorators.js";import i from"../geometry/Extent.js";import s from"../geometry/SpatialReference.js";import{create as a}from"../geometry/support/aaBoundingRect.js";import p from"./Layer.js";import{ScaleRangeLayer as n}from"./mixins/ScaleRangeLayer.js";import l from"./support/TileInfo.js";import{TileKey as m}from"./support/TileKey.js";const c=new m(0,0,0);let y=class extends(n(p)){constructor(e){super(e),this.tileInfo=l.create({spatialReference:s.WebMercator,size:256}),this.fullExtent=new i(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,s.WebMercator),this.spatialReference=s.WebMercator,this.type="base-elevation"}addResolvingPromise(e){super.addResolvingPromise(e)}getTileBounds(e,t,o,r){const i=r??a();return c.level=e,c.row=t,c.col=o,c.extent=i,this.tileInfo.updateTileInfo(c),i}fetchTile(){throw new t("BaseElevationLayer:fetchTile-not-implemented","fetchTile() is not implemented")}async queryElevation(e,t){const{query:o}=await this._importElevationQuery();return o(this,e,t)}createElevationSampler(e,t){return this._importElevationQuery().then(({createSampler:o})=>o(this,e,t))}_importElevationQuery(){return import("./support/ElevationQuery.js")}};e([o({type:l})],y.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],y.prototype,"listMode",void 0),e([o()],y.prototype,"fullExtent",void 0),e([o({type:s})],y.prototype,"spatialReference",void 0),e([o({readOnly:!0,value:"base-elevation"})],y.prototype,"type",void 0),y=e([r("esri.layers.BaseElevationLayer")],y);const f=y;export{f as default};
2
+ import{__decorate as e}from"tslib";import t from"../core/Error.js";import{property as o,subclass as r}from"../core/accessorSupport/decorators.js";import i from"../geometry/Extent.js";import s from"../geometry/SpatialReference.js";import{create as n}from"../geometry/support/aaBoundingRect.js";import a from"./Layer.js";import{ScaleRangeLayer as p}from"./mixins/ScaleRangeLayer.js";import l from"./support/TileInfo.js";import{TileKey as m}from"./support/TileKey.js";const c=new m(0,0,0);let u=class extends(p(a)){constructor(e){super(e),this.tileInfo=l.create({spatialReference:s.WebMercator,size:256}),this.fullExtent=new i(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,s.WebMercator),this.spatialReference=s.WebMercator,this.type="base-elevation"}get memoizedElevationQueryDependencies(){return[this.loadStatus,this.tileInfo,this.fullExtent,this.spatialReference]}addResolvingPromise(e){super.addResolvingPromise(e)}getTileBounds(e,t,o,r){const i=r??n();return c.level=e,c.row=t,c.col=o,c.extent=i,this.tileInfo.updateTileInfo(c),i}fetchTile(){throw new t("BaseElevationLayer:fetchTile-not-implemented","fetchTile() is not implemented")}async queryElevation(e,t){const{query:o}=await this._importElevationQuery();return o(this,e,t)}createElevationSampler(e,t){return this._importElevationQuery().then(({createSampler:o})=>o(this,e,t))}_importElevationQuery(){return import("./support/ElevationQuery.js")}};e([o({type:l})],u.prototype,"tileInfo",void 0),e([o({type:["show","hide"]})],u.prototype,"listMode",void 0),e([o()],u.prototype,"fullExtent",void 0),e([o({type:s})],u.prototype,"spatialReference",void 0),e([o()],u.prototype,"memoizedElevationQueryDependencies",null),e([o({readOnly:!0,value:"base-elevation"})],u.prototype,"type",void 0),u=e([r("esri.layers.BaseElevationLayer")],u);const y=u;export{y as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{releaseMaybe as i}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a,throwIfAborted as s}from"../core/promiseUtils.js";import{objectToQuery as l}from"../core/urlUtils.js";import{property as p,subclass as n}from"../core/accessorSupport/decorators.js";import c from"../geometry/HeightModelInfo.js";import d from"./Layer.js";import{ArcGISCachedService as u}from"./mixins/ArcGISCachedService.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{OperationalLayer as h}from"./mixins/OperationalLayer.js";import{PortalLayer as m}from"./mixins/PortalLayer.js";import{url as v}from"./support/commonProperties.js";import f from"./support/ElevationTileData.js";import{acquireDecoder as w}from"./support/LercDecoder.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";let S=class extends(u(y(h(m(o(d)))))){constructor(...e){super(...e),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=w()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._lercDecoder=i(this._lercDecoder)}readCapabilities(e,t){const r=t.capabilities&&t.capabilities.split(",").map(e=>e.toLowerCase().trim());if(!r)return{operations:{supportsTileMap:!1}};return{operations:{supportsTileMap:r.includes("tilemap")}}}readVersion(e,t){let r=t.currentVersion;return r||(r=9.3),r}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:e=>{if(e.typeKeywords)for(let t=0;t<e.typeKeywords.length;t++)if("elevation 3d layer"===e.typeKeywords[t].toLowerCase())return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}' ",{type:"Image Service",expectedType:"Image Service Elevation 3D Layer"})}},e).catch(a).then(()=>this._fetchImageService(t))),Promise.resolve(this)}async fetchTile(e,i,o,a){const s=a?.signal,l={responseType:"array-buffer",signal:s,useQueue:a?.useQueue,priority:a?.priority},p={noDataValue:a?.noDataValue,returnFileInfo:!0};await this.load(),await this._fetchTileAvailability(e,i,o,a);const n=await t(this.getTileUrl(e,i,o),l),c=await this._lercDecoder.decode(n.data,p,s);if(!c)throw new r("elevation-layer:tile-decode-failed","Failed to decode elevation tile data.");return new f({values:c.pixelData,width:c.width,height:c.height,noDataValue:c.noDataValue})}getTileUrl(e,t,r){const i=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,o=l({...this.parsedUrl.query,blankTile:!i&&null});return`${this.parsedUrl.path}/tile/${e}/${t}/${r}${o?"?"+o:""}`}async queryElevation(e,t){const{query:r}=await import("./support/ElevationQuery.js");return s(t),r(this,e,t)}async createElevationSampler(e,t){const{createSampler:r}=await import("./support/ElevationQuery.js");return s(t),r(this,e,t)}_fetchTileAvailability(e,t,r,i){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,t,r,i):Promise.resolve("unknown")}async _fetchImageService(e){if(this.sourceJSON)return this.sourceJSON;const r={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},i=await t(this.parsedUrl.path,r);i.ssl&&(this.url=this.url?.replace(/^http:/i,"https:")),this.sourceJSON=i.data,this.read(i.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[j]}};e([p({readOnly:!0})],S.prototype,"capabilities",void 0),e([g("service","capabilities",["capabilities"])],S.prototype,"readCapabilities",null),e([p({json:{read:{source:"copyrightText"}}})],S.prototype,"copyright",void 0),e([p({readOnly:!0,type:c})],S.prototype,"heightModelInfo",void 0),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],S.prototype,"path",void 0),e([p({type:["show","hide"]})],S.prototype,"listMode",void 0),e([p({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],S.prototype,"minScale",void 0),e([p({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],S.prototype,"maxScale",void 0),e([p({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],S.prototype,"opacity",void 0),e([p({type:["ArcGISTiledElevationServiceLayer"]})],S.prototype,"operationalLayerType",void 0),e([p()],S.prototype,"sourceJSON",void 0),e([p({json:{read:!1},value:"elevation",readOnly:!0})],S.prototype,"type",void 0),e([p(v)],S.prototype,"url",void 0),e([p()],S.prototype,"version",void 0),e([g("version",["currentVersion"])],S.prototype,"readVersion",null),S=e([n("esri.layers.ElevationLayer")],S);const j=Symbol("default-fetch-tile");S.prototype.fetchTile[j]=!0;const T=S;export{T as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import r from"../core/Error.js";import{releaseMaybe as i}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a,throwIfAborted as s}from"../core/promiseUtils.js";import{objectToQuery as l}from"../core/urlUtils.js";import{property as p,subclass as n}from"../core/accessorSupport/decorators.js";import c from"../geometry/HeightModelInfo.js";import d from"./Layer.js";import{ArcGISCachedService as u}from"./mixins/ArcGISCachedService.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{OperationalLayer as h}from"./mixins/OperationalLayer.js";import{PortalLayer as m}from"./mixins/PortalLayer.js";import{url as v}from"./support/commonProperties.js";import f from"./support/ElevationTileData.js";import{acquireDecoder as w}from"./support/LercDecoder.js";import{reader as g}from"../core/accessorSupport/decorators/reader.js";let S=class extends(u(y(h(m(o(d)))))){constructor(...e){super(...e),this.capabilities={operations:{supportsTileMap:!1}},this.copyright=null,this.heightModelInfo=null,this.path=null,this.minScale=void 0,this.maxScale=void 0,this.opacity=1,this.operationalLayerType="ArcGISTiledElevationServiceLayer",this.sourceJSON=null,this.type="elevation",this.url=null,this.version=null,this._lercDecoder=w()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this._lercDecoder=i(this._lercDecoder)}readCapabilities(e,t){const r=t.capabilities&&t.capabilities.split(",").map(e=>e.toLowerCase().trim());if(!r)return{operations:{supportsTileMap:!1}};return{operations:{supportsTileMap:r.includes("tilemap")}}}get memoizedElevationQueryDependencies(){return[this.loadStatus,this.tileInfo,this.fullExtent,this.spatialReference]}readVersion(e,t){let r=t.currentVersion;return r||(r=9.3),r}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"],supportsData:!1,validateItem:e=>{if(e.typeKeywords)for(let t=0;t<e.typeKeywords.length;t++)if("elevation 3d layer"===e.typeKeywords[t].toLowerCase())return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}' ",{type:"Image Service",expectedType:"Image Service Elevation 3D Layer"})}},e).catch(a).then(()=>this._fetchImageService(t))),Promise.resolve(this)}async fetchTile(e,i,o,a){const s=a?.signal,l={responseType:"array-buffer",signal:s,useQueue:a?.useQueue,priority:a?.priority},p={noDataValue:a?.noDataValue,returnFileInfo:!0};await this.load(),await this._fetchTileAvailability(e,i,o,a);const n=await t(this.getTileUrl(e,i,o),l),c=await this._lercDecoder.decode(n.data,p,s);if(!c)throw new r("elevation-layer:tile-decode-failed","Failed to decode elevation tile data.");return new f({values:c.pixelData,width:c.width,height:c.height,noDataValue:c.noDataValue})}getTileUrl(e,t,r){const i=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,o=l({...this.parsedUrl.query,blankTile:!i&&null});return`${this.parsedUrl.path}/tile/${e}/${t}/${r}${o?"?"+o:""}`}async queryElevation(e,t){const{query:r}=await import("./support/ElevationQuery.js");return s(t),r(this,e,t)}async createElevationSampler(e,t){const{createSampler:r}=await import("./support/ElevationQuery.js");return s(t),r(this,e,t)}_fetchTileAvailability(e,t,r,i){return this.tilemapCache?this.tilemapCache.fetchAvailability(e,t,r,i):Promise.resolve("unknown")}async _fetchImageService(e){if(this.sourceJSON)return this.sourceJSON;const r={query:{f:"json",...this.parsedUrl.query},responseType:"json",signal:e},i=await t(this.parsedUrl.path,r);i.ssl&&(this.url=this.url?.replace(/^http:/i,"https:")),this.sourceJSON=i.data,this.read(i.data,{origin:"service",url:this.parsedUrl})}get hasOverriddenFetchTile(){return!this.fetchTile[j]}};e([p({readOnly:!0})],S.prototype,"capabilities",void 0),e([g("service","capabilities",["capabilities"])],S.prototype,"readCapabilities",null),e([p({json:{read:{source:"copyrightText"}}})],S.prototype,"copyright",void 0),e([p({readOnly:!0,type:c})],S.prototype,"heightModelInfo",void 0),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],S.prototype,"path",void 0),e([p({type:["show","hide"]})],S.prototype,"listMode",void 0),e([p({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],S.prototype,"minScale",void 0),e([p({json:{read:!1,write:!1,origins:{service:{read:!1,write:!1},"portal-item":{read:!1,write:!1},"web-document":{read:!1,write:!1}}},readOnly:!0})],S.prototype,"maxScale",void 0),e([p({json:{read:!1,write:!1,origins:{"web-document":{read:!1,write:!1}}}})],S.prototype,"opacity",void 0),e([p({type:["ArcGISTiledElevationServiceLayer"]})],S.prototype,"operationalLayerType",void 0),e([p()],S.prototype,"sourceJSON",void 0),e([p({json:{read:!1},value:"elevation",readOnly:!0})],S.prototype,"type",void 0),e([p()],S.prototype,"memoizedElevationQueryDependencies",null),e([p(v)],S.prototype,"url",void 0),e([p()],S.prototype,"version",void 0),e([g("version",["currentVersion"])],S.prototype,"readVersion",null),S=e([n("esri.layers.ElevationLayer")],S);const j=Symbol("default-fetch-tile");S.prototype.fetchTile[j]=!0;const T=S;export{T as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as i}from"../core/Clonable.js";import r from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{on as n,sync as l}from"../core/reactiveUtils.js";import{property as p,subclass as m}from"../core/accessorSupport/decorators.js";import{persistable as c}from"../core/accessorSupport/decorators/persistable.js";import u from"../geometry/Extent.js";import d from"../geometry/SpatialReference.js";import h from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISService as y}from"./mixins/ArcGISService.js";import{CustomParametersMixin as g}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as S}from"./mixins/OperationalLayer.js";import{PortalLayer as _}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as v}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as j,url as T}from"./support/commonProperties.js";import x from"./support/SceneModifications.js";import{default3DTilesSpatialReference as w,default3DTilesFullExtent as b,initFullExtent as R,hasEsriCrs as L}from"./support/tiles3DUtils.js";import E from"../portal/Portal.js";import{logInvalidElevationInfoWarning as P,elevationModeRequiredMessage as k,featureExpressionUnsupportedMessage as I}from"../support/elevationInfoUtils.js";import{f as U}from"../chunks/persistableUrlUtils.js";import{isBasemap as O}from"../support/userTypeGuards/isBasemap.js";import{initialize as G,switchMeshModificationPolygonVCSSync as D}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as M,fromWasmModification as C}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as N}from"../core/accessorSupport/decorators/reader.js";let q=class extends(y(S(_(v(s(g(f(i(h))))))))){readModifications(e,t,i){this._modificationsSource={url:U(e,i),context:i}}initialize(){this.addHandles(n(()=>this.modifications,"after-changes",()=>this.modifications=this.modifications,l))}constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.modifications=null,this._modificationsSource=null,this.spatialReference=w,this.fullExtent=b,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._simulateGoogleUrl=!1}get supportedSpatialReferences(){return this.initialized&&this.esriCrsSpatialReference?[w,this.esriCrsSpatialReference]:[w]}get fullExtents(){return this.initialized&&this.esriCrsFullExtent?[b,this.esriCrsFullExtent]:[b]}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){const t=[e];for(;t?.length>0;){const e=t.pop();if(!e)return;for(const[r,o]of Object.entries(e)){if("uri"===r)try{const e=new URL("https://tmp"+o).searchParams.get("session");if(e)return e}catch(i){}"object"==typeof o&&null!==o&&t.push(o)}}return null}async requestRootAndSession(e){const i=(e,t)=>new r("3dtiles-init:"+e,t);return this._rootRequestPromise||(this._rootRequestPromise=new Promise((r,s)=>{this.url||s(i("url-missing","Layer url missing")),this._key=this.customParameters?this.customParameters.key:null;new Promise((e,r)=>{if(this.replacesTerrain&&!this._key){const o=this.portalItem?.portal||this.parent?.portalItem?.portal||E.getDefault();o.signIn().then(()=>{o.g3dTilesEnabled?t(o.restUrl+"/portals/self/modules/g3dtiles",{responseType:"json",query:{f:"json"}}).then(t=>{this._key=t.data.keyString,e()},()=>r(i("g3dtiles-key-error","Error fetching Google 3D Tiles key from portal"))):r(i("g3dTilesEnabled-false","Google 3D Tiles are not enabled on Portal "+o.url))},()=>r(i("sign-in-failed","Error signing in to Portal")))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:"array-buffer",signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse((new TextDecoder).decode(e.data))}catch(t){return void s(i("root-parse-failed","Error parsing root tile, details: "+t))}if(!this._rootTilesetJSON)return void s(i("root-is-null","Root tile is null."));this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=R(this._rootTilesetJSON);L(this._rootTilesetJSON)&&(this.esriCrsFullExtent=R(this._rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference),r(),this._rootRequestPromise=null},e=>{a(e),s(i("root-load-failed","Error loading root tile")),this._rootRequestPromise=null,o.getLogger("IntegratedMesh3DTilesLayer").error("Layer loading failed",e)})},e=>s(e))})),this._rootRequestPromise}_haveWGS84ZModifications(e){for(const t of e){if(!t.geometry?.spatialReference)return!0;if(115700===t.geometry?.spatialReference.vcsWkid&&4326===t.geometry?.spatialReference.wkid)return!0}return!1}async _doLoad(e){const t=null!=e?e.signal:null;if(this.isUsedAsGroundLayer&&!has("enable-feature:basemap-groundlayers"))throw new r("3dtiles-init:not-supported-in-groundlayers","Layer is not supported in basemap.");try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(i){a(i)}if(null!=this._modificationsSource){const t=await x.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await G();try{const e=M(null,t.toArray(),d.WGS84),i=D({modifications:e,inVCS:115700});i.success&&i.modifications&&C(i.modifications,t)}catch(s){o.getLogger(this).error("convert-mesh-modification-z-error","Error when converting:",s)}}this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(null==this._modificationsSource){const{modifications:e}=this;return void(e&&e.length>0&&await G())}await this.load().then(()=>{},()=>{})}get hasAttributionData(){return!1}_validateElevationInfo(e){const t="Integrated mesh 3d tiles layers";P(o.getLogger(this),k(t,"absolute-height",e)),P(o.getLogger(this),I(t,e))}get replacesTerrain(){return!!has("enable-feature:basemap-groundlayers")&&this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return O(this.parent)}get hasGoogleUrl(){return this._simulateGoogleUrl||!!this.url?.match(/.+\.googleapis.com/)}get test(){}};e([p({type:["IntegratedMesh3DTilesLayer"]})],q.prototype,"operationalLayerType",void 0),e([p({type:x,clonable:e=>e?.clone()??null}),c({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],q.prototype,"modifications",void 0),e([p({clonable:e=>e?{...e}:null})],q.prototype,"_modificationsSource",void 0),e([N(["web-scene","portal-item"],"modifications")],q.prototype,"readModifications",null),e([p({type:d})],q.prototype,"spatialReference",void 0),e([p({type:u})],q.prototype,"fullExtent",void 0),e([p({readOnly:!0})],q.prototype,"supportedSpatialReferences",null),e([p({type:[u]})],q.prototype,"fullExtents",null),e([p(j)],q.prototype,"elevationInfo",null),e([p({type:["show","hide"]})],q.prototype,"listMode",void 0),e([p(T)],q.prototype,"url",void 0),e([p({readOnly:!0})],q.prototype,"type",void 0),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],q.prototype,"path",void 0),e([p({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],q.prototype,"minScale",void 0),e([p({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],q.prototype,"maxScale",void 0),e([p({readOnly:!0})],q.prototype,"hasAttributionData",null),e([p()],q.prototype,"replacesTerrain",null),e([p()],q.prototype,"isUsedAsGroundLayer",null),e([p()],q.prototype,"hasGoogleUrl",null),e([p()],q.prototype,"_simulateGoogleUrl",void 0),q=e([m("esri.layers.IntegratedMesh3DTilesLayer")],q);const A=q;export{A as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{ClonableMixin as i}from"../core/Clonable.js";import r from"../core/Error.js";import has from"../core/has.js";import o from"../core/Logger.js";import{MultiOriginJSONSupportMixin as s}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as n}from"../core/promiseUtils.js";import{on as a,sync as l,watch as p}from"../core/reactiveUtils.js";import{property as m,subclass as c}from"../core/accessorSupport/decorators.js";import{persistable as d}from"../core/accessorSupport/decorators/persistable.js";import u from"../geometry/Extent.js";import h from"../geometry/SpatialReference.js";import f from"./Layer.js";import{APIKeyMixin as y}from"./mixins/APIKeyMixin.js";import{ArcGISService as g}from"./mixins/ArcGISService.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as j}from"./mixins/ScaleRangeLayer.js";import{elevationInfo as T,url as x}from"./support/commonProperties.js";import b from"./support/SceneModifications.js";import{default3DTilesSpatialReference as w,default3DTilesFullExtent as R,initFullExtent as L,hasEsriCrs as E}from"./support/tiles3DUtils.js";import k from"../portal/Portal.js";import{getElevationOffsetInMeters as G,logInvalidElevationInfoWarning as P,elevationModeRequiredMessage as I,featureExpressionUnsupportedMessage as U}from"../support/elevationInfoUtils.js";import{f as D}from"../chunks/persistableUrlUtils.js";import{isBasemap as O}from"../support/userTypeGuards/isBasemap.js";import{initialize as C,switchMeshModificationPolygonVCSSync as M}from"../views/3d/layers/Lyr3DWorker.js";import{toWasmModification as q,fromWasmModification as N}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{reader as A}from"../core/accessorSupport/decorators/reader.js";let J=class extends(g(_(v(j(s(S(y(i(f))))))))){readModifications(e,t,i){this._modificationsSource={url:D(e,i),context:i}}initialize(){this.addHandles([a(()=>this.modifications,"after-changes",()=>{this.modifications=this.modifications,this._modificationsGeneration++},l),p(()=>this.modifications,()=>this._modificationsGeneration++)])}constructor(e){super(e),this.operationalLayerType="IntegratedMesh3DTilesLayer",this.modifications=null,this._modificationsSource=null,this.spatialReference=w,this.fullExtent=R,this.esriCrsSpatialReference=null,this.esriCrsFullExtent=null,this.url=null,this.type="integrated-mesh-3dtiles",this.path=null,this.minScale=0,this.maxScale=0,this._rootTilesetJSON=null,this._rootTileset=null,this._key=null,this._session=null,this._rootRequestPromise=null,this.queryElevationCallback=null,this._modificationsGeneration=0,this._simulateGoogleUrl=!1}get supportedSpatialReferences(){return this.initialized&&this.esriCrsSpatialReference?[w,this.esriCrsSpatialReference]:[w]}get fullExtents(){return this.initialized&&this.esriCrsFullExtent?[R,this.esriCrsFullExtent]:[R]}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get rootTilesetJSON(){return this._rootTilesetJSON}get rootTileset(){return this._rootTileset}get key(){return this._key}get session(){return this._session}_findSessionParameter(e){const t=[e];for(;t?.length>0;){const e=t.pop();if(!e)return;for(const[r,o]of Object.entries(e)){if("uri"===r)try{const e=new URL("https://tmp"+o).searchParams.get("session");if(e)return e}catch(i){}"object"==typeof o&&null!==o&&t.push(o)}}return null}async requestRootAndSession(e){const i=(e,t)=>new r("3dtiles-init:"+e,t);return this._rootRequestPromise||(this._rootRequestPromise=new Promise((r,s)=>{this.url||s(i("url-missing","Layer url missing")),this._key=this.customParameters?this.customParameters.key:null;new Promise((e,r)=>{if(this.replacesTerrain&&!this._key){const o=this.portalItem?.portal||this.parent?.portalItem?.portal||k.getDefault();o.signIn().then(()=>{o.g3dTilesEnabled?t(o.restUrl+"/portals/self/modules/g3dtiles",{responseType:"json",query:{f:"json"}}).then(t=>{this._key=t.data.keyString,e()},()=>r(i("g3dtiles-key-error","Error fetching Google 3D Tiles key from portal"))):r(i("g3dTilesEnabled-false","Google 3D Tiles are not enabled on Portal "+o.url))},()=>r(i("sign-in-failed","Error signing in to Portal")))}else e()}).then(()=>{t(this.url,{query:this._key?{key:this._key,token:this.apiKey}:{token:this.apiKey},responseType:"array-buffer",signal:e}).then(e=>{try{this._rootTilesetJSON=JSON.parse((new TextDecoder).decode(e.data))}catch(t){return void s(i("root-parse-failed","Error parsing root tile, details: "+t))}if(!this._rootTilesetJSON)return void s(i("root-is-null","Root tile is null."));this._session=this._findSessionParameter(this._rootTilesetJSON),this._rootTileset=e.data,this.fullExtent=L(this._rootTilesetJSON);E(this._rootTilesetJSON)&&(this.esriCrsFullExtent=L(this._rootTilesetJSON,!0),this.esriCrsSpatialReference=this.esriCrsFullExtent.spatialReference,this.spatialReference=this.esriCrsSpatialReference),r(),this._rootRequestPromise=null},e=>{n(e),s(i("root-load-failed","Error loading root tile")),this._rootRequestPromise=null,o.getLogger("IntegratedMesh3DTilesLayer").error("Layer loading failed",e)})},e=>s(e))})),this._rootRequestPromise}_haveWGS84ZModifications(e){for(const t of e){if(!t.geometry?.spatialReference)return!0;if(115700===t.geometry?.spatialReference.vcsWkid&&4326===t.geometry?.spatialReference.wkid)return!0}return!1}async _doLoad(e){const t=null!=e?e.signal:null;if(this.isUsedAsGroundLayer&&!has("enable-feature:basemap-groundlayers"))throw new r("3dtiles-init:not-supported-in-groundlayers","Layer is not supported in basemap.");try{await this.loadFromPortal({supportedTypes:["3DTiles Service"],validateItem:e=>{if(e.typeKeywords?.includes("IntegratedMesh"))return!0;throw new r("portal:invalid-layer-item-type","Invalid layer item, expected '${expectedType}' ",{expectedType:"3DTiles Service containing IntegratedMesh"})}},e)}catch(i){n(i)}if(null!=this._modificationsSource){const t=await b.fromUrl(this._modificationsSource.url,this.spatialReference,e,!0);if(this._haveWGS84ZModifications(t)){await C();try{const e=q(null,t.toArray(),h.WGS84),i=M({modifications:e,inVCS:115700});i.success&&i.modifications&&N(i.modifications,t)}catch(s){o.getLogger(this).error("convert-mesh-modification-z-error","Error when converting:",s)}}this.setAtOrigin("modifications",t,this._modificationsSource.context.origin),this._modificationsSource=null}await this.requestRootAndSession(t)}async beforeSave(){if(null==this._modificationsSource){const{modifications:e}=this;return void(e&&e.length>0&&await C())}await this.load().then(()=>{},()=>{})}get memoizedElevationQueryDependencies(){return[this.loadStatus,null!=this.queryElevationCallback,G(this.elevationInfo),this._modificationsGeneration]}get hasAttributionData(){return!1}_validateElevationInfo(e){const t="Integrated mesh 3d tiles layers";P(o.getLogger(this),I(t,"absolute-height",e)),P(o.getLogger(this),U(t,e))}get replacesTerrain(){return!!has("enable-feature:basemap-groundlayers")&&this.hasGoogleUrl&&this.isUsedAsGroundLayer}get isUsedAsGroundLayer(){return O(this.parent)}get hasGoogleUrl(){return this._simulateGoogleUrl||!!this.url?.match(/.+\.googleapis.com/)}get test(){}};e([m({type:["IntegratedMesh3DTilesLayer"]})],J.prototype,"operationalLayerType",void 0),e([m({type:b,clonable:e=>e?.clone()??null}),d({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],J.prototype,"modifications",void 0),e([m({clonable:e=>e?{...e}:null})],J.prototype,"_modificationsSource",void 0),e([A(["web-scene","portal-item"],"modifications")],J.prototype,"readModifications",null),e([m({type:h})],J.prototype,"spatialReference",void 0),e([m({type:u})],J.prototype,"fullExtent",void 0),e([m({readOnly:!0})],J.prototype,"supportedSpatialReferences",null),e([m({type:[u]})],J.prototype,"fullExtents",null),e([m(T)],J.prototype,"elevationInfo",null),e([m({type:["show","hide"]})],J.prototype,"listMode",void 0),e([m(x)],J.prototype,"url",void 0),e([m({readOnly:!0})],J.prototype,"type",void 0),e([m({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],J.prototype,"path",void 0),e([m({type:Number,json:{name:"layerDefinition.minScale",write:!0,origins:{service:{read:!1,write:!1}}}})],J.prototype,"minScale",void 0),e([m({type:Number,json:{name:"layerDefinition.maxScale",write:!0,origins:{service:{read:!1,write:!1}}}})],J.prototype,"maxScale",void 0),e([m()],J.prototype,"queryElevationCallback",void 0),e([m()],J.prototype,"_modificationsGeneration",void 0),e([m()],J.prototype,"memoizedElevationQueryDependencies",null),e([m({readOnly:!0})],J.prototype,"hasAttributionData",null),e([m()],J.prototype,"replacesTerrain",null),e([m()],J.prototype,"isUsedAsGroundLayer",null),e([m()],J.prototype,"hasGoogleUrl",null),e([m()],J.prototype,"_simulateGoogleUrl",void 0),J=e([c("esri.layers.IntegratedMesh3DTilesLayer")],J);const z=J;export{z as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{fetchAndConvertSerializedKnowledgeIdMap as i,serializeInclusionDefinitionToIdCollectionsMapPbf as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{watch as d,sync as h}from"../core/reactiveUtils.js";import{isAbsolute as p,join as y}from"../core/urlUtils.js";import{generateUUID as c}from"../core/uuid.js";import{property as m,subclass as u}from"../core/accessorSupport/decorators.js";import{idToName as f,nameToId as g}from"../core/accessorSupport/PropertyOrigin.js";import w from"./Layer.js";import{KnowledgeGraphLayerDataManager as M}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getTitleFromServerUrl as T,initializeLayersFromClientData as D,getUserKGSPrivileges as _,createCapabilitiesFromKnowledgeGraph as S}from"./knowledgeGraph/layerUtils.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{CustomParametersMixin as k}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as C}from"./mixins/PortalLayer.js";import{RefreshableLayer as I}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as A}from"./mixins/ScaleRangeLayer.js";import{url as G}from"./support/commonProperties.js";import{getCreationDatesForResources as N,areResourcesSafe as E}from"../linkChart/utils.js";import{fetchKnowledgeGraph as x}from"../rest/knowledgeGraphService.js";import{f as R,t as O}from"../chunks/persistableUrlUtils.js";import{timeZoneProperty as U}from"../time/timeZoneUtils.js";import{reader as K}from"../core/accessorSupport/decorators/reader.js";import{writer as P}from"../core/accessorSupport/decorators/writer.js";let F=class extends(L(A(I(v(j(C(r(k(w))))))))){constructor(e){super(e),this._graphTypeLookup=new Map,this._namedTypesModified=!1,this._idMapCreationDate=null,this.dataManager=null,this.definitionSetMap=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="KnowledgeGraphLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="knowledge-graph",this.url=null,!e?.title&&e?.url&&(this.title=T(e.url)),this.addHandles(d(()=>this.layers.concat(this.tables),(e,i)=>this._handleSublayersChange(e,i),h))}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){try{await this.loadFromPortal({supportedTypes:["Knowledge Graph Layer"]},e)}catch(i){l(i)}await this._fetchMetadata(e),await this._initializeLayerProperties(e),this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await D(this)}async _fetchMetadata(e){if(!this.url)throw new s("knowledge-graph:missing-url","KnowledgeGraphLayer must be created with a url");const i=await x(this.url);this.knowledgeGraph=i;const{edit:t,fullEdit:a,updateItem:n}=await _(i.serviceDefinition.serviceItemId,this.url,e);this._set("userHasEditingPrivileges",t),this._set("userHasFullEditingPrivileges",a),this._set("userHasUpdateItemPrivileges",n),this.read({dateFieldsTimeReference:i.serviceDefinition.dateFieldsTimeReference},{origin:"service"}),this._forEachGraphType(e=>{e.name&&this._graphTypeLookup.set(e.name,e)})}async _initializeLayerProperties(e){7===this.originIdOf("inclusionModeDefinition")?this._validateInclusionModeDefinition():await this._initializeInclusionModeDefinition(e),this._setMemberTypes(),this.dataManager=new M({knowledgeGraph:this.knowledgeGraph,inclusionModeDefinition:this.inclusionModeDefinition})}async _initializeInclusionModeDefinition(e){this._idMapCreationDate=(await N([this.definitionSetMap??""],this.portalItem?.itemUrl??"")).get(this.definitionSetMap??"")??null;const t=this.definitionSetMap?await i(this.definitionSetMap,!0,e?.signal?{signal:e.signal}:void 0):{generateAllSublayers:!0,namedTypeDefinitions:new Map};[...this.layers.toArray(),...this.tables.toArray()].forEach(e=>{const i=this._graphTypeLookup.get(e.graphTypeName);i&&!t.namedTypeDefinitions.has(i.name)&&t.namedTypeDefinitions.set(i.name,{useAllData:!0})}),this.setAtOrigin("inclusionModeDefinition",t,f(this.originIdOf("definitionSetMap")))}_validateInclusionModeDefinition(){const{inclusionModeDefinition:e}=this;if(!e)return;const{namedTypeDefinitions:i}=e;if(i?.size>0)i.forEach((e,t)=>{const a=this._graphTypeLookup.get(t);if(!a)return n.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't in the data model and will be removed`),void i.delete(t);"relationship"!==a.type&&"entity"!==a.type&&(n.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't properly modeled and will be removed`),i.delete(t))});else if(!e.generateAllSublayers)throw new s("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined")}_setMemberTypes(){let e=[],i=[];const{inclusionModeDefinition:t}=this,a=t?.namedTypeDefinitions;!t||t.generateAllSublayers?(e=this.knowledgeGraph.dataModel?.entityTypes??[],i=this.knowledgeGraph.dataModel?.relationshipTypes??[]):a&&a.size>0&&a.forEach((t,a)=>{const s=this._graphTypeLookup.get(a);switch(s?.type){case"relationship":i.push(s);break;case"entity":e.push(s)}}),this.memberEntityTypes=e,this.memberRelationshipTypes=i}_forEachGraphType(e){[...this.knowledgeGraph.dataModel?.entityTypes??[],...this.knowledgeGraph.dataModel?.relationshipTypes??[]].forEach(i=>{e(i)})}_refreshNamedTypes(){this._namedTypesModified=!0;for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}async _handleNewRecords(e){const i=new Set,t=[];for(const a of e){if(!this._graphTypeLookup.has(a.typeName))continue;!1===this.layers.concat(this.tables).some(e=>e.objectType.name===a.typeName)&&(this.dataManager.sublayerCaches.set(a.typeName,new Map),i.add(a.typeName));o(this.sublayerIdsCache,a.typeName,()=>new Set).add(a.id),t.push(a)}this.dataManager.addToLayer(t);for(const a of i){const e=this._graphTypeLookup.get(a);e&&(this._addSublayer(e),"entity"===e.type?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a))}await D(this,Array.from(i)),this._refreshNamedTypes()}_createSublayers(e,i,t){e.forEach(e=>{const a=this._createSublayer(e);t(a)&&i.push(a),this._updateSublayerCaches(e)})}_addSublayer(e){const i=this._createSublayer(e);return i.geometryType?this.layers.push(i):this.tables.push(i),i}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_updateSublayers(e,i){i.forEach(i=>{i.parentCompositeLayer=this;const t=e.find(e=>e.type===i.graphType&&e.name===i.graphTypeName);t&&(i.objectType=t,this._updateSublayerCaches(t))})}_updateSublayerCaches({name:e}){if(!e)return;const i=this.dataManager.sublayerCaches;i.has(e)||i.set(e,new Map)}_saveUrlAsNewResource(e,i,t,a,s,n){H(this.inclusionModeDefinition).then(n=>{const o=$(a);e[i]=o.itemRelativeUrl,t.toAdd.push({resource:o,content:{type:"blob",blob:n},compress:!1,finish:e=>{this.definitionSetMap=e.url}}),s()}).catch(e=>{n(e)})}_displaysAllRecords(e){for(const[,{useAllData:i}]of e.namedTypeDefinitions)if(!i)return!1;return!0}_handleSublayersChange(e,i){i&&(i.forEach(e=>{e.parent=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this}),e.on("after-remove",({item:e})=>{e.parent=null})],"sublayers-owner"))}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=3&&e<7}readDefinitionSetMap(e,i,t){return R(e,t)}writeDefinitionSetMap(e,i,t,a){const s=a?.portalItem,n=a?.resources,o=g(a?.origin);i[t]="<pending>",n?.pendingOperations.push(new Promise((r,l)=>{E(e??"",s?.itemUrl??"",this._idMapCreationDate).then(d=>{if(!s||!n||null==o)return e&&(i[t]=O(e,a)),void r();const{inclusionModeDefinition:h}=this;if(!h||this._displaysAllRecords(h))return this.definitionSetMap=null,void r();const y=this.originIdOf("inclusionModeDefinition");if(7===y||this._namedTypesModified||!d||o<y)this._saveUrlAsNewResource(i,t,n,s,r,l);else{if(o===y&&e){const o=O(e,a);return void(p(o)?this._saveUrlAsNewResource(i,t,n,s,r,l):(i[t]=o,r()))}r()}}).catch(e=>{l(e)})}))}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):n.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}get sublayerCapabilities(){return S(this.knowledgeGraph)}loadLayerAssumingLocalCache(){const e=[...this.memberEntityTypes,...this.memberRelationshipTypes];this.layers.length||0===this.originIdOf("tables")?0===this.originIdOf("layers")?this._createSublayers(e,this.layers,e=>!!e.geometryType):this._updateSublayers(e,this.layers):this.layers=new a,this.tables.length||0===this.originIdOf("layers")?0===this.originIdOf("tables")?this._createSublayers(e,this.tables,e=>!e.geometryType):this._updateSublayers(e,this.tables):this.tables=new a,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,i)=>{const t=o(this.sublayerIdsCache,i,()=>new Set);e.members?.forEach(e=>{t.add(e.id)})})}async addRecords(e){await this.load(),await this._handleNewRecords(e)}async createSublayerForNamedType(e){await this.load();const i=this._graphTypeLookup.get(e);if(!i)throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),o(this.sublayerIdsCache,e,()=>new Set);const t=this._addSublayer(i);return"entity"===i.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),await D(this,[e]),this._refreshNamedTypes(),t}convertSublayerToDynamicData(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);i?.useAllData?n.getLogger(this).warn("This Knowledge Graph Layer already uses dynamic membership for the sublayer - no conversion was made"):(this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),this.sublayerIdsCache.delete(e),this._refreshNamedTypes())}convertSublayerToExplicitMembership(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);if(!i||i.useAllData){if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");this.sublayerIdsCache.set(e,new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),this._refreshNamedTypes()}else n.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership for the sublayer - no conversion was made")}convertToFullyDynamicData(){this.dataManager.inclusionModeDefinition?(this.sublayerIdsCache.clear(),this.dataManager.inclusionModeDefinition=null,this._set("inclusionModeDefinition",this.dataManager.inclusionModeDefinition),this._refreshNamedTypes()):n.getLogger(this).warn("This Knowledge Graph Layer already uses fully dynamic membership - no conversion was made")}convertToExplicitMembership(){if(this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.size>0&&[...this.dataManager.inclusionModeDefinition.namedTypeDefinitions.values()].every(e=>!1===e.useAllData))n.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership - no conversion was made");else{this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map};for(const e of this.dataManager.sublayerCaches.keys())o(this.sublayerIdsCache,e,()=>new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map});this._set("inclusionModeDefinition",this.dataManager.inclusionModeDefinition),this._refreshNamedTypes()}}async removeRecords(e){await this.load();const i=[];for(const t of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.members?.has(t.id)&&i.push(t);this.dataManager.removeFromLayer(i);for(const t of i)this.sublayerIdsCache.get(t.typeName)?.delete(t.id);return this._refreshNamedTypes(),i}};e([m()],F.prototype,"dataManager",void 0),e([m({json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],F.prototype,"definitionSetMap",void 0),e([K("definitionSetMap")],F.prototype,"readDefinitionSetMap",null),e([P("definitionSetMap")],F.prototype,"writeDefinitionSetMap",null),e([m()],F.prototype,"inclusionModeDefinition",null),e([m()],F.prototype,"knowledgeGraph",void 0),e([m({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],F.prototype,"layers",void 0),e([m()],F.prototype,"memberEntityTypes",void 0),e([m()],F.prototype,"memberRelationshipTypes",void 0),e([m({type:["KnowledgeGraphLayer"]})],F.prototype,"operationalLayerType",void 0),e([m()],F.prototype,"sublayerCapabilities",null),e([m()],F.prototype,"sublayerIdsCache",void 0),e([m({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],F.prototype,"tables",void 0),e([m({json:{read:!1}})],F.prototype,"type",void 0),e([m(G)],F.prototype,"url",void 0),e([m(U("dateFieldsTimeReference"))],F.prototype,"dateFieldsTimeZone",void 0),F=e([u("esri.layers.KnowledgeGraphLayer")],F);const z=F;async function H(e){const i=await t(e);return new Blob([i],{type:"application/x-protobuf"})}function $(e){const i=`definitionSetMap-${c()}.dat`,t=y("knowledgeGraphLayer",i);return e.resourceFromPath(t)}export{z as default};
2
+ import{__decorate as e}from"tslib";import{fetchAndConvertSerializedKnowledgeIdMap as i,serializeInclusionDefinitionToIdCollectionsMapPbf as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import s from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{watch as d,sync as h}from"../core/reactiveUtils.js";import{isAbsolute as p,join as y}from"../core/urlUtils.js";import{generateUUID as c}from"../core/uuid.js";import{property as u,subclass as m}from"../core/accessorSupport/decorators.js";import{idToName as f,nameToId as g}from"../core/accessorSupport/PropertyOrigin.js";import w from"./Layer.js";import{KnowledgeGraphLayerDataManager as M}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{getTitleFromServerUrl as T,initializeLayersFromClientData as D,getUserKGSPrivileges as _,createCapabilitiesFromKnowledgeGraph as S}from"./knowledgeGraph/layerUtils.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{CustomParametersMixin as k}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as C}from"./mixins/PortalLayer.js";import{RefreshableLayer as A}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as N}from"./mixins/ScaleRangeLayer.js";import{url as G}from"./support/commonProperties.js";import{getCreationDatesForResources as I,areResourcesSafe as E}from"../linkChart/utils.js";import{fetchKnowledgeGraph as R}from"../rest/knowledgeGraphService.js";import{c as x,t as O,f as U}from"../chunks/persistableUrlUtils.js";import{timeZoneProperty as K}from"../time/timeZoneUtils.js";import{reader as P}from"../core/accessorSupport/decorators/reader.js";import{writer as F}from"../core/accessorSupport/decorators/writer.js";let z=class extends(L(N(A(v(j(C(r(k(w))))))))){constructor(e){super(e),this._graphTypeLookup=new Map,this._namedTypesModified=!1,this._idMapCreationDate=null,this.dataManager=null,this.definitionSetMap=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="KnowledgeGraphLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="knowledge-graph",this.url=null,!e?.title&&e?.url&&(this.title=T(e.url)),this.addHandles(d(()=>this.layers.concat(this.tables),(e,i)=>this._handleSublayersChange(e,i),h))}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){try{await this.loadFromPortal({supportedTypes:["Knowledge Graph Layer"]},e)}catch(i){l(i)}await this._fetchMetadata(e),await this._initializeLayerProperties(e),this.loadLayerAssumingLocalCache(),this._layersLoadedFromAuthoritativeItem()||await D(this)}async _fetchMetadata(e){if(!this.url)throw new s("knowledge-graph:missing-url","KnowledgeGraphLayer must be created with a url");const i=await R(this.url);this.knowledgeGraph=i;const{edit:t,fullEdit:a,updateItem:n}=await _(i.serviceDefinition.serviceItemId,this.url,e);this._set("userHasEditingPrivileges",t),this._set("userHasFullEditingPrivileges",a),this._set("userHasUpdateItemPrivileges",n),this.read({dateFieldsTimeReference:i.serviceDefinition.dateFieldsTimeReference},{origin:"service"}),this._forEachGraphType(e=>{e.name&&this._graphTypeLookup.set(e.name,e)})}async _initializeLayerProperties(e){7===this.originIdOf("inclusionModeDefinition")?this._validateInclusionModeDefinition():await this._initializeInclusionModeDefinition(e),this._setMemberTypes(),this.dataManager=new M({knowledgeGraph:this.knowledgeGraph,inclusionModeDefinition:this.inclusionModeDefinition})}async _initializeInclusionModeDefinition(e){const t=this.definitionSetMap;if(t){const e=x(t),i=e?await I([t],e):null;this._idMapCreationDate=i?.get(t)??null}const a=t?await i(t,!0,e?.signal?{signal:e.signal}:void 0):{generateAllSublayers:!0,namedTypeDefinitions:new Map};[...this.layers.toArray(),...this.tables.toArray()].forEach(e=>{const i=this._graphTypeLookup.get(e.graphTypeName);i&&!a.namedTypeDefinitions.has(i.name)&&a.namedTypeDefinitions.set(i.name,{useAllData:!0})}),this.setAtOrigin("inclusionModeDefinition",a,f(this.originIdOf("definitionSetMap")))}_validateInclusionModeDefinition(){const{inclusionModeDefinition:e}=this;if(!e)return;const{namedTypeDefinitions:i}=e;if(i?.size>0)i.forEach((e,t)=>{const a=this._graphTypeLookup.get(t);if(!a)return n.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't in the data model and will be removed`),void i.delete(t);"relationship"!==a.type&&"entity"!==a.type&&(n.getLogger(this).warn(`A named type, ${t}, was in the inclusion list that wasn't properly modeled and will be removed`),i.delete(t))});else if(!e.generateAllSublayers)throw new s("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined")}_setMemberTypes(){let e=[],i=[];const{inclusionModeDefinition:t}=this,a=t?.namedTypeDefinitions;!t||t.generateAllSublayers?(e=this.knowledgeGraph.dataModel?.entityTypes??[],i=this.knowledgeGraph.dataModel?.relationshipTypes??[]):a&&a.size>0&&a.forEach((t,a)=>{const s=this._graphTypeLookup.get(a);switch(s?.type){case"relationship":i.push(s);break;case"entity":e.push(s)}}),this.memberEntityTypes=e,this.memberRelationshipTypes=i}_forEachGraphType(e){[...this.knowledgeGraph.dataModel?.entityTypes??[],...this.knowledgeGraph.dataModel?.relationshipTypes??[]].forEach(i=>{e(i)})}_refreshNamedTypes(){this._namedTypesModified=!0;for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}async _handleNewRecords(e){const i=new Set,t=[];for(const a of e){if(!this._graphTypeLookup.has(a.typeName))continue;!1===this.layers.concat(this.tables).some(e=>e.objectType.name===a.typeName)&&(this.dataManager.sublayerCaches.set(a.typeName,new Map),i.add(a.typeName));o(this.sublayerIdsCache,a.typeName,()=>new Set).add(a.id),t.push(a)}this.dataManager.addToLayer(t);for(const a of i){const e=this._graphTypeLookup.get(a);e&&(this._addSublayer(e),"entity"===e.type?this.dataManager.entityTypeNames.add(a):this.dataManager.relationshipTypeNames.add(a))}await D(this,Array.from(i)),this._refreshNamedTypes()}_createSublayers(e,i,t){e.forEach(e=>{const a=this._createSublayer(e);t(a)&&i.push(a),this._updateSublayerCaches(e)})}_addSublayer(e){const i=this._createSublayer(e);return i.geometryType?this.layers.push(i):this.tables.push(i),i}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_updateSublayers(e,i){i.forEach(i=>{i.parentCompositeLayer=this;const t=e.find(e=>e.type===i.graphType&&e.name===i.graphTypeName);t&&(i.objectType=t,this._updateSublayerCaches(t))})}_updateSublayerCaches({name:e}){if(!e)return;const i=this.dataManager.sublayerCaches;i.has(e)||i.set(e,new Map)}_saveUrlAsNewResource(e,i,t,a){return $(this.inclusionModeDefinition).then(s=>{const n=B(a);e[i]=n.itemRelativeUrl,t.toAdd.push({resource:n,content:{type:"blob",blob:s},compress:!1,finish:e=>{this.definitionSetMap=e.url}})})}_displaysAllRecords(e){for(const[,{useAllData:i}]of e.namedTypeDefinitions)if(!i)return!1;return!0}_handleSublayersChange(e,i){i&&(i.forEach(e=>{e.parent=null}),this.removeHandles("sublayers-owner")),e&&(e.forEach(e=>{e.parent=this}),this.addHandles([e.on("after-add",({item:e})=>{e.parent=this}),e.on("after-remove",({item:e})=>{e.parent=null})],"sublayers-owner"))}_layersLoadedFromAuthoritativeItem(){const e=this.originIdOf("layers");return e>=3&&e<7}async _checkResourceSafety(e,i,t,a,s,n){if(!await E(e??"",s?.itemUrl??"",this._idMapCreationDate))return this._saveUrlAsNewResource(i,t,a,s);const o=O(e,n);if(p(o))return this._saveUrlAsNewResource(i,t,a,s);i[t]=o}readDefinitionSetMap(e,i,t){return U(e,t)}writeDefinitionSetMap(e,i,t,a){const s=a?.portalItem,n=a?.resources,o=g(a?.origin);if(!s||!n||null==o)return void(e&&(i[t]=O(e,a)));const{inclusionModeDefinition:r}=this;if(!r||this._displaysAllRecords(r))return void(this.definitionSetMap=null);const l=this.originIdOf("inclusionModeDefinition");if(7===l||this._namedTypesModified||o<l)return i[t]="<pending>",void n.pendingOperations.push(this._saveUrlAsNewResource(i,t,n,s));o===l&&e&&(i[t]="<pending>",n.pendingOperations.push(this._checkResourceSafety(e,i,t,n,s,a)))}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):n.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}get sublayerCapabilities(){return S(this.knowledgeGraph)}loadLayerAssumingLocalCache(){const e=[...this.memberEntityTypes,...this.memberRelationshipTypes];this.layers.length||0===this.originIdOf("tables")?0===this.originIdOf("layers")?this._createSublayers(e,this.layers,e=>!!e.geometryType):this._updateSublayers(e,this.layers):this.layers=new a,this.tables.length||0===this.originIdOf("layers")?0===this.originIdOf("tables")?this._createSublayers(e,this.tables,e=>!e.geometryType):this._updateSublayers(e,this.tables):this.tables=new a,this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach((e,i)=>{const t=o(this.sublayerIdsCache,i,()=>new Set);e.members?.forEach(e=>{t.add(e.id)})})}async addRecords(e){await this.load(),await this._handleNewRecords(e)}async createSublayerForNamedType(e){await this.load();const i=this._graphTypeLookup.get(e);if(!i)throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type already exists as a sublayer.");this.dataManager.sublayerCaches.set(e,new Map),o(this.sublayerIdsCache,e,()=>new Set);const t=this._addSublayer(i);return"entity"===i.type?this.dataManager.entityTypeNames.add(e):this.dataManager.relationshipTypeNames.add(e),this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),await D(this,[e]),this._refreshNamedTypes(),t}convertSublayerToDynamicData(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);i?.useAllData?n.getLogger(this).warn("This Knowledge Graph Layer already uses dynamic membership for the sublayer - no conversion was made"):(this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!0}),this.sublayerIdsCache.delete(e),this._refreshNamedTypes())}convertSublayerToExplicitMembership(e){if(!this.dataManager.inclusionModeDefinition)throw new s("knowledge-graph:fully-dynamic-membership","This Knowledge Graph Layer already uses fully dynamic membership, individual sublayers cannot be converted");if(!this._graphTypeLookup.get(e))throw new s("knowledge-graph:missing-type","The specified type does not exist in the layer's graph data model.");const i=this.dataManager.inclusionModeDefinition.namedTypeDefinitions.get(e);if(!i||i.useAllData){if(!this.dataManager.sublayerCaches.has(e))throw new s("knowledge-graph:duplicate-type","The specified type does not exist as a sublayer.");this.sublayerIdsCache.set(e,new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map}),this._refreshNamedTypes()}else n.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership for the sublayer - no conversion was made")}convertToFullyDynamicData(){this.dataManager.inclusionModeDefinition?(this.sublayerIdsCache.clear(),this.dataManager.inclusionModeDefinition=null,this._set("inclusionModeDefinition",this.dataManager.inclusionModeDefinition),this._refreshNamedTypes()):n.getLogger(this).warn("This Knowledge Graph Layer already uses fully dynamic membership - no conversion was made")}convertToExplicitMembership(){if(this.dataManager.inclusionModeDefinition&&this.dataManager.inclusionModeDefinition.namedTypeDefinitions.size>0&&[...this.dataManager.inclusionModeDefinition.namedTypeDefinitions.values()].every(e=>!1===e.useAllData))n.getLogger(this).warn("This Knowledge Graph Layer already uses explicit membership - no conversion was made");else{this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map};for(const e of this.dataManager.sublayerCaches.keys())o(this.sublayerIdsCache,e,()=>new Set),this.dataManager.inclusionModeDefinition.namedTypeDefinitions.set(e,{useAllData:!1,members:new Map});this._set("inclusionModeDefinition",this.dataManager.inclusionModeDefinition),this._refreshNamedTypes()}}async removeRecords(e){await this.load();const i=[];for(const t of e)!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(t.typeName)?.members?.has(t.id)&&i.push(t);this.dataManager.removeFromLayer(i);for(const t of i)this.sublayerIdsCache.get(t.typeName)?.delete(t.id);return this._refreshNamedTypes(),i}};e([u()],z.prototype,"dataManager",void 0),e([u({json:{write:{ignoreOrigin:!0,writerEnsuresNonNull:!0}}})],z.prototype,"definitionSetMap",void 0),e([P("definitionSetMap")],z.prototype,"readDefinitionSetMap",null),e([F("definitionSetMap")],z.prototype,"writeDefinitionSetMap",null),e([u()],z.prototype,"inclusionModeDefinition",null),e([u()],z.prototype,"knowledgeGraph",void 0),e([u({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],z.prototype,"layers",void 0),e([u()],z.prototype,"memberEntityTypes",void 0),e([u()],z.prototype,"memberRelationshipTypes",void 0),e([u({type:["KnowledgeGraphLayer"]})],z.prototype,"operationalLayerType",void 0),e([u()],z.prototype,"sublayerCapabilities",null),e([u()],z.prototype,"sublayerIdsCache",void 0),e([u({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],z.prototype,"tables",void 0),e([u({json:{read:!1}})],z.prototype,"type",void 0),e([u(G)],z.prototype,"url",void 0),e([u(K("dateFieldsTimeReference"))],z.prototype,"dateFieldsTimeZone",void 0),z=e([m("esri.layers.KnowledgeGraphLayer")],z);const H=z;async function $(e){const i=await t(e);return new Blob([i],{type:"application/x-protobuf"})}function B(e){const i=`definitionSetMap-${c()}.dat`,t=y("knowledgeGraphLayer",i);return e.resourceFromPath(t)}export{H as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import{watch as d}from"../core/reactiveUtils.js";import{property as h,subclass as _}from"../core/accessorSupport/decorators.js";import y from"../geometry/SpatialReference.js";import{isGeographic as u}from"../geometry/support/spatialReferenceUtils.js";import c from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as g,elevQueriesFull as m,elevQueriesGenericFail as p,invalidLayerView as f}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as w}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as b}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as v}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as D}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as L}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as M}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const C=3857,k=32662,S=4326,I=5773;let W=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new Map,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([d(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),d(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()})]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(M.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:g})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){const s=this._lyr3DMain._malloc(8*t.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,t.length);for(let e=0;e<t.length;++e)r[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,t.length),this._lyr3DMain._free(s);const a=this._isUpdating(i);i.needFrame=!0,a||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=v().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=S,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=b(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=C,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I):this.view.renderSpatialReference?.wkid===k?(this._viewSR.wkid=this._viewSR.latestWkid=S,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=I):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new w(L(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?y.WGS84:this._viewSR.wkid===C?y.WebMercator:y.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===m)return Promise.reject("max mesh elevation query limit exceeded");if(d===p)return Promise.reject("elevation query failed");const h={descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e)}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e),this._cameraElevationDirty=!1}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t,e);const i=t.abortController.signal,s=t.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:r}},o={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(t,r,e);else if(0===r.status)this._onJobSucceeded(t,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{o.jobDescJson=r.jobDescJson,r.originalInputs?o.inputs=r.originalInputs:o.inputs=[],o.isMissingResourceCase=!0;for(const t of e)o.inputs.push(t);return this._workerHandle.invoke(o,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{l(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)})}};try{const t=await this._getInitialPromise(e,n,d,s,o,i,a);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,n,d,s,o,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:t}=e;t.data&&t.data.byteLength>0&&(t.data=t.data.slice());const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=e,a=t();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(t=>{l(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(t=>{try{const{layerId:i,handle:s}=e;t.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_onElevQueryComplete(e){const t=this._elevationQueries.get(e),i=this._lyr3DMain.get_elevation_query_result(e);if(t)if(i.succeeded&&i.zs){const s=i.zs.slice(),r=t.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),t.resolveCallback(r),this._elevationQueries.delete(e)}else t.rejectCallback(new s("elevation-query:error",i?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:f};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:f,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=D(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=u(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=c.values[c[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:f})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([h({constructOnly:!0})],W.prototype,"view",void 0),e([h({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([_("esri.layers.Lyr3DWasmPerSceneView")],W);const V=W;export{V as default};
2
+ import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import d from"../core/ReactiveMap.js";import{watch as h}from"../core/reactiveUtils.js";import{property as _,subclass as y}from"../core/accessorSupport/decorators.js";import u from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import m from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as g,elevQueriesFull as p,elevQueriesGenericFail as f,invalidLayerView as w}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as v}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as D}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as L}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const k=3857,S=32662,I=4326,j=5773;let W=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new d,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([h(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),h(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()}),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(C.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:g})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){const s=this._lyr3DMain._malloc(8*t.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,t.length);for(let e=0;e<t.length;++e)r[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,t.length),this._lyr3DMain._free(s);const a=this._isUpdating(i);i.needFrame=!0,a||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=D().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=I,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=v(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this.view.renderSpatialReference?.wkid===S?(this._viewSR.wkid=this._viewSR.latestWkid=I,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?u.WGS84:this._viewSR.wkid===k?u.WebMercator:u.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===p)return Promise.reject("max mesh elevation query limit exceeded");if(d===f)return Promise.reject("elevation query failed");const h={wasmLayerId:e.wasmLayerId,descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){const t=new Array;this._elevationQueries.forEach((i,s)=>{i.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(s),i.rejectCallback(n()),t.push(s))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t,e);const i=t.abortController.signal,s=t.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:r}},o={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(t,r,e);else if(0===r.status)this._onJobSucceeded(t,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{o.jobDescJson=r.jobDescJson,r.originalInputs?o.inputs=r.originalInputs:o.inputs=[],o.isMissingResourceCase=!0;for(const t of e)o.inputs.push(t);return this._workerHandle.invoke(o,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{l(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)})}};try{const t=await this._getInitialPromise(e,n,d,s,o,i,a);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,n,d,s,o,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{meshData:t}=e;t.data&&t.data.byteLength>0&&(t.data=t.data.slice());const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=e,a=t();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(t=>{l(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(t=>{try{const{layerId:i,handle:s}=e;t.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_onElevQueryComplete(e){const t=this._elevationQueries.get(e),i=this._lyr3DMain.get_elevation_query_result(e);if(t)if(i.succeeded&&i.zs){const s=i.zs.slice(),r=t.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),t.resolveCallback(r),this._elevationQueries.delete(e)}else t.rejectCallback(new s("elevation-query:error",i?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:w};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:w,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=L(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=c(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=m.values[m[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:w})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([_({constructOnly:!0})],W.prototype,"view",void 0),e([_()],W.prototype,"updating",null),e([_({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([y("esri.layers.Lyr3DWasmPerSceneView")],W);const V=W;export{V as default};