@arcgis/core 5.1.0-next.104 → 5.1.0-next.106

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 (461) hide show
  1. package/analysis/AreaMeasurementAnalysis.d.ts +5 -5
  2. package/analysis/DimensionAnalysis.d.ts +3 -3
  3. package/analysis/DimensionSimpleStyle.d.ts +2 -2
  4. package/analysis/DirectLineMeasurementAnalysis.d.ts +4 -4
  5. package/analysis/DistanceMeasurementAnalysis.d.ts +4 -4
  6. package/analysis/ElevationProfileAnalysis.d.ts +3 -3
  7. package/analysis/LengthDimension.d.ts +2 -2
  8. package/analysis/LineOfSightAnalysis.d.ts +4 -4
  9. package/analysis/ShadowCast/DiscreteOptions.d.ts +7 -3
  10. package/analysis/ShadowCast/MinDurationOptions.d.ts +5 -1
  11. package/analysis/ShadowCast/TotalDurationOptions.d.ts +7 -3
  12. package/analysis/ShadowCast/types.d.ts +1 -1
  13. package/analysis/ShadowCastAnalysis.d.ts +90 -66
  14. package/analysis/SliceAnalysis.d.ts +4 -4
  15. package/analysis/SlicePlane.d.ts +3 -3
  16. package/analysis/Viewshed.d.ts +2 -2
  17. package/analysis/ViewshedAnalysis.d.ts +3 -3
  18. package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.d.ts +1 -1
  19. package/analysis/VolumeMeasurementAnalysis.d.ts +3 -3
  20. package/applications/Components/imageryUtils.d.ts +24 -0
  21. package/applications/Components/layerUtils.d.ts +21 -0
  22. package/applications/Components/layerUtils.js +2 -0
  23. package/applications/Components/templateUtils.d.ts +11 -1
  24. package/applications/Components/templateUtils.js +1 -1
  25. package/arcgisGlobal.d.ts +1 -0
  26. package/assets/components/assets/icon/buttons16.json +1 -0
  27. package/assets/components/assets/icon/buttons24.json +1 -0
  28. package/assets/components/assets/icon/buttons32.json +1 -0
  29. package/assets/components/assets/icon/entityTypes16.json +1 -0
  30. package/assets/components/assets/icon/entityTypes24.json +1 -0
  31. package/assets/components/assets/icon/entityTypes32.json +1 -0
  32. package/assets/esri/core/t9n/Units.json +1 -1
  33. package/assets/esri/core/t9n/Units_ar.json +1 -1
  34. package/assets/esri/core/t9n/Units_bg.json +1 -1
  35. package/assets/esri/core/t9n/Units_bs.json +1 -1
  36. package/assets/esri/core/t9n/Units_ca.json +1 -1
  37. package/assets/esri/core/t9n/Units_cs.json +1 -1
  38. package/assets/esri/core/t9n/Units_da.json +1 -1
  39. package/assets/esri/core/t9n/Units_de.json +1 -1
  40. package/assets/esri/core/t9n/Units_el.json +1 -1
  41. package/assets/esri/core/t9n/Units_en.json +1 -1
  42. package/assets/esri/core/t9n/Units_es.json +1 -1
  43. package/assets/esri/core/t9n/Units_et.json +1 -1
  44. package/assets/esri/core/t9n/Units_fi.json +1 -1
  45. package/assets/esri/core/t9n/Units_fr.json +1 -1
  46. package/assets/esri/core/t9n/Units_he.json +1 -1
  47. package/assets/esri/core/t9n/Units_hr.json +1 -1
  48. package/assets/esri/core/t9n/Units_hu.json +1 -1
  49. package/assets/esri/core/t9n/Units_id.json +1 -1
  50. package/assets/esri/core/t9n/Units_it.json +1 -1
  51. package/assets/esri/core/t9n/Units_ja.json +1 -1
  52. package/assets/esri/core/t9n/Units_ko.json +1 -1
  53. package/assets/esri/core/t9n/Units_lt.json +1 -1
  54. package/assets/esri/core/t9n/Units_lv.json +1 -1
  55. package/assets/esri/core/t9n/Units_nl.json +1 -1
  56. package/assets/esri/core/t9n/Units_no.json +1 -1
  57. package/assets/esri/core/t9n/Units_pl.json +1 -1
  58. package/assets/esri/core/t9n/Units_pt-BR.json +1 -1
  59. package/assets/esri/core/t9n/Units_pt-PT.json +1 -1
  60. package/assets/esri/core/t9n/Units_ro.json +1 -1
  61. package/assets/esri/core/t9n/Units_ru.json +1 -1
  62. package/assets/esri/core/t9n/Units_sk.json +1 -1
  63. package/assets/esri/core/t9n/Units_sl.json +1 -1
  64. package/assets/esri/core/t9n/Units_sr.json +1 -1
  65. package/assets/esri/core/t9n/Units_sv.json +1 -1
  66. package/assets/esri/core/t9n/Units_th.json +1 -1
  67. package/assets/esri/core/t9n/Units_tr.json +1 -1
  68. package/assets/esri/core/t9n/Units_uk.json +1 -1
  69. package/assets/esri/core/t9n/Units_vi.json +1 -1
  70. package/assets/esri/core/t9n/Units_zh-CN.json +1 -1
  71. package/assets/esri/core/t9n/Units_zh-HK.json +1 -1
  72. package/assets/esri/core/t9n/Units_zh-TW.json +1 -1
  73. package/assets/esri/core/workers/RemoteClient.js +1 -1
  74. package/assets/esri/core/workers/chunks/01c70c27aa3a955e2928.js +262 -0
  75. package/assets/esri/core/workers/chunks/{7d571845292b1b7769c2.js → 065dd2fdc834146423c7.js} +1 -1
  76. package/assets/esri/core/workers/chunks/{f5bd0a4f82df5e942b70.js → 093f27e4e4781870b431.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{2a5f6a8d282f2c391591.js → 15920af0c4f46773b06e.js} +1 -1
  78. package/assets/esri/core/workers/chunks/179c9fe4ac83b42e5976.js +1 -0
  79. package/assets/esri/core/workers/chunks/1d1929f98d941179be29.js +2 -0
  80. package/assets/esri/core/workers/chunks/{24247ee93f43fff5e596.js.LICENSE.txt → 1d1929f98d941179be29.js.LICENSE.txt} +1 -3
  81. package/assets/esri/core/workers/chunks/1ebb613bbe09fcf274d8.js +1 -0
  82. package/assets/esri/core/workers/chunks/24b43fb12fc3009fdc30.js +1 -0
  83. package/assets/esri/core/workers/chunks/2b9661700743d1f9717e.js +1 -0
  84. package/assets/esri/core/workers/chunks/2f0a3b22fc46d832e240.js +1 -0
  85. package/assets/esri/core/workers/chunks/340f2c996f62f7f5ceae.js +1 -0
  86. package/assets/esri/core/workers/chunks/466c250537415f12eb59.js +1 -0
  87. package/assets/esri/core/workers/chunks/549d348ca181d06aefb7.js +2 -0
  88. package/assets/esri/core/workers/chunks/{0cb8bc6dbbbe3b212712.js → 558606a1af22e4a0d536.js} +1 -1
  89. package/assets/esri/core/workers/chunks/{7485d59d60d61737d662.js → 55b765c72d13b3b911f9.js} +1 -1
  90. package/assets/esri/core/workers/chunks/5cdf87e7a59ace38df87.js +1 -0
  91. package/assets/esri/core/workers/chunks/622bdd1b9d5d292ec12b.js +1 -0
  92. package/assets/esri/core/workers/chunks/{bff0c4094c14cb97b18f.js → 63ea4191d441efd2f146.js} +1 -1
  93. package/assets/esri/core/workers/chunks/69c9eb93553b006b640d.js +2 -0
  94. package/assets/esri/core/workers/chunks/6d20d741b8ae1a45b422.js +1 -0
  95. package/assets/esri/core/workers/chunks/{b63cbf6c2c9ec1b02b9a.js → 6e21675bbd7a44070771.js} +1 -1
  96. package/assets/esri/core/workers/chunks/702a3ef9e1b3442cbee7.js +1 -0
  97. package/assets/esri/core/workers/chunks/762e23466308f22d7076.js +1 -0
  98. package/assets/esri/core/workers/chunks/{52219561c144e5cb4442.js → 770611659b38066a6228.js} +1 -1
  99. package/assets/esri/core/workers/chunks/{c476f4979048e558baa7.js → 7ce60331f94ee0a5d674.js} +57 -75
  100. package/assets/esri/core/workers/chunks/7e02e5c6979090fe3ea7.js +1 -0
  101. package/assets/esri/core/workers/chunks/825db2ea15308ee6e5dc.js +1 -0
  102. package/assets/esri/core/workers/chunks/{bf2c202dec5ab7bc770b.js → 829a0583b8a228c65379.js} +1 -1
  103. package/assets/esri/core/workers/chunks/8330302096d4312a4393.js +1 -0
  104. package/assets/esri/core/workers/chunks/885eac78a76184efa1e5.js +1 -0
  105. package/assets/esri/core/workers/chunks/{79dc7045d9a2d43ba8df.js → 890b7a1153b7f65eba9a.js} +1 -1
  106. package/assets/esri/core/workers/chunks/8a1751187a20b6578875.js +1 -0
  107. package/assets/esri/core/workers/chunks/{d610f517fb3c6cb24365.js → 8ade869fa9bae446266a.js} +1 -1
  108. package/assets/esri/core/workers/chunks/{44636ef119c6a576470b.js → 94eab215bab3e4e0e5b5.js} +1 -1
  109. package/assets/esri/core/workers/chunks/95dee5853c6e89f15ea9.js +1 -0
  110. package/assets/esri/core/workers/chunks/a5b9ae4c93f9af7589f2.js +1 -0
  111. package/assets/esri/core/workers/chunks/{95798e3de3419fdda6ac.js → a8ae00e06f98e04aee8e.js} +1 -1
  112. package/assets/esri/core/workers/chunks/aaad0d3e82ed917d3886.js +1 -0
  113. package/assets/esri/core/workers/chunks/b3e8ab68fc38306f13c6.js +1 -0
  114. package/assets/esri/core/workers/chunks/b7a81fd4994eabba1869.js +640 -0
  115. package/assets/esri/core/workers/chunks/{9542ef3f6c2bc7c14d85.js → b9850fe7dcdaed0c327c.js} +1 -1
  116. package/assets/esri/core/workers/chunks/{f7e386ece75afb6e4be5.js → bc249bb667f0564ad093.js} +1 -1
  117. package/assets/esri/core/workers/chunks/bd59cb5abc67e46f1b2c.js +2 -0
  118. package/assets/esri/core/workers/chunks/{f3a9100518b044e79501.js → be817be7c81fb630122f.js} +1 -1
  119. package/assets/esri/core/workers/chunks/{3c9482764c9e4f8bcbb0.js → c187bc997bad61b6c6e9.js} +1 -1
  120. package/assets/esri/core/workers/chunks/c4872cf3b71d00f450e1.js +1 -0
  121. package/assets/esri/core/workers/chunks/c5ab346a226df1894302.js +1 -0
  122. package/assets/esri/core/workers/chunks/{ce0c7070eeb723a718e7.js → d859c046a3ea42530bff.js} +1 -1
  123. package/assets/esri/core/workers/chunks/da29cf0e64065631a470.js +1 -0
  124. package/assets/esri/core/workers/chunks/{bb04aff0b4947408592c.js → dcba6c766eee8b90381a.js} +1 -1
  125. package/assets/esri/core/workers/chunks/ddebc1dc10a2d207389f.js +1 -0
  126. package/assets/esri/core/workers/chunks/e393fd61deb2e7f22ee6.js +1 -0
  127. package/assets/esri/core/workers/chunks/ea2bf7c543cc536400b7.js +30 -0
  128. package/assets/esri/core/workers/chunks/ece30bfd5c49b8d99752.js +1 -0
  129. package/assets/esri/core/workers/chunks/ecf4d07917efc97eb991.js +1 -0
  130. package/assets/esri/core/workers/chunks/ee56290e600cbeb25a00.js +1 -0
  131. package/assets/esri/core/workers/chunks/f52c6efc5a2abf5ac845.js +1 -0
  132. package/assets/esri/core/workers/chunks/{5cffc7b49966201eccdb.js → f75295cdd5e84eb97d5a.js} +1 -1
  133. package/assets/esri/core/workers/chunks/f7fe17a22390a24d6df8.js +2 -0
  134. package/assets/esri/core/workers/chunks/f9324420f2c6ac240f63.js +1 -0
  135. package/assets/esri/core/workers/chunks/{855bf811cd79b97c169a.js → fae2c8f053927559fff0.js} +1 -1
  136. package/assets/esri/core/workers/chunks/{64e268ebac0b62076f81.js → fbb23db01f3cf629d32e.js} +1 -1
  137. package/assets/esri/core/workers/chunks/fc1fe1f58a65a1694c09.js +1 -0
  138. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +84 -1
  139. package/assets/esri/themes/dark/main.css +1 -1
  140. package/assets/esri/themes/light/main.css +1 -1
  141. package/assets/esri/themes/light/view.css +1 -1
  142. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  143. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  144. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
  145. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  146. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  147. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  148. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  149. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  150. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  151. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  152. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  153. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
  154. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  155. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  156. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  157. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  158. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  159. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  160. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  161. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  162. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  163. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  164. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  165. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  166. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  167. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  168. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  169. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  170. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  171. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  172. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  173. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  174. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  175. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  176. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  177. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  178. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  179. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  180. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  181. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  182. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  183. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  184. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  185. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  186. package/chunks/ChapmanAtmosphere.glsl.js +14 -19
  187. package/chunks/ComponentShader.glsl.js +11 -15
  188. package/chunks/Compositing.glsl.js +4 -4
  189. package/chunks/GaussianSplatShadow.glsl.js +7 -7
  190. package/chunks/GlobalIllumination.glsl.js +27 -50
  191. package/chunks/GlobalIlluminationBlur.glsl.js +16 -11
  192. package/chunks/Terrain.glsl.js +1 -1
  193. package/config.js +1 -1
  194. package/core/ReactiveSet.js +1 -1
  195. package/core/generatorUtils.js +2 -0
  196. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  197. package/core/libs/gl-matrix-2/math/vec2.js +1 -1
  198. package/core/mathUtils.js +1 -1
  199. package/core/typedArrayUtil.js +1 -1
  200. package/geometry/HeightModelInfo.js +1 -1
  201. package/geometry/geometryEngine.d.ts +2 -2
  202. package/geometry/support/buffer/BufferView.js +1 -1
  203. package/geometry/support/vcsData.js +1 -1
  204. package/geometry/support/vcsLookup.js +1 -1
  205. package/kernel.js +1 -1
  206. package/layers/DimensionLayer.d.ts +5 -5
  207. package/layers/FeatureLayer.d.ts +2 -2
  208. package/layers/GaussianSplatLayer.d.ts +3 -3
  209. package/layers/LineOfSightLayer.d.ts +5 -5
  210. package/layers/ParquetLayer.d.ts +6 -4
  211. package/layers/SubtypeGroupLayer.d.ts +2 -2
  212. package/layers/VideoLayer.js +1 -1
  213. package/layers/ViewshedLayer.d.ts +3 -3
  214. package/layers/graphics/sources/ParquetSource.js +1 -1
  215. package/layers/graphics/sources/parquet/FileProvider.js +2 -0
  216. package/layers/graphics/sources/parquet/PortalParquetFileProvider.js +2 -0
  217. package/layers/graphics/sources/parquet/PortalParquetLayerFileProvider.js +2 -0
  218. package/layers/graphics/sources/parquet/UrlsFileProvider.js +2 -0
  219. package/layers/graphics/sources/parquet/createFileProvider.js +2 -0
  220. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  221. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  222. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +2 -2
  223. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  224. package/layers/knowledgeGraph/layerUtils.js +1 -1
  225. package/layers/orientedImagery/core/utils.js +1 -1
  226. package/layers/raster/datasets/ImageAuxRaster.js +1 -1
  227. package/layers/raster/datasets/pixelReader.js +1 -1
  228. package/layers/raster/formats/JpgPlus.js +1 -1
  229. package/layers/raster/formats/RasterCodec.js +1 -1
  230. package/layers/raster/functions/clipUtils.js +1 -1
  231. package/layers/support/AggregateField.d.ts +2 -1
  232. package/layers/support/LayerContingentValuesCache.js +1 -1
  233. package/layers/support/SubtypeSublayer.d.ts +4 -4
  234. package/layers/support/parquetUtils.d.ts +18 -7
  235. package/layers/support/parquetUtils.js +1 -1
  236. package/layers/support/rasterFunctionUtils.d.ts +2 -2
  237. package/layers/video/VideoController.js +1 -1
  238. package/libs/parquet/parquet.js +1 -1
  239. package/linkChart/ChronologicalLayoutSettings.d.ts +1 -1
  240. package/networks/CircuitManager.d.ts +3 -3
  241. package/networks/UnitIdentifierManager.d.ts +1 -1
  242. package/networks/UnitIdentifierManager.js +1 -1
  243. package/networks/UtilityNetwork.d.ts +2 -2
  244. package/networks/UtilityNetwork.js +1 -1
  245. package/networks/support/Circuit.d.ts +1 -1
  246. package/networks/support/CircuitLocation.d.ts +1 -1
  247. package/networks/support/CircuitSection.d.ts +1 -1
  248. package/networks/support/Subcircuit.d.ts +1 -1
  249. package/networks/support/TraceJobInfo.js +1 -1
  250. package/networks/support/jsonTypes.d.ts +10 -3
  251. package/package.json +3 -3
  252. package/popup/FieldInfo.d.ts +4 -2
  253. package/popup/support/FieldInfoFormat.d.ts +3 -2
  254. package/rest/featureService/FeatureService.d.ts +1 -1
  255. package/rest/knowledgeGraph/FieldIndex.d.ts +1 -1
  256. package/rest/knowledgeGraph/GraphObjectType.d.ts +2 -2
  257. package/rest/knowledgeGraph/GraphSearch.d.ts +1 -1
  258. package/rest/knowledgeGraph/GraphSearchStreaming.d.ts +1 -1
  259. package/rest/networks/circuits/support/ExportCircuitsParameters.d.ts +19 -1
  260. package/rest/networks/circuits/support/ExportCircuitsResult.js +1 -1
  261. package/rest/networks/circuits/support/VerifyCircuitsParameters.d.ts +18 -10
  262. package/rest/networks/circuits/support/VerifyCircuitsParameters.js +1 -1
  263. package/rest/networks/support/TraceParameters.js +1 -1
  264. package/rest/networks/support/TraceResult.js +1 -1
  265. package/rest/networks/trace.js +1 -1
  266. package/rest/networks/unitIdentifiers/support/QueryUnitIdentifiersParameters.js +1 -1
  267. package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
  268. package/rest/support/GeneralizeParameters.d.ts +1 -1
  269. package/rest/support/Query.d.ts +1 -1
  270. package/rest/support/RelationParameters.d.ts +1 -1
  271. package/rest/support/types.d.ts +1 -1
  272. package/support/revision.js +1 -1
  273. package/symbols/CIMSymbol.d.ts +1 -1
  274. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +1 -0
  275. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  276. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  277. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  278. package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
  279. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  280. package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
  281. package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +1 -1
  282. package/views/3d/analysis/AreaMeasurementAnalysisView3D.d.ts +1 -0
  283. package/views/3d/analysis/DimensionAnalysisView3D.d.ts +7 -6
  284. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.d.ts +2 -0
  285. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +2 -1
  286. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +14 -6
  287. package/views/3d/analysis/SliceAnalysisView3D.d.ts +4 -3
  288. package/views/3d/analysis/Viewshed/ViewshedDrawToolRenderer.js +2 -0
  289. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
  290. package/views/3d/analysis/Viewshed/ViewshedInteractionVisuals.js +2 -0
  291. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +2 -0
  292. package/views/3d/analysis/Viewshed/ViewshedPlacementOperation.js +2 -0
  293. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +2 -0
  294. package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +2 -0
  295. package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +2 -0
  296. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  297. package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
  298. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  299. package/views/3d/analysis/Viewshed/ViewshedTool2.js +1 -1
  300. package/views/3d/analysis/Viewshed/analysisViewRegister.js +1 -1
  301. package/views/3d/analysis/Viewshed/placementUtils.js +2 -0
  302. package/views/3d/analysis/Viewshed/toolLifecycleUtils.js +2 -0
  303. package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +1 -1
  304. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  305. package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +4 -3
  306. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  307. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  308. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
  309. package/views/3d/layers/FlowSubView3D.js +1 -1
  310. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  311. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  312. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  313. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  314. package/views/3d/layers/support/UVWorkspace.js +2 -0
  315. package/views/3d/layers/support/patternUtils.js +1 -1
  316. package/views/3d/layers/support/uvUtils.js +1 -1
  317. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  318. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  319. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  320. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  321. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  322. package/views/3d/support/meshProcessing.js +1 -1
  323. package/views/3d/terrain/TerrainRenderer.js +1 -1
  324. package/views/3d/terrain/TileCompositor.js +1 -1
  325. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  326. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  327. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +8 -8
  328. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +13 -9
  329. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -49
  330. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  331. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +1 -1
  332. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
  333. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +1 -1
  334. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  335. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  336. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  337. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
  338. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
  339. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
  340. package/views/3d/webgl-engine/lib/AttributeArray.js +1 -1
  341. package/views/3d/webgl-engine/lib/Compositor.js +1 -1
  342. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  343. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  344. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  345. package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
  346. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  347. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  348. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  349. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  350. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  351. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  352. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  353. package/views/3d/webgl-engine/materials/PathLayouts.js +2 -0
  354. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  355. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  356. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  357. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  358. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  359. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  360. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  361. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  362. package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
  363. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  364. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  365. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  366. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  367. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  368. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  369. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  370. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +2 -3
  371. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  372. package/views/3d/webgl-engine/shaders/ditherNoise.glsl.js +1 -1
  373. package/views/PopupView.d.ts +77 -1
  374. package/views/PopupView.js +1 -1
  375. package/views/layers/DimensionLayerView.d.ts +2 -1
  376. package/views/layers/FeatureLikeLayerView.js +1 -1
  377. package/views/layers/LineOfSightLayerView.d.ts +2 -1
  378. package/views/layers/ViewshedLayerView.d.ts +2 -1
  379. package/webscene/Slide.js +1 -1
  380. package/widgets/Attachments/types.d.ts +1 -1
  381. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +38 -5
  382. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  383. package/widgets/BatchAttributeForm/ReactiveContingentValuesManager.js +2 -0
  384. package/widgets/BatchAttributeForm/ReactiveGraphic.js +1 -1
  385. package/widgets/BatchAttributeForm/attachmentUtils.js +1 -1
  386. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  387. package/widgets/BatchAttributeForm/css.js +1 -1
  388. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +11 -0
  389. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
  390. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +77 -0
  391. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  392. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +1 -1
  393. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  394. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  395. package/widgets/BatchAttributeForm/interfaceUtils.js +2 -0
  396. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  397. package/widgets/BatchAttributeForm/types.d.ts +30 -2
  398. package/widgets/BatchAttributeForm.d.ts +52 -1
  399. package/widgets/BatchAttributeForm.js +1 -1
  400. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  401. package/widgets/Editor.d.ts +1 -1
  402. package/widgets/FeatureTable/FieldColumn.js +1 -1
  403. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  404. package/widgets/LayerList/LayerListItem.js +1 -1
  405. package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
  406. package/widgets/OrientedImageryViewer.js +1 -1
  407. package/widgets/TableList/TableListViewModel.js +1 -1
  408. package/widgets/TimeSlider.d.ts +3 -3
  409. package/widgets/Track/TrackViewModel.d.ts +1 -0
  410. package/widgets/Track/TrackViewModel.js +1 -1
  411. package/widgets/Track.js +1 -1
  412. package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +10 -0
  413. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  414. package/widgets/support/ContingentValuesManager.js +1 -1
  415. package/widgets/support/GeolocationPositioning.d.ts +1 -0
  416. package/widgets/support/GeolocationPositioning.js +1 -1
  417. package/widgets/support/forms/formUtils.js +1 -1
  418. package/assets/esri/core/workers/chunks/037b36d415ae27e987f9.js +0 -1
  419. package/assets/esri/core/workers/chunks/11b0d3a825fe50dd1e84.js +0 -1
  420. package/assets/esri/core/workers/chunks/1a3426276dc82a8a80f2.js +0 -1
  421. package/assets/esri/core/workers/chunks/1c83e61fd9a4f8fc8372.js +0 -1
  422. package/assets/esri/core/workers/chunks/1cb0c4fc315bbc2bd00b.js +0 -1
  423. package/assets/esri/core/workers/chunks/24247ee93f43fff5e596.js +0 -2
  424. package/assets/esri/core/workers/chunks/276cb6a1cdd26d0e1444.js +0 -1
  425. package/assets/esri/core/workers/chunks/29b00d07d3e1d095c590.js +0 -2
  426. package/assets/esri/core/workers/chunks/2f903bd3a2611e7f0946.js +0 -30
  427. package/assets/esri/core/workers/chunks/2fda38219d778f0447b5.js +0 -1
  428. package/assets/esri/core/workers/chunks/35fdd62277fd06468a29.js +0 -2
  429. package/assets/esri/core/workers/chunks/38d7430d2370b69334d7.js +0 -1
  430. package/assets/esri/core/workers/chunks/39d6032d79720935910d.js +0 -1
  431. package/assets/esri/core/workers/chunks/40caf5e09e4382d81104.js +0 -640
  432. package/assets/esri/core/workers/chunks/4213aa844900fcf95287.js +0 -1
  433. package/assets/esri/core/workers/chunks/594e1f633527749d92d7.js +0 -1
  434. package/assets/esri/core/workers/chunks/5dafd35801dca4229aed.js +0 -1
  435. package/assets/esri/core/workers/chunks/642be1619c0e76355cb6.js +0 -1
  436. package/assets/esri/core/workers/chunks/6d66dc77af8d112c33c6.js +0 -1
  437. package/assets/esri/core/workers/chunks/7b3642195d6d3ea9b830.js +0 -1
  438. package/assets/esri/core/workers/chunks/7e57029ec958f6423d5d.js +0 -2
  439. package/assets/esri/core/workers/chunks/8042e001545e2782499c.js +0 -1
  440. package/assets/esri/core/workers/chunks/881234f25c7814de8753.js +0 -1
  441. package/assets/esri/core/workers/chunks/8a7682071941c35f05c1.js +0 -1
  442. package/assets/esri/core/workers/chunks/8e986167d4a393ee41ea.js +0 -1
  443. package/assets/esri/core/workers/chunks/8fdd57e2a0af647f1e3e.js +0 -1
  444. package/assets/esri/core/workers/chunks/90ea570f6b6ce8ca693b.js +0 -1
  445. package/assets/esri/core/workers/chunks/9373daa677dc767d7cf0.js +0 -1
  446. package/assets/esri/core/workers/chunks/95df6d2ebacc43ac5fa3.js +0 -1
  447. package/assets/esri/core/workers/chunks/a02ebdcb802d128c8eee.js +0 -1
  448. package/assets/esri/core/workers/chunks/adf72d87f0114aeade0e.js +0 -1
  449. package/assets/esri/core/workers/chunks/b1a21a4d7d73ad7d0e47.js +0 -1
  450. package/assets/esri/core/workers/chunks/b75e090a7e935ff870a3.js +0 -1
  451. package/assets/esri/core/workers/chunks/bacf0c9d5d3e084dea61.js +0 -1
  452. package/assets/esri/core/workers/chunks/c0e4fd6fa1d765275248.js +0 -2
  453. package/assets/esri/core/workers/chunks/cc8d55d1830d7542c3f5.js +0 -262
  454. package/assets/esri/core/workers/chunks/cf3c0bee919bb509cd4f.js +0 -1
  455. package/assets/esri/core/workers/chunks/cfaa6e205bfc0c94a1b1.js +0 -1
  456. package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +0 -1
  457. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechniqueConfiguration.js +0 -2
  458. /package/assets/esri/core/workers/chunks/{7e57029ec958f6423d5d.js.LICENSE.txt → 549d348ca181d06aefb7.js.LICENSE.txt} +0 -0
  459. /package/assets/esri/core/workers/chunks/{29b00d07d3e1d095c590.js.LICENSE.txt → 69c9eb93553b006b640d.js.LICENSE.txt} +0 -0
  460. /package/assets/esri/core/workers/chunks/{35fdd62277fd06468a29.js.LICENSE.txt → bd59cb5abc67e46f1b2c.js.LICENSE.txt} +0 -0
  461. /package/assets/esri/core/workers/chunks/{c0e4fd6fa1d765275248.js.LICENSE.txt → f7fe17a22390a24d6df8.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../Color.js";import t from"../../config.js";import{id as r}from"../../kernel.js";import s from"../../core/Error.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{throwIfAbortError as a}from"../../core/promiseUtils.js";import n from"../../form/FormTemplate.js";import i from"../../form/elements/FieldElement.js";import{initializeProjection as p,project as l}from"../../geometry/projectionUtils.js";import u from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as c,queryCapabilities as m}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as y}from"./constants.js";import f from"../support/FeatureTemplate.js";import b from"../support/LabelClass.js";import h from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as g,getOwningPortalUrl as w}from"../support/layerUtils.js";import I from"../../portal/PortalItem.js";import{getUserPrivileges as C}from"../../portal/support/portalItemUtils.js";import{executeQueryStreaming as j,fetchClientDataAtKeys as T}from"../../rest/knowledgeGraphService.js";import A from"../../rest/knowledgeGraph/Entity.js";import S from"../../rest/knowledgeGraph/GraphApplyEdits.js";import L from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as M}from"../../support/graphicInstanceUtils.js";import R from"../../symbols/CIMSymbol.js";import v from"../../symbols/TextSymbol.js";const E={initializeLayersFromClientData:async(e,t,r)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const s=new Map;for(const a of t)s.set(a,k(e,a));const o=await T(e.dataManager.knowledgeGraph,Array.from(s.values()),{requestOptions:{signal:r?.signal}});for(const a of[...e.layers,...e.tables]){const t=a.objectType.name;if(null==t)continue;const r=o.get(k(e,t));if(r){const e=JSON.parse(r);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),a.read(e,{origin:"service"})}}},getInclusionDefinitionFromCypherResults:async(e,t,r)=>{const s=X(e.dataModel),o=(await j(e,t,r)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await o.read();if(e)break;for(const r of t)for(const e of r){Y(e,s)}}return s},getInclusionDefinitionFromIdTypePairs:(e,t)=>{const r=X(e.dataModel);for(const{id:o,typeName:a}of t){const e=r.namedTypeDefinitions.get(a);if(!e)throw new s("WebLinkChart:data-model-desync","The provided id-type pairs contained a named type not reflected in the provided knowledge graph data model.");e.members?.set(o,{id:o})}return r},getUserKGSPrivileges:async(e,s,o)=>{let a=!0,n=!1,i=!1;if(!t.userPrivilegesApplied)return{edit:a,fullEdit:n,updateItem:i};const p=await w(s,o);if(!p)return{edit:a,fullEdit:n,updateItem:i};const l=r?.getCredential(`${p}/sharing`,{...o,prompt:!1});if(!l)return{edit:a,fullEdit:n,updateItem:i};const u=new I({id:e,portal:{url:p}});return await u.load(o),({features:{edit:a,fullEdit:n},content:{updateItem:i}}=C(u)),{edit:a,fullEdit:n,updateItem:i}}},k=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function D(e,t,r){return E.initializeLayersFromClientData(e,t,r)}async function U(e,t,r){return E.getInclusionDefinitionFromCypherResults(e,t,r)}function F(e,t){return E.getInclusionDefinitionFromIdTypePairs(e,t)}const N=["#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"],x="#8f8f82";function P(t){return t<0||t>=N.length?new e(x):new e(N[t])}function G(e){const t=e.toArray();return new R({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 _(e){let t="ESRI__ID",r=4;for(const s of e)if(s.name){if("name"===s.name.toLowerCase()){t=s.name;break}s.name.toLowerCase().includes("name")?(t=s.name,r=2):"esriFieldTypeString"===s.fieldType&&r>3&&(t=s.name,r=3)}return t}function z(e,t,r){const s={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},o=new b({labelExpressionInfo:new h({expression:"ESRI__ID"===r?`${t}`:`$feature.${r}`}),labelPlacement:"above-center",symbol:new v(s)}),a=new b({labelExpressionInfo:new h({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new v({...s,yoffset:"12px"})});return"entity"===e?[o]:[a]}function O(e,t,r){const s={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},o="ESRI__ID"===r?`${e}`:`$feature.${r}`;return"point"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"above-center",symbol:new v(s)})]:"polyline"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"center-along",repeatLabel:!0,symbol:new v(s)})]:"polygon"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"always-horizontal",symbol:new v(s)})]:null}async function $(e,t,r){return E.getUserKGSPrivileges(e,t,r).catch(e=>(a(e),{edit:!0,fullEdit:!1,updateItem:!1}))}const B={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function Q(e){const{capabilities:t,allowGeometryUpdates:r,serviceCapabilities:{geometryCapabilities:{supportsZValues:s,supportsMValues:o}}}=e?.serviceDefinition||B,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,supportedCurveTypes:[],supportsAttachment:!1,supportsM:o,supportsTrueCurve:!1,supportsZ:s},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:m,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:c,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&r,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:n.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:n.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function V(e,t){const r=new S,s=t.graphTypeName,a=t.graphType,n="knowledge-graph"===t.parentCompositeLayer.type?t.geometryFieldName:null,i=!!t.fieldsIndex.get(n)?.editable,c=e=>{const r={...e};for(const s of t.fields)s.editable||delete r[s.name];for(const t of Object.keys(e))t.includes("ESRI__")&&delete r[t];return r},m=async e=>{await p(e.spatialReference,u.WGS84);const t=l(e,u.WGS84);if("point"===t.type)return t.normalize();return(await d(t))[0]};for(const o of e.addFeatures??[]){const e=c(o.attributes);g(o.sourceLayer)&&o.sourceLayer.graphTypeName===s&&("entity"===a?(r.entityAdds||(r.entityAdds=[]),n&&o.geometry&&(e[n]=await m(o.geometry)),r.entityAdds.push(new A({properties:e,typeName:s}))):(r.relationshipAdds||(r.relationshipAdds=[]),r.relationshipAdds.push(new L({properties:e,typeName:s}))))}for(const o of e.updateFeatures??[]){const e=o.attributes[y],t=c(o.attributes);g(o.sourceLayer)&&o.sourceLayer.graphTypeName===s&&("entity"===a?(r.entityUpdates||(r.entityUpdates=[]),n&&i&&o.geometry&&(t[n]=await m(o.geometry)),r.entityUpdates.push(new A({id:e,properties:t,typeName:s}))):(r.relationshipUpdates||(r.relationshipUpdates=[]),r.relationshipUpdates.push(new L({id:e,properties:t,typeName:s}))))}const f=new Map;for(const p of e.deleteFeatures??[])if(M(p)){const e=p,t=o(f,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===s&&t.ids.push(e.attributes[y])}else if(p.objectId&&"string"==typeof p.objectId){o(f,s,()=>({typeName:s,ids:[]})).ids.push(p.objectId)}for(const o of f.values())o.ids.length>0&&("entity"===a?(r.entityDeletes||(r.entityDeletes=[]),r.entityDeletes.push({typeName:o.typeName,ids:o.ids})):(r.relationshipDeletes||(r.relationshipDeletes=[]),r.relationshipDeletes.push({typeName:o.typeName,ids:o.ids})));return r}function q(e,t){const r={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const s of e.editResults)if(s.typeName===t){for(const e of s.adds)r.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.updates)r.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.deletes)r.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return r}function W(e){if(!e.objectType)return null;const t=[];for(const r of e.fields)!r.name.includes("ESRI__")&&r.editable&&"geometry"!==r.type&&t.push(new i({fieldName:r.name}));return new n({elements:t})}function H(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 f({name:e.graphTypeName,drawingTool:t,prototype:{}})]}function K(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("id"in e&&"typeName"in e)}function Z(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e&&"path"in e&&Array.isArray(e.path))}function J(e){return!(!e||"object"!=typeof e||Array.isArray(e)||"id"in e)&&("properties"in e&&"object"==typeof e.properties)}function X(e){const t={namedTypeDefinitions:new Map,generateAllSublayers:!1},{entityTypes:r,relationshipTypes:s}=e,o=[...r,...s];for(const a of o)t.namedTypeDefinitions.set(a.name,{useAllData:!1,members:new Map});return t}function Y(e,t){if(e&&"object"==typeof e)if(K(e)){const r=t.namedTypeDefinitions.get(e.typeName);if(!r)throw new s("WebLinkChart:data-model-desync","The query result contained a named type not reflected in the provided knowledge graph data model.");r.members.set(e.id,{id:e.id})}else if(Z(e))for(const r of e.path)Y(r,t);else if(Array.isArray(e))for(const r of e)Y(r,t);else if(J(e))for(const r of Object.values(e.properties??{}))Y(r,t)}const ee=e=>{let t="";const r=e.split("/"),s=r.lastIndexOf("KnowledgeGraphServer");return s>0&&(t=r[s-1]),t};export{q as convertGraphEditsResultToFeatureEdits,V as convertLayerEditsToGraphEdits,Q as createCapabilitiesFromKnowledgeGraph,H as createDefaultKGSLFeatureTemplates,W as createDefaultKGSLFormTemplate,Y as extractGraphNamedObjectsFromQueryValueRecursive,x as fallbackKGSublayerSymbolHexColor,G as getDefaultLCRelationshipSublayerSymbol,_ as getDisplayLabelProperty,X as getEmptyInclusionListFromDataModel,U as getInclusionDefinitionFromCypherResults,F as getInclusionDefinitionFromIdTypePairs,P as getKGSublayerSymbolColor,z as getLinkChartDefaultLabelingInfo,O as getMapDefaultLabelingInfo,ee as getTitleFromServerUrl,$ as getUserKGSPrivileges,D as initializeLayersFromClientData,K as isGraphNamedObject,J as isGraphObject,Z as isPathObject,E as layerUtils};
