@arcgis/core 4.27.0-next.20230317 → 4.27.0-next.20230321

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 (300) hide show
  1. package/TimeExtent.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/05e47e78e258dd5ab6ea.js +1 -0
  4. package/assets/esri/core/workers/chunks/{b661d2c785333429aad3.js → 0b005e3502dd97562701.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{8812629e07e5bf46caa7.js → 1d2271a36641f6834401.js} +1 -1
  6. package/assets/esri/core/workers/chunks/1d65a2bc91774fdbd690.js +1 -0
  7. package/assets/esri/core/workers/chunks/273a894ab44b76ee4488.js +1 -0
  8. package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
  9. package/assets/esri/core/workers/chunks/{56ddde83f40cda0a8a5c.js → 2c0775541cfec9d43acb.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{48a1b8be3c2a59c4c925.js → 32f9b488915a4a8864e5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{790d62ea3c90ca076095.js → 403c18eaa30673b096fe.js} +1 -1
  12. package/assets/esri/core/workers/chunks/41bbf58417f4085657f4.js +1 -0
  13. package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
  14. package/assets/esri/core/workers/chunks/4be7647605300e07e843.js +1 -0
  15. package/assets/esri/core/workers/chunks/5cc99e9e974fec32b597.js +1 -0
  16. package/assets/esri/core/workers/chunks/6062bc79ebd5047a473a.js +1 -0
  17. package/assets/esri/core/workers/chunks/{57aa75a10fb8bb3fa517.js → 622139ef8f7181e48cd0.js} +1 -1
  18. package/assets/esri/core/workers/chunks/6b14673a4afd6ef81487.js +1 -0
  19. package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
  20. package/assets/esri/core/workers/chunks/{7727e6a4338c831f272f.js → 7570ec6a64a88ddc0fdd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/81a6f4b43e047c3395c0.js +1 -0
  22. package/assets/esri/core/workers/chunks/87edeb09a948122fa030.js +1 -0
  23. package/assets/esri/core/workers/chunks/8daa0523d49653cc5861.js +1 -0
  24. package/assets/esri/core/workers/chunks/{3ff3d67f1bc6e2b2f48e.js → 90e12cff7672f3d92ced.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
  26. package/assets/esri/core/workers/chunks/983b26414cc46d9c3105.js +1 -0
  27. package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
  28. package/assets/esri/core/workers/chunks/a27951dbe83c63f9d01a.js +1 -0
  29. package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
  30. package/assets/esri/core/workers/chunks/bfc2b40f1892970281c6.js +1 -0
  31. package/assets/esri/core/workers/chunks/c162d1e27e779732d494.js +1 -0
  32. package/assets/esri/core/workers/chunks/c5d872adce711ec61ede.js +1 -0
  33. package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e97c4beb3a6cf1d91310.js → c6c2f771bca0e303b5c0.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
  36. package/assets/esri/core/workers/chunks/d34dbb49508a95588423.js +1 -0
  37. package/assets/esri/core/workers/chunks/e637e47000f4dc48054d.js +1 -0
  38. package/assets/esri/core/workers/chunks/e7093d27a31345953dca.js +1 -0
  39. package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
  40. package/assets/esri/core/workers/chunks/f85a01429959e60a8713.js +1 -0
  41. package/assets/esri/core/workers/chunks/ff9efa829497557ec26a.js +1 -0
  42. package/assets/esri/themes/base/widgets/_Bookmarks.scss +3 -0
  43. package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
  44. package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
  45. package/assets/esri/themes/dark/main.css +1 -1
  46. package/assets/esri/themes/light/main.css +1 -1
  47. package/assets/esri/themes/light/view.css +1 -1
  48. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  49. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  50. package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
  51. package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
  52. package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
  53. package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
  54. package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
  55. package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
  56. package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
  57. package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
  58. package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
  59. package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
  60. package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
  61. package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
  62. package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
  63. package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
  64. package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
  65. package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
  66. package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
  67. package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
  68. package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
  69. package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
  70. package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
  71. package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
  72. package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
  73. package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
  74. package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
  75. package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
  76. package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
  77. package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
  78. package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
  79. package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
  80. package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
  81. package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
  82. package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
  83. package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
  84. package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
  85. package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
  86. package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
  87. package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
  88. package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
  89. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
  90. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
  91. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
  92. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
  93. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
  94. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
  95. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
  96. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
  97. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
  98. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
  99. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
  100. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
  101. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
  102. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
  103. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
  104. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
  105. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
  106. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
  107. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
  108. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
  109. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
  110. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
  111. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
  112. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
  113. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
  114. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
  115. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
  116. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
  117. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
  118. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
  119. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
  120. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
  121. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
  122. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
  123. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
  124. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
  125. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
  126. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
  127. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
  128. package/chunks/ColorMaterial.glsl.js +16 -14
  129. package/core/domUtils.js +1 -1
  130. package/core/maybe.js +1 -1
  131. package/core/urlUtils.js +1 -1
  132. package/geohash/GeohashTree.js +1 -1
  133. package/interfaces.d.ts +12 -214
  134. package/layers/SceneLayer.js +1 -1
  135. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  136. package/layers/support/FieldsIndex.js +1 -1
  137. package/layers/support/fieldType.js +1 -1
  138. package/layers/support/fieldUtils.js +1 -1
  139. package/layers/support/rasterFunctionConstants.js +1 -1
  140. package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
  141. package/layers/support/rasterFunctions/CurvatureFunction.js +5 -0
  142. package/layers/support/rasterFunctions/CurvatureFunctionArguments.js +5 -0
  143. package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
  144. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  145. package/layers/support/rasterFunctions/surfaceUtils.js +1 -1
  146. package/package.json +1 -1
  147. package/portal/schemas/definitions.js +1 -1
  148. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  149. package/support/revision.js +1 -1
  150. package/views/2d/engine/imagery/processor/curvatureProcessor.js +5 -0
  151. package/views/2d/engine/imagery/processor/rasterProcessor.js +1 -1
  152. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  153. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  154. package/views/2d/layers/features/support/BinStore.js +1 -1
  155. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  156. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  157. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  158. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  159. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  160. package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
  161. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  162. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  163. package/views/3d/environment/CloudsData.js +1 -1
  164. package/views/3d/environment/CloudsGenerator.js +1 -1
  165. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  166. package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
  167. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  168. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  169. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
  170. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  171. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  172. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
  173. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  174. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  175. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  176. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  179. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  180. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  181. package/views/3d/layers/graphics/interfaces.js +1 -1
  182. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  183. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  184. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  185. package/views/3d/support/buffer/glUtil.js +1 -1
  186. package/views/3d/support/buffer/workerHelper.js +1 -1
  187. package/views/3d/support/engineContent/line.js +1 -1
  188. package/views/3d/terrain/PatchRenderData.js +1 -1
  189. package/views/3d/terrain/TerrainSurface.js +1 -1
  190. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
  191. package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
  192. package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
  193. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  194. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  195. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  196. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  198. package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
  199. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  200. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  201. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  202. package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
  203. package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
  204. package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
  205. package/widgets/Bookmarks/css.js +1 -1
  206. package/widgets/Bookmarks.js +1 -1
  207. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  208. package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
  209. package/widgets/Editor/EditorViewModel.js +1 -1
  210. package/widgets/Editor/Upload.js +5 -0
  211. package/widgets/Editor/UploadState.js +4 -0
  212. package/widgets/Editor/workflowUtils.js +1 -1
  213. package/widgets/Editor.js +1 -1
  214. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  215. package/widgets/FeatureForm/{InputField.js → FieldInput.js} +1 -1
  216. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  217. package/widgets/FeatureForm/GroupInput.js +5 -0
  218. package/widgets/FeatureForm/css.js +1 -1
  219. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  220. package/widgets/FeatureForm.js +1 -1
  221. package/widgets/FeatureTable/FieldColumn.js +1 -1
  222. package/widgets/FeatureTemplates/ItemList.js +1 -1
  223. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  224. package/widgets/FeatureTemplates.js +1 -1
  225. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  226. package/widgets/LayerList/LayerListViewModel.js +1 -1
  227. package/widgets/LayerList.js +1 -1
  228. package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
  229. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  230. package/assets/esri/core/workers/chunks/009348f65fab440f7752.js +0 -1
  231. package/assets/esri/core/workers/chunks/075ecd53fb229dfee53c.js +0 -1
  232. package/assets/esri/core/workers/chunks/1c77b92063ee36421914.js +0 -1
  233. package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
  234. package/assets/esri/core/workers/chunks/262b6de5a29c713b4010.js +0 -1
  235. package/assets/esri/core/workers/chunks/281c0f936b5645a673ab.js +0 -1
  236. package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
  237. package/assets/esri/core/workers/chunks/2e032a58ac6717313227.js +0 -1
  238. package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
  239. package/assets/esri/core/workers/chunks/5504dff4113dd74d2fa7.js +0 -1
  240. package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
  241. package/assets/esri/core/workers/chunks/6caf8a0b49bd01906f32.js +0 -1
  242. package/assets/esri/core/workers/chunks/9cab04c71d8bccf0156d.js +0 -1
  243. package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
  244. package/assets/esri/core/workers/chunks/a265e454461edb306e2d.js +0 -1
  245. package/assets/esri/core/workers/chunks/a50ca44a62434bf18664.js +0 -1
  246. package/assets/esri/core/workers/chunks/bd090f9ec6cfe08e19a3.js +0 -1
  247. package/assets/esri/core/workers/chunks/c3338bdce8368731c4e9.js +0 -1
  248. package/assets/esri/core/workers/chunks/c54df59b2b3f73828a44.js +0 -1
  249. package/assets/esri/core/workers/chunks/ddebf3b5a131a6da5419.js +0 -1
  250. package/assets/esri/core/workers/chunks/de461c30aa24ec8bb212.js +0 -1
  251. package/assets/esri/core/workers/chunks/e23f56bee694a38da5b9.js +0 -1
  252. package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
  253. package/assets/esri/core/workers/chunks/ef884e2833868234c13c.js +0 -1
  254. package/assets/esri/core/workers/chunks/f3c99525fb1b0f719fe0.js +0 -1
  255. package/assets/esri/core/workers/chunks/fe314feede84dd688010.js +0 -1
  256. package/assets/esri/core/workers/chunks/ff15557dc7b74162ed75.js +0 -1
  257. package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
  258. package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
  259. package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
  260. package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
  261. package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
  262. package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
  263. package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
  264. package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
  265. package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
  266. package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
  267. package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
  268. package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
  269. package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
  270. package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
  271. package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
  272. package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
  273. package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
  274. package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
  275. package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
  276. package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
  277. package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
  278. package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
  279. package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
  280. package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
  281. package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
  282. package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
  283. package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
  284. package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
  285. package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
  286. package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
  287. package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
  288. package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
  289. package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
  290. package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
  291. package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
  292. package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
  293. package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
  294. package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
  295. package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
  296. package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
  297. package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
  298. package/widgets/FeatureForm/InputField.d.ts +0 -4
  299. package/widgets/FeatureForm/InputFieldGroup.d.ts +0 -4
  300. package/widgets/FeatureForm/InputFieldGroup.js +0 -5
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8598],{93860:(e,t,r)=>{function n(e,t){const r=e.count;t||(t=new e.TypedArrayConstructor(r));for(let n=0;n<r;n++)t[n]=e.get(n);return t}r.d(t,{m:()=>n}),Object.freeze(Object.defineProperty({__proto__:null,makeDense:n},Symbol.toStringTag,{value:"Module"}))},10816:(e,t,r)=>{r.d(t,{a:()=>o,f:()=>a,n:()=>s});var n=r(1533);function o(e,t){s(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r=2,o=r){const s=t.length/2;let a=0,i=0;if((0,n.kJ)(t)||(0,n.Q7)(t)){for(let n=0;n<s;++n)e[a]=t[i],e[a+1]=t[i+1],a+=r,i+=o;return}const u=(0,n.Op)(t);if((0,n.B3)(t))for(let n=0;n<s;++n)e[a]=Math.max(t[i]/u,-1),e[a+1]=Math.max(t[i+1]/u,-1),a+=r,i+=o;else for(let n=0;n<s;++n)e[a]=t[i]/u,e[a+1]=t[i+1]/u,a+=r,i+=o}function a(e,t,r,n){const o=e.typedBuffer,s=e.typedBufferStride,a=n?.count??e.count;let i=(n?.dstIndex??0)*s;for(let e=0;e<a;++e)o[i]=t,o[i+1]=r,i+=s}Object.freeze(Object.defineProperty({__proto__:null,fill:a,normalizeIntegerBuffer:s,normalizeIntegerBufferView:o},Symbol.toStringTag,{value:"Module"}))},56067:(e,t,r)=>{function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=3,n=r){const o=t.length/n;let s=0,a=0;for(let i=0;i<o;++i)e[s]=t[a],e[s+1]=t[a+1],e[s+2]=t[a+2],s+=r,a+=n}function s(e,t,r,n,o){const s=e.typedBuffer,a=e.typedBufferStride,i=o?.count??e.count;let u=(o?.dstIndex??0)*a;for(let e=0;e<i;++e)s[u]=t,s[u+1]=r,s[u+2]=n,u+=a}r.d(t,{a:()=>n,c:()=>o,f:()=>s}),Object.freeze(Object.defineProperty({__proto__:null,copy:o,copyView:n,fill:s},Symbol.toStringTag,{value:"Module"}))},11077:(e,t,r)=>{r.d(t,{a:()=>o,b:()=>i,n:()=>a,s:()=>u,t:()=>s});var n=r(72220);function o(e,t,r){s(e.typedBuffer,t.typedBuffer,r,e.typedBufferStride,t.typedBufferStride)}function s(e,t,r,o=4,s=o){if(e.length/o!=t.length/s)return void n.c.error("source and destination buffers need to have the same number of elements");const a=e.length/o,i=r[0],u=r[1],l=r[2],c=r[3],f=r[4],d=r[5],p=r[6],h=r[7],m=r[8];let w=0,T=0;for(let r=0;r<a;r++){const r=t[w],n=t[w+1],a=t[w+2],g=t[w+3];e[T]=i*r+c*n+p*a,e[T+1]=u*r+f*n+h*a,e[T+2]=l*r+d*n+m*a,e[T+3]=g,w+=s,T+=o}}function a(e,t){const r=Math.min(e.count,t.count),n=e.typedBuffer,o=e.typedBufferStride,s=t.typedBuffer,a=t.typedBufferStride;for(let e=0;e<r;e++){const t=e*o,r=e*a,i=s[r],u=s[r+1],l=s[r+2],c=i*i+u*u+l*l;if(c>0){const e=1/Math.sqrt(c);n[t]=e*i,n[t+1]=e*u,n[t+2]=e*l}}}function i(e,t,r){u(e.typedBuffer,t,r,e.typedBufferStride)}function u(e,t,r,n=4){const o=Math.min(e.length/n,t.count),s=t.typedBuffer,a=t.typedBufferStride;let i=0,u=0;for(let t=0;t<o;t++)e[u]=r*s[i],e[u+1]=r*s[i+1],e[u+2]=r*s[i+2],e[u+3]=r*s[i+3],i+=a,u+=n}Object.freeze(Object.defineProperty({__proto__:null,normalize:a,scale:u,scaleView:i,shiftRight:function(e,t,r){const n=Math.min(e.count,t.count),o=e.typedBuffer,s=e.typedBufferStride,a=t.typedBuffer,i=t.typedBufferStride;for(let e=0;e<n;e++){const t=e*s,n=e*i;o[t]=a[n]>>r,o[t+1]=a[n+1]>>r,o[t+2]=a[n+2]>>r,o[t+3]=a[n+3]>>r}},transformMat3:s,transformMat3View:o,transformMat4:function(e,t,r){if(e.count!==t.count)return void n.c.error("source and destination buffers need to have the same number of elements");const o=e.count,s=r[0],a=r[1],i=r[2],u=r[3],l=r[4],c=r[5],f=r[6],d=r[7],p=r[8],h=r[9],m=r[10],w=r[11],T=r[12],g=r[13],y=r[14],_=r[15],x=e.typedBuffer,b=e.typedBufferStride,S=t.typedBuffer,O=t.typedBufferStride;for(let e=0;e<o;e++){const t=e*b,r=e*O,n=S[r],o=S[r+1],N=S[r+2],A=S[r+3];x[t]=s*n+l*o+p*N+T*A,x[t+1]=a*n+c*o+h*N+g*A,x[t+2]=i*n+f*o+m*N+y*A,x[t+3]=u*n+d*o+w*N+_*A}}},Symbol.toStringTag,{value:"Module"}))},75488:(e,t,r)=>{function n(e,t){o(e.typedBuffer,t,e.typedBufferStride)}function o(e,t,r=4){const n=t.typedBuffer,o=t.typedBufferStride,s=t.count;let a=0,i=0;for(let t=0;t<s;++t)e[a]=n[i],e[a+1]=n[i+1],e[a+2]=n[i+2],e[a+3]=n[i+3],a+=r,i+=o}function s(e,t,r,n,o,s){const a=e.typedBuffer,i=e.typedBufferStride,u=s?.count??e.count;let l=(s?.dstIndex??0)*i;for(let e=0;e<u;++e)a[l]=t,a[l+1]=r,a[l+2]=n,a[l+3]=o,l+=i}r.d(t,{a:()=>n,c:()=>o,f:()=>s}),Object.freeze(Object.defineProperty({__proto__:null,copy:o,copyView:n,fill:s},Symbol.toStringTag,{value:"Module"}))},23670:(e,t,r)=>{r.d(t,{G:()=>o});var n=r(20102);let o=class{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}since(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new n.Z(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new o(this.major,this.minor,this._context)}static parse(e,t=""){const[r,s]=e.split("."),a=/^\s*\d+\s*$/;if(!r||!r.match||!r.match(a))throw new n.Z((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!s||!s.match||!s.match(a))throw new n.Z((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const i=parseInt(r,10),u=parseInt(s,10);return new o(i,u,t)}}},40270:(e,t,r)=>{r.d(t,{C:()=>u});var n=r(3172),o=r(66643),s=r(20102),a=r(95330),i=r(17452);class u{constructor(e){this._streamDataRequester=e}async loadJSON(e,t){return this._load("json",e,t)}async loadBinary(e,t){return(0,i.HK)(e)?((0,a.k_)(t),(0,i.AH)(e)):this._load("binary",e,t)}async loadImage(e,t){return this._load("image",e,t)}async _load(e,t,r){if(null==this._streamDataRequester)return(await(0,n.default)(t,{responseType:l[e]})).data;const i=await(0,o.q6)(this._streamDataRequester.request(t,e,r));if(!0===i.ok)return i.value;throw(0,a.r9)(i.error),new s.Z("",`Request for resource failed: ${i.error}`)}}const l={image:"image",binary:"array-buffer",json:"json"}},91911:(e,t,r)=>{r.d(t,{p:()=>a});var n=r(1533),o=r(24882),s=r(35371);function a(e,t){switch(t){case s.MX.TRIANGLES:return"number"==typeof(r=e)?(0,o.KF)(r):(0,n.lq)(r)?new Uint16Array(r):r;case s.MX.TRIANGLE_STRIP:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return[];const r=t-2,n=(0,o.$z)(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;t+=1)t%2==0?(n[e++]=t,n[e++]=t+1,n[e++]=t+2):(n[e++]=t+1,n[e++]=t,n[e++]=t+2)}else{let t=0;for(let o=0;o<r;o+=1)o%2==0?(n[t++]=e[o],n[t++]=e[o+1],n[t++]=e[o+2]):(n[t++]=e[o+1],n[t++]=e[o],n[t++]=e[o+2])}return n}(e);case s.MX.TRIANGLE_FAN:return function(e){const t="number"==typeof e?e:e.length;if(t<3)return new Uint16Array(0);const r=t-2,n=r<=65536?new Uint16Array(3*r):new Uint32Array(3*r);if("number"==typeof e){let e=0;for(let t=0;t<r;++t)n[e++]=0,n[e++]=t+1,n[e++]=t+2;return n}const o=e[0];let s=e[1],a=0;for(let t=0;t<r;++t){const r=e[t+2];n[a++]=o,n[a++]=s,n[a++]=r,s=r}return n}(e)}var r}},15317:(e,t,r)=>{r.d(t,{$A:()=>s,Ml:()=>i,NM:()=>o,i$:()=>a});var n=r(47026);class o{constructor(e){this.data=e,this.type="encoded-mesh-texture",this.encoding=n.Ti.KTX2_ENCODING}}function s(e){return"encoded-mesh-texture"===e?.type}async function a(e){return new Promise(((t,r)=>{const n=new Blob([e]),o=new FileReader;o.onload=()=>{const e=o.result;t(JSON.parse(e))},o.onerror=e=>{r(e)},o.readAsText(n)}))}async function i(e,t){return t===n.Ti.KTX2_ENCODING?new o(e):new Promise(((r,n)=>{const o=new Blob([e],{type:t}),s=URL.createObjectURL(o),a=new Image,i=()=>{URL.revokeObjectURL(s),"decode"in a?a.decode().then((()=>r(a)),(()=>r(a))).then(l):(r(a),l())},u=e=>{URL.revokeObjectURL(s),n(e),l()},l=()=>{a.removeEventListener("load",i),a.removeEventListener("error",u)};a.addEventListener("load",i),a.addEventListener("error",u),a.src=s}))}},91695:(e,t,r)=>{r.d(t,{Q:()=>U});var n,o,s=r(92604),a=r(13598),i=r(35371),u=r(20102),l=r(30175),c=r(95330),f=r(17452),d=r(23670),p=r(52138),h=r(51305),m=r(94961),w=r(56481),T=r(93860);r(80442);class g{constructor(e){this._data=e,this._offset4=0,this._dataUint32=new Uint32Array(this._data,0,Math.floor(this._data.byteLength/4))}readUint32(){const e=this._offset4;return this._offset4+=1,this._dataUint32[e]}readUint8Array(e){const t=4*this._offset4;return this._offset4+=e/4,new Uint8Array(this._data,t,e)}remainingBytes(){return this._data.byteLength-4*this._offset4}}!function(e){e.SCALAR="SCALAR",e.VEC2="VEC2",e.VEC3="VEC3",e.VEC4="VEC4",e.MAT2="MAT2",e.MAT3="MAT3",e.MAT4="MAT4"}(n||(n={})),function(e){e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"}(o||(o={}));var y=r(74085);const _={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1},x={pbrMetallicRoughness:_,emissiveFactor:[0,0,0],alphaMode:"OPAQUE",alphaCutoff:.5,doubleSided:!1},b={ESRI_externalColorMixMode:"tint"},S=(e={})=>{const t={..._,...e.pbrMetallicRoughness},r=function(e){switch(e.ESRI_externalColorMixMode){case"multiply":case"tint":case"ignore":case"replace":break;default:(0,y.Bg)(e.ESRI_externalColorMixMode),e.ESRI_externalColorMixMode="tint"}return e}({...b,...e.extras});return{...x,...e,pbrMetallicRoughness:t,extras:r}},O={magFilter:i.cw.LINEAR,minFilter:i.cw.LINEAR_MIPMAP_LINEAR,wrapS:i.e8.REPEAT,wrapT:i.e8.REPEAT},N=e=>({...O,...e});var A=r(15317);const E=1179937895;class v{constructor(e,t,r,n){if(this._context=e,this.uri=t,this.json=r,this._glbBuffer=n,this._bufferLoaders=new Map,this._textureLoaders=new Map,this._textureCache=new Map,this._materialCache=new Map,this._nodeParentMap=new Map,this._nodeTransformCache=new Map,this._supportedExtensions=["KHR_texture_basisu"],this._baseUri=function(e){let t,r;return e.replace(/^(.*\/)?([^/]*)$/,((e,n,o)=>(t=n||"",r=o||"",""))),{dirPart:t,filePart:r}}(this.uri).dirPart,this._checkVersionSupported(),this._checkRequiredExtensionsSupported(),null==r.scenes)throw new u.Z("gltf-loader-unsupported-feature","Scenes must be defined.");if(null==r.meshes)throw new u.Z("gltf-loader-unsupported-feature","Meshes must be defined");if(null==r.nodes)throw new u.Z("gltf-loader-unsupported-feature","Nodes must be defined.");this._computeNodeParents()}static async load(e,t,r){if((0,f.HK)(t)){const r=(0,f.sJ)(t);if(r&&"model/gltf-binary"!==r.mediaType)try{const n=JSON.parse(r.isBase64?atob(r.data):r.data);return new v(e,t,n)}catch{}const n=(0,f.AH)(t);if(v._isGLBData(n))return this._fromGLBData(e,t,n)}if(t.endsWith(".gltf")){const n=await e.loadJSON(t,r);return new v(e,t,n)}const n=await e.loadBinary(t,r);if(v._isGLBData(n))return this._fromGLBData(e,t,n);const o=await e.loadJSON(t,r);return new v(e,t,o)}static _isGLBData(e){if(null==e)return!1;const t=new g(e);return t.remainingBytes()>=4&&t.readUint32()===E}static async _fromGLBData(e,t,r){const n=await v._parseGLBData(r);return new v(e,t,n.json,n.binaryData)}static async _parseGLBData(e){const t=new g(e);if(t.remainingBytes()<12)throw new u.Z("gltf-loader-error","GLB binary data is insufficiently large.");const r=t.readUint32(),n=t.readUint32(),o=t.readUint32();if(r!==E)throw new u.Z("gltf-loader-error","Magic first 4 bytes do not fit to expected GLB value.");if(e.byteLength<o)throw new u.Z("gltf-loader-error","GLB binary data is smaller than header specifies.");if(2!==n)throw new u.Z("gltf-loader-unsupported-feature","An unsupported GLB container version was detected. Only version 2 is supported.");let a,i,l=0;for(;t.remainingBytes()>=8;){const e=t.readUint32(),r=t.readUint32();if(0===l){if(1313821514!==r)throw new u.Z("gltf-loader-error","First GLB chunk must be JSON.");if(e<0)throw new u.Z("gltf-loader-error","No JSON data found.");a=await(0,A.i$)(t.readUint8Array(e))}else if(1===l){if(5130562!==r)throw new u.Z("gltf-loader-unsupported-feature","Second GLB chunk expected to be BIN.");i=t.readUint8Array(e)}else s.Z.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] More than 2 GLB chunks detected. Skipping.");l+=1}if(!a)throw new u.Z("gltf-loader-error","No GLB JSON chunk detected.");return{json:a,binaryData:i}}async getBuffer(e,t){const r=this.json.buffers[e];if(null==r.uri){if(null==this._glbBuffer)throw new u.Z("gltf-loader-error","GLB buffer not present");return this._glbBuffer}const n=await this._getBufferLoader(e,t);if(n.byteLength!==r.byteLength)throw new u.Z("gltf-loader-error","Buffer byte lengths should match.");return n}async _getBufferLoader(e,t){const r=this._bufferLoaders.get(e);if(r)return r;const n=this.json.buffers[e].uri,o=this._context.loadBinary(this._resolveUri(n),t).then((e=>new Uint8Array(e)));return this._bufferLoaders.set(e,o),o}async getAccessor(e,t){if(!this.json.accessors)throw new u.Z("gltf-loader-unsupported-feature","Accessors missing.");const r=this.json.accessors[e];if(null==r?.bufferView)throw new u.Z("gltf-loader-unsupported-feature","Some accessor does not specify a bufferView.");if(r.type in[n.MAT2,n.MAT3,n.MAT4])throw new u.Z("gltf-loader-unsupported-feature",`AttributeType ${r.type} is not supported`);const o=this.json.bufferViews[r.bufferView],s=await this.getBuffer(o.buffer,t),a=B[r.type],i=L[r.componentType],l=a*i,c=o.byteStride||l;return{raw:s.buffer,byteStride:c,byteOffset:s.byteOffset+(o.byteOffset||0)+(r.byteOffset||0),entryCount:r.count,isDenselyPacked:c===l,componentCount:a,componentByteSize:i,componentType:r.componentType,min:r.min,max:r.max,normalized:!!r.normalized}}async getIndexData(e,t){if(null==e.indices)return;const r=await this.getAccessor(e.indices,t);if(r.isDenselyPacked)switch(r.componentType){case i.g.UNSIGNED_BYTE:return new Uint8Array(r.raw,r.byteOffset,r.entryCount);case i.g.UNSIGNED_SHORT:return new Uint16Array(r.raw,r.byteOffset,r.entryCount);case i.g.UNSIGNED_INT:return new Uint32Array(r.raw,r.byteOffset,r.entryCount)}else switch(r.componentType){case i.g.UNSIGNED_BYTE:return(0,T.m)(this._wrapAccessor(w.D_,r));case i.g.UNSIGNED_SHORT:return(0,T.m)(this._wrapAccessor(w.av,r));case i.g.UNSIGNED_INT:return(0,T.m)(this._wrapAccessor(w.Nu,r))}}async getPositionData(e,t){if(null==e.attributes.POSITION)throw new u.Z("gltf-loader-unsupported-feature","No POSITION vertex data found.");const r=await this.getAccessor(e.attributes.POSITION,t);if(r.componentType!==i.g.FLOAT)throw new u.Z("gltf-loader-unsupported-feature","Expected type FLOAT for POSITION vertex attribute, but found "+i.g[r.componentType]);if(3!==r.componentCount)throw new u.Z("gltf-loader-unsupported-feature","POSITION vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(w.ct,r)}async getNormalData(e,t){if(null==e.attributes.NORMAL)throw new u.Z("gltf-loader-error","No NORMAL vertex data found.");const r=await this.getAccessor(e.attributes.NORMAL,t);if(r.componentType!==i.g.FLOAT)throw new u.Z("gltf-loader-unsupported-feature","Expected type FLOAT for NORMAL vertex attribute, but found "+i.g[r.componentType]);if(3!==r.componentCount)throw new u.Z("gltf-loader-unsupported-feature","NORMAL vertex attribute must have 3 components, but found "+r.componentCount.toFixed());return this._wrapAccessor(w.ct,r)}async getTangentData(e,t){if(null==e.attributes.TANGENT)throw new u.Z("gltf-loader-error","No TANGENT vertex data found.");const r=await this.getAccessor(e.attributes.TANGENT,t);if(r.componentType!==i.g.FLOAT)throw new u.Z("gltf-loader-unsupported-feature","Expected type FLOAT for TANGENT vertex attribute, but found "+i.g[r.componentType]);if(4!==r.componentCount)throw new u.Z("gltf-loader-unsupported-feature","TANGENT vertex attribute must have 4 components, but found "+r.componentCount.toFixed());return new w.ek(r.raw,r.byteOffset,r.byteStride,r.byteOffset+r.byteStride*r.entryCount)}async getTextureCoordinates(e,t){if(null==e.attributes.TEXCOORD_0)throw new u.Z("gltf-loader-error","No TEXCOORD_0 vertex data found.");const r=await this.getAccessor(e.attributes.TEXCOORD_0,t);if(2!==r.componentCount)throw new u.Z("gltf-loader-unsupported-feature","TEXCOORD_0 vertex attribute must have 2 components, but found "+r.componentCount.toFixed());if(r.componentType===i.g.FLOAT)return this._wrapAccessor(w.Eu,r);if(!r.normalized)throw new u.Z("gltf-loader-unsupported-feature","Integer component types are only supported for a normalized accessor for TEXCOORD_0.");return function(e){switch(e.componentType){case i.g.BYTE:return new w.Vs(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case i.g.UNSIGNED_BYTE:return new w.xA(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case i.g.SHORT:return new w.or(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case i.g.UNSIGNED_SHORT:return new w.TS(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case i.g.UNSIGNED_INT:return new w.qt(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount);case i.g.FLOAT:return new w.Eu(e.raw,e.byteOffset,e.byteStride,e.byteOffset+e.byteStride*e.entryCount)}}(r)}async getVertexColors(e,t){if(null==e.attributes.COLOR_0)throw new u.Z("gltf-loader-error","No COLOR_0 vertex data found.");const r=await this.getAccessor(e.attributes.COLOR_0,t);if(4!==r.componentCount&&3!==r.componentCount)throw new u.Z("gltf-loader-unsupported-feature","COLOR_0 attribute must have 3 or 4 components, but found "+r.componentCount.toFixed());if(4===r.componentCount){if(r.componentType===i.g.FLOAT)return this._wrapAccessor(w.ek,r);if(r.componentType===i.g.UNSIGNED_BYTE)return this._wrapAccessor(w.mc,r);if(r.componentType===i.g.UNSIGNED_SHORT)return this._wrapAccessor(w.v6,r)}else if(3===r.componentCount){if(r.componentType===i.g.FLOAT)return this._wrapAccessor(w.ct,r);if(r.componentType===i.g.UNSIGNED_BYTE)return this._wrapAccessor(w.ne,r);if(r.componentType===i.g.UNSIGNED_SHORT)return this._wrapAccessor(w.mw,r)}throw new u.Z("gltf-loader-unsupported-feature","Unsupported component type for COLOR_0 attribute: "+i.g[r.componentType])}hasPositions(e){return void 0!==e.attributes.POSITION}hasNormals(e){return void 0!==e.attributes.NORMAL}hasVertexColors(e){return void 0!==e.attributes.COLOR_0}hasTextureCoordinates(e){return void 0!==e.attributes.TEXCOORD_0}hasTangents(e){return void 0!==e.attributes.TANGENT}async getMaterial(e,t,r){let n=e.material?this._materialCache.get(e.material):void 0;if(!n){const o=null!=e.material?S(this.json.materials[e.material]):S(),s=o.pbrMetallicRoughness,a=this.hasVertexColors(e),i=this.getTexture(s.baseColorTexture,t),u=this.getTexture(o.normalTexture,t),l=r?this.getTexture(o.occlusionTexture,t):void 0,c=r?this.getTexture(o.emissiveTexture,t):void 0,f=r?this.getTexture(s.metallicRoughnessTexture,t):void 0,d=null!=e.material?e.material:-1;n={alphaMode:o.alphaMode,alphaCutoff:o.alphaCutoff,color:s.baseColorFactor,doubleSided:!!o.doubleSided,colorTexture:await i,normalTexture:await u,name:o.name,id:d,occlusionTexture:await l,emissiveTexture:await c,emissiveFactor:o.emissiveFactor,metallicFactor:s.metallicFactor,roughnessFactor:s.roughnessFactor,metallicRoughnessTexture:await f,hasVertexColors:a,ESRI_externalColorMixMode:o.extras.ESRI_externalColorMixMode,colorTextureTransform:s?.baseColorTexture?.extensions?.KHR_texture_transform,normalTextureTransform:o.normalTexture?.extensions?.KHR_texture_transform,occlusionTextureTransform:o.occlusionTexture?.extensions?.KHR_texture_transform,emissiveTextureTransform:o.emissiveTexture?.extensions?.KHR_texture_transform,metallicRoughnessTextureTransform:s?.metallicRoughnessTexture?.extensions?.KHR_texture_transform}}return n}async getTexture(e,t){if(!e)return;if(0!==(e.texCoord||0))throw new u.Z("gltf-loader-unsupported-feature","Only TEXCOORD with index 0 is supported.");const r=e.index,n=this.json.textures[r],o=N(null!=n.sampler?this.json.samplers[n.sampler]:{}),s=this._getTextureSourceId(n),a=this.json.images[s],i=await this._loadTextureImageData(r,n,t);return(0,l.s1)(this._textureCache,r,(()=>{const e=e=>33071===e||33648===e||10497===e,t=e=>{throw new u.Z("gltf-loader-error",`Unexpected TextureSampler WrapMode: ${e}`)};return{data:i,wrapS:e(o.wrapS)?o.wrapS:t(o.wrapS),wrapT:e(o.wrapT)?o.wrapT:t(o.wrapT),minFilter:o.minFilter,name:a.name,id:r}}))}getNodeTransform(e){if(void 0===e)return R;let t=this._nodeTransformCache.get(e);if(!t){const r=this.getNodeTransform(this._getNodeParent(e)),n=this.json.nodes[e];n.matrix?t=(0,p.m)((0,a.c)(),r,n.matrix):n.translation||n.rotation||n.scale?(t=(0,a.b)(r),n.translation&&(0,p.w)(t,t,n.translation),n.rotation&&(M[3]=(0,h.g)(M,n.rotation),(0,p.e)(t,t,M[3],M)),n.scale&&(0,p.k)(t,t,n.scale)):t=(0,a.b)(r),this._nodeTransformCache.set(e,t)}return t}_wrapAccessor(e,t){return new e(t.raw,t.byteOffset,t.byteStride,t.byteOffset+t.byteStride*(t.entryCount-1)+t.componentByteSize*t.componentCount)}_resolveUri(e){return(0,f.hF)(e,this._baseUri)}_getNodeParent(e){return this._nodeParentMap.get(e)}_checkVersionSupported(){const e=d.G.parse(this.json.asset.version,"glTF");C.validate(e)}_checkRequiredExtensionsSupported(){const e=this.json;if(e.extensionsRequired&&!e.extensionsRequired.every((e=>this._supportedExtensions.includes(e))))throw new u.Z("gltf-loader-unsupported-feature","gltf loader was not able to load unsupported feature. Required extensions: "+e.extensionsRequired.join(", "))}_computeNodeParents(){this.json.nodes.forEach(((e,t)=>{e.children&&e.children.forEach((e=>{this._nodeParentMap.set(e,t)}))}))}async _loadTextureImageData(e,t,r){const n=this._textureLoaders.get(e);if(n)return n;const o=this._createTextureLoader(t,r);return this._textureLoaders.set(e,o),o}_getTextureSourceId(e){if(void 0!==e.extensions&&null!==e.extensions.KHR_texture_basisu)return e.extensions.KHR_texture_basisu.source;if(null!==e.source)return e.source;throw new u.Z("gltf-loader-unsupported-feature","Source is expected to be defined for a texture. It can also be omitted in favour of an KHR_texture_basisu extension tag.")}async _createTextureLoader(e,t){const r=this._getTextureSourceId(e),n=this.json.images[r];if(n.uri){if(n.uri.endsWith(".ktx2")){const e=await this._context.loadBinary(this._resolveUri(n.uri),t);return new A.NM(new Uint8Array(e))}return this._context.loadImage(this._resolveUri(n.uri),t)}if(null==n.bufferView)throw new u.Z("gltf-loader-unsupported-feature","Image bufferView must be defined.");if(null==n.mimeType)throw new u.Z("gltf-loader-unsupported-feature","Image mimeType must be defined.");const o=this.json.bufferViews[n.bufferView],s=await this.getBuffer(o.buffer,t);if(null!=o.byteStride)throw new u.Z("gltf-loader-unsupported-feature","byteStride not supported for image buffer");const a=s.byteOffset+(o.byteOffset||0);return(0,A.Ml)(new Uint8Array(s.buffer,a,o.byteLength),n.mimeType)}async getLoadedBuffersSize(){if(this._glbBuffer)return this._glbBuffer.byteLength;const e=await(0,c.WW)(Array.from(this._bufferLoaders.values())),t=await(0,c.WW)(Array.from(this._textureLoaders.values()));return e.reduce(((e,t)=>e+(t?.byteLength??0)),0)+t.reduce(((e,t)=>e+(t?(0,A.$A)(t)?t.data.byteLength:t.width*t.height*4:0)),0)}}const R=(0,p.A)((0,a.c)(),Math.PI/2),C=new d.G(2,0,"glTF"),M=(0,m.a)(),B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4},L={[i.g.BYTE]:1,[i.g.UNSIGNED_BYTE]:1,[i.g.SHORT]:2,[i.g.UNSIGNED_SHORT]:2,[i.g.FLOAT]:4,[i.g.UNSIGNED_INT]:4};let I=0;async function U(e,t,r={},n=!0){const o=await v.load(e,t,r),u="gltf_"+I++,l={lods:[],materials:new Map,textures:new Map,meta:D(o)},c=!(!o.json.asset.extras||"symbolResource"!==o.json.asset.extras.ESRI_type),f=new Map;await F(o,(async(e,t,c,d)=>{const p=f.get(c)??0;f.set(c,p+1);const h=void 0!==e.mode?e.mode:i.MX.TRIANGLES,m=h===i.MX.TRIANGLES||h===i.MX.TRIANGLE_STRIP||h===i.MX.TRIANGLE_FAN?h:null;if(null==m)return void s.Z.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Unsupported primitive mode ("+i.MX[h]+"). Skipping primitive.");if(!o.hasPositions(e))return void s.Z.getLogger("esri.views.3d.glTF").warn("Skipping primitive without POSITION vertex attribute.");const w=o.getPositionData(e,r),T=o.getMaterial(e,r,n),g=o.hasNormals(e)?o.getNormalData(e,r):null,y=o.hasTangents(e)?o.getTangentData(e,r):null,_=o.hasTextureCoordinates(e)?o.getTextureCoordinates(e,r):null,x=o.hasVertexColors(e)?o.getVertexColors(e,r):null,b=o.getIndexData(e,r),S={transform:(0,a.b)(t),attributes:{position:await w,normal:g?await g:null,texCoord0:_?await _:null,color:x?await x:null,tangent:y?await y:null},indices:await b,primitiveType:m,material:P(l,await T,u)};let O=null;null!=l.meta&&null!=l.meta.ESRI_lod&&"screenSpaceRadius"===l.meta.ESRI_lod.metric&&(O=l.meta.ESRI_lod.thresholds[c]),l.lods[c]=l.lods[c]||{parts:[],name:d,lodThreshold:O},l.lods[c].parts[p]=S}));for(const e of l.lods)e.parts=e.parts.filter((e=>!!e));const d=await o.getLoadedBuffersSize();return{model:l,meta:{isEsriSymbolResource:c,uri:o.uri},customMeta:{},size:d}}function D(e){const t=e.json;let r=null;return t.nodes.forEach((e=>{const t=e.extras;null!=t&&(t.ESRI_proxyEllipsoid||t.ESRI_lod)&&(r=t)})),r}async function F(e,t){const r=e.json,n=r.scenes[r.scene||0].nodes,o=n.length>1,a=[];for(const e of n){const t=r.nodes[e];a.push(i(e,0)),G(t)&&!o&&t.extensions.MSFT_lod.ids.forEach(((e,t)=>i(e,t+1)))}async function i(n,o){const u=r.nodes[n],l=e.getNodeTransform(n);if(null!=u.weights&&s.Z.getLogger("esri.views.3d.glTF").warn("[Unsupported Feature] Morph targets are not supported."),null!=u.mesh){const e=r.meshes[u.mesh];for(const r of e.primitives)a.push(t(r,l,o,e.name))}for(const e of u.children||[])a.push(i(e,o))}await Promise.all(a)}function G(e){return e.extensions&&e.extensions.MSFT_lod&&Array.isArray(e.extensions.MSFT_lod.ids)}function P(e,t,r){const n=t=>{const n=`${r}_tex_${t&&t.id}${t&&t.name?"_"+t.name:""}`;if(t&&!e.textures.has(n)){const r=function(e,t={}){return{data:e,parameters:{wrap:{s:i.e8.REPEAT,t:i.e8.REPEAT,...t.wrap},noUnpackFlip:!0,mipmap:!1,...t}}}(t.data,{wrap:{s:t.wrapS,t:t.wrapT},mipmap:j.includes(t.minFilter),noUnpackFlip:!0});e.textures.set(n,r)}return n},o=`${r}_mat_${t.id}_${t.name}`;if(!e.materials.has(o)){const r=function(e={}){return{color:[1,1,1],opacity:1,alphaMode:"OPAQUE",alphaCutoff:.5,doubleSided:!1,castShadows:!0,receiveShadows:!0,receiveAmbientOcclustion:!0,textureColor:null,textureNormal:null,textureOcclusion:null,textureEmissive:null,textureMetallicRoughness:null,colorTextureTransform:null,normalTextureTransform:null,occlusionTextureTransform:null,emissiveTextureTransform:null,metallicRoughnessTextureTransform:null,emissiveFactor:[0,0,0],metallicFactor:1,roughnessFactor:1,colorMixMode:"multiply",...e}}({color:[t.color[0],t.color[1],t.color[2]],opacity:t.color[3],alphaMode:t.alphaMode,alphaCutoff:t.alphaCutoff,doubleSided:t.doubleSided,colorMixMode:t.ESRI_externalColorMixMode,textureColor:t.colorTexture?n(t.colorTexture):void 0,textureNormal:t.normalTexture?n(t.normalTexture):void 0,textureOcclusion:t.occlusionTexture?n(t.occlusionTexture):void 0,textureEmissive:t.emissiveTexture?n(t.emissiveTexture):void 0,textureMetallicRoughness:t.metallicRoughnessTexture?n(t.metallicRoughnessTexture):void 0,emissiveFactor:[t.emissiveFactor[0],t.emissiveFactor[1],t.emissiveFactor[2]],colorTextureTransform:t.colorTextureTransform,normalTextureTransform:t.normalTextureTransform,occlusionTextureTransform:t.occlusionTextureTransform,emissiveTextureTransform:t.emissiveTextureTransform,metallicRoughnessTextureTransform:t.metallicRoughnessTextureTransform,metallicFactor:t.metallicFactor,roughnessFactor:t.roughnessFactor});e.materials.set(o,r)}return o}const j=[i.cw.LINEAR_MIPMAP_LINEAR,i.cw.LINEAR_MIPMAP_NEAREST]},47026:(e,t,r)=>{var n,o,s,a,i,u,l,c,f,d,p;r.d(t,{CE:()=>l,Gv:()=>o,JJ:()=>f,Rw:()=>a,Ti:()=>p,V_:()=>u,Vr:()=>n,hU:()=>i}),function(e){e[e.None=0]="None",e[e.Front=1]="Front",e[e.Back=2]="Back",e[e.COUNT=3]="COUNT"}(n||(n={})),function(e){e[e.Less=0]="Less",e[e.Lequal=1]="Lequal",e[e.COUNT=2]="COUNT"}(o||(o={})),function(e){e[e.BACKGROUND=0]="BACKGROUND",e[e.UPDATE=1]="UPDATE"}(s||(s={})),function(e){e[e.NOT_LOADED=0]="NOT_LOADED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"}(a||(a={})),function(e){e[e.IntegratedMeshMaskExcluded=1]="IntegratedMeshMaskExcluded",e[e.OutlineVisualElementMask=2]="OutlineVisualElementMask"}(i||(i={})),function(e){e[e.Highlight=0]="Highlight",e[e.MaskOccludee=1]="MaskOccludee",e[e.COUNT=2]="COUNT"}(u||(u={})),function(e){e[e.STRETCH=1]="STRETCH",e[e.PAD=2]="PAD"}(l||(l={})),function(e){e[e.CHANGED=0]="CHANGED",e[e.UNCHANGED=1]="UNCHANGED"}(c||(c={})),function(e){e[e.Blend=0]="Blend",e[e.Opaque=1]="Opaque",e[e.Mask=2]="Mask",e[e.MaskBlend=3]="MaskBlend",e[e.COUNT=4]="COUNT"}(f||(f={})),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON"}(d||(d={})),function(e){e.DDS_ENCODING="image/vnd-ms.dds",e.KTX2_ENCODING="image/ktx2",e.BASIS_ENCODING="image/x.basis"}(p||(p={}))},57758:(e,t,r)=>{r.d(t,{K:()=>n});const n=2.1}}]);
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3381,819,1433],{13867:(e,t,i)=>{i.d(t,{Z:()=>r});var n=i(69801);class r{constructor(e,t){this._storage=new n.WJ,this._storage.maxSize=e,t&&this._storage.registerRemoveFunc("",t)}put(e,t,i){this._storage.put(e,t,i,1)}pop(e){return this._storage.pop(e)}get(e){return this._storage.get(e)}clear(){this._storage.clearAll()}destroy(){this._storage.destroy()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}}},80819:(e,t,i)=>{i.r(t),i.d(t,{hydratedAdapter:()=>l});var n=i(6570),r=i(65091),s=i(94139),a=i(38913),o=i(58901);const l={convertToGEGeometry:function(e,t){if(null==t)return null;let i="cache"in t?t.cache._geVersion:void 0;return null==i&&(i=e.convertJSONToGeometry(t),"cache"in t&&(t.cache._geVersion=i)),i},exportPoint:function(e,t,i){const n=e.hasZ(t),r=e.hasM(t),a=new s.Z({x:e.getPointX(t),y:e.getPointY(t),spatialReference:i});return n&&(a.z=e.getPointZ(t)),r&&(a.m=e.getPointM(t)),a.cache._geVersion=t,a},exportPolygon:function(e,t,i){const n=new a.Z({rings:e.exportPaths(t),hasZ:e.hasZ(t),hasM:e.hasM(t),spatialReference:i});return n.cache._geVersion=t,n},exportPolyline:function(e,t,i){const n=new o.Z({paths:e.exportPaths(t),hasZ:e.hasZ(t),hasM:e.hasM(t),spatialReference:i});return n.cache._geVersion=t,n},exportMultipoint:function(e,t,i){const n=new r.Z({hasZ:e.hasZ(t),hasM:e.hasM(t),points:e.exportPoints(t),spatialReference:i});return n.cache._geVersion=t,n},exportExtent:function(e,t,i){const r=e.hasZ(t),s=e.hasM(t),a=new n.Z({xmin:e.getXMin(t),ymin:e.getYMin(t),xmax:e.getXMax(t),ymax:e.getYMax(t),spatialReference:i});if(r){const i=e.getZExtent(t);a.zmin=i.vmin,a.zmax=i.vmax}if(s){const i=e.getMExtent(t);a.mmin=i.vmin,a.mmax=i.vmax}return a.cache._geVersion=t,a}}},61433:(e,t,i)=>{i.r(t),i.d(t,{buffer:()=>C,changeDefaultSpatialReferenceTolerance:()=>W,clearDefaultSpatialReferenceTolerance:()=>q,clip:()=>o,contains:()=>c,convexHull:()=>b,crosses:()=>u,cut:()=>l,densify:()=>z,difference:()=>S,disjoint:()=>y,distance:()=>h,equals:()=>f,extendedSpatialReferenceInfo:()=>a,flipHorizontal:()=>Z,flipVertical:()=>A,generalize:()=>B,geodesicArea:()=>H,geodesicBuffer:()=>k,geodesicDensify:()=>J,geodesicLength:()=>L,intersect:()=>R,intersectLinesToPoints:()=>G,intersects:()=>d,isSimple:()=>w,nearestCoordinate:()=>F,nearestVertex:()=>M,nearestVertices:()=>P,offset:()=>T,overlaps:()=>g,planarArea:()=>N,planarLength:()=>E,relate:()=>x,rotate:()=>D,simplify:()=>I,symmetricDifference:()=>_,touches:()=>p,union:()=>v,within:()=>m});var n=i(45837),r=i(80819);function s(e){return Array.isArray(e)?e[0].spatialReference:e&&e.spatialReference}function a(e){return n.G.extendedSpatialReferenceInfo(e)}function o(e,t){return n.G.clip(r.hydratedAdapter,s(e),e,t)}function l(e,t){return n.G.cut(r.hydratedAdapter,s(e),e,t)}function c(e,t){return n.G.contains(r.hydratedAdapter,s(e),e,t)}function u(e,t){return n.G.crosses(r.hydratedAdapter,s(e),e,t)}function h(e,t,i){return n.G.distance(r.hydratedAdapter,s(e),e,t,i)}function f(e,t){return n.G.equals(r.hydratedAdapter,s(e),e,t)}function d(e,t){return n.G.intersects(r.hydratedAdapter,s(e),e,t)}function p(e,t){return n.G.touches(r.hydratedAdapter,s(e),e,t)}function m(e,t){return n.G.within(r.hydratedAdapter,s(e),e,t)}function y(e,t){return n.G.disjoint(r.hydratedAdapter,s(e),e,t)}function g(e,t){return n.G.overlaps(r.hydratedAdapter,s(e),e,t)}function x(e,t,i){return n.G.relate(r.hydratedAdapter,s(e),e,t,i)}function w(e){return n.G.isSimple(r.hydratedAdapter,s(e),e)}function I(e){return n.G.simplify(r.hydratedAdapter,s(e),e)}function b(e,t=!1){return n.G.convexHull(r.hydratedAdapter,s(e),e,t)}function S(e,t){return n.G.difference(r.hydratedAdapter,s(e),e,t)}function _(e,t){return n.G.symmetricDifference(r.hydratedAdapter,s(e),e,t)}function R(e,t){return n.G.intersect(r.hydratedAdapter,s(e),e,t)}function v(e,t=null){return n.G.union(r.hydratedAdapter,s(e),e,t)}function T(e,t,i,a,o,l){return n.G.offset(r.hydratedAdapter,s(e),e,t,i,a,o,l)}function C(e,t,i,a=!1){return n.G.buffer(r.hydratedAdapter,s(e),e,t,i,a)}function k(e,t,i,a,o,l){return n.G.geodesicBuffer(r.hydratedAdapter,s(e),e,t,i,a,o,l)}function F(e,t,i=!0){return n.G.nearestCoordinate(r.hydratedAdapter,s(e),e,t,i)}function M(e,t){return n.G.nearestVertex(r.hydratedAdapter,s(e),e,t)}function P(e,t,i,a){return n.G.nearestVertices(r.hydratedAdapter,s(e),e,t,i,a)}function O(e){return"xmin"in e?"center"in e?e.center:null:"x"in e?e:"extent"in e?e.extent?.center??null:null}function D(e,t,i){if(null==e)throw new j;const r=e.spatialReference;if(null==(i=i??O(e)))throw new j;const s=e.constructor.fromJSON(n.G.rotate(e,t,i));return s.spatialReference=r,s}function Z(e,t){if(null==e)throw new j;const i=e.spatialReference;if(null==(t=t??O(e)))throw new j;const r=e.constructor.fromJSON(n.G.flipHorizontal(e,t));return r.spatialReference=i,r}function A(e,t){if(null==e)throw new j;const i=e.spatialReference;if(null==(t=t??O(e)))throw new j;const r=e.constructor.fromJSON(n.G.flipVertical(e,t));return r.spatialReference=i,r}function B(e,t,i,a){return n.G.generalize(r.hydratedAdapter,s(e),e,t,i,a)}function z(e,t,i){return n.G.densify(r.hydratedAdapter,s(e),e,t,i)}function J(e,t,i,a=0){return n.G.geodesicDensify(r.hydratedAdapter,s(e),e,t,i,a)}function N(e,t){return n.G.planarArea(r.hydratedAdapter,s(e),e,t)}function E(e,t){return n.G.planarLength(r.hydratedAdapter,s(e),e,t)}function H(e,t,i){return n.G.geodesicArea(r.hydratedAdapter,s(e),e,t,i)}function L(e,t,i){return n.G.geodesicLength(r.hydratedAdapter,s(e),e,t,i)}function G(e,t){return n.G.intersectLinesToPoints(r.hydratedAdapter,s(e),e,t)}function W(e,t){n.G.changeDefaultSpatialReferenceTolerance(e,t)}function q(e){n.G.clearDefaultSpatialReferenceTolerance(e)}class j extends Error{constructor(){super("Illegal Argument Exception")}}},16306:(e,t,i)=>{i.d(t,{aX:()=>S});var n=i(68773),r=i(20102),s=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),d=i(11282),p=i(17452);async function m(e,t,i){const n="string"==typeof e?(0,p.mN)(e):e,r=t[0].spatialReference,s=(0,f.Ji)(t[0]),a={...i,query:{...n.query,f:"json",sr:r.wkid??JSON.stringify(r),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.default)(n.path+"/simplify",a);var l;return function(e,t,i){const n=(0,f.q9)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,s,r)}const y=s.Z.getLogger("esri.geometry.support.normalizeUtils");function g(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(e),new r.Z(e)}const i=(0,l.x3)(e),n=[];for(const e of i){const i=[];n.push(i),i.push([e[0][0],e[0][1]]);for(let n=0;n<e.length-1;n++){const r=e[n][0],s=e[n][1],a=e[n+1][0],o=e[n+1][1],l=Math.sqrt((a-r)*(a-r)+(o-s)*(o-s)),c=(o-s)/l,u=(a-r)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const n=e*t,a=u*n+r,o=c*n+s;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,n=u*e+r,a=c*e+s;i.push([n,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:n,spatialReference:e.spatialReference}):new o.Z({paths:n,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function I(e,t,i){if(Array.isArray(e)){const n=e[0];if(n>t){const i=(0,l.XZ)(n,t);e[0]=n+i*(-2*t)}else if(n<i){const t=(0,l.XZ)(n,i);e[0]=n+t*(-2*i)}}else{const n=e.x;if(n>t){const i=(0,l.XZ)(n,t);e=e.clone().offset(i*(-2*t),0)}else if(n<i){const t=(0,l.XZ)(n,i);e=e.clone().offset(t*(-2*i),0)}}return e}function b(e,t){let i=-1;for(let n=0;n<t.cutIndexes.length;n++){const r=t.cutIndexes[n],s=t.geometries[n],a=(0,l.x3)(s);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const n=t[e][0];i=n>i?n:i}i=Number(i.toFixed(9));const n=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=s.getPoint(e,i);s.setPoint(e,i,t.clone().offset(n,0))}return!0}}))}if(r===i){if(g(e))for(const t of(0,l.x3)(s))e[r]=e[r].addRing(t);else if(x(e))for(const t of(0,l.x3)(s))e[r]=e[r].addPath(t)}else i=r,e[r]=s}return e}async function S(e,t,i){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&y.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??n.Z.geometryServiceUrl;let s,p,g,x,_,R,v,T,C=0;const k=[],F=[];for(const t of e)if(null!=t)if(s||(s=t.spatialReference,p=(0,c.C5)(s),g=s.isWebMercator,R=g?102100:4326,x=l.UZ[R].maxX,_=l.UZ[R].minX,v=l.UZ[R].plus180Line,T=l.UZ[R].minus180Line),p)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(I(t.clone(),x,_));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>I(e,x,_))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,p);F.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,_)*(2*x);let n=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(v)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,n=w(n,g),k.push(n),F.push("cut")):e.intersects(T)&&e.xmin!==_?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,n=w(n,g,360),k.push(n),F.push("cut")):F.push(n)}else F.push(t.clone());else F.push(t);else F.push(t);let M=(0,l.XZ)(C,x),P=-90;const O=M,D=new o.Z;for(;M>0;){const e=360*M-180;D.addPath([[e,P],[e,-1*P]]),P*=-1,M--}if(k.length>0&&O>0){const t=b(k,await async function(e,t,i,n){const r=(0,d.en)(e),s=t[0].spatialReference,a={...n,query:{...r.query,f:"json",sr:JSON.stringify(s),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.default)(r.path+"/cut",a),{cutIndexes:l,geometries:c=[]}=o.data;return{cutIndexes:l,geometries:c.map((e=>{const t=(0,f.im)(e);return t.spatialReference=s,t}))}}(r,k,D,i)),n=[],s=[];for(let i=0;i<F.length;i++){const r=F[i];if("cut"!==r)s.push(r);else{const r=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&r.rings.length>=a.rings.length?(n.push(r),s.push("simplify")):s.push(g?(0,u.$)(r):r)}}if(!n.length)return s;const a=await m(r,n,i),o=[];for(let e=0;e<s.length;e++){const t=s[e];"simplify"!==t?o.push(t):o.push(g?(0,u.$)(a.shift()):a.shift())}return o}const Z=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)Z.push(t);else{const e=k.shift();Z.push(!0===g?(0,u.$)(e):e)}}return Z}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var n=i(58901),r=i(82971),s=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new n.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator}),minus180Line:new n.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new n.Z({paths:[[[180,-180],[180,180]]],spatialReference:r.Z.WGS84}),minus180Line:new n.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:r.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,s.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ht});var n=i(43697),r=i(51773),s=i(30030),a=i(20102),o=i(92604),l=i(16453),c=i(95330),u=i(17445),h=i(5600),f=i(75215),d=(i(67676),i(80442)),p=i(36030),m=i(71715),y=i(52011),g=i(87085),x=i(17287),w=i(71612),I=i(17017),b=(i(66577),i(3172)),S=i(8744),_=i(66677),R=i(21506),v=i(35956),T=i(29876),C=i(40297),k=i(88281),F=i(11145),M=i(96674),P=i(70586),O=i(609),D=i(39450),Z=i(36679),A=i(99815),B=i(73506),z=i(94139);const J=new Map,N=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.refCount--,e.refCount<=0&&(n.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.ts=Date.now(),e.refCount++,n.delete(i),n.set(i,e),e.block}return null}putBlock(e,t,i,n){const r=this._cachedBlocks,s=e+"/"+t;if(r.has(s)){const e=r.get(s);e.ts=Date.now(),e.refCount++}else r.set(s,{block:i,ts:Date.now(),refCount:1,controller:n});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,n=e+"/"+t;i.has(n)&&i.delete(n)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let n=0;n<t.length&&t[n][1].ts<=i-this._duration;n++)e.delete(t[n][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function E(e,t){return null==t?e:`${e}?sliceId=${t}`}function H(e,t,i){const n=J.get(e);if(!n)return null==t?N.decreaseRefCount(e,i):0;if(null==t||null==n[t])return N.decreaseRefCount(e,i);const r=n[t]?.cache,s=r?.get(i);if(r&&s){if(s.refCount--,0===s.refCount){r.delete(i);for(let e=0;e<n.length;e++)n[e]?.cache.delete(i);s.controller&&s.controller.abort()}return s.refCount}return 0}function L(e,t,i){const n=J.get(e);if(!n)return null==t?N.getBlock(e,i):null;if(null==t||null==n[t]){for(let e=0;e<n.length;e++){const t=n[e]?.cache.get(i);if(t)return t.refCount++,t.block}return N.getBlock(e,i)}const r=n[t]?.cache.get(i);if(r)return r.refCount++,r.block;for(let e=0;e<n.length;e++){if(e===t||!n[e])continue;const r=n[e]?.cache,s=r?.get(i);if(r&&s)return s.refCount++,r.set(i,s),s.block}return null}function G(e,t,i,n,r=null){const s=J.get(e);if(!s)return void(null==t&&N.putBlock(e,i,n,r));if(null==t||null==s[t])return void N.putBlock(e,i,n,r);const a={refCount:1,block:n,isResolved:!1,isRejected:!1,controller:r};n.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),s[t]?.cache.set(i,a)}function W(e,t,i){const n=J.get(e);n?null!=t&&null!=n[t]?n[t]?.cache.delete(i):N.deleteBlock(e,i):null==t&&N.deleteBlock(e,i)}var q=i(81578),j=i(75993),U=i(55914),V=i(80676),$=i(6570);let X=class extends((0,O.v)(M.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,B.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:F.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,B.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,_.Nm)(e,o.Z.getLogger(this.declaredClass)))}async open(e){throw new a.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){const r=n.tileInfo||this.rasterInfo.storageInfo.tileInfo,s=this.getTileExtentFromTileInfo(e,t,i,r);return this.fetchPixels(s,r.size[0],r.size[1],n)}async identify(e,t={}){e=(0,f.TJ)(z.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:n}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:s,multidimensionalInfo:a}=r;let{transposedVariableName:o}=t;const l=null!=a&&s&&(null!=n||(0,A.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=r,{datumTransformation:h}=t;let d=(0,B.nF)(e,c,h);if(!u.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let p=0;const m=null!=o&&null!=a&&r.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(d,t);const{pixelSize:i}=r,n=3,s=i.x*n/2,a=i.y*n/2,o=new $.Z({xmin:d.x-s,xmax:d.x+s,ymin:d.y-a,ymax:d.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,n,n,l),{pixelBlock:h}=await this.fetchPixels(o,n,n,l);if(null==u)return{location:d,value:null};const f=Math.floor(n*n*.5),p=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let y;return null!=h&&(y=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:d,value:p,processedValue:y,pyramidLevel:0}}if(!m)if(t.srcResolution)p=(0,B.kr)(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel;else if(p=await this.computeBestPyramidLevelForLocation(e,t),null==p)return{location:d,value:null};const y=this.identifyPixelLocation(d,p,null,m);if(null===y)return{location:d,value:null};const{row:g,col:x,rowOffset:w,colOffset:I,blockWidth:b}=y,S=o??t.sliceId,_=E(this.url,S),R=`${p}/${g}/${x}`;let v=L(_,null,R);null==v&&(v=this.fetchRawTile(p,g,x,t),G(_,null,R,v));const T=await v;if(null==T||!T.pixels?.length)return{location:d,value:null};const C=w*b+I;return this._processIdentifyResult(T,{srcLocation:d,position:C,pyramidLevel:p,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,n={}){e=(0,B.kZ)(e),n=this._getRequestOptionsWithSliceId(n);const{_hasNoneOrGCSShiftTransform:r}=this;if(n.requestRawData&&r)return this._fetchPixels(e,t,i,n);const s=(0,B.ut)(e.spatialReference),a=(0,B.Hq)(e);if(null==s||0===a||1===a&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,n);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(s/(c-l)*t),h=u-Math.round((s/2-l)/(c-l)*t);let f=0;const d=[];for(let r=0;r<=a;r++){const p=new $.Z({xmin:0===r?l:-s/2,xmax:r===a?c-s*r:s/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===r?u-h:r===a?t-f:u;f+=m,d.push(m);const y=n.disableWrapAround&&r>0?null:this._fetchPixels(p,m,i,n);o.push(y)}const p=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const y={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},n)).pixelBlock:(0,U.us)(p,y,{blockWidths:d}),{extent:e,srcExtent:(0,B.tB)(e,this.rasterInfo.spatialReference,n.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,n={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,n),{nativeExtent:s,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new $.Z({xmin:s.xmin+c*t.x,xmax:s.xmin+c*(t.x+i.width-1),ymin:s.ymax-u*(t.y+i.height-1),ymax:s.ymax-u*t.y,spatialReference:s.spatialReference});if(!r)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=r;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:r.pixelBlocks[0]};const p=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,y={x:t.x%p,y:t.y%m};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:n.interpolation,alignmentInfo:null,blockWidths:null},n)).pixelBlock:(0,U.us)(f,d,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,n){throw new a.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,B.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,j.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:n}=this.ioConfig,{range:r,query:s,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await(0,b.default)(e,{...t,query:{...s,...n},headers:{...a,...o}})}catch(n){if(i>0)return i--,this.request(e,t,i);throw n}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,A.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,n){const r=(0,P.s3)(n.lodAt(e));return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,n.origin,n.spatialReference,n.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const r=[],s=e.maximumPyramidLevel||0;let a=Math.max(n.x,n.y),o=1/.0254*96*a;for(let e=0;e<=s;e++)r.push(new D.Z({level:s-e,resolution:a,scale:o})),a*=2,o*=2;const l=new z.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new F.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,n){const{width:r,height:s,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new z.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(r,s))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],n);e.storageInfo=new Z.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,n,r,s=0,a=2){if(1===r.length&&s>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<s;i++)e*=a,t*=a,r.push({x:e,y:t})}const o=[],{x:l,y:c}=n;for(let n=0;n<r.length;n++){const{x:s,y:a}=r[n];o.push({minCol:Math.floor((e.xmin-l+.1*s)/t/s),maxCol:Math.floor((e.xmax-l-.1*s)/t/s),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:n}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=n**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,n){const{spatialReference:r,nativeExtent:s,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=n&&null!=c?c.tileSize[0]:a.blockWidth,h=n&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,B.nF)(e,r,i);if(!s.intersects(f))return null;if(t<0||t>o)return null;const d=this.getPyramidPixelSize(t),{x:p,y:m}=d,y=(l.y-f.y)/m/h,g=(f.x-l.x)/p/u,x=Math.min(h-1,Math.floor((y-Math.floor(y))*h)),w=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(y),col:Math.floor(g),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,n,r,s){const[a,o]=s,l=n.x+i*a*e.x,c=l+a*e.x,u=n.y-t*o*e.y,h=u-o*e.y;return new $.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const n=this.rasterInfo.storageInfo.blockBoundary[e];return!n||n.maxRow<t||n.maxCol<i||n.minRow>t||n.minCol>i}async _fetchPixels(e,t,i,n={}){let r=(0,B.Hq)(e);if(r>=2)return{extent:e,pixelBlock:null};const s=this._getSourceDataInfo(e,t,i,n),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=s;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,d=f.transform,p="gcs-shift"===d?.type,m=null!=(0,B.ut)(e.spatialReference);!p&&m||(r=(0,B.Hq)(s.srcExtent,p));const y=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:r},n);if(!y)return{extent:e,srcExtent:l,pixelBlock:null};const g=f.storageInfo,x=a>0?g.pyramidBlockWidth:g.blockWidth,w=a>0?g.pyramidBlockHeight:g.blockHeight;let{x:I,y:b}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[a-1])({x:I,y:b}=e[a-1]);else{const e=t**a;I*=e,b*=e}}const S=new z.Z({x:I,y:b,spatialReference:f.spatialReference}),_=x===c&&w===u&&h.x%x==0&&h.y%w==0,R=new z.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),v=!e.spatialReference.equals(this.rasterInfo.spatialReference),{datumTransformation:T}=n;if(!v&&_&&1===y.pixelBlocks.length&&x===t&&w===i&&o.x===R.x&&o.y===R.y)return{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:y.pixelBlocks[0]};const C=m&&null!=(0,B.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,k=n.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");k&&!this.rasterJobHandler&&await(0,B.zD)();const F=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R.toJSON(),datumTransformation:T,rasterTransform:d,hasWrapAround:r>0||C,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:k},n):(0,B.Qp)({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R,datumTransformation:T,rasterTransform:d,hasWrapAround:r>0||C,isAdaptive:!1,includeGCSGrid:k});let M;const P=!n.requestRawData,O={rows:F.spacing[0],cols:F.spacing[1]},D=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,y.extent.xmin):void 0,{pixelBlocks:Z,mosaicSize:A,isPartiallyFilled:J}=y;let N=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:Z,srcMosaicSize:A,destDimension:P?{width:t,height:i}:null,coefs:P?F.coefficients:null,sampleSpacing:P?O:null,projectDirections:k,gcsGrid:k?F.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:n.interpolation,alignmentInfo:D,blockWidths:null},n);({pixelBlock:M,localNorthDirections:N}=e)}else{const e=(0,U.us)(Z,A,{alignmentInfo:D});M=P?(0,U.Uk)(e,{width:t,height:i},F.coefficients,O,n.interpolation):e,k&&F.gcsGrid&&(N=(0,U.Qh)({width:t,height:i},F.gcsGrid),M=(0,V.xQ)(M,this.rasterInfo.dataType,N))}return n.requestRawData||k?{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:M,transformGrid:F,localNorthDirections:N,isPartiallyFilled:J}:{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:M}}async _fetchRawTiles(e,t,i,n){const{origin:r,blockBoundary:s}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const d=this._getRasterTileAlignmentInfo(e,0);n.buffer&&(l-=n.buffer.cols,c-=n.buffer.rows,u+=2*n.buffer.cols,h+=2*n.buffer.rows);let p=0,m=0,y=0;f&&null!=d&&(({worldColumnCountFromOrigin:m,originColumnOffset:y,rightPadding:p}=d),m*d.blockWidth-p>=l+u&&(p=0));const g=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+p-1)/a),I=Math.floor((c+h+p-1)/o),b=s[e];if(!b)return null;const{minRow:S,minCol:_,maxCol:R,maxRow:v}=b;if(0===f&&(I<S||w<_||x>v||g>R))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?n.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=I;t++)for(let i=g;i<=w;i++){let r=i;if(!n.disableWrapAround&&f&&null!=d&&m<=i&&(r=i-m-y),t>=S&&r>=_&&v>=t&&R>=r){const i=this._fetchRawTile(e,t,r,n);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const F=await Promise.all(T),M={height:(I-x+1)*o,width:(w-g+1)*a},{spatialReference:P}=this.rasterInfo,O=this.getPyramidPixelSize(e),{x:D,y:Z}=O;return{extent:new $.Z({xmin:r.x+g*a*D,xmax:r.x+(w+1)*a*D,ymin:r.y-(I+1)*o*Z,ymax:r.y-x*o*Z,spatialReference:P}),pixelBlocks:F,mosaicSize:M,isPartiallyFilled:C}}_fetchRawTile(e,t,i,n){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:s,minCol:a,maxCol:o,maxRow:l}=r;if(t<s||i<a||t>l||i>o)return Promise.resolve(null);const u=E(this.url,n.sliceId),h=`${e}/${t}/${i}`;let f=L(u,n.registryId,h);if(null==f){const r=new AbortController;f=this.fetchRawTile(e,t,i,{...n,signal:r.signal}),G(u,n.registryId,h,f,r),f.catch((()=>W(u,n.registryId,h)))}return n.signal&&(0,c.fu)(n,(()=>{H(u,n.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const n=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,s]=e,a=[],o=[];for(let e=0;e<n;e++){const[t,i]=(0,V.Tg)([r[e],s[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,B.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,n={}){const r={datumTransformation:n.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};n.srcResolution&&(r.srcResolution=n.srcResolution,this._updateSourceDataInfo(e,r));const s=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=r,c=a/t,u=o/i,h=l<s&&c*u>=16,f=l===s&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new z.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,B.VO)(a,this.rasterInfo.spatialReference,e,r.datumTransformation);const f=!o||n.srcResolution&&o.x+o.y<n.srcResolution.x+n.srcResolution.y;if(h&&n.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(s-l+3>=e){const t=2**e;o={x:n.srcResolution.x*t,y:n.srcResolution.y*t}}}o&&(r.srcResolution=o,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,n){const{tileInfo:r}=this.rasterInfo.storageInfo;return Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1])>=256||e/i>8||t/n>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,n=i.spatialReference,{srcResolution:r,datumTransformation:s}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,B.kr)(r,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,B.tB)(e,n,s);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,d=Math.floor((c.xmin-h)/o.x+.1),p=Math.floor((f-c.ymax)/o.y+.1),m=Math.floor((c.xmax-h)/o.x-.1),y=Math.floor((f-c.ymin)/o.y-.1),g=c.width<.1*o.x?0:m-d+1,x=c.height<.1*o.y?0:y-p+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=g,t.srcHeight=x,t.ul={x:d,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:n,pyramidLevel:r,useTransposedTile:s}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[n])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!s){const t=e.pixels.map((e=>e[n])),s={location:i,value:t,pyramidLevel:r},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(s.magdirValue=a.map((e=>e[0]))),s}let l=e.pixels.map((e=>e.slice(n*a,n*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,A.MO)(o,h.transposedVariableName);if(u){const e=(0,A.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const d=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:l,pixelType:e.pixelType};let m;return null!=d&&((0,q.A)(p,d),m=p.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===m?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new v.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};(0,n._)([(0,h.Cb)()],X.prototype,"_rasterTileAlighmentInfo",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],X.prototype,"_isGlobalWrappableSource",null),(0,n._)([(0,h.Cb)({readOnly:!0})],X.prototype,"_hasNoneOrGCSShiftTransform",null),(0,n._)([(0,h.Cb)()],X.prototype,"rasterJobHandler",null),(0,n._)([(0,h.Cb)(R.HQ)],X.prototype,"url",null),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetName",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"hasUniqueSourceStorageInfo",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"sourceJSON",void 0),X=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.BaseRaster")],X);const Y=X;let K=class extends Y{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:n}=this.primaryRasters,r=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(r);const s=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:s,rasterIds:n});if(!o.success||0===s.length)throw new a.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);await this.syncJobHandler();const l=s[0];this.hasUniqueSourceStorageInfo=1===s.length||s.slice(1).every((e=>this._hasSameStorageInfo(e,l))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,n={}){const{rasters:r,rasterIds:s}=this.primaryRasters;let a=!1;const{interpolation:o}=n,l=this.rasterFunction.flatWebGLFunctionChain?.hasSurfaceFunction;!n.requestRawData&&"bilinear"!==o&&l&&(a=1===r.length&&!n.skipRasterFunction,n={...n,interpolation:"bilinear",requestRawData:a});const c=r.map((r=>r.fetchPixels(e,t,i,n))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||n.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(n.skipRasterFunction||h.every((e=>null==e)))return u[0];const d=u.find((e=>null!=e.pixelBlock))?.extent??e,p=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}),{transformGrid:m}=u[0];if(!a||null==p||null==m)return{...u[0],pixelBlock:p};const y={rows:m.spacing[0],cols:m.spacing[1]};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[p],srcMosaicSize:{width:p.width,height:p.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:y,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},n)).pixelBlock:(0,U.Uk)(p,{width:t,height:i},m.coefficients,y,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:n,spatialReference:r,extent:s}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return n.x===o.x&&n.y===o.y&&r.equals(l)&&s.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],K.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"tileType",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"primaryRasters",void 0),K=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.FunctionRaster")],K);const Q=K;var ee=i(67900),te=i(61433),ie=i(5847);var ne=i(98722),re=i(15612),se=i(67058),ae=i(72758),oe=i(79681),le=i(23808),ce=i(82971);const ue=o.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),he=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}get tileInfo(){return this.rasterInfo?.storageInfo.tileInfo}set url(e){this._set("url",(0,_.Nm)(e,ue))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,V.KC)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.TJ)(oe.Z,e).clone();const{rasterInfo:i}=this,{geometry:n}=e;if(null==n)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","gemetry must be specified");let r=n;const{spatialReference:s}=i;n.spatialReference.equals(s)||(await(0,B.zD)(),r="extent"===n.type?(0,B.tB)(n,s):(0,B.Wt)(n,s));const o=e.pixelSize??new z.Z({...i.pixelSize,spatialReference:s}),{extent:l,width:c,height:u}=function(e,t,i,n=!0){const{spatialReference:r}=e,{x:s,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,ee.c9)(e.spatialReference),n=(0,ee.c9)(t);if(i===n)return e;const r=i/n;return{x:e.x*r,y:e.y*r}}(i,r);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:d,ymin:p}=u;const{xmin:m,ymax:y}=e.extent;return n?(h=m+(h>m?s*Math.round((h-m)/s):0),d=y-(d<y?a*Math.round((y-d)/a):0),f=m+(f>m?s*Math.round((f-m)/s):0),p=y-(p<y?a*Math.round((y-p)/a):0),o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r}),l=Math.round(o.width/s),c=Math.round(o.height/a)):(l=Math.floor((f-h)/s+.8),c=Math.floor((d-p)/a+.8),h=m+(h>m?s*Math.floor((h-m)/s+.1):0),d=y-(d<y?a*Math.floor((y-d)/a+.1):0),f=h+l*s,p=d-c*a,o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r})),{extent:o,width:l,height:c}}(i,r,o),h=await this.fetchPixels(l,c,u,{...t,interpolation:"nearest"});if(null==h.pixelBlock)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const d=function(e,t,i){if("extent"===i.type)return function(e,t,i){const{width:n,height:r}=e,s=new Uint8Array(n*r),a=t.width/n,o=t.height/r;if(i.width/a<.5||i.height/o<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:d,ymin:p,ymax:m}=i,y=Math.max(l,f),g=Math.min(c,d),x=Math.max(u,p),w=Math.min(h,m),I=.5*a,b=.5*o;if(g-y<I||w-x<b||g<l+I||y>c-I||x>h-b||w<u+b)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const S=Math.max(0,(y-l)/a),_=Math.min(n,Math.max(0,(g-l)/a)),R=Math.max(0,(h-w)/o),v=Math.min(r,Math.max(0,(h-x)/o)),T=Math.round(S),C=Math.round(_)-1,k=Math.round(R),F=Math.round(v)-1;if(T===C&&S%1>.5&&_%1<.5||k===F&&R%1>.5&&v%1<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});if(0===T&&0===k&&C===n&&F===r)return e;const M=e.mask;for(let e=k;e<=F;e++)for(let t=T;t<=C;t++){const i=e*n+t;s[i]=M?M[i]:255}return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]})}(e,t,i);const{width:n,height:r}=e,s=new Uint8Array(n*r);return(0,te.intersects)(t,i)?(0,te.contains)(i,t)?e:function(e,t,i){if(!e)return e;const{width:n,height:r}=e,s=t.width/n,a=t.height/r,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/s,t=(i.xmax-o)/s,n=(l-i.ymax)/a,r=(l-i.ymin)/a;c=[[[e,n],[e,r],[t,r],[t,n],[e,n]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/s,(l-t)/a]))));const u=document.createElement("canvas");u.width=n,u.height=r;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,n,r).data,d=e.mask,p=n*r,m=new Uint8Array(p);for(let e=0;e<p;e++)d&&!d[e]||(m[e]=f[4*e+3]>127?255:0);return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,i):new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,maskIsAlpha:!1,pixels:[...e.pixels]})}(h.pixelBlock,l,r),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:d},t):(0,re.js)(d)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,le.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=e.timeExtent||this.timeExtent;if(null!=i&&null!=n&&(null!=n.start||null!=n.end)){i=i.map((e=>e.clone()));const r=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),s=i.find((({dimensionName:e})=>"StdTime"===e));if(!r||!s)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=n,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=r.values){const e=r.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>u===h?(e[0]??e)-(t[0]??t):Math.abs((e[1]??e)-h)-Math.abs((t[1]??t)-h)))[0];s.values=[t]}else i=null}else if(r.hasRegularIntervals&&r.extent){const[e,t]=r.extent;u>t||h<e?i=null:s.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,A.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if("imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",C.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:n}=this;if(n){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const r=(0,ne.Ue)(n.rasterFunctionDefinition??n.toJSON(),i),s=new Q({rasterFunction:r});s.rasterJobHandler=this._rasterJobHandler.instance,await s.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=s}else this.raster=t,this._cachedRasterFunctionJson=null;if(this._cachedRendererJson=null,!i&&!n)return;const{bandIds:r}=this,{bandCount:s}=this.raster.rasterInfo,a=r?.length?r.some((e=>e>=s)):s>=3;r&&(a||"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t)return;const{rasterInfo:i}=this.raster,n=(0,A.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=n?.name,s=(0,se.ol)({...this.renderer.toJSON(),variableName:r});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(s))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,se.FI)(i,r),t.rendererJSON=s,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=s)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let n;await this.updateRenderer();const r=this._rasterJobHandler.instance,s=this.bandIds??[];return n=r?await r.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const n=(0,S.C5)(e);return F.Z.create({size:256,spatialReference:e,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,n,r={}){if(i(this),r.requestAsImageElement){const i=this.getTileUrl(e,t,n);return(0,b.default)(i,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:r.signal}).then((e=>e.data))}const{rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition){const i=r.tileInfo||s.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,n,i),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer.type&&(r={...r,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,n,r)}async fetchPixels(e,t,i,n={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,n))}async identify(e,t={}){const{raster:i,rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&!(n.hasMultidimensionalTranspose&&((0,A.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const r=this.multidimensionalSubset?.areaOfInterest;if(r&&!r.contains(e))throw new a.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,A.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new k.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{i(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,this.renderer&&this.updateRenderer(),"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){i(this);const{raster:e}=this,t=(0,se.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){i(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,se.YD)(t));const n=(0,A.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=n?.name;if(!this.renderer||"override"===e){const e=(0,se.Ob)(t,{bandIds:this.bandIds,variableName:r}),i=t.statistics,n=i&&i.length>0?i[0]:null,s=n?.max??0,a=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(s>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const s=(0,se.ol)({...this.renderer.toJSON(),variableName:r}),a=(0,se.FI)(t,r);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=a):this.symbolizer=new ae.Z({rendererJSON:s,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e)if("raster-colormap"!==t.type)this._configDefaultRenderer("override");else{const e=(0,se.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else ue.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function i(e){if(!e.raster||!e.rasterInfo)throw new a.Z("imagery-tile","no raster")}return(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRasterFunctionJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,n._)([(0,h.Cb)()],t.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)({type:[v.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,n._)([(0,h.Cb)({type:T.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"raster",void 0),(0,n._)([(0,h.Cb)({type:C.Z})],t.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:ce.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"tileInfo",null),(0,n._)([(0,h.Cb)(R.HQ)],t.prototype,"url",null),(0,n._)([(0,h.Cb)({types:s.dr})],t.prototype,"renderer",null),(0,n._)([(0,h.Cb)()],t.prototype,"symbolizer",void 0),t=(0,n._)([(0,y.j)("esri.layers.ImageryTileMixin")],t),t};var fe=i(38009),de=i(16859),pe=i(34760),me=i(72965),ye=i(28294),ge=i(1231),xe=i(69608),we=i(48526),Ie=i(20095);function be(e){const t=e.fields,i=e.records,n=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",r=[{name:n,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),s=r.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[n]=o++,l=1;l<s.length;l++)t[s[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:r,features:a}}class Se{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const n=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),a={version:i,recordCount:n,headerByteCount:r,recordByteCount:s};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,Ie.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<n&&e.byteLength-o>s;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,Ie.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const n=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(n.substring(0,4),10),parseInt(n.substring(4,6),10)-1,parseInt(n.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=s}}return{header:a,fields:l,records:c,recordSet:be({fields:l,records:c})}}}var _e=i(87521),Re=i(74889);const ve=new Map;ve.set("int16","esriFieldTypeSmallInteger"),ve.set("int32","esriFieldTypeInteger"),ve.set("int64","esriFieldTypeInteger"),ve.set("float32","esriFieldTypeSingle"),ve.set("float64","esriFieldTypeDouble"),ve.set("text","esriFieldTypeString");let Te=class extends Y{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new a.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:n}=this._parseHeader(t);if("thematic"===n.dataType){const e=await this._fetchAuxiliaryInformation();n.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",n),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,n={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:s}=n,a=!(!r||!s),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,n.multidimensionalDefinition,s),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:n.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const d=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:n.signal});if(!d)return null;const[p,m]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:p,height:m,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,histograms:n,colormap:r,blockWidth:s,blockHeight:a,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ce.Z(u?.wkid||u?.wkt?u:h);let d=new $.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const p=new z.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),m=Math.round((d.xmax-d.xmin)/p.x),y=Math.round((d.ymax-d.ymin)/p.y),g=this._parseTransform(e.geodataXform),x=g?d:null;g&&(d=g.forwardTransform(d),p.x=(d.xmax-d.xmin)/m,p.y=(d.ymax-d.ymin)/y);const w=e.properties??{},I=e.format.toLowerCase().replace("cache/",""),b=new z.Z(e.origin.x,e.origin.y,f);let S,_,R,v;if(r&&r.colors)for(S=[],_=0;_<r.colors.length;_++)R=r.colors[_],v=r.values?r.values[_]:_,S.push([v,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const T=e.LODInfos,C=[];for(_=0;_<T.levels.length;_++)C.push(new D.Z({level:T.levels[_],resolution:T.resolutions[_],scale:96/.0254*T.resolutions[_]}));const k=new F.Z({dpi:96,lods:C,format:I,origin:b,size:[s,a],spatialReference:f}),M={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},P=[{maxCol:Math.ceil(m/s)-1,maxRow:Math.ceil(y/a)-1,minCol:0,minRow:0}];let O=2;if(l>0)for(_=0;_<l;_++)P.push({maxCol:Math.ceil(m/O/s)-1,maxRow:Math.ceil(y/O/a)-1,minCol:0,minRow:0}),O*=2;const A=e.mdInfo;let B=null;if(A&&w._yxs){const e=w._yxs;B={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:M,rasterInfo:new we.Z({width:m,height:y,pixelType:t,bandCount:i,extent:d,nativeExtent:x,transform:g,spatialReference:f,pixelSize:p,keyProperties:w,statistics:c,histograms:n,multidimensionalInfo:A,colormap:S,storageInfo:new Z.Z({blockWidth:s,blockHeight:a,pyramidBlockWidth:s,pyramidBlockHeight:a,origin:b,tileInfo:k,transposeInfo:B,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:P})})}}_parseTransform(e){if(!(0,_e.j)(e))throw new a.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,_e.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),n=await Promise.all([t,i]);let r;if(n[0]){let e=n[0].fields;const t=n[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":ve.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(r={fields:e,features:i})}}return!r&&n[1]&&(r=Se.parse(n[1]).recordSet),Re.Z.fromJSON(r)}_buildCacheFilePath(e,t,i,n,r){const s=this._getPackageSize(!!r),a=Math.floor(t/s)*s,o=Math.floor(i/s)*s,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=n?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!r){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(r||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replace(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const n=this._getPackageSize(i),r=n*(e%n)+t%n;if(r<0)throw new Error("Invalid level / row / col");return 20+r*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let n,r=0;for(n=0;n<5;n++)r|=(255&i[n])<<8*n;const s=0xffffffffff&r;for(r=0,n=5;n<8;n++)r|=(255&i[n])<<8*(n-5);return{position:s,recordSize:0xffffffffff&r}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,n._)([(0,h.Cb)({readOnly:!0})],Te.prototype,"storageInfo",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.CloudRaster")],Te);const Ce=Te;let ke=class extends Y{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:n,histograms:r,name:s,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new $.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ce.Z({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,p={x:f.width/c,y:f.height/u},m=new we.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:p,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:n,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(m,512,512),this._set("rasterInfo",m),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=s,this.url="/InMemory/"+s}fetchRawTile(e,t,i,n={}){const r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,t,i){const n=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve((0,U.Vl)(e,t,n)),s=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,l=s?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,re.Hv)(e)),u=await(0,c.as)([r,l]);if(!u[0].value&&u[1].value)throw new a.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,s||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],ke.prototype,"data",void 0),ke=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],ke);const Fe=ke;function Me(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=[];if(t){const r=Me(e,i);for(let e=0;e<r.length;e++)Me(r[e],t).forEach((e=>n.push(e)));return n}const r=e.getElementsByTagNameNS("*",i);if(!r||0===r.length)return[];for(let e=0;e<r.length;e++)n.push(r[e]||r.item[e]);return n}function Pe(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=Me(e,i);return n.length>0?t?Pe(n[0],t):n[0]:null}function Oe(e,t=null){const i=t?Pe(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function De(e,t){return function(e,t){const i=Me(e,t),n=[];let r;for(let e=0;e<i.length;e++)r=i[e].textContent||i[e].nodeValue,r&&(r=r.trim(),""!==r&&n.push(r));return n}(e,t).map((e=>Number(e)))}function Ze(e,t){const i=Oe(e,t);return Number(i)}function Ae(e,t){const i=e?.nodeName?.toLowerCase(),n=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===n}var Be=i(87390);function ze(e,t){if(!e||!t)return null;const i=[];for(let n=0;n<e.length;n++)i.push(e[n]),i.push(t[n]);return i}function Je(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ce.Z({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),n=e.indexOf("PROJCS"),r=n>-1?n:e.indexOf("GEOGCS");if(-1===r)return null;const s=e.slice(r,e.lastIndexOf("]",i)+1).trim(),a=e.slice(i,e.lastIndexOf("]")).trim();t=Ne(s);const o=new ce.Z(t?{wkid:t}:{wkt:s}),l=Ne(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ne(e),new ce.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ne(e){const t=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),n=i[0]?.toLowerCase();if(("epsg"===n||"esri"===n)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ee(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Ae(e,"SRS")){if(!t.spatialReference){const i=Oe(e);t.spatialReference=Je(i)}}else if(Ae(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:n}=function(e){const t=Pe(e,"GeodataXform"),i=Je(Ze(t,"SpatialReference/WKID")||Oe(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const n=Ze(t,"PolynomialOrder")??1,r=De(t,"CoeffX/Double"),s=De(t,"CoeffY/Double"),a=De(t,"InverseCoeffX/Double"),o=De(t,"InverseCoeffY/Double"),l=ze(r,s),c=ze(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Be.Z({spatialReference:i,polynomialOrder:n,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=n,t.spatialReference||(t.spatialReference=i)}else Me(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=Oe(e)));else if(Ae(e,"PAMRasterBand")){const i=function(e){const t=Ze(e,"NoDataValue"),i=Pe(e,"Histograms/HistItem"),n=Ze(i,"HistMin"),r=Ze(i,"HistMax"),s=Ze(i,"BucketCount"),a=Oe(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Me(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=Ze(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=n&&null!=r?{min:n,max:r,size:s||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(P.pC):null;const n=!!i[0].histogram;t.histograms=n?i.map((e=>e.histogram)).filter(P.pC):null}return t}let He=class extends Y{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:r,transform:s}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ce.Z({wkid:3857})),r?.length&&null==n&&(n=(0,re.Oh)(r));const{width:o,height:l}=t;let c=new $.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=s?s.forwardTransform(c):c;let h=!0;if(s){const e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,c=u)}const f=new Fe({data:{extent:u,nativeExtent:c,transform:s,pixelBlock:t,statistics:n,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,n={}){return this._inMemoryRaster.fetchRawTile(e,t,i,n)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,j.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const n=i.toLowerCase(),r="gif"===n||"bmp"===n||!(0,d.Z)("ios"),s=await this.decodePixelBlock(t,{format:n,useCanvas:r,hasNoZlibMask:!0});if(null==s)throw new a.Z("image-aux-raster:open","the data cannot be decoded");return s}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],n=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,s="JPG"===r?"jgw":"PNG"===r?"pgw":"BMP"===r?"bpw":null,a=s&&i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,c.as)([n,a]);if(t?.aborted)throw(0,c.zE)();const l=Ee(o[0].value?.data);if(!l.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;l.transform=6===e?.length?new Be.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return l}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),He=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],He);const Le=He;var Ge=i(17452),We=i(45322),qe=i(56608),je=i(29680),Ue=i(26059);let Ve=class extends Y{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const n=i.data;if(this.sourceJSON=n,!n)throw new a.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new a.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=n.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(n.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===n.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=n.name?.slice(n.name.indexOf("/")+1)??"";const r=await this._fetchRasterInfo({signal:t});if(null==r)throw new a.Z("image-server-raster:open","cannot initialize image service");const s="Map"===this.tileType?(0,We.d)(n.tileInfo,n):F.Z.fromJSON(n.tileInfo);(0,P.O3)(s);const[o,l]=this._computeMinMaxLOD(r,s),{extent:c,pixelSize:u}=r,h=.5/r.width*u.x,f=Math.max(u.x,u.y),{lods:d}=s;("Map"!==this.tileType&&0!==n.maxScale||Math.abs(u.x-u.y)>h||!d.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,r.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),r.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const p=o.level-l.level,[m,y]=s.size,g=[],x=[];d.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<d.length-1&&x.push(Math.round(10*e.resolution/d[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,y,s.origin,g,p),I=g.length>1?g.slice(1):null;let b;n.transposeInfo&&(b={tileSize:[n.transposeInfo.rows,n.transposeInfo.cols],packetSize:r.keyProperties?._yxs.PacketSize??0});const S=x.length<=1||x.length>=3&&x.slice(0,x.length-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/p))/10;if(r.storageInfo=new Z.Z({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:I,pyramidScalingFactor:S,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,transposeInfo:b,blockBoundary:w}),this._fixGCSShift(r),this._set("rasterInfo",r),n.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:r.storageInfo.tileInfo,parsedUrl:(0,Ge.mN)(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new qe.y({layer:e})}}async fetchRawTile(e,t,i,n={}){const{storageInfo:r,extent:s}=this.rasterInfo,{transposeInfo:a}=r,o=null!=a&&!!n.transposedVariableName;if(this._slices&&!o&&null==n.sliceId)return null;const l=o?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:n.transposedVariableName}:{sliceId:n.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:n.signal});if(!h)return null;const f=o?a.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const p=r.blockBoundary[e];if("jpg"!==r.compression||i>p.minCol&&i<p.maxCol&&t>p.minRow&&t<p.maxRow)return d;const{origin:m,blockWidth:y,blockHeight:g}=r,{x,y:w}=this.getPyramidPixelSize(e),I=Math.round((s.xmin-m.x)/x)%y,b=Math.round((s.xmax-m.x)/x)%y||y,S=Math.round((m.y-s.ymax)/w)%g,_=Math.round((m.y-s.ymin)/w)%g||g,R=i===p.minCol?I:0,v=t===p.minRow?S:0,T=i===p.maxCol?b:y,C=t===p.maxRow?_:g;return(0,U.pW)(d,{x:R,y:v},{width:T-R,height:C-v}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),n=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,n]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let n=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let s=r-n+this._levelOffset;const a=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,n++,i=this.identifyPixelLocation(a,n,t.datumTransformation),null===i)return null}return-1===s||null==i?null:n}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),n=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=ce.Z.fromJSON(t.spatialReference||e.spatialReference),s=new z.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new we.Z({width:i,height:n,bandCount:3,extent:$.Z.fromJSON(e),spatialReference:r,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,n=(0,Ue.g)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,s=await Promise.all([n,r]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new je.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,n=.5/e.width*i.x,{lods:r}=t,s=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[s,a];if("Raster"===o)return[r.find((e=>e.resolution===i.x))??s,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=s;c>0&&(u=r.find((e=>Math.abs(e.scale-c)<n)),u||(u=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??s));let h=a;return l>0&&(h=r.find((e=>Math.abs(e.scale-l)<n))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Ve.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],Ve.prototype,"tileType",void 0),Ve=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],Ve);const $e=Ve;var Xe=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Ke=new Map;Ke.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ke.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ke.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ke.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Qe=class extends Y{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:n,files:r}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(n.statistics=t.statistics??n.statistics,n.histograms=t.histograms,t.histograms&&null==n.statistics&&(n.statistics=(0,re.Oh)(t.histograms)))}this._set("rasterInfo",n),this._files=r;const s=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(s.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,p=-1;for(;d<this._storageIndex.length;){p++;const e=Math.ceil(c/a/l**p)-1,t=Math.ceil(u/o/l**p)-1;d+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,p>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=p),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:r,blockHeight:s,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(r*s);return new ie.Z({width:r,height:s,pixels:null,mask:e,validPixelCount:0})}const{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<p;y++)(!d||d.indexOf[y]>-1)&&m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:n.signal}));const g=await Promise.all(m),x=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let I=0;for(y=0;y<p;y++)w.set(new Uint8Array(g[y].data),I),I+=g[y].data.byteLength;const b=Ke.get(this.rasterInfo.storageInfo.compression).decoderFormat,S=await this.decodePixelBlock(w.buffer,{width:r,height:s,format:b,planes:d?.length||l,pixelType:c});if(null==S)return null;if(null!=this.rasterInfo.noDataValue&&"lerc"!==b&&!S.mask){const e=this.rasterInfo.noDataValue[0];if(null!=e){const t=S.width*S.height,i=new Uint8Array(t);if(Math.abs(e)>1e24)for(y=0;y<t;y++)Math.abs((S.pixels[0][y]-e)/e)>1e-6&&(i[y]=1);else for(y=0;y<t;y++)S.pixels[0][y]!==e&&(i[y]=1);S.mask=i}}let _=0,R=0;if(h!==r||f!==s){let e=S.mask;if(e)for(y=0;y<s;y++)if(R=y*r,y<f)for(_=h;_<r;_++)e[R+_]=0;else for(_=0;_<r;_++)e[R+_]=0;else for(e=new Uint8Array(r*s),S.mask=e,y=0;y<f;y++)for(R=y*r,_=0;_<h;_++)e[R+_]=1}return S}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,n,r,s,a;if(Xe.f){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),n=new Uint8Array(r),s=0;s<e.byteLength/4;s++)for(a=0;a<4;a++)n[4*s+a]=i[4*s+3-a];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Ke.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:n,blockHeight:r,pyramidScalingFactor:s}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,d=0;for(h=0;h<e;h++)d=s**h,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=c*u;d=s**e,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=t*c+i,f*=4*l;const p=this._storageIndex.subarray(f,f+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=p[4*e]*2**32+p[4*e+1],y=m+p[4*e+2]*2**32+p[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?n:Math.ceil(a/d)-n*(c-1),actualTileHeight:t<u-1?r:Math.ceil(o/d)-r*(u-1)}}_parseHeader(e){const t=Pe(e,"MRF_META/Raster");if(!t)throw new a.Z("mrf:open","not a valid MRF format");const i=Pe(t,"Size"),n=parseInt(i.getAttribute("x"),10),r=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),o=(Oe(t,"Compression")||"none").toLowerCase();if(!Ke.has(o))throw new a.Z("mrf:open","currently does not support compression "+o);const l=Oe(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new a.Z("mrf:open","currently does not support pixel type "+l);const u=Pe(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),d=Pe(t,"DataValues");let p,m;if(d&&(m=d.getAttribute("NoData"),null!=m&&(p=m.trim().split(" ").map((e=>parseFloat(e))))),Pe(e,"MRF_META/CachedSource"))throw new a.Z("mrf:open","currently does not support MRF referencing other data files");const y=Pe(e,"MRF_META/GeoTags"),g=Pe(y,"BoundingBox");let x,w=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),n=parseFloat(g.getAttribute("maxy")),r=Oe(y,"Projection")||"";let s=ce.Z.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){const e=Number(r.slice(5));isNaN(e)||0===e||(s=new ce.Z({wkid:e}))}else s=Je(r)??ce.Z.WGS84;else w=!0,s=new ce.Z({wkid:3857});x=new $.Z(e,t,i,n),x.spatialReference=s}else w=!0,x=new $.Z({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:new ce.Z({wkid:3857})});const I=Pe(e,"MRF_META/Rsets"),b=parseInt(I&&I.getAttribute("scale")||"2",10),S=x.spatialReference,_=new Z.Z({origin:new z.Z({x:x.xmin,y:x.ymax,spatialReference:S}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:b}),R=new z.Z({x:x.width/n,y:x.height/r,spatialReference:S}),v=new we.Z({width:n,height:r,extent:x,isPseudoSpatialReference:w,spatialReference:S,bandCount:s,pixelType:c,pixelSize:R,noDataValue:p,storageInfo:_}),T=Oe(e,"datafile"),C=Oe(e,"IndexFile");return{rasterInfo:v,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Ke.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}};(0,n._)([(0,h.Cb)()],Qe.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],Qe.prototype,"_storageIndex",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Qe.prototype,"datasetFormat",void 0),Qe=(0,n._)([(0,y.j)("esri.layers.support.rasterIO.MRFRaster")],Qe);const et=Qe;var tt=i(94793),it=i(9832);const nt=(e,t)=>e.get(t)?.values,rt=(e,t)=>e.get(t)?.values?.[0];let st=class extends Y{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new a.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:n,firstIFDPos:r,isBigTiff:s}=(0,tt.cK)(i),o=[];await this._readIFDs(o,i,n,r,0,s?8:4,t);const{imageInfo:l,rasterInfo:c}=this._parseIFDs(o),u=(0,tt.ee)(o),h=(0,tt.I7)(o);if(this._headerInfo={littleEndian:n,isBigTiff:s,ifds:o,pyramidIFDs:u,maskIFDs:h,...l},this._set("rasterInfo",c),!l.isSupported)throw new a.Z("tiffraster:open","this tiff is not supported: "+l.message);if(!l.tileWidth)throw new a.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");const{skipExtensions:f=[]}=this.ioConfig;if(!f.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,c)}f.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const r=await this._fetchRawTiffTile(e,t,i,!1,n);if(null!=r&&this._headerInfo.hasMaskBand){const s=await this._fetchRawTiffTile(e,t,i,!0,n);null!=s&&s.pixels[0]instanceof Uint8Array&&(r.mask=s.pixels[0])}return r}_parseIFDs(e){const t=(0,tt.FI)(e),{width:i,height:n,tileWidth:r,tileHeight:s,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:p,metadata:m}=t;let y=Je(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),g=!!t.isPseudoGeographic;null==y&&(g=!0,y=new ce.Z({wkid:3857}));const x=new $.Z({...t.extent,spatialReference:y}),w=new z.Z(x?{x:x.xmin,y:x.ymax,spatialReference:y}:{x:0,y:0}),I=new Z.Z({blockWidth:r,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:d}),b=new z.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),S=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let _=null;const R=rt(e[0],"PHOTOMETRICINTERPRETATION"),v=nt(e[0],"COLORMAP");if(R<=3&&v?.length>3&&v.length%3==0){_=[];const e=v.length/3;for(let t=0;t<e;t++)_.push([t,v[t]>>>8,v[t+e]>>>8,v[t+2*e]>>>8])}const T=new we.Z({width:i,height:n,bandCount:a,pixelType:o,pixelSize:b,storageInfo:I,spatialReference:y,isPseudoSpatialReference:g,keyProperties:S,extent:x,colormap:_,statistics:m?m.statistics:null});return p?.length&&(T.nativeExtent=new $.Z({xmin:-.5,ymin:.5-n,xmax:i-.5,ymax:.5,spatialReference:y}),T.transform=new Be.Z({polynomialOrder:1,forwardCoefficients:[p[2]+p[0]/2,p[5]-p[3]/2,p[0],p[3],-p[1],-p[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new z.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),I.origin.x=-.5,I.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,re.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new z.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,n,r,s=4,a){if(!n)return null;(n>=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+r,to:n+r+this._bufferSize},responseType:"array-buffer",signal:a})).data,r=n+r,n=0);const o=await this._readIFD(t,i,n,r,it.Z.TIFF_TAGS,s,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-r,r,s,a)}async _readIFD(e,t,i,n,r=it.Z.TIFF_TAGS,s=4,a){if(!e)return null;const o=(0,tt.vr)(e,t,i,n,r,s);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const r=i.map((e=>e.offlineOffsetSize)).filter(P.pC),s=Math.min.apply(null,r.map((e=>e[0])));if(Math.min.apply(null,r.map((e=>e[0]+e[1])))-s<=this._bufferSize){const{data:r}=await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:a});e=r,n=s,i.forEach((i=>(0,tt.Dq)(e,t,i,n)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){const s=r[0]+"."+r[1]+"."+r[2],o=await this._readIFD(e,t,i.valueOffset+6-n,n,it.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:n,to:n+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,n,it.Z.TIFF_TAGS,4,a)}}async _fetchRawTiffTile(e,t,i,n,r={}){const s=this._getTileLocation(e,t,i,n);if(!s)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=s,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),d=1===h.length?h[0].data:new ArrayBuffer(f),p=[0],m=[0];if(h.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){const n=h[t].data;e.set(new Uint8Array(n),i),p[t]=i,i+=n.byteLength,m[t]=n.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:p,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,I,b;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(b=w*y,w<l)for(I=o;I<y;I++)e[b+I]=0;else for(I=0;I<y;I++)e[b+I]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(b=w*y,I=0;I<o;I++)e[b+I]=1}return x}_getTileLocation(e,t,i,n=!1){const{firstPyramidLevel:r,blockBoundary:s}=this.rasterInfo.storageInfo,a=0===e?0:e-(r-1),{_headerInfo:o}=this;if(!o)return null;const l=n?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,tt.If)(l,o),u=nt(l,"TILEOFFSETS");if(void 0===u)return null;const h=nt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:d,maxRow:p,maxCol:m}=s[a];if(t>p||i>m||t<f||i<d)return null;const y=rt(l,"IMAGEWIDTH"),g=rt(l,"IMAGELENGTH"),x=rt(l,"TILEWIDTH"),w=rt(l,"TILELENGTH"),I=c?this.rasterInfo.bandCount:1,b=I*t*(m+1)+i,S=[{from:u[b],to:u[b+I-1]+h[b+I-1]-1}];if(c){let e=!0;for(let t=0;t<I;t++)if(u[b+t]+h[b+t]!==u[b+t+1]){e=!1;break}if(!e)for(let e=0;e<I;e++)S[e]={from:u[b+e],to:u[b+e]+h[b+e]-1}}const _=u[b],R=h[b];return null==_||null==R?null:{ranges:S,ifd:l,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===p&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Se.parse(t);return i?.recordSet?Re.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,n._)([(0,h.Cb)()],st.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_headerInfo",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_bufferSize",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],st.prototype,"datasetFormat",void 0),st=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.TIFFRaster")],st);const at=st,ot=new Map;ot.set("CRF",{desc:"Cloud Raster Format",constructor:Ce}),ot.set("MRF",{desc:"Meta Raster Format",constructor:et}),ot.set("TIFF",{desc:"GeoTIFF",constructor:at}),ot.set("RasterTileServer",{desc:"Raster Tile Server",constructor:$e}),ot.set("JPG",{desc:"JPG Raster Format",constructor:Le}),ot.set("PNG",{desc:"PNG Raster Format",constructor:Le}),ot.set("GIF",{desc:"GIF Raster Format",constructor:Le}),ot.set("BMP",{desc:"BMP Raster Format",constructor:Le});class lt{static get supportedFormats(){const e=new Set;return ot.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:n}=e;let r=e.datasetFormat;null==r&&t.lastIndexOf(".")&&(r=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===r||"TIF"===r?r="TIFF":"JPG"!==r&&"JPEG"!==r&&"JFIF"!==r||(r="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const s={url:t,sourceJSON:n,datasetFormat:r,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(r&&this.supportedFormats.has(r)){if("CRF"===r&&!i?.enableCRF)throw new a.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=ot.get(r).constructor,l=new o(s),await l.open({signal:e.signal}),l}if(r)throw new a.Z("rasterfactory:open","not a supported format "+r);const c=Array.from(ot.keys());let u=0;const h=()=>(r=c[u++],r&&("CRF"!==r||i?.enableCRF)?(o=ot.get(r).constructor,l=new o(s),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){ot.has(e.toUpperCase())||ot.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(32163);let ut=class extends((0,w.h)((0,me.M)((0,fe.q)((0,de.I)((0,I.N)(he((0,ye.n)((0,x.Y)((0,pe.Q)((0,l.R)(g.Z))))))))))){constructor(...e){super(...e),this._primaryRasters=null,this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[new ge.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const{rasterInfo:t}=this,i=t?.attributeTable,n=null!=i?i.fields:null;if(n){const t=n.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e=e.concat(t)}const r=t?.dataType,s=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=s){const t=s.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ge.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ge.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,i){const n=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,r=(0,s.ij)(n,i)||void 0;if(null!=r)return r}createPopupTemplate(e){return(0,ct.eZ)({fields:this.rasterFields,title:this.title},e)}async generateRasterInfo(e,t){if(!(e=(0,f.TJ)(C.Z,e)))return this._primaryRasters[0].rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const n=(0,ne.Ue)(e.toJSON(),i),r=new Q({rasterFunction:n});return await r.open(t),r.rasterInfo}catch{return null}}write(e,t){const{raster:i}=this;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,ne.G8)(t.toJSON(),i);const n=await Promise.all(i.map((t=>lt.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),r=n.findIndex((e=>null==e));if(r>-1)throw new a.Z("imagery-tile-layer:open",`cannot open raster: ${i[r]}`);if(this._primaryRasters=n,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,ne.Ue)(t.rasterFunctionDefinition??t.toJSON(),e),r=new Q({rasterFunction:i});try{await r.open(),this.raster=r}catch(e){const t=o.Z.getLogger(this.declaredClass);e instanceof a.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const i=this.raster.rasterInfo;if(!i)throw new a.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,n._)([(0,h.Cb)()],ut.prototype,"_primaryRasters",void 0),(0,n._)([(0,h.Cb)({type:[f.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ut.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,p.J)(xe.c)],ut.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)(R.rn)],ut.prototype,"legendEnabled",void 0),(0,n._)([(0,h.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ut.prototype,"isReference",void 0),(0,n._)([(0,h.Cb)({type:["show","hide"]})],ut.prototype,"listMode",void 0),(0,n._)([(0,h.Cb)({json:{read:!0,write:!0}})],ut.prototype,"blendMode",void 0),(0,n._)([(0,h.Cb)()],ut.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ut.prototype,"version",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{read:!1}})],ut.prototype,"type",void 0),(0,n._)([(0,h.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ut.prototype,"operationalLayerType",void 0),(0,n._)([(0,h.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ut.prototype,"popupEnabled",void 0),(0,n._)([(0,h.Cb)({type:r.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ut.prototype,"popupTemplate",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],ut.prototype,"defaultPopupTemplate",null),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"fields",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"rasterFields",null),(0,n._)([(0,h.Cb)({types:s.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:s.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],ut.prototype,"renderer",null),(0,n._)([(0,m.r)("renderer")],ut.prototype,"readRenderer",null),ut=(0,n._)([(0,y.j)("esri.layers.ImageryTileLayer")],ut);const ht=ut},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>s}),i(68773),i(40330);var n=i(22974),r=i(17452);function s(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.mN)(e):(0,n.d9)(e)}function o(e,t,i){const n={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s)){n[r]=[];for(let e=0;e<s.length;e++)n[r][e]=o(s[e])}else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(i&&i[r]);n[r]=t?e:JSON.stringify(e)}else n[r]=t?s:JSON.stringify(s);else n[r]=s}return n}i(71058)}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3381,819,1433],{13867:(e,t,i)=>{i.d(t,{Z:()=>r});var n=i(69801);class r{constructor(e,t){this._storage=new n.WJ,this._storage.maxSize=e,t&&this._storage.registerRemoveFunc("",t)}put(e,t,i){this._storage.put(e,t,i,1)}pop(e){return this._storage.pop(e)}get(e){return this._storage.get(e)}clear(){this._storage.clearAll()}destroy(){this._storage.destroy()}get maxSize(){return this._storage.maxSize}set maxSize(e){this._storage.maxSize=e}}},80819:(e,t,i)=>{i.r(t),i.d(t,{hydratedAdapter:()=>l});var n=i(6570),r=i(65091),s=i(94139),a=i(38913),o=i(58901);const l={convertToGEGeometry:function(e,t){if(null==t)return null;let i="cache"in t?t.cache._geVersion:void 0;return null==i&&(i=e.convertJSONToGeometry(t),"cache"in t&&(t.cache._geVersion=i)),i},exportPoint:function(e,t,i){const n=e.hasZ(t),r=e.hasM(t),a=new s.Z({x:e.getPointX(t),y:e.getPointY(t),spatialReference:i});return n&&(a.z=e.getPointZ(t)),r&&(a.m=e.getPointM(t)),a.cache._geVersion=t,a},exportPolygon:function(e,t,i){const n=new a.Z({rings:e.exportPaths(t),hasZ:e.hasZ(t),hasM:e.hasM(t),spatialReference:i});return n.cache._geVersion=t,n},exportPolyline:function(e,t,i){const n=new o.Z({paths:e.exportPaths(t),hasZ:e.hasZ(t),hasM:e.hasM(t),spatialReference:i});return n.cache._geVersion=t,n},exportMultipoint:function(e,t,i){const n=new r.Z({hasZ:e.hasZ(t),hasM:e.hasM(t),points:e.exportPoints(t),spatialReference:i});return n.cache._geVersion=t,n},exportExtent:function(e,t,i){const r=e.hasZ(t),s=e.hasM(t),a=new n.Z({xmin:e.getXMin(t),ymin:e.getYMin(t),xmax:e.getXMax(t),ymax:e.getYMax(t),spatialReference:i});if(r){const i=e.getZExtent(t);a.zmin=i.vmin,a.zmax=i.vmax}if(s){const i=e.getMExtent(t);a.mmin=i.vmin,a.mmax=i.vmax}return a.cache._geVersion=t,a}}},61433:(e,t,i)=>{i.r(t),i.d(t,{buffer:()=>C,changeDefaultSpatialReferenceTolerance:()=>W,clearDefaultSpatialReferenceTolerance:()=>q,clip:()=>o,contains:()=>c,convexHull:()=>b,crosses:()=>u,cut:()=>l,densify:()=>z,difference:()=>S,disjoint:()=>y,distance:()=>h,equals:()=>f,extendedSpatialReferenceInfo:()=>a,flipHorizontal:()=>Z,flipVertical:()=>A,generalize:()=>B,geodesicArea:()=>H,geodesicBuffer:()=>k,geodesicDensify:()=>J,geodesicLength:()=>L,intersect:()=>R,intersectLinesToPoints:()=>G,intersects:()=>d,isSimple:()=>w,nearestCoordinate:()=>F,nearestVertex:()=>M,nearestVertices:()=>P,offset:()=>T,overlaps:()=>g,planarArea:()=>N,planarLength:()=>E,relate:()=>x,rotate:()=>D,simplify:()=>I,symmetricDifference:()=>_,touches:()=>p,union:()=>v,within:()=>m});var n=i(45837),r=i(80819);function s(e){return Array.isArray(e)?e[0].spatialReference:e&&e.spatialReference}function a(e){return n.G.extendedSpatialReferenceInfo(e)}function o(e,t){return n.G.clip(r.hydratedAdapter,s(e),e,t)}function l(e,t){return n.G.cut(r.hydratedAdapter,s(e),e,t)}function c(e,t){return n.G.contains(r.hydratedAdapter,s(e),e,t)}function u(e,t){return n.G.crosses(r.hydratedAdapter,s(e),e,t)}function h(e,t,i){return n.G.distance(r.hydratedAdapter,s(e),e,t,i)}function f(e,t){return n.G.equals(r.hydratedAdapter,s(e),e,t)}function d(e,t){return n.G.intersects(r.hydratedAdapter,s(e),e,t)}function p(e,t){return n.G.touches(r.hydratedAdapter,s(e),e,t)}function m(e,t){return n.G.within(r.hydratedAdapter,s(e),e,t)}function y(e,t){return n.G.disjoint(r.hydratedAdapter,s(e),e,t)}function g(e,t){return n.G.overlaps(r.hydratedAdapter,s(e),e,t)}function x(e,t,i){return n.G.relate(r.hydratedAdapter,s(e),e,t,i)}function w(e){return n.G.isSimple(r.hydratedAdapter,s(e),e)}function I(e){return n.G.simplify(r.hydratedAdapter,s(e),e)}function b(e,t=!1){return n.G.convexHull(r.hydratedAdapter,s(e),e,t)}function S(e,t){return n.G.difference(r.hydratedAdapter,s(e),e,t)}function _(e,t){return n.G.symmetricDifference(r.hydratedAdapter,s(e),e,t)}function R(e,t){return n.G.intersect(r.hydratedAdapter,s(e),e,t)}function v(e,t=null){return n.G.union(r.hydratedAdapter,s(e),e,t)}function T(e,t,i,a,o,l){return n.G.offset(r.hydratedAdapter,s(e),e,t,i,a,o,l)}function C(e,t,i,a=!1){return n.G.buffer(r.hydratedAdapter,s(e),e,t,i,a)}function k(e,t,i,a,o,l){return n.G.geodesicBuffer(r.hydratedAdapter,s(e),e,t,i,a,o,l)}function F(e,t,i=!0){return n.G.nearestCoordinate(r.hydratedAdapter,s(e),e,t,i)}function M(e,t){return n.G.nearestVertex(r.hydratedAdapter,s(e),e,t)}function P(e,t,i,a){return n.G.nearestVertices(r.hydratedAdapter,s(e),e,t,i,a)}function O(e){return"xmin"in e?"center"in e?e.center:null:"x"in e?e:"extent"in e?e.extent?.center??null:null}function D(e,t,i){if(null==e)throw new j;const r=e.spatialReference;if(null==(i=i??O(e)))throw new j;const s=e.constructor.fromJSON(n.G.rotate(e,t,i));return s.spatialReference=r,s}function Z(e,t){if(null==e)throw new j;const i=e.spatialReference;if(null==(t=t??O(e)))throw new j;const r=e.constructor.fromJSON(n.G.flipHorizontal(e,t));return r.spatialReference=i,r}function A(e,t){if(null==e)throw new j;const i=e.spatialReference;if(null==(t=t??O(e)))throw new j;const r=e.constructor.fromJSON(n.G.flipVertical(e,t));return r.spatialReference=i,r}function B(e,t,i,a){return n.G.generalize(r.hydratedAdapter,s(e),e,t,i,a)}function z(e,t,i){return n.G.densify(r.hydratedAdapter,s(e),e,t,i)}function J(e,t,i,a=0){return n.G.geodesicDensify(r.hydratedAdapter,s(e),e,t,i,a)}function N(e,t){return n.G.planarArea(r.hydratedAdapter,s(e),e,t)}function E(e,t){return n.G.planarLength(r.hydratedAdapter,s(e),e,t)}function H(e,t,i){return n.G.geodesicArea(r.hydratedAdapter,s(e),e,t,i)}function L(e,t,i){return n.G.geodesicLength(r.hydratedAdapter,s(e),e,t,i)}function G(e,t){return n.G.intersectLinesToPoints(r.hydratedAdapter,s(e),e,t)}function W(e,t){n.G.changeDefaultSpatialReferenceTolerance(e,t)}function q(e){n.G.clearDefaultSpatialReferenceTolerance(e)}class j extends Error{constructor(){super("Illegal Argument Exception")}}},16306:(e,t,i)=>{i.d(t,{aX:()=>S});var n=i(68773),r=i(20102),s=i(92604),a=i(38913),o=i(58901),l=i(73913),c=i(8744),u=i(40488),h=(i(66577),i(3172)),f=i(33955),d=i(11282),p=i(17452);async function m(e,t,i){const n="string"==typeof e?(0,p.mN)(e):e,r=t[0].spatialReference,s=(0,f.Ji)(t[0]),a={...i,query:{...n.query,f:"json",sr:r.wkid??JSON.stringify(r),geometries:JSON.stringify((l=t,{geometryType:(0,f.Ji)(l[0]),geometries:l.map((e=>e.toJSON()))}))}},{data:o}=await(0,h.default)(n.path+"/simplify",a);var l;return function(e,t,i){const n=(0,f.q9)(t);return e.map((e=>{const t=n.fromJSON(e);return t.spatialReference=i,t}))}(o.geometries,s,r)}const y=s.Z.getLogger("esri.geometry.support.normalizeUtils");function g(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function w(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw y.error(e),new r.Z(e)}const i=(0,l.x3)(e),n=[];for(const e of i){const i=[];n.push(i),i.push([e[0][0],e[0][1]]);for(let n=0;n<e.length-1;n++){const r=e[n][0],s=e[n][1],a=e[n+1][0],o=e[n+1][1],l=Math.sqrt((a-r)*(a-r)+(o-s)*(o-s)),c=(o-s)/l,u=(a-r)/l,h=l/t;if(h>1){for(let e=1;e<=h-1;e++){const n=e*t,a=u*n+r,o=c*n+s;i.push([a,o])}const e=(l+Math.floor(h-1)*t)/2,n=u*e+r,a=c*e+s;i.push([n,a])}i.push([a,o])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:n,spatialReference:e.spatialReference}):new o.Z({paths:n,spatialReference:e.spatialReference})}(e,1e6);e=(0,u.Sx)(t,!0)}return i&&(e=(0,l.Sy)(e,i)),e}function I(e,t,i){if(Array.isArray(e)){const n=e[0];if(n>t){const i=(0,l.XZ)(n,t);e[0]=n+i*(-2*t)}else if(n<i){const t=(0,l.XZ)(n,i);e[0]=n+t*(-2*i)}}else{const n=e.x;if(n>t){const i=(0,l.XZ)(n,t);e=e.clone().offset(i*(-2*t),0)}else if(n<i){const t=(0,l.XZ)(n,i);e=e.clone().offset(t*(-2*i),0)}}return e}function b(e,t){let i=-1;for(let n=0;n<t.cutIndexes.length;n++){const r=t.cutIndexes[n],s=t.geometries[n],a=(0,l.x3)(s);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const n=t[e][0];i=n>i?n:i}i=Number(i.toFixed(9));const n=-360*(0,l.XZ)(i,180);for(let i=0;i<t.length;i++){const t=s.getPoint(e,i);s.setPoint(e,i,t.clone().offset(n,0))}return!0}}))}if(r===i){if(g(e))for(const t of(0,l.x3)(s))e[r]=e[r].addRing(t);else if(x(e))for(const t of(0,l.x3)(s))e[r]=e[r].addPath(t)}else i=r,e[r]=s}return e}async function S(e,t,i){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&y.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??n.Z.geometryServiceUrl;let s,p,g,x,_,R,v,T,C=0;const k=[],F=[];for(const t of e)if(null!=t)if(s||(s=t.spatialReference,p=(0,c.C5)(s),g=s.isWebMercator,R=g?102100:4326,x=l.UZ[R].maxX,_=l.UZ[R].minX,v=l.UZ[R].plus180Line,T=l.UZ[R].minus180Line),p)if("mesh"===t.type)F.push(t);else if("point"===t.type)F.push(I(t.clone(),x,_));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>I(e,x,_))),F.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,p);F.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,i=(0,l.XZ)(e.xmin,_)*(2*x);let n=0===i?t.clone():(0,l.Sy)(t.clone(),i);e.offset(i,0),e.intersects(v)&&e.xmax!==x?(C=e.xmax>C?e.xmax:C,n=w(n,g),k.push(n),F.push("cut")):e.intersects(T)&&e.xmin!==_?(C=e.xmax*(2*x)>C?e.xmax*(2*x):C,n=w(n,g,360),k.push(n),F.push("cut")):F.push(n)}else F.push(t.clone());else F.push(t);else F.push(t);let M=(0,l.XZ)(C,x),P=-90;const O=M,D=new o.Z;for(;M>0;){const e=360*M-180;D.addPath([[e,P],[e,-1*P]]),P*=-1,M--}if(k.length>0&&O>0){const t=b(k,await async function(e,t,i,n){const r=(0,d.en)(e),s=t[0].spatialReference,a={...n,query:{...r.query,f:"json",sr:JSON.stringify(s),target:JSON.stringify({geometryType:(0,f.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},o=await(0,h.default)(r.path+"/cut",a),{cutIndexes:l,geometries:c=[]}=o.data;return{cutIndexes:l,geometries:c.map((e=>{const t=(0,f.im)(e);return t.spatialReference=s,t}))}}(r,k,D,i)),n=[],s=[];for(let i=0;i<F.length;i++){const r=F[i];if("cut"!==r)s.push(r);else{const r=t.shift(),a=e[i];null!=a&&"polygon"===a.type&&a.rings&&a.rings.length>1&&r.rings.length>=a.rings.length?(n.push(r),s.push("simplify")):s.push(g?(0,u.$)(r):r)}}if(!n.length)return s;const a=await m(r,n,i),o=[];for(let e=0;e<s.length;e++){const t=s[e];"simplify"!==t?o.push(t):o.push(g?(0,u.$)(a.shift()):a.shift())}return o}const Z=[];for(let e=0;e<F.length;e++){const t=F[e];if("cut"!==t)Z.push(t);else{const e=k.shift();Z.push(!0===g?(0,u.$)(e):e)}}return Z}},73913:(e,t,i)=>{i.d(t,{Sy:()=>l,UZ:()=>a,XZ:()=>o,x3:()=>c});var n=i(58901),r=i(82971),s=i(33955);const a={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new n.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator}),minus180Line:new n.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:r.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new n.Z({paths:[[[180,-180],[180,180]]],spatialReference:r.Z.WGS84}),minus180Line:new n.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:r.Z.WGS84})}};function o(e,t){return Math.ceil((e-t)/(2*t))}function l(e,t){const i=c(e);for(const e of i)for(const i of e)i[0]+=t;return e}function c(e){return(0,s.oU)(e)?e.rings:e.paths}},74878:(e,t,i)=>{i.r(t),i.d(t,{default:()=>ht});var n=i(43697),r=i(51773),s=i(30030),a=i(20102),o=i(92604),l=i(16453),c=i(95330),u=i(17445),h=i(5600),f=i(75215),d=(i(67676),i(80442)),p=i(36030),m=i(71715),y=i(52011),g=i(87085),x=i(17287),w=i(71612),I=i(17017),b=(i(66577),i(3172)),S=i(8744),_=i(66677),R=i(21506),v=i(35956),T=i(29876),C=i(40297),k=i(88281),F=i(11145),M=i(96674),P=i(70586),O=i(609),D=i(39450),Z=i(36679),A=i(99815),B=i(73506),z=i(94139);const J=new Map,N=new class{constructor(e=15e3,t=5e3){this._timer=null,this._cachedBlocks=new Map,this._size=-1,this._duration=e,this._interval=Math.min(e,t)}decreaseRefCount(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.refCount--,e.refCount<=0&&(n.delete(i),e.controller&&e.controller.abort()),e.refCount}return 0}getBlock(e,t){const i=e+"/"+t,n=this._cachedBlocks;if(n.has(i)){const e=n.get(i);return e.ts=Date.now(),e.refCount++,n.delete(i),n.set(i,e),e.block}return null}putBlock(e,t,i,n){const r=this._cachedBlocks,s=e+"/"+t;if(r.has(s)){const e=r.get(s);e.ts=Date.now(),e.refCount++}else r.set(s,{block:i,ts:Date.now(),refCount:1,controller:n});this._trim(),this._updateTimer()}deleteBlock(e,t){const i=this._cachedBlocks,n=e+"/"+t;i.has(n)&&i.delete(n)}updateMaxSize(e){this._size=e,this._trim()}empty(){this._cachedBlocks.clear(),this._clearTimer()}getCurrentSize(){return this._cachedBlocks.size}_updateTimer(){if(null!=this._timer)return;const e=this._cachedBlocks;this._timer=setInterval((()=>{const t=Array.from(e),i=Date.now();for(let n=0;n<t.length&&t[n][1].ts<=i-this._duration;n++)e.delete(t[n][0]);0===e.size&&this._clearTimer()}),this._interval)}_trim(){const e=this._cachedBlocks;if(-1===this._size||this._size>=e.size)return;const t=Array.from(e);for(let i=0;i<t.length-this._size;i++)e.delete(t[i][0])}_clearTimer(){null!=this._timer&&(clearInterval(this._timer),this._timer=null)}};function E(e,t){return null==t?e:`${e}?sliceId=${t}`}function H(e,t,i){const n=J.get(e);if(!n)return null==t?N.decreaseRefCount(e,i):0;if(null==t||null==n[t])return N.decreaseRefCount(e,i);const r=n[t]?.cache,s=r?.get(i);if(r&&s){if(s.refCount--,0===s.refCount){r.delete(i);for(let e=0;e<n.length;e++)n[e]?.cache.delete(i);s.controller&&s.controller.abort()}return s.refCount}return 0}function L(e,t,i){const n=J.get(e);if(!n)return null==t?N.getBlock(e,i):null;if(null==t||null==n[t]){for(let e=0;e<n.length;e++){const t=n[e]?.cache.get(i);if(t)return t.refCount++,t.block}return N.getBlock(e,i)}const r=n[t]?.cache.get(i);if(r)return r.refCount++,r.block;for(let e=0;e<n.length;e++){if(e===t||!n[e])continue;const r=n[e]?.cache,s=r?.get(i);if(r&&s)return s.refCount++,r.set(i,s),s.block}return null}function G(e,t,i,n,r=null){const s=J.get(e);if(!s)return void(null==t&&N.putBlock(e,i,n,r));if(null==t||null==s[t])return void N.putBlock(e,i,n,r);const a={refCount:1,block:n,isResolved:!1,isRejected:!1,controller:r};n.then((()=>a.isResolved=!0)).catch((()=>a.isRejected=!0)),s[t]?.cache.set(i,a)}function W(e,t,i){const n=J.get(e);n?null!=t&&null!=n[t]?n[t]?.cache.delete(i):N.deleteBlock(e,i):null==t&&N.deleteBlock(e,i)}var q=i(81578),j=i(75993),U=i(55914),V=i(80676),$=i(6570);let X=class extends((0,O.v)(M.wq)){constructor(){super(...arguments),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=(0,B.zD)();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e&&e.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:F.Z.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=(0,B.ut)(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}set url(e){this._set("url",(0,_.Nm)(e,o.Z.getLogger(this.declaredClass)))}async open(e){throw new a.Z("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,n={}){const r=n.tileInfo||this.rasterInfo.storageInfo.tileInfo,s=this.getTileExtentFromTileInfo(e,t,i,r);return this.fetchPixels(s,r.size[0],r.size[1],n)}async identify(e,t={}){e=(0,f.TJ)(z.Z,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:n}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:s,multidimensionalInfo:a}=r;let{transposedVariableName:o}=t;const l=null!=a&&s&&(null!=n||(0,A.WU)(i));l&&!o&&(o=null!=i&&i.length>0?i[0].variableName??void 0:a.variables[0].name,t={...t,transposedVariableName:o}),t=this._getRequestOptionsWithSliceId(t);const{spatialReference:c,extent:u}=r,{datumTransformation:h}=t;let d=(0,B.nF)(e,c,h);if(!u.intersects(d))return{location:d,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(d);if(!r.nativeExtent.intersects(e))return{location:e,value:null};d=e}let p=0;const m=null!=o&&null!=a&&r.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(m)return e.identify(d,t);const{pixelSize:i}=r,n=3,s=i.x*n/2,a=i.y*n/2,o=new $.Z({xmin:d.x-s,xmax:d.x+s,ymin:d.y-a,ymax:d.y+a,spatialReference:c}),l={interpolation:"nearest"},{pixelBlock:u}=await e.fetchPixels(o,n,n,l),{pixelBlock:h}=await this.fetchPixels(o,n,n,l);if(null==u)return{location:d,value:null};const f=Math.floor(n*n*.5),p=!u.mask||u.mask[f]?u.pixels.map((e=>e[f])):null;let y;return null!=h&&(y=!h.mask||h.mask[f]?h.pixels.map((e=>e[f])):void 0),{location:d,value:p,processedValue:y,pyramidLevel:0}}if(!m)if(t.srcResolution)p=(0,B.kr)(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel;else if(p=await this.computeBestPyramidLevelForLocation(e,t),null==p)return{location:d,value:null};const y=this.identifyPixelLocation(d,p,null,m);if(null===y)return{location:d,value:null};const{row:g,col:x,rowOffset:w,colOffset:I,blockWidth:b}=y,S=o??t.sliceId,_=E(this.url,S),R=`${p}/${g}/${x}`;let v=L(_,null,R);null==v&&(v=this.fetchRawTile(p,g,x,t),G(_,null,R,v));const T=await v;if(null==T||!T.pixels?.length)return{location:d,value:null};const C=w*b+I;return this._processIdentifyResult(T,{srcLocation:d,position:C,pyramidLevel:p,useTransposedTile:!!m,requestSomeSlices:l,identifyOptions:t})}async fetchPixels(e,t,i,n={}){e=(0,B.kZ)(e),n=this._getRequestOptionsWithSliceId(n);const{_hasNoneOrGCSShiftTransform:r}=this;if(n.requestRawData&&r)return this._fetchPixels(e,t,i,n);const s=(0,B.ut)(e.spatialReference),a=(0,B.Hq)(e);if(null==s||0===a||1===a&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,n);if(a>=3)return{extent:e,pixelBlock:null};const o=[],{xmin:l,xmax:c}=e,u=Math.round(s/(c-l)*t),h=u-Math.round((s/2-l)/(c-l)*t);let f=0;const d=[];for(let r=0;r<=a;r++){const p=new $.Z({xmin:0===r?l:-s/2,xmax:r===a?c-s*r:s/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),m=0===r?u-h:r===a?t-f:u;f+=m,d.push(m);const y=n.disableWrapAround&&r>0?null:this._fetchPixels(p,m,i,n);o.push(y)}const p=(await Promise.all(o)).map((e=>e?.pixelBlock));let m=null;const y={width:t,height:i};return m=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:y,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:d},n)).pixelBlock:(0,U.us)(p,y,{blockWidths:d}),{extent:e,srcExtent:(0,B.tB)(e,this.rasterInfo.spatialReference,n.datumTransformation),pixelBlock:m}}async fetchRawPixels(e,t,i,n={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,n),{nativeExtent:s,nativePixelSize:a,storageInfo:o}=this.rasterInfo,l=2**e,c=a.x*l,u=a.y*l,h=new $.Z({xmin:s.xmin+c*t.x,xmax:s.xmin+c*(t.x+i.width-1),ymin:s.ymax-u*(t.y+i.height-1),ymax:s.ymax-u*t.y,spatialReference:s.spatialReference});if(!r)return{extent:h,srcExtent:h,pixelBlock:null};const{pixelBlocks:f,mosaicSize:d}=r;if(1===f.length&&null!=f[0]&&f[0].width===i.width&&f[0].height===i.height)return{extent:h,srcExtent:h,pixelBlock:r.pixelBlocks[0]};const p=e>0?o.pyramidBlockWidth:o.blockWidth,m=e>0?o.pyramidBlockHeight:o.blockHeight,y={x:t.x%p,y:t.y%m};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:f,srcMosaicSize:d,destDimension:i,clipOffset:y,clipSize:i,coefs:null,sampleSpacing:null,interpolation:n.interpolation,alignmentInfo:null,blockWidths:null},n)).pixelBlock:(0,U.us)(f,d,{clipOffset:y,clipSize:i}),{extent:h,srcExtent:h,pixelBlock:g}}fetchRawTile(e,t,i,n){throw new a.Z("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return(0,B.tB)(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?(0,j.J)(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,t,i=0){const{customFetchParameters:n}=this.ioConfig,{range:r,query:s,headers:a}=t;i=i??t.retryCount??this.ioConfig.retryCount;const o=r?{Range:`bytes=${r.from}-${r.to}`}:null;try{return await(0,b.default)(e,{...t,query:{...s,...n},headers:{...a,...o}})}catch(n){if(i>0)return i--,this.request(e,t,i);throw n}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:(0,A.gk)(e,t)}getTileExtentFromTileInfo(e,t,i,n){const r=(0,P.s3)(n.lodAt(e));return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,n.origin,n.spatialReference,n.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:n}=this.rasterInfo;if(!e.tileInfo){const r=[],s=e.maximumPyramidLevel||0;let a=Math.max(n.x,n.y),o=1/.0254*96*a;for(let e=0;e<=s;e++)r.push(new D.Z({level:s-e,resolution:a,scale:o})),a*=2,o*=2;const l=new z.Z({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new F.Z({origin:l,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,n){const{width:r,height:s,nativeExtent:a,pixelSize:o,spatialReference:l}=e,c=new z.Z({x:a.xmin,y:a.ymax,spatialReference:l});null==n&&(n=Math.max(0,Math.round(Math.log(Math.max(r,s))/Math.LN2-8)));const u=this.computeBlockBoundary(a,512,512,{x:a.xmin,y:a.ymax},[o],n);e.storageInfo=new Z.Z({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:n,blockBoundary:u})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,n,r,s=0,a=2){if(1===r.length&&s>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<s;i++)e*=a,t*=a,r.push({x:e,y:t})}const o=[],{x:l,y:c}=n;for(let n=0;n<r.length;n++){const{x:s,y:a}=r[n];o.push({minCol:Math.floor((e.xmin-l+.1*s)/t/s),maxCol:Math.floor((e.xmax-l-.1*s)/t/s),minRow:Math.floor((c-e.ymax+.1*a)/i/a),maxRow:Math.floor((c-e.ymin-.1*a)/i/a)})}return o}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:n}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=n**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,n){const{spatialReference:r,nativeExtent:s,storageInfo:a}=this.rasterInfo,{maximumPyramidLevel:o,origin:l,transposeInfo:c}=a,u=n&&null!=c?c.tileSize[0]:a.blockWidth,h=n&&null!=c?c.tileSize[1]:a.blockHeight,f=(0,B.nF)(e,r,i);if(!s.intersects(f))return null;if(t<0||t>o)return null;const d=this.getPyramidPixelSize(t),{x:p,y:m}=d,y=(l.y-f.y)/m/h,g=(f.x-l.x)/p/u,x=Math.min(h-1,Math.floor((y-Math.floor(y))*h)),w=Math.min(u-1,Math.floor((g-Math.floor(g))*u));return{pyramidLevel:t,row:Math.floor(y),col:Math.floor(g),rowOffset:x,colOffset:w,blockWidth:u,srcLocation:f}}getTileExtent(e,t,i,n,r,s){const[a,o]=s,l=n.x+i*a*e.x,c=l+a*e.x,u=n.y-t*o*e.y,h=u-o*e.y;return new $.Z({xmin:l,xmax:c,ymin:h,ymax:u,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const n=this.rasterInfo.storageInfo.blockBoundary[e];return!n||n.maxRow<t||n.maxCol<i||n.minRow>t||n.minCol>i}async _fetchPixels(e,t,i,n={}){let r=(0,B.Hq)(e);if(r>=2)return{extent:e,pixelBlock:null};const s=this._getSourceDataInfo(e,t,i,n),{pyramidLevel:a,srcResolution:o,srcExtent:l,srcWidth:c,srcHeight:u,ul:h}=s;if(0===c||0===u)return{extent:e,srcExtent:l,pixelBlock:null};const{rasterInfo:f}=this,d=f.transform,p="gcs-shift"===d?.type,m=null!=(0,B.ut)(e.spatialReference);!p&&m||(r=(0,B.Hq)(s.srcExtent,p));const y=await this._fetchRawTiles(a,h,{width:c,height:u,wrapCount:r},n);if(!y)return{extent:e,srcExtent:l,pixelBlock:null};const g=f.storageInfo,x=a>0?g.pyramidBlockWidth:g.blockWidth,w=a>0?g.pyramidBlockHeight:g.blockHeight;let{x:I,y:b}=f.pixelSize;if(a>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=g;if(null!=e&&e[a-1])({x:I,y:b}=e[a-1]);else{const e=t**a;I*=e,b*=e}}const S=new z.Z({x:I,y:b,spatialReference:f.spatialReference}),_=x===c&&w===u&&h.x%x==0&&h.y%w==0,R=new z.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),v=!e.spatialReference.equals(this.rasterInfo.spatialReference),{datumTransformation:T}=n;if(!v&&_&&1===y.pixelBlocks.length&&x===t&&w===i&&o.x===R.x&&o.y===R.y)return{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:y.pixelBlocks[0]};const C=m&&null!=(0,B.ut)(l.spatialReference)&&this._hasNoneOrGCSShiftTransform,k=n.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");k&&!this.rasterJobHandler&&await(0,B.zD)();const F=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R.toJSON(),datumTransformation:T,rasterTransform:d,hasWrapAround:r>0||C,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:k},n):(0,B.Qp)({projectedExtent:e,srcBufferExtent:y.extent,pixelSize:R,datumTransformation:T,rasterTransform:d,hasWrapAround:r>0||C,isAdaptive:!1,includeGCSGrid:k});let M;const P=!n.requestRawData,O={rows:F.spacing[0],cols:F.spacing[1]},D=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(a,y.extent.xmin):void 0,{pixelBlocks:Z,mosaicSize:A,isPartiallyFilled:J}=y;let N=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:Z,srcMosaicSize:A,destDimension:P?{width:t,height:i}:null,coefs:P?F.coefficients:null,sampleSpacing:P?O:null,projectDirections:k,gcsGrid:k?F.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:n.interpolation,alignmentInfo:D,blockWidths:null},n);({pixelBlock:M,localNorthDirections:N}=e)}else{const e=(0,U.us)(Z,A,{alignmentInfo:D});M=P?(0,U.Uk)(e,{width:t,height:i},F.coefficients,O,n.interpolation):e,k&&F.gcsGrid&&(N=(0,U.Qh)({width:t,height:i},F.gcsGrid),M=(0,V.xQ)(M,this.rasterInfo.dataType,N))}return n.requestRawData||k?{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:M,transformGrid:F,localNorthDirections:N,isPartiallyFilled:J}:{extent:e,srcExtent:l,srcTilePixelSize:S,pixelBlock:M}}async _fetchRawTiles(e,t,i,n){const{origin:r,blockBoundary:s}=this.rasterInfo.storageInfo,{blockWidth:a,blockHeight:o}=this.getBlockWidthHeight(e);let{x:l,y:c}=t,{width:u,height:h,wrapCount:f}=i;const d=this._getRasterTileAlignmentInfo(e,0);n.buffer&&(l-=n.buffer.cols,c-=n.buffer.rows,u+=2*n.buffer.cols,h+=2*n.buffer.rows);let p=0,m=0,y=0;f&&null!=d&&(({worldColumnCountFromOrigin:m,originColumnOffset:y,rightPadding:p}=d),m*d.blockWidth-p>=l+u&&(p=0));const g=Math.floor(l/a),x=Math.floor(c/o),w=Math.floor((l+u+p-1)/a),I=Math.floor((c+h+p-1)/o),b=s[e];if(!b)return null;const{minRow:S,minCol:_,maxCol:R,maxRow:v}=b;if(0===f&&(I<S||w<_||x>v||g>R))return null;const T=new Array;let C=!1;const k=null==this.ioConfig.allowPartialFill?n.allowPartialFill:this.ioConfig.allowPartialFill;for(let t=x;t<=I;t++)for(let i=g;i<=w;i++){let r=i;if(!n.disableWrapAround&&f&&null!=d&&m<=i&&(r=i-m-y),t>=S&&r>=_&&v>=t&&R>=r){const i=this._fetchRawTile(e,t,r,n);k?T.push(new Promise((e=>{i.then((t=>e(t))).catch((()=>{C=!0,e(null)}))}))):T.push(i)}else T.push(Promise.resolve(null))}if(0===T.length)return null;const F=await Promise.all(T),M={height:(I-x+1)*o,width:(w-g+1)*a},{spatialReference:P}=this.rasterInfo,O=this.getPyramidPixelSize(e),{x:D,y:Z}=O;return{extent:new $.Z({xmin:r.x+g*a*D,xmax:r.x+(w+1)*a*D,ymin:r.y-(I+1)*o*Z,ymax:r.y-x*o*Z,spatialReference:P}),pixelBlocks:F,mosaicSize:M,isPartiallyFilled:C}}_fetchRawTile(e,t,i,n){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:s,minCol:a,maxCol:o,maxRow:l}=r;if(t<s||i<a||t>l||i>o)return Promise.resolve(null);const u=E(this.url,n.sliceId),h=`${e}/${t}/${i}`;let f=L(u,n.registryId,h);if(null==f){const r=new AbortController;f=this.fetchRawTile(e,t,i,{...n,signal:r.signal}),G(u,n.registryId,h,f,r),f.catch((()=>W(u,n.registryId,h)))}return n.signal&&(0,c.fu)(n,(()=>{H(u,n.registryId,h)})),f}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if((2!==t||"vector-magdir"!==i)&&"vector-uv"!==i||2!==e?.length||!e[0]?.length)return null;const n=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,s]=e,a=[],o=[];for(let e=0;e<n;e++){const[t,i]=(0,V.Tg)([r[e],s[e]]);a.push(t),o.push(i)}return[a,o]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlighmentInfo&&(this._rasterTileAlighmentInfo=(0,B.P_)(this.rasterInfo)),null==this._rasterTileAlighmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlighmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlighmentInfo.hasGCSSShiftTransform,...this._rasterTileAlighmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,n={}){const r={datumTransformation:n.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};n.srcResolution&&(r.srcResolution=n.srcResolution,this._updateSourceDataInfo(e,r));const s=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:a,srcHeight:o,pyramidLevel:l}=r,c=a/t,u=o/i,h=l<s&&c*u>=16,f=l===s&&this._requireTooManySrcTiles(a,o,t,i);if(h||f||0===a||0===o){const a=new z.Z({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let o=(0,B.VO)(a,this.rasterInfo.spatialReference,e,r.datumTransformation);const f=!o||n.srcResolution&&o.x+o.y<n.srcResolution.x+n.srcResolution.y;if(h&&n.srcResolution&&f){const e=Math.round(Math.log(Math.max(c,u))/Math.LN2)-1;if(s-l+3>=e){const t=2**e;o={x:n.srcResolution.x*t,y:n.srcResolution.y*t}}}o&&(r.srcResolution=o,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,n){const{tileInfo:r}=this.rasterInfo.storageInfo;return Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1])>=256||e/i>8||t/n>8}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,n=i.spatialReference,{srcResolution:r,datumTransformation:s}=t,{pyramidLevel:a,pyramidResolution:o,excessiveReading:l}=(0,B.kr)(r,i,this.ioConfig.sampling);if(l)return;let c=t.srcExtent||(0,B.tB)(e,n,s);if(null==c)return;const u=i.transform;u&&(c=u.inverseTransform(c)),t.srcExtent=c;const{x:h,y:f}=i.storageInfo.origin,d=Math.floor((c.xmin-h)/o.x+.1),p=Math.floor((f-c.ymax)/o.y+.1),m=Math.floor((c.xmax-h)/o.x-.1),y=Math.floor((f-c.ymin)/o.y-.1),g=c.width<.1*o.x?0:m-d+1,x=c.height<.1*o.y?0:y-p+1;t.pyramidLevel=a,t.pyramidResolution=o,t.srcWidth=g,t.srcHeight=x,t.ul={x:d,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:n,pyramidLevel:r,useTransposedTile:s}=t,a=e.pixels[0].length/e.width/e.height;if(e.mask&&!e.mask[n])return{location:i,value:null};const{multidimensionalInfo:o}=this.rasterInfo;if(null==o||!s){const t=e.pixels.map((e=>e[n])),s={location:i,value:t,pyramidLevel:r},a=this._computeMagDirValues(t.map((e=>[e])));return a?.length&&(s.magdirValue=a.map((e=>e[0]))),s}let l=e.pixels.map((e=>e.slice(n*a,n*a+a))),c=this._computeMagDirValues(l);const{requestSomeSlices:u,identifyOptions:h}=t;let f=(0,A.MO)(o,h.transposedVariableName);if(u){const e=(0,A.Ur)(f,h.multidimensionalDefinition,h.timeExtent);l=l.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),f=e.map((e=>f[e]))}const d=e.noDataValues||this.rasterInfo.noDataValue,p={pixels:l,pixelType:e.pixelType};let m;return null!=d&&((0,q.A)(p,d),m=p.mask),{location:i,value:null,dataSeries:f.map(((e,t)=>{const i={value:0===m?.[t]?null:l.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new v.Z({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};(0,n._)([(0,h.Cb)()],X.prototype,"_rasterTileAlighmentInfo",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],X.prototype,"_isGlobalWrappableSource",null),(0,n._)([(0,h.Cb)({readOnly:!0})],X.prototype,"_hasNoneOrGCSShiftTransform",null),(0,n._)([(0,h.Cb)()],X.prototype,"rasterJobHandler",null),(0,n._)([(0,h.Cb)(R.HQ)],X.prototype,"url",null),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetName",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],X.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"hasUniqueSourceStorageInfo",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)()],X.prototype,"sourceJSON",void 0),X=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.BaseRaster")],X);const Y=X;let K=class extends Y{constructor(){super(...arguments),this.datasetFormat="Function",this.tileType="Raster",this.rasterFunction=null}async open(e){await this.init();const{rasterFunction:t}=this;this.primaryRasters?.rasters?.length?t.sourceRasters=this.primaryRasters.rasters:(this.primaryRasters=t.getPrimaryRasters(),this.rasterJobHandler&&this.primaryRasters.rasters?.forEach((e=>e.rasterJobHandler=this.rasterJobHandler)));const{rasters:i,rasterIds:n}=this.primaryRasters,r=i.map((t=>t.rasterInfo?void 0:t.open(e)));await Promise.all(r);const s=i.map((({rasterInfo:e})=>e)),o=t.bind({rasterInfos:s,rasterIds:n});if(!o.success||0===s.length)throw new a.Z("raster-function:open",`cannot bind the function: ${o.error??""}`);await this.syncJobHandler();const l=s[0];this.hasUniqueSourceStorageInfo=1===s.length||s.slice(1).every((e=>this._hasSameStorageInfo(e,l))),this.set("sourceJSON",i[0].sourceJSON),this.set("rasterInfo",t.rasterInfo)}async syncJobHandler(){return this.rasterJobHandler?.updateRasterFunction(this.rasterFunction)}async fetchPixels(e,t,i,n={}){const{rasters:r,rasterIds:s}=this.primaryRasters;let a=!1;const{interpolation:o}=n,l=this.rasterFunction.flatWebGLFunctionChain?.hasSurfaceFunction;!n.requestRawData&&"bilinear"!==o&&l&&(a=1===r.length&&!n.skipRasterFunction,n={...n,interpolation:"bilinear",requestRawData:a});const c=r.map((r=>r.fetchPixels(e,t,i,n))),u=await Promise.all(c),h=u.map((e=>e.pixelBlock)),f=a||n.requestRawData?u.map((e=>e.srcTilePixelSize)):null;if(n.skipRasterFunction||h.every((e=>null==e)))return u[0];const d=u.find((e=>null!=e.pixelBlock))?.extent??e,p=this.rasterJobHandler?await this.rasterJobHandler.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}):this.rasterFunction.process({extent:d,primaryPixelBlocks:h,primaryPixelSizes:f,primaryRasterIds:s}),{transformGrid:m}=u[0];if(!a||null==p||null==m)return{...u[0],pixelBlock:p};const y={rows:m.spacing[0],cols:m.spacing[1]};let g;return g=this.rasterJobHandler?(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:[p],srcMosaicSize:{width:p.width,height:p.height},destDimension:{width:t,height:i},coefs:m.coefficients,sampleSpacing:y,projectDirections:!1,gcsGrid:null,isUV:!1,interpolation:o,alignmentInfo:void 0,blockWidths:null},n)).pixelBlock:(0,U.Uk)(p,{width:t,height:i},m.coefficients,y,o),{extent:e,srcExtent:u[0].srcExtent,pixelBlock:g}}_hasSameStorageInfo(e,t){const{storageInfo:i,pixelSize:n,spatialReference:r,extent:s}=e,{storageInfo:a,pixelSize:o,spatialReference:l,extent:c}=t;return n.x===o.x&&n.y===o.y&&r.equals(l)&&s.equals(c)&&i.blockHeight===a.blockHeight&&i.blockWidth===a.blockWidth&&i.maximumPyramidLevel===a.maximumPyramidLevel}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],K.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"tileType",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],K.prototype,"primaryRasters",void 0),K=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.FunctionRaster")],K);const Q=K;var ee=i(67900),te=i(61433),ie=i(5847);var ne=i(90036),re=i(15612),se=i(67058),ae=i(72758),oe=i(79681),le=i(23808),ce=i(82971);const ue=o.Z.getLogger("esri.layers.mixins.ImageryTileMixin"),he=e=>{let t=class extends e{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation="nearest",this.multidimensionalSubset=null,this.raster=null,this.rasterFunction=null,this.rasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.rasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}get tileInfo(){return this.rasterInfo?.storageInfo.tileInfo}set url(e){this._set("url",(0,_.Nm)(e,ue))}set renderer(e){this._set("renderer",e),this.updateRenderer()}async convertVectorFieldData(e,t){if(null==e||!this.rasterInfo)return null;const i=this._rasterJobHandler.instance,n=this.rasterInfo.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:n},t):(0,V.KC)(e,n)}async computeStatisticsHistograms(e,t){e=(0,f.TJ)(oe.Z,e).clone();const{rasterInfo:i}=this,{geometry:n}=e;if(null==n)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","gemetry must be specified");let r=n;const{spatialReference:s}=i;n.spatialReference.equals(s)||(await(0,B.zD)(),r="extent"===n.type?(0,B.tB)(n,s):(0,B.Wt)(n,s));const o=e.pixelSize??new z.Z({...i.pixelSize,spatialReference:s}),{extent:l,width:c,height:u}=function(e,t,i,n=!0){const{spatialReference:r}=e,{x:s,y:a}=function(e,t){if(e.spatialReference.equals(t))return e;const i=(0,ee.c9)(e.spatialReference),n=(0,ee.c9)(t);if(i===n)return e;const r=i/n;return{x:e.x*r,y:e.y*r}}(i,r);let o,l,c;const u="extent"===t.type?t:t.extent;let{xmin:h,xmax:f,ymax:d,ymin:p}=u;const{xmin:m,ymax:y}=e.extent;return n?(h=m+(h>m?s*Math.round((h-m)/s):0),d=y-(d<y?a*Math.round((y-d)/a):0),f=m+(f>m?s*Math.round((f-m)/s):0),p=y-(p<y?a*Math.round((y-p)/a):0),o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r}),l=Math.round(o.width/s),c=Math.round(o.height/a)):(l=Math.floor((f-h)/s+.8),c=Math.floor((d-p)/a+.8),h=m+(h>m?s*Math.floor((h-m)/s+.1):0),d=y-(d<y?a*Math.floor((y-d)/a+.1):0),f=h+l*s,p=d-c*a,o=new $.Z({xmin:h,ymax:d,xmax:f,ymin:p,spatialReference:r})),{extent:o,width:l,height:c}}(i,r,o),h=await this.fetchPixels(l,c,u,{...t,interpolation:"nearest"});if(null==h.pixelBlock)throw new a.Z("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const d=function(e,t,i){if("extent"===i.type)return function(e,t,i){const{width:n,height:r}=e,s=new Uint8Array(n*r),a=t.width/n,o=t.height/r;if(i.width/a<.5||i.height/o<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const{xmin:l,xmax:c,ymin:u,ymax:h}=t,{xmin:f,xmax:d,ymin:p,ymax:m}=i,y=Math.max(l,f),g=Math.min(c,d),x=Math.max(u,p),w=Math.min(h,m),I=.5*a,b=.5*o;if(g-y<I||w-x<b||g<l+I||y>c-I||x>h-b||w<u+b)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});const S=Math.max(0,(y-l)/a),_=Math.min(n,Math.max(0,(g-l)/a)),R=Math.max(0,(h-w)/o),v=Math.min(r,Math.max(0,(h-x)/o)),T=Math.round(S),C=Math.round(_)-1,k=Math.round(R),F=Math.round(v)-1;if(T===C&&S%1>.5&&_%1<.5||k===F&&R%1>.5&&v%1<.5)return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]});if(0===T&&0===k&&C===n&&F===r)return e;const M=e.mask;for(let e=k;e<=F;e++)for(let t=T;t<=C;t++){const i=e*n+t;s[i]=M?M[i]:255}return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,pixels:[...e.pixels]})}(e,t,i);const{width:n,height:r}=e,s=new Uint8Array(n*r);return(0,te.intersects)(t,i)?(0,te.contains)(i,t)?e:function(e,t,i){if(!e)return e;const{width:n,height:r}=e,s=t.width/n,a=t.height/r,{xmin:o,ymax:l}=t;let c;if("extent"===i.type){const e=(i.xmin-o)/s,t=(i.xmax-o)/s,n=(l-i.ymax)/a,r=(l-i.ymin)/a;c=[[[e,n],[e,r],[t,r],[t,n],[e,n]]]}else c=i.rings.map((e=>e.map((([e,t])=>[(e-o)/s,(l-t)/a]))));const u=document.createElement("canvas");u.width=n,u.height=r;const h=u.getContext("2d");h.fillStyle="#f00",c.forEach((e=>{h.beginPath(),h.moveTo(e[0][0],e[0][1]);for(let t=0;t<e.length;t++)h.lineTo(e[t][0],e[t][1]);h.closePath(),h.fill()}));const f=h.getImageData(0,0,n,r).data,d=e.mask,p=n*r,m=new Uint8Array(p);for(let e=0;e<p;e++)d&&!d[e]||(m[e]=f[4*e+3]>127?255:0);return new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:m,maskIsAlpha:!1,pixels:[...e.pixels]})}(e,t,i):new ie.Z({pixelType:e.pixelType,width:n,height:r,mask:s,maskIsAlpha:!1,pixels:[...e.pixels]})}(h.pixelBlock,l,r),p=this._rasterJobHandler.instance;return p?p.computeStatisticsHistograms({pixelBlock:d},t):(0,re.js)(d)}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):(0,le.GE)(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.rasterInfo??{};if(null==t)return e;let i=e.multidimensionalDefinition||this.multidimensionalDefinition;null!=i&&i.length||(i=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset}));const n=e.timeExtent||this.timeExtent;if(null!=i&&null!=n&&(null!=n.start||null!=n.end)){i=i.map((e=>e.clone()));const r=t.variables.find((({name:e})=>e===i[0].variableName))?.dimensions?.find((({name:e})=>"StdTime"===e)),s=i.find((({dimensionName:e})=>"StdTime"===e));if(!r||!s)return{...e,multidimensionalDefinition:null};const{start:a,end:o}=n,l=null==a?null:a.getTime(),c=null==o?null:o.getTime(),u=l??c,h=c??l;if(null!=r.values){const e=r.values.filter((e=>{if(Array.isArray(e)){if(u===h)return e[0]<=u&&e[1]>=u;const t=e[0]<=u&&e[1]>u||e[0]<h&&e[1]>=h,i=e[0]>=u&&e[1]<=h||e[0]<u&&e[1]>h;return t||i}return u===h?e===u:e>=u&&e<=h}));if(e.length){const t=e.sort(((e,t)=>u===h?(e[0]??e)-(t[0]??t):Math.abs((e[1]??e)-h)-Math.abs((t[1]??t)-h)))[0];s.values=[t]}else i=null}else if(r.hasRegularIntervals&&r.extent){const[e,t]=r.extent;u>t||h<e?i=null:s.values=u===h?[u]:[Math.max(e,u),Math.min(t,h)]}}return null!=i&&(0,A.nb)(i,this.multidimensionalSubset)?{...e,multidimensionalDefinition:null}:{...e,multidimensionalDefinition:i}}async updateRasterFunction(){if("imagery-tile"!==this.type||!this.rasterFunction&&!this._cachedRasterFunctionJson||JSON.stringify(this.rasterFunction)===JSON.stringify(this._cachedRasterFunctionJson))return;if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return!this.rasterFunction&&e&&this._set("rasterFunction",C.Z.fromJSON(e)),void(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON())}let e,t=this.raster,i=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],i=!0):e=[t];const{rasterFunction:n}=this;if(n){const i={raster:t};e.length>1&&e.forEach((e=>i[e.url]=e));const r=(0,ne.Ue)(n.rasterFunctionDefinition??n.toJSON(),i),s=new Q({rasterFunction:r});s.rasterJobHandler=this._rasterJobHandler.instance,await s.open(),this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this.raster=s}else this.raster=t,this._cachedRasterFunctionJson=null;if(this._cachedRendererJson=null,!i&&!n)return;const{bandIds:r}=this,{bandCount:s}=this.raster.rasterInfo,a=r?.length?r.some((e=>e>=s)):s>=3;r&&(a||"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t)return;const{rasterInfo:i}=this.raster,n=(0,A.WY)(i,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=n?.name,s=(0,se.ol)({...this.renderer.toJSON(),variableName:r});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(s))return;const a=this._rasterJobHandler.instance;a&&(t.rasterInfo=(0,se.FI)(i,r),t.rendererJSON=s,t.bind(),await a.updateSymbolizer(t),this._cachedRendererJson=s)}async applyRenderer(e,t){const i=e&&e.pixelBlock;if(!(null!=i&&i.pixels&&i.pixels.length>0))return null;let n;await this.updateRenderer();const r=this._rasterJobHandler.instance,s=this.bandIds??[];return n=r?await r.symbolize({...e,simpleStretchParams:t,bandIds:s}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:s}),n}getTileUrl(e,t,i){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${i}`:""}getCompatibleTileInfo(e,t,i=!1){if(!this.loaded||null==t)return null;if(i&&e.equals(this.spatialReference))return this.tileInfo;const n=(0,S.C5)(e);return F.Z.create({size:256,spatialReference:e,origin:n?{x:n.origin[0],y:n.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent&&this._compatibleFullExtent.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,t,n,r={}){if(i(this),r.requestAsImageElement){const i=this.getTileUrl(e,t,n);return(0,b.default)(i,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:r.signal}).then((e=>e.data))}const{rasterInfo:s}=this;if(null!=s.multidimensionalInfo&&null==(r=this.normalizeRasterFetchOptions(r)).multidimensionalDefinition){const i=r.tileInfo||s.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,t,n,i),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer.type&&(r={...r,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,t,n,r)}async fetchPixels(e,t,i,n={}){return null!=this.rasterInfo.multidimensionalInfo&&null==(n=this.normalizeRasterFetchOptions(n)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),i=Math.round(i),this.raster.fetchPixels(e,t,i,n))}async identify(e,t={}){const{raster:i,rasterInfo:n}=this;if(null!=n.multidimensionalInfo&&!(n.hasMultidimensionalTranspose&&((0,A.WU)(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent)||null!=(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition))return{location:e,value:null};const r=this.multidimensionalSubset?.areaOfInterest;if(r&&!r.contains(e))throw new a.Z("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.rasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.rasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,i=t?.[0]?.variableName;return e.variables.some((e=>e.name===i&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.rasterInfo?.multidimensionalInfo;return(0,A.jj)(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=(0,A.Tj)(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new k.Z;return this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{i(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,this.renderer&&this.updateRenderer(),"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){i(this);const{raster:e}=this,t=(0,se.In)(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){i(this);const{rasterInfo:t}=this.raster;!this.bandIds&&t.bandCount>1&&(this.bandIds=(0,se.YD)(t));const n=(0,A.WY)(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),r=n?.name;if(!this.renderer||"override"===e){const e=(0,se.Ob)(t,{bandIds:this.bandIds,variableName:r}),i=t.statistics,n=i&&i.length>0?i[0]:null,s=n?.max??0,a=n?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===e.type&&(s>1e24||a<-1e24)&&(e.dynamicRangeAdjustment=!0,e.statistics=null,"none"===e.stretchType&&(e.stretchType="min-max")),this.renderer=e}const s=(0,se.ol)({...this.renderer.toJSON(),variableName:r}),a=(0,se.FI)(t,r);this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=a):this.symbolizer=new ae.Z({rendererJSON:s,rasterInfo:a});const o=this.symbolizer.bind();if(o.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e)if("raster-colormap"!==t.type)this._configDefaultRenderer("override");else{const e=(0,se.Ob)(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,i=t.statistics?.length;!t.dynamicRangeAdjustment&&i&&e&&i!==e&&this._configDefaultRenderer("override")}}}else ue.warn("imagery-tile-mixin",o.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}};function i(e){if(!e.raster||!e.rasterInfo)throw new a.Z("imagery-tile","no raster")}return(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRendererJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_cachedRasterFunctionJson",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_compatibleFullExtent",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_isConstructedFromFunctionRaster",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"_rasterJobHandler",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{origins:{service:{read:{source:"copyrightText"}}}}})],t.prototype,"copyright",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"fullExtent",null),(0,n._)([(0,h.Cb)()],t.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"ioConfig",void 0),(0,n._)([(0,h.Cb)({type:[v.Z],json:{write:!0}})],t.prototype,"multidimensionalDefinition",null),(0,n._)([(0,h.Cb)({type:T.Z,json:{write:!0}})],t.prototype,"multidimensionalSubset",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"raster",void 0),(0,n._)([(0,h.Cb)({type:C.Z})],t.prototype,"rasterFunction",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"rasterInfo",void 0),(0,n._)([(0,h.Cb)()],t.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:ce.Z,json:{read:!1}})],t.prototype,"spatialReference",void 0),(0,n._)([(0,h.Cb)({json:{read:!1}})],t.prototype,"tileInfo",null),(0,n._)([(0,h.Cb)(R.HQ)],t.prototype,"url",null),(0,n._)([(0,h.Cb)({types:s.dr})],t.prototype,"renderer",null),(0,n._)([(0,h.Cb)()],t.prototype,"symbolizer",void 0),t=(0,n._)([(0,y.j)("esri.layers.ImageryTileMixin")],t),t};var fe=i(38009),de=i(16859),pe=i(34760),me=i(72965),ye=i(28294),ge=i(1231),xe=i(69608),we=i(48526),Ie=i(20095);function be(e){const t=e.fields,i=e.records,n=t.some((e=>"oid"===e.name.toLowerCase()))?"OBJECTID":"OID",r=[{name:n,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map((e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name})))),s=r.map((e=>e.name)),a=[];let o=0,l=0;return i.forEach((e=>{const t={};for(t[n]=o++,l=1;l<s.length;l++)t[s[l]]=e[l-1];a.push({attributes:t})})),{displayFieldName:"",fields:r,features:a}}class Se{static get supportedVersions(){return[5]}static parse(e){const t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};const n=t.getUint32(4,!0),r=t.getUint16(8,!0),s=t.getUint16(10,!0),a={version:i,recordCount:n,headerByteCount:r,recordByteCount:s};let o=32;const l=[],c=[];let u;if(3===i){for(;13!==t.getUint8(o);)u=String.fromCharCode(t.getUint8(o+11)).trim(),l.push({name:(0,Ie.f)(new Uint8Array(e,o,11)),type:u,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(u)],length:t.getUint8(o+16)}),o+=32;if(o+=1,l.length>0)for(;c.length<n&&e.byteLength-o>s;){const i=[];32===t.getUint8(o)?(o+=1,l.forEach((t=>{if("C"===t.type)i.push((0,Ie.f)(new Uint8Array(e,o,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim()));else if("D"===t.type){const n=String.fromCharCode.apply(null,new Uint8Array(e,o,t.length)).trim();i.push(new Date(parseInt(n.substring(0,4),10),parseInt(n.substring(4,6),10)-1,parseInt(n.substring(6,8),10)))}o+=t.length})),c.push(i)):o+=s}}return{header:a,fields:l,records:c,recordSet:be({fields:l,records:c})}}}var _e=i(87521),Re=i(74889);const ve=new Map;ve.set("int16","esriFieldTypeSmallInteger"),ve.set("int32","esriFieldTypeInteger"),ve.set("int64","esriFieldTypeInteger"),ve.set("float32","esriFieldTypeSingle"),ve.set("float64","esriFieldTypeDouble"),ve.set("text","esriFieldTypeString");let Te=class extends Y{constructor(){super(...arguments),this.storageInfo=null,this.datasetFormat="CRF"}async open(e){await this.init();const{data:t}=await this.request(this.url+"/conf.json",{signal:e?.signal});if(!this._validateHeader(t))throw new a.Z("cloudraster:open","Invalid or unsupported conf.json.");this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const{storageInfo:i,rasterInfo:n}=this._parseHeader(t);if("thematic"===n.dataType){const e=await this._fetchAuxiliaryInformation();n.attributeTable=e}this._set("storageInfo",i),this._set("rasterInfo",n),this.ioConfig.retryCount=this.ioConfig.retryCount||0}async fetchRawTile(e,t,i,n={}){const{transposeInfo:r}=this.rasterInfo.storageInfo,{transposedVariableName:s}=n,a=!(!r||!s),o=a?0:this.rasterInfo.storageInfo.maximumPyramidLevel-e;if(o<0)return null;const l=this._buildCacheFilePath(o,t,i,n.multidimensionalDefinition,s),c=this._getIndexRecordFromBundle(t,i,a),u=await this.request(l,{range:{from:0,to:this.storageInfo.headerSize-1},responseType:"array-buffer",signal:n.signal});if(!u)return null;const h=new Uint8Array(u.data),f=this._getTileEndAndContentType(h,c);if(0===f.recordSize)return null;const d=await this.request(l,{range:{from:f.position,to:f.position+f.recordSize},responseType:"array-buffer",signal:n.signal});if(!d)return null;const[p,m]=this._getTileSize(a);return this.decodePixelBlock(d.data,{width:p,height:m,planes:null,pixelType:null,returnInterleaved:a})}_validateHeader(e){return e&&"RasterInfo"===e.type&&!["origin","extent","geodataXform","LODInfos","blockWidth","blockHeight","bandCount","pixelType","pixelSizeX","pixelSizeY","format","packetSize"].some((t=>!e[t]))}_parseHeader(e){const t=["u1","u2","u4","u8","s8","u16","s16","u32","s32","f32","f64"][e.pixelType],{bandCount:i,histograms:n,colormap:r,blockWidth:s,blockHeight:a,firstPyramidLevel:o,maximumPyramidLevel:l}=e,c=e.statistics&&e.statistics.map((e=>({min:e.min,max:e.max,avg:e.mean,stddev:e.standardDeviation,median:e.median,mode:e.mode}))),u=e.extent.spatialReference,h=e.geodataXform?.spatialReference,f=new ce.Z(u?.wkid||u?.wkt?u:h);let d=new $.Z({xmin:e.extent.xmin,ymin:e.extent.ymin,xmax:e.extent.xmax,ymax:e.extent.ymax,spatialReference:f});const p=new z.Z({x:e.pixelSizeX,y:e.pixelSizeY,spatialReference:f}),m=Math.round((d.xmax-d.xmin)/p.x),y=Math.round((d.ymax-d.ymin)/p.y),g=this._parseTransform(e.geodataXform),x=g?d:null;g&&(d=g.forwardTransform(d),p.x=(d.xmax-d.xmin)/m,p.y=(d.ymax-d.ymin)/y);const w=e.properties??{},I=e.format.toLowerCase().replace("cache/",""),b=new z.Z(e.origin.x,e.origin.y,f);let S,_,R,v;if(r&&r.colors)for(S=[],_=0;_<r.colors.length;_++)R=r.colors[_],v=r.values?r.values[_]:_,S.push([v,255&R,R<<16>>>24,R<<8>>>24,R>>>24]);const T=e.LODInfos,C=[];for(_=0;_<T.levels.length;_++)C.push(new D.Z({level:T.levels[_],resolution:T.resolutions[_],scale:96/.0254*T.resolutions[_]}));const k=new F.Z({dpi:96,lods:C,format:I,origin:b,size:[s,a],spatialReference:f}),M={recordSize:8,packetSize:e.packetSize,headerSize:e.packetSize*e.packetSize*8+64},P=[{maxCol:Math.ceil(m/s)-1,maxRow:Math.ceil(y/a)-1,minCol:0,minRow:0}];let O=2;if(l>0)for(_=0;_<l;_++)P.push({maxCol:Math.ceil(m/O/s)-1,maxRow:Math.ceil(y/O/a)-1,minCol:0,minRow:0}),O*=2;const A=e.mdInfo;let B=null;if(A&&w._yxs){const e=w._yxs;B={packetSize:e.PacketSize,tileSize:[e.TileXSize,e.TileYSize]}}return{storageInfo:M,rasterInfo:new we.Z({width:m,height:y,pixelType:t,bandCount:i,extent:d,nativeExtent:x,transform:g,spatialReference:f,pixelSize:p,keyProperties:w,statistics:c,histograms:n,multidimensionalInfo:A,colormap:S,storageInfo:new Z.Z({blockWidth:s,blockHeight:a,pyramidBlockWidth:s,pyramidBlockHeight:a,origin:b,tileInfo:k,transposeInfo:B,firstPyramidLevel:o,maximumPyramidLevel:l,blockBoundary:P})})}}_parseTransform(e){if(!(0,_e.j)(e))throw new a.Z("cloudraster:open","the data contains unsupported geodata transform types");const t=(0,_e.c)(e);if("identity"===t.type)return null;if("polynomial"!==t.type||!t.forwardCoefficients?.length||!t.inverseCoefficients?.length)throw new a.Z("cloudraster:open","the data contains unsupported geodata transforms - both forward and inverse coefficients are required currently");return t}async _fetchAuxiliaryInformation(e){const t=this.request(this.url+"/conf.vat.json",{signal:e}).then((e=>e.data)).catch((()=>null)),i=this.request(this.url+"/conf.vat.dbf",{responseType:"array-buffer",signal:e}).then((e=>e.data)).catch((()=>null)),n=await Promise.all([t,i]);let r;if(n[0]){let e=n[0].fields;const t=n[0].values;if(e&&t){e=e.map((e=>({type:"OID"===e.name?"esriFieldTypeOID":ve.get(e.type),name:e.name,alias:e.alias||e.name})));const i=t.map((e=>({attributes:e})));e&&t&&(r={fields:e,features:i})}}return!r&&n[1]&&(r=Se.parse(n[1]).recordSet),Re.Z.fromJSON(r)}_buildCacheFilePath(e,t,i,n,r){const s=this._getPackageSize(!!r),a=Math.floor(t/s)*s,o=Math.floor(i/s)*s,l="R"+this._toHexString4(a)+"C"+this._toHexString4(o);let c="L";c+=e>=10?e.toString():"0"+e.toString();const{multidimensionalInfo:u}=this.rasterInfo,h=n?.[0];if(null==u||!h)return`${this.url}/_alllayers/${c}/${l}.bundle`;let f="_yxs";if(!r){f=u.variables.find((e=>e.name===h.variableName)).dimensions[0].values.indexOf(h.values[0]).toString(16);const e=4-f.length;for(let t=0;t<e;t++)f="0"+f;f="S"+f}const d=this._getVariableFolderName(r||h.variableName);return`${this.url}/_alllayers/${d}/${f}/${c}/${l}.bundle`}_getPackageSize(e=!1){const{transposeInfo:t}=this.rasterInfo.storageInfo;return e&&null!=t?t.packetSize??0:this.storageInfo.packetSize}_getTileSize(e=!1){const{storageInfo:t}=this.rasterInfo,{transposeInfo:i}=t;return e&&null!=i?i.tileSize:t.tileInfo.size}_getVariableFolderName(e){return""===(e=e.trim())?"_v":e.replace(/[\{|\}\-]/g,"_").replace("\\*","_v")}_getIndexRecordFromBundle(e,t,i=!1){const n=this._getPackageSize(i),r=n*(e%n)+t%n;if(r<0)throw new Error("Invalid level / row / col");return 20+r*this.storageInfo.recordSize+44}_getTileEndAndContentType(e,t){const i=e.subarray(t,t+8);let n,r=0;for(n=0;n<5;n++)r|=(255&i[n])<<8*n;const s=0xffffffffff&r;for(r=0,n=5;n<8;n++)r|=(255&i[n])<<8*(n-5);return{position:s,recordSize:0xffffffffff&r}}_toHexString4(e){let t=e.toString(16);if(4!==t.length){let e=4-t.length;for(;e-- >0;)t="0"+t}return t}};(0,n._)([(0,h.Cb)({readOnly:!0})],Te.prototype,"storageInfo",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Te.prototype,"datasetFormat",void 0),Te=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.CloudRaster")],Te);const Ce=Te;let ke=class extends Y{constructor(){super(...arguments),this.datasetFormat="MEMORY",this.data=null}async open(e){await this.init();const t=this.data,{pixelBlock:i,statistics:n,histograms:r,name:s,keyProperties:a,nativeExtent:o,transform:l}=this.data,{width:c,height:u,pixelType:h}=i,f=t.extent??new $.Z({xmin:-.5,ymin:.5,xmax:c-.5,ymax:u-.5,spatialReference:new ce.Z({wkid:3857})}),d=t.isPseudoSpatialReference??!t.extent,p={x:f.width/c,y:f.height/u},m=new we.Z({width:c,height:u,pixelType:h,extent:f,nativeExtent:o,transform:l,pixelSize:p,spatialReference:f.spatialReference,bandCount:i.pixels.length,keyProperties:a||{},statistics:n,isPseudoSpatialReference:d,histograms:r});this.createRemoteDatasetStorageInfo(m,512,512),this._set("rasterInfo",m),this.updateTileInfo(),await this._buildInMemoryRaster(i,{width:512,height:512},e),this.datasetName=s,this.url="/InMemory/"+s}fetchRawTile(e,t,i,n={}){const r=this._pixelBlockTiles.get(`${e}/${t}/${i}`);return Promise.resolve(r)}async _buildInMemoryRaster(e,t,i){const n=this.rasterInfo.storageInfo.maximumPyramidLevel,r=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:n},i):Promise.resolve((0,U.Vl)(e,t,n)),s=null!=this.rasterInfo.statistics,o=null!=this.rasterInfo.histograms,l=s?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,re.Hv)(e)),u=await(0,c.as)([r,l]);if(!u[0].value&&u[1].value)throw new a.Z("inmemory-raster:open","failed to build in memory raster");this._pixelBlockTiles=u[0].value,s||(this.rasterInfo.statistics=u[1].value?.statistics),o||(this.rasterInfo.histograms=u[1].value?.histograms)}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],ke.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],ke.prototype,"data",void 0),ke=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.InMemoryRaster")],ke);const Fe=ke;function Me(e,t){if(!e||!t)return[];let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=[];if(t){const r=Me(e,i);for(let e=0;e<r.length;e++)Me(r[e],t).forEach((e=>n.push(e)));return n}const r=e.getElementsByTagNameNS("*",i);if(!r||0===r.length)return[];for(let e=0;e<r.length;e++)n.push(r[e]||r.item[e]);return n}function Pe(e,t){if(!e||!t)return null;let i=t;t.includes("/")?(i=t.slice(0,t.indexOf("/")),t=t.slice(t.indexOf("/")+1)):t="";const n=Me(e,i);return n.length>0?t?Pe(n[0],t):n[0]:null}function Oe(e,t=null){const i=t?Pe(e,t):e;let n;return i?(n=i.textContent||i.nodeValue,n?n.trim():null):null}function De(e,t){return function(e,t){const i=Me(e,t),n=[];let r;for(let e=0;e<i.length;e++)r=i[e].textContent||i[e].nodeValue,r&&(r=r.trim(),""!==r&&n.push(r));return n}(e,t).map((e=>Number(e)))}function Ze(e,t){const i=Oe(e,t);return Number(i)}function Ae(e,t){const i=e?.nodeName?.toLowerCase(),n=t.toLowerCase();return i.slice(i.lastIndexOf(":")+1)===n}var Be=i(87390);function ze(e,t){if(!e||!t)return null;const i=[];for(let n=0;n<e.length;n++)i.push(e[n]),i.push(t[n]);return i}function Je(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new ce.Z({wkid:t});if((e=String(e)).startsWith("COMPD_CS")){if(!e.includes("VERTCS")||!e.includes("GEOGCS")&&!e.startsWith("PROJCS"))return null;const i=e.indexOf("VERTCS"),n=e.indexOf("PROJCS"),r=n>-1?n:e.indexOf("GEOGCS");if(-1===r)return null;const s=e.slice(r,e.lastIndexOf("]",i)+1).trim(),a=e.slice(i,e.lastIndexOf("]")).trim();t=Ne(s);const o=new ce.Z(t?{wkid:t}:{wkt:s}),l=Ne(a);return l&&(o.vcsWkid=l),o}return e.startsWith("GEOGCS")||e.startsWith("PROJCS")?(t=Ne(e),new ce.Z(0!==t?{wkid:t}:{wkt:e})):null}function Ne(e){const t=e.replace(/\]/g,"[").replace(/\"/g,"").split("[").map((e=>e.trim())).filter((e=>""!==e)),i=t[t.length-1].split(","),n=i[0]?.toLowerCase();if(("epsg"===n||"esri"===n)&&e.endsWith('"]]')){const e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function Ee(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};const t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach((e=>{if(1===e.nodeType)if(Ae(e,"SRS")){if(!t.spatialReference){const i=Oe(e);t.spatialReference=Je(i)}}else if(Ae(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){const{spatialReference:i,transform:n}=function(e){const t=Pe(e,"GeodataXform"),i=Je(Ze(t,"SpatialReference/WKID")||Oe(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};const n=Ze(t,"PolynomialOrder")??1,r=De(t,"CoeffX/Double"),s=De(t,"CoeffY/Double"),a=De(t,"InverseCoeffX/Double"),o=De(t,"InverseCoeffY/Double"),l=ze(r,s),c=ze(a,o);return{spatialReference:i,transform:l&&c&&l.length&&c.length?new Be.Z({spatialReference:i,polynomialOrder:n,forwardCoefficients:l,inverseCoefficients:c}):null}}(e);t.transform=n,t.spatialReference||(t.spatialReference=i)}else Me(e,"MDI").forEach((e=>t.metadata[e.getAttribute("key")]=Oe(e)));else if(Ae(e,"PAMRasterBand")){const i=function(e){const t=Ze(e,"NoDataValue"),i=Pe(e,"Histograms/HistItem"),n=Ze(i,"HistMin"),r=Ze(i,"HistMax"),s=Ze(i,"BucketCount"),a=Oe(i,"HistCounts")?.split("|").map((e=>Number(e)));let o,l,c,u;Me(e,"Metadata/MDI").forEach((e=>{const t=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":o=t;break;case"STATISTICS_MAXIMUM":l=t;break;case"STATISTICS_MEAN":c=t;break;case"STATISTICS_STDDEV":u=t}}));const h=Ze(e,"Metadata/SourceBandIndex");return{noDataValue:t,histogram:a?.length&&null!=n&&null!=r?{min:n,max:r,size:s||a.length,counts:a}:null,sourceBandIndex:h,statistics:null!=o&&null!=l?{min:o,max:l,avg:c,stddev:u}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}}));const i=t.rasterBands;if(i.length){const e=!!i[0].statistics;t.statistics=e?i.map((e=>e.statistics)).filter(P.pC):null;const n=!!i[0].histogram;t.histograms=n?i.map((e=>e.histogram)).filter(P.pC):null}return t}let He=class extends Y{async open(e){await this.init();const t=await this._fetchData(e);let{spatialReference:i,statistics:n,histograms:r,transform:s}=await this._fetchAuxiliaryData(e);const a=!i;a&&(i=new ce.Z({wkid:3857})),r?.length&&null==n&&(n=(0,re.Oh)(r));const{width:o,height:l}=t;let c=new $.Z({xmin:-.5,ymin:.5-l,xmax:o-.5,ymax:.5,spatialReference:i});const u=s?s.forwardTransform(c):c;let h=!0;if(s){const e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,c=u)}const f=new Fe({data:{extent:u,nativeExtent:c,transform:s,pixelBlock:t,statistics:n,histograms:r,keyProperties:{DateType:"Processed"},isPseudoSpatialReference:a}});await f.open(),f.data=null,this._set("rasterInfo",f.rasterInfo),this._inMemoryRaster=f}fetchRawTile(e,t,i,n={}){return this._inMemoryRaster.fetchRawTile(e,t,i,n)}async _fetchData(e){const{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,j.y)(t).toUpperCase();if("JPG"!==i&&"PNG"!==i&&"GIF"!==i&&"BMP"!==i)throw new a.Z("image-aux-raster:open","the data is not a supported format");this._set("datasetFormat",i);const n=i.toLowerCase(),r="gif"===n||"bmp"===n||!(0,d.Z)("ios"),s=await this.decodePixelBlock(t,{format:n,useCanvas:r,hasNoZlibMask:!0});if(null==s)throw new a.Z("image-aux-raster:open","the data cannot be decoded");return s}async _fetchAuxiliaryData(e){const t=e?.signal,i=this.ioConfig.skipExtensions??[],n=i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),r=this.datasetFormat,s="JPG"===r?"jgw":"PNG"===r?"pgw":"BMP"===r?"bpw":null,a=s&&i.includes(s)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+s,{responseType:"text",signal:t}),o=await(0,c.as)([n,a]);if(t?.aborted)throw(0,c.zE)();const l=Ee(o[0].value?.data);if(!l.transform){const e=o[1].value?o[1].value.data.split("\n").slice(0,6).map((e=>Number(e))):null;l.transform=6===e?.length?new Be.Z({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return l}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],He.prototype,"datasetFormat",void 0),He=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageAuxRaster")],He);const Le=He;var Ge=i(17452),We=i(45322),qe=i(56608),je=i(29680),Ue=i(26059);let Ve=class extends Y{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async open(e){await this.init();const t=e&&e.signal,i=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:t});i.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const n=i.data;if(this.sourceJSON=n,!n)throw new a.Z("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!n.tileInfo)throw new a.Z("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo(),this.tileType=n.cacheType,null==this.tileType&&(["jpg","jpeg","png","png8","png24","png32","mixed"].includes(n.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===n.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=n.name?.slice(n.name.indexOf("/")+1)??"";const r=await this._fetchRasterInfo({signal:t});if(null==r)throw new a.Z("image-server-raster:open","cannot initialize image service");const s="Map"===this.tileType?(0,We.d)(n.tileInfo,n):F.Z.fromJSON(n.tileInfo);(0,P.O3)(s);const[o,l]=this._computeMinMaxLOD(r,s),{extent:c,pixelSize:u}=r,h=.5/r.width*u.x,f=Math.max(u.x,u.y),{lods:d}=s;("Map"!==this.tileType&&0!==n.maxScale||Math.abs(u.x-u.y)>h||!d.some((e=>Math.abs(e.resolution-f)<h)))&&(u.x=u.y=o.resolution,r.width=Math.ceil((c.xmax-c.xmin)/u.x-.1),r.height=Math.ceil((c.ymax-c.ymin)/u.y-.1));const p=o.level-l.level,[m,y]=s.size,g=[],x=[];d.forEach(((e,t)=>{e.level>=l.level&&e.level<=o.level&&g.push({x:e.resolution,y:e.resolution}),t<d.length-1&&x.push(Math.round(10*e.resolution/d[t+1].resolution)/10)})),g.sort(((e,t)=>e.x-t.x));const w=this.computeBlockBoundary(c,m,y,s.origin,g,p),I=g.length>1?g.slice(1):null;let b;n.transposeInfo&&(b={tileSize:[n.transposeInfo.rows,n.transposeInfo.cols],packetSize:r.keyProperties?._yxs.PacketSize??0});const S=x.length<=1||x.length>=3&&x.slice(0,x.length-1).every((e=>e===x[0]))?x[0]??2:Math.round(10/(l.resolution/o.resolution)**(-1/p))/10;if(r.storageInfo=new Z.Z({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:I,pyramidScalingFactor:S,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,transposeInfo:b,blockBoundary:w}),this._fixGCSShift(r),this._set("rasterInfo",r),n.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:r.storageInfo.tileInfo,parsedUrl:(0,Ge.mN)(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new qe.y({layer:e})}}async fetchRawTile(e,t,i,n={}){const{storageInfo:r,extent:s}=this.rasterInfo,{transposeInfo:a}=r,o=null!=a&&!!n.transposedVariableName;if(this._slices&&!o&&null==n.sliceId)return null;const l=o?0:r.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${l}/${t}/${i}`,u=this._slices?o?{variable:n.transposedVariableName}:{sliceId:n.sliceId||0}:null,{data:h}=await this.request(c,{query:u,responseType:"array-buffer",signal:n.signal});if(!h)return null;const f=o?a.tileSize:r.tileInfo.size,d=await this.decodePixelBlock(h,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnInterleaved:o,noDataValue:this.rasterInfo.noDataValue});if(null==d)return null;const p=r.blockBoundary[e];if("jpg"!==r.compression||i>p.minCol&&i<p.maxCol&&t>p.minRow&&t<p.maxRow)return d;const{origin:m,blockWidth:y,blockHeight:g}=r,{x,y:w}=this.getPyramidPixelSize(e),I=Math.round((s.xmin-m.x)/x)%y,b=Math.round((s.xmax-m.x)/x)%y||y,S=Math.round((m.y-s.ymax)/w)%g,_=Math.round((m.y-s.ymin)/w)%g||g,R=i===p.minCol?I:0,v=t===p.minRow?S:0,T=i===p.maxCol?b:y,C=t===p.maxRow?_:g;return(0,U.pW)(d,{x:R,y:v},{width:T-R,height:C-v}),d}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;const t=e;for(let e=0;e<this._slices.length;e++){const i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));return!i||(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return e}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),n=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),r=await Promise.all([i,n]);return r[0]&&r[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:r[0]||null,histograms:r[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,t.datumTransformation);if(null===i)return null;let n=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let s=r-n+this._levelOffset;const a=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,n++,i=this.identifyPixelLocation(a,n,t.datumTransformation),null===i)return null}return-1===s||null==i?null:n}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),n=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),r=ce.Z.fromJSON(t.spatialReference||e.spatialReference),s=new z.Z({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:r});return new we.Z({width:i,height:n,bandCount:3,extent:$.Z.fromJSON(e),spatialReference:r,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,n=(0,Ue.g)(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),r=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,s=await Promise.all([n,r]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new je.Z,e.extent=e.transform.forwardTransform(t))}_computeMinMaxLOD(e,t){const{pixelSize:i}=e,n=.5/e.width*i.x,{lods:r}=t,s=t.lodAt(Math.max.apply(null,r.map((e=>e.level)))),a=t.lodAt(Math.min.apply(null,r.map((e=>e.level)))),{tileType:o}=this;if("Map"===o)return this._levelOffset=r[0].level,[s,a];if("Raster"===o)return[r.find((e=>e.resolution===i.x))??s,a];const{minScale:l,maxScale:c}=this.sourceJSON;let u=s;c>0&&(u=r.find((e=>Math.abs(e.scale-c)<n)),u||(u=r.filter((e=>e.scale>c)).sort(((e,t)=>e.scale>t.scale?1:-1))[0]??s));let h=a;return l>0&&(h=r.find((e=>Math.abs(e.scale-l)<n))??a,this._levelOffset=h.level-a.level),[u,h]}};(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Ve.prototype,"datasetFormat",void 0),(0,n._)([(0,h.Cb)()],Ve.prototype,"tileType",void 0),Ve=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.ImageServerRaster")],Ve);const $e=Ve;var Xe=i(48279);const Ye=new Map;Ye.set("Int8","s8"),Ye.set("UInt8","u8"),Ye.set("Int16","s16"),Ye.set("UInt16","u16"),Ye.set("Int32","s32"),Ye.set("UInt32","u32"),Ye.set("Float32","f32"),Ye.set("Float64","f32"),Ye.set("Double64","f32");const Ke=new Map;Ke.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Ke.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Ke.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Ke.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"});let Qe=class extends Y{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this.datasetFormat="MRF"}async open(e){await this.init(),this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);const t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:n,files:r}=this._parseHeader(i.data);if(-1===this.ioConfig.skipExtensions?.indexOf("aux.xml")){const t=await this._fetchAuxiliaryData(e);null!=t&&(n.statistics=t.statistics??n.statistics,n.histograms=t.histograms,t.histograms&&null==n.statistics&&(n.statistics=(0,re.Oh)(t.histograms)))}this._set("rasterInfo",n),this._files=r;const s=await this.request(r.index,{responseType:"array-buffer",signal:t});this._storageIndex=this._parseIndex(s.data);const{blockWidth:a,blockHeight:o}=this.rasterInfo.storageInfo,l=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:c,height:u}=this.rasterInfo,h=[],f=this._getBandSegmentCount();let d=0,p=-1;for(;d<this._storageIndex.length;){p++;const e=Math.ceil(c/a/l**p)-1,t=Math.ceil(u/o/l**p)-1;d+=(e+1)*(t+1)*f*4,h.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=h,p>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=p),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){const{blockWidth:r,blockHeight:s,blockBoundary:a}=this.rasterInfo.storageInfo,o=a[e];if(!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i)return null;const{bandCount:l,pixelType:c}=this.rasterInfo,{ranges:u,actualTileWidth:h,actualTileHeight:f}=this._getTileLocation(e,t,i);if(!u||0===u.length)return null;if(0===u[0].from&&0===u[0].to){const e=new Uint8Array(r*s);return new ie.Z({width:r,height:s,pixels:null,mask:e,validPixelCount:0})}const{bandIds:d}=this.ioConfig,p=this._getBandSegmentCount(),m=[];let y=0;for(y=0;y<p;y++)(!d||d.indexOf[y]>-1)&&m.push(this.request(this._files.data,{range:{from:u[y].from,to:u[y].to},responseType:"array-buffer",signal:n.signal}));const g=await Promise.all(m),x=g.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),w=new Uint8Array(x);let I=0;for(y=0;y<p;y++)w.set(new Uint8Array(g[y].data),I),I+=g[y].data.byteLength;const b=Ke.get(this.rasterInfo.storageInfo.compression).decoderFormat,S=await this.decodePixelBlock(w.buffer,{width:r,height:s,format:b,planes:d?.length||l,pixelType:c});if(null==S)return null;if(null!=this.rasterInfo.noDataValue&&"lerc"!==b&&!S.mask){const e=this.rasterInfo.noDataValue[0];if(null!=e){const t=S.width*S.height,i=new Uint8Array(t);if(Math.abs(e)>1e24)for(y=0;y<t;y++)Math.abs((S.pixels[0][y]-e)/e)>1e-6&&(i[y]=1);else for(y=0;y<t;y++)S.pixels[0][y]!==e&&(i[y]=1);S.mask=i}}let _=0,R=0;if(h!==r||f!==s){let e=S.mask;if(e)for(y=0;y<s;y++)if(R=y*r,y<f)for(_=h;_<r;_++)e[R+_]=0;else for(_=0;_<r;_++)e[R+_]=0;else for(e=new Uint8Array(r*s),S.mask=e,y=0;y<f;y++)for(R=y*r,_=0;_<h;_++)e[R+_]=1}return S}_parseIndex(e){if(e.byteLength%16>0)throw new Error("invalid array buffer must be multiples of 16");let t,i,n,r,s,a;if(Xe.f){for(i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),n=new Uint8Array(r),s=0;s<e.byteLength/4;s++)for(a=0;a<4;a++)n[4*s+a]=i[4*s+3-a];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}_getBandSegmentCount(){return Ke.get(this.rasterInfo.storageInfo.compression).isOneSegment?1:this.rasterInfo.bandCount}_getTileLocation(e,t,i){const{blockWidth:n,blockHeight:r,pyramidScalingFactor:s}=this.rasterInfo.storageInfo,{width:a,height:o}=this.rasterInfo,l=this._getBandSegmentCount();let c,u,h,f=0,d=0;for(h=0;h<e;h++)d=s**h,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=c*u;d=s**e,c=Math.ceil(a/n/d),u=Math.ceil(o/r/d),f+=t*c+i,f*=4*l;const p=this._storageIndex.subarray(f,f+4*l);let m=0,y=0;const g=[];for(let e=0;e<l;e++)m=p[4*e]*2**32+p[4*e+1],y=m+p[4*e+2]*2**32+p[4*e+3],g.push({from:m,to:y});return{ranges:g,actualTileWidth:i<c-1?n:Math.ceil(a/d)-n*(c-1),actualTileHeight:t<u-1?r:Math.ceil(o/d)-r*(u-1)}}_parseHeader(e){const t=Pe(e,"MRF_META/Raster");if(!t)throw new a.Z("mrf:open","not a valid MRF format");const i=Pe(t,"Size"),n=parseInt(i.getAttribute("x"),10),r=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),o=(Oe(t,"Compression")||"none").toLowerCase();if(!Ke.has(o))throw new a.Z("mrf:open","currently does not support compression "+o);const l=Oe(t,"DataType")||"UInt8",c=Ye.get(l);if(null==c)throw new a.Z("mrf:open","currently does not support pixel type "+l);const u=Pe(t,"PageSize"),h=parseInt(u.getAttribute("x"),10),f=parseInt(u.getAttribute("y"),10),d=Pe(t,"DataValues");let p,m;if(d&&(m=d.getAttribute("NoData"),null!=m&&(p=m.trim().split(" ").map((e=>parseFloat(e))))),Pe(e,"MRF_META/CachedSource"))throw new a.Z("mrf:open","currently does not support MRF referencing other data files");const y=Pe(e,"MRF_META/GeoTags"),g=Pe(y,"BoundingBox");let x,w=!1;if(null!=g){const e=parseFloat(g.getAttribute("minx")),t=parseFloat(g.getAttribute("miny")),i=parseFloat(g.getAttribute("maxx")),n=parseFloat(g.getAttribute("maxy")),r=Oe(y,"Projection")||"";let s=ce.Z.WGS84;if("LOCAL_CS[]"!==r)if(r.toLowerCase().startsWith("epsg:")){const e=Number(r.slice(5));isNaN(e)||0===e||(s=new ce.Z({wkid:e}))}else s=Je(r)??ce.Z.WGS84;else w=!0,s=new ce.Z({wkid:3857});x=new $.Z(e,t,i,n),x.spatialReference=s}else w=!0,x=new $.Z({xmin:-.5,ymin:.5-r,xmax:n-.5,ymax:.5,spatialReference:new ce.Z({wkid:3857})});const I=Pe(e,"MRF_META/Rsets"),b=parseInt(I&&I.getAttribute("scale")||"2",10),S=x.spatialReference,_=new Z.Z({origin:new z.Z({x:x.xmin,y:x.ymax,spatialReference:S}),blockWidth:h,blockHeight:f,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:o,pyramidScalingFactor:b}),R=new z.Z({x:x.width/n,y:x.height/r,spatialReference:S}),v=new we.Z({width:n,height:r,extent:x,isPseudoSpatialReference:w,spatialReference:S,bandCount:s,pixelType:c,pixelSize:R,noDataValue:p,storageInfo:_}),T=Oe(e,"datafile"),C=Oe(e,"IndexFile");return{rasterInfo:v,files:{mrf:this.url,index:C||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Ke.get(o).blobExtension)}}}async _fetchAuxiliaryData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}};(0,n._)([(0,h.Cb)()],Qe.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],Qe.prototype,"_storageIndex",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],Qe.prototype,"datasetFormat",void 0),Qe=(0,n._)([(0,y.j)("esri.layers.support.rasterIO.MRFRaster")],Qe);const et=Qe;var tt=i(94793),it=i(9832);const nt=(e,t)=>e.get(t)?.values,rt=(e,t)=>e.get(t)?.values?.[0];let st=class extends Y{constructor(){super(...arguments),this._files=null,this._headerInfo=null,this._bufferSize=1048576,this.datasetFormat="TIFF"}async open(e){await this.init();const t=e?e.signal:null,{data:i}=await this.request(this.url,{range:{from:0,to:this._bufferSize},responseType:"array-buffer",signal:t});if(!i)throw new a.Z("tiffraster:open","failed to open url "+this.url);this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf("."));const{littleEndian:n,firstIFDPos:r,isBigTiff:s}=(0,tt.cK)(i),o=[];await this._readIFDs(o,i,n,r,0,s?8:4,t);const{imageInfo:l,rasterInfo:c}=this._parseIFDs(o),u=(0,tt.ee)(o),h=(0,tt.I7)(o);if(this._headerInfo={littleEndian:n,isBigTiff:s,ifds:o,pyramidIFDs:u,maskIFDs:h,...l},this._set("rasterInfo",c),!l.isSupported)throw new a.Z("tiffraster:open","this tiff is not supported: "+l.message);if(!l.tileWidth)throw new a.Z("tiffraster:open","none-tiled tiff is not optimized for access, convert to COG and retry.");const{skipExtensions:f=[]}=this.ioConfig;if(!f.includes("aux.xml")){const t=await this._fetchAuxiliaryMetaData(e);null!=t&&this._processPAMInfo(t,c)}f.includes("vat.dbf")||1!==c.bandCount||"u8"!==c.pixelType||(c.attributeTable=await this._fetchAuxiliaryTable(e),null!=c.attributeTable&&(c.keyProperties.DataType="thematic")),this.updateTileInfo()}async fetchRawTile(e,t,i,n={}){if(!this._headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;const r=await this._fetchRawTiffTile(e,t,i,!1,n);if(null!=r&&this._headerInfo.hasMaskBand){const s=await this._fetchRawTiffTile(e,t,i,!0,n);null!=s&&s.pixels[0]instanceof Uint8Array&&(r.mask=s.pixels[0])}return r}_parseIFDs(e){const t=(0,tt.FI)(e),{width:i,height:n,tileWidth:r,tileHeight:s,planes:a,pixelType:o,compression:l,firstPyramidLevel:c,maximumPyramidLevel:u,pyramidBlockWidth:h,pyramidBlockHeight:f,tileBoundary:d,affine:p,metadata:m}=t;let y=Je(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),g=!!t.isPseudoGeographic;null==y&&(g=!0,y=new ce.Z({wkid:3857}));const x=new $.Z({...t.extent,spatialReference:y}),w=new z.Z(x?{x:x.xmin,y:x.ymax,spatialReference:y}:{x:0,y:0}),I=new Z.Z({blockWidth:r,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:f,compression:l,origin:w,firstPyramidLevel:c,maximumPyramidLevel:u,blockBoundary:d}),b=new z.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),S=m?{BandProperties:m.bandProperties,DataType:m.dataType}:{};let _=null;const R=rt(e[0],"PHOTOMETRICINTERPRETATION"),v=nt(e[0],"COLORMAP");if(R<=3&&v?.length>3&&v.length%3==0){_=[];const e=v.length/3;for(let t=0;t<e;t++)_.push([t,v[t]>>>8,v[t+e]>>>8,v[t+2*e]>>>8])}const T=new we.Z({width:i,height:n,bandCount:a,pixelType:o,pixelSize:b,storageInfo:I,spatialReference:y,isPseudoSpatialReference:g,keyProperties:S,extent:x,colormap:_,statistics:m?m.statistics:null});return p?.length&&(T.nativeExtent=new $.Z({xmin:-.5,ymin:.5-n,xmax:i-.5,ymax:.5,spatialReference:y}),T.transform=new Be.Z({polynomialOrder:1,forwardCoefficients:[p[2]+p[0]/2,p[5]-p[3]/2,p[0],p[3],-p[1],-p[4]]}),T.extent=T.transform.forwardTransform(T.nativeExtent),T.pixelSize=new z.Z({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/n,spatialReference:y}),I.origin.x=-.5,I.origin.y=.5),{imageInfo:t,rasterInfo:T}}_processPAMInfo(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,re.Oh)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;const i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new z.Z({x:(i.xmax-i.xmin)/t.width,y:(i.ymax-i.ymin)/t.height,spatialReference:t.spatialReference}),t.extent=i}t.isPseudoSpatialReference&&e.spatialReference&&(t.spatialReference=e.spatialReference,t.extent.spatialReference=t.nativeExtent.spatialReference=t.storageInfo.origin.spatialReference=t.spatialReference)}async _readIFDs(e,t,i,n,r,s=4,a){if(!n)return null;(n>=t.byteLength||n<0)&&(t=(await this.request(this.url,{range:{from:n+r,to:n+r+this._bufferSize},responseType:"array-buffer",signal:a})).data,r=n+r,n=0);const o=await this._readIFD(t,i,n,r,it.Z.TIFF_TAGS,s,a);if(e.push(o.ifd),!o.nextIFD)return null;await this._readIFDs(e,t,i,o.nextIFD-r,r,s,a)}async _readIFD(e,t,i,n,r=it.Z.TIFF_TAGS,s=4,a){if(!e)return null;const o=(0,tt.vr)(e,t,i,n,r,s);if(o.success){const i=[];if(o.ifd?.forEach((e=>{e.values||i.push(e)})),i.length>0){const r=i.map((e=>e.offlineOffsetSize)).filter(P.pC),s=Math.min.apply(null,r.map((e=>e[0])));if(Math.min.apply(null,r.map((e=>e[0]+e[1])))-s<=this._bufferSize){const{data:r}=await this.request(this.url,{range:{from:s,to:s+this._bufferSize},responseType:"array-buffer",signal:a});e=r,n=s,i.forEach((i=>(0,tt.Dq)(e,t,i,n)))}}if(o.ifd?.has("GEOKEYDIRECTORY")){const i=o.ifd.get("GEOKEYDIRECTORY"),r=i?.values;if(r&&r.length>4){const s=r[0]+"."+r[1]+"."+r[2],o=await this._readIFD(e,t,i.valueOffset+6-n,n,it.Z.GEO_KEYS,2,a);i.data=o.ifd,i.data&&i.data.set("GEOTIFFVersion",{id:0,type:2,valueCount:1,valueOffset:null,values:[s]})}}return o}if(o.requiredBufferSize&&o.requiredBufferSize!==e.byteLength){const i=await this.request(this.url,{range:{from:n,to:n+o.requiredBufferSize+4},responseType:"array-buffer",signal:a});return(e=i.data).byteLength<o.requiredBufferSize?null:this._readIFD(e,t,0,n,it.Z.TIFF_TAGS,4,a)}}async _fetchRawTiffTile(e,t,i,n,r={}){const s=this._getTileLocation(e,t,i,n);if(!s)return null;const{ranges:a,actualTileWidth:o,actualTileHeight:l,ifd:c}=s,u=a.map((e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:r.signal}))),h=await Promise.all(u),f=h.map((e=>e.data.byteLength)).reduce(((e,t)=>e+t)),d=1===h.length?h[0].data:new ArrayBuffer(f),p=[0],m=[0];if(h.length>1){const e=new Uint8Array(d);for(let t=0,i=0;t<h.length;t++){const n=h[t].data;e.set(new Uint8Array(n),i),p[t]=i,i+=n.byteLength,m[t]=n.byteLength}}const{blockWidth:y,blockHeight:g}=this.getBlockWidthHeight(e),x=await this.decodePixelBlock(d,{format:"tiff",customOptions:{headerInfo:this._headerInfo,ifd:c,offsets:p,sizes:m},width:y,height:g,planes:null,pixelType:null});if(null==x)return null;let w,I,b;if(o!==y||l!==g){let e=x.mask;if(e)for(w=0;w<g;w++)if(b=w*y,w<l)for(I=o;I<y;I++)e[b+I]=0;else for(I=0;I<y;I++)e[b+I]=0;else for(e=new Uint8Array(y*g),x.mask=e,w=0;w<l;w++)for(b=w*y,I=0;I<o;I++)e[b+I]=1}return x}_getTileLocation(e,t,i,n=!1){const{firstPyramidLevel:r,blockBoundary:s}=this.rasterInfo.storageInfo,a=0===e?0:e-(r-1),{_headerInfo:o}=this;if(!o)return null;const l=n?o.maskIFDs[a]:0===a?o?.ifds[0]:o?.pyramidIFDs[a-1];if(!l)return null;const c=(0,tt.If)(l,o),u=nt(l,"TILEOFFSETS");if(void 0===u)return null;const h=nt(l,"TILEBYTECOUNTS"),{minRow:f,minCol:d,maxRow:p,maxCol:m}=s[a];if(t>p||i>m||t<f||i<d)return null;const y=rt(l,"IMAGEWIDTH"),g=rt(l,"IMAGELENGTH"),x=rt(l,"TILEWIDTH"),w=rt(l,"TILELENGTH"),I=c?this.rasterInfo.bandCount:1,b=I*t*(m+1)+i,S=[{from:u[b],to:u[b+I-1]+h[b+I-1]-1}];if(c){let e=!0;for(let t=0;t<I;t++)if(u[b+t]+h[b+t]!==u[b+t+1]){e=!1;break}if(!e)for(let e=0;e<I;e++)S[e]={from:u[b+e],to:u[b+e]+h[b+e]-1}}const _=u[b],R=h[b];return null==_||null==R?null:{ranges:S,ifd:l,actualTileWidth:i===m&&y%x||x,actualTileHeight:t===p&&g%w||w}}async _fetchAuxiliaryMetaData(e){try{const{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return Ee(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{const{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Se.parse(t);return i?.recordSet?Re.Z.fromJSON(i.recordSet):null}catch{return null}}};(0,n._)([(0,h.Cb)()],st.prototype,"_files",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_headerInfo",void 0),(0,n._)([(0,h.Cb)()],st.prototype,"_bufferSize",void 0),(0,n._)([(0,h.Cb)({type:String,json:{write:!0}})],st.prototype,"datasetFormat",void 0),st=(0,n._)([(0,y.j)("esri.layers.support.rasterDatasets.TIFFRaster")],st);const at=st,ot=new Map;ot.set("CRF",{desc:"Cloud Raster Format",constructor:Ce}),ot.set("MRF",{desc:"Meta Raster Format",constructor:et}),ot.set("TIFF",{desc:"GeoTIFF",constructor:at}),ot.set("RasterTileServer",{desc:"Raster Tile Server",constructor:$e}),ot.set("JPG",{desc:"JPG Raster Format",constructor:Le}),ot.set("PNG",{desc:"PNG Raster Format",constructor:Le}),ot.set("GIF",{desc:"GIF Raster Format",constructor:Le}),ot.set("BMP",{desc:"BMP Raster Format",constructor:Le});class lt{static get supportedFormats(){const e=new Set;return ot.forEach(((t,i)=>e.add(i))),e}static async open(e){const{url:t,ioConfig:i,sourceJSON:n}=e;let r=e.datasetFormat;null==r&&t.lastIndexOf(".")&&(r=t.slice(t.lastIndexOf(".")+1).toUpperCase()),"OVR"===r||"TIF"===r?r="TIFF":"JPG"!==r&&"JPEG"!==r&&"JFIF"!==r||(r="JPG"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(r="RasterTileServer");const s={url:t,sourceJSON:n,datasetFormat:r,ioConfig:i??{bandIds:null,sampling:null}};let o,l;if(r&&this.supportedFormats.has(r)){if("CRF"===r&&!i?.enableCRF)throw new a.Z("rasterfactory:open",`cannot open raster: ${t}`);return o=ot.get(r).constructor,l=new o(s),await l.open({signal:e.signal}),l}if(r)throw new a.Z("rasterfactory:open","not a supported format "+r);const c=Array.from(ot.keys());let u=0;const h=()=>(r=c[u++],r&&("CRF"!==r||i?.enableCRF)?(o=ot.get(r).constructor,l=new o(s),l.open({signal:e.signal}).then((()=>l)).catch((()=>h()))):null);return h()}static register(e,t,i){ot.has(e.toUpperCase())||ot.set(e.toUpperCase(),{desc:t,constructor:i})}}var ct=i(32163);let ut=class extends((0,w.h)((0,me.M)((0,fe.q)((0,de.I)((0,I.N)(he((0,ye.n)((0,x.Y)((0,pe.Q)((0,l.R)(g.Z))))))))))){constructor(...e){super(...e),this._primaryRasters=null,this.bandIds=null,this.interpolation=null,this.legendEnabled=!0,this.isReference=null,this.listMode="show",this.sourceJSON=null,this.version=null,this.type="imagery-tile",this.operationalLayerType="ArcGISTiledImageServiceLayer",this.popupEnabled=!0,this.popupTemplate=null,this.fields=null}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(c.r9).then((()=>this._openRaster(t)))),Promise.resolve(this)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[new ge.Z({name:"Raster.ServicePixelValue",alias:"Pixel Value",domain:null,editable:!1,length:50,type:"string"})];const{rasterInfo:t}=this,i=t?.attributeTable,n=null!=i?i.fields:null;if(n){const t=n.filter((e=>"oid"!==e.type&&"value"!==e.name.toLowerCase())).map((e=>{const t=e.clone();return t.name="Raster."+e.name,t}));e=e.concat(t)}const r=t?.dataType,s=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=s){const t=s.variables[0].unit?.trim(),i="Magnitude"+(t?` (${t})`:"");e.push(new ge.Z({name:"Raster.Magnitude",alias:i,domain:null,editable:!1,type:"double"})),e.push(new ge.Z({name:"Raster.Direction",alias:"Direction (°)",domain:null,editable:!1,type:"double"}))}return e}set renderer(e){this._set("renderer",e),this.updateRenderer()}readRenderer(e,t,i){const n=t&&t.layerDefinition&&t.layerDefinition.drawingInfo&&t.layerDefinition.drawingInfo.renderer,r=(0,s.ij)(n,i)||void 0;if(null!=r)return r}createPopupTemplate(e){return(0,ct.eZ)({fields:this.rasterFields,title:this.title},e)}async generateRasterInfo(e,t){if(!(e=(0,f.TJ)(C.Z,e)))return this._primaryRasters[0].rasterInfo;try{const i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((e=>i[e.url]=e));const n=(0,ne.Ue)(e.toJSON(),i),r=new Q({rasterFunction:n});return await r.open(t),r.rasterInfo}catch{return null}}write(e,t){const{raster:i}=this;if(this.loaded?"RasterTileServer"===i.datasetFormat&&("Raster"===i.tileType||"Map"===i.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))return super.write(e,t);if(t&&t.messages){const e=`${t.origin}/${t.layerContainerType||"operational-layers"}`;t.messages.push(new a.Z("layer:unsupported",`Layers (${this.title}, ${this.id}) of type '${this.declaredClass}' are not supported in the context of '${e}'`,{layer:this}))}return null}async _openRaster(e){let t=!1;if(this.raster)this.raster.rasterInfo||await this.raster.open(),"Function"===this.raster.datasetFormat?(t=!0,this._primaryRasters=this.raster.primaryRasters.rasters):this._primaryRasters=[this.raster],this.url=this.raster.url;else{const{rasterFunction:t}=this,i=[this.url];t&&(0,ne.G8)(t.toJSON(),i);const n=await Promise.all(i.map((t=>lt.open({url:t,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:e})))),r=n.findIndex((e=>null==e));if(r>-1)throw new a.Z("imagery-tile-layer:open",`cannot open raster: ${i[r]}`);if(this._primaryRasters=n,t){const e={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach((t=>e[t.url]=t));const i=(0,ne.Ue)(t.rasterFunctionDefinition??t.toJSON(),e),r=new Q({rasterFunction:i});try{await r.open(),this.raster=r}catch(e){const t=o.Z.getLogger(this.declaredClass);e instanceof a.Z&&t.error("imagery-tile-layer:open",e.message),t.warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=n[0]}}else this.raster=n[0]}const i=this.raster.rasterInfo;if(!i)throw new a.Z("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("rasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){const e="Map"===this.raster.tileType&&null!=this.sourceJSON.minLOD&&null!=this.sourceJSON.maxLOD?this.sourceJSON:{...this.sourceJSON,minScale:0,maxScale:0};this.read(e,{origin:"service"})}this.title||(this.title=this.raster.datasetName),"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,u.YP)((()=>this.customParameters),(e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)})))}};(0,n._)([(0,h.Cb)()],ut.prototype,"_primaryRasters",void 0),(0,n._)([(0,h.Cb)({type:[f.z8],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ut.prototype,"bandIds",void 0),(0,n._)([(0,h.Cb)({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),(0,p.J)(xe.c)],ut.prototype,"interpolation",void 0),(0,n._)([(0,h.Cb)(R.rn)],ut.prototype,"legendEnabled",void 0),(0,n._)([(0,h.Cb)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ut.prototype,"isReference",void 0),(0,n._)([(0,h.Cb)({type:["show","hide"]})],ut.prototype,"listMode",void 0),(0,n._)([(0,h.Cb)({json:{read:!0,write:!0}})],ut.prototype,"blendMode",void 0),(0,n._)([(0,h.Cb)()],ut.prototype,"sourceJSON",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],ut.prototype,"version",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,json:{read:!1}})],ut.prototype,"type",void 0),(0,n._)([(0,h.Cb)({type:["ArcGISTiledImageServiceLayer"]})],ut.prototype,"operationalLayerType",void 0),(0,n._)([(0,h.Cb)({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,t)=>!t.disablePopup},write:{target:"disablePopup",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}},writer(e,t,i){t[i]=!e}}}})],ut.prototype,"popupEnabled",void 0),(0,n._)([(0,h.Cb)({type:r.Z,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],ut.prototype,"popupTemplate",void 0),(0,n._)([(0,h.Cb)({readOnly:!0})],ut.prototype,"defaultPopupTemplate",null),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"fields",void 0),(0,n._)([(0,h.Cb)({readOnly:!0,type:[ge.Z]})],ut.prototype,"rasterFields",null),(0,n._)([(0,h.Cb)({types:s.dr,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:s.FK,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],ut.prototype,"renderer",null),(0,n._)([(0,m.r)("renderer")],ut.prototype,"readRenderer",null),ut=(0,n._)([(0,y.j)("esri.layers.ImageryTileLayer")],ut);const ht=ut},11282:(e,t,i)=>{i.d(t,{cv:()=>o,en:()=>a,lA:()=>s}),i(68773),i(40330);var n=i(22974),r=i(17452);function s(e,t){return t?{...t,query:{...e??{},...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.mN)(e):(0,n.d9)(e)}function o(e,t,i){const n={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s)){n[r]=[];for(let e=0;e<s.length;e++)n[r][e]=o(s[e])}else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(i&&i[r]);n[r]=t?e:JSON.stringify(e)}else n[r]=t?s:JSON.stringify(s);else n[r]=s}return n}i(71058)}}]);