@arcgis/core 6.0.0-next.33 → 6.0.0-next.35

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 (317) hide show
  1. package/Basemap.d.ts +2 -2
  2. package/README.md +2 -2
  3. package/analysis/ShadowCastAnalysis.d.ts +11 -5
  4. package/applications/Urban/meshUtils.d.ts +1 -0
  5. package/applications/Urban/meshUtils.js +1 -1
  6. package/arcgisGlobal.d.ts +1 -0
  7. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  8. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/01f55004d64309f8538b.js +1 -0
  11. package/assets/esri/core/workers/chunks/0202eb8c2b2865f99981.js +1 -0
  12. package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{f3dc0bc0e00635855a7a.js → 03daf6f235c6edef6268.js} +1 -1
  14. package/assets/esri/core/workers/chunks/04a1d08c3b5b1dc7628f.js +1 -0
  15. package/assets/esri/core/workers/chunks/{1eaf8bfdd3765a90ccc2.js → 0523f893870a1546d7d9.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{1ee4df0fd61440cb5f02.js → 06102715e9a8f218e07c.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{6029773458ab98600f67.js → 07e5482e1fc69be5de09.js} +1 -1
  18. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +1 -0
  19. package/assets/esri/core/workers/chunks/{72d20d3957d612f86431.js → 0a508e25ec05363e1f04.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
  21. package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
  22. package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
  23. package/assets/esri/core/workers/chunks/{84038dd85005fea413eb.js → 139e753d95cfc9470e74.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{dd30b02c5978c1c5f511.js → 155861fbd0e5fc2db80c.js} +1 -1
  25. package/assets/esri/core/workers/chunks/15950c2fb173b62ee0ec.js +1 -0
  26. package/assets/esri/core/workers/chunks/165ca7a97b611c8f26c4.js +1 -0
  27. package/assets/esri/core/workers/chunks/{418addce122dbb8897b4.js → 1a614bac5db42c6263f8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{0cc7fba402a93e6d2455.js → 1ae0c9345626e70affd3.js} +2 -2
  29. package/assets/esri/core/workers/chunks/{58c3ae6030def2ed5f31.js → 1b17f5f720f6cf3f6d73.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{cd355baab983033c3ef0.js → 1ec772eaa63eb6937231.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{f9dc38761b314d33890f.js → 1f51567f47c2e2fc8a23.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{5c04835b0b52461183cd.js → 1fd82fcba2758741996a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
  34. package/assets/esri/core/workers/chunks/2211ff0a1f1ae8100231.js +1 -0
  35. package/assets/esri/core/workers/chunks/{096b2bf1c0d69d27f20c.js → 247617c0dbae2386ab3b.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{97ec46605f16333144b7.js → 26ea39dfdf887f357fce.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{85de980c5b296ec69323.js → 279089a6a3f08022c678.js} +1 -1
  38. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +1 -0
  39. package/assets/esri/core/workers/chunks/2b4dd42920d37b1ff0a9.js +2 -0
  40. package/assets/esri/core/workers/chunks/{8da2a10318f49d0dc73a.js → 31ef7b7074b3e3829763.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{b657363113f4a37e634b.js → 3223f9fbc76ba9ef8d13.js} +1 -1
  42. package/assets/esri/core/workers/chunks/322b22a5d54e404bebd5.js +1 -0
  43. package/assets/esri/core/workers/chunks/{122e75b21699a4e83b15.js → 338d800d4efcc91cead1.js} +1 -1
  44. package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
  45. package/assets/esri/core/workers/chunks/{360c944c610efa2051fc.js → 379db67f78161ebd5468.js} +2 -2
  46. package/assets/esri/core/workers/chunks/{f09bc86cd52224febfcb.js → 3b380e64566a6cce59e2.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{be55771758e4bcef0976.js → 3e406043a374ee17475b.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{e3b212f8af448ec29eef.js → 3fe4c89acd325d36618d.js} +1 -1
  49. package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
  50. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +1 -0
  51. package/assets/esri/core/workers/chunks/{a596779eaeec7310671d.js → 478a89317a12e9b4d146.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{fcc3902d6d9eda6f09f5.js → 48b8b57f559a53c6c513.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{55a9eaeb152a3abada67.js → 4e5405134d079bdf9b7a.js} +1 -1
  54. package/assets/esri/core/workers/chunks/4f3e0d583cfa9d1d6727.js +2 -0
  55. package/assets/esri/core/workers/chunks/{d070fcb73ce274ab80e4.js → 5504ec9bd9ee4d10af07.js} +1 -1
  56. package/assets/esri/core/workers/chunks/552c36b40e5a5ec117fb.js +1 -0
  57. package/assets/esri/core/workers/chunks/5622f3faa59434772857.js +1 -0
  58. package/assets/esri/core/workers/chunks/{bd46a04a9ee4ea9e6ef1.js → 5864bce1498a13ee5b7e.js} +2 -2
  59. package/assets/esri/core/workers/chunks/59a1b637d2c107504a04.js +1 -0
  60. package/assets/esri/core/workers/chunks/59a88dd53f8806bbec06.js +1 -0
  61. package/assets/esri/core/workers/chunks/{f4d91d470ca5fea0bd26.js → 5bd1414220e42cb8ebcf.js} +1 -1
  62. package/assets/esri/core/workers/chunks/5c2fe67527c9d7b4dba3.js +1 -0
  63. package/assets/esri/core/workers/chunks/5c3aa8386705c5e40358.js +1 -0
  64. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +1 -0
  65. package/assets/esri/core/workers/chunks/{176d75e76318bfc25a53.js → 60c8eedd06080edab3e3.js} +1 -1
  66. package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
  67. package/assets/esri/core/workers/chunks/6604272ef6fe85279032.js +1 -0
  68. package/assets/esri/core/workers/chunks/{29cc6b1705418b1be5d7.js → 687deb918eb48a963c8f.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{0694c7bcfe71692e2ccf.js → 723df53cfa0189837d01.js} +1 -1
  70. package/assets/esri/core/workers/chunks/{90c1d10eae7ae71889b0.js → 7400b8c454b47ee4fb3c.js} +1 -1
  71. package/assets/esri/core/workers/chunks/796c6195b6bf59dcc9bd.js +1 -0
  72. package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
  73. package/assets/esri/core/workers/chunks/{2de077c7b971f2c215a6.js → 7ddbde8fdd1cf3c53f50.js} +1 -1
  74. package/assets/esri/core/workers/chunks/804606b194dc9e71d088.js +1 -0
  75. package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
  76. package/assets/esri/core/workers/chunks/{1a8d8274df292d65f82e.js → 81bcc495e6eaf2cf7474.js} +1 -1
  77. package/assets/esri/core/workers/chunks/90360c0bd053d3e3fd77.js +1 -0
  78. package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
  79. package/assets/esri/core/workers/chunks/{e096c1d9d53af74d3207.js → 990e96139b5a1dccb061.js} +1 -1
  80. package/assets/esri/core/workers/chunks/9c3de54513bf8619271c.js +1 -0
  81. package/assets/esri/core/workers/chunks/{f28b63c1179366dac8a2.js → 9e2c30b67bab5795306e.js} +1 -1
  82. package/assets/esri/core/workers/chunks/{9184c947cdefe06bf551.js → a18c3cbe505a19d29569.js} +1 -1
  83. package/assets/esri/core/workers/chunks/aa6ee2aa4ff6e6d41efb.js +1 -0
  84. package/assets/esri/core/workers/chunks/{3fd5c3cd8457ddc68798.js → aa779896fd9e5c341349.js} +1 -1
  85. package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
  86. package/assets/esri/core/workers/chunks/{fe6dcb21570395e46ce8.js → afc8a9847f31bb66b13b.js} +1 -1
  87. package/assets/esri/core/workers/chunks/c5bf19da62a3d31009fe.js +2 -0
  88. package/assets/esri/core/workers/chunks/{2226c20c38e20713bcb5.js.LICENSE.txt → c5bf19da62a3d31009fe.js.LICENSE.txt} +1 -1
  89. package/assets/esri/core/workers/chunks/c7adb7b77721c75891f4.js +1 -0
  90. package/assets/esri/core/workers/chunks/cd55cad81accf51d2989.js +1 -0
  91. package/assets/esri/core/workers/chunks/{bead830a677690eeb6fb.js → ce8ef2eec290e1df6b2a.js} +1 -1
  92. package/assets/esri/core/workers/chunks/d3369ffed19f4c264dcd.js +1 -0
  93. package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
  94. package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
  95. package/assets/esri/core/workers/chunks/{89dc49e784f7ba3b93ea.js → dac69c0047488fdf986d.js} +1 -1
  96. package/assets/esri/core/workers/chunks/db1f7b2562de495b3401.js +2 -0
  97. package/assets/esri/core/workers/chunks/dcc782e4bf9e8a8202f9.js +1 -0
  98. package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +1 -0
  99. package/assets/esri/core/workers/chunks/e0a37d3bcb9a944e53dd.js +1 -0
  100. package/assets/esri/core/workers/chunks/{19a4fa965b70fc6f78f6.js → e209cb1f3f14bf576ebe.js} +1 -1
  101. package/assets/esri/core/workers/chunks/e67ea2f1714e5abeae44.js +1 -0
  102. package/assets/esri/core/workers/chunks/e8fb2ba7b7a4f0916325.js +1 -0
  103. package/assets/esri/core/workers/chunks/{636e9c4ac1f9ae98f9d1.js → ea81f9d71b0842a4be26.js} +1 -1
  104. package/assets/esri/core/workers/chunks/{164c8eeefa8232b2b191.js → eaa0e906b46ae4c84d72.js} +2 -2
  105. package/assets/esri/core/workers/chunks/efcd38aad9aa667001b2.js +1 -0
  106. package/assets/esri/core/workers/chunks/{3aafdb905c697bc9b1ad.js → f372f4eb5527238c46f5.js} +1 -1
  107. package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
  108. package/assets/esri/core/workers/chunks/f7123ba1286f64e13e91.js +1 -0
  109. package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
  110. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  111. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  112. package/chunks/BlurEmission.glsl.js +9 -4
  113. package/chunks/GlobalIllumination.glsl.js +55 -46
  114. package/chunks/GlobalIlluminationBlur.glsl.js +13 -9
  115. package/chunks/RibbonLine.glsl.js +90 -88
  116. package/chunks/Terrain.glsl.js +9 -9
  117. package/chunks/libtess-f32.js +1 -1
  118. package/chunks/libtess-f64.js +1 -1
  119. package/chunks/lyr3DMain.js +1 -1
  120. package/chunks/lyr3DWorker.js +2 -2
  121. package/config.d.ts +3 -3
  122. package/config.js +1 -1
  123. package/core/has.js +1 -1
  124. package/core/mathUtils.js +1 -1
  125. package/core/workers.d.ts +1 -0
  126. package/form/FormTemplate.d.ts +1 -1
  127. package/geometry/libtess.js +1 -1
  128. package/geometry/projection/projectors.js +1 -1
  129. package/geometry/support/MeshLocalVertexSpace.d.ts +3 -3
  130. package/geometry/support/aaBoundingRect.js +1 -1
  131. package/geometry/support/meshUtils/convertMeshVertexSpace.js +1 -1
  132. package/geometry/support/meshUtils/vertexSpaceConversion.js +1 -1
  133. package/identity/Credential.d.ts +1 -1
  134. package/identity/IdentityManager.d.ts +1 -1
  135. package/identity/IdentityManagerBase.js +1 -1
  136. package/identity/OAuthInfo.d.ts +1 -1
  137. package/identity/ServerInfo.d.ts +1 -1
  138. package/kernel.d.ts +3 -3
  139. package/kernel.js +1 -1
  140. package/layers/CSVLayer.js +1 -1
  141. package/layers/GaussianSplatLayer.js +1 -1
  142. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  143. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  144. package/layers/VectorTileLayer.d.ts +2 -2
  145. package/layers/VideoLayer.js +1 -1
  146. package/layers/VoxelWasmPerSceneView.js +1 -1
  147. package/layers/WFSLayer.d.ts +8 -4
  148. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  149. package/layers/graphics/sources/CSVSource.js +1 -1
  150. package/layers/graphics/sources/GeoJSONSource.js +1 -1
  151. package/layers/graphics/sources/MemorySource.js +2 -2
  152. package/layers/graphics/sources/WFSSource.js +1 -1
  153. package/layers/graphics/sources/geojson/geojson.js +1 -1
  154. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  155. package/layers/graphics/sources/support/QueryTask.js +1 -1
  156. package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
  157. package/layers/mixins/APIKeyMixin.d.ts +1 -1
  158. package/layers/mixins/ArcGISMapService.d.ts +17 -0
  159. package/layers/mixins/ArcGISMapService.js +1 -1
  160. package/layers/ogc/types.d.ts +1 -1
  161. package/layers/ogc/wfsUtils.d.ts +7 -2
  162. package/layers/ogc/wfsUtils.js +1 -1
  163. package/layers/ogc/xmlUtils.js +1 -1
  164. package/layers/support/TelemetryData.d.ts +28 -4
  165. package/layers/support/TimeInformation.js +1 -1
  166. package/layers/support/tiles3DUtils.js +1 -1
  167. package/layers/support/timeInfoUtils.js +2 -0
  168. package/layers/video/videoUtils.js +1 -1
  169. package/package.json +4 -4
  170. package/rest/query/executeAttributeBinsQuery.js +1 -1
  171. package/rest/query/executeForExtent.js +1 -1
  172. package/rest/query/executeForTopCount.js +1 -1
  173. package/rest/query/executeForTopExtents.js +1 -1
  174. package/rest/query/executeForTopIds.js +1 -1
  175. package/rest/query/executeTopFeaturesQuery.js +1 -1
  176. package/rest/query/operations/query.js +1 -1
  177. package/rest/query/operations/queryAttributeBins.js +1 -1
  178. package/rest/query/operations/queryTopFeatures.js +1 -1
  179. package/rest/route.d.ts +1 -1
  180. package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
  181. package/rest/support/LengthsParameters.d.ts +1 -1
  182. package/rest/support/timeUtils.js +1 -1
  183. package/symbols/TextSymbol.d.ts +0 -1
  184. package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
  185. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  186. package/views/2d/engine/webgl/GlyphWorker.js +1 -1
  187. package/views/2d/engine/webgl/TextureManager.js +1 -1
  188. package/views/2d/engine/webgl/materialKeyUtils.js +2 -0
  189. package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
  190. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  191. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  192. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
  193. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
  195. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
  196. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
  197. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  198. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
  199. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
  200. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  201. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  202. package/views/2d/layers/VideoLayerView2D.js +1 -1
  203. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  204. package/views/3d/FocusAreasView.js +1 -1
  205. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  206. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  207. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  208. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  209. package/views/3d/analysis/ShadowCast/ShadowCastError.d.ts +40 -0
  210. package/views/3d/analysis/ShadowCast/ShadowCastError.js +2 -0
  211. package/views/3d/analysis/ShadowCast/sunlightUtils.js +2 -0
  212. package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +16 -1
  213. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  214. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  215. package/views/3d/camera/intersectionUtils.js +1 -1
  216. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  217. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  218. package/views/3d/layers/Lyr3DWorker.js +1 -1
  219. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  220. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  221. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
  226. package/views/3d/layers/graphics/MeshFastUpdateProcessor.js +1 -1
  227. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  228. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  229. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  230. package/views/3d/layers/support/FeatureMemory.js +1 -1
  231. package/views/3d/layers/support/FeatureTile.js +1 -1
  232. package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
  233. package/views/3d/state/Constraints.js +1 -1
  234. package/views/3d/state/NearFarHeuristic.js +1 -1
  235. package/views/3d/state/ScreenSizePerspective.js +1 -1
  236. package/views/3d/state/ViewStateManager.js +1 -1
  237. package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
  238. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  239. package/views/3d/support/RenderCoordsHelper.js +1 -1
  240. package/views/3d/support/orientedBoundingBox.js +1 -1
  241. package/views/3d/support/sphereExtentUtils.js +1 -1
  242. package/views/3d/terrain/TerrainRenderer.js +1 -1
  243. package/views/3d/terrain/TerrainSurface.js +1 -1
  244. package/views/3d/terrain/TileRenderer.js +1 -1
  245. package/views/3d/terrain/tileUtils.js +1 -1
  246. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  247. package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
  248. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  249. package/views/3d/webgl-engine/lib/RibbonLineVertexInfo.js +1 -1
  250. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  251. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  252. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  253. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  254. package/views/3d/webgl.d.ts +1 -1
  255. package/views/SceneView.js +1 -1
  256. package/views/support/Scheduler.js +1 -1
  257. package/views/webgl/BufferObject.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/widgets/Directions.d.ts +1 -1
  260. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  261. package/widgets/HistogramRangeSlider.d.ts +1 -1
  262. package/assets/esri/core/workers/chunks/0e445ec3523de9f2dfa2.js +0 -1
  263. package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +0 -1
  264. package/assets/esri/core/workers/chunks/131185d26343a997495e.js +0 -1
  265. package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +0 -1
  266. package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +0 -1
  267. package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +0 -1
  268. package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
  269. package/assets/esri/core/workers/chunks/2226c20c38e20713bcb5.js +0 -2
  270. package/assets/esri/core/workers/chunks/277263466837e1673f56.js +0 -1
  271. package/assets/esri/core/workers/chunks/2981e904ab62f3ed80d0.js +0 -2
  272. package/assets/esri/core/workers/chunks/32cc59e126df8c96a0cf.js +0 -2
  273. package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
  274. package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
  275. package/assets/esri/core/workers/chunks/46453ebfee17b5421d9d.js +0 -1
  276. package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
  277. package/assets/esri/core/workers/chunks/5bb6c255bdc8aa9ba23e.js +0 -1
  278. package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
  279. package/assets/esri/core/workers/chunks/654f5441227579d2b6b4.js +0 -1
  280. package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +0 -1
  281. package/assets/esri/core/workers/chunks/6bb191b19ce43a27f205.js +0 -1
  282. package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
  283. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +0 -1
  284. package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +0 -1
  285. package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +0 -1
  286. package/assets/esri/core/workers/chunks/7566321c6a2913f2852b.js +0 -1
  287. package/assets/esri/core/workers/chunks/7b5cd150a4d0139850be.js +0 -1
  288. package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +0 -1
  289. package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +0 -1
  290. package/assets/esri/core/workers/chunks/844eedda8f749972f707.js +0 -2
  291. package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +0 -1
  292. package/assets/esri/core/workers/chunks/87177e0f82e8a6ae3189.js +0 -1
  293. package/assets/esri/core/workers/chunks/9976eaa81085c0d17e14.js +0 -1
  294. package/assets/esri/core/workers/chunks/a2196a49f89d57a0a1c7.js +0 -1
  295. package/assets/esri/core/workers/chunks/a504a5e06cb89a620799.js +0 -1
  296. package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
  297. package/assets/esri/core/workers/chunks/aba259a70bee68d2edb7.js +0 -1
  298. package/assets/esri/core/workers/chunks/b8fd7c3b36981261378b.js +0 -1
  299. package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +0 -1
  300. package/assets/esri/core/workers/chunks/c33a9635c294c8774977.js +0 -1
  301. package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
  302. package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
  303. package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
  304. package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
  305. package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +0 -1
  306. package/assets/esri/core/workers/chunks/e81173724e8de8c1e65b.js +0 -1
  307. package/assets/esri/core/workers/chunks/e83f9abee611c5b80009.js +0 -1
  308. package/assets/esri/core/workers/chunks/f39c700f3db7db52b522.js +0 -1
  309. package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +0 -1
  310. package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +0 -1
  311. package/views/2d/engine/webgl/hashMosaic.js +0 -2
  312. /package/assets/esri/core/workers/chunks/{0cc7fba402a93e6d2455.js.LICENSE.txt → 1ae0c9345626e70affd3.js.LICENSE.txt} +0 -0
  313. /package/assets/esri/core/workers/chunks/{844eedda8f749972f707.js.LICENSE.txt → 2b4dd42920d37b1ff0a9.js.LICENSE.txt} +0 -0
  314. /package/assets/esri/core/workers/chunks/{32cc59e126df8c96a0cf.js.LICENSE.txt → 4f3e0d583cfa9d1d6727.js.LICENSE.txt} +0 -0
  315. /package/assets/esri/core/workers/chunks/{bd46a04a9ee4ea9e6ef1.js.LICENSE.txt → 5864bce1498a13ee5b7e.js.LICENSE.txt} +0 -0
  316. /package/assets/esri/core/workers/chunks/{2981e904ab62f3ed80d0.js.LICENSE.txt → db1f7b2562de495b3401.js.LICENSE.txt} +0 -0
  317. /package/assets/esri/core/workers/chunks/{164c8eeefa8232b2b191.js.LICENSE.txt → eaa0e906b46ae4c84d72.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>o,Qh:()=>n,lM:()=>s,ro:()=>u,rq:()=>f});var r=i(44208),a=i(34275);function s(e){if(!e)return 0;let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function n(e){if(!e)return 0;if("number"==typeof e[0])return o(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return f(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?n(e):h;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...e){return e.reduce((e,t)=>e+u(t),0)}function u(e,t=16){return e?(0,a.iu)(e)?e.byteLength+d:Array.isArray(e)?f(e,t):0:0}function f(e,t){return c+e.length*t}const h=32,c=16,p=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,d=145;i.d(t,["JY",0,p])},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),_=i(8303),T=i(72545),R=i(56551),M=i(54310),O=i(25036),F=i(82935),k=i(82806),P=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),z=i(16930),E=i(73444),J=i(94778),H=i(14140);function $(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function U(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,E.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function j(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=j(),e.Green=j(),e.Blue=j())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,J.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new z.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!$(t[t.length-1])||!U(t[t.length-2]))throw new l.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];$(o)?s=e:U(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new z.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new z.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new z.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new z.A({wkid:t}):new z.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new z.A({wkt:e}):new z.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(40951);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new z.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let _e=class extends N.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g="raw"===p.format,y=await this.decodePixelBlock(o,{format:g?"bsq":void 0,width:d[0],height:d[1],planes:u?.length,offsets:u,pixelType:g?this.rasterInfo.pixelType:void 0,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==y)return null;let w=a.blockBoundary[e];if("jpg"!==a.compression||i>w.minCol&&i<w.maxCol&&t>w.minRow&&t<w.maxRow)return y;let{origin:v,blockWidth:x,blockHeight:b}=a,{x:I,y:C}=this.getPyramidPixelSize(e),S=Math.round((s.xmin-v.x)/I)%x,A=Math.round((s.xmax-v.x)/I)%x||x,_=Math.round((v.y-s.ymax)/C)%b,T=Math.round((v.y-s.ymin)/C)%b||b,R=i===w.minCol?S:0,M=t===w.minRow?_:0,O=i===w.maxCol?A:x,F=t===w.maxRow?T:b;return(0,X.z$)(y,{x:R,y:M},{width:O-R,height:F-M}),y}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}async _open(e){let t=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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=z.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],_e.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],_e.prototype,"tileType",void 0),_e=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],_e);const Te=_e;var Re=i(10713);const Me=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Oe=new Map;Oe.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Oe.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Oe.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Oe.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Oe.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Oe.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let _=0,T=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(T=g*a,g<c)for(_=h;_<a;_++)e[T+_]=0;else for(_=0;_<a;_++)e[T+_]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(T=g*a,_=0;_<h;_++)e[T+_]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(Re.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Oe.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Me.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Oe.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=z.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new z.A({wkid:e}))}else s=fe(a)??z.A.WGS84;else x=!0,s=new z.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new z.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),_=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),T=this._getAuxFullPath((0,le.mX)(t,"DataFile")),R=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:R||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Oe.get(n).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const ke=Fe;i(44208);var Pe=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,Pe.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,Pe.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const ze="none-tiled tiff is not optimized for access, convert to COG and retry.";let Ee=class extends N.A{constructor(){super(...arguments),this._bufferSize=1048576,this._chunkSize=10485760,this._fileSize=-1,this._headerChunks=[],this.datasetFormat="TIFF",this.headerInfo=null}async fetchRawTile(e,t,i,r={}){if(!this.headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this.headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf(".")),await this._readHeader(e?.signal),await this._fetchAllAuxData(),this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(this.rasterInfo),this.updateTileInfo()}async _readHeader(e){try{let t=await this._fetchHeaderData(0,this._bufferSize,e);if(!t)throw new l.A("tiffraster:open","failed to open url "+this.url);let{littleEndian:i,firstIFDPos:r,isBigTiff:a}=(0,Le.uT)(t),s=[],n={fileChunk:t,posIFD:r,fileOffset:0};await this._readIFDs(s,n,i,a?8:4,e);let{imageInfo:o,rasterInfo:u}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new z.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(s),f=(0,Le.zS)(s),h=(0,Le.r9)(s);this.headerInfo={littleEndian:i,isBigTiff:a,ifds:s,pyramidIFDs:f,maskIFDs:h,...o},this._set("rasterInfo",u),this._validateHeader()}finally{this._headerChunks.length=0}}_validateHeader(){let e=this.headerInfo;if(!e.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+e.message);if(!e.tileWidth||!e.tileHeight)throw new l.A("tiffraster:open",ze);this.rasterInfo.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let t=e.ifds[0],i=t.get("PREDICTOR")?.values?.[0];if(3===t.get("SAMPLEFORMAT")?.values?.[0]&&2===i)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data")}async _fetchHeaderData(e,t,i){let r=this._getCachedHeaderData(e,t);if(r)return r;let a=Math.floor(e/this._bufferSize)*this._bufferSize,s=a+Math.max(1,Math.ceil((t-a)/this._bufferSize))*this._bufferSize,n=this._getMissingHeaderRanges(a,s).map(async e=>{let{from:t,to:r}=e,a=await this._fetchOffsets(t,r,i),s=this._fileSize;return{chunk:a,fileOffset:t,isEOF:s>0?t+a.byteLength>=s:a.byteLength<r-t+1}}),o=await Promise.all(n);this._headerChunks.push(...o),this._headerChunks.sort((e,t)=>e.fileOffset-t.fileOffset);let u=this._getCachedHeaderData(e,t);if(!u)throw new l.A("tiffraster:open",`failed to fetch byte range ${e}-${t} from ${this.url}`);return u}_getCachedHeaderData(e,t){let i=[],r=e;for(let{chunk:a,fileOffset:s,isEOF:n}of this._headerChunks){if(s+a.byteLength-1<r)continue;if(s>r)return null;let l=r-s,o=Math.min(t-s+1,a.byteLength);if(i.push({chunk:a,start:l,end:o}),r=s+o,r>t||n&&o===a.byteLength){let t=new Uint8Array(r-e),a=0;for(let e of i){let i=new Uint8Array(e.chunk,e.start,e.end-e.start);t.set(i,a),a+=i.byteLength}return t.buffer}}return null}_getMissingHeaderRanges(e,t){let i=[],r=(e,t)=>{let r=Math.floor(e/this._bufferSize)*this._bufferSize,a=Math.ceil(t/this._bufferSize)*this._bufferSize;i.push({from:r,to:a})},a=e;for(let{chunk:e,fileOffset:s,isEOF:n}of this._headerChunks){let l=s+e.byteLength-1;if(!(l<a)&&(s>a&&r(a,Math.min(s-1,t)),a=Math.max(a,l+1),a>t||n))return i}return a<=t&&r(a,t),i}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;if(a+8>=i.byteLength||a<0){if(r=a+r,r<0)throw new l.A("tiffraster:open",`invalid IFD position ${r}. failed to open url ${this.url}`);i=await this._fetchHeaderData(r,r+this._bufferSize/2,t),a=0}return{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",ze);let r=[];e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),(0,Le.fM)(e),(0,Le.h_)(e);for(let[i,r]of Be.RR){let l=e.get(i),u=null!=l?.data&&Array.from(l.data.values()).some(e=>null==e.values&&null!=e.offlineOffsetSize);if(l&&(!l.data||u)){n=l.valueOffset-o;let e=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);l.data=(await this._readIFD(e,t,r,4,a))?.ifd}}return u}return u.requiredBufferSize?(s=await this._fetchHeaderData(o,o+n+u.requiredBufferSize+8,a),s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=Math.max(l,n+this._bufferSize/4),i=await this._fetchHeaderData(n,e,r);return void a.forEach(e=>(0,Le.Cr)(i,t,e,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchHeaderData(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize;this._fileSize>0&&(t=Math.min(t,this._fileSize-1));let s=Math.ceil((t-e+1)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);if(-1===this._fileSize&&206===l[0].httpStatus){let e=l[0].getHeader?.("Content-Range"),t=Number(e?.split("/")[1]);Number.isFinite(t)&&(this._fileSize=t)}if(1===l.length)return l[0].data;let o=l.reduce((e,t)=>e+t.data.byteLength,0),u=new Uint8Array(o),f=0;for(let e of l)u.set(new Uint8Array(e.data),f),f+=e.data.byteLength;return u.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this.headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAllAuxData(e){if(this.ioConfig.skipMapInfo)return;let{rasterInfo:t}=this,{skipExtensions:i=[]}=this.ioConfig,r=i.includes("aux.xml")?Promise.resolve(null):this._fetchAuxiliaryMetaData(e),a=i.includes("vat.dbf")||1!==t.bandCount||"u8"!==t.pixelType?Promise.resolve(null):this._fetchAuxiliaryTable(e),[s,n]=await Promise.all([r,a]);null!=s&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,K.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new xe.A({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)}(s,t),null!=n&&(t.attributeTable=n,t.keyProperties.DataType="thematic")}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_fileSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_headerChunks",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"headerInfo",void 0),Ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Ee);const Je=Ee,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:ke}),He.set("TIFF",{desc:"GeoTIFF",constructor:Je}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Te}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class $e{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var Ue=i(99235),Ze=i(10873),je=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,We.refCount>0||(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,O.j)((0,A.q)((0,_.A)((0,R.H)((0,S.d)((0,k.b)((0,T.G)((0,F.e)((0,I.b)((0,M.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),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.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,P.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let 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"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,P.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,Ue.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>$e.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await $e.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await $e.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,Ue.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({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}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[je.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[je.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=class extends n.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),_=a.A.fromJSON(y.extent),T=Math.ceil(_.width/y.pixelSizeX-.1),R=Math.ceil(_.height/y.pixelSizeY-.1),M=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),O="fulfilled"===A[0].status?A[0].value?.data:null,F=O?.features?.length?f.A.fromJSON(O):null,k="fulfilled"===A[1].status?A[1].value?.data.colormap:null,P=k?.length?k:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,z=B?.variables?.length?B:null;var E;(E=z)&&E.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let J=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:$}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),$?.includes("esriImageServiceDataTypeVector")&&!$.includes(L.DataType)&&(L.DataType=$.replace("esriImageServiceDataType",""));let U=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==U)&&(U=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:M}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(T,R))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:T,height:R,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:M,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:M}),pixelType:y.pixelType.toLowerCase(),statistics:J,attributeTable:F,colormap:P,histograms:N,keyProperties:L,noDataValue:U,multidimensionalInfo:z,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(6361),i.e(6475),i.e(3713)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[1137],{56512(e,t,i){function r(e){let t,i,r=[],a=!1;return function(...s){return a&&t===this&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}(s,r)||(i=e.apply(this,s),t=this,r=s,a=!0),i}}i.d(t,{B:()=>r})},69397(e,t,i){i.d(t,{Qf:()=>o,Qh:()=>n,lM:()=>s,ro:()=>u,rq:()=>f});var r=i(44208),a=i(34275);function s(e){if(!e)return 0;let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i],!1));return t}function n(e){if(!e)return 0;if("number"==typeof e[0])return o(e);if(Array.isArray(e))return function(e){let t=e.length;if(0===t||"number"==typeof e[0])return f(e,8);let i=c;for(let r=0;r<t;r++)i+=l(e[r]);return i}(e);let t=h;for(let i in e)e.hasOwnProperty(i)&&(t+=l(e[i]));return t}function l(e,t=!0){switch(typeof e){case"object":return t?n(e):h;case"string":return function(e){return 32+e.length}(e);case"number":return 16;case"boolean":return 4;default:return 8}}function o(...e){return e.reduce((e,t)=>e+u(t),0)}function u(e,t=16){return e?(0,a.iu)(e)?e.byteLength+d:Array.isArray(e)?f(e,t):0:0}function f(e,t){return c+e.length*t}const h=32,c=16,p=(0,r.A)("ios")||!(0,r.A)("chrome")&&!(0,r.A)("opr")?8:4,d=145;i.d(t,["JY",0,p])},5359(e,t,i){i.d(t,{Z:()=>a});const r=Symbol("isImageryTileGraphicOrigin");function a(e){return!!e&&r in e}i.d(t,["H",0,r])},11137(e,t,i){i.r(t),i.d(t,{default:()=>rt});var r,a=i(32198),s=i(40124),n=i(69540),l=i(49186),o=i(53966),u=i(97768),f=i(25728),h=i(17676),c=i(36708),p=i(91429),d=i(78888),m=i(41910),g=i(60950),y=i(89808),w=i(99959),v=i(5359);class x extends w.A{get[(r=v.H,g.ym)](){return this.layer}get[y.Q](){return this.layer}get[m.e7](){return this.layer}constructor(e){super(),this[r]=!0,this.type="imagery-tile",this.layer=e}get id(){return this.layer.id}}var b=i(4146),I=i(18768),C=i(63074),S=i(69208),A=i(34287),_=i(8303),T=i(72545),R=i(56551),M=i(54310),O=i(25036),F=i(82935),k=i(82806),P=i(7548),D=i(23636),N=i(49859),L=i(68197),B=i(5443),z=i(16930),E=i(73444),J=i(94778),H=i(14140);function $(e){return["x","e","east","long","longitude"].includes(e.toLowerCase())}function U(e){return["y","n","west","lat","latitude"].includes(e.toLowerCase())}function Z(e){let t=(0,E.lR)();return t?e[t]??Object.values(e)[0]:Object.values(e)[0]}function j(){return Math.round(255*Math.random())}function q(e){let t={},{parameters:i}=e;if(!i)return t;for(let[e,r]of Object.entries(i)){let{type:i,description:a,unit:s,categoryEncoding:n,observedProperty:l}=r;if("Parameter"===i&&(t[e]={},a&&(t[e].description=Z(a)),s&&(t[e].unit=s.label?Z(s.label):null,t[e].symbol=s.symbol?.value),n)){let i=Object.entries(n).map((e,t)=>({OID:t,Value:Number(e[1]),ClassName:e[0].slice(e[0].lastIndexOf("/")+1),Count:1})),r=!1;l?.categories?.length&&(l.categories.forEach(e=>{if(!e.id)return;let t=e.id.slice(e.id.lastIndexOf("/")+1),a=i.find(e=>e.ClassName===t);if(a&&(a.Label=e.label?Z(e.label):null,e.preferredColor)){let t=L.A.fromHex(e.preferredColor);t&&(r=!0,a.Red=t.r,a.Green=t.g,a.Blue=t.b)}}),r&&i.forEach(e=>{e.Red??(e.Red=j(),e.Green=j(),e.Blue=j())}));let a={objectIdFieldName:"",fields:[{name:"OID",type:"esriFieldTypeOID",alias:"OID",domain:null},{name:"Value",type:"esriFieldTypeInteger",alias:"Value",domain:null},{name:"Count",type:"esriFieldTypeDouble",alias:"Count",domain:null},{name:"ClassName",type:"esriFieldTypeString",alias:"ClassName",domain:null,length:50},{name:"Label",type:"esriFieldTypeString",alias:"Label",domain:null,length:50}],features:i.map(e=>({attributes:e}))};r&&a.fields.push({name:"Red",type:"esriFieldTypeInteger",alias:"Red",domain:null},{name:"Green",type:"esriFieldTypeInteger",alias:"Green",domain:null},{name:"Blue",type:"esriFieldTypeInteger",alias:"Blue",domain:null}),t[e].attributeTable=a}}return t}function V(e){let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let r=0;r<e.length;r++){let a=e[r];null!=a&&(a<t&&(t=a),a>i&&(i=a))}return(0,J.X1)(t,i)}function G(e,t,i){let r=e.map((e,i)=>({name:e,count:t[i]})).sort((e,t)=>e.name>t.name?-1:1),a=(e=>t=>e*=t.count)(1),s=[...r.slice(1),{name:"",count:1}].reverse().map(a).reverse(),n=0;for(let a=e.length-1;a>=0;a--){let l=r.findIndex(({name:t})=>t===e[a]);n+=s[l]*(i%t[a]),i=Math.floor(i/t[a])}return n}var W=i(4366),X=i(47520),K=i(51927),Y=i(45617),Q=i(87186);let ee=class extends N.A{constructor(){super(...arguments),this._pixelBlockTiles=new Map,this.datasetFormat="MEMORY",this.preGenerateTiles=!0,this.source=null}get url(){return""}async fetchRawTile(e,t,i,r={}){let a=`${e}/${t}/${i}`,s=this._pixelBlockTiles.get(a);if(s)return s;if(!this.source)return null;let{rasterInfo:n}=this,[l,o]=n.storageInfo.tileInfo.size,{sliceId:u}=r,{encodedData:f}=this.source;if(f){let s=await this.decodePixelBlock(f,{tileSize:[l,o],tileIndex:[e,t,i],canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},{signal:r.signal});return s&&this._pixelBlockTiles.set(a,s),s}let{pixelBlocks:h}=this.source,c=null==u?h[0]:h[u];if(null==c)return null;let p={pixelBlock:c,useBilinear:"thematic"!==n.dataType,tileSize:{width:l,height:o},level:e,row:t,col:i};return this.rasterJobHandler?this.rasterJobHandler.clipTile(p,r):(0,X.J$)(p)}async _open(e){if(!this.source)throw new l.A("in-memory-raster:open","source is required to open an in memory raster");let t=this.source;this.datasetName=t.name;let{pixelBlocks:i,attributeTable:r,statistics:a,histograms:s,nativeExtent:n,transform:o,colormap:u}=t,f=i[0],{width:h,height:c,pixelType:p}=f??t.imageInfo,d=t.extent??new B.A({xmin:-.5,ymin:.5,xmax:h-.5,ymax:c-.5,spatialReference:new z.A({wkid:3857})}),m=t.isPseudoSpatialReference??!t.extent,g={x:d.width/h,y:d.height/c},y={...t.keyProperties};t.dataType&&(y.DataType=t.dataType),t.bandInfos&&(y.BandProperties=t.bandInfos.map(e=>e.toJSON())),r&&(y.DataType="Thematic");let w=new Q.A({width:h,height:c,pixelType:p,extent:d,nativeExtent:n,attributeTable:r,colormap:u,transform:o,pixelSize:g,spatialReference:d.spatialReference,bandCount:f?.pixels.length??t.imageInfo.bandCount,keyProperties:y,multidimensionalInfo:t.multidimensionalInfo,statistics:a,isPseudoSpatialReference:m,histograms:s});this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(w),this.createRemoteDatasetStorageInfo(w,512,512),this._set("rasterInfo",w),this.updateTileInfo(),w.multidimensionalInfo?await this._buildMDimStats(i,w.multidimensionalInfo):this.preGenerateTiles&&f&&(await this._buildInMemoryRaster(f,{width:512,height:512},e),this.source=null)}async _buildInMemoryRaster(e,t,i){let{rasterInfo:r}=this,a=r.storageInfo.maximumPyramidLevel??0,s="thematic"!==r.dataType,n=this.rasterJobHandler?this.rasterJobHandler.split({pixelBlock:e,tileSize:t,maximumPyramidLevel:a,useBilinear:s},i):Promise.resolve((0,X.lD)(e,t,a,s)),o=null!=r.statistics,u=null!=r.histograms,f=this.ioConfig.skipStatistics||o?Promise.resolve({statistics:null,histograms:null}):this.rasterJobHandler?this.rasterJobHandler.estimateStatisticsHistograms({pixelBlock:e},i):Promise.resolve((0,K.f4)(e)),c=await(0,h.Lx)([n,f]);if(!c[0].value)throw new l.A("in-memory-raster:open","failed to build in memory raster");this._pixelBlockTiles=c[0].value,o||(r.statistics=c[1].value?.statistics),u||(r.histograms=c[1].value?.histograms)}async _buildMDimStats(e,t,i){for(let r=0;r<t.variables.length;r++){let a=t.variables[r];if(a.statistics)continue;let s=a.dimensions.map(e=>new Y.A({variableName:a.name,dimensionName:e.name,values:[e.values?.[0]??e.extent?.[0]],isSlice:!0})),n=(0,W.NG)(s,t),l=null==n?null:e[n];if(null==l)continue;let o=this.rasterJobHandler?await this.rasterJobHandler.computeStatisticsHistograms({pixelBlock:l},i):(0,K.eH)(l);a.statistics=o.statistics,a.histograms||=o.histograms}}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],ee.prototype,"preGenerateTiles",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"source",void 0),(0,a.Cg)([(0,p.MZ)()],ee.prototype,"url",null),ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.InMemoryRaster")],ee);const te=ee;var ie=i(22671);let re=class extends N.A{constructor(){super(...arguments),this.datasetFormat="CovJSON"}fetchRawTile(e,t,i,r={}){return this._inMemoryRaster.fetchRawTile(e,t,i,r)}async _open(e){let{extent:t,pixelBlocks:i,multidimensionalInfo:r,attributeTable:a,bandNames:s}=await this._fetchData(e),{statistics:n,histograms:l}=(0,K.eH)(i[0]),o=s?.map(e=>({BandName:e})),u={DataType:a?"Thematic":r?"Scientific":"Generic",BandProperties:o},f=new te({source:{extent:t,pixelBlocks:i,attributeTable:a?ie.A.fromJSON(a):null,multidimensionalInfo:r,statistics:n,histograms:l,keyProperties:u,isPseudoSpatialReference:!1}});await f.open(),this._inMemoryRaster=f;let h=this.source?"":this.url.slice(this.url.lastIndexOf("/")+1);this._set("datasetName",h.slice(0,h.indexOf("."))),this._set("rasterInfo",f.rasterInfo)}async _fetchData(e){let t=this.source??(await this.request(this.url,{signal:e?.signal})).data,i="imagery-tile-layer:open-coverage-json";if("coverage"!==t.type?.toLowerCase()||"grid"!==t.domain?.domainType?.toLowerCase())throw new l.A(i,"Only coverage with Grid domain type is supported");if(!t.ranges)throw new l.A(i,"Missing ranges in the grid coverage data");if(!t.domain.referencing?.length)throw new l.A(i,"Missing domain referencing in the grid coverage data");let r=Object.values(t.ranges);for(let e=0;e<r.length;e++){let{axisNames:t,shape:a,type:s,values:n}=r[e];if(!("ndarray"===s.toLowerCase()&&n?.length&&t?.length&&a?.length))throw new l.A(i,"Only ranges with valid NdArray, axisNames, shape, and inline values are supported");if(!$(t[t.length-1])||!U(t[t.length-2]))throw new l.A(i,"Only row-major ordered pixel values are supported. X axis must be the last axis.")}return function(e){let{width:t,height:i,extent:r,dimensions:a}=function(e){let{axes:t}=e.domain,i=Object.keys(t),r=[],a=[],s=-1,n=-1,l=[];for(let e=0;e<i.length;e++){let o=i[e];$(o)?s=e:U(o)&&(n=e);let u=t[o],f=[];if("values"in u){u.values.forEach(e=>f.push("string"==typeof e?new Date(e).getTime():e));let e=f[1]-f[0];r.push([f[0]-.5*e,f[f.length-1]+.5*e]),a.push(e)}else{let{start:e,stop:t,num:i}=u,s=(t-e)/(i-1);r.push([e-.5*s,t+.5*s]),a.push(s);for(let t=0;t<i;t++)f.push(e+s*t)}l.push({name:o,values:f,extent:[f[0],f[f.length-1]]})}s>-1&&-1===n?n=+(0===s):n>-1&&-1===s?s=+(0===n):-1===n&&-1===s&&(s=0,n=1),l=l.filter((e,t)=>t!==s&&t!==n);let{referencing:o}=e.domain,u=o.find(e=>e.coordinates.includes(i[s])).system.id,f=u?.slice(u.lastIndexOf("/")+1),h=null==f||"CRS84"===f?4326:Number(f),c=new z.A({wkid:h}),[p,d]=r[s],[m,g]=r[n],y=new B.A({xmin:p,xmax:d,ymin:m,ymax:g,spatialReference:c});return{width:Math.round(y.width/a[s]),height:Math.round(y.height/a[n]),extent:y,dimensions:l}}(e),{ranges:s}=e,n=Object.keys(s).sort((e,t)=>e<t?-1:1),l=[];for(let e=0;e<n.length;e++){let t=n[e];a?.length&&l.push({name:t,dimensions:a})}let o=q(e);l.forEach(e=>o[e.name]&&Object.assign(e,o[e.name]));let u=l.length?{variables:l}:void 0,f=[];for(let e=0;e<n.length;e++){let{values:r,dataType:l,axisNames:o,shape:u}=s[n[e]],h=u.length>2?e*u.slice(0,-2).reduce((e,t)=>e*t):0,c=o.slice(0,-2),p=u.slice(0,-2),d="float"===l?"f32":V(r),m=t*i,g=r.length/m;for(let s=0;s<g;s++){let n=H.A.createEmptyBand(d,m),l=new Uint8Array(m).fill(255),o=!1,u=s*m;for(let e=0;e<m;e++){let t=r[u+e];null==t?(l[e]=0,o=!0):n[e]=t}if(0===e||a?.length){let e=new H.A({width:t,height:i,mask:o?l:null,pixels:[n],pixelType:d});e.updateStatistics(),a?.length?f[G(c,p,s)+h]=e:f.push(e)}else{let e=f[s];e.pixels.push(n),o?e.mask&&=H.A.combineBandMasks([e.mask,l]):e.mask=o?l:null}}}return{extent:r,pixelBlocks:f,multidimensionalInfo:u,attributeTable:Object.values(o).find(e=>e.attributeTable)?.attributeTable,bandNames:u?void 0:n}}(t)}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],re.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],re.prototype,"source",void 0),re=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.CovJSONRaster")],re);const ae=re;var se=i(4576),ne=i(21325),le=i(330),oe=i(43163);function ue(e,t){if(!e||!t)return null;let i=[];for(let r=0;r<e.length;r++)i.push(e[r]),i.push(t[r]);return i}function fe(e){if(!e)return null;let t=Number(e);if(!isNaN(t)&&0!==t)return new z.A({wkid:t});if(e=String(e).trim(),(0,ne.jp)(e))return new z.A({wkt2:e});let i=e.toUpperCase();if(i.startsWith("COMPD_CS")){if(!i.includes("VERTCS")||!i.includes("GEOGCS")&&!i.startsWith("PROJCS"))return null;let r=i.indexOf("VERTCS"),a=i.indexOf("PROJCS"),s=a>-1?a:i.indexOf("GEOGCS");if(-1===s)return null;let n=e.slice(s,e.lastIndexOf("]",r)+1).trim(),l=e.slice(r,e.lastIndexOf("]")).trim();t=he(n);let o=t?new z.A({wkid:t}):new z.A({wkt:n}),u=he(l);return u&&(o.vcsWkid=u),o}return i.startsWith("GEOGCS")||i.startsWith("PROJCS")?(t=he(e),0===t?new z.A({wkt:e}):new z.A({wkid:t})):null}function he(e){let t=e.replaceAll("]","[").replaceAll('"',"").split("[").map(e=>e.trim()).filter(e=>""!==e),i=t[t.length-1].split(","),r=i[0]?.toLowerCase();if(("epsg"===r||"esri"===r)&&e.endsWith('"]]')){let e=Number(i[1]);if(!isNaN(e)&&0!==e)return e}return 0}function ce(e){if("pamdataset"!==e?.documentElement.tagName?.toLowerCase())return{};let t={spatialReference:null,transform:null,metadata:{},rasterBands:[],statistics:null,histograms:null};e.documentElement.childNodes.forEach(e=>{if(1===e.nodeType)if((0,le.g7)(e,"SRS")){if(!t.spatialReference){let i=(0,le.mX)(e);t.spatialReference=fe(i)}}else if((0,le.g7)(e,"Metadata"))if("xml:ESRI"===e.getAttribute("domain")){let{spatialReference:i,transform:r}=function(e){let t=(0,le.V6)(e,"GeodataXform"),i=fe((0,le.v7)(t,"SpatialReference/WKID")||(0,le.mX)(t,"SpatialReference/WKT"));if("typens:PolynomialXform"!==t.getAttribute("xsi:type"))return{spatialReference:i,transform:null};let r=(0,le.v7)(t,"PolynomialOrder")??1,a=(0,le.Ui)(t,"CoeffX/Double"),s=(0,le.Ui)(t,"CoeffY/Double"),n=(0,le.Ui)(t,"InverseCoeffX/Double"),l=(0,le.Ui)(t,"InverseCoeffY/Double"),o=ue(a,s),u=ue(n,l);return{spatialReference:i,transform:o&&u&&o.length&&u.length?new oe.A({spatialReference:i,polynomialOrder:r,forwardCoefficients:o,inverseCoefficients:u}):null}}(e);t.transform=r,t.spatialReference||=i}else(0,le.IC)(e,"MDI").forEach(e=>t.metadata[e.getAttribute("key")]=(0,le.mX)(e));else if((0,le.g7)(e,"PAMRasterBand")){let i=function(e){let t,i,r,a,s=(0,le.v7)(e,"NoDataValue"),n=(0,le.V6)(e,"Histograms/HistItem"),l=(0,le.v7)(n,"HistMin"),o=(0,le.v7)(n,"HistMax"),u=(0,le.v7)(n,"BucketCount"),f=(0,le.mX)(n,"HistCounts")?.split("|").map(e=>Number(e));(0,le.IC)(e,"Metadata/MDI").forEach(e=>{let s=Number(e.textContent??e.nodeValue);switch(e.getAttribute("key").toUpperCase()){case"STATISTICS_MINIMUM":t=s;break;case"STATISTICS_MAXIMUM":i=s;break;case"STATISTICS_MEAN":r=s;break;case"STATISTICS_STDDEV":a=s}});let h=(0,le.v7)(e,"Metadata/SourceBandIndex");return{noDataValue:s,histogram:f?.length&&null!=l&&null!=o?{min:l,max:o,size:u||f.length,counts:f}:null,sourceBandIndex:h,statistics:null!=t&&null!=i?{min:t,max:i,avg:r,stddev:a}:null}}(e);null!=i.sourceBandIndex&&null==t.rasterBands[i.sourceBandIndex]?t.rasterBands[i.sourceBandIndex]=i:t.rasterBands.push(i)}});let i=t.rasterBands;return i.length&&(t.statistics=i[0].statistics?i.map(e=>e.statistics).filter(se.Ru):null,t.histograms=i[0].histogram?i.map(e=>e.histogram).filter(se.Ru):null),t}var pe=i(85951),de=i(40951);const me="image-aux-raster:open",ge="The data is not a supported format.";let ye=class extends N.A{set rasterJobHandler(e){this._set("rasterJobHandler",e),this._inMemoryRaster&&(this._inMemoryRaster.rasterJobHandler=e)}async fetchRawTile(e,t,i,r={}){return this._inMemoryRaster?.fetchRawTile(e,t,i,r)}async _open(e){let t,{data:i,format:r}=await this._fetchData(e),{tileGeneration:a}=this.ioConfig,s="immediate"===a||"jpg"!==r;if(s){let a=await this._decodeFullImage(i,r,e);if(!a)throw new l.A(me,"The data cannot be decoded.");t=await this._createRasterSource(a,e)}else{let r=(0,pe.R)(i);if(!r)throw new l.A(me,ge);t=await this._createRasterSource(r,e),t.encodedData=i}let{rasterJobHandler:n,ioConfig:o}=this,u=new te({preGenerateTiles:s,rasterJobHandler:n,source:t,ioConfig:{...o,sampling:"closest",skipStatistics:!0}});await u.open(e),this._set("rasterInfo",u.rasterInfo),this._inMemoryRaster=u}async _createRasterSource(e,t){let{spatialReference:i,statistics:r,histograms:a,transform:s}=await this._fetchAuxiliaryData(t),n=!i;n&&(i=new z.A({wkid:3857})),a?.length&&null==r&&(r=(0,K.Pg)(a));let{width:l,height:o}=e,u=new B.A({xmin:-.5,ymin:.5-o,xmax:l-.5,ymax:.5,spatialReference:i}),f=s?s.forwardTransform(u):u,h=!0;if(s){let e=s.forwardCoefficients;h=e&&0===e[1]&&0===e[2],h&&(s=null,u=f)}let c=[];return"pixels"in e&&c.push(e),{name:this.datasetName,pixelBlocks:c,imageInfo:{width:l,height:o,pixelType:"u8",bandCount:3},extent:f,nativeExtent:u,transform:s,statistics:r,histograms:a,isPseudoSpatialReference:n,keyProperties:{DataType:"Processed"}}}async _fetchData(e){let{data:t}=await this.request(this.url,{responseType:"array-buffer",signal:e?.signal}),i=(0,de.g)(t);if("jpg"!==i&&"png"!==i&&"gif"!==i&&"bmp"!==i)throw new l.A(me,ge);return this._set("datasetFormat",i.toUpperCase()),{data:t,format:i}}async _decodeFullImage(e,t,i){try{return await this.decodePixelBlock(e,{format:t,canvasUsage:"canvas-only",cloneSource:!0,skipStatistics:!0},i)}catch{return(0,h.Te)(i?.signal),this.decodePixelBlock(e,{format:t,canvasUsage:"no-canvas",skipStatistics:!0},i)}}async _fetchAuxiliaryData(e){let t=e?.signal,{skipExtensions:i=[],skipMapInfo:r}=this.ioConfig,a=r||i.includes("aux.xml")?null:this.request(this.url+".aux.xml",{responseType:"xml",signal:t}),s=this.datasetFormat,n="JPG"===s?"jgw":"PNG"===s?"pgw":"BMP"===s?"bpw":null,l=r||null==n||i.includes(n)?null:this.request(this.url.slice(0,this.url.lastIndexOf("."))+"."+n,{responseType:"text",signal:t}),o=await(0,h.Lx)([a,l]);if(t?.aborted)throw(0,h.NK)();let u=ce(o[0].value?.data);if(!u.transform){let e=o[1].value?o[1].value.data.split("\n").slice(0,6).map(e=>Number(e)):null;u.transform=6===e?.length?new oe.A({forwardCoefficients:[e[4],e[5],e[0],-e[1],e[2],-e[3]]}):null}return u}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],ye.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],ye.prototype,"rasterJobHandler",null),ye=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageAuxRaster")],ye);const we=ye;var ve=i(84952),xe=i(86738),be=i(75414),Ie=i(20223),Ce=i(87045),Se=i(25943),Ae=i(82371);let _e=class extends N.A{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer",this.tileType=null}async fetchRawTile(e,t,i,r={}){let{storageInfo:a,extent:s}=this.rasterInfo,{transposeInfo:n}=a,l=null!=n&&!!r.transposedVariableName;if(this._slices&&!l&&null==r.sliceId)return null;let o,u,f=l?0:a.maximumPyramidLevel-e+this._levelOffset,h=`${this.url}/tile/${f}/${t}/${i}`,c={...this._slices?l?{variable:r.transposedVariableName}:{sliceId:r.sliceId||0}:null,...r.refreshParameters};if(a.isBsqTile){let e=(r.bandIds?.length?r.bandIds:[0,1,2]).map(e=>this.request(h,{query:{...c,bandId:e},responseType:"array-buffer",signal:r.signal})),t=await Promise.all(e),i=t.map(e=>e.data.byteLength).reduce((e,t)=>e+t),a=new Uint8Array(i);u=[];let s=0;for(let{data:e}of t)u.push(s),a.set(new Uint8Array(e),s),s+=e.byteLength;o=a.buffer}else o=(await this.request(h,{query:c,responseType:"array-buffer",signal:r.signal})).data;if(!o)return null;let{tileInfo:p}=a,d=l?n.tileSize:p.size,m=/^(mixed|jp)/i.test(p.format),g="raw"===p.format,y=await this.decodePixelBlock(o,{format:g?"bsq":void 0,width:d[0],height:d[1],planes:u?.length,offsets:u,pixelType:g?this.rasterInfo.pixelType:void 0,isPoint:"Elevation"===this.tileType,returnInterleaved:l,noDataValue:this.rasterInfo.noDataValue,applyJpegMask:m},{signal:r.signal});if(null==y)return null;let w=a.blockBoundary[e];if("jpg"!==a.compression||i>w.minCol&&i<w.maxCol&&t>w.minRow&&t<w.maxRow)return y;let{origin:v,blockWidth:x,blockHeight:b}=a,{x:I,y:C}=this.getPyramidPixelSize(e),S=Math.round((s.xmin-v.x)/I)%x,A=Math.round((s.xmax-v.x)/I)%x||x,_=Math.round((v.y-s.ymax)/C)%b,T=Math.round((v.y-s.ymin)/C)%b||b,R=i===w.minCol?S:0,M=t===w.minRow?_:0,O=i===w.maxCol?A:x,F=t===w.maxRow?T:b;return(0,X.z$)(y,{x:R,y:M},{width:O-R,height:F-M}),y}getSliceIndex(e){if(!this._slices||null==e||0===e.length)return null;let t=e;for(let e=0;e<this._slices.length;e++){let i=this._slices[e].multidimensionalDefinition;if(i.length===t.length&&!i.some(e=>{let 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){let i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.statistics),r=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then(e=>e.data?.histograms),a=await Promise.all([i,r]);return a[0]&&a[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),a[1]?.[0]?.counts?.length||(a[1]=null),{statistics:a[0]||null,histograms:a[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 r=0,{maximumPyramidLevel:a}=this.rasterInfo.storageInfo,s=a-r+this._levelOffset,n=i.srcLocation;for(;s>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(s,i.row,i.col,t))break}catch{}if(s--,r++,i=this.identifyPixelLocation(n,r,t.datumTransformation),null===i)return null}return-1===s||null==i?null:r}async _open(e){let t=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:"));let r=i.data;if(this.sourceJSON=r,!r)throw new l.A("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new l.A("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();this.tileType=r.cacheType,this.tileType??=["jpg","jpeg","png","png8","png24","png32","mixed"].includes(r.tileInfo.format.toLowerCase())?"Map":"lerc"===r.tileInfo.format.toLowerCase()?"Elevation":"Raster",this.datasetName=r.name?.slice(r.name.indexOf("/")+1)??"";let a=this.rasterInfo??await this._fetchRasterInfo({signal:t});if(null==a)throw new l.A("image-server-raster:open","cannot initialize image service");(0,Ae.E9)(a,r);let s="Map"===this.tileType?function(e,t){if(!e)return null;let{minScale:i,maxScale:r,minLOD:a,maxLOD:s}=t;if(null!=a&&null!=s)return Ce.A.fromJSON({...e,lods:e.lods.filter(({level:e})=>null!=e&&e>=a&&e<=s)});if(0!==i&&0!==r){let t=e=>Math.round(1e4*e)/1e4,a=i?t(i):1/0,s=r?t(r):-1/0;return Ce.A.fromJSON({...e,lods:e.lods.filter(e=>{let i=t(e.scale);return i<=a&&i>=s})})}return Ce.A.fromJSON(e)}(r.tileInfo,r):Ce.A.fromJSON(r.tileInfo);(0,u.Lw)(s);let[n,o]=this._computeMinMaxLOD(a,s),{extent:f,pixelSize:h}=a,c=.001*Math.min(h.x,h.y);(h.x!==h.y||Math.abs(n.resolution-h.x)>c)&&(h.x=h.y=n.resolution,a.width=Math.ceil((f.xmax-f.xmin)/h.x-.1),a.height=Math.ceil((f.ymax-f.ymin)/h.y-.1));let p=n.level-o.level,[d,m]=s.size,g=[],y=[],{lods:w}=s;w.forEach((e,t)=>{e.level>=o.level&&e.level<=n.level&&g.push({x:e.resolution,y:e.resolution}),t<w.length-1&&y.push(Math.round(10*e.resolution/w[t+1].resolution)/10)}),g.sort((e,t)=>e.x-t.x);let v,x=this.computeBlockBoundary(f,d,m,s.origin,g,p),b=g.length>1?g.slice(1):null;r.transposeInfo&&(v={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:a.keyProperties?._yxs.PacketSize??0});let I=y.length<=1||y.length>=3&&y.slice(0,-1).every(e=>e===y[0])?y[0]??2:Math.round(10/(o.resolution/n.resolution)**(-1/p))/10,C=!!r.bsq&&"Raster"===this.tileType;if(a.storageInfo=new Ie.A({blockWidth:s.size[0],blockHeight:s.size[1],pyramidBlockWidth:s.size[0],pyramidBlockHeight:s.size[1],pyramidResolutions:b,pyramidScalingFactor:I,compression:s.format,origin:s.origin,firstPyramidLevel:1,maximumPyramidLevel:p,tileInfo:s,isBsqTile:C,transposeInfo:v,blockBoundary:x}),function(e){let{extent:t,spatialReference:i}=e;t.xmin>-1&&t.xmax>181&&i?.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new be.A,e.extent=e.transform.forwardTransform(t))}(a),this._set("rasterInfo",a),r.capabilities.toLowerCase().includes("tilemap")){let e={tileInfo:a.storageInfo.tileInfo,parsedUrl:(0,ve.An)(this.url),url:this.url,tileServers:[]};this._tilemapCache=new Se.d({layer:e})}}async _fetchRasterInfo(e){let t=this.sourceJSON;if("Map"===this.tileType){let e=t.fullExtent||t.extent,i=Math.ceil((e.xmax-e.xmin)/t.pixelSizeX-.1),r=Math.ceil((e.ymax-e.ymin)/t.pixelSizeY-.1),a=z.A.fromJSON(t.spatialReference||e.spatialReference),s=new xe.A({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a});return new Q.A({width:i,height:r,bandCount:3,extent:B.A.fromJSON(e),spatialReference:a,pixelSize:s,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}let i={...e,query:{...this.ioConfig.customFetchParameters,f:"json"}},r=(0,Ae.Tw)(this.url,this.sourceJSON,i),a=t.hasMultidimensions?this.request(`${this.url}/slices`,i).then(e=>e.data?.slices).catch(()=>null):null,s=await Promise.all([r,a]);return this._slices=s[1],s[0]}_fixScaleInServiceInfo(){let{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_computeMinMaxLOD(e,t){let{pixelSize:i}=e,r=.5/e.width*i.x,{lods:a}=t,s=t.lodAt(Math.max.apply(null,a.map(e=>e.level))),n=t.lodAt(Math.min.apply(null,a.map(e=>e.level))),{tileType:l}=this;if("Map"===l)return this._levelOffset=a[0].level,[s,n];if("Raster"===l)return[a.find(e=>e.resolution===i.x)??s,n];let{minScale:o,maxScale:u}=this.sourceJSON,f=s;u>0&&(f=a.find(e=>Math.abs(e.scale-u)<r),f||=a.filter(e=>e.scale>u).sort((e,t)=>e.scale>t.scale?1:-1)[0]??s);let h=n;return o>0&&(h=a.find(e=>Math.abs(e.scale-o)<r)??n,this._levelOffset=h.level-n.level),[f,h]}};(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],_e.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],_e.prototype,"tileType",void 0),_e=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.ImageServerRaster")],_e);const Te=_e;var Re=i(10713);const Me=new Map([["byte","u8"],["signedbyte","s8"],["int8","s8"],["uint8","u8"],["int16","s16"],["uint16","u16"],["int32","s32"],["uint32","u32"],["float32","f32"],["float64","f64"],["double64","f64"]]),Oe=new Map;Oe.set("none",{blobExtension:".til",isOneSegment:!0,decoderFormat:"bip"}),Oe.set("lerc",{blobExtension:".lrc",isOneSegment:!1,decoderFormat:"lerc"}),Oe.set("deflate",{blobExtension:".pzp",isOneSegment:!0,decoderFormat:"deflate"}),Oe.set("jpeg",{blobExtension:".pjg",isOneSegment:!0,decoderFormat:"jpg"}),Oe.set("qb3",{blobExtension:".pq3",isOneSegment:!0,decoderFormat:"qb3"});let Fe=class extends N.A{constructor(){super(...arguments),this._files=null,this._storageIndex=null,this._isBsq=!1,this.datasetFormat="MRF"}async fetchRawTile(e,t,i,r={}){let{blockWidth:a,blockHeight:s,blockBoundary:n}=this.rasterInfo.storageInfo,l=n[e];if(!l||l.maxRow<t||l.maxCol<i||l.minRow>t||l.minCol>i)return null;let{bandCount:o,pixelType:u}=this.rasterInfo,{ranges:f,actualTileWidth:h,actualTileHeight:c}=this._getTileLocation(e,t,i);if(!f||0===f.length)return null;if(f.some(e=>e.from>e.to)){let e=new Uint8Array(a*s);return new H.A({width:a,height:s,pixels:void 0,mask:e,validPixelCount:0})}let{bandIds:p}=this.ioConfig,d=this._getBandSegmentCount(),m=[],g=0;for(g=0;g<d;g++)(!p||p.includes(g))&&m.push(this.request(this._files.data,{range:{from:f[g].from,to:f[g].to},responseType:"array-buffer",signal:r.signal}));let y=await Promise.all(m),w=y.map(e=>e.data.byteLength).reduce((e,t)=>e+t),v=new Uint8Array(w),x=[],b=0;for(g=0;g<d;g++)x.push(b),v.set(new Uint8Array(y[g].data),b),b+=y[g].data.byteLength;let I=Oe.get(this.rasterInfo.storageInfo.compression).decoderFormat,C="jpg"===I&&4===o&&1===x.length,S=await this.decodePixelBlock(v.buffer,{width:a,height:s,format:I,planes:p?.length||o,offsets:x,pixelType:u,canvasUsage:C?"no-canvas":void 0,decodeJpegAsRgb:!1},{signal:r.signal});if(null==S)return null;let{noDataValue:A}=this.rasterInfo;if(null!=A&&"lerc"!==I&&!S.mask&&(A=A[0],null!=A)){let e=S.width*S.height,t=new Uint8Array(e);if(Math.abs(A)>1e24)for(g=0;g<e;g++)Math.abs((S.pixels[0][g]-A)/A)>1e-6&&(t[g]=1);else for(g=0;g<e;g++)S.pixels[0][g]!==A&&(t[g]=1);S.mask=t}let _=0,T=0;if(h!==a||c!==s){let e=S.mask;if(e)for(g=0;g<s;g++)if(T=g*a,g<c)for(_=h;_<a;_++)e[T+_]=0;else for(_=0;_<a;_++)e[T+_]=0;else for(e=new Uint8Array(a*s),S.mask=e,g=0;g<c;g++)for(T=g*a,_=0;_<h;_++)e[T+_]=1}return S}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1);let t=e?e.signal:null,i=await this.request(this.url,{responseType:"xml",signal:t}),{rasterInfo:r,files:a}=this._parseHeader(i.data),{skipMapInfo:s,skipExtensions:n=[]}=this.ioConfig;if(!n.includes("aux.xml")&&!s){let t=await this._fetchAuxiliaryData(e);null!=t&&(r.statistics=t.statistics??r.statistics,r.histograms=t.histograms,t.histograms&&null==r.statistics&&(r.statistics=(0,K.Pg)(t.histograms)))}s&&this.updateImageSpaceRasterInfo(r),this._set("rasterInfo",r),this._files=a;let l=await this.request(a.index,{responseType:"array-buffer",signal:t});this._storageIndex=function(e){if(e.byteLength%16>0)throw Error("invalid array buffer must be multiples of 16");let t;if(Re.Z){let i=new Uint8Array(e),r=new ArrayBuffer(e.byteLength),a=new Uint8Array(r);for(let t=0;t<e.byteLength/4;t++)for(let e=0;e<4;e++)a[4*t+e]=i[4*t+3-e];t=new Uint32Array(r)}else t=new Uint32Array(e);return t}(l.data);let{blockWidth:o,blockHeight:u}=this.rasterInfo.storageInfo,f=this.rasterInfo.storageInfo.pyramidScalingFactor,{width:h,height:c}=this.rasterInfo,p=[],d=this._getBandSegmentCount(),m=0,g=-1;for(;m<this._storageIndex.length;){g++;let e=Math.ceil(h/o/f**g)-1,t=Math.ceil(c/u/f**g)-1;m+=(e+1)*(t+1)*d*4,p.push({maxRow:t,maxCol:e,minCol:0,minRow:0})}this.rasterInfo.storageInfo.blockBoundary=p,g>0&&(this.rasterInfo.storageInfo.firstPyramidLevel=1,this.rasterInfo.storageInfo.maximumPyramidLevel=g),this.updateTileInfo()}_getBandSegmentCount(){return this._isBsq?this.rasterInfo.bandCount:1}_getTileLocation(e,t,i){let r,a,s,{blockWidth:n,blockHeight:l,pyramidScalingFactor:o}=this.rasterInfo.storageInfo,{width:u,height:f}=this.rasterInfo,h=this._getBandSegmentCount(),c=0,p=0;for(s=0;s<e;s++)p=o**s,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=r*a;p=o**e,r=Math.ceil(u/n/p),a=Math.ceil(f/l/p),c+=t*r+i,c*=4*h;let d=this._storageIndex.subarray(c,c+4*h),m=0,g=0,y=[];for(let e=0;e<h;e++)m=d[4*e]*2**32+d[4*e+1],g=m+d[4*e+2]*2**32+d[4*e+3]-1,y.push({from:m,to:g});return{ranges:y,actualTileWidth:i<r-1?n:Math.ceil(u/p)-n*(r-1),actualTileHeight:t<a-1?l:Math.ceil(f/p)-l*(a-1)}}_parseHeader(e){let t=(0,le.V6)(e,"MRF_META/Raster");if(!t)throw new l.A("mrf:open","not a valid MRF format");let i=(0,le.V6)(t,"Size"),r=parseInt(i.getAttribute("x"),10),a=parseInt(i.getAttribute("y"),10),s=parseInt(i.getAttribute("c"),10),n=((0,le.mX)(t,"Compression")||"none").toLowerCase();if(!Oe.has(n))throw new l.A("mrf:open","currently does not support compression "+n);let o=(0,le.mX)(t,"DataType")||"UInt8",u=Me.get(o.toLowerCase());if(null==u)throw new l.A("mrf:open","currently does not support pixel type "+o);let f=(0,le.V6)(t,"PageSize"),h=parseInt(f.getAttribute("x"),10),c=parseInt(f.getAttribute("y"),10),p=f.getAttribute("c"),d=p?p===String(s):Oe.get(n).isOneSegment;this._isBsq=!d;let m,g=(0,le.V6)(t,"DataValues");if(g){let e=g.getAttribute("NoData");null!=e&&(m=e.trim().split(" ").map(e=>parseFloat(e)))}if((0,le.V6)(e,"MRF_META/CachedSource"))throw new l.A("mrf:open","currently does not support MRF referencing other data files");let y,w=(0,le.V6)(e,"MRF_META/GeoTags"),v=(0,le.V6)(w,"BoundingBox"),x=!1;if(null!=v){let e=parseFloat(v.getAttribute("minx")),t=parseFloat(v.getAttribute("miny")),i=parseFloat(v.getAttribute("maxx")),r=parseFloat(v.getAttribute("maxy")),a=(0,le.mX)(w,"Projection")||"",s=z.A.WGS84;if("LOCAL_CS[]"!==a)if(a.toLowerCase().startsWith("epsg:")){let e=Number(a.slice(5));!isNaN(e)&&0!==e&&(s=new z.A({wkid:e}))}else s=fe(a)??z.A.WGS84;else x=!0,s=new z.A({wkid:3857});y=new B.A(e,t,i,r),y.spatialReference=s}else x=!0,y=new B.A({xmin:-.5,ymin:.5-a,xmax:r-.5,ymax:.5,spatialReference:new z.A({wkid:3857})});let b=(0,le.V6)(e,"MRF_META/Rsets"),I=parseInt(b?.getAttribute("scale")||"2",10),C=y.spatialReference,S=new Ie.A({origin:new xe.A({x:y.xmin,y:y.ymax,spatialReference:C}),blockWidth:h,blockHeight:c,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:n,pyramidScalingFactor:I}),A=new xe.A({x:y.width/r,y:y.height/a,spatialReference:C}),_=new Q.A({width:r,height:a,extent:y,isPseudoSpatialReference:x,spatialReference:C,bandCount:s,pixelType:u,pixelSize:A,noDataValue:m,storageInfo:S}),T=this._getAuxFullPath((0,le.mX)(t,"DataFile")),R=this._getAuxFullPath((0,le.mX)(t,"IndexFile"));return{rasterInfo:_,files:{mrf:this.url,index:R||this.url.replace(".mrf",".idx"),data:T||this.url.replace(".mrf",Oe.get(n).blobExtension)}}}_getAuxFullPath(e){return!e||e.includes("\\")?null:e.includes("/")?e.startsWith(new URL(this.url).origin)?e:null:`${this.url.slice(0,this.url.lastIndexOf("/"))}/${e}`}async _fetchAuxiliaryData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_files",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_storageIndex",void 0),(0,a.Cg)([(0,p.MZ)()],Fe.prototype,"_isBsq",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Fe.prototype,"datasetFormat",void 0),Fe=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.MRFRaster")],Fe);const ke=Fe;i(44208);var Pe=i(9334);function De(e){let t=e.fields,i=e.records,r=t.some(e=>"oid"===e.name.toLowerCase())?"OBJECTID":"OID",a=[{name:r,type:"esriFieldTypeOID",alias:"OID"}].concat(t.map(e=>({name:e.name,type:"esriFieldType"+e.typeName,alias:e.name}))),s=a.map(e=>e.name),n=[],l=0,o=0;return i.forEach(e=>{let t={};for(t[r]=l++,o=1;o<s.length;o++)t[s[o]]=e[o-1];n.push({attributes:t})}),{displayFieldName:"",fields:a,features:n}}function Ne(e){let t=new DataView(e),i=3&t.getUint8(0);if(3!==i)return{header:{version:i},recordSet:null};let r=t.getUint32(4,!0),a=t.getUint16(8,!0),s=t.getUint16(10,!0),n={version:i,recordCount:r,headerByteCount:a,recordByteCount:s},l=32,o=[],u=[];for(;13!==t.getUint8(l);){let i=String.fromCharCode(t.getUint8(l+11)).trim();o.push({name:(0,Pe.w)(new Uint8Array(e,l,11)),type:i,typeName:["String","Date","Double","Boolean","String","Integer"][["C","D","F","L","M","N"].indexOf(i)],length:t.getUint8(l+16)}),l+=32}if(l+=1,o.length>0)for(;u.length<r&&e.byteLength-l>s;){let i=[];32===t.getUint8(l)?(l+=1,o.forEach(t=>{if("C"===t.type)i.push((0,Pe.w)(new Uint8Array(e,l,t.length)).trim());else if("N"===t.type)i.push(parseInt(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim(),10));else if("F"===t.type)i.push(parseFloat(String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim()));else if("D"===t.type){let r=String.fromCharCode.apply(null,new Uint8Array(e,l,t.length)).trim();i.push(new Date(parseInt(r.slice(0,4),10),parseInt(r.slice(4,6),10)-1,parseInt(r.slice(6,8),10)))}l+=t.length}),u.push(i)):l+=s}return{header:n,fields:o,records:u,recordSet:De({fields:o,records:u})}}var Le=i(44094),Be=i(94213);const ze="none-tiled tiff is not optimized for access, convert to COG and retry.";let Ee=class extends N.A{constructor(){super(...arguments),this._bufferSize=1048576,this._chunkSize=10485760,this._fileSize=-1,this._headerChunks=[],this.datasetFormat="TIFF",this.headerInfo=null}async fetchRawTile(e,t,i,r={}){if(!this.headerInfo?.isSupported||this.isBlockOutside(e,t,i))return null;let a=await this._fetchRawTiffTile(e,t,i,!1,r);if(null!=a&&this.headerInfo.hasMaskBand){let s=await this._fetchRawTiffTile(e,t,i,!0,r);null!=s&&s.pixels[0]instanceof Uint8Array&&(a.mask=s.pixels[0])}return a}async _open(e){this.datasetName=this.url.slice(this.url.lastIndexOf("/")+1,this.url.lastIndexOf(".")),await this._readHeader(e?.signal),await this._fetchAllAuxData(),this.ioConfig.skipMapInfo&&this.updateImageSpaceRasterInfo(this.rasterInfo),this.updateTileInfo()}async _readHeader(e){try{let t=await this._fetchHeaderData(0,this._bufferSize,e);if(!t)throw new l.A("tiffraster:open","failed to open url "+this.url);let{littleEndian:i,firstIFDPos:r,isBigTiff:a}=(0,Le.uT)(t),s=[],n={fileChunk:t,posIFD:r,fileOffset:0};await this._readIFDs(s,n,i,a?8:4,e);let{imageInfo:o,rasterInfo:u}=function(e){let t=(0,Le.uc)(e),{width:i,height:r,tileWidth:a,tileHeight:s,planes:n,pixelType:l,compression:o,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidBlockWidth:h,pyramidBlockHeight:c,pyramidResolutions:p,tileBoundary:d,affine:m,metadata:g,colormap:y}=t,w=fe(t.extent.spatialReference?.wkt||t.extent.spatialReference?.wkid),v=!!t.isPseudoGeographic;w??=(v=!0,new z.A({wkid:3857}));let x=new B.A({...t.extent,spatialReference:w}),b=x?new xe.A({x:x.xmin,y:x.ymax,spatialReference:w}):new xe.A({x:0,y:0}),I=new Ie.A({blockWidth:a,blockHeight:s,pyramidBlockWidth:h,pyramidBlockHeight:c,compression:o,origin:b,firstPyramidLevel:u,maximumPyramidLevel:f,pyramidResolutions:p,blockBoundary:d}),C=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),S=g?{BandProperties:g.bandProperties,DataType:g.dataType}:{},A=new Q.A({width:i,height:r,bandCount:n,pixelType:l,pixelSize:C,storageInfo:I,spatialReference:w,isPseudoSpatialReference:v,keyProperties:S,extent:x,colormap:y,statistics:g?g.statistics:null});if(m?.length&&(A.nativeExtent=new B.A({xmin:-.5,ymin:.5-r,xmax:i-.5,ymax:.5,spatialReference:w}),A.transform=new oe.A({polynomialOrder:1,forwardCoefficients:[m[2]+m[0]/2,m[5]-m[3]/2,m[0],m[3],-m[1],-m[4]]}),A.extent=A.transform.forwardTransform(A.nativeExtent),A.pixelSize=new xe.A({x:(x.xmax-x.xmin)/i,y:(x.ymax-x.ymin)/r,spatialReference:w}),I.origin.x=-.5,I.origin.y=.5),p){let{x:e,y:t}=A.pixelSize;p.forEach(i=>{i.x*=e,i.y*=t})}return{imageInfo:t,rasterInfo:A}}(s),f=(0,Le.zS)(s),h=(0,Le.r9)(s);this.headerInfo={littleEndian:i,isBigTiff:a,ifds:s,pyramidIFDs:f,maskIFDs:h,...o},this._set("rasterInfo",u),this._validateHeader()}finally{this._headerChunks.length=0}}_validateHeader(){let e=this.headerInfo;if(!e.isSupported)throw new l.A("tiffraster:open","this tiff is not supported: "+e.message);if(!e.tileWidth||!e.tileHeight)throw new l.A("tiffraster:open",ze);this.rasterInfo.isPseudoSpatialReference&&o.A.getLogger(this).warn("The spatial reference for this tiff is unsupported. Only EPSG spatial reference codes and Esri WKTs are supported.");let t=e.ifds[0],i=t.get("PREDICTOR")?.values?.[0];if(3===t.get("SAMPLEFORMAT")?.values?.[0]&&2===i)throw new l.A("tiffraster:open","unsupported horizontal difference encoding. Predictor=3 is supported for floating point data")}async _fetchHeaderData(e,t,i){let r=this._getCachedHeaderData(e,t);if(r)return r;let a=Math.floor(e/this._bufferSize)*this._bufferSize,s=a+Math.max(1,Math.ceil((t-a)/this._bufferSize))*this._bufferSize,n=this._getMissingHeaderRanges(a,s).map(async e=>{let{from:t,to:r}=e,a=await this._fetchOffsets(t,r,i),s=this._fileSize;return{chunk:a,fileOffset:t,isEOF:s>0?t+a.byteLength>=s:a.byteLength<r-t+1}}),o=await Promise.all(n);this._headerChunks.push(...o),this._headerChunks.sort((e,t)=>e.fileOffset-t.fileOffset);let u=this._getCachedHeaderData(e,t);if(!u)throw new l.A("tiffraster:open",`failed to fetch byte range ${e}-${t} from ${this.url}`);return u}_getCachedHeaderData(e,t){let i=[],r=e;for(let{chunk:a,fileOffset:s,isEOF:n}of this._headerChunks){if(s+a.byteLength-1<r)continue;if(s>r)return null;let l=r-s,o=Math.min(t-s+1,a.byteLength);if(i.push({chunk:a,start:l,end:o}),r=s+o,r>t||n&&o===a.byteLength){let t=new Uint8Array(r-e),a=0;for(let e of i){let i=new Uint8Array(e.chunk,e.start,e.end-e.start);t.set(i,a),a+=i.byteLength}return t.buffer}}return null}_getMissingHeaderRanges(e,t){let i=[],r=(e,t)=>{let r=Math.floor(e/this._bufferSize)*this._bufferSize,a=Math.ceil(t/this._bufferSize)*this._bufferSize;i.push({from:r,to:a})},a=e;for(let{chunk:e,fileOffset:s,isEOF:n}of this._headerChunks){let l=s+e.byteLength-1;if(!(l<a)&&(s>a&&r(a,Math.min(s-1,t)),a=Math.max(a,l+1),a>t||n))return i}return a<=t&&r(a,t),i}async _validateOrFetchHeaderBuffer(e,t){let{fileChunk:i,fileOffset:r,posIFD:a}=e;if(a+8>=i.byteLength||a<0){if(r=a+r,r<0)throw new l.A("tiffraster:open",`invalid IFD position ${r}. failed to open url ${this.url}`);i=await this._fetchHeaderData(r,r+this._bufferSize/2,t),a=0}return{fileChunk:i,fileOffset:r,posIFD:a}}async _readIFDs(e,t,i,r=4,a){if(!t.posIFD)return null;t=await this._validateOrFetchHeaderBuffer(t,a);let s=await this._readIFD(t,i,Be.NB,r,a);if(!s?.ifd)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(e.push(s.ifd),!s.nextIFD)return null;t.posIFD=s.nextIFD-t.fileOffset,await this._readIFDs(e,t,i,r,a)}async _readIFD(e,t,i=Be.NB,r=4,a){let{fileChunk:s,posIFD:n,fileOffset:o}=e;if(!e.fileChunk)return null;let u=(0,Le.JM)(s,t,n,o,i,r);if(u.success){let{ifd:e}=u;if(!e)throw new l.A("tiffraster:open","cannot parse tiff header. failed to open url "+this.url);if(!(this.ioConfig.loadFullMetadata||i!==Be.NB||e.has("TILEWIDTH")&&e.has("TILELENGTH")))throw new l.A("tiffraster:open",ze);let r=[];e.forEach(e=>{e.values||r.push(e)}),r.length>0&&await this._fillOffsets(r,t,u.nextIFD,a),(0,Le.fM)(e),(0,Le.h_)(e);for(let[i,r]of Be.RR){let l=e.get(i),u=null!=l?.data&&Array.from(l.data.values()).some(e=>null==e.values&&null!=e.offlineOffsetSize);if(l&&(!l.data||u)){n=l.valueOffset-o;let e=await this._validateOrFetchHeaderBuffer({fileChunk:s,posIFD:n,fileOffset:o},a);l.data=(await this._readIFD(e,t,r,4,a))?.ifd}}return u}return u.requiredBufferSize?(s=await this._fetchHeaderData(o,o+n+u.requiredBufferSize+8,a),s.byteLength<n+u.requiredBufferSize?null:(e.fileChunk=s,e.fileOffset=o,this._readIFD(e,t,i,r,a))):null}async _fillOffsets(e,t,i,r){let a=e.filter(e=>null!=e.offlineOffsetSize);if(0===a.length)return;let s=a.map(e=>e.offlineOffsetSize),n=Math.min.apply(null,s.map(e=>e[0])),l=Math.max.apply(null,s.map(e=>e[0]+e[1])),o=1===s.length||l-n<=this._bufferSize;if(!o&&s.length>1&&(s.sort((e,t)=>e[0]-t[0]),o=s.reduce((e,t)=>e===t[0]?t[0]+t[1]:0,s[0][0])===l),o){let e=Math.max(l,n+this._bufferSize/4),i=await this._fetchHeaderData(n,e,r);return void a.forEach(e=>(0,Le.Cr)(i,t,e,n))}let u=a.map(async e=>{let i=e.offlineOffsetSize,a=await this._fetchHeaderData(i[0],i[1]+i[0],r);(0,Le.Cr)(a,t,e,i[0])});await Promise.all(u)}async _fetchOffsets(e,t,i){let r=[],a=this._chunkSize;this._fileSize>0&&(t=Math.min(t,this._fileSize-1));let s=Math.ceil((t-e+1)/a),n=e;for(let e=0;e<s;e++)r.push(this.request(this.url,{range:{from:n,to:e===s-1?t:n+a-1},responseType:"array-buffer",signal:i})),n+=a;let l=await Promise.all(r);if(-1===this._fileSize&&206===l[0].httpStatus){let e=l[0].getHeader?.("Content-Range"),t=Number(e?.split("/")[1]);Number.isFinite(t)&&(this._fileSize=t)}if(1===l.length)return l[0].data;let o=l.reduce((e,t)=>e+t.data.byteLength,0),u=new Uint8Array(o),f=0;for(let e of l)u.set(new Uint8Array(e.data),f),f+=e.data.byteLength;return u.buffer}async _fetchRawTiffTile(e,t,i,r,a={}){let s=this._getTileLocation(e,t,i,r);if(!s)return null;let{ranges:n,actualTileWidth:l,actualTileHeight:o,ifd:u}=s,f=n.map(e=>this.request(this.url,{range:e,responseType:"array-buffer",signal:a.signal})),h=await Promise.all(f),c=h.map(e=>e.data.byteLength).reduce((e,t)=>e+t),p=1===h.length?h[0].data:new ArrayBuffer(c),d=[0],m=[0];if(h.length>1){let e=new Uint8Array(p);for(let t=0,i=0;t<h.length;t++){let r=h[t].data;e.set(new Uint8Array(r),i),d[t]=i,i+=r.byteLength,m[t]=r.byteLength}}let{blockWidth:g,blockHeight:y}=this.getBlockWidthHeight(e),w=await this.decodePixelBlock(p,{format:"tiff",customOptions:{headerInfo:this.headerInfo,ifd:u,offsets:d,sizes:m},width:g,height:y,planes:null,pixelType:null},{signal:a.signal});if(null==w)return null;if(l!==g||o!==y){let e=w.mask;if(e)for(let t=0;t<y;t++){let i=t*g;if(t<o)for(let t=l;t<g;t++)e[i+t]=0;else for(let t=0;t<g;t++)e[i+t]=0}else{e=new Uint8Array(g*y),w.mask=e;for(let t=0;t<o;t++){let i=t*g;for(let t=0;t<l;t++)e[i+t]=1}}}return w}_getTileLocation(e,t,i,r=!1){let{firstPyramidLevel:a,blockBoundary:s}=this.rasterInfo.storageInfo,n=0===e?0:e-(a-1),{headerInfo:l}=this;if(!l)return null;let o=r?l.maskIFDs[n]:0===n?l.ifds[0]:l.pyramidIFDs[n-1];if(!o)return null;let u=(0,Le.XO)(o,l),f=(0,Le.wc)(o,"TILEOFFSETS"),h=(0,Le.wc)(o,"TILEBYTECOUNTS");if(!f?.length||!h?.length)return null;let{minRow:c,minCol:p,maxRow:d,maxCol:m}=s[n];if(t>d||i>m||t<c||i<p)return null;let g=(0,Le.LZ)(o,"IMAGEWIDTH"),y=(0,Le.LZ)(o,"IMAGELENGTH"),w=(0,Le.LZ)(o,"TILEWIDTH"),v=(0,Le.LZ)(o,"TILELENGTH"),x=[];if(u){let{bandCount:e}=this.rasterInfo;for(let r=0;r<e;r++){let e=r*(d+1)*(m+1)+t*(m+1)+i;x[r]={from:f[e],to:f[e]+h[e]-1}}}else{let e=t*(m+1)+i;x.push({from:f[e],to:f[e]+h[e]-1})}for(let e=0;e<x.length;e++)if(null==x[e].from||!x[e].to||x[e].to<0)return null;return{ranges:x,ifd:o,actualTileWidth:i===m&&g%w||w,actualTileHeight:t===d&&y%v||v}}async _fetchAllAuxData(e){if(this.ioConfig.skipMapInfo)return;let{rasterInfo:t}=this,{skipExtensions:i=[]}=this.ioConfig,r=i.includes("aux.xml")?Promise.resolve(null):this._fetchAuxiliaryMetaData(e),a=i.includes("vat.dbf")||1!==t.bandCount||"u8"!==t.pixelType?Promise.resolve(null):this._fetchAuxiliaryTable(e),[s,n]=await Promise.all([r,a]);null!=s&&function(e,t){if(t.statistics=e.statistics??t.statistics,t.histograms=e.histograms,e.histograms&&null==t.statistics&&(t.statistics=(0,K.Pg)(e.histograms)),e.transform&&null==t.transform){t.transform=e.transform,t.nativeExtent=t.extent;let i=t.transform.forwardTransform(t.nativeExtent);t.pixelSize=new xe.A({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)}(s,t),null!=n&&(t.attributeTable=n,t.keyProperties.DataType="thematic")}async _fetchAuxiliaryMetaData(e){try{let{data:t}=await this.request(this.url+".aux.xml",{responseType:"xml",signal:e?.signal});return ce(t)}catch{return null}}async _fetchAuxiliaryTable(e){try{let{data:t}=await this.request(this.url+".vat.dbf",{responseType:"array-buffer",signal:e?.signal}),i=Ne(t);return i?.recordSet?ie.A.fromJSON(i.recordSet):null}catch{return null}}};(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_bufferSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_chunkSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_fileSize",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"_headerChunks",void 0),(0,a.Cg)([(0,p.MZ)({type:String,json:{write:!0}})],Ee.prototype,"datasetFormat",void 0),(0,a.Cg)([(0,p.MZ)()],Ee.prototype,"headerInfo",void 0),Ee=(0,a.Cg)([(0,p.$K)("esri.layers.raster.datasets.TIFFRaster")],Ee);const Je=Ee,He=new Map;He.set("MRF",{desc:"Meta Raster Format",constructor:ke}),He.set("TIFF",{desc:"GeoTIFF",constructor:Je}),He.set("RasterTileServer",{desc:"Raster Tile Server",constructor:Te}),He.set("JPG",{desc:"JPG Raster Format",constructor:we}),He.set("PNG",{desc:"PNG Raster Format",constructor:we}),He.set("GIF",{desc:"GIF Raster Format",constructor:we}),He.set("BMP",{desc:"BMP Raster Format",constructor:we}),He.set("CovJSON",{desc:"COVJSON Raster Format",constructor:ae}),He.set("MEMORY",{desc:"In Memory Raster Format",constructor:te});class $e{static get supportedFormats(){let e=new Set;return He.forEach((t,i)=>e.add(i)),e}static async open(e){let{url:t,ioConfig:i,source:r,sourceJSON:a}=e,s=e.datasetFormat??i?.datasetFormat;s??(t.includes(".")?s=t.slice(t.lastIndexOf(".")+1).toUpperCase():"coverage"===r?.type?.toLowerCase()?s="CovJSON":r?.extent&&r.pixelblocks&&(s="MEMORY")),"OVR"===s||"TIF"===s||"DM"===s?s="TIFF":"JPG"===s||"JPEG"===s||"JFIF"===s?s="JPG":"COVJSON"===s&&(s="CovJSON"),t.toLowerCase().includes("/imageserver")&&!t.toLowerCase().includes("/wcsserver")&&(s="RasterTileServer");let n={url:t,source:r,sourceJSON:a,datasetFormat:s,ioConfig:i??{bandIds:null,sampling:null}};if(Object.keys(n).forEach(e=>{n[e]??delete n[e]}),s){if(!this.supportedFormats.has(s))throw new l.A("rasterfactory:open","not a supported format "+s);if("CRF"===s)throw new l.A("rasterfactory:open",`cannot open raster: ${t}`);let i=new(0,He.get(s).constructor)(n);return i.rasterJobHandler=e.rasterJobHandler,i.rasterInfo=e.rasterInfo,await i.open({signal:e.signal}),i}let o=Array.from(He.keys()).filter(e=>"CovJSON"!==e&&"Memory"!==e),u=0,f=()=>{if(s=o[u++],!s||"CRF"===s)return null;let t=new(0,He.get(s).constructor)(n);return t.rasterJobHandler=e.rasterJobHandler,t.open({signal:e.signal}).then(()=>t).catch(()=>f())};return f()}static register(e,t,i){He.has(e.toUpperCase())||He.set(e.toUpperCase(),{desc:t,constructor:i})}}var Ue=i(99235),Ze=i(10873),je=i(20437),qe=i(74797),Ve=i(22796),Ge=i(69409);const We={instance:null,refCount:0,connectionPromise:null};async function Xe(){if(We.refCount++,We.instance)return We.instance;if(!We.connectionPromise){let e=new Ge.A;We.connectionPromise=e.initialize().then(()=>{We.instance=e})}return await We.connectionPromise,We.instance}function Ke(){We.refCount--,We.refCount>0||(We.instance?.destroy(),We.instance=null,We.connectionPromise=null,We.refCount=0)}var Ye=i(24212),Qe=i(30291),et=i(88625),tt=i(59923);let it=class extends((0,C.dM)((0,O.j)((0,A.q)((0,_.A)((0,R.H)((0,S.d)((0,k.b)((0,T.G)((0,F.e)((0,I.b)((0,M.J)((0,f.M)((0,n.OU)(b.A)))))))))))))){constructor(...e){super(...e),this._primaryRasters=[],this.charts=null,this.graphicOrigin=new x(this),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.screenSizePerspectiveEnabled=!0,this.fields=null,this.source=void 0,this._debouncedSaveOperations=(0,h.sg)(async(e,t,r)=>{let{save:a,saveAs:s}=await i.e(9838).then(()=>i(59838));switch(e){case 0:return a(this,t);case 1:return s(this,r,t)}})}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){let t=null==e?null:e.signal;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Image Service"]},e).catch(h.QP).then(()=>this._openRaster(t))),Promise.resolve(this)}destroy(){super.destroy(),this._releaseWorkerHandle=(0,u.xt)(this._releaseWorkerHandle)}set elevationInfo(e){"relative-to-scene"!==e?.mode&&this._set("elevationInfo",e),this._validateElevationInfo(e)}get defaultPopupTemplate(){return this.createPopupTemplate()}get rasterFields(){let e=[(0,qe.rZ)("Pixel Value"),(0,qe.dy)("Raw Pixel Value")],t=this.raster?.rasterInfo??this.serviceRasterInfo,i=t?.attributeTable;if(i){let t=(0,qe.jC)(i);e.push(...t)}let r=t?.dataType,a=t?.multidimensionalInfo;if(("vector-magdir"===r||"vector-uv"===r)&&null!=a){let t=a.variables[0].unit?.trim(),i=(0,qe.DV)(t),r=(0,qe.y6)();e.push(i,r)}if(a){let t=(0,qe.AL)(a);e.push(...t)}return e}get renderer(){return super.renderer}set renderer(e){super.renderer=e}createPopupTemplate(e){let{rasterFields:t}=this,i=e?.visibleFieldNames??new Set(t.map(({name:e})=>e).filter(e=>e!==qe.F_.rawServicePixelValue)),r=(0,Qe.tn)({fields:t,title:this.title},{...e,visibleFieldNames:i}),{rasterInfo:a}=this.raster;return r?.fieldInfos&&a&&(0,qe.h4)(r.fieldInfos,a),r}async generateRasterInfo(e,t){let i=(0,d.PZ)(Ve.A,e);if(await this.load(),!i||"none"===i.functionName?.toLowerCase())return this.serviceRasterInfo;try{let{rasterInfo:e}=await this._openFunctionRaster(i,t);return e}catch(e){throw e instanceof l.A?e:new l.A("imagery-tile-layer","the given raster function is not supported")}}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}supportsExportMapTiles(){let e=this._primaryRasters[0]??this.raster,t="RasterTileServer"===e?.datasetFormat,i=!!this.sourceJSON?.exportTilesAllowed,r=this.sourceJSON?.datasetFormat?.toLowerCase(),a=!/\/tiledimageservices[^.]*\.arcgis\.com/i.test(this.url)&&"Raster"===e?.tileType&&("cache/jpegplus"===r||"cache/jpegpng"===r);return t&&i&&("Map"===e?.tileType||a)}supportsWrite(){let e=this._primaryRasters[0]??this.raster;return!!(this.loaded?"RasterTileServer"===e.datasetFormat&&("Raster"===e.tileType||"Map"===e.tileType):this.url&&/\/ImageServer(\/|\/?$)/i.test(this.url))}write(e,t){return this.supportsWrite()?super.write(e,t):((0,tt.U4)(t,this),null)}async hasDataChanged(){try{let e=this._primaryRasters[0]??this.raster,{dataChanged:t,updates:i}=await e.refresh();return t&&(this.serviceRasterInfo!==e.rasterInfo&&this._set("serviceRasterInfo",e.rasterInfo),e.sourceJSON&&this.sourceJSON!==e.sourceJSON&&(this.sourceJSON=e.sourceJSON),i&&this.read(i,{origin:"service",url:this.parsedUrl,ignoreDefaults:!0})),t}catch{return!1}}async _openRaster(e){let t=!1;if(this.raster)await this._openFromRaster(this.raster,e),t=(0,P.qg)(this.raster),!t&&this.rasterFunction&&(this._primaryRasters=[this.raster],await this._initializeWithFunctionRaster(this.rasterFunction));else{let{url:t,rasterFunction:i,source:r}=this;if(!t&&!r)throw new l.A("imagery-tile-layer:open","missing url or source parameter");r?await this._openFromSource(r,e):i?await this._openFromUrlWithRasterFunction(t,i,e):await this._openFromUrl(t,e)}let i=this.raster.rasterInfo;if(!i)throw new l.A("imagery-tile-layer:load","cannot load resources on "+this.url);if(this._set("serviceRasterInfo",t?i:this._primaryRasters[0].rasterInfo),this._set("spatialReference",i.spatialReference),this.sourceJSON=this.sourceJSON||this.raster.sourceJSON,null!=this.sourceJSON){let 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"})}else this.read({tileInfo:this.serviceRasterInfo?.storageInfo.tileInfo.toJSON()},{origin:"service"});this.title||=this.raster.datasetName,"Map"===this.raster.tileType&&(this.popupEnabled=!1),this._configDefaultSettings(),this.addHandles((0,c.wB)(()=>this.customParameters,e=>{this.raster&&(this.raster.ioConfig.customFetchParameters=e)}))}async _openFromRaster(e,t){e.rasterInfo||await e.open({signal:t}),this._primaryRasters=(0,P.pb)(e),this.url||=this._primaryRasters[0].url}async _openFromUrlWithRasterFunction(e,t,i){let r,a=[e];t&&(0,Ue.UD)(t.toJSON(),a),a.some(e=>at(e,this.ioConfig))&&(r=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let s=await Promise.all(a.map(e=>$e.open({url:e,rasterInfo:1===a.length?this.serviceRasterInfo:void 0,sourceJSON:1===a.length?this.sourceJSON:void 0,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:r,signal:i}))),n=s.findIndex(e=>null==e);if(n>-1)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${a[n]}`);return this._primaryRasters=s,this._initializeWithFunctionRaster(t)}async _openFromUrl(e,t){let i;at(e,this.ioConfig)&&(i=await Xe(),this._releaseWorkerHandle={remove:()=>Ke()});let r=await $e.open({url:e,rasterInfo:this.serviceRasterInfo,sourceJSON:this.sourceJSON,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},rasterJobHandler:i,signal:t});if(null==r)throw new l.A("imagery-tile-layer:open",`cannot open raster: ${e}`);this._primaryRasters=[r],this.raster=r}async _openFromSource(e,t){let i="the tiled imagery data source is not supported",r="coverage"===e.type?.toLowerCase()?"CovJSON":e.extent&&e.pixelBlock?"MEMORY":null;if(!r)throw new l.A("imagery-tile-layer:open",i);"MEMORY"===r&&(e={...e,pixelBlock:void 0,pixelBlocks:[e.pixelBlock]});let a=await $e.open({url:"",source:e,datasetFormat:r,ioConfig:{sampling:"closest",...this.ioConfig,customFetchParameters:this.customParameters},signal:t});if(null==a)throw new l.A("imagery-tile-layer:open",i);this._primaryRasters=[a],this.rasterFunction?await this._initializeWithFunctionRaster(this.rasterFunction):this.raster=a}async _openFunctionRaster(e,t){let i={raster:this._primaryRasters[0]};this._primaryRasters.length>1&&this._primaryRasters.forEach(e=>i[e.url]=e);let r=(0,Ue.vt)(e.functionDefinition?.toJSON()??e.toJSON(),i),a=new D.A({rasterFunction:r});return await a.open(t),a}async _initializeWithFunctionRaster(e,t){try{this.raster=await this._openFunctionRaster(e,t)}catch(e){e instanceof l.A&&o.A.getLogger(this).error("imagery-tile-layer:open",e.message),o.A.getLogger(this).warn("imagery-tile-layer:open","the raster function cannot be applied and is removed"),this._set("rasterFunction",null),this.raster=this._primaryRasters[0]}}_validateElevationInfo(e){(0,Ye.XF)(o.A.getLogger(this),(0,Ye.$7)("ImageryTile layers","relative-to-scene",e)),(0,Ye.XF)(o.A.getLogger(this),(0,Ye.tW)("ImageryTile layers",e))}};(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_primaryRasters",void 0),(0,a.Cg)([(0,p.MZ)({clonable:!1})],it.prototype,"_releaseWorkerHandle",void 0),(0,a.Cg)([(0,p.MZ)({json:{origins:{"web-scene":{write:!1}},write:!0}})],it.prototype,"charts",void 0),(0,a.Cg)([(0,p.MZ)({type:et.A,value:null,json:{name:"layerDefinition.elevationInfo",write:!0,origins:{"portal-item":{read:!1,write:!1},"web-map":{read:!1,write:!1}}}})],it.prototype,"elevationInfo",null),(0,a.Cg)([(0,p.MZ)({type:Ce.A})],it.prototype,"tileInfo",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,clonable:!1})],it.prototype,"graphicOrigin",void 0),(0,a.Cg)([(0,p.MZ)(Ze.fV)],it.prototype,"legendEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],it.prototype,"isReference",void 0),(0,a.Cg)([(0,p.MZ)({type:["show","hide"]})],it.prototype,"listMode",void 0),(0,a.Cg)([(0,p.MZ)({json:{read:!0,write:!0}})],it.prototype,"blendMode",void 0),(0,a.Cg)([(0,p.MZ)({type:Ve.A,json:{name:"renderingRule",write:!0}})],it.prototype,"rasterFunction",void 0),(0,a.Cg)([(0,p.MZ)()],it.prototype,"sourceJSON",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{origins:{service:{read:{source:"currentVersion"}}}}})],it.prototype,"version",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,json:{read:!1}})],it.prototype,"type",void 0),(0,a.Cg)([(0,p.MZ)({type:["ArcGISTiledImageServiceLayer"]})],it.prototype,"operationalLayerType",void 0),(0,a.Cg)([(0,p.MZ)({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}}}})],it.prototype,"popupEnabled",void 0),(0,a.Cg)([(0,p.MZ)({type:s.A,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType}}}}})],it.prototype,"popupTemplate",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0})],it.prototype,"defaultPopupTemplate",null),(0,a.Cg)([(0,p.MZ)(Ze.PY)],it.prototype,"screenSizePerspectiveEnabled",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[je.A]})],it.prototype,"fields",void 0),(0,a.Cg)([(0,p.MZ)({readOnly:!0,type:[je.A]})],it.prototype,"rasterFields",null),(0,a.Cg)([(0,p.MZ)({constructOnly:!0})],it.prototype,"source",void 0),it=(0,a.Cg)([(0,p.$K)("esri.layers.ImageryTileLayer")],it);const rt=it;function at(e,t){let{tileGeneration:i}=t??{};return"immediate"===i||/\.(png|gif|bmp)$/i.test(e)}},18768(e,t,i){var r=i(32198),a=i(53966),s=i(91429),n=i(60694);i.d(t,["b",0,e=>{let t=e,i=class extends t{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){let e=(0,n.qg)(this.url);if(e?.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,n.Jf)(e,a.A.getLogger(this)))}};return(0,r.Cg)([(0,s.MZ)()],i.prototype,"title",null),(0,r.Cg)([(0,s.MZ)({type:String})],i.prototype,"url",null),i=(0,r.Cg)([(0,s.$K)("esri.layers.mixins.ArcGISService")],i),i}])},56551(e,t,i){i.d(t,{H:()=>h});var r=i(32198),a=i(91429),s=i(69540),n=i(25482),l=i(78888),o=i(94359),u=i(93223);let f=class extends((0,s.OU)(n.o)){constructor(e){super(e),this.name=void 0,this.method="none",this.value=void 0,this.bandIds=void 0,this.renderer=void 0}};(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({type:["raster-function-template","variable","none"],json:{write:{isRequired:!0}}}),(0,u.e)({rasterFunctionTemplate:"raster-function-template",variable:"variable",none:"none"})],f.prototype,"method",void 0),(0,r.Cg)([(0,a.MZ)({type:String,json:{write:{isRequired:!0}}})],f.prototype,"value",void 0),(0,r.Cg)([(0,a.MZ)({type:[l.jz],json:{write:{isRequired:!0}}})],f.prototype,"bandIds",void 0),(0,r.Cg)([(0,a.MZ)({types:o.uy,json:{write:!0,origins:{"web-scene":{types:o.Gj,write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],f.prototype,"renderer",void 0),f=(0,r.Cg)([(0,a.$K)("esri.renderers.support.RasterPresetRenderer")],f);const h=e=>{let t=e,i=class extends t{constructor(){super(...arguments),this.activePresetRendererName=null,this.presetRenderers=null}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"layerDefinition.activePresetRendererName",write:{allowNull:!0}}})],i.prototype,"activePresetRendererName",void 0),(0,r.Cg)([(0,a.MZ)({type:[f],json:{name:"layerDefinition.presetRenderers",write:!0}})],i.prototype,"presetRenderers",void 0),i=(0,r.Cg)([(0,a.$K)("esri.layers.mixins.RasterPresetRendererMixin")],i),i}},10333(e,t,i){i.d(t,{A:()=>n});var r=i(32198),a=i(25482),s=i(91429);let n=class extends a.o{get affectsPixelSize(){return!1}forwardTransform(e){return e}inverseTransform(e){return e}};(0,r.Cg)([(0,s.MZ)()],n.prototype,"affectsPixelSize",null),(0,r.Cg)([(0,s.MZ)({json:{write:!0}})],n.prototype,"spatialReference",void 0),n=(0,r.Cg)([(0,s.$K)("esri.layers.raster.transforms.BaseRasterTransform")],n)},75414(e,t,i){i.d(t,{A:()=>o});var r,a=i(32198),s=i(91429),n=i(10333),l=i(93223);let o=r=class extends n.A{constructor(){super(...arguments),this.type="gcs-shift",this.tolerance=1e-8}forwardTransform(e){return"point"===(e=e.clone()).type?(e.x>180+this.tolerance&&(e.x-=360),e):(e.xmin>=180-this.tolerance?(e.xmax-=360,e.xmin-=360):e.xmax>180+this.tolerance&&(e.xmin=-180,e.xmax=180),e)}inverseTransform(e){return"point"===(e=e.clone()).type?(e.x<-this.tolerance&&(e.x+=360),e):(e.xmin<-this.tolerance&&(e.xmin+=360,e.xmax+=360),e)}clone(){return new r({tolerance:this.tolerance})}};(0,a.Cg)([(0,l.e)({GCSShiftXform:"gcs-shift"})],o.prototype,"type",void 0),(0,a.Cg)([(0,s.MZ)()],o.prototype,"tolerance",void 0),o=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.GCSShiftTransform")],o)},43163(e,t,i){i.d(t,{A:()=>d});var r,a=i(32198),s=i(91429),n=i(5443),l=i(86738),o=i(10333),u=i(36005),f=i(43937),h=i(93223);function c(e,t,i){let{x:r,y:a}=t;if(i<2)return{x:e[0]+r*e[2]+a*e[4],y:e[1]+r*e[3]+a*e[5]};if(2===i){let t=r*r,i=a*a,s=r*a;return{x:e[0]+r*e[2]+a*e[4]+t*e[6]+s*e[8]+i*e[10],y:e[1]+r*e[3]+a*e[5]+t*e[7]+s*e[9]+i*e[11]}}let s=r*r,n=a*a,l=r*a,o=s*r,u=s*a,f=r*n,h=a*n;return{x:e[0]+r*e[2]+a*e[4]+s*e[6]+l*e[8]+n*e[10]+o*e[12]+u*e[14]+f*e[16]+h*e[18],y:e[1]+r*e[3]+a*e[5]+s*e[7]+l*e[9]+n*e[11]+o*e[13]+u*e[15]+f*e[17]+h*e[19]}}function p(e,t,i){let{xmin:r,ymin:a,xmax:s,ymax:l,spatialReference:o}=t,u=[];if(i<2)u.push({x:r,y:l}),u.push({x:s,y:l}),u.push({x:r,y:a}),u.push({x:s,y:a});else{let e=10;for(let t=0;t<e;t++)u.push({x:r,y:a+(l-a)*t/(e-1)}),u.push({x:s,y:a+(l-a)*t/(e-1)});e=8;for(let t=1;t<=e;t++)u.push({x:r+(s-r)*t/e,y:a}),u.push({x:r+(s-r)*t/e,y:l})}u=u.map(t=>c(e,t,i));let f=u.map(e=>e.x),h=u.map(e=>e.y);return new n.A({xmin:Math.min.apply(null,f),xmax:Math.max.apply(null,f),ymin:Math.min.apply(null,h),ymax:Math.max.apply(null,h),spatialReference:o})}let d=r=class extends o.A{constructor(){super(...arguments),this.polynomialOrder=1,this.type="polynomial"}readForwardCoefficients(e,t){let{coeffX:i,coeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeForwardCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.coeffX=r,t.coeffY=a}get inverseCoefficients(){let e=this._get("inverseCoefficients"),t=this._get("forwardCoefficients");return!e&&t&&this.polynomialOrder<2&&(e=function(e){let[t,i,r,a,s,n]=e,l=r*n-s*a,o=s*a-r*n;return[(s*i-t*n)/l,(r*i-t*a)/o,n/l,a/o,-s/l,-r/o]}(t)),e}set inverseCoefficients(e){this._set("inverseCoefficients",e)}readInverseCoefficients(e,t){let{inverseCoeffX:i,inverseCoeffY:r}=t;if(!i?.length||!r?.length||i.length!==r.length)return null;let a=[];for(let e=0;e<i.length;e++)a.push(i[e]),a.push(r[e]);return a}writeInverseCoefficients(e,t,i){let r=[],a=[];for(let t=0;t<e?.length;t++)t%2==0?r.push(e[t]):a.push(e[t]);t.inverseCoeffX=r,t.inverseCoeffY=a}get affectsPixelSize(){return this.polynomialOrder>0}forwardTransform(e){if("point"===e.type){let t=c(this.forwardCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.forwardCoefficients,e,this.polynomialOrder)}inverseTransform(e){if("point"===e.type){let t=c(this.inverseCoefficients,e,this.polynomialOrder);return new l.A({x:t.x,y:t.y,spatialReference:e.spatialReference})}return p(this.inverseCoefficients,e,this.polynomialOrder)}clone(){return new r({polynomialOrder:this.polynomialOrder,forwardCoefficients:this.forwardCoefficients?[...this.forwardCoefficients]:null,inverseCoefficients:this.inverseCoefficients?[...this.inverseCoefficients]:null})}};(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"polynomialOrder",void 0),(0,a.Cg)([(0,s.MZ)()],d.prototype,"forwardCoefficients",void 0),(0,a.Cg)([(0,u.w)("forwardCoefficients",["coeffX","coeffY"])],d.prototype,"readForwardCoefficients",null),(0,a.Cg)([(0,f.K)("forwardCoefficients")],d.prototype,"writeForwardCoefficients",null),(0,a.Cg)([(0,s.MZ)({json:{write:!0}})],d.prototype,"inverseCoefficients",null),(0,a.Cg)([(0,u.w)("inverseCoefficients",["inverseCoeffX","inverseCoeffY"])],d.prototype,"readInverseCoefficients",null),(0,a.Cg)([(0,f.K)("inverseCoefficients")],d.prototype,"writeInverseCoefficients",null),(0,a.Cg)([(0,s.MZ)()],d.prototype,"affectsPixelSize",null),(0,a.Cg)([(0,h.e)({PolynomialXform:"polynomial"})],d.prototype,"type",void 0),d=r=(0,a.Cg)([(0,s.$K)("esri.layers.raster.transforms.PolynomialTransform")],d)},25943(e,t,i){i.d(t,{d:()=>I});var r,a=i(32198),s=i(56507),n=i(69622),l=i(49186),o=i(36563),u=(i(44208),i(66344)),f=i(15142),h=i(17676),c=i(36708),p=i(76030),d=i(84952),m=i(91429),g=i(72802),y=i(4718),w=i(69397);class v{constructor(e){!function(e){if(!e?.location)throw new l.A("tilemap:missing-location","Location missing from tilemap response");if(!1===e.valid)throw new l.A("tilemap:invalid","Tilemap response was marked as invalid");if(!e.data)throw new l.A("tilemap:missing-data","Data missing from tilemap response");if(!Array.isArray(e.data))throw new l.A("tilemap:data-mismatch","Data must be an array of numbers");if(e.data.length!==e.location.width*e.location.height)throw new l.A("tilemap:data-mismatch","Number of data items does not match width/height of tilemap")}(e);let{location:t,data:i}=e;this.location=Object.freeze((0,y.o8)(t));let r=this.location.width,a=this.location.height,s=!0,n=!0,o=function(e,t=!1){return e<=1024?t?Array(e).fill(0):Array(e):new Uint32Array(e)}(Math.ceil(r*a/32)),u=0;for(let e=0;e<i.length;e++){let t=e%32;i[e]?(n=!1,o[u]|=1<<t):s=!1,31===t&&++u}n?(this._availability="unavailable",this.byteSize=40):s?(this._availability="available",this.byteSize=40):(this._availability=o,this.byteSize=40+(0,w.Qf)(o))}getAvailability(e,t){if("unavailable"===this._availability||"available"===this._availability)return this._availability;let i=(e-this.location.top)*this.location.width+(t-this.location.left),r=i%32,a=i>>5,s=this._availability;return a<0||a>s.length?"unknown":s[a]&1<<r?"available":"unavailable"}static fromDefinition(e,t){let i=e.service.request||s.A,{row:r,col:a,width:n,height:o}=e,u={query:{f:"json"}};return t=t?{...u,...t}:u,i(function(e){let t;if(e.service.tileServers?.length){let i=e.service.tileServers;t=`${i&&i.length?i[e.row%i.length]:e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}else t=`${e.service.url}/tilemap/${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`;let i=e.service.query;return i&&(t=`${t}?${i}`),t}(e),t).then(e=>e.data).catch(e=>{if(422===e?.details?.httpStatus)return{location:{top:r,left:a,width:n,height:o},valid:!0,data:Array(n*o).fill(0)};throw e}).then(e=>{if(e.location&&(e.location.top!==r||e.location.left!==a||e.location.width!==n||e.location.height!==o))throw new l.A("tilemap:location-mismatch","Tilemap response for different location than requested",{response:e,definition:{top:r,left:a,width:n,height:o}});return v.fromJSON(e)})}static fromJSON(e){return Object.freeze(new v(e))}}function x(e){return`${e.level}/${e.row}/${e.col}/${e.width}/${e.height}`}function b(e,t,i){return new l.A("tile-map:tile-unavailable","Tile is not available",{level:e,row:t,col:i})}let I=class extends n.A{static{r=this}constructor(e){super(e),this._pendingTilemapRequests={},this.request=s.A,this.size=32,this._prefetchingEnabled=!0}initialize(){this._tilemapCache=new u.q(2097152),this.addHandles((0,c.wB)(()=>{let{layer:e}=this;return[e?.parsedUrl,e?.tileServers,e?.apiKey,e?.customParameters]},()=>this._initializeTilemapDefinition(),c.Vh))}get effectiveMinLOD(){return this.minLOD??this.layer.tileInfo.lods[0].level}get effectiveMaxLOD(){return this.maxLOD??this.layer.tileInfo.lods[this.layer.tileInfo.lods.length-1].level}getAvailability(e,t,i){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return"unavailable";let r=this._tilemapFromCache(e,t,i,this._tmpTilemapDefinition);return r?r.getAvailability(t,i):"unknown"}fetchAvailability(e,t,i,r){return!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD?Promise.reject(b(e,t,i)):this._fetchTilemap(e,t,i,r).catch(e=>e).then(r=>{if(r instanceof v){let a=r.getAvailability(t,i);if("unavailable"===a)throw b(e,t,i);return a}if((0,h.zf)(r))throw r;return"unknown"})}fetchAvailabilityUpsample(e,t,i,r,a){r.level=e,r.row=t,r.col=i;let s=this.layer.tileInfo;s.updateTileInfo(r);let n=this.fetchAvailability(e,t,i,a).catch(e=>{if((0,h.zf)(e))throw e;if(s.upsampleTile(r))return this.fetchAvailabilityUpsample(r.level,r.row,r.col,r,a);throw e});return this._fetchAvailabilityUpsamplePrefetch(e,t,i,a,n),n}async _fetchAvailabilityUpsamplePrefetch(e,t,i,a,s){if(!this._prefetchingEnabled)return;let n=`prefetch-${e}-${t}-${i}`;if(this.hasHandles(n))return;let l=new AbortController;s.then(()=>l.abort(),()=>l.abort());let u=!1,f=(0,o.hA)(()=>{u||(u=!0,l.abort())});if(this.addHandles(f,n),await(0,p.md)(10,l.signal).catch(()=>{}),u||(u=!0,this.removeHandles(n)),(0,h.G4)(l))return;let c=new g.U(e,t,i),d={...a,signal:l.signal},m=this.layer.tileInfo;for(let e=0;r._prefetches.length<r._maxPrefetch&&m.upsampleTile(c);++e){let e=this.fetchAvailability(c.level,c.row,c.col,d);r._prefetches.push(e);let t=()=>{r._prefetches.removeUnordered(e)};e.then(t,t)}}static{this._maxPrefetch=4}static{this._prefetches=new f.A({initialSize:r._maxPrefetch})}static cleanupTilemapCache(){this._prefetches.prune()}_fetchTilemap(e,t,i,r){if(!this.layer.tileInfo.lodAt(e)||e<this.effectiveMinLOD||e>this.effectiveMaxLOD)return Promise.reject(new l.A("tilemap-cache:level-unavailable",`Level ${e} is unavailable in the service`));let a=this._tmpTilemapDefinition,s=this._tilemapFromCache(e,t,i,a);if(s)return Promise.resolve(s);let n=r?.signal;return r={...r,signal:null},new Promise((e,t)=>{(0,h.u7)(n,()=>t((0,h.NK)()));let i=x(a),s=this._pendingTilemapRequests[i];if(!s){s=v.fromDefinition(a,r).then(e=>(this._tilemapCache.put(i,e,e.byteSize),e));let e=()=>{delete this._pendingTilemapRequests[i]};this._pendingTilemapRequests[i]=s,s.then(e,e)}s.then(e,t)})}_initializeTilemapDefinition(){if(!this.layer.parsedUrl)return;let{parsedUrl:e,apiKey:t,customParameters:i}=this.layer;this._tilemapCache.clear(),this._tmpTilemapDefinition={service:{url:e.path,query:(0,d.x0)({...e.query,...i,token:t??e.query?.token}),tileServers:this.layer.tileServers,request:this.request},width:this.size,height:this.size,level:0,row:0,col:0}}_tilemapFromCache(e,t,i,r){r.level=e,r.row=t-t%this.size,r.col=i-i%this.size;let a=x(r);return this._tilemapCache.get(a)}get test(){}};(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"layer",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"minLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"maxLOD",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"request",void 0),(0,a.Cg)([(0,m.MZ)({constructOnly:!0})],I.prototype,"size",void 0),I=r=(0,a.Cg)([(0,m.$K)("esri.layers.support.TilemapCache")],I)},82371(e,t,i){i.d(t,{E9:()=>d,Tw:()=>c,X6:()=>p});var r=i(56507),a=i(5443),s=i(86738),n=i(16930),l=i(87186),o=i(20223),u=i(2272),f=i(22671);async function h(e,t,i){let h=(0,u.Dl)(e),{rasterFunction:c,sourceJSON:p}=t||{},d=c?JSON.stringify(c.rasterFunctionDefinition||c):null,m=(0,u.lF)({...h.query,renderingRule:d,f:"json"}),g=(0,u.jV)(m,i);e=h.path;let y=p||await(0,r.A)(e,g).then(e=>e.data),{currentVersion:w}=y,v=y.hasRasterAttributeTable?(0,r.A)(`${e}/rasterAttributeTable`,g):null,x=y.hasColormap?(0,r.A)(`${e}/colormap`,g):null,b=y.hasHistograms?(0,r.A)(`${e}/histograms`,g):null,I=w>=10.3?(0,r.A)(`${e}/keyProperties`,g):null,C=y.hasMultidimensions?(0,r.A)(`${e}/multidimensionalInfo`,g):null,S=(c?w>=10.91:w>=10.81)?(0,r.A)(`${e}/statistics`,g):null,A=await Promise.allSettled([v,x,b,I,C,S]),_=a.A.fromJSON(y.extent),T=Math.ceil(_.width/y.pixelSizeX-.1),R=Math.ceil(_.height/y.pixelSizeY-.1),M=n.A.fromJSON(y.spatialReference||y.extent.spatialReference),O="fulfilled"===A[0].status?A[0].value?.data:null,F=O?.features?.length?f.A.fromJSON(O):null,k="fulfilled"===A[1].status?A[1].value?.data.colormap:null,P=k?.length?k:null,D="fulfilled"===A[2].status?A[2].value?.data.histograms:null,N=D?.[0]?.counts?.length?D:null,L="fulfilled"===A[3].status?A[3].value?.data??{}:{},B="fulfilled"===A[4].status?A[4].value?.data.multidimensionalInfo:null,z=B?.variables?.length?B:null;var E;(E=z)&&E.variables.forEach(e=>{e.statistics?.length&&e.statistics.forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),e.dimensions?.forEach(e=>{"StdTime"===e.name&&!e.recurring&&!e.unit&&(e.unit="ISO8601")})});let J=function(e,t){let i=null;t&&t.length===e.bandCount&&(i=t.map(e=>{let t=e.covariances?.trim(),i=t?t.split(",").map(Number):void 0;return{avg:e.mean,count:e.count,max:e.max,median:e.median,min:e.min,mode:e.mode,stddev:e.standardDeviation,sum:e.sum,covariances:i}}));let r=e.minValues?.length===e.bandCount?e.minValues.map((t,i)=>({min:t,max:e.maxValues[i],avg:e.meanValues[i],stddev:e.stdvValues[i]})):null;return null==r||null==i||i.some((e,t)=>e.min!==r[t]?.min||e.max!==r[t]?.max||e.avg!==r[t]?.avg||e.stddev!==r[t]?.stddev)?r:i}(y,"fulfilled"===A[5].status?A[5].value?.data.statistics:null),{defaultVariable:H,serviceDataType:$}=y;H&&H!==L.DefaultVariable&&(L.DefaultVariable=H),$?.includes("esriImageServiceDataTypeVector")&&!$.includes(L.DataType)&&(L.DataType=$.replace("esriImageServiceDataType",""));let U=y.noDataValue;y.noDataValues?.length&&y.noDataValues.some(e=>e!==U)&&(U=y.noDataValues);let Z=y.transposeInfo?new o.A({blockWidth:256,blockHeight:256,pyramidBlockWidth:256,pyramidBlockHeight:256,pyramidScalingFactor:2,compression:"lerc",origin:new s.A({x:y.extent.xmin,y:y.extent.ymax,spatialReference:M}),firstPyramidLevel:1,maximumPyramidLevel:Math.max(0,Math.round(Math.log(Math.max(T,R))/Math.LN2-8)),transposeInfo:y.transposeInfo}):void 0;return new l.A({width:T,height:R,bandCount:y.bandCount,extent:a.A.fromJSON(y.extent),spatialReference:M,pixelSize:new s.A({x:y.pixelSizeX,y:y.pixelSizeY,spatialReference:M}),pixelType:y.pixelType.toLowerCase(),statistics:J,attributeTable:F,colormap:P,histograms:N,keyProperties:L,noDataValue:U,multidimensionalInfo:z,storageInfo:Z})}function c(e,t,i){return h(e,{sourceJSON:t},i)}function p(e,t,i){return h(e,{rasterFunction:t},i)}function d(e,t){e.attributeTable||(t.hasRasterAttributeTable=!1),e.histograms||(t.hasHistograms=!1),e.colormap||(t.hasColormap=!1),e.multidimensionalInfo||(t.hasMultidimensions=!1)}},2272(e,t,i){i.d(t,{Dl:()=>u,gf:()=>h,jV:()=>o,lF:()=>f});var r=i(92602),a=i(70333),s=i(4718),n=i(84952),l=i(926);function o(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function u(e){return"string"==typeof e?(0,n.An)(e):(0,s.o8)(e)}function f(e,t,i){let r={};for(let a in e){if("declaredClass"===a)continue;let s=e[a];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))r[a]=s.map(e=>f(e));else if("object"==typeof s)if(s.toJSON){let e=s.toJSON(i?.[a]);r[a]=t?e:JSON.stringify(e)}else r[a]=t?s:JSON.stringify(s);else r[a]=s}return r}async function h(e,t,s){return function(e,t){return e?t&&(0,l.Qc)(e)?t:(0,l.getApiKey)(e)??a.id?.findCredential(e)?.token:null}(e,t)||(!a.id&&r.A.request.useIdentity&&await Promise.all([i.e(8673),i.e(7956),i.e(3713)]).then(()=>i(50148)),(await a.id.getCredential(e,s))?.token)}},24212(e,t,i){i.d(t,{$7:()=>o,B:()=>l,M7:()=>h,XF:()=>f,tW:()=>u,w7:()=>n});var r=i(56512),a=i(86211),s=i(16271);function n(e,t){return function(e,t){return t?.mode?t.mode:function(e){return e?c:p}(e).mode}(null==e||(e.hasZ??!1),t)}function l(e,t,i){return i&&i.mode!==t?`${e} only support ${t} elevation mode`:null}function o(e,t,i){return i?.mode===t?`${e} do not support ${t} elevation mode`:null}function u(e,t){return null!=t?.featureExpressionInfo&&"0"!==t.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function f(e,t){t&&e.warn(".elevationInfo=",t)}function h(e){return(e?.offset??0)*(0,s.Ao)(e?.unit)}(0,r.B)((e,t,i)=>{if(!e||"decimal-degrees"===t)return 0;let r="unknown"!==t&&t?t:"meters",s=(0,a.mq)(i);return s?(0,a.oU)(e,r,s):0});const c={mode:"absolute-height",offset:0},p={mode:"on-the-ground",offset:null}}}]);