2
+ import e from"../../Color.js";import t from"../../config.js";import{id as r}from"../../kernel.js";import s from"../../core/Error.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{throwIfAbortError as a}from"../../core/promiseUtils.js";import n from"../../form/FormTemplate.js";import i from"../../form/elements/FieldElement.js";import{initializeProjection as p,project as l}from"../../geometry/projectionUtils.js";import u from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as d}from"../../geometry/support/normalizeUtils.js";import{queryBinsCapabilities as c,queryCapabilities as m}from"../graphics/data/QueryEngineCapabilities.js";import{systemOidFieldName as y}from"./constants.js";import f from"../support/FeatureTemplate.js";import b from"../support/LabelClass.js";import h from"../support/LabelExpressionInfo.js";import{isKnowledgeGraphSublayer as g,getOwningPortalUrl as w}from"../support/layerUtils.js";import I from"../../portal/PortalItem.js";import{getUserPrivileges as C}from"../../portal/support/portalItemUtils.js";import{executeQueryStreaming as j,fetchClientDataAtKeys as T}from"../../rest/knowledgeGraphService.js";import A from"../../rest/knowledgeGraph/Entity.js";import S from"../../rest/knowledgeGraph/GraphApplyEdits.js";import M from"../../rest/knowledgeGraph/Relationship.js";import{isGraphic as R}from"../../support/graphicInstanceUtils.js";import v from"../../symbols/CIMSymbol.js";import E from"../../symbols/TextSymbol.js";const L={initializeLayersFromClientData:async(e,t,r)=>{if(t||(t=[...e.layers,...e.tables].map(e=>e.graphTypeName)),0===t?.length)return;const s=new Map;for(const a of t)s.set(a,k(e,a));const o=await T(e.dataManager.knowledgeGraph,Array.from(s.values()),{requestOptions:{signal:r?.signal}});for(const a of[...e.layers,...e.tables]){const t=a.objectType.name;if(null==t)continue;const r=o.get(k(e,t));if(r){const e=JSON.parse(r);null===e||"object"!=typeof e||e.hasOwnProperty("showLabels")||(e.showLabels=!1),a.read(e,{origin:"service"})}}},getInclusionDefinitionFromCypherResults:async(e,t,r)=>{const s=X(e.dataModel),o=(await j(e,t,r)).resultRowsStream.getReader();for(;;){const{done:e,value:t}=await o.read();if(e)break;for(const r of t)for(const e of r){Y(e,s)}}return s},getInclusionDefinitionFromIdTypePairs:(e,t)=>{const r=X(e.dataModel);for(const{id:o,typeName:a}of t){const e=r.namedTypeDefinitions.get(a);if(!e)throw new s("WebLinkChart:data-model-desync","The provided id-type pairs contained a named type not reflected in the provided knowledge graph data model.");e.members?.set(o,{id:o})}return r},getUserKGSPrivileges:async(e,s,o)=>{let a=!0,n=!1,i=!1;if(!t.userPrivilegesApplied)return{edit:a,fullEdit:n,updateItem:i};const p=await w(s,o);if(!p)return{edit:a,fullEdit:n,updateItem:i};const l=r?.getCredential(`${p}/sharing`,{...o,prompt:!1});if(!l)return{edit:a,fullEdit:n,updateItem:i};const u=new I({id:e,portal:{url:p}});return await u.load(o),({features:{edit:a,fullEdit:n},content:{updateItem:i}}=C(u)),{edit:a,fullEdit:n,updateItem:i}}},k=(e,t)=>"knowledge-graph"===e.type?`${t}/Map`:`${t}/LinkChart/LinkChartSubLayer`;async function D(e,t,r){return L.initializeLayersFromClientData(e,t,r)}async function U(e,t,r){return L.getInclusionDefinitionFromCypherResults(e,t,r)}function F(e,t){return L.getInclusionDefinitionFromIdTypePairs(e,t)}const N=["#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"],x="#8f8f82";function P(t){return t<0||t>=N.length?new e(x):new e(N[t])}function G(e){const t=e.toArray();return new v({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 _(e){let t="ESRI__ID",r=4;for(const s of e)if(s.name){if("name"===s.name.toLowerCase()){t=s.name;break}s.name.toLowerCase().includes("name")?(t=s.name,r=2):"esriFieldTypeString"===s.fieldType&&r>3&&(t=s.name,r=3)}return t}function z(e,t,r){const s={color:[80,80,80],haloColor:[255,255,255],haloSize:.7,font:{size:10,weight:"normal"}},o=new b({labelExpressionInfo:new h({expression:"ESRI__ID"===r?`${t}`:`$feature.${r}`}),labelPlacement:"above-center",symbol:new E(s)}),a=new b({labelExpressionInfo:new h({expression:`'${t}' + IIf($feature.ESRI__AggregationCount>1, ' (' + $feature.ESRI__AggregationCount + ')', '')`}),labelPlacement:"center-along",labelPosition:"parallel",repeatLabel:!1,symbol:new E({...s,yoffset:"12px"})});return"entity"===e?[o]:[a]}function O(e,t,r){const s={color:[255,255,255],haloColor:[0,0,0],haloSize:.7,font:{size:10,weight:"bold"}},o="ESRI__ID"===r?`${e}`:`$feature.${r}`;return"point"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"above-center",symbol:new E(s)})]:"polyline"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"center-along",repeatLabel:!0,symbol:new E(s)})]:"polygon"===t?[new b({labelExpressionInfo:new h({expression:o}),labelPlacement:"always-horizontal",symbol:new E(s)})]:null}async function $(e,t,r){return L.getUserKGSPrivileges(e,t,r).catch(e=>(a(e),{edit:!0,fullEdit:!1,updateItem:!1}))}const B={capabilities:[],allowGeometryUpdates:!1,serviceCapabilities:{geometryCapabilities:{supportsZValues:!1,supportsMValues:!1}}};function Q(e){const{capabilities:t,allowGeometryUpdates:r,serviceCapabilities:{geometryCapabilities:{supportsZValues:s,supportsMValues:o}}}=e?.serviceDefinition||B,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,supportedCurveTypes:[],supportsAttachment:!1,supportsM:o,supportsTrueCurve:!1,supportsZ:s},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:m,queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:c,editing:{supportsGeometryUpdate:!!e?.dataModel.arcgisManaged&&r,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:n.has("Delete"),supportsUpdateByAnonymous:!1,supportsUpdateByOthers:n.has("Update"),supportsAsyncApplyEdits:!1,zDefault:void 0}}}async function V(e,t,r){const s=new S,a=t.graphTypeName,n=t.graphType,i="knowledge-graph"===r.type?t.geometryFieldName:null,c=!!t.fieldsIndex.get(i)?.editable,m=e=>{const r={...e};for(const s of t.fields)s.editable||delete r[s.name];for(const t of Object.keys(e))t.includes("ESRI__")&&delete r[t];return r},f=async e=>{await p(e.spatialReference,u.WGS84);const t=l(e,u.WGS84);if("point"===t.type)return t.normalize();return(await d(t))[0]};for(const o of e.addFeatures??[]){const e=m(o.attributes);g(o.sourceLayer)&&o.sourceLayer.graphTypeName===a&&("entity"===n?(s.entityAdds||(s.entityAdds=[]),i&&o.geometry&&(e[i]=await f(o.geometry)),s.entityAdds.push(new A({properties:e,typeName:a}))):(s.relationshipAdds||(s.relationshipAdds=[]),s.relationshipAdds.push(new M({properties:e,typeName:a}))))}for(const o of e.updateFeatures??[]){const e=o.attributes[y],t=m(o.attributes);g(o.sourceLayer)&&o.sourceLayer.graphTypeName===a&&("entity"===n?(s.entityUpdates||(s.entityUpdates=[]),i&&c&&o.geometry&&(t[i]=await f(o.geometry)),s.entityUpdates.push(new A({id:e,properties:t,typeName:a}))):(s.relationshipUpdates||(s.relationshipUpdates=[]),s.relationshipUpdates.push(new M({id:e,properties:t,typeName:a}))))}const b=new Map;for(const p of e.deleteFeatures??[])if(R(p)){const e=p,t=o(b,e.sourceLayer.graphTypeName,()=>({typeName:e.sourceLayer.graphTypeName,ids:[]}));e.sourceLayer.graphTypeName===a&&t.ids.push(e.attributes[y])}else if(p.objectId&&"string"==typeof p.objectId){o(b,a,()=>({typeName:a,ids:[]})).ids.push(p.objectId)}for(const o of b.values())o.ids.length>0&&("entity"===n?(s.entityDeletes||(s.entityDeletes=[]),s.entityDeletes.push({typeName:o.typeName,ids:o.ids})):(s.relationshipDeletes||(s.relationshipDeletes=[]),s.relationshipDeletes.push({typeName:o.typeName,ids:o.ids})));return s}function q(e,t){const r={addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]};for(const s of e.editResults)if(s.typeName===t){for(const e of s.adds)r.addFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.updates)r.updateFeatureResults.push({objectId:e.id,globalId:e.id});for(const e of s.deletes)r.deleteFeatureResults.push({objectId:e.id,globalId:e.id})}return r}function W(e){if(!e.objectType)return null;const t=[];for(const r of e.fields)!r.name.includes("ESRI__")&&r.editable&&"geometry"!==r.type&&t.push(new i({fieldName:r.name}));return new n({elements:t})}function H(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 f({name:e.graphTypeName,drawingTool:t,prototype:{}})]}function K(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&("id"in e&&"typeName"in e)}function Z(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e&&"path"in e&&Array.isArray(e.path))}function J(e){return!(!e||"object"!=typeof e||Array.isArray(e)||"id"in e)&&("properties"in e&&"object"==typeof e.properties)}function X(e){const t={namedTypeDefinitions:new Map,generateAllSublayers:!1},{entityTypes:r,relationshipTypes:s}=e,o=[...r,...s];for(const a of o)t.namedTypeDefinitions.set(a.name,{useAllData:!1,members:new Map});return t}function Y(e,t){if(e&&"object"==typeof e)if(K(e)){const r=t.namedTypeDefinitions.get(e.typeName);if(!r)throw new s("WebLinkChart:data-model-desync","The query result contained a named type not reflected in the provided knowledge graph data model.");r.members.set(e.id,{id:e.id})}else if(Z(e))for(const r of e.path)Y(r,t);else if(Array.isArray(e))for(const r of e)Y(r,t);else if(J(e))for(const r of Object.values(e.properties??{}))Y(r,t)}const ee=e=>{let t="";const r=e.split("/"),s=r.lastIndexOf("KnowledgeGraphServer");return s>0&&(t=r[s-1]),t};export{q as convertGraphEditsResultToFeatureEdits,V as convertLayerEditsToGraphEdits,Q as createCapabilitiesFromKnowledgeGraph,H as createDefaultKGSLFeatureTemplates,W as createDefaultKGSLFormTemplate,Y as extractGraphNamedObjectsFromQueryValueRecursive,x as fallbackKGSublayerSymbolHexColor,G as getDefaultLCRelationshipSublayerSymbol,_ as getDisplayLabelProperty,X as getEmptyInclusionListFromDataModel,U as getInclusionDefinitionFromCypherResults,F as getInclusionDefinitionFromIdTypePairs,P as getKGSublayerSymbolColor,z as getLinkChartDefaultLabelingInfo,O as getMapDefaultLabelingInfo,ee as getTitleFromServerUrl,$ as getUserKGSPrivileges,D as initializeLayersFromClientData,K as isGraphNamedObject,J as isGraphObject,Z as isPathObject,L as layerUtils};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/units.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";function l(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function a(e,t,r){let{url:n}=e;return n?(n=l(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):a(e,t,r):e}const u=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new e({Feet:"feet",Meter:"meter"}),p=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),m=new Map;function d(e){const[t,r,n,i,o,s,l,a,c,u,f,p,m,d,h,w,y,v,D,z,I,L]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...g([c,u,f,p,m,d],[w,y],[v,D,z],[I,L],h)}}m.set("1",w),m.set("3",y),m.set("2",d),m.set("4",v);const h=e=>{const t=e.map(e=>parseFloat(e)).filter(e=>!isNaN(e));if(t.length===e.length)return t};function g(e,t,r,n,i){const o=h(e),s=h(t),l=h(r),a=h(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function w(e){const[t,r,n,i,o,s,l,a,c,u,f,p,m,d,h,w,y,v,D,z,I,L]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...g([c,u,f,p,m,d],[w,y],[v,D,z],[I,L],h)}}function y(e){const[t,r,n,i,o,s,l,a,c,u,f,p,m,d,h,w,y,v,D,z,I,L]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...g([c,u,f,p,m,d],[w,y],[v,D,z],[I,L],h)}}function v(e){const[t,r,i,o,s,...l]=e.slice(1),a=m.get(s),c=n.get(s)?.constructor;if(!a||!c)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new c(a([s,"",...l]))}}function D(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=m.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function z(e){return Array.isArray(e)&&e?.length>5&&!e.some(isNaN)}function I(e){for(e=e.slice(0,8);e.length<8;)e.push(0);return e}function L(e){return e.spatialReference.isGeographic?r(e):e.clone()}function N(e){return e.isGeographic?1:t(e)}function W(e){const t=e.match(/^(.*)\/rest\/services\/(.*)$/);return t?t[1]:null}const j="sequenceorder";function C(e,t){if(!e){const e=t.find(e=>e.name.toLocaleLowerCase()===j.toLocaleLowerCase());return e?[{fieldName:e.name,sortOrder:"asc"}]:null}return e.split(";").map(e=>{const[r,n]=e.split(/\s+/).map(e=>e.trim()),i=t.find(e=>e.name.toLowerCase()===r.toLowerCase());return i?{fieldName:i?i.name:j,sortOrder:"desc"===n?"desc":"asc"}:null}).filter(e=>null!=e)}export{l as appendPrefixAndSuffix,L as convertGeographicToWebMercator,D as createCameraOrientation,j as defaultSequenceOrderField,W as getArcGISServerUrl,c as getEffectiveElevationSource,N as getMetersPerUnitOfSR,z as isOrientationAccuracy,p as orientedImageryTypeMap,I as padAccuracyArray,C as parseSequenceOrderFields,a as processElevationSource,u as timeIntervalUnitTypeMap,m as transformersRegistry,f as verticalMeasurementTypeMap};
2
+ import{JSONMap as e}from"../../../core/jsonMap.js";import{getMetersPerUnitForSR as t}from"../../../core/units.js";import{geographicToWebMercator as r}from"../../../geometry/support/webMercatorUtils.js";import n from"./cameraOrientationRegistry.js";import{isConstantElevation as i,ConstantElevation as o,ElevationSource as s}from"./ElevationSourceDefinitions.js";function l(e,t,r){return t&&(e=`${t}${e}`),r&&(e+=`${r}`),e}function a(e,t,r){let{url:n}=e;return n?(n=l(n,t,r),new s({...e,url:n})):null}function c(e,t,r){return e?i(e)?new o(e):a(e,t,r):e}const u=new e({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),f=new e({Feet:"feet",Meter:"meter"}),m=new e({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique",Terrestrial360Video:"terrestrial-360-video",TerrestrialFrameVideo:"terrestrial-frame-video",Aerial360Video:"aerial-360-video",AerialFrameVideo:"aerial-frame-video","":null}),p=new Map;function d(e){const[t,r,n,i,o,s,l,a,c,u,f,m,p,d,h,w,y,v,D,z,L,C]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,omega:s,phi:l,kappa:a,...g([c,u,f,m,p,d],[w,y],[v,D,z],[L,C],h)}}p.set("1",w),p.set("3",y),p.set("2",d),p.set("4",v);const h=e=>{const t=e.map(e=>parseFloat(e)).filter(e=>!isNaN(e));if(t.length===e.length)return t};function g(e,t,r,n,i){const o=h(e),s=h(t),l=h(r),a=h(n);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(i):void 0,principalOffsetPoint:2!==s?.length?[0,0]:s,radialDistortionCoefficients:3!==l?.length?[0,0,0]:l,tangentialDistortionCoefficients:2!==a?.length?[0,0]:a}}function w(e){const[t,r,n,i,o,s,l,a,c,u,f,m,p,d,h,w,y,v,D,z,L,C]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,heading:s,pitch:l,roll:a,...g([c,u,f,m,p,d],[w,y],[v,D,z],[L,C],h)}}function y(e){const[t,r,n,i,o,s,l,a,c,u,f,m,p,d,h,w,y,v,D,z,L,C]=e.slice(1);return{horizontalWKID:t,verticalWKID:r,x:n,y:i,z:o,yaw:s,pitch:l,roll:a,...g([c,u,f,m,p,d],[w,y],[v,D,z],[L,C],h)}}function v(e){const[t,r,i,o,s,...l]=e.slice(1),a=p.get(s),c=n.get(s)?.constructor;if(!a||!c)return null;return{latitude:t,longitude:r,ellipsoidRadius:i,squaredEccentricity:o,properties:new c(a([s,"",...l]))}}function D(e){if(!e)return null;const t=`${e}`.split("|");if(0===t.length)return null;const r=n.get(t[0]);if(!r)return null;const i=p.get(t[0]);if(!i)return null;return new(0,r.constructor)(i(t))}function z(e){return Array.isArray(e)&&e?.length>5&&!e.some(isNaN)}function L(e){for(e=e.slice(0,8);e.length<8;)e.push(0);return e}function C(e){return e.spatialReference.isGeographic?r(e):e.clone()}function I(e){return e.isGeographic?1:t(e)}function N(e){const t=e.match(/^(.*)\/rest\/services\/(.*)$/);return t?t[1]:null}const W="sequenceorder";function j(e,t){if(!e){const e=t.find(e=>e.name.toLocaleLowerCase()===W.toLocaleLowerCase());return e?[{fieldName:e.name,sortOrder:"asc"}]:null}return e.split(";").map(e=>{const r=e.trim(),[n,i]=r.split(/\s+/).map(e=>e.trim()),o=t.find(e=>e.name.toLowerCase()===n.toLowerCase());return o?{fieldName:o?o.name:W,sortOrder:"desc"===i?.toLowerCase()?"desc":"asc"}:null}).filter(e=>null!=e)}export{l as appendPrefixAndSuffix,C as convertGeographicToWebMercator,D as createCameraOrientation,W as defaultSequenceOrderField,N as getArcGISServerUrl,c as getEffectiveElevationSource,I as getMetersPerUnitOfSR,z as isOrientationAccuracy,m as orientedImageryTypeMap,L as padAccuracyArray,j as parseSequenceOrderFields,a as processElevationSource,u as timeIntervalUnitTypeMap,p as transformersRegistry,f as verticalMeasurementTypeMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s,createAbortError as a}from"../../../core/promiseUtils.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import c from"./InMemoryRaster.js";import{parsePAMInfo as m}from"./pamParser.js";import{getFormat as f}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";let u=class extends l{fetchRawTile(t,e,s,a={}){if(this._imageBlob){const{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[t,e,s],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster.fetchRawTile(t,e,s,a)}async _open(t){const s=await this._fetchData(t);if(null==s)throw new e("image-aux-raster:open","the data cannot be decoded");let{spatialReference:a,statistics:r,histograms:o,transform:l}=await this._fetchAuxiliaryData(t);const m=!a;m&&(a=new n({wkid:3857})),o?.length&&null==r&&(r=p(o));const{width:f,height:h}=s;let u=new i({xmin:-.5,ymin:.5-h,xmax:f-.5,ymax:.5,spatialReference:a});const d=l?l.forwardTransform(u):u;let g=!0;if(l){const t=l.forwardCoefficients;g=t&&0===t[1]&&0===t[2],g&&(l=null,u=d)}const w=new c({preGenerateTiles:!1,source:{extent:d,nativeExtent:u,transform:l,pixelBlocks:[s],statistics:r,histograms:o,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:m},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(w.ioConfig.skipMapInfo=!0),await w.open(),w.source=null,this._set("rasterInfo",w.rasterInfo),this._inMemoryRaster=w}async _fetchData(t){const{data:s}=await this.request(this.url,{responseType:"array-buffer",signal:t?.signal}),a=f(s).toUpperCase();if("JPG"!==a&&"PNG"!==a&&"GIF"!==a&&"BMP"!==a)throw new e("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",a);const r=a.toLowerCase();try{const t=await this.decodePixelBlock(s,{format:r,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0});return this._imageBlob=s,t}catch{return this.decodePixelBlock(s,{format:r,canvasUsage:"no-canvas",skipStatistics:!0})}}async _fetchAuxiliaryData(t){const e=t?.signal,{skipExtensions:r=[],skipMapInfo:o}=this.ioConfig,i=o||r.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),n=this.datasetFormat,l="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,c=l&&r.includes(l)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:e}),f=await s([i,c]);if(e?.aborted)throw a();const p=m(f[0].value?.data);if(!p.transform){const t=f[1].value?f[1].value.data.split("\n").slice(0,6).map(t=>Number(t)):null;p.transform=6===t?.length?new h({forwardCoefficients:[t[4],t[5],t[0],-t[1],t[2],-t[3]]}):null}return p}};t([r({type:String,json:{write:!0}})],u.prototype,"datasetFormat",void 0),u=t([o("esri.layers.raster.datasets.ImageAuxRaster")],u);const d=u;export{d as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{eachAlways as s,createAbortError as a}from"../../../core/promiseUtils.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";import i from"../../../geometry/Extent.js";import n from"../../../geometry/SpatialReference.js";import l from"./BaseRaster.js";import c from"./InMemoryRaster.js";import{parsePAMInfo as m}from"./pamParser.js";import{getFormat as f}from"../formats/RasterCodec.js";import{estimateStatisticsFromHistograms as p}from"../functions/stretchUtils.js";import h from"../transforms/PolynomialTransform.js";let u=class extends l{fetchRawTile(t,e,s,a={}){if(this._imageBlob){const{blockWidth:a,blockHeight:r}=this.rasterInfo.storageInfo;return this.decodePixelBlock(this._imageBlob,{tileSize:[a,r],tileIndex:[t,e,s],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0})}return this._inMemoryRaster.fetchRawTile(t,e,s,a)}async _open(t){const s=await this._fetchData(t);if(null==s)throw new e("image-aux-raster:open","the data cannot be decoded");let{spatialReference:a,statistics:r,histograms:o,transform:l}=await this._fetchAuxiliaryData(t);const m=!a;m&&(a=new n({wkid:3857})),o?.length&&null==r&&(r=p(o));const{width:f,height:h}=s;let u=new i({xmin:-.5,ymin:.5-h,xmax:f-.5,ymax:.5,spatialReference:a});const d=l?l.forwardTransform(u):u;let g=!0;if(l){const t=l.forwardCoefficients;g=t&&0===t[1]&&0===t[2],g&&(l=null,u=d)}const w=new c({preGenerateTiles:!1,source:{extent:d,nativeExtent:u,transform:l,pixelBlocks:[s],statistics:r,histograms:o,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:m},ioConfig:{sampling:"closest",skipStatistics:!0}});this.ioConfig.skipMapInfo&&(w.ioConfig.skipMapInfo=!0),await w.open(),w.source=null,this._set("rasterInfo",w.rasterInfo),this._inMemoryRaster=w}async _fetchData(t){const{data:s}=await this.request(this.url,{responseType:"array-buffer",signal:t?.signal}),a=f(s);if("jpg"!==a&&"png"!==a&&"gif"!==a&&"bmp"!==a)throw new e("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",a.toUpperCase());const r=a.toLowerCase();try{const t=await this.decodePixelBlock(s,{format:r,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0});return this._imageBlob=s,t}catch{return this.decodePixelBlock(s,{format:r,canvasUsage:"no-canvas",skipStatistics:!0})}}async _fetchAuxiliaryData(t){const e=t?.signal,{skipExtensions:r=[],skipMapInfo:o}=this.ioConfig,i=o||r.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:e}),n=this.datasetFormat,l="JPG"===n?"jgw":"PNG"===n?"pgw":"BMP"===n?"bpw":null,c=l&&r.includes(l)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+l,{responseType:"text",signal:e}),f=await s([i,c]);if(e?.aborted)throw a();const p=m(f[0].value?.data);if(!p.transform){const t=f[1].value?f[1].value.data.split("\n").slice(0,6).map(t=>Number(t)):null;p.transform=6===t?.length?new h({forwardCoefficients:[t[4],t[5],t[0],-t[1],t[2],-t[3]]}):null}return p}};t([r({type:String,json:{write:!0}})],u.prototype,"datasetFormat",void 0),u=t([o("esri.layers.raster.datasets.ImageAuxRaster")],u);const d=u;export{d as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- 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{getByteCount as o}from"../formats/pixelRangeUtils.js";import{clip as a,snapToRaster as r}from"../functions/clipUtils.js";import{transformPixels as s}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as l,mosaic as c,pixelIdFieldName as p,convertPixelBlockToFeatures as f,getValidPixels as u,countCategoricalPixels as m}from"../functions/pixelUtils.js";import{load as x,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as d,computeStatisticsHistograms as y}from"../functions/stretchUtils.js";import w from"../../support/Field.js";import g from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const S=2**30,B=2048,P=2**20,j=20,I=100;async function z(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function R(e){const t=[new w({name:p,alias:"Pixel ID",type:"oid"})],{pixelType:i}=e,n="f32"===i?"single":"f64"===i?"double":"integer";return k(e).forEach(e=>{t.push(new w({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 x(),t=h(t,i)}return t}async function v(e,t,i=!1){const{spatialReference:o}=e,a=t?.geometry,s=await T(a??e.extent,o),l="extent"===s.type?s:s.extent,c=null==a||"extent"===a.type&&a.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),f=!!t?.autoResample,u=f?p:t?.pixelSize??p;let{extent:m,width:x,height:h}=r(e,l,u);if(!f)return{extent:m,clipGeometry:c,width:x,height:h,pixelSize:u};const d=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=u;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:o})}}async function*M(e,n,o=!1,r){const{extent:s,clipGeometry:l,width:c,height:p}=n,f=s.width/c,u=s.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),h=f*B,d=u*B,{xmin:y,xmax:w,ymin:g,ymax:k}=s,b=x*m,S={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(S);const r=new i({xmin:y+n*h,xmax:o?Math.min(w,y+(n+1)*h):y+(n+1)*h,ymax:k-P*d,ymin:o?Math.max(g,k-(P+1)*d):k-(P+1)*d,spatialReference:s.spatialReference}),c={row:P,col:n},p=P*m+n+1;if(l&&!r.intersects(l)){yield{extent:r,pixelBlock:null,id:c,total:b,current:p};continue}const x=o?Math.round(r.width/f):B,j=o?Math.round(r.height/u):B;let{pixelBlock:I}=await e.fetchPixels(r,x,j,S).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await a(I,r,l)),yield{extent:r,pixelBlock:I,id:c,total:b,current:p}}}async function*F(e,i,n){const o=await z(e,n),a=R(o),r={...i,geometry:i?.geometry??o.extent},s=M(e,await v(o,r),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const r=V(e),{pixelBlock:s}=c,{statistics:p,histograms:f}=await K({pixelBlock:s,rasterJobHandler:r},n),u=c;u.statistics=p,u.histograms=f;const m=c.id.row*o.width*B+c.id.col*B;t(n),u.featureSet=await _({pixelBlock:s,extent:c.extent,fields:a,skipFactor:i?.skipFactor??1,rasterJobHandler:r,pixelIdOffset:m,imageRowSize:l},n),t(n),yield u}}function H(t,i,n){const a=o(i),{width:r,height:s}=t;if(r*s*a>S)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 o=await z(t),a=await v(o,i,!0);H(a,o.pixelType);const{extent:r,pixelSize:s}=a,l=Math.round(o.extent.width/s.x),c=R(o),p={fields:c,features:[]},f=p.features,{maxPixelCount:u}=i,m=!!i.autoResample&&null!=u&&a.width*a.height>u,x=m?1:i.skipFactor??1,h=a.width<=B||a.height<=B,d=M(t,a,1===x||h,n);for await(const e of d){if(!e.pixelBlock)continue;const i=V(t),a=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),r=await _({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:a,imageRowSize:l},n);if(r?.features?.length){const{features:e}=r,t=e.length;for(let i=0;i<t;i++){const t=e.pop();f.push(t)}}}if(m&&u){const e=u/(i.skipFactor??1)**2;if(f.length>e){const t=f.length/e,i=[...f],n=f.length-1;f.length=0;for(let o=0,a=0;o<e-1;o++){a+=t;const e=Math.round(a);e<n&&f.push(i[e])}}}return{extent:r,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 o=await $(e,{geometry:n},i);if(!o)return null;return d(o)}async function J(e,t,i){const n=await z(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>q(e,t,i)),a=(await Promise.all(o)).filter(e=>null!=e);if(a.length<=1)return N(a[0]);const r=a[0].map((e,t)=>a.map(e=>e[t]));return d(new g({pixels:r,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),o=await z(e,i),{bandCount:a,pixelType:r}=o,s=new Array(a).fill(0).map(()=>g.createEmptyBand(r,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<a;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return d(new g({pixels:s,pixelType:r}))}async function A(t,i,n){const o=await z(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const a=o.attributeTable.clone(),r=a.fields.find(e=>"value"===e.name.toLowerCase()),s=a.fields.find(e=>"count"===e.name.toLowerCase());if(!r||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p,pixelSize:f}=i;return await L(t,{geometry:p,pixelSize:f},(e,t)=>m(e,c),n),a.features.forEach(e=>{const t=e.attributes[r.name];e.attributes[s.name]=c[t]}),a}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)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return G(o).map(e=>e/o.length)}const o=await L(e,{geometry:n},(e,t)=>W(e),i),a=o?.filter(e=>e.count>0);if(!a?.length)return null;const r=G(a.map(e=>e.bandSum)),s=a.map(e=>e.count).reduce((e,t)=>e+t);return r.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:o}=e,a=new Array(n.length).fill(0);let r=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)a[e]+=n[e][i];r++}}return{bandSum:a,count:r}}async function D(e,t,i){const n=await L(e,{geometry:t.geometry},u,i);return n?.flat()??[]}async function L(i,n,o,r){const s=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(s)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,s);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await T(c,s),f="polyline"===l.type?l:p,u=await z(i,r),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],h=M(i,await v(u,m),!0,r);for await(const e of h){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await a(e.pixelBlock,i,f),i);x.push(n),t(r)}return x}async function K(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:a}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):y(n);return{statistics:o,histograms:a}}async function _(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:a,pixelIdOffset:r,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=a?await a.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:r,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 z(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await v(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:a,height:r}=o;if(a<=B&&r<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,a,r,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=M(e,o,!1,i);for await(const c of l)s.push(c.pixelBlock);if(!s.some(e=>null!=e))return null;const p=Math.ceil(a/B),f=Math.ceil(r/B),u={width:p*B,height:f*B};let m;const x=V(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:u,destDimension:u},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=c(s,u);return m}async function Q(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");let o=await $(t,i,n);if(!o)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:a}=i;if(a&&"value"!==a.toLowerCase()){const e=await z(t,n);o=l(o,e,a)}const r=V(t),{transformType:c}=i;if(c){const e={lambda:i.lambda,shift:i.shift};o=r?await r.transformPixels({pixelBlock:o,transformType:c,transformParameters:e},{...n,transferPixelsToWorker:!0}):s(o,c,e)}const p=i.histogramSize??void 0;return r?await r.computeStatisticsHistograms({pixelBlock:o,histogramSize:p,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):y(o,{histogramSize:p,includeSkewnessKurtosis:!0})}export{O as computeBoxStatistics,A as computeRasterAttributeTable,Q as computeStatisticsHistograms,F as createPixelFeatureSetCursor,C as fetchPixelFeatureSet,E as identifyAveragePixelValue,D as readIntersectingPixels};
2
+ 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{getByteCount as o}from"../formats/pixelRangeUtils.js";import{convertPixelSize as r,snapToRaster as a,clip as s}from"../functions/clipUtils.js";import{transformPixels as l}from"../functions/pixelTransformUtils.js";import{mapPixelValueToAttribute as c,mosaic as p,pixelIdFieldName as u,convertPixelBlockToFeatures as f,getValidPixels as m,countCategoricalPixels as x}from"../functions/pixelUtils.js";import{load as d,projectPolygon as h}from"../functions/rasterProjectionHelper.js";import{computeBoxStatistics as y,computeStatisticsHistograms as w}from"../functions/stretchUtils.js";import g from"../../support/Field.js";import S from"../../support/PixelBlock.js";import{getBandNames as k}from"../../../renderers/support/rasterRendererHelper.js";import b from"../../../rest/support/ImageIdentifyParameters.js";const z=2**30,B=2048,P=2**20,I=20,R=100;async function j(e,t){return"imagery"===e.type?await e.generateRasterInfo(e.rasterFunction,t):e.raster.rasterInfo}function v(e){const{rasterInfo:t,geometry:i,pixelSize:o,downsampleOnly:s=!1,maxPixelCountForDownsample:l}=e;if(!o)return!0;if(!s)return!1;const c=r(o,t.spatialReference);if(c.x+c.y<=t.pixelSize.x+t.pixelSize.y)return!0;if(null==l)return!1;const p="polyline"===i?.type?i.extent:i??t.extent,u=new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference}),f=a(t,p,u);return f.width*f.height<=l}function T(e){const t=[new g({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 g({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<I){const e=(await import("../../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"})/R;t=(await import("../../../geometry/operators/densifyOperator.js")).execute(t,e,{unit:"meters"}),await d(),t=h(t,i)}return t}async function M(e,t,i=!1){const{spatialReference:o}=e,r=t?.geometry,s=await F(r??e.extent,o),l="extent"===s.type?s:s.extent,c=null==r||"extent"===r.type&&r.spatialReference.equals(o)?void 0:s,p=new n({x:e.pixelSize.x,y:e.pixelSize.y,spatialReference:o}),u=!!t?.autoResample,f=u?p:t?.pixelSize??p;let{extent:m,width:x,height:d}=a(e,l,f);if(!u)return{extent:m,clipGeometry:c,width:x,height:d,pixelSize:f};const h=e.storageInfo?.pyramidScalingFactor??2;let{x:y,y:w}=f;const g=t?.maxPixelCount??P;for(;x*d>g&&(!i||Math.max(x,d)>1024);)y*=h,w*=h,x/=h,d/=h;return x=Math.round(x),d=Math.round(d),{extent:m,clipGeometry:c,width:x,height:d,pixelSize:new n({x:y,y:w,spatialReference:o})}}async function*C(e,n,o=!1,r){const{extent:a,clipGeometry:l,width:c,height:p}=n,u=a.width/c,f=a.height/p,m=Math.ceil(c/B),x=Math.ceil(p/B),d=u*B,h=f*B,{xmin:y,xmax:w,ymin:g,ymax:S}=a,k=x*m,b={bandIds:n.bandIds?.length?n.bandIds:void 0,interpolation:"nearest",...r};for(let z=0;z<x;z++)for(let n=0;n<m;n++){t(b);const r=new i({xmin:y+n*d,xmax:o?Math.min(w,y+(n+1)*d):y+(n+1)*d,ymax:S-z*h,ymin:o?Math.max(g,S-(z+1)*h):S-(z+1)*h,spatialReference:a.spatialReference}),c={row:z,col:n},p=z*m+n+1;if(l&&!r.intersects(l)){yield{extent:r,pixelBlock:null,id:c,total:k,current:p};continue}const x=o?Math.round(r.width/u):B,P=o?Math.round(r.height/f):B;let{pixelBlock:I}=await e.fetchPixels(r,x,P,b).catch(()=>({pixelBlock:void 0}));I&&l&&(I=await s(I,r,l)),yield{extent:r,pixelBlock:I,id:c,total:k,current:p}}}async function*O(e,i,n){const o=await j(e,n),r=T(o),a={...i,geometry:i?.geometry??o.extent},s=C(e,await M(o,a),!0,n),l=o.width;for await(const c of s){if(!c.pixelBlock){yield{...c};continue}const a=Q(e),{pixelBlock:s}=c,{statistics:p,histograms:u}=await V({pixelBlock:s,rasterJobHandler:a},n),f=c;f.statistics=p,f.histograms=u;const m=c.id.row*o.width*B+c.id.col*B;t(n),f.featureSet=await $({pixelBlock:s,extent:c.extent,fields:r,skipFactor:i?.skipFactor??1,rasterJobHandler:a,pixelIdOffset:m,imageRowSize:l},n),t(n),yield f}}function H(t,i,n){const r=o(i),{width:a,height:s}=t;if(a*s*r>z)throw new e("fetch-pixels","failed to fetch pixels as pixel byte count exceeds the 1GB limit");if(n&&a*s>n)throw new e("fetch-pixels",`failed to fetch pixels as pixel count exceeds the ${n} limit`)}async function D(t,i,n){if(!i.geometry)throw new e("fetch-pixels","geometry is required to fetch pixel feature set");const o=await j(t),r=await M(o,i,!0);H(r,o.pixelType);const{extent:a,pixelSize:s}=r,l=Math.round(o.extent.width/s.x),c=T(o),p={fields:c,features:[]},u=p.features,{maxPixelCount:f}=i,m=!!i.autoResample&&null!=f&&r.width*r.height>f,x=m?1:i.skipFactor??1,d=r.width<=B||r.height<=B,h=C(t,r,1===x||d,n);for await(const e of h){if(!e.pixelBlock)continue;const i=Q(t),r=Math.floor((o.extent.ymax-e.extent.ymax)/s.y)*l+Math.floor((e.extent.xmin-o.extent.xmin)/s.x),a=await $({pixelBlock:e.pixelBlock,extent:e.extent,fields:c,skipFactor:x,rasterJobHandler:i,pixelIdOffset:r,imageRowSize:l},n);if(a?.features?.length){const{features:e}=a,t=e.length;for(let i=0;i<t;i++){const t=e.pop();u.push(t)}}}if(m&&f){const e=f/(i.skipFactor??1)**2;if(u.length>e){const t=u.length/e,i=[...u],n=u.length-1;u.length=0;for(let o=0,r=0;o<e-1;o++){r+=t;const e=Math.round(r);e<n&&u.push(i[e])}}}return{extent:a,featureSet:p,pixelSize:s}}async function J(e,t,i){const{geometry:n}=t;if("multipoint"===n.type)return q(e,n,i);if("polyline"===n.type)return A(e,n,i);const o=await X(e,{geometry:n},i);if(!o)return null;return y(o)}async function q(e,t,i){const n=await j(e,i),o=t.points.map((e,i)=>t.getPoint(i)).map(t=>N(e,t,i)),r=(await Promise.all(o)).filter(e=>null!=e);if(r.length<=1)return U(r[0]);const a=r[0].map((e,t)=>r.map(e=>e[t]));return y(new S({pixels:a,pixelType:n.pixelType}))}async function N(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 U(e){return e?.map(e=>({min:e,max:e,avg:e,median:e,quartile1:e,quartile3:e}))}async function A(e,t,i){const n=await K(e,{geometry:t},i),o=await j(e,i),{bandCount:r,pixelType:a}=o,s=new Array(r).fill(0).map(()=>S.createEmptyBand(a,n.length));let l=0;for(let c=0;c<n.length;c++){const e=n[c];if(null!=e.value){l++;for(let t=0;t<r;t++)s[t][c]=e.value[t]}}l!==n.length&&s.forEach((e,t)=>{s[t]=e.subarray(0,l)});return y(new S({pixels:s,pixelType:a}))}async function E(t,i,n){const o=await j(t,n);if(!o.attributeTable||!o.pixelType.startsWith("u"))return null;const r=o.attributeTable.clone(),a=r.fields.find(e=>"value"===e.name.toLowerCase()),s=r.fields.find(e=>"count"===e.name.toLowerCase());if(!a||!s)throw new e("compute-attribute-table","Value or count field not found in attribute table");const l=2**Number(o.pixelType.slice(1)),c=new Uint32Array(l),{geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m}=i,d=v({rasterInfo:o,geometry:p,pixelSize:u,downsampleOnly:f,maxPixelCountForDownsample:m})?void 0:u;return await _(t,{geometry:p,pixelSize:d},(e,t)=>x(e,c),n),r.features.forEach(e=>{const t=e.attributes[a.name];e.attributes[s.name]=c[t]}),r}async function G(e,t,i){const{geometry:n}=t;if("point"===n.type)return N(e,n,i);if("multipoint"===n.type){const t=n.points.map((e,t)=>n.getPoint(t)).map(t=>N(e,t,i)),o=(await Promise.all(t)).filter(e=>null!=e);if(0===o.length)return null;return W(o).map(e=>e/o.length)}const o=await _(e,{geometry:n},(e,t)=>L(e),i),r=o?.filter(e=>e.count>0);if(!r?.length)return null;const a=W(r.map(e=>e.bandSum)),s=r.map(e=>e.count).reduce((e,t)=>e+t);return a.map(e=>e/s)}function W(e){return e.reduce((e,t)=>e.map((e,i)=>e+t[i]))}function L(e){const{width:t,height:i,pixels:n,mask:o}=e,r=new Array(n.length).fill(0);let a=0;for(let s=0;s<i;s++)for(let e=0;e<t;e++){const i=s*t+e;if(!o||o[i]){for(let e=0;e<n.length;e++)r[e]+=n[e][i];a++}}return{bandSum:r,count:a}}async function K(e,t,i){const n=await _(e,{geometry:t.geometry},m,i);return n?.flat()??[]}async function _(i,n,o,r){const a=i.spatialReference;let{geometry:l}=n;if("polyline"===l.type&&!l.spatialReference.equals(a)){const t=(await import("../../../geometry/operators/projectOperator.js")).execute(l,a);if(null==t)throw new e("read-pixels","failed to fetch pixels");l=t}const c="polyline"===l.type?l.extent:l,p=await F(c,a),u="polyline"===l.type?l:p,f=await j(i,r),m={geometry:p,autoResample:!1,pixelSize:n?.pixelSize},x=[],d=C(i,await M(f,m),!0,r);for await(const e of d){if(!e.pixelBlock)continue;const{extent:i}=e,n=o(await s(e.pixelBlock,i,u),i);x.push(n),t(r)}return x}async function V(e,t){const{rasterJobHandler:i}=e,{pixelBlock:n}=e,{statistics:o,histograms:r}=i?await i.computeStatisticsHistograms({pixelBlock:n},t):w(n);return{statistics:o,histograms:r}}async function $(e,t){const{extent:i,fields:n,skipFactor:o,rasterJobHandler:r,pixelIdOffset:a,imageRowSize:s}=e,{pixelBlock:l}=e,c=n.map(({name:e})=>e),p=r?await r.convertPixelBlockToFeatures({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s},t):f({pixelBlock:l,extent:i,fieldNames:c,skipFactor:o,pixelIdOffset:a,imageRowSize:s});return p?{fields:n,features:p}:void 0}function Q(e){return"_rasterJobHandler"in e?e._rasterJobHandler:null}async function X(e,t,i){const n=await j(e);t={...t,maxPixelCount:t.maxPixelCount??2**28};const o=await M(n,t);o.bandIds=t.bandIds?.length?t.bandIds:void 0,H(o,n.pixelType,t.maxPixelCount);const{width:r,height:a}=o;if(r<=B&&a<=B){const t=o.bandIds?.length?o.bandIds:void 0,{pixelBlock:n}=await e.fetchPixels(o.extent,r,a,{bandIds:t,interpolation:"nearest",...i});return n}const s=[],l=C(e,o,!1,i);for await(const p of l)s.push(p.pixelBlock);if(!s.some(e=>null!=e))return null;const c=Math.ceil(r/B),u=Math.ceil(a/B),f={width:c*B,height:u*B};let m;const x=Q(e);if(x){const e=await x.mosaicAndTransform({srcPixelBlocks:s,srcMosaicSize:f,destDimension:f},{...i,transferPixelsToWorker:!0});m=e?.pixelBlock}else m=p(s,f);return m}async function Y(t,i,n){if(!i.geometry)throw new e("compute-statistics-histograms","geometry is required to fetch pixel feature set");const{pixelSize:o,downsampleOnly:r,maxPixelCountForDownsample:a}=i,s=await j(t,n),p=v({rasterInfo:s,geometry:i.geometry,pixelSize:o,downsampleOnly:r,maxPixelCountForDownsample:a})?void 0:o;let u=await X(t,{...i,pixelSize:p},n);if(!u)throw new e("compute-statistics-histograms","failed to get intersecting pixels");const{valueAttributeFieldName:f}=i;f&&"value"!==f.toLowerCase()&&(u=c(u,s,f));const m=Q(t),{transformType:x}=i;if(x){const e={lambda:i.lambda,shift:i.shift};u=m?await m.transformPixels({pixelBlock:u,transformType:x,transformParameters:e},{...n,transferPixelsToWorker:!0}):l(u,x,e)}const d=i.histogramSize??void 0;return m?await m.computeStatisticsHistograms({pixelBlock:u,histogramSize:d,includeSkewnessKurtosis:!0},{...n,transferPixelsToWorker:!0}):w(u,{histogramSize:d,includeSkewnessKurtosis:!0})}export{J as computeBoxStatistics,E as computeRasterAttributeTable,Y as computeStatisticsHistograms,O as createPixelFeatureSetCursor,D as fetchPixelFeatureSet,G as identifyAveragePixelValue,K as readIntersectingPixels};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),l=new t;l.parse(s);const{width:o,height:a,numComponents:i,eof:f}=l,h=l.getData(o,a,!0),c=o*a;let u,g=null;if(n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);let r=0;for(let e=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===o*a){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let e=0;e<3;e++)u.push(new Uint8Array(c));let t=0;for(let e=0;e<c;e++)for(let r=0;r<3;r++)u[r][e]=h[t++]}return{width:o,height:a,pixels:u,mask:g}}}export{r as default};
2
+ import{J as t}from"../../../chunks/Jpg.js";import{F as e}from"../../../chunks/Zlib.js";class r{static decode(r,n=!1){const s=new Uint8Array(r),o=new t;o.parse(s);const{width:a,height:l,numComponents:i,eof:f}=o,h=o.getData(a,l,1!==i),c=a*l;let u,g=null;if(n&&f<s.length-1)try{const t=new e(s.subarray(f)).getBytes();g=new Uint8Array(c);for(let e=0,r=0;e<t.length;e++)for(let n=7;n>=0;n--)g[r++]=t[e]>>n&1}catch{}if(1===i&&h.length===a*l){const t=new Uint8Array(h.buffer);u=[t,t,t]}else{u=[];for(let t=0;t<3;t++)u.push(new Uint8Array(c));for(let t=0,e=0;t<c;t++)for(let r=0;r<3;r++)u[r][t]=h[e++]}return{width:a,height:l,pixels:u,mask:g}}}export{r as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as h}from"./pixelRangeUtils.js";import{F as c}from"../../../chunks/Zlib.js";import{load as l,decode as p}from"./Qb3.js";import d from"./Raw.js";import{decodeTileOrStrip as u,decode as f}from"./TiffDecoder.js";import{isPlatformLittleEndian as m}from"./utils.js";import w from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";var y=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,u;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(u=this.colorType)||6===u,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,l,p,d,u,f,m,w,g,y,x,b,k,v,T,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new c(t)).getBytes(),g=(u=this.pixelBitlength/8)*this.width,f=new Uint8Array(g*this.height),n=t.length,w=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<g;s=b+=1)f[a++]=t[m++];break;case 1:for(s=k=0;k<g;s=k+=1)e=t[m++],r=s<u?0:f[a-u],f[a++]=(e+r)%256;break;case 2:for(s=v=0;v<g;s=v+=1)e=t[m++],i=(s-s%u)/u,y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(y+e)%256;break;case 3:for(s=T=0;T<g;s=T+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],y=w&&f[(w-1)*g+i*u+s%u],f[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<g;s=C+=1)e=t[m++],i=(s-s%u)/u,r=s<u?0:f[a-u],0===w?y=x=0:(y=f[(w-1)*g+i*u+s%u],x=i&&f[(w-1)*g+(i-1)*u+s%u]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),l=h<=p&&h<=d?r:p<=d?y:x,f[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}w++}return f},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);const x=new Set(["jpg","png","bmp","gif"]);async function b(e,a){if(!m)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{offset:i}=a,{width:s,height:o,pixelType:h,statistics:c,depthCount:l,noDataValues:p,bandMasks:d,pixels:u,mask:f,validPixelCount:y}=n(e,{inputOffset:i,returnInterleaved:a.returnInterleaved}),x=new w({width:s,height:o,pixelType:h.toLowerCase(),pixels:u,mask:f,validPixelCount:y,statistics:c.map(({minValue:t,maxValue:e})=>new g(t,e)),bandMasks:d,depthCount:l,noDataValues:p});return c?.length||a.skipStatistics||x.updateStatistics(),x}async function k(e,a){await l();const i=p(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n,pixelType:o}=i,h=new w({width:s,height:r,pixelType:o,pixels:n});return a.skipStatistics||h.updateStatistics(),h}async function v(t,a){const i=await f(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);const s=new w({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks,statistics:null});return a.skipStatistics||s.updateStatistics(),s}async function T(t,e){const a=await u(t,e.customOptions),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask,statistics:null});return e.skipStatistics||i.updateStatistics(),i}function C(t,e){const a=e.pixelType||"u8",i=w.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let h=0;h<n;h++){const a=(e.width||1)*(e.height||t.length),o=new i(a);for(let t=0;t<a;t++)o[t]=s[t*n+h];r.push(o)}const o=new w({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a,statistics:null});return e.skipStatistics||o.updateStatistics(),o}function I(t,e){return C(new c(new Uint8Array(t)).getBytes(),e)}function U(t,e){return C(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function A(t,e,a){const{pixelTypeCtor:i}=M(e.pixelType),s=(0,d.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a}),r=new w({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask,statistics:null});return e.skipStatistics||r.updateStatistics(),r}function D(t,e){const a=s.decode(t,e.applyJpegMask),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask,statistics:null});return e.skipStatistics||i.updateStatistics(),i}function S(t,e){const a=new Uint8Array(t),i=new y(a),{width:s,height:r}=e,n=s*r,o=i.decode(),h=new Uint8Array(n);for(let l=0;l<n;l++)h[l]=o[4*l+3];const c=new w({width:s,height:r,pixels:[],pixelType:"u8",mask:h,statistics:[]});for(let l=0;l<3;l++){const t=new Uint8Array(n);for(let e=0;e<n;e++)t[e]=o[4*e+l];c.addData({pixels:t})}return e.skipStatistics||c.updateStatistics(),c}async function P(t,e,a,s){const r={...a,format:e},n=await i(t,r,s),o=new w(n);return a.skipStatistics||o.updateStatistics(),o}function j(e){if(null==e)throw new t("rasterCodec:decode","parameter encodeddata is required.");const a=new Uint8Array(e,0,10);let i="";return 255===a[0]&&216===a[1]?i="jpg":137===a[0]&&80===a[1]&&78===a[2]&&71===a[3]?i="png":67===a[0]&&110===a[1]&&116===a[2]&&90===a[3]&&73===a[4]&&109===a[5]&&97===a[6]&&103===a[7]&&101===a[8]&&32===a[9]?i="lerc":76===a[0]&&101===a[1]&&114===a[2]&&99===a[3]&&50===a[4]&&32===a[5]?i="lerc2":73===a[0]&&73===a[1]&&42===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&42===a[3]||73===a[0]&&73===a[1]&&43===a[2]&&0===a[3]||77===a[0]&&77===a[1]&&0===a[2]&&43===a[3]?i="tiff":71===a[0]&&73===a[1]&&70===a[2]?i="gif":66===a[0]&&77===a[1]?i="bmp":81===a[0]&&66===a[1]&&51===a[2]?i="qb3":String.fromCharCode.apply(null,a).toLowerCase().includes("error")&&(i="error"),i}function O(e){let a=null;switch(e){case"lerc":case"lerc2":a=b;break;case"jpg":a=D;break;case"png":a=S;break;case"bsq":case"bip":a=(t,a)=>A(t,a,e);break;case"tiff":a=v;break;case"deflate":a=I;break;case"lzw":a=U;break;case"qb3":a=k;break;case"error":a=()=>{throw new t("rasterCodec:decode","input data contains error")};break;default:a=()=>{throw new t("rasterCodec:decode","unsupported raster format")}}return a}function M(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function L(t,e=1){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=i-1,o=s-1,h=[];let c=null;const l=w.getPixelArrayConstructor(t.pixelType);if(0===e){for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let i=0;i<n;i++)e[a*n+i]=t[s+i]}h.push(e)}if(null!=r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=r[e+a]}}}else{for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let r=0;r<n;r++)e[a*n+r]=(t[s+r]+t[s+r+1]+t[s+i+r]+t[s+i+r+1])/4}h.push(e)}if(r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=Math.min.apply(null,[r[e+a],r[e+a+1],r[e+i+a],r[e+i+a+1]])}}}t.width=n,t.height=o,t.mask=c,t.pixels=h}function R(t){let e=j(t);return"lerc2"===e?e="lerc":"error"===e&&(e=""),e}async function B(e,i={},s){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let r=i.format?.toLowerCase();if(!("bsq"!==r&&"bip"!==r||null!=i.width&&null!=i.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===r&&i.customOptions)return T(e,i);if((!r||"bsq"!==r&&"bip"!==r&&"deflate"!==r&&"lzw"!==r)&&(r=j(e)),"no-canvas"!==i.canvasUsage&&x.has(r))try{return await P(e,r,i,s)}catch(l){if(a(l))throw l;if("canvas-only"===i.canvasUsage)throw new t("rasterCodec:decode",`failed to decode the input data with canvas for format ${r}`)}const n=O(r);let o;i.isPoint&&(null!=(i={...i}).width&&i.width++,null!=i.height&&i.height++);const{offsets:c}=i;if(c&&c.length>1){const t=c.map((t,a)=>n(e.slice(t,c[a+1]),i)),a=await Promise.all(t);o=a[0],o.pixels=a.map(t=>t.pixels[0]);const s=a.map(t=>t.mask);a.some(t=>null!=t)&&(s.forEach((t,e)=>{null==t&&(s[e]=new Uint8Array(o.width*o.height).fill(255))}),o.bandMasks=s,o.mask=w.combineBandMasks(s)),o.updateStatistics()}else o=await n(e,{...i,offset:c?.[0]??i.offset});return"jpg"!==r&&null!=i.noDataValue&&1===o.depthCount&&h(o,i.noDataValue,{customFloatTolerance:i.tolerance}),i.isPoint&&L(o),o}export{B as decode,R as getFormat};
2
+ import t from"../../../core/Error.js";import{assertIsSome as e}from"../../../core/maybe.js";import{isAbortError as a}from"../../../core/promiseUtils.js";import{decode as i}from"./ImageCanvasDecoder.js";import s from"./JpgPlus.js";import{load as r,decode as n}from"./Lerc.js";import{decode as o}from"./Lzw.js";import{convertNoDataToMask as h}from"./pixelRangeUtils.js";import{F as c}from"../../../chunks/Zlib.js";import{load as l,decode as p}from"./Qb3.js";import d from"./Raw.js";import{decodeTileOrStrip as f,decode as u}from"./TiffDecoder.js";import{isPlatformLittleEndian as m}from"./utils.js";import w from"../../support/PixelBlock.js";import g from"../../support/SimpleBandStatistics.js";var y=function(t){var e,a,i,s,r,n;function o(t){var e,a,i,s,r,n,o,h,c,l,p,d,f;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},r=null;;){switch(e=this.readUInt32(),h=function(){var t,e;for(e=[],t=0;t<4;++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join(""),h){case"IHDR":this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++];break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":r&&this.animation.frames.push(r),this.pos+=4,r={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},s=this.readUInt16(),i=this.readUInt16()||100,r.delay=1e3*s/i,r.disposeOp=this.data[this.pos++],r.blendOp=this.data[this.pos++],r.data=[];break;case"IDAT":case"fdAT":for("fdAT"===h&&(this.pos+=4,e-=4),t=(null!=r?r.data:void 0)||this.imgData,p=0;0<=e?p<e:p>e;0<=e?++p:--p)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),(c=255-this.transparency.indexed.length)>0)for(d=0;0<=c?d<c:d>c;0<=c?++d:--d)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":n=(l=this.read(e)).indexOf(0),o=String.fromCharCode.apply(String,l.slice(0,n)),this.text[o]=String.fromCharCode.apply(String,l.slice(n+1));break;case"IEND":return r&&this.animation.frames.push(r),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(f=this.colorType)||6===f,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}return o.load=function(t,e,a){var i;return"function"==typeof e&&(a=e),(i=new XMLHttpRequest).open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t;return t=new o(new Uint8Array(i.response||i.mozResponseArrayBuffer)),"function"==typeof(null!=e?e.getContext:void 0)&&t.render(e),"function"==typeof a?a(t):void 0},i.send(null)},a=1,i=2,e=0,o.prototype.read=function(t){var e,a;for(a=[],e=0;0<=t?e<t:e>t;0<=t?++e:--e)a.push(this.data[this.pos++]);return a},o.prototype.readUInt32=function(){return this.data[this.pos++]<<24|this.data[this.pos++]<<16|this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.readUInt16=function(){return this.data[this.pos++]<<8|this.data[this.pos++]},o.prototype.decodePixels=function(t){var e,a,i,s,r,n,o,h,l,p,d,f,u,m,w,g,y,x,b,k,T,v,C;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=(t=new c(t)).getBytes(),g=(f=this.pixelBitlength/8)*this.width,u=new Uint8Array(g*this.height),n=t.length,w=0,m=0,a=0;m<n;){switch(t[m++]){case 0:for(s=b=0;b<g;s=b+=1)u[a++]=t[m++];break;case 1:for(s=k=0;k<g;s=k+=1)e=t[m++],r=s<f?0:u[a-f],u[a++]=(e+r)%256;break;case 2:for(s=T=0;T<g;s=T+=1)e=t[m++],i=(s-s%f)/f,y=w&&u[(w-1)*g+i*f+s%f],u[a++]=(y+e)%256;break;case 3:for(s=v=0;v<g;s=v+=1)e=t[m++],i=(s-s%f)/f,r=s<f?0:u[a-f],y=w&&u[(w-1)*g+i*f+s%f],u[a++]=(e+Math.floor((r+y)/2))%256;break;case 4:for(s=C=0;C<g;s=C+=1)e=t[m++],i=(s-s%f)/f,r=s<f?0:u[a-f],0===w?y=x=0:(y=u[(w-1)*g+i*f+s%f],x=i&&u[(w-1)*g+(i-1)*f+s%f]),o=r+y-x,h=Math.abs(o-r),p=Math.abs(o-y),d=Math.abs(o-x),l=h<=p&&h<=d?r:p<=d?y:x,u[a++]=(e+l)%256;break;default:throw new Error("Invalid filter algorithm: "+t[m-1])}w++}return u},o.prototype.decodePalette=function(){var t,e,a,i,s,r,n,o,h;for(a=this.palette,r=this.transparency.indexed||[],s=new Uint8Array((r.length||0)+a.length),i=0,a.length,t=0,e=n=0,o=a.length;n<o;e=n+=3)s[i++]=a[e],s[i++]=a[e+1],s[i++]=a[e+2],s[i++]=null!=(h=r[t++])?h:255;return s},o.prototype.copyToImageData=function(t,e){var a,i,s,r,n,o,h,c,l,p,d;if(i=this.colors,l=null,a=this.hasAlphaChannel,this.palette.length&&(l=null!=(d=this._decodedPalette)?d:this._decodedPalette=this.decodePalette(),i=4,a=!0),c=(s=t.data||t).length,n=l||e,r=o=0,1===i)for(;r<c;)h=l?4*e[r/4]:o,p=n[h++],s[r++]=p,s[r++]=p,s[r++]=p,s[r++]=a?n[h++]:this.transparency.grayscale&&this.transparency.grayscale===p?0:255,o=h;else for(;r<c;)h=l?4*e[r/4]:o,s[r++]=n[h++],s[r++]=n[h++],s[r++]=n[h++],s[r++]=a?n[h++]:this.transparency.rgb&&this.transparency.rgb[1]===n[h-3]&&this.transparency.rgb[3]===n[h-2]&&this.transparency.rgb[5]===n[h-1]?0:255,o=h},o.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},r=t.document&&t.document.createElement("canvas"),n=r&&r.getContext("2d"),s=function(t){var e;return n.width=t.width,n.height=t.height,n.clearRect(0,0,t.width,t.height),n.putImageData(t,0,0),(e=new Image).src=r.toDataURL(),e},o.prototype.decodeFrames=function(t){var e,a,i,r,n,o,h,c;if(this.animation){for(c=[],a=n=0,o=(h=this.animation.frames).length;n<o;a=++n)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,c.push(e.image=s(i));return c}},o.prototype.renderFrame=function(t,s){var r,n,o;return r=(n=this.animation.frames)[s],o=n[s-1],0===s&&t.clearRect(0,0,this.width,this.height),(null!=o?o.disposeOp:void 0)===a?t.clearRect(o.xOffset,o.yOffset,o.width,o.height):(null!=o?o.disposeOp:void 0)===i&&t.putImageData(o.imageData,o.xOffset,o.yOffset),r.blendOp===e&&t.clearRect(r.xOffset,r.yOffset,r.width,r.height),t.drawImage(r.image,r.xOffset,r.yOffset)},o.prototype.animate=function(t){var e,a,i,s,r,n,o=this;return a=0,n=this.animation,s=n.numFrames,i=n.frames,r=n.numPlays,(e=function(){var n,h;if(n=a++%s,h=i[n],o.renderFrame(t,n),s>1&&a/s<r)return o.animation._timeout=setTimeout(e,h.delay)})()},o.prototype.stopAnimation=function(){var t;return clearTimeout(null!=(t=this.animation)?t._timeout:void 0)},o.prototype.render=function(t){var e,a;return t._png&&t._png.stopAnimation(),t._png=this,t.width=this.width,t.height=this.height,e=t.getContext("2d"),this.animation?(this.decodeFrames(e),this.animate(e)):(a=e.createImageData(this.width,this.height),this.copyToImageData(a,this.decodePixels()),e.putImageData(a,0,0))},o}(self);async function x(e,a){if(!m)throw new t("rasterCoded:decode","lerc decoder is not supported on big endian platform");await r();const{width:i,height:s,pixelType:o,statistics:h,depthCount:c,noDataValues:l,bandMasks:p,pixels:d,mask:f,validPixelCount:u}=n(e,{inputOffset:a.offset,returnInterleaved:a.returnInterleaved});return new w({width:i,height:s,pixelType:o.toLowerCase(),pixels:d,mask:f,validPixelCount:u,statistics:h.map(({minValue:t,maxValue:e})=>new g(t,e)),bandMasks:p,depthCount:c,noDataValues:l})}async function b(e,a){await l();const i=p(e);if(!i)throw new t("rasterCodec:decode","failed to decode the input data.");const{width:s,height:r,pixels:n,pixelType:o}=i;return new w({width:s,height:r,pixelType:o,pixels:n})}async function k(t,a){const i=await u(t,{...a,noDataValue:a.tiffNoDataValue,matchAllNoData:a.matchAllNoData});e(i);return new w({width:i.width,height:i.height,pixels:i.pixels,pixelType:i.pixelType.toLowerCase(),mask:i.mask,bandMasks:i.bandMasks})}async function T(t,e){const a=await f(t,e.customOptions),i=new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:a.pixelType.toLowerCase(),mask:a.mask});return e.skipStatistics||i.updateStatistics(),i}function v(t,e){const a=e.pixelType||"u8",i=w.getPixelArrayConstructor(a),s="u8"===a?t:new i(t.buffer),r=[],n=e.planes||1;if(1===n)r.push(s);else for(let o=0;o<n;o++){const a=(e.width||1)*(e.height||t.length),h=new i(a);for(let t=0;t<a;t++)h[t]=s[t*n+o];r.push(h)}return new w({width:e.width||1,height:e.height||t.length,pixels:r,pixelType:a})}function C(t,e){return v(new c(new Uint8Array(t)).getBytes(),e)}function A(t,e){return v(o(t,e.offset,e.eof,!e.isInputBigEndian),e)}function I(t,e){const a=e.format,{pixelTypeCtor:i}=M(e.pixelType),s=(0,d.decode)(t,{width:e.width,height:e.height,pixelType:i,format:a});return new w({width:e.width,height:e.height,pixels:s.pixels,pixelType:e.pixelType,mask:s.mask})}function U(t,e){const a=s.decode(t,e.applyJpegMask);return new w({width:a.width,height:a.height,pixels:a.pixels,pixelType:"u8",mask:a.mask})}function D(t,e){const a=new Uint8Array(t),i=new y(a),{width:s,height:r}=e,n=s*r,o=i.decode(),h=new Uint8Array(n);for(let l=0;l<n;l++)h[l]=o[4*l+3];const c=new w({width:s,height:r,pixels:[],pixelType:"u8",mask:h});for(let l=0;l<3;l++){const t=new Uint8Array(n);for(let e=0;e<n;e++)t[e]=o[4*e+l];c.pixels.push(t)}return c}async function P(t,e,a){const s=await i(t,e,a);return new w(s)}async function j(e,i,s){const r=i.format||L(e),n={...i,format:r},{canvasUsage:o}=i;if("no-canvas"!==o)try{return await P(e,n,s)}catch(h){if(a(h))throw h;if("canvas-only"===o)throw new t("rasterCodec:decode",`failed to decode the input data with canvas for format ${r}`)}return"jpg"===r?U(e,n):D(e,n)}function O(e){let a=null;switch(e){case"lerc":a=x;break;case"jpg":case"png":a=j;break;case"bmp":case"gif":a=P;break;case"bsq":case"bip":a=I;break;case"tiff":a=k;break;case"deflate":a=C;break;case"lzw":a=A;break;case"qb3":a=b;break;default:a=()=>{throw new t("rasterCodec:decode",`unsupported raster format ${e}`)}}return a}function M(t){let e=null,a=null;switch(t?t.toLowerCase():"f32"){case"u1":case"u2":case"u4":case"u8":a=255,e=Uint8Array;break;case"u16":a=a||65535,e=Uint16Array;break;case"u32":a=a||2**32-1,e=Uint32Array;break;case"s8":a=a||-128,e=Int8Array;break;case"s16":a=a||-32768,e=Int16Array;break;case"s32":a=a||0-2**31,e=Int32Array;break;default:e=Float32Array}return{pixelTypeCtor:e,noDataValue:a}}function S(t,e="bilinear"){if(!t)return;const{pixels:a,width:i,height:s,mask:r}=t;if(!a||0===a.length)return;const n=i-1,o=s-1,h=[];let c=null;const l=w.getPixelArrayConstructor(t.pixelType);if("nearest"===e){for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let i=0;i<n;i++)e[a*n+i]=t[s+i]}h.push(e)}if(null!=r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=r[e+a]}}}else{for(const t of a){const e=new l(n*o);for(let a=0;a<o;a++){const s=a*i;for(let r=0;r<n;r++)e[a*n+r]=(t[s+r]+t[s+r+1]+t[s+i+r]+t[s+i+r+1])/4}h.push(e)}if(r){c=new Uint8Array(n*o);for(let t=0;t<o;t++){const e=t*i;for(let a=0;a<n;a++)c[t*n+a]=Math.min.apply(null,[r[e+a],r[e+a+1],r[e+i+a],r[e+i+a+1]])}}}t.width=n,t.height=o,t.mask=c,t.pixels=h}function L(t){if(!t)return;const e=new Uint8Array(t,0,10);let a;return 255===e[0]&&216===e[1]?a="jpg":137===e[0]&&80===e[1]&&78===e[2]&&71===e[3]?a="png":67===e[0]&&110===e[1]&&116===e[2]&&90===e[3]&&73===e[4]&&109===e[5]&&97===e[6]&&103===e[7]&&101===e[8]&&32===e[9]||76===e[0]&&101===e[1]&&114===e[2]&&99===e[3]&&50===e[4]&&32===e[5]?a="lerc":73===e[0]&&73===e[1]&&42===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&42===e[3]||73===e[0]&&73===e[1]&&43===e[2]&&0===e[3]||77===e[0]&&77===e[1]&&0===e[2]&&43===e[3]?a="tiff":71===e[0]&&73===e[1]&&70===e[2]?a="gif":66===e[0]&&77===e[1]?a="bmp":81===e[0]&&66===e[1]&&51===e[2]&&(a="qb3"),a}async function R(e,a={},i){if(null==e)throw new t("rasterCodec:decode","missing encodeddata parameter.");let s=a.format?.toLowerCase();if(!("bsq"!==s&&"bip"!==s||null!=a.width&&null!=a.height))throw new t("rasterCodec:decode","requires width and height in options parameter.");if("tiff"===s&&a.customOptions)return T(e,a);if(!s||"bsq"!==s&&"bip"!==s&&"deflate"!==s&&"lzw"!==s){if(s=L(e),!s){throw String.fromCharCode.apply(null,[...new Uint8Array(e,0,10)]).toLowerCase().includes("error")?new t("rasterCodec:decode","input data contains error"):new t("rasterCodec:decode","unsupported raster format")}a={...a,format:s}}const r=O(s);let n;a.isPoint&&(null!=(a={...a}).width&&a.width++,null!=a.height&&a.height++);const{offsets:o}=a;if(o&&o.length>1){const t=o.map((t,s)=>r(e.slice(t,o[s+1]),a,i)),s=await Promise.all(t);n=s[0],n.pixels=s.map(t=>t.pixels[0]);const h=s.map(t=>t.mask);h.some(t=>null!=t)&&(h.forEach((t,e)=>{h[e]??=new Uint8Array(n.width*n.height).fill(255)}),n.bandMasks=h,n.mask=w.combineBandMasks(h))}else n=await r(e,{...a,offset:o?.[0]??a.offset},i);return"jpg"!==s&&null!=a.noDataValue&&1===n.depthCount&&h(n,a.noDataValue,{customFloatTolerance:a.tolerance}),a.isPoint&&S(n),n.statistics?.length||a.skipStatistics||n.updateStatistics(),n}export{R as decode,L as getFormat};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../../support/PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:u}=n,M=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,u),T=.5*h,k=.5*x;if(w-M<T||g-d<k||w<m+T||M>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(M-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),u=Math.max(0,Math.floor((s-y)/x)),M=Math.min(r-1,Math.floor((s-c)/x));if(!(M<u))if(u===M){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=u*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=u;n<=M;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:u}=p;const{xmin:M,ymax:w}=t.extent;return r?(f=M+(f>M?h*Math.round((f-M)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=M+(c>M?h*Math.round((c-M)/h):0),u=w-(u<w?x*Math.round((w-u)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-u)/x+.8),f=M+(f>M?h*Math.floor((f-M)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,u=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,p as snapToRaster};
2
+ import{getMetersPerUnitForSR as t}from"../../../core/units.js";import e from"../../../geometry/Extent.js";import n from"../../../geometry/Point.js";import i from"../../support/PixelBlock.js";function a(e,n){if(e.spatialReference.equals(n))return e;const i=t(e.spatialReference),a=t(n);if(i===a)return e;const r=i/a;return{x:e.x*r,y:e.y*r}}async function r(t,e,n){if("extent"===n.type)return m(t,e,n);const{width:a,height:r}=t,h=new Uint8Array(a*r);if(!(await import("../../../geometry/operators/intersectsOperator.js")).execute(e,n))return new i({pixelType:t.pixelType,width:a,height:r,mask:h,maskIsAlpha:!1,pixels:[...t.pixels]});if("polyline"===n.type)return s(t,e,n);return(await import("../../../geometry/operators/containsOperator.js")).execute(n,e)?t:o(t,e,n)}function o(t,e,n){if(!t)return t;const{width:a,height:r}=t,o=h({geometry:n,size:[a,r],srcExtent:e,srcMask:t.mask});return new i({pixelType:t.pixelType,width:a,height:r,mask:o,maskIsAlpha:!1,pixels:[...t.pixels]})}function h(t){const{geometry:e,size:n,srcExtent:i,srcMask:a}=t,[r,o]=n;let h;const m=i.width/r,s=i.height/o,{xmin:l,ymax:p}=i;if("extent"===e.type){const t=(e.xmin-l)/m,n=(e.xmax-l)/m,i=(p-e.ymax)/s,a=(p-e.ymin)/s;h=[[[t,i],[t,a],[n,a],[n,i],[t,i]]]}else h=e.rings.map(t=>t.map(([t,e])=>[(t-l)/m,(p-e)/s]));return x(h,n,a)}function x(t,e,n){const[i,a]=e,r=new OffscreenCanvas(i,a).getContext("2d");r.fillStyle="#f00",r.beginPath(),t.forEach(t=>{r.moveTo(t[0][0],t[0][1]);for(let e=0;e<t.length;e++)r.lineTo(t[e][0],t[e][1]);r.closePath()}),r.fill();const o=r.getImageData(0,0,i,a).data,h=i*a,x=new Uint8Array(h);let m=!1;for(let s=0;s<h;s++)n&&!n[s]||(o[4*s+3]>127?x[s]=255:m=!0);return m||n?x:void 0}function m(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r;if(n.width/h<.5||n.height/x<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const{xmin:m,xmax:s,ymin:l,ymax:p}=e,{xmin:f,xmax:c,ymin:y,ymax:u}=n,M=Math.max(m,f),w=Math.min(s,c),d=Math.max(l,y),g=Math.min(p,u),T=.5*h,k=.5*x;if(w-M<T||g-d<k||w<m+T||M>s-T||d>p-k||g<l+k)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});const R=Math.max(0,(M-m)/h),j=Math.min(a,Math.max(0,(w-m)/h)),A=Math.max(0,(p-g)/x),z=Math.min(r,Math.max(0,(p-d)/x)),E=Math.round(R),P=Math.round(j)-1,S=Math.round(A),U=Math.round(z)-1;if(E===P&&R%1>.5&&j%1<.5||S===U&&A%1>.5&&z%1<.5)return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]});if(0===E&&0===S&&P===a&&U===r)return t;const v=t.mask;for(let i=S;i<=U;i++)for(let t=E;t<=P;t++){const e=i*a+t;o[e]=v?v[e]:255}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function s(t,e,n){const{width:a,height:r}=t,o=new Uint8Array(a*r),h=e.width/a,x=e.height/r,{xmin:m,ymax:s}=e,{paths:l}=n,p=t.mask;for(let i=0;i<l.length;i++){const t=l[i];for(let e=0;e<t.length-1;e++){const[n,i]=t[e],[l,f]=t[e+1],c=Math.min(i,f),y=Math.max(i,f),u=Math.max(0,Math.floor((s-y)/x)),M=Math.min(r-1,Math.floor((s-c)/x));if(!(M<u))if(u===M){const t=Math.min(n,l),e=Math.max(n,l),i=Math.max(0,Math.floor((t-m)/h)),r=Math.min(a-1,Math.floor((e-m)/h));if(r<i)continue;const x=u*a;for(let n=x+i;n<=x+r;n++)o[n]=p?p[n]:255}else{const t=(n-m)/h,e=(l-n)/(f-i)/h,r=x*e;for(let n=u;n<=M;n++){const h=e*(s-n*x-i)+t,m=Math.max(0,Math.floor(r>0?h-r:h)),l=Math.min(a-1,Math.floor(r>0?h:h-r));if(l<m)continue;const f=n*a;for(let t=f+m;t<=f+l;t++)o[t]=p?p[t]:255}}}}return new i({pixelType:t.pixelType,width:a,height:r,mask:o,pixels:[...t.pixels]})}function l(t,e){const{extent:i}=p(t,e,new n({x:t.pixelSize.x,y:t.pixelSize.y,spatialReference:t.spatialReference})),{extent:a}=t.extent;if(i.xmax=Math.min(i.xmax,a.xmax),i.ymax=Math.min(i.ymax,a.ymax),i.xmin<i.xmax&&i.ymin<i.ymax){const{x:e,y:n}=t.pixelSize,a=Math.round(i.width/e),r=Math.round(i.height/n);t.extent=i,t.width=a,t.height=r}}function p(t,n,i,r=!0){const{spatialReference:o}=t,{x:h,y:x}=a(i,o);let m,s,l;const p="extent"===n.type?n:n.extent;let{xmin:f,xmax:c,ymax:y,ymin:u}=p;const{xmin:M,ymax:w}=t.extent;return r?(f=M+(f>M?h*Math.round((f-M)/h):0),y=w-(y<w?x*Math.round((w-y)/x):0),c=M+(c>M?h*Math.round((c-M)/h):0),u=w-(u<w?x*Math.round((w-u)/x):0),m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o}),s=Math.round(m.width/h),l=Math.round(m.height/x)):(s=Math.floor((c-f)/h+.8),l=Math.floor((y-u)/x+.8),f=M+(f>M?h*Math.floor((f-M)/h+.1):0),y=w-(y<w?x*Math.floor((w-y)/x+.1):0),c=f+s*h,u=y-l*x,m=new e({xmin:f,ymax:y,xmax:c,ymin:u,spatialReference:o})),{extent:m,width:s,height:l}}export{r as clip,l as clipRasterInfo,h as convertGeometryToMask,a as convertPixelSize,p as snapToRaster};
@@ -52,7 +52,8 @@ export default class AggregateField extends JSONSupport {
52
52
  constructor(properties?: AggregateFieldProperties);
53
53
  /**
54
54
  * The display name that describes the aggregate field in the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/),
55
- * [Popup](https://developers.arcgis.com/javascript/latest/map-components/arcgis-popup/), and other UI elements.
55
+ * [Popup](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-popup/), and
56
+ * other UI elements.
56
57
  *
57
58
  * @example aggregateField.alias = "Total population";
58
59
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{property as o,subclass as r}from"../../core/accessorSupport/decorators.js";import{parse as a}from"./arcgisLayerUrl.js";import l from"./Contingency.js";import u from"./ContingencyConstraintViolation.js";import c from"./ContingentValue.js";import p from"./ContingentValuesResult.js";import d from"./FieldGroup.js";import{isStringField as f,isDateField as y}from"./fieldUtils.js";import m from"./Subtype.js";import{getNormalizedFeatureTypeInfo as g}from"../../widgets/FeatureForm/featureFormUtils.js";var h;let V=h=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this.fieldGroupDefinitions=null}initialize(){}get loaded(){return super.loaded}get subtypeFieldName(){return g(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e,t){await e.load();const n=e.sourceJSON;if(void 0===e.layerId)return null;const i=n?.hasContingentValuesDefinition;if(i)return new h({layer:e}).load(t);if(void 0===i){const n=a(e.url);if(null==n)return null;const i=n.url.path;if((await C(i,t)).supportsQueryDataElements){const n=e.layerId.toString(),s=await x(i,n,t);if(s){const n=s.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))}));return new h({layer:e,fieldGroupDefinitions:n}).load(t)}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new u({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],c=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==c.length){for(const t of c){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new u({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new c({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=b(i);p[e]||a.push(i),p[e]=!0}}c&&(a=j(a)),o[l.name]=a,r=n?G(r,a):[]}return 1===a.length&&n&&(r=[]),new p({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return void(this.fieldGroups=[]);const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=a(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await v(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:C(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await x(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=a(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await S(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await F(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),p=new c({codedValue:u,objectType:"code"});r[s]=p}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new c({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new c({objectType:"any"});r[s]=e}else{const e=new c({objectType:"null"});r[s]=e}}return new l({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(f(n))s=t.stringDictionary[s];else if(y(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new c({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new c({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new c({objectType:"any"});r[i]=e}else{const e=new c({objectType:"null"});r[i]=e}}return new l({id:i,isRetired:s,subtype:o,values:r})});return new d({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=m.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=m.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?O(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function b(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function j(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new c({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new c({objectType:"range",minValue:t,maxValue:n})),i}function T(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new c({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new c({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new c({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new c({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new c({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function w(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function G(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?T(e,t):w(e,t)}async function v(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function x(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function C(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function F(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function S(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function O(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}e([o({constructOnly:!0})],V.prototype,"layer",void 0),e([o({constructOnly:!0})],V.prototype,"request",void 0),e([o({type:[d]})],V.prototype,"fieldGroups",void 0),e([o({constructOnly:!0})],V.prototype,"fieldGroupDefinitions",void 0),e([o()],V.prototype,"subtypeFieldName",null),V=h=e([r("esri.layers.support.LayerContingentValuesCache")],V);const D=V;export{D as default};
2
+ import{__decorate as e}from"tslib";import t from"../../request.js";import{isSome as n}from"../../core/arrayUtils.js";import{JSONSupportMixin as i}from"../../core/JSONSupport.js";import{Loadable as s}from"../../core/Loadable.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{throwIfAborted as r,isAborted as a,createAbortError as l}from"../../core/promiseUtils.js";import{addMany as u}from"../../core/SetUtils.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{parse as d}from"./arcgisLayerUrl.js";import f from"./Contingency.js";import y from"./ContingencyConstraintViolation.js";import m from"./ContingentValue.js";import g from"./ContingentValuesResult.js";import h from"./FieldGroup.js";import{isStringField as V,isDateField as b}from"./fieldUtils.js";import j from"./Subtype.js";import{getNormalizedFeatureTypeInfo as T}from"../../widgets/FeatureForm/featureFormUtils.js";var w;let G=w=class extends(i(s)){constructor(e){super(e),this.request=t,this.fieldGroups=null,this._relatedFieldsLookup=new Map,this.fieldGroupDefinitions=null}initialize(){}get loaded(){return super.loaded}get subtypeFieldName(){return T(this.layer).typeFieldName}static async createLoadedLayerContingentValuesCache(e,t){await e.load();const n=e.sourceJSON;if(r(t),void 0===e.layerId)return null;const i=n?.hasContingentValuesDefinition;if(i){const n=new w({layer:e});if(a(t))throw n.destroy(),l();return n.load(t)}if(void 0===i){const n=d(e.url);if(null==n)return null;const i=n.url.path,s=await D(i,t);if(r(t),s.supportsQueryDataElements){const n=e.layerId.toString(),s=await O(i,n,t);if(r(t),s){const n=s.map(t=>({name:t.name,isEditingRestrictive:t.isEditingRestrictive,fields:t.fieldNames.names.map(t=>e.fieldsIndex.normalizeFieldName(t))})),i=new w({layer:e,fieldGroupDefinitions:n});return r(t),i.load(t)}}}return null}async load(e){const t=this.layer.load(e).then(()=>this._initializeContingentValues(this.fieldGroupDefinitions,e));return this.addResolvingPromise(t),this}validateContingencyConstraints(e,t){const n=Object.keys(e),i=[],s=[];for(const o of this.fieldGroups){const r=o.isEditingRestrictive?"error":"warning";if(t&&!o.fields.some(e=>t.includes(e)))continue;if(!o.fields.every(e=>n.includes(e))){s.push(new y({fieldGroup:o,type:r}));continue}let a=!1;const l=e[this.subtypeFieldName],u=o.contingencies.filter(e=>!(!e.isRetired&&e.subtype)||e.subtype.code===l);if(0!==u.length){for(const t of u){let n=!0;for(const i in t.values){const s=t.values[i];if("any"!==s.objectType)if("null"===s.objectType){if(null!=e[i]){n=!1;break}}else if("code"===s.objectType){if(e[i]!==s.codedValue.code){n=!1;break}}else if("range"===s.objectType){const t=e[i];if(t<s.minValue||t>s.maxValue){n=!1;break}}}if(n){a=!0;break}}a||i.push(new y({fieldGroup:o,type:r}))}}return{invalid:i,incomplete:s}}getRelatedFields(e){return o(this._relatedFieldsLookup,e,()=>R(this.fieldGroups,e))}getContingentValues(e,t,n=!1){const i=e[this.subtypeFieldName],s=null!=i,o={};let r=[];const a=this.fieldGroups.filter(e=>e.fields.includes(t));r.push(new m({objectType:"any"}));for(const l of a){let a=[];const u=l.contingencies.filter(e=>!(e.isRetired||e.subtype&&s&&e.subtype.code!==i));let c=!1;const p={};for(const n of u){let i,s=!0;for(const o in n.values){const r=n.values[o];if(t!==o){if(void 0!==e[o]&&"any"!==r.objectType)if("null"===r.objectType)null!==e[o]&&(s=!1);else if("code"===r.objectType)e[o]!==r.codedValue.code&&(s=!1);else if("range"===r.objectType){const t=e[o];(t<r.minValue||t>r.maxValue)&&(s=!1)}}else i=r,c=c||"range"===r.objectType}if(i&&s){if("any"===i.objectType){a.length=0,a.push(i);break}const e=v(i);p[e]||a.push(i),p[e]=!0}}c&&(a=F(a)),o[l.name]=a,r=n?C(r,a):[]}return 1===a.length&&n&&(r=[]),new g({contingentValuesAllGroups:r,contingentValuesByFieldGroup:o})}async _initializeContingentValues(e,t){const n=e??await this._fetchFieldGroupDefs(t);if(0===n.length)return this.fieldGroups=[],void this._relatedFieldsLookup.clear();const i=await this._fetchContingentValues(n,t);this.fieldGroups=i}async _fetchFieldGroupDefs(e){if(void 0===this.layer.layerId)return[];const t=this.layer.sourceJSON,n=this.layer.layerId.toString(),i=d(this.layer.url).url.path;if(t?.hasContingentValuesDefinition){return(await _(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.restrictive,fields:e.fields.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return void 0!==t?.hasContingentValuesDefinition?[]:D(i,e).then(async t=>{if(t.supportsQueryDataElements){return(await O(i,n,e)).map(e=>({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fieldNames.names.map(e=>this.layer.fieldsIndex.normalizeFieldName(e))}))}return[]})}async _fetchContingentValues(e,t){if(void 0===this.layer.layerId)return[];const n=this.layer.sourceJSON,i=this.layer.layerId.toString(),s=d(this.layer.url).url.path;if(n?.hasContingentValuesDefinition){const n=await E(s,i,t);return this._constructFieldGroupsAGOL(e,n)}const o=await L(s,i,t);return this._constructFieldGroupsEnterprise(e,o)}_constructFieldGroupsAGOL(e,t){return e.map(e=>{const n=t.contingentValuesDefinition.fieldGroups.find(t=>t.name===e.name);if(n){let i=[];return i=t.contingentValuesDefinition.hasSubType?this._parseAGOLFieldGroupSubtype(e,t,n.subTypes):this._parseAGOLFieldGroup(e,t,n.contingentValues),new h({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_parseAGOLFieldGroupSubtype(e,t,n){let i=[];return n?.forEach(n=>{const s=this._getSubtypeAGOL(n.name);i=i.concat(this._parseAGOLFieldGroup(e,t,n.contingentValues,s))}),i}_parseAGOLFieldGroup(e,t,n,i=null){const s=[];for(const o of n??[]){const n=this._parseAGOLContingency(o,e,t,i);s.push(n)}return s}_parseAGOLContingency(e,t,n,i){const s=e.id,o=!!e.retired&&1===e.retired,r={};for(let a=0,l=0;a<t.fields.length;a++){const s=t.fields[a],o=n.typeCodes[e.types[a]];if("Code"===o){let t=e.values[l];l++;const o=this._getDomain(i,s),a=this.layer.getField(s);if("string"===a?.type){const e=n.stringDicts.find(e=>e.domain===o?.name);e&&(t=e.entries[t])}const u=o?.codedValues.find(e=>e.code===t),c=new m({codedValue:u,objectType:"code"});r[s]=c}else if("Range"===o){const t=e.values[l];l++;const n=t.range[0],i=t.range[1],o=new m({minValue:n,maxValue:i,objectType:"range"});r[s]=o}else if("Any"===o){const e=new m({objectType:"any"});r[s]=e}else{const e=new m({objectType:"null"});r[s]=e}}return new f({id:s,isRetired:o,subtype:i,values:r})}_constructFieldGroupsEnterprise(e,t){const i=t.fieldGroups;return e.map(e=>{const n=i.find(t=>t.name===e.name);if(n){const i=n.contingencies.map(n=>{const i=n.id,s=n.isRetired||!1,o=this._getSubtypeEnterprise(n.subtypeCode),r={};for(let a=0;a<e.fields.length;a++){const i=e.fields[a];let s=n.values[a];if("number"==typeof s||"string"==typeof s){const e=this._getDomain(o,i),n=this.layer.getField(i);if(V(n))s=t.stringDictionary[s];else if(b(n)){const e=new Date(`${s}+00:00`);s=e.getTime()}const a=e?.codedValues.find(e=>e.code===s),l=new m({codedValue:a,objectType:"code"});r[i]=l}else if("object"==typeof s){const e=s.minValue,t=s.maxValue,n=new m({minValue:e,maxValue:t,objectType:"range"});r[i]=n}else if(s){const e=new m({objectType:"any"});r[i]=e}else{const e=new m({objectType:"null"});r[i]=e}}return new f({id:i,isRetired:s,subtype:o,values:r})});return new h({name:e.name,isEditingRestrictive:e.isEditingRestrictive,fields:e.fields,contingencies:i})}return null}).filter(n)}_getSubtypeEnterprise(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.code===e);n=j.fromJSON(i)}return n||null}_getSubtypeAGOL(e){const t=this.layer.sourceJSON;let n;if(t?.subtypes){const i=t.subtypes.find(t=>t.name===e);n=j.fromJSON(i)}return n||null}_getDomain(e,t){const n=e?N(e,t):this.layer.getFieldDomain(t);return"inherited"===n?.type?this.layer.getFieldDomain(t):n}};function v(e){switch(e.objectType){case"any":return"@any@";case"null":return"@null@";case"code":return e.codedValue.name+e.codedValue.code.toString();case"range":return e.minValue.toString()+"-"+e.maxValue.toString()}}function F(e){let t,n;e.sort((e,t)=>"null"===e.objectType?-1:"null"===t.objectType?1:e.minValue-t.minValue);const i=[];for(const s of e)"null"!==s.objectType?null!=t&&null!=n?n<s.minValue?(i.push(new m({objectType:"range",minValue:t,maxValue:n})),t=s.minValue,n=s.maxValue):n<s.maxValue&&(n=s.maxValue):(t=s.minValue,n=s.maxValue):i.push(s);return i.push(new m({objectType:"range",minValue:t,maxValue:n})),i}function x(e,t){const n=[];let i,s=0;for(const o of e)for(;s<t.length;s++){const e=t[s];if("null"===o.objectType&&"null"===e.objectType)n.push(new m({objectType:"null"}));else{if("null"===o.objectType)break;if("null"===e.objectType)continue}if(o.maxValue<e.minValue)break;if(o.maxValue===e.minValue){n.push(new m({objectType:"range",minValue:o.maxValue,maxValue:e.minValue}));break}if(!(o.minValue>e.maxValue))if(o.minValue!==e.maxValue){if(i=o.minValue>e.minValue?o.minValue:e.minValue,o.maxValue<e.maxValue){n.push(new m({objectType:"range",minValue:i,maxValue:o.maxValue}));break}n.push(new m({objectType:"range",minValue:i,maxValue:e.maxValue}))}else n.push(new m({objectType:"range",minValue:o.minValue,maxValue:e.maxValue}))}return n}function S(e,t){const n=[];for(const i of e)t.some(e=>{if(i.objectType===e.objectType)switch(i.objectType){case"any":case"null":return!0;case"code":return i.codedValue.code===e.codedValue.code&&i.codedValue.name===e.codedValue.name}return!1})&&n.push(i);return n}function C(e,t){if(0===e.length||0===t.length)return[];if("any"===e[0].objectType)return t;if("any"===t[0].objectType)return e;const n="range"===e[0].objectType||"range"===e[1]?.objectType,i="range"===t[0].objectType||"range"===t[1]?.objectType;return n||i?x(e,t):S(e,t)}async function _(e,n,i){return t(`${e}/${n}/fieldgroups`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data.fieldGroups??[])}async function O(e,n,i){return t(`${e}/queryDataElements`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.layerDataElements?.[0].dataElement.fieldGroups??[])}async function D(e,n){return t(e,{responseType:"json",query:{f:"json"},...n}).then(e=>e.data)}async function L(e,n,i){return t(`${e}/queryContingentValues`,{responseType:"json",query:{layers:JSON.stringify([n]),f:"json"},...i}).then(e=>e.data.contingentValueSets?.[0])}async function E(e,n,i){return t(`${e}/${n}/contingentValues`,{responseType:"json",query:{f:"json"},...i}).then(e=>e.data)}function N(e,t){const n=e.domains;if(n){const[e,i]=Object.entries(n).find(([e])=>e.trim().toLowerCase()===t.trim().toLowerCase())||[];return i||null}return null}function R(e,t){const n=new Set;for(const i of e)i.fields.includes(t)&&u(n,i.fields);return n.delete(t),n}e([c({constructOnly:!0})],G.prototype,"layer",void 0),e([c({constructOnly:!0})],G.prototype,"request",void 0),e([c({type:[h]})],G.prototype,"fieldGroups",void 0),e([c({constructOnly:!0})],G.prototype,"fieldGroupDefinitions",void 0),e([c()],G.prototype,"subtypeFieldName",null),G=w=e([p("esri.layers.support.LayerContingentValuesCache")],G);const k=G;export{k as default};
@@ -212,7 +212,7 @@ export interface SubtypeSublayerProperties extends LoadableMixinProperties, Iden
212
212
  renderer?: (SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | null;
213
213
  /**
214
214
  * An array of feature templates defined in the feature layer.
215
- * See [ArcGIS Pro subtypes document](https://pro.arcgis.com/en/pro-app/help/data/geodatabases/overview/an-overview-of-subtypes.htm).
215
+ * See [ArcGIS Pro subtypes document](https://doc.esri.com/en/arcgis-pro/latest/help/data/geodatabases/overview/an-overview-of-subtypes.html).
216
216
  */
217
217
  templates?: FeatureTemplateProperties[] | null;
218
218
  }
