@arcgis/core 4.24.0-next.20220511 → 4.24.0-next.20220512

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 (231) hide show
  1. package/assets/components/assets/icon/compactness16.json +1 -0
  2. package/assets/components/assets/icon/compactness24.json +1 -0
  3. package/assets/components/assets/icon/compactness32.json +1 -0
  4. package/assets/components/assets/icon/configure16.json +1 -0
  5. package/assets/components/assets/icon/configure24.json +1 -0
  6. package/assets/components/assets/icon/configure32.json +1 -0
  7. package/assets/components/assets/icon/debugScript16.json +1 -0
  8. package/assets/components/assets/icon/debugScript24.json +1 -0
  9. package/assets/components/assets/icon/debugScript32.json +1 -0
  10. package/assets/components/assets/icon/dissolveFeatures16.json +1 -0
  11. package/assets/components/assets/icon/dissolveFeatures24.json +1 -0
  12. package/assets/components/assets/icon/dissolveFeatures32.json +1 -0
  13. package/assets/components/assets/icon/distanceType16.json +1 -0
  14. package/assets/components/assets/icon/distanceType24.json +1 -0
  15. package/assets/components/assets/icon/distanceType32.json +1 -0
  16. package/assets/components/assets/icon/gridDiamond16.json +1 -0
  17. package/assets/components/assets/icon/gridDiamond24.json +1 -0
  18. package/assets/components/assets/icon/gridDiamond32.json +1 -0
  19. package/assets/components/assets/icon/gridHexagon16.json +1 -0
  20. package/assets/components/assets/icon/gridHexagon24.json +1 -0
  21. package/assets/components/assets/icon/gridHexagon32.json +1 -0
  22. package/assets/components/assets/icon/gridTriangle16.json +1 -0
  23. package/assets/components/assets/icon/gridTriangle24.json +1 -0
  24. package/assets/components/assets/icon/gridTriangle32.json +1 -0
  25. package/assets/components/assets/icon/insets16.json +1 -0
  26. package/assets/components/assets/icon/insets24.json +1 -0
  27. package/assets/components/assets/icon/insets32.json +1 -0
  28. package/assets/components/assets/icon/maximumTerritoryDistance16.json +1 -0
  29. package/assets/components/assets/icon/maximumTerritoryDistance24.json +1 -0
  30. package/assets/components/assets/icon/maximumTerritoryDistance32.json +1 -0
  31. package/assets/components/assets/icon/minDistanceBetweenCenters16.json +1 -0
  32. package/assets/components/assets/icon/minDistanceBetweenCenters24.json +1 -0
  33. package/assets/components/assets/icon/minDistanceBetweenCenters32.json +1 -0
  34. package/assets/components/assets/icon/numberOfTerritories16.json +1 -0
  35. package/assets/components/assets/icon/numberOfTerritories24.json +1 -0
  36. package/assets/components/assets/icon/numberOfTerritories32.json +1 -0
  37. package/assets/components/assets/icon/overlapFeatures16.json +1 -0
  38. package/assets/components/assets/icon/overlapFeatures24.json +1 -0
  39. package/assets/components/assets/icon/overlapFeatures32.json +1 -0
  40. package/assets/components/assets/icon/profileVariables16.json +1 -0
  41. package/assets/components/assets/icon/profileVariables24.json +1 -0
  42. package/assets/components/assets/icon/profileVariables32.json +1 -0
  43. package/assets/components/assets/icon/rasterAnalysis16.json +1 -0
  44. package/assets/components/assets/icon/rasterAnalysis24.json +1 -0
  45. package/assets/components/assets/icon/rasterAnalysis32.json +1 -0
  46. package/assets/components/assets/icon/recurrence16.json +1 -0
  47. package/assets/components/assets/icon/recurrence24.json +1 -0
  48. package/assets/components/assets/icon/recurrence32.json +1 -0
  49. package/assets/components/assets/icon/splitFeatures16.json +1 -0
  50. package/assets/components/assets/icon/splitFeatures24.json +1 -0
  51. package/assets/components/assets/icon/splitFeatures32.json +1 -0
  52. package/assets/components/assets/icon/territoryBufferDistance16.json +1 -0
  53. package/assets/components/assets/icon/territoryBufferDistance24.json +1 -0
  54. package/assets/components/assets/icon/territoryBufferDistance32.json +1 -0
  55. package/assets/components/assets/icon/testData16.json +1 -0
  56. package/assets/components/assets/icon/testData24.json +1 -0
  57. package/assets/components/assets/icon/testData32.json +1 -0
  58. package/assets/esri/core/workers/RemoteClient.js +1 -1
  59. package/assets/esri/core/workers/chunks/07eda3e958d29f86b37e.js +1 -0
  60. package/assets/esri/core/workers/chunks/0ecaa28b8bff1d779d66.js +1 -0
  61. package/assets/esri/core/workers/chunks/{adae54f116f311d72d97.js → 1aba8c73c62a64e0658c.js} +1 -1
  62. package/assets/esri/core/workers/chunks/1d109cd048170e2d529a.js +1 -0
  63. package/assets/esri/core/workers/chunks/366e5c1abd1ab6d3e548.js +1 -0
  64. package/assets/esri/core/workers/chunks/3e94e35f44aadbb332ff.js +1 -0
  65. package/assets/esri/core/workers/chunks/46411f32b29a0e783105.js +1 -0
  66. package/assets/esri/core/workers/chunks/4d1c87e3e0a02efcc082.js +1 -0
  67. package/assets/esri/core/workers/chunks/{b089058b64db3912478f.js → 5e46e60fab93ad034d3a.js} +1 -1
  68. package/assets/esri/core/workers/chunks/6281b15009712a5dee3c.js +1 -0
  69. package/assets/esri/core/workers/chunks/66f627d68dbb0fdb725f.js +1 -0
  70. package/assets/esri/core/workers/chunks/672da24bbf86718bf48d.js +1 -0
  71. package/assets/esri/core/workers/chunks/733625d85602127d62cd.js +1 -0
  72. package/assets/esri/core/workers/chunks/{c51c9b5da855f84b9a48.js → 7391422fc51acb96a25d.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{f435dc615fdc8917f6ca.js → 7cf3cff7b28ff007dbad.js} +1 -1
  74. package/assets/esri/core/workers/chunks/7ea06c86adfc827fda08.js +1 -0
  75. package/assets/esri/core/workers/chunks/{a054a52712a118c6d505.js → 82bc24bdc9c6ebaf58c0.js} +1 -1
  76. package/assets/esri/core/workers/chunks/8965ab74e03506e3475e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{5405f478af3563580926.js → 8b497d9c37a8f577a467.js} +1 -1
  78. package/assets/esri/core/workers/chunks/919d0d8b1c2176760973.js +1 -0
  79. package/assets/esri/core/workers/chunks/ab2a0480dc2b608deda3.js +1 -0
  80. package/assets/esri/core/workers/chunks/ab97a35f7a7d5cf1da19.js +2 -0
  81. package/assets/esri/core/workers/chunks/{dcd0653191cd4a1ccaae.js.LICENSE.txt → ab97a35f7a7d5cf1da19.js.LICENSE.txt} +1 -1
  82. package/assets/esri/core/workers/chunks/ae554c88e862a5761f2e.js +1 -0
  83. package/assets/esri/core/workers/chunks/ae5ce55cd1a32525f101.js +1 -0
  84. package/assets/esri/core/workers/chunks/b597c04a4abb98e29d1c.js +1 -0
  85. package/assets/esri/core/workers/chunks/{287c484fd40eee643f3a.js → b78c3e9d31c4a562cdf0.js} +1 -1
  86. package/assets/esri/core/workers/chunks/be4bf1e4cbe2a593f8b3.js +1 -0
  87. package/assets/esri/core/workers/chunks/{b7572b0921b23aef8b9d.js → c40d9caf5189be2c698e.js} +1 -1
  88. package/assets/esri/core/workers/chunks/{b28539c5a6bedb71b038.js → d63f736b3560c577a8a4.js} +1 -1
  89. package/assets/esri/core/workers/chunks/d869dabe937d3b60504e.js +1 -0
  90. package/assets/esri/core/workers/chunks/dd6c9a114ad38cf622ba.js +1 -0
  91. package/assets/esri/core/workers/chunks/e6b0f74226b9394bfa7a.js +1 -0
  92. package/assets/esri/themes/base/widgets/_Editor.scss +3 -2
  93. package/assets/esri/themes/dark/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -0
  97. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -0
  98. package/chunks/EdgeShader.glsl.js +3 -4
  99. package/interfaces.d.ts +463 -30
  100. package/layers/FeatureLayer.js +1 -1
  101. package/layers/GeoJSONLayer.js +1 -1
  102. package/layers/OGCFeatureLayer.js +1 -1
  103. package/layers/RouteLayer.js +1 -1
  104. package/layers/SceneLayer.js +1 -1
  105. package/layers/StreamLayer.js +1 -1
  106. package/layers/SubtypeGroupLayer.js +1 -1
  107. package/layers/WFSLayer.js +1 -1
  108. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  109. package/layers/mixins/ArcGISImageService.js +1 -1
  110. package/layers/save/featureLayerUtils.js +1 -1
  111. package/layers/support/AggregateField.d.ts +4 -0
  112. package/layers/support/AggregateField.js +1 -1
  113. package/layers/support/FeatureReductionBinning.d.ts +4 -0
  114. package/layers/support/FeatureReductionBinning.js +1 -1
  115. package/layers/support/OutStatistic.d.ts +4 -0
  116. package/layers/support/Sublayer.js +1 -1
  117. package/layers/support/SubtypeSublayer.js +1 -1
  118. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  119. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  120. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  121. package/package.json +3 -3
  122. package/portal/support/portalItemUtils.js +1 -1
  123. package/renderers/PieChartRenderer.d.ts +4 -0
  124. package/renderers/PieChartRenderer.js +5 -0
  125. package/renderers/Renderer.js +1 -1
  126. package/renderers/support/AuthoringInfo.js +1 -1
  127. package/renderers/support/RasterSymbolizer.js +1 -1
  128. package/renderers/support/clickToleranceUtils.js +1 -1
  129. package/renderers/support/rasterRendererHelper.js +1 -1
  130. package/renderers/support/types.js +1 -1
  131. package/renderers/support/utils.js +1 -1
  132. package/renderers.js +1 -1
  133. package/request.js +1 -1
  134. package/rest/imageService/fetchRasterInfo.js +5 -0
  135. package/rest/imageService/getCatalogItemRasterInfo.js +5 -0
  136. package/rest/print.js +1 -1
  137. package/smartMapping/renderers/color.js +1 -1
  138. package/smartMapping/renderers/dotDensity.js +1 -1
  139. package/smartMapping/renderers/heatmap.js +1 -1
  140. package/smartMapping/renderers/location.js +1 -1
  141. package/smartMapping/renderers/size.js +1 -1
  142. package/smartMapping/renderers/type.js +1 -1
  143. package/support/arcadeUtils.js +1 -1
  144. package/support/revision.js +1 -1
  145. package/symbols/cim/CIMSymbolHelper.js +1 -1
  146. package/symbols/cim/CurveHelper.js +1 -1
  147. package/symbols/cim/ExpandedCIM.js +1 -1
  148. package/symbols/cim/cimAnalyzer.js +1 -1
  149. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  150. package/views/2d/engine/brushes.js +1 -1
  151. package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
  152. package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
  153. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  154. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  155. package/views/2d/engine/webgl/Painter.js +1 -1
  156. package/views/2d/engine/webgl/Utils.js +1 -1
  157. package/views/2d/engine/webgl/brushes/WGLBrushPieChart.js +5 -0
  158. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  159. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  160. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  161. package/views/2d/engine/webgl/color.js +1 -1
  162. package/views/2d/engine/webgl/definitions.js +1 -1
  163. package/views/2d/engine/webgl/enums.js +1 -1
  164. package/views/2d/engine/webgl/mesh/templates/WGLBaseFillTemplate.js +1 -1
  165. package/views/2d/engine/webgl/mesh/templates/WGLBaseLineTemplate.js +1 -1
  166. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  167. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  168. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  169. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  170. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +1 -1
  171. package/views/2d/engine/webgl/techniques/pieChart/TechniquePieChart.js +5 -0
  172. package/views/2d/engine/webgl/techniques/utils.js +1 -1
  173. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  174. package/views/2d/layers/features/schemaUtils.js +1 -1
  175. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  176. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  177. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  178. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  179. package/views/3d/analysis/Dimensioning/DimensioningTool.js +1 -1
  180. package/views/3d/analysis/Dimensioning/LengthDimensionVisualization.js +1 -1
  181. package/views/3d/environment/SnowyWeather.d.ts +4 -0
  182. package/views/3d/layers/I3SMeshView3D.js +1 -1
  183. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  184. package/views/3d/terrain/TerrainRenderer.js +1 -1
  185. package/views/3d/terrain/TerrainSurface.js +1 -1
  186. package/views/3d/terrain/TileRenderer.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +5 -5
  189. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  190. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  191. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  192. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  193. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +37 -31
  194. package/views/draw/DrawOperation.js +1 -1
  195. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  196. package/views/interactive/snapping/SceneSnappingEngine.js +5 -0
  197. package/views/interactive/snapping/SnappingManager.js +1 -1
  198. package/views/interactive/snapping/snappingFactory.js +5 -0
  199. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  200. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  201. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  202. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  203. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  204. package/widgets/Editor/workflowUtils.js +1 -1
  205. package/widgets/Editor.js +1 -1
  206. package/widgets/Popup/PopupViewModel.js +1 -1
  207. package/widgets/Popup/actionUtils.js +1 -1
  208. package/widgets/Sketch/SketchViewModel.js +1 -1
  209. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +0 -1
  210. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +0 -1
  211. package/assets/esri/core/workers/chunks/52478ee2d2a1354b6900.js +0 -1
  212. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +0 -1
  213. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +0 -1
  214. package/assets/esri/core/workers/chunks/875f26ee040f3d75c0db.js +0 -1
  215. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +0 -1
  216. package/assets/esri/core/workers/chunks/89acd5f888d6b8df4aad.js +0 -1
  217. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +0 -1
  218. package/assets/esri/core/workers/chunks/a3bb600bfcb0282622f1.js +0 -1
  219. package/assets/esri/core/workers/chunks/b50ae3dc7e43ff452568.js +0 -1
  220. package/assets/esri/core/workers/chunks/b5b7bcbc19b3430903ee.js +0 -1
  221. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +0 -1
  222. package/assets/esri/core/workers/chunks/cf47b605c31063e88357.js +0 -1
  223. package/assets/esri/core/workers/chunks/cfbb332d144e65a4a55d.js +0 -1
  224. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +0 -1
  225. package/assets/esri/core/workers/chunks/dc3ed59f450283d97a19.js +0 -1
  226. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +0 -2
  227. package/assets/esri/core/workers/chunks/dfb6a28039e5d5ce6fd4.js +0 -1
  228. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +0 -1
  229. package/assets/esri/core/workers/chunks/f7e0bb11ba3677069c94.js +0 -1
  230. package/assets/esri/core/workers/chunks/f7f3dde4c8f9c687cc1e.js +0 -1
  231. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import a from"../../core/Error.js";import{strict as o}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{aliasOf as y}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as g,Integer as R,ensureNumber as v}from"../../core/accessorSupport/ensureType.js";import{property as b,ensureRange as x}from"../../core/accessorSupport/decorators/property.js";import{reader as S}from"../../core/accessorSupport/decorators/reader.js";import{subclass as I}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as F}from"../support/commonProperties.js";import P from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as D}from"../support/ExportImageServiceParameters.js";import T from"../support/Field.js";import j from"../support/FieldsIndex.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as J}from"../support/rasterEnums.js";import q from"../support/RasterFunction.js";import V from"../support/RasterInfo.js";import A from"../support/RasterJobHandler.js";import{decode as z,getFormat as E}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as Q}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as U,getDefaultBandCombination as H,createDefaultRenderer as L,normalizeRendererJSON as k}from"../../renderers/support/rasterRendererHelper.js";import B from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as G,computePixelSpaceLocations as W,computeHistograms as X,computeStatisticsHistograms as Y,getImageSpatialReferenceQueryParameter as K,getSamples as $,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import re from"../../geometry/Point.js";import ie from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import se from"../../rest/support/FeatureSet.js";import ne from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ae}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import le from"../../rest/support/ImageAngleParameters.js";import ue from"../../rest/support/ImageHistogramParameters.js";import pe from"../../rest/support/ImageIdentifyParameters.js";import ce from"../../rest/support/ImagePixelLocationParameters.js";import me from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as de}from"../../views/2d/engine/flow/dataUtils.js";import he from"../../geometry/SpatialReference.js";const fe=u.getLogger("esri.layers.mixins.ArcGISImageService"),ye=o()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ge=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Re=x(v,{min:0,max:255});function ve(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const be=o=>{let u=class extends o{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=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.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterAttributeTable=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 D({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /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,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new j(this.fields):null}set format(e){e&&ge.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&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=Re(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer,n=r(s,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!s.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),O(n)||fe.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){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.rasterAttributeTableFieldPrefix||"Raster.",t=new T({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new T({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new T({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new T({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new T({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new T({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=q.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?q.fromJSON({rasterFunctionDefinition:t.renderingRule}):q.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?he.fromJSON(r):null}readPixelType(e){return ye.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=ye.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const a=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:a}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new a("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=g(le,e).clone(),G(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new a("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=g(ce,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new a("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=g(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new a("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=g(ue,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),Y(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new a("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new a("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>se.fromJSON(e.data)))}async getCatalogItemRasterInfo(e,t){const r=n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t}).then((e=>e.data)),i=n(this.parsedUrl.path+"/"+e+"/info/keyProperties",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>{})),s=await Promise.all([r,i]);if(!s[0])return;const a=te.fromJSON(s[0].extent),o=s[0].statistics?s[0].statistics.map((e=>({min:e[0],max:e[1],avg:e[2],stddev:e[3]}))):null;return new V({bandCount:s[0].bandCount,extent:a,spatialReference:a.sr,pixelSize:new re({x:s[0].pixelSizeX,y:s[0].pixelSizeY,spatialReference:a.sr}),pixelType:s[0].pixelType.toLowerCase(),statistics:o,histograms:s[0].histograms,keyProperties:s[1]||{}})}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},o=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:o.wkid||JSON.stringify(o),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([a,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new he({wkid:0,imageCoordinateSystem:i}));const b=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],x=b.length;if(x<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let S=0,I=0,w=0,_=0;for(let n=0;n<x;n++)S+=b[n].x,I+=b[n].y,w+=b[n].x*b[n].x,_+=b[n].x*b[n].y;const F=(x*_-S*I)/(x*w-S*S);let P=0;const D=b[p-1].x>b[0].x,T=b[p-1].y>b[0].y;return F===1/0?P=T?90:270:0===F?P=D?0:180:F>0?P=D?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(P=T?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:P}}async generateRasterInfo(e,t){if((!e||"none"===e?.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const r=ve(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=K(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:a,noData:o}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(a?.length&&this._hasRenderingRule(this.renderingRule)&&!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(",");o instanceof Array&&o.length>0&&(n.noData=o.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=m&&JSON.stringify(m),n.renderingRule=this._getRenderingRuleString(q.fromJSON(l));const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...d}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new a("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=g(me,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");e=g(pe,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new ne;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ae(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new a("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(o=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new q({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:o,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new pe(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,a=r.value.toLowerCase().includes("nodata");if(!(o&&!h&&r?.catalogItems?.features.length&&(n||!a)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new ne({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new ie(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new a("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):de(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):this._fetchAuxiliaryRasterInfo({serviceInfo:t,signal:e}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),fe.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.own(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const s=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),n=p(t.start)?t.start.getTime():null,a=p(t.end)?t.end.getTime():null,o=null==n||null==a||n===a,l=o?[n||a]:[[n,a]],u=this.version>=10.8;if(s.length)s.forEach((e=>{e.dimensionName===i&&(u?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=o,e.values=l))}));else if(!u){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=o,e.values=l})):e.multidimensionalDefinition.push(new P({variableName:"",dimensionName:i,isSlice:o,values:l}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new a("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?g(ne,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 A;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||U(this.rasterInfo).includes(this.renderer.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:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new a("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),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=H(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=k(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new B({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):z(e,t,r)}async _fetchMultidimensionalInfo(e){const t=await n(this.parsedUrl.path+"/multidimensionalInfo",{query:this._getQueryParams(),signal:e}).then((e=>e.data?.multidimensionalInfo));return t.variables?.length&&t.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),t}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _fetchAuxiliaryRasterInfo(e){const t=e&&e.serviceInfo;if(!t)throw new a("imagery-layer:fetch-metadata","valid serviceInfo is required");const r=e.signal,i=!!(t.hasRasterAttributeTable&&this.version>=10.1)&&n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.1?e?.renderingRule:null}),signal:r}).then((e=>se.fromJSON(e.data))).catch((()=>null)),s=!!(t.hasColormap&&this.version>=10.1)&&n(this.parsedUrl.path+"/colormap",{query:this._getQueryParams({renderingRule:this.version>=10.6?e?.renderingRule:null}),signal:r}).then((e=>e.data?.colormap)),o=!!(t.hasHistograms&&this.version>=10.1)&&n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({renderingRule:this.version>=10.1?e?.renderingRule:null}),signal:r}).then((e=>e.data?.histograms)),l=this.version>=10.3&&n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:e?.renderingRule}),signal:r}).then((e=>e.data)).catch((()=>{})),u=!!(t.hasMultidimensions&&this.version>=10.3)&&this._fetchMultidimensionalInfo(),p=await Promise.all([i,s,o,l,u]);let c=null;if(t.minValues&&t.minValues.length===t.bandCount){c=[];for(let e=0;e<t.minValues.length;e++)c.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}const m=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),d=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),h=he.fromJSON(t.spatialReference||t.extent.spatialReference);return new V({width:m,height:d,bandCount:t.bandCount,extent:te.fromJSON(t.extent),spatialReference:h,pixelSize:new re({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:h}),pixelType:t.pixelType.toLowerCase(),statistics:c,attributeTable:p[0]||null,colormap:p[1]||null,histograms:p[2]||null,keyProperties:p[3]||{},multidimensionalInfo:p[4]||null})}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),o=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([o,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=E(l)),!p)throw new a("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?z(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}async _generateRasterInfo(e,t){const{data:r}=await n(this.parsedUrl.path,{query:this._getQueryParams({renderingRule:e}),...t});return await this._fetchAuxiliaryRasterInfo({serviceInfo:r,renderingRule:e,...t})}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let a=!0,o=[n[0]];e.hasRanges&&!0===e.hasRanges?(a=!1,o=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(o=[n[1]]),i.push(new P({variableName:r,dimensionName:t[s].name,isSlice:a,values:o}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,o),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const a=this.fields&&this.fields.length>0;let o=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?a?y:i:g;this.renderingRule||(o=a?y:i),this._updateFeatureWithRasterAttributeTableValues(f,o)}if(f.sourceLayer=f.layer=this,a&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),a=n&&n[0];if(!a)return;const o=i.filter((e=>e.attributes[a]===(null!=t?parseInt(t,10):null)));o&&o[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=o[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new C({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Q([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=a[0],e.attributes["Raster.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 r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),a="esriImageServiceDataTypeElevation"===e.serviceDataType,o=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&o,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&a,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([b()],u.prototype,"_functionRasterInfos",void 0),e([b()],u.prototype,"_rasterJobHandler",void 0),e([b({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([S("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([b()],u.prototype,"_cachedRendererJson",void 0),e([b({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([S("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([b({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([S("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([b()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([b({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([b()],u.prototype,"adjustAspectRatio",void 0),e([b({readOnly:!0}),y("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([b({type:[R],json:{write:!0}})],u.prototype,"bandIds",void 0),e([S("bandIds")],u.prototype,"readBandIds",null),e([b({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([S("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([b({type:Number})],u.prototype,"compressionQuality",void 0),e([w("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([b({type:Number})],u.prototype,"compressionTolerance",void 0),e([w("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([b({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([b({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([b({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([b()],u.prototype,"rasterInfo",void 0),e([b({readOnly:!0,type:[T]})],u.prototype,"fields",void 0),e([b({readOnly:!0})],u.prototype,"fieldsIndex",null),e([b({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([S("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([b({type:te})],u.prototype,"fullExtent",void 0),e([b({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([b({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([b({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([b({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"interpolation",void 0),e([b()],u.prototype,"minScale",void 0),e([S("service","minScale")],u.prototype,"readMinScale",null),e([b()],u.prototype,"maxScale",void 0),e([S("service","maxScale")],u.prototype,"readMaxScale",null),e([b({type:N})],u.prototype,"mosaicRule",null),e([S("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([w("mosaicRule")],u.prototype,"writeMosaicRule",null),e([b({readOnly:!0}),y("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([b({json:{type:R}})],u.prototype,"noData",void 0),e([w("noData")],u.prototype,"writeNoData",null),e([b({type:String,json:{type:J.jsonValues,read:J.read,write:J.write}})],u.prototype,"noDataInterpretation",void 0),e([b({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([S("objectIdField")],u.prototype,"readObjectIdField",null),e([b({})],u.prototype,"geometryType",void 0),e([b({})],u.prototype,"typeIdField",void 0),e([b({})],u.prototype,"types",void 0),e([b({readOnly:!0})],u.prototype,"parsedUrl",null),e([b({readOnly:!0}),y("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([b({readOnly:!0}),y("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([b({type:Function})],u.prototype,"pixelFilter",void 0),e([b()],u.prototype,"raster",void 0),e([b()],u.prototype,"viewId",void 0),e([b({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],u.prototype,"renderer",null),e([S("renderer")],u.prototype,"readRenderer",null),e([w("renderer")],u.prototype,"writeRenderer",null),e([b()],u.prototype,"symbolizer",void 0),e([b(_)],u.prototype,"opacity",void 0),e([b({readOnly:!0}),y("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([b({readOnly:!0})],u.prototype,"rasterFields",null),e([b({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([b({type:q})],u.prototype,"renderingRule",null),e([S("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([w("renderingRule")],u.prototype,"writeRenderingRule",null),e([b()],u.prototype,"serviceDataType",void 0),e([b({readOnly:!0,type:he})],u.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([b({json:{type:ye.jsonValues}})],u.prototype,"pixelType",void 0),e([S("pixelType")],u.prototype,"readPixelType",null),e([w("pixelType")],u.prototype,"writePixelType",null),e([b({constructOnly:!0,type:V})],u.prototype,"serviceRasterInfo",void 0),e([b()],u.prototype,"sourceJSON",void 0),e([b(F)],u.prototype,"url",void 0),e([b({readOnly:!0})],u.prototype,"version",void 0),e([S("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([I("esri.layers.mixins.ArcGISImageService")],u),u};export{be as ArcGISImageService};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import{read as r,rasterRendererTypes as i,websceneRasterRendererTypes as s}from"../../rasterRenderers.js";import n from"../../request.js";import o from"../../core/Error.js";import{strict as a}from"../../core/jsonMap.js";import{clone as l}from"../../core/lang.js";import u from"../../core/Logger.js";import{isSome as p,isNone as c,unwrap as m}from"../../core/maybe.js";import{when as d}from"../../core/promiseUtils.js";import{watch as h}from"../../core/reactiveUtils.js";import{urlToObject as f}from"../../core/urlUtils.js";import{aliasOf as y}from"../../core/accessorSupport/decorators/aliasOf.js";import{ensureClass as g,Integer as R,ensureNumber as v}from"../../core/accessorSupport/ensureType.js";import{property as S,ensureRange as b}from"../../core/accessorSupport/decorators/property.js";import{reader as I}from"../../core/accessorSupport/decorators/reader.js";import{subclass as x}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{opacity as _,url as F}from"../support/commonProperties.js";import D from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as j}from"../support/ExportImageServiceParameters.js";import T from"../support/Field.js";import P from"../support/FieldsIndex.js";import{isSupportedRendererType as O}from"../support/imageryRendererUtils.js";import N from"../support/MosaicRule.js";import C from"../support/PixelBlock.js";import{interpolationKebab as M,noDataInterpretationKebab as J}from"../support/rasterEnums.js";import q from"../support/RasterFunction.js";import V from"../support/RasterInfo.js";import A from"../support/RasterJobHandler.js";import{decode as E,getFormat as Q}from"../support/rasterFormats/RasterCodec.js";import{uvComponentToVector as z}from"../support/rasterFunctions/vectorFieldUtils.js";import{getSupportedRendererTypes as H,getDefaultBandCombination as U,createDefaultRenderer as L,normalizeRendererJSON as B}from"../../renderers/support/rasterRendererHelper.js";import G from"../../renderers/support/RasterSymbolizer.js";import{computeAngles as k,computePixelSpaceLocations as W,computeHistograms as X,computeStatisticsHistograms as K,getImageSpatialReferenceQueryParameter as Y,getSamples as $,identify as Z}from"../../rest/imageService.js";import"../../core/has.js";import"../support/source/DataLayerSource.js";import{executeQueryJSON as ee}from"../../rest/query/executeQueryJSON.js";import"../../core/unitUtils.js";import"../../geometry/support/spatialReferenceUtils.js";import"../graphics/featureConversionUtils.js";import te from"../../geometry/Extent.js";import"../../geometry/Geometry.js";import"../../geometry/Multipoint.js";import"../../geometry/Point.js";import re from"../../geometry/Polygon.js";import"../../geometry/Polyline.js";import"../../geometry/support/normalizeUtils.js";import"../../core/pbf.js";import ie from"../../rest/support/FeatureSet.js";import se from"../../rest/support/Query.js";import"../../kernel.js";import"../../rest/query/support/AttachmentInfo.js";import"../../rest/support/AttachmentQuery.js";import{executeForCount as ne}from"../../rest/query/executeForCount.js";import{executeForIds as oe}from"../../rest/query/executeForIds.js";import"../../rest/support/RelationshipQuery.js";import"../../rest/support/TopFeaturesQuery.js";import{fetchServiceRasterInfo as ae,generateRasterInfo as le}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as ue}from"../../rest/imageService/getCatalogItemRasterInfo.js";import pe from"../../rest/support/ImageAngleParameters.js";import ce from"../../rest/support/ImageHistogramParameters.js";import me from"../../rest/support/ImageIdentifyParameters.js";import de from"../../rest/support/ImagePixelLocationParameters.js";import he from"../../rest/support/ImageSampleParameters.js";import{createStreamlinesMesh as fe}from"../../views/2d/engine/flow/dataUtils.js";import ye from"../../geometry/SpatialReference.js";const ge=u.getLogger("esri.layers.mixins.ArcGISImageService"),Re=a()({U1:"u1",U2:"u2",U4:"u4",U8:"u8",S8:"s8",U16:"u16",S16:"s16",U32:"u32",S32:"s32",F32:"f32",F64:"f64",C64:"c64",C128:"c128",UNKNOWN:"unknown"}),ve=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Se=b(v,{min:0,max:255});function be(e){if(!e)return null;const t=JSON.stringify(e).match(/"rasterFunction":"(.*?")/gi)?.map((e=>e.replace('"rasterFunction":"',"").replace('"',"")));return t?t.join("/"):null}const Ie=a=>{let u=class extends a{constructor(){super(...arguments),this._functionRasterInfos={},this._rasterJobHandler={instance:null,refCount:0,connectionPromise:null},this._defaultServiceMosaicRule=null,this._serviceSourceType=null,this._serviceSupportsMosaicRule=null,this.rasterAttributeTableFieldPrefix="Raster.",this.adjustAspectRatio=null,this.bandCount=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=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.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelSizeX=null,this.pixelSizeY=null,this.pixelFilter=null,this.raster=void 0,this.viewId=void 0,this.symbolizer=null,this.rasterAttributeTable=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 j({layer:this}))}readDefaultServiceMosaicRule(e,t){return this._serviceSupportsMosaicRule?N.fromJSON(t):null}readServiceSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.length<1||p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.forEach((t=>{e.set(t.name.toLowerCase().replace(/ /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,r){null!=e&&"lerc"!==this.format&&(t[r]=e)}writeCompressionTolerance(e,t,r){"lerc"===this.format&&null!=e&&(t[r]=e)}get fieldsIndex(){return this.fields?new P(this.fields):null}set format(e){e&&ve.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&&t.mosaicMethod&&(t=N.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const r=e||t.mosaicRule;return r?N.fromJSON(r):this._isMosaicRuleSupported(t)?N.fromJSON(t):null}writeMosaicRule(e,t,r){let i=this.mosaicRule;const s=this.definitionExpression;i?s&&s!==i.where&&(i=i.clone(),i.where=s):s&&(i=new N({where:s})),this._isValidCustomizedMosaicRule(i)&&(t[r]=i.toJSON())}writeNoData(e,t,r){null!=e&&"number"==typeof e&&(t[r]=Se(e))}readObjectIdField(e,t){if(!e){const r=t.fields.filter((e=>"esriFieldTypeOID"===e.type||"oid"===e.type));e=r&&r[0]&&r[0].name}return e}get parsedUrl(){return this.url?f(this.url):null}set renderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("renderer",e)}readRenderer(e,t,i){const s=t?.layerDefinition?.drawingInfo?.renderer,n=r(s,i);return null==n?null:("vector-field"===n.type&&t.symbolTileSize&&!s.symbolTileSize&&(n.symbolTileSize=t.symbolTileSize),O(n)||ge.warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),n)}writeRenderer(e,t,r){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.rasterAttributeTableFieldPrefix||"Raster.",t=new T({name:"Raster.ItemPixelValue",alias:"Item Pixel Value",domain:null,editable:!1,length:50,type:"string"}),r=new T({name:"Raster.ServicePixelValue",alias:"Service Pixel Value",domain:null,editable:!1,length:50,type:"string"}),i=new T({name:"Raster.ServicePixelValue.Raw",alias:"Raw Service Pixel Value",domain:null,editable:!1,length:50,type:"string"});let s=this.fields?l(this.fields):[];s.push(r),this.capabilities.operations.supportsQuery&&this.fields&&this.fields.length>0&&s.push(t),this.version>=10.4&&p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.some((e=>"none"===e.name.toLowerCase()))&&s.push(i),p(this.rasterFunctionInfos)&&this.rasterFunctionInfos.filter((e=>"none"!==e.name.toLowerCase())).forEach((e=>{s.push(new T({name:"Raster.ServicePixelValue."+e.name,alias:e.name,domain:null,editable:!1,length:50,type:"string"}))})),null==this.pixelFilter||"esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType||(s.push(new T({name:"Raster.Magnitude",alias:"Magnitude",domain:null,editable:!1,type:"double"})),s.push(new T({name:"Raster.Direction",alias:"Direction",domain:null,editable:!1,type:"double"})));const n=this.rasterInfo.attributeTable&&this.rasterInfo.attributeTable.fields||null;if(n&&n.length>0){const t=n.filter((e=>"esriFieldTypeOID"!==e.type&&"value"!==e.name.toLowerCase())).map((t=>{const r=l(t);return r.name=e+t.name,r}));s=s.concat(t)}return s}set renderingRule(e){let t=e;t&&t.rasterFunction&&(t=q.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("renderingRule",t)}readRenderingRule(e,t){const r=t.rasterFunctionInfos;return t.renderingRule||r&&r.length&&"None"!==r[0].name?this._isRFTJson(t.renderingRule)?q.fromJSON({rasterFunctionDefinition:t.renderingRule}):q.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}writeRenderingRule(e,t,r){const i=e.toJSON();i.rasterFunctionDefinition?t[r]=i.rasterFunctionDefinition:t[r]=i}readSpatialReference(e,t){const r=e||t.extent.spatialReference;return r?ye.fromJSON(r):null}readPixelType(e){return Re.fromJSON(e)||e}writePixelType(e,t,r){(c(this.serviceRasterInfo)||this.pixelType!==this.serviceRasterInfo.pixelType)&&(t[r]=Re.toJSON(e))}readVersion(e,t){let r=t.currentVersion;return r||(r=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),r}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let r=e;if(!this._isPicture()&&this.renderer&&this.symbolizer&&!this.pixelFilter){const i=JSON.stringify(this._cachedRendererJson)!==JSON.stringify(this.renderer.toJSON()),s=this._rasterJobHandler.instance,{bandIds:n}=this;if(s){i&&(this.symbolizer.bind(),await s.updateSymbolizer(this.symbolizer,t),this._cachedRendererJson=this.renderer.toJSON());const o=await s.symbolize({bandIds:n,...e},t);r={extent:e.extent,pixelBlock:o}}else r={extent:e.extent,pixelBlock:this.symbolizer.symbolize({bandIds:n,...e})}}return r}destroy(){this._shutdownJobHandler()}increaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount++}decreaseRasterJobHandlerUsage(){this._rasterJobHandler.refCount--,this._rasterJobHandler.refCount<=0&&this._shutdownJobHandler()}async computeAngles(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeAngles)throw new o("imagery-layer:compute-angles","this operation is not supported on the input image service");return e=g(pe,e).clone(),k(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputePixelLocation)throw new o("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=g(de,e).clone(),W(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeHistograms)throw new o("imagery-layer:compute-histograms","this operation is not supported on the input image service");e=g(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),X(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsComputeStatisticsHistograms)throw new o("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");e=g(ce,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;return s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule&&(e.mosaicRule=i),r&&null==e.raster&&(e.raster=r),K(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return p(t)?t.get(e):void 0}getFieldDomain(e,t){const r=this.getField(e);return r?r.domain:null}fetchImage(e,t,r,i={}){if(null==e||null==t||null==r)return Promise.reject(new o("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required."));const s=this.renderer||this.symbolizer?this.generateRasterInfo(this.renderingRule,{signal:i.signal}):null;return d(s).then((s=>{s&&(this.rasterInfo=s);const n={imageServiceParameters:this.getExportImageServiceParameters(e,t,r,i.timeExtent),imageProps:{extent:e,width:t,height:r,format:this.format},requestAsImageElement:i.requestAsImageElement&&!this.pixelFilter||!1,signal:i.signal};return this._requestArrayBuffer(n)}))}fetchKeyProperties(e){return n(this.parsedUrl.path+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>e.data))}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new o("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):n(this.parsedUrl.path+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.renderingRule:null})}).then((e=>ie.fromJSON(e.data)))}getCatalogItemRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return ue(this.parsedUrl.path,e,r)}async getCatalogItemICSInfo(e,t){const{data:r}=await n(this.parsedUrl.path+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),i=r&&r.ics;if(!i)return;let s=null;try{s=(await n(this.parsedUrl.path+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!s||!s.spatialReference)return{ics:i,icsToPixelTransform:null,icsExtent:null,northDirection:null};const o=this.version>=10.7?n(this.parsedUrl.path+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then((e=>e.data)).catch((()=>({}))):{},a=s.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[s]}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},u=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(l),...t}).then((e=>e.data)).catch((()=>({}))),p=5,c=(s.xmin+s.xmax)/2,m=(s.ymax-s.ymin)/(p+1),d=s.ymin+m,h=[];for(let n=0;n<p;n++)h.push({x:c,y:d+m*n});const f={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:h}),inSR:a.wkid||JSON.stringify(a),outSR:"0:"+e},y=n(this.parsedUrl.path+"/project",{query:this._getQueryParams(f),...t}).then((e=>e.data)).catch((()=>({}))),g=await Promise.all([o,u,y]);let R=g[0].ipxf;if(null==R){const e=i.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(R={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const v=te.fromJSON(g[1]&&g[1].geometries&&g[1].geometries[0]);v&&(v.spatialReference=new ye({wkid:0,imageCoordinateSystem:i}));const S=g[2].geometries?g[2].geometries.filter((e=>null!=e&&null!=e.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y)):[],b=S.length;if(b<3)return{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:null};let I=0,x=0,w=0,_=0;for(let n=0;n<b;n++)I+=S[n].x,x+=S[n].y,w+=S[n].x*S[n].x,_+=S[n].x*S[n].y;const F=(b*_-I*x)/(b*w-I*I);let D=0;const j=S[p-1].x>S[0].x,T=S[p-1].y>S[0].y;return F===1/0?D=T?90:270:0===F?D=j?0:180:F>0?D=j?180*Math.atan(F)/Math.PI:180*Math.atan(F)/Math.PI+180:F<0&&(D=T?180+180*Math.atan(F)/Math.PI:360+180*Math.atan(F)/Math.PI),{ics:i,icsToPixelTransform:R,icsExtent:v,northDirection:D}}async generateRasterInfo(e,t){if((!e||"none"===e?.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))&&p(this.serviceRasterInfo))return this.serviceRasterInfo;const r=be(e);if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const i=this._generateRasterInfo(e,t);this._functionRasterInfos[r]=i;try{return await i}catch{return this._functionRasterInfos[r]=null,null}}getExportImageServiceParameters(e,t,r,i){e=e.clone().shiftCentralMeridian();const s=Y(e.spatialReference,this.parsedUrl.path);p(this.serviceRasterInfo)&&this.pixelType!==this.serviceRasterInfo.pixelType&&(this.exportImageServiceParameters.pixelType=this.pixelType);const n=this.exportImageServiceParameters.toJSON(),{bandIds:o,noData:a}=n;let{renderingRule:l}=n;const u=this.renderingRule?.rasterFunctionDefinition,c=!this.renderer||"raster-stretch"===this.renderer.type;if(o?.length&&this._hasRenderingRule(this.renderingRule)&&!u&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};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=o?.join(",");a instanceof Array&&a.length>0&&(n.noData=a.join(","));const m=this._serviceSupportsMosaicRule?this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,i):null;n.mosaicRule=m&&JSON.stringify(m),n.renderingRule=this._getRenderingRuleString(q.fromJSON(l));const d={};if(i){const{start:e,end:t}=i.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${null==e?"null":e},${null==t?"null":t}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:s,imageSR:s,size:t+","+r,...n,...d}}async getSamples(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsGetSamples)throw new o("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=g(he,e).clone();const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),$(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsIdentify)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");e=g(me,e).clone();const{raster:r,mosaicRule:i,renderingRule:s}=this;if(s&&null==e.renderingRule&&(e.renderingRule=s),i&&null==e.mosaicRule){const t=this._combineMosaicRuleWithTimeExtent(i,e.timeExtent);e.mosaicRule=m(t)}return r&&null==e.raster&&(e.raster=r),Z(this.url,e,this._getRequestOptions(t))}createQuery(){const e=new se;return e.outFields=["*"],e.returnGeometry=!0,e.where=this.definitionExpression||"1=1",e}async queryRasters(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ee(this.url,e,t)}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),oe(this.url,e,t)}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),ne(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new o("imagery-layer: query-visible-rasters","missing query parameter");const{pixelSize:r,returnDomainValues:i,returnTopmostRaster:s,showNoDataRecords:n}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let a=!1,l=null,u=null;const m="raster.servicepixelvalue",d=this.rasterFunctionNamesIndex;if(p(e.outFields)&&(a=e.outFields.some((e=>!e.toLowerCase().includes(m))),this.version>=10.4)){const t=e.outFields.filter((e=>e.toLowerCase().includes(m)&&e.length>m.length)).map((e=>{const t=e.slice(m.length+1);return[this._updateRenderingRulesFunctionName(t,d),t]}));l=t.map((e=>new q({functionName:e[0]}))),u=t.map((e=>e[1])),0===l.length?this.renderingRule?(l.push(this.renderingRule),u.push(this.renderingRule.functionName)):l=null:this.renderingRule&&!l.some((e=>e.functionName===this.renderingRule.functionName))&&(l.push(this.renderingRule),u.push(this.renderingRule.functionName))}const h=c(e.outSpatialReference)||e.outSpatialReference.equals(this.spatialReference),f=e.timeExtent||this.timeExtent,y=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,f),g=this._getQueryParams({geometry:e.geometry,timeExtent:f,mosaicRule:y,renderingRule:this.version<10.4?this.renderingRule:null,renderingRules:l,pixelSize:r,returnCatalogItems:a,returnGeometry:h,raster:this.raster,maxItemCount:s?1:null});delete g.f;const R=new me(g);try{await this.generateRasterInfo(this.renderingRule);const r=await Z(this.url,R,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,o=r.value.toLowerCase().includes("nodata");if(!(a&&!h&&r?.catalogItems?.features.length&&(n||!o)))return this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s});const l=this.objectIdField||"ObjectId",c=r.catalogItems.features,m=c.map((e=>e.attributes?.[l])),d=new se({objectIds:m,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[l]}),f=await this.queryRasters(d);return f?.features?.length&&f.features.forEach((t=>{c.forEach((r=>{r.attributes[l]===t.attributes[l]&&(r.geometry=new re(t.geometry),p(e.outSpatialReference)&&(r.geometry.spatialReference=e.outSpatialReference))}))})),this._processVisibleRastersResponse(r,{returnDomainValues:i,templateRRFunctionNames:u,showNoDataRecords:n,templateFields:s})}catch{throw new o("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=n(this.parsedUrl.path+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.statistics)),i=n(this.parsedUrl.path+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then((e=>e.data?.histograms)),s=await Promise.all([r,i]);return s[0]&&s[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:s[0]||null,histograms:s[1]||null}}async createStreamlinesMesh(e,t){const r=this._rasterJobHandler.instance;return r?r.createStreamlinesMesh(e,t):fe(e.rendererSettings,e.flowData,p(t.signal)?t.signal:(new AbortController).signal)}async _fetchService(e){await this._fetchServiceInfo(e),p(this.serviceRasterInfo)&&!this.rasterInfo&&(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,r=p(this.serviceRasterInfo)?Promise.resolve(this.serviceRasterInfo):ae(this.parsedUrl.path,t,{signal:e,query:this._getQueryParams()}).then((e=>(this._set("serviceRasterInfo",e),e))),i=this._hasRenderingRule(this.renderingRule)?this.generateRasterInfo(this.renderingRule,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([r,i,s]).then((e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.renderer&&!this._isSupportedRenderer(this.renderer)&&(this._set("renderer",null),ge.warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("renderer",this._configRenderer(this.renderer)),this.own(h((()=>this.renderingRule),(e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this.generateRasterInfo(e).then((e=>{e&&(this.rasterInfo=e)}))})));const t=p(this.serviceRasterInfo)&&this.serviceRasterInfo.multidimensionalInfo;t&&this._updateMultidimensionalDefinition(t)}))}_combineMosaicRuleWithTimeExtent(e,t){const r=this.timeInfo;if(c(e)||c(this.multidimensionalInfo)||c(t)||c(r?.startField))return e;const{startField:i}=r;if(e=e.clone(),"mosaic-dataset"===this._serviceSourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter((e=>e.dimensionName!==i)),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const s=e.multidimensionalDefinition.filter((e=>e.dimensionName===i)),n=p(t.start)?t.start.getTime():null,o=p(t.end)?t.end.getTime():null,a=null==n||null==o||n===o,l=a?[n||o]:[[n,o]],u=this.version>=10.8;if(s.length)s.forEach((e=>{e.dimensionName===i&&(u?(e.dimensionName=null,e.isSlice=null,e.values=null):(e.isSlice=a,e.values=l))}));else if(!u){const t=e.multidimensionalDefinition.filter((e=>null!=e.variableName&&null==e.dimensionName));t.length?t.forEach((e=>{e.dimensionName=i,e.isSlice=a,e.values=l})):e.multidimensionalDefinition.push(new D({variableName:"",dimensionName:i,isSlice:a,values:l}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return c(e)?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter((e=>!(!e.variableName&&!e.dimensionName))),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this._serviceSourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(await this._fetchCapabilities(t?.signal),!this.capabilities.operations.supportsQuery)throw new o("imagery-layer:query-rasters","query operation is not supported on the input image service");return e=p(e)?g(se,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 A;this._rasterJobHandler.connectionPromise=e.initialize().then((()=>{this._rasterJobHandler.instance=e}),(()=>null)),await this._rasterJobHandler.connectionPromise}_shutdownJobHandler(){this._rasterJobHandler.instance&&this._rasterJobHandler.instance.destroy(),this._rasterJobHandler.instance=null,this._rasterJobHandler.connectionPromise=null,this._rasterJobHandler.refCount=0}_isSupportedRenderer(e){const{rasterInfo:t,renderingRule:r}=this;return"unique-value"===e.type&&this._hasRenderingRule(r)&&1===t.bandCount&&["u8","s8"].includes(t.pixelType)||H(this.rasterInfo).includes(this.renderer.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:i}=await n(this.parsedUrl.path,{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,i&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map((e=>e.trim())).indexOf("tilesonly")>-1)throw new o("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),r=e.currentVersion>=10.71&&e.hasMultidimensions&&e.timeInfo&&!(e.objectIdField&&e.fields?.length>1);return t||r}_isVectorFieldResampleFunction(e){if(c(e))return!1;const{functionName:t,functionArguments:r}=e,i="resample"===t?.toLowerCase(),s=r?.ResampleType||r?.resampleType;return i&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){if(!this._isPicture()&&!this.pixelFilter){if(!this.bandIds&&this.rasterInfo.bandCount>=3){const e=U(this.rasterInfo);!e||3===this.rasterInfo.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=L(this.rasterInfo,{bandIds:this.bandIds,variableName:this.renderingRule?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}));const t=B(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=t,this.symbolizer.rasterInfo=this.rasterInfo):this.symbolizer=new G({rendererJSON:t,rasterInfo:this.rasterInfo}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:p(e.pixelBlock)&&e.pixelBlock.clone()}}_getQueryParams(e){p(e?.renderingRule)&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:r}=this;return{raster:t,viewId:r,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,r){return this._rasterJobHandler.instance?this._rasterJobHandler.instance.decode({data:e,options:t}):E(e,t,r)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.serviceRasterInfo)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;return(await n(this.parsedUrl.path+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e})).data?.rasterFunctionInfos}return null}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,signal:i}=e;if(r&&!this.pixelFilter&&t.format?.indexOf("png")>-1){return{imageElement:(await n(this.parsedUrl.path+"/exportImage",{responseType:"image",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i})).data,params:t}}const s=this._initJobHandler(),a=n(this.parsedUrl.path+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:i}),l=(await Promise.all([a,s]))[0].data,u=t.format||"jpgpng";let p=u;if("bsq"!==p&&"bip"!==p&&(p=Q(l)),!p)throw new o("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(l)));const c={signal:i},m="gif"===u||"bmp"===u||u.includes("png")&&("png"===p||"jpg"===p)?E(l,{useCanvas:!0,...t},c):this._decodePixelBlock(l,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:u},c);return{pixelData:{pixelBlock:await m,extent:t.extent},params:t}}_generateRasterInfo(e,t){const r={...t,query:this._getQueryParams()};return le(this.parsedUrl.path,e,r)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this._defaultServiceMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;const t=e.variables[0].dimensions,r="",i=[];for(const s in t)if(t.hasOwnProperty(s)){const e=t[s],n=e.extent;let o=!0,a=[n[0]];e.hasRanges&&!0===e.hasRanges?(o=!1,a=[e.values[0]]):"stdz"===e.name.toLowerCase()&&Math.abs(n[1])<=Math.abs(n[0])&&(a=[n[1]]),i.push(new D({variableName:r,dimensionName:t[s].name,isSlice:o,values:a}))}if(i.length>0){this.mosaicRule=this.mosaicRule||new N;const e=this.mosaicRule.multidimensionalDefinition;(!e||e&&e.length<=0)&&(this.mosaicRule.multidimensionalDefinition=i)}}_processVisibleRastersResponse(e,r){r=r||{};const i=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:o,templateFields:a}=r,l=e.processedValues;let u=e.catalogItems&&e.catalogItems.features,c=e.properties&&e.properties.Values&&e.properties.Values.map((e=>e.replace(/ /gi,", ")))||[];const m=this.objectIdField||"ObjectId",d="string"==typeof i&&i.toLowerCase().includes("nodata"),h=[];if(i&&!u&&!d){const e={};e[m]=0;c=[i],u=[new t(this.fullExtent,null,e)]}if(!u)return[];let f,y,g;this._updateResponseFieldNames(u,a),d&&!n&&(u=[]);for(let t=0;t<u.length;t++){if(f=u[t],null!=i){if(y=c[t],g=this.renderingRule&&l&&l.length>0&&s&&s.length>0&&s.includes(this.renderingRule.functionName)?l[s.indexOf(this.renderingRule.functionName)]:i,"nodata"===y.toLowerCase()&&!n)continue;const e="Raster.ItemPixelValue",r="Raster.ServicePixelValue";f.attributes[e]=y,f.attributes[r]=g,this._updateFeatureWithMagDirValues(f,y);const o=this.fields&&this.fields.length>0;let a=this.renderingRule&&p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable?o?y:i:g;this.renderingRule||(a=o?y:i),this._updateFeatureWithRasterAttributeTableValues(f,a)}if(f.sourceLayer=f.layer=this,o&&this._updateFeatureWithDomainValues(f),s&&l&&s.length===l.length)for(let e=0;e<s.length;e++){const t="Raster.ServicePixelValue."+s[e];f.attributes[t]=l[e]}h.push(u[t])}return h}_updateFeatureWithRasterAttributeTableValues(e,t){const r=this.rasterInfo&&this.rasterInfo.attributeTable||p(this.serviceRasterInfo)&&this.serviceRasterInfo.attributeTable,i=r&&r.features;if(!i)return;const s=r.fields,n=s.map((e=>e.name)).filter((e=>"value"===e.toLowerCase())),o=n&&n[0];if(!o)return;const a=i.filter((e=>e.attributes[o]===(null!=t?parseInt(t,10):null)));a&&a[0]&&s.forEach((t=>{const r=this.rasterAttributeTableFieldPrefix+t.name;e.attributes[r]=a[0].attributes[t.name]}))}_updateFeatureWithMagDirValues(e,t){if("esriImageServiceDataTypeVector-UV"!==this.serviceDataType&&"esriImageServiceDataTypeVector-MagDir"!==this.serviceDataType)return;const r=t.split(/,\s*/).map((e=>parseFloat(e))),i=r.map((e=>[e])),s=r.map((e=>({minValue:e,maxValue:e,noDataValue:null}))),n=new C({height:1,width:1,pixelType:"f32",pixels:i,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new te(0,0,0,0,this.spatialReference)});const o="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:z([n.pixels[0][0],n.pixels[1][0]]);e.attributes["Raster.Magnitude"]=o[0],e.attributes["Raster.Direction"]=o[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter((e=>e.domain&&"coded-value"===e.domain.type));null!=t&&t.forEach((t=>{const r=e.attributes[t.name];if(null!=r){const i=t.domain.codedValues.find((e=>e.code===r));i&&(e.attributes[t.name]=i.name)}}))}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const r=this.fieldsIndex;c(r)||e.forEach((e=>{if(e&&e.attributes)for(const i of t)if(r.has(i)){const t=r.get(i).name;t!==i&&(e.attributes[i]=e.attributes[t],delete e.attributes[t])}}))}_getRenderingRuleString(e){if(this._hasRenderingRule(e)){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRenderingRule(e){return e&&e.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const r=e.toLowerCase().replace(/ /gi,"_");return t.has(r)?t.get(r):e}_isRFTJson(e){return e&&e.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map((e=>e.trim())):["image","catalog"],{currentVersion:r,advancedQueryCapabilities:i,maxRecordCount:s}=e,n=t.includes("image"),o="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!!(e.spatialReference||e.extent&&e.extent.spatialReference),l=t.includes("edit");return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:n,supportsExportImage:n,supportsIdentify:n,supportsMeasure:t.includes("mensuration")&&a,supportsDownload:t.includes("download"),supportsQuery:t.includes("catalog")&&e.fields&&e.fields.length>0,supportsGetSamples:r>=10.2&&n,supportsProject:r>=10.3&&n,supportsComputeStatisticsHistograms:r>=10.4&&n,supportsQueryBoundary:r>=10.6&&n,supportsCalculateVolume:r>=10.7&&o,supportsComputePixelLocation:r>=10.7&&t.includes("catalog"),supportsComputeAngles:r>=10.91,supportsAdd:l,supportsDelete:l,supportsEditing:l,supportsUpdate:l,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1},query:{maxRecordCount:s,maxRecordCountFactor:void 0,supportsStatistics:!!i?.supportsStatistics,supportsOrderBy:!!i?.supportsOrderBy,supportsDistinct:!!i?.supportsDistinct,supportsPagination:!!i?.supportsPagination,supportsStandardizedQueriesOnly:!!i?.useStandardizedQueries,supportsPercentileStatistics:!!i?.supportsPercentileStatistics,supportsCentroid:!!i?.supportsReturningGeometryCentroid,supportsDistance:!!i?.supportsQueryWithDistance,supportsExtent:!!i?.supportsReturningQueryExtent,supportsGeometryProperties:!!i?.supportsReturningGeometryProperties,supportsHavingClause:!!i?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:!1,supportsTopFeaturesQuery:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!i?.supportsDefaultSR,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}}}};return e([S()],u.prototype,"_functionRasterInfos",void 0),e([S()],u.prototype,"_rasterJobHandler",void 0),e([S({dependsOn:["_serviceSupportsMosaicRule"]})],u.prototype,"_defaultServiceMosaicRule",void 0),e([I("_defaultServiceMosaicRule",["defaultMosaicMethod"])],u.prototype,"readDefaultServiceMosaicRule",null),e([S()],u.prototype,"_cachedRendererJson",void 0),e([S({readOnly:!0})],u.prototype,"_serviceSourceType",void 0),e([I("_serviceSourceType",["serviceSourceType","fields"])],u.prototype,"readServiceSourceType",null),e([S({readOnly:!0})],u.prototype,"_serviceSupportsMosaicRule",void 0),e([I("_serviceSupportsMosaicRule",["currentVersion","fields"])],u.prototype,"readServiceSupportsMosaicRule",null),e([S()],u.prototype,"rasterAttributeTableFieldPrefix",void 0),e([S({readOnly:!0})],u.prototype,"rasterFunctionNamesIndex",null),e([S()],u.prototype,"adjustAspectRatio",void 0),e([S({readOnly:!0}),y("serviceRasterInfo.bandCount")],u.prototype,"bandCount",void 0),e([S({type:[R],json:{write:!0}})],u.prototype,"bandIds",void 0),e([I("bandIds")],u.prototype,"readBandIds",null),e([S({readOnly:!0,json:{read:!1}})],u.prototype,"capabilities",void 0),e([I("service","capabilities",["capabilities","currentVersion","serviceDataType"])],u.prototype,"readCapabilities",null),e([S({type:Number})],u.prototype,"compressionQuality",void 0),e([w("compressionQuality")],u.prototype,"writeCompressionQuality",null),e([S({type:Number})],u.prototype,"compressionTolerance",void 0),e([w("compressionTolerance")],u.prototype,"writeCompressionTolerance",null),e([S({json:{read:{source:"copyrightText"}}})],u.prototype,"copyright",void 0),e([S({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],u.prototype,"definitionExpression",void 0),e([S({readOnly:!0,constructOnly:!0})],u.prototype,"exportImageServiceParameters",void 0),e([S()],u.prototype,"rasterInfo",void 0),e([S({readOnly:!0,type:[T]})],u.prototype,"fields",void 0),e([S({readOnly:!0})],u.prototype,"fieldsIndex",null),e([S({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"],json:{write:!0}})],u.prototype,"format",null),e([I("service","format",["serviceDataType"])],u.prototype,"readFormat",null),e([S({type:te})],u.prototype,"fullExtent",void 0),e([S({readOnly:!0})],u.prototype,"hasMultidimensions",void 0),e([S({json:{read:{source:"maxImageHeight"}}})],u.prototype,"imageMaxHeight",void 0),e([S({json:{read:{source:"maxImageWidth"}}})],u.prototype,"imageMaxWidth",void 0),e([S({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],u.prototype,"interpolation",void 0),e([S()],u.prototype,"minScale",void 0),e([I("service","minScale")],u.prototype,"readMinScale",null),e([S()],u.prototype,"maxScale",void 0),e([I("service","maxScale")],u.prototype,"readMaxScale",null),e([S({type:N})],u.prototype,"mosaicRule",null),e([I("mosaicRule",["mosaicRule","defaultMosaicMethod"])],u.prototype,"readMosaicRule",null),e([w("mosaicRule")],u.prototype,"writeMosaicRule",null),e([S({readOnly:!0}),y("serviceRasterInfo.multidimensionalInfo")],u.prototype,"multidimensionalInfo",void 0),e([S({json:{type:R}})],u.prototype,"noData",void 0),e([w("noData")],u.prototype,"writeNoData",null),e([S({type:String,json:{type:J.jsonValues,read:J.read,write:J.write}})],u.prototype,"noDataInterpretation",void 0),e([S({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],u.prototype,"objectIdField",void 0),e([I("objectIdField")],u.prototype,"readObjectIdField",null),e([S({})],u.prototype,"geometryType",void 0),e([S({})],u.prototype,"typeIdField",void 0),e([S({})],u.prototype,"types",void 0),e([S({readOnly:!0})],u.prototype,"parsedUrl",null),e([S({readOnly:!0}),y("serviceRasterInfo.pixelSize.x")],u.prototype,"pixelSizeX",void 0),e([S({readOnly:!0}),y("serviceRasterInfo.pixelSize.y")],u.prototype,"pixelSizeY",void 0),e([S({type:Function})],u.prototype,"pixelFilter",void 0),e([S()],u.prototype,"raster",void 0),e([S()],u.prototype,"viewId",void 0),e([S({types:i,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:s,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type&&"flow"!==e.type})}}}}})],u.prototype,"renderer",null),e([I("renderer")],u.prototype,"readRenderer",null),e([w("renderer")],u.prototype,"writeRenderer",null),e([S()],u.prototype,"symbolizer",void 0),e([S(_)],u.prototype,"opacity",void 0),e([S({readOnly:!0}),y("serviceRasterInfo.attributeTable")],u.prototype,"rasterAttributeTable",void 0),e([S({readOnly:!0})],u.prototype,"rasterFields",null),e([S({constructOnly:!0})],u.prototype,"rasterFunctionInfos",void 0),e([S({type:q})],u.prototype,"renderingRule",null),e([I("renderingRule",["renderingRule","rasterFunctionInfos"])],u.prototype,"readRenderingRule",null),e([w("renderingRule")],u.prototype,"writeRenderingRule",null),e([S()],u.prototype,"serviceDataType",void 0),e([S({readOnly:!0,type:ye})],u.prototype,"spatialReference",void 0),e([I("spatialReference",["spatialReference","extent"])],u.prototype,"readSpatialReference",null),e([S({json:{type:Re.jsonValues}})],u.prototype,"pixelType",void 0),e([I("pixelType")],u.prototype,"readPixelType",null),e([w("pixelType")],u.prototype,"writePixelType",null),e([S({constructOnly:!0,type:V})],u.prototype,"serviceRasterInfo",void 0),e([S()],u.prototype,"sourceJSON",void 0),e([S(F)],u.prototype,"url",void 0),e([S({readOnly:!0})],u.prototype,"version",void 0),e([I("version",["currentVersion","fields","timeInfo"])],u.prototype,"readVersion",null),u=e([x("esri.layers.mixins.ArcGISImageService")],u),u};export{Ie 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{difference as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import r from"../../core/Logger.js";import{isNone as a,isSome as o}from"../../core/maybe.js";import{debounce as s,eachAlways as i}from"../../core/promiseUtils.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import l from"../FeatureLayer.js";import{fetchFeatureService as p}from"../support/arcgisLayers.js";import{isFeatureCollectionLayer as u}from"../support/layerUtils.js";import d from"../../portal/Portal.js";import c from"../../portal/PortalItem.js";import{createForItemWrite as f}from"../../portal/support/jsonContext.js";import{addTypeKeyword as m,TypeKeyword as y,getWGS84ExtentForItem as w,removeTypeKeyword as b}from"../../portal/support/portalItemUtils.js";const v=r.getLogger("esri.layers.FeatureLayer"),I="Feature Service";function h(e,t){return`Layer (title: ${e.title}, id: ${e.id}) of type '${e.declaredClass}' ${t}`}function g(e,r){if(r.type!==I)throw new t("feature-layer:portal-item-wrong-type",h(e,`should have portal item of type "${I}"`))}async function j(e){if(await e.load(),u(e))throw new t("feature-layer:save",h(e,"using an in-memory source cannot be saved to a portal item"));if(e.isTable)throw new t("feature-layer:save",h(e,"using a table source cannot be saved to a portal item"))}function S(e,r){let a=e.messages.filter((({type:e})=>"error"===e)).map((({name:e,message:r,details:a})=>new t(e,r,a)));if(r?.ignoreUnsupported&&(a=a.filter((({name:e})=>"layer:unsupported"!==e&&"symbol:unsupported"!==e&&"symbol-layer:unsupported"!==e&&"property:unsupported"!==e&&"url:unsupported"!==e))),a.length>0)throw new t("feature-layer:save","Failed to save feature layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function L(e,t,r){"beforeSave"in e&&"function"==typeof e.beforeSave&&await e.beforeSave();const a=e.write({},t);return S(t,r),a}function x(e,t){return e.isTable?{layers:[],tables:[t]}:{layers:[t],tables:[]}}function E(e){m(e,y.JSAPI),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}function T(e){const r=e.portalItem;if(!r)throw v.error("save: requires the portalItem property to be set"),new t("feature-layer:portal-item-not-set",h(e,"requires the portalItem property to be set"));if(!r.loaded)throw new t("feature-layer:portal-item-not-loaded",h(e,"cannot be saved to a portal item that does not exist or is inaccessible"));g(e,r)}async function U(e,t){const r=e.portalItem;if(/\/\d+\/?$/.test(r.url))return x(e,t);let a=await r.fetchData("json");return a&&null!=a.layers&&null!=a.tables||(a=await A(e,a)),J(e,t,a),a}async function A(e,t){var r,a;t||(t={}),(r=t).layers||(r.layers=[]),(a=t).tables||(a.tables=[]);const{url:o,layerId:s,customParameters:i,apiKey:n}=e,{serviceJSON:l,layersJSON:u}=await p(o,{customParameters:i,apiKey:n}),d=P(t.layers,l.layers,s),c=P(t.tables,l.tables,s);t.layers=d.itemResources,t.tables=c.itemResources;const f=[...d.added,...c.added],m=u?[...u.layers,...u.tables]:[];return await $(t,f,o,m),t}function P(t,r,a){const o=e(t,r,((e,t)=>e.id===t.id));t=t.filter((e=>!o.removed.some((t=>t.id===e.id))));const s=o.added.map((({id:e})=>({id:e})));return s.forEach((({id:e})=>{t.push({id:e})})),{itemResources:t,added:s.filter((({id:e})=>e!==a))}}async function $(e,t,r,o){const s=t.map((({id:e})=>new l({url:r,layerId:e,sourceJSON:o.find((({id:t})=>t===e))})));await i(s.map((e=>e.load()))),s.forEach((t=>{const{layerId:r,loaded:o,defaultPopupTemplate:s}=t;if(!o||a(s))return;J(t,{id:r,popupInfo:s.toJSON()},e)}))}function J(e,t,r){e.isTable?K(r.tables,t):K(r.layers,t)}function K(e,t){const r=e.findIndex((({id:e})=>e===t.id));-1===r?e.push(t):e[r]=t}function N(e,t){var r,a;let o=c.from(t);return o.id&&(o=o.clone(),o.id=null),(r=o).type??(r.type=I),(a=o).portal??(a.portal=d.getDefault()),g(e,o),o}async function O(e,t){const{url:r,title:a,fullExtent:s,isTable:i}=e;t.url=r,t.title||(t.title=a),t.extent=null,!i&&o(s)&&(t.extent=await w(s)),b(t,y.METADATA),b(t,y.MULTI_LAYER),m(t,y.SINGLE_LAYER),E(t)}async function R(e,t,r){const a=e.portal;await a._signIn(),await a.user.addItem({item:e,data:t,folder:r?.folder})}const F=s(D);async function D(e,t){await j(e),T(e);const r=e.portalItem,a=f(r),o=await L(e,a,t),s=await U(e,o);return E(r),await r.update({data:s}),n(a),r}const _=s(q);async function q(e,t,r){await j(e);const a=N(e,t),o=f(a),s=x(e,await L(e,o,r));return await O(e,a),await R(a,s,r),e.portalItem=a,n(o),a}export{F as save,_ as saveAs};
5
+ import{difference as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import r from"../../core/Logger.js";import{isNone as a,isSome as o}from"../../core/maybe.js";import{debounce as s,eachAlways as i}from"../../core/promiseUtils.js";import{updateOrigins as n}from"../../core/accessorSupport/originUtils.js";import l from"../FeatureLayer.js";import{fetchFeatureService as p}from"../support/arcgisLayers.js";import{isFeatureCollectionLayer as u}from"../support/layerUtils.js";import d from"../../portal/Portal.js";import c from"../../portal/PortalItem.js";import{createForItemWrite as f}from"../../portal/support/jsonContext.js";import{addTypeKeyword as m,TypeKeyword as y,getWGS84ExtentForItem as w,removeTypeKeyword as b}from"../../portal/support/portalItemUtils.js";const I=r.getLogger("esri.layers.FeatureLayer"),h="Feature Service";function v(e,t){return`Layer (title: ${e.title}, id: ${e.id}) of type '${e.declaredClass}' ${t}`}function g(e,r){if(r.type!==h)throw new t("feature-layer:portal-item-wrong-type",v(e,`should have portal item of type "${h}"`))}async function j(e){if(await e.load(),u(e))throw new t("feature-layer:save",v(e,"using an in-memory source cannot be saved to a portal item"))}function S(e,r){let a=e.messages.filter((({type:e})=>"error"===e)).map((({name:e,message:r,details:a})=>new t(e,r,a)));if(r?.ignoreUnsupported&&(a=a.filter((({name:e})=>"layer:unsupported"!==e&&"symbol:unsupported"!==e&&"symbol-layer:unsupported"!==e&&"property:unsupported"!==e&&"url:unsupported"!==e))),a.length>0)throw new t("feature-layer:save","Failed to save feature layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:a})}async function L(e,t,r){"beforeSave"in e&&"function"==typeof e.beforeSave&&await e.beforeSave();const a=e.write({},t);return S(t,r),a}function E(e,t){return e.isTable?{layers:[],tables:[t]}:{layers:[t],tables:[]}}function x(e){m(e,y.JSAPI),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}function T(e){const r=e.portalItem;if(!r)throw I.error("save: requires the portalItem property to be set"),new t("feature-layer:portal-item-not-set",v(e,"requires the portalItem property to be set"));if(!r.loaded)throw new t("feature-layer:portal-item-not-loaded",v(e,"cannot be saved to a portal item that does not exist or is inaccessible"));g(e,r)}async function A(e,t){const r=e.portalItem;if(/\/\d+\/?$/.test(r.url))return E(e,t);let a=await r.fetchData("json");return a&&null!=a.layers&&null!=a.tables||(a=await U(e,a)),J(e,t,a),a}async function U(e,t){var r,a;t||(t={}),(r=t).layers||(r.layers=[]),(a=t).tables||(a.tables=[]);const{url:o,layerId:s,customParameters:i,apiKey:n}=e,{serviceJSON:l,layersJSON:u}=await p(o,{customParameters:i,apiKey:n}),d=P(t.layers,l.layers,s),c=P(t.tables,l.tables,s);t.layers=d.itemResources,t.tables=c.itemResources;const f=[...d.added,...c.added],m=u?[...u.layers,...u.tables]:[];return await $(t,f,o,m),t}function P(t,r,a){const o=e(t,r,((e,t)=>e.id===t.id));t=t.filter((e=>!o.removed.some((t=>t.id===e.id))));const s=o.added.map((({id:e})=>({id:e})));return s.forEach((({id:e})=>{t.push({id:e})})),{itemResources:t,added:s.filter((({id:e})=>e!==a))}}async function $(e,t,r,o){const s=t.map((({id:e})=>new l({url:r,layerId:e,sourceJSON:o.find((({id:t})=>t===e))})));await i(s.map((e=>e.load()))),s.forEach((t=>{const{layerId:r,loaded:o,defaultPopupTemplate:s}=t;if(!o||a(s))return;J(t,{id:r,popupInfo:s.toJSON()},e)}))}function J(e,t,r){e.isTable?K(r.tables,t):K(r.layers,t)}function K(e,t){const r=e.findIndex((({id:e})=>e===t.id));-1===r?e.push(t):e[r]=t}function N(e,t){var r,a;let o=c.from(t);return o.id&&(o=o.clone(),o.id=null),(r=o).type??(r.type=h),(a=o).portal??(a.portal=d.getDefault()),g(e,o),o}async function O(e,t){const{url:r,title:a,fullExtent:s,isTable:i}=e;t.url=r,t.title||(t.title=a),t.extent=null,!i&&o(s)&&(t.extent=await w(s)),b(t,y.METADATA),b(t,y.MULTI_LAYER),m(t,y.SINGLE_LAYER),i&&m(t,y.TABLE),x(t)}async function R(e,t,r){const a=e.portal;await a._signIn(),await a.user.addItem({item:e,data:t,folder:r?.folder})}const F=s(D);async function D(e,t){await j(e),T(e);const r=e.portalItem,a=f(r),o=await L(e,a,t),s=await A(e,o);return x(r),await r.update({data:s}),n(a),r}const _=s(q);async function q(e,t,r){await j(e);const a=N(e,t),o=f(a),s=E(e,await L(e,o,r));return await O(e,a),await R(a,s,r),e.portalItem=a,n(o),a}export{F as save,_ as saveAs};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import AggregateField = __esri.AggregateField;
4
+ export default AggregateField;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import e from"./OutStatistic.js";var p;let i=p=class extends r{constructor(){super(...arguments),this.name=null}clone(){return new p({name:this.name,outStatistic:this.outStatistic.clone()})}};t([o({type:String,json:{write:!0}})],i.prototype,"name",void 0),t([o({type:e,json:{write:!0}})],i.prototype,"outStatistic",void 0),i=p=t([s("esri.layers.support.AggregateField")],i);const c=i;export{c as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import e from"./OutStatistic.js";var i;let p=i=class extends r{constructor(){super(...arguments),this.name=null,this.outStatistic=null}clone(){return new i({name:this.name,outStatistic:this.outStatistic.clone()})}};t([o({type:String,json:{write:!0}})],p.prototype,"name",void 0),t([o({type:e,json:{write:!0}})],p.prototype,"outStatistic",void 0),p=i=t([s("esri.layers.support.AggregateField")],p);const c=p;export{c as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import FeatureReductionBinning = __esri.FeatureReductionBinning;
4
+ export default FeatureReductionBinning;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as t}from"../../core/lang.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./AggregateField.js";import{labelsVisible as l,popupEnabled as a}from"./commonProperties.js";import{FeatureReduction as d}from"./FeatureReduction.js";import m from"./LabelClass.js";var u;let c=u=class extends d{constructor(){super(...arguments),this.type="binning",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[]}clone(){return new u({fields:t(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:t(this.labelingInfo),labelsVisible:this.labelsVisible,popupEnabled:this.popupEnabled,popupTemplate:t(this.popupTemplate),renderer:t(this.renderer)})}};e([i({binning:"binning"})],c.prototype,"type",void 0),e([s({type:Number,json:{write:!0}})],c.prototype,"fixedBinLevel",void 0),e([s({type:[m],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],c.prototype,"labelingInfo",void 0),e([s(l)],c.prototype,"labelsVisible",void 0),e([s(a)],c.prototype,"popupEnabled",void 0),e([s({type:r,json:{name:"popupInfo",write:!0}})],c.prototype,"popupTemplate",void 0),e([s({type:[n],json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],c.prototype,"fields",void 0),e([s({types:o,json:{write:!0}})],c.prototype,"renderer",void 0),c=u=e([p("esri.layers.support.FeatureReductionBinning")],c);const f=c;export{f as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as o}from"../../renderers/support/types.js";import{clone as t}from"../../core/lang.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import n from"./AggregateField.js";import{labelsVisible as l,popupEnabled as a}from"./commonProperties.js";import{FeatureReduction as d}from"./FeatureReduction.js";import m from"./LabelClass.js";var u;let c=u=class extends d{constructor(e){super(e),this.type="binning",this.fixedBinLevel=3,this.labelingInfo=null,this.labelsVisible=!0,this.popupEnabled=!0,this.popupTemplate=null,this.fields=[]}clone(){return new u({fields:t(this.fields),fixedBinLevel:this.fixedBinLevel,labelingInfo:t(this.labelingInfo),labelsVisible:this.labelsVisible,popupEnabled:this.popupEnabled,popupTemplate:t(this.popupTemplate),renderer:t(this.renderer)})}};e([i({binning:"binning"})],c.prototype,"type",void 0),e([s({type:Number,json:{write:!0}})],c.prototype,"fixedBinLevel",void 0),e([s({type:[m],json:{read:{source:"drawingInfo.labelingInfo"},write:{target:"drawingInfo.labelingInfo"}}})],c.prototype,"labelingInfo",void 0),e([s(l)],c.prototype,"labelsVisible",void 0),e([s(a)],c.prototype,"popupEnabled",void 0),e([s({type:r,json:{name:"popupInfo",write:!0}})],c.prototype,"popupTemplate",void 0),e([s({type:[n],json:{write:!0,origins:{"web-document":{write:!1},"portal-item":{write:!1}}}})],c.prototype,"fields",void 0),e([s({types:o,json:{write:!0}})],c.prototype,"renderer",void 0),c=u=e([p("esri.layers.support.FeatureReductionBinning")],c);const f=c;export{f as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import OutStatistic = __esri.OutStatistic;
4
+ export default OutStatistic;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as t}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as s}from"../../symbols.js";import a from"../../core/Collection.js";import l from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as m}from"../../core/sql.js";import{objectToQuery as h}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import{getProperties as g}from"../../core/accessorSupport/utils.js";import{cast as S}from"../../core/accessorSupport/decorators/cast.js";import{reader as I}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as j,ensureType as D,Integer as L,ensureClass as E}from"../../core/accessorSupport/ensureType.js";import{OriginId as F,nameToId as O}from"../../core/accessorSupport/PropertyOrigin.js";import x from"./FeatureType.js";import P from"./Field.js";import _ from"./FieldsIndex.js";import T from"./LabelClass.js";import N from"./LayerFloorInfo.js";import{DataLayerSource as M}from"./source/DataLayerSource.js";import{MapLayerSource as V}from"./source/MapLayerSource.js";import A from"../../rest/support/Query.js";import{createPopupTemplate as C}from"../../support/popupUtils.js";import U from"../../geometry/Extent.js";var R;function k(e){return e&&"esriSMS"===e.type}function q(e,r,i){const t=this.originIdOf(r)>=O(i.origin);return{ignoreOrigin:!0,allowNull:t,enabled:!!i&&("map-image"===i.layer?.type&&(i.writeSublayerStructure||t))}}function $(e,r,i){return{enabled:!!i&&("tile"===i.layer?.type&&this._isOverridden(r))}}function J(e,r,i){return{ignoreOrigin:!0,enabled:i&&i.writeSublayerStructure||!1}}function B(e,r,i){return{ignoreOrigin:!0,enabled:!!i&&(i.writeSublayerStructure||this.originIdOf(r)>=O(i.origin))}}const Q=u.getLogger("esri.layers.support.Sublayer");let G=0;const H=new Set;H.add("layer"),H.add("parent"),H.add("loaded"),H.add("loadStatus"),H.add("loadError"),H.add("loadWarnings");let K=R=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{if(!this.layer&&!this.url)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let r=null;if(!this.layer||this.originIdOf("url")>F.SERVICE||"data-layer"===this.source?.type){r=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{let i=this.id;"map-layer"===this.source?.type&&(i=this.source.mapLayerId),r=await this.layer.fetchSublayerInfo(i,e)}r&&(this.sourceJSON=r,this.read({layerDefinition:r},{origin:"service"}))})()),this}readCapabilities(e,r){const i=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[];return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i.includes("query")}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new _(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeGlobalID"===i.type)return i.name}get id(){const e=this._get("id");return null==e?G++:e}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,i,t){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},t)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeOID"===i.type)return i.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const i=r.layerDefinition;return 1-.01*(null!=i.transparency?i.transparency:i.drawingInfo.transparency)}writeOpacity(e,r,i,t){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=j(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(s(r)){Q.warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new V({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return D(a.ofType(R),e)}writeSublayers(e,r,i){this.get("sublayers.length")&&(r[i]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let i=(r=r.layerDefinition||r).typeIdField;if(i&&r.fields){i=i.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===i));e&&(i=e.name)}return null}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const i={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${h(i)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,i,t){r[i]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=g(this),r=new R;return g(r).store=e.clone(H),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return C(this,e)}createQuery(){return new A({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=this.layer?.parsedUrl,r=new(0,(await import("../FeatureLayer.js")).default)({url:e.path});return e&&this.source&&("map-layer"===this.source.type?r.layerId=this.source.mapLayerId:r.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(r.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(r.definitionExpression=this.definitionExpression),this.floorInfo&&(r.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>F.SERVICE&&(r.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>F.DEFAULTS&&(r.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>F.DEFAULTS&&(r.legendEnabled=this.legendEnabled),this.originIdOf("visible")>F.DEFAULTS&&(r.visible=this.visible),this.originIdOf("minScale")>F.DEFAULTS&&(r.minScale=this.minScale),this.originIdOf("maxScale")>F.DEFAULTS&&(r.maxScale=this.maxScale),this.originIdOf("opacity")>F.DEFAULTS&&(r.opacity=this.opacity),this.originIdOf("popupTemplate")>F.DEFAULTS&&(r.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>F.SERVICE&&(r.renderer=y(this.renderer)),"data-layer"===this.source?.type&&(r.dynamicDataSource=this.source.clone()),this.originIdOf("title")>F.DEFAULTS&&(r.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>F.DEFAULTS&&(r.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>F.DEFAULTS&&(r.customParameters=this.layer.customParameters),r}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:i}=this;if(!r||!e)return null;const t=e.attributes?e.attributes[r]:void 0;if(null==t)return null;let o=null;return i.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===t.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const i=r&&r.feature,t=this.getFeatureType(i);if(t){const r=t.domains&&t.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.get("capabilities.operations.supportsQuery"))throw new l("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:i},{default:t}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),o=await i(this.url,A.from(e),this.layer?.spatialReference??null,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}}),s=t.fromJSON(o.data);if(s?.features)for(const a of s.features)a.sourceLayer=this;return s}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},i=m(e,this.definitionExpression);c(i)&&(r.definitionExpression=i);const t=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(t).some((e=>t[e]>F.SERVICE));if(o){const e=r.drawingInfo={};t.renderer>F.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),t.labelsVisible>F.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&t.labelingInfo>F.SERVICE&&(e.labelingInfo=this.labelingInfo?this.labelingInfo.map((e=>e.write({},{origin:"service",layer:this.layer}))):null,e.showLabels=!0),t.opacity>F.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const i="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of i)k(e.symbol)&&r(e.symbol);"symbol"in e&&k(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&k(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const i=this.layer,t=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification"}const a=g(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.get(`capabilities.exportMap.${s}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&t!==r&&i&&i.emit&&i.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(Q.error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){Q.error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};K.test={isMapImageLayerOverridePolicy:e=>e===J||e===q,isTileImageLayerOverridePolicy:e=>e===$},e([b({readOnly:!0})],K.prototype,"capabilities",void 0),e([I("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],K.prototype,"readCapabilities",null),e([b({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:q}}})],K.prototype,"definitionExpression",null),e([b({type:[P],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],K.prototype,"fields",void 0),e([b({readOnly:!0})],K.prototype,"fieldsIndex",null),e([b({type:N,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:q},origins:{"web-scene":{read:!1,write:!1}}}})],K.prototype,"floorInfo",null),e([b({type:U,json:{read:{source:"layerDefinition.extent"}}})],K.prototype,"fullExtent",void 0),e([b({type:String})],K.prototype,"globalIdField",void 0),e([I("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],K.prototype,"readGlobalIdFieldFromService",null),e([b({type:L,json:{write:{ignoreOrigin:!0}}})],K.prototype,"id",null),e([b({value:null,type:[T],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:J}}})],K.prototype,"labelingInfo",null),e([w("labelingInfo")],K.prototype,"writeLabelingInfo",null),e([b({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:J}}})],K.prototype,"labelsVisible",null),e([b({value:null})],K.prototype,"layer",null),e([b({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:B}}})],K.prototype,"legendEnabled",void 0),e([b({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],K.prototype,"listMode",null),e([b({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"minScale",null),e([I("minScale",["minScale","layerDefinition.minScale"])],K.prototype,"readMinScale",null),e([b({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"maxScale",null),e([I("maxScale",["maxScale","layerDefinition.maxScale"])],K.prototype,"readMaxScale",null),e([b({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([b({type:String})],K.prototype,"objectIdField",void 0),e([I("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],K.prototype,"readObjectIdFieldFromService",null),e([b({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:J}}})],K.prototype,"opacity",null),e([I("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],K.prototype,"readOpacity",null),e([w("opacity")],K.prototype,"writeOpacity",null),e([b({json:{type:L,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:J}}})],K.prototype,"parent",void 0),e([w("parent")],K.prototype,"writeParent",null),e([b({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:B,writer(e,r,i){r[i]=!e}}}})],K.prototype,"popupEnabled",void 0),e([b({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:B}}})],K.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([b({types:i,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J},origins:{"web-scene":{types:t,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J}}}}})],K.prototype,"renderer",null),e([b({types:{key:"type",base:null,typeMap:{"data-layer":M,"map-layer":V}},cast(e){if(e){if("mapLayerId"in e)return E(V,e);if("dataSource"in e)return E(M,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:J}}})],K.prototype,"source",null),e([b()],K.prototype,"sourceJSON",void 0),e([b({value:null,json:{type:[L],write:{target:"subLayerIds",allowNull:!0,overridePolicy:J}}})],K.prototype,"sublayers",null),e([S("sublayers")],K.prototype,"castSublayers",null),e([w("sublayers")],K.prototype,"writeSublayers",null),e([b({type:String,json:{name:"name",write:{overridePolicy:B}}})],K.prototype,"title",void 0),e([b({type:String})],K.prototype,"typeIdField",void 0),e([I("typeIdField",["layerDefinition.typeIdField"])],K.prototype,"readTypeIdField",null),e([b({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],K.prototype,"types",void 0),e([b({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:$}}})],K.prototype,"url",null),e([b({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:J}}})],K.prototype,"visible",null),e([w("visible")],K.prototype,"writeVisible",null),K=R=e([v("esri.layers.support.Sublayer")],K);const W=K;export{W as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import r from"../../PopupTemplate.js";import"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import"../../renderers/Renderer.js";import"../../renderers/SimpleRenderer.js";import"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import{rendererTypes as i,webSceneRendererTypes as t}from"../../renderers/support/types.js";import o from"../../request.js";import{isSymbol3D as s}from"../../symbols.js";import a from"../../core/Collection.js";import l from"../../core/Error.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as y}from"../../core/lang.js";import d from"../../core/Loadable.js";import u from"../../core/Logger.js";import{isSome as c}from"../../core/maybe.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{sqlAnd as m}from"../../core/sql.js";import{objectToQuery as h}from"../../core/urlUtils.js";import{property as b}from"../../core/accessorSupport/decorators/property.js";import{getProperties as g}from"../../core/accessorSupport/utils.js";import{cast as S}from"../../core/accessorSupport/decorators/cast.js";import{reader as I}from"../../core/accessorSupport/decorators/reader.js";import{subclass as v}from"../../core/accessorSupport/decorators/subclass.js";import{writer as w}from"../../core/accessorSupport/decorators/writer.js";import{ensureInteger as j,ensureType as D,Integer as L,ensureClass as E}from"../../core/accessorSupport/ensureType.js";import{OriginId as F,nameToId as O}from"../../core/accessorSupport/PropertyOrigin.js";import x from"./FeatureType.js";import P from"./Field.js";import _ from"./FieldsIndex.js";import T from"./LabelClass.js";import N from"./LayerFloorInfo.js";import{DataLayerSource as M}from"./source/DataLayerSource.js";import{MapLayerSource as V}from"./source/MapLayerSource.js";import A from"../../rest/support/Query.js";import{createPopupTemplate as C}from"../../support/popupUtils.js";import U from"../../geometry/Extent.js";var R;function k(e){return e&&"esriSMS"===e.type}function q(e,r,i){const t=this.originIdOf(r)>=O(i.origin);return{ignoreOrigin:!0,allowNull:t,enabled:!!i&&("map-image"===i.layer?.type&&(i.writeSublayerStructure||t))}}function $(e,r,i){return{enabled:!!i&&("tile"===i.layer?.type&&this._isOverridden(r))}}function J(e,r,i){return{ignoreOrigin:!0,enabled:i&&i.writeSublayerStructure||!1}}function B(e,r,i){return{ignoreOrigin:!0,enabled:!!i&&(i.writeSublayerStructure||this.originIdOf(r)>=O(i.origin))}}const Q=u.getLogger("esri.layers.support.Sublayer");let G=0;const H=new Set;H.add("layer"),H.add("parent"),H.add("loaded"),H.add("loadStatus"),H.add("loadError"),H.add("loadWarnings");let K=R=class extends(n(f(p(d)))){constructor(e){super(e),this.capabilities=void 0,this.fields=null,this.fullExtent=null,this.globalIdField=null,this.legendEnabled=!0,this.objectIdField=null,this.popupEnabled=!0,this.popupTemplate=null,this.sourceJSON=null,this.title=null,this.typeIdField=null,this.types=null}async load(e){return this.addResolvingPromise((async()=>{if(!this.layer&&!this.url)throw new l("sublayer:missing-layer","Sublayer can't be loaded without being part of a layer",{sublayer:this});let r=null;if(!this.layer||this.originIdOf("url")>F.SERVICE||"data-layer"===this.source?.type){r=(await o(this.url,{responseType:"json",query:{f:"json"},...e})).data}else{let i=this.id;"map-layer"===this.source?.type&&(i=this.source.mapLayerId),r=await this.layer.fetchSublayerInfo(i,e)}r&&(this.sourceJSON=r,this.read({layerDefinition:r},{origin:"service"}))})()),this}readCapabilities(e,r){const i=(e=(r=r.layerDefinition||r).capabilities||e)?e.toLowerCase().split(",").map((e=>e.trim())):[];return{exportMap:{supportsModification:!!r.canModifyLayer},operations:{supportsQuery:i.includes("query")}}}set definitionExpression(e){this._setAndNotifyLayer("definitionExpression",e)}get fieldsIndex(){return new _(this.fields||[])}set floorInfo(e){this._setAndNotifyLayer("floorInfo",e)}readGlobalIdFieldFromService(e,r){if((r=r.layerDefinition||r).globalIdField)return r.globalIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeGlobalID"===i.type)return i.name}get id(){const e=this._get("id");return null==e?G++:e}set id(e){this._get("id")!==e&&(!1!==this.get("layer.capabilities.exportMap.supportsDynamicLayers")?this._set("id",e):this._logLockedError("id","capability not available 'layer.capabilities.exportMap.supportsDynamicLayers'"))}set labelingInfo(e){this._setAndNotifyLayer("labelingInfo",e)}writeLabelingInfo(e,r,i,t){e&&e.length&&(r.layerDefinition={drawingInfo:{labelingInfo:e.map((e=>e.write({},t)))}})}set labelsVisible(e){this._setAndNotifyLayer("labelsVisible",e)}set layer(e){this._set("layer",e),this.sublayers&&this.sublayers.forEach((r=>r.layer=e))}set listMode(e){this._set("listMode",e)}set minScale(e){this._setAndNotifyLayer("minScale",e)}readMinScale(e,r){return r.minScale||r.layerDefinition&&r.layerDefinition.minScale||0}set maxScale(e){this._setAndNotifyLayer("maxScale",e)}readMaxScale(e,r){return r.maxScale||r.layerDefinition&&r.layerDefinition.maxScale||0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}readObjectIdFieldFromService(e,r){if((r=r.layerDefinition||r).objectIdField)return r.objectIdField;if(r.fields)for(const i of r.fields)if("esriFieldTypeOID"===i.type)return i.name}set opacity(e){this._setAndNotifyLayer("opacity",e)}readOpacity(e,r){const i=r.layerDefinition;return 1-.01*(null!=i.transparency?i.transparency:i.drawingInfo.transparency)}writeOpacity(e,r,i,t){r.layerDefinition={drawingInfo:{transparency:100-100*e}}}writeParent(e,r){this.parent&&this.parent!==this.layer?r.parentLayerId=j(this.parent.id):r.parentLayerId=-1}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){if(e)for(const r of e.getSymbols())if(s(r)){Q.warn("Sublayer renderer should use 2D symbols");break}this._setAndNotifyLayer("renderer",e)}get source(){return this._get("source")||new V({mapLayerId:this.id})}set source(e){this._setAndNotifyLayer("source",e)}set sublayers(e){this._handleSublayersChange(e,this._get("sublayers")),this._set("sublayers",e)}castSublayers(e){return D(a.ofType(R),e)}writeSublayers(e,r,i){this.get("sublayers.length")&&(r[i]=this.sublayers.map((e=>e.id)).toArray().reverse())}readTypeIdField(e,r){let i=(r=r.layerDefinition||r).typeIdField;if(i&&r.fields){i=i.toLowerCase();const e=r.fields.find((e=>e.name.toLowerCase()===i));e&&(i=e.name)}return null}get url(){const e=this.layer?.parsedUrl??this._lastParsedUrl,r=this.source;if(!e)return null;if(this._lastParsedUrl=e,"map-layer"===r?.type)return`${e.path}/${r.mapLayerId}`;const i={layer:JSON.stringify({source:this.source})};return`${e.path}/dynamicLayer?${h(i)}`}set url(e){e?this._override("url",e):this._clearOverride("url")}set visible(e){this._setAndNotifyLayer("visible",e)}writeVisible(e,r,i,t){r[i]=this.getAtOrigin("defaultVisibility","service")||e}clone(){const{store:e}=g(this),r=new R;return g(r).store=e.clone(H),this.commitProperty("url"),r._lastParsedUrl=this._lastParsedUrl,r}createPopupTemplate(e){return C(this,e)}createQuery(){return new A({returnGeometry:!0,where:this.definitionExpression||"1=1"})}async createFeatureLayer(){if(this.hasOwnProperty("sublayers"))return null;const e=this.layer?.parsedUrl,r=new(0,(await import("../FeatureLayer.js")).default)({url:e.path});return e&&this.source&&("map-layer"===this.source.type?r.layerId=this.source.mapLayerId:r.dynamicDataSource=this.source),null!=this.layer.refreshInterval&&(r.refreshInterval=this.layer.refreshInterval),this.definitionExpression&&(r.definitionExpression=this.definitionExpression),this.floorInfo&&(r.floorInfo=y(this.floorInfo)),this.originIdOf("labelingInfo")>F.SERVICE&&(r.labelingInfo=y(this.labelingInfo)),this.originIdOf("labelsVisible")>F.DEFAULTS&&(r.labelsVisible=this.labelsVisible),this.originIdOf("legendEnabled")>F.DEFAULTS&&(r.legendEnabled=this.legendEnabled),this.originIdOf("visible")>F.DEFAULTS&&(r.visible=this.visible),this.originIdOf("minScale")>F.DEFAULTS&&(r.minScale=this.minScale),this.originIdOf("maxScale")>F.DEFAULTS&&(r.maxScale=this.maxScale),this.originIdOf("opacity")>F.DEFAULTS&&(r.opacity=this.opacity),this.originIdOf("popupTemplate")>F.DEFAULTS&&(r.popupTemplate=y(this.popupTemplate)),this.originIdOf("renderer")>F.SERVICE&&(r.renderer=y(this.renderer)),"data-layer"===this.source?.type&&(r.dynamicDataSource=this.source.clone()),this.originIdOf("title")>F.DEFAULTS&&(r.title=this.title),"map-image"===this.layer.type&&this.layer.originIdOf("customParameters")>F.DEFAULTS&&(r.customParameters=this.layer.customParameters),"tile"===this.layer.type&&this.layer.originIdOf("customParameters")>F.DEFAULTS&&(r.customParameters=this.layer.customParameters),r}getField(e){return this.fieldsIndex.get(e)}getFeatureType(e){const{typeIdField:r,types:i}=this;if(!r||!e)return null;const t=e.attributes?e.attributes[r]:void 0;if(null==t)return null;let o=null;return i.some((e=>{const{id:r}=e;return null!=r&&(r.toString()===t.toString()&&(o=e),!!o)})),o}getFieldDomain(e,r){const i=r&&r.feature,t=this.getFeatureType(i);if(t){const r=t.domains&&t.domains[e];if(r&&"inherited"!==r.type)return r}return this._getLayerDomain(e)}async queryFeatures(e=this.createQuery(),r){if(await this.load(),!this.get("capabilities.operations.supportsQuery"))throw new l("Sublayer.queryFeatures","this layer doesn't support queries.");const[{executeQuery:i},{default:t}]=await Promise.all([import("../../rest/query/operations/query.js"),import("../../rest/support/FeatureSet.js")]),o=await i(this.url,A.from(e),this.layer?.spatialReference??null,{...r,query:{...this.layer?.customParameters,token:this.layer?.apiKey}}),s=t.fromJSON(o.data);if(s?.features)for(const a of s.features)a.sourceLayer=this;return s}toExportImageJSON(e){const r={id:this.id,source:this.source?.toJSON()||{mapLayerId:this.id,type:"mapLayer"}},i=m(e,this.definitionExpression);c(i)&&(r.definitionExpression=i);const t=["renderer","labelingInfo","opacity","labelsVisible"].reduce(((e,r)=>(e[r]=this.originIdOf(r),e)),{}),o=Object.keys(t).some((e=>t[e]>F.SERVICE));if(o){const e=r.drawingInfo={};t.renderer>F.SERVICE&&(e.renderer=this.renderer?this.renderer.toJSON():null),t.labelsVisible>F.SERVICE&&(e.showLabels=this.labelsVisible),this.labelsVisible&&t.labelingInfo>F.SERVICE&&(e.labelingInfo=this.labelingInfo?this.labelingInfo.map((e=>e.write({},{origin:"service",layer:this.layer}))):null,e.showLabels=!0),t.opacity>F.SERVICE&&(e.transparency=100-100*this.opacity),this._assignDefaultSymbolColors(e.renderer)}return r}_assignDefaultSymbolColors(e){this._forEachSimpleMarkerSymbols(e,(e=>{e.color||"esriSMSX"!==e.style&&"esriSMSCross"!==e.style||(e.outline&&e.outline.color?e.color=e.outline.color:e.color=[0,0,0,0])}))}_forEachSimpleMarkerSymbols(e,r){if(e){const i="uniqueValueInfos"in e?e.uniqueValueInfos:"classBreakInfos"in e?e.classBreakInfos:[];for(const e of i)k(e.symbol)&&r(e.symbol);"symbol"in e&&k(e.symbol)&&r(e.symbol),"defaultSymbol"in e&&k(e.defaultSymbol)&&r(e.defaultSymbol)}}_setAndNotifyLayer(e,r){const i=this.layer,t=this._get(e);let o,s;switch(e){case"definitionExpression":case"floorInfo":o="supportsSublayerDefinitionExpression";case"minScale":case"maxScale":case"visible":o="supportsSublayerVisibility";break;case"labelingInfo":case"labelsVisible":case"opacity":case"renderer":case"source":o="supportsDynamicLayers",s="supportsModification"}const a=g(this).getDefaultOrigin();if("service"!==a){if(o&&!1===this.get(`layer.capabilities.exportMap.${o}`))return void this._logLockedError(e,`capability not available 'layer.capabilities.exportMap.${o}'`);if(s&&!1===this.get(`capabilities.exportMap.${s}`))return void this._logLockedError(e,`capability not available 'capabilities.exportMap.${s}'`)}"source"!==e||"not-loaded"===this.loadStatus?(this._set(e,r),"service"!==a&&t!==r&&i&&i.emit&&i.emit("sublayer-update",{propertyName:e,target:this})):this._logLockedError(e,"'source' can't be changed after calling sublayer.load()")}_handleSublayersChange(e,r){r&&(r.forEach((e=>{e.parent=null,e.layer=null})),this.handles.removeAll()),e&&(e.forEach((e=>{e.parent=this,e.layer=this.layer})),this.handles.add([e.on("after-add",(({item:e})=>{e.parent=this,e.layer=this.layer})),e.on("after-remove",(({item:e})=>{e.parent=null,e.layer=null})),e.on("before-changes",(e=>{const r=this.get("layer.capabilities.exportMap.supportsSublayersChanges");null==r||r||(Q.error(new l("sublayer:sublayers-non-modifiable","Sublayer can't be added, moved, or removed from the layer's sublayers",{sublayer:this,layer:this.layer})),e.preventDefault())}))]))}_logLockedError(e,r){Q.error(new l("sublayer:locked",`Property '${String(e)}' can't be changed on Sublayer from the layer '${this.layer.id}'`,{reason:r,sublayer:this,layer:this.layer}))}_getLayerDomain(e){const r=this.fieldsIndex.get(e);return r?r.domain:null}};K.test={isMapImageLayerOverridePolicy:e=>e===J||e===q,isTileImageLayerOverridePolicy:e=>e===$},e([b({readOnly:!0})],K.prototype,"capabilities",void 0),e([I("service","capabilities",["layerDefinition.canModifyLayer","layerDefinition.capabilities"])],K.prototype,"readCapabilities",null),e([b({type:String,value:null,json:{name:"layerDefinition.definitionExpression",write:{allowNull:!0,overridePolicy:q}}})],K.prototype,"definitionExpression",null),e([b({type:[P],json:{origins:{service:{read:{source:"layerDefinition.fields"}}}}})],K.prototype,"fields",void 0),e([b({readOnly:!0})],K.prototype,"fieldsIndex",null),e([b({type:N,value:null,json:{name:"layerDefinition.floorInfo",read:{source:"layerDefinition.floorInfo"},write:{target:"layerDefinition.floorInfo",overridePolicy:q},origins:{"web-scene":{read:!1,write:!1}}}})],K.prototype,"floorInfo",null),e([b({type:U,json:{read:{source:"layerDefinition.extent"}}})],K.prototype,"fullExtent",void 0),e([b({type:String})],K.prototype,"globalIdField",void 0),e([I("service","globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],K.prototype,"readGlobalIdFieldFromService",null),e([b({type:L,json:{write:{ignoreOrigin:!0}}})],K.prototype,"id",null),e([b({value:null,type:[T],json:{read:{source:"layerDefinition.drawingInfo.labelingInfo"},write:{target:"layerDefinition.drawingInfo.labelingInfo",overridePolicy:J}}})],K.prototype,"labelingInfo",null),e([w("labelingInfo")],K.prototype,"writeLabelingInfo",null),e([b({type:Boolean,value:!0,json:{read:{source:"layerDefinition.drawingInfo.showLabels"},write:{target:"layerDefinition.drawingInfo.showLabels",overridePolicy:J}}})],K.prototype,"labelsVisible",null),e([b({value:null})],K.prototype,"layer",null),e([b({type:Boolean,value:!0,json:{origins:{service:{read:{enabled:!1}}},read:{source:"showLegend"},write:{target:"showLegend",overridePolicy:B}}})],K.prototype,"legendEnabled",void 0),e([b({type:["show","hide","hide-children"],value:"show",json:{read:!1,write:!1,origins:{"web-scene":{read:!0,write:!0}}}})],K.prototype,"listMode",null),e([b({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"minScale",null),e([I("minScale",["minScale","layerDefinition.minScale"])],K.prototype,"readMinScale",null),e([b({type:Number,value:0,json:{write:{overridePolicy:J}}})],K.prototype,"maxScale",null),e([I("maxScale",["maxScale","layerDefinition.maxScale"])],K.prototype,"readMaxScale",null),e([b({readOnly:!0})],K.prototype,"effectiveScaleRange",null),e([b({type:String})],K.prototype,"objectIdField",void 0),e([I("service","objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],K.prototype,"readObjectIdFieldFromService",null),e([b({type:Number,value:1,json:{write:{target:"layerDefinition.drawingInfo.transparency",overridePolicy:J}}})],K.prototype,"opacity",null),e([I("opacity",["layerDefinition.drawingInfo.transparency","layerDefinition.transparency"])],K.prototype,"readOpacity",null),e([w("opacity")],K.prototype,"writeOpacity",null),e([b({json:{type:L,write:{target:"parentLayerId",writerEnsuresNonNull:!0,overridePolicy:J}}})],K.prototype,"parent",void 0),e([w("parent")],K.prototype,"writeParent",null),e([b({type:Boolean,value:!0,json:{read:{source:"disablePopup",reader:(e,r)=>!r.disablePopup},write:{target:"disablePopup",overridePolicy:B,writer(e,r,i){r[i]=!e}}}})],K.prototype,"popupEnabled",void 0),e([b({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo",overridePolicy:B}}})],K.prototype,"popupTemplate",void 0),e([b({readOnly:!0})],K.prototype,"defaultPopupTemplate",null),e([b({types:i,value:null,json:{name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J},origins:{"web-scene":{types:t,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:J}}}}})],K.prototype,"renderer",null),e([b({types:{key:"type",base:null,typeMap:{"data-layer":M,"map-layer":V}},cast(e){if(e){if("mapLayerId"in e)return E(V,e);if("dataSource"in e)return E(M,e)}return e},json:{name:"layerDefinition.source",write:{overridePolicy:J}}})],K.prototype,"source",null),e([b()],K.prototype,"sourceJSON",void 0),e([b({value:null,json:{type:[L],write:{target:"subLayerIds",allowNull:!0,overridePolicy:J}}})],K.prototype,"sublayers",null),e([S("sublayers")],K.prototype,"castSublayers",null),e([w("sublayers")],K.prototype,"writeSublayers",null),e([b({type:String,json:{name:"name",write:{overridePolicy:B}}})],K.prototype,"title",void 0),e([b({type:String})],K.prototype,"typeIdField",void 0),e([I("typeIdField",["layerDefinition.typeIdField"])],K.prototype,"readTypeIdField",null),e([b({type:[x],json:{origins:{service:{read:{source:"layerDefinition.types"}}}}})],K.prototype,"types",void 0),e([b({type:String,json:{read:{source:"layerUrl"},write:{target:"layerUrl",overridePolicy:$}}})],K.prototype,"url",null),e([b({type:Boolean,value:!0,json:{read:{source:"defaultVisibility"},write:{target:"defaultVisibility",overridePolicy:J}}})],K.prototype,"visible",null),e([w("visible")],K.prototype,"writeVisible",null),K=R=e([v("esri.layers.support.Sublayer")],K);const W=K;export{W as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import t from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import o from"../../renderers/Renderer.js";import i from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import{read as s}from"../../renderers/support/jsonUtils.js";import{webSceneRendererTypes as p}from"../../renderers/support/types.js";import{symbolTypesRenderer as a}from"../../symbols.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as d}from"../../core/Identifiable.js";import m from"../../core/Loadable.js";import y from"../../core/Logger.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{createTypeReader as g}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{labelsVisible as j,legendEnabled as v,minScale as S,maxScale as w,opacityDrawingInfo as I,popupEnabled as h}from"./commonProperties.js";import D from"./FeatureTemplate.js";import R from"./LabelClass.js";import{reader as T}from"./labelingInfo.js";import{createPopupTemplate as V}from"../../support/popupUtils.js";const x=y.getLogger("esri.layers.FeatureLayer"),P=g({types:a}),O={key:"type",base:o,typeMap:{simple:i,"unique-value":n,"class-breaks":t},errorContext:"renderer"};let C=class extends(l(f(d(m)))){constructor(e){super(e),this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.minScale=0,this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){this._set("renderer",e)}readRenderer(e,r,t){const o=(r=r.layerDefinition||r).drawingInfo&&r.drawingInfo.renderer||void 0;if(o){const e=s(o,r,t)||void 0;return e||x.error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:t}),e}if(r.defaultSymbol)return r.types&&r.types.length?new n({defaultSymbol:P(r.defaultSymbol,r,t),field:r.typeIdField,uniqueValueInfos:r.types.map((e=>({id:e.id,symbol:P(e.symbol,e,t)})))}):new i({symbol:P(r.defaultSymbol,r,t)})}readTemplates(e,r){return e=e&&e.map((e=>D.fromJSON(e)))}readVisible(e,r){return r.layerDefinition&&null!=r.layerDefinition.defaultVisibility?!!r.layerDefinition.defaultVisibility:null!=r.visibility?!!r.visibility:void 0}createPopupTemplate(e){const r=this.parent.fields;return V({...this,fields:r},e)}};e([u({json:{read:!1}})],C.prototype,"type",void 0),e([u(j)],C.prototype,"labelsVisible",void 0),e([u({type:[R],json:{origins:{service:{read:{source:"drawingInfo.labelingInfo",reader:T},write:{target:"drawingInfo.labelingInfo",enabled:!1}}},read:{source:"layerDefinition.drawingInfo.labelingInfo",reader:T},write:{target:"layerDefinition.drawingInfo.labelingInfo"}}})],C.prototype,"labelingInfo",void 0),e([u(v)],C.prototype,"legendEnabled",void 0),e([u(S)],C.prototype,"minScale",void 0),e([u(w)],C.prototype,"maxScale",void 0),e([u({readOnly:!0})],C.prototype,"effectiveScaleRange",null),e([u(I)],C.prototype,"opacity",void 0),e([u()],C.prototype,"parent",void 0),e([u(h)],C.prototype,"popupEnabled",void 0),e([u({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],C.prototype,"popupTemplate",void 0),e([u({readOnly:!0})],C.prototype,"defaultPopupTemplate",null),e([u({types:O,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{name:"layerDefinition.drawingInfo.renderer",types:p,write:{overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}})],C.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","defaultSymbol"]),c("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],C.prototype,"readRenderer",null),e([u({type:Number,json:{origins:{service:{read:!1,write:!1}},read:{source:"layerDefinition.subtypeCode"},write:{target:"layerDefinition.subtypeCode"}}})],C.prototype,"subtypeCode",void 0),e([u({type:[D]})],C.prototype,"templates",void 0),e([c("templates",["editFieldsInfo","creatorField","editorField","templates"])],C.prototype,"readTemplates",null),e([u()],C.prototype,"title",void 0),e([u({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],C.prototype,"visible",void 0),e([c("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],C.prototype,"readVisible",null),C=e([b("esri.layers.support.SubtypeSublayer")],C);const F=C;export{F as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../PopupTemplate.js";import t from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import o from"../../renderers/Renderer.js";import i from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import{read as s}from"../../renderers/support/jsonUtils.js";import{webSceneRendererTypes as p}from"../../renderers/support/types.js";import{symbolTypesRenderer as a}from"../../symbols.js";import{HandleOwnerMixin as l}from"../../core/HandleOwner.js";import{IdentifiableMixin as d}from"../../core/Identifiable.js";import m from"../../core/Loadable.js";import y from"../../core/Logger.js";import{MultiOriginJSONMixin as f}from"../../core/MultiOriginJSONSupport.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{createTypeReader as g}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{labelsVisible as j,legendEnabled as v,minScale as S,maxScale as w,opacityDrawingInfo as I,popupEnabled as h}from"./commonProperties.js";import D from"./FeatureTemplate.js";import R from"./LabelClass.js";import{reader as T}from"./labelingInfo.js";import{createPopupTemplate as P}from"../../support/popupUtils.js";const V=y.getLogger("esri.layers.FeatureLayer"),x=g({types:a}),C={key:"type",base:o,typeMap:{simple:i,"unique-value":n,"class-breaks":t},errorContext:"renderer"};let O=class extends(l(f(d(m)))){constructor(e){super(e),this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.legendEnabled=!0,this.minScale=0,this.maxScale=0,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}get effectiveScaleRange(){const{minScale:e,maxScale:r}=this;return{minScale:e,maxScale:r}}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){this._set("renderer",e)}readRenderer(e,r,t){const o=(r=r.layerDefinition||r).drawingInfo&&r.drawingInfo.renderer||void 0;if(o){const e=s(o,r,t)||void 0;return e||V.error("Failed to create renderer",{rendererDefinition:r.drawingInfo.renderer,layer:this,context:t}),e}if(r.defaultSymbol)return r.types&&r.types.length?new n({defaultSymbol:x(r.defaultSymbol,r,t),field:r.typeIdField,uniqueValueInfos:r.types.map((e=>({id:e.id,symbol:x(e.symbol,e,t)})))}):new i({symbol:x(r.defaultSymbol,r,t)})}readTemplates(e,r){return e=e&&e.map((e=>D.fromJSON(e)))}readVisible(e,r){return r.layerDefinition&&null!=r.layerDefinition.defaultVisibility?!!r.layerDefinition.defaultVisibility:null!=r.visibility?!!r.visibility:void 0}createPopupTemplate(e){const r=this.parent.fields;return P({...this,fields:r},e)}};e([u({json:{read:!1}})],O.prototype,"type",void 0),e([u(j)],O.prototype,"labelsVisible",void 0),e([u({type:[R],json:{origins:{service:{read:{source:"drawingInfo.labelingInfo",reader:T},write:{target:"drawingInfo.labelingInfo",enabled:!1}}},read:{source:"layerDefinition.drawingInfo.labelingInfo",reader:T},write:{target:"layerDefinition.drawingInfo.labelingInfo"}}})],O.prototype,"labelingInfo",void 0),e([u(v)],O.prototype,"legendEnabled",void 0),e([u(S)],O.prototype,"minScale",void 0),e([u(w)],O.prototype,"maxScale",void 0),e([u({readOnly:!0})],O.prototype,"effectiveScaleRange",null),e([u(I)],O.prototype,"opacity",void 0),e([u()],O.prototype,"parent",void 0),e([u(h)],O.prototype,"popupEnabled",void 0),e([u({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],O.prototype,"popupTemplate",void 0),e([u({readOnly:!0})],O.prototype,"defaultPopupTemplate",null),e([u({types:C,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{name:"layerDefinition.drawingInfo.renderer",types:p,write:{overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,r,t)=>({ignoreOrigin:t?.writeLayerSchema})}}})],O.prototype,"renderer",null),e([c("service","renderer",["drawingInfo.renderer","defaultSymbol"]),c("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],O.prototype,"readRenderer",null),e([u({type:Number,json:{origins:{service:{read:!1,write:!1}},read:{source:"layerDefinition.subtypeCode"},write:{target:"layerDefinition.subtypeCode"}}})],O.prototype,"subtypeCode",void 0),e([u({type:[D]})],O.prototype,"templates",void 0),e([c("templates",["editFieldsInfo","creatorField","editorField","templates"])],O.prototype,"readTemplates",null),e([u()],O.prototype,"title",void 0),e([u({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility"}}}}})],O.prototype,"visible",void 0),e([c("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],O.prototype,"readVisible",null),O=e([b("esri.layers.support.SubtypeSublayer")],O);const F=O;export{F as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,isNone as s,unwrap as a}from"../../../core/maybe.js";import{urlToObject as l}from"../../../core/urlUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import o from"../RasterInfo.js";import m from"../RasterStorageInfo.js";import{readServiceTileInfo as c}from"../serviceTileInfoProperty.js";import h from"../TileInfo.js";import{TilemapCache as u}from"../TilemapCache.js";import p from"./BaseRaster.js";import{setValidBoundary as f}from"../rasterFunctions/pixelUtils.js";import d from"../rasterTransforms/GCSShiftTransform.js";import y from"../../../rest/support/FeatureSet.js";import x from"../../../geometry/SpatialReference.js";import g from"../../../geometry/Extent.js";import v from"../../../geometry/Point.js";let S=class extends p{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const s=e&&e.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:s});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const r=a.data;if(this.sourceJSON=r,!r)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!r.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const n=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=r.cacheType,null==this.tileType&&(n.includes(r.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===r.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=r.name.slice(r.name.indexOf("/")+1);const o=await this._fetchRasterInfo({signal:s});if(!i(o))throw new t("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?c(r.tileInfo,r):h.fromJSON(r.tileInfo),{extent:t,pixelSize:i}=o,s=.5/o.width*i.x;let a,l;const n=e.lodAt(Math.max.apply(null,e.lods.map((e=>e.level))));"Map"!==this.tileType&&0!==r.maxScale&&("Raster"===this.tileType?(a=e.lods.find((e=>e.resolution===i.x)),a||(a=e.lods[e.lods.length-1])):(a=e.lods.find((e=>Math.abs(e.scale-r.maxScale)<s)),a||(a=e.lods.filter((e=>e.scale>r.maxScale)).sort(((e,t)=>e.scale>t.scale?1:-1))[0])),i.x=i.y=a.resolution,o.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),o.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),a||(a=n);const u=e.lodAt(Math.min.apply(null,e.lods.map((e=>e.level))));"Map"===this.tileType?this._levelOffset=e.lods[0].level:0!==r.minScale&&"Elevation"===this.tileType&&(l=e.lods.find((e=>Math.abs(e.scale-r.minScale)<s)),this._levelOffset=l.level-u.level),l||(l=u);const p=Math.max(i.x,i.y);(Math.abs(i.x-i.y)>s||!e.lods.some((e=>Math.abs(e.resolution-p)<s)))&&(i.x=i.y=a.resolution,o.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),o.height=Math.ceil((t.ymax-t.ymin)/i.y-.1));const f=a.level-l.level,[d,y]=e.size,x=[];e.lods.forEach((e=>{e.level>=l.level&&e.level<=a.level&&x.push({x:e.resolution,y:e.resolution})})),x.sort(((e,t)=>e.x-t.x));const g=this.computeBlockBoundary(t,d,y,e.origin,x,f),v=x.length>1?x.slice(1):null;let S;r.transposeInfo&&(S={tileSize:[r.transposeInfo.rows,r.transposeInfo.cols],packetSize:o.keyProperties?._yxs.PacketSize??0}),o.storageInfo=new m({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],pyramidResolutions:v,compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:f,tileInfo:e,transposeInfo:S,blockBoundary:g}),this._fixGCSShift(o),this._set("rasterInfo",o)}if(r.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:o.storageInfo.tileInfo,parsedUrl:l(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new u({layer:e})}}async fetchRawTile(e,t,s,a={}){const{storageInfo:l,extent:r}=this.rasterInfo,{transposeInfo:n}=l,o=i(n)&&!!a.transposedVariableName;if(this._slices&&!o&&null==a.sliceId)return null;const m=o?0:l.maximumPyramidLevel-e+this._levelOffset,c=`${this.url}/tile/${m}/${t}/${s}`,h=this._slices?o?{variable:a.transposedVariableName}:{sliceId:a.sliceId||0}:null,{data:u}=await this.request(c,{query:h,responseType:"array-buffer",signal:a.signal});if(!u)return null;const p=o?n.tileSize:l.tileInfo.size,d=await this.decodePixelBlock(u,{width:p[0],height:p[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnPixelInterleavedDims:o}),y=l.blockBoundary[e];if("jpg"!==l.compression||s>y.minCol&&s<y.maxCol&&t>y.minRow&&t<y.maxRow)return d;const{origin:x,blockWidth:g,blockHeight:v}=l,{x:S,y:I}=this.getPyramidPixelSize(e),w=Math.round((r.xmin-x.x)/S)%g,b=Math.round((r.xmax-x.x)/S)%g||g,j=Math.round((x.y-r.ymax)/I)%v,T=Math.round((x.y-r.ymin)/I)%v||v,_=s===y.minCol?w:0,M=t===y.minRow?j:0,R=s===y.maxCol?b:g,z=t===y.maxRow?T:v;return f(d,{x:_,y:M},{width:R-_,height:z-M}),d}getSliceIndex(e){if(!this._slices||s(e)||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),a=await Promise.all([i,s]);return a[0]&&a[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,a(t.datumTransformation));if(null===i)return null;let s=0;const{maximumPyramidLevel:l}=this.rasterInfo.storageInfo;let r=l-s+this._levelOffset;const n=i.srcLocation;for(;r>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(r,i.row,i.col,t))break}catch{}if(r--,s++,i=this.identifyPixelLocation(n,s,a(t.datumTransformation)),null===i)return null}return-1===r||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON,i=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),s=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),a=x.fromJSON(t.spatialReference||t.extent.spatialReference);if("Map"===this.tileType)return new o({width:i,height:s,bandCount:3,extent:g.fromJSON(t.extent),spatialReference:a,pixelSize:new v({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a}),pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}});const{slice:l,signal:r}=e,n=!!t.hasRasterAttributeTable&&this.request(this.url+"/rasterAttributeTable",{query:{slice:l,f:"json"},signal:r}).then((e=>y.fromJSON(e.data))).catch((()=>null)),m=!!t.hasColormap&&this.request(this.url+"/colormap",{query:{slice:l,f:"json"},signal:r}).then((e=>e.data?.colormap)),c=!!t.hasHistograms&&this.request(this.url+"/histograms",{query:{slice:l,f:"json"},signal:r}).then((e=>e.data?.histograms)),h=this.request(this.url+"/keyProperties",{query:{f:"json"},signal:r}).then((e=>e.data)).catch((()=>{})),u=!!t.hasMultidimensions&&this._fetchMultidimensionalInfo(),p=!!t.hasMultidimensions&&this.request(this.url+"/slices",{query:{f:"json"},signal:r}).then((e=>e.data&&e.data.slices)).catch((()=>{}));return Promise.all([n,m,c,h,u,p]).then((e=>{let l=null;if(t.minValues&&t.minValues.length===t.bandCount){l=[];for(let e=0;e<t.minValues.length;e++)l.push({min:t.minValues[e],max:t.maxValues[e],avg:t.meanValues[e],stddev:t.stdvValues[e]})}return this._slices=e[5]||null,new o({width:i,height:s,bandCount:t.bandCount,extent:g.fromJSON(t.extent),spatialReference:a,pixelSize:new v({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:a}),pixelType:t.pixelType.toLowerCase(),statistics:l,attributeTable:e[0]||null,colormap:e[1]||null,histograms:e[2]||null,keyProperties:e[3]||{},multidimensionalInfo:e[4]||null})}))}async _fetchMultidimensionalInfo(e){const t=await this.request(this.url+"/multidimensionalInfo",{query:{f:"json"},signal:e}).then((e=>e.data?.multidimensionalInfo));return t.variables?.length&&t.variables.forEach((e=>{e.statistics?.length&&e.statistics.forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation}))})),t}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new d,e.extent=e.transform.forwardTransform(t))}};e([r({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),e([r()],S.prototype,"tileType",void 0),S=e([n("esri.layers.support.rasterDatasets.ImageServerRaster")],S);const I=S;export{I as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import{isSome as i,isNone as s,unwrap as a}from"../../../core/maybe.js";import{urlToObject as r}from"../../../core/urlUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../RasterInfo.js";import c from"../RasterStorageInfo.js";import{readServiceTileInfo as m}from"../serviceTileInfoProperty.js";import h from"../TileInfo.js";import{TilemapCache as p}from"../TilemapCache.js";import f from"./BaseRaster.js";import{setValidBoundary as u}from"../rasterFunctions/pixelUtils.js";import y from"../rasterTransforms/GCSShiftTransform.js";import{fetchServiceRasterInfo as d}from"../../../rest/imageService/fetchRasterInfo.js";import x from"../../../geometry/SpatialReference.js";import g from"../../../geometry/Point.js";import v from"../../../geometry/Extent.js";let S=class extends f{constructor(){super(...arguments),this._levelOffset=0,this._tilemapCache=null,this._slices=null,this.datasetFormat="RasterTileServer"}async open(e){await this.init();const s=e&&e.signal,a=this.sourceJSON?{data:this.sourceJSON}:await this.request(this.url,{query:{f:"json"},signal:s});a.ssl&&(this.url=this.url.replace(/^http:/i,"https:"));const l=a.data;if(this.sourceJSON=l,!l)throw new t("imageserverraster:open","cannot initialize tiled image service, missing service info");if(!l.tileInfo)throw new t("imageserverraster:open","use ImageryLayer to open non-tiled image services");this._fixScaleInServiceInfo();const o=["jpg","jpeg","png","png8","png24","png32","mixed"];this.tileType=l.cacheType,null==this.tileType&&(o.includes(l.tileInfo.format.toLowerCase())?this.tileType="Map":"lerc"===l.tileInfo.format.toLowerCase()?this.tileType="Elevation":this.tileType="Raster"),this.datasetName=l.name.slice(l.name.indexOf("/")+1);const n=await this._fetchRasterInfo({signal:s});if(!i(n))throw new t("image-server-raster:open","cannot initialize image service");{const e="Map"===this.tileType?m(l.tileInfo,l):h.fromJSON(l.tileInfo),{extent:t,pixelSize:i}=n,s=.5/n.width*i.x;let a,r;const o=e.lodAt(Math.max.apply(null,e.lods.map((e=>e.level))));"Map"!==this.tileType&&0!==l.maxScale&&("Raster"===this.tileType?(a=e.lods.find((e=>e.resolution===i.x)),a||(a=e.lods[e.lods.length-1])):(a=e.lods.find((e=>Math.abs(e.scale-l.maxScale)<s)),a||(a=e.lods.filter((e=>e.scale>l.maxScale)).sort(((e,t)=>e.scale>t.scale?1:-1))[0])),i.x=i.y=a.resolution,n.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),n.height=Math.ceil((t.ymax-t.ymin)/i.y-.1)),a||(a=o);const p=e.lodAt(Math.min.apply(null,e.lods.map((e=>e.level))));"Map"===this.tileType?this._levelOffset=e.lods[0].level:0!==l.minScale&&"Elevation"===this.tileType&&(r=e.lods.find((e=>Math.abs(e.scale-l.minScale)<s)),this._levelOffset=r.level-p.level),r||(r=p);const f=Math.max(i.x,i.y);(Math.abs(i.x-i.y)>s||!e.lods.some((e=>Math.abs(e.resolution-f)<s)))&&(i.x=i.y=a.resolution,n.width=Math.ceil((t.xmax-t.xmin)/i.x-.1),n.height=Math.ceil((t.ymax-t.ymin)/i.y-.1));const u=a.level-r.level,[y,d]=e.size,x=[];e.lods.forEach((e=>{e.level>=r.level&&e.level<=a.level&&x.push({x:e.resolution,y:e.resolution})})),x.sort(((e,t)=>e.x-t.x));const g=this.computeBlockBoundary(t,y,d,e.origin,x,u),v=x.length>1?x.slice(1):null;let S;l.transposeInfo&&(S={tileSize:[l.transposeInfo.rows,l.transposeInfo.cols],packetSize:n.keyProperties?._yxs.PacketSize??0}),n.storageInfo=new c({blockWidth:e.size[0],blockHeight:e.size[1],pyramidBlockWidth:e.size[0],pyramidBlockHeight:e.size[1],pyramidResolutions:v,compression:e.format,origin:e.origin,firstPyramidLevel:1,maximumPyramidLevel:u,tileInfo:e,transposeInfo:S,blockBoundary:g}),this._fixGCSShift(n),this._set("rasterInfo",n)}if(l.capabilities.toLowerCase().includes("tilemap")){const e={tileInfo:n.storageInfo.tileInfo,parsedUrl:r(this.url),url:this.url,tileServers:[],type:"tile"};this._tilemapCache=new p({layer:e})}}async fetchRawTile(e,t,s,a={}){const{storageInfo:r,extent:l}=this.rasterInfo,{transposeInfo:o}=r,n=i(o)&&!!a.transposedVariableName;if(this._slices&&!n&&null==a.sliceId)return null;const c=n?0:r.maximumPyramidLevel-e+this._levelOffset,m=`${this.url}/tile/${c}/${t}/${s}`,h=this._slices?n?{variable:a.transposedVariableName}:{sliceId:a.sliceId||0}:null,{data:p}=await this.request(m,{query:h,responseType:"array-buffer",signal:a.signal});if(!p)return null;const f=n?o.tileSize:r.tileInfo.size,y=await this.decodePixelBlock(p,{width:f[0],height:f[1],planes:null,pixelType:null,isPoint:"Elevation"===this.tileType,returnPixelInterleavedDims:n}),d=r.blockBoundary[e];if("jpg"!==r.compression||s>d.minCol&&s<d.maxCol&&t>d.minRow&&t<d.maxRow)return y;const{origin:x,blockWidth:g,blockHeight:v}=r,{x:S,y:I}=this.getPyramidPixelSize(e),w=Math.round((l.xmin-x.x)/S)%g,j=Math.round((l.xmax-x.x)/S)%g||g,T=Math.round((x.y-l.ymax)/I)%v,b=Math.round((x.y-l.ymin)/I)%v||v,_=s===d.minCol?w:0,M=t===d.minRow?T:0,R=s===d.maxCol?j:g,P=t===d.maxRow?b:v;return u(y,{x:_,y:M},{width:R-_,height:P-M}),y}getSliceIndex(e){if(!this._slices||s(e)||0===e.length)return null;const t=e;for(let i=0;i<this._slices.length;i++){const e=this._slices[i].multidimensionalDefinition;if(e.length===t.length&&!e.some((e=>{const i=t.find((t=>e.variableName===t.variableName&&t.dimensionName===e.dimensionName));if(!i)return!0;return(Array.isArray(e.values[0])?`${e.values[0][0]}-${e.values[0][1]}`:e.values[0])!==(Array.isArray(i.values[0])?`${i.values[0][0]}-${i.values[0][1]}`:i.values[0])})))return i}return null}async fetchVariableStatisticsHistograms(e,t){const i=this.request(this.url+"/statistics",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.statistics)),s=this.request(this.url+"/histograms",{query:{variable:e,f:"json"},signal:t}).then((e=>e.data?.histograms)),a=await Promise.all([i,s]);return a[0]&&a[0].forEach((e=>{e.avg=e.mean,e.stddev=e.standardDeviation})),{statistics:a[0]||null,histograms:a[1]||null}}async computeBestPyramidLevelForLocation(e,t={}){if(!this._tilemapCache)return 0;let i=this.identifyPixelLocation(e,0,a(t.datumTransformation));if(null===i)return null;let s=0;const{maximumPyramidLevel:r}=this.rasterInfo.storageInfo;let l=r-s+this._levelOffset;const o=i.srcLocation;for(;l>=0;){try{if("available"===await this._tilemapCache.fetchAvailability(l,i.row,i.col,t))break}catch{}if(l--,s++,i=this.identifyPixelLocation(o,s,a(t.datumTransformation)),null===i)return null}return-1===l||null==i?null:s}async _fetchRasterInfo(e){const t=this.sourceJSON;if("Map"===this.tileType){const e=Math.ceil((t.extent.xmax-t.extent.xmin)/t.pixelSizeX-.1),i=Math.ceil((t.extent.ymax-t.extent.ymin)/t.pixelSizeY-.1),s=x.fromJSON(t.spatialReference||t.extent.spatialReference),a=new g({x:t.pixelSizeX,y:t.pixelSizeY,spatialReference:s});return new n({width:e,height:i,bandCount:3,extent:v.fromJSON(t.extent),spatialReference:s,pixelSize:a,pixelType:"u8",statistics:null,keyProperties:{DataType:"processed"}})}const{signal:i}=e,s=d(this.url,this.sourceJSON,{signal:i,query:this.ioConfig.customFetchParameters}),a=t.hasMultidimensions?this.request(`${this.url}/slices`,{query:{f:"json"},signal:i}).then((e=>e.data&&e.data.slices)).catch((()=>null)):null,r=await Promise.all([s,a]);return this._slices=r[1],r[0]}_fixScaleInServiceInfo(){const{sourceJSON:e}=this;e.minScale&&e.minScale<0&&(e.minScale=0),e.maxScale&&e.maxScale<0&&(e.maxScale=0)}_fixGCSShift(e){const{extent:t,spatialReference:i}=e;0===t.xmin&&360===t.xmax&&i.wkid&&i.isGeographic&&(e.nativeExtent=e.extent,e.transform=new y,e.extent=e.transform.forwardTransform(t))}};e([l({type:String,json:{write:!0}})],S.prototype,"datasetFormat",void 0),e([l()],S.prototype,"tileType",void 0),S=e([o("esri.layers.support.rasterDatasets.ImageServerRaster")],S);const I=S;export{I as default};