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

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 (365) 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/02e7359162cf974b41b6.js +1 -0
  6. package/assets/esri/core/workers/chunks/{17d5f8dba6ebb1184506.js → 042cd64e1f4eb326c30f.js} +1 -1
  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/0f735b0dec173142f3b6.js +2 -0
  11. package/assets/esri/core/workers/chunks/{a8f998b8ec8c56150479.js.LICENSE.txt → 0f735b0dec173142f3b6.js.LICENSE.txt} +1 -1
  12. package/assets/esri/core/workers/chunks/{73487b9d85e726e9c012.js → 1257c37bf04d39c27b62.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{398f356b11fd33bd3831.js → 136a7d781dad05a7463b.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{1e4e7aedf4b779241a02.js → 15c7c10ff9ac63f0e792.js} +1 -1
  15. package/assets/esri/core/workers/chunks/17784cf16fa91504b9ea.js +1 -0
  16. package/assets/esri/core/workers/chunks/{a395373e3173e6458a56.js → 1ab37e13947d0e2e4181.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{f03635ddf56e2ef90e4c.js → 1d06fcae4c2f02fb1c95.js} +1 -1
  18. package/assets/esri/core/workers/chunks/1dfca37f95f2b968aa54.js +1 -0
  19. package/assets/esri/core/workers/chunks/{5bd36dbf46c25bd961c8.js → 21293b0c6405a10ec7b6.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{285762ff92d5388b6024.js → 2166238a7ad63a2d43c7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{620a94b54be3ed78350d.js → 22ca80f491e070b2a5e7.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{88074189fa10c335370b.js → 24cd7b84cd0f3de4bff2.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{ccc0da0e01f023c8aa1f.js → 28d1f2cf6aae547615c3.js} +1 -1
  24. package/assets/esri/core/workers/chunks/292daac70bb828e4923f.js +1 -0
  25. package/assets/esri/core/workers/chunks/{7e43c105f1cfc44b7bd0.js → 2fa01bd3f3608616fd7f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/30e220f4f843681a4cdd.js +1 -0
  27. package/assets/esri/core/workers/chunks/{5d3661d1fe46dd29aae9.js → 311b564e44ae637c960d.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{f4d0ae6be1b3984228d0.js → 31b6406960261da21dd4.js} +1 -1
  29. package/assets/esri/core/workers/chunks/31c7ce65e16f7858400f.js +1 -0
  30. package/assets/esri/core/workers/chunks/31dbe07047dc61303d7d.js +1 -0
  31. package/assets/esri/core/workers/chunks/{8a314b3790313e6dc5db.js → 333b62dad3811cff0f14.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{c8733cd621105afab2ac.js → 35c9b24e4430bd6c2b6b.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{e31192ae920e3e19b6aa.js → 37c1f155da14de91565a.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{c55c096669677321a227.js → 38cd3648932bf2534b0f.js} +1 -1
  35. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
  36. package/assets/esri/core/workers/chunks/{f5e47eea8720ba84665b.js → 3c07aa2015ab1dff5f7b.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{e9311386f58f3cb95c22.js → 42a1e71d09e8583a7327.js} +1 -1
  38. package/assets/esri/core/workers/chunks/443dfe7029ec208f670c.js +1 -0
  39. package/assets/esri/core/workers/chunks/{b75930d60449eceb0f1c.js → 4baf6f6e7ddedb25f806.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{bb5484b5eeacc9ad2ceb.js → 4d0cbf9584446f411a37.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{17103e6542aae53c7301.js → 4e3e27673d0671fc2b58.js} +1 -1
  42. package/assets/esri/core/workers/chunks/4fb5f1c671892001a4fd.js +1 -0
  43. package/assets/esri/core/workers/chunks/{5fc7b61f467f1d60a284.js → 51ab2acac4ecc1ca9c34.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{fc4417d1260b717a9385.js → 52282f767bd0e99ddca0.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{dedc4583b5f32a278124.js → 5350d50b47b6a4e0e169.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{fc06014fb484fc8c697e.js → 53654edd766d9b4ef750.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{90f8b4bda28af43ea019.js → 538f509d7fc8337d37ac.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{ed8a85efbd90241512bb.js → 588533c3abe876f20f62.js} +1 -1
  49. package/assets/esri/core/workers/chunks/58e59ead33368ce38c8f.js +1 -0
  50. package/assets/esri/core/workers/chunks/5db37547963857295273.js +1 -0
  51. package/assets/esri/core/workers/chunks/{72846fb9c87c6642daf0.js → 5e2ce34def5e053913b2.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{8c056eac35d05d9524b7.js → 5f29422a051311ef9b3c.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{ac26e3e77df4302f47a2.js → 604777417722d4effe06.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{ff35a077ac6776469805.js → 61d970ed75c2c358b1e9.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{7a6a96edc892d7060b7d.js → 629127877042ad784ad2.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{90b2b43b8b54c9a1ec35.js → 664ae441617afe4b17ec.js} +1 -1
  57. package/assets/esri/core/workers/chunks/67f03d042455cd0f7009.js +1 -0
  58. package/assets/esri/core/workers/chunks/{4c5a7249a311070d8f43.js → 6af18d7a0d314d7c1756.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{f35aaa04cca676c2d3f8.js → 6b59f94040c7d2f6728a.js} +1 -1
  60. package/assets/esri/core/workers/chunks/6d9f2b113d6bde936a04.js +1 -0
  61. package/assets/esri/core/workers/chunks/{5132ca68e8c7af111a47.js → 6e22b02a9715c10578d0.js} +1 -1
  62. package/assets/esri/core/workers/chunks/{f0e0a63962784acb4ba1.js → 6f0aec7428021e440ac9.js} +1 -1
  63. package/assets/esri/core/workers/chunks/{deb2854bb7d082a26f52.js → 7005d956c990a04ee8b2.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{a3991ae8caa713d4ddcd.js → 731f7b552dde0fb325cd.js} +1 -1
  65. package/assets/esri/core/workers/chunks/7565b382f6b3d2cb46a3.js +2 -0
  66. package/assets/esri/core/workers/chunks/{b96eb0ea506379182d62.js.LICENSE.txt → 7565b382f6b3d2cb46a3.js.LICENSE.txt} +1 -1
  67. package/assets/esri/core/workers/chunks/{464d42bebb365287808d.js → 773f2c6c9d38db76dfed.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3f3d492f1093b7832aab.js → 7803495f8862d9025bcd.js} +1 -1
  69. package/assets/esri/core/workers/chunks/7d641f2f5edd95b9bc18.js +1 -0
  70. package/assets/esri/core/workers/chunks/7e4c14d4502e3f06d94b.js +1 -0
  71. package/assets/esri/core/workers/chunks/812f2ccc01f44e3cfd41.js +1 -0
  72. package/assets/esri/core/workers/chunks/826fa0dfb63df77bfd95.js +1 -0
  73. package/assets/esri/core/workers/chunks/{7544316a75dbd981aea6.js → 86cb097deec50b0da3f3.js} +1 -1
  74. package/assets/esri/core/workers/chunks/87921f3fa9001f5801ed.js +1 -0
  75. package/assets/esri/core/workers/chunks/{95c594a87b732f5c4979.js → 89b748e064ca90b4f76a.js} +1 -1
  76. package/assets/esri/core/workers/chunks/8a40ed2ee4b032822c30.js +1 -0
  77. package/assets/esri/core/workers/chunks/{09de8be660174a229efb.js → 8cbb28476151a37ae958.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{fe77ae6cf232a7a3298e.js → 8d9d3797c6d62fdfff9d.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{62a49cfd9a2508950e9f.js → 8fedfd33c37172dba6bf.js} +1 -1
  80. package/assets/esri/core/workers/chunks/91aa1157da32f650983b.js +1 -0
  81. package/assets/esri/core/workers/chunks/{e7638b9ab6674bc8a18f.js → 91dfd29e2dba200eab09.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{794748fd1edc29a621cd.js → 9698f36c143953a975d4.js} +1 -1
  83. package/assets/esri/core/workers/chunks/98584902c9db6faa3e4d.js +1 -0
  84. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
  85. package/assets/esri/core/workers/chunks/{e5a06ce0ef6a9a90e100.js → 9f21436016ff7a899e79.js} +1 -1
  86. package/assets/esri/core/workers/chunks/{67d9cfe02613cb73ee37.js → 9ff8ee6ed6b98c03ae7e.js} +2 -2
  87. package/assets/esri/core/workers/chunks/{67d9cfe02613cb73ee37.js.LICENSE.txt → 9ff8ee6ed6b98c03ae7e.js.LICENSE.txt} +1 -1
  88. package/assets/esri/core/workers/chunks/a6ee40dfc471d6612f3c.js +1 -0
  89. package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
  90. package/assets/esri/core/workers/chunks/{a4db5c9a90107e097df8.js → af47272aaaef0ea57e71.js} +1 -1
  91. package/assets/esri/core/workers/chunks/b05208d56a724a8f1661.js +1 -0
  92. package/assets/esri/core/workers/chunks/{79968c183135281d2a6f.js → b3613a38178cad2ebc82.js} +1 -1
  93. package/assets/esri/core/workers/chunks/{22d6b8102e75bdef204c.js → b7eb486354994dc70855.js} +1 -1
  94. package/assets/esri/core/workers/chunks/bc19a232076d98825eef.js +1 -0
  95. package/assets/esri/core/workers/chunks/c29486c4eeb3e72effff.js +1 -0
  96. package/assets/esri/core/workers/chunks/{2b94623cabc6ae0f86ce.js → c37f7756d48ff9af2656.js} +1 -1
  97. package/assets/esri/core/workers/chunks/{1c52999a6392370844a6.js → c4090a60d149a5962179.js} +1 -1
  98. package/assets/esri/core/workers/chunks/c715fd32f814a0f14f40.js +1 -0
  99. package/assets/esri/core/workers/chunks/{73c1d43070b4fe1e5c1e.js → c8e686efe344a33a0258.js} +1 -1
  100. package/assets/esri/core/workers/chunks/{6bb5158de43c4b59107f.js → c9b16fd41cd59d452522.js} +1 -1
  101. package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
  102. package/assets/esri/core/workers/chunks/cf971e7b1b98d9c502d3.js +1 -0
  103. package/assets/esri/core/workers/chunks/{279366e6b743f9680603.js → cfff044859e6e6dcc75d.js} +1 -1
  104. package/assets/esri/core/workers/chunks/d07f911d40bf05fc0306.js +1 -0
  105. package/assets/esri/core/workers/chunks/{8833c3d168951be4bf20.js → d0d79dd3e88eecf5c314.js} +1 -1
  106. package/assets/esri/core/workers/chunks/d1ca7c3a32ce00ed8b81.js +1 -0
  107. package/assets/esri/core/workers/chunks/{76ae1702fecc7ad7017c.js → d1e97cce5047f1791e22.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{17acde0245ecd956306c.js → d233cc33497a663450f9.js} +1 -1
  109. package/assets/esri/core/workers/chunks/{b017bac40dc8328013e3.js → d391bfbaf0e790cd10d6.js} +2 -2
  110. package/assets/esri/core/workers/chunks/{b017bac40dc8328013e3.js.LICENSE.txt → d391bfbaf0e790cd10d6.js.LICENSE.txt} +1 -1
  111. package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
  112. package/assets/esri/core/workers/chunks/{36fe6b8228e622407ec2.js → d8793eead02491136841.js} +1 -1
  113. package/assets/esri/core/workers/chunks/{4d599008e1ea42321b37.js → da24ad57747714ac5eda.js} +1 -1
  114. package/assets/esri/core/workers/chunks/db678a6e352275e507a9.js +1 -0
  115. package/assets/esri/core/workers/chunks/{facb3886714222772ab2.js → ddfd01bb9ba8577c3ffc.js} +1 -1
  116. package/assets/esri/core/workers/chunks/de2ebd9cc3d9e68d435b.js +1 -0
  117. package/assets/esri/core/workers/chunks/{50d9f69d5255af4b29bb.js → df5afa06c6deb6b40109.js} +1 -1
  118. package/assets/esri/core/workers/chunks/e25c4b4a03270d48f408.js +1 -0
  119. package/assets/esri/core/workers/chunks/e3294318daf1192b8319.js +1 -0
  120. package/assets/esri/core/workers/chunks/e599125e746c27de106e.js +1 -0
  121. package/assets/esri/core/workers/chunks/{da573ecc68e6aa8f6da9.js → e767f83f9e2de6650f80.js} +1 -1
  122. package/assets/esri/core/workers/chunks/e9d4cae2144974489d6e.js +1 -0
  123. package/assets/esri/core/workers/chunks/{91df8638b8b904e6d8c5.js → ead8d0cbcebd12dbfad7.js} +1 -1
  124. package/assets/esri/core/workers/chunks/{f9324e88c359c03f35aa.js → eb9c166db0db6fa60e95.js} +1 -1
  125. package/assets/esri/core/workers/chunks/ebcc94234d9d4be1941f.js +316 -0
  126. package/assets/esri/core/workers/chunks/ee5f0fd5384caa11c986.js +1 -0
  127. package/assets/esri/core/workers/chunks/{bc241c7735e4efba734a.js → f34e3fa0c5b28531e289.js} +1 -1
  128. package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +1 -0
  129. package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
  130. package/assets/esri/core/workers/chunks/{d97fadbc69e055d183a0.js → f77f4bd6a577b92cf66f.js} +1 -1
  131. package/assets/esri/core/workers/chunks/f80f5dbf96c343ac4df6.js +1 -0
  132. package/assets/esri/core/workers/chunks/{16d66770ef841564ee3f.js → f89c90f98c85667b0ebc.js} +1 -1
  133. package/assets/esri/core/workers/chunks/{4c4227b0ea21a5e429ab.js → fb192de7e4fa152342bb.js} +1 -1
  134. package/assets/esri/core/workers/chunks/fbd8d2f61f8a15bcf3db.js +1 -0
  135. package/assets/esri/core/workers/chunks/fccd931f95d81ecc57b2.js +1 -0
  136. package/assets/esri/core/workers/chunks/{2f78861afe0e9037dd8d.js → fe49321dca22dc60d105.js} +1 -1
  137. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  138. package/assets/esri/themes/base/widgets/_NavigationToggle.scss +1 -1
  139. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -4
  140. package/assets/esri/themes/base/widgets/_Widget.scss +1 -1
  141. package/assets/esri/themes/dark/main.css +1 -1
  142. package/assets/esri/themes/light/main.css +1 -1
  143. package/assets/esri/themes/light/view.css +1 -1
  144. package/chunks/MultiPathImpl.js +1 -1
  145. package/chunks/Point2D.js +1 -1
  146. package/chunks/UnitFactory.js +1 -1
  147. package/config.js +1 -1
  148. package/core/QueueProcessor.js +1 -1
  149. package/core/SetUtils.js +1 -1
  150. package/core/has.js +1 -1
  151. package/form/FormTemplate.js +1 -1
  152. package/form/elements/Element.js +1 -1
  153. package/form/elements/FieldElement.js +1 -1
  154. package/form/elements/GroupElement.js +1 -1
  155. package/geometry/operators/gx/operatorOffset.js +1 -1
  156. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  157. package/identity/Credential.js +1 -1
  158. package/identity/IdentityManager.js +1 -1
  159. package/identity/IdentityManagerBase.js +1 -1
  160. package/interfaces.d.ts +92 -50
  161. package/kernel.js +1 -1
  162. package/layers/FeatureLayer.js +1 -1
  163. package/layers/SceneLayer.js +1 -1
  164. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  165. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  166. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  167. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  168. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  169. package/layers/knowledgeGraph/layerUtils.js +1 -1
  170. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  171. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  172. package/layers/support/RasterJobHandler.js +1 -1
  173. package/layers/support/RasterWorker.js +1 -1
  174. package/layers/support/fieldConfigUtils.js +1 -1
  175. package/layers/support/rasterDatasets/pixelReader.js +1 -1
  176. package/layers/support/rasterFunctions/pixelTransformUtils.js +5 -0
  177. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  178. package/layers/support/source/DataLayerSource.js +1 -1
  179. package/package.json +4 -4
  180. package/popup/FieldInfo.js +1 -1
  181. package/processRequest.js +5 -0
  182. package/request.js +1 -1
  183. package/requestConfig.js +5 -0
  184. package/requestQueue.js +5 -0
  185. package/rest/query/executeForCount.js +1 -1
  186. package/rest/query/executeForExtent.js +1 -1
  187. package/rest/query/executeForIds.js +1 -1
  188. package/rest/query/executeQueryJSON.js +1 -1
  189. package/rest/query/executeQueryPBF.js +1 -1
  190. package/rest/query/operations/query.js +1 -1
  191. package/rest/support/BaseImageMeasureResultValue.js +5 -0
  192. package/rest/support/ImageAreaResult.js +1 -1
  193. package/rest/support/ImageDistanceResult.js +1 -1
  194. package/rest/support/ImageHeightResult.js +1 -1
  195. package/rest/support/ImageMeasureResultAngleValue.js +5 -0
  196. package/rest/support/ImageMeasureResultAreaValue.js +5 -0
  197. package/rest/support/ImageMeasureResultLengthValue.js +5 -0
  198. package/rest/support/ImageWithType.js +5 -0
  199. package/rest/support/imageMeasureUtils.js +1 -1
  200. package/smartMapping/renderers/size.js +1 -1
  201. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  202. package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
  203. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  204. package/smartMapping/support/adapters/support/utils.js +1 -1
  205. package/support/revision.js +1 -1
  206. package/symbols/support/utils.js +1 -1
  207. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  208. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  209. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  210. package/views/2d/layers/features/schema/SourceSchema.js +1 -1
  211. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  212. package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
  213. package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
  214. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  215. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  216. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  217. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  218. package/views/{3d/support/ImageWithType.js → 2d/layers/features/sources/strategies/constants.js} +1 -1
  219. package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
  220. package/views/3d/GroundView3D.js +1 -1
  221. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  222. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  223. package/views/3d/analysis/VolumeMeasurement/volumeMeasurementErrors.js +1 -1
  224. package/views/3d/glTF/DefaultLoadingContext.js +1 -1
  225. package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
  226. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
  227. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  228. package/views/3d/layers/ElevationLayerView3D.js +1 -1
  229. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  230. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  231. package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
  232. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  233. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  234. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  235. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  236. package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
  237. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  238. package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
  239. package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
  240. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  241. package/views/3d/layers/i3s/I3SDataRequester.js +5 -0
  242. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  243. package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
  244. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  245. package/views/3d/layers/support/FeatureTile.js +1 -1
  246. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  247. package/views/3d/layers/support/MediaLayerInteractionOptions.js +1 -1
  248. package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.js +5 -0
  249. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +5 -0
  250. package/views/3d/layers/support/featureTileQuery3D.js +1 -1
  251. package/views/3d/layers/support/fetchTile.js +1 -1
  252. package/views/3d/support/ResourceController.js +1 -1
  253. package/views/3d/support/SharedSymbolResources.js +1 -1
  254. package/views/3d/support/StreamTextureCollection.js +1 -1
  255. package/views/3d/terrain/TerrainSurface.js +1 -1
  256. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  257. package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
  258. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +6 -0
  259. package/views/SceneView.js +1 -1
  260. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  261. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  262. package/views/draw/MultipointDrawAction.js +1 -1
  263. package/views/draw/PointDrawAction.js +1 -1
  264. package/views/draw/PolygonDrawAction.js +1 -1
  265. package/views/draw/PolylineDrawAction.js +1 -1
  266. package/views/draw/SegmentDrawAction.js +1 -1
  267. package/views/draw/input/CursorUpdateEvents.js +5 -0
  268. package/views/draw/input/DrawCompleteEvent.js +5 -0
  269. package/views/draw/input/VertexAddEvent.js +5 -0
  270. package/views/draw/input/VertexRemoveEvent.js +5 -0
  271. package/views/draw/input/VertexUpdateEvent.js +5 -0
  272. package/views/interactive/editGeometry/CheckpointingEditGeometryOperations.js +5 -0
  273. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  274. package/views/interactive/editGeometry/operations/ReplayableAppendVertex.js +5 -0
  275. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  276. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  277. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  278. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  279. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  280. package/views/support/PromiseQueue.js +1 -1
  281. package/views/support/Scheduler.js +1 -1
  282. package/webscene/spec-certification/api.js +1 -1
  283. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  284. package/widgets/CoordinateConversion.js +1 -1
  285. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  286. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  287. package/widgets/Editor/EditorViewModel.js +1 -1
  288. package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
  289. package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
  290. package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
  291. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  292. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  293. package/widgets/Editor/UpdateRecordWorkflowData.js +1 -1
  294. package/widgets/Editor/UpdateWorkflow.js +1 -1
  295. package/widgets/Editor/UpdateWorkflowData.js +1 -1
  296. package/widgets/Editor/support/SketchController.js +1 -1
  297. package/widgets/Editor/support/errors.js +5 -0
  298. package/widgets/Editor/workflowUtils.js +1 -1
  299. package/widgets/Editor.js +1 -1
  300. package/widgets/Legend/LegendViewModel.js +1 -1
  301. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  302. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  303. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  304. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  305. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  306. package/widgets/OrientedImageryViewer/services/DepthImageService.js +1 -1
  307. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  308. package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
  309. package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +1 -1
  310. package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
  311. package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
  312. package/widgets/PanoramicViewer/support/getVisibleTiles.js +5 -0
  313. package/widgets/Sketch/CreateToolVisibilityMap.js +5 -0
  314. package/widgets/Sketch/SelectionToolVisibilityMap.js +5 -0
  315. package/widgets/Sketch/VisibleElements.js +1 -1
  316. package/widgets/Sketch.js +1 -1
  317. package/assets/esri/core/workers/chunks/020c8913d8e35d63080b.js +0 -1
  318. package/assets/esri/core/workers/chunks/02e69f0c63d97661da60.js +0 -1
  319. package/assets/esri/core/workers/chunks/05eee334d58a0b9f6316.js +0 -1
  320. package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +0 -1
  321. package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +0 -1
  322. package/assets/esri/core/workers/chunks/326a76a4e80269d4029d.js +0 -1
  323. package/assets/esri/core/workers/chunks/377a66034e7c1bad5599.js +0 -1
  324. package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +0 -1
  325. package/assets/esri/core/workers/chunks/459a67928bde4a62b6a4.js +0 -1
  326. package/assets/esri/core/workers/chunks/4eebd74ebc20579dade8.js +0 -1
  327. package/assets/esri/core/workers/chunks/53bd8996e8812f1ad7b2.js +0 -1
  328. package/assets/esri/core/workers/chunks/557960763695abee4a83.js +0 -1
  329. package/assets/esri/core/workers/chunks/6201356f7f91e5c06425.js +0 -1
  330. package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +0 -1
  331. package/assets/esri/core/workers/chunks/6f4bd0ee85e7e5a74340.js +0 -1
  332. package/assets/esri/core/workers/chunks/7413e582bc2b16af6a0f.js +0 -1
  333. package/assets/esri/core/workers/chunks/7461124454bfb4fb6474.js +0 -1
  334. package/assets/esri/core/workers/chunks/75bf27271a31e26e1b21.js +0 -1
  335. package/assets/esri/core/workers/chunks/7aaaebbabee27690283c.js +0 -1
  336. package/assets/esri/core/workers/chunks/7c4a63aeead2505d6f02.js +0 -1
  337. package/assets/esri/core/workers/chunks/811d4c46c75cf6a63e78.js +0 -1
  338. package/assets/esri/core/workers/chunks/8ffd4710d168c2fcfd96.js +0 -1
  339. package/assets/esri/core/workers/chunks/90250e9239c173aace88.js +0 -1
  340. package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +0 -1
  341. package/assets/esri/core/workers/chunks/99859dce1925b406ccd0.js +0 -1
  342. package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +0 -1
  343. package/assets/esri/core/workers/chunks/9e8dceef4c961f56940d.js +0 -1
  344. package/assets/esri/core/workers/chunks/9fac5a12e878cd745354.js +0 -1
  345. package/assets/esri/core/workers/chunks/a06bac9b8f9e18874de8.js +0 -316
  346. package/assets/esri/core/workers/chunks/a712cdff78fc826acd8c.js +0 -1
  347. package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js +0 -2
  348. package/assets/esri/core/workers/chunks/aa54b6f2aba6952af149.js +0 -1
  349. package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +0 -2
  350. package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +0 -1
  351. package/assets/esri/core/workers/chunks/c4e4da69969499a89a2c.js +0 -1
  352. package/assets/esri/core/workers/chunks/cd1930f08e1fc8b30b14.js +0 -1
  353. package/assets/esri/core/workers/chunks/d1fe816b6990918c13c7.js +0 -1
  354. package/assets/esri/core/workers/chunks/d305a21666b1ed5bf33d.js +0 -1
  355. package/assets/esri/core/workers/chunks/d40f57f9fc47f9a9f97c.js +0 -1
  356. package/assets/esri/core/workers/chunks/e0bbfbe1ed39c82f1bd4.js +0 -1
  357. package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +0 -1
  358. package/assets/esri/core/workers/chunks/f6c8beb60f6d29945a2e.js +0 -1
  359. package/assets/esri/core/workers/chunks/f746e3f7ebff2bbdf333.js +0 -1
  360. package/assets/esri/core/workers/chunks/fd2efd1d1cf9d95a87e6.js +0 -1
  361. package/views/3d/layers/i3s/I3SStreamDataController.js +0 -5
  362. package/views/3d/support/StreamDataLoader.js +0 -5
  363. package/views/3d/support/StreamDataRequester.js +0 -5
  364. package/views/3d/support/downloadSlots.js +0 -5
  365. 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 e from"../../Color.js";import{getOrCreateMapValue as t}from"../../core/MapUtils.js";import{queryBinsCapabilities as s,queryCapabilities as o}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as a}from"./constants.js";import r from"../support/LabelClass.js";import n from"../support/LabelExpressionInfo.js";import{fetchClientDataAtKeys as p}from"../../rest/knowledgeGraphService.js";import i from"../../rest/knowledgeGraph/Entity.js";import l from"../../rest/knowledgeGraph/GraphApplyEdits.js";import u from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as d}from"../../support/guards.js";import c from"../../symbols/CIMSymbol.js";import y from"../../symbols/TextSymbol.js";const m={initializeLayersFromClientData:async(e,t,s)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const o=new Map;for(const r of t)o.set(r,f(e,r));const a=await p(e.dataManager.knowledgeGraph,Array.from(o.values()),{requestOptions:{signal:s?.signal}});for(const r of[...e.layers,...e.tables]){const t=r.objectType.name;if(null==t)continue;const s=a.get(f(e,t));if(s){const e=JSON.parse(s);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),r.read(e,{origin:"service"})}}}},f=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function b(e,t,s){return m.initializeLayersFromClientData(e,t,s)}const h=["#4a0932","#b31515","#18382e","#a64f1b","#102432","#8c213f","#ed9310","#2c6954","#144d59","#ffc730","#75351e","#454f4b","#78b1c2","#191921","#8f8f82","#9be0c0","#dbb658","#87b051","#11495c","#c43541","#9c5596","#44498b","#ad9d63","#86afb3","#5c98ca","#b0bfa2","#73241f","#b86b53","#d9d78c","#3e756d","#f260a1","#a0d17d","#c27c30","#eb82eb","#ffdf3c","#ffb259","#ab52b3","#3cccb4","#0095ba","#d92b30"],g="#8f8f82";function w(t){return t<0||t>=h.length?new e(g):new e(h[t])}function I(e){const t=e.toArray();return new c({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,style:"solid",width:.75,color:t},{type:"CIMVectorMarker",enable:!0,size:6,markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}]}]}}})}function C(e){let t="ESRI__ID",s=4;for(const o of e)if(o.name){if("name"===o.name.toLowerCase()){t=o.name;break}o.name.toLowerCase().includes("name")?(t=o.name,s=2):"esriFieldTypeString"===o.fieldType&&s>3&&(t=o.name,s=3)}return t}function S(e,t,s){const o={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},a=new r({labelExpressionInfo:new n({expression:"ESRI__ID"===s?`${t}`:`$feature.${s}`}),labelPlacement:"above-center",symbol:new y(o)}),p=new r({labelExpressionInfo:new n({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new y({...o,yoffset:"12px"})});return"entity"===e?[a]:[p]}function A(e,t,s){const o={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},a="ESRI__ID"===s?`${e}`:`$feature.${s}`;return"point"===t?[new r({labelExpressionInfo:new n({expression:a}),labelPlacement:"above-center",symbol:new y(o)})]:"polyline"===t?[new r({labelExpressionInfo:new n({expression:a}),labelPlacement:"center-along",repeatLabel:!0,symbol:new y(o)})]:"polygon"===t?[new r({labelExpressionInfo:new n({expression:a}),labelPlacement:"always-horizontal",symbol:new y(o)})]:null}const M={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function L(e){const{capabilities:t,allowGeometryUpdates:a,serviceCapabilities:{geometryCapabilities:{supportsZValues:r,supportsMValues:n}}}=e?.serviceDefinition||M,p=e?.dataModel.arcgisManaged?t:t.filter(e=>"Query"===e),i=new Set(p);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:n,supportsZ:r},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:i.has("Create"),supportsDelete:i.has("Delete"),supportsEditing:i.has("Editing"),supportsChangeTracking:!1,supportsQuery:i.has("Query"),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:i.has("Update"),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:o,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&a,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:i.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:i.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}function R(e,s){const o=new l,r=s.graphTypeName,n=s.graphType,p=e=>{const t={...e};for(const o of s.fields)o.editable||delete t[o.name];for(const s of Object.keys(e))s.includes("ESRI__")&&delete t[s];return t};for(const t of e.addFeatures??[]){const e=p(t.attributes);t.sourceLayer.graphTypeName===r&&("entity"===n?(o.entityAdds||(o.entityAdds=[]),o.entityAdds.push(new i({properties:e,typeName:r}))):(o.relationshipAdds||(o.relationshipAdds=[]),o.relationshipAdds.push(new u({properties:e,typeName:r}))))}for(const t of e.updateFeatures??[]){const e=t.attributes[a],s=p(t.attributes);t.sourceLayer.graphTypeName===r&&("entity"===n?(o.entityUpdates||(o.entityUpdates=[]),o.entityUpdates.push(new i({id:e,properties:s,typeName:r}))):(o.relationshipUpdates||(o.relationshipUpdates=[]),o.relationshipUpdates.push(new u({id:e,properties:s,typeName:r}))))}const c=new Map;for(const i of e.deleteFeatures??[])if(d(i)){const e=i,s=t(c,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===r&&s.ids.push(e.attributes[a])}else if(i.objectId&&"string"==typeof i.objectId){t(c,r,()=>({typeName:r,ids:[]})).ids.push(i.objectId)}for(const t of c.values())t.ids.length>0&&("entity"===n?(o.entityDeletes||(o.entityDeletes=[]),o.entityDeletes.push({typeName:t.typeName,ids:t.ids})):(o.relationshipDeletes||(o.relationshipDeletes=[]),o.relationshipDeletes.push({typeName:t.typeName,ids:t.ids})));return o}function j(e,t){const s={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const o of e.editResults)if(o.typeName===t){for(const e of o.adds)s.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.updates)s.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.deletes)s.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return s}export{j as convertGraphEditsResultToFeatureEdits,R as convertLayerEditsToGraphEdits,L as createCapabilitiesFromKnowledgeGraph,g as fallbackKGSublayerSymbolHexColor,I as getDefaultLCRelationshipSublayerSymbol,C as getDisplayLabelProperty,w as getKGSublayerSymbolColor,S as getLinkChartDefaultLabelingInfo,A as getMapDefaultLabelingInfo,b as initializeLayersFromClientData,m as layerUtils};
5
+ import e from"../../Color.js";import{getOrCreateMapValue as t}from"../../core/MapUtils.js";import{FieldElement as s}from"../../form/elements.js";import o from"../../form/FormTemplate.js";import{initializeProjection as r,project as a}from"../../geometry/projectionUtils.js";import n from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as p}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as i,queryCapabilities as l}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as u}from"./constants.js";import c from"../support/FeatureTemplate.js";import d from"../support/LabelClass.js";import y from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as m}from"../support/layerUtils.js";import{fetchClientDataAtKeys as f}from"../../rest/knowledgeGraphService.js";import b from"../../rest/knowledgeGraph/Entity.js";import h from"../../rest/knowledgeGraph/GraphApplyEdits.js";import g from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as w}from"../../support/guards.js";import I from"../../symbols/CIMSymbol.js";import C from"../../symbols/TextSymbol.js";const j={initializeLayersFromClientData:async(e,t,s)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const o=new Map;for(const a of t)o.set(a,S(e,a));const r=await f(e.dataManager.knowledgeGraph,Array.from(o.values()),{requestOptions:{signal:s?.signal}});for(const a of[...e.layers,...e.tables]){const t=a.objectType.name;if(null==t)continue;const s=r.get(S(e,t));if(s){const e=JSON.parse(s);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),a.read(e,{origin:"service"})}}}},S=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function L(e,t,s){return j.initializeLayersFromClientData(e,t,s)}const A=["#4a0932","#b31515","#18382e","#a64f1b","#102432","#8c213f","#ed9310","#2c6954","#144d59","#ffc730","#75351e","#454f4b","#78b1c2","#191921","#8f8f82","#9be0c0","#dbb658","#87b051","#11495c","#c43541","#9c5596","#44498b","#ad9d63","#86afb3","#5c98ca","#b0bfa2","#73241f","#b86b53","#d9d78c","#3e756d","#f260a1","#a0d17d","#c27c30","#eb82eb","#ffdf3c","#ffb259","#ab52b3","#3cccb4","#0095ba","#d92b30"],M="#8f8f82";function R(t){return t<0||t>=A.length?new e(M):new e(A[t])}function T(e){const t=e.toArray();return new I({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,style:"solid",width:.75,color:t},{type:"CIMVectorMarker",enable:!0,size:6,markerPlacement:{type:"CIMMarkerPlacementOnLine",angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-10,ymin:-5,xmax:0,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[-12,-3.47],[-12,3.6],[1.96,-.03],[-12,-3.47]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:t}]}}]}]}}})}function k(e){let t="ESRI__ID",s=4;for(const o of e)if(o.name){if("name"===o.name.toLowerCase()){t=o.name;break}o.name.toLowerCase().includes("name")?(t=o.name,s=2):"esriFieldTypeString"===o.fieldType&&s>3&&(t=o.name,s=3)}return t}function N(e,t,s){const o={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},r=new d({labelExpressionInfo:new y({expression:"ESRI__ID"===s?`${t}`:`$feature.${s}`}),labelPlacement:"above-center",symbol:new C(o)}),a=new d({labelExpressionInfo:new y({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new C({...o,yoffset:"12px"})});return"entity"===e?[r]:[a]}function E(e,t,s){const o={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},r="ESRI__ID"===s?`${e}`:`$feature.${s}`;return"point"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"above-center",symbol:new C(o)})]:"polyline"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"center-along",repeatLabel:!0,symbol:new C(o)})]:"polygon"===t?[new d({labelExpressionInfo:new y({expression:r}),labelPlacement:"always-horizontal",symbol:new C(o)})]:null}const x={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function F(e){const{capabilities:t,allowGeometryUpdates:s,serviceCapabilities:{geometryCapabilities:{supportsZValues:o,supportsMValues:r}}}=e?.serviceDefinition||x,a=e?.dataModel.arcgisManaged?t:t.filter(e=>"Query"===e),n=new Set(a);return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:r,supportsZ:o},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:n.has("Create"),supportsDelete:n.has("Delete"),supportsEditing:n.has("Editing"),supportsChangeTracking:!1,supportsQuery:n.has("Query"),supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:n.has("Update"),supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:l,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:i,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&s,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:n.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:n.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function U(e,s){const o=new h,i=s.graphTypeName,l=s.graphType,c="knowledge-graph"===s.parentCompositeLayer.type?s.geometryFieldName:null,d=!!s.fieldsIndex.get(c)?.editable,y=e=>{const t={...e};for(const o of s.fields)o.editable||delete t[o.name];for(const s of Object.keys(e))s.includes("ESRI__")&&delete t[s];return t},f=async e=>{await r(e.spatialReference,n.WGS84);const t=a(e,n.WGS84);if("point"===t.type)return t.normalize();return(await p(t))[0]};for(const t of e.addFeatures??[]){const e=y(t.attributes);m(t.sourceLayer)&&t.sourceLayer.graphTypeName===i&&("entity"===l?(o.entityAdds||(o.entityAdds=[]),c&&t.geometry&&(e[c]=await f(t.geometry)),o.entityAdds.push(new b({properties:e,typeName:i}))):(o.relationshipAdds||(o.relationshipAdds=[]),o.relationshipAdds.push(new g({properties:e,typeName:i}))))}for(const t of e.updateFeatures??[]){const e=t.attributes[u],s=y(t.attributes);m(t.sourceLayer)&&t.sourceLayer.graphTypeName===i&&("entity"===l?(o.entityUpdates||(o.entityUpdates=[]),c&&d&&t.geometry&&(s[c]=await f(t.geometry)),o.entityUpdates.push(new b({id:e,properties:s,typeName:i}))):(o.relationshipUpdates||(o.relationshipUpdates=[]),o.relationshipUpdates.push(new g({id:e,properties:s,typeName:i}))))}const I=new Map;for(const r of e.deleteFeatures??[])if(w(r)){const e=r,s=t(I,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===i&&s.ids.push(e.attributes[u])}else if(r.objectId&&"string"==typeof r.objectId){t(I,i,()=>({typeName:i,ids:[]})).ids.push(r.objectId)}for(const t of I.values())t.ids.length>0&&("entity"===l?(o.entityDeletes||(o.entityDeletes=[]),o.entityDeletes.push({typeName:t.typeName,ids:t.ids})):(o.relationshipDeletes||(o.relationshipDeletes=[]),o.relationshipDeletes.push({typeName:t.typeName,ids:t.ids})));return o}function D(e,t){const s={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const o of e.editResults)if(o.typeName===t){for(const e of o.adds)s.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.updates)s.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of o.deletes)s.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return s}function v(e){if(!e.objectType)return null;const t=[];for(const o of e.fields)!o.name.includes("ESRI__")&&o.editable&&"geometry"!==o.type&&t.push(new s({fieldName:o.name}));return new o({elements:t})}function G(e){if(!e.objectType)return null;let t=null;switch(e.geometryType){case"point":case"multipoint":t="point";break;case"polyline":t="line";break;case"polygon":t="polygon";break;default:t=null}return[new c({name:e.graphTypeName,drawingTool:t,prototype:{}})]}export{D as convertGraphEditsResultToFeatureEdits,U as convertLayerEditsToGraphEdits,F as createCapabilitiesFromKnowledgeGraph,G as createDefaultKGSLFeatureTemplates,v as createDefaultKGSLFormTemplate,M as fallbackKGSublayerSymbolHexColor,T as getDefaultLCRelationshipSublayerSymbol,k as getDisplayLabelProperty,R as getKGSublayerSymbolColor,N as getLinkChartDefaultLabelingInfo,E as getMapDefaultLabelingInfo,L as initializeLayersFromClientData,j as layerUtils};
@@ -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{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as a,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{isElevationSource as n}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPointPanoramic as o,rectifyMapPoint as c}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as f,convertPixelToHeadingPitch as l,isElevationSampler as m,reducerFn as p,validatePixelsToTransform as h,validateRotationMatrix as u,computeFarplaneVertices as y,computeHFOVAndVFOV as d,vecToPoint as w,or as g,isUpdateElevationWithElevationSource as v,scaleAndAddWithFactor as x,computeNewReferenceCoordinates as M,projectiveTransform as R}from"./utils.js";import{worldToImage as A}from"./worldToImage.js";import{viewingLimit as P}from"../../../widgets/OrientedImageryViewer/constants.js";async function V(e,t,a){const{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:n,farPlaneVertices:o,cameraLocation:c,pixelsToTransform:s,vecToPoint:f,pixelDepths:l}=S(e,t),m=new Array;return await j(s,o,i,f,t,m,c,n,r,a,l),Array.isArray(e)?m:m[0]}async function j(e,t,a,r,n,o,s,f,l,p,h){let u=n.averageElevation,y=0;for(const d of e){const e=L(t,a,d,r,n),w=h?.at(y);if("number"==typeof w){const t=F(e,s,f),a=w*f,r=[s[0]+t[0]*a,s[1]+t[1]*a,s[2]+t[2]*w];o.push(new i(r,n.cameraLocation.spatialReference));continue}if(y+=1,p&&g(m(p.elevationSample),v(p))){u=(await c(r(e),{x:d[0],y:d[1]},{...n,...p,farPlaneVertices:t.map(r)}))[2]}o.push(r(b(e,s,f,u,n.cameraPitch,l)))}}function F(e,t,a){const i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],c=Math.hypot(i,n)/a,s=Math.hypot(o,c)*a,f=r();return f[0]=i/s,f[1]=n/s,f[2]=o/s,f[2]=f[2]*a,f}function b(e,t,r,i,n,o){let c=a(e);const s=F(e,t,r);if(T(e[2],i,n,o)){const e=Math.abs((t[2]-i)/-s[2])*r;c=x(t,s,e,r)}else c[2]=i;return c}function T(e,t,a,r){return e<t||a+r/2<P}function L(e,t,a,r,i){let n=null;const o=9;let c,s=0,f=e,l=t;for(;s<=o;){const e=D(a,l,f,i);if(c=e.error,n=e.transformedPoint,g(c<=1,s===o))break;f=M(f,c,a,t),l=O(f,r,i),s++}return n}function O(e,t,a){return A(e.map(t),a).map(({x:e,y:t})=>[e,t,1])}function D(e,t,a,r){const{cameraLocation:n}=r,o=R(e,t,a),{x:c,y:s}=A(new i(o,n.spatialReference),r);return{transformedPoint:o,error:E(e,[c,s,1])}}function E(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function S(t,a){const r=e(t)||"items"in t?t:[t],{cameraLocation:n,rotationMatrix:o}=a;if(h(r,n),u(o),9!==o?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=s(n.y,n.spatialReference),f=y({...a,scalingFactor:c}),l=A(f.map(e=>new i(e,n.spatialReference)),a),{vfov:m}=d(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:n.toArray(),imageBoundaries:l.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:m,farPlaneVertices:f,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:w(n.spatialReference),pixelDepths:r.map(e=>B(e)?e.depth:void 0)}}function B(e){return"depth"in e&&"number"==typeof e.depth}async function H(e,a,r){const{cameraHeading:c,cameraLocation:h,farDistance:u,imageHeight:y,imageWidth:d,verticalFieldOfView:w}=a,g=s(h.y,h.spatialReference),v=u*g,x=new Array,[M,R,A]=h.toArray(),P=Array.isArray(e)?e:[e];for(const s of P){let e,P;const V=B(s),j=V?s.depth*g:v;if(f(s))e=s.heading,P=s.pitch;else{const t=l({x:s.x,y:s.y},d,y);e=t.heading,P=t.pitch}e=(e+c)%360;const F=[M+Math.sin(t(e))*Math.sin(t(P))*j,R+Math.cos(t(e))*Math.sin(t(P))*j,A+-Math.cos(t(P))*(V?s.depth:u)];if(V){x.push(new i(F,h.spatialReference));continue}let T=a.averageElevation;if(r&&(n(r)||m(r.elevationSample))){T=(await o(new i(F,h.spatialReference),{heading:e,pitch:P},{...a,...r,farPlaneVertices:p(u,u).map(([e,t])=>new i([h.x+e,h.y+t],h.spatialReference))}))[2]}x.push(new i(b(F,h.toArray(),g,T,P,w),h.spatialReference))}return Array.isArray(e)?x:x[0]}export{V as imageToWorld,H as imageToWorldPanoramic};
5
+ import{isArrayLike as e}from"../../../core/arrayUtils.js";import{deg2rad as t}from"../../../core/mathUtils.js";import{clone as a,zeros as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import i from"../../../geometry/Point.js";import{isElevationSource as n}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPointPanoramic as o,rectifyMapPoint as c}from"./rectifyMapPoint.js";import{getWebMercatorScalingFactor as s,hasAngles as f,convertPixelToHeadingPitch as l,isElevationSampler as m,reducerFn as p,validatePixelsToTransform as h,validateRotationMatrix as u,computeFarplaneVertices as y,computeHFOVAndVFOV as d,vecToPoint as w,or as g,isUpdateElevationWithElevationSource as v,scaleAndAddWithFactor as x,computeNewReferenceCoordinates as M,projectiveTransform as R}from"./utils.js";import{worldToImage as A}from"./worldToImage.js";import{viewingLimit as P}from"../../../widgets/OrientedImageryViewer/constants.js";async function V(e,t,a){const{verticalFieldOfView:r,imageBoundaries:i,scalingFactor:n,farPlaneVertices:o,cameraLocation:c,pixelsToTransform:s,vecToPoint:f,pixelDepths:l}=S(e,t),m=new Array;return await j(s,o,i,f,t,m,c,n,r,a,l),Array.isArray(e)?m:m[0]}async function j(e,t,a,r,n,o,s,f,l,p,h){let u=n.averageElevation;const y=e.length;for(let d=0;d<y;d+=1){const y=e.at(d),w=L(t,a,y,r,n),x=h?.at(d);if("number"==typeof x){const e=F(w,s,f),t=x*f,a=[s[0]+e[0]*t,s[1]+e[1]*t,s[2]+e[2]*x];o.push(new i(a,n.cameraLocation.spatialReference));continue}if(p&&g(m(p.elevationSample),v(p))){u=(await c(r(w),{x:y[0],y:y[1]},{...n,...p,farPlaneVertices:t.map(r)}))[2]}o.push(r(b(w,s,f,u,n.cameraPitch,l)))}}function F(e,t,a){const i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],c=Math.hypot(i,n)/a,s=Math.hypot(o,c)*a,f=r();return f[0]=i/s,f[1]=n/s,f[2]=o/s,f[2]=f[2]*a,f}function b(e,t,r,i,n,o){let c=a(e);const s=F(e,t,r);if(T(e[2],i,n,o)){const e=Math.abs((t[2]-i)/-s[2])*r;c=x(t,s,e,r)}else c[2]=i;return c}function T(e,t,a,r){return e<t||a+r/2<P}function L(e,t,a,r,i){let n=null;const o=9;let c,s=0,f=e,l=t;for(;s<=o;){const e=D(a,l,f,i);if(c=e.error,n=e.transformedPoint,g(c<=1,s===o))break;f=M(f,c,a,t),l=O(f,r,i),s++}return n}function O(e,t,a){return A(e.map(t),a).map(({x:e,y:t})=>[e,t,1])}function D(e,t,a,r){const{cameraLocation:n}=r,o=R(e,t,a),{x:c,y:s}=A(new i(o,n.spatialReference),r);return{transformedPoint:o,error:E(e,[c,s,1])}}function E(e,t){return Math.abs(e[0]-t[0])+Math.abs(e[1]-t[1])}function S(t,a){const r=e(t)||"items"in t?t:[t],{cameraLocation:n,rotationMatrix:o}=a;if(h(r,n),u(o),9!==o?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const c=s(n.y,n.spatialReference),f=y({...a,scalingFactor:c}),l=A(f.map(e=>new i(e,n.spatialReference)),a),{vfov:m}=d(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:n.toArray(),imageBoundaries:l.map(({x:e,y:t})=>[e,t,1]),verticalFieldOfView:m,farPlaneVertices:f,scalingFactor:c,pixelsToTransform:r.map(e=>[e.x,e.y,1]),vecToPoint:w(n.spatialReference),pixelDepths:r.map(e=>B(e)?e.depth:void 0)}}function B(e){return"depth"in e&&"number"==typeof e.depth}async function H(e,a,r){const{cameraHeading:c,cameraLocation:h,farDistance:u,imageHeight:y,imageWidth:d,verticalFieldOfView:w}=a,g=s(h.y,h.spatialReference),v=u*g,x=new Array,[M,R,A]=h.toArray(),P=Array.isArray(e)?e:[e];for(const s of P){let e,P;const V=B(s),j=V?s.depth*g:v;if(f(s))e=s.heading,P=s.pitch;else{const t=l({x:s.x,y:s.y},d,y);e=t.heading,P=t.pitch}e=(e+c)%360;const F=[M+Math.sin(t(e))*Math.sin(t(P))*j,R+Math.cos(t(e))*Math.sin(t(P))*j,A+-Math.cos(t(P))*(V?s.depth:u)];if(V){x.push(new i(F,h.spatialReference));continue}let T=a.averageElevation;if(r&&(n(r)||m(r.elevationSample))){T=(await o(new i(F,h.spatialReference),{heading:e,pitch:P},{...a,...r,farPlaneVertices:p(u,u).map(([e,t])=>new i([h.x+e,h.y+t],h.spatialReference))}))[2]}x.push(new i(b(F,h.toArray(),g,T,P,w),h.spatialReference))}return Array.isArray(e)?x:x[0]}export{V as imageToWorld,H as imageToWorldPanoramic};
@@ -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{open as r}from"../../core/workers/workers.js";import o from"./PixelBlock.js";class t{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await r("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r.pixelBlock.getTransferableObject().pixelBlock,a=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:n,type:r.dataType},t);return a?new o(a):null}async convertPixelBlockToFeatures(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=await this._workerThread.invoke("convertPixelBlockToFeatures",{pixelBlock:r.pixelBlock.toJSON(),extent:r.extent.toJSON(),fieldNames:r.fieldNames,skipFactor:r.skipFactor,pixelIdOffset:r.pixelIdOffset,imageRowSize:r.imageRowSize},o),n=r.extent.spatialReference?.toJSON();return t.forEach(e=>e.geometry.spatialReference=n),t}computeStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const{transferList:t,pixelBlock:n}=r.pixelBlock.getTransferableObject();return o?.transferPixelsToWorker&&(o={...o,transferList:t}),this._workerThread.invoke("computeStatisticsHistograms",{...r,pixelBlock:n},o)}async compositeBands(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r.pixelBlocks.map(e=>e?.getTransferableObject()),a={pixelBlocks:n.map(e=>e?.pixelBlock)};if(t?.transferPixelsToWorker){const e=n.flatMap(e=>e?.transferList).filter(e=>null!=e);t={...t,transferList:e}}const i=await this._workerThread.invoke("compositeBands",a,t);return i?o.fromJSON(i):null}async decode(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("decode",r,{...t,transferList:[r.data]});return n?new o(n):null}async symbolize(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=r.pixelBlock?.getTransferableObject().pixelBlock,a={extent:r.extent?.toJSON(),pixelBlock:n,simpleStretchParams:r.simpleStretchParams,bandIds:r.bandIds},i=await this._workerThread.invoke("symbolize",a,t);return i?new o(i):null}async highlightPixels(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={pixelBlock:r.pixelBlock?.toJSON(),renderedPixelBlock:r.renderedPixelBlock?.toJSON(),highlightOptions:r.highlightOptions},n=await this._workerThread.invoke("highlightPixels",t,o);r.renderedPixelBlock.pixels=n.pixels,r.renderedPixelBlock.mask=n.mask,r.renderedPixelBlock.maskIsAlpha=n.maskIsAlpha}async updateSymbolizer(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=r?.rendererJSON?.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:r.toJSON(),histograms:t},o))}async updateRasterFunction(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:r.toJSON()},o))}async process(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const n=await this._workerThread.invoke("process",{extent:r.extent?.toJSON(),primaryPixelSizes:r.primaryPixelSizes?.map(e=>null!=e?e.toJSON():null),primaryPixelBlocks:r.primaryPixelBlocks.map(e=>e?.getTransferableObject().pixelBlock),primaryRasterIds:r.primaryRasterIds},t);return n?new o(n):null}async stretch(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock,stretchParams:r.stretchParams},a=await this._workerThread.invoke("stretch",n,t);return a?new o(a):null}async split(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock,tileSize:r.tileSize,maximumPyramidLevel:r.maximumPyramidLevel,useBilinear:r.useBilinear},a=await this._workerThread.invoke("split",n,t);return a&&a.forEach((e,r)=>{a.set(r,e?o.fromJSON(e):null)}),a}async clipTile(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const n=r.pixelBlock.getTransferableObject().pixelBlock,a={...r,pixelBlock:n},i=await this._workerThread.invoke("clipTile",a,t);return i?o.fromJSON(i):null}async estimateStatisticsHistograms(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.pixelBlock)return null;const t={srcPixelBlock:r.pixelBlock.getTransferableObject().pixelBlock};return await this._workerThread.invoke("estimateStatisticsHistograms",t,o)}async mosaicAndTransform(r,t){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");if(!r?.srcPixelBlocks?.length)return{pixelBlock:null};const n=r.srcPixelBlocks.map(e=>e?.getTransferableObject()),a={...r,srcPixelBlocks:n.map(e=>e?.pixelBlock)};if(t?.transferPixelsToWorker){const e=n.flatMap(e=>e?.transferList).filter(e=>null!=e);t={...t,transferList:e}}const i=await this._workerThread.invoke("mosaicAndTransform",a,t);return{pixelBlock:i.pixelBlock?new o(i.pixelBlock):null,localNorthDirections:i.localNorthDirections}}async createFlowMesh(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t={buffer:r.flowData.data.buffer,maskBuffer:r.flowData.mask.buffer,width:r.flowData.width,height:r.flowData.height},{meshType:n,simulationSettings:a}=r,i=await this._workerThread.invoke("createFlowMesh",{meshType:n,flowData:t,simulationSettings:a},{...o,transferList:[t.buffer,t.maskBuffer]});return{vertexData:new Float32Array(i.vertexBuffer),indexData:new Uint32Array(i.indexBuffer)}}getProjectionOffsetGrid(r,o){if(!this._workerThread)throw new e("raster-jobhandler:no-connection","no available worker connection");const t=null!=r.datumTransformation?r.datumTransformation.steps.map(e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse})):null,n=null!=r.rasterTransform?r.rasterTransform.toJSON():null,a={projectedExtent:r.projectedExtent.toJSON(),srcBufferExtent:r.srcBufferExtent.toJSON(),pixelSize:r.pixelSize,hasWrapAround:r.hasWrapAround,spacing:r.spacing,datumTransformationSteps:t,rasterTransform:n,isAdaptive:r.isAdaptive,includeGCSGrid:r.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",a,o)}}export{t as default};
5
+ import e from"../../core/Error.js";import{open as r}from"../../core/workers/workers.js";import t from"./PixelBlock.js";class i{constructor(){this._workerThread=null,this._destroyed=!1}async initialize(){const e=await r("RasterWorker");this._destroyed?e.close():this._workerThread=e}destroy(){this._destroyed=!0,this._workerThread&&(this._workerThread.close(),this._workerThread=null)}async convertVectorFieldData(e,r){a(this._workerThread);const i=e.pixelBlock.getTransferableObject().pixelBlock,s=await this._workerThread.invoke("convertVectorFieldData",{pixelBlock:i,type:e.dataType},r);return s?new t(s):null}async convertPixelBlockToFeatures(e,r){a(this._workerThread);const t=await this._workerThread.invoke("convertPixelBlockToFeatures",{pixelBlock:e.pixelBlock.toJSON(),extent:e.extent.toJSON(),fieldNames:e.fieldNames,skipFactor:e.skipFactor,pixelIdOffset:e.pixelIdOffset,imageRowSize:e.imageRowSize},r),i=e.extent.spatialReference?.toJSON();return t.forEach(e=>e.geometry.spatialReference=i),t}computeStatisticsHistograms(e,r){a(this._workerThread);const{transferList:t,pixelBlock:i}=e.pixelBlock.getTransferableObject();return r?.transferPixelsToWorker&&(r={...r,transferList:t}),this._workerThread.invoke("computeStatisticsHistograms",{...e,pixelBlock:i},r)}async transformPixels(e,r){a(this._workerThread);const{transferList:i,pixelBlock:s}=e.pixelBlock.getTransferableObject();r?.transferPixelsToWorker&&(r={...r,transferList:i});const o=await this._workerThread.invoke("transformPixels",{...e,pixelBlock:s},r);return t.fromJSON(o)}async compositeBands(e,r){a(this._workerThread);const i=e.pixelBlocks.map(e=>e?.getTransferableObject()),s={pixelBlocks:i.map(e=>e?.pixelBlock)};if(r?.transferPixelsToWorker){const e=i.flatMap(e=>e?.transferList).filter(e=>null!=e);r={...r,transferList:e}}const o=await this._workerThread.invoke("compositeBands",s,r);return o?t.fromJSON(o):null}async decode(e,r){a(this._workerThread);const i=await this._workerThread.invoke("decode",e,{...r,transferList:[e.data]});return i?new t(i):null}async symbolize(e,r){a(this._workerThread);const i=e.pixelBlock?.getTransferableObject().pixelBlock,s={extent:e.extent?.toJSON(),pixelBlock:i,simpleStretchParams:e.simpleStretchParams,bandIds:e.bandIds},o=await this._workerThread.invoke("symbolize",s,r);return o?new t(o):null}async highlightPixels(e,r){a(this._workerThread);const t={pixelBlock:e.pixelBlock?.toJSON(),renderedPixelBlock:e.renderedPixelBlock?.toJSON(),highlightOptions:e.highlightOptions},i=await this._workerThread.invoke("highlightPixels",t,r);e.renderedPixelBlock.pixels=i.pixels,e.renderedPixelBlock.mask=i.mask,e.renderedPixelBlock.maskIsAlpha=i.maskIsAlpha}async updateSymbolizer(e,r){a(this._workerThread);const t=e?.rendererJSON?.histograms;await Promise.all(this._workerThread.broadcast("updateSymbolizer",{symbolizerJSON:e.toJSON(),histograms:t},r))}async updateRasterFunction(e,r){a(this._workerThread),await Promise.all(this._workerThread.broadcast("updateRasterFunction",{rasterFunctionJSON:e.toJSON()},r))}async process(e,r){a(this._workerThread);const i=await this._workerThread.invoke("process",{extent:e.extent?.toJSON(),primaryPixelSizes:e.primaryPixelSizes?.map(e=>null!=e?e.toJSON():null),primaryPixelBlocks:e.primaryPixelBlocks.map(e=>e?.getTransferableObject().pixelBlock),primaryRasterIds:e.primaryRasterIds},r);return i?new t(i):null}async stretch(e,r){if(a(this._workerThread),!e?.pixelBlock)return null;const i={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock,stretchParams:e.stretchParams},s=await this._workerThread.invoke("stretch",i,r);return s?new t(s):null}async split(e,r){if(a(this._workerThread),!e?.pixelBlock)return null;const i={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock,tileSize:e.tileSize,maximumPyramidLevel:e.maximumPyramidLevel,useBilinear:e.useBilinear},s=await this._workerThread.invoke("split",i,r);return s&&s.forEach((e,r)=>{s.set(r,e?t.fromJSON(e):null)}),s}async clipTile(e,r){if(a(this._workerThread),!e?.pixelBlock)return null;const i=e.pixelBlock.getTransferableObject().pixelBlock,s={...e,pixelBlock:i},o=await this._workerThread.invoke("clipTile",s,r);return o?t.fromJSON(o):null}async estimateStatisticsHistograms(e,r){if(a(this._workerThread),!e?.pixelBlock)return null;const t={srcPixelBlock:e.pixelBlock.getTransferableObject().pixelBlock};return await this._workerThread.invoke("estimateStatisticsHistograms",t,r)}async mosaicAndTransform(e,r){if(a(this._workerThread),!e?.srcPixelBlocks?.length)return{pixelBlock:null};const i=e.srcPixelBlocks.map(e=>e?.getTransferableObject()),s={...e,srcPixelBlocks:i.map(e=>e?.pixelBlock)};if(r?.transferPixelsToWorker){const e=i.flatMap(e=>e?.transferList).filter(e=>null!=e);r={...r,transferList:e}}const o=await this._workerThread.invoke("mosaicAndTransform",s,r);return{pixelBlock:o.pixelBlock?new t(o.pixelBlock):null,localNorthDirections:o.localNorthDirections}}async createFlowMesh(e,r){a(this._workerThread);const t={buffer:e.flowData.data.buffer,maskBuffer:e.flowData.mask.buffer,width:e.flowData.width,height:e.flowData.height},{meshType:i,simulationSettings:s}=e,o=await this._workerThread.invoke("createFlowMesh",{meshType:i,flowData:t,simulationSettings:s},{...r,transferList:[t.buffer,t.maskBuffer]});return{vertexData:new Float32Array(o.vertexBuffer),indexData:new Uint32Array(o.indexBuffer)}}getProjectionOffsetGrid(e,r){a(this._workerThread);const t=null!=e.datumTransformation?e.datumTransformation.steps.map(e=>({wkid:e.wkid,wkt:e.wkt,isInverse:e.isInverse})):null,i=null!=e.rasterTransform?e.rasterTransform.toJSON():null,s={projectedExtent:e.projectedExtent.toJSON(),srcBufferExtent:e.srcBufferExtent.toJSON(),pixelSize:e.pixelSize,hasWrapAround:e.hasWrapAround,spacing:e.spacing,datumTransformationSteps:t,rasterTransform:i,isAdaptive:e.isAdaptive,includeGCSGrid:e.includeGCSGrid};return this._workerThread.invoke("getProjectionOffsetGrid",s,r)}}function a(r){if(null==r)throw new e("raster-jobhandler:no-connection","no available worker connection")}export{i 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 e from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import t from"../../geometry/operators/support/GeographicTransformation.js";import s from"./PixelBlock.js";import{decode as o}from"./rasterFormats/RasterCodec.js";import{convertPixelBlockToFeatures as i,compositeBands as n,highlightPixels as l,split as a,clipTile as m,mosaic as c,approximateTransform as f,getLocalArithmeticNorthRotations as p}from"./rasterFunctions/pixelUtils.js";import{create as u}from"./rasterFunctions/rasterFunctionHelper.js";import{load as x,getProjectionOffsetGrid as S}from"./rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as d,estimateStatisticsHistograms as h}from"./rasterFunctions/stretchUtils.js";import{convertVectorFieldData as g,convertToLocalDirections as k}from"./rasterFunctions/vectorFieldUtils.js";import{readTransform as y}from"./rasterTransforms/utils.js";import O from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as B}from"../../views/2d/engine/flow/dataUtils.js";function N(e){if(!e)return{result:null,transferList:[]};const{pixelBlock:r,transferList:t}=e.getTransferableObject();return{result:r,transferList:t}}class P{convertVectorFieldData(e){const r=s.fromJSON(e.pixelBlock),t=N(g(r,e.type));return Promise.resolve(t)}convertPixelBlockToFeatures(r){const t=i({pixelBlock:s.fromJSON(r.pixelBlock),extent:e.fromJSON(r.extent),fieldNames:r.fieldNames,skipFactor:r.skipFactor,skipSpatialReference:!0,pixelIdOffset:r.pixelIdOffset,imageRowSize:r.imageRowSize});return Promise.resolve(t)}computeStatisticsHistograms(e){const r=s.fromJSON(e.pixelBlock),t=d(r,{histogramSize:e.histogramSize,includeSkewnessKurtosis:e.includeSkewnessKurtosis});return Promise.resolve(t)}compositeBands(e){const r=e.pixelBlocks.map(e=>e&&s.fromJSON(e)),t=N(n(r));return Promise.resolve(t)}async decode(e){return N(await o(e.data,e.options))}symbolize(r){const t=r.pixelBlock?s.fromJSON(r.pixelBlock):null,o=r.extent?e.fromJSON(r.extent):null,i=N(this.symbolizer.symbolize({...r,pixelBlock:t,extent:o}));return Promise.resolve(i)}highlightPixels(e){const r=s.fromJSON(e.pixelBlock),t=s.fromJSON(e.renderedPixelBlock);return l(r,t,e.highlightOptions),Promise.resolve(t.toJSON())}async updateSymbolizer(e){this.symbolizer=O.fromJSON(e.symbolizerJSON),e.histograms&&"rasterStretch"===this.symbolizer?.rendererJSON.type&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=u(e.rasterFunctionJSON)}async process(t){return N(this.rasterFunction.process({extent:e.fromJSON(t.extent),primaryPixelBlocks:t.primaryPixelBlocks.map(e=>null!=e?s.fromJSON(e):null),primaryPixelSizes:t.primaryPixelSizes?.map(e=>null!=e?r.fromJSON(e):null),primaryRasterIds:t.primaryRasterIds}))}stretch(e){const r=N(this.symbolizer.simpleStretch(s.fromJSON(e.srcPixelBlock),e.stretchParams));return Promise.resolve(r)}estimateStatisticsHistograms(e){const r=h(s.fromJSON(e.srcPixelBlock));return Promise.resolve(r)}split(e){const r=a(s.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel??0,!1===e.useBilinear),t=[];let o;return r&&(o=new Map,r.forEach((e,r)=>{if(e){const{pixelBlock:s,transferList:i}=e.getTransferableObject();o.set(r,s),i.forEach(e=>{t.includes(e)||t.push(e)})}})),Promise.resolve({result:o,transferList:t})}clipTile(e){const r=s.fromJSON(e.pixelBlock),t=N(m({...e,pixelBlock:r}));return Promise.resolve(t)}async mosaicAndTransform(e){const r=e.srcPixelBlocks.map(e=>e?new s(e):null),t=c(r,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let o,i=t;e.coefs&&(i=f(t,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(o=p(e.destDimension,e.gcsGrid),i=k(i,e.isUV?"vector-uv":"vector-magdir",o));const{result:n,transferList:l}=N(i);return{result:{pixelBlock:n,localNorthDirections:o},transferList:l}}async createFlowMesh(e,r){const t={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:s,indexData:o}=await B(e.meshType,e.simulationSettings,t,r.signal);return{result:{vertexBuffer:s.buffer,indexBuffer:o.buffer},transferList:[s.buffer,o.buffer]}}async getProjectionOffsetGrid(r){const s=e.fromJSON(r.projectedExtent),o=e.fromJSON(r.srcBufferExtent);let i=null;r.datumTransformationSteps?.length&&(i=new t({steps:r.datumTransformationSteps})),await x();const n=r.rasterTransform?y(r.rasterTransform):null;return S({...r,projectedExtent:s,srcBufferExtent:o,datumTransformation:i,rasterTransform:n})}}export{P as default};
5
+ import e from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import t from"../../geometry/operators/support/GeographicTransformation.js";import s from"./PixelBlock.js";import{decode as o}from"./rasterFormats/RasterCodec.js";import{transformPixels as i}from"./rasterFunctions/pixelTransformUtils.js";import{convertPixelBlockToFeatures as n,compositeBands as l,highlightPixels as a,split as m,clipTile as c,mosaic as f,approximateTransform as p,getLocalArithmeticNorthRotations as u}from"./rasterFunctions/pixelUtils.js";import{create as x}from"./rasterFunctions/rasterFunctionHelper.js";import{load as S,getProjectionOffsetGrid as d}from"./rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as h,estimateStatisticsHistograms as k}from"./rasterFunctions/stretchUtils.js";import{convertVectorFieldData as y,convertToLocalDirections as O}from"./rasterFunctions/vectorFieldUtils.js";import{readTransform as g}from"./rasterTransforms/utils.js";import B from"../../renderers/support/RasterSymbolizer.js";import{createFlowMesh as P}from"../../views/2d/engine/flow/dataUtils.js";function N(e){if(!e)return{result:null,transferList:[]};const{pixelBlock:r,transferList:t}=e.getTransferableObject();return{result:r,transferList:t}}class J{convertVectorFieldData(e){const r=s.fromJSON(e.pixelBlock),t=N(y(r,e.type));return Promise.resolve(t)}convertPixelBlockToFeatures(r){const t=n({pixelBlock:s.fromJSON(r.pixelBlock),extent:e.fromJSON(r.extent),fieldNames:r.fieldNames,skipFactor:r.skipFactor,skipSpatialReference:!0,pixelIdOffset:r.pixelIdOffset,imageRowSize:r.imageRowSize});return Promise.resolve(t)}transformPixels(e){const r=s.fromJSON(e.pixelBlock),t=i(r,e.transformType,e.transformParameters);return Promise.resolve(N(t))}computeStatisticsHistograms(e){const r=s.fromJSON(e.pixelBlock),t=h(r,{histogramSize:e.histogramSize,includeSkewnessKurtosis:e.includeSkewnessKurtosis});return Promise.resolve(t)}compositeBands(e){const r=e.pixelBlocks.map(e=>e&&s.fromJSON(e)),t=N(l(r));return Promise.resolve(t)}async decode(e){return N(await o(e.data,e.options))}symbolize(r){const t=r.pixelBlock?s.fromJSON(r.pixelBlock):null,o=r.extent?e.fromJSON(r.extent):null,i=N(this.symbolizer.symbolize({...r,pixelBlock:t,extent:o}));return Promise.resolve(i)}highlightPixels(e){const r=s.fromJSON(e.pixelBlock),t=s.fromJSON(e.renderedPixelBlock);return a(r,t,e.highlightOptions),Promise.resolve(t.toJSON())}async updateSymbolizer(e){this.symbolizer=B.fromJSON(e.symbolizerJSON),e.histograms&&"rasterStretch"===this.symbolizer?.rendererJSON.type&&(this.symbolizer.rendererJSON.histograms=e.histograms)}async updateRasterFunction(e){this.rasterFunction=x(e.rasterFunctionJSON)}async process(t){return N(this.rasterFunction.process({extent:e.fromJSON(t.extent),primaryPixelBlocks:t.primaryPixelBlocks.map(e=>null!=e?s.fromJSON(e):null),primaryPixelSizes:t.primaryPixelSizes?.map(e=>null!=e?r.fromJSON(e):null),primaryRasterIds:t.primaryRasterIds}))}stretch(e){const r=N(this.symbolizer.simpleStretch(s.fromJSON(e.srcPixelBlock),e.stretchParams));return Promise.resolve(r)}estimateStatisticsHistograms(e){const r=k(s.fromJSON(e.srcPixelBlock));return Promise.resolve(r)}split(e){const r=m(s.fromJSON(e.srcPixelBlock),e.tileSize,e.maximumPyramidLevel??0,!1===e.useBilinear),t=[];let o;return r&&(o=new Map,r.forEach((e,r)=>{if(e){const{pixelBlock:s,transferList:i}=e.getTransferableObject();o.set(r,s),i.forEach(e=>{t.includes(e)||t.push(e)})}})),Promise.resolve({result:o,transferList:t})}clipTile(e){const r=s.fromJSON(e.pixelBlock),t=N(c({...e,pixelBlock:r}));return Promise.resolve(t)}async mosaicAndTransform(e){const r=e.srcPixelBlocks.map(e=>e?new s(e):null),t=f(r,e.srcMosaicSize,{blockWidths:e.blockWidths,alignmentInfo:e.alignmentInfo,clipOffset:e.clipOffset,clipSize:e.clipSize});let o,i=t;e.coefs&&(i=p(t,e.destDimension,e.coefs,e.sampleSpacing,e.interpolation)),e.projectDirections&&e.gcsGrid&&(o=u(e.destDimension,e.gcsGrid),i=O(i,e.isUV?"vector-uv":"vector-magdir",o));const{result:n,transferList:l}=N(i);return{result:{pixelBlock:n,localNorthDirections:o},transferList:l}}async createFlowMesh(e,r){const t={data:new Float32Array(e.flowData.buffer),mask:new Uint8Array(e.flowData.maskBuffer),width:e.flowData.width,height:e.flowData.height},{vertexData:s,indexData:o}=await P(e.meshType,e.simulationSettings,t,r.signal);return{result:{vertexBuffer:s.buffer,indexBuffer:o.buffer},transferList:[s.buffer,o.buffer]}}async getProjectionOffsetGrid(r){const s=e.fromJSON(r.projectedExtent),o=e.fromJSON(r.srcBufferExtent);let i=null;r.datumTransformationSteps?.length&&(i=new t({steps:r.datumTransformationSteps})),await S();const n=r.rasterTransform?g(r.rasterTransform):null;return d({...r,projectedExtent:s,srcBufferExtent:o,datumTransformation:i,rasterTransform:n})}}export{J 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 a from"../Field.js";import r from"../PixelBlock.js";import{getByteCount as o}from"../rasterFormats/pixelRangeUtils.js";import{snapToRaster as s,clip as l}from"../rasterFunctions/clipUtils.js";import{transformPixels as c}from"../rasterFunctions/pixelTransformUtils.js";import{mapPixelValueToAttribute as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,mosaic as x,countCategoricalPixels as h}from"../rasterFunctions/pixelUtils.js";import{load as d,projectPolygon as y}from"../rasterFunctions/rasterProjectionHelper.js";import{computeBoxStatistics as w,computeStatisticsHistograms as g}from"../rasterFunctions/stretchUtils.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const B=2**30,S=2048,P=2**20,j=20,I=100;async function R(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function F(e){const t=[new a({name:u,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new a({name:e,alias:e,type:n}))}),t.map(e=>e.toJSON())}async function T(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<j){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/I;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=y(t,i)}return t}async function v(e,t,i=!1){const{spatialReference:a}=e,r=t?.geometry,o=await T(r??e.extent,a),l="extent"===o.type?o:o.extent,c=null==r||"extent"===r.type&&r.spatialReference.equals(a)?void 0:o,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:a}),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 d=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*h>g&&(!i||Math.max(x,h)>1024);)y*=d,w*=d,x/=d,h/=d;return x=Math.round(x),h=Math.round(h),{extent:m,clipGeometry:c,width:x,height:h,pixelSize:new n({x:y,y:w,spatialReference:a})}}async function*z(e,n,a=!1,r){const{extent:o,clipGeometry:s,width:c,height:p}=n,u=o.width/c,f=o.height/p,m=Math.ceil(c/S),x=Math.ceil(p/S),h=u*S,d=f*S,{xmin:y,xmax:w,ymin:g,ymax:k}=o,b=x*m,B={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let P=0;P<x;P++)for(let n=0;n<m;n++){t(B);const r=new i({xmin:y+n*h,xmax:a?Math.min(w,y+(n+1)*h):y+(n+1)*h,ymax:k-P*d,ymin:a?Math.max(g,k-(P+1)*d):k-(P+1)*d,spatialReference:o.spatialReference}),c={row:P,col:n},p=P*m+n+1;if(s&&!r.intersects(s)){yield{extent:r,pixelBlock:null,id:c,total:b,current:p};continue}const x=a?Math.round(r.width/u):S,j=a?Math.round(r.height/f):S;let{pixelBlock:I}=await e.fetchPixels(r,x,j,B).catch(()=>({pixelBlock:void 0}));I&&s&&(I=await l(I,r,s)),yield{extent:r,pixelBlock:I,id:c,total:b,current:p}}}async function*M(e,i,n){const a=await R(e,n),r=F(a),o={...i,geometry:i?.geometry??a.extent},s=z(e,await v(a,o),!0,n),l=a.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const o=V(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await K({pixelBlock:s,rasterJobHandler:o},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*a.width*S+c.id.col*S;t(n),f.featureSet=await _({pixelBlock:s,extent:c.extent,fields:r,skipFactor:i?.skipFactor??1,rasterJobHandler:o,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>B)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 C(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const a=await R(t),r=await v(a,i,!0);H(r,a.pixelType);const{extent:o,pixelSize:s}=r,l=Math.round(a.extent.width/s.x),c=F(a),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<=S||r.height<=S,d=z(t,r,1===x||h,n);for await(const e of d){if(!e.pixelBlock)continue;const i=V(t),r=Math.floor((a.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-a.extent.xmin)/s.x),o=await _({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:r,imageRowSize:l},n);if(o?.features?.length){const{features:e}=o,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 a=0,r=0;a<e-1;a++){r+=t;const e=Math.round(r);e<n&&u.push(i[e])}}}return{extent:o,featureSet:p,pixelSize:s}}async function O(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return J(e,n,i);if("polyline"===n.type)return U(e,n,i);const a=await $(e,{geometry:n},i);if(!a)return null;return w(a)}async function J(e,t,i){const n=await R(e,i),a=t.points.map((e,i)=>t.getPoint(i)).map(t=>q(e,t,i)),o=(await Promise.all(a)).filter(e=>null!=e);if(o.length<=1)return N(o[0]);const s=o[0].map((e,t)=>o.map(e=>e[t]));return w(new r({pixels:s,pixelType:n.pixelType}))}async function q(e,t,i){if("imagery"===e.type){const n=await e.identify(new b({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 N(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function U(e,t,i){const n=await D(e,{geometry:t},i),a=await R(e,i),{bandCount:o,pixelType:s}=a,l=new Array(o).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<o;t++)l[t][r]=e.value[t]}}c!==n.length&&l.forEach((e,t)=>{l[t]=e.subarray(0,c)});return w(new r({pixels:l,pixelType:s}))}async function A(t,i,n){const a=await R(t,n);if(!a.attributeTable||!a.pixelType.startsWith("u"))return null;const r=a.attributeTable.clone(),o=r.fields.find(e=>"value"===e.name.toLowerCase()),s=r.fields.find(e=>"count"===e.name.toLowerCase());if(!o||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(a.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p}=i;return await L(t,p,(e,t)=>h(e,c),n),r.features.forEach(e=>{const t=e.attributes[o.name];e.attributes[s.name]=c[t]}),r}async function E(e,t,i){const{geometry:n}=t;if("point"===n.type)return q(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>q(e,t,i)),a=(await Promise.all(t)).filter(e=>null!=e);if(0===a.length)return null;return G(a).map(e=>e/a.length)}const a=await L(e,n,(e,t)=>W(e),i),r=a?.filter(e=>e.count>0);if(!r?.length)return null;const o=G(r.map(e=>e.bandSum)),s=r.map(e=>e.count).reduce((e,t)=>e+t);return o.map(e=>e/s)}function G(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function W(e){const{width:t,height:i,pixels:n,mask:a}=e,r=new Array(n.length).fill(0);let o=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!a||a[i]){for(let e=0;e<n.length;e++)r[e]+=n[e][i];o++}}return{bandSum:r,count:o}}async function D(e,t,i){const n=await L(e,t.geometry,m,i);return n?.flat()??[]}async function L(i,n,a,r){const o=i.spatialReference;if("polyline"===n.type&&!n.spatialReference.equals(o)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(n,o);if(null==t)throw new e("read-pixels","failed to fetch pixels");n=t}const s="polyline"===n.type?n.extent:n,c=await T(s,o),p="polyline"===n.type?n:c,u=await R(i,r),f={geometry:c,autoResample:!1},m=[],x=z(i,await v(u,f),!0,r);for await(const e of x){if(!e.pixelBlock)continue;const{extent:i}=e,n=a(await l(e.pixelBlock,i,p),i);m.push(n),t(r)}return m}async function K(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:a,histograms:r}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):g(n);return{statistics:a,histograms:r}}async function _(e,t){const{extent:i,fields:n,skipFactor:a,rasterJobHandler:r,pixelIdOffset:o,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=r?await r.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:a,pixelIdOffset:o,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:a,pixelIdOffset:o,imageRowSize:s});return p?{fields:n,features:p}:void 0}function V(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 a=await v(n,t);a.bandIds=t.bandIds?.length?t.bandIds:void 0,H(a,n.pixelType,t.maxPixelCount);const{width:r,height:o}=a;if(r<=S&&o<=S){const t=a.bandIds?.length?a.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(a.extent,r,o,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=z(e,a,!1,i);for await(const x of l)s.push(x.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(r/S),p=Math.ceil(o/S),u={width:c*S,height:p*S};let f;const m=V(e);if(m){const e=await m.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:u,destDimension:u},{...i,transferPixelsToWorker:!0});f=e?.pixelBlock}else f=x(s,u);return f}async function Q(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");let a=await $(t,i,n);if(!a)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:r}=i;if(r&&"value"!==r.toLowerCase()){const e=await R(t,n);a=p(a,e,r)}const o=V(t),{transformType:s}=i;if(s){const e={lambda:i.lambda,shift:i.shift};a=o?await o.transformPixels({pixelBlock:a,transformType:s,transformParameters:e},{...n,transferPixelsToWorker:!0}):c(a,s,e)}const l=i.histogramSize??void 0;return o?await o.computeStatisticsHistograms({pixelBlock:a,histogramSize:l,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):g(a,{histogramSize:l,includeSkewnessKurtosis:!0})}export{O as computeBoxStatistics,A as computeRasterAttributeTable,Q as computeStatisticsHistograms,M as createPixelFeatureSetCursor,C as fetchPixelFeatureSet,E as identifyAveragePixelValue,D as readIntersectingPixels};
@@ -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"../../../core/has.js";import t from"../PixelBlock.js";import{getPixelValueRange as e}from"../rasterFormats/pixelRangeUtils.js";import{matchAnyMask as n}from"./pixelUtils.js";function r(e,n,r){const a=e.length,s=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(n[t]){const r=e[t];r<=0?n[t]=0:s[t]=Math.log(r)}return s}function a(n,r,a,s){const i=n.length,o=t.createEmptyBand(a,i),[l,c]=e(a),m=s?.lambda??0,f=s?.shift??0,h=0===m;for(let t=0;t<i;t++)if(r[t]){const e=n[t];if(e<=0)r[t]=0;else if(h)o[t]=Math.log(e+f);else{const n=((e+f)**m-1)/m;o[t]=Math.max(l,Math.min(n,c))}}return o}function s(e,n,r){const a=e.length,s=t.createEmptyBand(r,a);for(let t=0;t<a;t++)if(n[t]){const r=e[t];r<0?n[t]=0:s[t]=Math.sqrt(r)}return s}function i(n,r,a){const s=n.length,i=t.createEmptyBand(a,s),[o,l]=e(a);for(let t=0;t<s;t++)if(!r||r[t]){const e=1/n[t];i[t]=i[t]=Math.max(o,Math.min(e,l))}return i}function o(e,o,l){const{width:c,height:m,pixels:f}=e;let h=[];h=e.bandMasks?e.bandMasks.map(t=>new Uint8Array(t)):f.map(()=>e.mask?new Uint8Array(e.mask):new Uint8Array(c*m).fill(255));const p="f32",u=f.map((t,e)=>{switch(o){case"log":return r(t,h[e],p);case"sqrt":return s(t,h[e],p);case"inverse":return i(t,h[e],p);case"box-cox":return a(t,h[e],p,l);default:return t}}),d="inverse"===o,g=d?e.mask:1===h.length?h[0]:n(h),x=d?e.bandMasks:1===h.length?void 0:h;return new t({width:c,height:m,pixelType:p,bandMasks:x,mask:g,pixels:u})}export{o as transformPixels};
@@ -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{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function s(t,e){return e?.length&&o(t)?t.extractBands(e):t}function r(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:s}=n[0];if(n.some(t=>t.width!==l||t.height!==i))return null;const r=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;r.length&&(a=new Uint8Array(l*i),a.set(r[0]),r.length>1&&w(r.slice(1),a));const h=[];n.forEach(({pixels:t})=>h.push(...t));const f=null!=a&&h.length===n.length?n.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=n.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new e({pixelType:s,width:l,height:i,mask:a,bandMasks:f,pixels:h,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),s=[],r=5===n[0].length;if(i>65536)return n.forEach(t=>{s[t[0]-l]=r?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:s,offset:l,alphaSpecified:r};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,s=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=r?t[4]:255,e===t[0]-l&&(t=s===n.length-1?t:n[++s])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=r?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:r}}function h(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const s=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:r,indexed2DColormap:a,offset:h,alphaSpecified:f}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,d=0;if(r){const t=r.length-1;if(null!=i)for(let e=0;e<s;e++)i[e]&&(d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],i[e]=r[d+3]));else{i=new Uint8Array(s);for(let e=0;e<s;e++)d=4*(c[e]-h),d<h||d>t?i[e]=0:(u[e]=r[d],p[e]=r[d+1],x[e]=r[d+2],i[e]=r[d+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<s;o++)i[o]&&(m=a[c[o]],u[o]=m[0],p[o]=m[1],x[o]=m[2],i[o]=m[3]);else{i=new Uint8Array(s);for(let t=0;t<s;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],i[t]=m[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=f,n}function f(t,n){if(!o(t))return null;const{pixels:l,mask:i}=t,s=l.length;let r=n.lut;const{offset:a}=n;r&&1===r[0].length&&(r=l.map(()=>r));const h=[],f=n.outputPixelType||"u8";for(let e=0;e<s;e++){const t=c(l[e],i,r[e],a||0,f);h.push(t)}const u=new e({width:t.width,height:t.height,pixels:h,mask:i,pixelType:f});return u.updateStatistics(),u}function c(t,n,l,i,o){const s=t.length,r=e.createEmptyBand(o,s);if(n)for(let e=0;e<s;e++)n[e]&&(r[e]=l[t[e]-i]);else for(let e=0;e<s;e++)r[e]=l[t[e]-i];return r}function u(t,e,n){if(!o(t))return;const{width:l,height:i,pixels:s,mask:r}=t,a=l*i,h=new Uint8Array(a);for(let o=1;o<=n.length;o++){const{bandId:t,ranges:e}=n[o-1],l=s[t];if(!l)continue;const i=1===e.length,[f,c]=e[0];for(let n=0;n<a;n++)if(!r||r[n]){const t=l[n];if(i)t>=f&&t<=c&&(h[n]=o);else for(let l=0;l<e.length;l++){const[i,s]=e[l];if(t>=i&&t<=s){h[n]=o;break}}}}const{pixels:f}=e;1===f.length&&(f[1]=f[0].slice(),f[2]=f[0].slice());const c=n.map(t=>t.color);if(e.mask){const t=e.mask;for(let e=0;e<a;e++)if(t[e]){t[e]=255;const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++){const n=h[e];if(n){const l=c[n-1];f[0][e]=l[0],f[1][e]=l[1],f[2][e]=l[2],t[e]=l[3]}}e.mask=t}e.maskIsAlpha=!0}function p(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,s=e.length,r=Math.floor(s/2),a=e[Math.floor(r)],h=l[0],f=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=h[o];let n=!1,l=r,i=a,x=0,m=s-1;for(;m-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:m=l,l=Math.floor((x+m)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[m].value?(i=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(i=e[x],n=!0):m===s-1?n=!1:(i=e[m],n=!0))),n?(f[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):f[o]=c[o]=u[o]=p[o]=0}return n.pixels=[f,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function x(e,n,i=!1){const o=1e-5,s=new Float32Array(3*l),r=n.length;for(let a=0;a<l;a++)s[3*a]=e[2*a]??t-1,s[3*a+1]=e[2*a+1]??t,s[3*a+2]=n[a]??0,a<r&&(a>0&&(s[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<r-1||!i)&&(s[3*a+1]-=o));return s}function m(t,l){if(!o(t))return null;const{width:i,height:s}=t,{inputRanges:r,outputValues:a,outputPixelType:h,noDataRanges:f,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(h,x.length),d=t.mask,g=new Uint8Array(i*s);d?g.set(d):g.fill(255);const w=t.pixelType.startsWith("f")?1e-6:0,y=r.map(t=>t-w);y[0]=r[0],y[y.length-1]=r[r.length-1]+(p?1e-6:0);const k=r.length/2,[M,A]=n(h);for(let e=0;e<s;e++)for(let t=0;t<i;t++){const n=e*i+t;if(g[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===r[2*l]||t>y[2*l]&&t<y[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:g[n]=0)}}const U=f?.length;if(U)for(let e=0;e<s;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!d||d[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=f[e]&&t<=f[e+1]){m[n]=0,g[n]=0;break}}}return new e({width:i,height:s,pixelType:h,pixels:[m],mask:g})}function d(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,s=!!e?.length;for(let r=0;r<t.length;r++)if(l[r]){const n=t[r];if(s){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[r]=0)}l[r]&&(n===o||i?.has(n))&&(l[r]=0)}}function g(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}}function w(t,e){const n=t[0].length;for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}}function y(t,n){if(!o(t))return null;const{width:l,height:i,pixels:s}=t,r=l*i,a=new Uint8Array(r);t.mask?a.set(t.mask):a.fill(255);const h=s.length,{includedRanges:f,noDataValues:u,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<h;e++){const n=m[e],l=c(s[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?g(t,a):w(t,a)}else if(x){const t=[];for(let e=0;e<h;e++){const n=new Uint8Array(r);n.set(a),d(s[e],f?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):g(t,a)}else for(let e=0;e<h;e++)d(s[e],f?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:s,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:s,noDataRanges:r,isLastInputRangeInclusive:a,outputPixelType:h}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const f=l.includes("16")?65536:256,c=l.includes("s")?-f/2:0,u=e.createEmptyBand(h,f),p=new Uint8Array(f);s&&p.fill(255);const[x,m]=n(h);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),s=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=s;e++)u[e]=t,p[e]=255}}if(r?.length)for(let e=0;e<r.length;e++){const t=Math.ceil(r[2*e]-c),n=Math.floor(r[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let s=0;s<e.length;s++){const t=Math.ceil(e[2*s]-i),n=Math.floor(e[2*s+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let s=0;s<n.length;s++)o[n[s]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,s,r){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+s<=n*t?0:i+s<n*t+t?i+s-n*t:t,ymax:o+r<=l*e?0:o+r<l*e+e?o+r-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),s=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),r=Math.min.apply(null,s.map(t=>t.extent.xmin)),a=Math.min.apply(null,s.map(t=>t.extent.ymin)),h=Math.max.apply(null,s.map(t=>t.extent.xmax)),f=Math.max.apply(null,s.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-r)/l),y:Math.round((f-e.ymax)/i)},u={width:Math.round((h-r)/l),height:Math.round((f-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==s.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(s.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:s,height:r}=n.block,{x:a,y:h}=n.offset,{width:f,height:c}=n.mosaic,u=A(s,r,l,i,a,h,f,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=s*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p,o=m*s;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*r+m-h)*f+(l*s-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:s,alignmentInfo:r,blockWidths:a}=l;if(a)return S(t,n,{blockWidths:a});const h=t.find(t=>o(t));if(null==h)return null;const f=s?s.width:n.width,c=s?s.height:n.height,u=h.width,p=h.height,x=n.width/u,m=n.height/p,d={offset:i||{x:0,y:0},mosaic:s||n,block:{width:u,height:p}},g=h.pixelType,w=e.getPixelArrayConstructor(g),y=h.pixels.length,k=[];let M,A;for(let e=0;e<y;e++){A=new w(f*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];o(i)&&(M=i.pixels[e],b(A,M,d,l,n,r))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),T=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=U?new Uint8Array(f*c):void 0,B=T?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(v,null!=i?i:l?255:0,d,n,e,r)}if(B)for(let e=0;e<y;e++){const n=new Uint8Array(f*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],s=o?.bandMasks?.[e]??o?.mask;b(n,null!=s?s:o?255:0,d,i,l,r)}B.push(n)}}const C=new e({width:f,height:c,pixels:k,pixelType:g,bandMasks:B,mask:v});return C.updateStatistics(),C}function S(t,n,l){const i=t.find(t=>null!=t);if(null==i)return null;const s=t.some(t=>null==t||!!t.mask),{width:r,height:a}=n,h=s?new Uint8Array(r*a):null,{blockWidths:f}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(s)for(let e=0,w=0;e<t.length;w+=f[e],e++){const n=t[e];if(!o(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<f[e];i++)h[t*r+i+w]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,d=r*a;for(let e=0;e<u;e++){const n=new p(d),l=x?new Uint8Array(d):void 0;for(let i=0,s=0;i<t.length;s+=f[i],i++){const h=t[i];if(!o(h))continue;const c=h.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<f[i];e++)n[t*r+e+s]=c[t*h.width+e];if(l){const t=h.bandMasks?.[e]??h.mask;for(let e=0;e<a;e++)for(let n=0;n<f[i];n++)l[e*r+n+s]=t?t[e*h.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const g=new e({width:r,height:a,mask:h,bandMasks:m,pixels:c,pixelType:i.pixelType});return g.updateStatistics(),g}function v(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,s=e.x,r=e.y,a=n.width+s,h=n.height+r;if(s<0||r<0||a>l||h>i)return t;if(0===s&&0===r&&a===l&&h===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const f=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)f[t+e]=o<r||o>=h||e<s||e>=a?0:1}return t.updateStatistics(),t}function B(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,s=i[0],r=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;R(t,s[i],a?a[i]:1)}r[o*n]=C(t),r[o*n+1]=r[o*n+2]=r[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;R(t,s[l],a?a[l]:1),l=(o-1)*n+e+1,R(t,s[l],a?a[l]:1),l=o*n+e+1,R(t,s[l],a?a[l]:1),l=(o+1)*n+e+1,R(t,s[l],a?a[l]:1),l=(o-2)*n+e-3,P(t,s[l],a?a[l]:1),l=(o-1)*n+e-3,P(t,s[l],a?a[l]:1),l=o*n+e-3,P(t,s[l],a?a[l]:1),l=(o+1)*n+e-3,P(t,s[l],a?a[l]:1),r[o*n+e]=C(t)}r[o*n+e+1]=r[o*n+e]}for(let o=0;o<n;o++)r[o]=r[n+o]=r[2*n+o],r[(l-1)*n+o]=r[(l-2)*n+o];return e.updateStatistics(),e}function C(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function P(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function R(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function I(t,n,l){let{x:i,y:s}=n;const{width:r,height:a}=l;if(0===i&&0===s&&a===t.height&&r===t.width)return t;const{width:h,height:f}=t,c=Math.max(0,s),u=Math.max(0,i),p=Math.min(i+r,h),x=Math.min(s+a,f);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),s=Math.max(0,-s);const{pixels:m}=t,d=r*a,g=m.length,w=[];for(let o=0;o<g;o++){const n=m[o],l=e.createEmptyBand(t.pixelType,d);for(let t=c;t<x;t++){const e=t*h;let o=(t+s-c)*r+i;for(let t=u;t<p;t++)l[o++]=n[e+t]}w.push(l)}const y=new Uint8Array(d),k=t.mask;for(let e=c;e<x;e++){const t=e*h;let n=(e+s-c)*r+i;for(let e=u;e<p;e++)y[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:w,mask:y});return M.updateStatistics(),M}function _(t,n=!0){if(!o(t))return null;const{pixels:l,width:i,height:s,mask:r,pixelType:a}=t,h=[],f=Math.round(i/2),c=Math.round(s/2),u=s-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],r=e.createEmptyBand(a,f*c);let x=0;for(let e=0;e<s;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],s=e===u?o:t[e*i+l+i],a=l===p?s:e===u?n:t[e*i+l+i+1];r[x++]=(o+n+s+a)/4}else r[x++]=o}h.push(r)}let x=null;if(null!=r){x=new Uint8Array(f*c);let t=0;for(let e=0;e<s;e+=2)for(let l=0;l<i;l+=2){const o=r[e*i+l];if(n){const n=l===p?o:r[e*i+l+1],s=e===u?o:r[e*i+l+i],a=l===p?s:e===u?n:r[e*i+l+i+1];x[t++]=o*n*s*a?1:0}else x[t++]=o}}return new e({width:f,height:c,pixelType:a,pixels:h,mask:x})}function W(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:s}=e;let{width:r,height:a}=t;const h=new Map,f={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(r/i),n=Math.ceil(a/s);for(let l=0;l<n;l++){f.y=l*s;for(let n=0;n<t;n++){f.x=n*i;const t=I(u,f,e);h.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=_(u,l)),r=Math.round(r/2),a=Math.round(a/2)}return h}function E(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:s,useBilinear:r}=t;if(!o(e))return null;const{width:a,height:h}=n,f=2**l,c=f*a,u=f*h;let p=I(e,{y:i*u,x:s*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=_(p,r);return p}function F(t,e,n,l,i=0){const{width:o,height:s}=t,{width:r,height:a}=e,h=l.cols,f=l.rows,c=Math.ceil(r/h-.1/h),u=Math.ceil(a/f-.1/f);let p,x,m,d,g,w,y;const k=c*h,M=k*u*f,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,B=0;for(let C=0;C<u;C++)for(let t=0;t<c;t++){p=12*(C*c+t),x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],w=n[p+4],y=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=0;t<e;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+w*v+y)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}p+=6,x=n[p],m=n[p+1],d=n[p+2],g=n[p+3],w=n[p+4],y=n[p+5];for(let e=0;e<f;e++){B=(C*f+e)*k+t*h,v=(e+.5)/f;for(let t=e;t<h;t++)S=(t+.5)/h,A[B+t]=(x*S+m*v+d)*o+i,U[B+t]=(g*S+w*v+y)*s+i,b[B+t]=Math.floor(A[B+t]),T[B+t]=Math.floor(U[B+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function D(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:s}=F(t,t,n,{rows:l[0],cols:l[1]}),{width:r,height:a}=t,h=new Float32Array(r*a),f=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<r;t++){const e=c*s+t,n=0===c?e:e-s,l=c===a-1?e:e+s,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))h[c*r+t]=90;else{let e=Math.atan2(p,u)*f;e=(360+e)%360,h[c*r+t]=e}}return h}function N(t,n,l,i,s="nearest"){if(!o(t))return null;"majority"===s&&(t=B(t));const{pixels:r,mask:a,bandMasks:h,pixelType:f}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(f),x=r.length,{width:m,height:d}=n;let g=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(g=!0);const{offsets_x:w,offsets_y:y,offsets_xi:k,offsets_yi:M,gridWidth:A}=F({width:c,height:u},n,l,i,"majority"===s?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<d;o++){U=o*A;for(let s=0;s<m;s++){if(w[U]<0||y[U]<0)t[o*m+s]=0;else if(l)t[o*m+s]=e[k[U]+M[U]*c];else{const l=Math.floor(w[U]),r=Math.floor(y[U]),a=Math.ceil(w[U]),h=Math.ceil(y[U]),f=w[U]-l,u=y[U]-r;if(!n||n[l+r*c]&&n[a+r*c]&&n[l+h*c]&&n[a+h*c]){const n=(1-f)*e[l+r*c]+f*e[a+r*c],p=(1-f)*e[l+h*c]+f*e[a+h*c];t[o*m+s]=(1-u)*n+u*p+i}else t[o*m+s]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const v=h?.length===x,C=[];for(let e=0;e<x;e++){if(v){const t=new Uint8Array(m*d);b(t,h[e],h[e],!0),C.push(t)}S=new p(m*d),b(S,r[e],v?h[e]:a,"nearest"===s||"majority"===s),T.push(S)}const P=new e({width:m,height:d,pixelType:f,pixels:T,bandMasks:v?C:void 0});if(null!=a)P.mask=new Uint8Array(m*d),b(P.mask,a,a,!0);else if(g){P.mask=new Uint8Array(m*d);for(let t=0;t<m*d;t++)P.mask[t]=w[t]<0||y[t]<0?0:1}return P.updateStatistics(),P}function j(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:s=!1,pixelIdOffset:r=0}=t,a=[],{width:h,height:f,pixels:c,mask:u}=e,p=t.imageRowSize??h,x=n.width/h,m=n.height/f,d=c.length,g=Math.floor(o/2),{xmin:w,ymax:y}=n,k=s?void 0:n.spatialReference.toJSON();for(let M=g;M<f;M+=o)for(let t=g;t<h;t+=o){const e=M*h+t;if(!u||u[e]){const n={x:w+(t+.5)*x,y:y-(M+.5)*m,spatialReference:k},o={[i]:r+M*p+t};for(let t=0;t<d;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=i[0];let r=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[s[t]]++,r++)}return r}function O(t,e){const{width:n,height:l,pixels:i,mask:o}=t,s=e.width/n,r=e.height/l,{xmin:a,ymax:h}=e,f=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*s,y:h-(u+.5)*r,spatialReference:f},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}export{N as approximateTransform,I as clip,E as clipTile,h as colorize,r as compositeBands,j as convertPixelBlockToFeatures,z as countCategoricalPixels,a as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,s as extractBands,A as getClipBounds,D as getLocalArithmeticNorthRotations,O as getValidPixels,u as highlightPixels,F as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,f as lookupPixels,y as mask,l as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,i as pixelIdFieldName,m as remap,p as remapColor,B as resampleByMajority,v as setValidBoundary,W as split};
5
+ import{numberMaxFloat32 as t}from"../../../core/mathUtils.js";import e from"../PixelBlock.js";import{getPixelValueRange as n}from"../rasterFormats/pixelRangeUtils.js";const l=9,i="PixelID";function o(t){return null!=t&&t.pixels?.length>0}function r(t,e){return e?.length&&o(t)?t.extractBands(e):t}function s(t){if(!t?.length||t.some(t=>!o(t)))return null;if(1===t.length)return t[0]?.clone()??null;const n=t,{width:l,height:i,pixelType:r}=n[0];if(n.some(t=>t.width!==l||t.height!==i))return null;const s=n.map(({mask:t})=>t).filter(t=>null!=t);let a=null;s.length&&(a=new Uint8Array(l*i),a.set(s[0]),s.length>1&&y(s.slice(1),a));const f=[];n.forEach(({pixels:t})=>f.push(...t));const h=null!=a&&f.length===n.length?n.map(({width:t,height:e,mask:n})=>n??new Uint8Array(t*e).fill(255)):null,c=n.map(({statistics:t})=>t).filter(t=>t?.length),u=[];return c.forEach(t=>u.push(...t)),new e({pixelType:r,width:l,height:i,mask:a,bandMasks:h,pixels:f,statistics:u.length?u:null})}function a(t){if(!t)return;const e=t.colormap;if(!e||0===e.length)return;const n=e.sort((t,e)=>t[0]-e[0]),l=n[0][0]<0?n[0][0]:0,i=Math.max(256,n[n.length-1][0]-l+1),o=new Uint8Array(4*i),r=[],s=5===n[0].length;if(i>65536)return n.forEach(t=>{r[t[0]-l]=s?t.slice(1):t.slice(1).concat([255])}),{indexed2DColormap:r,offset:l,alphaSpecified:s};if(t.fillUnspecified){let t=n[0];for(let e=t[0]-l,r=0;e<i;e++)o[4*e]=t[1],o[4*e+1]=t[2],o[4*e+2]=t[3],o[4*e+3]=s?t[4]:255,e===t[0]-l&&(t=r===n.length-1?t:n[++r])}else for(let a=0;a<n.length;a++){const t=n[a],e=4*(t[0]-l);o[e]=t[1],o[e+1]=t[2],o[e+2]=t[3],o[e+3]=s?t[4]:255}return{indexedColormap:o,offset:l,alphaSpecified:s}}function f(t,e){if(!o(t))return t;if(!e||!e.indexedColormap&&!e.indexed2DColormap)return t;const n=t.clone(),l=n.pixels;let i=n.mask;const r=n.width*n.height;if(1!==l.length)return t;const{indexedColormap:s,indexed2DColormap:a,offset:f,alphaSpecified:h}=e,c=l[0],u=new Uint8Array(c.length),p=new Uint8Array(c.length),x=new Uint8Array(c.length);let m,g=0;if(s){const t=s.length-1;if(null!=i)for(let e=0;e<r;e++)i[e]&&(g=4*(c[e]-f),g<f||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],x[e]=s[g+2],i[e]=s[g+3]));else{i=new Uint8Array(r);for(let e=0;e<r;e++)g=4*(c[e]-f),g<f||g>t?i[e]=0:(u[e]=s[g],p[e]=s[g+1],x[e]=s[g+2],i[e]=s[g+3]);n.mask=i}}else if(a)if(null!=i)for(let o=0;o<r;o++)i[o]&&(m=a[c[o]],u[o]=m[0],p[o]=m[1],x[o]=m[2],i[o]=m[3]);else{i=new Uint8Array(r);for(let t=0;t<r;t++)m=a[c[t]],u[t]=m[0],p[t]=m[1],x[t]=m[2],i[t]=m[3];n.mask=i}return n.pixels=[u,p,x],n.statistics=null,n.pixelType="u8",n.maskIsAlpha=h,n}function h(t,n){if(!o(t))return null;const{pixels:l,mask:i}=t,r=l.length;let s=n.lut;const{offset:a}=n;s&&1===s[0].length&&(s=l.map(()=>s));const f=[],h=n.outputPixelType||"u8";for(let e=0;e<r;e++){const t=c(l[e],i,s[e],a||0,h);f.push(t)}const u=new e({width:t.width,height:t.height,pixels:f,mask:i,pixelType:h});return u.updateStatistics(),u}function c(t,n,l,i,o){const r=t.length,s=e.createEmptyBand(o,r);if(n)for(let e=0;e<r;e++)n[e]&&(s[e]=l[t[e]-i]);else for(let e=0;e<r;e++)s[e]=l[t[e]-i];return s}function u(t,e,n){if(!o(t))return;const{width:l,height:i,pixels:r,mask:s}=t,a=l*i,f=new Uint8Array(a);for(let o=1;o<=n.length;o++){const{bandId:t,ranges:e}=n[o-1],l=r[t];if(!l)continue;const i=1===e.length,[h,c]=e[0];for(let n=0;n<a;n++)if(!s||s[n]){const t=l[n];if(i)t>=h&&t<=c&&(f[n]=o);else for(let l=0;l<e.length;l++){const[i,r]=e[l];if(t>=i&&t<=r){f[n]=o;break}}}}const{pixels:h}=e;1===h.length&&(h[1]=h[0].slice(),h[2]=h[0].slice());const c=n.map(t=>t.color);if(e.mask){const t=e.mask;for(let e=0;e<a;e++)if(t[e]){t[e]=255;const n=f[e];if(n){const l=c[n-1];h[0][e]=l[0],h[1][e]=l[1],h[2][e]=l[2],t[e]=l[3]}}}else{const t=new Uint8Array(a).fill(255);for(let e=0;e<a;e++){const n=f[e];if(n){const l=c[n-1];h[0][e]=l[0],h[1][e]=l[1],h[2][e]=l[2],t[e]=l[3]}}e.mask=t}e.maskIsAlpha=!0}function p(t,e){if(!o(t))return null;const n=t.clone(),{pixels:l}=n,i=n.width*n.height,r=e.length,s=Math.floor(r/2),a=e[Math.floor(s)],f=l[0],h=new Uint8Array(i),c=new Uint8Array(i),u=new Uint8Array(i);let p=n.mask;const x=4===e[0].mappedColor.length;p||(p=new Uint8Array(i),p.fill(x?255:1),n.mask=p);for(let o=0;o<i;o++)if(p[o]){const t=f[o];let n=!1,l=s,i=a,x=0,m=r-1;for(;m-x>1;){if(t===i.value){n=!0;break}t>i.value?x=l:m=l,l=Math.floor((x+m)/2),i=e[Math.floor(l)]}n||(t===e[x].value?(i=e[x],n=!0):t===e[m].value?(i=e[m],n=!0):t<e[x].value?n=!1:t>e[x].value&&(t<e[m].value?(i=e[x],n=!0):m===r-1?n=!1:(i=e[m],n=!0))),n?(h[o]=i.mappedColor[0],c[o]=i.mappedColor[1],u[o]=i.mappedColor[2],p[o]=i.mappedColor[3]):h[o]=c[o]=u[o]=p[o]=0}return n.pixels=[h,c,u],n.mask=p,n.pixelType="u8",n.maskIsAlpha=x,n}function x(e,n,i=!1){const o=1e-5,r=new Float32Array(3*l),s=n.length;for(let a=0;a<l;a++)r[3*a]=e[2*a]??t-1,r[3*a+1]=e[2*a+1]??t,r[3*a+2]=n[a]??0,a<s&&(a>0&&(r[3*a]-=o),e[2*a+1]!==e[2*a]&&(a<s-1||!i)&&(r[3*a+1]-=o));return r}function m(t,l){if(!o(t))return null;const{width:i,height:r}=t,{inputRanges:s,outputValues:a,outputPixelType:f,noDataRanges:h,allowUnmatched:c,replacementValue:u,isLastInputRangeInclusive:p}=l,x=t.pixels[0],m=e.createEmptyBand(f,x.length),g=t.mask,d=new Uint8Array(i*r);g?d.set(g):d.fill(255);const y=t.pixelType.startsWith("f")?1e-6:0,w=s.map(t=>t-y);w[0]=s[0],w[w.length-1]=s[s.length-1]+(p?1e-6:0);const k=s.length/2,[M,A]=n(f);for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(d[n]){const t=x[n];let e=!1;for(let l=k-1;l>=0;l--)if(t===s[2*l]||t>w[2*l]&&t<w[2*l+1]){m[n]=a[l],e=!0;break}e||(c?m[n]=t>A?A:t<M?M:u??t:d[n]=0)}}const U=h?.length;if(U)for(let e=0;e<r;e++)for(let t=0;t<i;t++){const n=e*i+t;if(!g||g[n]){const t=x[n];for(let e=0;e<U;e+=2)if(t>=h[e]&&t<=h[e+1]){m[n]=0,d[n]=0;break}}}return new e({width:i,height:r,pixelType:f,pixels:[m],mask:d})}function g(t,e,n,l){const i=null!=n&&n.length>=2?new Set(n):null,o=1===n?.length?n[0]:null,r=!!e?.length;for(let s=0;s<t.length;s++)if(l[s]){const n=t[s];if(r){let t=!1;for(let l=0;l<e.length;l+=2)if(n>=e[l]&&n<=e[l+1]){t=!0;break}t||(l[s]=0)}l[s]&&(n===o||i?.has(n))&&(l[s]=0)}}function d(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(t[e][l]){n=!0;break}n||(e[l]=0)}return e}function y(t,e){const n=t[0].length;e??=new Uint8Array(n).fill(255);for(let l=0;l<n;l++)if(e[l]){let n=!1;for(let e=0;e<t.length;e++)if(0===t[e][l]){n=!0;break}n&&(e[l]=0)}return e}function w(t,n){if(!o(t))return null;const{width:l,height:i,pixels:r}=t,s=l*i,a=new Uint8Array(s);t.mask?a.set(t.mask):a.fill(255);const f=r.length,{includedRanges:h,noDataValues:u,outputPixelType:p,matchAll:x,lookups:m}=n;if(m){const t=[];for(let e=0;e<f;e++){const n=m[e],l=c(r[e],a,n.lut,n.offset||0,"u8");t.push(l)}1===t.length?a.set(t[0]):x?d(t,a):y(t,a)}else if(x){const t=[];for(let e=0;e<f;e++){const n=new Uint8Array(s);n.set(a),g(r[e],h?.slice(2*e,2*e+2),u?.[e],n),t.push(n)}1===t.length?a.set(t[0]):d(t,a)}else for(let e=0;e<f;e++)g(r[e],h?.slice(2*e,2*e+2),u?.[e],a);return new e({width:l,height:i,pixelType:p,pixels:r,mask:a})}function k(t){const{srcPixelType:l,inputRanges:i,outputValues:o,allowUnmatched:r,noDataRanges:s,isLastInputRangeInclusive:a,outputPixelType:f}=t;if("u8"!==l&&"s8"!==l&&"u16"!==l&&"s16"!==l)return null;const h=l.includes("16")?65536:256,c=l.includes("s")?-h/2:0,u=e.createEmptyBand(f,h),p=new Uint8Array(h);r&&p.fill(255);const[x,m]=n(f);if(i?.length&&o?.length){const t=1e-6,e=i.map(e=>e-t);e[0]=i[0],a&&(e[e.length-1]=i[i.length-1]);for(let n=0;n<e.length;n++){const t=o[n]>m?m:o[n]<x?x:o[n],l=Math.ceil(e[2*n]-c),r=i[2*n+1]===i[2*n]?l:Math.floor(e[2*n+1]-c);for(let e=l;e<=r;e++)u[e]=t,p[e]=255}}if(s?.length)for(let e=0;e<s.length;e++){const t=Math.ceil(s[2*e]-c),n=Math.floor(s[2*e+1]-c);for(let e=t;e<=n;e++)p[e]=0}return{lut:u,offset:c,mask:p}}function M(t,e,n){if("u8"!==t&&"s8"!==t&&"u16"!==t&&"s16"!==t)return null;const l=t.includes("16")?65536:256,i=t.includes("s")?-l/2:0,o=new Uint8Array(l);if(e)for(let r=0;r<e.length;r++){const t=Math.ceil(e[2*r]-i),n=Math.floor(e[2*r+1]-i);for(let e=t;e<=n;e++)o[e]=255}else o.fill(255);if(n)for(let r=0;r<n.length;r++)o[n[r]-i]=0;return{lut:o,offset:i}}function A(t,e,n,l,i,o,r,s){return{xmin:i<=n*t?0:i<n*t+t?i-n*t:t,ymin:o<=l*e?0:o<l*e+e?o-l*e:e,xmax:i+r<=n*t?0:i+r<n*t+t?i+r-n*t:t,ymax:o+s<=l*e?0:o+s<l*e+e?o+s-l*e:e}}function U(t,e){if(!t||0===t.length)return null;const n=t.find(t=>t.pixelBlock);if(null==n?.pixelBlock)return null;const l=(n.extent.xmax-n.extent.xmin)/n.pixelBlock.width,i=(n.extent.ymax-n.extent.ymin)/n.pixelBlock.height,o=.01*Math.min(l,i),r=t.sort((t,e)=>Math.abs(t.extent.ymax-e.extent.ymax)>o?e.extent.ymax-t.extent.ymax:Math.abs(t.extent.xmin-e.extent.xmin)>o?t.extent.xmin-e.extent.xmin:0),s=Math.min.apply(null,r.map(t=>t.extent.xmin)),a=Math.min.apply(null,r.map(t=>t.extent.ymin)),f=Math.max.apply(null,r.map(t=>t.extent.xmax)),h=Math.max.apply(null,r.map(t=>t.extent.ymax)),c={x:Math.round((e.xmin-s)/l),y:Math.round((h-e.ymax)/i)},u={width:Math.round((f-s)/l),height:Math.round((h-a)/i)},p={width:Math.round((e.xmax-e.xmin)/l),height:Math.round((e.ymax-e.ymin)/i)};if(Math.round(u.width/n.pixelBlock.width)*Math.round(u.height/n.pixelBlock.height)!==r.length||c.x<0||c.y<0||u.width<p.width||u.height<p.height)return null;return{extent:e,pixelBlock:T(r.map(t=>t.pixelBlock),u,{clipOffset:c,clipSize:p})}}function b(t,e,n,l,i,o){const{width:r,height:s}=n.block,{x:a,y:f}=n.offset,{width:h,height:c}=n.mosaic,u=A(r,s,l,i,a,f,h,c);let p=0,x=0;if(o){const t=o.hasGCSSShiftTransform?360:o.halfWorldWidth??0,e=r*o.resolutionX,n=o.startX+l*e;n<t&&n+e>t?x=o.rightPadding:n>=t&&(p=o.leftMargin-o.rightPadding,x=0)}if(u.xmax-=x,"number"!=typeof e)for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-f)*h+(l*r-a)+p,o=m*r;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e[o+l]}else for(let m=u.ymin;m<u.ymax;m++){const n=(i*s+m-f)*h+(l*r-a)+p;for(let l=u.xmin;l<u.xmax;l++)t[n+l]=e}}function T(t,n,l={}){const{clipOffset:i,clipSize:r,alignmentInfo:s,blockWidths:a}=l;if(a)return S(t,n,{blockWidths:a});const f=t.find(t=>o(t));if(null==f)return null;const h=r?r.width:n.width,c=r?r.height:n.height,u=f.width,p=f.height,x=n.width/u,m=n.height/p,g={offset:i||{x:0,y:0},mosaic:r||n,block:{width:u,height:p}},d=f.pixelType,y=e.getPixelArrayConstructor(d),w=f.pixels.length,k=[];let M,A;for(let e=0;e<w;e++){A=new y(h*c);for(let n=0;n<m;n++)for(let l=0;l<x;l++){const i=t[n*x+l];o(i)&&(M=i.pixels[e],b(A,M,g,l,n,s))}k.push(A)}const U=t.some(t=>null==t||null!=t.mask&&t.mask.length>0),T=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),v=U?new Uint8Array(h*c):void 0,C=T?[]:void 0;if(v){for(let e=0;e<m;e++)for(let n=0;n<x;n++){const l=t[e*x+n],i=null!=l?l.mask:null;b(v,null!=i?i:l?255:0,g,n,e,s)}if(C)for(let e=0;e<w;e++){const n=new Uint8Array(h*c);for(let l=0;l<m;l++)for(let i=0;i<x;i++){const o=t[l*x+i],r=o?.bandMasks?.[e]??o?.mask;b(n,null!=r?r:o?255:0,g,i,l,s)}C.push(n)}}const B=new e({width:h,height:c,pixels:k,pixelType:d,bandMasks:C,mask:v});return B.updateStatistics(),B}function S(t,n,l){const i=t.find(t=>null!=t);if(null==i)return null;const r=t.some(t=>null==t||!!t.mask),{width:s,height:a}=n,f=r?new Uint8Array(s*a):null,{blockWidths:h}=l,c=[],u=i.getPlaneCount(),p=e.getPixelArrayConstructor(i.pixelType);if(r)for(let e=0,y=0;e<t.length;y+=h[e],e++){const n=t[e];if(!o(n))continue;const l=n.mask;for(let t=0;t<a;t++)for(let i=0;i<h[e];i++)f[t*s+i+y]=null==l?255:l[t*n.width+i]}const x=t.some(t=>t?.bandMasks&&t.bandMasks.length>1),m=x?[]:void 0,g=s*a;for(let e=0;e<u;e++){const n=new p(g),l=x?new Uint8Array(g):void 0;for(let i=0,r=0;i<t.length;r+=h[i],i++){const f=t[i];if(!o(f))continue;const c=f.pixels[e];if(null!=c){for(let t=0;t<a;t++)for(let e=0;e<h[i];e++)n[t*s+e+r]=c[t*f.width+e];if(l){const t=f.bandMasks?.[e]??f.mask;for(let e=0;e<a;e++)for(let n=0;n<h[i];n++)l[e*s+n+r]=t?t[e*f.width+n]:255}}}c.push(n),m&&l&&m.push(l)}const d=new e({width:s,height:a,mask:f,bandMasks:m,pixels:c,pixelType:i.pixelType});return d.updateStatistics(),d}function v(t,e,n){if(!o(t))return null;const{width:l,height:i}=t,r=e.x,s=e.y,a=n.width+r,f=n.height+s;if(r<0||s<0||a>l||f>i)return t;if(0===r&&0===s&&a===l&&f===i)return t;t.mask||(t.mask=new Uint8Array(l*i));const h=t.mask;for(let o=0;o<i;o++){const t=o*l;for(let e=0;e<l;e++)h[t+e]=o<s||o>=f||e<r||e>=a?0:1}return t.updateStatistics(),t}function C(t){if(!o(t))return null;const e=t.clone(),{width:n,height:l,pixels:i}=t,r=i[0],s=e.pixels[0],a=t.mask;for(let o=2;o<l-1;o++){const t=new Map;for(let l=o-2;l<o+2;l++)for(let e=0;e<4;e++){const i=l*n+e;P(t,r[i],a?a[i]:1)}s[o*n]=B(t),s[o*n+1]=s[o*n+2]=s[o*n];let e=3;for(;e<n-1;e++){let l=(o-2)*n+e+1;P(t,r[l],a?a[l]:1),l=(o-1)*n+e+1,P(t,r[l],a?a[l]:1),l=o*n+e+1,P(t,r[l],a?a[l]:1),l=(o+1)*n+e+1,P(t,r[l],a?a[l]:1),l=(o-2)*n+e-3,I(t,r[l],a?a[l]:1),l=(o-1)*n+e-3,I(t,r[l],a?a[l]:1),l=o*n+e-3,I(t,r[l],a?a[l]:1),l=(o+1)*n+e-3,I(t,r[l],a?a[l]:1),s[o*n+e]=B(t)}s[o*n+e+1]=s[o*n+e]}for(let o=0;o<n;o++)s[o]=s[n+o]=s[2*n+o],s[(l-1)*n+o]=s[(l-2)*n+o];return e.updateStatistics(),e}function B(t){if(0===t.size)return 0;let e=0,n=-1,l=0;const i=t.keys();let o=i.next();for(;!o.done;)l=t.get(o.value),l>e&&(n=o.value,e=l),o=i.next();return n}function I(t,e,n){if(0===n)return;const l=t.get(e);1===l?t.delete(e):t.set(e,l-1)}function P(t,e,n){0!==n&&t.set(e,t.has(e)?t.get(e)+1:1)}function R(t,n,l){let{x:i,y:r}=n;const{width:s,height:a}=l;if(0===i&&0===r&&a===t.height&&s===t.width)return t;const{width:f,height:h}=t,c=Math.max(0,r),u=Math.max(0,i),p=Math.min(i+s,f),x=Math.min(r+a,h);if(p<0||x<0||!o(t))return null;i=Math.max(0,-i),r=Math.max(0,-r);const{pixels:m}=t,g=s*a,d=m.length,y=[];for(let o=0;o<d;o++){const n=m[o],l=e.createEmptyBand(t.pixelType,g);for(let t=c;t<x;t++){const e=t*f;let o=(t+r-c)*s+i;for(let t=u;t<p;t++)l[o++]=n[e+t]}y.push(l)}const w=new Uint8Array(g),k=t.mask;for(let e=c;e<x;e++){const t=e*f;let n=(e+r-c)*s+i;for(let e=u;e<p;e++)w[n++]=k?k[t+e]:1}const M=new e({width:l.width,height:l.height,pixelType:t.pixelType,pixels:y,mask:w});return M.updateStatistics(),M}function F(t,n=!0){if(!o(t))return null;const{pixels:l,width:i,height:r,mask:s,pixelType:a}=t,f=[],h=Math.round(i/2),c=Math.round(r/2),u=r-1,p=i-1;for(let o=0;o<l.length;o++){const t=l[o],s=e.createEmptyBand(a,h*c);let x=0;for(let e=0;e<r;e+=2)for(let l=0;l<i;l+=2){const o=t[e*i+l];if(n){const n=l===p?o:t[e*i+l+1],r=e===u?o:t[e*i+l+i],a=l===p?r:e===u?n:t[e*i+l+i+1];s[x++]=(o+n+r+a)/4}else s[x++]=o}f.push(s)}let x=null;if(null!=s){x=new Uint8Array(h*c);let t=0;for(let e=0;e<r;e+=2)for(let l=0;l<i;l+=2){const o=s[e*i+l];if(n){const n=l===p?o:s[e*i+l+1],r=e===u?o:s[e*i+l+i],a=l===p?r:e===u?n:s[e*i+l+i+1];x[t++]=o*n*r*a?1:0}else x[t++]=o}}return new e({width:h,height:c,pixelType:a,pixels:f,mask:x})}function _(t,e,n=0,l=!0){if(!o(t))return null;const{width:i,height:r}=e;let{width:s,height:a}=t;const f=new Map,h={x:0,y:0},c=1+n;let u=t;for(let o=0;o<c;o++){const t=Math.ceil(s/i),n=Math.ceil(a/r);for(let l=0;l<n;l++){h.y=l*r;for(let n=0;n<t;n++){h.x=n*i;const t=R(u,h,e);f.set(`${o}/${l}/${n}`,t)}}o<c-1&&(u=F(u,l)),s=Math.round(s/2),a=Math.round(a/2)}return f}function W(t){const{pixelBlock:e,tileSize:n,level:l,row:i,col:r,useBilinear:s}=t;if(!o(e))return null;const{width:a,height:f}=n,h=2**l,c=h*a,u=h*f;let p=R(e,{y:i*u,x:r*c},{width:c,height:u});if(!p)return null;for(let o=l;o>0;o--)p=F(p,s);return p}function E(t,e,n,l,i=0){const{width:o,height:r}=t,{width:s,height:a}=e,f=l.cols,h=l.rows,c=Math.ceil(s/f-.1/f),u=Math.ceil(a/h-.1/h);let p,x,m,g,d,y,w;const k=c*f,M=k*u*h,A=new Float32Array(M),U=new Float32Array(M),b=new Uint32Array(M),T=new Uint32Array(M);let S,v,C=0;for(let B=0;B<u;B++)for(let t=0;t<c;t++){p=12*(B*c+t),x=n[p],m=n[p+1],g=n[p+2],d=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<h;e++){C=(B*h+e)*k+t*f,v=(e+.5)/h;for(let t=0;t<e;t++)S=(t+.5)/f,A[C+t]=(x*S+m*v+g)*o+i,U[C+t]=(d*S+y*v+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}p+=6,x=n[p],m=n[p+1],g=n[p+2],d=n[p+3],y=n[p+4],w=n[p+5];for(let e=0;e<h;e++){C=(B*h+e)*k+t*f,v=(e+.5)/h;for(let t=e;t<f;t++)S=(t+.5)/f,A[C+t]=(x*S+m*v+g)*o+i,U[C+t]=(d*S+y*v+w)*r+i,b[C+t]=Math.floor(A[C+t]),T[C+t]=Math.floor(U[C+t])}}return{offsets_x:A,offsets_y:U,offsets_xi:b,offsets_yi:T,gridWidth:k}}function D(t,e){const{coefficients:n,spacing:l}=e,{offsets_x:i,offsets_y:o,gridWidth:r}=E(t,t,n,{rows:l[0],cols:l[1]}),{width:s,height:a}=t,f=new Float32Array(s*a),h=180/Math.PI;for(let c=0;c<a;c++)for(let t=0;t<s;t++){const e=c*r+t,n=0===c?e:e-r,l=c===a-1?e:e+r,u=i[n]-i[l],p=o[l]-o[n];if(isNaN(u)||isNaN(p))f[c*s+t]=90;else{let e=Math.atan2(p,u)*h;e=(360+e)%360,f[c*s+t]=e}}return f}function N(t,n,l,i,r="nearest"){if(!o(t))return null;"majority"===r&&(t=C(t));const{pixels:s,mask:a,bandMasks:f,pixelType:h}=t,c=t.width,u=t.height,p=e.getPixelArrayConstructor(h),x=s.length,{width:m,height:g}=n;let d=!1;for(let e=0;e<l.length;e+=3)-1===l[e]&&-1===l[e+1]&&-1===l[e+2]&&(d=!0);const{offsets_x:y,offsets_y:w,offsets_xi:k,offsets_yi:M,gridWidth:A}=E({width:c,height:u},n,l,i,"majority"===r?.5:0);let U;const b=(t,e,n,l)=>{const i=t instanceof Float32Array||t instanceof Float64Array?0:.5;for(let o=0;o<g;o++){U=o*A;for(let r=0;r<m;r++){if(y[U]<0||w[U]<0)t[o*m+r]=0;else if(l)t[o*m+r]=e[k[U]+M[U]*c];else{const l=Math.floor(y[U]),s=Math.floor(w[U]),a=Math.ceil(y[U]),f=Math.ceil(w[U]),h=y[U]-l,u=w[U]-s;if(!n||n[l+s*c]&&n[a+s*c]&&n[l+f*c]&&n[a+f*c]){const n=(1-h)*e[l+s*c]+h*e[a+s*c],p=(1-h)*e[l+f*c]+h*e[a+f*c];t[o*m+r]=(1-u)*n+u*p+i}else t[o*m+r]=e[k[U]+M[U]*c]}U++}}},T=[];let S;const v=f?.length===x,B=[];for(let e=0;e<x;e++){if(v){const t=new Uint8Array(m*g);b(t,f[e],f[e],!0),B.push(t)}S=new p(m*g),b(S,s[e],v?f[e]:a,"nearest"===r||"majority"===r),T.push(S)}const I=new e({width:m,height:g,pixelType:h,pixels:T,bandMasks:v?B:void 0});if(null!=a)I.mask=new Uint8Array(m*g),b(I.mask,a,a,!0);else if(d){I.mask=new Uint8Array(m*g);for(let t=0;t<m*g;t++)I.mask[t]=y[t]<0||w[t]<0?0:1}return I.updateStatistics(),I}function j(t){const{pixelBlock:e,extent:n,fieldNames:l,skipFactor:o,skipSpatialReference:r=!1,pixelIdOffset:s=0}=t,a=[],{width:f,height:h,pixels:c,mask:u}=e,p=t.imageRowSize??f,x=n.width/f,m=n.height/h,g=c.length,d=Math.floor(o/2),{xmin:y,ymax:w}=n,k=r?void 0:n.spatialReference.toJSON();for(let M=d;M<h;M+=o)for(let t=d;t<f;t+=o){const e=M*f+t;if(!u||u[e]){const n={x:y+(t+.5)*x,y:w-(M+.5)*m,spatialReference:k},o={[i]:s+M*p+t};for(let t=0;t<g;t++)o[l[t+1]]=c[t][e];a.push({geometry:n,attributes:o})}}return a}function z(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=i[0];let s=0;for(let a=0;a<l;a++){let t=a*n;for(let l=0;l<n;l++,t++)o&&!o[t]||(e[r[t]]++,s++)}return s}function L(t,e){const{width:n,height:l,pixels:i,mask:o}=t,r=e.width/n,s=e.height/l,{xmin:a,ymax:f}=e,h=e.spatialReference.toJSON(),c=[];for(let u=0;u<l;u++)for(let t=0;t<n;t++){const e=u*n+t;if(!o||o[e]){const n={x:a+(t+.5)*r,y:f-(u+.5)*s,spatialReference:h},l=i.map(t=>t[e]);c.push({location:n,value:l})}}return c}function O(t,n,l){const{attributeTable:i}=n;if(!i)return t;const o=i.fields.find(t=>t.name.toLowerCase()===l.toLowerCase()),r=i.fields.find(t=>"value"===t.name.toLowerCase());if(!o||!r)return t;const[s]=t.pixels,a="single"===o.type?"f32":"double"===o.type||"big-integer"===o.type?"f64":"small-integer"===o.type?"s16":"s32",f=s.length,h=new("f32"===a?Float32Array:"f64"===a?Float64Array:"s16"===a?Int16Array:Int32Array)(f),c=new Map;for(const e of i.features){const t=e.attributes[r.name],n=e.attributes[o.name];c.set(t,n)}const u=t.mask??new Uint8Array(f).fill(255);for(let e=0;e<f;e++)if(u[e]){const t=c.get(s[e]);null==t?u[e]=0:h[e]=t}return new e({width:t.width,height:t.height,pixels:[h],mask:u,pixelType:a})}export{N as approximateTransform,R as clip,W as clipTile,f as colorize,s as compositeBands,j as convertPixelBlockToFeatures,z as countCategoricalPixels,a as createColormapLUT,M as createMaskLUT,x as createRangeMaps,k as createRemapLUT,r as extractBands,A as getClipBounds,D as getLocalArithmeticNorthRotations,L as getValidPixels,u as highlightPixels,E as interpolateOffsets,o as isValidPixelBlock,c as lookupBandValues,h as lookupPixels,O as mapPixelValueToAttribute,w as mask,y as matchAnyMask,l as maxMapSizeGpu,T as mosaic,U as mosaicPixelData,i as pixelIdFieldName,m as remap,p as remapColor,C as resampleByMajority,v as setValidBoundary,_ as split};
@@ -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.9",
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
- "@esri/calcite-components": "^3.3.1",
24
+ "@esri/calcite-components": "^3.3.2",
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};
package/request.js CHANGED
@@ -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"./config.js";import{id as r}from"./kernel.js";import t from"./core/Error.js";import has from"./core/has.js";import{clone as s}from"./core/lang.js";import{getOrCreateMapValue as o}from"./core/MapUtils.js";import{onAbort as n,createAbortError as a,isAbortError as i,isAborted as l}from"./core/promiseUtils.js";import{queryToObject as u,isDataProtocol as c,isBlobProtocol as d,normalize as p,getInterceptor as m,isTrustedServer as h,getOrigin as f,toHTTPS as y,objectToQuery as w,getProxyRule as g,getProxyUrl as q,addQueryParameters as b,hasSameOrigin as k,addProxyRule as S,getAppUrl as T}from"./core/urlUtils.js";import{isHostedAgolService as O}from"./layers/support/arcgisLayerUrl.js";import{isSecureProxyService as v}from"./portal/support/urlUtils.js";import{getApiKey as C}from"./support/apiKeyUtils.js";import{registerNoCorsDomains as x,setPreferredHost as L,getPreferredUrl as j,isNoCorsRequestRequired as E,sendNoCorsRequest as U,createTimeoutError as A,loadImageAsync as P}from"./support/requestUtils.js";async function H(e,r){e instanceof URL&&(e=e.toString()),r?.query instanceof URLSearchParams&&(r.query=u(r.query.toString().replaceAll("+"," ")));const t=c(e),s=d(e);s||t||(e=p(e));const o={url:e,requestOptions:{...r}},a=e=>({data:e,getAllHeaders:B,getHeader:B,httpStatus:200,requestOptions:o.requestOptions,url:o.url}),i=m(e,D.internalInterceptors);if(i){const e=await Y(i,o);if(null!=e)return a(e)}let l=m(e);if(l){const e=await Y(l,o);if(null!=e)return a(e);l.after||l.error||(l=null)}if(e=o.url,"image"===(r=o.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw W("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),o);if("head"===r.method){if(r.body)throw W("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),o);if(t||s)throw W("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),o)}if(await G(),M)return M.execute(e,r);const h=new AbortController,f=n(r,()=>h.abort()),y={controller:h,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:l,params:o,redoRequest:!1,useIdentity:D.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},w=r.useRequestQueue?te(y):se(y),g=await w.finally(()=>f?.remove());return l?.after?.(g),g}let M,R=!1;const D=e.request,I="FormData"in globalThis,_=new Set([499,498,403,401]),F=new Set(["COM_0056","COM_0057","SB_0008"]),N=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],B=()=>null,$=Symbol();function z(e){const r=f(e);r&&!H._corsServers.includes(r)&&H._corsServers.push(r)}function Q(e){const r=f(e);return!r||r.endsWith(".arcgis.com")||H._corsServers.includes(r)||h(r)}function W(e,r,o,n){let l;const u={url:o.url,requestOptions:o.requestOptions,getAllHeaders:B,getHeader:B,ssl:!1};if(r instanceof t)return r.details?(r.details=s(r.details),r.details.url=o.url,r.details.requestOptions=o.requestOptions):r.details=u,r;if(r){const e=n&&(()=>Array.from(n.headers)),t=n&&(e=>n.headers.get(e)),s=n?.status,o=r.message;o&&(l=o),e&&t&&(u.getAllHeaders=e,u.getHeader=t),u.httpStatus=(null!=r.httpCode?r.httpCode:r.code)||s||0,u.subCode=r.subcode,u.messageCode=r.messageCode,"string"==typeof r.details?(u.messages=[r.details],l??=r.details):(u.messages=r.details,l??=u.messages?.[0]),u.raw=$ in r?r[$]:r}return l??="Error",i(r)?a():new t(e,l,u)}async function G(){has("host-webworker")&&(!M&&globalThis.invokeStaticMessage?M=await import("./core/workers/request.js"):R=!0)}async function J(){r||await import("./identity/IdentityManager.js")}async function K(e){const t=e.params.url,s=e.params.requestOptions,o=e.controller.signal,n=s.body;let a=null,i=null;if(I&&"HTMLFormElement"in globalThis&&(n instanceof FormData?a=n:n instanceof HTMLFormElement&&(a=new FormData(n))),"string"==typeof n&&(i=n),e.fetchOptions={cache:s.cacheBust?"no-cache":"default",credentials:"same-origin",headers:s.headers||{},keepalive:s.keepAlive??!1,method:"head"===s.method?"HEAD":"GET",mode:"cors",priority:D.priority,redirect:"follow",signal:o},(a||i)&&(e.fetchOptions.body=a||i),(R||"anonymous"===s.authMode)&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||s.query?.token||a?.get("token")),!e.hasToken){const r=C(t);r&&(s.query??={},s.query.token=r,e.hasToken=!0)}if(e.useIdentity&&!e.hasToken&&!e.credential&&!e.credentialToken&&!X(t)&&!l(o)){let n;"immediate"===s.authMode?(await J(),n=await r.getCredential(t,{signal:o})):"no-prompt"===s.authMode?(await J(),n=await r.getCredential(t,{prompt:!1,signal:o}).catch(()=>{})):r&&(n=r.findCredential(t)),n&&(e.credential=n,e.credentialToken=n.token,e.useSSL=!!n.ssl)}}function X(e){return N.some(r=>r.test(e))}async function V(e){let t=e.params.url,s=j(t);const o=e.params.requestOptions,n=e.fetchOptions??{},i=d(t)||c(t),l=o.responseType||"json",u=i?0:null!=o.timeout?o.timeout:D.timeout;let p=!1;if(!i){e.useSSL&&(t=y(t));let a={...o.query};e.credentialToken&&(a.token=e.credentialToken);let i=w(a);has("esri-url-encodes-apostrophe")&&(i=i.replaceAll("'","%27"));const l=s.length+1+i.length;let u;p="delete"===o.method||"post"===o.method||"put"===o.method||!!o.body||l>D.maxUrlLength;const c=o.useProxy||!!g(t);if(c){const e=q(t);u=e.path,!p&&u.length+1+l>D.maxUrlLength&&(p=!0),e.query&&(a={...e.query,...a})}if("HEAD"===n.method&&(p||c)){if(p){if(l>D.maxUrlLength)throw W("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw W("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(c)throw W("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(p?(n.method="delete"===o.method?"DELETE":"put"===o.method?"PUT":"POST",o.body?t=b(t,a):(n.body=w(a),n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=b(t,a),c&&(e.useProxy=!0,t=`${u}?${t}`),a.token&&I&&n.body instanceof FormData&&!v(t)&&n.body.set("token",a.token),o.hasOwnProperty("withCredentials"))e.withCredentials=o.withCredentials;else if(!k(t,T()))if(h(t))e.withCredentials=!0;else if(r){const s=r.findServerInfo(t);s?.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include",E(t)&&await U(p?b(t,a):t)),s=j(t)}let m,O,C=0,x=!1;u>0&&(C=setTimeout(()=>{x=!0,e.controller.abort()},u));try{if("native-request-init"===o.responseType)O=n,O.url=s,o.signal?O.signal=o.signal:delete O.signal;else if("image"!==o.responseType||"default"!==n.cache||n.keepalive||"GET"!==n.method||p||Z(o.headers)||!i&&!e.useProxy&&D.proxyUrl&&!Q(t)){if(await(H._beforeFetch?.(t,n)),m=await fetch(s,n),await(H._afterFetch?.(m)),e.useProxy||z(t),"native"===o.responseType)O=m;else if("HEAD"!==n.method)if(m.ok){switch(l){case"array-buffer":O=await m.arrayBuffer();break;case"blob":case"image":O=await m.blob();break;default:O=await m.text()}if(C&&(clearTimeout(C),C=0),"json"===l||"xml"===l||"document"===l)if(O)switch(l){case"json":O=JSON.parse(O);break;case"xml":O=ee(O,"application/xml");break;case"document":O=ee(O,"text/html")}else O=null;if(O){if("array-buffer"===l||"blob"===l){const e=m.headers.get("Content-Type");if(e&&/application\/json|text\/plain/i.test(e)&&O["blob"===l?"size":"byteLength"]<=750)try{const e=await new Response(O).json();e.error&&(O=e)}catch{}}"image"===l&&O instanceof Blob&&(O=await ne(URL.createObjectURL(O),e,!0))}}else{O=await m.text();try{O=JSON.parse(O)}catch{}}}else O=await ne(s,e)}catch(L){if("AbortError"===L.name){if(x)throw A();throw a("Request canceled")}if(!(!m&&L instanceof TypeError&&D.proxyUrl)||o.body||"delete"===o.method||"head"===o.method||"post"===o.method||"put"===o.method||e.useProxy||Q(t))throw L;e.redoRequest=!0,S({proxyUrl:D.proxyUrl,urlPrefix:f(t)??""})}finally{C&&clearTimeout(C)}return[m,O]}async function Y(e,r){if(null!=e.responseData)return e.responseData;if(e.headers&&(r.requestOptions.headers={...r.requestOptions.headers,...e.headers}),e.query&&(r.requestOptions.query={...r.requestOptions.query,...e.query}),e.before){let o,n;try{n=await e.before(r)}catch(s){o=W("request:interceptor",s,r)}if((n instanceof Error||n instanceof t)&&(o=W("request:interceptor",n,r)),o)throw e.error&&e.error(o),o;return n}}function Z(e){if(e)for(const r of Object.getOwnPropertyNames(e))if(e[r])return!0;return!1}function ee(e,r){let t;try{t=(new DOMParser).parseFromString(e,r)}catch{}if(!t||t.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return t}H._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"],H._beforeFetch=void 0,H._afterFetch=void 0;const re=new Map;async function te(e){const r=ae(e.params.url);if(!r)return se(e);const{QueueProcessor:t}=await import("./core/QueueProcessor.js"),s=o(re,r.origin,()=>{const e=r.isHosted?has("request-queue-concurrency-hosted"):has("request-queue-concurrency-non-hosted");return new t({concurrency:e,process:e=>{if(l(e.params.requestOptions))throw W("",a("Request canceled"),e.params);return se(e)}})});return s.push(e)}async function se(e){let t,s;await K(e);try{do{[t,s]=await V(e)}while(!await oe(e,t,s))}catch(a){const r=W("request:server",a,e.params,t);throw r.details.ssl=e.useSSL,e.interceptor?.error&&e.interceptor.error(r),r}const o=e.params.url;if(s)if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(o)){if(!e.hasToken&&!e.credentialToken&&s.user?.username&&!h(o)){const e=f(o,!0);e&&D.trustedServers.push(e)}Array.isArray(s.authorizedCrossOriginNoCorsDomains)&&x(s.authorizedCrossOriginNoCorsDomains)}else{"json"===(e.params.requestOptions.responseType||"json")&&L(o,s)}const n=e.credential;if(n&&r){const e=r.findServerInfo(n.server);let t=e?.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=r.findCredential(t,n.userId);e&&-1===r._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:s,getAllHeaders:t?()=>Array.from(t.headers):B,getHeader:t?e=>t.headers.get(e):B,httpStatus:t?.status??200,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}async function oe(e,t,s){if(e.redoRequest)return e.redoRequest=!1,!1;const o=e.params.requestOptions;if(!t||"native"===o.responseType||"native-request-init"===o.responseType)return!0;let n,a;if(s&&(s.error&&"object"==typeof s.error?n=s.error:"error"===s.status&&Array.isArray(s.messages)&&(n={...s},n[$]=s,n.details=s.messages)),!n&&!t.ok)throw n=new Error(`Unable to load ${t.url} status: ${t.status}`),n[$]=s,n;let i,l=null;n&&(a=Number(n.code),l=n.hasOwnProperty("subcode")?Number(n.subcode):null,i=n.messageCode,i=i?.toUpperCase());const u=o.authMode;if(403===a&&(4===l||n.message?.toLowerCase().includes("ssl")&&!n.message.toLowerCase().includes("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===a)&&void 0!==a&&_.has(a)&&!X(e.params.url)&&(403!==a||(!i||!F.has(i))&&(null==l||2===l&&e.credentialToken))){await J();try{const t=await r.getCredential(e.params.url,{error:W("request:server",n,e.params),credential:e.credential,prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(c){if("no-prompt"===u)return e.credential=void 0,e.credentialToken=void 0,!1;n=c}}if(n)throw n;return!0}function ne(e,r,t=!1){const s=r.controller.signal,o=new Image;return r.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.fetchPriority=D.priority,o.src=e,P(o,e,t,s)}function ae(e){let r,t;return"string"==typeof e?(r=f(e,!0),t=O(e)):(r=e.origin,t=O(e.toString())),null==r?null:{origin:r,isHosted:t}}export{H as default};
5
+ import e from"./config.js";import{createRequestError as r,processRequest as t}from"./processRequest.js";import{requestConfig as o}from"./requestConfig.js";import{ensureRequestQueue as s}from"./requestQueue.js";import n from"./core/Error.js";import has from"./core/has.js";import{onAbort as i}from"./core/promiseUtils.js";import{isDataProtocol as a,isBlobProtocol as u,normalize as p,queryToObject as c,getInterceptor as l}from"./core/urlUtils.js";async function f(e,o){e instanceof URL&&(e=e.toString());const s=a(e),n=u(e);n||s||(e=p(e));const f={url:e,requestOptions:{...o}};o?.query&&(f.requestOptions.query=o?.query instanceof URLSearchParams?c(o.query.toString().replaceAll("+"," ")):o?.query);const b=e=>({data:e,getAllHeaders:q,getHeader:q,httpStatus:200,requestOptions:f.requestOptions,url:f.url}),g=l(e,m.internalInterceptors);if(g){const e=await w(g,f);if(null!=e)return b(e)}let O=l(e);if(O){const e=await w(O,f);if(null!=e)return b(e);O.after||O.error||(O=null)}if(e=f.url,"image"===(o=f.requestOptions).responseType&&(has("host-webworker")||has("host-node")))throw r("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),f);if("head"===o.method){if(o.body)throw r("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),f);if(s||n)throw r("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),f)}if(await h(),d)return d.execute(e,o);const j=new AbortController,v=i(o,()=>j.abort()),k={controller:j,credential:void 0,credentialToken:void 0,fetchOptions:void 0,hasToken:!1,interceptor:O,parameters:f,redoRequest:!1,useIdentity:m.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},S=o.useQueue?y(k):t(k),E=await S.finally(()=>v?.remove());return O?.after?.(E),E}let d;const m=e.request,q=()=>null;async function h(){has("host-webworker")&&(!d&&globalThis.invokeStaticMessage?d=await import("./core/workers/request.js"):o.isForeignWorker=!0)}async function w(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let s,i;try{i=await e.before(t)}catch(o){s=r("request:interceptor",o,t)}if((i instanceof Error||i instanceof n)&&(s=r("request:interceptor",i,t)),s)throw e.error&&e.error(s),s;return i}}async function y(e){const r=await s(e);return r?r.push(e):t(e)}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
+ const e={corsServers:["https://server.arcgisonline.com","https://services.arcgisonline.com"],beforeFetch:void 0,fetch:fetch.bind(null),afterFetch:void 0,isForeignWorker:!1};export{e as requestConfig};