@@ -625,7 +625,7 @@ export default class SubtypeSublayer extends SubtypeSublayerSuperclass {
625
625
  get subtypeField(): string;
626
626
  /**
627
627
  * An array of feature templates defined in the feature layer.
628
- * See [ArcGIS Pro subtypes document](https://pro.arcgis.com/en/pro-app/help/data/geodatabases/overview/an-overview-of-subtypes.htm).
628
+ * See [ArcGIS Pro subtypes document](https://doc.esri.com/en/arcgis-pro/latest/help/data/geodatabases/overview/an-overview-of-subtypes.html).
629
629
  */
630
630
  get templates(): FeatureTemplate[] | null | undefined;
631
631
  set templates(value: FeatureTemplateProperties[] | null | undefined);
@@ -703,7 +703,7 @@ export default class SubtypeSublayer extends SubtypeSublayerSuperclass {
703
703
  *
704
704
  * > [!WARNING]
705
705
  * >
706
- * > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information,
706
+ * > When calling the applyEdits method on a service that does not have [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
707
707
  * > the z-values of the geometries in the `edits` object will automatically be converted to match the spatial reference of the layer.
708
708
  * > Example: The service has a horizontal spatial reference with `feet` units, and `applyEdits()` is called with z-values based on `meter` units,
709
709
  * > then the method will automatically convert the z values from `meter` to `feet` units.
@@ -953,7 +953,7 @@ export default class SubtypeSublayer extends SubtypeSublayerSuperclass {
953
953
  * features.
954
954
  * > [!WARNING]
955
955
  * >
956
- * > When querying a service with z-values and no [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information,
956
+ * > When querying a service with z-values and no [vertical coordinate system](https://doc.esri.com/en/arcgis-pro/latest/help/mapping/properties/vertical-coordinate-systems.html) information,
957
957
  * > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units.
958
958
  * > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference`
959
959
  * > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/#queryFeatures) automatically converts the values from `feet` to `meter` units.
@@ -9,7 +9,7 @@ import type SpatialReference from "../../geometry/SpatialReference.js";
9
9
  import type Field from "./Field.js";
10
10
  import type { AbortOptions } from "../../core/promiseUtils.js";
11
11
  import type { CustomParameters } from "../mixins/CustomParametersMixin.js";
12
- import type { ParquetGeometryEncodingUnion } from "./types.js";
12
+ import type { ParquetDataUnion, ParquetGeometryEncodingUnion } from "./types.js";
13
13
 
14
14
  /**
15
15
  * Contains an information inferred from the parquet files.
@@ -18,12 +18,18 @@ import type { ParquetGeometryEncodingUnion } from "./types.js";
18
18
  * @see [getParquetLayerInfo()](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#getParquetLayerInfo)
19
19
  */
20
20
  export interface ParquetLayerInfo {
21
+ /**
22
+ * The data backing the parquet layer.
23
+ *
24
+ * @since 5.0
25
+ */
26
+ data?: ParquetDataUnion;
21
27
  /**
22
28
  * A collection of URLs pointing to the parquet files.
23
29
  *
24
30
  * @since 5.0
25
31
  */
26
- urls: Collection<string>;
32
+ urls?: Collection<string>;
27
33
  /**
28
34
  * The fields derived from the parquet files.
29
35
  *
@@ -65,17 +71,22 @@ export interface ParquetLayerInfoOptions extends AbortOptions {
65
71
  }
66
72
 
67
73
  /**
68
- * Retrieves information about a [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) from the first parquet file in the specified URLs array.
74
+ * Retrieves information about a [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) from the first Parquet file in the specified data source.
69
75
  * Throws an error if the parquet file is empty or if the information cannot be determined.
70
76
  *
71
- * @param urls - An array of URLs pointing to parquet files. At least one url must be provided.
77
+ * @param data - The data source for the parquet layer. Pass a [ParquetFilesData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetFilesData/), a
78
+ * [ParquetPortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/ParquetPortalItemData/), or an array of URLs pointing to parquet files for backward compatibility.
72
79
  * @param options - An object specifying additional options. See [ParquetLayerInfoOptions](https://developers.arcgis.com/javascript/latest/references/core/layers/support/parquetUtils/#ParquetLayerInfoOptions) for details.
73
80
  * @returns A promise that resolves to the parquet layer information.
74
81
  * @example
75
- * const urls = ["url-to-your-parquet-file.parquet"];
76
- * const info = await parquetUtils.getParquetLayerInfo(urls);
82
+ * ```js
83
+ * const data = new ParquetFilesData({
84
+ * urls: ["url-to-your-parquet-file.parquet"]
85
+ * });
86
+ * const info = await parquetUtils.getParquetLayerInfo(data);
77
87
  *
78
88
  * // create new parquet layer using the retrieved info
79
89
  * const layer = new ParquetLayer(info);
90
+ * ```
80
91
  */
81
- export function getParquetLayerInfo(urls: string[], options?: ParquetLayerInfoOptions): Promise<ParquetLayerInfo>;
92
+ export function getParquetLayerInfo(data: string[] | ParquetDataUnion, options?: ParquetLayerInfoOptions): Promise<ParquetLayerInfo>;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import n from"../../geometry/SpatialReference.js";import i from"./Field.js";import{isNumericField as r}from"./fieldUtils.js";import s from"./GeometryEncodingLocation.js";import l from"./GeometryEncodingWkb.js";import{inferLocationInfo as a}from"./locationUtils.js";import{createParquetFile as p,readGeoMetadata as c,readGeodisplayMetadata as u}from"../../libs/parquet/parquet.js";const m=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"}),d=new Set(["uncompressed","snappy","gzip"]);function f(e){return m.toJSON(e)}function y(e){return m.fromJSON(e)}function g(t,o={}){return w({urls:new e(t)},o)}async function w(e,o={}){if(e.urls.length<1)throw new t("parquet:bad-input","At least one url must be specified",e);if(e.geometryType&&e.spatialReference&&e.geometryEncoding&&e.fields)return e;const s=await p(e.urls.getItemAt(0),{getCustomParameters:()=>o.customParameters});for(const n of s.compressionCodecs())if(!d.has(n))throw new t("parquet:unsupported",`Compression codec ${n} is unsupported. Must be of type ${Array.from(d).join(",")}`);const l=c(s),a={...e,file:s};if(null==a.fields&&(a.fields=s.fields(!1).map(e=>i.fromJSON({name:e.name,alias:e.name,type:e.type}))),null!=a.geometryEncoding){const e=a.geometryEncoding;switch(e.type){case"wkb":{const o=a.fields.find(t=>t.name===e.field);if(!o)throw new t("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==o.type)throw new t("parquet:unsupported",`Invalid field type for geometry encoding. Found ${o.type} but expected 'blob'`);break}case"location":for(const o of[e.xField,e.yField])if(null!=o){const e=a.fields.find(e=>e.name===o);if(!e)throw new t("parquet:unsupported",`Geometry encoding references field ${o} which does not exist`);if(!r(e))throw new t("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}null==a.geometryEncoding&&(a.geometryEncoding=h(l,a.fields));const m=u(s);if(m&&(a.displayOptimization=m),a.geometryEncoding)switch(a.geometryEncoding.type){case"location":null==a.spatialReference&&(a.spatialReference=n.WGS84),null==a.geometryType&&(a.geometryType="point");break;case"wkb":{if(!l)return a;const e=l.primary_column,t=l.columns[e];if(a.geometryType||(a.geometryType=j(t)),a.spatialReference||(a.spatialReference=k(t)),a.fields)for(const o of Object.keys(l.columns))a.fields=a.fields.filter(e=>e.name!==o)}}if(a.displayOptimization){const e=a.displayOptimization.index;if(!a.spatialReference&&e.wkid&&(a.spatialReference=new n({wkid:e.wkid})),!a.geometryType)switch(e.type){case"z":a.geometryType="point";break;case"xz":a.geometryType=e.geometryType}}return a}function h(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new l({field:t,orientation:"counterclockwise"===o.orientation?"counter-clockwise":null})}const o=t.filter(e=>r(e)).map(e=>e.name),n=a(o);return n.latitudeFieldName&&n.longitudeFieldName?new s({xField:n.longitudeFieldName,yField:n.latitudeFieldName}):null}function b(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function j(e){const{geometry_types:o}=e,n=new Set;for(const t of o){const e=b(t);e&&n.add(e)}if(n.size>1)throw new t("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:n});return 1===n.size?n.values().next().value:void 0}function k(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new n({wkid:t}):void 0}async function q(e,t){switch(e?.type){case"files":return e.urls.toArray();case"portal-item":return await e.portalItem.load(t),[x(e.portalItem)];default:return[]}}function x(e){const o=e.itemCdnUrl?`${e.itemCdnUrl}/data`:`${e.itemUrl}/data`;if(!o)throw new t("parquet-layer:missing-portal-item-id","Portal item data requires a portal item id",{portalItem:e});return o}export{w as completeParquetLayerInfo,y as fromParquetJSONGeometryType,g as getParquetLayerInfo,m as parquetGeometryTypeKebabDict,q as resolveParquetDataUrls,f as toParquetJSONGeometryType};
2
+ import e from"../../core/Collection.js";import t from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import i from"../../geometry/SpatialReference.js";import{createFileProvider as r}from"../graphics/sources/parquet/createFileProvider.js";import n from"./Field.js";import{isNumericField as s}from"./fieldUtils.js";import l from"./GeometryEncodingLocation.js";import a from"./GeometryEncodingWkb.js";import{inferLocationInfo as p}from"./locationUtils.js";import c from"./ParquetFilesData.js";import{createParquetFile as u,readGeoMetadata as m,readGeodisplayMetadata as d}from"../../libs/parquet/parquet.js";const f=new o({esriGeometryPoint:"point",esriGeometryPolygon:"polygon",esriGeometryPolyline:"polyline",esriGeometryMultipoint:"multipoint"}),y=new Set(["uncompressed","snappy","gzip"]);function g(e){return f.toJSON(e)}function w(e){return f.fromJSON(e)}async function h(t,o={}){const i=Array.isArray(t)?new c({urls:new e(t)}):t,n=await k(i,o);return b(r(n,()=>o.customParameters),{data:i})}async function b(e,o){if(o.geometryType&&o.spatialReference&&o.geometryEncoding&&o.fields)return o;const r=await e.getFileList();if(!r.length)throw new t("parquet:bad-input","At least one url must be specified");const l=await u(r[0],{provider:e});for(const i of l.compressionCodecs())if(!y.has(i))throw new t("parquet:unsupported",`Compression codec ${i} is unsupported. Must be of type ${Array.from(y).join(",")}`);const a=m(l),p={...o,file:l};if(null==p.fields&&(p.fields=l.fields(!1).map(e=>n.fromJSON({name:e.name,alias:e.name,type:e.type}))),null!=p.geometryEncoding){const e=p.geometryEncoding;switch(e.type){case"wkb":{const o=p.fields.find(t=>t.name===e.field);if(!o)throw new t("parquet:unsupported",`Geometry encoding references field ${e.field} which does not exist`);if("blob"!==o.type)throw new t("parquet:unsupported",`Invalid field type for geometry encoding. Found ${o.type} but expected 'blob'`);break}case"location":for(const o of[e.xField,e.yField])if(null!=o){const e=p.fields.find(e=>e.name===o);if(!e)throw new t("parquet:unsupported",`Geometry encoding references field ${o} which does not exist`);if(!s(e))throw new t("parquet:unsupported",`Invalid field type for location geometry encoding. Found ${e.type} but expected a numeric`)}}}null==p.geometryEncoding&&(p.geometryEncoding=q(a,p.fields));const c=d(l);if(c&&(p.displayOptimization=c),p.geometryEncoding)switch(p.geometryEncoding.type){case"location":null==p.spatialReference&&(p.spatialReference=i.WGS84),null==p.geometryType&&(p.geometryType="point");break;case"wkb":{if(!a)return p;const e=a.primary_column,t=a.columns[e];if(p.geometryType||(p.geometryType=F(t)),p.spatialReference||(p.spatialReference=P(t)),p.fields)for(const o of Object.keys(a.columns))p.fields=p.fields.filter(e=>e.name!==o)}}if(p.displayOptimization){const e=p.displayOptimization.index;if(!p.spatialReference&&e.wkid&&(p.spatialReference=new i({wkid:e.wkid})),!p.geometryType)switch(e.type){case"z":p.geometryType="point";break;case"xz":p.geometryType=e.geometryType}}return p}function q(e,t){if(null!=e){const t=e.primary_column,o=e.columns[t];return new a({field:t,orientation:"counterclockwise"===o.orientation?"counter-clockwise":null})}const o=t.filter(e=>s(e)).map(e=>e.name),i=p(o);return i.latitudeFieldName&&i.longitudeFieldName?new l({xField:i.longitudeFieldName,yField:i.latitudeFieldName}):null}function j(e){switch(e){case"Point":return"point";case"Polygon":case"MultiPolygon":return"polygon";case"LineString":return"polyline";case"MultiPoint":return"multipoint";default:return null}}function F(e){const{geometry_types:o}=e,i=new Set;for(const t of o){const e=j(t);e&&i.add(e)}if(i.size>1)throw new t("parquet:unsupported","Parquet mixed geometry types are not supported",{geometryTypes:i});return 1===i.size?i.values().next().value:void 0}function P(e){const t=e.crs?.id?.code;return t&&"number"==typeof t?new i({wkid:t}):void 0}async function k(e,o){switch(e.type){case"files":return{type:"urls",urls:e.urls.toArray()};case"portal-item":{const i=await e.portalItem.load(o);switch(i.type){case"Apache Parquet":return{type:"portal-parquet-file",itemUrl:i.itemUrl,itemCdnUrl:i.itemCdnUrl,modified:i.modified,size:i.size};case"Parquet layer":case"Parquet Layer":return{type:"portal-parquet-layer",itemUrl:i.itemUrl,itemCdnUrl:i.itemCdnUrl,modified:i.modified};default:throw new t("parquet:bad-item",`Item of type ${i.type} is not supported`,i)}}}}export{b as completeParquetLayerInfo,k as createFileProviderSchema,w as fromParquetJSONGeometryType,h as getParquetLayerInfo,f as parquetGeometryTypeKebabDict,g as toParquetJSONGeometryType};
@@ -10,7 +10,7 @@ import type { Base2RasterFunctionParameters, BaseNRasterFunctionParameters, Base
10
10
 
11
11
  /**
12
12
  * Creates a Contrast And Brightness function that enhances the appearance of raster data by modifying the brightness and contrast within the image.
13
- * See [Contrast And Brightness function](https://pro.arcgis.com/en/pro-app/latest/help/analysis/raster-functions/contrast-and-brightness-function.htm).
13
+ * See [Contrast And Brightness function](https://doc.esri.com/en/arcgis-pro/latest/help/analysis/raster-functions/contrast-and-brightness-function.html).
14
14
  *
15
15
  * @param parameters - The parameters object has the following properties.
16
16
  * @returns Returns a RasterFunction.
@@ -437,7 +437,7 @@ export function bandArithmeticCIre(parameters: CIreBandParameters): RasterFuncti
437
437
 
438
438
  /**
439
439
  * Creates a Band Arithmetic function to calculate CIg. Chlorophyll index - Green (CIG) method is a vegetation index for estimating the chlorophyll content in leaves using
440
- * the ratio of reflectivity in the NIR and green bands. See [CIg raster function](https://pro.arcgis.com/en/pro-app/latest/arcpy/spatial-analyst/cig.htm).
440
+ * the ratio of reflectivity in the NIR and green bands. See [CIg raster function](https://doc.esri.com/en/arcgis-pro/latest/arcpy/spatial-analyst/cig.html).
441
441
  *
442
442
  * Equation: CIg = (NIR / Green)-1
443
443
  *