@arcgis/core 5.0.0-next.7 → 5.0.0-next.8

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 (286) hide show
  1. package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{8f56f298e7c1a283f407.js → 0030d68d9edf42b4af57.js} +1 -1
  4. package/assets/esri/core/workers/chunks/01d460398f3ba6767a37.js +1 -0
  5. package/assets/esri/core/workers/chunks/{17d5f8dba6ebb1184506.js → 042cd64e1f4eb326c30f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/05429f9d292a7a714309.js +316 -0
  7. package/assets/esri/core/workers/chunks/{66db5f77e09d25e33951.js → 063905fbf9a0c6586949.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{9486032af3e934d85582.js → 0a5d74414dd02a2fb8e1.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{3815ffa13e7b439bca6e.js → 0d5212f59e9b62c16164.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{73487b9d85e726e9c012.js → 1257c37bf04d39c27b62.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{398f356b11fd33bd3831.js → 136a7d781dad05a7463b.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{1e4e7aedf4b779241a02.js → 15c7c10ff9ac63f0e792.js} +1 -1
  13. package/assets/esri/core/workers/chunks/17784cf16fa91504b9ea.js +1 -0
  14. package/assets/esri/core/workers/chunks/{a395373e3173e6458a56.js → 1ab37e13947d0e2e4181.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{f03635ddf56e2ef90e4c.js → 1d06fcae4c2f02fb1c95.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{020c8913d8e35d63080b.js → 1d15d1b20dc10fde6def.js} +1 -1
  17. package/assets/esri/core/workers/chunks/1dfca37f95f2b968aa54.js +1 -0
  18. package/assets/esri/core/workers/chunks/20975513be0a3a1da286.js +1 -0
  19. package/assets/esri/core/workers/chunks/{285762ff92d5388b6024.js → 2166238a7ad63a2d43c7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{620a94b54be3ed78350d.js → 22ca80f491e070b2a5e7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{88074189fa10c335370b.js → 24cd7b84cd0f3de4bff2.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{9fac5a12e878cd745354.js → 28020063048e644f17a5.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{95c594a87b732f5c4979.js → 2a8dff8521e1e6a10cf6.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{7e43c105f1cfc44b7bd0.js → 2fa01bd3f3608616fd7f.js} +1 -1
  25. package/assets/esri/core/workers/chunks/30e220f4f843681a4cdd.js +1 -0
  26. package/assets/esri/core/workers/chunks/{5d3661d1fe46dd29aae9.js → 311b564e44ae637c960d.js} +1 -1
  27. package/assets/esri/core/workers/chunks/31c7ce65e16f7858400f.js +1 -0
  28. package/assets/esri/core/workers/chunks/{8a314b3790313e6dc5db.js → 333b62dad3811cff0f14.js} +1 -1
  29. package/assets/esri/core/workers/chunks/36d067c8d03d7a894f5f.js +1 -0
  30. package/assets/esri/core/workers/chunks/{e31192ae920e3e19b6aa.js → 37c1f155da14de91565a.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{aa54b6f2aba6952af149.js → 38cc18fd93c18815ded0.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{c55c096669677321a227.js → 38cd3648932bf2534b0f.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{ac26e3e77df4302f47a2.js → 3afb83f5de033dda89ec.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{f5e47eea8720ba84665b.js → 3c07aa2015ab1dff5f7b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{e9311386f58f3cb95c22.js → 42a1e71d09e8583a7327.js} +1 -1
  36. package/assets/esri/core/workers/chunks/443dfe7029ec208f670c.js +1 -0
  37. package/assets/esri/core/workers/chunks/{b75930d60449eceb0f1c.js → 4baf6f6e7ddedb25f806.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{bb5484b5eeacc9ad2ceb.js → 4d0cbf9584446f411a37.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{17103e6542aae53c7301.js → 4e3e27673d0671fc2b58.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{5fc7b61f467f1d60a284.js → 51ab2acac4ecc1ca9c34.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{fc4417d1260b717a9385.js → 52282f767bd0e99ddca0.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{fc06014fb484fc8c697e.js → 53654edd766d9b4ef750.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{90f8b4bda28af43ea019.js → 538f509d7fc8337d37ac.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{ed8a85efbd90241512bb.js → 588533c3abe876f20f62.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{c8733cd621105afab2ac.js → 59d3cac32ad6dad941dc.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{72846fb9c87c6642daf0.js → 5e2ce34def5e053913b2.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{8c056eac35d05d9524b7.js → 5f29422a051311ef9b3c.js} +1 -1
  48. package/assets/esri/core/workers/chunks/5f402b3c00bc4afc77b2.js +1 -0
  49. package/assets/esri/core/workers/chunks/{ff35a077ac6776469805.js → 61d970ed75c2c358b1e9.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{7a6a96edc892d7060b7d.js → 629127877042ad784ad2.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{fd2efd1d1cf9d95a87e6.js → 63a6f3e70d2b6ea57e40.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{90b2b43b8b54c9a1ec35.js → 664ae441617afe4b17ec.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{c4e4da69969499a89a2c.js → 695cdef5057e5461078a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{4c5a7249a311070d8f43.js → 6af18d7a0d314d7c1756.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{f35aaa04cca676c2d3f8.js → 6b59f94040c7d2f6728a.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{811d4c46c75cf6a63e78.js → 6bb7dbc46787b8e34bd9.js} +1 -1
  57. package/assets/esri/core/workers/chunks/6d9f2b113d6bde936a04.js +1 -0
  58. package/assets/esri/core/workers/chunks/{5132ca68e8c7af111a47.js → 6e22b02a9715c10578d0.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{cd1930f08e1fc8b30b14.js → 6ee2f0f708494102a493.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{f0e0a63962784acb4ba1.js → 6f0aec7428021e440ac9.js} +1 -1
  61. package/assets/esri/core/workers/chunks/{deb2854bb7d082a26f52.js → 7005d956c990a04ee8b2.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{a3991ae8caa713d4ddcd.js → 731f7b552dde0fb325cd.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{464d42bebb365287808d.js → 773f2c6c9d38db76dfed.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{3f3d492f1093b7832aab.js → 7803495f8862d9025bcd.js} +1 -1
  65. package/assets/esri/core/workers/chunks/78694ad8229347903f41.js +1 -0
  66. package/assets/esri/core/workers/chunks/7e4c14d4502e3f06d94b.js +1 -0
  67. package/assets/esri/core/workers/chunks/{7544316a75dbd981aea6.js → 86cb097deec50b0da3f3.js} +1 -1
  68. package/assets/esri/core/workers/chunks/8a40ed2ee4b032822c30.js +1 -0
  69. package/assets/esri/core/workers/chunks/{09de8be660174a229efb.js → 8cbb28476151a37ae958.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{62a49cfd9a2508950e9f.js → 8fedfd33c37172dba6bf.js} +1 -1
  71. package/assets/esri/core/workers/chunks/90cbd627d4113db3b686.js +1 -0
  72. package/assets/esri/core/workers/chunks/91aa1157da32f650983b.js +1 -0
  73. package/assets/esri/core/workers/chunks/{e7638b9ab6674bc8a18f.js → 91dfd29e2dba200eab09.js} +1 -1
  74. package/assets/esri/core/workers/chunks/{794748fd1edc29a621cd.js → 9698f36c143953a975d4.js} +1 -1
  75. package/assets/esri/core/workers/chunks/98584902c9db6faa3e4d.js +1 -0
  76. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
  77. package/assets/esri/core/workers/chunks/{6f4bd0ee85e7e5a74340.js → a31635a6366347dcef0f.js} +1 -1
  78. package/assets/esri/core/workers/chunks/a6ee40dfc471d6612f3c.js +1 -0
  79. package/assets/esri/core/workers/chunks/{ccc0da0e01f023c8aa1f.js → a876d6159ca120c1567e.js} +1 -1
  80. package/assets/esri/core/workers/chunks/{a4db5c9a90107e097df8.js → af47272aaaef0ea57e71.js} +1 -1
  81. package/assets/esri/core/workers/chunks/{d1fe816b6990918c13c7.js → afc13d5b842275db7dbc.js} +1 -1
  82. package/assets/esri/core/workers/chunks/aff8e40a641c6822af1d.js +1 -0
  83. package/assets/esri/core/workers/chunks/{22d6b8102e75bdef204c.js → b0365cbc3d2a41969e3b.js} +1 -1
  84. package/assets/esri/core/workers/chunks/{79968c183135281d2a6f.js → b3613a38178cad2ebc82.js} +1 -1
  85. package/assets/esri/core/workers/chunks/b548910e820d731ffe8a.js +1 -0
  86. package/assets/esri/core/workers/chunks/{5bd36dbf46c25bd961c8.js → b708792c84620b73c847.js} +1 -1
  87. package/assets/esri/core/workers/chunks/c29486c4eeb3e72effff.js +1 -0
  88. package/assets/esri/core/workers/chunks/{2b94623cabc6ae0f86ce.js → c37f7756d48ff9af2656.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{1c52999a6392370844a6.js → c4090a60d149a5962179.js} +1 -1
  90. package/assets/esri/core/workers/chunks/{73c1d43070b4fe1e5c1e.js → c8e686efe344a33a0258.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{6bb5158de43c4b59107f.js → c9b16fd41cd59d452522.js} +1 -1
  92. package/assets/esri/core/workers/chunks/ce98416437cc1a89d8ea.js +1 -0
  93. package/assets/esri/core/workers/chunks/{279366e6b743f9680603.js → cfff044859e6e6dcc75d.js} +1 -1
  94. package/assets/esri/core/workers/chunks/d07f911d40bf05fc0306.js +1 -0
  95. package/assets/esri/core/workers/chunks/{8833c3d168951be4bf20.js → d0d79dd3e88eecf5c314.js} +1 -1
  96. package/assets/esri/core/workers/chunks/{76ae1702fecc7ad7017c.js → d1e97cce5047f1791e22.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{17acde0245ecd956306c.js → d233cc33497a663450f9.js} +1 -1
  98. package/assets/esri/core/workers/chunks/{36fe6b8228e622407ec2.js → d8793eead02491136841.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{dedc4583b5f32a278124.js → d88f2fe680b8d5603ef8.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{4d599008e1ea42321b37.js → da24ad57747714ac5eda.js} +1 -1
  101. package/assets/esri/core/workers/chunks/{facb3886714222772ab2.js → ddfd01bb9ba8577c3ffc.js} +1 -1
  102. package/assets/esri/core/workers/chunks/{50d9f69d5255af4b29bb.js → df5afa06c6deb6b40109.js} +1 -1
  103. package/assets/esri/core/workers/chunks/e25c4b4a03270d48f408.js +1 -0
  104. package/assets/esri/core/workers/chunks/e3294318daf1192b8319.js +1 -0
  105. package/assets/esri/core/workers/chunks/{da573ecc68e6aa8f6da9.js → e767f83f9e2de6650f80.js} +1 -1
  106. package/assets/esri/core/workers/chunks/e9d4cae2144974489d6e.js +1 -0
  107. package/assets/esri/core/workers/chunks/{91df8638b8b904e6d8c5.js → ead8d0cbcebd12dbfad7.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{f9324e88c359c03f35aa.js → eb9c166db0db6fa60e95.js} +1 -1
  109. package/assets/esri/core/workers/chunks/{8ffd4710d168c2fcfd96.js → ebf23b46db56aaa88841.js} +1 -1
  110. package/assets/esri/core/workers/chunks/{bc241c7735e4efba734a.js → f34e3fa0c5b28531e289.js} +1 -1
  111. package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +1 -0
  112. package/assets/esri/core/workers/chunks/{d97fadbc69e055d183a0.js → f77f4bd6a577b92cf66f.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{16d66770ef841564ee3f.js → f89c90f98c85667b0ebc.js} +1 -1
  114. package/assets/esri/core/workers/chunks/{4c4227b0ea21a5e429ab.js → fb192de7e4fa152342bb.js} +1 -1
  115. package/assets/esri/core/workers/chunks/fbd8d2f61f8a15bcf3db.js +1 -0
  116. package/assets/esri/core/workers/chunks/{2f78861afe0e9037dd8d.js → fe49321dca22dc60d105.js} +1 -1
  117. package/assets/esri/core/workers/chunks/{fe77ae6cf232a7a3298e.js → fef45bc59c71f88c60b5.js} +1 -1
  118. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  119. package/chunks/MultiPathImpl.js +1 -1
  120. package/chunks/Point2D.js +1 -1
  121. package/chunks/UnitFactory.js +1 -1
  122. package/config.js +1 -1
  123. package/core/QueueProcessor.js +1 -1
  124. package/core/SetUtils.js +1 -1
  125. package/core/has.js +1 -1
  126. package/geometry/operators/gx/operatorOffset.js +1 -1
  127. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  128. package/identity/Credential.js +1 -1
  129. package/identity/IdentityManager.js +1 -1
  130. package/identity/IdentityManagerBase.js +1 -1
  131. package/interfaces.d.ts +67 -27
  132. package/kernel.js +1 -1
  133. package/layers/FeatureLayer.js +1 -1
  134. package/layers/SceneLayer.js +1 -1
  135. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  136. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  137. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  138. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  139. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  140. package/layers/support/fieldConfigUtils.js +1 -1
  141. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  142. package/layers/support/source/DataLayerSource.js +1 -1
  143. package/package.json +3 -3
  144. package/popup/FieldInfo.js +1 -1
  145. package/processRequest.js +5 -0
  146. package/request.js +1 -1
  147. package/requestConfig.js +5 -0
  148. package/requestQueue.js +5 -0
  149. package/rest/query/executeForCount.js +1 -1
  150. package/rest/query/executeForExtent.js +1 -1
  151. package/rest/query/executeForIds.js +1 -1
  152. package/rest/query/executeQueryJSON.js +1 -1
  153. package/rest/query/executeQueryPBF.js +1 -1
  154. package/rest/query/operations/query.js +1 -1
  155. package/rest/support/BaseImageMeasureResultValue.js +5 -0
  156. package/rest/support/ImageAreaResult.js +1 -1
  157. package/rest/support/ImageDistanceResult.js +1 -1
  158. package/rest/support/ImageHeightResult.js +1 -1
  159. package/rest/support/ImageMeasureResultAngleValue.js +5 -0
  160. package/rest/support/ImageMeasureResultAreaValue.js +5 -0
  161. package/rest/support/ImageMeasureResultLengthValue.js +5 -0
  162. package/rest/support/ImageWithType.js +5 -0
  163. package/rest/support/imageMeasureUtils.js +1 -1
  164. package/support/revision.js +1 -1
  165. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  166. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  167. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  168. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  169. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  170. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
  171. package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
  172. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  173. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  174. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  175. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  176. package/views/{3d/support/ImageWithType.js → 2d/layers/features/sources/strategies/constants.js} +1 -1
  177. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  178. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  179. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  180. package/views/3d/analysis/VolumeMeasurement/volumeMeasurementErrors.js +1 -1
  181. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  182. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  183. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  184. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  185. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  186. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  187. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  188. package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
  189. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  190. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  191. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  192. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  193. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  194. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  195. package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
  196. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  197. package/views/3d/layers/i3s/I3SDataRequester.js +5 -0
  198. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  199. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  200. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  201. package/views/3d/layers/support/FeatureTile.js +1 -1
  202. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  203. package/views/3d/layers/support/MediaLayerInteractionOptions.js +1 -1
  204. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.js +5 -0
  205. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +5 -0
  206. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  207. package/views/3d/layers/support/fetchTile.js +1 -1
  208. package/views/3d/support/ResourceController.js +1 -1
  209. package/views/3d/support/SharedSymbolResources.js +1 -1
  210. package/views/3d/support/StreamTextureCollection.js +1 -1
  211. package/views/3d/terrain/TerrainSurface.js +1 -1
  212. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  213. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  214. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +6 -0
  215. package/views/SceneView.js +1 -1
  216. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  217. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  218. package/views/draw/MultipointDrawAction.js +1 -1
  219. package/views/draw/PointDrawAction.js +1 -1
  220. package/views/draw/PolygonDrawAction.js +1 -1
  221. package/views/draw/PolylineDrawAction.js +1 -1
  222. package/views/draw/SegmentDrawAction.js +1 -1
  223. package/views/draw/input/CursorUpdateEvents.js +5 -0
  224. package/views/draw/input/DrawCompleteEvent.js +5 -0
  225. package/views/draw/input/VertexAddEvent.js +5 -0
  226. package/views/draw/input/VertexRemoveEvent.js +5 -0
  227. package/views/draw/input/VertexUpdateEvent.js +5 -0
  228. package/views/interactive/editGeometry/CheckpointingEditGeometryOperations.js +5 -0
  229. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  230. package/views/interactive/editGeometry/operations/ReplayableAppendVertex.js +5 -0
  231. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  232. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  233. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  234. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  235. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  236. package/webscene/spec-certification/api.js +1 -1
  237. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  238. package/widgets/CoordinateConversion.js +1 -1
  239. package/widgets/Editor.js +1 -1
  240. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  241. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  242. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  243. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  244. package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
  245. package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +1 -1
  246. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  247. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  248. package/widgets/PanoramicViewer/support/getVisibleTiles.js +5 -0
  249. package/widgets/Sketch/CreateToolVisibilityMap.js +5 -0
  250. package/widgets/Sketch/SelectionToolVisibilityMap.js +5 -0
  251. package/widgets/Sketch/VisibleElements.js +1 -1
  252. package/widgets/Sketch.js +1 -1
  253. package/assets/esri/core/workers/chunks/02e69f0c63d97661da60.js +0 -1
  254. package/assets/esri/core/workers/chunks/05eee334d58a0b9f6316.js +0 -1
  255. package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +0 -1
  256. package/assets/esri/core/workers/chunks/326a76a4e80269d4029d.js +0 -1
  257. package/assets/esri/core/workers/chunks/377a66034e7c1bad5599.js +0 -1
  258. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +0 -1
  259. package/assets/esri/core/workers/chunks/459a67928bde4a62b6a4.js +0 -1
  260. package/assets/esri/core/workers/chunks/53bd8996e8812f1ad7b2.js +0 -1
  261. package/assets/esri/core/workers/chunks/557960763695abee4a83.js +0 -1
  262. package/assets/esri/core/workers/chunks/6201356f7f91e5c06425.js +0 -1
  263. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +0 -1
  264. package/assets/esri/core/workers/chunks/7413e582bc2b16af6a0f.js +0 -1
  265. package/assets/esri/core/workers/chunks/7461124454bfb4fb6474.js +0 -1
  266. package/assets/esri/core/workers/chunks/75bf27271a31e26e1b21.js +0 -1
  267. package/assets/esri/core/workers/chunks/7aaaebbabee27690283c.js +0 -1
  268. package/assets/esri/core/workers/chunks/7c4a63aeead2505d6f02.js +0 -1
  269. package/assets/esri/core/workers/chunks/90250e9239c173aace88.js +0 -1
  270. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +0 -1
  271. package/assets/esri/core/workers/chunks/99859dce1925b406ccd0.js +0 -1
  272. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +0 -1
  273. package/assets/esri/core/workers/chunks/9e8dceef4c961f56940d.js +0 -1
  274. package/assets/esri/core/workers/chunks/a06bac9b8f9e18874de8.js +0 -316
  275. package/assets/esri/core/workers/chunks/a712cdff78fc826acd8c.js +0 -1
  276. package/assets/esri/core/workers/chunks/d305a21666b1ed5bf33d.js +0 -1
  277. package/assets/esri/core/workers/chunks/d40f57f9fc47f9a9f97c.js +0 -1
  278. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +0 -1
  279. package/assets/esri/core/workers/chunks/f4d0ae6be1b3984228d0.js +0 -1
  280. package/assets/esri/core/workers/chunks/f6c8beb60f6d29945a2e.js +0 -1
  281. package/assets/esri/core/workers/chunks/f746e3f7ebff2bbdf333.js +0 -1
  282. package/views/3d/layers/i3s/I3SStreamDataController.js +0 -5
  283. package/views/3d/support/StreamDataLoader.js +0 -5
  284. package/views/3d/support/StreamDataRequester.js +0 -5
  285. package/views/3d/support/downloadSlots.js +0 -5
  286. package/views/draw/input/DrawEvents.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import{clone as a}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{destroyMaybe as o,removeMaybe as n,abortMaybe as h}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as c,isAbortError as d}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as f,sync as y}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as F}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{projectWithZConversion as v}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as w}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as D}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as C}from"../../support/layerUtils.js";import b from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as S,virtualSnapshotTileId as E,virtualDisplayFilterHighlightTileId as T}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as V}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as H}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as I}from"../../../views/3d/support/debugFlags.js";let L=class extends(u(t)){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void l.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher?.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get hasAllFeatures(){return this.serviceDataCount===M.noServiceDataCount&&"snapshot"===this.mode&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){const e=this.context.effectiveDisplayFilter?.where||null,t=null!=e&&"1=1"!==e;return("tiles"!==this.mode||!t)&&(this._tileFetcher?.showsAllFeatures??!1)}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if("catalog-footprint"===e.type)return"tiles";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(!1===t.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===M.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>M.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){if("snapshot"===this.mode){const e=new S(0,0,0,null,E);return new r([e])}const e=this.layerView.view.featureTiles;if(!e)return new r;const t=e.tiles;if(this.layerView.displayFilterEnabled&&null!=this.layerView.effectiveDisplayFilterClause&&"1=1"!==this.layerView.effectiveDisplayFilterClause&&this.layerView.highlightIds?.length>0){const e=new S(0,0,0,this.layerView.view.featureTiles?.tilingScheme,T);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new x,this.serviceDataExtent=null,this.serviceDataCount=M.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{"tiles"===e&&"snapshot"===t&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!C(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=o(this._tileFetcher),this._tilesHandle=n(this._tilesHandle),this._lifeCycleAbortController=h(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){const t=()=>{null!=this._tileFetcher&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const{layerView:t,tileDescriptors:i}=this,r=t.layer,s=new V({context:this.context,filterExtent:this.extent,tileDescriptors:i,features:this.graphics});this._tileFetcher=s,this._suspended?s.suspend():s.resume(),e&&this.addHandles(m(()=>e.quality,e=>s.memoryFactor=e,f));const a="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>s.lodFactor=e||1,p));const l=e=>{s.maximumNumberOfFeatures=e,s.useTileCount=this.serviceDataCount>e},n=e=>{s.useTileCount=e>this.maximumNumberOfFeatures};"ogc-feature"!==r.type&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),"customParameters"in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on("apply-edits",e=>this._applyEdits(e)),m(()=>this.extent,e=>s.filterExtent=e,y),m(()=>this.tileDescriptors,e=>s.tileDescriptors=e,y),m(()=>this.maximumNumberOfFeatures,l,f),m(()=>this.serviceDataCount,n,f),m(()=>({featureTiles:e.featureTiles,show:I.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:i})=>{t&&s&&i?s.debugger??=new H(s,i.tilingScheme.toTileInfo(),e):s.debugger=o(s.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.enableFeatureTiles());break;default:l.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){"snapshot"!==this.mode&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){"snapshot"!==this.mode&&null!=this._tileFetcher&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){const t=this.layerView.layer;null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw c();e.exceededTransferLimit&&"refresh"in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!d(e))throw e})}_availableFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new b({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=this.layerView,i=e.createQuery();return i.returnGeometry=!1,i.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),t.effectiveDisplayFilter&&(i.where=_(i.where,t.effectiveDisplayFilter.where)),i}_fullExtentIsAccurate(){const e=this.layerView.layer;if("definitionExpression"in e&&e.definitionExpression)return!1;switch(e.type){case"feature":case"catalog-footprint":case"oriented-imagery":return w(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){d(t)||this._set("serviceDataExtent",a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=a(t.fullExtentInLocalViewSpatialReference),l=i.fullExtent,o=this._fullExtentIsAccurate(),n=this.serviceDataCount;if(r&&n<=M.maxFeatureCountForExtent&&(!s||!o)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:M.queryExtentTimeout,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=l){const e=l.spatialReference?await v(l,t.view.spatialReference):null;this._set("serviceDataExtent",e??null)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",M.noServiceDataCount);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:M.queryStatisticsTimeout,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(d(r.error))throw r.error;this._set("serviceDataCount",M.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,r){if(null==e?.averageSymbolComplexity)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:s,averageSymbolComplexity:a}=e,{verticesPerFeature:l,verticesPerCoordinate:o}=a,n=l<=0,h=this._minimumNumberOfVerticesForGeometry>1;if(!n&&!h)return void(this._snapshotLimitExceeded=!1);0!==l&&null!=t&&await t;const u=Math.min(s,A),c=this.serviceDataCount,p=c!==M.noServiceDataCount;let m=p?Math.ceil((u-c*l)/(o||1)):Math.ceil(u/(o||1));if(h&&(m=Math.min(m,N)),p&&this._minimumNumberOfVerticesForGeometry*c>m)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m);const f=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:M.queryStatisticsTimeout,signal:r}));if(!1===f.ok){if(d(f.error))throw f.error;return void(this._snapshotLimitExceeded=!1)}const y=f.value.features[0];this._snapshotLimitExceeded=!!y?.attributes&&!!y.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await D(this.layerView.layer);let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),s=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{d(e)||l.getLogger(this).error("#fetchServiceDataInfo()",e)}).then(()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([g({readOnly:!0})],L.prototype,"type",void 0),e([g({constructOnly:!0})],L.prototype,"graphics",void 0),e([g({constructOnly:!0})],L.prototype,"layerView",void 0),e([g({constructOnly:!0})],L.prototype,"context",void 0),e([g({readOnly:!0})],L.prototype,"dataUpdating",null),e([g()],L.prototype,"extent",null),e([g()],L.prototype,"updating",null),e([g({readOnly:!0})],L.prototype,"_updatingHandles",void 0),e([g()],L.prototype,"updatingTotal",null),e([g()],L.prototype,"updatingRemaining",null),e([g()],L.prototype,"expectedFeatureDiff",null),e([g()],L.prototype,"memoryForUnusedFeatures",null),e([g()],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([g({readOnly:!0})],L.prototype,"serviceDataExtent",void 0),e([g({readOnly:!0})],L.prototype,"serviceDataCount",void 0),e([g()],L.prototype,"_snapshotLimitExceeded",void 0),e([g()],L.prototype,"displayFeatureLimit",void 0),e([g({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([g({readOnly:!0})],L.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],L.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],L.prototype,"hasFullGeometries",null),e([g()],L.prototype,"_forceTilesMode",void 0),e([g({readOnly:!0})],L.prototype,"mode",null),e([g({readOnly:!0})],L.prototype,"maxTotalSnapshotVertices",null),e([g({readOnly:!0})],L.prototype,"tileDescriptors",null),e([g()],L.prototype,"_tileFetcher",void 0),e([g()],L.prototype,"_fetchDataInfoPromise",void 0),L=e([F("esri.layers.graphics.controllers.FeatureTileController3D")],L);const O=1e4,A=1e6,q=12e3,j=1e4,N=5e6;function P(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}class M{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){M.maxFeatureCountForExtent=O,M.queryStatisticsTimeout=q,M.queryExtentTimeout=j}}M.reset();export{L as FeatureTileController3D,M as FeatureTileController3DConstants};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import{clone as a}from"../../../core/lang.js";import l from"../../../core/Logger.js";import{destroyMaybe as o,removeMaybe as n,abortMaybe as h}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as c,isAbortError as d}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as f,sync as y}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import{subclass as F}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{projectWithZConversion as v}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as w}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as D}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as C}from"../../support/layerUtils.js";import b from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as S,virtualSnapshotTileId as E,virtualDisplayFilterHighlightTileId as T}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as V}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as H}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as I}from"../../../views/3d/support/debugFlags.js";let L=class extends(u(t)){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void l.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher?.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get hasAllFeatures(){return this.serviceDataCount===M.noServiceDataCount&&"snapshot"===this.mode&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){const e=this.context.effectiveDisplayFilter?.where||null,t=null!=e&&"1=1"!==e;return("tiles"!==this.mode||!t)&&(this._tileFetcher?.showsAllFeatures??!1)}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if("catalog-footprint"===e.type)return"tiles";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(!1===t.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===M.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>M.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){if("snapshot"===this.mode){const e=new S(0,0,0,null,E);return new r([e])}const e=this.layerView.view.featureTiles;if(!e)return new r;const t=e.tiles;if(this.layerView.displayFilterEnabled&&null!=this.layerView.effectiveDisplayFilterClause&&"1=1"!==this.layerView.effectiveDisplayFilterClause&&this.layerView.highlightIds?.length>0){const e=new S(0,0,0,this.layerView.view.featureTiles?.tilingScheme,T);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new x,this.serviceDataExtent=null,this.serviceDataCount=M.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{"tiles"===e&&"snapshot"===t&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!C(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=o(this._tileFetcher),this._tilesHandle=n(this._tilesHandle),this._lifeCycleAbortController=h(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){const t=()=>{null!=this._tileFetcher&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const{layerView:t,tileDescriptors:i}=this,r=t.layer,s=new V({context:this.context,filterExtent:this.extent,tileDescriptors:i,features:this.graphics});this._tileFetcher=s,this._suspended?s.suspend():s.resume(),e&&this.addHandles(m(()=>e.quality,e=>s.memoryFactor=e,f));const a="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>s.lodFactor=e||1,p));const l=e=>{s.maximumNumberOfFeatures=e,s.useTileCount=this.serviceDataCount>e},n=e=>{s.useTileCount=e>this.maximumNumberOfFeatures};"ogc-feature"!==r.type&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),"customParameters"in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on("apply-edits",e=>this._applyEdits(e)),m(()=>this.extent,e=>s.filterExtent=e,y),m(()=>this.tileDescriptors,e=>s.tileDescriptors=e,y),m(()=>this.maximumNumberOfFeatures,l,f),m(()=>this.serviceDataCount,n,f),m(()=>({featureTiles:e.featureTiles,show:I.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:i})=>{t&&s&&i?s.debugger??=new H(s,i.tilingScheme.toTileInfo(),e):s.debugger=o(s.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.enableFeatureTiles());break;default:l.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){"snapshot"!==this.mode&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){"snapshot"!==this.mode&&null!=this._tileFetcher&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){const t=this.layerView.layer;null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw c();e.exceededTransferLimit&&"refresh"in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!d(e))throw e})}_availableFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new b({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=this.layerView,i=e.createQuery();return i.returnGeometry=!1,i.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),t.effectiveDisplayFilter&&(i.where=_(i.where,t.effectiveDisplayFilter.where)),i}_fullExtentIsAccurate(){const e=this.layerView.layer;if("definitionExpression"in e&&e.definitionExpression)return!1;switch(e.type){case"feature":case"catalog-footprint":case"oriented-imagery":return w(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){d(t)||this._set("serviceDataExtent",a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=a(t.fullExtentInLocalViewSpatialReference),l=i.fullExtent,o=this._fullExtentIsAccurate(),n=this.serviceDataCount;if(r&&n<=M.maxFeatureCountForExtent&&(!s||!o)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:M.queryExtentTimeout,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=l){const e=l.spatialReference?await v(l,t.view.spatialReference):null;this._set("serviceDataExtent",e??null)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",M.noServiceDataCount);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:M.queryStatisticsTimeout,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(d(r.error))throw r.error;this._set("serviceDataCount",M.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,r){if(null==e?.averageSymbolComplexity)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:s,averageSymbolComplexity:a}=e,{verticesPerFeature:l,verticesPerCoordinate:o}=a,n=l<=0,h=this._minimumNumberOfVerticesForGeometry>1;if(!n&&!h)return void(this._snapshotLimitExceeded=!1);0!==l&&null!=t&&await t;const u=Math.min(s,A),c=this.serviceDataCount,p=c!==M.noServiceDataCount;let m=p?Math.ceil((u-c*l)/(o||1)):Math.ceil(u/(o||1));if(h&&(m=Math.min(m,N)),p&&this._minimumNumberOfVerticesForGeometry*c>m)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m);const f=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:M.queryStatisticsTimeout,signal:r}));if(!1===f.ok){if(d(f.error))throw f.error;return void(this._snapshotLimitExceeded=!1)}const y=f.value.features[0];this._snapshotLimitExceeded=!!y?.attributes&&!!y.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await D(this.layerView.layer);let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),s=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{d(e)||l.getLogger(this).error("#fetchServiceDataInfo()",e)}).then(()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([g({readOnly:!0})],L.prototype,"type",void 0),e([g({constructOnly:!0})],L.prototype,"graphics",void 0),e([g({constructOnly:!0})],L.prototype,"layerView",void 0),e([g({constructOnly:!0})],L.prototype,"context",void 0),e([g({readOnly:!0})],L.prototype,"dataUpdating",null),e([g()],L.prototype,"extent",null),e([g()],L.prototype,"updating",null),e([g({readOnly:!0})],L.prototype,"_updatingHandles",void 0),e([g()],L.prototype,"updatingTotal",null),e([g()],L.prototype,"updatingRemaining",null),e([g()],L.prototype,"expectedFeatureDiff",null),e([g()],L.prototype,"memoryForUnusedFeatures",null),e([g()],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([g()],L.prototype,"snappingComplexityExceeded",null),e([g({readOnly:!0})],L.prototype,"serviceDataExtent",void 0),e([g({readOnly:!0})],L.prototype,"serviceDataCount",void 0),e([g()],L.prototype,"_snapshotLimitExceeded",void 0),e([g()],L.prototype,"displayFeatureLimit",void 0),e([g({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([g({readOnly:!0})],L.prototype,"hasAllFeatures",null),e([g({readOnly:!0})],L.prototype,"hasAllFeaturesInView",null),e([g({readOnly:!0})],L.prototype,"hasFullGeometries",null),e([g()],L.prototype,"_forceTilesMode",void 0),e([g({readOnly:!0})],L.prototype,"mode",null),e([g({readOnly:!0})],L.prototype,"maxTotalSnapshotVertices",null),e([g({readOnly:!0})],L.prototype,"tileDescriptors",null),e([g()],L.prototype,"_tileFetcher",void 0),e([g()],L.prototype,"_fetchDataInfoPromise",void 0),L=e([F("esri.layers.graphics.controllers.FeatureTileController3D")],L);const O=1e4,A=1e6,q=12e3,j=1e4,N=5e6;function P(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}class M{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){M.maxFeatureCountForExtent=O,M.queryStatisticsTimeout=q,M.queryExtentTimeout=j}}M.reset();export{L as FeatureTileController3D,M as FeatureTileController3DConstants};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as o,sync as n,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{addCallback as f}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import N from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{I3SStreamDataController as v}from"../../../views/3d/layers/i3s/I3SStreamDataController.js";import{getVertexCrs as b,getIndexCrs as L,findIntersectingNodes as C}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{maxDownloadSlots as V}from"../../../views/3d/support/downloadSlots.js";import{toBoundingRect as A}from"../../../views/3d/support/extentUtils.js";import{minQuality as I}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as M}from"../../../views/support/PromiseQueue.js";import{noBudget as F}from"../../../views/support/Scheduler.js";const S=100,P=2,O=1e4,q=1e-4,R=1.2,G=500,U=1.5;let H=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(2);return new v(e,this.layer.customParameters,this.layer.apiKey)}get dataStreamController(){const e=this.layerView.view.resourceController.createStreamDataRequester(3);return new v(e,this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return b(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new M,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new N(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),o(()=>r.quality,()=>this._setCameraDirty(),n),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),f(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new x(m(r.viewingMode),t,s,this.indexStreamController,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),()=>!this.indexStreamController.busy,t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,Q.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=T(e,i),r=T(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();j(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();A(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&(this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate()))}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,k,this.crsIndex),e=k);const s=this._elevationUpdateNodes;return s.clear(),C(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>G){if(this._featureLOD<=q)return;this._featureLOD/=U,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=O||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*R||e&&i.estimate>t))return;if(this._featureLOD<=q)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(O,Math.max(q,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?S:P)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=P)&&(this._downloadingCount<V&&!this.dataStreamController.busy)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.progressiveLoadPenalty=E.distancePenalty*this._viewportQueries.distCameraToPOI(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-I)/(.5-I)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataStreamController,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexStreamController.cancelAll(),this.dataStreamController.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;Q.clear(),this.layerView.getLoadedNodeIndices(Q);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return Q.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),Q.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(Q,e,0),!(i&&this._lodDropFactor<1)&&(0===Q.length||(Q.clear(),!1))}markNodeToRemove(e){Q.push(e)}removeMarkedNodes(){this._removeNodes(Q,F,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=j(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&j(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const o=this._requiredAttributes,n=await this.reschedule(()=>this._loadAttributes(e,o,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:o,attributeData:n},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],H.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],H.prototype,"isGraphics3D",null),e([h({readOnly:!0})],H.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],H.prototype,"indexStreamController",null),e([h({readOnly:!0})],H.prototype,"dataStreamController",null),e([h({readOnly:!0})],H.prototype,"crsVertex",null),e([h({readOnly:!0})],H.prototype,"crsIndex",null),e([h()],H.prototype,"featureTarget",void 0),e([h()],H.prototype,"fixedFeatureTarget",void 0),e([h()],H.prototype,"layerView",void 0),e([h()],H.prototype,"layer",null),e([h()],H.prototype,"_updatingHandles",void 0),e([h()],H.prototype,"updating",null),e([h()],H.prototype,"running",void 0),e([h()],H.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],H.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],H.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],H.prototype,"rootNodeVisible",null),H=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],H);const Q=new r({deallocator:null});function j(e,t){return null!=e&&e.length===t.length&&e.every(e=>T(t,e.name)>=0)}function T(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const E={distancePenalty:10},k=g();export{H as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import r from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as d}from"../../../core/promiseUtils.js";import{watch as n,sync as o,initial as l}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{q as _}from"../../../chunks/vec32.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as p}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as m}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as y}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as f}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as x}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as N}from"../../../views/3d/layers/i3s/I3SIndex.js";import b from"../../../views/3d/layers/i3s/I3SLodHandling.js";import w from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as v,getIndexCrs as L,findIntersectingNodes as D}from"../../../views/3d/layers/i3s/I3SUtil.js";import C from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as V}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as I}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const F=100,O=2,q=1e4,R=1e-4,P=1.2,S=500,G=1.5;let U=class extends(a(t)){get isMeshPyramid(){return"mesh-pyramids"===this.layer.profile||"MeshPyramid"===this.layer.store?.lodType}get isGraphics3D(){return"points"===this.layer.profile}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(null==this.layer.priority||"High"===this.layer.priority)}get indexRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new f(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return v(this.layer)}get crsIndex(){return L(this.layer)}get layer(){return this.layerView.i3slayer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){if(this._index){const e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new c,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new r({deallocator:null}),this._modificationsNodeFilteringArray=new r,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=new Array,this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new I,this._elevationUpdateNodes=new r({deallocator:null}),this._errorCount=0}initialize(){const{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new b(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has("disable-feature:idb-cache"),"fields"in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([s])=>{if(this.destroyed||!e||e.destroyed||!s)return;const{view:r,clientGeometry:a}=e;if(this._setClippingArea(r.clippingArea),this.addHandles([this._updatingHandles.add(()=>r?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:_}),n(()=>r.quality,()=>this._setCameraDirty(),o),this._updatingHandles.add(()=>2===r.state.mode,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),x(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>r.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e)),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>null!=this._index&&(this._index.holeFilling=e))]),this._viewportQueries=new C(this.crsIndex,r.renderCoordsHelper,r.state.contentCamera,!r.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?r.basemapTerrain:r.elevationProvider,m(r.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new y(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:r.renderCoordsHelper.spatialReference},r.resourceController.memoryController,this.worker),this._index=new N(m(r.viewingMode),t,s,this.indexRequester,this._clientNodeLoader,this._viewportQueries,i.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),null!=a){for(const e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on("change",e=>{for(const t of e.removed)this._removeMesh(t.oid);for(const t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){const t=this._index,i=this.layerView;null!=t&&i?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{const i=t.getNode(e);null!=i&&this._modificationsNodeFilteringArray.push(i)}),i.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,H.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),this._index=null,this._lodHandling=s(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set("worker",null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(null==this._attributeStorageInfo||!this._fields||!this.layerView.availableFields)return[];const e=this._attributeStorageInfo,t=this._fields,i=this.layer.objectIdField;return this.layerView.availableFields.map(i=>{const s=j(e,i),r=j(t,i);return s>=0&&r>=0?{index:s,name:t[r].name,field:t[r],attributeStorageInfo:e[s]}:null}).filter(e=>null!=e&&e.name!==i)}_requiredFieldsChange(){const e=this._getRequiredAttributes();Q(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){const t=g();V(e,t,this.layerView.view.renderSpatialReference)?this._clippingArea=t:this._clippingArea=null}_pointOfInterestChanged(e){null!=this._viewportQueries&&(this._viewportQueries.setPointOfInterest(e),null!=this._index&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),null!=this._viewportQueries&&null!=this._index&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(null==this._index)return;const i=this._clientNodeLoader.createMeshNodeInfo(e,t),s=this._index.addClientNodeToIndex(i.id,i.mbs);this._clientNodeLoader.addMeshNode(s,i),this._evaluateRunning(),this.notifyChange("rootNodeVisible")}_removeMesh(e){const t=this._clientNodeLoader.getMeshNodeIndex(e);if(null!=t){if(null==this._index)throw new Error("delayed removal of client side i3s node geometry not supported yet.");{const e=(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&null!=e&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},i=(e,t,i)=>{this._clientNodeLoader.updateNodeIndex(e,t,i),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,i)};this._index.removeClientNodeFromIndex(t,e,i),this.notifyChange("rootNodeVisible")}}}updateElevationChanged(e,t){const i=this._index;if(null==i?.rootNode||null==t)return null;this.crsIndex.equals(t)||(p(e,t,T,this.crsIndex),e=T);const s=this._elevationUpdateNodes;return s.clear(),D(e,i.rootNode,i,e=>s.push(e.index)),s.length&&(s.forAll(e=>i.updateElevationChanged(e)),this._setCameraDirty()),s}removeAllGeometryObbs(){null!=this._index&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return null!=this._viewportQueries?this._viewportQueries.getServiceMbsInRenderSR(e):null}_elevationInfoChanged(e){null!=this._index&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){const i=this._idleQueue.push(e,t);return this._evaluateRunning(),i}reschedule(e,t){const i=this._idleQueue.unshift(e,t);return this._evaluateRunning(),i}get _isIntegratedMesh(){return"integrated-mesh"===this.layer.type}get unloadedMemoryEstimate(){return null!=this._index&&this.layerView.contentVisible?this._index.unloadedMemoryEstimate*this._lodDropFactor:0}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,i){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,i)}get indexDepth(){return null!=this._index?this._index.maxLevel:0}set disableMemCache(e){this.layerView.loadCachedGPUData&&this.layerView.addCachedGPUData?this._disableMemCache=e:this._disableMemCache=!0}runTask(e,t){return this.layerView.contentVisible?this.layerView.visible&&null!=this._index?(this._processWithErrorLogging(e,t),this._index.maxPriority):-1/0:(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(s){this._errorCount<50?i.getLogger(this).error(`Error during processing: ${s} at ${s.stack}`):50===this._errorCount&&i.getLogger(this).error("Too many errors for this layer. Further errors will not be displayed."),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),null!=this._nodeLoader&&null!=this._index&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(null==this._index)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushArray(this._index.updates.missing.data,this._index.updates.missing.length));const t=this._index.featureEstimate.leavesReached;this._index.isLoading||t===this._get("leavesReached")||this._set("leavesReached",t)}return this._index.load()}_prefetchIndex(){return!(null==this._index||this._loadingNodes.size>0||this._index.updates.add.length>0)&&this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||null==this._index||null==this._viewportQueries)return;const e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,i=this._index.featureEstimate;if(i.estimate=i.estimate||t/2,this._index.indexMissing>S){if(this._featureLOD<=R)return;this._featureLOD/=G,this._stableFeatureLOD=!1}else if(e&&i.estimate<t){if(i.leavesReached||this._featureLOD>=q||this._stableFeatureLOD)return;const e=Math.min(10,Math.max(t/i.estimate,1.001));this._featureLOD*=e;const s=this._lod,r=this._index.checkFeatureTarget(t,s);r!==s&&(this._featureLOD=r/this._baseLOD,this._stableFeatureLOD=!0)}else{if(!(i.estimate>t*P||e&&i.estimate>t))return;if(this._featureLOD<=R)return;this._featureLOD/=1+.25*(i.estimate/t-1),this._stableFeatureLOD=!1}this._featureLOD=Math.min(q,Math.max(R,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){const t=this._index;if(null==t)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){const i=this._newLoadingNodes.pop();for(let s=t.getParent(i);null!=s&&!this.layerView.isNodeLoaded(s.index);s=t.getParent(s.index))if(this._enableFromGPUCache(s,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(null==this._index)return!1;let i=(this._isIdle?F:O)-this._loadingNodes.size;const s=this._index.updates;for(s.cancel.forEach(this._cancelNode,this),s.cancel=[];s.remove.length>0&&!e.done;)this.layerView.removeNode(s.remove.pop()),e.madeProgress();for(;s.update.length>0&&!e.done;){const t=this._index.getNode(s.update.pop());null!=t&&(this._updateLoadedNode(t),e.madeProgress())}for(;s.add.length>0&&!e.done&&i>0;){--i;const r=this._index.getNode(s.add.back());if(null==r||2!==r.cacheState&&!this._hasNodeLoadToken(t))break;s.add.pop(),this._loadNode(r),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){const t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!(!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=O)&&(null==this.index||!this.dataRequester.isFull(this._index.urlPrefix))}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(this.layerView.contentVisible){const i=(this._index?.indexMissing??0)+3*(this._index?.updates.add.length??0)+2*this._loadingNodes.size;e=!!(i>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||null!=this._index&&this._index.isPrefetching),0===i&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(i,this._progressMaxNumNodes),t=1-i/this._progressMaxNumNodes}else e=this._cameraDirty,t=e?0:1;this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||null==this._index||null==this._viewportQueries)return;const e=this.layerView.view,{contentCamera:t,fixedContentCamera:i}=e.state;this._viewportQueries.updateCamera(t,!i||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange("rootNodeVisible")}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){const e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){if(this.fixedFeatureTarget)return 1;return(Math.min(this.layerView.view.quality,.5)-A)/(.5-A)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e))&&!(null==this._index||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(null==this._viewportQueries)return!1;const t=this._lodDropFactor;if(t>=1||!this._lodHandling.hasNoVisibleChildren(e))return!1;return Math.abs(this._viewportQueries.calcCameraDistanceToCenter(e))-this._viewportQueries.minDistance>(this._viewportQueries.maxDistance-this._viewportQueries.minDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;const e=this._index;if(this._updatesDisabled||null==e||null==this._viewportQueries)return;this._updateViewData(),this._requiredAttributesDirty&&(this._requiredAttributes=this._getRequiredAttributes(),this._requiredAttributesDirty=!1);const t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new w(this.layer,this.dataRequester,i.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return null!=this._nodeLoader&&null!=this._index}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){const t=this._index;if(null==t||null==this._viewportQueries)return!1;H.clear(),this.layerView.getLoadedNodeIndices(H);const i=0===this._viewportQueries.maxDistance,s=i?()=>!1:e=>this._shouldDropNode(e);return H.filterInPlace(e=>{const i=t.getNode(e);return null==i||!t.isGeometryVisible(e)||s(i)}),H.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(H,e,0),!(i&&this._lodDropFactor<1)&&(0===H.length||(H.clear(),!1))}markNodeToRemove(e){H.push(e)}removeMarkedNodes(){this._removeNodes(H,M,0)}_removeNodes(e,t,i){if(0!==e.length&&!t.done)for(null!=this._index&&this._index.requestUpdate();e.length>0&&!t.done;){const s=e.pop(),r=this._index;1===i&&this.layerView.nodeFadeoutEnabled&&null!=r&&r.isGeometryVisible(s)?this.layerView.fadeNode(s,1,!0):this.layerView.removeNode(s),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;const t=this.layerView.getLoadedAttributes(e.index);return null!=t&&t!==this._requiredAttributes}async _updateLoadedNode(e){const t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{const i=this.layerView.getLoadedAttributes(e.index),s=Q(i,this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:s},t.signal),t.signal)}catch(i){if(!d(i))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index))return void i.getLogger(this).error("already loading node "+e.index);const t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(i=>{i&&null!=this._index&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(e=>{if(!d(e))throw e}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return 1===e.cacheState?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!d(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||null==this._index)return!1;if(0===t&&!this._index.useNodeAsHole(e.index))return!0;const i=this._loadCachedGPUData(e);return!!i&&(this.layerView.addCachedGPUData(e,i,t),this._nodeAdded(),!0)}_loadCachedGPUData(e){const t=this.layerView.loadCachedGPUData(e.index);return null!=t?.attributeInfo&&Q(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){null!=this._index&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){const i=this._index;null!=i&&i.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;const i=this.layerView;if(this.disableIDBCache||!i.loadCachedNodeData||!i.addCachedNodeData)return!1;const s=(t,i)=>this._nodeLoader.loadTextures(e,t,i),r=(t,i)=>this._clientNodeLoader.loadTextures(e,t,i),a=e.index>=0?s:r,d=await this.schedule(()=>i.loadCachedNodeData(e,t,a),t);if(null==d)return!1;const n=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,n,t),t);return await this.reschedule(()=>i.addCachedNodeData(e,d,{loadedAttributes:n,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).catch(e=>{throw this._downloadingCount--,e}).then(i=>(this._downloadingCount--,this.schedule(()=>this.layerView.addNode(e,i,t),t))).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!d(t))throw i.getLogger(this).error("#loadNodeData()",this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),null!=this._index&&this._index.requestUpdate()}geometryFilterChanged(e){const t=this._index;null!=t&&t.layerFilterChanged(e),this._setCameraDirty()}};e([h({readOnly:!0})],U.prototype,"isMeshPyramid",null),e([h({readOnly:!0})],U.prototype,"isGraphics3D",null),e([h({readOnly:!0})],U.prototype,"useMaximumNumberOfFeatures",null),e([h({readOnly:!0})],U.prototype,"indexRequester",null),e([h({readOnly:!0})],U.prototype,"dataRequester",null),e([h({readOnly:!0})],U.prototype,"crsVertex",null),e([h({readOnly:!0})],U.prototype,"crsIndex",null),e([h()],U.prototype,"featureTarget",void 0),e([h()],U.prototype,"fixedFeatureTarget",void 0),e([h()],U.prototype,"layerView",void 0),e([h()],U.prototype,"layer",null),e([h()],U.prototype,"_updatingHandles",void 0),e([h()],U.prototype,"updating",null),e([h()],U.prototype,"running",void 0),e([h()],U.prototype,"updatingProgress",void 0),e([h({readOnly:!0})],U.prototype,"leavesReached",void 0),e([h({constructOnly:!0})],U.prototype,"worker",void 0),e([h({readOnly:!0,dependsOn:[]})],U.prototype,"rootNodeVisible",null),U=e([u("esri.layers.graphics.controllers.I3SOnDemandController")],U);const H=new r({deallocator:null});function Q(e,t){return null!=e&&e.length===t.length&&e.every(e=>j(t,e.name)>=0)}function j(e,t){const i=t.toLowerCase();for(let s=0;s<e.length;s++)if(e[s].name.toLowerCase()===i)return s;return-1}const T=g();export{U as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Error.js";import i from"../../../../core/Logger.js";import{createResolver as o}from"../../../../core/promiseUtils.js";import{addQueryParameters as s}from"../../../../core/urlUtils.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../geometry/SpatialReference.js";import{fromJSON as c}from"../../../../geometry/support/jsonUtils.js";import{WebSocketConnection as u}from"./WebSocketConnection.js";import{executeQuery as l}from"../../../../rest/query/operations/query.js";import f from"../../../../rest/support/Query.js";const h=1e4,d={maxQueryDepth:5,maxRecordCountFactor:3};let g=class extends u{constructor(e){super({...d,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||i.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:o}=this._config;this.destroyed||this._setFilter(r,o)}_onMessage(e){if("attributes"in e){let o;try{o=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(o.geometry)}catch(t){return void i.getLogger(this).error(new r("geoevent-connection","Failed to parse message",t))}this.onFeature(o)}else this.onMessage(e)}async _fetchServiceDefinition(e){const r={f:"json",...this._config.customParameters},i=t(e.path,{query:r,responseType:"json"}),o=(await i).data;return this._serviceDefinition=o,o}_fetchWebSocketUrl(e,t){const r=e[0],{urls:i,token:o}=r,n=this._inferWebSocketBaseUrl(i);return s(`${n}/subscribe`,{outSR:""+t.wkid,token:o})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return i.getLogger(this).error(new r("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if(null==s||null==e&&null==t)return;const n=JSON.stringify({filter:this._serializeFilter(e,t)});let a=!1;const c=o(),u=()=>{a||(this.destroyed||this._websocket!==s||i.getLogger(this).error(new r("geoevent-connection","Server timed out when setting filter")),c.reject())},l=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(i.getLogger(this).error(new r("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(s),a=!0,c.resolve())};return s.onmessage=l,s.send(n),setTimeout(u,h),c.promise}_serializeFilter(e,t){const o={};if(null==e&&null==t)return o;if(e?.geometry)try{const t=c(e.geometry);if("extent"!==t.type)throw new r("geoevent-connection",`Expected extent but found type ${t.type}`);o.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(s){i.getLogger(this).error(new r("geoevent-connection","Encountered an error when setting connection geometryDefinition",s))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(o.where=e.where),null!=t&&(o.outFields=t.join(",")),o}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,o=e.attributes[t],s=this._relatedFeatures.get(o);if(!s)return i.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:n,geometry:a}=s;for(const r in n)e.attributes[r]=n[r];return a&&(e.geometry=a),e.geometry||e.centroid||i.getLogger(this).error(new r("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),i=this._queryArchive(t);await r;const o=await i;if(!o)return;for(const s of o.features)this.onFeature(this._enrich(s))}catch(e){i.getLogger(this).error(new r("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await import("../../../FeatureLayer.js")).default)({url:e}),{capabilities:r}=await t.load(),i=r.query.supportsMaxRecordCountFactor,o=r.query.supportsPagination,s=r.query.supportsCentroid,n=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,u=i?c*n:c,h=new f;if(h.outFields=this._config.outFields??["*"],h.where=this._config.filter?.where??"1=1",h.returnGeometry=!0,h.returnExceededLimitFeatures=!0,h.outSpatialReference=a.fromJSON(this._config.spatialReference),s&&(h.returnCentroid=!0),i&&(h.maxRecordCountFactor=n),o)return h.num=u,t.destroy(),this._queryPages(e,h);const d=await l(e,h,this._config.sourceSpatialReference);return t.destroy(),d.data}async _queryPages(e,t,r=[],i=0){t.start=null!=t.num?i*t.num:null;const{data:o}=await l(e,t,this._config.sourceSpatialReference);return o.exceededTransferLimit&&i<(this._config.maxQueryDepth??0)?(o.features.forEach(e=>r.push(e)),this._queryPages(e,t,r,i+1)):(r.forEach(e=>o.features.push(e)),o)}_addRelatedFeatures(e){const t=new Map,r=e.features,i=this._serviceDefinition.relatedFeatures.joinField;for(const o of r){const e=o.attributes[i];t.set(e,o)}this._relatedFeatures=t}};g=e([n("esri.layers.graphics.sources.connections.GeoEventConnection")],g);export{g as default};
5
+ import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Error.js";import i from"../../../../core/Logger.js";import{createResolver as o}from"../../../../core/promiseUtils.js";import{addQueryParameters as s}from"../../../../core/urlUtils.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import a from"../../../../geometry/SpatialReference.js";import{fromJSON as c}from"../../../../geometry/support/jsonUtils.js";import{WebSocketConnection as u}from"./WebSocketConnection.js";import{executeQuery as l}from"../../../../rest/query/operations/query.js";import f from"../../../../rest/support/Query.js";const h=1e4,d={maxQueryDepth:5,maxRecordCountFactor:3};let g=class extends u{constructor(e){super({...d,...e}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const e=await this._fetchServiceDefinition(this._config.source);e.timeInfo.trackIdField||i.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const t=this._fetchWebSocketUrl(e.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(t);const{filter:r,outFields:o}=this._config;this.destroyed||this._setFilter(r,o)}_onMessage(e){if("attributes"in e){let o;try{o=this._enrich(e),null!=this._featureZScaler&&this._featureZScaler(o.geometry)}catch(t){return void i.getLogger(this).error(new r("geoevent-connection","Failed to parse message",t))}this.onFeature(o)}else this.onMessage(e)}async _fetchServiceDefinition(e){const r={f:"json",...this._config.customParameters},i=t(e.path,{query:r,responseType:"json"}),o=(await i).data;return this._serviceDefinition=o,o}_fetchWebSocketUrl(e,t){const r=e[0],{urls:i,token:o}=r,n=this._inferWebSocketBaseUrl(i);return s(`${n}/subscribe`,{outSR:""+t.wkid,token:o})}_inferWebSocketBaseUrl(e){if(1===e.length)return e[0];for(const t of e)if(t.includes("wss"))return t;return i.getLogger(this).error(new r("geoevent-connection","Unable to infer WebSocket url",e)),null}async _setFilter(e,t){const s=this._websocket;if(null==s||null==e&&null==t)return;const n=JSON.stringify({filter:this._serializeFilter(e,t)});let a=!1;const c=o(),u=()=>{a||(this.destroyed||this._websocket!==s||i.getLogger(this).error(new r("geoevent-connection","Server timed out when setting filter")),c.reject())},l=e=>{const t=JSON.parse(e.data);t.filter&&(t.error&&(i.getLogger(this).error(new r("geoevent-connection","Failed to set service filter",t.error)),this._set("errorString",`Could not set service filter - ${t.error}`),c.reject(t.error)),this._setWebSocketJSONParseHandler(s),a=!0,c.resolve())};return s.onmessage=l,s.send(n),setTimeout(u,h),c.promise}_serializeFilter(e,t){const o={};if(null==e&&null==t)return o;if(e?.geometry)try{const t=c(e.geometry);if("extent"!==t.type)throw new r("geoevent-connection",`Expected extent but found type ${t.type}`);o.geometry=JSON.stringify(t.shiftCentralMeridian())}catch(s){i.getLogger(this).error(new r("geoevent-connection","Encountered an error when setting connection geometryDefinition",s))}return e?.where&&"1 = 1"!==e.where&&"1=1"!==e.where&&(o.where=e.where),null!=t&&(o.outFields=t.join(",")),o}_enrich(e){if(!this._relatedFeatures)return e;const t=this._serviceDefinition.relatedFeatures.joinField,o=e.attributes[t],s=this._relatedFeatures.get(o);if(!s)return i.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",e),e;const{attributes:n,geometry:a}=s;for(const r in n)e.attributes[r]=n[r];return a&&(e.geometry=a),e.geometry||e.centroid||i.getLogger(this).error(new r("geoevent-connection","Found malformed feature - no geometry found",e)),e}async _queryBuddyServices(){try{const{relatedFeatures:e,keepLatestArchive:t}=this._serviceDefinition,r=this._queryRelatedFeatures(e),i=this._queryArchive(t);await r;const o=await i;if(!o)return;for(const s of o.features)this.onFeature(this._enrich(s))}catch(e){i.getLogger(this).error(new r("geoevent-connection","Encountered an error when querying buddy services",{error:e}))}}async _queryRelatedFeatures(e){if(!e)return;const t=await this._queryBuddy(e.featuresUrl);this._addRelatedFeatures(t)}async _queryArchive(e){if(e)return this._queryBuddy(e.featuresUrl)}async _queryBuddy(e){const t=new((await import("../../../FeatureLayer.js")).default)({url:e}),{capabilities:r}=await t.load(),i=r.query.supportsMaxRecordCountFactor,o=r.query.supportsPagination,s=r.query.supportsCentroid,n=this._config.maxRecordCountFactor,c=t.capabilities.query.maxRecordCount,u=i?c*n:c,h=new f;if(h.outFields=this._config.outFields??["*"],h.where=this._config.filter?.where??"1=1",h.returnGeometry=!0,h.returnExceededLimitFeatures=!0,h.outSpatialReference=a.fromJSON(this._config.spatialReference),s&&(h.returnCentroid=!0),i&&(h.maxRecordCountFactor=n),o)return h.num=u,t.destroy(),this._queryPages(e,h);const d=await l(e,h,this._config.sourceSpatialReference);return t.destroy(),d}async _queryPages(e,t,r=[],i=0){t.start=null!=t.num?i*t.num:null;const o=await l(e,t,this._config.sourceSpatialReference);return o.exceededTransferLimit&&i<(this._config.maxQueryDepth??0)?(o.features.forEach(e=>r.push(e)),this._queryPages(e,t,r,i+1)):(r.forEach(e=>o.features.push(e)),o)}_addRelatedFeatures(e){const t=new Map,r=e.features,i=this._serviceDefinition.relatedFeatures.joinField;for(const o of r){const e=o.attributes[i];t.set(e,o)}this._relatedFeatures=t}};g=e([n("esri.layers.graphics.sources.connections.GeoEventConnection")],g);export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import s from"../../../../core/Collection.js";import{toConst as r}from"../../../../core/compilerUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as u,create as p,expandWithRect as l,expandWithAABB as c,negativeInfinity as d,fromRect as f}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as y}from"../../data/QueryEngine.js";import{QueryEngineResult as h}from"../../data/QueryEngineResult.js";import{createDrawingInfo as g}from"./clientSideDefaults.js";import _ from"../../../support/Field.js";import w from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as I}from"../../../support/fieldUtils.js";import{fromParquetEncodingJSON as R}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as x,fromParquetJSONGeometryType as S,toParquetJSONGeometryType as F}from"../../../support/parquetUtils.js";import{createParquetFile as q,readGeoMetadata as C}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as b}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as v}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as O}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as j}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as Q}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const A=new b,E=8e3,P="__OBJECTID";class B{constructor(){this._fileInfos=new Map,this._queue=new n({concurrency:1,process:(e,t)=>this._executeQuery(e,t)})}async load(r){const n=r.spatialReference?a.fromJSON(r.spatialReference):void 0;if(n&&!n.isWGS84&&!n.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");const c=await x({urls:new s(r.urls),fields:r.fields?.map(e=>_.fromJSON(e)),encoding:r.encoding?R(r.encoding):r.encoding,geometryType:r.geometryType?S(r.geometryType):null,spatialReference:n},{customParameters:r.customParameters});let f;if(c.geometryType&&c.encoding){if(!c.spatialReference)throw new o("parquet:unsupported","SpatialReference must be defined");if(!c.spatialReference.isGeographic&&!c.spatialReference.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");c.spatialReference.isGeographic&&!c.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:c.spatialReference}),c.spatialReference=a.WGS84),f={geometryType:F(c.geometryType),spatialReference:c.spatialReference.toJSON(),encoding:c.encoding.toJSON(),displayOptimization:c.displayOptimization}}this.setCustomParameters(r.customParameters),this._geometryInfo=f;for(const e of r.urls){const t=await q(e,{geometryInfo:f,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(e,{index:this._fileInfos.size,file:t})}this._capabilities=k(await this.getFileStatistics());const m=this._fileInfos.values().next().value?.file;if(!m)return{layerDefinition:{},capabilities:k(null)};const{fields:y}=c;if(null==y)throw new o("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",y);y.push(new _({name:P,type:"oid",alias:P}));const h={fields:y.map(e=>({...e.toJSON(),column:m.columnForFieldName(e.name)})),timeZoneByFieldName:null},I=w.fromJSON(h);this._fieldsIndex=I;const C=F(c.geometryType??"point");if(this._metadata=j.createFeature({fieldsIndex:h,geometryType:C,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:c.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:f?.spatialReference??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},c.spatialReference&&(this._fullExtent=U(this._fileInfos.values(),c.spatialReference.toJSON())),null==this._fullExtent&&"location"===c.encoding?.type){const{latitudeFieldName:s,longitudeFieldName:r}=c.encoding,o=this._fieldsIndex.get(s)?.column,i=this._fieldsIndex.get(r)?.column,n=u(p(),d);for(const a of this._fileInfos.values())for(const s of a.file.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(o),!1),a=e(r,s.columnDescriptorForAttribute(i),!1),u=[a.minValue(),t.minValue(),a.maxValue(),t.maxValue()];l(n,u),s.free()}catch(b){r.error=b,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:c.spatialReference?.toJSON()}}return{capabilities:this._capabilities,layerDefinition:{fields:c.fields?.map(e=>e.toJSON()),drawingInfo:g(C),extent:this._fullExtent??void 0,geometryType:C,encoding:c.encoding?.toJSON(),displayOptimization:c.displayOptimization}}}destroy(){for(const e of this._fileInfos.values())e.file.free();this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}getFileStatistics(){if(!this._fileInfos.size)return null;const e=Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.byteLength(),0);return{featureCount:this._getFeatureCount(),byteLength:e}}async updateFiles(e){const t=new Set(e);for(const[s,r]of this._fileInfos.entries())t.has(s)?t.delete(s):(r.file.free(),this._fileInfos.delete(s));for(const s of t){const e=await q(s,{geometryInfo:this._geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(s,{index:this._fileInfos.size,file:e})}}async queryFeatures(e,t){this._validateQuery(e),N(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!T(e))return this._getFeatureCount();delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!T(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!T(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.returnGeometry=!0,delete e.outFields;const o=u(p(),d),i=p(),n=await this._enqueueQuery(e,t);let a=0;for(const r of n.items)r.getBounds(i)&&(c(o,i),a+=1);return{count:a,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new o("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new o("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new o("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async*_fetchChunks(e,t){for(const s of this._fileInfos.values()){const r=s.file.numRows(),o=Math.ceil(r/E);for(let i=0;i<o;i++){const r=i*E,o=await s.file.readChunk(r,E,e.fields,e.returnGeometry,t);for(const e of o){const t=new Q(this._metadata,this._fieldsIndex,e,0,s.index),r=D([new v(t,null,0,!1)],this._queryEngineParams);yield r}}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const s=await this._getReadParams(e);if(e.objectIds?.length)for(const n of this._fileInfos.values()){const r=[],o=D((await n.file.readChunksByRowId(new Uint32Array(e.objectIds),s.fields,s.returnGeometry,t)).map((e,t)=>new Q(this._metadata,this._fieldsIndex,e,t,n.index)).map((e,t)=>new v(e,null,t,!1)),this._queryEngineParams),i=await o.executeQueryForOpaqueFeatures(e,t);for(const e of i)r.push(e);return new h(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}let r=e.resultRecordCount??this._getFeatureCount(),o=e.resultOffset??0;delete e.resultRecordCount,delete e.resultOffset;const i=[];for await(const n of this._fetchChunks(s,t)){const s=await n.executeQueryForOpaqueFeatures(e,t);if(s.length>o){const t=s.slice(o,Math.min(o+r,s.length));for(const e of t)i.push(e);if(o=0,r-=t.length,0===r)return new h(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}else o-=s.length}return new h(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}async _getReadParams(e){const t=new Set;if(e.where&&await I(t,this._fieldsIndex,e.where),e.outStatistics)for(const s of e.outStatistics)null!=s.onStatisticField&&t.add(s.onStatisticField);if(e.outFields)for(const s of e.outFields)t.add(s);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const s of e){const e=this._fieldsIndex.get(s);if(null==e)throw new o("unknown-field",`Field ${s} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function T(e){return Object.keys(e).some(e=>G(e))}function G(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function D(e,t){const s=new O(null);for(const r of e)s.insert(r);return new y({...t,featureStore:s})}function M(e){switch(e.length){case 4:return f(p(),e);case 6:return e;default:throw new o("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function U(e,t){const s=u(p(),d);for(const r of e){const e=C(r.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=M(t.bbox);c(s,o)}return{xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:t}}function k(e){const t=e?.featureCount;let s=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(s=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:s,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:s,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:s,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function N(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{B as default};
5
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import s from"../../../../core/Collection.js";import{toConst as r}from"../../../../core/compilerUtils.js";import o from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{QueueProcessor as n}from"../../../../core/QueueProcessor.js";import a from"../../../../geometry/SpatialReference.js";import{set as u,create as p,expandWithRect as l,expandWithAABB as c,negativeInfinity as d,fromRect as f}from"../../../../geometry/support/aaBoundingBox.js";import{getQueryResultExtent as m,QueryEngine as y}from"../../data/QueryEngine.js";import{QueryEngineResult as h}from"../../data/QueryEngineResult.js";import{createDrawingInfo as g}from"./clientSideDefaults.js";import _ from"../../../support/Field.js";import w from"../../../support/FieldsIndex.js";import{collectSQLFieldNames as I}from"../../../support/fieldUtils.js";import{fromParquetEncodingJSON as R}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as x,fromParquetJSONGeometryType as S,toParquetJSONGeometryType as F}from"../../../support/parquetUtils.js";import{createParquetFile as q,readGeoMetadata as C}from"../../../../libs/parquet/parquet.js";import{FeatureStoreQueryAdapter as b}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as v}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as O}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as j}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as Q}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const A=new b,E=4,P=8e3,B="__OBJECTID";class T{constructor(){this._fileInfos=new Map,this._queue=new n({concurrency:E,process:(e,t)=>this._executeQuery(e,t)})}async load(r){const n=r.spatialReference?a.fromJSON(r.spatialReference):void 0;if(n&&!n.isWGS84&&!n.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");const c=await x({urls:new s(r.urls),fields:r.fields?.map(e=>_.fromJSON(e)),encoding:r.encoding?R(r.encoding):r.encoding,geometryType:r.geometryType?S(r.geometryType):null,spatialReference:n},{customParameters:r.customParameters});let f;if(c.geometryType&&c.encoding){if(!c.spatialReference)throw new o("parquet:unsupported","SpatialReference must be defined");if(!c.spatialReference.isGeographic&&!c.spatialReference.isWebMercator)throw new o("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");c.spatialReference.isGeographic&&!c.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:c.spatialReference}),c.spatialReference=a.WGS84),f={geometryType:F(c.geometryType),spatialReference:c.spatialReference.toJSON(),encoding:c.encoding.toJSON(),displayOptimization:c.displayOptimization}}this.setCustomParameters(r.customParameters),this._geometryInfo=f;const m=r.urls;for(const e of m){const t=await q(e,{geometryInfo:f,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(e,{index:this._fileInfos.size,file:t})}this._capabilities=N(await this.getFileStatistics());const y=this._fileInfos.values().next().value?.file;if(!y)return{layerDefinition:{},capabilities:N(null)};const{fields:h}=c;if(null==h)throw new o("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",h);h.push(new _({name:B,type:"oid",alias:B}));const I={fields:h.map(e=>({...e.toJSON(),column:y.columnForFieldName(e.name)})),timeZoneByFieldName:null},C=w.fromJSON(I);this._fieldsIndex=C;const b=F(c.geometryType??"point");if(this._metadata=j.createFeature({fieldsIndex:I,geometryType:b,featureIdInfo:{type:"object-id",fieldName:"rowId"},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:c.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:f?.geometryType??"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"rowId"},hasM:!1,hasZ:!1,spatialReference:f?.spatialReference??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},c.spatialReference&&(this._fullExtent=k(this._fileInfos.values(),c.spatialReference.toJSON())),null==this._fullExtent&&"location"===c.encoding?.type){const{latitudeFieldName:s,longitudeFieldName:r}=c.encoding,o=this._fieldsIndex.get(s)?.column,i=this._fieldsIndex.get(r)?.column,n=u(p(),d);for(const a of this._fileInfos.values())for(const s of a.file.rowGroups()){const r={stack:[],error:void 0,hasError:!1};try{const t=e(r,s.columnDescriptorForAttribute(o),!1),a=e(r,s.columnDescriptorForAttribute(i),!1),u=[a.minValue(),t.minValue(),a.maxValue(),t.maxValue()];l(n,u),s.free()}catch(v){r.error=v,r.hasError=!0}finally{t(r)}}this._fullExtent={xmin:n[0],ymin:n[1],xmax:n[3],ymax:n[4],spatialReference:c.spatialReference?.toJSON()}}return{capabilities:this._capabilities,layerDefinition:{fields:c.fields?.map(e=>e.toJSON()),drawingInfo:g(b),extent:this._fullExtent??void 0,geometryType:b,encoding:c.encoding?.toJSON(),displayOptimization:c.displayOptimization}}}destroy(){for(const e of this._fileInfos.values())e.file.free();this._fileInfos.clear(),this._queue.destroy()}setCustomParameters(e){this._customParameters=e}getFileStatistics(){if(!this._fileInfos.size)return null;const e=Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.byteLength(),0);return{featureCount:this._getFeatureCount(),byteLength:e}}async updateFiles(e){const t=new Set(e);for(const[s,r]of this._fileInfos.entries())t.has(s)?t.delete(s):(r.file.free(),this._fileInfos.delete(s));for(const s of t){const e=await q(s,{geometryInfo:this._geometryInfo,outSpatialReference:null,getCustomParameters:()=>this._customParameters});this._fileInfos.set(s,{index:this._fileInfos.size,file:e})}}async queryFeatures(e,t){this._validateQuery(e),z(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0),(e.outStatistics||e.returnDistinctValues)&&delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){if(this._validateQuery(e),!G(e))return this._getFeatureCount();delete e.outFields,delete e.returnGeometry;return(await this._enqueueQuery(e,t)).createQueryResponseForCount()}async queryObjectIds(e,t){if(this._validateQuery(e),!G(e))return Array.from({length:this._getFeatureCount()},(e,t)=>t);e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,8e3):8e3,e.resultOffset=e.resultOffset??0,delete e.returnGeometry,delete e.outFields;return(await this._enqueueQuery(e,t)).items.map(e=>e.getObjectId())}async queryExtent(e,t){if(this._validateQuery(e),this._fullExtent&&!G(e))return{count:this._getFeatureCount(),extent:this._fullExtent};const s=r(this._metadata.spatialReference);e.returnGeometry=!0,delete e.outFields;const o=u(p(),d),i=p(),n=await this._enqueueQuery(e,t);let a=0;for(const r of n.items)r.getBounds(i)&&(c(o,i),a+=1);return{count:a,extent:m(o,s,e.outSR?r(e.outSR):s,s,!1)}}_getFeatureCount(){return Array.from(this._fileInfos.values()).reduce((e,t)=>e+t.file.numRows(),0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new o("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new o("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new o("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async*_fetchChunks(e,t){for(const s of this._fileInfos.values()){const r=s.file.numRows(),o=Math.ceil(r/P);for(let i=0;i<o;i++){const r=i*P,o=await s.file.readChunk(r,P,e.fields,e.returnGeometry,t);for(const e of o){const t=new Q(this._metadata,this._fieldsIndex,e,0,s.index),r=M([new v(t,null,0,!1)],this._queryEngineParams);yield r}}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){const s=await this._getReadParams(e);if(e.objectIds?.length)for(const n of this._fileInfos.values()){const r=[],o=M((await n.file.readChunksByRowId(new Uint32Array(e.objectIds),s.fields,s.returnGeometry,t)).map((e,t)=>new Q(this._metadata,this._fieldsIndex,e,t,n.index)).map((e,t)=>new v(e,null,t,!1)),this._queryEngineParams),i=await o.executeQueryForOpaqueFeatures(e,t);for(const e of i)r.push(e);return new h(r,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}let r=e.resultRecordCount??this._getFeatureCount(),o=e.resultOffset??0;delete e.resultRecordCount,delete e.resultOffset;const i=[];for await(const n of this._fetchChunks(s,t)){const s=await n.executeQueryForOpaqueFeatures(e,t);if(s.length>o){const t=s.slice(o,Math.min(o+r,s.length));for(const e of t)i.push(e);if(o=0,r-=t.length,0===r)return new h(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}else o-=s.length}return new h(i,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,objectIdField:"rowId",hasM:!1,hasZ:!1,featureAdapter:A})}async _getReadParams(e){const t=new Set;if(e.where&&await I(t,this._fieldsIndex,e.where),e.outStatistics)for(const s of e.outStatistics)null!=s.onStatisticField&&t.add(s.onStatisticField);if(e.outFields)for(const s of e.outFields)t.add(s);return{fields:this._getAttributeIds(Array.from(t)),returnGeometry:!!e.returnGeometry||!!e.geometry}}_getAttributeIds(e){if(null==e)return new Uint32Array;if(e.includes("*"))return new Uint32Array(this._fieldsIndex.fields.map(e=>e.column).filter(e=>null!=e));const t=[];for(const s of e){const e=this._fieldsIndex.get(s);if(null==e)throw new o("unknown-field",`Field ${s} does not exist`);null==e.column||t.push(e.column)}return new Uint32Array(t)}}function G(e){return Object.keys(e).some(e=>D(e))}function D(e){switch(e){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"where":case"objectIds":case"historicMoment":return!0;default:return!1}}function M(e,t){const s=new O;for(const r of e)s.insert(r);return new y({...t,featureStore:s})}function U(e){switch(e.length){case 4:return f(p(),e);case 6:return e;default:throw new o("parquet:protocol-violation","Invalid Geoparquet file. BoundingBox size must be 4 or 6.",{bbox:e})}}function k(e,t){const s=u(p(),d);for(const r of e){const e=C(r.file);if(!e)return null;const t=e.columns[e.primary_column];if(!t.bbox)return null;const o=U(t.bbox);c(s,o)}return{xmin:s[0],ymin:s[1],xmax:s[3],ymax:s[4],spatialReference:t}}function N(e){const t=e?.featureCount;let s=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(s=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:8e3,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,standardMaxRecordCount:void 0,supportsCacheHint:!1,supportsCentroid:!0,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:s,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:s,supportsPagination:!0,supportsPaginationOnAggregatedQueries:!1,supportsPercentileStatistics:!1,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsStatistics:s,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,supportsSqlExpression:!1,supportsTrueCurve:!1,tileMaxRecordCount:void 0},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function z(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import r from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import y from"./CameraOrientation.js";import d from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,getArcGISServerUrl as h,getMetersPerUnitOfSR as v,orientedImageryTypeMap as w}from"./utils.js";import{ltpToGeographic as O}from"../transformations/utils.js";function b(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function j(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const S=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),I=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}}),N="$virtualCacheDirectory:";let F=class extends(t(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}writeGeometry(e,t){t.geometry=this._geometry.toJSON()}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||j("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;if(r.startsWith(N)){return`${h(o.url)}${r.replace(N,o.virtualCacheDirectory+"/")}`}return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return"360"===this.orientedImageryType}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(4===t){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(O([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw b("cameraHeight");const o=this.geometry.clone(),i=(r??0)+t/v(o.spatialReference);if("360"===this.orientedImageryType&&o.hasZ){const e=i-o.z;return null!=r&&Math.abs(e)>.001&&(a.getLogger(this).warnOnce("The elevation value is different from the geometry's z value. The geometry's z value will be updated.",{elevation:r,geometryZ:o.z}),o.z=i),o}return o.z=o.hasZ?o.z:i,o}set matrix(e){if(e)return 9!==e.length?(a.getLogger(this).warnOnce("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null)):void this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=w.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e){if("string"==typeof e){const[t,r,o]=e.split(";").map(Number);return void this._set("radial",[t??0,r??0,o??0])}this._set("radial",e)}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e){if("string"==typeof e){const[t,r]=e.split(";").map(Number);return void this._set("tangential",[t??0,r??0])}this._set("tangential",e)}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}clone(){const e=super.clone();return e._geometry=this._geometry.clone(),e}};e([i()],F.prototype,"_geometry",void 0),e([i(S())],F.prototype,"a0",void 0),e([i(S())],F.prototype,"a1",void 0),e([i(S())],F.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],F.prototype,"acquisitionDate",void 0),e([i(S())],F.prototype,"b0",void 0),e([i(S())],F.prototype,"b1",void 0),e([i(S())],F.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],F.prototype,"cameraHeading",void 0),e([p("cameraHeading")],F.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],F.prototype,"readCameraHeight",null),e([i()],F.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],F.prototype,"readCamOffset",null),e([l("cameraOffset")],F.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:y}),n(e=>e?d.getCameraOrientation(e):null)],F.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],F.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],F.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],F.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],F.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],F.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],F.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],F.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],F.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],F.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],F.prototype,"readFarDistance",null),e([i(S("focallength"))],F.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],F.prototype,"geometry",null),e([l("geometry")],F.prototype,"writeGeometry",null),e([i({type:Number,json:{write:!0}})],F.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],F.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],F.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],F.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],F.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],F.prototype,"readImageRotation",null),e([i()],F.prototype,"isHorizontal",null),e([i()],F.prototype,"isInspection",null),e([i()],F.prototype,"isNadir",null),e([i()],F.prototype,"isOblique",null),e([i()],F.prototype,"isSpherical",null),e([i()],F.prototype,"location",null),e([i(I())],F.prototype,"matrix",null),e([i({json:{write:!0},type:String})],F.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],F.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],F.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],F.prototype,"readOffsetFromStart",null),e([i()],F.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],F.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],F.prototype,"writeOrientationAccuracy",null),e([s(w)],F.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],F.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],F.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],F.prototype,"principalY",void 0),e([i(I([0,0,0]))],F.prototype,"radial",null),e([i({type:String})],F.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],F.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],F.prototype,"writeSequenceOrder",null),e([i({type:Object})],F.prototype,"sourceMap",void 0),e([i(I([0,0]))],F.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],F.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],F.prototype,"readVFOV",null),F=e([c("esri.layers.orientedImagery.core.ExposurePoint")],F);export{F as default};
5
+ import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import r from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import a from"../../../core/Logger.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../../core/accessorSupport/decorators/writer.js";import m from"../../../geometry/Point.js";import{getGeometryZScaler as u}from"../../../geometry/support/zscale.js";import y from"./CameraOrientation.js";import d from"./cameraOrientationFactory.js";import{appendPrefixAndSuffix as f,getEffectiveElevationSource as g,getArcGISServerUrl as h,getMetersPerUnitOfSR as v,orientedImageryTypeMap as w}from"./utils.js";import{ltpToGeographic as O}from"../transformations/utils.js";function b(e){throw new r("exposure-point:missing-default-value",`a value for ${e} is missing in default properties`)}function j(e,t){throw new r("exposure-point:missing-attribute-value",`a value for ${e} is missing in attribute table`,{exposurePoint:t})}const S=e=>({cast:e=>{const t=parseFloat(e);return Number.isFinite(t)?t:void 0},json:{name:e,write:{writer:(e,t,r)=>{t[r]=Number.isFinite(e)?e:void 0}}}}),I=e=>({cast:e=>"string"==typeof e?e.split(";").map(Number):e,json:{default:e,write:{writer:(e,t,r)=>{t[r]=e?.join(";")}}}}),N="$virtualCacheDirectory:";let F=class extends(t(o)){constructor(e){super(e),this._geometry=null,this.cameraOrientation=null,this.elevation=null,this.elevationSource=null,this.name=null,this.sourceMap=null}read(e,t){const r={},{attributes:o,geometry:a}=e,i={};for(const s in o)r[s.toLowerCase()]=o[s],i[s.toLowerCase()]=s;const n=e.layer??{};n.sequenceOrderField?.length&&(r.sequenceorder=o[n.sequenceOrderField],i.sequenceorder=n.sequenceOrderField),super.read({geometry:a,layer:n,sourceMap:i,...r},t)}write(e,t){const r=super.write(e,t),{sourceMap:o}=this;if(!o||!r)return r;const a={};for(const i in r){const e=o[i.toLowerCase()];e&&(a[e]=r[i])}return a}readCameraHeading(e,t){const{cameraheading:r,camheading:o,layer:a}=t;return r??o??a.cameraHeading}readCameraHeight(e,t){const{cameraheight:r,avghtag:o,layer:a}=t;return r??o??a.cameraHeight}readCamOffset(e,t){const{cameraoffset:r,camoffset:o}=t;return r?.split(";").map(Number)??o?.split(";").map(Number)??null}writeCameraOffset(e,t){e&&(t.cameraOffset=e.join(";"))}readCameraOrientation(e,t){const{cameraorientation:r,camori:o}=t;return r??o}readCameraPitch(e,t){const{camerapitch:r,campitch:o,layer:a}=t;return r??o??a.cameraPitch}readCameraRoll(e,t){const{cameraroll:r,camroll:o,layer:a}=t;return r??o??a.cameraRoll}readDepthImage(e,t){const{depthimage:r,depthimg:o,layer:a}=t,i=r??o??null,{depthImagePathPrefix:n,depthImagePathSuffix:s}=a??{};return f(i,n,s)}readElevationSource(e,t){const{elevationsource:r,layer:o}=t,{demPathSuffix:a,demPathPrefix:i}=o;if(r){const e=this._parseIfJSON(r);return g(e,i,a)}return o.effectiveElevationSource}readFarDistance(e,t){const{fardistance:r,fardist:o,layer:a}=t;return r??o??a.farDistance}get geometry(){const e=this._geometry.clone();if(!e)return null;const{cameraOffset:t}=this;if(t){const[r,o,a]=t;e.x+=r,e.y+=o,null!=e.z&&null!=a&&(e.z+=a)}return e}set geometry(e){this._geometry=e}writeGeometry(e,t){t.geometry=this._geometry.toJSON()}readHFOV(e,t){const{horizontalfieldofview:r,hfov:o,layer:a}=t;return r??o??a.horizontalFieldOfView}readImageURL(e,t){const{imagepath:r,layer:o}=t;r||j("imagePath",this);const{imagePathPrefix:a,imagePathSuffix:i}=o;if(r.startsWith(N)){return`${h(o.url)}${r.replace(N,o.virtualCacheDirectory+"/")}`}return f(r,a,i)}readImageRotation(e,t){const{imagerotation:r,imgrot:o,layer:a}=t;return r??o??a.imageRotation}get isHorizontal(){return"horizontal"===this.orientedImageryType}get isInspection(){return"inspection"===this.orientedImageryType}get isNadir(){return"nadir"===this.orientedImageryType}get isOblique(){return"oblique"===this.orientedImageryType}get isSpherical(){return this.orientedImageryType?.includes("360")??!1}get location(){const{cameraOrientation:e,cameraHeight:t,elevation:r}=this;if(e){const{type:t,x:r,y:o,z:a,horizontalWKID:i,verticalWKID:n}=e,s="number"==typeof i?{wkid:i}:{wkt:i};if(4===t){const{latitude:t,longitude:r,ellipsoidRadius:o,squaredEccentricity:a,properties:i}=e,{x:n,y:s,z:p}=i;return new m(O([n,s,p],[t,r,o,a]))}const p=new m({x:r,y:o,z:a,spatialReference:s}),c=n?u("point",{wkid:n},s):null;return c&&c(p),p}if("number"!=typeof t)throw b("cameraHeight");const o=this.geometry.clone(),i=(r??0)+t/v(o.spatialReference);if("360"===this.orientedImageryType&&o.hasZ){const e=i-o.z;return null!=r&&Math.abs(e)>.001&&(a.getLogger(this).warnOnce("The elevation value is different from the geometry's z value. The geometry's z value will be updated.",{elevation:r,geometryZ:o.z}),o.z=i),o}return o.z=o.hasZ?o.z:i,o}set matrix(e){if(e)return 9!==e.length?(a.getLogger(this).warnOnce("Ignoring rotation matrix because it doesn't have 9 values",{value:e}),void this._set("matrix",null)):void this._set("matrix",e)}readNearDistance(e,t){const{neardistance:r,neardist:o,layer:a}=t;return r??o??a.nearDistance}readOffsetFromStart(e,t){return t.offsetfromstart??null}readOrientationAccuracy(e,t){const{accuracy:r,orientationaccuracy:o}=t;return o?.split(";").map(Number)??r?.split(";").map(Number)??null}writeOrientationAccuracy(e,t){e&&(t.orientationAccuracy=e.join(";"))}readOIType(e,t){const{orientedimagerytype:r,oitype:o,camerapitch:a,campitch:i,layer:n}=t,s=w.read(r??o??n.orientedImageryType),p=a??i??n.cameraPitch;return"oblique"===s?p<10?"nadir":"oblique":s}set radial(e){if(e){if("string"==typeof e){const[t,r,o]=e.split(";").map(Number);return void this._set("radial",[t??0,r??0,o??0])}this._set("radial",e)}else this._set("radial",[0,0,0])}readSequenceOrder(e,t){const{layer:r}=t;return t[r.sequenceOrderField.toLowerCase()]}writeSequenceOrder(e,t){if(!e)return;const{sourceMap:r}=this;if(r){t[r.sequenceorder]=e}}set tangential(e){if(e){if("string"==typeof e){const[t,r]=e.split(";").map(Number);return void this._set("tangential",[t??0,r??0])}this._set("tangential",e)}else this._set("tangential",[0,0])}readVFOV(e,t){const{verticalfieldofview:r,vfov:o,layer:a}=t;return r??o??a.verticalFieldOfView}_parseIfJSON(e){let t=null;try{t=JSON.parse(e)}catch(r){a.getLogger(this).error("couldn't parse the given elevation source JSON",e,r)}return t}clone(){const e=super.clone();return e._geometry=this._geometry.clone(),e}};e([i()],F.prototype,"_geometry",void 0),e([i(S())],F.prototype,"a0",void 0),e([i(S())],F.prototype,"a1",void 0),e([i(S())],F.prototype,"a2",void 0),e([i({type:Date,json:{write:{enabled:!0,target:"acquisitionDate"},name:"acquisitiondate"}})],F.prototype,"acquisitionDate",void 0),e([i(S())],F.prototype,"b0",void 0),e([i(S())],F.prototype,"b1",void 0),e([i(S())],F.prototype,"b2",void 0),e([i({type:Number,json:{write:!0,read:{source:["cameraheading","camheading","layer.cameraHeading"]}}})],F.prototype,"cameraHeading",void 0),e([p("cameraHeading")],F.prototype,"readCameraHeading",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraHeight",void 0),e([p("cameraHeight",["cameraheight","avghtag","layer.cameraHeight"])],F.prototype,"readCameraHeight",null),e([i()],F.prototype,"cameraOffset",void 0),e([p("cameraOffset",["cameraoffset","camoffset"])],F.prototype,"readCamOffset",null),e([l("cameraOffset")],F.prototype,"writeCameraOffset",null),e([i({json:{write:{writer:(e,t,r)=>{t[r]=e.toString()}}},type:y}),n(e=>e?d.getCameraOrientation(e):null)],F.prototype,"cameraOrientation",void 0),e([p("cameraOrientation",["cameraorientation","camori"])],F.prototype,"readCameraOrientation",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraPitch",void 0),e([p("cameraPitch",["camerapitch","campitch","layer.cameraPitch"])],F.prototype,"readCameraPitch",null),e([i({type:Number,json:{write:!0}})],F.prototype,"cameraRoll",void 0),e([p("cameraRoll",["cameraroll","camroll","layer.cameraRoll"])],F.prototype,"readCameraRoll",null),e([i({json:{write:!0},type:String})],F.prototype,"depthImage",void 0),e([p("depthImage",["depthimage","depthimg"])],F.prototype,"readDepthImage",null),e([i({type:Number,json:{write:!0}})],F.prototype,"elevation",void 0),e([i({json:{write:!0},clonable:"reference"})],F.prototype,"elevationSource",void 0),e([p("elevationSource",["elevationsource","layer.effectiveElevationSource"])],F.prototype,"readElevationSource",null),e([i({json:{name:"exposurestationid",write:{target:"exposureStationId"}},type:String})],F.prototype,"exposureStationId",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"farDistance",void 0),e([p("farDistance",["fardistance","fardist","layer.farDistance"])],F.prototype,"readFarDistance",null),e([i(S("focallength"))],F.prototype,"focalLength",void 0),e([i({type:m,json:{name:"geometry"}})],F.prototype,"geometry",null),e([l("geometry")],F.prototype,"writeGeometry",null),e([i({type:Number,json:{write:!0}})],F.prototype,"horizontalFieldOfView",void 0),e([p("horizontalFieldOfView",["horizontalfieldofview","hfov","layer.horizontalFieldOfView"])],F.prototype,"readHFOV",null),e([i({json:{write:!0},type:String})],F.prototype,"imagePath",void 0),e([p("imagePath",["imagepath"])],F.prototype,"readImageURL",null),e([i({type:Number,json:{write:!0}})],F.prototype,"imageRotation",void 0),e([p("imageRotation",["imagerotation","imgrot","layer.imageRotation"])],F.prototype,"readImageRotation",null),e([i()],F.prototype,"isHorizontal",null),e([i()],F.prototype,"isInspection",null),e([i()],F.prototype,"isNadir",null),e([i()],F.prototype,"isOblique",null),e([i()],F.prototype,"isSpherical",null),e([i()],F.prototype,"location",null),e([i(I())],F.prototype,"matrix",null),e([i({json:{write:!0},type:String})],F.prototype,"name",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"nearDistance",void 0),e([p("nearDistance",["neardistance","neardist","layer.nearDistance"])],F.prototype,"readNearDistance",null),e([i({json:{write:!0,name:"objectid"},type:Number})],F.prototype,"objectId",void 0),e([i({type:Number,json:{write:!0}})],F.prototype,"offsetFromStart",void 0),e([p("offsetFromStart",["offsetfromstart"])],F.prototype,"readOffsetFromStart",null),e([i()],F.prototype,"orientationAccuracy",void 0),e([p("orientationAccuracy",["accuracy","orientationaccuracy"])],F.prototype,"readOrientationAccuracy",null),e([l("orientationAccuracy")],F.prototype,"writeOrientationAccuracy",null),e([s(w)],F.prototype,"orientedImageryType",void 0),e([p("orientedImageryType",["orientedimagerytype","oitype","layer.orientedImageryType"])],F.prototype,"readOIType",null),e([i({type:Number,json:{write:!0,read:{source:"principalx"}}})],F.prototype,"principalX",void 0),e([i({type:Number,json:{write:!0,read:{source:"principaly"}}})],F.prototype,"principalY",void 0),e([i(I([0,0,0]))],F.prototype,"radial",null),e([i({type:String})],F.prototype,"sequenceOrder",void 0),e([p("sequenceOrder",["sequenceorder","layer.sequenceOrderField"])],F.prototype,"readSequenceOrder",null),e([l("sequenceOrder")],F.prototype,"writeSequenceOrder",null),e([i({type:Object})],F.prototype,"sourceMap",void 0),e([i(I([0,0]))],F.prototype,"tangential",null),e([i({type:Number,json:{write:!0}})],F.prototype,"verticalFieldOfView",void 0),e([p("verticalFieldOfView",["verticalfieldofview","vfov","layer.verticalFieldOfView"])],F.prototype,"readVFOV",null),F=e([c("esri.layers.orientedImagery.core.ExposurePoint")],F);export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{clone as n}from"../../core/lang.js";import e from"./FieldConfiguration.js";import{isFormattableField as o,fieldFormatFromFieldInfoFormat as t,defaultFieldFormat as l,fieldInfoFormatFromFieldFormat as i}from"./fieldFormatUtils.js";import{isFieldEditable as f}from"./fieldUtils.js";import s from"../../popup/FieldInfo.js";function r(n){const{popupTemplate:i,fieldsIndex:f}=n,s=i?.fieldInfos;if(!s?.length||!f)return;const r=[];for(const{fieldName:a,label:u,format:m}of s){const n=f.get(a);if(!n)continue;const i=u&&u!==n.alias?u:null,s=o(n)?m?t(m,n):l(n,{hour12:"always",useGrouping:"always"}):null;(i||s)&&r.push(new e({name:n.name,alias:i,fieldFormat:s}))}return r.length?r:null}function a(n){const{fields:t}=n;if(!t?.length)return;const i=[];for(const f of t){const n=o(f)?l(f):null;n&&i.push(new e({name:f.name,fieldFormat:n}))}return i.length?i:null}function u(n,e){const{popupTemplate:o,fieldsIndex:t}=n;if(!o||!t)return;const l=m(n,e,o.fieldInfos);if(!l)return;const i=o.clone();return i.fieldInfos=l,i}function m(e,t,l){t??=[],l=l?n(l):[];let f=!1;const s=new Map;for(const n of t){const o=e.fieldsIndex.get(n.name);o&&s.set(o.name,n)}for(const n of l){const t=e.fieldsIndex.get(n.fieldName);if(!t)continue;const l=s.get(t.name);n.label=l?.alias||t.alias,n.format=o(t)&&l?.fieldFormat?i(l.fieldFormat,t):null,f=!0,s.delete(t.name)}for(const n of s.values()){const o=c(e,n);o&&(l.push(o),f=!0)}return f?l:null}function c(n,e){const{name:t,alias:l,fieldFormat:r}=e,a=n.fieldsIndex.get(t);if(!a||!l&&!r)return;const u=l||a.alias,m=o(a)&&r?i(r,a):null;return new s({fieldName:a.name,label:u,format:m,visible:!1,isEditable:f(a,n)})}export{a as fieldConfigurationsFromFields,r as fieldConfigurationsFromPopupTemplate,u as popupTemplateWithFieldConfigurations};
5
+ import{clone as n}from"../../core/lang.js";import e from"./FieldConfiguration.js";import{isFormattableField as o,fieldFormatFromFieldInfoFormat as t,defaultFieldFormat as s,fieldInfoFormatFromFieldFormat as l}from"./fieldFormatUtils.js";import{isFieldEditable as f}from"./fieldUtils.js";import i from"../../popup/FieldInfo.js";function r(n){const{popupTemplate:l,fieldsIndex:f}=n,i=l?.fieldInfos;if(!i?.length||!f)return;const r=[];for(const{fieldName:a,label:u,format:c}of i){const n=f.get(a);if(!n)continue;const l=u&&u!==n.alias?u:null,i=o(n)?c?t(c,n):s(n,{hour12:"always",useGrouping:"always"}):null;(l||i)&&r.push(new e({name:n.name,alias:l,fieldFormat:i}))}return r.length?r:null}function a(n){const{fields:t}=n;if(!t?.length)return;const l=[];for(const f of t){const n=o(f)?s(f):null;n&&l.push(new e({name:f.name,fieldFormat:n}))}return l.length?l:null}function u(n,e){const{popupTemplate:o,fieldsIndex:t}=n;if(!o||!t)return;const s=c(n,e,o.fieldInfos);if(!s)return;const l=o.clone();return l.fieldInfos=s,l}function c(e,t,s){t??=[],s=n(s)??[];let f=!1;const i=new Map;for(const n of t){const o=e.fieldsIndex.get(n.name);o&&i.set(o.name,n)}for(const n of s){const t=e.fieldsIndex.get(n.fieldName);if(!t)continue;const s=i.get(t.name);n.label=s?.alias||t.alias,n.format=o(t)&&s?.fieldFormat?l(s.fieldFormat,t):null,f=!0,i.delete(t.name)}for(const n of i.values()){const o=m(e,n);o&&(s.push(o),f=!0)}return f?s:null}function m(n,e){const{name:t,alias:s,fieldFormat:r}=e,a=n.fieldsIndex.get(t);if(!a||!s&&!r)return;const u=s||a.alias,c=o(a)&&r?l(r,a):null;return new i({fieldName:a.name,label:u,format:c,visible:!1,isEditable:f(a,n)})}function d(n){const e=new Map;for(const o of n)e.set(o.name.toLowerCase(),o);return e}function p(e,o){if(!o.length)return;const{fieldConfigurations:t}=e,s=t?d(t):null;let l;if(s?.size){l=[];for(const n of o)s.has(n.name.toLowerCase())||l.push(n);if(!l.length)return}else l=o;const f=n(t)??[];f.push(...l),e.fieldConfigurations=f}function g(n,e){const{fieldConfigurations:o}=n;if(!e.length||!o?.length)return;const t=d(e),s=[];let l=!1;for(const f of o){const n=t.get(f.name.toLowerCase());n?(s.push(n),l=!0):s.push(f.clone())}l&&(n.fieldConfigurations=s)}function h(n,e){const{fieldConfigurations:o}=n;if(!e.length||!o?.length)return;const t=new Set(e.map(n=>n.toLowerCase())),s=[];let l=!1;for(const f of o)t.has(f.name.toLowerCase())?l=!0:s.push(f.clone());l&&(n.fieldConfigurations=s)}export{p as addFieldConfigurations,a as fieldConfigurationsFromFields,r as fieldConfigurationsFromPopupTemplate,u as popupTemplateWithFieldConfigurations,h as removeFieldConfigurations,g as replaceFieldConfigurations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import r from"../Field.js";import o from"../PixelBlock.js";import{getByteCount as a}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{mosaic as c,pixelIdFieldName as p,convertPixelBlockToFeatures as u,getValidPixels as f,countCategoricalPixels as m}from"../rasterFunctions/pixelUtils.js";import{load as x,projectPolygon as y}from"../rasterFunctions/rasterProjectionHelper.js";import{computeBoxStatistics as h,computeStatisticsHistograms as d}from"../rasterFunctions/stretchUtils.js";import{getBandNames as w}from"../../../renderers/support/rasterRendererHelper.js";import g from"../../../rest/support/ImageIdentifyParameters.js";const k=2**30,b=2048,B=2**20,S=20,j=100;async function R(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function P(e){const t=[new r({name:p,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return w(e).forEach(e=>{t.push(new r({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function F(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<S){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/j;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await x(),t=y(t,i)}return t}async function I(e,t){const{spatialReference:i}=e,r=t?.geometry,o=await F(r??e.extent,i),a="extent"===o.type?o:o.extent,l=null==r||"extent"===r.type&&r.spatialReference.equals(i)?void 0:o,c=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:i}),p=!!t?.autoResample,u=p?c:t?.pixelSize??c;let{extent:f,width:m,height:x}=s(e,a,u);if(!p)return{extent:f,clipGeometry:l,width:m,height:x,pixelSize:u};const y=e.storageInfo?.pyramidScalingFactor??2;let{x:h,y:d}=u;const w=t?.maxPixelCount??B;if(m*x>w)for(;m*x>w;)h*=y,d*=y,m/=y,x/=y;return m=Math.round(m),x=Math.round(x),{extent:f,clipGeometry:l,width:m,height:x,pixelSize:new n({x:h,y:d,spatialReference:i})}}async function*T(e,n,r=!1,o){const{extent:a,clipGeometry:s,width:c,height:p}=n,u=a.width/c,f=a.height/p,m=Math.ceil(c/b),x=Math.ceil(p/b),y=u*b,h=f*b,{xmin:d,xmax:w,ymin:g,ymax:k}=a,B=x*m,S={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...o};for(let j=0;j<x;j++)for(let n=0;n<m;n++){t(S);const o=new i({xmin:d+n*y,xmax:r?Math.min(w,d+(n+1)*y):d+(n+1)*y,ymax:k-j*h,ymin:r?Math.max(g,k-(j+1)*h):k-(j+1)*h,spatialReference:a.spatialReference}),c={row:j,col:n},p=j*m+n+1;if(s&&!o.intersects(s)){yield{extent:o,pixelBlock:null,id:c,total:B,current:p};continue}const x=r?Math.round(o.width/u):b,R=r?Math.round(o.height/f):b;let{pixelBlock:P}=await e.fetchPixels(o,x,R,S).catch(()=>({pixelBlock:void 0}));P&&s&&(P=await l(P,o,s)),yield{extent:o,pixelBlock:P,id:c,total:B,current:p}}}async function*M(e,i,n){const r=await R(e,n),o=P(r),a={...i,geometry:i?.geometry??r.extent},s=T(e,await I(r,a),!0,n),l=r.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const a=L(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await W({pixelBlock:s,rasterJobHandler:a},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*r.width*b+c.id.col*b;t(n),f.featureSet=await K({pixelBlock:s,extent:c.extent,fields:o,skipFactor:i?.skipFactor??1,rasterJobHandler:a,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function v(t,i,n){const r=a(i),{width:o,height:s}=t;if(o*s*r>k)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&o*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function z(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const r=await R(t),o=await I(r,i);v(o,r.pixelType);const{extent:a,pixelSize:s}=o,l=Math.round(r.extent.width/s.x),c=P(r),p={fields:c,features:[]},u=p.features,f=T(t,o,!1,n);for await(const e of f){if(!e.pixelBlock)continue;const o=L(t),a=Math.floor((r.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-r.extent.xmin)/s.x),p=await K({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:i?.skipFactor??1,rasterJobHandler:o,pixelIdOffset:a,imageRowSize:l},n);if(p?.features?.length){const{features:e}=p,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}return{extent:a,featureSet:p,pixelSize:s}}async function H(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return O(e,n,i);if("polyline"===n.type)return q(e,n,i);const r=await _(e,{geometry:n},i);if(!r)return null;return h(r)}async function O(e,t,i){const n=await R(e,i),r=t.points.map((e,i)=>t.getPoint(i)).map(t=>C(e,t,i)),a=(await Promise.all(r)).filter(e=>null!=e);if(a.length<=1)return J(a[0]);const s=a[0].map((e,t)=>a.map(e=>e[t]));return h(new o({pixels:s,pixelType:n.pixelType}))}async function C(e,t,i){if("imagery"===e.type){const n=await e.identify(new g({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function J(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function q(e,t,i){const n=await G(e,{geometry:t},i),r=await R(e,i),{bandCount:a,pixelType:s}=r,l=new Array(a).fill(0).map(()=>o.createEmptyBand(s,n.length));let c=0;for(let o=0;o<n.length;o++){const e=n[o];if(null!=e.value){c++;for(let t=0;t<a;t++)l[t][o]=e.value[t]}}c!==n.length&&l.forEach((e,t)=>{l[t]=e.subarray(0,c)});return h(new o({pixels:l,pixelType:s}))}async function E(t,i,n){const r=await R(t,n);if(!r.attributeTable||!r.pixelType.startsWith("u"))return null;const o=r.attributeTable.clone(),a=o.fields.find(e=>"value"===e.name.toLowerCase()),s=o.fields.find(e=>"count"===e.name.toLowerCase());if(!a||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(r.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p}=i;return await D(t,p,(e,t)=>m(e,c),n),o.features.forEach(e=>{const t=e.attributes[a.name];e.attributes[s.name]=c[t]}),o}async function N(e,t,i){const{geometry:n}=t;if("point"===n.type)return C(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>C(e,t,i)),r=(await Promise.all(t)).filter(e=>null!=e);if(0===r.length)return null;return U(r).map(e=>e/r.length)}const r=await D(e,n,(e,t)=>A(e),i),o=r?.filter(e=>e.count>0);if(!o?.length)return null;const a=U(o.map(e=>e.bandSum)),s=o.map(e=>e.count).reduce((e,t)=>e+t);return a.map(e=>e/s)}function U(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function A(e){const{width:t,height:i,pixels:n,mask:r}=e,o=new Array(n.length).fill(0);let a=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!r||r[i]){for(let e=0;e<n.length;e++)o[e]+=n[e][i];a++}}return{bandSum:o,count:a}}async function G(e,t,i){const n=await D(e,t.geometry,f,i);return n?.flat()??[]}async function D(i,n,r,o){const a=i.spatialReference;if("polyline"===n.type&&!n.spatialReference.equals(a)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(n,a);if(null==t)throw new e("read-pixels","failed to fetch pixels");n=t}const s="polyline"===n.type?n.extent:n,c=await F(s,a),p="polyline"===n.type?n:c,u=await R(i,o),f={geometry:c,autoResample:!1},m=[],x=T(i,await I(u,f),!0,o);for await(const e of x){if(!e.pixelBlock)continue;const{extent:i}=e,n=r(await l(e.pixelBlock,i,p),i);m.push(n),t(o)}return m}async function W(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:r,histograms:o}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):d(n);return{statistics:r,histograms:o}}async function K(e,t){const{extent:i,fields:n,skipFactor:r,rasterJobHandler:o,pixelIdOffset:a,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=o?await o.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:r,pixelIdOffset:a,imageRowSize:s},t):u({pixelBlock:l,extent:i,fieldNames:c,skipFactor:r,pixelIdOffset:a,imageRowSize:s});return p?{fields:n,features:p}:void 0}function L(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function _(e,t,i){const n=await R(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const r=await I(n,t);v(r,n.pixelType,t.maxPixelCount);const o=[],a=T(e,r,!1,i);for await(const c of a)o.push(c.pixelBlock);if(!o.some(e=>null!=e))return null;const{width:s,height:l}=r,p=Math.ceil(s/b),u=Math.ceil(l/b),f={width:p*b,height:u*b};let m;const x=L(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:o,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=c(o,f);return m}async function V(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const r=await _(t,i,n);if(!r)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const o=L(t);return o?await o.computeStatisticsHistograms({pixelBlock:r,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):d(r,{includeSkewnessKurtosis:!0})}export{H as computeBoxStatistics,E as computeRasterAttributeTable,V as computeStatisticsHistograms,M as createPixelFeatureSetCursor,_ as fetchLargePixelBlock,z as fetchPixelFeatureSet,N as identifyAveragePixelValue,G as readIntersectingPixels};
5
+ import e from"../../../core/Error.js";import{throwIfAborted as t}from"../../../core/promiseUtils.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import o from"../Field.js";import r from"../PixelBlock.js";import{getByteCount as a}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{mosaic as c,pixelIdFieldName as p,convertPixelBlockToFeatures as u,getValidPixels as f,countCategoricalPixels as m}from"../rasterFunctions/pixelUtils.js";import{load as x,projectPolygon as h}from"../rasterFunctions/rasterProjectionHelper.js";import{computeBoxStatistics as y,computeStatisticsHistograms as d}from"../rasterFunctions/stretchUtils.js";import{getBandNames as w}from"../../../renderers/support/rasterRendererHelper.js";import g from"../../../rest/support/ImageIdentifyParameters.js";const k=2**30,b=2048,B=2**20,S=20,j=100;async function R(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function P(e){const t=[new o({name:p,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return w(e).forEach(e=>{t.push(new o({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function F(t,i){if(t.spatialReference.equals(i))return t;if("polyline"===t.type){const n=(await import("../../../geometry/operators/projectOperator.js")).execute(t,i);if(null==n)throw new e("read-pixels","failed to project the geometry into the layer's spatial reference");return n}if("extent"===t.type||t.rings[0].length<S){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/j;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await x(),t=h(t,i)}return t}async function M(e,t,i=!1){const{spatialReference:o}=e,r=t?.geometry,a=await F(r??e.extent,o),l="extent"===a.type?a:a.extent,c=null==r||"extent"===r.type&&r.spatialReference.equals(o)?void 0:a,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:h}=s(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:h,pixelSize:f};const y=e.storageInfo?.pyramidScalingFactor??2;let{x:d,y:w}=f;const g=t?.maxPixelCount??B;for(;x*h>g&&(!i||Math.max(x,h)>1024);)d*=y,w*=y,x/=y,h/=y;return x=Math.round(x),h=Math.round(h),{extent:m,clipGeometry:c,width:x,height:h,pixelSize:new n({x:d,y:w,spatialReference:o})}}async function*I(e,n,o=!1,r){const{extent:a,clipGeometry:s,width:c,height:p}=n,u=a.width/c,f=a.height/p,m=Math.ceil(c/b),x=Math.ceil(p/b),h=u*b,y=f*b,{xmin:d,xmax:w,ymin:g,ymax:k}=a,B=x*m,S={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let j=0;j<x;j++)for(let n=0;n<m;n++){t(S);const r=new i({xmin:d+n*h,xmax:o?Math.min(w,d+(n+1)*h):d+(n+1)*h,ymax:k-j*y,ymin:o?Math.max(g,k-(j+1)*y):k-(j+1)*y,spatialReference:a.spatialReference}),c={row:j,col:n},p=j*m+n+1;if(s&&!r.intersects(s)){yield{extent:r,pixelBlock:null,id:c,total:B,current:p};continue}const x=o?Math.round(r.width/u):b,R=o?Math.round(r.height/f):b;let{pixelBlock:P}=await e.fetchPixels(r,x,R,S).catch(()=>({pixelBlock:void 0}));P&&s&&(P=await l(P,r,s)),yield{extent:r,pixelBlock:P,id:c,total:B,current:p}}}async function*T(e,i,n){const o=await R(e,n),r=P(o),a={...i,geometry:i?.geometry??o.extent},s=I(e,await M(o,a),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const a=L(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await W({pixelBlock:s,rasterJobHandler:a},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*o.width*b+c.id.col*b;t(n),f.featureSet=await K({pixelBlock:s,extent:c.extent,fields:r,skipFactor:i?.skipFactor??1,rasterJobHandler:a,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function v(t,i,n){const o=a(i),{width:r,height:s}=t;if(r*s*o>k)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&r*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function z(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await R(t),r=await M(o,i,!0);v(r,o.pixelType);const{extent:a,pixelSize:s}=r,l=Math.round(o.extent.width/s.x),c=P(o),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&r.width*r.height>f,x=m?1:i.skipFactor??1,h=r.width<=b||r.height<=b,y=I(t,r,1===x||h,n);for await(const e of y){if(!e.pixelBlock)continue;const i=L(t),r=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),a=await K({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:r,imageRowSize:l},n);if(a?.features?.length){const{features:e}=a,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let o=0,r=0;o<e-1;o++){r+=t;const e=Math.round(r);e<n&&u.push(i[e])}}}return{extent:a,featureSet:p,pixelSize:s}}async function H(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return O(e,n,i);if("polyline"===n.type)return q(e,n,i);const o=await _(e,{geometry:n},i);if(!o)return null;return y(o)}async function O(e,t,i){const n=await R(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>C(e,t,i)),a=(await Promise.all(o)).filter(e=>null!=e);if(a.length<=1)return J(a[0]);const s=a[0].map((e,t)=>a.map(e=>e[t]));return y(new r({pixels:s,pixelType:n.pixelType}))}async function C(e,t,i){if("imagery"===e.type){const n=await e.identify(new g({geometry:t,returnCatalogItems:!1}),i).catch(()=>null);return null==n?.value||n.value.includes("NoData")?null:n.value.replaceAll(", "," ").split(" ").map(e=>Number(e))}const n=await e.identify(t,i).catch(()=>null);return n?.value}function J(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function q(e,t,i){const n=await G(e,{geometry:t},i),o=await R(e,i),{bandCount:a,pixelType:s}=o,l=new Array(a).fill(0).map(()=>r.createEmptyBand(s,n.length));let c=0;for(let r=0;r<n.length;r++){const e=n[r];if(null!=e.value){c++;for(let t=0;t<a;t++)l[t][r]=e.value[t]}}c!==n.length&&l.forEach((e,t)=>{l[t]=e.subarray(0,c)});return y(new r({pixels:l,pixelType:s}))}async function E(t,i,n){const o=await R(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const r=o.attributeTable.clone(),a=r.fields.find(e=>"value"===e.name.toLowerCase()),s=r.fields.find(e=>"count"===e.name.toLowerCase());if(!a||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p}=i;return await D(t,p,(e,t)=>m(e,c),n),r.features.forEach(e=>{const t=e.attributes[a.name];e.attributes[s.name]=c[t]}),r}async function N(e,t,i){const{geometry:n}=t;if("point"===n.type)return C(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>C(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return U(o).map(e=>e/o.length)}const o=await D(e,n,(e,t)=>A(e),i),r=o?.filter(e=>e.count>0);if(!r?.length)return null;const a=U(r.map(e=>e.bandSum)),s=r.map(e=>e.count).reduce((e,t)=>e+t);return a.map(e=>e/s)}function U(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function A(e){const{width:t,height:i,pixels:n,mask:o}=e,r=new Array(n.length).fill(0);let a=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)r[e]+=n[e][i];a++}}return{bandSum:r,count:a}}async function G(e,t,i){const n=await D(e,t.geometry,f,i);return n?.flat()??[]}async function D(i,n,o,r){const a=i.spatialReference;if("polyline"===n.type&&!n.spatialReference.equals(a)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(n,a);if(null==t)throw new e("read-pixels","failed to fetch pixels");n=t}const s="polyline"===n.type?n.extent:n,c=await F(s,a),p="polyline"===n.type?n:c,u=await R(i,r),f={geometry:c,autoResample:!1},m=[],x=I(i,await M(u,f),!0,r);for await(const e of x){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await l(e.pixelBlock,i,p),i);m.push(n),t(r)}return m}async function W(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:r}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):d(n);return{statistics:o,histograms:r}}async function K(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:r,pixelIdOffset:a,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=r?await r.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s},t):u({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s});return p?{fields:n,features:p}:void 0}function L(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function _(e,t,i){const n=await R(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await M(n,t);v(o,n.pixelType,t.maxPixelCount);const r=[],a=I(e,o,!1,i);for await(const c of a)r.push(c.pixelBlock);if(!r.some(e=>null!=e))return null;const{width:s,height:l}=o,p=Math.ceil(s/b),u=Math.ceil(l/b),f={width:p*b,height:u*b};let m;const x=L(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:r,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=c(r,f);return m}async function V(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const o=await _(t,i,n);if(!o)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const r=L(t);return r?await r.computeStatisticsHistograms({pixelBlock:o,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):d(o,{includeSkewnessKurtosis:!0})}export{H as computeBoxStatistics,E as computeRasterAttributeTable,V as computeStatisticsHistograms,T as createPixelFeatureSetCursor,_ as fetchLargePixelBlock,z as fetchPixelFeatureSet,N as identifyAveragePixelValue,G as readIntersectingPixels};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{strict as r}from"../../../core/jsonMap.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{ensureType as l,ensureOneOfType as c}from"../../../core/accessorSupport/ensureType.js";import{createTypeReader as u}from"../../../core/accessorSupport/extensions/serializableProperty/reader.js";import n from"../Field.js";import{MapLayerSource as y}from"./MapLayerSource.js";import{QueryTableDataSource as b}from"./QueryTableDataSource.js";import{RasterDataSource as S}from"./RasterDataSource.js";import{TableDataSource as d}from"./TableDataSource.js";var f,m;const j=r()({esriLeftInnerJoin:"left-inner-join",esriLeftOuterJoin:"left-outer-join"});let T=f=class extends o{constructor(e){super(e),this.type="join-table"}readLeftTableSource(e,r,o){return g()(e,r,o)}castLeftTableSource(e){return c(w(),e)}readRightTableSource(e,r,o){return g()(e,r,o)}castRightTableSource(e){return c(w(),e)}clone(){const{leftTableKey:e,rightTableKey:r,leftTableSource:o,rightTableSource:t,joinType:a}=this,s={leftTableKey:e,rightTableKey:r,leftTableSource:o?.clone()??void 0,rightTableSource:t?.clone()??void 0,joinType:a};return new f(s)}};e([s({joinTable:"join-table"}),t({json:{write:{isRequired:!0}}})],T.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],T.prototype,"leftTableKey",void 0),e([t({type:String,json:{write:!0}})],T.prototype,"rightTableKey",void 0),e([t({json:{write:!0}})],T.prototype,"leftTableSource",void 0),e([p("leftTableSource")],T.prototype,"readLeftTableSource",null),e([a("leftTableSource")],T.prototype,"castLeftTableSource",null),e([t({json:{write:!0}})],T.prototype,"rightTableSource",void 0),e([p("rightTableSource")],T.prototype,"readRightTableSource",null),e([a("rightTableSource")],T.prototype,"castRightTableSource",null),e([s(j)],T.prototype,"joinType",void 0),T=f=e([i("esri.layers.support.source.JoinTableDataSource")],T);let h=null;function g(){return h||(h=u({types:w()})),h}let v=null;function w(){return v||(v={key:"type",base:null,typeMap:{"data-layer":R,"map-layer":y}}),v}const L={key:"type",base:null,typeMap:{"join-table":T,"query-table":b,raster:S,table:d}};let R=class extends o{static{m=this}constructor(e){super(e),this.type="data-layer"}clone(){const{fields:e,dataSource:r}=this;return new m({fields:e,dataSource:r})}};e([s({dataLayer:"data-layer"}),t({json:{write:{isRequired:!0}}})],R.prototype,"type",void 0),e([t({type:[n],json:{write:!0}})],R.prototype,"fields",void 0),e([t({types:L,json:{write:!0}})],R.prototype,"dataSource",void 0),R=m=e([i("esri.layers.support.source.DataLayerSource")],R),R.from=l(R);export{R as DataLayerSource,T as JoinTableDataSource};
5
+ import{__decorate as e}from"tslib";import{strict as r}from"../../../core/jsonMap.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{cast as a}from"../../../core/accessorSupport/decorators/cast.js";import{enumeration as s}from"../../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{ensureType as l,ensureOneOfType as c}from"../../../core/accessorSupport/ensureType.js";import{createTypeReader as u}from"../../../core/accessorSupport/extensions/serializableProperty/reader.js";import n from"../Field.js";import{MapLayerSource as y}from"./MapLayerSource.js";import{QueryTableDataSource as b}from"./QueryTableDataSource.js";import{RasterDataSource as S}from"./RasterDataSource.js";import{TableDataSource as d}from"./TableDataSource.js";var f,m;const j=r()({esriLeftInnerJoin:"left-inner-join",esriLeftOuterJoin:"left-outer-join"});let T=f=class extends o{constructor(e){super(e),this.type="join-table"}readLeftTableSource(e,r,o){return g()(e,r,o)}castLeftTableSource(e){return c(w(),e)}readRightTableSource(e,r,o){return g()(e,r,o)}castRightTableSource(e){return c(w(),e)}clone(){const{leftTableKey:e,rightTableKey:r,leftTableSource:o,rightTableSource:t,joinType:a}=this,s={leftTableKey:e,rightTableKey:r,leftTableSource:o?.clone()??void 0,rightTableSource:t?.clone()??void 0,joinType:a};return new f(s)}};e([s({joinTable:"join-table"}),t({json:{write:{isRequired:!0}}})],T.prototype,"type",void 0),e([t({type:String,json:{write:!0}})],T.prototype,"leftTableKey",void 0),e([t({type:String,json:{write:!0}})],T.prototype,"rightTableKey",void 0),e([t({json:{write:!0}})],T.prototype,"leftTableSource",void 0),e([p("leftTableSource")],T.prototype,"readLeftTableSource",null),e([a("leftTableSource")],T.prototype,"castLeftTableSource",null),e([t({json:{write:!0}})],T.prototype,"rightTableSource",void 0),e([p("rightTableSource")],T.prototype,"readRightTableSource",null),e([a("rightTableSource")],T.prototype,"castRightTableSource",null),e([s(j)],T.prototype,"joinType",void 0),T=f=e([i("esri.layers.support.source.JoinTableDataSource")],T);let h=null;function g(){return h||(h=u({types:w()})),h}let v=null;function w(){return v||(v={key:"type",base:null,typeMap:{"data-layer":R,"map-layer":y}}),v}const L={key:"type",base:null,typeMap:{"join-table":T,"query-table":b,raster:S,table:d}};let R=class extends o{static{m=this}constructor(e){super(e),this.type="data-layer"}clone(){const{fields:e,dataSource:r}=this;return new m({fields:e,dataSource:r})}};e([s({dataLayer:"data-layer"}),t({json:{write:{isRequired:!0}}})],R.prototype,"type",void 0),e([t({type:[n],json:{write:!0}})],R.prototype,"fields",void 0),e([t({types:L,json:{write:!0}})],R.prototype,"dataSource",void 0),R=m=e([i("esri.layers.support.source.DataLayerSource")],R),R.from=l(R);export{R as DataLayerSource,T as JoinTableDataSourceClass};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.0.0-next.7",
3
+ "version": "5.0.0-next.8",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -19,11 +19,11 @@
19
19
  "license": "SEE LICENSE IN copyright.txt",
20
20
  "dependencies": {
21
21
  "@amcharts/amcharts5": "~5.14.1",
22
- "@arcgis/toolkit": "^4.34.0-next.154",
22
+ "@arcgis/toolkit": "^4.34.0-next.157",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
24
  "@esri/calcite-components": "^3.3.1",
25
25
  "@vaadin/grid": "~24.9.1",
26
- "@zip.js/zip.js": "~2.8.5",
26
+ "@zip.js/zip.js": "~2.8.7",
27
27
  "luxon": "~3.7.2",
28
28
  "marked": "~16.3.0",
29
29
  "tslib": "^2.8.1"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{ClonableMixin as o}from"../core/Clonable.js";import{JSONMap as e}from"../core/jsonMap.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{property as i}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{enumeration as s}from"../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{fieldInfoFormatFromFieldFormat as a,fieldFormatFromFieldInfoFormat as n,formatTypes as m}from"../layers/support/fieldFormatUtils.js";import d from"./support/FieldInfoFormat.js";let c=class extends(o(r)){constructor(t){super(t),this.fieldName=null,this.isEditable=!0,this.label=null,this.statisticType=null,this.stringFieldOption="text-box",this.tooltip=null,this.visible=!0}set fieldFormat(t){this._set("fieldFormat",t),this._set("format",t?a(t):null)}set format(t){this._set("format",t),this._set("fieldFormat",t?n(t):null)}readFormat(t,o){if(!o.fieldFormat)return t?d.fromJSON(t):null}};t([i({value:null,types:m,json:{write:{overridePolicy(t,o,e){const{fieldName:r}=this;return{enabled:!!r&&!r.startsWith("expression/")&&!r.startsWith("relationships/")&&!!e?.writeFieldFormat}}}}})],c.prototype,"fieldFormat",null),t([i({type:String,json:{write:!0}})],c.prototype,"fieldName",void 0),t([i({value:null,type:d,json:{write:!0}})],c.prototype,"format",null),t([p("format")],c.prototype,"readFormat",null),t([i({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],c.prototype,"isEditable",void 0),t([i({type:String,json:{write:!0}})],c.prototype,"label",void 0),t([i({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],c.prototype,"statisticType",void 0),t([s(new e({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],c.prototype,"stringFieldOption",void 0),t([i({type:String,json:{write:!0}})],c.prototype,"tooltip",void 0),t([i({type:Boolean,json:{write:!0}})],c.prototype,"visible",void 0),c=t([l("esri.popup.FieldInfo")],c);const u=c;export{u as default};
5
+ import{__decorate as t}from"tslib";import{ClonableMixin as o}from"../core/Clonable.js";import{JSONMap as e}from"../core/jsonMap.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{enumeration as i}from"../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{fieldInfoFormatFromFieldFormat as a,fieldFormatFromFieldInfoFormat as n,formatTypes as m}from"../layers/support/fieldFormatUtils.js";import c from"./support/FieldInfoFormat.js";let d=class extends(o(r)){constructor(t){super(t),this.fieldName=null,this.isEditable=!0,this.label=null,this.statisticType=null,this.stringFieldOption="text-box",this.tooltip=null,this.visible=!0}set fieldFormat(t){this._set("fieldFormat",t),this._set("format",t?a(t):null)}set format(t){this._set("format",t),this._set("fieldFormat",t?n(t):null)}readFormat(t,o){if(!o.fieldFormat)return t?c.fromJSON(t):null}clone(){const t=super.clone();return t._set("format",this.format?.clone()),t._set("fieldFormat",this.fieldFormat?.clone()),t}};t([s({value:null,clonable:!1,types:m,json:{write:{overridePolicy(t,o,e){const{fieldName:r}=this;return{enabled:!!r&&!r.startsWith("expression/")&&!r.startsWith("relationships/")&&!!e?.writeFieldFormat}}}}})],d.prototype,"fieldFormat",null),t([s({type:String,json:{write:!0}})],d.prototype,"fieldName",void 0),t([s({value:null,clonable:!1,type:c,json:{write:!0}})],d.prototype,"format",null),t([l("format")],d.prototype,"readFormat",null),t([s({type:Boolean,json:{write:{alwaysWriteDefaults:!0},default:!0}})],d.prototype,"isEditable",void 0),t([s({type:String,json:{write:!0}})],d.prototype,"label",void 0),t([s({type:["count","sum","min","max","avg","stddev","var"],json:{write:!0}})],d.prototype,"statisticType",void 0),t([i(new e({richtext:"rich-text",textarea:"text-area",textbox:"text-box"}),{default:"text-box"})],d.prototype,"stringFieldOption",void 0),t([s({type:String,json:{write:!0}})],d.prototype,"tooltip",void 0),t([s({type:Boolean,json:{write:!0}})],d.prototype,"visible",void 0),d=t([p("esri.popup.FieldInfo")],d);const f=d;export{f as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import e from"./config.js";import{id as t}from"./kernel.js";import{requestConfig as r}from"./requestConfig.js";import s from"./core/Error.js";import has from"./core/has.js";import{clone as o}from"./core/lang.js";import{createAbortError as a,isAbortError as n,isAborted as i}from"./core/promiseUtils.js";import{isTrustedServer as l,getOrigin as u,isBlobProtocol as c,isDataProtocol as d,toHTTPS as p,objectToQuery as m,getProxyRule as f,getProxyUrl as h,addQueryParameters as y,hasSameOrigin as g,addProxyRule as w,getAppUrl as b}from"./core/urlUtils.js";import{isSecureProxyService as T}from"./portal/support/urlUtils.js";import{getImageType as k,ImageWithType as q}from"./rest/support/ImageWithType.js";import{getApiKey as S}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as C,setPreferredHost as O,getPreferredUrl as x,isNoCorsRequestRequired as j,sendNoCorsRequest as v,createTimeoutError as L,loadImageAsync as U}from"./support/requestUtils.js";const E="FormData"in globalThis,A=new Set([499,498,403,401]),P=new Set(["COM_0056","COM_0057","SB_0008"]),D=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i];async function H(r){let s,o;await I(r);try{do{[s,o]=await M(r)}while(!await z(r,s,o))}catch(i){const e=G("request:server",i,r.parameters,s);throw e.details.ssl=r.useSSL,r.interceptor?.error?.(e),e}const a=r.parameters.url;if(o)if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(a)){if(!r.hasToken&&!r.credentialToken&&o.user?.username&&!l(a)){const t=u(a,!0);t&&e.request.trustedServers.push(t)}Array.isArray(o.authorizedCrossOriginNoCorsDomains)&&C(o.authorizedCrossOriginNoCorsDomains)}else{"json"===(r.parameters.requestOptions.responseType||"json")&&O(a,o)}const n=r.credential;if(n&&t){const e=t.findServerInfo(n.server);let r=e?.owningSystemUrl;if(r){r=r.replace(/\/?$/,"/sharing");const e=t.findCredential(r,n.userId);e&&-1===t._getIdenticalSvcIdx(r,e)&&e.resources.unshift(r)}}return{data:o,getAllHeaders:s?()=>Array.from(s.headers):K,getHeader:s?e=>s.headers.get(e):K,httpStatus:s?.status??200,requestOptions:r.parameters.requestOptions,ssl:r.useSSL,url:r.parameters.url}}async function I(s){const o=s.parameters.url,a=s.parameters.requestOptions,n=s.controller.signal,l=a.body;let u=null,c=null;if(E&&"HTMLFormElement"in globalThis&&(l instanceof FormData?u=l:l instanceof HTMLFormElement&&(u=new FormData(l))),"string"==typeof l&&(c=l),s.fetchOptions={cache:a.cacheBust?"no-cache":"default",credentials:"same-origin",headers:a.headers||{},keepalive:a.keepAlive??!1,method:"head"===a.method?"HEAD":"GET",mode:"cors",priority:a.priority??e.request.priority,redirect:"follow",signal:n},(u||c)&&(s.fetchOptions.body=u||c),(r.isForeignWorker||"anonymous"===a.authMode)&&(s.useIdentity=!1),s.hasToken=!!(/token=/i.test(o)||a.query?.token||u?.get("token")),!s.hasToken){const e=S(o);e&&(a.query??={},a.query.token=e,s.hasToken=!0)}if(s.useIdentity&&!s.hasToken&&!s.credential&&!s.credentialToken&&!$(o)&&!i(n)){let e;"immediate"===a.authMode?(await B(),e=await t.getCredential(o,{signal:n})):"no-prompt"===a.authMode?(await B(),e=await t.getCredential(o,{prompt:!1,signal:n}).catch(()=>{})):t&&(e=t.findCredential(o)),e&&(s.credential=e,s.credentialToken=e.token,s.useSSL=!!e.ssl)}}async function M(s){let o=s.parameters.url,n=x(o);const i=s.parameters.requestOptions,S=s.fetchOptions??{},C=c(o)||d(o),O=i.responseType??"json",U="image"===O&&i.imageWithType,A=C?0:null!=i.timeout?i.timeout:e.request.timeout;let P=!1;if(!C){s.useSSL&&(o=p(o));let r={...i.query};s.credentialToken&&(r.token=s.credentialToken);let a=m(r);has("esri-url-encodes-apostrophe")&&(a=a.replaceAll("'","%27"));const u=n.length+1+a.length;let c;P="delete"===i.method||"post"===i.method||"put"===i.method||!!i.body||u>e.request.maxUrlLength;const d=i.useProxy||!!f(o);if(d){const t=h(o);c=t.path,!P&&c.length+1+u>e.request.maxUrlLength&&(P=!0),t.query&&(r={...t.query,...r})}if("HEAD"===S.method&&(P||d)){if(P){if(u>e.request.maxUrlLength)throw G("request:invalid-parameters",new Error("URL exceeds maximum length"),s.parameters);throw G("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),s.parameters)}if(d)throw G("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),s.parameters)}if(P?(S.method="delete"===i.method?"DELETE":"put"===i.method?"PUT":"POST",i.body?o=y(o,r):(S.body=m(r),S.headers||(S.headers={}),S.headers["Content-Type"]="application/x-www-form-urlencoded")):o=y(o,r),d&&(s.useProxy=!0,o=`${c}?${o}`),r.token&&E&&S.body instanceof FormData&&!T(o)&&S.body.set("token",r.token),i.hasOwnProperty("withCredentials"))s.withCredentials=i.withCredentials;else if(!g(o,b()))if(l(o))s.withCredentials=!0;else if(t){const e=t.findServerInfo(o);e?.webTierAuth&&(s.withCredentials=!0)}s.withCredentials&&(S.credentials="include",j(o)&&await v(P?y(o,r):o)),n=x(o)}let D,H,I=0,B=!1;A>0&&(I=setTimeout(()=>{B=!0,s.controller.abort()},A));try{if("native-request-init"===i.responseType)H=S,H.url=n,i.signal?H.signal=i.signal:delete H.signal;else if("image"!==i.responseType||"default"!==S.cache||S.keepalive||"GET"!==S.method||P||W(i.headers)||!C&&!s.useProxy&&e.request.proxyUrl&&!N(o)){if(await(r.beforeFetch?.(o,S)),D=await r.fetch(n,S),await(r.afterFetch?.(D)),s.useProxy||R(o),"native"===i.responseType)H=D;else if("HEAD"!==S.method)if(D.ok){switch(O){case"array-buffer":H=await D.arrayBuffer();break;case"blob":H=await D.blob();break;case"image":H=await(U?D.arrayBuffer():D.blob());break;default:H=await D.text()}if(I&&(clearTimeout(I),I=0),"json"===O||"xml"===O||"document"===O)if(H)switch(O){case"json":H=JSON.parse(H);break;case"xml":H=_(H,"application/xml");break;case"document":H=_(H,"text/html")}else H=null;if(H){if("array-buffer"===O||"blob"===O){const e=D.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&H["blob"===O?"size":"byteLength"]<=750)try{const e=await new Response(H).json();e.error&&(H=e)}catch{}}if(U&&H instanceof ArrayBuffer){const e=k(H);if("unknown"===e)return i.responseType="image",await M(s);H=await D.blob(),H=await F(URL.createObjectURL(H),s,!0),H=new q(H,e)}"image"===O&&H instanceof Blob&&(H=await F(URL.createObjectURL(H),s,!0))}}else{H=await D.text();try{H=JSON.parse(H)}catch{}}}else H=await F(n,s)}catch($){if("AbortError"===$.name){if(B)throw L();throw a("Request canceled")}if(!(!D&&$ instanceof TypeError&&e.request.proxyUrl)||i.body||"delete"===i.method||"head"===i.method||"post"===i.method||"put"===i.method||s.useProxy||N(o))throw $;s.redoRequest=!0,w({proxyUrl:e.request.proxyUrl,urlPrefix:u(o)??""})}finally{I&&clearTimeout(I)}return[D,H]}function F(t,r,s=!1){const o=r.controller.signal,a=new Image;return r.withCredentials?a.crossOrigin="use-credentials":a.crossOrigin="anonymous",a.alt="",a.fetchPriority=e.request.priority,a.src=t,U(a,t,s,o)}function R(e){const t=u(e);t&&!r.corsServers.includes(t)&&r.corsServers.push(t)}function N(e){const t=u(e);return!t||t.endsWith(".arcgis.com")||r.corsServers.includes(t)||l(t)}async function B(){t||await import("./identity/IdentityManager.js")}function $(e){return D.some(t=>t.test(e))}function W(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}function _(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function z(e,r,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.parameters.requestOptions;if(!r||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let a,n;if(s&&(s.error&&"object"==typeof s.error?a=s.error:"error"===s.status&&Array.isArray(s.messages)&&(a={...s},a[J]=s,a.details=s.messages)),!a&&!r.ok)throw a=new Error(`Unable to load ${r.url} status: ${r.status}`),a[J]=s,a;let i,l=null;a&&(n=Number(a.code),l=a.hasOwnProperty("subcode")?Number(a.subcode):null,i=a.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===n&&(4===l||a.message?.toLowerCase().includes("ssl")&&!a.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===n)&&void 0!==n&&A.has(n)&&!$(e.parameters.url)&&(403!==n||(!i||!P.has(i))&&(null==l||2===l&&e.credentialToken))){await B();try{const r=await t.getCredential(e.parameters.url,{error:G("request:server",a,e.parameters),credential:e.credential,prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=r,e.credentialToken=r.token,e.useSSL=e.useSSL||r.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;a=c}}if(a)throw a;return!0}function G(e,t,r,i){let l;const u={url:r.url,requestOptions:r.requestOptions,getAllHeaders:K,getHeader:K,ssl:!1};if(t instanceof s)return t.details?(t.details=o(t.details),t.details.url=r.url,t.details.requestOptions=r.requestOptions):t.details=u,t;if(t){const e=i&&(()=>Array.from(i.headers)),r=i&&(e=>i.headers.get(e)),s=i?.status,o=t.message;o&&(l=o),e&&r&&(u.getAllHeaders=e,u.getHeader=r),u.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||s||0,u.subCode=t.subcode,u.messageCode=t.messageCode,"string"==typeof t.details?(u.messages=[t.details],l??=t.details):(u.messages=t.details,l??=u.messages?.[0]),u.raw=J in t?t[J]:t}return l??="Error",n(t)?a():new s(e,l,u)}const J=Symbol(),K=()=>null;export{G as createRequestError,H as processRequest};