@arcgis/core 5.0.0-next.22 → 5.0.0-next.23

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 (178) hide show
  1. package/analysis/DistanceMeasurementAnalysis.d.ts +4 -0
  2. package/applications/SceneViewer/sceneViewerUtils.d.ts +1 -0
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/024104997daea0d74b38.js +1 -0
  6. package/assets/esri/core/workers/chunks/052ded41dc06c93ec0a7.js +1 -0
  7. package/assets/esri/core/workers/chunks/05b7720ab6bf0874f27c.js +1 -0
  8. package/assets/esri/core/workers/chunks/06d52a570d5d44f8c86e.js +1 -0
  9. package/assets/esri/core/workers/chunks/13b47c217d1e9b61bcbf.js +1 -0
  10. package/assets/esri/core/workers/chunks/174972870db79189200b.js +1 -0
  11. package/assets/esri/core/workers/chunks/219876879bc543568bcd.js +1 -0
  12. package/assets/esri/core/workers/chunks/221691ad0b2912827e14.js +1 -0
  13. package/assets/esri/core/workers/chunks/231c0b583fa97f2ca675.js +1 -0
  14. package/assets/esri/core/workers/chunks/274f2b5e6dbc58505142.js +1 -0
  15. package/assets/esri/core/workers/chunks/2a41283bba2361afa1fd.js +1 -0
  16. package/assets/esri/core/workers/chunks/2c4218306747f5d15575.js +1 -0
  17. package/assets/esri/core/workers/chunks/2c7038a7ffaf75344b02.js +1 -0
  18. package/assets/esri/core/workers/chunks/2de32649f8b0c6404d7c.js +1 -0
  19. package/assets/esri/core/workers/chunks/{f651c05604eab83aef5f.js → 3266c3392c24ce6cdd83.js} +2 -2
  20. package/assets/esri/core/workers/chunks/42747a028fc404ac55f4.js +1 -0
  21. package/assets/esri/core/workers/chunks/443931ac4b4ee5ccb932.js +1 -0
  22. package/assets/esri/core/workers/chunks/4ab89c990a82c745c0fd.js +1 -0
  23. package/assets/esri/core/workers/chunks/4b14ee37b5ac50a734f9.js +1 -0
  24. package/assets/esri/core/workers/chunks/4cda42b94e9cb58dd372.js +1 -0
  25. package/assets/esri/core/workers/chunks/4ce28c936eaffe57c448.js +1 -0
  26. package/assets/esri/core/workers/chunks/538ddb267aa328814865.js +1 -0
  27. package/assets/esri/core/workers/chunks/5b290d18de61789417f9.js +1 -0
  28. package/assets/esri/core/workers/chunks/5b73c77587772120b209.js +1 -0
  29. package/assets/esri/core/workers/chunks/60eeeea671a523bb6b15.js +1 -0
  30. package/assets/esri/core/workers/chunks/6428e2f4fc0a6739cc9e.js +1 -0
  31. package/assets/esri/core/workers/chunks/69278d08a7d64917f826.js +2 -0
  32. package/assets/esri/core/workers/chunks/{c1e4e9ab4a543e8b350d.js → 6b8a923fe5f800f703e3.js} +1 -1
  33. package/assets/esri/core/workers/chunks/6e5d41f51572e3e7cf92.js +1 -0
  34. package/assets/esri/core/workers/chunks/{7565b382f6b3d2cb46a3.js → 6f3ffc04086bca30e55d.js} +2 -2
  35. package/assets/esri/core/workers/chunks/70e2804d3710c6af468e.js +2 -0
  36. package/assets/esri/core/workers/chunks/7749801f30a99b60753e.js +1 -0
  37. package/assets/esri/core/workers/chunks/{aa78b69219d9a0ef1c54.js → 78fc9a55e620602db1ff.js} +2 -2
  38. package/assets/esri/core/workers/chunks/800c282a7335b2e6c7cd.js +1 -0
  39. package/assets/esri/core/workers/chunks/{867a181969eeeb5f1856.js → 838b3ec88785ac7aa31b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/88aa71f02f43bb069345.js +1 -0
  41. package/assets/esri/core/workers/chunks/8a8192e6a9fd7a6d8060.js +1 -0
  42. package/assets/esri/core/workers/chunks/{74a251e7f5be72ca2a5a.js → 8b336a63737e917e50e2.js} +1 -1
  43. package/assets/esri/core/workers/chunks/8d4cc5f1d07b4aa3aea0.js +1 -0
  44. package/assets/esri/core/workers/chunks/8f0c53feead87457b7eb.js +1 -0
  45. package/assets/esri/core/workers/chunks/{4f7b7587d7902355f2a1.js → 93fe46be3c7fe34b5361.js} +1 -1
  46. package/assets/esri/core/workers/chunks/9461cc37ab3397265270.js +1 -0
  47. package/assets/esri/core/workers/chunks/9527f1a611557a7af237.js +1 -0
  48. package/assets/esri/core/workers/chunks/97b01803d0c38541aa08.js +1 -0
  49. package/assets/esri/core/workers/chunks/9921c8d4487a0f580b93.js +1 -0
  50. package/assets/esri/core/workers/chunks/9d0f0d055ec25af037e0.js +1 -0
  51. package/assets/esri/core/workers/chunks/9f0172b83f25ef5f8d40.js +1 -0
  52. package/assets/esri/core/workers/chunks/9f6d82ce8f680abb79bb.js +1 -0
  53. package/assets/esri/core/workers/chunks/a4f492aa5444e6381063.js +1 -0
  54. package/assets/esri/core/workers/chunks/{d6e0528eacee7ea4c1ce.js → a67c3958d76d10c04fa6.js} +2 -2
  55. package/assets/esri/core/workers/chunks/a7dc1928d46dd6b69868.js +1 -0
  56. package/assets/esri/core/workers/chunks/b6d21a2b5c1be8bee57c.js +1 -0
  57. package/assets/esri/core/workers/chunks/{ce16489cf7eb0d78c741.js → be631029691d9a320cb5.js} +2 -2
  58. package/assets/esri/core/workers/chunks/c35a22becf5c470ff6a2.js +1 -0
  59. package/assets/esri/core/workers/chunks/c5d6b416baf24e74b9ba.js +1 -0
  60. package/assets/esri/core/workers/chunks/cade149fa19b4d06dd24.js +1 -0
  61. package/assets/esri/core/workers/chunks/cd1d9f638af5b63a1292.js +1 -0
  62. package/assets/esri/core/workers/chunks/d21ae4980741be98f948.js +1 -0
  63. package/assets/esri/core/workers/chunks/d32aad968798948946e4.js +1 -0
  64. package/assets/esri/core/workers/chunks/{0f735b0dec173142f3b6.js → d9251c3c85c3ddd242c8.js} +2 -2
  65. package/assets/esri/core/workers/chunks/e0369ce0d729c9656488.js +1 -0
  66. package/assets/esri/core/workers/chunks/e2d2a55aedd3ce9cb47b.js +1 -0
  67. package/assets/esri/core/workers/chunks/e3c8fac5fe638d548e34.js +1 -0
  68. package/assets/esri/core/workers/chunks/e45940d342b18983a5ef.js +1 -0
  69. package/assets/esri/core/workers/chunks/{16f841f12b32d8a500a9.js → fa4f788abfbfd3dee882.js} +1 -1
  70. package/assets/esri/core/workers/chunks/fbbf25629e0dab486887.js +1 -0
  71. package/config.js +1 -1
  72. package/interfaces.d.ts +355 -73
  73. package/kernel.js +1 -1
  74. package/layers/VideoLayer.js +1 -1
  75. package/layers/mixins/ArcGISImageService.js +1 -1
  76. package/layers/support/SubtypeSublayer.js +1 -1
  77. package/package.json +6 -6
  78. package/support/revision.js +1 -1
  79. package/unionTypes.d.ts +0 -1
  80. package/views/2d/analysis/AreaMeasurement/AreaMeasurementAreaVisualization.js +1 -1
  81. package/views/2d/analysis/AreaMeasurement/AreaMeasurementController.js +1 -1
  82. package/views/2d/analysis/AreaMeasurement/utils.js +5 -0
  83. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +4 -0
  84. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
  85. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +4 -0
  86. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  87. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  88. package/views/3d/analysis/Dimension/types.d.ts +3 -0
  89. package/views/3d/analysis/Dimension/types.js +5 -0
  90. package/views/3d/analysis/DirectLineMeasurement/types.d.ts +4 -0
  91. package/views/3d/analysis/DirectLineMeasurement/types.js +5 -0
  92. package/views/3d/analysis/LineOfSight/types.d.ts +3 -0
  93. package/views/3d/analysis/LineOfSight/types.js +5 -0
  94. package/views/3d/analysis/Slice/types.d.ts +3 -0
  95. package/views/3d/analysis/Slice/types.js +5 -0
  96. package/views/3d/analysis/Viewshed/types.d.ts +3 -0
  97. package/views/3d/analysis/Viewshed/types.js +5 -0
  98. package/views/3d/analysis/VolumeMeasurement/types.d.ts +3 -0
  99. package/views/3d/analysis/VolumeMeasurement/types.js +5 -0
  100. package/views/3d/support/popupHitTest.js +1 -1
  101. package/views/3d/terrain/TerrainSurface.js +1 -1
  102. package/views/3d/terrain/Tile.js +1 -1
  103. package/views/VideoView.js +1 -1
  104. package/views/analysis/AreaMeasurement/types.d.ts +4 -0
  105. package/views/analysis/AreaMeasurement/types.js +5 -0
  106. package/views/analysis/DistanceMeasurement/types.d.ts +4 -0
  107. package/views/analysis/DistanceMeasurement/types.js +5 -0
  108. package/views/analysis/types.d.ts +3 -0
  109. package/views/analysis/types.js +5 -0
  110. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  111. package/widgets/Editor/workflowUtils.js +1 -1
  112. package/widgets/FeatureTable/FieldColumn.js +1 -1
  113. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  114. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  115. package/assets/esri/core/workers/chunks/03ed15ba64f1679b3d48.js +0 -1
  116. package/assets/esri/core/workers/chunks/04bac7bb3f794b33e2e4.js +0 -1
  117. package/assets/esri/core/workers/chunks/092d72caf3269e696d1c.js +0 -1
  118. package/assets/esri/core/workers/chunks/1466ab7bd500ba7a4025.js +0 -1
  119. package/assets/esri/core/workers/chunks/1beee2932154db83f79d.js +0 -1
  120. package/assets/esri/core/workers/chunks/1cae81089b50b7e43d70.js +0 -1
  121. package/assets/esri/core/workers/chunks/1fcd4d90a99e85d35dd2.js +0 -1
  122. package/assets/esri/core/workers/chunks/21d7f42c2033de987b97.js +0 -1
  123. package/assets/esri/core/workers/chunks/24ff9dad3fb64ab54970.js +0 -1
  124. package/assets/esri/core/workers/chunks/26282c67d2b066a76881.js +0 -1
  125. package/assets/esri/core/workers/chunks/2d3e7b41b225d905c7f4.js +0 -1
  126. package/assets/esri/core/workers/chunks/30a631c39c9372797b92.js +0 -1
  127. package/assets/esri/core/workers/chunks/388873be1dca91ccbc9d.js +0 -1
  128. package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js +0 -2
  129. package/assets/esri/core/workers/chunks/44e08b49898a8fcbe031.js +0 -1
  130. package/assets/esri/core/workers/chunks/4731f507149940dde534.js +0 -1
  131. package/assets/esri/core/workers/chunks/4d0e099f34639cda3a9b.js +0 -1
  132. package/assets/esri/core/workers/chunks/5a6b487b70ca85a45f57.js +0 -1
  133. package/assets/esri/core/workers/chunks/5b5f1f22de985dc6bbc0.js +0 -1
  134. package/assets/esri/core/workers/chunks/5c82b17f9990e6cd7d0b.js +0 -1
  135. package/assets/esri/core/workers/chunks/61bb39597ccf89f99a72.js +0 -1
  136. package/assets/esri/core/workers/chunks/67bc5b87fd61095689d4.js +0 -1
  137. package/assets/esri/core/workers/chunks/6bf5b3c7129aa14b4fc6.js +0 -1
  138. package/assets/esri/core/workers/chunks/755e2ecd20b6bd1909be.js +0 -1
  139. package/assets/esri/core/workers/chunks/768e1ad2f06fdc9d5ef8.js +0 -1
  140. package/assets/esri/core/workers/chunks/7a957f2bca1438732338.js +0 -1
  141. package/assets/esri/core/workers/chunks/809a9055da28c8fa58b0.js +0 -1
  142. package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +0 -1
  143. package/assets/esri/core/workers/chunks/8cd03b54b2859b52fb81.js +0 -1
  144. package/assets/esri/core/workers/chunks/8f85039d76f03fbdd27a.js +0 -1
  145. package/assets/esri/core/workers/chunks/93f706acaa812bb3ac70.js +0 -1
  146. package/assets/esri/core/workers/chunks/976dd80e318266ab4c2c.js +0 -1
  147. package/assets/esri/core/workers/chunks/9a20be3b02c9d6349b8d.js +0 -1
  148. package/assets/esri/core/workers/chunks/9dae3e4e34096b3d82d7.js +0 -1
  149. package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +0 -1
  150. package/assets/esri/core/workers/chunks/a0b0fe0d99df20fa9076.js +0 -1
  151. package/assets/esri/core/workers/chunks/a987731d1b5449d8fb0c.js +0 -1
  152. package/assets/esri/core/workers/chunks/ad9606164c694af0c61f.js +0 -1
  153. package/assets/esri/core/workers/chunks/b0e52c3775f05aaf7ff6.js +0 -1
  154. package/assets/esri/core/workers/chunks/bfd3d81e8e148be99686.js +0 -1
  155. package/assets/esri/core/workers/chunks/cbc5131723cbe29cb88f.js +0 -1
  156. package/assets/esri/core/workers/chunks/ce00509970e7e6eacbdf.js +0 -1
  157. package/assets/esri/core/workers/chunks/cec95ed69c86758d95ec.js +0 -1
  158. package/assets/esri/core/workers/chunks/d391bfbaf0e790cd10d6.js +0 -2
  159. package/assets/esri/core/workers/chunks/d622fb553babd515a21f.js +0 -1
  160. package/assets/esri/core/workers/chunks/ddb55435adeda1e2a1bf.js +0 -1
  161. package/assets/esri/core/workers/chunks/e5a9c37de44508e9733b.js +0 -1
  162. package/assets/esri/core/workers/chunks/e5b42ddec8e424602e03.js +0 -1
  163. package/assets/esri/core/workers/chunks/eaabb5b010b7bb850b0a.js +0 -1
  164. package/assets/esri/core/workers/chunks/eafc4da265469e9e5e0b.js +0 -1
  165. package/assets/esri/core/workers/chunks/eb1b582a73111c8556c1.js +0 -1
  166. package/assets/esri/core/workers/chunks/f594df2f5ce6ca41a254.js +0 -1
  167. package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +0 -1
  168. package/assets/esri/core/workers/chunks/f888849b0236cc0d6f50.js +0 -1
  169. package/assets/esri/core/workers/chunks/fbcc4cbb221c0fbb90d4.js +0 -1
  170. package/views/2d/analysis/AreaMeasurement/AreaMeasurementLabelVisualization.js +0 -5
  171. /package/assets/esri/core/workers/chunks/{0f735b0dec173142f3b6.js.LICENSE.txt → 3266c3392c24ce6cdd83.js.LICENSE.txt} +0 -0
  172. /package/assets/esri/core/workers/chunks/{d391bfbaf0e790cd10d6.js.LICENSE.txt → 69278d08a7d64917f826.js.LICENSE.txt} +0 -0
  173. /package/assets/esri/core/workers/chunks/{7565b382f6b3d2cb46a3.js.LICENSE.txt → 6f3ffc04086bca30e55d.js.LICENSE.txt} +0 -0
  174. /package/assets/esri/core/workers/chunks/{3a457e718a901a45902e.js.LICENSE.txt → 70e2804d3710c6af468e.js.LICENSE.txt} +0 -0
  175. /package/assets/esri/core/workers/chunks/{aa78b69219d9a0ef1c54.js.LICENSE.txt → 78fc9a55e620602db1ff.js.LICENSE.txt} +0 -0
  176. /package/assets/esri/core/workers/chunks/{d6e0528eacee7ea4c1ce.js.LICENSE.txt → a67c3958d76d10c04fa6.js.LICENSE.txt} +0 -0
  177. /package/assets/esri/core/workers/chunks/{ce16489cf7eb0d78c741.js.LICENSE.txt → be631029691d9a320cb5.js.LICENSE.txt} +0 -0
  178. /package/assets/esri/core/workers/chunks/{f651c05604eab83aef5f.js.LICENSE.txt → d9251c3c85c3ddd242c8.js.LICENSE.txt} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{Integer as c}from"../core/accessorSupport/ensureType.js";import h from"../geometry/Extent.js";import f from"../geometry/Polyline.js";import v from"../geometry/SpatialReference.js";import g from"./Layer.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as b,effectProperty as O}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as T}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as L}from"./support/arcgisLayerUrl.js";import{opacity as C,id as x}from"./support/commonProperties.js";import{normalizeParsedUrlObject as U,urlProperty as P}from"./support/multiLayerServiceUtils.js";import E from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as N}from"./support/serviceCapabilitiesUtils.js";import M from"./support/TelemetryData.js";import k from"./support/TelemetryDisplay.js";import V from"./support/VideoFrame.js";import F from"./support/VideoTimeExtent.js";import H from"./video/VideoController.js";import{getFrameHorizonPoints as J,getGroundControlPoints as G,getTelemetryData as R,getServiceLayersInfo as z,getStyledTelemetrySymbol as A,getSensorTrailPoints as q,readVideoTimeExtent as D}from"./video/videoUtils.js";import B from"../symbols/CIMSymbol.js";import W from"../symbols/PictureMarkerSymbol.js";import _ from"../symbols/SimpleFillSymbol.js";import Q from"../symbols/SimpleLineSymbol.js";import $ from"../symbols/SimpleMarkerSymbol.js";import Z from"../symbols/Symbol.js";import{write as K}from"../symbols/support/jsonUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";function Y(e,t){return{ignoreOrigin:this.originIdOf(t)<3}}let ee=[];const te=new t([255,127,0]),re=new t([0,0,0,.05]),oe=new $({angle:0,color:te,size:10,style:"cross"}),ie=new _({color:re,outline:new Q({color:te,width:2})}),se=new Q({color:te,width:1}),le=new $({angle:0,color:te,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),ne=new Q({color:te,width:1}),ae={types:{base:Z,key:"type",typeMap:{"simple-marker":$,"picture-marker":W,cim:B}},json:{name:"drawingInfo.sensorSymbol",write:{writer:K,overridePolicy:Y}}};function pe(e,t){return{type:t,json:{name:e,write:{overridePolicy:Y}}}}let ye=class extends(b(I(S(T(w(n(j(g)))))))){constructor(e){super(e),this.cameraInfo=null,this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new H,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=oe.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=ie.clone(),this.fullExtent=null,this.fullTimeExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbolOrientation={source:"platformHeading",symbolOffset:0},this.sensorSymbol=le.clone(),this.sensorSightLineSymbol=se.clone(),this.sensorTrailSymbol=ne.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=v.WGS84,this.start=0,this.telemetryDisplay=new k,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p(()=>this.metadata,()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")}),p(()=>this.telemetry?.sensorLocation,e=>this._setSensorTrail(e),y)]),m(()=>this.loaded&&"can-play"===this.state&&this.duration>0).then(()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)})}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then(()=>this._fetchService(t));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return N(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return J(this.metadata)}get groundControlPoints(){return G(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return U(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return R(this.metadata)}readTitleFromService(e,{name:t}){return this.url?L(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return z(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){ee=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=A(this.frameCenterSymbol,e)??oe,this.frameOutlineSymbol=A(this.frameOutlineSymbol,e,re)??ie,this.sensorSightLineSymbol=A(this.sensorSightLineSymbol,e)??se,this.sensorTrailSymbol=A(this.sensorTrailSymbol,e)??ne,this.sensorSymbol=A(this.sensorSymbol,e)??le}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=q(e,ee);ee=[...t];const r=ee.map(e=>e.toArray()),o=new f({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],ye.prototype,"autoplay",null),e([u({readOnly:!0})],ye.prototype,"buffered",null),e([u({readOnly:!0})],ye.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],ye.prototype,"capabilities",void 0),e([X("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],ye.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],ye.prototype,"codecs",void 0),e([u({readOnly:!0})],ye.prototype,"connectionInfo",void 0),e([X("connectionInfo",["connectionUrl"])],ye.prototype,"readConnectionInfo",null),e([u()],ye.prototype,"controller",void 0),e([u({type:String})],ye.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],ye.prototype,"created",void 0),e([u({type:Number})],ye.prototype,"currentTime",null),e([u({json:{write:!1}})],ye.prototype,"customParameters",void 0),e([u({type:String})],ye.prototype,"description",void 0),e([u({type:Number})],ye.prototype,"duration",null),e([u({readOnly:!0})],ye.prototype,"elevationSource",void 0),e([u({type:Boolean})],ye.prototype,"ended",null),e([u({type:V})],ye.prototype,"frame",void 0),e([u(pe("drawingInfo.frameCenterSymbol",$))],ye.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:c})],ye.prototype,"frameCount",void 0),e([u(O)],ye.prototype,"frameEffect",void 0),e([u(C)],ye.prototype,"frameOpacity",void 0),e([u(pe("drawingInfo.frameOutlineSymbol",_))],ye.prototype,"frameOutlineSymbol",void 0),e([u({type:h})],ye.prototype,"fullExtent",void 0),e([u({readOnly:!0})],ye.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:D,source:"time"}},type:F})],ye.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],ye.prototype,"groundControlPoints",null),e([u(x)],ye.prototype,"id",void 0),e([u({type:h})],ye.prototype,"initialExtent",void 0),e([u({readOnly:!0})],ye.prototype,"isLive",null),e([u({type:c,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],ye.prototype,"layerId",void 0),e([u({readOnly:!0})],ye.prototype,"livestreamStatus",null),e([u({type:Boolean})],ye.prototype,"loop",null),e([u({readOnly:!0})],ye.prototype,"metadata",null),e([u({readOnly:!0})],ye.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],ye.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],ye.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],ye.prototype,"parsedUrl",null),e([u({type:E})],ye.prototype,"playbackInfo",void 0),e([u({type:Number})],ye.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],ye.prototype,"playerUrl",null),e([u({readOnly:!0})],ye.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],ye.prototype,"posterUrl",void 0),e([u({readOnly:!0})],ye.prototype,"qualities",void 0),e([u()],ye.prototype,"sensorSymbolOrientation",void 0),e([u(ae)],ye.prototype,"sensorSymbol",void 0),e([u(pe("drawingInfo.sensorSightLineSymbol",Q))],ye.prototype,"sensorSightLineSymbol",void 0),e([u(pe("drawingInfo.sensorTrailSymbol",Q))],ye.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],ye.prototype,"serviceItemId",void 0),e([u()],ye.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],ye.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],ye.prototype,"sourceType",void 0),e([u()],ye.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],ye.prototype,"start",void 0),e([u({readOnly:!0})],ye.prototype,"started",null),e([u({readOnly:!0,type:String})],ye.prototype,"state",null),e([u({readOnly:!0,type:M})],ye.prototype,"telemetry",null),e([u({type:k,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],ye.prototype,"telemetryDisplay",void 0),e([X("service","title",["name"])],ye.prototype,"readTitleFromService",null),e([u({readOnly:!0})],ye.prototype,"type",void 0),e([u(P())],ye.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],ye.prototype,"version",void 0),e([u({readOnly:!0})],ye.prototype,"videoElement",null),e([u({readOnly:!0})],ye.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],ye.prototype,"videoLayersInfo",void 0),e([X("service","videoLayersInfo",["id","name","poster","serviceType","type"])],ye.prototype,"readLayerInfosFromService",null),e([u({type:F,readOnly:!0})],ye.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],ye.prototype,"videoWidth",null),e([u()],ye.prototype,"volume",null),e([u({readOnly:!0})],ye.prototype,"waiting",null),ye=e([d("esri.layers.VideoLayer")],ye);const me=ye;export{me as default};
5
+ import{__decorate as e}from"tslib";import t from"../Color.js";import r from"../request.js";import{deprecatedProperty as o}from"../core/deprecate.js";import i from"../core/Error.js";import s from"../core/Logger.js";import{clamp as l}from"../core/mathUtils.js";import{MultiOriginJSONMixin as n}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as a}from"../core/promiseUtils.js";import{watch as p,initial as y,whenOnce as m}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{Integer as c}from"../core/accessorSupport/ensureType.js";import h from"../geometry/Extent.js";import f from"../geometry/Polyline.js";import v from"../geometry/SpatialReference.js";import g from"./Layer.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as b,effectProperty as O}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as T}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{titleFromUrlAndName as L}from"./support/arcgisLayerUrl.js";import{opacity as C,id as P}from"./support/commonProperties.js";import{normalizeParsedUrlObject as x,urlProperty as U}from"./support/multiLayerServiceUtils.js";import E from"./support/PlaybackInfo.js";import{getVideoLayerCapabilities as N}from"./support/serviceCapabilitiesUtils.js";import M from"./support/TelemetryData.js";import k from"./support/TelemetryDisplay.js";import V from"./support/VideoFrame.js";import F from"./support/VideoTimeExtent.js";import H from"./video/VideoController.js";import{getFrameHorizonPoints as J,getGroundControlPoints as _,getTelemetryData as G,getServiceLayersInfo as R,getStyledTelemetrySymbol as z,getSensorTrailPoints as A,readVideoTimeExtent as q}from"./video/videoUtils.js";import D from"../symbols/CIMSymbol.js";import B from"../symbols/PictureMarkerSymbol.js";import W from"../symbols/SimpleFillSymbol.js";import Q from"../symbols/SimpleLineSymbol.js";import $ from"../symbols/SimpleMarkerSymbol.js";import Z from"../symbols/Symbol.js";import{write as K}from"../symbols/support/jsonUtils.js";import{reader as X}from"../core/accessorSupport/decorators/reader.js";function Y(e,t){return{ignoreOrigin:this.originIdOf(t)<3}}const ee=new t([255,127,0]),te=new t([0,0,0,.05]),re=new $({angle:0,color:ee,size:10,style:"cross"}),oe=new W({color:te,outline:new Q({color:ee,width:2})}),ie=new Q({color:ee,width:1}),se=new $({angle:0,color:ee,outline:{color:[255,255,255],width:1.33},size:10,style:"circle"}),le=new Q({color:ee,width:1}),ne={types:{base:Z,key:"type",typeMap:{"simple-marker":$,"picture-marker":B,cim:D}},json:{name:"drawingInfo.sensorSymbol",write:{writer:K,overridePolicy:Y}}};function ae(e,t){return{type:t,json:{name:e,write:{overridePolicy:Y}}}}let pe=class extends(b(I(S(T(w(n(j(g)))))))){constructor(e){super(e),this._trailPoints=[],this.cameraInfo=null,this.capabilities=null,this.codecs=null,this.connectionInfo=null,this.controller=new H,this.copyright=null,this.created=null,this.customParameters=null,this.description=null,this.elevationSource=null,this.frame=null,this.frameCenterSymbol=re.clone(),this.frameCount=null,this.frameEffect=null,this.frameOpacity=1,this.frameOutlineSymbol=oe.clone(),this.fullExtent=null,this.fullTimeExtent=null,this.initialExtent=null,this.layerId=null,this.operationalLayerType="ArcGISVideoLayer",this.playbackInfo=null,this.posterUrl=null,this.qualities=null,this.sensorSymbolOrientation={source:"platformHeading",symbolOffset:0},this.sensorSymbol=se.clone(),this.sensorSightLineSymbol=ie.clone(),this.sensorTrailSymbol=le.clone(),this.serviceItemId=null,this.sourceJSON=null,this.sourceQuality=null,this.sourceType=null,this.spatialReference=v.WGS84,this.start=0,this.telemetryDisplay=new k,this.type="video",this.url=null,this.version=null,this.videoLayersInfo=null}initialize(){this.addHandles([p(()=>this.metadata,()=>{this.notifyChange("telemetry"),this.notifyChange("groundControlPoints"),this.notifyChange("frameHorizonPoints")}),p(()=>this.telemetry?.sensorLocation,e=>this._setSensorTrail(e),y)]),m(()=>this.loaded&&"can-play"===this.state&&this.duration>0).then(()=>{this.start>=0&&this.start<=this.duration&&this.setCurrentTime(this.start)})}destroy(){this.removeAllHandles(),this.controller&&this.controller.destroy()}load(e){const t=null!=e?e.signal:null,r=this.loadFromPortal({supportedTypes:["Video Service"],supportsData:!1},e).catch(a).then(()=>this._fetchService(t));return this.addResolvingPromise(r),Promise.resolve(this)}get autoplay(){return this.controller?.autoplay??!1}set autoplay(e){this.controller.autoplay=e}get buffered(){return this.controller.buffered}readCapabilitiesFromService(e,t){return N(t)}readConnectionInfo(e,t){const r=Object.values(t.connectionUrl);return r?.length&&(this.controller.playerUrl=r[0]),t.connectionUrl}get currentTime(){return this.controller.currentTime}get duration(){return this.controller.duration}get ended(){return this.controller.ended}get frameHorizonPoints(){return J(this.metadata)}get groundControlPoints(){return _(this.metadata)}get isLive(){return this.controller?.isLive??!1}get livestreamStatus(){return this.controller?.livestreamStatus}get loop(){return this.controller.loop}set loop(e){this.controller.loop=e}get metadata(){return this.controller?.currentMetadata}get mimeType(){return this.controller?.mimeType}get muted(){return this.controller.muted}set muted(e){this.controller.muted=e}get parsedUrl(){return x(this)}get playbackRate(){return this.controller.rate}set playbackRate(e){this.controller.rate=e}get playerUrl(){return this.controller.playerUrl}get playing(){return this.controller.playing}get started(){return this.controller?.started??!1}get state(){return this.controller.state}get telemetry(){return G(this.metadata)}readTitleFromService(e,{name:t}){return this.url?L(this.url,t):t}get videoElement(){return this.controller?.element}get videoHeight(){return this.controller?.videoHeight}readLayerInfosFromService(e,t){return R(t)}get videoTimeExtent(){return o(s.getLogger(this),"videoTimeExtent",{replacement:"fullTimeExtent",version:"4.33",warnOnce:!0}),this.fullTimeExtent}get videoWidth(){return this.controller?.videoWidth}get volume(){return this.controller?.volume??0}set volume(e){this.controller.volume=e}get waiting(){return this.controller.waiting}play(){this.controller.play()}pause(){this.controller.pause()}reset(){this._trailPoints=[],this.controller.reset()}setCurrentTime(e){if(this.duration<0)return;const t=l(e,0,this.duration);this.controller.setCurrentTime(t)}toGround(e,t){return this.controller?.sensorModel?.metadataSupportsTransforms?this.controller.sensorModel.transformImageToGeo(e,t):null}toVideo(e){if(!this.controller?.sensorModel?.metadataSupportsTransforms)return null;const t=this.controller.sensorModel.transformGeoToImage(e.x,e.y,e.z);return{x:t[0],y:t[1]}}updateTelemetryColor(e){this.frameCenterSymbol=z(this.frameCenterSymbol,e)??re,this.frameOutlineSymbol=z(this.frameOutlineSymbol,e,te)??oe,this.sensorSightLineSymbol=z(this.sensorSightLineSymbol,e)??ie,this.sensorTrailSymbol=z(this.sensorTrailSymbol,e)??le,this.sensorSymbol=z(this.sensorSymbol,e)??se}write(e,t){return null==this.layerId?(t?.messages?.push(new i("layer:unsupported",`Layer (${this.title}, ${this.id}) of type '${this.declaredClass}' cannot be saved to a web map, web scene, or portal item. The ArcGIS server version must be greater than 11.2.`)),null):super.write(e,t)}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.url,{query:{f:"json",...this.parsedUrl.query,...this.customParameters},signal:e});if(o&&(this.url=this.url.replace(/^http:/i,"https:")),!t?.currentVersion)return t.currentVersion="11.2",this.sourceJSON=t,void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});if(this.layerId??=t.layers?.[0]?.id??null,null==this.layerId)throw new i("arcgis-layers:url-mismatch","The url is not a valid arcgis resource");const{data:s}=await r(this.parsedUrl.path,{query:{f:"json",...this.customParameters},signal:e});this.sourceJSON={...t,...s},this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl})}_setSensorTrail(e){if(!e)return;const t=A(e,this._trailPoints);this._trailPoints=[...t];const r=this._trailPoints.map(e=>e.toArray()),o=new f({hasZ:e.hasZ,paths:[r]});this.telemetry.sensorTrail=o.clone()}};e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],pe.prototype,"autoplay",null),e([u({readOnly:!0})],pe.prototype,"buffered",null),e([u({readOnly:!0})],pe.prototype,"cameraInfo",void 0),e([u({readOnly:!0,json:{read:!1}})],pe.prototype,"capabilities",void 0),e([X("service","capabilities",["supportsAppend","supportsCoverageQuery","supportsExportClip","supportsExportFrameset","supportsMensuration","supportsPreviews","supportsUpdate"])],pe.prototype,"readCapabilitiesFromService",null),e([u({readOnly:!0})],pe.prototype,"codecs",void 0),e([u({readOnly:!0})],pe.prototype,"connectionInfo",void 0),e([X("connectionInfo",["connectionUrl"])],pe.prototype,"readConnectionInfo",null),e([u()],pe.prototype,"controller",void 0),e([u({type:String})],pe.prototype,"copyright",void 0),e([u({readOnly:!0,type:Date})],pe.prototype,"created",void 0),e([u({type:Number})],pe.prototype,"currentTime",null),e([u({json:{write:!1}})],pe.prototype,"customParameters",void 0),e([u({type:String})],pe.prototype,"description",void 0),e([u({type:Number})],pe.prototype,"duration",null),e([u({readOnly:!0})],pe.prototype,"elevationSource",void 0),e([u({type:Boolean})],pe.prototype,"ended",null),e([u({type:V})],pe.prototype,"frame",void 0),e([u(ae("drawingInfo.frameCenterSymbol",$))],pe.prototype,"frameCenterSymbol",void 0),e([u({readOnly:!0,type:c})],pe.prototype,"frameCount",void 0),e([u(O)],pe.prototype,"frameEffect",void 0),e([u(C)],pe.prototype,"frameOpacity",void 0),e([u(ae("drawingInfo.frameOutlineSymbol",W))],pe.prototype,"frameOutlineSymbol",void 0),e([u({type:h})],pe.prototype,"fullExtent",void 0),e([u({readOnly:!0})],pe.prototype,"frameHorizonPoints",null),e([u({readOnly:!0,json:{read:{reader:q,source:"time"}},type:F})],pe.prototype,"fullTimeExtent",void 0),e([u({readOnly:!0})],pe.prototype,"groundControlPoints",null),e([u(P)],pe.prototype,"id",void 0),e([u({type:h})],pe.prototype,"initialExtent",void 0),e([u({readOnly:!0})],pe.prototype,"isLive",null),e([u({type:c,json:{read:!1,origins:{service:{read:{source:"id"}}}}})],pe.prototype,"layerId",void 0),e([u({readOnly:!0})],pe.prototype,"livestreamStatus",null),e([u({type:Boolean})],pe.prototype,"loop",null),e([u({readOnly:!0})],pe.prototype,"metadata",null),e([u({readOnly:!0})],pe.prototype,"mimeType",null),e([u({type:Boolean,json:{write:{ignoreOrigin:!0}}})],pe.prototype,"muted",null),e([u({type:["ArcGISVideoLayer"]})],pe.prototype,"operationalLayerType",void 0),e([u({readOnly:!0})],pe.prototype,"parsedUrl",null),e([u({type:E})],pe.prototype,"playbackInfo",void 0),e([u({type:Number})],pe.prototype,"playbackRate",null),e([u({readOnly:!0,type:String})],pe.prototype,"playerUrl",null),e([u({readOnly:!0})],pe.prototype,"playing",null),e([u({readOnly:!0,json:{read:{source:"poster"}}})],pe.prototype,"posterUrl",void 0),e([u({readOnly:!0})],pe.prototype,"qualities",void 0),e([u()],pe.prototype,"sensorSymbolOrientation",void 0),e([u(ne)],pe.prototype,"sensorSymbol",void 0),e([u(ae("drawingInfo.sensorSightLineSymbol",Q))],pe.prototype,"sensorSightLineSymbol",void 0),e([u(ae("drawingInfo.sensorTrailSymbol",Q))],pe.prototype,"sensorTrailSymbol",void 0),e([u({readOnly:!0})],pe.prototype,"serviceItemId",void 0),e([u()],pe.prototype,"sourceJSON",void 0),e([u({readOnly:!0})],pe.prototype,"sourceQuality",void 0),e([u({readOnly:!0,json:{name:"serviceType"}})],pe.prototype,"sourceType",void 0),e([u()],pe.prototype,"spatialReference",void 0),e([u({json:{write:!0}})],pe.prototype,"start",void 0),e([u({readOnly:!0})],pe.prototype,"started",null),e([u({readOnly:!0,type:String})],pe.prototype,"state",null),e([u({readOnly:!0,type:M})],pe.prototype,"telemetry",null),e([u({type:k,nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],pe.prototype,"telemetryDisplay",void 0),e([X("service","title",["name"])],pe.prototype,"readTitleFromService",null),e([u({readOnly:!0})],pe.prototype,"type",void 0),e([u(U())],pe.prototype,"url",void 0),e([u({readOnly:!0,type:Number,json:{read:{source:"currentVersion"}}})],pe.prototype,"version",void 0),e([u({readOnly:!0})],pe.prototype,"videoElement",null),e([u({readOnly:!0})],pe.prototype,"videoHeight",null),e([u({readOnly:!0,json:{read:!1}})],pe.prototype,"videoLayersInfo",void 0),e([X("service","videoLayersInfo",["id","name","poster","serviceType","type"])],pe.prototype,"readLayerInfosFromService",null),e([u({type:F,readOnly:!0})],pe.prototype,"videoTimeExtent",null),e([u({readOnly:!0})],pe.prototype,"videoWidth",null),e([u()],pe.prototype,"volume",null),e([u({readOnly:!0})],pe.prototype,"waiting",null),pe=e([d("esri.layers.VideoLayer")],pe);const ye=pe;export{ye 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import{deprecatedFunction as r}from"../../core/deprecate.js";import s from"../../core/Error.js";import{clone as n}from"../../core/lang.js";import a from"../../core/Logger.js";import{watch as o}from"../../core/reactiveUtils.js";import{urlToObject as l}from"../../core/urlUtils.js";import{property as u,subclass as p}from"../../core/accessorSupport/decorators.js";import{Integer as m,ensureRange as c,ensureClass as h,ensureNumber as d}from"../../core/accessorSupport/ensureType.js";import f from"../../geometry/Extent.js";import g from"../../geometry/Polygon.js";import y from"../../geometry/SpatialReference.js";import{srToRESTValue as R}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as I,url as v}from"../support/commonProperties.js";import w from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as b}from"../support/ExportImageServiceParameters.js";import x from"../support/Field.js";import S from"../support/FieldsIndex.js";import{createBitmap as _}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as F}from"../support/imageryRendererUtils.js";import D from"../support/MosaicRule.js";import O from"../support/MultidimensionalSubset.js";import T from"../support/PixelBlock.js";import{interpolationKebab as C,noDataInterpretationKebab as M,pixelTypeKebabDict as P}from"../support/rasterEnums.js";import{getServicePixelValueField as N,getItemPixelValueField as q,getRawServicePixelValueField as j,getProcessedServicePixelValueField as E,getMagnitudeField as A,getDirectionField as V,getMultidimensionalFields as Q,getRasterAttributeTableFields as J,commonRasterFieldNames as U,addMultidimensionalFieldValues as B,rasterFieldPrefix as L}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import H from"../support/RasterInfo.js";import{intersectMultimensionalSubset as G,getEffectiveMultidimensionalDefinition as k,getSubsetVariablesFromMdInfo as W,getDefaultMultidimensionalDefinition as $}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as X,getFormat as K}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as Y}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as Z}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as ee,getSupportedRendererTypes as te,matchPresetRenderer as ie,getDefaultBandCombination as re,normalizeRendererJSON as se}from"../../renderers/support/rasterRendererHelper.js";import ne from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as ae,rasterRendererTypes as oe,read as le}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as ue,computeAngles as pe,computePixelSpaceLocations as me,computeHistograms as ce,computeStatisticsHistograms as he,measureHeight as de,measureAreaAndPerimeter as fe,measureDistanceAndAngle as ge,measurePointOrCentroid as ye,measureLengthFromImage as Re,measureAreaFromImage as Ie,getImageSpatialReferenceQueryParameter as ve,getSamples as we,identify as be,imageToMap as xe,imageToMapMultiray as Se,mapToImage as _e,findImages as Fe,getImageUrl as De,queryBoundary as Oe,queryGPSInfo as Te}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Ce,generateRasterInfo as Me,patchServiceInfo as Pe}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Ne}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as qe}from"../../rest/query/executeForCount.js";import{executeForIds as je}from"../../rest/query/executeForIds.js";import{executeQueryJSON as Ee}from"../../rest/query/executeQueryJSON.js";import Ae from"../../rest/support/FeatureSet.js";import Ve from"../../rest/support/ImageIdentifyParameters.js";import Qe from"../../rest/support/Query.js";import{reader as Je}from"../../core/accessorSupport/decorators/reader.js";import{writer as Ue}from"../../core/accessorSupport/decorators/writer.js";const Be=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Le=c(d,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const He=c=>{const d=c;let He=class extends d{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new b({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?D.fromJSON(t):null}get fieldsIndex(){return this.fields?new S(this.fields):null}set format(e){e&&Be.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=D.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?D.fromJSON(i):this._isMosaicRuleSupported(t)?D.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Le(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return l(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=le(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),F(s)||a.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(N()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(q()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(j()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(E(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=A(i),s=V();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=Q(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=J(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?y.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=P.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=ee(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new ne({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},{bandId:i}=t;if(null==i)t.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(i):i;if(e<0||e>2)return;t.bandId=e}return t}).filter(e=>null!=e),r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):Y(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=n(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),ue(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new s("imagery-layer:compute-angles","this operation is not supported on the input image service");return pe(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new s("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return me(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new s("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),ce(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new s("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=n(e),this._applyMosaicAndRenderingRules(e),he(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new s("imagery-layer:measure-height","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),de(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new s("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=n(e),this._applyMosaicRule(e),ye(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new s("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return Re(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new s("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new s("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return Ie(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}fetchImage(e,t,i,n={}){if(r(a.getLogger(this),"`ImageryLayer.fetchImage` is deprecated in favor of 'ImageryLayer.fetchPixels'.",{replacement:"ImageryLayer.fetchPixels",version:"4.33",warnOnce:!0}),null==e||null==t||null==i)throw new s("imagery-layer:fetch-image","Insufficient parameters for requesting an image. A valid extent, width and height values are required.");return this.internalFetchImage(e,t,i,n)}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await _(e,`${Ge(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(T.createEmptyBand(l,o));return{pixelData:{pixelBlock:new T({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new b({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,r.bandIds||delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(Ge(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new s("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(Ge(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ae.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return Ne(Ge(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(Ge(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(Ge(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(Ge(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:R(o),outSR:"0:"+e},u=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,d=[];for(let i=0;i<p;i++)d.push({x:m,y:h+c*i});const g={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:d}),inSR:R(o),outSR:"0:"+e},I=i(Ge(this.parsedUrl)+"/project",{query:this._getQueryParams(g),...t}).then(e=>e.data).catch(()=>({})),v=await Promise.all([a,u,I]);let w=v[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=f.fromJSON(v[1]?.geometries?.[0]);b&&(b.spatialReference=new y({wkid:0,imageCoordinateSystem:s}));const x=v[2].geometries?v[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],S=x.length;if(S<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<S;i++)_+=x[i].x,F+=x[i].y,D+=x[i].x*x[i].x,O+=x[i].x*x[i].y;const T=(S*O-_*F)/(S*D-_*_);let C=0;const M=x[p-1].x>x[0].x,P=x[p-1].y>x[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=h(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Ce(Ge(this.parsedUrl),this.sourceJSON,i);const r=ze(e);if(!r)throw new s("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[r])return this._functionRasterInfos[r];const n=Me(Ge(this.parsedUrl),e,i);this._functionRasterInfos[r]=n;try{return await n}catch(a){throw this._functionRasterInfos[r]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=ve(e.spatialReference,Ge(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(z.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new s("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=n(e);const{raster:r}=this;return r&&null==e.raster&&(e.raster=r),we(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new s("imagery-layer:identify","identify operation is not supported on the input image service");e=n(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=g.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new s("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:r,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),r&&null==e.raster&&(e.raster=r),be(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new s("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return xe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new s("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Se(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new s("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return _e(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new s("imagery-layer:find-images","findImages operation is not supported on the input image service");return Fe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new s("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return De(Ge(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Qe({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new s("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},Oe(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));const i=await Ee(this.url,e,t),r=this.graphicOrigin;return i.features.forEach(e=>{e.layer=this,e.origin=r}),i}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),je(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new s("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Te(Ge(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasterCount(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),qe(this.url,e,t)}async queryVisibleRasters(e,t){if(!e)throw new s("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:r,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=U.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new z({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=G(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new s("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const f=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=g.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:d,mosaicRule:f,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete R.f;const I=new Ve(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await be(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),s=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?k({rasterInfo:this.rasterInfo,multidimensionalDefinition:f?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],g=h.map(e=>e.attributes?.[m]),y=new Qe({objectIds:g,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:r,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:s,effectiveMultidimensionalDefinition:p})}catch{throw new s("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(Ge(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(Ge(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return W(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Ce(Ge(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Pe(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),a.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([o(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new w({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new s("imagery-layer:query-rasters","query operation is not supported on the input image service");const i=null!=e?h(Qe,e):this.createQuery();return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:i,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&te(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(Ge(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new s("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=ie({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??re(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??ee(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=se(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new ne({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):X(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(Ge(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:r,returnImageBitmap:n,signal:a}=e;if(r&&this._canRequestImageElement(t.format)){const r=`${Ge(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await _(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(Ge(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=K(u)),!m)throw new s("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?X(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=$(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new D;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&B(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=U,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${U.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=G(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=G(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=L+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new T({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new f(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Z([n.pixels[0][0],n.pixels[1][0]]);e.attributes[U.magnitude]=a[0],e.attributes[U.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function Ge(e){return e?.path??""}return e([u({clonable:!1})],He.prototype,"_functionRasterInfos",void 0),e([u({readOnly:!0})],He.prototype,"_serviceSupportsMosaicRule",void 0),e([Je("_serviceSupportsMosaicRule",["currentVersion","fields"])],He.prototype,"readServiceSupportsMosaicRule",null),e([u({readOnly:!0})],He.prototype,"_rasterFunctionNamesIndex",null),e([u()],He.prototype,"adjustAspectRatio",void 0),e([u({type:[m],json:{write:!0}})],He.prototype,"bandIds",void 0),e([Je("bandIds")],He.prototype,"readBandIds",null),e([u({readOnly:!0,json:{read:!1}})],He.prototype,"capabilities",void 0),e([Je("service","capabilities",["capabilities","currentVersion","serviceDataType"])],He.prototype,"readCapabilities",null),e([u({type:Number})],He.prototype,"compressionQuality",void 0),e([Ue("compressionQuality")],He.prototype,"writeCompressionQuality",null),e([u({type:Number})],He.prototype,"compressionTolerance",void 0),e([Ue("compressionTolerance")],He.prototype,"writeCompressionTolerance",null),e([u({json:{read:{source:"copyrightText"}}})],He.prototype,"copyright",void 0),e([u({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],He.prototype,"defaultMosaicRule",void 0),e([Je("defaultMosaicRule",["defaultMosaicMethod"])],He.prototype,"readDefaultMosaicRule",null),e([u({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],He.prototype,"definitionExpression",void 0),e([u({readOnly:!0,constructOnly:!0})],He.prototype,"exportImageServiceParameters",void 0),e([u()],He.prototype,"rasterInfo",void 0),e([u({readOnly:!0,type:[x]})],He.prototype,"fields",void 0),e([u({readOnly:!0})],He.prototype,"fieldsIndex",null),e([u({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],He.prototype,"format",null),e([Je("service","format",["serviceDataType"])],He.prototype,"readFormat",null),e([u({type:f})],He.prototype,"fullExtent",void 0),e([u({readOnly:!0})],He.prototype,"hasMultidimensions",void 0),e([u({json:{read:{source:"maxImageHeight"}}})],He.prototype,"imageMaxHeight",void 0),e([u({json:{read:{source:"maxImageWidth"}}})],He.prototype,"imageMaxWidth",void 0),e([u({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],He.prototype,"interpolation",void 0),e([u()],He.prototype,"minScale",void 0),e([Je("service","minScale")],He.prototype,"readMinScale",null),e([u()],He.prototype,"maxScale",void 0),e([Je("service","maxScale")],He.prototype,"readMaxScale",null),e([u({type:D})],He.prototype,"mosaicRule",null),e([Je("mosaicRule",["mosaicRule","defaultMosaicMethod"])],He.prototype,"readMosaicRule",null),e([Ue("mosaicRule")],He.prototype,"writeMosaicRule",null),e([u()],He.prototype,"multidimensionalInfo",void 0),e([u({type:O,json:{write:!0}})],He.prototype,"multidimensionalSubset",void 0),e([u({json:{type:m}})],He.prototype,"noData",void 0),e([Ue("noData")],He.prototype,"writeNoData",null),e([u({type:String,json:{type:M.jsonValues,read:M.read,write:M.write}})],He.prototype,"noDataInterpretation",void 0),e([u({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],He.prototype,"objectIdField",void 0),e([Je("objectIdField")],He.prototype,"readObjectIdField",null),e([u({readOnly:!0})],He.prototype,"geometryType",void 0),e([u({})],He.prototype,"typeIdField",void 0),e([u({})],He.prototype,"types",void 0),e([u({readOnly:!0})],He.prototype,"parsedUrl",null),e([u({type:Function})],He.prototype,"pixelFilter",void 0),e([u()],He.prototype,"raster",void 0),e([u({readOnly:!0})],He.prototype,"sourceType",void 0),e([Je("sourceType",["serviceSourceType","fields"])],He.prototype,"readSourceType",null),e([u()],He.prototype,"viewId",void 0),e([u()],He.prototype,"renderer",null),e([u({types:oe,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:ae,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],He.prototype,"internalRenderer",null),e([Je("internalRenderer")],He.prototype,"readRenderer",null),e([Ue("internalRenderer")],He.prototype,"writeRenderer",null),e([u({clonable:!1})],He.prototype,"symbolizer",void 0),e([u(I)],He.prototype,"opacity",void 0),e([u({readOnly:!0})],He.prototype,"rasterFields",null),e([u({constructOnly:!0})],He.prototype,"rasterFunctionInfos",void 0),e([u({type:z,json:{name:"renderingRule"}})],He.prototype,"rasterFunction",null),e([Je("rasterFunction",["renderingRule","rasterFunctionInfos"])],He.prototype,"readRasterFunction",null),e([u({readOnly:!0})],He.prototype,"serviceDataType",void 0),e([u({readOnly:!0,type:y})],He.prototype,"spatialReference",void 0),e([Je("spatialReference",["spatialReference","extent"])],He.prototype,"readSpatialReference",null),e([u({type:P.apiValues,json:{read:P.read,type:P.jsonValues}})],He.prototype,"pixelType",void 0),e([Ue("pixelType")],He.prototype,"writePixelType",null),e([u({constructOnly:!0,type:H})],He.prototype,"serviceRasterInfo",void 0),e([u()],He.prototype,"sourceJSON",void 0),e([u(v)],He.prototype,"url",void 0),e([u({readOnly:!0})],He.prototype,"version",void 0),e([Je("version",["currentVersion","fields","timeInfo"])],He.prototype,"readVersion",null),He=e([p("esri.layers.mixins.ArcGISImageService")],He),He};export{He as ArcGISImageService};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import i from"../../request.js";import r from"../../core/Error.js";import{clone as s}from"../../core/lang.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{urlToObject as o}from"../../core/urlUtils.js";import{property as l,subclass as u}from"../../core/accessorSupport/decorators.js";import{Integer as p,ensureRange as m,ensureClass as c,ensureNumber as h}from"../../core/accessorSupport/ensureType.js";import d from"../../geometry/Extent.js";import f from"../../geometry/Polygon.js";import g from"../../geometry/SpatialReference.js";import{srToRESTValue as y}from"../../geometry/support/spatialReferenceUtils.js";import{opacity as R,url as I}from"../support/commonProperties.js";import v from"../support/DimensionalDefinition.js";import{ExportImageServiceParameters as w}from"../support/ExportImageServiceParameters.js";import b from"../support/Field.js";import S from"../support/FieldsIndex.js";import{createBitmap as x}from"../support/imageBitmapUtils.js";import{isSupportedRendererType as _}from"../support/imageryRendererUtils.js";import F from"../support/MosaicRule.js";import D from"../support/MultidimensionalSubset.js";import O from"../support/PixelBlock.js";import{interpolationKebab as T,noDataInterpretationKebab as C,pixelTypeKebabDict as M}from"../support/rasterEnums.js";import{getServicePixelValueField as P,getItemPixelValueField as N,getRawServicePixelValueField as q,getProcessedServicePixelValueField as j,getMagnitudeField as E,getDirectionField as A,getMultidimensionalFields as V,getRasterAttributeTableFields as Q,commonRasterFieldNames as J,addMultidimensionalFieldValues as U,rasterFieldPrefix as B}from"../support/rasterFieldUtils.js";import z from"../support/RasterFunction.js";import L from"../support/RasterInfo.js";import{intersectMultimensionalSubset as H,getEffectiveMultidimensionalDefinition as G,getSubsetVariablesFromMdInfo as k,getDefaultMultidimensionalDefinition as W}from"../support/rasterDatasets/multidimensionalUtils.js";import{decode as $,getFormat as X}from"../support/rasterFormats/RasterCodec.js";import{highlightPixels as K}from"../support/rasterFunctions/pixelUtils.js";import{uvComponentToVector as Y}from"../support/rasterFunctions/vectorFieldUtils.js";import{createDefaultRenderer as Z,getSupportedRendererTypes as ee,matchPresetRenderer as te,getDefaultBandCombination as ie,normalizeRendererJSON as re}from"../../renderers/support/rasterRendererHelper.js";import se from"../../renderers/support/RasterSymbolizer.js";import{websceneRasterRendererTypes as ne,rasterRendererTypes as ae,read as oe}from"../../renderers/support/rasterTypeUtils.js";import{calculateVolume as le,computeAngles as ue,computePixelSpaceLocations as pe,computeHistograms as me,computeStatisticsHistograms as ce,measureHeight as he,measureAreaAndPerimeter as de,measureDistanceAndAngle as fe,measurePointOrCentroid as ge,measureLengthFromImage as ye,measureAreaFromImage as Re,getImageSpatialReferenceQueryParameter as Ie,getSamples as ve,identify as we,imageToMap as be,imageToMapMultiray as Se,mapToImage as xe,findImages as _e,getImageUrl as Fe,queryBoundary as De,queryGPSInfo as Oe}from"../../rest/imageService.js";import{fetchServiceRasterInfo as Te,generateRasterInfo as Ce,patchServiceInfo as Me}from"../../rest/imageService/fetchRasterInfo.js";import{getCatalogItemRasterInfo as Pe}from"../../rest/imageService/getCatalogItemRasterInfo.js";import{executeForCount as Ne}from"../../rest/query/executeForCount.js";import{executeForIds as qe}from"../../rest/query/executeForIds.js";import{executeQueryJSON as je}from"../../rest/query/executeQueryJSON.js";import Ee from"../../rest/support/FeatureSet.js";import Ae from"../../rest/support/ImageIdentifyParameters.js";import Ve from"../../rest/support/Query.js";import{reader as Qe}from"../../core/accessorSupport/decorators/reader.js";import{writer as Je}from"../../core/accessorSupport/decorators/writer.js";const Ue=new Set(["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff"]),Be=m(h,{min:0,max:255});function ze(e){const t=JSON.stringify(e),i=t.includes('"rasterFunctionDefinition":{'),r=i?t.match(/"type":"(.*?FunctionArguments")/gi):t.match(/"rasterFunction":"(.*?")/gi),s=r?.map(e=>i?e.slice(8,-18):e.slice(18,-1));return s?s.join("/"):null}const Le=m=>{const h=m;let Le=class extends h{constructor(){super(...arguments),this._functionRasterInfos={},this._serviceSupportsMosaicRule=null,this.adjustAspectRatio=null,this.bandIds=void 0,this.capabilities=null,this.compressionQuality=void 0,this.compressionTolerance=.01,this.copyright=null,this.defaultMosaicRule=null,this.definitionExpression=null,this.exportImageServiceParameters=null,this.rasterInfo=null,this.fields=null,this.fullExtent=null,this.hasMultidimensions=!1,this.imageMaxHeight=4100,this.imageMaxWidth=4100,this.interpolation=void 0,this.minScale=0,this.maxScale=0,this.multidimensionalInfo=null,this.multidimensionalSubset=null,this.noData=null,this.noDataInterpretation=void 0,this.objectIdField=null,this.geometryType="polygon",this.typeIdField=null,this.types=[],this.pixelFilter=null,this.raster=void 0,this.sourceType=null,this.viewId=void 0,this.symbolizer=null,this.rasterFunctionInfos=null,this.serviceDataType=null,this.spatialReference=null,this.pixelType=null,this.serviceRasterInfo=null,this.sourceJSON=null,this.url=null,this.version=void 0}initialize(){this._set("exportImageServiceParameters",new w({layer:this}))}readServiceSupportsMosaicRule(e,t){return this._isMosaicRuleSupported(t)}get _rasterFunctionNamesIndex(){const e=new Map;return!this.rasterFunctionInfos||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.length<1||null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.forEach(t=>{e.set(t.name.toLowerCase().replaceAll(/ /gi,"_"),t.name)}),e}readBandIds(e,t){if(Array.isArray(e)&&e.length>0&&e.every(e=>"number"==typeof e))return e}readCapabilities(e,t){return this._readCapabilities(t)}writeCompressionQuality(e,t,i){null!=e&&"lerc"!==this.format&&(t[i]=e)}writeCompressionTolerance(e,t,i){"lerc"===this.format&&null!=e&&(t[i]=e)}readDefaultMosaicRule(e,t){return this._serviceSupportsMosaicRule?F.fromJSON(t):null}get fieldsIndex(){return this.fields?new S(this.fields):null}set format(e){e&&Ue.has(e.toLowerCase())&&this._set("format",e.toLowerCase())}readFormat(e,t){return"esriImageServiceDataTypeVector-UV"===t.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===t.serviceDataType||null!=this.pixelFilter?"lerc":"jpgpng"}readMinScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}readMaxScale(e,t){return null!=t.minLOD&&null!=t.maxLOD?e:0}set mosaicRule(e){let t=e;t?.mosaicMethod&&(t=F.fromJSON({...t.toJSON(),mosaicMethod:t.mosaicMethod,mosaicOperation:t.mosaicOperation})),this._set("mosaicRule",t)}readMosaicRule(e,t){const i=e||t.mosaicRule;return i?F.fromJSON(i):this._isMosaicRuleSupported(t)?F.fromJSON(t):null}writeMosaicRule(e,t,i){const{mosaicRule:r}=this;this._isValidCustomizedMosaicRule(r)&&(t[i]=r.toJSON())}writeNoData(e,t,i){null!=e&&"number"==typeof e&&(t[i]=Be(e))}readObjectIdField(e,t){if(!e){const i=t.fields.find(e=>"esriFieldTypeOID"===e.type||"oid"===e.type);e=i?.name}return e}get parsedUrl(){return o(this.url)}readSourceType(e,t){return this._isMosaicDataset(t)?"mosaic-dataset":"raster-dataset"}get renderer(){const{activePresetRendererName:e,presetRenderers:t}=this;if(e){const i=t?.find(({name:t})=>t===e);return i?.renderer.clone()}return this.internalRenderer}set renderer(e){this.activePresetRendererName=null,this.internalRenderer=e}set internalRenderer(e){this.loaded&&(e=this._configRenderer(e)),this._set("internalRenderer",e)}readRenderer(e,t,i){const r=t?.layerDefinition?.drawingInfo?.renderer,s=oe(r,i);return null==s?null:("vector-field"===s.type&&t.symbolTileSize&&!r.symbolTileSize&&(s.symbolTileSize=t.symbolTileSize),_(s)||n.getLogger(this).warn("ArcGISImageService","Imagery layer doesn't support given renderer type."),s)}writeRenderer(e,t,i){t.layerDefinition=t.layerDefinition||{},t.layerDefinition.drawingInfo=t.layerDefinition.drawingInfo||{},t.layerDefinition.drawingInfo.renderer=e.toJSON(),"vector-field"===e.type&&(t.symbolTileSize=e.symbolTileSize)}get rasterFields(){const e=this.fields?.map(e=>e.clone())??[];e.push(P()),"mosaic-dataset"===this.sourceType&&this.fields?.length&&e.push(N()),this.version>=10.4&&null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.some(({name:e})=>"none"===e.toLowerCase())&&e.push(q()),null!=this.rasterFunctionInfos&&this.rasterFunctionInfos.filter(({name:e})=>"none"!==e.toLowerCase()).forEach(({name:t})=>e.push(j(t)));const{rasterInfo:t}=this;if(this._isVectorDataSet()){const i=t?.multidimensionalInfo?.variables[0].unit?.trim(),r=E(i),s=A();e.push(r,s)}if(t?.multidimensionalInfo&&"raster-dataset"===this.sourceType){const i=V(t.multidimensionalInfo);e.push(...i)}const i=t?.attributeTable;if(null!=i){const t=Q(i);e.push(...t)}return e}set rasterFunction(e){let t=e;t?.rasterFunction&&(t=z.fromJSON({...t.toJSON(),rasterFunction:t.rasterFunction,rasterFunctionArguments:t.rasterFunctionArguments})),this._set("rasterFunction",t)}readRasterFunction(e,t){const i=t.rasterFunctionInfos;return t.renderingRule||i?.length&&"None"!==i[0].name?this._isRFTJson(t.renderingRule)?z.fromJSON({rasterFunctionDefinition:t.renderingRule}):z.fromJSON(t.renderingRule||{rasterFunctionInfos:t.rasterFunctionInfos}):null}readSpatialReference(e,t){const i=e||t.extent.spatialReference;return i?g.fromJSON(i):null}writePixelType(e,t,i){null!=this.serviceRasterInfo&&this.pixelType===this.serviceRasterInfo.pixelType||(t[i]=M.toJSON(e))}readVersion(e,t){let i=t.currentVersion;return i||(i=t.hasOwnProperty("fields")||t.hasOwnProperty("timeInfo")?10:9.3),i}applyFilter(e){let t=e;return this.pixelFilter&&(t=this._clonePixelData(e),this.pixelFilter(t)),t}async applyRenderer(e,t){let i=e,{renderer:r,symbolizer:s,pixelFilter:n}=this;const{isRawData:a}=e;if(a&&"lerc"!==this.format&&(r??=Z(this.rasterInfo,{bandIds:this.bandIds,variableName:this.rasterFunction?null:this.mosaicRule?.multidimensionalDefinition?.[0].variableName}),s||(this.symbolizer=new se({rendererJSON:r.toJSON(),rasterInfo:this.rasterInfo}),s=this.symbolizer)),(a||!this._isPicture())&&r&&s&&!n){await this._updateSymbolizer(s,r);const{bandIds:n}=this;i=await this._symbolize({pixelData:e,bandIds:n,symbolizer:s},t)}return i}async highlightPixels(e,t){const i=e.highlightOptions.map(e=>{const t={...e},{bandId:i}=t;if(null==i)t.bandId=0;else{const e=this.bandIds?.length?this.bandIds.indexOf(i):i;if(e<0||e>2)return;t.bandId=e}return t}).filter(e=>null!=e),r=this._rasterJobHandler;r?await r.highlightPixels({...e,highlightOptions:i},t):K(e.pixelBlock,e.renderedPixelBlock,i)}destroy(){this._shutdownJobHandler()}async calculateVolume(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsCalculateVolume)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return e=s(e),this.mosaicRule&&null==e.mosaicRule&&(e.mosaicRule=this.mosaicRule),le(this.url,e,this._getRequestOptions(t))}async computeAngles(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeAngles)throw new r("imagery-layer:compute-angles","this operation is not supported on the input image service");return ue(this.url,e,this._getRequestOptions(t))}async computePixelSpaceLocations(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputePixelLocation)throw new r("imagery-layer:compute-pixel-space-locations","this operation is not supported on the input image service");return pe(this.url,e,this._getRequestOptions(t))}async computeHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeHistograms)throw new r("imagery-layer:compute-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),me(this.url,e,this._getRequestOptions(t))}async computeStatisticsHistograms(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsComputeStatisticsHistograms)throw new r("imagery-layer:compute-statistics-histograms","this operation is not supported on the input image service");return e=s(e),this._applyMosaicAndRenderingRules(e),ce(this.url,e,this._getRequestOptions(t))}async measureHeight(e,t){const i=await this._fetchCapabilities(t?.signal);if(!("base-and-top"===e.operationType?i.mensuration.supportsHeightFromBaseAndTop:"base-and-top-shadow"===e.operationType?i.mensuration.supportsHeightFromBaseAndTopShadow:i.mensuration.supportsHeightFromTopAndTopShadow))throw new r("imagery-layer:measure-height","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),he(this.url,e,this._getRequestOptions(t))}async measureAreaAndPerimeter(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsAreaAndPerimeter&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-area-and-perimeter","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),de(this.url,e,this._getRequestOptions(t))}async measureDistanceAndAngle(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsDistanceAndAngle&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-distance-and-angle","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),fe(this.url,e,this._getRequestOptions(t))}async measurePointOrCentroid(e,t){const i=await this._fetchCapabilities(t?.signal);if(!(i.mensuration.supportsPointOrCentroid&&(!e.is3D||i.mensuration.supports3D)))throw new r("imagery-layer:measure-point-or-centroid","this operation is not supported on the input image service");return e=s(e),this._applyMosaicRule(e),ge(this.url,e,this._getRequestOptions(t))}async measureLengthFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-length-from-image","this operation is not supported on the input image service");if("polyline"!==e.geometry.type)throw new r("imagery-layer:measure-length-from-image","this input geometry must be a polyline");return ye(this.url,e,this._getRequestOptions(t))}async measureAreaFromImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMeasureFromImage)throw new r("imagery-layer:measure-area-from-image","this operation is not supported on the input image service");if("polygon"!==e.geometry.type)throw new r("imagery-layer:measure-area-from-image","this input geometry must be a polygon");return Re(this.url,e,this._getRequestOptions(t))}getField(e){const{fieldsIndex:t}=this;return null!=t?t.get(e):void 0}getFieldDomain(e,t){const i=this.getField(e);return i?i.domain:null}async internalFetchImage(e,t,i,r={}){await this._updateCurrentRasterInfo();const{exportImageServiceParameters:s}=this;let n=!1;r.requestRawData&&(await this._initJobHandler(),s.requestRawData||"lerc"===this.format||(n=!0,s.requestRawData=!0));const a=this.getExportImageServiceParameters(e,t,i,r.timeExtent);if(n&&(s.requestRawData=!1),null==a){if(r.requestAsImageElement&&this._canRequestImageElement(this.format)){const e=document.createElement("canvas");if(e.width=t,e.height=i,r.returnImageBitmap){return{imageBitmap:await x(e,`${He(this.parsedUrl)}/exportImage`,r.signal)}}return{imageOrCanvasElement:e}}const{bandIds:s,rasterInfo:n}=this,a=(s?.length||n.bandCount)??0,o=t*i,l=n.pixelType,u=[];for(let e=0;e<a;e++)u.push(O.createEmptyBand(l,o));return{pixelData:{pixelBlock:new O({width:t,height:i,pixels:u,mask:new Uint8Array(o),pixelType:l}),extent:e}}}const o=!!r.requestAsImageElement&&!this.pixelFilter,l=o&&!!r.returnImageBitmap,u={imageServiceParameters:a,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:o,returnImageBitmap:l,signal:r.signal};return this._requestArrayBuffer(u)}async fetchPixels(e,t,i,r={}){await this._initJobHandler(),r.applyRendering&&this._updateCurrentRasterInfo();const s=r.applyRendering?void 0:new w({layer:this,requestRawData:!0,interpolation:r.interpolation??"nearest",bandIds:r.bandIds??[]}),n=this.getExportImageServiceParameters(e,t,i,r.timeExtent,s);if(null==n)return{extent:e,pixelBlock:null};delete n.pixelType,r.bandIds||delete n.bandIds,delete n.compressionQuality;const a={imageServiceParameters:n,imageProps:{extent:e,width:t,height:i,format:this.format},requestAsImageElement:!1,returnImageBitmap:!1,signal:r.signal},{pixelData:o}=await this._requestArrayBuffer(a);return o??{extent:e,pixelBlock:null}}fetchKeyProperties(e){return i(He(this.parsedUrl)+"/keyProperties",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>e.data)}fetchRasterAttributeTable(e){return this.version<10.1?Promise.reject(new r("#fetchRasterAttributeTable()","Failed to get rasterAttributeTable")):i(He(this.parsedUrl)+"/rasterAttributeTable",{query:this._getQueryParams({renderingRule:this.version>=10.3?e?.rasterFunction:null})}).then(e=>Ee.fromJSON(e.data))}getCatalogItemRasterInfo(e,t){const i={...t,query:this._getQueryParams()};return Pe(He(this.parsedUrl),e,i)}async getCatalogItemICSInfo(e,t){const{data:r}=await i(He(this.parsedUrl)+"/"+e+"/info/ics",{query:this._getQueryParams(),...t}),s=r?.ics;if(!s)return;let n=null;try{n=(await i(He(this.parsedUrl)+"/"+e+"/info",{query:this._getQueryParams(),...t})).data.extent}catch{}if(!n?.spatialReference)return{ics:s,icsToPixelTransform:null,icsExtent:null,northDirection:null};const a=this.version>=10.7?i(He(this.parsedUrl)+"/"+e+"/info/icstopixel",{query:this._getQueryParams(),...t}).then(e=>e.data).catch(()=>({})):{},o=n.spatialReference,l={geometries:JSON.stringify({geometryType:"esriGeometryEnvelope",geometries:[n]}),inSR:y(o),outSR:"0:"+e},u=i(He(this.parsedUrl)+"/project",{query:this._getQueryParams(l),...t}).then(e=>e.data).catch(()=>({})),p=5,m=(n.xmin+n.xmax)/2,c=(n.ymax-n.ymin)/(p+1),h=n.ymin+c,f=[];for(let i=0;i<p;i++)f.push({x:m,y:h+c*i});const R={geometries:JSON.stringify({geometryType:"esriGeometryPoint",geometries:f}),inSR:y(o),outSR:"0:"+e},I=i(He(this.parsedUrl)+"/project",{query:this._getQueryParams(R),...t}).then(e=>e.data).catch(()=>({})),v=await Promise.all([a,u,I]);let w=v[0].ipxf;if(null==w){const e=s.geodataXform?.xf_0;"topup"===e?.name?.toLowerCase()&&6===e?.coefficients?.length&&(w={affine:{name:"ics [sensor: Frame] to pixel (column, row) transformation",coefficients:e.coefficients,cellsizeRatio:0,type:"GeometricXform"}})}const b=d.fromJSON(v[1]?.geometries?.[0]);b&&(b.spatialReference=new g({wkid:0,imageCoordinateSystem:s}));const S=v[2].geometries?v[2].geometries.filter(e=>null!=e?.x&&null!=e.y&&"NaN"!==e.x&&"NaN"!==e.y):[],x=S.length;if(x<3)return{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:null};let _=0,F=0,D=0,O=0;for(let i=0;i<x;i++)_+=S[i].x,F+=S[i].y,D+=S[i].x*S[i].x,O+=S[i].x*S[i].y;const T=(x*O-_*F)/(x*D-_*_);let C=0;const M=S[p-1].x>S[0].x,P=S[p-1].y>S[0].y;return T===1/0?C=P?90:270:0===T?C=M?0:180:T>0?C=M?180*Math.atan(T)/Math.PI:180*Math.atan(T)/Math.PI+180:T<0&&(C=P?180+180*Math.atan(T)/Math.PI:360+180*Math.atan(T)/Math.PI),{ics:s,icsToPixelTransform:w,icsExtent:b,northDirection:C}}async generateRasterInfo(e,t){e=c(z,e);const i={...t,query:this._getQueryParams()};if(!e||"none"===e.functionName?.toLowerCase()||this._isVectorFieldResampleFunction(e))return this.serviceRasterInfo??Te(He(this.parsedUrl),this.sourceJSON,i);const s=ze(e);if(!s)throw new r("imagery-layer:generate-raster-info","the rendering rule is not supported");if(this._functionRasterInfos[s])return this._functionRasterInfos[s];const n=Ce(He(this.parsedUrl),e,i);this._functionRasterInfos[s]=n;try{return await n}catch(a){throw this._functionRasterInfos[s]=null,a}}getExportImageServiceParameters(e,t,i,r,s){e=e.clone().shiftCentralMeridian();const n=Ie(e.spatialReference,He(this.parsedUrl));s??=this.exportImageServiceParameters;const a=s.toJSON(),{bandIds:o,noData:l}=a;let{renderingRule:u}=a;const p=this.rasterFunction?.rasterFunctionDefinition,m=this.renderer?.type,c=!m||"raster-stretch"===m||"raster-colormap"===m||"unique-value"===m||"class-breaks"===m||"raster-shaded-relief"===m;if(o?.length&&this._hasRasterFunction(this.rasterFunction)&&!p&&c){const e={rasterFunction:"ExtractBand",rasterFunctionArguments:{BandIds:o}};if("Stretch"===u.rasterFunction)e.rasterFunctionArguments.Raster=u.rasterFunctionArguments.Raster,u.rasterFunctionArguments.Raster=e;else if("Colormap"===u.rasterFunction){const t=u.rasterFunctionArguments.Raster;"Stretch"===t?.rasterFunction?(e.rasterFunctionArguments.Raster=t.rasterFunctionArguments.Raster,t.rasterFunctionArguments.Raster=e):(e.rasterFunctionArguments.Raster=t,u.rasterFunctionArguments.Raster=e)}else e.rasterFunctionArguments.Raster=u,u=e;a.bandIds=void 0}else a.bandIds=o?.join(",");Array.isArray(l)&&l.length>0&&(a.noData=l.join(","));const h=this._processMultidimensionalIntersection(null,r,s.mosaicRule);if(h.isOutSide)return null;a.mosaicRule=null!=h.mosaicRule?JSON.stringify(h.mosaicRule):null,r=h.timeExtent,a.renderingRule=this._getRenderingRuleString(z.fromJSON(u));const d={};if(null!=r){const{start:e,end:t}=r.toJSON();e&&t&&e===t?d.time=""+e:null==e&&null==t||(d.time=`${e??"null"},${t??"null"}`)}return{bbox:e.xmin+","+e.ymin+","+e.xmax+","+e.ymax,bboxSR:n,imageSR:n,size:t+","+i,...a,...d}}async getSamples(e,t){const i=await this._fetchCapabilities(t?.signal);if(!i?.operations.supportsGetSamples)throw new r("imagery-layer:get-samples","getSamples operation is not supported on the input image service");e=s(e);const{raster:n}=this;return n&&null==e.raster&&(e.raster=n),ve(this.url,e,this._getRequestOptions(t))}async identify(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsIdentify)throw new r("imagery-layer:identify","identify operation is not supported on the input image service");e=s(e),this.version<10.91&&"extent"===e.geometry?.type&&(e.geometry=f.fromExtent(e.geometry));const i=this._processMultidimensionalIntersection(e.geometry,e.timeExtent,e.mosaicRule||this.mosaicRule);if(i.isOutSide)throw new r("imagery-layer:identify","the request cannot be fulfilled when falling outside of the multidimensional subset");e.timeExtent=i.timeExtent,e.mosaicRule=i.mosaicRule;const{raster:n,rasterFunction:a}=this;return a&&null==e.rasterFunction&&(e.rasterFunction=a),n&&null==e.raster&&(e.raster=n),we(this.url,e,this._getRequestOptions(t))}async imageToMap(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMap)throw new r("imagery-layer:image-to-map","imageToMap operation is not supported on the input image service");return be(He(this.parsedUrl),e,this._getRequestOptions(t))}async imageToMapMultiray(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsImageToMapMultiray)throw new r("imagery-layer:image-to-map-multiray","imageToMapMultiray operation is not supported on the input image service");return Se(He(this.parsedUrl),e,this._getRequestOptions(t))}async mapToImage(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsMapToImage)throw new r("imagery-layer:map-to-image","mapToImage operation is not supported on the input image service");return xe(He(this.parsedUrl),e,this._getRequestOptions(t))}async findImages(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsFindImages)throw new r("imagery-layer:find-images","findImages operation is not supported on the input image service");return _e(He(this.parsedUrl),e,this._getRequestOptions(t))}async getImageUrl(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsGetImageUrl)throw new r("imagery-layer:get-image-url","getImageUrl operation is not supported on the input image service");return Fe(He(this.parsedUrl),e,this._getRequestOptions(t))}createQuery(){return new Ve({outFields:["*"],returnGeometry:!0,where:this.definitionExpression||"1=1"})}async queryBoundary(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryBoundary)throw new r("imagery-layer:query-boundary","queryBoundary operation is not supported on the input image service");return e=e??{outSpatialReference:this.spatialReference},De(He(this.parsedUrl),e,this._getRequestOptions(t))}async queryRasters(e,t){({query:e,requestOptions:t}=await this._prepareForQuery(e,t));const i=await je(this.url,e,t),r=this.graphicOrigin;return i.features.forEach(e=>{e.layer=this,e.origin=r}),i}async queryObjectIds(e,t){return({query:e,requestOptions:t}=await this._prepareForQuery(e,t)),qe(this.url,e,t)}async queryGPSInfo(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQueryGPSInfo)throw new r("imagery-layer:query-gps-info","queryGPSInfo operation is not supported on the input image service");return e=e??{where:"1=1"},Oe(He(this.parsedUrl),e,this._getRequestOptions(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 r("imagery-layer: query-visible-rasters","missing query parameter");await this.load();const{pixelSize:i,returnDomainValues:s,returnTopmostRaster:n,showNoDataRecords:a}=t||{pixelSize:null,returnDomainValues:!1,returnTopmostRaster:!1,showNoDataRecords:!1};let o=!1,l=null,u=null;const p=J.servicePixelValue.toLowerCase(),m=this._rasterFunctionNamesIndex;if(null!=e.outFields&&(o=e.outFields.some(e=>!e.toLowerCase().startsWith(p)),this.version>=10.4)){const t=e.outFields.filter(e=>e.toLowerCase().startsWith(p)&&e.length>p.length).map(e=>{const t=e.slice(p.length+1);return[this._updateRenderingRulesFunctionName(t,m),t]});l=t.map(e=>new z({functionName:e[0]})),u=t.map(e=>e[1]);const{rasterFunction:i}=this;0===l.length?i?.functionName?(l.push(i),u.push(i.functionName)):l=null:i?.functionName&&!l.some(e=>e.functionName===i.functionName)&&(l.push(i),u.push(i.functionName))}const c=null==e.outSpatialReference||e.outSpatialReference.equals(this.spatialReference),{multidimensionalSubset:h}=this;let d=e.timeExtent||this.timeExtent;if(h){const{isOutside:t,intersection:i}=H(h,{geometry:e.geometry,timeExtent:e.timeExtent,multidimensionalDefinition:this.exportImageServiceParameters.mosaicRule?.multidimensionalDefinition});if(t)throw new r("imagery-layer:query-visible-rasters","the request cannot be fulfilled when falling outside of the multidimensional subset");null!=i?.timeExtent&&(d=i.timeExtent)}const g=this._combineMosaicRuleWithTimeExtent(this.exportImageServiceParameters.mosaicRule,d);let y=e.geometry;this.version<10.91&&"extent"===y?.type&&(y=f.fromExtent(y));const R=this._getQueryParams({geometry:y,timeExtent:d,mosaicRule:g,rasterFunction:this.version<10.4?this.rasterFunction:null,rasterFunctions:l,pixelSize:i,returnCatalogItems:o,returnGeometry:c,raster:this.raster,maxItemCount:n?1:null});delete R.f;const I=new Ae(R);try{await this._generateRasterInfo(this.rasterFunction);const i=await we(this.url,I,{signal:t?.signal,query:{...this.customParameters}}),r=e.outFields,n=null!=i.value&&i.value.toLowerCase().includes("nodata"),l=o&&!c&&i?.catalogItems?.features.length&&(a||!n),p=this.multidimensionalInfo&&"raster-dataset"===this.sourceType?G({rasterInfo:this.rasterInfo,multidimensionalDefinition:g?.multidimensionalDefinition,timeExtent:d,multidimensionalSubset:this.multidimensionalSubset}):null;if(!l)return this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p});const m=this.objectIdField||"ObjectId",h=i.catalogItems?.features??[],f=h.map(e=>e.attributes?.[m]),y=new Ve({objectIds:f,returnGeometry:!0,outSpatialReference:e.outSpatialReference,outFields:[m]}),R=await this.queryRasters(y);return R?.features?.length&&R.features.forEach(t=>{h.forEach(i=>{i.attributes[m]===t.attributes[m]&&t.geometry&&(i.geometry=t.geometry.clone(),null!=e.outSpatialReference&&(i.geometry.spatialReference=e.outSpatialReference))})}),this._processVisibleRastersResponse(i,{returnDomainValues:s,templateRRFunctionNames:u,showNoDataRecords:a,templateFields:r,effectiveMultidimensionalDefinition:p})}catch{throw new r("imagery-layer:query-visible-rasters","encountered error when querying visible rasters")}}async fetchVariableStatisticsHistograms(e,t){const r=i(He(this.parsedUrl)+"/statistics",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.statistics),s=i(He(this.parsedUrl)+"/histograms",{query:this._getQueryParams({variable:e}),signal:t}).then(e=>e.data?.histograms),n=await Promise.all([r,s]);return n[0]&&n[0].forEach(e=>{e.avg=e.mean,e.stddev=e.standardDeviation}),{statistics:n[0]||null,histograms:n[1]||null}}getMultidimensionalSubsetVariables(e){const t=e??this.serviceRasterInfo.multidimensionalInfo;return k(this.multidimensionalSubset,t)}async _fetchService(e){await this._fetchServiceInfo(e),this.rasterInfo||(this.rasterInfo=this.serviceRasterInfo);const t=this.sourceJSON,i=null!=this.serviceRasterInfo?Promise.resolve(this.serviceRasterInfo):Te(He(this.parsedUrl),t,{signal:e,query:this._getQueryParams()}).then(e=>(this._set("serviceRasterInfo",e),this._set("multidimensionalInfo",e.multidimensionalInfo),Me(e,t),e)),r=this._hasRasterFunction(this.rasterFunction)?this._generateRasterInfo(this.rasterFunction,{signal:e}):null,s=this._getRasterFunctionInfos();return Promise.all([i,r,s]).then(e=>{e[1]?this._set("rasterInfo",e[1]):this._set("rasterInfo",e[0]),e[2]&&this._set("rasterFunctionInfos",e[2]),this.internalRenderer&&!this._isSupportedRenderer(this.internalRenderer)&&(this._set("internalRenderer",null),n.getLogger(this).warn("ArcGISImageService","Switching to the default renderer. Renderer applied is not valid for this Imagery Layer")),this._set("internalRenderer",this._configRenderer(this.renderer)),this.addHandles([a(()=>this.rasterFunction,e=>{(this.renderer||this.symbolizer||this.popupEnabled&&this.popupTemplate)&&this._generateRasterInfo(e).then(e=>{e&&(this.rasterInfo=e)})})]);const{serviceRasterInfo:t}=this;null!=t.multidimensionalInfo&&this._updateMultidimensionalDefinition(t)})}_combineMosaicRuleWithTimeExtent(e,t){const i=this.timeInfo,{multidimensionalInfo:r}=this.serviceRasterInfo;if(null==e||null==r||null==t||null==i?.startField)return e;const{startField:s}=i,n=r.variables.some(e=>e.dimensions.some(e=>e.name===s))?s:"StdTime";if(e=e.clone(),"mosaic-dataset"===this.sourceType)return e.multidimensionalDefinition=e.multidimensionalDefinition?.filter(e=>e.dimensionName!==n),this._cleanupMultidimensionalDefinition(e);e.multidimensionalDefinition=e.multidimensionalDefinition||[];const a=e.multidimensionalDefinition.filter(e=>e.dimensionName===n),o=null!=t.start?t.start.getTime():null,l=null!=t.end?t.end.getTime():null,u=null==o||null==l||o===l,p=u?[o||l]:[[o,l]],m=this.version>=10.8;if(a.length)a.forEach(e=>{e.dimensionName===n&&(m?(e.dimensionName=null,e.isSlice=!1,e.values=[]):(e.isSlice=u,e.values=p))});else if(!m){const t=e.multidimensionalDefinition.filter(e=>null!=e.variableName&&null==e.dimensionName);t.length?t.forEach(e=>{e.dimensionName=n,e.isSlice=u,e.values=p}):e.multidimensionalDefinition.push(new v({variableName:"",dimensionName:n,isSlice:u,values:p}))}return this._cleanupMultidimensionalDefinition(e)}_cleanupMultidimensionalDefinition(e){return null==e?null:(e.multidimensionalDefinition&&(e.multidimensionalDefinition=e.multidimensionalDefinition.filter(e=>!(!e.variableName&&!e.dimensionName)),0===e.multidimensionalDefinition.length&&(e.multidimensionalDefinition=null)),"mosaic-dataset"!==this.sourceType&&null==e.multidimensionalDefinition?null:e)}async _prepareForQuery(e,t){if(!(await this._fetchCapabilities(t?.signal)).operations.supportsQuery)throw new r("imagery-layer:query-rasters","query operation is not supported on the input image service");const i=null!=e?c(Ve,e):this.createQuery();return t=this._getRequestOptions(t),this.raster&&(t.query={...t.query,raster:this.raster}),{query:i,requestOptions:t}}_isSupportedRenderer(e){const{rasterInfo:t,rasterFunction:i}=this;return"unique-value"===e.type&&this._hasRasterFunction(i)&&1===t?.bandCount&&["u8","s8"].includes(t.pixelType)||null!=t&&null!=e&&ee(t).includes(e.type)}async _fetchCapabilities(e){return this.capabilities||await this._fetchServiceInfo(e),this.capabilities}async _fetchServiceInfo(e){let t=this.sourceJSON;if(!t){const{data:r,ssl:s}=await i(He(this.parsedUrl),{query:this._getQueryParams(),signal:e});t=r,this.sourceJSON=t,s&&(this.url=this.url.replace(/^http:/i,"https:"))}if(t.capabilities?.toLowerCase().split(",").map(e=>e.trim()).indexOf("tilesonly")>-1)throw new r("imagery-layer:fetch-service-info","use ImageryTileLayer to open tiles-only image services");this.read(t,{origin:"service",url:this.parsedUrl})}_isMosaicDataset(e){return e.serviceSourceType?"esriImageServiceSourceTypeMosaicDataset"===e.serviceSourceType:e.fields?.length>0}_isMosaicRuleSupported(e){if(!e)return!1;const t=this._isMosaicDataset(e),i=e.currentVersion>=10.71&&e.hasMultidimensions&&!(e.fields?.length>1);return t||i}_isVectorFieldResampleFunction(e){if(null==e)return!1;const{functionName:t,functionArguments:i}=e,r="resample"===t?.toLowerCase(),s=i?.ResampleType||i?.resampleType;return r&&(7===s||10===s)}_isPicture(){return!this.format||this.format.includes("jpg")||this.format.includes("png")}_configRenderer(e){const t=this._isPicture(),{rasterInfo:i}=this;if(!t&&!this.pixelFilter||this._isVectorDataSet()){const t=this.mosaicRule?.multidimensionalDefinition?.[0].variableName,r=te({variableName:t,rasterFunctionName:this.rasterFunction?.functionName,presetRenderers:this.presetRenderers});if(!this.bandIds&&i.bandCount>=3){const e=r?.bandIds??ie(i);!e||3===i.bandCount&&0===e[0]&&1===e[1]&&2===e[2]||(this.bandIds=e)}e||(e=r?.renderer??Z(i,{bandIds:this.bandIds,variableName:this.rasterFunction?null:t}));const s=re(e.toJSON());this.symbolizer?(this.symbolizer.rendererJSON=s,this.symbolizer.rasterInfo=i):this.symbolizer=new se({rendererJSON:s,rasterInfo:i}),this.symbolizer.bind().success||(this.symbolizer=null)}return e}_clonePixelData(e){return null==e?e:{extent:e.extent&&e.extent.clone(),pixelBlock:null!=e.pixelBlock?e.pixelBlock.clone():null}}_getQueryParams(e){null!=e?.renderingRule&&"string"!=typeof e.renderingRule&&(e.renderingRule=this._getRenderingRuleString(e.renderingRule));const{raster:t,viewId:i}=this;return{raster:t,viewId:i,f:"json",...e,...this.customParameters}}_getRequestOptions(e){return{...e,query:{...e?.query,...this.customParameters}}}_decodePixelBlock(e,t,i){return this._rasterJobHandler?this._rasterJobHandler.decode({data:e,options:t}):$(e,t,i)}async _getRasterFunctionInfos(e){const t=this.sourceJSON.rasterFunctionInfos;if(this.loaded)return t;if(t&&this.version>=10.3){if(1===t.length&&"none"===t[0].name.toLowerCase())return t;const r=await i(He(this.parsedUrl)+"/rasterFunctionInfos",{query:this._getQueryParams(),signal:e});return r.data?.rasterFunctionInfos}return null}_canRequestImageElement(e){return!this.pixelFilter&&(!e||e.includes("png"))}async _requestArrayBuffer(e){const{imageProps:t,requestAsImageElement:s,returnImageBitmap:n,signal:a}=e;if(s&&this._canRequestImageElement(t.format)){const r=`${He(this.parsedUrl)}/exportImage`,{data:s}=await i(r,{responseType:n?"blob":"image",query:this._getQueryParams({f:"image",...this.refreshParameters,...e.imageServiceParameters}),signal:a});if(s instanceof Blob){return{imageBitmap:await x(s,r,a),params:t}}return{imageOrCanvasElement:s,params:t}}const o=this._initJobHandler(),l=i(He(this.parsedUrl)+"/exportImage",{responseType:"array-buffer",query:this._getQueryParams({f:"image",...e.imageServiceParameters}),signal:a}),u=(await Promise.all([l,o]))[0].data,p=t.format||"jpgpng";let m=p;if("bsq"!==m&&"bip"!==m&&(m=X(u)),!m)throw new r("imagery-layer:fetch-image","unsupported format signature "+String.fromCharCode.apply(null,new Uint8Array(u)));const c={signal:a},h="gif"===p||"bmp"===p||p.includes("png")&&("png"===m||"jpg"===m)?$(u,{useCanvas:!0,...t},c):this._decodePixelBlock(u,{width:t.width,height:t.height,planes:null,pixelType:null,noDataValue:null,format:p},c);return{pixelData:{pixelBlock:await h,extent:t.extent},params:t}}_generateRasterInfo(e,t){return this.generateRasterInfo(e,t).catch(()=>null)}_isValidCustomizedMosaicRule(e){return e&&JSON.stringify(e.toJSON())!==JSON.stringify(this.defaultMosaicRule?.toJSON())}_updateMultidimensionalDefinition(e){if(this._isValidCustomizedMosaicRule(this.mosaicRule))return;let t=W(e,{multidimensionalSubset:this.multidimensionalSubset});if(null!=t&&t.length>0){this.mosaicRule=this.mosaicRule||new F;const e=this.mosaicRule.multidimensionalDefinition;!this.sourceJSON.defaultVariableName&&this.rasterFunction&&"none"!==this.rasterFunction.functionName?.toLowerCase()&&t.forEach(e=>e.variableName=""),t=t.filter(({variableName:e,dimensionName:t})=>e&&"*"!==e||t),!e?.length&&t.length&&(this.mosaicRule.multidimensionalDefinition=t)}}_processVisibleRastersResponse(e,i){i=i||{};const r=e.value,{templateRRFunctionNames:s,showNoDataRecords:n,returnDomainValues:a,templateFields:o}=i,l=e.processedValues;let u=e.catalogItems?.features,p=e.properties?.Values?.map(e=>e.replaceAll(/ /gi,", "))||[];const m=this.objectIdField||"ObjectId",c="string"==typeof r&&r.toLowerCase().includes("nodata"),h=[];if(r&&!u&&(!c||n)){const e={};e[m]=0;p=[r],u=[new t({geometry:this.fullExtent,attributes:e})],this.multidimensionalInfo&&"raster-dataset"===this.sourceType&&U(this.rasterFields,e,i.effectiveMultidimensionalDefinition)}if(!u)return[];this._updateResponseFieldNames(u,o),c&&!n&&(u=[]);const{itemPixelValue:d,servicePixelValue:f}=J,g=this.rasterFields.some(e=>e.name===d),y=this.graphicOrigin;for(let t=0;t<u.length;t++){const e=u[t];if(null!=r){const i=p[t],a=this.rasterFunction&&l&&l.length>0&&s&&s.length>0&&s.includes(this.rasterFunction.functionName)?l[s.indexOf(this.rasterFunction.functionName)]:r;if("nodata"===i.toLowerCase()&&!n)continue;g&&(e.attributes[d]=i),e.attributes[f]=a,this._updateFeatureWithMagDirValues(e,i);const o=this.fields&&this.fields.length>0;let u=this.rasterFunction&&null!=this.serviceRasterInfo.attributeTable?o?i:r:a;this.rasterFunction||(u=o?i:r),this._updateFeatureWithRasterAttributeTableValues(e,u)}if(e.sourceLayer=e.layer=this,e.origin=y,a&&this._updateFeatureWithDomainValues(e),s&&l&&s.length===l.length)for(let t=0;t<s.length;t++){const i=`${J.servicePixelValue}.${s[t]}`;e.attributes[i]=l[t]}h.push(u[t])}return h}_processMultidimensionalIntersection(e,t,i){const{multidimensionalSubset:r}=this;if(!r)return{isOutSide:!1,timeExtent:t,mosaicRule:i=this._combineMosaicRuleWithTimeExtent(i,t)};if(r){const{isOutside:i,intersection:s}=H(r,{geometry:e,timeExtent:t});if(i)return{isOutSide:!0,timeExtent:null,mosaicRule:null};null!=s?.timeExtent&&(t=s.timeExtent)}if(i=this._combineMosaicRuleWithTimeExtent(i,t),i?.multidimensionalDefinition){const{isOutside:e}=H(r,{multidimensionalDefinition:i.multidimensionalDefinition});if(e)return{isOutSide:!0,timeExtent:null,mosaicRule:null}}return{isOutSide:!1,timeExtent:t,mosaicRule:i}}_updateFeatureWithRasterAttributeTableValues(e,t){const i=this.rasterInfo.attributeTable||this.serviceRasterInfo.attributeTable;if(null==i)return;const{features:r,fields:s}=i,n=s.map(e=>e.name).find(e=>"value"===e.toLowerCase());if(!n)return;const a=r.filter(e=>e.attributes[n]===(null!=t?parseInt(t,10):null));a&&a[0]&&s.forEach(t=>{const i=B+t.name;e.attributes[i]=a[0].attributes[t.name]})}_updateFeatureWithMagDirValues(e,t){if(!this._isVectorDataSet())return;const i=t.split(/,\s*/).map(e=>parseFloat(e)),r=i.map(e=>[e]),s=i.map(e=>({minValue:e,maxValue:e,noDataValue:null})),n=new O({height:1,width:1,pixelType:"f32",pixels:r,statistics:s});null!=this.pixelFilter&&this.pixelFilter({pixelBlock:n,extent:new d(0,0,0,0,this.spatialReference)});const a="esriImageServiceDataTypeVector-MagDir"===this.serviceDataType?[n.pixels[0][0],n.pixels[1][0]]:Y([n.pixels[0][0],n.pixels[1][0]]);e.attributes[J.magnitude]=a[0],e.attributes[J.direction]=a[1]}_updateFeatureWithDomainValues(e){const t=this.fields&&this.fields.filter(e=>e.domain&&"coded-value"===e.domain.type);null!=t&&t.forEach(t=>{const i=e.attributes[t.name];if(null!=i){const r=t.domain.codedValues.find(e=>e.code===i);r&&(e.attributes[t.name]=r.name)}})}_updateResponseFieldNames(e,t){if(!t||t.length<1)return;const i=this.fieldsIndex;null!=i&&e.forEach(e=>{if(e?.attributes)for(const r of t){const t=i.get(r)?.name;t&&t!==r&&(e.attributes[r]=e.attributes[t],delete e.attributes[t])}})}_getRenderingRuleString(e){if(e){let t=e.toJSON();return t=t.rasterFunctionDefinition??t,(t.thumbnail||t.thumbnailEx)&&(t.thumbnail=t.thumbnailEx=null),JSON.stringify(t)}return null}_hasRasterFunction(e){return null!=e?.functionName&&"none"!==e.functionName.toLowerCase()}_updateRenderingRulesFunctionName(e,t){if(!e||e.length<1)return;if("Raw"===e)return e.replace("Raw","None");const i=e.toLowerCase().replaceAll(/ /gi,"_");return t.has(i)?t.get(i):e}_isRFTJson(e){return e?.name&&e.arguments&&e.function&&e.hasOwnProperty("functionType")}_isVectorDataSet(){return"esriImageServiceDataTypeVector-UV"===this.serviceDataType||"esriImageServiceDataTypeVector-MagDir"===this.serviceDataType}_applyMosaicAndRenderingRules(e){const{raster:t,mosaicRule:i,rasterFunction:r}=this;r&&null==e.rasterFunction&&(e.rasterFunction=r),i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}async _updateCurrentRasterInfo(e){if(this.renderer||this.symbolizer){const t=await this._generateRasterInfo(this.rasterFunction,{signal:e});t&&(this.rasterInfo=t)}}_applyMosaicRule(e){const{raster:t,mosaicRule:i}=this;i&&null==e.mosaicRule&&(e.mosaicRule=i),t&&null==e.raster&&(e.raster=t)}_readCapabilities(e){const t=e.capabilities?e.capabilities.toLowerCase().split(",").map(e=>e.trim()):["image","catalog"],{currentVersion:i,maxRecordCount:r}=e,s=t.includes("image"),n="esriImageServiceDataTypeElevation"===e.serviceDataType,a=!(!e.spatialReference&&!e.extent?.spatialReference),o=t.includes("edit"),l=t.includes("mensuration")&&a,u=null==e.mensurationCapabilities?[]:e.mensurationCapabilities.toLowerCase().split(",").map(e=>e.trim()),p=l&&u.includes("basic"),m=this._isMosaicDataset(e)&&t.includes("catalog"),c=t.includes("download"),h=i>=10.7&&n||i>=11.4&&(n||l&&u.includes("3d")),d=m&&e.fields&&e.fields.length>0,f=d&&e.supportsAdvancedQueries?e.advancedQueryCapabilities:void 0;return{data:{supportsAttachment:!1},operations:{supportsComputeHistograms:s,supportsExportImage:s,supportsIdentify:s,supportsImageToMap:i>=11.2&&m,supportsImageToMapMultiray:i>=11.2&&m,supportsMapToImage:i>=11.2&&m,supportsFindImages:i>=11.2&&m,supportsGetImageUrl:i>=11.3&&c,supportsMeasure:l,supportsMeasureFromImage:i>=11.2,supportsDownload:c,supportsQuery:d,supportsGetSamples:i>=10.2&&s,supportsProject:i>=10.3&&s,supportsComputeStatisticsHistograms:i>=10.4&&s,supportsQueryBoundary:i>=10.6&&s,supportsCalculateVolume:h,supportsComputePixelLocation:i>=10.7&&m,supportsComputeAngles:i>=10.91,supportsQueryGPSInfo:i>=11.2&&m,supportsAdd:o,supportsDelete:o,supportsEditing:o,supportsUpdate:o,supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsChangeTracking:!1,supportsQueryAttachments:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsExceedsLimitStatistics:!1,supportsQueryAnalytics:!1,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryTopFeatures:!1,supportsAsyncConvert3D:!1},query:{maxRecordCount:r,maxRecordCountFactor:void 0,maxUniqueIDCount:void 0,supportsStatistics:!!f?.supportsStatistics,supportsOrderBy:!!f?.supportsOrderBy,supportsDistinct:!!f?.supportsDistinct,supportsPagination:!!f?.supportsPagination,supportsPaginationOnAggregatedQueries:!!f?.supportsPaginationOnAggregatedQueries,supportsStandardizedQueriesOnly:!!f?.useStandardizedQueries,supportsPercentileStatistics:!!f?.supportsPercentileStatistics,supportsCentroid:!!f?.supportsReturningGeometryCentroid,supportsCentroidOnDegeneratedQuantizedGeometry:!1,supportsCurrentUser:!1,supportsDegeneratedQuantizedGeometry:!1,supportsDistance:!!f?.supportsQueryWithDistance,supportsExtent:!!f?.supportsReturningQueryExtent,supportsGeometryProperties:!!f?.supportsReturningGeometryProperties,supportsHavingClause:!!f?.supportsHavingClause,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsMaxRecordCountFactor:!1,supportsSqlExpression:f?.supportsSqlExpression??!!f,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!1,supportsCacheHint:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsDefaultSpatialReference:!!f?.supportsDefaultSR,supportsFullTextSearch:!1,supportsCompactGeometry:!1,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0,supportsTrueCurve:!1},mensuration:{supportsDistanceAndAngle:p,supportsAreaAndPerimeter:p,supportsPointOrCentroid:p,supportsHeightFromBaseAndTop:l&&u.includes("base-top height"),supportsHeightFromBaseAndTopShadow:l&&u.includes("base-top shadow height"),supportsHeightFromTopAndTopShadow:l&&u.includes("top-top shadow height"),supports3D:l&&u.includes("3d")}}}};function He(e){return e?.path??""}return e([l({clonable:!1})],Le.prototype,"_functionRasterInfos",void 0),e([l({readOnly:!0})],Le.prototype,"_serviceSupportsMosaicRule",void 0),e([Qe("_serviceSupportsMosaicRule",["currentVersion","fields"])],Le.prototype,"readServiceSupportsMosaicRule",null),e([l({readOnly:!0})],Le.prototype,"_rasterFunctionNamesIndex",null),e([l()],Le.prototype,"adjustAspectRatio",void 0),e([l({type:[p],json:{write:!0}})],Le.prototype,"bandIds",void 0),e([Qe("bandIds")],Le.prototype,"readBandIds",null),e([l({readOnly:!0,json:{read:!1}})],Le.prototype,"capabilities",void 0),e([Qe("service","capabilities",["capabilities","currentVersion","serviceDataType"])],Le.prototype,"readCapabilities",null),e([l({type:Number})],Le.prototype,"compressionQuality",void 0),e([Je("compressionQuality")],Le.prototype,"writeCompressionQuality",null),e([l({type:Number})],Le.prototype,"compressionTolerance",void 0),e([Je("compressionTolerance")],Le.prototype,"writeCompressionTolerance",null),e([l({json:{read:{source:"copyrightText"}}})],Le.prototype,"copyright",void 0),e([l({readOnly:!0,dependsOn:["_serviceSupportsMosaicRule"]})],Le.prototype,"defaultMosaicRule",void 0),e([Qe("defaultMosaicRule",["defaultMosaicMethod"])],Le.prototype,"readDefaultMosaicRule",null),e([l({type:String,json:{name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],Le.prototype,"definitionExpression",void 0),e([l({readOnly:!0,constructOnly:!0})],Le.prototype,"exportImageServiceParameters",void 0),e([l()],Le.prototype,"rasterInfo",void 0),e([l({readOnly:!0,type:[b]})],Le.prototype,"fields",void 0),e([l({readOnly:!0})],Le.prototype,"fieldsIndex",null),e([l({type:["png","png8","png24","png32","jpg","bmp","gif","jpgpng","lerc","tiff","bip","bsq"],json:{write:!0}})],Le.prototype,"format",null),e([Qe("service","format",["serviceDataType"])],Le.prototype,"readFormat",null),e([l({type:d})],Le.prototype,"fullExtent",void 0),e([l({readOnly:!0})],Le.prototype,"hasMultidimensions",void 0),e([l({json:{read:{source:"maxImageHeight"}}})],Le.prototype,"imageMaxHeight",void 0),e([l({json:{read:{source:"maxImageWidth"}}})],Le.prototype,"imageMaxWidth",void 0),e([l({type:String,json:{type:T.jsonValues,read:T.read,write:T.write}})],Le.prototype,"interpolation",void 0),e([l()],Le.prototype,"minScale",void 0),e([Qe("service","minScale")],Le.prototype,"readMinScale",null),e([l()],Le.prototype,"maxScale",void 0),e([Qe("service","maxScale")],Le.prototype,"readMaxScale",null),e([l({type:F})],Le.prototype,"mosaicRule",null),e([Qe("mosaicRule",["mosaicRule","defaultMosaicMethod"])],Le.prototype,"readMosaicRule",null),e([Je("mosaicRule")],Le.prototype,"writeMosaicRule",null),e([l()],Le.prototype,"multidimensionalInfo",void 0),e([l({type:D,json:{write:!0}})],Le.prototype,"multidimensionalSubset",void 0),e([l({json:{type:p}})],Le.prototype,"noData",void 0),e([Je("noData")],Le.prototype,"writeNoData",null),e([l({type:String,json:{type:C.jsonValues,read:C.read,write:C.write}})],Le.prototype,"noDataInterpretation",void 0),e([l({type:String,readOnly:!0,json:{read:{source:["fields"]}}})],Le.prototype,"objectIdField",void 0),e([Qe("objectIdField")],Le.prototype,"readObjectIdField",null),e([l({readOnly:!0})],Le.prototype,"geometryType",void 0),e([l({})],Le.prototype,"typeIdField",void 0),e([l({})],Le.prototype,"types",void 0),e([l({readOnly:!0})],Le.prototype,"parsedUrl",null),e([l({type:Function})],Le.prototype,"pixelFilter",void 0),e([l()],Le.prototype,"raster",void 0),e([l({readOnly:!0})],Le.prototype,"sourceType",void 0),e([Qe("sourceType",["serviceSourceType","fields"])],Le.prototype,"readSourceType",null),e([l()],Le.prototype,"viewId",void 0),e([l()],Le.prototype,"renderer",null),e([l({types:ae,json:{name:"layerDefinition.drawingInfo.renderer",origins:{"web-scene":{types:ne,name:"layerDefinition.drawingInfo.renderer",write:{overridePolicy:e=>({enabled:e&&"vector-field"!==e.type})}}}}})],Le.prototype,"internalRenderer",null),e([Qe("internalRenderer")],Le.prototype,"readRenderer",null),e([Je("internalRenderer")],Le.prototype,"writeRenderer",null),e([l({clonable:!1})],Le.prototype,"symbolizer",void 0),e([l(R)],Le.prototype,"opacity",void 0),e([l({readOnly:!0})],Le.prototype,"rasterFields",null),e([l({constructOnly:!0})],Le.prototype,"rasterFunctionInfos",void 0),e([l({type:z,json:{name:"renderingRule"}})],Le.prototype,"rasterFunction",null),e([Qe("rasterFunction",["renderingRule","rasterFunctionInfos"])],Le.prototype,"readRasterFunction",null),e([l({readOnly:!0})],Le.prototype,"serviceDataType",void 0),e([l({readOnly:!0,type:g})],Le.prototype,"spatialReference",void 0),e([Qe("spatialReference",["spatialReference","extent"])],Le.prototype,"readSpatialReference",null),e([l({type:M.apiValues,json:{read:M.read,type:M.jsonValues}})],Le.prototype,"pixelType",void 0),e([Je("pixelType")],Le.prototype,"writePixelType",null),e([l({constructOnly:!0,type:L})],Le.prototype,"serviceRasterInfo",void 0),e([l()],Le.prototype,"sourceJSON",void 0),e([l(I)],Le.prototype,"url",void 0),e([l({readOnly:!0})],Le.prototype,"version",void 0),e([Qe("version",["currentVersion","fields","timeInfo"])],Le.prototype,"readVersion",null),Le=e([u("esri.layers.mixins.ArcGISImageService")],Le),Le};export{Le 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/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import{ClonableMixin as r}from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import{Loadable as l}from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y,subclass as c}from"../../core/accessorSupport/decorators.js";import{excludeTables as m}from"../../core/accessorSupport/layerContainerType.js";import f from"../../form/FormTemplate.js";import h from"../../geometry/SpatialReference.js";import b from"../../graphic/SubtypeGroupGraphicOrigin.js";import{labelsVisible as g,legendEnabled as j,minScale as v,maxScale as w,popupEnabled as F}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as I}from"./featureLayerUtils.js";import O from"./FeatureTemplate.js";import{defineFieldProperties as S}from"./fieldProperties.js";import{fixRendererFields as C}from"./fieldUtils.js";import E from"./LabelClass.js";import{reader as q}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as x}from"./subtypeGroupLayerUtils.js";import R from"./TitleCreator.js";import P from"../../renderers/SimpleRenderer.js";import L from"../../rest/support/AttachmentQuery.js";import G from"../../rest/support/Query.js";import{createPopupTemplate as _}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as D,defaultPolylineSymbol2D as N,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";import $ from"../../tables/AttributeTableTemplate.js";import{writer as U}from"../../core/accessorSupport/decorators/writer.js";import{reader as M}from"../../core/accessorSupport/decorators/reader.js";const Q=S();let k=0;function B(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=m),e}function H(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=m),e?.target&&(t.write.target=e.target)),t}function J(e){return new P({symbol:W(e)})}function W(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return N.clone();case"polygon":case"multipatch":return D.clone();default:return null}}function z(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function K(e,t){return null==e?null:t.subtypes?.find(t=>t.code===e)}function X(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=K(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new O({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let Y=class extends(p(r(o(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.graphicOrigin=new b(this),this.id=`${Date.now().toString(16)}-subtype-sublayer-${k++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return C(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new R({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach(({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find(e=>e.name===t);if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++}),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find(e=>e.code===r),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find(e=>e.name===i);if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(te("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(te("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){C(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?J(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&z(o,t.subtypeField)){const e=o.uniqueValueInfos?.find(({value:e})=>(e="number"==typeof e?String(e):e)===String(l));e&&(n=new P({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some(e=>"rotationInfo"!==e.type);return o?void 0:A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??h.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[X(this.subtypeCode,t)]}readTitleFromService(e,t){const r=K(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw te("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw te("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw te("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw te("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return _(t,e)}createQuery(){if(!this.parent)throw te("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=I(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw te("queryAttachments");const i=e instanceof L?e.clone():new L(e);return i.where=ee(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(i,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw te("queryFeatureCount");return r.parent.queryFeatureCount(Z(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw te("queryFeatures");return r.parent.queryFeatures(Z(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw te("queryObjectIds");return r.parent.queryObjectIds(Z(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw te("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw te("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],Y.prototype,"_titleCreator",null),e([y({type:$,json:H({name:"attributeTableInfo"})})],Y.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"effectiveCapabilities",null),e([y({json:H()})],Y.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:H({name:"enableEditing"})})],Y.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],Y.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],Y.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],Y.prototype,"fieldOverrides",void 0),e([U("fieldOverrides")],Y.prototype,"writeFieldOverrides",null),e([y({...Q.fields,readOnly:!0,json:{read:!1}})],Y.prototype,"fields",null),e([y(Q.fieldsIndex)],Y.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"floorInfo",null),e([y({type:f,json:H({name:"formInfo"})})],Y.prototype,"formTemplate",void 0),e([y({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([y(B(n(g)))],Y.prototype,"labelsVisible",void 0),e([y({type:[E],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:q},write:{ignoreOrigin:!0,layerContainerTypes:m}}})],Y.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:m}}})],Y.prototype,"layerType",void 0),e([y(B(n(j)))],Y.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([y((()=>{const e=n(v);return e.json.origins.service.read=!1,B(e,{spatialOnly:!0})})())],Y.prototype,"minScale",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,B(e,{spatialOnly:!0})})())],Y.prototype,"maxScale",void 0),e([y({readOnly:!0})],Y.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:H({spatialOnly:!0})})],Y.prototype,"opacity",void 0),e([y({clonable:!1})],Y.prototype,"parent",void 0),e([y(B(n(F)))],Y.prototype,"popupEnabled",void 0),e([y({type:t,json:H({name:"popupInfo"})})],Y.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"relationships",null),e([y({types:x,json:H({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],Y.prototype,"renderer",null),e([M("service","renderer",["drawingInfo.renderer","subtypeField","type"])],Y.prototype,"readRendererFromService",null),e([M("renderer",["layerDefinition.drawingInfo.renderer"])],Y.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"subtypeField",null),e([y({type:[O],json:H({name:"layerDefinition.templates"})})],Y.prototype,"templates",void 0),e([M("service","templates",["geometryType","subtypeField","subtypes","type"])],Y.prototype,"readTemplatesFromService",null),e([y({type:String,json:H()})],Y.prototype,"title",void 0),e([M("service","title",["subtypes"])],Y.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"url",null),e([y({readOnly:!0})],Y.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:H({name:"visibility",spatialOnly:!0})})],Y.prototype,"visible",void 0),Y=e([c("esri.layers.support.SubtypeSublayer")],Y);const Z=(e,t,r)=>{if(!r)return t.createQuery();const i=G.from(r);return i.where=ee(i.where,e.subtypeField,t.subtypeCode),i},ee=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},te=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{Y as default};
5
+ import{__decorate as e}from"tslib";import t from"../../PopupTemplate.js";import{ClonableMixin as r}from"../../core/Clonable.js";import"../../core/has.js";import i from"../../core/Error.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import{clone as n}from"../../core/lang.js";import{Loadable as l}from"../../core/Loadable.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{MultiOriginJSONMixin as p}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as d}from"../../core/object.js";import{sqlAnd as u}from"../../core/sql.js";import{property as y,subclass as c}from"../../core/accessorSupport/decorators.js";import{excludeTables as m}from"../../core/accessorSupport/layerContainerType.js";import f from"../../form/FormTemplate.js";import h from"../../geometry/SpatialReference.js";import b from"../../graphic/SubtypeGroupGraphicOrigin.js";import{labelsVisible as g,legendEnabled as j,minScale as v,maxScale as w,popupEnabled as F}from"./commonProperties.js";import{createQuery as T,computeDomainFromSubtypes as I}from"./featureLayerUtils.js";import O from"./FeatureTemplate.js";import{defineFieldProperties as S}from"./fieldProperties.js";import{fixRendererFields as C}from"./fieldUtils.js";import E from"./LabelClass.js";import{reader as q}from"./labelingInfo.js";import{rendererReader as A,supportedRendererTypes as x}from"./subtypeGroupLayerUtils.js";import R from"./TitleCreator.js";import P from"../../renderers/SimpleRenderer.js";import L from"../../rest/support/AttachmentQuery.js";import G from"../../rest/support/Query.js";import{createPopupTemplate as _}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as D,defaultPolylineSymbol2D as N,defaultPointSymbol2D as $}from"../../symbols/support/defaults.js";import U from"../../tables/AttributeTableTemplate.js";import{writer as V}from"../../core/accessorSupport/decorators/writer.js";import{reader as M}from"../../core/accessorSupport/decorators/reader.js";const Q=S();let k=0;function B(e,t){let r=e.json.write;return"object"!=typeof r&&(r=e.json.write={}),r.ignoreOrigin=!0,t?.spatialOnly&&(r.layerContainerTypes=m),e}function H(e){const t={write:{ignoreOrigin:!0}};return e?.name&&(t.name=e.name),"object"==typeof t.write&&(e?.spatialOnly&&(t.write.layerContainerTypes=m),e?.target&&(t.write.target=e.target)),t}function J(e){return new P({symbol:W(e)})}function W(e){switch(e){case"point":case"multipoint":return $.clone();case"polyline":return N.clone();case"polygon":case"multipatch":return D.clone();default:return null}}function z(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function K(e,t){return null==e?null:t.subtypes?.find(t=>t.code===e)}function X(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=K(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new O({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let Y=class extends(p(r(o(l)))){constructor(e){super(e),this.attributeTableTemplate=null,this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.graphicOrigin=new b(this),this.id=`${Date.now().toString(16)}-subtype-sublayer-${k++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return C(this.renderer,this.fieldsIndex),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return a(e),new R({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,displayField:this.parent?.displayField??"",fields:this.fields,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}get featureTitleFields(){return[...this._titleCreator.requiredFields]}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let l;if(i){l=[];let e=0;i.forEach(({name:t,alias:r,editable:i,visible:n})=>{if(!n)return;const s=o?.fields?.find(e=>e.name===t);if(!s)return;const a={name:t};let p=!1;r!==s.alias&&(a.alias=r,p=!0),i!==s.editable&&(a.editable=i,p=!0),l.push(a),p&&e++}),0===e&&l.length===i.length&&(l=null)}else l=n(e);l?.length&&d(r,l,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,l=o?.find(e=>e.code===r),s=l?.defaultValues,a=l?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find(e=>e.name===i);if(e.visible=!t?.length||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const l=s?.[i]??null;e.defaultValue=i===n?r:l;const u=a?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get isTable(){return!!this.parent?.isTable}get geometryType(){return this.parent?.geometryType}get globalIdField(){return this.parent?this.parent.globalIdField:(s.getLogger(this).error(te("globalIdField")),null)}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(te("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){C(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?J(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=A(i,t,r);let n;const{subtypeCode:l}=this;if(null!=l&&z(o,t.subtypeField)){const e=o.uniqueValueInfos?.find(({value:e})=>(e="number"==typeof e?String(e):e)===String(l));e&&(n=new P({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(n=o);return n}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(i)return A(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??h.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[X(this.subtypeCode,t)]}readTitleFromService(e,t){const r=K(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw te("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:o}=this;if(!o)throw te("updateAttachment");if(e.getAttribute(o.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return o.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw te("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new i("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw te("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:l}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:l,title:o}}return _(t,e)}createQuery(){if(!this.parent)throw te("createQuery");const e=T(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=u(t,this.parent.definitionExpression),e}getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(!t?.excludeImpliedDomains&&this.parent){const t=I(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw te("queryAttachments");const i=e instanceof L?e.clone():new L(e);return i.where=ee(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(i,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw te("queryFeatureCount");return r.parent.queryFeatureCount(Z(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw te("queryFeatures");return r.parent.queryFeatures(Z(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw te("queryObjectIds");return r.parent.queryObjectIds(Z(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw te("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw te("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([y({clonable:!1,readOnly:!0})],Y.prototype,"_titleCreator",null),e([y({type:U,json:H({name:"attributeTableInfo"})})],Y.prototype,"attributeTableTemplate",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"capabilities",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"effectiveCapabilities",null),e([y({json:H()})],Y.prototype,"charts",void 0),e([y({type:Boolean,nonNullable:!0,json:H({name:"enableEditing"})})],Y.prototype,"editingEnabled",void 0),e([y({type:Boolean,readOnly:!0})],Y.prototype,"effectiveEditingEnabled",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"elevationInfo",null),e([y({clonable:!1,readOnly:!0})],Y.prototype,"featureTitleFields",null),e([y({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],Y.prototype,"fieldOverrides",void 0),e([V("fieldOverrides")],Y.prototype,"writeFieldOverrides",null),e([y({...Q.fields,readOnly:!0,json:{read:!1}})],Y.prototype,"fields",null),e([y(Q.fieldsIndex)],Y.prototype,"fieldsIndex",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"floorInfo",null),e([y({type:f,json:H({name:"formInfo"})})],Y.prototype,"formTemplate",void 0),e([y({readOnly:!0,clonable:!1})],Y.prototype,"graphicOrigin",void 0),e([y({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"id",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"isTable",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"geometryType",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"globalIdField",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"type",void 0),e([y(B(n(g)))],Y.prototype,"labelsVisible",void 0),e([y({type:[E],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:q},write:{ignoreOrigin:!0,layerContainerTypes:m}}})],Y.prototype,"labelingInfo",void 0),e([y({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0,layerContainerTypes:m}}})],Y.prototype,"layerType",void 0),e([y(B(n(j)))],Y.prototype,"legendEnabled",void 0),e([y({type:["show","hide"]})],Y.prototype,"listMode",void 0),e([y((()=>{const e=n(v);return e.json.origins.service.read=!1,B(e,{spatialOnly:!0})})())],Y.prototype,"minScale",void 0),e([y((()=>{const e=n(w);return e.json.origins.service.read=!1,B(e,{spatialOnly:!0})})())],Y.prototype,"maxScale",void 0),e([y({readOnly:!0})],Y.prototype,"effectiveScaleRange",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"objectIdField",null),e([y({type:Number,range:{min:0,max:1},nonNullable:!0,json:H({spatialOnly:!0})})],Y.prototype,"opacity",void 0),e([y({clonable:!1})],Y.prototype,"parent",void 0),e([y(B(n(F)))],Y.prototype,"popupEnabled",void 0),e([y({type:t,json:H({name:"popupInfo"})})],Y.prototype,"popupTemplate",void 0),e([y({readOnly:!0})],Y.prototype,"defaultPopupTemplate",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"relationships",null),e([y({types:x,json:H({target:"layerDefinition.drawingInfo.renderer",spatialOnly:!0})})],Y.prototype,"renderer",null),e([M("service","renderer",["drawingInfo.renderer","subtypeField","type"])],Y.prototype,"readRendererFromService",null),e([M("renderer",["layerDefinition.drawingInfo.renderer"])],Y.prototype,"readRenderer",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"spatialReference",null),e([y({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],Y.prototype,"subtypeCode",void 0),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"subtypeField",null),e([y({type:[O],json:H({name:"layerDefinition.templates"})})],Y.prototype,"templates",void 0),e([M("service","templates",["geometryType","subtypeField","subtypes","type"])],Y.prototype,"readTemplatesFromService",null),e([y({type:String,json:H()})],Y.prototype,"title",void 0),e([M("service","title",["subtypes"])],Y.prototype,"readTitleFromService",null),e([y({readOnly:!0,json:{read:!1}})],Y.prototype,"url",null),e([y({readOnly:!0})],Y.prototype,"userHasUpdateItemPrivileges",null),e([y({type:Boolean,nonNullable:!0,json:H({name:"visibility",spatialOnly:!0})})],Y.prototype,"visible",void 0),Y=e([c("esri.layers.support.SubtypeSublayer")],Y);const Z=(e,t,r)=>{if(!r)return t.createQuery();const i=G.from(r);return i.where=ee(i.where,e.subtypeField,t.subtypeCode),i},ee=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):u(o,n)},te=e=>new i("subtype-sublayer:parent-missing",`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`);export{Y as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.0.0-next.22",
3
+ "version": "5.0.0-next.23",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -18,14 +18,14 @@
18
18
  ],
19
19
  "license": "SEE LICENSE IN copyright.txt",
20
20
  "dependencies": {
21
- "@amcharts/amcharts5": "~5.14.1",
22
- "@arcgis/toolkit": "^4.34.0",
21
+ "@amcharts/amcharts5": "~5.14.3",
22
+ "@arcgis/toolkit": "^5.0.0-next.28",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
24
  "@esri/calcite-components": "^3.3.2",
25
- "@vaadin/grid": "~24.9.1",
26
- "@zip.js/zip.js": "~2.8.7",
25
+ "@vaadin/grid": "~24.9.2",
26
+ "@zip.js/zip.js": "~2.8.8",
27
27
  "luxon": "~3.7.2",
28
- "marked": "~16.3.0",
28
+ "marked": "~16.4.1",
29
29
  "tslib": "^2.8.1"
30
30
  },
31
31
  "type": "module"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const f="20251021",b="9fb22c26a640982f9ef70bd5ba3054660fb01fed";export{f as buildDate,b as commitHash};
5
+ const c="20251022",b="203a8f8bce3f66d5d181ccb25c7c3275623a1b8f";export{c as buildDate,b as commitHash};
package/unionTypes.d.ts CHANGED
@@ -2,7 +2,6 @@ import "./interfaces";
2
2
 
3
3
  export type AnalysisView3DUnion = __esri.unionTypes.AnalysisView3DUnion;
4
4
  export type AnalysisView2DUnion = __esri.unionTypes.AnalysisView2DUnion;
5
- export const AnalysisView2DUnion: typeof __esri.unionTypes.AnalysisView2DUnion;
6
5
  export type AnalysisViewUnion = __esri.unionTypes.AnalysisViewUnion;
7
6
  export type AnalysisUnion = __esri.unionTypes.AnalysisUnion;
8
7
  export type RendererWithVisualVariablesUnion = __esri.unionTypes.RendererWithVisualVariablesUnion;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import i from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{multiplyOpacity as s}from"../../../../core/colorUtils.js";import{initial as t}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../layers/GraphicsLayer.js";import m from"../../../../symbols/SimpleFillSymbol.js";import n from"../../../../symbols/SimpleLineSymbol.js";let h=class extends r{constructor(e){super(e),this._graphicsLayer=new p({listMode:"hide",internal:!0}),this._updatingHandles=new l}initialize(){this.view.map?.add(this._graphicsLayer),this._updatingHandles.add(()=>({color:this.view.effectiveTheme.accentColor,fill:this.measurementViewData.result?.display.fill,outline:this.measurementViewData.result?.display.outline,visible:this.measurementViewData.visible}),({color:e,fill:r,outline:t,visible:a},o)=>{if(this._graphicsLayer.visible=a,a)if(r&&t){if(2===this._graphicsLayer.graphics.length&&e.equals(o?.color)){const[e,i]=this._graphicsLayer.graphics.toArray();return e.geometry=r,void(i.geometry=t)}this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.addMany([new i({geometry:r,symbol:new m({color:s(e,.3),outline:null})}),new i({geometry:t,symbol:new n({color:e,width:2})})])}else this._graphicsLayer.graphics.destroyAll()},t)}destroy(){this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.destroy(),this._updatingHandles.destroy()}get updating(){return!this._graphicsLayer.loaded||this._updatingHandles.updating}};e([a()],h.prototype,"measurementViewData",void 0),e([a()],h.prototype,"updating",null),e([a()],h.prototype,"view",void 0),h=e([o("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementAreaVisualization")],h);export{h as AreaMeasurementAreaVisualization};
5
+ import{__decorate as e}from"tslib";import s from"../../../../Graphic.js";import t from"../../../../core/Accessor.js";import{createTask as r}from"../../../../core/asyncUtils.js";import{formatArea as i}from"../../../../core/quantityFormatUtils.js";import{initial as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as n}from"../../../../core/support/UpdatingHandles.js";import{onLocaleChange as m}from"../../../../intl/locale.js";import{fetchMessageBundle as p}from"../../../../intl/messages.js";import h from"../../../../layers/GraphicsLayer.js";import{getAreaMeasurementFillSymbol as u,getAreaMeasurementOutlineSymbol as c}from"./utils.js";let d=class extends t{get _messages(){return this._messagesTask?.value}constructor(e){super(e),this._graphicsLayer=new h({listMode:"hide",internal:!0}),this._updatingHandles=new n}initialize(){this.view.map?.add(this._graphicsLayer),this.addHandles(m(()=>this._updateMessageBundle())),this._updatingHandles.add(()=>({accentColor:this.view.effectiveTheme.accentColor,area:this.measurementViewData.result?.area,fill:this.measurementViewData.result?.display.fill,messages:this._messages,outline:this.measurementViewData.result?.display.outline,textColor:this.view.effectiveTheme.textColor,unit:this.measurementViewData.unit,visible:this.measurementViewData.visible}),({accentColor:e,area:t,fill:r,messages:a,outline:o,textColor:l,unit:n,visible:m},p)=>{if(this._graphicsLayer.visible=m,!m)return;if(!(t&&r&&a&&o))return void this._graphicsLayer.graphics.destroyAll();const h=a&&t?i(a,t,n):null;if(2===this._graphicsLayer.graphics.length&&e.equals(p?.accentColor)&&l.equals(p?.textColor)){const[e,s]=this._graphicsLayer.graphics.toArray();return e.attributes.areaText=h,e.geometry=r,void(s.geometry=o)}this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.addMany([new s({attributes:{areaText:h},geometry:r,symbol:u(e,l)}),new s({geometry:o,symbol:c(e)})])},a),this._updateMessageBundle()}destroy(){this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.destroy(),this._updatingHandles.destroy()}get updating(){return!this._graphicsLayer.loaded||!this._messagesTask?.finished||this._updatingHandles.updating}_updateMessageBundle(){return this._messagesTask?.abort(),this._messagesTask=r(()=>p("esri/core/t9n/Units")),this._messagesTask.promise}};e([o()],d.prototype,"_messages",null),e([o()],d.prototype,"_messagesTask",void 0),e([o()],d.prototype,"measurementViewData",void 0),e([o()],d.prototype,"updating",null),e([o()],d.prototype,"view",void 0),d=e([l("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementAreaVisualization")],d);export{d as AreaMeasurementAreaVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{debounce as r,ignoreAbortErrors as s}from"../../../../core/promiseUtils.js";import{createLength as i,createArea as o}from"../../../../core/quantity.js";import{initial as n}from"../../../../core/reactiveUtils.js";import{property as a,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as l}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../geometry/Polyline.js";import{e as m}from"../../../../chunks/areaOperator.js";import{l as c,e as d}from"../../../../chunks/geodeticAreaOperator.js";import{l as f,e as g}from"../../../../chunks/geodeticDensifyOperator.js";import{l as y,e as h}from"../../../../chunks/geodeticLengthOperator.js";import{e as j}from"../../../../chunks/lengthOperator.js";import{load as v,execute as _}from"../../../../geometry/operators/projectOperator.js";import{e as w}from"../../../../chunks/simplifyOperator.js";import{isSupported as R,geodesicDensify as q,geodesicLengths as O,geodesicAreas as k}from"../../../../geometry/support/geodesicUtils.js";const H=i(1e5,"meters");async function b(e,t){if(!e?.rings.length||!e.rings[0].length)return null;await v();const r=_(e,t);return r?r.spatialReference.isGeographic?R(r.spatialReference)?U(r):A(r):r.spatialReference.isWebMercator?A(r):D(r):null}async function A(e){await Promise.all([c(),f(),y()]);const t=w(e);if(!t)return null;const r=G(t),s=g(t,H.value,{unit:H.unit});if(!s)return null;const n=g(r,H.value,{unit:H.unit});if(!n)return null;const a=h(t,{unit:"meters"}),u=d(t,{unit:"square-meters"});return{area:o(u,"square-meters"),display:{fill:s,outline:n},mode:"geodesic",perimeter:i(a,"meters")}}function U(e){const t=w(e);if(!t)return null;const r=G(t),s=q(t,H.value),n=q(r,H.value),a=O([t],"meters")[0],u=k([t],"square-meters")[0];return{area:o(u,"square-meters"),display:{fill:s,outline:n},mode:"geodesic",perimeter:i(a,"meters")}}function D(e){const t=w(e);if(!t)return null;const r=G(t),s=j(r,{unit:"meters"}),n=m(t,{unit:"square-meters"});return{area:o(n,"square-meters"),display:{fill:t,outline:r},mode:"euclidean",perimeter:i(s,"meters")}}function G(e){return new p({spatialReference:e.spatialReference,paths:e.rings})}let M=class extends t{constructor(e){super(e),this._result=null,this._updatingHandles=new l,this._debouncedGetResult=r(async e=>{this._result=await b(e,this.view.spatialReference)})}initialize(){this._updatingHandles.add(()=>this.measurementViewData.analysis.geometry,e=>{s(this._debouncedGetResult(e))},n)}destroy(){this._updatingHandles.destroy()}get result(){return this._result}get updating(){return this._updatingHandles.updating}};e([a()],M.prototype,"_result",void 0),e([a()],M.prototype,"_updatingHandles",void 0),e([a()],M.prototype,"measurementViewData",void 0),e([a()],M.prototype,"result",null),e([a()],M.prototype,"updating",null),e([a()],M.prototype,"view",void 0),M=e([u("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementController")],M);export{M as AreaMeasurementController};
5
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{debounce as r,ignoreAbortErrors as s}from"../../../../core/promiseUtils.js";import{createLength as i,createArea as o}from"../../../../core/quantity.js";import{watch as n,syncAndInitial as a}from"../../../../core/reactiveUtils.js";import{property as u,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../../../core/support/UpdatingHandles.js";import m from"../../../../geometry/Polyline.js";import{e as c}from"../../../../chunks/areaOperator.js";import{l as d,e as f}from"../../../../chunks/geodeticAreaOperator.js";import{l as g,e as h}from"../../../../chunks/geodeticDensifyOperator.js";import{l as y,e as j}from"../../../../chunks/geodeticLengthOperator.js";import{e as v}from"../../../../chunks/lengthOperator.js";import{load as w,execute as _}from"../../../../geometry/operators/projectOperator.js";import{e as R}from"../../../../chunks/simplifyOperator.js";import{isSupported as q,geodesicDensify as O,geodesicLengths as k,geodesicAreas as H}from"../../../../geometry/support/geodesicUtils.js";const b=i(1e5,"meters");async function A(e,t){if(!e?.rings.length||!e.rings[0].length)return null;await w();const r=_(e,t);return r?r.spatialReference.isGeographic?q(r.spatialReference)?D(r):U(r):r.spatialReference.isWebMercator?U(r):G(r):null}async function U(e){await Promise.all([d(),g(),y()]);const t=R(e);if(!t)return null;const r=M(t),s=h(t,b.value,{unit:b.unit});if(!s)return null;const n=h(r,b.value,{unit:b.unit});if(!n)return null;const a=j(t,{unit:"meters"}),u=f(t,{unit:"square-meters"});return{area:o(u,"square-meters"),display:{fill:s,outline:n},mode:"geodesic",perimeter:i(a,"meters")}}function D(e){const t=R(e);if(!t)return null;const r=M(t),s=O(t,b.value),n=O(r,b.value),a=k([t],"meters")[0],u=H([t],"square-meters")[0];return{area:o(u,"square-meters"),display:{fill:s,outline:n},mode:"geodesic",perimeter:i(a,"meters")}}function G(e){const t=R(e);if(!t)return null;const r=M(t),s=v(r,{unit:"meters"}),n=c(t,{unit:"square-meters"});return{area:o(n,"square-meters"),display:{fill:t,outline:r},mode:"euclidean",perimeter:i(s,"meters")}}function M(e){return new m({spatialReference:e.spatialReference,paths:e.rings})}let P=class extends t{constructor(e){super(e),this._result=null,this._updatingHandles=new p,this._debouncedGetResult=r(async e=>{this._result=await A(e,this.view.spatialReference)})}initialize(){this.addHandles(n(()=>this.measurementViewData.analysis.geometry,e=>{this._updatingHandles.addPromise(s(this._debouncedGetResult(e)))},a))}destroy(){this._updatingHandles.destroy()}get result(){return this._result}get updating(){return this._updatingHandles.updating}};e([u()],P.prototype,"_result",void 0),e([u()],P.prototype,"measurementViewData",void 0),e([u()],P.prototype,"result",null),e([u()],P.prototype,"updating",null),e([u()],P.prototype,"view",void 0),P=e([l("esri.views.2d.analysis.AreaMeasurement.AreaMeasurementController")],P);export{P as AreaMeasurementController};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
+ */
5
+ import{multiplyOpacity as e,getContrast as o}from"../../../../core/colorUtils.js";import r from"../../../../symbols/CIMSymbol.js";function t(t,l){const y=e(o(l,160),.5),i=e(t,.2);return new r({data:{type:"CIMSymbolReference",primitiveOverrides:[{type:"CIMPrimitiveOverride",primitiveName:"textOverride",propertyName:"TextString",valueExpressionInfo:{type:"CIMExpressionInfo",title:"Custom",expression:"$feature.areaText",returnType:"Default"}}],symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,size:10,colorLocked:!0,anchorPointUnits:"Relative",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",fontFamilyName:"sans-serif",height:14,horizontalAlignment:"Center",offsetX:0,offsetY:0,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:l.toArray()}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:y.toArray()}]},haloSize:1.5,verticalAlignment:"Center"},primitiveName:"textOverride"}],scaleSymbolsProportionally:!0,respectFrame:!0,markerPlacement:{type:"CIMMarkerPlacementPolygonCenter",method:"OnPolygon",offsetX:0,offsetY:0,clipAtBoundary:!1}},{type:"CIMSolidFill",enable:!0,color:i.toArray()}]}}})}function l(e){return new r({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:2,color:e.toArray()}]}}})}export{t as getAreaMeasurementFillSymbol,l as getAreaMeasurementOutlineSymbol};
@@ -0,0 +1,4 @@
1
+ import "../../../interfaces";
2
+
3
+ import AreaMeasurementAnalysisView2D = __esri.AreaMeasurementAnalysisView2D;
4
+ export default AreaMeasurementAnalysisView2D;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import{AnalysisView2D as r}from"./AnalysisView2D.js";import{AreaMeasurementAreaVisualization as s}from"./AreaMeasurement/AreaMeasurementAreaVisualization.js";import{AreaMeasurementController as o}from"./AreaMeasurement/AreaMeasurementController.js";import{AreaMeasurementLabelVisualization as n}from"./AreaMeasurement/AreaMeasurementLabelVisualization.js";import{AreaMeasurementManipulatorVisualization as l}from"./AreaMeasurement/AreaMeasurementManipulatorVisualization.js";import{AreaMeasurementSketchVisualization as p}from"./AreaMeasurement/AreaMeasurementSketchVisualization.js";import{AreaMeasurementTool as u}from"./AreaMeasurement/AreaMeasurementTool.js";import m from"../../interactive/snapping/SnappingOptions.js";let h=class extends r{constructor(t){super(t),this.analysis=null,this.snappingOptions=new m,this.type="area-measurement-view-2d"}initialize(){const{view:t}=this;this._areaVisualization=new s({view:t,measurementViewData:this}),this._controller=new o({view:t,measurementViewData:this}),this._labelVisualization=new n({view:t,measurementViewData:this}),this._manipulatorVisualization=new l({view:t,measurementViewData:this}),this._sketchVisualization=new p({view:t,measurementViewData:this}),this._tool=new u({view:t,measurementViewData:this})}destroy(){this._areaVisualization?.destroy(),this._controller?.destroy(),this._labelVisualization?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get result(){return this._controller?.result}get unit(){return this.analysis.unit??a(this.view)}get updating(){return(this._areaVisualization?.updating??!0)||(this._controller?.updating??!0)||(this._labelVisualization?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(t){super.visible=t}async place(t){return this._tool.place(t)}};t([e()],h.prototype,"_areaVisualization",void 0),t([e()],h.prototype,"_controller",void 0),t([e()],h.prototype,"_labelVisualization",void 0),t([e()],h.prototype,"_manipulatorVisualization",void 0),t([e()],h.prototype,"_sketchVisualization",void 0),t([e()],h.prototype,"_tool",void 0),t([e({constructOnly:!0})],h.prototype,"analysis",void 0),t([e()],h.prototype,"manipulatorGraphic",null),t([e()],h.prototype,"manipulatorGraphicsLayer",null),t([e()],h.prototype,"sketchGraphicsLayer",null),t([e({readOnly:!0})],h.prototype,"result",null),t([e({type:m,nonNullable:!0})],h.prototype,"snappingOptions",void 0),t([e({readOnly:!0})],h.prototype,"type",void 0),t([e({readOnly:!0})],h.prototype,"unit",null),t([e({readOnly:!0})],h.prototype,"updating",null),h=t([i("esri.views.2d.analysis.AreaMeasurementAnalysisView2D")],h);const y=h;export{y as default};
5
+ import{__decorate as t}from"tslib";import{property as e,subclass as i}from"../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as a}from"../../../support/getDefaultUnitForView.js";import{AnalysisView2D as r}from"./AnalysisView2D.js";import{AreaMeasurementAreaVisualization as s}from"./AreaMeasurement/AreaMeasurementAreaVisualization.js";import{AreaMeasurementController as o}from"./AreaMeasurement/AreaMeasurementController.js";import{AreaMeasurementManipulatorVisualization as n}from"./AreaMeasurement/AreaMeasurementManipulatorVisualization.js";import{AreaMeasurementSketchVisualization as p}from"./AreaMeasurement/AreaMeasurementSketchVisualization.js";import{AreaMeasurementTool as l}from"./AreaMeasurement/AreaMeasurementTool.js";import u from"../../interactive/snapping/SnappingOptions.js";let m=class extends r{constructor(t){super(t),this.analysis=null,this.snappingOptions=new u,this.type="area-measurement-view-2d"}initialize(){const{view:t}=this;this._areaVisualization=new s({view:t,measurementViewData:this}),this._controller=new o({view:t,measurementViewData:this}),this._manipulatorVisualization=new n({view:t,measurementViewData:this}),this._sketchVisualization=new p({view:t,measurementViewData:this}),this._tool=new l({view:t,measurementViewData:this})}destroy(){this._areaVisualization?.destroy(),this._controller?.destroy(),this._manipulatorVisualization?.destroy(),this._sketchVisualization?.destroy(),this._tool?.destroy()}get manipulatorGraphic(){return this._manipulatorVisualization?.graphic}get manipulatorGraphicsLayer(){return this._manipulatorVisualization?.graphicsLayer}get sketchGraphicsLayer(){return this._sketchVisualization?.graphicsLayer}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get result(){return this._controller?.result}get unit(){return this.analysis.unit??a(this.view)}get updating(){return(this._areaVisualization?.updating??!0)||(this._controller?.updating??!0)||(this._sketchVisualization?.updating??!0)||(this._tool?.updating??!0)}get visible(){return super.visible}set visible(t){super.visible=t}async place(t){return this._tool.place(t)}};t([e()],m.prototype,"_areaVisualization",void 0),t([e()],m.prototype,"_controller",void 0),t([e()],m.prototype,"_manipulatorVisualization",void 0),t([e()],m.prototype,"_sketchVisualization",void 0),t([e()],m.prototype,"_tool",void 0),t([e({constructOnly:!0})],m.prototype,"analysis",void 0),t([e()],m.prototype,"manipulatorGraphic",null),t([e()],m.prototype,"manipulatorGraphicsLayer",null),t([e()],m.prototype,"sketchGraphicsLayer",null),t([e({readOnly:!0})],m.prototype,"result",null),t([e({type:u,nonNullable:!0})],m.prototype,"snappingOptions",void 0),t([e({readOnly:!0})],m.prototype,"type",void 0),t([e({readOnly:!0})],m.prototype,"unit",null),t([e({readOnly:!0})],m.prototype,"updating",null),m=t([i("esri.views.2d.analysis.AreaMeasurementAnalysisView2D")],m);const h=m;export{h as default};
@@ -0,0 +1,4 @@
1
+ import "../../../interfaces";
2
+
3
+ import DistanceMeasurementAnalysisView2D = __esri.DistanceMeasurementAnalysisView2D;
4
+ export default DistanceMeasurementAnalysisView2D;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{clone as e}from"../../../../../core/lang.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getServiceGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as o}from"./labelingUtils.js";import{ExceedsLimitCache as s}from"../schema/ExceedsLimitCache.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e,this._cache=new s}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??a(r);return[{vvEvaluators:{0:o(r.renderer)},deconflictionEnabled:t,labelingInfo:r.labelingInfo}]}async createSourceSchema(e,r){const t=this._createServiceInfo(e);return l(t,null,{definitionExpression:null,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:this.layer.displayFilterInfo,customParameters:this.layer.customParameters,gdbVersion:null,historicMoment:null,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:r,availableFields:e.availableFields,cache:this._cache})}createProcessorSchema(e,t,i){const{fields:a,renderer:o,geometryType:s,labelingInfo:l,labelsVisible:c,orderBy:u,objectIdField:p}=this.layer,d={fields:a.map(e=>e.toJSON()),renderer:o?.clone(),labelingInfoSource:this.layer.id,featureReduction:r(this.layer,t),geometryType:s,labelingInfo:l,labelsVisible:c,objectIdField:p,orderBy:u??"default"};return n(e,t,d,i)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>r(this.layer,e),()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.renderer]}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(r){const i=this.layer,{capabilities:a}=i,o=i.fieldsIndex.toJSON(),s=t(i),l=i.timeInfo?.toJSON(),n=i.spatialReference.toJSON(),c=i.source.getSource(),u=this.layer.objectIdField,p=e(a);p.query.maxRecordCount=c.maxRecordCount;const d=r.spatialReference.toJSON();return{type:"ogc",source:c,orderByFields:u,outSpatialReference:d,metadata:{fieldsIndex:o,geometryType:s,featureIdInfo:{type:"object-id",fieldName:i.objectIdField},timeInfo:l,spatialReference:n,outSpatialReference:d,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:p.query.maxRecordCount,supportsCompactGeometry:p.query.supportsCompactGeometry,supportsDefaultSpatialReference:p.query.supportsDefaultSpatialReference,supportsFormatPBF:p.query.supportsFormatPBF,supportsMaxRecordCountFactor:p.query.supportsMaxRecordCountFactor,supportsQuantization:p.query.supportsQuantization,supportsCentroidOnDegeneratedQuantizedGeometry:p.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:p.query.supportsDegeneratedQuantizedGeometry,lastEditDate:null}}}}export{u as OGCFeatureLayerAdapter};
5
+ import{clone as e}from"../../../../../core/lang.js";import{getEffectiveFeatureReduction as r}from"./featureReductionUtils.js";import{getServiceGeometryType as t}from"./geometryUtils.js";import{getFeatureReductionDeconflictionEnabled as i,getLayerDeconflictionEnabled as a,createLabelVVEvaluator as o}from"./labelingUtils.js";import{ExceedsLimitCache as s}from"../schema/ExceedsLimitCache.js";import{createFeatureSourceSchema as l}from"../schema/SourceSchema.js";import{createSimpleProcessorSchema as n}from"../schema/processor/SimpleProcessorSchema.js";import{isRendererSupported as c}from"../support/rendererUtils.js";class u{constructor(e){this.layer=e,this._cache=new s}getLabelingDeconflictionInfo(e){const r=this.layer,t=i(r,e)??a(r);return[{vvEvaluators:{0:o(r.renderer)},deconflictionEnabled:t,labelingInfo:r.labelingInfo}]}async createSourceSchema(e,r){const t=this._createServiceInfo(e);return l(t,null,{definitionExpression:null,queryScaleRanges:[],displayFilterEnabled:e.displayFilterEnabled,displayFilterInfo:null,customParameters:this.layer.customParameters,gdbVersion:null,historicMoment:null,timeExtent:this.layer.timeExtent,apiKey:this.layer.apiKey,sourceRefreshVersion:r,availableFields:e.availableFields,cache:this._cache})}createProcessorSchema(e,t,i){const{fields:a,renderer:o,geometryType:s,labelingInfo:l,labelsVisible:c,orderBy:u,objectIdField:p}=this.layer,d={fields:a.map(e=>e.toJSON()),renderer:o?.clone(),labelingInfoSource:this.layer.id,featureReduction:r(this.layer,t),geometryType:s,labelingInfo:l,labelsVisible:c,objectIdField:p,orderBy:u??"default"};return n(e,t,d,i)}get hasRequiredSupport(){return c(this.layer.renderer)}get timeOptions(){return this.layer}getUpdateHashProperties(e){return[()=>this.layer.apiKey,()=>this.layer.customParameters,()=>r(this.layer,e),()=>this.layer.labelsVisible?this.layer.labelingInfo:null,()=>this.layer.orderBy,()=>this.layer.renderer]}setGraphicOrigin(e){e.origin=this.layer.graphicOrigin}setAggregateGraphicOrigin(e){e.origin=this.layer.aggregateGraphicOrigin}setTrackGraphicOrigin(e){e.origin=this.layer.trackGraphicOrigin}_createServiceInfo(r){const i=this.layer,{capabilities:a}=i,o=i.fieldsIndex.toJSON(),s=t(i),l=i.timeInfo?.toJSON(),n=i.spatialReference.toJSON(),c=i.source.getSource(),u=this.layer.objectIdField,p=e(a);p.query.maxRecordCount=c.maxRecordCount;const d=r.spatialReference.toJSON();return{type:"ogc",source:c,orderByFields:u,outSpatialReference:d,metadata:{fieldsIndex:o,geometryType:s,featureIdInfo:{type:"object-id",fieldName:i.objectIdField},timeInfo:l,spatialReference:n,outSpatialReference:d,globalIdField:null,subtypeField:null,subtypes:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null},queryMetadata:{maxRecordCount:p.query.maxRecordCount,supportsCompactGeometry:p.query.supportsCompactGeometry,supportsDefaultSpatialReference:p.query.supportsDefaultSpatialReference,supportsFormatPBF:p.query.supportsFormatPBF,supportsMaxRecordCountFactor:p.query.supportsMaxRecordCountFactor,supportsQuantization:p.query.supportsQuantization,supportsCentroidOnDegeneratedQuantizedGeometry:p.query.supportsCentroidOnDegeneratedQuantizedGeometry,supportsDegeneratedQuantizedGeometry:p.query.supportsDegeneratedQuantizedGeometry,lastEditDate:null}}}}export{u as OGCFeatureLayerAdapter};