@arcgis/core 4.33.0-next.20250212 → 4.33.0-next.20250214

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 (290) hide show
  1. package/arcade/arcadeAsyncRuntime.js +1 -1
  2. package/arcade/arcadeCompiler.js +1 -1
  3. package/arcade/arcadeEnvironment.js +1 -1
  4. package/arcade/arcadeRuntime.js +1 -1
  5. package/arcade/featureSetUtils.js +1 -1
  6. package/arcade/featureset/actions/GroupBy.js +1 -1
  7. package/arcade/featureset/actions/OrderBy.js +1 -1
  8. package/arcade/functions/date.js +1 -1
  9. package/arcade/functions/feature.js +1 -1
  10. package/arcade/functions/featuresetbase.js +1 -1
  11. package/arcade/functions/featuresetgeom.js +1 -1
  12. package/arcade/functions/featuresetstats.js +1 -1
  13. package/arcade/functions/featuresetstring.js +1 -1
  14. package/arcade/functions/fieldStats.js +1 -1
  15. package/arcade/functions/geomasync.js +1 -1
  16. package/arcade/functions/geometry.js +1 -1
  17. package/arcade/functions/geomsync.js +1 -1
  18. package/arcade/functions/knowledgegraph.js +1 -1
  19. package/arcade/functions/maths.js +1 -1
  20. package/arcade/functions/string.js +1 -1
  21. package/arcade/geometry/functions.js +1 -1
  22. package/arcade/languageUtils.js +1 -1
  23. package/arcade.js +1 -1
  24. package/assets/esri/core/workers/RemoteClient.js +1 -1
  25. package/assets/esri/core/workers/chunks/01f8f52a3f9e6fb72f64.js +1 -0
  26. package/assets/esri/core/workers/chunks/{8191dd3d7451b2e7b95e.js → 041eebac192855fbf919.js} +1 -1
  27. package/assets/esri/core/workers/chunks/09cbf45dc7b026957d3e.js +1 -0
  28. package/assets/esri/core/workers/chunks/{1a286d43daa3b811c30d.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  29. package/assets/esri/core/workers/chunks/197dc75a1c10c0fbf65a.js +1 -0
  30. package/assets/esri/core/workers/chunks/219b06cca6aa1e041f40.js +1 -0
  31. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +1 -0
  32. package/assets/esri/core/workers/chunks/{efded84870064c3d8210.js → 23a045fccc005079bd58.js} +1 -1
  33. package/assets/esri/core/workers/chunks/2dc35c1c5d83174a2c06.js +1 -0
  34. package/assets/esri/core/workers/chunks/{e4651d577d297386268e.js → 32035bc69ee18b19623d.js} +1 -1
  35. package/assets/esri/core/workers/chunks/32fee5446ee0b0a6c4bd.js +1 -0
  36. package/assets/esri/core/workers/chunks/{f429d95eb986f3d215f3.js → 391c200274bbeb92404c.js} +1 -1
  37. package/assets/esri/core/workers/chunks/39c595734a9e9cd67e41.js +1 -0
  38. package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +1 -0
  39. package/assets/esri/core/workers/chunks/3eacb4d1275f2d87825f.js +1 -0
  40. package/assets/esri/core/workers/chunks/{c0af54cc5938176ce764.js → 3fe7be535affae31de7e.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{c061cad8323f0469e7e4.js → 42f21349f488a14198e4.js} +1 -1
  42. package/assets/esri/core/workers/chunks/48eb5cbb4555acc56984.js +1 -0
  43. package/assets/esri/core/workers/chunks/4927b33f7e9daf059765.js +1 -0
  44. package/assets/esri/core/workers/chunks/50bab11c32bf4001edd7.js +1 -0
  45. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +1 -0
  46. package/assets/esri/core/workers/chunks/5c9a7b1dedd146cc65d2.js +1 -0
  47. package/assets/esri/core/workers/chunks/5d8120c84e5a164cb1bc.js +1 -0
  48. package/assets/esri/core/workers/chunks/{7a9e1696dc6120df15b0.js → 60ca6a2e9f1e2c969aab.js} +1 -1
  49. package/assets/esri/core/workers/chunks/679cc23be07ededb3992.js +1 -0
  50. package/assets/esri/core/workers/chunks/{9f122278e917c9ce5f95.js → 67c1e2c17ea3ca27248c.js} +1 -1
  51. package/assets/esri/core/workers/chunks/69b55259f90e8e4bc2aa.js +1 -0
  52. package/assets/esri/core/workers/chunks/69e0ff74e44962d97049.js +1 -0
  53. package/assets/esri/core/workers/chunks/6c64ccf5f64b5025b239.js +1 -0
  54. package/assets/esri/core/workers/chunks/6ca4b5d1a076c6079472.js +1 -0
  55. package/assets/esri/core/workers/chunks/{7058001bf66f9f3d5d45.js → 6d02d66234a7b74e5c14.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{77bfd4f819096cb754ae.js → 6e92569a4a82592b95dc.js} +1 -1
  57. package/assets/esri/core/workers/chunks/6f007703662e714b2f0a.js +1 -0
  58. package/assets/esri/core/workers/chunks/744bdf2bb0cc38e6a7b1.js +1 -0
  59. package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +1 -0
  60. package/assets/esri/core/workers/chunks/{8b6580329e1e35ea4190.js → 7c03489438f51a5170f3.js} +1 -1
  61. package/assets/esri/core/workers/chunks/7e77e4288ed205128b87.js +1 -0
  62. package/assets/esri/core/workers/chunks/80c3e933b43ea79b30de.js +1 -0
  63. package/assets/esri/core/workers/chunks/830844f7fb7557d30f34.js +1 -0
  64. package/assets/esri/core/workers/chunks/8a66d06132c8803033c9.js +1 -0
  65. package/assets/esri/core/workers/chunks/{e9993d4f2bfdc434fbcc.js → 8f4bcca8b0525e19374f.js} +1 -1
  66. package/assets/esri/core/workers/chunks/95047f145ebda65c3d8e.js +1 -0
  67. package/assets/esri/core/workers/chunks/9968c6654d048c9add0c.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b50176897ffadc53573e.js → 9bbfa8dc4124b5273d28.js} +1 -1
  69. package/assets/esri/core/workers/chunks/9be12d0df67e2c4c3787.js +1 -0
  70. package/assets/esri/core/workers/chunks/a2b548fbfa2eb5e6f2a7.js +1 -0
  71. package/assets/esri/core/workers/chunks/a37825705e49b60e5d4b.js +1 -0
  72. package/assets/esri/core/workers/chunks/a80c3ada9e09b8832e9b.js +1 -0
  73. package/assets/esri/core/workers/chunks/a8457210711b663059f0.js +1 -0
  74. package/assets/esri/core/workers/chunks/aebbaa7ab7a6b3b1579c.js +314 -0
  75. package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +1 -0
  76. package/assets/esri/core/workers/chunks/{a39977478a6c57d2e8fb.js → bd2dcc55ac3418421ee5.js} +1 -1
  77. package/assets/esri/core/workers/chunks/{83fe9a8002a4fc96e534.js → bd38717780fffa49d36c.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{c77ade444aa2f3f2b599.js → bdc9dec6a359d2e3705c.js} +1 -1
  79. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +1 -0
  80. package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +1 -0
  81. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +1 -0
  82. package/assets/esri/core/workers/chunks/{8d8f5f08d730270e1165.js → cb9a27176bd5de2c34ca.js} +1 -1
  83. package/assets/esri/core/workers/chunks/cbba0b6bd41d16eacb5c.js +1 -0
  84. package/assets/esri/core/workers/chunks/cdf942020b7054628dc9.js +1 -0
  85. package/assets/esri/core/workers/chunks/d6c3df07cfaa6bb639e9.js +1 -0
  86. package/assets/esri/core/workers/chunks/ea4c7560e64335f155f9.js +1 -0
  87. package/assets/esri/core/workers/chunks/eac791e3a0bb056a28f3.js +1 -0
  88. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +1 -0
  89. package/assets/esri/core/workers/chunks/ee5b82873ff80cb4ba34.js +1 -0
  90. package/assets/esri/core/workers/chunks/{08980b1ad3d5d67c6390.js → f419aaf3bab086060894.js} +1 -1
  91. package/assets/esri/core/workers/chunks/{d0656e9d30eb3a66a8db.js → f976233ad5e5b718ba83.js} +1 -1
  92. package/assets/esri/themes/base/widgets/_Directions.scss +30 -9
  93. package/assets/esri/themes/base/widgets/_Editor.scss +1 -0
  94. package/assets/esri/themes/dark/main.css +1 -1
  95. package/assets/esri/themes/light/main.css +1 -1
  96. package/assets/esri/themes/light/view.css +1 -1
  97. package/chunks/ComponentShader.glsl.js +6 -6
  98. package/chunks/arcade.js +1 -1
  99. package/chunks/array.js +1 -1
  100. package/chunks/languageUtils.js +1 -1
  101. package/copyright.txt +26 -19
  102. package/core/colorUtils.js +1 -1
  103. package/core/deprecate.js +1 -1
  104. package/core/libs/gl-matrix-2/factories/mat2df32.js +1 -1
  105. package/core/libs/gl-matrix-2/factories/mat2df64.js +1 -1
  106. package/core/libs/gl-matrix-2/factories/mat2f32.js +1 -1
  107. package/core/libs/gl-matrix-2/factories/mat2f64.js +1 -1
  108. package/core/libs/gl-matrix-2/factories/mat3f32.js +1 -1
  109. package/core/libs/gl-matrix-2/factories/mat3f64.js +1 -1
  110. package/core/libs/gl-matrix-2/factories/mat4f32.js +1 -1
  111. package/core/libs/gl-matrix-2/factories/mat4f64.js +1 -1
  112. package/core/libs/gl-matrix-2/factories/quat2f64.js +1 -1
  113. package/core/libs/gl-matrix-2/factories/vec2f32.js +1 -1
  114. package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
  115. package/core/libs/gl-matrix-2/factories/vec3f32.js +1 -1
  116. package/core/libs/gl-matrix-2/factories/vec3f64.js +1 -1
  117. package/core/libs/gl-matrix-2/factories/vec4f32.js +1 -1
  118. package/core/libs/gl-matrix-2/factories/vec4f64.js +1 -1
  119. package/editing/templateUtils.js +1 -1
  120. package/geohash/geohashUtils.js +1 -1
  121. package/interfaces.d.ts +634 -129
  122. package/intl/locale.js +1 -1
  123. package/layers/FeatureLayer.js +1 -1
  124. package/layers/GeoJSONLayer.js +1 -1
  125. package/layers/ImageryTileLayer.js +1 -1
  126. package/layers/OGCFeatureLayer.js +1 -1
  127. package/layers/RouteLayer.js +1 -1
  128. package/layers/SubtypeGroupLayer.js +1 -1
  129. package/layers/WFSLayer.js +1 -1
  130. package/layers/graphics/data/queryUtils.js +1 -1
  131. package/layers/mixins/ArcGISImageService.js +1 -1
  132. package/layers/mixins/ImageryTileMixin.js +1 -1
  133. package/layers/mixins/TrackableLayer.d.ts +4 -0
  134. package/layers/save/imageryUtils.js +1 -1
  135. package/layers/support/ExportImageServiceParameters.js +1 -1
  136. package/layers/support/SubtypeSublayer.js +1 -1
  137. package/layers/support/TitleCreator.js +5 -0
  138. package/layers/support/TrackInfo.d.ts +4 -0
  139. package/layers/support/TrackInfo.js +1 -1
  140. package/layers/support/TrackPartInfo.d.ts +4 -0
  141. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  142. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  143. package/layers/support/rasterDatasets/datasetUtils.js +5 -0
  144. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  145. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  146. package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
  147. package/layers/support/rasterFunctions/creators/createLocalFunctions.js +1 -1
  148. package/layers/support/rasterFunctions/creators/createStatisticsFunctions.js +1 -1
  149. package/networks/UtilityNetwork.js +1 -1
  150. package/networks/support/networkFieldUtils.js +5 -0
  151. package/package.json +1 -1
  152. package/renderers/support/rasterRendererHelper.js +1 -1
  153. package/rest/query/executeForIds.js +1 -1
  154. package/rest/support/BinParametersBase.js +1 -1
  155. package/support/arcadeUtils.js +1 -1
  156. package/support/revision.js +1 -1
  157. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  158. package/symbols/cim/rasterizingUtils.js +1 -1
  159. package/symbols/support/previewCIMSymbol.js +1 -1
  160. package/symbols/support/previewSymbol2D.js +1 -1
  161. package/symbols/support/symbolUtils.js +1 -1
  162. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  163. package/views/2d/layers/RouteLayerView2D.js +1 -1
  164. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  165. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  166. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  167. package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
  168. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  169. package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
  170. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  171. package/views/3d/environment/EnvironmentManager.js +1 -1
  172. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  173. package/views/3d/environment/Fog.js +1 -1
  174. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  175. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  176. package/views/3d/layers/I3SMeshView3D.js +1 -1
  177. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  178. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  179. package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
  180. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  181. package/views/3d/layers/i3s/SymbologyInfo.js +5 -0
  182. package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
  183. package/views/3d/state/utils/navigationUtils.js +1 -1
  184. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  185. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  186. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +14 -14
  188. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  189. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  190. package/views/3d/webgl-engine/core/renderPasses/RenderPassIdentifier.js +5 -0
  191. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  193. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  194. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  195. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  196. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  197. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  198. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  199. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  200. package/views/SceneView.js +1 -1
  201. package/views/View.js +1 -1
  202. package/views/draw/DrawAction.js +1 -1
  203. package/views/layers/FeatureLayerView.js +1 -1
  204. package/views/layers/ImageryTileLayerView.js +1 -1
  205. package/views/support/RequiredFieldsOptions.js +5 -0
  206. package/views/webgl/Texture.js +1 -1
  207. package/widgets/BasemapGallery.js +1 -1
  208. package/widgets/BasemapToggle.js +1 -1
  209. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  210. package/widgets/BatchAttributeForm.js +1 -1
  211. package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
  212. package/widgets/Compass/CompassViewModel.js +1 -1
  213. package/widgets/DirectionalPad.js +1 -1
  214. package/widgets/Directions/DirectionsViewModel.js +1 -1
  215. package/widgets/Directions.js +1 -1
  216. package/widgets/Editor/AddAssociationWorkflow.js +1 -1
  217. package/widgets/Editor/EditorViewModel.js +1 -1
  218. package/widgets/Editor.js +1 -1
  219. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
  220. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  221. package/widgets/Fullscreen.js +1 -1
  222. package/widgets/Home.js +1 -1
  223. package/widgets/LayerList/LayerListItem.js +1 -1
  224. package/widgets/LayerList/ListItem.js +1 -1
  225. package/widgets/LayerList/support/layerListUtils.js +1 -1
  226. package/widgets/Legend/LegendViewModel.js +1 -1
  227. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  228. package/widgets/Legend.js +1 -1
  229. package/widgets/Locate.js +1 -1
  230. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  231. package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
  232. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  233. package/widgets/OrientedImageryViewer/constants.js +1 -1
  234. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  235. package/widgets/OrientedImageryViewer/symbols.js +1 -1
  236. package/widgets/OrientedImageryViewer.js +1 -1
  237. package/widgets/ScaleBar.js +1 -1
  238. package/widgets/Swipe.js +1 -1
  239. package/widgets/TableList/ListItem.js +1 -1
  240. package/widgets/TableList.js +1 -1
  241. package/widgets/Track.js +1 -1
  242. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  243. package/widgets/UtilityNetworkTrace.js +1 -1
  244. package/widgets/support/GoTo.js +1 -1
  245. package/widgets/support/goToUtils.js +5 -0
  246. package/assets/esri/core/workers/chunks/03f51ea011ffbcfb7c7d.js +0 -1
  247. package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +0 -1
  248. package/assets/esri/core/workers/chunks/1249fd2f83caeaefd8ce.js +0 -1
  249. package/assets/esri/core/workers/chunks/144e534d4ac1aafab60d.js +0 -1
  250. package/assets/esri/core/workers/chunks/177d4c2c10ef7369006f.js +0 -1
  251. package/assets/esri/core/workers/chunks/1d282700e76285a1684c.js +0 -1
  252. package/assets/esri/core/workers/chunks/35392bf8f21005ad6170.js +0 -1
  253. package/assets/esri/core/workers/chunks/37cfd102b6ab5b959f9d.js +0 -1
  254. package/assets/esri/core/workers/chunks/3ba85f1d660b8887f963.js +0 -314
  255. package/assets/esri/core/workers/chunks/3c8e5b5fb52611e30ed6.js +0 -1
  256. package/assets/esri/core/workers/chunks/5eceedac9b2b4d1ef133.js +0 -1
  257. package/assets/esri/core/workers/chunks/6a9a1cd8134a903dd05a.js +0 -1
  258. package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +0 -1
  259. package/assets/esri/core/workers/chunks/7485588bd24217669578.js +0 -1
  260. package/assets/esri/core/workers/chunks/74e0116ae84def626c87.js +0 -1
  261. package/assets/esri/core/workers/chunks/7e3b374f906441cd7fb0.js +0 -1
  262. package/assets/esri/core/workers/chunks/80d3aa3f27ad5b2b969b.js +0 -1
  263. package/assets/esri/core/workers/chunks/84c1c3336011a1b79669.js +0 -1
  264. package/assets/esri/core/workers/chunks/8939479cd433cc53f6c1.js +0 -1
  265. package/assets/esri/core/workers/chunks/8a2f3ce46eeac853b3a9.js +0 -1
  266. package/assets/esri/core/workers/chunks/8f31fbb1d549230ee3db.js +0 -1
  267. package/assets/esri/core/workers/chunks/91384398f01485631f70.js +0 -1
  268. package/assets/esri/core/workers/chunks/9421ae38fdf986b9b107.js +0 -1
  269. package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +0 -1
  270. package/assets/esri/core/workers/chunks/99c136b800e5fc7e04f4.js +0 -1
  271. package/assets/esri/core/workers/chunks/9b74635d80d029498da1.js +0 -1
  272. package/assets/esri/core/workers/chunks/9e7895e8201127ffe0a8.js +0 -1
  273. package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +0 -1
  274. package/assets/esri/core/workers/chunks/a6ec3665bde2af8a96e6.js +0 -1
  275. package/assets/esri/core/workers/chunks/a9274c9132e7a2691abb.js +0 -1
  276. package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +0 -1
  277. package/assets/esri/core/workers/chunks/bf0bf2b912d668575a9b.js +0 -1
  278. package/assets/esri/core/workers/chunks/ca6180e572e69540c183.js +0 -1
  279. package/assets/esri/core/workers/chunks/cccd215b0a4890551957.js +0 -1
  280. package/assets/esri/core/workers/chunks/d074c916b414432a7b6a.js +0 -1
  281. package/assets/esri/core/workers/chunks/d7b260d6187f29e0c136.js +0 -1
  282. package/assets/esri/core/workers/chunks/de638753a30c9aa41bad.js +0 -1
  283. package/assets/esri/core/workers/chunks/debfb75a94b66b58cbbc.js +0 -1
  284. package/assets/esri/core/workers/chunks/e490f70f192780d7ad50.js +0 -1
  285. package/assets/esri/core/workers/chunks/e6633f0326a44477f630.js +0 -1
  286. package/assets/esri/core/workers/chunks/e71b780d1e6a32f303b7.js +0 -1
  287. package/assets/esri/core/workers/chunks/eb0ce7937813d1be1284.js +0 -1
  288. package/assets/esri/core/workers/chunks/f285ed5425b31123d2bc.js +0 -1
  289. package/assets/esri/core/workers/chunks/f2cf05fbbb51d657d300.js +0 -1
  290. package/assets/esri/core/workers/chunks/f4ba823c8acd60c7c82d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../core/Error.js";import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as i}from"../../../core/unitUtils.js";import{canProjectWithoutEngine as r}from"../../../geometry/projection.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{fromJSON as a,isExtent as o,isPolygon as s,isPolyline as l}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as m}from"../../../geometry/support/normalizeUtils.js";import{equals as u,isGeographic as c,isWebMercator as p,wgs84 as f}from"../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as y,project as d}from"./projectionSupport.js";const g=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),S=Object.freeze({}),R="frequency";async function w(t,e,i){const r=t.bin;return r.onField&&(r.onField=r.onField.trim()),r.onExpression?.value&&(r.onExpression.value=r.onExpression.value.trim()),r.splitBy&&(r.splitBy.value&&(r.splitBy.value=r.splitBy.value.trim()),r.splitBy.outAlias&&(r.splitBy.outAlias=r.splitBy.outAlias.trim())),r.stackBy&&(r.stackBy.value&&(r.stackBy.value=r.stackBy.value.trim()),r.stackBy.outAlias&&(r.stackBy.outAlias=r.stackBy.outAlias.trim())),"normalizationField"in r.parameters&&r.parameters.normalizationField&&(r.parameters.normalizationField=r.parameters.normalizationField.trim()),t.outStatistics?.length||(t.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:R}]),x(t,e,i)}async function x(t,e,i){const{outFields:r,orderByFields:n,groupByFieldsForStatistics:a,outStatistics:o}=t;if(r)for(let s=0;s<r.length;s++)r[s]=r[s].trim();if(n)for(let s=0;s<n.length;s++)n[s]=n[s].trim();if(a)for(let s=0;s<a.length;s++)a[s]=a[s].trim();if(o)for(let s=0;s<o.length;s++)o[s].onStatisticField&&(o[s].onStatisticField=o[s].onStatisticField.trim());return t.geometry&&!t.outSR&&(t.outSR=t.geometry.spatialReference),B(t,e,i)}async function B(t,e,i){if(!t)return null;let{where:r}=t;if(t.where=r=r?.trim(),(!r||/^1 *= *1$/.test(r)||e&&e===r)&&(t.where=null),!t.geometry)return t;let o=await v(t);if(t.distance=0,t.units=null,"esriSpatialRelEnvelopeIntersects"===t.spatialRel){const{spatialReference:e}=t.geometry;o=n(o),o.spatialReference=e}if(o){await y(o.spatialReference,i),o=j(o,i);const e=(await m(a(o)))[0];if(null==e)throw S;const r="quantizationParameters"in t&&t.quantizationParameters?.tolerance||"maxAllowableOffset"in t&&t.maxAllowableOffset||0,n=r&&F(o,i)?{densificationStep:8*r}:void 0,s=e.toJSON(),l=d(s,s.spatialReference,i,n);if(!l)throw S;l.spatialReference=i,t.geometry=l}return t}function F(t,e){if(!t)return!1;const i=t.spatialReference;return(o(t)||s(t)||l(t))&&!u(i,e)&&!r(i,e)}function j(t,e){const i=t.spatialReference;return F(t,e)&&o(t)?{spatialReference:i,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:t}async function v(e){const{distance:r,units:n}=e,a=e.geometry;if(null==r||"vertexAttributes"in a)return a;const o=a.spatialReference,l=n?g.fromJSON(n):i(o),m=o&&(c(o)||p(o))?a:await y(o,f).then((()=>d(a,f))),u=await import("../../../geometry/operators/json/geodesicBufferOperator.js");await u.load();const S=u.execute(m,r,{unit:l})??void 0;if(!S||!s(S)||0===S.rings.length)throw new t("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return S}function h(t,e){return null==t?null:"string"==typeof t?e?new Date(`1970-01-01T${t}Z`).getTime():new Date(t).getTime():t instanceof Date?t.getTime():t}export{h as getDateInNumber,w as normalizeAttributeBinsQuery,x as normalizeQuery,B as normalizeQueryLike,S as queryEngineEmptyResult,g as unitsKebabDict};
5
+ import t from"../../../core/Error.js";import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as i}from"../../../core/unitUtils.js";import{canProjectWithoutEngine as r}from"../../../geometry/projection.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{fromJSON as a,isExtent as o,isPolygon as s,isPolyline as l}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as m}from"../../../geometry/support/normalizeUtils.js";import{equals as u,isGeographic as c,isWebMercator as p,wgs84 as f}from"../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as y,project as d}from"./projectionSupport.js";const g=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),S=Object.freeze({}),R="frequency";async function w(t,e,i){const r=t.bin;return r.onField&&(r.onField=r.onField.trim()),r.onExpression?.value&&(r.onExpression.value=r.onExpression.value.trim()),r.splitBy&&(r.splitBy.value&&(r.splitBy.value=r.splitBy.value.trim()),r.splitBy.outAlias&&(r.splitBy.outAlias=r.splitBy.outAlias.trim())),r.stackBy&&(r.stackBy.value&&(r.stackBy.value=r.stackBy.value.trim()),r.stackBy.outAlias&&(r.stackBy.outAlias=r.stackBy.outAlias.trim())),"normalizationField"in r.parameters&&r.parameters.normalizationField&&(r.parameters.normalizationField=r.parameters.normalizationField.trim()),t.outStatistics?.length||(t.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:R}]),x(t,e,i)}async function x(t,e,i){const{outFields:r,orderByFields:n,groupByFieldsForStatistics:a,outStatistics:o}=t;if(r)for(let s=0;s<r.length;s++)r[s]=r[s].trim();if(n)for(let s=0;s<n.length;s++)n[s]=n[s].trim();if(a)for(let s=0;s<a.length;s++)a[s]=a[s].trim();if(o)for(let s=0;s<o.length;s++)o[s].onStatisticField&&(o[s].onStatisticField=o[s].onStatisticField.trim());return t.geometry&&!t.outSR&&(t.outSR=t.geometry.spatialReference),B(t,e,i)}async function B(t,e,i){if(!t)return null;let{where:r}=t;if(t.where=r=r?.trim(),(!r||/^1 *= *1$/.test(r)||e&&e===r)&&(t.where=null),!t.geometry)return t;let o=await v(t);if(t.distance=0,t.units=null,"esriSpatialRelEnvelopeIntersects"===t.spatialRel){const{spatialReference:e}=t.geometry;o=n(o),o.spatialReference=e}if(o){await y(o.spatialReference,i),o=j(o,i);const e=(await m(a(o)))[0];if(null==e)throw S;const r="quantizationParameters"in t&&t.quantizationParameters?.tolerance||"maxAllowableOffset"in t&&t.maxAllowableOffset||0,n=r&&F(o,i)?{densificationStep:8*r}:void 0,s=e.toJSON(),l=d(s,s.spatialReference,i,n);if(!l)throw S;l.spatialReference=i,t.geometry=l}return t}function F(t,e){if(!t)return!1;const i=t.spatialReference;return(o(t)||s(t)||l(t))&&!u(i,e)&&!r(i,e)}function j(t,e){const i=t.spatialReference;return F(t,e)&&o(t)?{spatialReference:i,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:t}async function v(e){const{distance:r,units:n}=e,a=e.geometry;if(null==r||"vertexAttributes"in a)return a;const o=a.spatialReference,l=n?g.fromJSON(n):i(o),m=o&&(c(o)||p(o))?a:await y(o,f).then((()=>d(a,f))),u=await import("../../../geometry/operators/json/geodesicBufferOperator.js");await u.load();const S=u.execute(m,r||1,{unit:l})??void 0;if(!S||!s(S)||0===S.rings.length)throw new t("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return S}function h(t,e){return null==t?null:"string"==typeof t?e?new Date(`1970-01-01T${t}Z`).getTime():new Date(t).getTime():t instanceof Date?t.getTime():t}export{h as getDateInNumber,w as normalizeAttributeBinsQuery,x as normalizeQuery,B as normalizeQueryLike,S as queryEngineEmptyResult,g as unitsKebabDict};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import i from"../../request.js";import r from"../../core/Error.js";import{clone as s}from"../../core/lang.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{urlToObject as o}from"../../core/urlUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import{Integer as u,ensureClass as p,ensureRange as c,ensureNumber as m}from"../../core/accessorSupport/ensureType.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import g from"../../geometry/Polygon.js";import R from"../../geometry/SpatialReference.js";import{srToRESTValue as b}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as I}from"../support/commonProperties.js";import v from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as S}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import x from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import O from"../support/MultidimensionalSubset.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as N,pixelTypeKebabDict as P}from"../support/rasterEnums.js";import{getServicePixelValueField as j,getItemPixelValueField as q,getRawServicePixelValueField as E,getProcessedServicePixelValueField as J,getMagnitudeField as A,getDirectionField as V,getMultidimensionalFields as Q,getRasterAttributeTableFields as H,commonRasterFieldNames as U,addMultidimensionalFieldValues as B,rasterFieldPrefix as L}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import G from"../support/RasterInfo.js";import k from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as ee}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as te,matchPresetRenderer as ie,getDefaultBandCombination as re,createDefaultRenderer as se,normalizeRendererJSON as ne}from"../../renderers/support/rasterRendererHelper.js";import ae from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as oe,websceneRasterRendererTypes as le,read as ue}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as pe,computeAngles as ce,computePixelSpaceLocations as me,computeHistograms as he,computeStatisticsHistograms as de,measureHeight as fe,measureAreaAndPerimeter as ye,measureDistanceAndAngle as ge,measurePointOrCentroid as Re,measureLengthFromImage as be,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as Ie,getSamples as ve,identify as Se,imageToMap as _e,imageToMapMultiray as xe,mapToImage as Fe,findImages as De,getImageUrl as Te,queryBoundary as Oe,queryGPSInfo as Ce}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Me,generateRasterInfo as Ne,patchServiceInfo as Pe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as je}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as qe}from"../../rest/query/executeForCount.js";import{executeForIds as Ee}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Je}from"../../rest/query/executeQueryJSON.js";import Ae from"../../rest/support/FeatureSet.js";import Ve from"../../rest/support/ImageIdentifyParameters.js";import Qe from"../../rest/support/Query.js";import{createFlowMesh as He}from"../../views/2d/engine/flow/dataUtils.js";const Ue=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Be=c(m,{min:0,max:255});function Le(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map((e=>i?e.slice(8,-18):e.slice(18,-1)));return s?s.join("/"):null}const ze=c=>{let m=class extends c{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new S({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new x(this.fields):null}set format(e){e&&Ue.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new T({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Be(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i?.name}return e}get parsedUrl(){return o(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find((({name:t})=>t===e));return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=ue(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),D(s)||n.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map((e=>e.clone()))??[];e.push(j()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(q()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((({name:e})=>"none"===e.toLowerCase()))&&e.push(E()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((({name:e})=>"none"!==e.toLowerCase())).forEach((({name:t})=>e.push(J(t))));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=A(i),s=V();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=Q(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=H(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?R.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=P.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:a}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),o=this._rasterJobHandler.instance;if(o){n&&(s.bind(),await o.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await o.symbolize({bandIds:a,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:a,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=s(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),pe(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return me(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),he(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new r("imagery-layer:measure-height","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ye(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),Re(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new r("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return be(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new r("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,s={}){if(null==e||null==t||null==i)throw new r("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:s.signal});e&&(this.rasterInfo=e)}const n=this.getExportImageServiceParameters(e,t,i,s.timeExtent);if(null==n){if(s.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,s.returnImageBitmap){return{imageBitmap:await F(e,`${ze(this.parsedUrl)}/exportImage`,s.signal)}}return{imageOrCanvasElement:e}}const{bandIds:r,rasterInfo:n}=this,a=(r?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(C.createEmptyBand(l,o));return{pixelData:{pixelBlock:new C({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const a=!!s.requestAsImageElement&&!this.pixelFilter,o=a&&!!s.returnImageBitmap,l={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:a,returnImageBitmap:o,signal:s.signal};return this._requestArrayBuffer(l)}fetchKeyProperties(e){return i(ze(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(ze(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>Ae.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return je(ze(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(ze(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(ze(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(ze(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:b(o),outSR:"0:"+e},u=i(ze(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(n.xmin+n.xmax)/2,m=(n.ymax-n.ymin)/(p+1),h=n.ymin+m,d=[];for(let i=0;i<p;i++)d.push({x:c,y:h+m*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:b(o),outSR:"0:"+e},g=i(ze(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),w=await Promise.all([a,u,g]);let I=w[0].ipxf;if(null==I){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(I={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=y.fromJSON(w[1]?.geometries?.[0]);v&&(v.spatialReference=new R({wkid:0,imageCoordinateSystem:s}));const S=w[2].geometries?w[2].geometries.filter((e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],_=S.length;if(_<3)return{ics:s,icsToPixelTransform:I,icsExtent:v,northDirection:null};let x=0,F=0,D=0,T=0;for(let i=0;i<_;i++)x+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,T+=S[i].x*S[i].y;const O=(_*T-x*F)/(_*D-x*x);let C=0;const M=S[p-1].x>S[0].x,N=S[p-1].y>S[0].y;return O===1/0?C=N?90:270:0===O?C=M?0:180:O>0?C=M?180*Math.atan(O)/Math.PI:180*Math.atan(O)/Math.PI+180:O<0&&(C=N?180+180*Math.atan(O)/Math.PI:360+180*Math.atan(O)/Math.PI),{ics:s,icsToPixelTransform:I,icsExtent:v,northDirection:C}}async generateRasterInfo(e,t){e=p(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Me(ze(this.parsedUrl),this.sourceJSON,i);const s=Le(e);if(!s)throw new r("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=Ne(ze(this.parsedUrl),e,i);this._functionRasterInfos[s]=n;try{return await n}catch(a){throw this._functionRasterInfos[s]=null,a}}getExportImageServiceParameters(e,t,i,r){e=e.clone().shiftCentralMeridian();const s=Ie(e.spatialReference,ze(this.parsedUrl)),n=this.exportImageServiceParameters.toJSON(),{bandIds:a,noData:o}=n;let{renderingRule:l}=n;const u=this.rasterFunction?.rasterFunctionDefinition,p=this.renderer?.type,c=!p||"raster-stretch"===p||"raster-colormap"===p||"unique-value"===p||"class-breaks"===p||"raster-shaded-relief"===p;if(a?.length&&this._hasRasterFunction(this.rasterFunction)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:a}};if("Stretch"===l.rasterFunction)e.rasterFunctionArguments.Raster=l.rasterFunctionArguments.Raster,l.rasterFunctionArguments.Raster=e;else if("Colormap"===l.rasterFunction){const t=l.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,l.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=l,l=e;n.bandIds=void 0}else n.bandIds=a?.join(",");Array.isArray(o)&&o.length>0&&(n.noData=o.join(","));const m=this._processMultidimensionalIntersection(null,r,this.exportImageServiceParameters.mosaicRule);if(m.isOutSide)return null;n.mosaicRule=null!=m.mosaicRule?JSON.stringify(m.mosaicRule):null,r=m.timeExtent,n.renderingRule=this._getRenderingRuleString(z.fromJSON(l));const h={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?h.time=""+e:null==e&&null==t||(h.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+i,...n,...h}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new r("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=s(e);const{raster:n}=this;return n&&null==e.raster&&(e.raster=n),ve(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r("imagery-layer:identify","identify operation is not supported on the input image service");e=s(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=g.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new r("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:n,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),n&&null==e.raster&&(e.raster=n),Se(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(ze(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return xe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return Fe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r("imagery-layer:find-images","findImages operation is not supported on the input image service");return De(ze(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(ze(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Qe({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Oe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Je(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Ce(ze(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),qe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:s,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=U.servicePixelValue.toLowerCase(),c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().startsWith(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().startsWith(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new z({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some((e=>e.functionName===i.functionName))&&(l.push(i),u.push(i.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=W(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=g.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:n?1:null});delete R.f;const b=new Ve(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await Se(this.url,b,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!m&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p});const c=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],y=h.map((e=>e.attributes?.[c])),g=new Qe({objectIds:y,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[c]}),R=await this.queryRasters(g);return R?.features?.length&&R.features.forEach((t=>{h.forEach((i=>{i.attributes[c]===t.attributes[c]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p})}catch{throw new r("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(ze(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),s=i(ze(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([r,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:n[0]||null,histograms:n[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):He(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Me(ze(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Pe(e,t),e))),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),n.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([a((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],c=this.version>=10.8;if(a.length)a.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new v({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?p(Qe,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new k;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&te(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(ze(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new r("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=ie({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??re(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??se(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ne(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new ae({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(ze(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:n,signal:a}=e;if(s&&this._canRequestImageElement(t.format)){const r=`${ze(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await F(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(ze(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Z(u)),!c)throw new r("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?Y(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&!m){const e={};e[c]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&B(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),m&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=U,y=this.rasterFields.some((e=>e.name===d));for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;y&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${U.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).find((e=>"value"===e.toLowerCase()));if(!n)return;const a=r.filter((e=>e.attributes[n]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=L+t.name;e.attributes[i]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map((e=>parseFloat(e))),r=i.map((e=>[e])),s=i.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new C({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:ee([n.pixels[0][0],n.pixels[1][0]]);e.attributes[U.magnitude]=a[0],e.attributes[U.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find((e=>e.code===i));r&&(e.attributes[t.name]=r.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach((e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:i,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!(!e.spatialReference&&!e.extent?.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&o,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),h=t.includes("download"),d=i>=10.7&&a||i>=11.4&&(a||u&&p.includes("3d"));return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&h,supportsMeasure:u,supportsMeasureFromImage:i>=11.2,supportsDownload:h,supportsQuery:m&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:d,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsCurrentUser:!1,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function ze(e){return e?.path??""}return e([l({clonable:!1})],m.prototype,"_functionRasterInfos",void 0),e([l({clonable:!1})],m.prototype,"_rasterJobHandler",void 0),e([l({clonable:!1})],m.prototype,"_cachedRendererJson",void 0),e([l({readOnly:!0})],m.prototype,"_serviceSupportsMosaicRule",void 0),e([h("_serviceSupportsMosaicRule",["currentVersion","fields"])],m.prototype,"readServiceSupportsMosaicRule",null),e([l({readOnly:!0})],m.prototype,"_rasterFunctionNamesIndex",null),e([l()],m.prototype,"adjustAspectRatio",void 0),e([l({type:[u],json:{write:!0}})],m.prototype,"bandIds",void 0),e([h("bandIds")],m.prototype,"readBandIds",null),e([l({readOnly:!0,json:{read:!1}})],m.prototype,"capabilities",void 0),e([h("service","capabilities",["capabilities","currentVersion","serviceDataType"])],m.prototype,"readCapabilities",null),e([l({type:Number})],m.prototype,"compressionQuality",void 0),e([f("compressionQuality")],m.prototype,"writeCompressionQuality",null),e([l({type:Number})],m.prototype,"compressionTolerance",void 0),e([f("compressionTolerance")],m.prototype,"writeCompressionTolerance",null),e([l({json:{read:{source:"copyrightText"}}})],m.prototype,"copyright",void 0),e([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],m.prototype,"defaultMosaicRule",void 0),e([h("defaultMosaicRule",["defaultMosaicMethod"])],m.prototype,"readDefaultMosaicRule",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],m.prototype,"definitionExpression",void 0),e([l({readOnly:!0,constructOnly:!0})],m.prototype,"exportImageServiceParameters",void 0),e([l()],m.prototype,"rasterInfo",void 0),e([l({readOnly:!0,type:[_]})],m.prototype,"fields",void 0),e([l({readOnly:!0})],m.prototype,"fieldsIndex",null),e([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],m.prototype,"format",null),e([h("service","format",["serviceDataType"])],m.prototype,"readFormat",null),e([l({type:y})],m.prototype,"fullExtent",void 0),e([l({readOnly:!0})],m.prototype,"hasMultidimensions",void 0),e([l({json:{read:{source:"maxImageHeight"}}})],m.prototype,"imageMaxHeight",void 0),e([l({json:{read:{source:"maxImageWidth"}}})],m.prototype,"imageMaxWidth",void 0),e([l({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],m.prototype,"interpolation",void 0),e([l()],m.prototype,"minScale",void 0),e([h("service","minScale")],m.prototype,"readMinScale",null),e([l()],m.prototype,"maxScale",void 0),e([h("service","maxScale")],m.prototype,"readMaxScale",null),e([l({type:T})],m.prototype,"mosaicRule",null),e([h("mosaicRule",["mosaicRule","defaultMosaicMethod"])],m.prototype,"readMosaicRule",null),e([f("mosaicRule")],m.prototype,"writeMosaicRule",null),e([l()],m.prototype,"multidimensionalInfo",void 0),e([l({type:O,json:{write:!0}})],m.prototype,"multidimensionalSubset",void 0),e([l({json:{type:u}})],m.prototype,"noData",void 0),e([f("noData")],m.prototype,"writeNoData",null),e([l({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],m.prototype,"noDataInterpretation",void 0),e([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],m.prototype,"objectIdField",void 0),e([h("objectIdField")],m.prototype,"readObjectIdField",null),e([l({readOnly:!0})],m.prototype,"geometryType",void 0),e([l({})],m.prototype,"typeIdField",void 0),e([l({})],m.prototype,"types",void 0),e([l({readOnly:!0})],m.prototype,"parsedUrl",null),e([l({type:Function})],m.prototype,"pixelFilter",void 0),e([l()],m.prototype,"raster",void 0),e([l({readOnly:!0})],m.prototype,"sourceType",void 0),e([h("sourceType",["serviceSourceType","fields"])],m.prototype,"readSourceType",null),e([l()],m.prototype,"viewId",void 0),e([l()],m.prototype,"renderer",null),e([l({types:oe,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],m.prototype,"internalRenderer",null),e([h("internalRenderer")],m.prototype,"readRenderer",null),e([f("internalRenderer")],m.prototype,"writeRenderer",null),e([l({clonable:!1})],m.prototype,"symbolizer",void 0),e([l(w)],m.prototype,"opacity",void 0),e([l({readOnly:!0})],m.prototype,"rasterFields",null),e([l({constructOnly:!0})],m.prototype,"rasterFunctionInfos",void 0),e([l({type:z,json:{name:"renderingRule"}})],m.prototype,"rasterFunction",null),e([h("rasterFunction",["renderingRule","rasterFunctionInfos"])],m.prototype,"readRasterFunction",null),e([l({readOnly:!0})],m.prototype,"serviceDataType",void 0),e([l({readOnly:!0,type:R})],m.prototype,"spatialReference",void 0),e([h("spatialReference",["spatialReference","extent"])],m.prototype,"readSpatialReference",null),e([l({type:P.apiValues,json:{read:P.read,type:P.jsonValues}})],m.prototype,"pixelType",void 0),e([f("pixelType")],m.prototype,"writePixelType",null),e([l({constructOnly:!0,type:G})],m.prototype,"serviceRasterInfo",void 0),e([l()],m.prototype,"sourceJSON",void 0),e([l(I)],m.prototype,"url",void 0),e([l({readOnly:!0})],m.prototype,"version",void 0),e([h("version",["currentVersion","fields","timeInfo"])],m.prototype,"readVersion",null),m=e([d("esri.layers.mixins.ArcGISImageService")],m),m};export{ze as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import i from"../../request.js";import r from"../../core/Error.js";import{clone as s}from"../../core/lang.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{urlToObject as o}from"../../core/urlUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import{Integer as u,ensureClass as p,ensureRange as c,ensureNumber as m}from"../../core/accessorSupport/ensureType.js";import{reader as d}from"../../core/accessorSupport/decorators/reader.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import y from"../../geometry/Extent.js";import g from"../../geometry/Polygon.js";import R from"../../geometry/SpatialReference.js";import{srToRESTValue as b}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as w,url as I}from"../support/commonProperties.js";import v from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as S}from"../support/ExportImageServiceParameters.js";import _ from"../support/Field.js";import x from"../support/FieldsIndex.js";import{createBitmap as F}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as D}from"../support/imageryRendererUtils.js";import T from"../support/MosaicRule.js";import O from"../support/MultidimensionalSubset.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as N,pixelTypeKebabDict as P}from"../support/rasterEnums.js";import{getServicePixelValueField as q,getItemPixelValueField as j,getRawServicePixelValueField as E,getProcessedServicePixelValueField as A,getMagnitudeField as J,getDirectionField as V,getMultidimensionalFields as Q,getRasterAttributeTableFields as H,commonRasterFieldNames as U,addMultidimensionalFieldValues as B,rasterFieldPrefix as L}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import G from"../support/RasterInfo.js";import k from"../support/RasterJobHandler.js";import{intersectMultimensionalSubset as W,getEffectiveMultidimensionalDefinition as $,getSubsetVariablesFromMdInfo as X,getDefaultMultidimensionalDefinition as K}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as Y,getFormat as Z}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as ee}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as te,matchPresetRenderer as ie,getDefaultBandCombination as re,createDefaultRenderer as se,normalizeRendererJSON as ne}from"../../renderers/support/rasterRendererHelper.js";import ae from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as oe,websceneRasterRendererTypes as le,read as ue}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as pe,computeAngles as ce,computePixelSpaceLocations as me,computeHistograms as de,computeStatisticsHistograms as he,measureHeight as fe,measureAreaAndPerimeter as ye,measureDistanceAndAngle as ge,measurePointOrCentroid as Re,measureLengthFromImage as be,measureAreaFromImage as we,getImageSpatialReferenceQueryParameter as Ie,getSamples as ve,identify as Se,imageToMap as _e,imageToMapMultiray as xe,mapToImage as Fe,findImages as De,getImageUrl as Te,queryBoundary as Oe,queryGPSInfo as Ce}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Me,generateRasterInfo as Ne,patchServiceInfo as Pe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as qe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as je}from"../../rest/query/executeForCount.js";import{executeForIds as Ee}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ae}from"../../rest/query/executeQueryJSON.js";import Je from"../../rest/support/FeatureSet.js";import Ve from"../../rest/support/ImageIdentifyParameters.js";import Qe from"../../rest/support/Query.js";import{createFlowMesh as He}from"../../views/2d/engine/flow/dataUtils.js";const Ue=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Be=c(m,{min:0,max:255});function Le(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map((e=>i?e.slice(8,-18):e.slice(18,-1)));return s?s.join("/"):null}const ze=c=>{let m=class extends c{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._cachedRendererJson=null,this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new S({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)})),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every((e=>"number"==typeof e)))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?T.fromJSON(t):null}get fieldsIndex(){return this.fields?new x(this.fields):null}set format(e){e&&Ue.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=T.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?T.fromJSON(i):this._isMosaicRuleSupported(t)?T.fromJSON(t):null}writeMosaicRule(e,t,i){let r=this.mosaicRule;const s=this.definitionExpression;r?s&&s!==r.where&&(r=r.clone(),r.where=s):s&&(r=new T({where:s})),this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Be(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=i?.name}return e}get parsedUrl(){return o(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find((({name:t})=>t===e));return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=ue(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),D(s)||n.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map((e=>e.clone()))??[];e.push(q()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(j()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some((({name:e})=>"none"===e.toLowerCase()))&&e.push(E()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter((({name:e})=>"none"!==e.toLowerCase())).forEach((({name:t})=>e.push(A(t))));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=J(i),s=V();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=Q(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=H(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?R.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=P.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e;const{renderer:r,symbolizer:s,pixelFilter:n,bandIds:a}=this;if(!this._isPicture()&&r&&s&&!n){const n=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(r.toJSON()),o=this._rasterJobHandler.instance;if(o){n&&(s.bind(),await o.updateSymbolizer(s,t),this._cachedRendererJson=r.toJSON());const l=await o.symbolize({bandIds:a,...e},t);i={extent:e.extent,pixelBlock:l}}else i={extent:e.extent,pixelBlock:s.symbolize({bandIds:a,...e})}}return i}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=s(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),pe(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r("imagery-layer:compute-angles","this operation is not supported on the input image service");return ce(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return me(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),de(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),he(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new r("imagery-layer:measure-height","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ye(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),Re(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new r("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return be(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new r("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return we(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async fetchImage(e,t,i,s={}){if(null==e||null==t||null==i)throw new r("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");if(this.renderer||this.symbolizer){const e=await this._generateRasterInfo(this.rasterFunction,{signal:s.signal});e&&(this.rasterInfo=e)}const n=this.getExportImageServiceParameters(e,t,i,s.timeExtent);if(null==n){if(s.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,s.returnImageBitmap){return{imageBitmap:await F(e,`${ze(this.parsedUrl)}/exportImage`,s.signal)}}return{imageOrCanvasElement:e}}const{bandIds:r,rasterInfo:n}=this,a=(r?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(C.createEmptyBand(l,o));return{pixelData:{pixelBlock:new C({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const a=!!s.requestAsImageElement&&!this.pixelFilter,o=a&&!!s.returnImageBitmap,l={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:a,returnImageBitmap:o,signal:s.signal};return this._requestArrayBuffer(l)}async fetchPixels(e,t,i,r={}){await this._initJobHandler();const s=new S({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(ze(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(ze(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then((e=>Je.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return qe(ze(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(ze(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(ze(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(ze(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:b(o),outSR:"0:"+e},u=i(ze(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(n.xmin+n.xmax)/2,m=(n.ymax-n.ymin)/(p+1),d=n.ymin+m,h=[];for(let i=0;i<p;i++)h.push({x:c,y:d+m*i});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:b(o),outSR:"0:"+e},g=i(ze(this.parsedUrl)+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),w=await Promise.all([a,u,g]);let I=w[0].ipxf;if(null==I){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(I={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=y.fromJSON(w[1]?.geometries?.[0]);v&&(v.spatialReference=new R({wkid:0,imageCoordinateSystem:s}));const S=w[2].geometries?w[2].geometries.filter((e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],_=S.length;if(_<3)return{ics:s,icsToPixelTransform:I,icsExtent:v,northDirection:null};let x=0,F=0,D=0,T=0;for(let i=0;i<_;i++)x+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,T+=S[i].x*S[i].y;const O=(_*T-x*F)/(_*D-x*x);let C=0;const M=S[p-1].x>S[0].x,N=S[p-1].y>S[0].y;return O===1/0?C=N?90:270:0===O?C=M?0:180:O>0?C=M?180*Math.atan(O)/Math.PI:180*Math.atan(O)/Math.PI+180:O<0&&(C=N?180+180*Math.atan(O)/Math.PI:360+180*Math.atan(O)/Math.PI),{ics:s,icsToPixelTransform:I,icsExtent:v,northDirection:C}}async generateRasterInfo(e,t){e=p(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Me(ze(this.parsedUrl),this.sourceJSON,i);const s=Le(e);if(!s)throw new r("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=Ne(ze(this.parsedUrl),e,i);this._functionRasterInfos[s]=n;try{return await n}catch(a){throw this._functionRasterInfos[s]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=Ie(e.spatialReference,ze(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,c=this.renderer?.type,m=!c||"raster-stretch"===c||"raster-colormap"===c||"unique-value"===c||"class-breaks"===c||"raster-shaded-relief"===c;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&m){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const d=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(d.isOutSide)return null;a.mosaicRule=null!=d.mosaicRule?JSON.stringify(d.mosaicRule):null,r=d.timeExtent,a.renderingRule=this._getRenderingRuleString(z.fromJSON(u));const h={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?h.time=""+e:null==e&&null==t||(h.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...h}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new r("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=s(e);const{raster:n}=this;return n&&null==e.raster&&(e.raster=n),ve(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r("imagery-layer:identify","identify operation is not supported on the input image service");e=s(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=g.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new r("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:n,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),n&&null==e.raster&&(e.raster=n),Se(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return _e(ze(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return xe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return Fe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r("imagery-layer:find-images","findImages operation is not supported on the input image service");return De(ze(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Te(ze(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Qe({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Oe(ze(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ae(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),Ee(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Ce(ze(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),je(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new r("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:s,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=U.servicePixelValue.toLowerCase(),c=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some((e=>!e.toLowerCase().startsWith(p))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().startsWith(p)&&e.length>p.length)).map((e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,c),t]}));l=t.map((e=>new z({functionName:e[0]}))),u=t.map((e=>e[1]));const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some((e=>e.functionName===i.functionName))&&(l.push(i),u.push(i.functionName))}const m=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:d}=this;let h=e.timeExtent||this.timeExtent;if(d){const{isOutside:t,intersection:i}=W(d,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(h=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,h);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=g.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:h,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:m,raster:this.raster,maxItemCount:n?1:null});delete R.f;const b=new Ve(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await Se(this.url,b,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!m&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?$({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:h,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p});const c=this.objectIdField||"ObjectId",d=i.catalogItems?.features??[],y=d.map((e=>e.attributes?.[c])),g=new Qe({objectIds:y,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[c]}),R=await this.queryRasters(g);return R?.features?.length&&R.features.forEach((t=>{d.forEach((i=>{i.attributes[c]===t.attributes[c]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p})}catch{throw new r("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(ze(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),s=i(ze(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),n=await Promise.all([r,s]);return n[0]&&n[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:n[0]||null,histograms:n[1]||null}}async createFlowMesh(e,t){const i=this._rasterJobHandler.instance;return i?i.createFlowMesh(e,t):He(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return X(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Me(ze(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Pe(e,t),e))),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),n.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([a((()=>this.rasterFunction),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))}))]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some((e=>e.dimensions.some((e=>e.name===s))))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==n)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter((e=>e.dimensionName===n)),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],c=this.version>=10.8;if(a.length)a.forEach((e=>{e.dimensionName===n&&(c?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))}));else if(!c){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=n,e.isSlice=u,e.values=p})):e.multidimensionalDefinition.push(new v({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=null!=e?p(Qe,e):this.createQuery(),t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:e,requestOptions:t}}async _initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new k;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>{})),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&te(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(ze(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new r("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=ie({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??re(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??se(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=ne(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new ae({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):Y(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(ze(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:n,signal:a}=e;if(s&&this._canRequestImageElement(t.format)){const r=`${ze(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await F(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(ze(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let c=p;if("bsq"!==c&&"bip"!==c&&(c=Z(u)),!c)throw new r("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const m={signal:a},d="gif"===p||"bmp"===p||p.includes("png")&&("png"===c||"jpg"===c)?Y(u,{useCanvas:!0,...t},m):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},m);return{pixelData:{pixelBlock:await d,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch((()=>null))}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=K(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new T;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach((e=>e.variableName="")),t=t.filter((({variableName:e,dimensionName:t})=>e&&"*"!==e||t)),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map((e=>e.replaceAll(/ /gi,", ")))||[];const c=this.objectIdField||"ObjectId",m="string"==typeof r&&r.toLowerCase().includes("nodata"),d=[];if(r&&!u&&!m){const e={};e[c]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&B(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),m&&!n&&(u=[]);const{itemPixelValue:h,servicePixelValue:f}=U,y=this.rasterFields.some((e=>e.name===h));for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;y&&(e.attributes[h]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${U.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}d.push(u[t])}return d}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=W(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=W(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map((e=>e.name)).find((e=>"value"===e.toLowerCase()));if(!n)return;const a=r.filter((e=>e.attributes[n]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const i=L+t.name;e.attributes[i]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map((e=>parseFloat(e))),r=i.map((e=>[e])),s=i.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new C({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new y(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:ee([n.pixels[0][0],n.pixels[1][0]]);e.attributes[U.magnitude]=a[0],e.attributes[U.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find((e=>e.code===i));r&&(e.attributes[t.name]=r.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach((e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:i,advancedQueryCapabilities:r,maxRecordCount:s}=e,n=t.includes("image"),a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!(!e.spatialReference&&!e.extent?.spatialReference),l=t.includes("edit"),u=t.includes("mensuration")&&o,p=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map((e=>e.trim())),c=u&&p.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),d=t.includes("download"),h=i>=10.7&&a||i>=11.4&&(a||u&&p.includes("3d"));return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&d,supportsMeasure:u,supportsMeasureFromImage:i>=11.2,supportsDownload:d,supportsQuery:m&&e.fields&&e.fields.length>0,supportsGetSamples:i>=10.2&&n,supportsProject:i>=10.3&&n,supportsComputeStatisticsHistograms:i>=10.4&&n,supportsQueryBoundary:i>=10.6&&n,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!r?.supportsStatistics,supportsOrderBy:!!r?.supportsOrderBy,supportsDistinct:!!r?.supportsDistinct,supportsPagination:!!r?.supportsPagination,supportsStandardizedQueriesOnly:!!r?.useStandardizedQueries,supportsPercentileStatistics:!!r?.supportsPercentileStatistics,supportsCentroid:!!r?.supportsReturningGeometryCentroid,supportsCurrentUser:!1,supportsDistance:!!r?.supportsQueryWithDistance,supportsExtent:!!r?.supportsReturningQueryExtent,supportsGeometryProperties:!!r?.supportsReturningGeometryProperties,supportsHavingClause:!!r?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!r?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:c,supportsAreaAndPerimeter:c,supportsPointOrCentroid:c,supportsHeightFromBaseAndTop:u&&p.includes("base-top height"),supportsHeightFromBaseAndTopShadow:u&&p.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:u&&p.includes("top-top shadow height"),supports3D:u&&p.includes("3d")}}}};function ze(e){return e?.path??""}return e([l({clonable:!1})],m.prototype,"_functionRasterInfos",void 0),e([l({clonable:!1})],m.prototype,"_rasterJobHandler",void 0),e([l({clonable:!1})],m.prototype,"_cachedRendererJson",void 0),e([l({readOnly:!0})],m.prototype,"_serviceSupportsMosaicRule",void 0),e([d("_serviceSupportsMosaicRule",["currentVersion","fields"])],m.prototype,"readServiceSupportsMosaicRule",null),e([l({readOnly:!0})],m.prototype,"_rasterFunctionNamesIndex",null),e([l()],m.prototype,"adjustAspectRatio",void 0),e([l({type:[u],json:{write:!0}})],m.prototype,"bandIds",void 0),e([d("bandIds")],m.prototype,"readBandIds",null),e([l({readOnly:!0,json:{read:!1}})],m.prototype,"capabilities",void 0),e([d("service","capabilities",["capabilities","currentVersion","serviceDataType"])],m.prototype,"readCapabilities",null),e([l({type:Number})],m.prototype,"compressionQuality",void 0),e([f("compressionQuality")],m.prototype,"writeCompressionQuality",null),e([l({type:Number})],m.prototype,"compressionTolerance",void 0),e([f("compressionTolerance")],m.prototype,"writeCompressionTolerance",null),e([l({json:{read:{source:"copyrightText"}}})],m.prototype,"copyright",void 0),e([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],m.prototype,"defaultMosaicRule",void 0),e([d("defaultMosaicRule",["defaultMosaicMethod"])],m.prototype,"readDefaultMosaicRule",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],m.prototype,"definitionExpression",void 0),e([l({readOnly:!0,constructOnly:!0})],m.prototype,"exportImageServiceParameters",void 0),e([l()],m.prototype,"rasterInfo",void 0),e([l({readOnly:!0,type:[_]})],m.prototype,"fields",void 0),e([l({readOnly:!0})],m.prototype,"fieldsIndex",null),e([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],m.prototype,"format",null),e([d("service","format",["serviceDataType"])],m.prototype,"readFormat",null),e([l({type:y})],m.prototype,"fullExtent",void 0),e([l({readOnly:!0})],m.prototype,"hasMultidimensions",void 0),e([l({json:{read:{source:"maxImageHeight"}}})],m.prototype,"imageMaxHeight",void 0),e([l({json:{read:{source:"maxImageWidth"}}})],m.prototype,"imageMaxWidth",void 0),e([l({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],m.prototype,"interpolation",void 0),e([l()],m.prototype,"minScale",void 0),e([d("service","minScale")],m.prototype,"readMinScale",null),e([l()],m.prototype,"maxScale",void 0),e([d("service","maxScale")],m.prototype,"readMaxScale",null),e([l({type:T})],m.prototype,"mosaicRule",null),e([d("mosaicRule",["mosaicRule","defaultMosaicMethod"])],m.prototype,"readMosaicRule",null),e([f("mosaicRule")],m.prototype,"writeMosaicRule",null),e([l()],m.prototype,"multidimensionalInfo",void 0),e([l({type:O,json:{write:!0}})],m.prototype,"multidimensionalSubset",void 0),e([l({json:{type:u}})],m.prototype,"noData",void 0),e([f("noData")],m.prototype,"writeNoData",null),e([l({type:String,json:{type:N.jsonValues,read:N.read,write:N.write}})],m.prototype,"noDataInterpretation",void 0),e([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],m.prototype,"objectIdField",void 0),e([d("objectIdField")],m.prototype,"readObjectIdField",null),e([l({readOnly:!0})],m.prototype,"geometryType",void 0),e([l({})],m.prototype,"typeIdField",void 0),e([l({})],m.prototype,"types",void 0),e([l({readOnly:!0})],m.prototype,"parsedUrl",null),e([l({type:Function})],m.prototype,"pixelFilter",void 0),e([l()],m.prototype,"raster",void 0),e([l({readOnly:!0})],m.prototype,"sourceType",void 0),e([d("sourceType",["serviceSourceType","fields"])],m.prototype,"readSourceType",null),e([l()],m.prototype,"viewId",void 0),e([l()],m.prototype,"renderer",null),e([l({types:oe,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:le,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],m.prototype,"internalRenderer",null),e([d("internalRenderer")],m.prototype,"readRenderer",null),e([f("internalRenderer")],m.prototype,"writeRenderer",null),e([l({clonable:!1})],m.prototype,"symbolizer",void 0),e([l(w)],m.prototype,"opacity",void 0),e([l({readOnly:!0})],m.prototype,"rasterFields",null),e([l({constructOnly:!0})],m.prototype,"rasterFunctionInfos",void 0),e([l({type:z,json:{name:"renderingRule"}})],m.prototype,"rasterFunction",null),e([d("rasterFunction",["renderingRule","rasterFunctionInfos"])],m.prototype,"readRasterFunction",null),e([l({readOnly:!0})],m.prototype,"serviceDataType",void 0),e([l({readOnly:!0,type:R})],m.prototype,"spatialReference",void 0),e([d("spatialReference",["spatialReference","extent"])],m.prototype,"readSpatialReference",null),e([l({type:P.apiValues,json:{read:P.read,type:P.jsonValues}})],m.prototype,"pixelType",void 0),e([f("pixelType")],m.prototype,"writePixelType",null),e([l({constructOnly:!0,type:G})],m.prototype,"serviceRasterInfo",void 0),e([l()],m.prototype,"sourceJSON",void 0),e([l(I)],m.prototype,"url",void 0),e([l({readOnly:!0})],m.prototype,"version",void 0),e([d("version",["currentVersion","fields","timeInfo"])],m.prototype,"readVersion",null),m=e([h("esri.layers.mixins.ArcGISImageService")],m),m};export{ze as ArcGISImageService};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as n,ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Point.js";import d from"../../geometry/SpatialReference.js";import{getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as h}from"../support/arcgisLayerUrl.js";import{url as p}from"../support/commonProperties.js";import f from"../support/DimensionalDefinition.js";import y from"../support/MultidimensionalSubset.js";import{interpolationKebab as b}from"../support/rasterEnums.js";import g from"../support/RasterFunction.js";import R from"../support/RasterJobHandler.js";import F from"../support/TileInfo.js";import _ from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as I,getDefaultVariableInfo as J,isMultiSliceOrRangeDefinition as v,getSubsetVariablesFromMdInfo as S,getDefaultMultidimensionalDefinition as w}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as x,clip as j}from"../support/rasterFunctions/clipUtils.js";import{create as D}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as H,projectExtent as N,projectPolygon as T}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as P}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as O}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as z,getVariableRasterInfo as C,getDefaultInterpolation as E,matchPresetRenderer as U,getDefaultBandCombination as M,getFunctionColorRamp as k,createDefaultRenderer as q}from"../../renderers/support/rasterRendererHelper.js";import B from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as L,websceneRasterRendererTypes as V,read as A}from"../../renderers/support/rasterTypeUtils.js";import $ from"../../rest/support/ImageHistogramParameters.js";import{createFlowMesh as G}from"../../views/2d/engine/flow/dataUtils.js";const W=W=>{let K=class extends W{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster="Function"===e[0]?.raster?.datasetFormat}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",h(e,i.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const r=t?.find((({name:t})=>t===e));return r?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;return A(i,r)||void 0}async convertVectorFieldData(e,t){const{serviceRasterInfo:r}=this;if(null==e||!r)return null;const i=this._rasterJobHandler.instance,s=r.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:s},t):O(e,s)}async computeStatisticsHistograms(e,t){await this.load(t),e=o($,e).clone();const{serviceRasterInfo:i}=this;if(null==i)throw new r("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new r("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:a}=i;s.spatialReference.equals(a)||(await H(),n="extent"===s.type?N(s,a):T(s,a));const l=e.pixelSize??new u({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:a}),{extent:c,width:d,height:m}=x(i,n,l),h=await this.fetchPixels(c,d,m,{...t,interpolation:"nearest"});if(null==h.pixelBlock)throw new r("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const p=await j(h.pixelBlock,c,n),f=this._rasterJobHandler.instance;return f?f.computeStatisticsHistograms({pixelBlock:p},t):P(p)}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):G(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const r=I({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:r}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:r}=this.raster,i=J(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=z({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(n))return;const o=this._rasterJobHandler.instance;o&&(t.rasterInfo=C(r,s),t.rendererJSON=n,t.bind(),await o.updateSymbolizer(t),this._cachedRendererJson=n)}async applyRenderer(e,t){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const s=this._rasterJobHandler.instance,n=this.bandIds??[];return i=s?await s.symbolize({...e,simpleStretchParams:t,bandIds:n}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:n}),i}getTileUrl(e,t,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${r}`:""}getCompatibleTileInfo(e,t,r=!1){if(!this.loaded||null==t)return null;if(r&&e.equals(this.spatialReference))return this.tileInfo;const i=m(e);return F.create({size:256,spatialReference:e,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,r,i,s={}){if(Q(this),s.requestAsImageElement){const n=this.getTileUrl(e,r,i);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,r,i,t),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,r,i,s)}async fetchPixels(e,t,r,i={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),r=Math.round(r),this.raster.fetchPixels(e,t,r,i))}async identify(e,t={}){await this.load();const{raster:i,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(v(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new r("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,r=t?.[0]?.variableName;return e.variables.some((e=>e.name===r&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return S(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=w(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&"Function"===this.raster.datasetFormat&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new R;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{Q(this),this._rasterJobHandler.instance=e,this.raster.rasterJobHandler=e,"Function"===this.raster.datasetFormat&&this.raster.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}_configDefaultInterpolation(){if(null==this.interpolation){Q(this);const{raster:e}=this,t=E(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){Q(this);const{rasterInfo:t}=this.raster,r=J(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=r?.name,n=U({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??M(t)),!this.renderer||"override"===e){const e=k(this.raster),r=n?.renderer??q(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),i=t.statistics,o=i&&i.length>0?i[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===r.type&&(a>1e24||l<-1e24)&&(r.dynamicRangeAdjustment=!0,r.customStatistics=null,"none"===r.stretchType&&(r.stretchType="min-max")),this.renderer=r}const o=z({...this.renderer.toJSON(),variableName:s}),a=C(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new B({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=q(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,r=t.customStatistics?.length;!t.dynamicRangeAdjustment&&r&&e&&r!==e&&this._configDefaultRenderer("override")}}}else i.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&"Function"===this.raster.datasetFormat){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",g.fromJSON(e)))}let e,t=this.raster,r=!1;"Function"===t.datasetFormat?(e=t.primaryRasters.rasters,t=e[0],r=!0):e=[t];const{rasterFunction:i}=this;if(i){const r={raster:t};e.length>1&&e.forEach((e=>r[e.url]=e));const s=D(i.functionDefinition?.toJSON()??i.toJSON(),r),n=new _({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler.instance,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((e=>e>=n)):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}};function Q(e){if(!e.raster||!e.serviceRasterInfo)throw new r("imagery-tile","no raster")}return e([s({clonable:!1})],K.prototype,"_cachedRendererJson",void 0),e([s({clonable:!1})],K.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],K.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],K.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],K.prototype,"_rasterJobHandler",void 0),e([s({clonable:!1})],K.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[n],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],K.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],K.prototype,"copyright",void 0),e([s({json:{read:!1}})],K.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),a(b)],K.prototype,"interpolation",void 0),e([s()],K.prototype,"ioConfig",void 0),e([s({type:[f],json:{write:!0}})],K.prototype,"multidimensionalDefinition",null),e([s({type:y,json:{write:!0}})],K.prototype,"multidimensionalSubset",void 0),e([s()],K.prototype,"raster",void 0),e([s({type:g})],K.prototype,"rasterFunction",null),e([s()],K.prototype,"serviceRasterInfo",void 0),e([s()],K.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:d,json:{read:!1}})],K.prototype,"spatialReference",void 0),e([s({type:F})],K.prototype,"tileInfo",void 0),e([s(p)],K.prototype,"url",null),e([s()],K.prototype,"renderer",null),e([s({types:L,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:V,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],K.prototype,"internalRenderer",null),e([l("internalRenderer")],K.prototype,"readRenderer",null),e([s({clonable:!1})],K.prototype,"symbolizer",void 0),K=e([c("esri.layers.mixins.ImageryTileMixin")],K),K};export{W as ImageryTileMixin};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import r from"../../core/Error.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{Integer as n,ensureClass as o}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as l}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Point.js";import m from"../../geometry/SpatialReference.js";import{getInfo as d}from"../../geometry/support/spatialReferenceUtils.js";import{sanitizeUrl as p}from"../support/arcgisLayerUrl.js";import{url as h}from"../support/commonProperties.js";import f from"../support/DimensionalDefinition.js";import y from"../support/MultidimensionalSubset.js";import{interpolationKebab as b}from"../support/rasterEnums.js";import g from"../support/RasterFunction.js";import R from"../support/RasterJobHandler.js";import I from"../support/TileInfo.js";import{isFunctionRaster as S}from"../support/rasterDatasets/datasetUtils.js";import _ from"../support/rasterDatasets/FunctionRaster.js";import{getEffectiveMultidimensionalDefinition as w,getDefaultVariableInfo as F,isMultiSliceOrRangeDefinition as v,getSubsetVariablesFromMdInfo as x,getDefaultMultidimensionalDefinition as J}from"../support/rasterDatasets/multidimensionalUtils.js";import{snapToRaster as j,clip as D}from"../support/rasterFunctions/clipUtils.js";import{create as H}from"../support/rasterFunctions/rasterFunctionHelper.js";import{load as N,projectExtent as T,projectPolygon as P}from"../support/rasterFunctions/rasterProjectionHelper.js";import{computeStatisticsHistograms as O}from"../support/rasterFunctions/stretchUtils.js";import{convertVectorFieldData as z}from"../support/rasterFunctions/vectorFieldUtils.js";import{normalizeRendererJSON as C,getVariableRasterInfo as E,getDefaultInterpolation as U,matchPresetRenderer as M,getDefaultBandCombination as L,getFunctionColorRamp as k,createDefaultRenderer as q}from"../../renderers/support/rasterRendererHelper.js";import A from"../../renderers/support/RasterSymbolizer.js";import{rasterRendererTypes as V,websceneRasterRendererTypes as B,read as $}from"../../renderers/support/rasterTypeUtils.js";import G from"../../rest/support/ImageHistogramParameters.js";import W from"../../rest/support/ImageSample.js";import K from"../../rest/support/ImageSampleParameters.js";import Q from"../../rest/support/ImageSampleResult.js";import{createFlowMesh as X}from"../../views/2d/engine/flow/dataUtils.js";const Y=1e3,Z=Z=>{let ee=class extends Z{constructor(...e){super(...e),this._isConstructedFromFunctionRaster=!1,this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this.bandIds=null,this.copyright=null,this.interpolation=null,this.multidimensionalSubset=null,this.raster=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.spatialReference=null,this.symbolizer=null,this._isConstructedFromFunctionRaster=S(e[0]?.raster)}get fullExtent(){return this.serviceRasterInfo?.extent}set multidimensionalDefinition(e){this._set("multidimensionalDefinition",e),this.updateRenderer()}set rasterFunction(e){"none"===e?.functionName?.toLowerCase()&&(e=void 0),this._set("rasterFunction",e),this.updateRasterFunction()}set url(e){this._set("url",p(e,i.getLogger(this)))}get renderer(){if("imagery-tile"!==this.type)return this.internalRenderer;const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const r=t?.find((({name:t})=>t===e));return r?.renderer.clone()}return this.internalRenderer}set renderer(e){"imagery-tile"===this.type&&(this.activePresetRendererName=null),this.internalRenderer=e}set internalRenderer(e){null==e&&null==this.rasterFunction?this._configDefaultRenderer("override"):(this._set("internalRenderer",e),this.updateRenderer())}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;return $(i,r)||void 0}async convertVectorFieldData(e,t){const{serviceRasterInfo:r}=this;if(null==e||!r)return null;const i=this._rasterJobHandler.instance,s=r.dataType;return i?i.convertVectorFieldData({pixelBlock:e,dataType:s},t):z(e,s)}async computeStatisticsHistograms(e,t){await this.load(t),e=o(G,e).clone();const{serviceRasterInfo:i}=this;if(null==i)throw new r("imagery-tile-mixin:compute-statistics-histograms","serviceRasterInfo must be specified");const{geometry:s}=e;if(null==s)throw new r("imagery-tile-mixin:compute-statistics-histograms","geometry must be specified");let n=s;const{spatialReference:a}=i;s.spatialReference.equals(a)||(await N(),n="extent"===s.type?T(s,a):P(s,a));const l=e.pixelSize??new u({x:i.pixelSize.x,y:i.pixelSize.y,spatialReference:a}),{extent:c,width:m,height:d}=j(i,n,l),p=await this.fetchPixels(c,m,d,{...t,interpolation:"nearest"});if(null==p.pixelBlock)throw new r("imagery-tile-mixin:compute-statistics-histograms","failed to fetch pixels");const h=await D(p.pixelBlock,c,n),f=this._rasterJobHandler.instance;return f?f.computeStatisticsHistograms({pixelBlock:h},t):O(h)}async createFlowMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createFlowMesh(e,t):X(e.meshType,e.simulationSettings,e.flowData,null!=t.signal?t.signal:(new AbortController).signal)}normalizeRasterFetchOptions(e){const{multidimensionalInfo:t}=this.serviceRasterInfo??{};if(null==t)return e;const r=w({rasterInfo:this.raster.rasterInfo,multidimensionalDefinition:e.multidimensionalDefinition||this.multidimensionalDefinition,timeExtent:e.timeExtent??this.timeExtent,multidimensionalSubset:this.multidimensionalSubset});return{...e,multidimensionalDefinition:r}}async updateRasterFunction(){return this.loaded&&"imagery-tile"===this.type&&(this.rasterFunction||this._cachedRasterFunctionJson)&&JSON.stringify(this.rasterFunction)!==JSON.stringify(this._cachedRasterFunctionJson)?(this._cachedRasterFunctionJson=this.rasterFunction?.toJSON(),this._rasterFunctionUpdatePromise=this._updateRasterFunction(),this._rasterFunctionUpdatePromise):this._rasterFunctionUpdatePromise}async updateRenderer(){const{loaded:e,symbolizer:t}=this;if(!e||!t||!this.renderer)return;const{rasterInfo:r}=this.raster,i=F(r,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=i?.name,n=C({...this.renderer.toJSON(),variableName:s});if(JSON.stringify(this._cachedRendererJson)===JSON.stringify(n))return;const o=this._rasterJobHandler.instance;o&&(t.rasterInfo=E(r,s),t.rendererJSON=n,t.bind(),await o.updateSymbolizer(t),this._cachedRendererJson=n)}async applyRenderer(e,t){const r=e?.pixelBlock;if(!(null!=r&&r.pixels&&r.pixels.length>0))return null;let i;await this.updateRenderer();const s=this._rasterJobHandler.instance,n=this.bandIds??[];return i=s?await s.symbolize({...e,simpleStretchParams:t,bandIds:n}):this.symbolizer.symbolize({...e,simpleStretchParams:t,bandIds:n}),i}getTileUrl(e,t,r){return"RasterTileServer"===this.raster.datasetFormat?`${this.url}/tile/${e}/${t}/${r}`:""}getCompatibleTileInfo(e,t,r=!1){if(!this.loaded||null==t)return null;if(r&&e.equals(this.spatialReference))return this.tileInfo;const i=d(e);return I.create({size:256,spatialReference:e,origin:i?{x:i.origin[0],y:i.origin[1]}:{x:t.xmin,y:t.ymax}})}getCompatibleFullExtent(e){return this.loaded?(this._compatibleFullExtent?.spatialReference.equals(e)||(this._compatibleFullExtent=this.raster.computeExtent(e)),this._compatibleFullExtent):null}async fetchTile(e,r,i,s={}){if(te(this),s.requestAsImageElement){const n=this.getTileUrl(e,r,i);return t(n,{responseType:"image",query:{...this.refreshParameters,...this.raster.ioConfig.customFetchParameters},signal:s.signal}).then((e=>e.data))}const{serviceRasterInfo:n}=this;if(null!=n.multidimensionalInfo&&null==(s=this.normalizeRasterFetchOptions(s)).multidimensionalDefinition){const t=s.tileInfo||n.storageInfo.tileInfo;return{extent:this.raster.getTileExtentFromTileInfo(e,r,i,t),pixelBlock:null}}return await this._initJobHandler(),await this.updateRasterFunction(),"raster-shaded-relief"===this.renderer?.type&&(s={...s,buffer:{cols:1,rows:1}}),this.raster.fetchTile(e,r,i,s)}async fetchPixels(e,t,r,i={}){return null!=this.serviceRasterInfo.multidimensionalInfo&&null==(i=this.normalizeRasterFetchOptions(i)).multidimensionalDefinition?{extent:e,pixelBlock:null}:(await this._initJobHandler(),await this.updateRasterFunction(),t=Math.round(t),r=Math.round(r),this.raster.fetchPixels(e,t,r,i))}async getSamples(e,t){if(await this.load(),(e=o(K,e).clone()).interpolation&&"nearest"!==e.interpolation)throw new r("imagery-tile-mixin:get-samples","only nearest interpolation is currently supported");const i=e.mosaicRule?.multidimensionalDefinition,s={...t,multidimensionalDefinition:i},n=(await this._getSampleLocations(e)).map((e=>this.identify(e,s).then((t=>(t.location=e,t))))),a=(await Promise.all(n)).flatMap(((e,t)=>this._convertRasterIdentifyResultToSample(e,t)));return new Q({samples:a})}async identify(e,t={}){await this.load();const{raster:i,serviceRasterInfo:s}=this;if(null!=s?.multidimensionalInfo){if(!(s.hasMultidimensionalTranspose&&!!(v(t.multidimensionalDefinition)||t.transposedVariableName||t.timeExtent))&&null==(t=this.normalizeRasterFetchOptions(t)).multidimensionalDefinition)return{location:e,value:null}}const n=this.multidimensionalSubset?.areaOfInterest;if(n&&!n.contains(e))throw new r("imagery-tile-mixin:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");return i.identify(e,t)}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}hasStandardTime(){const e=this.serviceRasterInfo?.multidimensionalInfo;if(null==e||"standard-time"!==this.serviceRasterInfo?.dataType)return!1;const t=this.multidimensionalDefinition,r=t?.[0]?.variableName;return e.variables.some((e=>e.name===r&&(!t?.[0].dimensionName||e.dimensions.some((e=>"StdTime"===e.name)))))}getStandardTimeValue(e){return new Date(24*(e-25569)*3600*1e3).toString()}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo?.multidimensionalInfo;return x(this.multidimensionalSubset,t)}_configDefaultSettings(){this._configDefaultInterpolation(),this.multidimensionalDefinition||(this.multidimensionalDefinition=J(this.raster.rasterInfo,{multidimensionalSubset:this.multidimensionalSubset})),this.rasterFunction&&S(this.raster)&&(this._cachedRasterFunctionJson=this.rasterFunction.toJSON()),this._configDefaultRenderer()}_initJobHandler(){if(null!=this._rasterJobHandler.connectionPromise)return this._rasterJobHandler.connectionPromise;const e=new R;return this._rasterJobHandler.connectionPromise=e.initialize().then((async()=>{te(this),this._rasterJobHandler.instance=e;const{raster:t}=this;t.rasterJobHandler=e,S(t)&&t.syncJobHandler(),this.rasterFunction&&await this.updateRasterFunction().catch((()=>{})),this.renderer&&this.updateRenderer()})).catch((()=>{})),this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0,this._cachedRendererJson=null,this.raster&&(this.raster.rasterJobHandler=null)}async _getSampleLocations(e){const{geometry:t}=e;if("point"===t.type)return[t];const{spatialReference:r,type:i}=t;if("multipoint"===i)return t.points.map((e=>new u({x:e[0],y:e[1],spatialReference:r})));if("polyline"===i){let i=t;if(e.sampleCount||e.sampleDistance){const r=await import("../../geometry/operators/densifyOperator.js"),s=(await import("../../geometry/operators/lengthOperator.js")).execute(t,{unit:"meters"}),n=Math.min(e.sampleCount||100,Y);let o=e.sampleDistance;if(!o){o=s/(n+(2===i.paths[0].length?1:0))}i=r.execute(t,o,{unit:"meters"})}return i.paths.flatMap((e=>e.map((e=>new u({x:e[0],y:e[1],spatialReference:r})))))}const s=Math.min(e.sampleCount||100,Y),n="extent"===t.type,o=n?t:t.extent,a=Math.sqrt(o.width*o.height/s),l=o.height/a,c=o.width/a,{xmin:m,ymax:d}=o,p=[];for(let h=0;h<l;h++)for(let e=0;e<c;e++){const i=new u({x:m+(e+.5)*a,y:d-(h+.5)*a,spatialReference:r});(n||t.contains(i))&&p.push(i)}return p}_configDefaultInterpolation(){if(null==this.interpolation){te(this);const{raster:e}=this,t=U(e.rasterInfo,e.tileType,this.sourceJSON?.defaultResamplingMethod);this._set("interpolation",t)}}_configDefaultRenderer(e="no"){te(this);const{rasterInfo:t}=this.raster,r=F(t,{multidimensionalDefinition:this.multidimensionalDefinition,multidimensionalSubset:this.multidimensionalSubset}),s=r?.name,n=M({variableName:s,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&t.bandCount>1&&(this.bandIds=n?.bandIds??L(t)),!this.renderer||"override"===e){const e=k(this.raster),r=n?.renderer??q(t,{bandIds:this.bandIds,variableName:s,rasterFunctionColorRamp:e}),i=t.statistics,o=i&&i.length>0?i[0]:null,a=o?.max??0,l=o?.min??0;"WCSServer"===this.raster.datasetFormat&&"raster-stretch"===r.type&&(a>1e24||l<-1e24)&&(r.dynamicRangeAdjustment=!0,r.customStatistics=null,"none"===r.stretchType&&(r.stretchType="min-max")),this.renderer=r}const o=C({...this.renderer.toJSON(),variableName:s}),a=E(t,s);this.symbolizer?(this.symbolizer.rendererJSON=o,this.symbolizer.rasterInfo=a):this.symbolizer=new A({rendererJSON:o,rasterInfo:a});const l=this.symbolizer.bind();if(l.success){if("auto"===e){const{colormap:e}=this.raster.rasterInfo,t=this.renderer;if(null!=e&&"raster-colormap"===t.type){const e=q(this.raster.rasterInfo);JSON.stringify(e)!==JSON.stringify(t)&&this._configDefaultRenderer("override")}else if("raster-stretch"===t.type){const e=this.bandIds?.length,r=t.customStatistics?.length;!t.dynamicRangeAdjustment&&r&&e&&r!==e&&this._configDefaultRenderer("override")}}}else i.getLogger(this).warn("imagery-tile-mixin",l.error||"The given renderer is not supported by the layer."),"auto"===e&&this._configDefaultRenderer("override")}async _updateRasterFunction(){if(this._isConstructedFromFunctionRaster&&S(this.raster)){const e=this.raster.rasterFunction.toJSON();return void(!this.rasterFunction&&e&&this._set("rasterFunction",g.fromJSON(e)))}let e,t=this.raster,r=!1;S(t)?(e=t.primaryRasters.rasters,t=e[0],r=!0):e=[t];const{rasterFunction:i}=this;if(i){const r={raster:t};e.length>1&&e.forEach((e=>r[e.url]=e));const s=H(i.functionDefinition?.toJSON()??i.toJSON(),r),n=new _({rasterFunction:s});n.rasterJobHandler=this._rasterJobHandler.instance,await n.open(),this.raster=n}else this.raster=t,await t.open();if(this._cachedRendererJson=null,!r&&!i)return;const{bandIds:s}=this,{bandCount:n}=this.raster.rasterInfo,o=s?.length?s.some((e=>e>=n)):n>=3;s&&(o||this.renderer&&"raster-stretch"!==this.renderer.type)&&this._set("bandIds",null),this._configDefaultRenderer("auto")}_convertRasterIdentifyResultToSample(e,t){const{rasterInfo:r}=this.raster,i=r.storageInfo.pyramidScalingFactor**(e.pyramidLevel??0),s=(r.pixelSize.x+r.pixelSize.y)/2*i;if(!e.dataSeries?.length)return[new W({location:e.location,pixelValue:e.value,locationId:t,resolution:s})];const n=[];return e.dataSeries.forEach((({value:r,multidimensionalDefinition:i},o)=>{const a={Variables:i[0].variableName,Dimensions:i.flatMap((({dimensionName:e})=>e)).join(",")};for(const{dimensionName:e,values:t}of i){a[e]=Array.isArray(t[0])?t[0][0]:t[0];const r=t[t.length-1];a[`${e}_Max`]=Array.isArray(r)?r[r.length-1]:r}const l=new W({location:e.location,pixelValue:r,rasterId:o,locationId:t,resolution:s,attributes:a});n.push(l)})),n}};function te(e){if(!e.raster||!e.serviceRasterInfo)throw new r("imagery-tile","no raster")}return e([s({clonable:!1})],ee.prototype,"_cachedRendererJson",void 0),e([s({clonable:!1})],ee.prototype,"_cachedRasterFunctionJson",void 0),e([s({clonable:!1})],ee.prototype,"_compatibleFullExtent",void 0),e([s({clonable:!1})],ee.prototype,"_isConstructedFromFunctionRaster",void 0),e([s({clonable:!1})],ee.prototype,"_rasterJobHandler",void 0),e([s({clonable:!1})],ee.prototype,"_rasterFunctionUpdatePromise",void 0),e([s({type:[n],json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"0,1,2"!==this.bandIds?.join(",")}}}}})],ee.prototype,"bandIds",void 0),e([s({json:{origins:{service:{read:{source:"copyrightText"}}}}})],ee.prototype,"copyright",void 0),e([s({json:{read:!1}})],ee.prototype,"fullExtent",null),e([s({json:{write:{overridePolicy(){return{enabled:!this.loaded||"Raster"===this.raster.tileType||"bilinear"!==this.interpolation}}}}}),a(b)],ee.prototype,"interpolation",void 0),e([s()],ee.prototype,"ioConfig",void 0),e([s({type:[f],json:{write:!0}})],ee.prototype,"multidimensionalDefinition",null),e([s({type:y,json:{write:!0}})],ee.prototype,"multidimensionalSubset",void 0),e([s()],ee.prototype,"raster",void 0),e([s({type:g})],ee.prototype,"rasterFunction",null),e([s()],ee.prototype,"serviceRasterInfo",void 0),e([s()],ee.prototype,"sourceJSON",void 0),e([s({readOnly:!0,type:m,json:{read:!1}})],ee.prototype,"spatialReference",void 0),e([s({type:I})],ee.prototype,"tileInfo",void 0),e([s(h)],ee.prototype,"url",null),e([s()],ee.prototype,"renderer",null),e([s({types:V,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy(){const e="raster-stretch"===this.renderer?.type&&"none"===this.renderer.stretchType&&!this.renderer.useGamma;return{enabled:!this.loaded||"Raster"===this.raster.tileType||!e}}},origins:{"web-scene":{types:B,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],ee.prototype,"internalRenderer",null),e([l("internalRenderer")],ee.prototype,"readRenderer",null),e([s({clonable:!1})],ee.prototype,"symbolizer",void 0),ee=e([c("esri.layers.mixins.ImageryTileMixin")],ee),ee};export{Z as ImageryTileMixin};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import TrackableLayer = __esri.TrackableLayer;
4
+ export { TrackableLayer };
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{save as e,saveAs as t}from"./utils.js";import{getWGS84ExtentForItem as r,removeTypeKeyword as a,typeKeyword as s,toggleTypeKeyword as i}from"../../portal/support/portalItemUtils.js";const y="Image Service",l="imagery-layer-save",n="imagery-layer-save-as",m="imagery-tile-layer-save",o="imagery-tile-layer-save-as",c="WCS",p="wcs-layer-save",u="wcs-layer-save-as";function g(e){if("imagery"===e.type||"wcs"===e.type)return{isValid:!0};const{raster:t}=e,r="Function"===t?.datasetFormat?t.primaryRasters?.rasters[0]:t;return{isValid:"RasterTileServer"===r?.datasetFormat&&("Raster"===r.tileType||"Map"===r.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function v(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function f(e,t){const{parsedUrl:y,title:l,fullExtent:n}=e;t.url=y.path,t.title||=l;try{t.extent=await r(n)}catch{t.extent=void 0}a(t,s.METADATA),i(t,s.TILED_IMAGERY,"imagery-tile"===e.type)}async function d(t,r){const a="imagery"===t.type?l:"imagery-tile"===t.type?m:p,s="wcs"===t.type?c:y;return e({layer:t,itemType:s,validateLayer:g,createItemData:v,errorNamePrefix:a},r)}async function I(e,r,a){const s="imagery"===e.type?n:"imagery-tile"===e.type?o:u,i="wcs"===e.type?c:y;return t({layer:e,itemType:i,validateLayer:g,createItemData:v,errorNamePrefix:s,newItem:r,setItemProperties:f},a)}export{d as save,I as saveAs};
5
+ import{save as e,saveAs as t}from"./utils.js";import{getPrimaryRasters as r}from"../support/rasterDatasets/datasetUtils.js";import{getWGS84ExtentForItem as a,removeTypeKeyword as s,typeKeyword as i,toggleTypeKeyword as y}from"../../portal/support/portalItemUtils.js";const l="Image Service",o="imagery-layer-save",m="imagery-layer-save-as",n="imagery-tile-layer-save",c="imagery-tile-layer-save-as",p="WCS",u="wcs-layer-save",g="wcs-layer-save-as";function v(e){if("imagery"===e.type||"wcs"===e.type)return{isValid:!0};const{raster:t}=e,a=r(t)[0];return{isValid:"RasterTileServer"===a?.datasetFormat&&("Raster"===a.tileType||"Map"===a.tileType),errorMessage:"imagery tile layer should be created from a tiled image service."}}function f(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function d(e,t){const{parsedUrl:r,title:l,fullExtent:o}=e;t.url=r.path,t.title||=l;try{t.extent=await a(o)}catch{t.extent=void 0}s(t,i.METADATA),y(t,i.TILED_IMAGERY,"imagery-tile"===e.type)}async function I(t,r){const a="imagery"===t.type?o:"imagery-tile"===t.type?n:u,s="wcs"===t.type?p:l;return e({layer:t,itemType:s,validateLayer:v,createItemData:f,errorNamePrefix:a},r)}async function T(e,r,a){const s="imagery"===e.type?m:"imagery-tile"===e.type?c:g,i="wcs"===e.type?p:l;return t({layer:e,itemType:i,validateLayer:v,createItemData:f,errorNamePrefix:s,newItem:r,setItemProperties:d},a)}export{I as save,T as saveAs};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as s,convertRendererToRenderingRule as a,convertRenderingRuleToRFT as p}from"./imageryRendererUtils.js";import l from"./MosaicRule.js";import{interpolationKebab as c,noDataInterpretationKebab as m,pixelTypeKebabDict as u}from"./rasterEnums.js";import y from"./RasterFunction.js";let d=class extends t{constructor(){super(...arguments),this.layer=null,this.compression=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[r]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get format(){return"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}get pixelType(){const{layer:e}=this;return e.pixelType!==e.serviceRasterInfo.pixelType?e.pixelType:void 0}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("pixelType"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new l({where:r})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const r=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");t=this._addResampleRasterFunction(t);const i=e.multidimensionalSubset?.areaOfInterest;return i&&(t=f(t,i)),o&&!r&&"vector-field"!==e.renderer?.type&&(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:r,renderer:o}=t;if(e=e||t.rasterFunction,!o||!n(o))return e;return s(a(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandNames:r.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:r.bandCount}),e)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,r=this.layer.serviceRasterInfo.pixelSize;let o=new y({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:r}});return o=e?.rasterFunctionDefinition?new y({rasterFunctionDefinition:p(o)}):o,s(o,e)}};function f(e,t){const r=new y({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return s(r,e)}e([r()],d.prototype,"layer",void 0),e([r({json:{write:!0}})],d.prototype,"adjustAspectRatio",null),e([i("adjustAspectRatio")],d.prototype,"writeAdjustAspectRatio",null),e([r({json:{write:!0}})],d.prototype,"bandIds",null),e([r({json:{write:!0}})],d.prototype,"compression",void 0),e([r({json:{write:!0}})],d.prototype,"compressionQuality",null),e([i("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([r({json:{write:!0}})],d.prototype,"compressionTolerance",null),e([i("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([r({json:{write:!0}})],d.prototype,"format",null),e([r({type:String,json:{read:{reader:c.read},write:{writer:c.write}}})],d.prototype,"interpolation",null),e([r({json:{write:!0}})],d.prototype,"noData",null),e([r({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],d.prototype,"noDataInterpretation",null),e([r({type:u.apiValues,json:{read:u.read,write:u.write}})],d.prototype,"pixelType",null),e([r({json:{write:!0}})],d.prototype,"lercVersion",void 0),e([i("lercVersion")],d.prototype,"writeLercVersion",null),e([r({type:Number})],d.prototype,"version",null),e([r({json:{write:!0}})],d.prototype,"mosaicRule",null),e([r({json:{write:!0,name:"renderingRule"}})],d.prototype,"rasterFunction",null),d=e([o("esri.layers.support.ExportImageServiceParameters")],d);export{d as ExportImageServiceParameters};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/JSONSupport.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{writer as i}from"../../core/accessorSupport/decorators/writer.js";import{isSupportedRendererType as n,combineRenderingRules as s,convertRendererToRenderingRule as a,convertRenderingRuleToRFT as p}from"./imageryRendererUtils.js";import l from"./MosaicRule.js";import{interpolationKebab as c,noDataInterpretationKebab as m,pixelTypeKebabDict as u}from"./rasterEnums.js";import y from"./RasterFunction.js";let d=class extends t{constructor(){super(...arguments),this.layer=null,this.requestRawData=!1,this.compression=void 0,this.lercVersion=2}get adjustAspectRatio(){return this.layer.adjustAspectRatio}writeAdjustAspectRatio(e,t,r){this.layer.version<10.3||(t[r]=e)}get bandIds(){return this.layer.bandIds}get compressionQuality(){return this.layer.compressionQuality}writeCompressionQuality(e,t,r){this.format&&this.format.toLowerCase().includes("jpg")&&null!=e&&(t[r]=e)}get compressionTolerance(){return this.layer.compressionTolerance}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get format(){return this.requestRawData||"vector-field"===this.layer.renderer?.type?"lerc":this.layer.format}get interpolation(){return this.layer.interpolation}get noData(){return this.layer.noData}get noDataInterpretation(){return this.layer.noDataInterpretation}get pixelType(){const{layer:e}=this;return e.pixelType!==e.serviceRasterInfo.pixelType?e.pixelType:void 0}writeLercVersion(e,t,r){"lerc"===this.format&&this.layer.version>=10.5&&(t[r]=e)}get version(){const e=this.layer;return e.commitProperty("bandIds"),e.commitProperty("format"),e.commitProperty("compressionQuality"),e.commitProperty("compressionTolerance"),e.commitProperty("interpolation"),e.commitProperty("noData"),e.commitProperty("noDataInterpretation"),e.commitProperty("mosaicRule"),e.commitProperty("rasterFunction"),e.commitProperty("adjustAspectRatio"),e.commitProperty("pixelFilter"),e.commitProperty("pixelType"),e.commitProperty("definitionExpression"),e.commitProperty("multidimensionalSubset"),(this._get("version")||0)+1}set version(e){this._set("version",e)}get mosaicRule(){const e=this.layer;let t=e.mosaicRule;const r=e.definitionExpression;return t?r&&r!==t.where&&(t=t.clone(),t.where=r):r&&(t=new l({where:r})),t}get rasterFunction(){const e=this.layer;let{rasterFunction:t}=e;const r=e.pixelFilter,o=!e.format||e.format.includes("jpg")||e.format.includes("png");this.requestRawData||(t=this._addResampleRasterFunction(t));const i=e.multidimensionalSubset?.areaOfInterest;return i&&(t=f(t,i)),this.requestRawData||!o||r||"vector-field"===e.renderer?.type||(t=this.combineRendererWithRenderingRule(t)),t}combineRendererWithRenderingRule(e){const t=this.layer,{rasterInfo:r,renderer:o}=t;if(e=e||t.rasterFunction,!o||!n(o))return e;return s(a(o,{rasterAttributeTable:r.attributeTable,pixelType:r.pixelType,dataType:r.dataType,bandNames:r.bandInfos.map((({name:e})=>e)),convertColorRampToColormap:t.version<10.6,convertToRFT:!!e?.rasterFunctionDefinition,bandCount:r.bandCount}),e)}_addResampleRasterFunction(e){if(!("vector-field"===this.layer.renderer?.type)||"Resample"===e?.functionName)return e;const t="esriImageServiceDataTypeVector-UV"===this.layer.serviceDataType?7:10,r=this.layer.serviceRasterInfo.pixelSize;let o=new y({functionName:"Resample",functionArguments:{ResamplingType:t,InputCellSize:r}});return o=e?.rasterFunctionDefinition?new y({rasterFunctionDefinition:p(o)}):o,s(o,e)}};function f(e,t){const r=new y({functionName:"Clip",functionArguments:{ClippingGeometry:t.toJSON(),ClippingType:1}});return s(r,e)}e([r()],d.prototype,"layer",void 0),e([r()],d.prototype,"requestRawData",void 0),e([r({json:{write:!0}})],d.prototype,"adjustAspectRatio",null),e([i("adjustAspectRatio")],d.prototype,"writeAdjustAspectRatio",null),e([r({json:{write:!0}})],d.prototype,"bandIds",null),e([r({json:{write:!0}})],d.prototype,"compression",void 0),e([r({json:{write:!0}})],d.prototype,"compressionQuality",null),e([i("compressionQuality")],d.prototype,"writeCompressionQuality",null),e([r({json:{write:!0}})],d.prototype,"compressionTolerance",null),e([i("compressionTolerance")],d.prototype,"writeCompressionTolerance",null),e([r({json:{write:!0}})],d.prototype,"format",null),e([r({type:String,json:{read:{reader:c.read},write:{writer:c.write}}})],d.prototype,"interpolation",null),e([r({json:{write:!0}})],d.prototype,"noData",null),e([r({type:String,json:{read:{reader:m.read},write:{writer:m.write}}})],d.prototype,"noDataInterpretation",null),e([r({type:u.apiValues,json:{read:u.read,write:u.write}})],d.prototype,"pixelType",null),e([r({json:{write:!0}})],d.prototype,"lercVersion",void 0),e([i("lercVersion")],d.prototype,"writeLercVersion",null),e([r({type:Number})],d.prototype,"version",null),e([r({json:{write:!0}})],d.prototype,"mosaicRule",null),e([r({json:{write:!0,name:"renderingRule"}})],d.prototype,"rasterFunction",null),d=e([o("esri.layers.support.ExportImageServiceParameters")],d);export{d as ExportImageServiceParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import n from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as i}from"../../core/lang.js";import s from"../../core/Loadable.js";import a from"../../core/Logger.js";import{MultiOriginJSONMixin as l}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as p}from"../../core/object.js";import{sqlAnd as d}from"../../core/sql.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as f}from"../../core/accessorSupport/layerContainerType.js";import h from"../../form/FormTemplate.js";import b from"../../geometry/SpatialReference.js";import{labelsVisible as g,legendEnabled as v,minScale as j,maxScale as w,popupEnabled as F}from"./commonProperties.js";import{createQuery as I,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import T from"./FeatureTemplate.js";import{defineFieldProperties as S}from"./fieldProperties.js";import{fixRendererFields as C}from"./fieldUtils.js";import E from"./LabelClass.js";import{reader as q}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as x}from"./subtypeGroupLayerUtils.js";import R from"../../renderers/SimpleRenderer.js";import P from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as D,defaultPolylineSymbol2D as G,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=S();let M=0;function U(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=f),e}function _(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=f),e?.target&&(t.write.target=e.target)),t}function k(e){return new R({symbol:Q(e)})}function Q(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return D.clone();default:return null}}function B(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function H(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const n={},o=H(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)n[t]=e[t]}return n[t.subtypeField]=e,new T({name:"New Feature",drawingTool:r,prototype:{attributes:n}})}let W=class extends(l(r.ClonableMixin(o.IdentifiableMixin(s)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return C(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:n,parent:o}=this;let s;if(n){s=[];let e=0;n.forEach((({name:t,alias:r,editable:n,visible:i})=>{if(!i)return;const a=o?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),n!==a.editable&&(l.editable=n,p=!0),s.push(l),p&&e++})),0===e&&s.length===n.length&&(s=null)}else s=i(e);s?.length&&p(r,s,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,n=e?.fields;if(!e||!n?.length)return null;const{subtypes:o,subtypeField:i}=e,s=o?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of n){const e=d.clone(),{name:n}=e,o=t?.find((e=>e.name===n));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[n]??null;e.defaultValue=n===i?r:s;const u=l?.[n]??null;e.domain=n===i?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(a.getLogger(this).error(X("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||a.getLogger(this).error(X("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){C(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?k(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const n=t.drawingInfo?.renderer,o=A(n,t,r);let i;const{subtypeCode:s}=this;if(null!=s&&B(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(s)));e&&(i=new R({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(i=o);return i}readRenderer(e,t,r){const n=t?.layerDefinition?.drawingInfo?.renderer;if(!n)return;const o=n.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(n,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??b.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=H(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw X("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw X("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw X("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new n("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw X("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:n,title:o}=this;if(r){const{displayField:e,editFieldsInfo:i,objectIdField:s}=r;t={displayField:e,editFieldsInfo:i,fields:n,objectIdField:s,title:o}}return L(t,e)}createQuery(){if(!this.parent)throw X("createQuery");const e=I(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=d(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw X("queryAttachments");const n=e.clone();return n.where=K(n.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatureCount");return r.parent.queryFeatureCount(z(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatures");return r.parent.queryFeatures(z(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw X("queryObjectIds");return r.parent.queryObjectIds(z(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([u({type:V,json:_({name:"attributeTableInfo"})})],W.prototype,"attributeTableTemplate",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([u({json:_()})],W.prototype,"charts",void 0),e([u({type:Boolean,nonNullable:!0,json:_({name:"enableEditing"})})],W.prototype,"editingEnabled",void 0),e([u({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([u({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([m("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([u({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([u($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"floorInfo",null),e([u({type:h,json:_({name:"formInfo"})})],W.prototype,"formTemplate",void 0),e([u({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"isTable",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"globalIdField",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([u(U(i(g)))],W.prototype,"labelsVisible",void 0),e([u({type:[E],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:q},write:{ignoreOrigin:!0,layerContainerTypes:f}}})],W.prototype,"labelingInfo",void 0),e([u({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:f}}})],W.prototype,"layerType",void 0),e([u(U(i(v)))],W.prototype,"legendEnabled",void 0),e([u({type:["show","hide"]})],W.prototype,"listMode",void 0),e([u((()=>{const e=i(j);return e.json.origins.service.read=!1,U(e,{spatialOnly:!0})})())],W.prototype,"minScale",void 0),e([u((()=>{const e=i(w);return e.json.origins.service.read=!1,U(e,{spatialOnly:!0})})())],W.prototype,"maxScale",void 0),e([u({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([u({type:Number,range:{min:0,max:1},nonNullable:!0,json:_({spatialOnly:!0})})],W.prototype,"opacity",void 0),e([u({clonable:!1})],W.prototype,"parent",void 0),e([u(U(i(F)))],W.prototype,"popupEnabled",void 0),e([u({type:t,json:_({name:"popupInfo"})})],W.prototype,"popupTemplate",void 0),e([u({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"relationships",null),e([u({types:x,json:_({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],W.prototype,"renderer",null),e([y("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([y("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([u({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"subtypeField",null),e([u({type:[T],json:_({name:"layerDefinition.templates"})})],W.prototype,"templates",void 0),e([y("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([u({type:String,json:_()})],W.prototype,"title",void 0),e([y("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([u({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([u({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([u({type:Boolean,nonNullable:!0,json:_({name:"visibility",spatialOnly:!0})})],W.prototype,"visible",void 0),W=e([c("esri.layers.support.SubtypeSublayer")],W);const z=(e,t,r)=>{if(!r)return t.createQuery();const n=P.from(r);return n.where=K(n.where,e.subtypeField,t.subtypeCode),n},K=(e,t,r)=>{const n=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,i=e??"";return n.test(i)?i.replace(n,o):d(o,i)},X=e=>new n(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Y=W;export{Y as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import o from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import l from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{writer as f}from"../../core/accessorSupport/decorators/writer.js";import{excludeTables as h}from"../../core/accessorSupport/layerContainerType.js";import b from"../../form/FormTemplate.js";import g from"../../geometry/SpatialReference.js";import{labelsVisible as j,legendEnabled as v,minScale as w,maxScale as F,popupEnabled as I}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as O}from"./featureLayerUtils.js";import S from"./FeatureTemplate.js";import{defineFieldProperties as C}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import q from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as R}from"./subtypeGroupLayerUtils.js";import P from"./TitleCreator.js";import L from"../../renderers/SimpleRenderer.js";import _ from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as M,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";import V from"../../tables/AttributeTableTemplate.js";const $=C();let U=0;function k(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=h),e}function Q(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=h),e?.target&&(t.write.target=e.target)),t}function B(e){return new L({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return M.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function J(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function W(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function Z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=W(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new S({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let z=class extends(p(r.ClonableMixin(o.IdentifiableMixin(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${U++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new P({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find((e=>e.name===t));if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++})),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find((e=>e.code===r)),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(Y("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&J(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(l)));e&&(n=new L({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??g.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[Z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=W(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw Y("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t={timeZone:"system",fetchMissingFields:!1}){return this._titleCreator.getTitle(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=O(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],z.prototype,"_titleCreator",null),e([y({type:V,json:Q({name:"attributeTableInfo"})})],z.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"effectiveCapabilities",null),e([y({json:Q()})],z.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:Q({name:"enableEditing"})})],z.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],z.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],z.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],z.prototype,"fieldOverrides",void 0),e([f("fieldOverrides")],z.prototype,"writeFieldOverrides",null),e([y({...$.fields,readOnly:!0,json:{read:!1}})],z.prototype,"fields",null),e([y($.fieldsIndex)],z.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"floorInfo",null),e([y({type:b,json:Q({name:"formInfo"})})],z.prototype,"formTemplate",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"type",void 0),e([y(k(n(j)))],z.prototype,"labelsVisible",void 0),e([y({type:[q],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:h}}})],z.prototype,"layerType",void 0),e([y(k(n(v)))],z.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],z.prototype,"listMode",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"minScale",void 0),e([y((()=>{const e=n(F);return e.json.origins.service.read=!1,k(e,{spatialOnly:!0})})())],z.prototype,"maxScale",void 0),e([y({readOnly:!0})],z.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:Q({spatialOnly:!0})})],z.prototype,"opacity",void 0),e([y({clonable:!1})],z.prototype,"parent",void 0),e([y(k(n(I)))],z.prototype,"popupEnabled",void 0),e([y({type:t,json:Q({name:"popupInfo"})})],z.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],z.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"relationships",null),e([y({types:R,json:Q({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],z.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","subtypeField","type"])],z.prototype,"readRendererFromService",null),e([c("renderer",["layerDefinition.drawingInfo.renderer"])],z.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],z.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"subtypeField",null),e([y({type:[S],json:Q({name:"layerDefinition.templates"})})],z.prototype,"templates",void 0),e([c("service","templates",["geometryType","subtypeField","subtypes","type"])],z.prototype,"readTemplatesFromService",null),e([y({type:String,json:Q()})],z.prototype,"title",void 0),e([c("service","title",["subtypes"])],z.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],z.prototype,"url",null),e([y({readOnly:!0})],z.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:Q({name:"visibility",spatialOnly:!0})})],z.prototype,"visible",void 0),z=e([m("esri.layers.support.SubtypeSublayer")],z);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=_.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},Y=e=>new i(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),ee=z;export{ee as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{createTask as s}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{featureHasFields as o,extractSubstitutionTemplatesFromString as n}from"./fieldUtils.js";import{loadArcade as l}from"../../support/arcadeOnDemand.js";const p="relationships/",c="expression/";let d=class extends t{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){if(this.expressionsUsedInTitle.length>0){return this._get("_arcadeTask")||s((()=>l()))}return null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??import("../../widgets/Feature/support/featureUtils.js").then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new i;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const s=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(s.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:s,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(s,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter((t=>e.includes(`{expression/${t.name.toLowerCase()}}`)))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some((e=>!0===e.invalid))}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const s of this.calculatedExpressions?.toArray()??[])try{const t=this._arcadeTask.value.arcade.extractFieldLiterals(s.syntax);for(const s of t){const t=s.split("."),i=this.fieldsIndex.get(t.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const s of t){const t=this.fieldsIndex.get(s);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,s){try{const{attributes:i}=t,r=s?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:a}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(s.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const s=this._createFormattedAttributes(e,t,r).global;return a({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:s,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const s=t.getObjectId();if(null==s)return t;if(!o(this.requiredFields,t)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[s];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const s of e){if(!s.fieldName)continue;const e=this.fieldsIndex.get(s.fieldName),i=e?.name??s.fieldName;s.fieldName=i,t.set(i.toLowerCase(),s)}return t}_createFormattedAttributes(e,t,s="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],r={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const s=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{r[`expression/${e.name}`]=e.func({vars:{$feature:s}})}catch{}}const a={...t.attributes,...r};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:a,graphic:t,timeZone:s,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return n(e).filter((e=>!(0===e.indexOf(p)||0===e.indexOf(c))))}};e([r({readOnly:!0})],d.prototype,"_arcadeTask",null),e([r()],d.prototype,"_featureUtils",void 0),e([r({readOnly:!0})],d.prototype,"featureUtilsPromise",null),e([r({readOnly:!0})],d.prototype,"calculatedExpressions",null),e([r()],d.prototype,"displayField",void 0),e([r()],d.prototype,"effectivePopupTemplate",void 0),e([r()],d.prototype,"expressionsUsedInTitle",null),e([r()],d.prototype,"fieldsIndex",void 0),e([r()],d.prototype,"fieldInfoMap",null),e([r()],d.prototype,"fields",void 0),e([r()],d.prototype,"objectIdField",void 0),e([r()],d.prototype,"requiredFields",null),d=e([a("esri.layers.support.TitleCreator")],d);const u=d;export{u as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import TrackInfo = __esri.TrackInfo;
4
+ export default TrackInfo;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import t from"../../core/JSONSupport.js";import{setDeepValue as s}from"../../core/object.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import n from"./AggregateField.js";import{popupEnabled as m}from"./commonProperties.js";import l from"./TrackPartInfo.js";import d from"../../renderers/SimpleRenderer.js";import{defaultPointSymbol2D as c,defaultPolylineSymbol2D as y}from"../../symbols/support/defaults.js";let j=class extends(r.ClonableMixin(t)){constructor(o){super(o),this.enabled=!0,this.fields=[],this.latestObservations=new l({renderer:new d({symbol:c.clone()})}),this.maxDisplayDuration=1/0,this.maxDisplayObservations=1/0,this.popupEnabled=!0,this.popupTemplate=null,this.previousObservations=new l({renderer:new d({symbol:c.clone()})}),this.trackLines=new l({renderer:new d({symbol:y.clone()})}),this.timeField="startTimeField"}writeFields(o,e,r){const t=o.filter((o=>"avg_angle"!==o.statisticType)).map((o=>o.toJSON()));s(r,t,e)}};o([p({type:Boolean,json:{write:!0}})],j.prototype,"enabled",void 0),o([p({type:[n],json:{write:!0}})],j.prototype,"fields",void 0),o([a("fields")],j.prototype,"writeFields",null),o([p({type:l,json:{write:!0}})],j.prototype,"latestObservations",void 0),o([p({type:Number,json:{write:!0}})],j.prototype,"maxDisplayDuration",void 0),o([p({type:Number,json:{write:!0}})],j.prototype,"maxDisplayObservations",void 0),o([p(m)],j.prototype,"popupEnabled",void 0),o([p({type:e,json:{name:"popupInfo",write:!0}})],j.prototype,"popupTemplate",void 0),o([p({type:l,json:{write:!0}})],j.prototype,"previousObservations",void 0),o([p({type:l,json:{write:!0}})],j.prototype,"trackLines",void 0),o([p({json:{read:!0,write:!0}})],j.prototype,"timeField",void 0),j=o([i("esri.layers.support.TrackInfo")],j);const u=j;export{u as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../PopupTemplate.js";import r from"../../core/Clonable.js";import t from"../../core/JSONSupport.js";import{setDeepValue as s}from"../../core/object.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as a}from"../../core/accessorSupport/decorators/writer.js";import n from"./AggregateField.js";import{popupEnabled as m}from"./commonProperties.js";import l from"./TrackPartInfo.js";import d from"../../renderers/SimpleRenderer.js";import{defaultPointSymbol2D as c,defaultPolylineSymbol2D as y}from"../../symbols/support/defaults.js";import j from"../../time/TimeInterval.js";let u=class extends(r.ClonableMixin(t)){constructor(e){super(e),this.enabled=!0,this.fields=[],this.latestObservations=new l({renderer:new d({symbol:c.clone()})}),this.maxDisplayDuration=null,this.maxDisplayObservationsPerTrack=0,this.popupEnabled=!0,this.popupTemplate=null,this.previousObservations=new l({renderer:new d({symbol:c.clone()})}),this.trackLines=new l({renderer:new d({symbol:y.clone()})}),this.timeField="startTimeField"}writeFields(e,o,r){const t=e.filter((e=>"avg_angle"!==e.statisticType)).map((e=>e.toJSON()));s(r,t,o)}};e([i({type:Boolean,json:{write:!0}})],u.prototype,"enabled",void 0),e([i({type:[n],json:{write:!0}})],u.prototype,"fields",void 0),e([a("fields")],u.prototype,"writeFields",null),e([i({type:l,json:{write:!0}})],u.prototype,"latestObservations",void 0),e([i({type:j,json:{write:!0}})],u.prototype,"maxDisplayDuration",void 0),e([i({type:Number,json:{write:!0}})],u.prototype,"maxDisplayObservationsPerTrack",void 0),e([i(m)],u.prototype,"popupEnabled",void 0),e([i({type:o,json:{name:"popupInfo",write:!0}})],u.prototype,"popupTemplate",void 0),e([i({type:l,json:{write:!0}})],u.prototype,"previousObservations",void 0),e([i({type:l,json:{write:!0}})],u.prototype,"trackLines",void 0),e([i({type:["timeReceived","startTimeField","endTimeField"],json:{read:!0,write:!0}})],u.prototype,"timeField",void 0),u=e([p("esri.layers.support.TrackInfo")],u);const f=u;export{f as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import TrackPartInfo = __esri.TrackPartInfo;
4
+ export default TrackPartInfo;