@arcgis/core 4.24.0-next.20220607 → 4.24.0-next.20220610

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 (206) hide show
  1. package/analysis/Analysis.js +1 -1
  2. package/analysis/LineOfSightAnalysis.js +1 -1
  3. package/arcade/arcadeCompiler.js +1 -1
  4. package/arcade.d.ts +4 -0
  5. package/arcade.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{4d2181bde97983ecac8b.js → 03ddf44e6fb8bf9db3ff.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{2e2d7f5952934af43fd7.js → 04034dabc8e0a489b0f8.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d7168ff8f26ca2537080.js → 0747c28fce0b344dc89b.js} +1 -1
  10. package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +1 -0
  11. package/assets/esri/core/workers/chunks/{cbe98327181d8d7ad9e5.js → 262fabdc409d55831ffa.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2a52c2c6edd70432f4a5.js +1 -0
  13. package/assets/esri/core/workers/chunks/{71d445d1e6812e03a1d7.js → 3ce7adaefc9de28d9c87.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{c165845a117c21246b1e.js → 42aa8ce4eb7bd851475e.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{a9a4bb1d781b1a995fb3.js → 4824926501e11d04eb4a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{e51420d231c286b9c062.js → 540f1ed1ea9cddc739af.js} +1 -1
  17. package/assets/esri/core/workers/chunks/6196cfdeb91ceba52af3.js +1 -0
  18. package/assets/esri/core/workers/chunks/71a4618d959a09302c51.js +1 -0
  19. package/assets/esri/core/workers/chunks/76fbc8eaabba62fd4f9c.js +1 -0
  20. package/assets/esri/core/workers/chunks/{cb906a3f03dd0805c880.js → 7cc17b716b16a6684023.js} +1 -1
  21. package/assets/esri/core/workers/chunks/871681c1353026cb6d4b.js +1 -0
  22. package/assets/esri/core/workers/chunks/{13e9e6f0b4942d79b0eb.js → 88942e9f60687ac006dc.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{4c5b80ba3dbfe6f6cafb.js → acb1e649cda99d4f69a5.js} +1 -1
  24. package/assets/esri/core/workers/chunks/b71a0a8a2f446c671161.js +1 -0
  25. package/assets/esri/core/workers/chunks/b8002aaa665712299121.js +1 -0
  26. package/assets/esri/core/workers/chunks/{e4ca3f04ca7f71b46240.js → bb3480e231934b7bb34e.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{185da42e7cc8e440c0f0.js → c157b46b0724f3f0947e.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{1aba8c73c62a64e0658c.js → c6af8b0903d8d934d542.js} +1 -1
  29. package/assets/esri/core/workers/chunks/c8402e32307a7b7eaaeb.js +1 -0
  30. package/assets/esri/core/workers/chunks/c8e08a956b16034d9819.js +1 -0
  31. package/assets/esri/core/workers/chunks/d0d2566bedc493ed0a3b.js +1 -0
  32. package/assets/esri/core/workers/chunks/{8152cd26ebeae910b753.js → d3c73da9c2abb59e762a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/d828a0656e7351a74fc4.js +1 -0
  34. package/assets/esri/core/workers/chunks/{172368d4eb6e6f8d2bdb.js → d8b9551df1bd196d0126.js} +1 -1
  35. package/assets/esri/core/workers/chunks/e5c8584ae764892c324d.js +1 -0
  36. package/assets/esri/core/workers/chunks/{1d893ebc6f203ff1fc3d.js → efe605ff4ba2a95c14c5.js} +1 -1
  37. package/assets/esri/core/workers/chunks/f54d5abbb9668c45bd19.js +1 -0
  38. package/assets/esri/core/workers/chunks/{bd2f4a01cb71e25837ba.js → f7ba74fc4eb541c424fc.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{1ebed6d6f561f926bd36.js → faf6e48f9f1205fb2e43.js} +1 -1
  40. package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
  41. package/assets/esri/themes/base/widgets/_BasemapToggle.scss +6 -23
  42. package/assets/esri/themes/base/widgets/_Directions.scss +0 -3
  43. package/assets/esri/themes/base/widgets/_FeatureTable.scss +10 -2
  44. package/assets/esri/themes/base/widgets/_Slider.scss +8 -3
  45. package/assets/esri/themes/base/widgets/_Tooltip.scss +8 -8
  46. package/assets/esri/themes/base/widgets/_Weather.scss +5 -1
  47. package/assets/esri/themes/dark/main.css +1 -1
  48. package/assets/esri/themes/light/main.css +1 -1
  49. package/assets/esri/themes/light/view.css +1 -1
  50. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle.json +1 -1
  51. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ar.json +1 -1
  52. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bg.json +1 -1
  53. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_bs.json +1 -1
  54. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ca.json +1 -1
  55. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_cs.json +1 -1
  56. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_da.json +1 -1
  57. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_de.json +1 -1
  58. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_el.json +1 -1
  59. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_en.json +1 -1
  60. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_es.json +1 -1
  61. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_et.json +1 -1
  62. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fi.json +1 -1
  63. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_fr.json +1 -1
  64. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_he.json +1 -1
  65. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hr.json +1 -1
  66. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_hu.json +1 -1
  67. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_id.json +1 -1
  68. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_it.json +1 -1
  69. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ja.json +1 -1
  70. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ko.json +1 -1
  71. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lt.json +1 -1
  72. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_lv.json +1 -1
  73. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nb.json +1 -1
  74. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_nl.json +1 -1
  75. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pl.json +1 -1
  76. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-BR.json +1 -1
  77. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_pt-PT.json +1 -1
  78. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ro.json +1 -1
  79. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_ru.json +1 -1
  80. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sk.json +1 -1
  81. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sl.json +1 -1
  82. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sr.json +1 -1
  83. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_sv.json +1 -1
  84. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_th.json +1 -1
  85. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_tr.json +1 -1
  86. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_uk.json +1 -1
  87. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_vi.json +1 -1
  88. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-CN.json +1 -1
  89. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-HK.json +1 -1
  90. package/assets/esri/widgets/BasemapToggle/t9n/BasemapToggle_zh-TW.json +1 -1
  91. package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_en.json +1 -1
  92. package/chunks/RasterColorizer.glsl.js +22 -18
  93. package/chunks/basis_transcoder.js +1 -1
  94. package/chunks/i3s.js +1 -1
  95. package/chunks/lclayout.js +1 -1
  96. package/chunks/lerc-wasm.js +1 -1
  97. package/chunks/libtess-asm.js +1 -1
  98. package/chunks/libtess.js +1 -1
  99. package/chunks/pe-wasm.js +1 -1
  100. package/chunks/persistableUrlUtils.js +1 -1
  101. package/chunks/vxlLayer.js +1 -1
  102. package/core/quantityUtils.js +1 -1
  103. package/geometry/projection.js +1 -1
  104. package/geometry/support/geodesicUtils.js +1 -1
  105. package/geometry/support/plane.js +1 -1
  106. package/interfaces.d.ts +471 -52
  107. package/layers/LineOfSightLayer.js +1 -1
  108. package/layers/RouteLayer.js +1 -1
  109. package/layers/VectorTileLayer.js +1 -1
  110. package/layers/support/LayerContingentValuesCache.js +1 -1
  111. package/layers/support/RasterInfo.js +1 -1
  112. package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
  113. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  114. package/layers/support/rasterDatasets/WCSRaster.js +1 -1
  115. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  116. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  117. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  118. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  119. package/package.json +1 -1
  120. package/portal/support/urlUtils.js +5 -0
  121. package/renderers/support/colorRampUtils.js +1 -1
  122. package/rest/imageService/fetchRasterInfo.js +1 -1
  123. package/smartMapping/renderers/pieChart.js +1 -1
  124. package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
  125. package/support/arcadeUtils.js +1 -1
  126. package/support/elevationInfoUtils.js +1 -1
  127. package/support/persistableUrlUtils.js +1 -1
  128. package/support/revision.js +1 -1
  129. package/symbols/cim/cimAnalyzer.js +1 -1
  130. package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
  131. package/views/2d/engine/webgl/Utils.js +1 -1
  132. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  133. package/views/2d/layers/graphics/GraphicStoreItem.js +1 -1
  134. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  135. package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
  136. package/views/3d/analysis/Dimensioning/LengthDimensionComputation.js +1 -1
  137. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  138. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  139. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  140. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  141. package/views/3d/input/SceneInputManager.js +1 -1
  142. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  143. package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
  144. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  145. package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
  146. package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
  147. package/views/3d/layers/i3s/I3SAttributeOverrides.js +1 -1
  148. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  149. package/views/3d/support/MemoryController.js +1 -1
  150. package/views/3d/terrain/RasterColorizerTechnique.js +1 -1
  151. package/views/3d/terrain/TerrainSurface.js +1 -1
  152. package/views/3d/terrain/TileCompositor.js +1 -1
  153. package/views/3d/terrain/TileRenderer.js +1 -1
  154. package/views/3d/webgl-engine/core/shaderLibrary/output/BlendOptions.js +1 -1
  155. package/views/MapView.js +1 -1
  156. package/views/SceneView.js +1 -1
  157. package/views/View.js +1 -1
  158. package/views/draw/DrawOperation.js +1 -1
  159. package/views/draw/support/GraphicMover.js +1 -1
  160. package/views/interactive/SegmentLabels.js +1 -1
  161. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  162. package/views/interactive/tooltip/TranslateTooltipInfos.js +1 -1
  163. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  164. package/views/interactive/tooltip/support/measurements.js +1 -1
  165. package/views/support/areaMeasurementUtils.js +1 -1
  166. package/views/support/automaticLengthMeasurementUtils.js +5 -0
  167. package/views/support/euclideanLengthMeasurementUtils.js +5 -0
  168. package/views/support/geodesicLengthMeasurementUtils.js +5 -0
  169. package/views/support/measurementUtils.js +5 -0
  170. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  171. package/widgets/BasemapToggle.js +1 -1
  172. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  173. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  174. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  175. package/widgets/BuildingExplorer.js +1 -1
  176. package/widgets/Daylight/DaylightViewModel.js +1 -1
  177. package/widgets/Directions/DirectionsViewModel.js +1 -1
  178. package/widgets/Directions.js +1 -1
  179. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  180. package/widgets/Feature/support/featureUtils.js +1 -1
  181. package/widgets/FeatureTable/FieldColumn.js +1 -1
  182. package/widgets/Legend/support/sizeRampUtils.js +1 -1
  183. package/widgets/Print/PrintViewModel.js +1 -1
  184. package/widgets/Sketch/SketchViewModel.js +1 -1
  185. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  186. package/widgets/UtilityNetworkTrace.js +1 -1
  187. package/widgets/Weather.js +1 -1
  188. package/widgets/Widget.js +1 -1
  189. package/widgets/support/AnalysisViewModel.js +1 -1
  190. package/widgets/support/AnchorElementViewModel.js +1 -1
  191. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  192. package/assets/esri/core/workers/chunks/2ac6c99aacb873134f7c.js +0 -1
  193. package/assets/esri/core/workers/chunks/471beeb6924599209567.js +0 -1
  194. package/assets/esri/core/workers/chunks/5242c9badca17ba2ab25.js +0 -1
  195. package/assets/esri/core/workers/chunks/72c7d48408d1f8050026.js +0 -1
  196. package/assets/esri/core/workers/chunks/770cf0a66102100abe74.js +0 -1
  197. package/assets/esri/core/workers/chunks/96ff15d6c2bfca0c6061.js +0 -1
  198. package/assets/esri/core/workers/chunks/9c4c721d890b49697132.js +0 -1
  199. package/assets/esri/core/workers/chunks/af3766a2d27419c7766c.js +0 -1
  200. package/assets/esri/core/workers/chunks/b50bbfd75768d9a8de88.js +0 -1
  201. package/assets/esri/core/workers/chunks/b577ec80647cf2ece397.js +0 -1
  202. package/assets/esri/core/workers/chunks/c1653b6cb201ecbaabaa.js +0 -1
  203. package/assets/esri/core/workers/chunks/e99b58d07475bffce7ea.js +0 -1
  204. package/assets/esri/core/workers/chunks/f3d885aec4bca18928d4.js +0 -1
  205. package/assets/esri/core/workers/chunks/fc0da1dfeef041182ddf.js +0 -1
  206. package/views/support/lengthMeasurementUtils.js +0 -5
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8875,5235],{28924:(e,t,i)=>{i.d(t,{Z:()=>s});class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(){return"object, FeatureSetCollection"}}},42666:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>ne,constructFeatureSet:()=>se,constructFeatureSetFromPortalItem:()=>fe,constructFeatureSetFromRelationship:()=>ae,constructFeatureSetFromUrl:()=>ie,convertToFeatureSet:()=>pe,createFeatureSetCollectionFromMap:()=>ue,createFeatureSetCollectionFromService:()=>ce,getPortal:()=>he,initialiseMetaDataCache:()=>ee,lookupUser:()=>de});var s=i(40330),r=i(3172),n=i(28924),a=i(84328),l=i(38171),o=i(61363),u=i(70409),c=i(85065),h=i(91136),d=i(90961),p=i(3823),f=i(90658),y=i(36515),_=i(95002),g=i(41534);class m{clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i){const s=new m;s.field=e;const r=g.WhereClause.create(t,i),n=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new Error("Statistic does not have 1 or 0 Parameters");const t=g.WhereClause.create((0,y.XF)(e.parseTree.args.value[0],f.Bj.Standardised,e.parameters),e.fieldsIndex);return{name:e.parseTree.name,expr:t}}return null}(r);if(null===n)throw new Error("Invalid Statistic Function");const a=n.name.toUpperCase().trim();if("MIN"===a){if(s.typeofstat="MIN",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("MAX"===a){if(s.typeofstat="MAX",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("COUNT"===a)s.typeofstat="COUNT",s.workingexpr=n.expr;else if("STDEV"===a){if(s.typeofstat="STDDEV",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("SUM"===a){if(s.typeofstat="SUM",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("MEAN"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("AVG"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else{if("VAR"!==a)throw new Error("Invalid Statistic Function");if(s.typeofstat="VAR",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}function w(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function b(e,t,i,s,r,n){return w(function(e,t){return e<<t|e>>>32-t}(w(w(t,e),w(s,n)),r),i)}function v(e,t,i,s,r,n,a){return b(t&i|~t&s,e,t,r,n,a)}function S(e,t,i,s,r,n,a){return b(t&s|i&~s,e,t,r,n,a)}function F(e,t,i,s,r,n,a){return b(t^i^s,e,t,r,n,a)}function I(e,t,i,s,r,n,a){return b(i^(t|~s),e,t,r,n,a)}function C(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let i=1732584193,s=-271733879,r=-1732584194,n=271733878;for(let t=0;t<e.length;t+=16){const a=i,l=s,o=r,u=n;i=v(i,s,r,n,e[t+0],7,-680876936),n=v(n,i,s,r,e[t+1],12,-389564586),r=v(r,n,i,s,e[t+2],17,606105819),s=v(s,r,n,i,e[t+3],22,-1044525330),i=v(i,s,r,n,e[t+4],7,-176418897),n=v(n,i,s,r,e[t+5],12,1200080426),r=v(r,n,i,s,e[t+6],17,-1473231341),s=v(s,r,n,i,e[t+7],22,-45705983),i=v(i,s,r,n,e[t+8],7,1770035416),n=v(n,i,s,r,e[t+9],12,-1958414417),r=v(r,n,i,s,e[t+10],17,-42063),s=v(s,r,n,i,e[t+11],22,-1990404162),i=v(i,s,r,n,e[t+12],7,1804603682),n=v(n,i,s,r,e[t+13],12,-40341101),r=v(r,n,i,s,e[t+14],17,-1502002290),s=v(s,r,n,i,e[t+15],22,1236535329),i=S(i,s,r,n,e[t+1],5,-165796510),n=S(n,i,s,r,e[t+6],9,-1069501632),r=S(r,n,i,s,e[t+11],14,643717713),s=S(s,r,n,i,e[t+0],20,-373897302),i=S(i,s,r,n,e[t+5],5,-701558691),n=S(n,i,s,r,e[t+10],9,38016083),r=S(r,n,i,s,e[t+15],14,-660478335),s=S(s,r,n,i,e[t+4],20,-405537848),i=S(i,s,r,n,e[t+9],5,568446438),n=S(n,i,s,r,e[t+14],9,-1019803690),r=S(r,n,i,s,e[t+3],14,-187363961),s=S(s,r,n,i,e[t+8],20,1163531501),i=S(i,s,r,n,e[t+13],5,-1444681467),n=S(n,i,s,r,e[t+2],9,-51403784),r=S(r,n,i,s,e[t+7],14,1735328473),s=S(s,r,n,i,e[t+12],20,-1926607734),i=F(i,s,r,n,e[t+5],4,-378558),n=F(n,i,s,r,e[t+8],11,-2022574463),r=F(r,n,i,s,e[t+11],16,1839030562),s=F(s,r,n,i,e[t+14],23,-35309556),i=F(i,s,r,n,e[t+1],4,-1530992060),n=F(n,i,s,r,e[t+4],11,1272893353),r=F(r,n,i,s,e[t+7],16,-155497632),s=F(s,r,n,i,e[t+10],23,-1094730640),i=F(i,s,r,n,e[t+13],4,681279174),n=F(n,i,s,r,e[t+0],11,-358537222),r=F(r,n,i,s,e[t+3],16,-722521979),s=F(s,r,n,i,e[t+6],23,76029189),i=F(i,s,r,n,e[t+9],4,-640364487),n=F(n,i,s,r,e[t+12],11,-421815835),r=F(r,n,i,s,e[t+15],16,530742520),s=F(s,r,n,i,e[t+2],23,-995338651),i=I(i,s,r,n,e[t+0],6,-198630844),n=I(n,i,s,r,e[t+7],10,1126891415),r=I(r,n,i,s,e[t+14],15,-1416354905),s=I(s,r,n,i,e[t+5],21,-57434055),i=I(i,s,r,n,e[t+12],6,1700485571),n=I(n,i,s,r,e[t+3],10,-1894986606),r=I(r,n,i,s,e[t+10],15,-1051523),s=I(s,r,n,i,e[t+1],21,-2054922799),i=I(i,s,r,n,e[t+8],6,1873313359),n=I(n,i,s,r,e[t+15],10,-30611744),r=I(r,n,i,s,e[t+6],15,-1560198380),s=I(s,r,n,i,e[t+13],21,1309151649),i=I(i,s,r,n,e[t+4],6,-145523070),n=I(n,i,s,r,e[t+11],10,-1120210379),r=I(r,n,i,s,e[t+2],15,718787259),s=I(s,r,n,i,e[t+9],21,-343485551),i=w(i,a),s=w(s,l),r=w(r,o),n=w(n,u)}return[i,s,r,n]}function x(e,t=1){const i=t||0,s=C(function(e){const t=[];for(let i=0,s=8*e.length;i<s;i+=8)t[i>>5]|=(255&e.charCodeAt(i/8))<<i%32;return t}(e),8*e.length);switch(i){case 3:return s;case 1:return function(e){const t="0123456789abcdef",i=[];for(let s=0,r=4*e.length;s<r;s++)i.push(t.charAt(e[s>>2]>>s%4*8+4&15)+t.charAt(e[s>>2]>>s%4*8&15));return i.join("")}(s);case 2:return function(e){const t=[];for(let i=0,s=32*e.length;i<s;i+=8)t.push(String.fromCharCode(e[i>>5]>>>i%32&255));return t.join("")}(s);case 0:return function(e){const t=[];for(let i=0,s=4*e.length;i<s;i+=3){const s=(e[i>>2]>>i%4*8&255)<<16|(e[i+1>>2]>>(i+1)%4*8&255)<<8|e[i+2>>2]>>(i+2)%4*8&255;for(let r=0;r<4;r++)8*i+6*r>32*e.length?t.push("="):t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(s>>6*(3-r)&63))}return t.join("")}(s)}}var R=i(82971),k=i(1231),D=i(99514);function E(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class T extends h.Z{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return f.dj.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new D.Z([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s),t.typeofstat=E(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s)};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null}else this.geometryType=f.Qk.point,this.typeIdField="",this.types=null,this.spatialReference=new R.Z({wkid:4326});this.fields=[];const r=new m;r.field=this._nextUniqueName(e),r.tofieldname=this.objectIdField,r.workingexpr=g.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex()),r.typeofstat="MIN",this._decodedStatsfield.push(r);for(const t of this._decodedGroupbyfield){const i=new k.Z;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,y.y5)(t.expression)){const e=this._parent.getField((0,y.zR)(t.expression,f.Bj.Standardised));if(!e)throw new Error("Field is not present for Aggregation");t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type}else{i.type=this._convertToEsriFieldType((0,y.DT)(t.expression,this._parent.fields));const e=new k.Z;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new u.yN(e,t.expression)),this._candosimplegroupby=!1}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new u.$X(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new k.Z;let s=null;const r=this._decodedStatsfield[t];r.field=this._nextUniqueName(e),r.tofieldname===this.objectIdField&&(this._internalObjectIdField=r.field),i.name=r.tofieldname,i.alias=i.name;const n=null!==r.workingexpr&&(0,y.y5)(r.workingexpr)?(0,y.zR)(r.workingexpr,f.Bj.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(s=this._parent.getField(n),!s)throw new Error("Field is not present for Aggregation");i.type=s.type}else i.type="double";break;case"MIN":case"MAX":if(""!==n){if(s=this._parent.getField(n),!s)throw new Error("Field is not present for Aggregation");i.type=s.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(s=this._parent.getField(n),!s))throw new Error("Field is not present for Aggregation");i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const r=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,r)?(await this._expandPagedSet(e,r,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,r){if(""!==e)return new d.Z([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.hq)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==s){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,l.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(r),n=!0===l.nowhereclause?new d.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new d.Z(a._candidates.slice(0),a._known.slice(0),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.Xx({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.Z({parentfeatureset:o,orderbyclause:new p.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=o;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a.Z({parentfeatureset:e,whereclause:t})}n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.Z({parentfeatureset:e,orderbyclause:new p.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.bB)(e,t.tofieldname,(0,y.zR)(t.workingexpr,f.Bj.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.bB)(e,t.tofieldname,(0,y.zR)(t.expression,f.Bj.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const e of s){const t={geometry:e.geometry,attributes:{}};for(const i of this._decodedGroupbyfield)t.attributes[i.tofieldname]=e.attributes[i.name];for(const i of this._decodedStatsfield)t.attributes[i.tofieldname]=e.attributes[i.field];this._featureCache[t.attributes[this.objectIdField]]=new l.Z(t)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((r,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?r(s.length):this._nextAggregateItem(e,t,i,s,(n=>{null===n?r(s.length):(t-=1,r(this._sequentialGetPhysicalItem(e,t,i,s)))}),n)}))}_nextAggregateItem(e,t,i,s,r,n){try{(0,o.X)(e.pagesDefinition.internal.iterator.next()).then((a=>{if(null===a)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const l=this._generateAggregateHash(a);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[a],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[a],id:l},void r(i)}e.pagesDefinition.internal.workingItem.features.push(a)}this._nextAggregateItem(e,t,i,s,r,n)}}),n)}catch(e){n(e)}}_calculateFieldStat(e,t,i){const s=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const r=t.workingexpr.calculateValue(e.features[i]);null!==r&&s.push(r)}else s.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,_.tj)("min",s,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,_.tj)("max",s,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,_.tj)("sum",s,-1);break;case"COUNT":i.attributes[t.tofieldname]=s.length;break;case"VAR":i.attributes[t.tofieldname]=(0,_.tj)("var",s,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,_.tj)("stddev",s,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,_.tj)("avg",s,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.features[0].attributes[i.singlefield]:i.expression.calculateValue(e.features[0]);t.attributes[i.tofieldname]=s}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let s=0;s<this._decodedStatsfield.length;s++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[s],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.Z({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return x(t,2)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){h.Z._featuresetFunctions.groupby=function(e,t){return new T({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var A=i(53073),N=i(63991),L=i(80692),O=i(33955),P=i(3121),j=i(98732),Z=(i(20102),i(80442),i(92604),i(10158),i(4967)),q=(i(67676),i(17452),i(67900),i(8744),i(34599)),M=i(74889),U=i(57444),G=(i(98326),i(56545),i(41818)),B=(i(66577),i(5396)),z=i(75935),W=(i(82526),i(28141),i(78760)),V=i(58539),J=i(33586);class Q extends h.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.tI}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}convertQueryToLruCacheKey(e){return x((0,f.hd)(e.toJSON()),2)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{const e=[];for(const t of this.fields)if("oid"===t.type)e.push(t);else for(const i of this._layer.outFields)if(i.toLowerCase()===t.name.toLowerCase()){e.push(t);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=f.Bj.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=f.Bj.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=f.Bj.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=f.Bj.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types}_isInFeatureSet(){return f.dj.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new U.Z;t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){return!e.outStatistics&&this._layer&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsFormatPBF&&!0===this._layer.capabilities.query.supportsQuantizationEditMode}async queryPBF(e){e.quantizationParameters={mode:"edit"};const t=await(0,q.executeQueryPBF)(this._layer.parsedUrl,e,new W.J({}));return M.default.fromJSON((0,j.cn)(t.data)).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion?this._layer.gdbVersion:"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title,source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){const i="execute"===t?Z.e:"executeForCount"===t?G.P:B.G,s="execute"===t&&this.pbfSupportedForQuery(e);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),r}async _getFilteredSet(e,t,i,s,r){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new U.Z;o.where=null===i?null===t?"1=1":"":(0,y.zR)(i,n),this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(r),new d.Z([],u,l,null)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=s.constructClause(),a=!0);const l=await this.databaseType();let o=null===i?null===t?"1=1":"":(0,y.zR)(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(o=""!==o?"(("+this._layer.definitionExpression+") AND ("+o+"))":this._layer.definitionExpression);let u=this._maxQueryRate();const c=this._layer.capabilities.query.maxRecordCount;void 0!==c&&c<u&&(u=c);let h=null;if(!0===this._pageJustIds)h=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const s=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._layer.outFields?this._layer.outFields:["*"]);h=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:s.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(h,u,0,1,r),h}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=new U.Z;this._requestStandardised&&(a.sqlFormat="standard"),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return"done";for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[r+t]=l.features[t].attributes[this._layer.objectIdField];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[this._layer.objectIdField]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,s){const r=[];if(-1!==t&&void 0===this._featureCache[t]&&r.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,s),this._getFeatures(e,t,i,s);let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[s]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[s]]){const r=t._featureMap[e._known[s]];null!==r&&(i=!0,this._featureCache[e._known[s]]=r)}}if(!1===i&&(e._known[s]!==t&&r.push(e._known[s]),r.length>=this._maxProcessingRate()-1))break}if(n>=i&&0===r.length)break}if(0===r.length)return"success";const a=new U.Z;this._requestStandardised&&(a.sqlFormat="standard"),a.objectIds=r,a.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._layer.outFields?this._layer.outFields:["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(s),void 0!==l.error)throw new Error(l.error);for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[this._layer.objectIdField]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,s,r,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;for(let e=0;e<this._layer.fields.length;e++)if(this._layer.fields[e].name.toLowerCase()===c.toLowerCase()){c=this._layer.fields[e].name;break}const h=new U.Z;this._requestStandardised&&(h.sqlFormat="standard");let d=null===n?null===r?"1=1":"":(0,y.zR)(n,u);this._layer.definitionExpression&&this._useDefinitionExpression&&(d=""!==d?"(("+this._layer.definitionExpression+") AND ("+d+"))":this._layer.definitionExpression),h.where=d,h.spatialRelationship=this._makeRelationshipEnum(s),h.relationParameter=this._makeRelationshipParam(s),h.geometry=null===r?null:r,h.returnDistinctValues=!0,h.returnGeometry=!1,h.outFields=[c];const p=await this.executeQuery(h,"execute");if(this._checkCancelled(o),!p.hasOwnProperty("features"))throw new Error("Unnexected Result querying statistics from layer");let f=!1;for(let e=0;e<this._layer.fields.length;e++)if(this._layer.fields[e].name===c){"date"===this._layer.fields[e].type&&(f=!0);break}for(let e=0;e<p.features.length;e++){if(f){const t=p.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(p.features[e].attributes[c]);if(l.length>=a)break}return 0===p.features.length?l:p.features.length===this._layer.capabilities.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+p.features.length,t,i,s,r,n,a,l,o)}:l}async _distinctStat(e,t,i,s,r,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,s,r,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType}async _countstat(e,t,i,s){const r=await this.databaseType(),n=new U.Z;if(this._requestStandardised&&(n.sqlFormat="standard"),this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};let a=null===s?null===i?"1=1":"":(0,y.zR)(s,r);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=""!==a?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),n.where=a,n.where=a,n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===i?null:i,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,i,s,r,n,a){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,s,r):{calculated:!1};if(!1===o||!1===(0,y.y5)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===u?""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,i,s,r,n,a);const c=await this.databaseType();if(this.isTable()&&s&&null!==i&&""!==i)return{calculated:!0,result:null};const h=new U.Z;this._requestStandardised&&(h.sqlFormat="standard");let d=null===r?null===s?"1=1":"":(0,y.zR)(r,c);this._layer.definitionExpression&&this._useDefinitionExpression&&(d=""!==d?"(("+this._layer.definitionExpression+") AND ("+d+"))":this._layer.definitionExpression),h.where=d,h.spatialRelationship=this._makeRelationshipEnum(i),h.relationParameter=this._makeRelationshipParam(i),h.geometry=null===s?null:s;const p=new V.Z;p.statisticType=(0,_.g3)(e),p.onStatisticField=(0,y.zR)(t,c),p.outStatisticFieldName="ARCADE_STAT_RESULT",h.returnGeometry=!1;let f="ARCADE_STAT_RESULT";h.outStatistics=[p];const g=await this.executeQuery(h,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new Error("Unnexected Result querying statistics from layer");let m=!1;for(let e=0;e<g.fields.length;e++)if("ARCADE_STAT_RESULT"===g.fields[e].name.toUpperCase()){f=g.fields[e].name,"date"===g.fields[e].type&&(m=!0);break}if(m){let e=g.features[0].attributes[f];return null!==e&&(e=new Date(g.features[0].attributes[f])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[f]}}_stat(e,t,i,s,r,n,a){return this._stats(e,t,i,s,r,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const s=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression;if(void 0!==this._layer.capabilities&&null!==this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics&&!0===this._layer.capabilities.query.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)null!==t[e].workingexpr&&(!1===t[e].workingexpr.isStandardized||!1===(0,y.y5)(t[e].workingexpr)&&!1===s)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,c=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,u=!0,o=this._layer.objectIdField);const h=[];for(let e=0;e<t.length;e++){const i=new V.Z;i.onStatisticField=null!==t[e].workingexpr?(0,y.zR)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),h.push(i)}""===o&&(o=e.join(","));let p=this._maxQueryRate();const f=this._layer.capabilities.query.maxRecordCount;void 0!==f&&f<p&&(p=f);let _=null===r?null===s?"1=1":"":(0,y.zR)(r,l);return this._layer.definitionExpression&&this._useDefinitionExpression&&(_=""!==_?"(("+this._layer.definitionExpression+") AND ("+_+"))":this._layer.definitionExpression),new d.Z([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:p,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:h,geometry:null===s?null:s,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let s=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(s=""!==s?"("+s+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const r=e.pagesDefinition.internal.lastRetrieved,n=r,a=e.pagesDefinition.internal.lastPage,o=new U.Z;if(this._requestStandardised&&(o.sqlFormat="standard"),o.where=s,o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new Error("Unnexected Result querying aggregates from layer");const c=[];if(e.pagesDefinition.internal.lastPage!==a)return[];for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.Z({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,s,r){const n=new P.default({url:e,outFields:null===t?["*"]:t});return new Q({layer:n,spatialReference:i,lrucache:s,interceptor:r})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON&&this._layer.source.sourceJSON.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,f.US)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,s,r){if(this._layer.capabilities.data.supportsAttachment&&this._layer.capabilities.operations.supportsQueryAttachments){const n={objectIds:[e],returnMetadata:r};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(n.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:n,method:"attachments"});const a=await this._layer.queryAttachments(n),l=[];return a&&a[e]&&a[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let s=null;r&&t.exifInfo&&(s=J.Z.convertJsonToArcade(t.exifInfo,!0)),l.push(new L.Z(t.id,t.name,t.contentType,t.size,i,s))})),l}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=JSON.stringify(e.outSpatialReference.toJSON())),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,r.default)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t&&t.relatedRecordGroups){const i=t.spatialReference;for(const s of t.relatedRecordGroups){const r=s.objectId,n=[];for(const e of s.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.Z({geometry:e.geometry?(0,O.im)(e.geometry):null,attributes:e.attributes});n.push(t)}e[r]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new Error("Invalid Request")}async getFeatureByObjectId(e,t){const i=new U.Z;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await(0,Z.e)(this._layer.parsedUrl.path,i);return 1===s.features.length?s.features[0]:null}async getIdentityUser(){await this.load();const e=s.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=s.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const e=await(0,r.default)(t,{query:{f:"json"}});let i="";return e.data&&e.data.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new Q({layer:this._layer,spatialReference:this.spatialReference,outFields:this._overrideFields,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries,interceptor:this.featureSetQueryInterceptor});return e._useDefinitionExpression=!1,e}}var K=i(17805);class $ extends h.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,this.relatedLayer=null,this.relationship=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this.relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this.relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this.relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this.relatedLayer.geometryType,this.fields=this.relatedLayer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this.relatedLayer.objectIdField,this.globalIdField=this.relatedLayer.globalIdField,this.hasM=this.relatedLayer.supportsM,this.hasZ=this.relatedLayer.supportsZ,this.typeIdField=this.relatedLayer.typeIdField,this.types=this.relatedLayer.types}async databaseType(){return await this.relatedLayer.databaseType(),this._databaseType=this.relatedLayer._databaseType,this._databaseType}isTable(){return this.relatedLayer.isTable()}_isInFeatureSet(){return f.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new d.Z([],[],!0,null);if(n.capabilities.queryRelated&&n.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&n.capabilities&&n.capabilities.queryRelated&&!0===n.capabilities.queryRelated.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new z.Z;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),o.returnGeometry=c,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const h=await n.source.queryRelatedFeatures(o);this._checkCancelled(r);const p=h[this._findObjectId]?h[this._findObjectId].features:[],f=[];for(let e=0;e<p.length;e++)this._featureCache[p[e].attributes[this.relatedLayer.objectIdField]]=p[e],f.push(p[e].attributes[this.relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=i;return new d.Z(y||_?f:[],y||_?[]:f,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==s&&l&&l.capabilities.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities.query.maxRecordCount;void 0!==u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,h=null!=i;let p=null,f=!0;!0===this._removeGeometry&&(f=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);return p=new d.Z(c||h?["GETPAGES"]:[],c||h?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(p,o,0,0,r),p}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new z.Z;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[r+t]=u[t].attributes[this.relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this.relatedLayer.objectIdField]]=u[e];const c=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&c&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,s){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let a=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[s]&&void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)))&&!(a>=i&&0===r.length);s++);if(0===r.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,r,n,a){return{calculated:!1}}get gdbVersion(){return this.relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,r){return!1}relationshipMetaData(){return this.relatedLayer.relationshipMetaData()}serviceUrl(){return this.relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,r){return this.relatedLayer.queryAttachments(e,t,i,s,r)}getFeatureByObjectId(e,t){return this.relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this.relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this.relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this.relatedLayer}}var H=i(48039),X=i(65587),Y=i(15235);function ee(){null===H.Z.applicationCache&&(H.Z.applicationCache=new H.Z)}async function te(e,t){if(H.Z.applicationCache){const i=H.Z.applicationCache.getLayerInfo(e);if(i){const s=await i;return new P.default({url:e,outFields:t,sourceJSON:s})}const s=new P.default({url:e,outFields:t}),r=(async()=>(await s.load(),s.sourceJSON))();if(H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,r);try{return await r,s}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return await r,s}return new P.default({url:e,outFields:t})}async function ie(e,t,i,s,r,n=null){return se(await te(e,["*"]),t,i,s,r,n)}function se(e,t=null,i=null,s=!0,r=null,n=null){return!0===e._hasMemorySource()?new K.Z({layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:n}):new Q({layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:n})}async function re(e){if(null!==H.Z.applicationCache){const t=H.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.default)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return t}async function ne(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},s=await re(e);if(i.metadata=s,s.controllerDatasetLayers&&void 0!==s.controllerDatasetLayers.utilityNetworkLayerId&&null!==s.controllerDatasetLayers.utilityNetworkLayerId){if(s.layers)for(const e of s.layers)i.layerNameLkp[e.id]=e.name;if(s.tables)for(const e of s.tables)i.layerNameLkp[e.id]=e.name;const n=s.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=n;const a=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==H.Z.applicationCache){const e=H.Z.applicationCache.getLayerInfo(i);if(null!==e)return e}const s=(async()=>{const i=await(0,r.default)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements&&e.layerDataElements[0])return e.layerDataElements[0]}throw new Error("Not Found")})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(i,s);try{return await s}catch(e){throw H.Z.applicationCache.clearLayerInfo(i),e}}return s}(e,n);if(a){i.queryelem=a,i.queryelem&&i.queryelem.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources?e.edgeSources:[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]?i.layerNameLkp[t.layerId]:null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources?e.junctionSources:[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]?i.layerNameLkp[t.layerId]:null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const s=await async function(e){if(null!==H.Z.applicationCache){const t=H.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.default)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+n);if(s.systemLayers&&void 0!==s.systemLayers.associationsTableId&&null!==s.systemLayers.associationsTableId){const r=[];i.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG"));let n=await ie(e+"/"+s.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null);return await n.load(),i.unVersion>=4&&(n=n.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)",n.getFieldsIndex())),await n.load()),{lkp:i.lkp,associations:n,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function ae(e,t,i,s=null,r=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await ie(o,s,r,n,a,l);return new $({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:s,outFields:r,includeGeometry:n,lrucache:a,interceptor:l})}a.Z.registerAction(),T.registerAction(),c.Z.registerAction(),A.Z.registerAction(),N.Z.registerAction();class le extends n.Z{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this.lrucache=i,this.interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=se(e,this._overridespref,null===i?["*"]:i,t,this.lrucache,this.interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>t instanceof P.default&&t.title===e));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>!!(t.title&&t.title===e||t.title&&t.title===e)));if(s){if(s instanceof P.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e=s.outFields?s:{...s,outFields:["*"]};s._materializedTable=new P.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}async featureSetById(e,t=!0,i=["*"]){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>t instanceof P.default&&t.id===e));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>t.id===e));if(s){if(s instanceof P.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e={...s,outFields:["*"]};s._materializedTable=new P.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}}class oe extends n.Z{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this.lrucache=i,this.interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=se(e,this._overridespref,null===i?["*"]:i,t,this.lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await re(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new oe(this._url,this._overridespref,this.lrucache,this.interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers?r.layers:[])t.name===e&&(n=t);if(!n)for(const t of r.tables?r.tables:[])t.name===e&&(n=t);if(n){const e=await te(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers?r.layers:[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of r.tables?r.tables:[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await te(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}}function ue(e,t,i=null,s=null){return new le(e,t,i,s)}function ce(e,t,i=null,s=null){return new oe(e,t,i,s)}function he(e,t){return null===e?t:new X.Z({url:e.field("url")})}async function de(e,t,i){if(!s.id.findCredential(e.restUrl))return null;if("loaded"===e.loadStatus&&""===t&&e.user&&e.user.sourceJSON&&!1===i)return e.user.sourceJSON;if(""===t){const t=await(0,r.default)(e.restUrl+"/community/self",{responseType:"json",query:{f:"json",...!1===i?{}:{returnUserLicenseTypeExtensions:!0}}});if(t.data){const e=t.data;if(e&&e.username)return e}return null}const n=await(0,r.default)(e.restUrl+"/community/users/"+t,{responseType:"json",query:{f:"json"}});if(n.data){const e=n.data;return e.error?null:e}return null}function pe(e,t,i,s,r){if(null===e)return null;if(e instanceof P.default){switch(t){case"datasource":return se(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return se(e,r,e.outFields,!0,i,s)}return null}if(e instanceof h.Z)switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}async function fe(e,t,i,s,r,n,a,l=null){if(H.Z.applicationCache){const o=H.Z.applicationCache.getLayerInfo(e+":"+n.url);if(o){const e=await o;return se(new P.default({url:(0,f.US)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}}const o=new Y.default({id:e,portal:n}).load();H.Z.applicationCache&&H.Z.applicationCache.setLayerInfo(e+":"+n.url,o);try{const e=await o;return se(new P.default({url:(0,f.US)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}catch(t){throw H.Z.applicationCache&&H.Z.applicationCache.clearLayerInfo(e+":"+n.url),t}}},70409:(e,t,i)=>{i.d(t,{$X:()=>d,QP:()=>p,TO:()=>f,Xx:()=>_,yN:()=>y});var s=i(38171),r=i(77286),n=i(91136),a=i(90961),l=i(90658),o=i(36515),u=i(41534),c=i(82971);class h{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class d extends h{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class p extends h{constructor(e,t,i){super((0,l.JW)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,o.bB)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class f extends h{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,l.Bj.Standardised,this.field.name,this.codefield instanceof u.WhereClause?(0,o.zR)(this.codefield,l.Bj.Standardised):this.codefield,e.parameters);return i.includes(f.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:u.WhereClause.create(i,t._parent.getFieldsIndex())}}evaluateNodeToWhereClause(e,t,i=null,s=null,r){let n,a,l,u;switch(e.type){case"interval":return(0,o.TE)(this.evaluateNodeToWhereClause(e.value,t,i,s,r),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,i,f.BADNESS,r));for(let n=0;n<e.clauses.length;n++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,i,f.BADNESS,r)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,i,f.BADNESS,r);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,f.BADNESS,r)),s+=" END ",s}case"parameter":{const i=r[e.value.toLowerCase()];if("string"==typeof i)return"'"+r[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'";if(i instanceof Date)return(0,o.oX)(i,t);if(i instanceof Array){const e=[];for(let s=0;s<i.length;s++)"string"==typeof i[s]?e.push("'"+i[s].toString().replace(/'/g,"''")+"'"):i[s]instanceof Date?e.push((0,o.oX)(i[s],t)):e.push(i[s].toString());return e}return i.toString()}case"expression-list":a=[];for(const n of e.value)a.push(this.evaluateNodeToWhereClause(n,t,i,s,r));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,f.BADNESS,r)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"IS":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return u=this.evaluateNodeToWhereClause(e.right,t,i,s,r),u instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+u.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+u+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return u=this.evaluateNodeToWhereClause(e.right,t,i,s,r),u instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+u.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+u+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return(0,o.oX)(e.value,t);case"number":return e.value.toString();case"current-time":return(0,o.vR)("date"===e.mode,t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,i,f.BADNESS,r);return(0,o.fz)(e.name,s,t)}}throw new Error("Unsupported sql syntax "+e.type)}extractValue(e){return this.codefield instanceof u.WhereClause?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]}}f.BADNESS="_!!!_BAD_LKP_!!!!";class y extends h{constructor(e,t){super(e),this.sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,o.bB)(e,this.field.name,(0,o.zR)(this.sql,l.Bj.Standardised),t.getFieldsIndex())}}extractValue(e){return this.sql.calculateValueCompiled(e)}}class _ extends n.Z{constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=null,this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new c.Z({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=l.Qk.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await this._parent._getSet(e),this._checkCancelled(e),this._wset=new a.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,n){const l=[];-1!==t&&void 0===this._featureCache[t]&&l.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,n),this._getFeatures(e,t,i,n);let u=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&l.push(e._known[s]),l.length>=o)));s++);if(0===l.length)return"success";e=new a.Z([],l,e._ordered,null);const c=Math.min(l.length,i);await this._parent._getFeatures(e,-1,c,n),this._checkCancelled(n);const h=[];for(let e=0;e<c;e++){const t=this._parent._featureFromCache(l[e]);void 0!==t&&h.push({geometry:t.geometry,attributes:t.attributes,id:l[e]})}for(const e of h){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new s.Z({attributes:t,geometry:(0,r.r1)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new Error("Fetch and Refine should not be called in this featureset")}async _getFilteredSet(e,t,i,s,r){let n=!1;const l=this._reformulateWithoutAdaptions(i);n=l.cannot,i=l.where;let u=!1;if(null!==s){u=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof d)&&!0===s.scanForField(t.field.name)){if(!(t instanceof p)){s=null,u=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,o.$e)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,s,r);let h;return this._checkCancelled(r),h=!0===n?new a.Z(c._candidates.slice(0).concat(c._known.slice(0)),[],!0===u&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new a.Z(c._candidates.slice(0),c._known.slice(0),!0===u&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),h}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,o.hq)(e,i.field.name)){const s=i.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,i,s,r,n,a){let l=!1,u=this._reformulateWithoutAdaptions(t);if(l=u.cannot,t=u.where,u=this._reformulateWithoutAdaptions(r),l=l||u.cannot,null!==(r=u.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,!0===l)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,i,s,r,n,a);return!1===c.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,s,r){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof d))return!1;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,n.push(t)}else n.push(i)}const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(null!==(r=a.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._canDoAggregates(e,n,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){if(null===this._parent)throw new Error("Should never be called");const l=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new Error("Should never be called");const t=i.clone();t.workingexpr=e.where,l.push(t)}else l.push(i)}const u=this._reformulateWithoutAdaptions(r);if(u.cannot)throw new Error("Should never be called");return null!==(r=u.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,l,i,s,r,n,a)}}},84328:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(91136),r=i(90961),n=i(90658),a=i(36515),l=i(95330),o=i(41534),u=i(82971);class c extends s.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof o.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new u.Z({wkid:4326}),this.geometryType=n.Qk.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new r.Z(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new r.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent._isInFeatureSet(e);return t===n.dj.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?n.dj.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause.testFeature(e)}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,l.y8)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const s=new r.Z([],e,!1,null),a=Math.min(t,e.length);if(await this._parent._getFeatures(s,-1,a,i),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<a;t++){const i=this._parent._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=n.dj.InFeatureSet:this._idstates[e[t]]=n.dj.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<a;t++){const i=this._parent._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=n.dj.InFeatureSet:this._idstates[e[i]]=n.dj.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,s,n){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,a.$e)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const l=await this._parent._getFilteredSet(e,t,i,s,n);let o;return this._checkCancelled(n),o=null!==this._whereClauseFunction?new r.Z(l._candidates.slice(0).concat(l._known.slice(0)),[],l._ordered,this._clonePageDefinition(l.pagesDefinition)):new r.Z(l._candidates.slice(0),l._known.slice(0),l._ordered,this._clonePageDefinition(l.pagesDefinition)),o}async _stat(e,t,i,s,r,n,l){if(null!==this._whereClauseFunction)return null===r&&""===i&&null===s?this._manualStat(e,t,n,l):{calculated:!1};let o=this._whereclause;null!==r&&null!==this._whereclause&&(o=(0,a.$e)(this._whereclause,r));const u=await this._parent._stat(e,t,i,s,o,n,l);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,l):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){return null===this._whereClauseFunction&&(null!==r?null!==this._whereclause&&(r=(0,a.$e)(this._whereclause,r)):r=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,l){if(null===this._parent)throw new Error("Should never be called");return null!==r?null!==this._whereclause&&(r=(0,a.$e)(this._whereclause,r)):r=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,l)}static registerAction(){s.Z._featuresetFunctions.filter=function(e){if("function"==typeof e)return new c({parentfeatureset:this,whereclause:e});let t=null;return e instanceof o.WhereClause&&(t=e),new c({parentfeatureset:this,whereclause:t})}}}},85065:(e,t,i)=>{i.d(t,{Z:()=>l});var s=i(61363),r=i(91136),n=i(90961),a=i(3823);class l extends r.Z{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause.order(i);const s=new n.Z([],[],!0,null);for(let e=0;e<i.length;e++)s._known.push(i[e].id);return s}async getIdColumnDictionary(e,t,i,r){if(i<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,s.X)(this._parent._expandPagedSet(e,n,0,0,r)),this.getIdColumnDictionary(e,t,i,r);let a=i+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;i+=l.length;const o=await(0,s.X)(this._parent._getFeatureBatch(l,r));this._checkCancelled(r);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,r)}return e._candidates.length>0?(await(0,s.X)(this._refineSetBlock(e,this._maxProcessingRate(),r)),this._checkCancelled(r),this.getIdColumnDictionary(e,t,i,r)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new Error("Fetch and Refine should not be called in this featureset")}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,null===s?this._orderbyclause:s,r);this._checkCancelled(r);const l=new n.Z(a._candidates.slice(0),a._known.slice(0),a._ordered,this._clonePageDefinition(a.pagesDefinition));let o=!0;if(a._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,r);return!1===o&&(null===t&&null===i||(e=new n.Z(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){r.Z._featuresetFunctions.orderBy=function(e){return""===e?this:new l({parentfeatureset:this,orderbyclause:new a.Z(e)})}}}},63991:(e,t,i)=>{i.d(t,{Z:()=>a});var s=i(91136),r=i(90961),n=i(90658);class a extends s.Z{constructor(e){super(e),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new r.Z(t._candidates.slice(0),t._known.slice(0),!1,this._clonePageDefinition(t.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===n.dj.NotInFeatureSet)return t;const i=this._idstates[e];return i===n.dj.InFeatureSet||i===n.dj.NotInFeatureSet?i:t===n.dj.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=n.dj.InFeatureSet,this._countedin++,n.dj.InFeatureSet):(this._idstates[e]=n.dj.NotInFeatureSet,n.dj.NotInFeatureSet):n.dj.Unknown}async _expandPagedSet(e,t,i,s,r){if(null===this._parent)throw new Error("Parent Paging not implemented");if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const n=await this._parent._expandPagedSet(e,t,i,s,r);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),n}async _getFeatures(e,t,i,s){const n=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,s),this._getFeatures(e,t,i,s);-1!==t&&void 0===this._featureCache[t]&&n.push(t);let l=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&n.push(e._known[s]),n.length>a)));s++);if(0===n.length)return"success";const o=new r.Z([],n,!1,null),u=Math.min(n.length,i);await this._parent._getFeatures(o,-1,u,s);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(n[e]);void 0!==t&&(this._featureCache[n[e]]=t)}return"success"}async _getFilteredSet(e,t,i,s,n){await this._ensureLoaded();const a=await this._getSet(n);return new r.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,s=null;const r=[];for(let a=0;a<e._candidates.length;a++){const l=this._isInFeatureSet(e._candidates[a]);if(l===n.dj.InFeatureSet){if(e._known.push(e._candidates[a]),i+=1,null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(r.push(s),s={start:a,end:a}),e._known.length>=this._topnum)break}else if(l===n.dj.NotInFeatureSet)null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(r.push(s),s={start:a,end:a}),i+=1;else if(l===n.dj.Unknown)break;if(i>=t)break}null!==s&&r.push(s);for(let t=r.length-1;t>=0;t--)e._candidates.splice(r[t].start,r[t].end-r[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.Z._featuresetFunctions.top=function(e){return new a({parentfeatureset:this,topnum:e})}}}},17805:(e,t,i)=>{i.d(t,{Z:()=>p});var s=i(38171),r=i(91136),n=i(90961),a=i(90658),l=i(36515),o=i(9361),u=i(3121),c=i(16451),h=i(1231),d=i(57444);class p extends r.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return a.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{const e=[];for(const t of this.fields)if("oid"===t.type)e.push(t);else for(const i of this._layer.outFields)if(i.toLowerCase()===t.name.toLowerCase()){e.push(t);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this._databaseType=a.Bj.Standardised,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types}isTable(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return a.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new s.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){let o="",u=!1;if(null!==s&&(o=s.constructClause(),u=!0),this.isTable()&&t&&null!==e&&""!==e)return new n.Z([],[],!0,null);const c=new d.Z;c.where=null===i?null===t?"1=1":"":(0,l.zR)(i,a.Bj.Standardised),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==o?o.split(","):null,c.geometry=null===t?null:t,c.returnGeometry=!0,c.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(c);if(null===h)return new n.Z([],[],u,null);this._checkCancelled(r);const p=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];p.push(t),this._featureCache[t]=this._changeFeature(e)})),new n.Z([],p,u,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new d.Z;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new n.Z([],e,!1,null),this._wset}const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new n.Z([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);for(let r=e._lastFetchedIndex;r<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)));r++);if(0===s.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title,canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField?e.layerDefinition.typeIdField:"",r=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)r.push(c.Z.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(""===i||void 0===i){let t=!1;for(const s of e.layerDefinition.fields)if("oid"===s.type||"esriFieldTypeOID"===s.type){i=s.name,t=!0;break}if(!1===t){let t="FID",s=!0,r=0;for(;s;){let i=!0;for(const s of e.layerDefinition.fields)if(s.name===t){i=!1;break}!0===i?s=!1:(r++,t="FID"+r.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let i=0;i<a.length;i++)n.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),n[i].attributes[t]=i;a=n,i=t}}const d=[];for(const t of e.layerDefinition.fields)t instanceof h.Z?d.push(t):d.push(h.Z.fromJSON(t));let f=n;switch(f){case"esriGeometryPoint":f="point";break;case"esriGeometryPolyline":f="polyline";break;case"esriGeometryPolygon":f="polygon";break;case"esriGeometryExtent":f="extent";break;case"esriGeometryMultipoint":f="multipoint"}for(const e of a)e.geometry&&e.geometry instanceof o.Z==0&&(e.geometry.type=f,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));const y={outFields:["*"],source:a,fields:d,types:r,typeIdField:s,objectIdField:i,spatialReference:t};y.geometryType=f||"point";const _=new u.default(y);return new p({layer:_,spatialReference:t,isTable:null===f||""===f})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new d.Z;t.where=this.objectIdField+"="+e.toString();const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}}},3823:(e,t,i)=>{function s(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{Z:()=>r});class r{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e.feature,this._fields[i],i),n=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?s(r,n):-1*s(r,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let s=this._fields[i];for(const t of e)if(s.toLowerCase()===t.field.toLowerCase()){s=t.newfield;break}t+=s,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new r(t)}featureValue(e,t,i){const s=e.attributes[t];if(void 0!==s)return s;for(const s in e.attributes)if(t.toLowerCase()===s.toLowerCase())return this._fields[i]=s,e.attributes[s];return null}}},25929:(e,t,i)=>{i.d(t,{M:()=>p,f:()=>n,i:()=>h,p:()=>y,r:()=>l,t:()=>a,w:()=>o});var s=i(70586),r=i(17452);function n(e,t){const i=t&&t.url&&t.url.path;if(e&&i&&(e=(0,r.hF)(e,i,{preserveProtocolRelative:!0}),t.portalItem&&t.readResourcePaths)){const i=(0,r.PF)(e,t.portalItem.itemUrl);c.test(i)&&t.readResourcePaths.push(t.portalItem.resourceFromPath(i).path)}return d(e,t&&t.portal)}function a(e,t,i=p.YES){if(!e)return e;!(0,r.YP)(e)&&t&&t.blockedRelativeUrls&&t.blockedRelativeUrls.push(e);let s=(0,r.hF)(e);if(t){const i=t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.rootPath||t.url&&t.url.path;if(i){const n=d(i,t.portal);s=(0,r.PF)(d(s,t.portal),n,n),s!==e&&t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.writtenUrls.push(s)}}return s=function(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?(0,r.Ie)(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}(s,t&&t.portal),(0,r.YP)(s)&&(s=(0,r.Fv)(s)),t?.resources&&t?.portalItem&&!(0,r.YP)(s)&&!(0,r.HK)(s)&&i===p.YES&&t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(s)}),s}function l(e,t,i){return n(e,i)}function o(e,t,i,s){const r=a(e,s);void 0!==r&&(t[i]=r)}const u=/\/items\/([^\/]+)\/resources\//,c=/^\.\/resources\//;function h(e){const t=(0,s.pC)(e)?e.match(u):null;return(0,s.pC)(t)?t[1]:null}function d(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const i=`${t.urlKey}.${t.customBaseUrl}`,s=(0,r.TI)();return(0,r.D6)(s,`${s.scheme}://${i}`)?(0,r.Ie)(e,t.portalHostname,i):(0,r.Ie)(e,i,t.portalHostname)}var p,f;(f=p||(p={}))[f.YES=0]="YES",f[f.NO=1]="NO";const y=Object.freeze(Object.defineProperty({__proto__:null,fromJSON:n,toJSON:a,read:l,write:o,itemIdFromResourceUrl:h,get MarkKeep(){return p}},Symbol.toStringTag,{value:"Module"}))},46791:(e,t,i)=>{i.d(t,{Z:()=>E});var s,r=i(43697),n=i(3894),a=i(32448),l=i(22974),o=i(70586),u=i(71143);!function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE",e[e.MOVE=4]="MOVE"}(s||(s={}));var c,h=i(1654),d=i(5600),p=i(75215),f=i(52421),y=i(52011),_=i(58971),g=i(10661);const m=new u.Z(class{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}},void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1})),w=()=>{};function b(e){return e?e instanceof D?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function v(e){if(e&&e.length)return e[0]}function S(e,t,i,s){const r=Math.min(e.length-i,t.length-s);let n=0;for(;n<r&&e[i+n]===t[s+n];)n++;return n}function F(e,t,i,s){t&&t.forEach(((t,r,n)=>{e.push(t),F(e,i.call(s,t,r,n),i,s)}))}const I=new Set,C=new Set,x=new Set,R=new Map;let k=0,D=c=class extends a.Z.EventedAccessor{constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new g.s,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:k++})}static isCollection(e){return null!=e&&e instanceof c}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof c?{items:e}:e:{}}destroy(){this.removeAll()}*[Symbol.iterator](){yield*this.items}get items(){return(0,_.it)(this._observable),this._items}set items(e){this._emitBeforeChanges(s.ADD)||(this._splice(0,this.length,b(e)),this._emitAfterChanges(s.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,i={removed:!1,callback:t};return e.push(i),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),{remove(){this.remove=w,i.removed=!0,e.splice(e.indexOf(i),1)}}}return this._emitter.on(e,t)}once(e,t){const i=this.on(e,t);return{remove(){i.remove()}}}add(e,t){if((0,_.it)(this._observable),this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t??null);return this._splice(i,0,[e]),this._emitAfterChanges(s.ADD),this}addMany(e,t=this._items.length){if((0,_.it)(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t);return this._splice(i,0,b(e)),this._emitAfterChanges(s.ADD),this}at(e){if((0,_.it)(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return[];const e=this._splice(0,this.length)||[];return this._emitAfterChanges(s.REMOVE),e}clone(){return(0,_.it)(this._observable),this._createNewInstance({items:this._items.map(l.d9)})}concat(...e){(0,_.it)(this._observable);const t=e.map(b);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const i=(0,o.j0)(this._splice(0,this.length)),r=i.length;for(let s=0;s<r;s++)e.call(t,i[s],s,i);this._emitAfterChanges(s.REMOVE)}every(e,t){return(0,_.it)(this._observable),this._items.every(e,t)}filter(e,t){let i;return(0,_.it)(this._observable),i=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:i})}find(e,t){return(0,_.it)(this._observable),this._items.find(e,t)}findIndex(e,t){return(0,_.it)(this._observable),this._items.findIndex(e,t)}flatten(e,t){(0,_.it)(this._observable);const i=[];return F(i,this,e,t),new c(i)}forEach(e,t){return(0,_.it)(this._observable),this._items.forEach(e,t)}getItemAt(e){return(0,_.it)(this._observable),this._items[e]}getNextIndex(e){(0,_.it)(this._observable);const t=this.length;return(e=null==e?t:e)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return(0,_.it)(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return(0,_.it)(this._observable),this._items.indexOf(e,t)}join(e=","){return(0,_.it)(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return(0,_.it)(this._observable),this._items.lastIndexOf(e,t)}map(e,t){(0,_.it)(this._observable);const i=this._items.map(e,t);return new c({items:i})}reorder(e,t=this.length-1){(0,_.it)(this._observable);const i=this.indexOf(e);if(-1!==i){if(t<0?t=0:t>=this.length&&(t=this.length-1),i!==t){if(this._emitBeforeChanges(s.MOVE))return e;this._splice(i,1),this._splice(t,0,[e]),this._emitAfterChanges(s.MOVE)}return e}}pop(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=v(this._splice(this.length-1,1));return this._emitAfterChanges(s.REMOVE),e}push(...e){return(0,_.it)(this._observable),this._emitBeforeChanges(s.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(s.ADD)),this.length}reduce(e,t){(0,_.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduce(e,t):i.reduce(e)}reduceRight(e,t){(0,_.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduceRight(e,t):i.reduceRight(e)}remove(e){return(0,_.it)(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if((0,_.it)(this._observable),e<0||e>=this.length||this._emitBeforeChanges(s.REMOVE))return;const t=v(this._splice(e,1));return this._emitAfterChanges(s.REMOVE),t}removeMany(e){if((0,_.it)(this._observable),!e||!e.length||this._emitBeforeChanges(s.REMOVE))return[];const t=e instanceof c?e.toArray():e,i=this._items,r=[],n=t.length;for(let e=0;e<n;e++){const s=t[e],n=i.indexOf(s);if(n>-1){const s=1+S(t,i,e+1,n+1),a=this._splice(n,s);a&&a.length>0&&r.push.apply(r,a),e+=s-1}}return this._emitAfterChanges(s.REMOVE),r}reverse(){if((0,_.it)(this._observable),this._emitBeforeChanges(s.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(s.MOVE),this}shift(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=v(this._splice(0,1));return this._emitAfterChanges(s.REMOVE),e}slice(e=0,t=this.length){return(0,_.it)(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return(0,_.it)(this._observable),this._items.some(e,t)}sort(e){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.MOVE))return this;const t=(0,o.j0)(this._splice(0,this.length));return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(s.MOVE),this}splice(e,t,...i){(0,_.it)(this._observable);const r=(t?s.REMOVE:0)|(i.length?s.ADD:0);if(this._emitBeforeChanges(r))return[];const n=this._splice(e,t,i)||[];return this._emitAfterChanges(r),n}toArray(){return(0,_.it)(this._observable),this._items.slice()}toJSON(){return(0,_.it)(this._observable),this.toArray()}toLocaleString(){return(0,_.it)(this._observable),this._items.toLocaleString()}toString(){return(0,_.it)(this._observable),this._items.toString()}unshift(...e){return(0,_.it)(this._observable),!e.length||this._emitBeforeChanges(s.ADD)||(this._splice(0,0,e),this._emitAfterChanges(s.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,i){const s=this._items,r=this.itemType;let n,a;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=(0,h.Os)((()=>this._dispatchChange()))),t){if(a=s.splice(e,t),this.hasEventListener("before-remove")){const t=m.acquire();t.target=this,t.cancellable=!0;for(let i=0,r=a.length;i<r;i++)n=a[i],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(a.splice(i,1),s.splice(e,0,n),e+=1,i-=1,r-=1);m.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=m.acquire();e.target=this,e.cancellable=!1;const t=a.length;for(let i=0;i<t;i++)e.reset(a[i]),this.emit("after-remove",e);m.release(e)}}if(i&&i.length){if(r){const e=[];for(const t of i){const i=r.ensureType(t);null==i&&null!=t||e.push(i)}i=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),a=e===this.length;if(t||n){const r=m.acquire();r.target=this,r.cancellable=!0;const l=m.acquire();l.target=this,l.cancellable=!1;for(const o of i)t?(r.reset(o),this.emit("before-add",r),r.defaultPrevented||(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),n&&(l.reset(o),this.emit("after-add",l)))):(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),l.reset(o),this.emit("after-add",l));m.release(l),m.release(r)}else{if(a)for(const e of i)s.push(e);else s.splice(e,0,...i);this._set("length",s.length)}}return(i&&i.length||a&&a.length)&&this._notifyChangeEvent(i,a),a}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const i=m.acquire();i.target=this,i.cancellable=!0,i.type=e,this.emit("before-changes",i),t=i.defaultPrevented,m.release(i)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=m.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),m.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const t of e){const e=t.changes;I.clear(),C.clear(),x.clear();for(const{added:t,removed:i}of e){if(t)if(0===x.size&&0===C.size)for(const e of t)I.add(e);else for(const e of t)C.has(e)?(x.add(e),C.delete(e)):x.has(e)||I.add(e);if(i)if(0===x.size&&0===I.size)for(const e of i)C.add(e);else for(const e of i)I.has(e)?I.delete(e):(x.delete(e),C.add(e))}const i=n.Z.acquire();I.forEach((e=>{i.push(e)}));const s=n.Z.acquire();C.forEach((e=>{s.push(e)}));const r=this._items,a=t.items,l=n.Z.acquire();if(x.forEach((e=>{a.indexOf(e)!==r.indexOf(e)&&l.push(e)})),t.listeners&&(i.length||s.length||l.length)){const e={target:this,added:i,removed:s,moved:l},r=t.listeners.length;for(let i=0;i<r;i++){const s=t.listeners[i];s.removed||s.callback.call(this,e)}}n.Z.release(i),n.Z.release(s),n.Z.release(l)}I.clear(),C.clear(),x.clear()}};D.ofType=e=>{if(!e)return c;if(R.has(e))return R.get(e);let t=null;if("function"==typeof e)t=e.prototype.declaredClass;else if(e.base)t=e.base.prototype.declaredClass;else for(const i in e.typeMap){const s=e.typeMap[i].prototype.declaredClass;t?t+=` | ${s}`:t=s}let i=class extends c{};return(0,r._)([(0,f.c)({Type:e,ensureType:"function"==typeof e?(0,p.se)(e):(0,p.N7)(e)})],i.prototype,"itemType",void 0),i=(0,r._)([(0,y.j)(`esri.core.Collection<${t}>`)],i),R.set(e,i),i},(0,r._)([(0,d.Cb)()],D.prototype,"length",void 0),(0,r._)([(0,d.Cb)()],D.prototype,"items",null),D=c=(0,r._)([(0,y.j)("esri.core.Collection")],D);const E=D},32448:(e,t,i)=>{i.d(t,{Z:()=>o});var s=i(43697),r=i(15923),n=i(50758),a=i(52011);class l{constructor(){this._emitter=new l.EventEmitter(this)}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}}!function(e){class t{constructor(e=null){this.target=e,this._listenersMap=null}clear(){this._listenersMap&&this._listenersMap.clear(),this._listenersMap=null}emit(e,t){const i=this._listenersMap&&this._listenersMap.get(e);if(!i)return!1;const s=this.target||this;return[...i].forEach((e=>{e.call(s,t)})),i.length>0}on(e,t){if(Array.isArray(e)){const i=e.map((e=>this.on(e,t)));return(0,n.AL)(i)}if(e.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap||(this._listenersMap=new Map);const i=this._listenersMap.get(e)||[];return i.push(t),this._listenersMap.set(e,i),{remove:()=>{const i=this._listenersMap&&this._listenersMap.get(e)||[],s=i.indexOf(t);s>=0&&i.splice(s,1)}}}once(e,t){const i=this.on(e,(e=>{i.remove(),t.call(null,e)}));return i}hasEventListener(e){const t=this._listenersMap&&this._listenersMap.get(e);return null!=t&&t.length>0}}e.EventEmitter=t,e.EventedMixin=e=>{let i=class extends e{constructor(){super(...arguments),this._emitter=new t}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};return i=(0,s._)([(0,a.j)("esri.core.Evented")],i),i};let i=class extends r.Z{constructor(){super(...arguments),this._emitter=new l.EventEmitter(this)}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};i=(0,s._)([(0,a.j)("esri.core.Evented")],i),e.EventedAccessor=i}(l||(l={}));const o=l},61247:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(43697),r=i(15923),n=i(46791),a=i(70586),l=i(5600),o=i(52011);let u=class extends r.Z{constructor(e){super(e),this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach((t=>{e+=t.length})),e}add(e,t){if(!this._isHandle(e)&&!Array.isArray(e)&&!n.Z.isCollection(e))return this;const i=this._getOrCreateGroup(t);return Array.isArray(e)||n.Z.isCollection(e)?e.forEach((e=>this._isHandle(e)&&i.push(e))):i.push(e),this.notifyChange("size"),this}forEach(e,t){if("function"==typeof e)this._groups.forEach((t=>t.forEach(e)));else{const i=this._getGroup(e);i&&t&&i.forEach(t)}}has(e){return this._groups.has(this._ensureGroupKey(e))}remove(e){if(Array.isArray(e)||n.Z.isCollection(e))return e.forEach(this.remove,this),this;if(!this.has(e))return this;const t=this._getGroup(e);for(let e=0;e<t.length;e++)t[e].remove();return this._deleteGroup(e),this.notifyChange("size"),this}removeAll(){return this._groups.forEach((e=>{for(let t=0;t<e.length;t++)e[t].remove()})),this._groups.clear(),this.notifyChange("size"),this}_isHandle(e){return e&&!!e.remove}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const t=[];return this._groups.set(this._ensureGroupKey(e),t),t}_getGroup(e){return(0,a.j0)(this._groups.get(this._ensureGroupKey(e)))}_deleteGroup(e){return this._groups.delete(this._ensureGroupKey(e))}_ensureGroupKey(e){return e||"_default_"}};(0,s._)([(0,l.Cb)({readOnly:!0})],u.prototype,"size",null),u=(0,s._)([(0,o.j)("esri.core.Handles")],u);const c=u},69801:(e,t,i)=>{i.d(t,{WJ:()=>o,Xq:()=>l});var s,r,n=i(70586),a=i(44553);(r=s||(s={}))[r.ALL=0]="ALL",r[r.SOME=1]="SOME";class l{constructor(e,t,i){this._namespace=e,this._storage=t,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),this._namespace+=":",i&&(this._storage.registerRemoveFunc(this._namespace,i),this._removeFunc=!0)}destroy(){this._storage.clear(this._namespace),this._removeFunc&&this._storage.deregisterRemoveFunc(this._namespace),this._storage.deregister(this),this._storage=null}get namespace(){return this._namespace.slice(0,-1)}get hitRate(){return this._hit/(this._hit+this._miss)}get size(){return this._storage.size}get maxSize(){return this._storage.maxSize}resetHitRate(){this._hit=this._miss=0}put(e,t,i,s=0){this._storage.put(this._namespace+e,t,i,s)}get(e){const t=this._storage.get(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}pop(e){const t=this._storage.pop(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}updateSize(e,t,i){this._storage.updateSize(this._namespace+e,t,i)}clear(){this._storage.clear(this._namespace)}clearAll(){this._storage.clearAll()}getStats(){return this._storage.getStats()}resetStats(){this._storage.resetStats()}}class o{constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new a.Z,this._users=new a.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,t){this._removeFuncs.push([e,t])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace((t=>t[0]!==e))}get size(){return this._size}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimit()}put(e,t,i,r){const n=this._db.get(e);if(n&&(this._size-=n.size,this._db.delete(e),n.entry!==t&&this._notifyRemove(e,n.entry,s.ALL)),i>this._maxSize)return void this._notifyRemove(e,t,s.ALL);if(void 0===t)return void console.warn("Refusing to cache undefined entry ");if(!i||i<0)return void console.warn("Refusing to cache entry with invalid size "+i);const a=1+Math.max(r,-3)- -3;this._db.set(e,{entry:t,size:i,lifetime:a,lives:a}),this._size+=i,this._checkSizeLimit()}updateSize(e,t,i){const r=this._db.get(e);if(r&&r.entry===t){for(this._size-=r.size;i>this._maxSize;){const r=this._notifyRemove(e,t,s.SOME);if(!((0,n.pC)(r)&&r>0))return void this._db.delete(e);i=r}r.size=i,this._size+=i,this._checkSizeLimit()}}pop(e){const t=this._db.get(e);if(t)return this._size-=t.size,this._db.delete(e),++this._hit,t.entry;++this._miss}get(e){const t=this._db.get(e);if(void 0!==t)return this._db.delete(e),t.lives=t.lifetime,this._db.set(e,t),++this._hit,t.entry;++this._miss}getStats(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach(((e,s)=>{const r=e.lifetime;i[r]=(i[r]||0)+e.size,this._users.forAll((i=>{const r=i.namespace;if(s.startsWith(r)){const i=t[r]||0;t[r]=i+e.size}}))}));const s={};this._users.forAll((e=>{const i=e.namespace;if(!isNaN(e.hitRate)&&e.hitRate>0){const r=t[i]||0;t[i]=r,s[i]=Math.round(100*e.hitRate)+"%"}else s[i]="0%"}));const r=Object.keys(t);r.sort(((e,i)=>t[i]-t[e])),r.forEach((i=>e[i]=Math.round(t[i]/2**20)+"MB / "+s[i]));for(let t=i.length-1;t>=0;--t){const s=i[t];s&&(e["Priority "+(t+-3-1)]=Math.round(s/this.size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll((e=>e.resetHitRate()))}clear(e){this._db.forEach(((t,i)=>{i.startsWith(e)&&(this._size-=t.size,this._db.delete(i),this._notifyRemove(i,t.entry,s.ALL))}))}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,s.ALL))),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i){let s;return this._removeFuncs.some((r=>{if(e.startsWith(r[0])){const e=r[1](t,i);return"number"==typeof e&&(s=e),!0}return!1})),s}_checkSizeLimit(){if(!(this._size<=this._maxSize))for(const[e,t]of this._db){if(this._db.delete(e),t.lives<=1){this._size-=t.size;const i=this._notifyRemove(e,t.entry,s.SOME);(0,n.pC)(i)&&i>0&&(this._size+=i,t.lives=t.lifetime,t.size=i,this._db.set(e,t))}else--t.lives,this._db.set(e,t);if(this._size<=.9*this.maxSize)return}}}},52421:(e,t,i)=>{function s(e){return(t,i)=>{t[i]=e}}i.d(t,{c:()=>s})},22862:(e,t,i)=>{i.d(t,{Hg:()=>y,V7:()=>f,uD:()=>p});var s=i(15923),r=i(46791),n=i(70586),a=i(1153);const l=["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"];function o(e){return e instanceof s.Z}function u(e){return e instanceof r.Z?Object.keys(e.items):o(e)?(0,a.vw)(e).keys():e?Object.keys(e):[]}function c(e,t){return e instanceof r.Z?e.items[t]:e[t]}function h(e){return e?e.declaredClass:null}function d(e,t){const i=e.diff;if(i&&"function"==typeof i)return i(e,t);const s=u(e),r=u(t);if(0===s.length&&0===r.length)return;if(!s.length||!r.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};const a=r.filter((e=>!s.includes(e))),p=s.filter((e=>!r.includes(e))),f=s.filter((i=>r.includes(i)&&c(e,i)!==c(t,i))).concat(a,p).sort(),y=h(e);if(y&&l.includes(y)&&f.length)return{type:"complete",oldValue:e,newValue:t};let _;const g=o(e)&&o(t);for(const s of f){const r=c(e,s),a=c(t,s);let l;if((g||"function"!=typeof r&&"function"!=typeof a)&&r!==a&&(null!=r||null!=a)){if(i&&i[s]&&"function"==typeof i[s])l=i[s](r,a);else if(r instanceof Date&&a instanceof Date){if(r.getTime()===a.getTime())continue;l={type:"complete",oldValue:r,newValue:a}}else l="object"==typeof r&&"object"==typeof a&&h(r)===h(a)?d(r,a):{type:"complete",oldValue:r,newValue:a};(0,n.pC)(l)&&((0,n.pC)(_)?_.diff[s]=l:_={type:"partial",diff:{[s]:l}})}}return _}function p(e,t){if((0,n.Wi)(e))return!1;const i=t.split(".");let s=e;for(const e of i){if("complete"===s.type)return!0;if("partial"!==s.type)return!1;{const t=s.diff[e];if(!t)return!1;s=t}}return!0}function f(e,t){for(const i of t)if(p(e,i))return!0;return!1}function y(e,t){if(!("function"==typeof e||"function"==typeof t||(0,n.Wi)(e)&&(0,n.Wi)(t)))return(0,n.Wi)(e)||(0,n.Wi)(t)||"object"==typeof e&&"object"==typeof t&&h(e)!==h(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},10661:(e,t,i)=>{i.d(t,{s:()=>r});var s=i(39020);class r{constructor(){this._observers=[]}observe(e){return this._observers.includes(e)||this._observers.push(e),new s.X(this._observers,e)}notify(){const e=this._observers.slice();for(let t=0;t<e.length;++t){const i=e[t];i.onInvalidated(),i.onCommitted()}}}},66643:(e,t,i)=>{i.d(t,{Ed:()=>n,UI:()=>a,mt:()=>o,q6:()=>l});var s=i(70586),r=i(95330);function n(e,t,i){return(0,r.as)(e.map(((e,s)=>t.apply(i,[e,s]))))}async function a(e,t,i){return(await(0,r.as)(e.map(((e,s)=>t.apply(i,[e,s]))))).map((e=>e.value))}async function l(e){if((0,s.Wi)(e))return{ok:!1,error:new Error("no promise provided")};try{return{ok:!0,value:await e}}catch(e){return{ok:!1,error:e}}}async function o(e){try{return{ok:!0,value:await e}}catch(e){return(0,r.r9)(e),{ok:!1,error:e}}}},17445:(e,t,i)=>{i.d(t,{N1:()=>d,YP:()=>o,Z_:()=>y,gx:()=>u,nn:()=>_,on:()=>h,tX:()=>g});var s=i(91460),r=i(50758),n=i(70586),a=i(95330),l=i(26258);function o(e,t,i={}){return c(e,t,i,p)}function u(e,t,i={}){return c(e,t,i,f)}function c(e,t,i={},s){let r=null;const a=i.once?(e,i)=>{s(e)&&((0,n.hw)(r),t(e,i))}:(e,i)=>{s(e)&&t(e,i)};if(r=(0,l.aQ)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return r}function h(e,t,i,a={}){let l=null,u=null,c=null;function h(){l&&u&&(u.remove(),a.onListenerRemove?.(l),l=null,u=null)}function d(e){a.once&&a.once&&(0,n.hw)(c),i(e)}const p=o(e,((e,i)=>{h(),(0,s.vT)(e)&&(l=e,u=(0,s.on)(e,t,d),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return c=(0,r.kB)((()=>{p.remove(),h()})),c}function d(e,t){return function(e,t,i){if((0,a.Hc)(i))return Promise.reject((0,a.zE)());const s=e();if(t?.(s))return Promise.resolve(s);let l=null;function o(){l=(0,n.hw)(l)}return new Promise(((s,n)=>{l=(0,r.AL)([(0,a.fu)(i,(()=>{o(),n((0,a.zE)())})),c(e,(e=>{o(),s(e)}),{sync:!1,once:!0},t??p)])}))}(e,f,t)}function p(e){return!0}function f(e){return!!e}i(87538);const y={sync:!0},_={initial:!0},g={sync:!0,initial:!0}},42033:(e,t,i)=>{i.d(t,{E:()=>r,_:()=>n});var s=i(70586);async function r(e,t){const{WhereClause:s}=await Promise.resolve().then(i.bind(i,41534));return s.create(e,t)}function n(e,t){return(0,s.pC)(e)?(0,s.pC)(t)?`(${e}) AND (${t})`:e:t}},60437:(e,t,i)=>{i.d(t,{Gv:()=>m,HH:()=>l,JR:()=>y,TC:()=>o,Tn:()=>d,Ue:()=>n,al:()=>a,cS:()=>f,dp:()=>c,fS:()=>g,op:()=>h,pp:()=>u,t8:()=>p});var s=i(70586),r=i(6570);function n(e=w){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function a(e,t,i,s,r,a,l=n()){return l[0]=e,l[1]=t,l[2]=i,l[3]=s,l[4]=r,l[5]=a,l}function l(e,t){const i=isFinite(e[2])||isFinite(e[5]);return new r.Z(i?{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],zmin:e[2],zmax:e[5],spatialReference:t}:{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],spatialReference:t})}function o(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e[4]=Math.max(e[4],t[4]),e[5]=Math.max(e[5],t[5])}function u(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[0]),e[4]=Math.max(e[4],t[1]),e[5]=Math.max(e[5],t[2])}function c(e,t=[0,0,0]){return t[0]=function(e){return e[0]>=e[3]?0:e[3]-e[0]}(e),t[1]=function(e){return e[1]>=e[4]?0:e[4]-e[1]}(e),t[2]=function(e){return e[2]>=e[5]?0:e[5]-e[2]}(e),t}function h(e,t,i=e){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i!==e&&(i[3]=e[3],i[4]=e[4],i[5]=e[5]),i}function d(e,t,i=e){return i[3]=t[0],i[4]=t[1],i[5]=t[2],i!==e&&(i[0]=e[0],i[1]=e[1],i[2]=e[2]),e}function p(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function f(e){return e?p(e,m):n(m)}function y(e,t){return e[0]=t[0],e[1]=t[1],e[2]=Number.NEGATIVE_INFINITY,e[3]=t[2],e[4]=t[3],e[5]=Number.POSITIVE_INFINITY,e}function _(e){return 6===e.length}function g(e,t,i){if((0,s.Wi)(e)||(0,s.Wi)(t))return e===t;if(!_(e)||!_(t))return!1;if(i){for(let s=0;s<e.length;s++)if(!i(e[s],t[s]))return!1}else for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}i(24470);const m=[1/0,1/0,1/0,-1/0,-1/0,-1/0],w=[0,0,0,0,0,0];n()},24470:(e,t,i)=>{i.d(t,{HH:()=>o,SO:()=>u,Ue:()=>n,al:()=>a,cS:()=>p,jE:()=>c,kK:()=>h,oJ:()=>l,r3:()=>d}),i(80442),i(22021);var s=i(70586),r=i(6570);function n(e=y){return[e[0],e[1],e[2],e[3]]}function a(e,t,i,s,r=n()){return r[0]=e,r[1]=t,r[2]=i,r[3]=s,r}function l(e,t=n()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function o(e,t){return new r.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function u(e){return function(e){return(0,s.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function c(e,t,i){return t>=e[0]&&i>=e[1]&&t<=e[2]&&i<=e[3]}function h(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function d(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function p(e){return e?function(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}(e,f):n(f)}const f=[1/0,1/0,-1/0,-1/0],y=[0,0,0,0]},82526:(e,t,i)=>{i.d(t,{aX:()=>x});var s=i(68773),r=i(20102),n=i(92604),a=i(70586),l=i(38913),o=i(58901),u=i(82971),c=i(33955);const h={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new o.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator}),minus180Line:new o.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new o.Z({paths:[[[180,-180],[180,180]]],spatialReference:u.Z.WGS84}),minus180Line:new o.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:u.Z.WGS84})}};function d(e,t){return Math.ceil((e-t)/(2*t))}function p(e,t){const i=f(e);for(const e of i)for(const i of e)i[0]+=t;return e}function f(e){return(0,c.oU)(e)?e.rings:e.paths}var y=i(8744),_=i(40488),g=(i(66577),i(3172)),m=i(17452);function w(e){return{geometryType:(0,c.Ji)(e[0]),geometries:e.map((e=>e.toJSON()))}}const b=n.Z.getLogger("esri.geometry.support.normalizeUtils");function v(e){return"polygon"===e[0].type}function S(e){return"polyline"===e[0].type}function F(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof l.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw b.error(e),new r.Z(e)}const i=f(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const r=e[s][0],n=e[s][1],a=e[s+1][0],l=e[s+1][1],o=Math.sqrt((a-r)*(a-r)+(l-n)*(l-n)),u=(l-n)/o,c=(a-r)/o,h=o/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=c*s+r,l=u*s+n;i.push([a,l])}const e=(o+Math.floor(h-1)*t)/2,s=c*e+r,a=u*e+n;i.push([s,a])}i.push([a,l])}}return function(e){return"polygon"===e.type}(e)?new l.Z({rings:s,spatialReference:e.spatialReference}):new o.Z({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,_.Sx)(t,!0)}return i&&(e=p(e,i)),e}function I(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=d(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=d(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=d(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=d(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function C(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const r=t.cutIndexes[s],n=t.geometries[s],a=f(n);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*d(i,180);for(let i=0;i<t.length;i++){const t=n.getPoint(e,i);n.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(r===i){if(v(e))for(const t of f(n))e[r]=e[r].addRing(t);else if(S(e))for(const t of f(n))e[r]=e[r].addPath(t)}else i=r,e[r]=n}return e}async function x(e,t,i){if(!Array.isArray(e))return x([e],t);t&&"string"!=typeof t&&b.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??s.Z.geometryServiceUrl;let n,u,f,v,S,R,k,D,E=0;const T=[],A=[];for(const t of e)if((0,a.Wi)(t))A.push(t);else if(n||(n=t.spatialReference,u=(0,y.C5)(n),f=n.isWebMercator,R=f?102100:4326,v=h[R].maxX,S=h[R].minX,k=h[R].plus180Line,D=h[R].minus180Line),u)if("mesh"===t.type)A.push(t);else if("point"===t.type)A.push(I(t.clone(),v,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>I(e,v,S))),A.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,u);A.push(e.rings?new l.Z(e):e)}else if(t.extent){const e=t.extent,i=d(e.xmin,S)*(2*v);let s=0===i?t.clone():p(t.clone(),i);e.offset(i,0),e.intersects(k)&&e.xmax!==v?(E=e.xmax>E?e.xmax:E,s=F(s,f),T.push(s),A.push("cut")):e.intersects(D)&&e.xmin!==S?(E=e.xmax*(2*v)>E?e.xmax*(2*v):E,s=F(s,f,360),T.push(s),A.push("cut")):A.push(s)}else A.push(t.clone());else A.push(t);let N=d(E,v),L=-90;const O=N,P=new o.Z;for(;N>0;){const e=360*N-180;P.addPath([[e,L],[e,-1*L]]),L*=-1,N--}if(T.length>0&&O>0){const t=C(T,await async function(e,t,i,s){const r="string"==typeof e?(0,m.mN)(e):e,n=t[0].spatialReference,a={...s,query:{...r.query,f:"json",sr:JSON.stringify(n),target:JSON.stringify({geometryType:(0,c.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},l=await(0,g.default)(r.path+"/cut",a),{cutIndexes:o,geometries:u=[]}=l.data;return{cutIndexes:o,geometries:u.map((e=>{const t=(0,c.im)(e);return t.spatialReference=n,t}))}}(r,T,P,i)),s=[],n=[];for(let i=0;i<A.length;i++){const r=A[i];if("cut"!==r)n.push(r);else{const r=t.shift(),l=e[i];(0,a.pC)(l)&&"polygon"===l.type&&l.rings&&l.rings.length>1&&r.rings.length>=l.rings.length?(s.push(r),n.push("simplify")):n.push(f?(0,_.$)(r):r)}}if(!s.length)return n;const l=await async function(e,t,i){const s="string"==typeof e?(0,m.mN)(e):e,r=t[0].spatialReference,n=(0,c.Ji)(t[0]),a={...i,query:{...s.query,f:"json",sr:r.wkid?r.wkid:JSON.stringify(r),geometries:JSON.stringify(w(t))}};return function(e,t,i){const s=(0,c.q9)(t);return e.map((e=>{const t=s.fromJSON(e);return t.spatialReference=i,t}))}((await(0,g.default)(s.path+"/simplify",a)).data,n,r)}(r,s,i),o=[];for(let e=0;e<n.length;e++){const t=n[e];"simplify"!==t?o.push(t):o.push(f?(0,_.$)(l.shift()):l.shift())}return o}const j=[];for(let e=0;e<A.length;e++){const t=A[e];if("cut"!==t)j.push(t);else{const e=T.shift();j.push(!0===f?(0,_.$)(e):e)}}return j}},69285:(e,t,i)=>{i.d(t,{k:()=>a});var s=i(70586),r=i(67900),n=i(8744);function a(e,t,i){if((0,s.Wi)(t)||(0,s.Wi)(i)||i.vcsWkid||(0,n.fS)(t,i))return null;const a=(0,r._R)(t)/(0,r._R)(i);if(1===a)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,a);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const i of e.paths)for(const e of i)e.length>2&&(e[2]*=t)}(e,a);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const i of e.rings)for(const e of i)e.length>2&&(e[2]*=t)}(e,a);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const i of e.points)i.length>2&&(i[2]*=t)}(e,a);case"extent":case"esriGeometryExtent":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,a);default:return null}}},54295:(e,t,i)=>{i.d(t,{V:()=>a});var s=i(43697),r=i(5600),n=(i(67676),i(80442),i(75215),i(52011));const a=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,s._)([(0,r.Cb)({type:String})],t.prototype,"apiKey",null),t=(0,s._)([(0,n.j)("esri.layers.mixins.APIKeyMixin")],t),t}},17287:(e,t,i)=>{i.d(t,{Y:()=>u});var s=i(43697),r=i(92604),n=i(70586),a=i(5600),l=(i(67676),i(80442),i(75215),i(52011)),o=i(66677);const u=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,o.Qc)(this.url);if((0,n.pC)(e)&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,o.Nm)(e,r.Z.getLogger(this.declaredClass)))}};return(0,s._)([(0,a.Cb)()],t.prototype,"title",null),(0,s._)([(0,a.Cb)({type:String})],t.prototype,"url",null),t=(0,s._)([(0,l.j)("esri.layers.mixins.ArcGISService")],t),t}},16859:(e,t,i)=>{i.d(t,{I:()=>b});var s=i(43697),r=i(40330),n=i(3172),a=i(66643),l=i(20102),o=i(92604),u=i(70586),c=i(95330),h=i(17452),d=i(5600),p=(i(67676),i(80442),i(75215),i(71715)),f=i(52011),y=i(30556),_=i(65587),g=i(15235),m=i(86082);const w=o.Z.getLogger("esri.layers.mixins.PortalLayer"),b=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0}destroy(){this.portalItem?.destroy(),this.portalItem=null}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new g.default({id:t.itemId,portal:i&&i.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const s=await i.e(8062).then(i.bind(i,18062));return(0,c.k_)(t),await s.load({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData},t)}catch(e){throw(0,c.D_)(e)||w.warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,c.r9)(e),!0))))}async _fetchUserHasEditingPrivileges(e){const t=this.url?r.id?.findCredential(this.url):null;if(!t)return!0;const i=v.credential===t?v.user:await this._fetchEditingUser(e);return v.credential=t,v.user=i,(0,u.Wi)(i)||null==i.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const i=r.id.findServerInfo(this.url);if(!i?.owningSystemUrl)return null;const s=`${i.owningSystemUrl}/sharing/rest`,l=_.Z.getDefault();if(l&&l.loaded&&(0,h.Fv)(l.restUrl)===(0,h.Fv)(s))return l.user;const o=`${s}/community/self`,c=(0,u.pC)(e)?e.signal:null,d=await(0,a.q6)((0,n.default)(o,{authMode:"no-prompt",query:{f:"json"},signal:c}));return d.ok?m.default.fromJSON(d.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const i=t&&t.portal,s=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||_.Z.getDefault());return i&&s&&!(0,h.tm)(s.restUrl,i.restUrl)?(t.messages&&t.messages.push(new l.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,s._)([(0,d.Cb)({type:g.default})],t.prototype,"portalItem",null),(0,s._)([(0,p.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,s._)([(0,y.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,s._)([(0,d.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,s._)([(0,d.Cb)({readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),t=(0,s._)([(0,f.j)("esri.layers.mixins.PortalLayer")],t),t},v={credential:null,user:null}},56765:(e,t,i)=>{i.d(t,{Z:()=>c});var s,r=i(43697),n=i(46791),a=i(96674),l=i(5600),o=(i(67676),i(80442),i(75215),i(52011));let u=s=class extends a.wq{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new n.Z}clone(){return new s({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,r._)([(0,l.Cb)({type:String,json:{write:!0}})],u.prototype,"floorField",void 0),(0,r._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllMode",void 0),(0,r._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllLevelIds",void 0),u=s=(0,r._)([(0,o.j)("esri.layers.support.LayerFloorInfo")],u);const c=u},66677:(e,t,i)=>{i.d(t,{B5:()=>h,DR:()=>p,G:()=>b,M8:()=>_,Nm:()=>g,Qc:()=>d,XG:()=>m,a7:()=>y,ld:()=>f,wH:()=>w});var s=i(70586),r=i(17452),n=i(25929);const a={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},l=Object.values(a),o=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${l.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${l.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),c=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function h(e){return!!o.test(e)}function d(e){if((0,s.Wi)(e))return null;const t=(0,r.mN)(e),i=t.path.match(o)||t.path.match(u);if(!i)return null;const[,n,l,c,h]=i,d=l.indexOf("/");return{title:f(-1!==d?l.slice(d+1):l),serverType:a[c.toLowerCase()],sublayer:null!=h&&""!==h?parseInt(h,10):null,url:{path:n}}}function p(e){const t=(0,r.mN)(e).path.match(c);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function y(e,t){const i=[];if(e){const t=d(e);(0,s.pC)(t)&&t.title&&i.push(t.title)}if(t){const e=f(t);i.push(e)}if(2===i.length){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function _(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".arcgis.com/"),i=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&i}function g(e,t){return e?(0,r.Qj)((0,r.Hu)(e,t)):e}function m(e){let{url:t}=e;if(!t)return{url:t};t=(0,r.Hu)(t,e.logger);const i=(0,r.mN)(t),n=d(i.path);let a;if((0,s.pC)(n))null!=n.sublayer&&null==e.layer.layerId&&(a=n.sublayer),t=n.url.path;else if(e.nonStandardUrlAllowed){const e=p(i.path);(0,s.pC)(e)&&(t=e.serviceUrl,a=e.sublayerId)}return{url:(0,r.Qj)(t),layerId:a}}function w(e,t,i,s,a){(0,n.w)(t,s,"url",a),s.url&&null!=e.layerId&&(s.url=(0,r.v_)(s.url,i,e.layerId.toString()))}function b(e){if(!e)return!1;const t=e.toLowerCase(),i=t.includes("/services/"),s=t.includes("/mapserver/wmsserver"),r=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return i&&(s||r||n)}},15235:(e,t,i)=>{i.r(t),i.d(t,{default:()=>R});var s=i(43697),r=i(99880),n=i(20102),a=i(96674),l=i(22974),o=i(83379),u=i(70586),c=i(17452),h=i(5600),d=i(75215),p=i(71715),f=i(52011),y=i(6570),_=i(65587),g=i(15923),m=i(92604),w=(i(67676),i(80442),i(90578));const b=m.Z.getLogger("esri.portal.PortalItemResource");let v=class extends g.Z{constructor(e){super(e),this.portalItem=null}normalizeCtorArgs(e){return e&&e.portalItem&&e.path?{...e,path:this._normalizePath(e.path,e.portalItem)}:e}set path(e){(0,u.pC)(e)&&(0,c.YP)(e)?b.error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",e)}_castPath(e){return this._normalizePath(e,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(e="json",t){const i=this.url;if((0,u.Wi)(i))throw new n.Z("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal._request(i,{responseType:e,query:{token:this.portalItem.apiKey},signal:(0,u.U2)(t,"signal")})}async update(e,t){return(await i.e(7873).then(i.bind(i,97873))).addOrUpdateResource(this,"update",e,t)}hasPath(){return(0,u.pC)(this.path)}_normalizePath(e,t){return(0,u.Wi)(e)?e:(e=e.replace(/^\/+/,""),(0,u.pC)(t)&&(0,c.YP)(e)&&(e=(0,c.PF)(e,t.itemUrl)),e.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,""))}};(0,s._)([(0,h.Cb)()],v.prototype,"portalItem",void 0),(0,s._)([(0,h.Cb)({type:String,value:null})],v.prototype,"path",null),(0,s._)([(0,w.p)("path")],v.prototype,"_castPath",null),(0,s._)([(0,h.Cb)({type:String,readOnly:!0})],v.prototype,"url",null),(0,s._)([(0,h.Cb)({type:String,readOnly:!0})],v.prototype,"itemRelativeUrl",null),v=(0,s._)([(0,f.j)("esri.portal.PortalItemResource")],v);const S=v;let F=class extends g.Z{constructor(e){super(e),this.created=null,this.rating=null}};(0,s._)([(0,h.Cb)()],F.prototype,"created",void 0),(0,s._)([(0,h.Cb)()],F.prototype,"rating",void 0),F=(0,s._)([(0,f.j)("esri.portal.PortalRating")],F);const I=F;var C;let x=C=class extends((0,a.eC)(o.Z)){constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}static from(e){return(0,d.TJ)(C,e)}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e&&this.portal&&this.portal.isPortal?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replace(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")&&(i="Instant App"),i}readExtent(e){return e&&e.length?new y.Z(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",t=this.typeKeywords||[];let i,s=!1,n=!1,a=!1,l=!1,o=!1,u=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(s=t.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=t.includes("Table"),a=t.includes("Route Layer"),l=t.includes("Markup"),o=t.includes("Spatiotemporal"),u=t.includes("UtilityNetwork"),i=o&&n?"spatiotemporaltable":n?"table":a?"routelayer":l?"markup":o?"spatiotemporal":s?"featureshosted":u?"utilitynetwork":"features"):i="map service"===e||"wms"===e||"wmts"===e?s||t.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?t.includes("Line")?"sceneweblayerline":t.includes("3DObject")?"sceneweblayermultipatch":t.includes("Point")?"sceneweblayerpoint":t.includes("IntegratedMesh")?"sceneweblayermesh":t.includes("PointCloud")?"sceneweblayerpointcloud":t.includes("Polygon")?"sceneweblayerpolygon":t.includes("Building")?"sceneweblayerbuilding":t.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?t.includes("Elevation 3D Layer")?"elevationlayer":t.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?t.includes("Web Tool")&&this.portal&&this.portal.isPortal?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):i="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?t.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&t.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&t.includes("ArcGIS Pro")||"explorer map"===e&&t.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"360 vr experience"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&t.includes("Explorer Mapping Application")||t.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"maps",i?(0,r.V)("esri/images/portal/"+i+"16.png"):null}get isLayer(){return["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","WMTS","WMS"].includes(this.type)}get itemUrl(){const e=this.get("portal.restUrl");return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal._normalizeUrl(`${e}/info/${t}?f=json`):null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");return t?`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`:null}load(e){this.portal||(this.portal=_.Z.getDefault());const t=this.portal.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?this.portal._request(this.itemUrl,{signal:(0,u.pC)(e)?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}addRating(e){const t={method:"post",query:{}};return e instanceof I&&(e=e.rating),isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal._request(this.itemUrl+"/addRating",t).then((()=>new I({rating:e,created:new Date})))}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:(0,l.d9)(this.applicationProxies),avgRating:this.avgRating,categories:(0,l.d9)(this.categories),created:(0,l.d9)(this.created),culture:this.culture,description:this.description,extent:(0,l.d9)(this.extent),groupCategories:(0,l.d9)(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:(0,l.d9)(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:(0,l.d9)(this.screenshots),size:this.size,snippet:this.snippet,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};return this.loaded&&(e.loadStatus="loaded"),new C({sourceJSON:this.sourceJSON}).set(e)}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]&&(e[t]=e[t].join(", "));const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}deleteRating(){return this.portal._request(this.itemUrl+"/deleteRating",{method:"post"}).then((()=>{}))}fetchData(e="json",t){return this.portal._request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}fetchRating(e){return this.portal._request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e}).then((e=>null!=e.rating?(e.created=new Date(e.created),new I(e)):null))}fetchRelatedItems(e,t){return this.portal._requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},C)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal._request(this.itemUrl,{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal._signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal._request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new n.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}updateThumbnail(e){return this.id?this.load().then((()=>this.portal._signIn())).then((()=>{const t=e.thumbnail,i=e.filename,s={method:"post"};if("string"==typeof t)(0,c.HK)(t)?s.query={data:t}:s.query={url:(0,c.hF)(t)},(0,u.pC)(i)&&(s.query.filename=i);else{const e=new FormData;(0,u.pC)(i)?e.append("file",t,i):e.append("file",t),s.body=e}return this.portal._request(`${this.userItemUrl}/updateThumbnail`,s).then((()=>this.reload()))})):Promise.reject(new n.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){return(await i.e(7873).then(i.bind(i,97873))).fetchResources(this,e,t)}async addResource(e,t,s){const r=await i.e(7873).then(i.bind(i,97873));return e.portalItem=this,r.addOrUpdateResource(e,"add",t,s)}async removeResource(e,t){const s=await i.e(7873).then(i.bind(i,97873));if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new n.Z("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return s.removeResource(this,e,t)}async removeAllResources(e){return(await i.e(7873).then(i.bind(i,97873))).removeAllResources(this,e)}resourceFromPath(e){return new S({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:(0,l.d9)(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};return(0,l.yd)(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new C({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};(0,s._)([(0,h.Cb)({type:["private","shared","org","public"]})],x.prototype,"access",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"accessInformation",void 0),(0,s._)([(0,h.Cb)({type:String})],x.prototype,"apiKey",void 0),(0,s._)([(0,h.Cb)({json:{read:{source:"appProxies"}}})],x.prototype,"applicationProxies",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"avgRating",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"categories",void 0),(0,s._)([(0,h.Cb)({type:Date})],x.prototype,"created",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"culture",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"description",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"displayName",null),(0,s._)([(0,h.Cb)({type:y.Z})],x.prototype,"extent",void 0),(0,s._)([(0,p.r)("extent")],x.prototype,"readExtent",null),(0,s._)([(0,h.Cb)()],x.prototype,"groupCategories",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"iconUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"id",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"isLayer",null),(0,s._)([(0,h.Cb)()],x.prototype,"itemControl",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"itemUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"licenseInfo",void 0),(0,s._)([(0,h.Cb)({type:Date})],x.prototype,"modified",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"name",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numComments",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numRatings",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numViews",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"owner",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"ownerFolder",void 0),(0,s._)([(0,h.Cb)({type:_.Z})],x.prototype,"portal",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"screenshots",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"size",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"snippet",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"sourceJSON",void 0),(0,s._)([(0,h.Cb)({type:String})],x.prototype,"spatialReference",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"tags",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"thumbnail",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"thumbnailUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"title",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"type",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"typeKeywords",void 0),(0,s._)([(0,h.Cb)({type:String,json:{read(e,t){if("KML"!==t.type)return e;const i=this.portal?.restUrl;return e||(e=i&&this.id?`${i}/content/items/${this.id}/data`:null),e}}})],x.prototype,"url",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"userItemUrl",null),x=C=(0,s._)([(0,f.j)("esri.portal.PortalItem")],x);const R=x},41818:(e,t,i)=>{i.d(t,{P:()=>a});var s=i(11282),r=i(34599),n=i(57444);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.executeQueryForCount)(a,n.Z.from(t),{...i}).then((e=>e.data.count))}},5396:(e,t,i)=>{i.d(t,{G:()=>a});var s=i(11282),r=i(34599),n=i(57444);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.executeQueryForIds)(a,n.Z.from(t),{...i}).then((e=>e.data.objectIds))}},4967:(e,t,i)=>{i.d(t,{F:()=>o,e:()=>l});var s=i(11282),r=i(34599),n=i(74889),a=i(57444);async function l(e,t,i){const s=await o(e,t,i);return n.default.fromJSON(s)}async function o(e,t,i){const n=(0,s.en)(e),l={...i},o=a.Z.from(t),{data:u}=await(0,r.executeQuery)(n,o,o.sourceSpatialReference,l);return u}},98326:(e,t,i)=>{i.d(t,{Z:()=>h});var s,r=i(43697),n=i(96674),a=i(5600),l=(i(67676),i(80442),i(75215)),o=i(52011);const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let c=s=class extends n.wq{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:s}=e;if(!t||!i||!s)return null;const r=t.find((e=>e.name===i));return r?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const s=i.find((e=>e.name===t));return s&&s.value||null}({tagName:s,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new s({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,r._)([(0,a.Cb)({type:String})],c.prototype,"contentType",void 0),(0,r._)([(0,a.Cb)()],c.prototype,"exifInfo",void 0),(0,r._)([(0,a.Cb)({readOnly:!0})],c.prototype,"orientationInfo",null),(0,r._)([(0,a.Cb)({type:l.z8})],c.prototype,"id",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"globalId",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"keywords",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"name",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"parentGlobalId",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"parentObjectId",void 0),(0,r._)([(0,a.Cb)({type:l.z8})],c.prototype,"size",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"url",void 0),c=s=(0,r._)([(0,o.j)("esri.layers.support.AttachmentInfo")],c);const h=c},11282:(e,t,i)=>{i.d(t,{cv:()=>l,en:()=>a,lA:()=>n});var s=i(22974),r=i(17452);function n(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.mN)(e):(0,s.d9)(e)}function l(e,t,i){const s={};for(const r in e){if("declaredClass"===r)continue;const n=e[r];if(null!=n&&"function"!=typeof n)if(Array.isArray(n)){s[r]=[];for(let e=0;e<n.length;e++)s[r][e]=l(n[e])}else if("object"==typeof n)if(n.toJSON){const e=n.toJSON(i&&i[r]);s[r]=t?e:JSON.stringify(e)}else s[r]=t?n:JSON.stringify(n);else s[r]=n}return s}},58333:(e,t,i)=>{i.d(t,{ET:()=>n,I4:()=>r,eG:()=>o,lF:()=>a,lj:()=>c,qP:()=>l,wW:()=>u});const s=[252,146,31,255],r={type:"esriSMS",style:"esriSMSCircle",size:6,color:s,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},n={type:"esriSLS",style:"esriSLSSolid",width:.75,color:s},a={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},l={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},o={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},u={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},c={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8875,5235],{28924:(e,t,i)=>{i.d(t,{Z:()=>s});class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,i){this._layerById[t]=i,this._layerByName[e]=i}async featureSetByName(e,t=!0,i=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,i=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(){return"object, FeatureSetCollection"}}},42666:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>ne,constructFeatureSet:()=>se,constructFeatureSetFromPortalItem:()=>fe,constructFeatureSetFromRelationship:()=>ae,constructFeatureSetFromUrl:()=>ie,convertToFeatureSet:()=>pe,createFeatureSetCollectionFromMap:()=>ue,createFeatureSetCollectionFromService:()=>ce,getPortal:()=>he,initialiseMetaDataCache:()=>ee,lookupUser:()=>de});var s=i(40330),r=i(3172),n=i(28924),a=i(84328),l=i(38171),o=i(61363),u=i(70409),c=i(85065),h=i(91136),d=i(90961),p=i(3823),f=i(90658),y=i(36515),_=i(95002),g=i(41534);class m{clone(){const e=new m;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i){const s=new m;s.field=e;const r=g.WhereClause.create(t,i),n=function(e){if("function"===e.parseTree.type){if(0===e.parseTree.args.value.length)return{name:e.parseTree.name,expr:null};if(e.parseTree.args.value.length>1)throw new Error("Statistic does not have 1 or 0 Parameters");const t=g.WhereClause.create((0,y.XF)(e.parseTree.args.value[0],f.Bj.Standardised,e.parameters),e.fieldsIndex);return{name:e.parseTree.name,expr:t}}return null}(r);if(null===n)throw new Error("Invalid Statistic Function");const a=n.name.toUpperCase().trim();if("MIN"===a){if(s.typeofstat="MIN",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("MAX"===a){if(s.typeofstat="MAX",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("COUNT"===a)s.typeofstat="COUNT",s.workingexpr=n.expr;else if("STDEV"===a){if(s.typeofstat="STDDEV",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("SUM"===a){if(s.typeofstat="SUM",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("MEAN"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else if("AVG"===a){if(s.typeofstat="AVG",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}else{if("VAR"!==a)throw new Error("Invalid Statistic Function");if(s.typeofstat="VAR",s.workingexpr=n.expr,null===r)throw new Error("Invalid Statistic Function Parameters")}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}function w(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function b(e,t,i,s,r,n){return w(function(e,t){return e<<t|e>>>32-t}(w(w(t,e),w(s,n)),r),i)}function v(e,t,i,s,r,n,a){return b(t&i|~t&s,e,t,r,n,a)}function S(e,t,i,s,r,n,a){return b(t&s|i&~s,e,t,r,n,a)}function F(e,t,i,s,r,n,a){return b(t^i^s,e,t,r,n,a)}function I(e,t,i,s,r,n,a){return b(i^(t|~s),e,t,r,n,a)}function C(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;let i=1732584193,s=-271733879,r=-1732584194,n=271733878;for(let t=0;t<e.length;t+=16){const a=i,l=s,o=r,u=n;i=v(i,s,r,n,e[t+0],7,-680876936),n=v(n,i,s,r,e[t+1],12,-389564586),r=v(r,n,i,s,e[t+2],17,606105819),s=v(s,r,n,i,e[t+3],22,-1044525330),i=v(i,s,r,n,e[t+4],7,-176418897),n=v(n,i,s,r,e[t+5],12,1200080426),r=v(r,n,i,s,e[t+6],17,-1473231341),s=v(s,r,n,i,e[t+7],22,-45705983),i=v(i,s,r,n,e[t+8],7,1770035416),n=v(n,i,s,r,e[t+9],12,-1958414417),r=v(r,n,i,s,e[t+10],17,-42063),s=v(s,r,n,i,e[t+11],22,-1990404162),i=v(i,s,r,n,e[t+12],7,1804603682),n=v(n,i,s,r,e[t+13],12,-40341101),r=v(r,n,i,s,e[t+14],17,-1502002290),s=v(s,r,n,i,e[t+15],22,1236535329),i=S(i,s,r,n,e[t+1],5,-165796510),n=S(n,i,s,r,e[t+6],9,-1069501632),r=S(r,n,i,s,e[t+11],14,643717713),s=S(s,r,n,i,e[t+0],20,-373897302),i=S(i,s,r,n,e[t+5],5,-701558691),n=S(n,i,s,r,e[t+10],9,38016083),r=S(r,n,i,s,e[t+15],14,-660478335),s=S(s,r,n,i,e[t+4],20,-405537848),i=S(i,s,r,n,e[t+9],5,568446438),n=S(n,i,s,r,e[t+14],9,-1019803690),r=S(r,n,i,s,e[t+3],14,-187363961),s=S(s,r,n,i,e[t+8],20,1163531501),i=S(i,s,r,n,e[t+13],5,-1444681467),n=S(n,i,s,r,e[t+2],9,-51403784),r=S(r,n,i,s,e[t+7],14,1735328473),s=S(s,r,n,i,e[t+12],20,-1926607734),i=F(i,s,r,n,e[t+5],4,-378558),n=F(n,i,s,r,e[t+8],11,-2022574463),r=F(r,n,i,s,e[t+11],16,1839030562),s=F(s,r,n,i,e[t+14],23,-35309556),i=F(i,s,r,n,e[t+1],4,-1530992060),n=F(n,i,s,r,e[t+4],11,1272893353),r=F(r,n,i,s,e[t+7],16,-155497632),s=F(s,r,n,i,e[t+10],23,-1094730640),i=F(i,s,r,n,e[t+13],4,681279174),n=F(n,i,s,r,e[t+0],11,-358537222),r=F(r,n,i,s,e[t+3],16,-722521979),s=F(s,r,n,i,e[t+6],23,76029189),i=F(i,s,r,n,e[t+9],4,-640364487),n=F(n,i,s,r,e[t+12],11,-421815835),r=F(r,n,i,s,e[t+15],16,530742520),s=F(s,r,n,i,e[t+2],23,-995338651),i=I(i,s,r,n,e[t+0],6,-198630844),n=I(n,i,s,r,e[t+7],10,1126891415),r=I(r,n,i,s,e[t+14],15,-1416354905),s=I(s,r,n,i,e[t+5],21,-57434055),i=I(i,s,r,n,e[t+12],6,1700485571),n=I(n,i,s,r,e[t+3],10,-1894986606),r=I(r,n,i,s,e[t+10],15,-1051523),s=I(s,r,n,i,e[t+1],21,-2054922799),i=I(i,s,r,n,e[t+8],6,1873313359),n=I(n,i,s,r,e[t+15],10,-30611744),r=I(r,n,i,s,e[t+6],15,-1560198380),s=I(s,r,n,i,e[t+13],21,1309151649),i=I(i,s,r,n,e[t+4],6,-145523070),n=I(n,i,s,r,e[t+11],10,-1120210379),r=I(r,n,i,s,e[t+2],15,718787259),s=I(s,r,n,i,e[t+9],21,-343485551),i=w(i,a),s=w(s,l),r=w(r,o),n=w(n,u)}return[i,s,r,n]}function x(e,t=1){const i=t||0,s=C(function(e){const t=[];for(let i=0,s=8*e.length;i<s;i+=8)t[i>>5]|=(255&e.charCodeAt(i/8))<<i%32;return t}(e),8*e.length);switch(i){case 3:return s;case 1:return function(e){const t="0123456789abcdef",i=[];for(let s=0,r=4*e.length;s<r;s++)i.push(t.charAt(e[s>>2]>>s%4*8+4&15)+t.charAt(e[s>>2]>>s%4*8&15));return i.join("")}(s);case 2:return function(e){const t=[];for(let i=0,s=32*e.length;i<s;i+=8)t.push(String.fromCharCode(e[i>>5]>>>i%32&255));return t.join("")}(s);case 0:return function(e){const t=[];for(let i=0,s=4*e.length;i<s;i+=3){const s=(e[i>>2]>>i%4*8&255)<<16|(e[i+1>>2]>>(i+1)%4*8&255)<<8|e[i+2>>2]>>(i+2)%4*8&255;for(let r=0;r<4;r++)8*i+6*r>32*e.length?t.push("="):t.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(s>>6*(3-r)&63))}return t.join("")}(s)}}var R=i(82971),k=i(1231),D=i(99514);function E(e){if(!e)return"COUNT";switch(e.toLowerCase()){case"max":return"MAX";case"var":case"variance":return"VAR";case"avg":case"average":case"mean":return"AVG";case"min":return"MIN";case"sum":return"SUM";case"stdev":case"stddev":return"STDDEV";case"count":return"COUNT"}return"COUNT"}class T extends h.Z{constructor(e){super(e),this._decodedStatsfield=[],this._decodedGroupbyfield=[],this._candosimplegroupby=!0,this.phsyicalgroupbyfields=[],this.objectIdField="ROW__ID",this._internalObjectIdField="ROW__ID",this._adaptedFields=[],this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}async _getSet(e){if(null===this._wset){const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,this._wset}return this._wset}_isInFeatureSet(){return f.dj.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,i=1;const s=this._parent?this._parent.getFieldsIndex():new D.Z([]);for(this.objectIdField="ROW__ID",this.globalIdField="";!1===t;){let e=!1;for(let t=0;t<this._config.groupbyfields.length;t++)if(this._config.groupbyfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(let t=0;t<this._config.statsfields.length;t++)if(this._config.statsfields[t].name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+i.toString(),i++)}for(const e of this._config.statsfields){const t=new m;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s),t.typeofstat=E(e.statistic),this._decodedStatsfield.push(t)}this._decodedGroupbyfield=[];for(const e of this._config.groupbyfields){const t={name:e.name,singlefield:null,tofieldname:e.name,expression:e.expression instanceof g.WhereClause?e.expression:g.WhereClause.create(e.expression,s)};this._decodedGroupbyfield.push(t)}if(null!==this._parent){this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const t of this._parent.fields)e[t.name.toUpperCase()]=1;this.types=null}else this.geometryType=f.Qk.point,this.typeIdField="",this.types=null,this.spatialReference=new R.Z({wkid:4326});this.fields=[];const r=new m;r.field=this._nextUniqueName(e),r.tofieldname=this.objectIdField,r.workingexpr=g.WhereClause.create(this._parent.objectIdField,this._parent.getFieldsIndex()),r.typeofstat="MIN",this._decodedStatsfield.push(r);for(const t of this._decodedGroupbyfield){const i=new k.Z;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,y.y5)(t.expression)){const e=this._parent.getField((0,y.zR)(t.expression,f.Bj.Standardised));if(!e)throw new Error("Field is not present for Aggregation");t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type}else{i.type=this._convertToEsriFieldType((0,y.DT)(t.expression,this._parent.fields));const e=new k.Z;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new u.yN(e,t.expression)),this._candosimplegroupby=!1}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new u.$X(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new k.Z;let s=null;const r=this._decodedStatsfield[t];r.field=this._nextUniqueName(e),r.tofieldname===this.objectIdField&&(this._internalObjectIdField=r.field),i.name=r.tofieldname,i.alias=i.name;const n=null!==r.workingexpr&&(0,y.y5)(r.workingexpr)?(0,y.zR)(r.workingexpr,f.Bj.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(s=this._parent.getField(n),!s)throw new Error("Field is not present for Aggregation");i.type=s.type}else i.type="double";break;case"MIN":case"MAX":if(""!==n){if(s=this._parent.getField(n),!s)throw new Error("Field is not present for Aggregation");i.type=s.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(s=this._parent.getField(n),!s))throw new Error("Field is not present for Aggregation");i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,s){-1!==t&&this._featureCache[t];const r=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,r)?(await this._expandPagedSet(e,r,0,0,s),this._getFeatures(e,t,i,s)):"success"}async _getFilteredSet(e,t,i,s,r){if(""!==e)return new d.Z([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==i)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,y.hq)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==s){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===s.scanForField(this._decodedStatsfield[e].tofieldname)){s=null,l.ordered=!1;break}if(null!==s)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===s.scanForField(e.tofieldname)){s=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;i&&(e=this._reformulateWhereClauseWithoutGroupByFields(i));let t=null;s&&(t=this._reformulateOrderClauseWithoutGroupByFields(s));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(r),n=!0===l.nowhereclause?new d.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new d.Z(a._candidates.slice(0),a._known.slice(0),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.Xx({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.Z({parentfeatureset:o,orderbyclause:new p.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=o;if(null!==i){let t=null;i&&(t=this._reformulateWhereClauseWithoutGroupByFields(i)),e=new a.Z({parentfeatureset:e,whereclause:t})}n=new d.Z(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.Z({parentfeatureset:e,orderbyclause:new p.Z(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,y.bB)(e,t.tofieldname,(0,y.zR)(t.workingexpr,f.Bj.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,y.bB)(e,t.tofieldname,(0,y.zR)(t.expression,f.Bj.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,i){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,i),this._refineSetBlock(e,t,i)):(this._checkCancelled(i),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const s=await this._getAgregagtePhysicalPage(e,t,i);for(const e of s){const t={geometry:e.geometry,attributes:{}};for(const i of this._decodedGroupbyfield)t.attributes[i.tofieldname]=e.attributes[i.name];for(const i of this._decodedStatsfield)t.attributes[i.tofieldname]=e.attributes[i.field];this._featureCache[t.attributes[this.objectIdField]]=new l.Z(t)}return s.length}_sequentialGetPhysicalItem(e,t,i,s){return new Promise(((r,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?r(s.length):this._nextAggregateItem(e,t,i,s,(n=>{null===n?r(s.length):(t-=1,r(this._sequentialGetPhysicalItem(e,t,i,s)))}),n)}))}_nextAggregateItem(e,t,i,s,r,n){try{(0,o.X)(e.pagesDefinition.internal.iterator.next()).then((a=>{if(null===a)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);s.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,r(null)}else e.pagesDefinition.internal.fullyResolved=!0,r(null);else{const l=this._generateAggregateHash(a);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[a],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return s.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[a],id:l},void r(i)}e.pagesDefinition.internal.workingItem.features.push(a)}this._nextAggregateItem(e,t,i,s,r,n)}}),n)}catch(e){n(e)}}_calculateFieldStat(e,t,i){const s=[];for(let i=0;i<e.features.length;i++)if(null!==t.workingexpr){const r=t.workingexpr.calculateValue(e.features[i]);null!==r&&s.push(r)}else s.push(null);switch(t.typeofstat){case"MIN":i.attributes[t.tofieldname]=(0,_.tj)("min",s,-1);break;case"MAX":i.attributes[t.tofieldname]=(0,_.tj)("max",s,-1);break;case"SUM":i.attributes[t.tofieldname]=(0,_.tj)("sum",s,-1);break;case"COUNT":i.attributes[t.tofieldname]=s.length;break;case"VAR":i.attributes[t.tofieldname]=(0,_.tj)("var",s,-1);break;case"STDDEV":i.attributes[t.tofieldname]=(0,_.tj)("stddev",s,-1);break;case"AVG":i.attributes[t.tofieldname]=(0,_.tj)("avg",s,-1)}return!0}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.features[0].attributes[i.singlefield]:i.expression.calculateValue(e.features[0]);t.attributes[i.tofieldname]=s}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let s=0;s<this._decodedStatsfield.length;s++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[s],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.Z({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const s=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==s?":":":"+s.toString()}return x(t,2)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){h.Z._featuresetFunctions.groupby=function(e,t){return new T({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var A=i(53073),N=i(63991),L=i(80692),O=i(33955),P=i(3121),j=i(98732),Z=(i(20102),i(80442),i(92604),i(10158),i(4967)),q=(i(67676),i(17452),i(67900),i(8744),i(34599)),M=i(74889),U=i(57444),G=(i(98326),i(56545),i(41818)),B=(i(66577),i(5396)),z=i(75935),W=(i(82526),i(28141),i(78760)),V=i(58539),J=i(33586);class Q extends h.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this.formulaCredential=null,this._pageJustIds=!1,this._requestStandardised=!1,this._useDefinitionExpression=!0,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.tI}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}convertQueryToLruCacheKey(e){return x((0,f.hd)(e.toJSON()),2)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{const e=[];for(const t of this.fields)if("oid"===t.type)e.push(t);else for(const i of this._layer.outFields)if(i.toLowerCase()===t.name.toLowerCase()){e.push(t);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=f.Bj.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=f.Bj.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=f.Bj.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=f.Bj.Standardised))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types}_isInFeatureSet(){return f.dj.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new U.Z;t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch(e){return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}pbfSupportedForQuery(e){return!e.outStatistics&&this._layer&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsFormatPBF&&!0===this._layer.capabilities.query.supportsQuantizationEditMode}async queryPBF(e){e.quantizationParameters={mode:"edit"};const t=await(0,q.executeQueryPBF)(this._layer.parsedUrl,e,new W.J({}));return M.default.fromJSON((0,j.cn)(t.data)).unquantize()}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion?this._layer.gdbVersion:"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title,source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}executeQuery(e,t){const i="execute"===t?Z.e:"executeForCount"===t?G.P:B.G,s="execute"===t&&this.pbfSupportedForQuery(e);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e),this.recentlyUsedQueries.addToCache(t,r),r=r.catch((e=>{throw this.recentlyUsedQueries.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===r&&(r=!0!==s?i(this._layer.parsedUrl.path,e):this.queryPBF(e)),r}async _getFilteredSet(e,t,i,s,r){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new U.Z;o.where=null===i?null===t?"1=1":"":(0,y.zR)(i,n),this._requestStandardised&&(o.sqlFormat="standard"),o.spatialRelationship=this._makeRelationshipEnum(e),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null,o.geometry=null===t?null:t,o.relationParameter=this._makeRelationshipParam(e);let u=await this.executeQuery(o,"executeForIds");return null===u&&(u=[]),this._checkCancelled(r),new d.Z([],u,l,null)}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;null!==s&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=s.constructClause(),a=!0);const l=await this.databaseType();let o=null===i?null===t?"1=1":"":(0,y.zR)(i,l);this._layer.definitionExpression&&this._useDefinitionExpression&&(o=""!==o?"(("+this._layer.definitionExpression+") AND ("+o+"))":this._layer.definitionExpression);let u=this._maxQueryRate();const c=this._layer.capabilities.query.maxRecordCount;void 0!==c&&c<u&&(u=c);let h=null;if(!0===this._pageJustIds)h=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:this._layer.objectIdField,resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const s=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._layer.outFields?this._layer.outFields:["*"]);h=new d.Z([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:s.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(h,u,0,1,r),h}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,spatialRel:e.spatialRel,relationParam:e.relationParam,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=new U.Z;this._requestStandardised&&(a.sqlFormat="standard"),a.spatialRelationship=e.pagesDefinition.spatialRel,a.relationParameter=e.pagesDefinition.relationParam,a.outFields=e.pagesDefinition.outFields.split(","),a.num=e.pagesDefinition.resultRecordCount,a.start=e.pagesDefinition.internal.lastPage,a.geometry=e.pagesDefinition.geometry,a.where=e.pagesDefinition.where,a.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,a.returnGeometry=e.pagesDefinition.returnGeometry,a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return"done";for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[r+t]=l.features[t].attributes[this._layer.objectIdField];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[this._layer.objectIdField]]=l.features[e];return(void 0===l.exceededTransferLimit&&l.features.length!==e.pagesDefinition.resultRecordCount||!1===l.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFeatures(e,t,i,s){const r=[];if(-1!==t&&void 0===this._featureCache[t]&&r.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,s),this._getFeatures(e,t,i,s);let n=0;for(let s=e._lastFetchedIndex;s<e._known.length;s++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[s]]){let i=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[s]]){const r=t._featureMap[e._known[s]];null!==r&&(i=!0,this._featureCache[e._known[s]]=r)}}if(!1===i&&(e._known[s]!==t&&r.push(e._known[s]),r.length>=this._maxProcessingRate()-1))break}if(n>=i&&0===r.length)break}if(0===r.length)return"success";const a=new U.Z;this._requestStandardised&&(a.sqlFormat="standard"),a.objectIds=r,a.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._layer.outFields?this._layer.outFields:["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(s),void 0!==l.error)throw new Error(l.error);for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[this._layer.objectIdField]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,s,r,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;for(let e=0;e<this._layer.fields.length;e++)if(this._layer.fields[e].name.toLowerCase()===c.toLowerCase()){c=this._layer.fields[e].name;break}const h=new U.Z;this._requestStandardised&&(h.sqlFormat="standard");let d=null===n?null===r?"1=1":"":(0,y.zR)(n,u);this._layer.definitionExpression&&this._useDefinitionExpression&&(d=""!==d?"(("+this._layer.definitionExpression+") AND ("+d+"))":this._layer.definitionExpression),h.where=d,h.spatialRelationship=this._makeRelationshipEnum(s),h.relationParameter=this._makeRelationshipParam(s),h.geometry=null===r?null:r,h.returnDistinctValues=!0,h.returnGeometry=!1,h.outFields=[c];const p=await this.executeQuery(h,"execute");if(this._checkCancelled(o),!p.hasOwnProperty("features"))throw new Error("Unnexected Result querying statistics from layer");let f=!1;for(let e=0;e<this._layer.fields.length;e++)if(this._layer.fields[e].name===c){"date"===this._layer.fields[e].type&&(f=!0);break}for(let e=0;e<p.features.length;e++){if(f){const t=p.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(p.features[e].attributes[c]);if(l.length>=a)break}return 0===p.features.length?l:p.features.length===this._layer.capabilities.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+p.features.length,t,i,s,r,n,a,l,o)}:l}async _distinctStat(e,t,i,s,r,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,s,r,n,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType}async _countstat(e,t,i,s){const r=await this.databaseType(),n=new U.Z;if(this._requestStandardised&&(n.sqlFormat="standard"),this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};let a=null===s?null===i?"1=1":"":(0,y.zR)(s,r);return this._layer.definitionExpression&&this._useDefinitionExpression&&(a=""!==a?"(("+this._layer.definitionExpression+") AND ("+a+"))":this._layer.definitionExpression),n.where=a,n.where=a,n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===i?null:i,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,i,s,r,n,a){await this._ensureLoaded();const l=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression,o=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics,u=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsDistinct;if("count"===e)return u?this._countstat(e,i,s,r):{calculated:!1};if(!1===o||!1===(0,y.y5)(t)&&!1===l||!1===t.isStandardized)return""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===u?""!==i||null!==r?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,i,s,r,n,a);const c=await this.databaseType();if(this.isTable()&&s&&null!==i&&""!==i)return{calculated:!0,result:null};const h=new U.Z;this._requestStandardised&&(h.sqlFormat="standard");let d=null===r?null===s?"1=1":"":(0,y.zR)(r,c);this._layer.definitionExpression&&this._useDefinitionExpression&&(d=""!==d?"(("+this._layer.definitionExpression+") AND ("+d+"))":this._layer.definitionExpression),h.where=d,h.spatialRelationship=this._makeRelationshipEnum(i),h.relationParameter=this._makeRelationshipParam(i),h.geometry=null===s?null:s;const p=new V.Z;p.statisticType=(0,_.g3)(e),p.onStatisticField=(0,y.zR)(t,c),p.outStatisticFieldName="ARCADE_STAT_RESULT",h.returnGeometry=!1;let f="ARCADE_STAT_RESULT";h.outStatistics=[p];const g=await this.executeQuery(h,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new Error("Unnexected Result querying statistics from layer");let m=!1;for(let e=0;e<g.fields.length;e++)if("ARCADE_STAT_RESULT"===g.fields[e].name.toUpperCase()){f=g.fields[e].name,"date"===g.fields[e].type&&(m=!0);break}if(m){let e=g.features[0].attributes[f];return null!==e&&(e=new Date(g.features[0].attributes[f])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[f]}}_stat(e,t,i,s,r,n,a){return this._stats(e,t,i,s,r,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const s=this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsSqlExpression;if(void 0!==this._layer.capabilities&&null!==this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsStatistics&&!0===this._layer.capabilities.query.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)null!==t[e].workingexpr&&(!1===t[e].workingexpr.isStandardized||!1===(0,y.y5)(t[e].workingexpr)&&!1===s)&&(i=!1);return!1!==i}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){await this._ensureLoaded();const l=await this.databaseType();let o="",u=!1,c=!1;null!==n&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(o=n.constructClause(),c=!0),this._layer.capabilities&&this._layer.capabilities.query&&!1===this._layer.capabilities.query.supportsPagination&&(c=!1,u=!0,o=this._layer.objectIdField);const h=[];for(let e=0;e<t.length;e++){const i=new V.Z;i.onStatisticField=null!==t[e].workingexpr?(0,y.zR)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),h.push(i)}""===o&&(o=e.join(","));let p=this._maxQueryRate();const f=this._layer.capabilities.query.maxRecordCount;void 0!==f&&f<p&&(p=f);let _=null===r?null===s?"1=1":"":(0,y.zR)(r,l);return this._layer.definitionExpression&&this._useDefinitionExpression&&(_=""!==_?"(("+this._layer.definitionExpression+") AND ("+_+"))":this._layer.definitionExpression),new d.Z([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:u,generatedOid:a,resultRecordCount:p,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:h,geometry:null===s?null:s,where:_,orderByFields:o,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}async _getAgregagtePhysicalPage(e,t,i){let s=e.pagesDefinition.where;!0===e.pagesDefinition.useOIDpagination&&(s=""!==s?"("+s+") AND ("+e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString()+")":e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString());const r=e.pagesDefinition.internal.lastRetrieved,n=r,a=e.pagesDefinition.internal.lastPage,o=new U.Z;if(this._requestStandardised&&(o.sqlFormat="standard"),o.where=s,o.spatialRelationship=e.pagesDefinition.spatialRel,o.relationParameter=e.pagesDefinition.relationParam,o.outFields=e.pagesDefinition.outFields,o.outStatistics=e.pagesDefinition.outStatistics,o.geometry=e.pagesDefinition.geometry,o.groupByFieldsForStatistics=e.pagesDefinition.groupByFieldsForStatistics,o.num=e.pagesDefinition.resultRecordCount,o.start=e.pagesDefinition.internal.lastPage,o.returnGeometry=e.pagesDefinition.returnGeometry,o.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,this.isTable()&&o.geometry&&o.spatialRelationship)return[];const u=await this.executeQuery(o,"execute");if(this._checkCancelled(i),!u.hasOwnProperty("features"))throw new Error("Unnexected Result querying aggregates from layer");const c=[];if(e.pagesDefinition.internal.lastPage!==a)return[];for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[n+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.Z({attributes:u.features[e].attributes,geometry:null}));return!0===e.pagesDefinition.useOIDpagination?0===u.features.length?e.pagesDefinition.internal.fullyResolved=!0:e.pagesDefinition.internal.lastMaxId=u.features[u.features.length-1].attributes[e.pagesDefinition.generatedOid]:(void 0===u.exceededTransferLimit&&u.features.length!==e.pagesDefinition.resultRecordCount||!1===u.exceededTransferLimit)&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=r+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,s,r){const n=new P.default({url:e,outFields:null===t?["*"]:t});return new Q({layer:n,spatialReference:i,lrucache:s,interceptor:r})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON&&this._layer.source.sourceJSON.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,f.US)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,s,r){if(this._layer.capabilities.data.supportsAttachment&&this._layer.capabilities.operations.supportsQueryAttachments){const n={objectIds:[e],returnMetadata:r};(t&&t>0||i&&i>0)&&(n.size=[t&&t>0?t:0,i&&i>0?i:t+1]),s&&s.length>0&&(n.attachmentTypes=s),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:n,method:"attachments"});const a=await this._layer.queryAttachments(n),l=[];return a&&a[e]&&a[e].forEach((t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let s=null;r&&t.exifInfo&&(s=J.Z.convertJsonToArcade(t.exifInfo,!0)),l.push(new L.Z(t.id,t.name,t.contentType,t.size,i,s))})),l}return[]}async queryRelatedFeatures(e){const t={f:"json",relationshipId:e.relationshipId.toString(),definitionExpression:e.where,outFields:e.outFields.join(","),returnGeometry:e.returnGeometry.toString()};void 0!==e.resultOffset&&null!==e.resultOffset&&(t.resultOffset=e.resultOffset.toString()),void 0!==e.resultRecordCount&&null!==e.resultRecordCount&&(t.resultRecordCount=e.resultRecordCount.toString()),e.orderByFields&&(t.orderByFields=e.orderByFields.join(",")),e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=JSON.stringify(e.outSpatialReference.toJSON())),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,r.default)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t&&t.relatedRecordGroups){const i=t.spatialReference;for(const s of t.relatedRecordGroups){const r=s.objectId,n=[];for(const e of s.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.Z({geometry:e.geometry?(0,O.im)(e.geometry):null,attributes:e.attributes});n.push(t)}e[r]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new Error("Invalid Request")}async getFeatureByObjectId(e,t){const i=new U.Z;i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=this.objectIdField+"="+e.toString(),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const s=await(0,Z.e)(this._layer.parsedUrl.path,i);return 1===s.features.length?s.features[0]:null}async getIdentityUser(){await this.load();const e=s.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=s.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const i=t.toLowerCase().indexOf("/rest/services");if(t=i>-1?t.substring(0,i):t,t){t+="/rest/info";try{const e=await(0,r.default)(t,{query:{f:"json"}});let i="";return e.data&&e.data.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new Q({layer:this._layer,spatialReference:this.spatialReference,outFields:this._overrideFields,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries,interceptor:this.featureSetQueryInterceptor});return e._useDefinitionExpression=!1,e}}var K=i(17805);class $ extends h.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._findObjectId=-1,this._requestStandardised=!1,this._removeGeometry=!1,this._overrideFields=null,this.featureObjectId=null,this.relatedLayer=null,this.relationship=null,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,this._findObjectId=e.objectId,this.featureObjectId=e.objectId,this.relationship=e.relationship,this.relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return f.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return await Promise.all([this._layer.load(),this.relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this.relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this.relatedLayer.geometryType,this.fields=this.relatedLayer.fields.slice(0),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType,this._requestStandardised=e.requestStandardised),this.objectIdField=this.relatedLayer.objectIdField,this.globalIdField=this.relatedLayer.globalIdField,this.hasM=this.relatedLayer.supportsM,this.hasZ=this.relatedLayer.supportsZ,this.typeIdField=this.relatedLayer.typeIdField,this.types=this.relatedLayer.types}async databaseType(){return await this.relatedLayer.databaseType(),this._databaseType=this.relatedLayer._databaseType,this._databaseType}isTable(){return this.relatedLayer.isTable()}_isInFeatureSet(){return f.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new l.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new d.Z([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new d.Z([],[],!0,null);if(n.capabilities.queryRelated&&n.capabilities.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,s,r);let a="",l=!1;null!==s&&n.capabilities&&n.capabilities.queryRelated&&!0===n.capabilities.queryRelated.supportsOrderBy&&(a=s.constructClause(),l=!0);const o=new z.Z;o.objectIds=[this._findObjectId];const u=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);o.outFields=u,o.relationshipId=this.relationship.id,o.where="1=1";let c=!0;!0===this._removeGeometry&&(c=!1),o.returnGeometry=c,this._requestStandardised&&(o.sqlFormat="standard"),o.outSpatialReference=this.spatialReference,o.orderByFields=""!==a?a.split(","):null;const h=await n.source.queryRelatedFeatures(o);this._checkCancelled(r);const p=h[this._findObjectId]?h[this._findObjectId].features:[],f=[];for(let e=0;e<p.length;e++)this._featureCache[p[e].attributes[this.relatedLayer.objectIdField]]=p[e],f.push(p[e].attributes[this.relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=i;return new d.Z(y||_?f:[],y||_?[]:f,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice(0);if(t.includes("*"))return t;let i=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){i=!0;break}return!1===i&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,i,s,r){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==s&&l&&l.capabilities.queryRelated&&!0===l.capabilities.queryRelated.supportsOrderBy&&(n=s.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities.query.maxRecordCount;void 0!==u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,h=null!=i;let p=null,f=!0;!0===this._removeGeometry&&(f=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this.relatedLayer.fields?this.relatedLayer.fields.map((e=>e.name)):["*"]);return p=new d.Z(c||h?["GETPAGES"]:[],c||h?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(p,o,0,0,r),p}_expandPagedSet(e,t,i,s,r){return this._expandPagedSetFeatureSet(e,t,i,s,r)}_clonePageDefinition(e){return null===e?null:!0!==e.groupbypage?{groupbypage:!1,outFields:e.outFields,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}:{groupbypage:!0,outFields:e.outFields,resultRecordCount:e.resultRecordCount,useOIDpagination:e.useOIDpagination,generatedOid:e.generatedOid,groupByFieldsForStatistics:e.groupByFieldsForStatistics,resultOffset:e.resultOffset,outStatistics:e.outStatistics,geometry:e.geometry,where:e.where,objectIds:e.objectIds,orderByFields:e.orderByFields,returnGeometry:e.returnGeometry,returnIdsOnly:e.returnIdsOnly,internal:e.internal}}async _getPhysicalPage(e,t,i){const s=e.pagesDefinition.internal.lastRetrieved,r=s,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new z.Z;!0===this._requestStandardised&&(l.sqlFormat="standard"),l.relationshipId=this.relationship.id,l.objectIds=e.pagesDefinition.objectIds,l.resultOffset=e.pagesDefinition.internal.lastPage,l.resultRecordCount=e.pagesDefinition.resultRecordCount,l.outFields=e.pagesDefinition.outFields.split(","),l.where=e.pagesDefinition.where,l.orderByFields=""!==e.pagesDefinition.orderByFields?e.pagesDefinition.orderByFields.split(","):null,l.returnGeometry=e.pagesDefinition.returnGeometry,l.outSpatialReference=this.spatialReference;const o=await a.source.queryRelatedFeatures(l);if(this._checkCancelled(i),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[r+t]=u[t].attributes[this.relatedLayer.objectIdField];for(let e=0;e<u.length;e++)this._featureCache[u[e].attributes[this.relatedLayer.objectIdField]]=u[e];const c=!o[this._findObjectId]||!1===o[this._findObjectId].exceededTransferLimit;return u.length!==e.pagesDefinition.resultRecordCount&&c&&(e.pagesDefinition.internal.fullyResolved=!0),e.pagesDefinition.internal.lastRetrieved=s+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,s){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,s),this._getFeatures(e,t,i,s);let a=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[s]&&void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&r.push(e._known[s]),r.length>i)))&&!(a>=i&&0===r.length);s++);if(0===r.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,s,r,n,a){return{calculated:!1}}get gdbVersion(){return this.relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,s,r){return!1}relationshipMetaData(){return this.relatedLayer.relationshipMetaData()}serviceUrl(){return this.relatedLayer.serviceUrl()}queryAttachments(e,t,i,s,r){return this.relatedLayer.queryAttachments(e,t,i,s,r)}getFeatureByObjectId(e,t){return this.relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this.relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this.relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this.relatedLayer}}var H=i(48039),X=i(65587),Y=i(15235);function ee(){null===H.Z.applicationCache&&(H.Z.applicationCache=new H.Z)}async function te(e,t){if(H.Z.applicationCache){const i=H.Z.applicationCache.getLayerInfo(e);if(i){const s=await i;return new P.default({url:e,outFields:t,sourceJSON:s})}const s=new P.default({url:e,outFields:t}),r=(async()=>(await s.load(),s.sourceJSON))();if(H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,r);try{return await r,s}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return await r,s}return new P.default({url:e,outFields:t})}async function ie(e,t,i,s,r,n=null){return se(await te(e,["*"]),t,i,s,r,n)}function se(e,t=null,i=null,s=!0,r=null,n=null){return!0===e._hasMemorySource()?new K.Z({layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:n}):new Q({layer:e,spatialReference:t,outFields:i,includeGeometry:s,lrucache:r,interceptor:n})}async function re(e){if(null!==H.Z.applicationCache){const t=H.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.default)(e,{responseType:"json",query:{f:"json"}});if(t.data){const e=t.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return t}async function ne(e,t){const i={metadata:null,networkId:-1,unVersion:3,terminals:[],queryelem:null,layerNameLkp:{},lkp:null},s=await re(e);if(i.metadata=s,s.controllerDatasetLayers&&void 0!==s.controllerDatasetLayers.utilityNetworkLayerId&&null!==s.controllerDatasetLayers.utilityNetworkLayerId){if(s.layers)for(const e of s.layers)i.layerNameLkp[e.id]=e.name;if(s.tables)for(const e of s.tables)i.layerNameLkp[e.id]=e.name;const n=s.controllerDatasetLayers.utilityNetworkLayerId;i.networkId=n;const a=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==H.Z.applicationCache){const e=H.Z.applicationCache.getLayerInfo(i);if(null!==e)return e}const s=(async()=>{const i=await(0,r.default)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements&&e.layerDataElements[0])return e.layerDataElements[0]}throw new Error("Not Found")})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(i,s);try{return await s}catch(e){throw H.Z.applicationCache.clearLayerInfo(i),e}}return s}(e,n);if(a){i.queryelem=a,i.queryelem&&i.queryelem.dataElement&&void 0!==i.queryelem.dataElement.schemaGeneration&&(i.unVersion=i.queryelem.dataElement.schemaGeneration),i.lkp={},i.queryelem.dataElement.domainNetworks||(i.queryelem.dataElement.domainNetworks=[]);for(const e of i.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources?e.edgeSources:[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]?i.layerNameLkp[t.layerId]:null};e.className&&(i.lkp[e.className]=e)}for(const t of e.junctionSources?e.junctionSources:[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:i.layerNameLkp[t.layerId]?i.layerNameLkp[t.layerId]:null};e.className&&(i.lkp[e.className]=e)}}if(i.queryelem.dataElement.terminalConfigurations)for(const e of i.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)i.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const s=await async function(e){if(null!==H.Z.applicationCache){const t=H.Z.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.default)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==H.Z.applicationCache){H.Z.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw H.Z.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+n);if(s.systemLayers&&void 0!==s.systemLayers.associationsTableId&&null!==s.systemLayers.associationsTableId){const r=[];i.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG"));let n=await ie(e+"/"+s.systemLayers.associationsTableId.toString(),t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null);return await n.load(),i.unVersion>=4&&(n=n.filter(g.WhereClause.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62,63)",n.getFieldsIndex())),await n.load()),{lkp:i.lkp,associations:n,unVersion:i.unVersion,terminals:i.terminals}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}return{associations:null,unVersion:i.unVersion,lkp:null,terminals:[]}}async function ae(e,t,i,s=null,r=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await ie(o,s,r,n,a,l);return new $({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:s,outFields:r,includeGeometry:n,lrucache:a,interceptor:l})}a.Z.registerAction(),T.registerAction(),c.Z.registerAction(),A.Z.registerAction(),N.Z.registerAction();class le extends n.Z{constructor(e,t=null,i=null,s=null){super(),this._map=e,this._overridespref=t,this.lrucache=i,this.interceptor=s,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const s=se(e,this._overridespref,null===i?["*"]:i,t,this.lrucache,this.interceptor);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async featureSetByName(e,t=!0,i=null){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>t instanceof P.default&&t.title===e));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>!!(t.title&&t.title===e||t.title&&t.title===e)));if(s){if(s instanceof P.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e=s.outFields?s:{...s,outFields:["*"]};s._materializedTable=new P.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}async featureSetById(e,t=!0,i=["*"]){if(void 0!==this._map.loaded&&void 0!==this._map.load&&!1===this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=this._map.allLayers.find((t=>t instanceof P.default&&t.id===e));if(r)return this._makeAndAddFeatureSet(r,t,i);if(this._map.tables){const s=this._map.tables.find((t=>t.id===e));if(s){if(s instanceof P.default)return this._makeAndAddFeatureSet(s,t,i);if(s._materializedTable);else{const e={...s,outFields:["*"]};s._materializedTable=new P.default(e)}return await s._materializedTable.load(),this._makeAndAddFeatureSet(s._materializedTable,t,i)}}return null}}class oe extends n.Z{constructor(e,t=null,i=null,s=null){super(),this._url=e,this._overridespref=t,this.lrucache=i,this.interceptor=s,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const s=se(e,this._overridespref,null===i?["*"]:i,t,this.lrucache);return this._instantLayers.push({featureset:s,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),s}async _loadMetaData(){const e=await re(this._url);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new oe(this._url,this._overridespref,this.lrucache,this.interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.title===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers?r.layers:[])t.name===e&&(n=t);if(!n)for(const t of r.tables?r.tables:[])t.name===e&&(n=t);if(n){const e=await te(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice(0)).sort();const s=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const r=this._instantLayers[i];if(r.opitem.id===e&&r.includeGeometry===t&&r.outFields===s)return this._instantLayers[i].featureset}const r=await this._loadMetaData();let n=null;for(const t of r.layers?r.layers:[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of r.tables?r.tables:[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await te(this._url+"/"+n.id,["*"]);return this._makeAndAddFeatureSet(e,t,i)}return null}}function ue(e,t,i=null,s=null){return new le(e,t,i,s)}function ce(e,t,i=null,s=null){return new oe(e,t,i,s)}function he(e,t){return null===e?t:new X.Z({url:e.field("url")})}async function de(e,t,i){if(!s.id.findCredential(e.restUrl))return null;if("loaded"===e.loadStatus&&""===t&&e.user&&e.user.sourceJSON&&!1===i)return e.user.sourceJSON;if(""===t){const t=await(0,r.default)(e.restUrl+"/community/self",{responseType:"json",query:{f:"json",...!1===i?{}:{returnUserLicenseTypeExtensions:!0}}});if(t.data){const e=t.data;if(e&&e.username)return e}return null}const n=await(0,r.default)(e.restUrl+"/community/users/"+t,{responseType:"json",query:{f:"json"}});if(n.data){const e=n.data;return e.error?null:e}return null}function pe(e,t,i,s,r){if(null===e)return null;if(e instanceof P.default){switch(t){case"datasource":return se(e,r,e.outFields,!0,i,s).getDataSourceFeatureSet();case"parent":case"root":return se(e,r,e.outFields,!0,i,s)}return null}if(e instanceof h.Z)switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}async function fe(e,t,i,s,r,n,a,l=null){if(H.Z.applicationCache){const o=H.Z.applicationCache.getLayerInfo(e+":"+n.url);if(o){const e=await o;return se(new P.default({url:(0,f.US)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}}const o=new Y.default({id:e,portal:n}).load();H.Z.applicationCache&&H.Z.applicationCache.setLayerInfo(e+":"+n.url,o);try{const e=await o;return se(new P.default({url:(0,f.US)(e.url)+"/"+t,outFields:["*"]}),i,s,r,a,l)}catch(t){throw H.Z.applicationCache&&H.Z.applicationCache.clearLayerInfo(e+":"+n.url),t}}},70409:(e,t,i)=>{i.d(t,{$X:()=>d,QP:()=>p,TO:()=>f,Xx:()=>_,yN:()=>y});var s=i(38171),r=i(77286),n=i(91136),a=i(90961),l=i(90658),o=i(36515),u=i(41534),c=i(82971);class h{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class d extends h{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class p extends h{constructor(e,t,i){super((0,l.JW)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,o.bB)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class f extends h{constructor(e,t,i){super(e),this.codefield=t,this.lkp=i,this.reverseLkp={};for(const e in i)this.reverseLkp[i[e]]=e;this.sqlRewritable=!0}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,l.Bj.Standardised,this.field.name,this.codefield instanceof u.WhereClause?(0,o.zR)(this.codefield,l.Bj.Standardised):this.codefield,e.parameters);return i.includes(f.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:u.WhereClause.create(i,t._parent.getFieldsIndex())}}evaluateNodeToWhereClause(e,t,i=null,s=null,r){let n,a,l,u;switch(e.type){case"interval":return(0,o.TE)(this.evaluateNodeToWhereClause(e.value,t,i,s,r),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,i,f.BADNESS,r));for(let n=0;n<e.clauses.length;n++)s+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,i,f.BADNESS,r)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,i,f.BADNESS,r);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,f.BADNESS,r)),s+=" END ",s}case"parameter":{const i=r[e.value.toLowerCase()];if("string"==typeof i)return"'"+r[e.value.toLowerCase()].toString().replace(/'/g,"''")+"'";if(i instanceof Date)return(0,o.oX)(i,t);if(i instanceof Array){const e=[];for(let s=0;s<i.length;s++)"string"==typeof i[s]?e.push("'"+i[s].toString().replace(/'/g,"''")+"'"):i[s]instanceof Date?e.push((0,o.oX)(i[s],t)):e.push(i[s].toString());return e}return i.toString()}case"expression-list":a=[];for(const n of e.value)a.push(this.evaluateNodeToWhereClause(n,t,i,s,r));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,f.BADNESS,r)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,s,r)+") ";case"IS":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new Error("Unsupported RHS for IS");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+n.join(",")+")) "}return u=this.evaluateNodeToWhereClause(e.right,t,i,s,r),u instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+u.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" IN ("+u+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,i,s,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+n.join(",")+")) "}return u=this.evaluateNodeToWhereClause(e.right,t,i,s,r),u instanceof Array?" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+u.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,s,r)+" NOT IN ("+u+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)," ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this.lkp[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this.lkp[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this.lkp[e.right.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,f.BADNESS,r)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,f.BADNESS,r)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replace(/'/g,"''")+"'";case"timestamp":case"date":return(0,o.oX)(e.value,t);case"number":return e.value.toString();case"current-time":return(0,o.vR)("date"===e.mode,t);case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+s+")":e.column;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,i,f.BADNESS,r);return(0,o.fz)(e.name,s,t)}}throw new Error("Unsupported sql syntax "+e.type)}extractValue(e){return this.codefield instanceof u.WhereClause?this.reverseLkp[this.codefield.calculateValueCompiled(e)]:this.reverseLkp[e.attributes[this.codefield]]}}f.BADNESS="_!!!_BAD_LKP_!!!!";class y extends h{constructor(e,t){super(e),this.sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,o.bB)(e,this.field.name,(0,o.zR)(this.sql,l.Bj.Standardised),t.getFieldsIndex())}}extractValue(e){return this.sql.calculateValueCompiled(e)}}class _ extends n.Z{constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=null,this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}_initialiseFeatureSet(){null!==this._parent?(this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.spatialReference=new c.Z({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=l.Qk.point,this.typeIdField="",this.types=null),this.fields=[];for(const e of this.adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();let t=null;return t=this._extraFilter?await this._getFilteredSet("",null,null,null,e):await this._parent._getSet(e),this._checkCancelled(e),this._wset=new a.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,n){const l=[];-1!==t&&void 0===this._featureCache[t]&&l.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,n),this._getFeatures(e,t,i,n);let u=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&l.push(e._known[s]),l.length>=o)));s++);if(0===l.length)return"success";e=new a.Z([],l,e._ordered,null);const c=Math.min(l.length,i);await this._parent._getFeatures(e,-1,c,n),this._checkCancelled(n);const h=[];for(let e=0;e<c;e++){const t=this._parent._featureFromCache(l[e]);void 0!==t&&h.push({geometry:t.geometry,attributes:t.attributes,id:l[e]})}for(const e of h){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new s.Z({attributes:t,geometry:(0,r.r1)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new Error("Fetch and Refine should not be called in this featureset")}async _getFilteredSet(e,t,i,s,r){let n=!1;const l=this._reformulateWithoutAdaptions(i);n=l.cannot,i=l.where;let u=!1;if(null!==s){u=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof d)&&!0===s.scanForField(t.field.name)){if(!(t instanceof p)){s=null,u=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}s&&e.length>0&&(s=s.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,o.$e)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,s,r);let h;return this._checkCancelled(r),h=!0===n?new a.Z(c._candidates.slice(0).concat(c._known.slice(0)),[],!0===u&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new a.Z(c._candidates.slice(0),c._known.slice(0),!0===u&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),h}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,o.hq)(e,i.field.name)){const s=i.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}async _stat(e,t,i,s,r,n,a){let l=!1,u=this._reformulateWithoutAdaptions(t);if(l=u.cannot,t=u.where,u=this._reformulateWithoutAdaptions(r),l=l||u.cannot,null!==(r=u.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,!0===l)return null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,i,s,r,n,a);return!1===c.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,s,r){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const i of this.adaptedFields)if(e[t].toLowerCase()===i.field.name.toLowerCase()&&!(i instanceof d))return!1;const n=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)return!1;const t=i.clone();t.workingexpr=e.where,n.push(t)}else n.push(i)}const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(null!==(r=a.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._canDoAggregates(e,n,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,a){if(null===this._parent)throw new Error("Should never be called");const l=[];for(let e=0;e<t.length;e++){const i=t[e];if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new Error("Should never be called");const t=i.clone();t.workingexpr=e.where,l.push(t)}else l.push(i)}const u=this._reformulateWithoutAdaptions(r);if(u.cannot)throw new Error("Should never be called");return null!==(r=u.where)?null!==this._extraFilter&&(r=(0,o.$e)(this._extraFilter,r)):r=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,l,i,s,r,n,a)}}},84328:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(91136),r=i(90961),n=i(90658),a=i(36515),l=i(95330),o=i(41534),u=i(82971);class c extends s.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof o.WhereClause?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(0),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types):(this.fields=[],this.typeIdField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new u.Z({wkid:4326}),this.geometryType=n.Qk.point)}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getFilteredSet("",null,this._whereclause,null,e);return this._checkCancelled(e),null!==this._whereClauseFunction?this._wset=new r.Z(t._candidates.slice(0).concat(t._known.slice(0)),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new r.Z(t._candidates.slice(0),t._known.slice(0),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent._isInFeatureSet(e);return t===n.dj.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?n.dj.Unknown:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause.testFeature(e)}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,l.y8)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const s=new r.Z([],e,!1,null),a=Math.min(t,e.length);if(await this._parent._getFeatures(s,-1,a,i),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<a;t++){const i=this._parent._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=n.dj.InFeatureSet:this._idstates[e[t]]=n.dj.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<a;t++){const i=this._parent._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===l[i]?this._idstates[e[i]]=n.dj.InFeatureSet:this._idstates[e[i]]=n.dj.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,i,s,n){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,a.$e)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const l=await this._parent._getFilteredSet(e,t,i,s,n);let o;return this._checkCancelled(n),o=null!==this._whereClauseFunction?new r.Z(l._candidates.slice(0).concat(l._known.slice(0)),[],l._ordered,this._clonePageDefinition(l.pagesDefinition)):new r.Z(l._candidates.slice(0),l._known.slice(0),l._ordered,this._clonePageDefinition(l.pagesDefinition)),o}async _stat(e,t,i,s,r,n,l){if(null!==this._whereClauseFunction)return null===r&&""===i&&null===s?this._manualStat(e,t,n,l):{calculated:!1};let o=this._whereclause;null!==r&&null!==this._whereclause&&(o=(0,a.$e)(this._whereclause,r));const u=await this._parent._stat(e,t,i,s,o,n,l);return!1===u.calculated?null===r&&""===i&&null===s?this._manualStat(e,t,n,l):{calculated:!1}:u}async _canDoAggregates(e,t,i,s,r){return null===this._whereClauseFunction&&(null!==r?null!==this._whereclause&&(r=(0,a.$e)(this._whereclause,r)):r=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,s,r))}async _getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,l){if(null===this._parent)throw new Error("Should never be called");return null!==r?null!==this._whereclause&&(r=(0,a.$e)(this._whereclause,r)):r=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,s,r,n,l)}static registerAction(){s.Z._featuresetFunctions.filter=function(e){if("function"==typeof e)return new c({parentfeatureset:this,whereclause:e});let t=null;return e instanceof o.WhereClause&&(t=e),new c({parentfeatureset:this,whereclause:t})}}}},85065:(e,t,i)=>{i.d(t,{Z:()=>l});var s=i(61363),r=i(91136),n=i(90961),a=i(3823);class l extends r.Z{constructor(e){super(e),this._orderbyclause=null,this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._orderbyclause=e.orderbyclause,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,this._orderbyclause,e);return this._checkCancelled(e),this._wset=t,this._wset}return this._wset}async manualOrderSet(e,t){const i=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause.order(i);const s=new n.Z([],[],!0,null);for(let e=0;e<i.length;e++)s._known.push(i[e].id);return s}async getIdColumnDictionary(e,t,i,r){if(i<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,s.X)(this._parent._expandPagedSet(e,n,0,0,r)),this.getIdColumnDictionary(e,t,i,r);let a=i+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;i+=l.length;const o=await(0,s.X)(this._parent._getFeatureBatch(l,r));this._checkCancelled(r);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,r)}return e._candidates.length>0?(await(0,s.X)(this._refineSetBlock(e,this._maxProcessingRate(),r)),this._checkCancelled(r),this.getIdColumnDictionary(e,t,i,r)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,s){return this._parent._getFeatures(e,t,i,s)}_featureFromCache(e){if(void 0===this._featureCache[e]){const t=this._parent._featureFromCache(e);if(void 0===t)return;return null===t?null:(this._featureCache[e]=t,t)}return this._featureCache[e]}async _fetchAndRefineFeatures(){throw new Error("Fetch and Refine should not be called in this featureset")}async _getFilteredSet(e,t,i,s,r){await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,null===s?this._orderbyclause:s,r);this._checkCancelled(r);const l=new n.Z(a._candidates.slice(0),a._known.slice(0),a._ordered,this._clonePageDefinition(a.pagesDefinition));let o=!0;if(a._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,r);return!1===o&&(null===t&&null===i||(e=new n.Z(e._candidates.slice(0).concat(e._known.slice(0)),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){r.Z._featuresetFunctions.orderBy=function(e){return""===e?this:new l({parentfeatureset:this,orderbyclause:new a.Z(e)})}}}},63991:(e,t,i)=>{i.d(t,{Z:()=>a});var s=i(91136),r=i(90961),n=i(90658);class a extends s.Z{constructor(e){super(e),this._topnum=0,this.declaredClass="esri.arcade.featureset.actions.Top",this._countedin=0,this._maxProcessing=100,this._topnum=e.topnum,this._parent=e.parentfeatureset}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._parent._getSet(e);return this._wset=new r.Z(t._candidates.slice(0),t._known.slice(0),!1,this._clonePageDefinition(t.pagesDefinition)),this._setKnownLength(this._wset)>this._topnum&&(this._wset._known=this._wset._known.slice(0,this._topnum)),this._setKnownLength(this._wset)>=this._topnum&&(this._wset._candidates=[]),this._wset}return this._wset}_setKnownLength(e){return e._known.length>0&&"GETPAGES"===e._known[e._known.length-1]?e._known.length-1:e._known.length}_isInFeatureSet(e){const t=this._parent._isInFeatureSet(e);if(t===n.dj.NotInFeatureSet)return t;const i=this._idstates[e];return i===n.dj.InFeatureSet||i===n.dj.NotInFeatureSet?i:t===n.dj.InFeatureSet&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=n.dj.InFeatureSet,this._countedin++,n.dj.InFeatureSet):(this._idstates[e]=n.dj.NotInFeatureSet,n.dj.NotInFeatureSet):n.dj.Unknown}async _expandPagedSet(e,t,i,s,r){if(null===this._parent)throw new Error("Parent Paging not implemented");if(t>this._topnum&&(t=this._topnum),this._countedin>=this._topnum&&e.pagesDefinition.internal.set.length<=e.pagesDefinition.resultOffset){let t=e._known.length;return t>0&&"GETPAGES"===e._known[t-1]&&(e._known.length=t-1),t=e._candidates.length,t>0&&"GETPAGES"===e._candidates[t-1]&&(e._candidates.length=t-1),"success"}const n=await this._parent._expandPagedSet(e,t,i,s,r);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),n}async _getFeatures(e,t,i,s){const n=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,s),this._getFeatures(e,t,i,s);-1!==t&&void 0===this._featureCache[t]&&n.push(t);let l=0;for(let s=e._lastFetchedIndex;s<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&n.push(e._known[s]),n.length>a)));s++);if(0===n.length)return"success";const o=new r.Z([],n,!1,null),u=Math.min(n.length,i);await this._parent._getFeatures(o,-1,u,s);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(n[e]);void 0!==t&&(this._featureCache[n[e]]=t)}return"success"}async _getFilteredSet(e,t,i,s,n){await this._ensureLoaded();const a=await this._getSet(n);return new r.Z(a._candidates.slice(0).concat(a._known.slice(0)),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,s=null;const r=[];for(let a=0;a<e._candidates.length;a++){const l=this._isInFeatureSet(e._candidates[a]);if(l===n.dj.InFeatureSet){if(e._known.push(e._candidates[a]),i+=1,null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(r.push(s),s={start:a,end:a}),e._known.length>=this._topnum)break}else if(l===n.dj.NotInFeatureSet)null===s?s={start:a,end:a}:s.end===a-1?s.end=a:(r.push(s),s={start:a,end:a}),i+=1;else if(l===n.dj.Unknown)break;if(i>=t)break}null!==s&&r.push(s);for(let t=r.length-1;t>=0;t--)e._candidates.splice(r[t].start,r[t].end-r[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.Z._featuresetFunctions.top=function(e){return new a({parentfeatureset:this,topnum:e})}}}},17805:(e,t,i)=>{i.d(t,{Z:()=>p});var s=i(38171),r=i(91136),n=i(90961),a=i(90658),l=i(36515),o=i(9361),u=i(3121),c=i(16451),h=i(1231),d=i(57444);class p extends r.Z{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,e.spatialReference&&(this.spatialReference=e.spatialReference),this._transparent=!0,this._maxProcessing=1e3,this._layer=e.layer,this._wset=null,!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return a.tI}end(){return this._layer}optimisePagingFeatureQueries(){}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._layer.geometryType,this.fields=this._layer.fields.slice(0),this._layer.outFields)if(1===this._layer.outFields.length&&"*"===this._layer.outFields[0]);else{const e=[];for(const t of this.fields)if("oid"===t.type)e.push(t);else for(const i of this._layer.outFields)if(i.toLowerCase()===t.name.toLowerCase()){e.push(t);break}this.fields=e}if(null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=[],t=[];for(const i of this.fields)if("oid"===i.type)e.push(i),t.push(i.name);else for(const s of this._overrideFields)if(s.toLowerCase()===i.name.toLowerCase()){e.push(i),t.push(i.name);break}this.fields=e,this._overrideFields=t}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.hasM=this._layer.supportsM,this.hasZ=this._layer.supportsZ,this._databaseType=a.Bj.Standardised,this.typeIdField=this._layer.typeIdField,this.types=this._layer.types}isTable(){return this._forceIsTable||this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return a.dj.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new s.Z({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,s,r){let o="",u=!1;if(null!==s&&(o=s.constructClause(),u=!0),this.isTable()&&t&&null!==e&&""!==e)return new n.Z([],[],!0,null);const c=new d.Z;c.where=null===i?null===t?"1=1":"":(0,l.zR)(i,a.Bj.Standardised),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==o?o.split(","):null,c.geometry=null===t?null:t,c.returnGeometry=!0,c.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(c);if(null===h)return new n.Z([],[],u,null);this._checkCancelled(r);const p=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];p.push(t),this._featureCache[t]=this._changeFeature(e)})),new n.Z([],p,u,null)}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}async _queryAllFeatures(){if(this._wset)return this._wset;const e=new d.Z;if(e.where="1=1",await this._ensureLoaded(),this._layer.source&&this._layer.source.items){const e=[];return this._layer.source.items.forEach((t=>{const i=t.attributes[this._layer.objectIdField];e.push(i),this._featureCache[i]=this._changeFeature(t)})),this._wset=new n.Z([],e,!1,null),this._wset}const t=await this._layer.queryFeatures(e),i=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];i.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new n.Z([],i,!1,null),this._wset}async _getFeatures(e,t,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);for(let r=e._lastFetchedIndex;r<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&s.push(e._known[r]),s.length>i)));r++);if(0===s.length)return"success";throw new Error("Unaccounted for Features. Not in Feature Collection")}async _refineSetBlock(e){return e}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}relationshipMetaData(){return[]}static _cloneAttr(e){const t={};for(const i in e)t[i]=e[i];return t}nativeCapabilities(){return{title:this._layer.title,canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let i=e.layerDefinition.objectIdField;const s=e.layerDefinition.typeIdField?e.layerDefinition.typeIdField:"",r=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)r.push(c.Z.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(""===i||void 0===i){let t=!1;for(const s of e.layerDefinition.fields)if("oid"===s.type||"esriFieldTypeOID"===s.type){i=s.name,t=!0;break}if(!1===t){let t="FID",s=!0,r=0;for(;s;){let i=!0;for(const s of e.layerDefinition.fields)if(s.name===t){i=!1;break}!0===i?s=!1:(r++,t="FID"+r.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let i=0;i<a.length;i++)n.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),n[i].attributes[t]=i;a=n,i=t}}const d=[];for(const t of e.layerDefinition.fields)t instanceof h.Z?d.push(t):d.push(h.Z.fromJSON(t));let f=n;switch(f){case"esriGeometryPoint":f="point";break;case"esriGeometryPolyline":f="polyline";break;case"esriGeometryPolygon":f="polygon";break;case"esriGeometryExtent":f="extent";break;case"esriGeometryMultipoint":f="multipoint"}for(const e of a)e.geometry&&e.geometry instanceof o.Z==0&&(e.geometry.type=f,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));const y={outFields:["*"],source:a,fields:d,types:r,typeIdField:s,objectIdField:i,spatialReference:t};y.geometryType=f||"point";const _=new u.default(y);return new p({layer:_,spatialReference:t,isTable:null===f||""===f})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=new d.Z;t.where=this.objectIdField+"="+e.toString();const i=await this._layer.queryFeatures(t);return 1===i.features.length?i.features[0]:null}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}}},3823:(e,t,i)=>{function s(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{Z:()=>r});class r{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const i=t[e].match(/\S+/g);this._fields.push(i[0]),2===i.length?"asc"===i[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let e="";for(let t=0;t<this._fields.length;t++)0!==t&&(e+=","),e+=this._fields[t],1===this._directions[t]?e+=" ASC":e+=" DESC";return e}order(e){e.sort(((e,t)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e.feature,this._fields[i],i),n=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?s(r,n):-1*s(r,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let i=0;i<this._fields.length;i++){0!==i&&(t+=",");let s=this._fields[i];for(const t of e)if(s.toLowerCase()===t.field.toLowerCase()){s=t.newfield;break}t+=s,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new r(t)}featureValue(e,t,i){const s=e.attributes[t];if(void 0!==s)return s;for(const s in e.attributes)if(t.toLowerCase()===s.toLowerCase())return this._fields[i]=s,e.attributes[s];return null}}},25929:(e,t,i)=>{i.d(t,{M:()=>f,e:()=>d,f:()=>n,i:()=>h,p:()=>_,r:()=>l,t:()=>a,w:()=>o});var s=i(70586),r=i(17452);function n(e,t){const i=t&&t.url&&t.url.path;if(e&&i&&(e=(0,r.hF)(e,i,{preserveProtocolRelative:!0}),t.portalItem&&t.readResourcePaths)){const i=(0,r.PF)(e,t.portalItem.itemUrl);c.test(i)&&t.readResourcePaths.push(t.portalItem.resourceFromPath(i).path)}return p(e,t&&t.portal)}function a(e,t,i=f.YES){if(!e)return e;!(0,r.YP)(e)&&t&&t.blockedRelativeUrls&&t.blockedRelativeUrls.push(e);let s=(0,r.hF)(e);if(t){const i=t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.rootPath||t.url&&t.url.path;if(i){const n=p(i,t.portal);s=(0,r.PF)(p(s,t.portal),n,n),s!==e&&t.verifyItemRelativeUrls&&t.verifyItemRelativeUrls.writtenUrls.push(s)}}return s=d(s,t&&t.portal),(0,r.YP)(s)&&(s=(0,r.Fv)(s)),t?.resources&&t?.portalItem&&!(0,r.YP)(s)&&!(0,r.HK)(s)&&i===f.YES&&t.resources.toKeep.push({resource:t.portalItem.resourceFromPath(s)}),s}function l(e,t,i){return n(e,i)}function o(e,t,i,s){const r=a(e,s);void 0!==r&&(t[i]=r)}const u=/\/items\/([^\/]+)\/resources\//,c=/^\.\/resources\//;function h(e){const t=(0,s.pC)(e)?e.match(u):null;return(0,s.pC)(t)?t[1]:null}function d(e,t){return t&&!t.isPortal&&t.urlKey&&t.customBaseUrl?(0,r.Ie)(e,`${t.urlKey}.${t.customBaseUrl}`,t.portalHostname):e}function p(e,t){if(!t||t.isPortal||!t.urlKey||!t.customBaseUrl)return e;const i=`${t.urlKey}.${t.customBaseUrl}`,s=(0,r.TI)();return(0,r.D6)(s,`${s.scheme}://${i}`)?(0,r.Ie)(e,t.portalHostname,i):(0,r.Ie)(e,i,t.portalHostname)}var f,y;(y=f||(f={}))[y.YES=0]="YES",y[y.NO=1]="NO";const _=Object.freeze(Object.defineProperty({__proto__:null,fromJSON:n,toJSON:a,read:l,write:o,itemIdFromResourceUrl:h,ensureMainOnlineDomain:d,get MarkKeep(){return f}},Symbol.toStringTag,{value:"Module"}))},46791:(e,t,i)=>{i.d(t,{Z:()=>E});var s,r=i(43697),n=i(3894),a=i(32448),l=i(22974),o=i(70586),u=i(71143);!function(e){e[e.ADD=1]="ADD",e[e.REMOVE=2]="REMOVE",e[e.MOVE=4]="MOVE"}(s||(s={}));var c,h=i(1654),d=i(5600),p=i(75215),f=i(52421),y=i(52011),_=i(58971),g=i(10661);const m=new u.Z(class{constructor(){this.target=null,this.cancellable=!1,this.defaultPrevented=!1,this.item=void 0,this.type=void 0}preventDefault(){this.cancellable&&(this.defaultPrevented=!0)}reset(e){this.defaultPrevented=!1,this.item=e}},void 0,(e=>{e.item=null,e.target=null,e.defaultPrevented=!1,e.cancellable=!1})),w=()=>{};function b(e){return e?e instanceof D?e.toArray():e.length?Array.prototype.slice.apply(e):[]:[]}function v(e){if(e&&e.length)return e[0]}function S(e,t,i,s){const r=Math.min(e.length-i,t.length-s);let n=0;for(;n<r&&e[i+n]===t[s+n];)n++;return n}function F(e,t,i,s){t&&t.forEach(((t,r,n)=>{e.push(t),F(e,i.call(s,t,r,n),i,s)}))}const I=new Set,C=new Set,x=new Set,R=new Map;let k=0,D=c=class extends a.Z.EventedAccessor{constructor(e){super(e),this._chgListeners=[],this._notifications=null,this._timer=null,this._observable=new g.s,this.length=0,this._items=[],Object.defineProperty(this,"uid",{value:k++})}static isCollection(e){return null!=e&&e instanceof c}normalizeCtorArgs(e){return e?Array.isArray(e)||e instanceof c?{items:e}:e:{}}destroy(){this.removeAll()}*[Symbol.iterator](){yield*this.items}get items(){return(0,_.it)(this._observable),this._items}set items(e){this._emitBeforeChanges(s.ADD)||(this._splice(0,this.length,b(e)),this._emitAfterChanges(s.ADD))}hasEventListener(e){return"change"===e?this._chgListeners.length>0:this._emitter.hasEventListener(e)}on(e,t){if("change"===e){const e=this._chgListeners,i={removed:!1,callback:t};return e.push(i),this._notifications&&this._notifications.push({listeners:e.slice(),items:this._items.slice(),changes:[]}),{remove(){this.remove=w,i.removed=!0,e.splice(e.indexOf(i),1)}}}return this._emitter.on(e,t)}once(e,t){const i=this.on(e,t);return{remove(){i.remove()}}}add(e,t){if((0,_.it)(this._observable),this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t??null);return this._splice(i,0,[e]),this._emitAfterChanges(s.ADD),this}addMany(e,t=this._items.length){if((0,_.it)(this._observable),!e||!e.length)return this;if(this._emitBeforeChanges(s.ADD))return this;const i=this.getNextIndex(t);return this._splice(i,0,b(e)),this._emitAfterChanges(s.ADD),this}at(e){if((0,_.it)(this._observable),(e=Math.trunc(e)||0)<0&&(e+=this.length),!(e<0||e>=this.length))return this._items[e]}removeAll(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return[];const e=this._splice(0,this.length)||[];return this._emitAfterChanges(s.REMOVE),e}clone(){return(0,_.it)(this._observable),this._createNewInstance({items:this._items.map(l.d9)})}concat(...e){(0,_.it)(this._observable);const t=e.map(b);return this._createNewInstance({items:this._items.concat(...t)})}drain(e,t){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const i=(0,o.j0)(this._splice(0,this.length)),r=i.length;for(let s=0;s<r;s++)e.call(t,i[s],s,i);this._emitAfterChanges(s.REMOVE)}every(e,t){return(0,_.it)(this._observable),this._items.every(e,t)}filter(e,t){let i;return(0,_.it)(this._observable),i=2===arguments.length?this._items.filter(e,t):this._items.filter(e),this._createNewInstance({items:i})}find(e,t){return(0,_.it)(this._observable),this._items.find(e,t)}findIndex(e,t){return(0,_.it)(this._observable),this._items.findIndex(e,t)}flatten(e,t){(0,_.it)(this._observable);const i=[];return F(i,this,e,t),new c(i)}forEach(e,t){return(0,_.it)(this._observable),this._items.forEach(e,t)}getItemAt(e){return(0,_.it)(this._observable),this._items[e]}getNextIndex(e){(0,_.it)(this._observable);const t=this.length;return(e=null==e?t:e)<0?e=0:e>t&&(e=t),e}includes(e,t=0){return(0,_.it)(this._observable),this._items.includes(e,t)}indexOf(e,t=0){return(0,_.it)(this._observable),this._items.indexOf(e,t)}join(e=","){return(0,_.it)(this._observable),this._items.join(e)}lastIndexOf(e,t=this.length-1){return(0,_.it)(this._observable),this._items.lastIndexOf(e,t)}map(e,t){(0,_.it)(this._observable);const i=this._items.map(e,t);return new c({items:i})}reorder(e,t=this.length-1){(0,_.it)(this._observable);const i=this.indexOf(e);if(-1!==i){if(t<0?t=0:t>=this.length&&(t=this.length-1),i!==t){if(this._emitBeforeChanges(s.MOVE))return e;this._splice(i,1),this._splice(t,0,[e]),this._emitAfterChanges(s.MOVE)}return e}}pop(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=v(this._splice(this.length-1,1));return this._emitAfterChanges(s.REMOVE),e}push(...e){return(0,_.it)(this._observable),this._emitBeforeChanges(s.ADD)||(this._splice(this.length,0,e),this._emitAfterChanges(s.ADD)),this.length}reduce(e,t){(0,_.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduce(e,t):i.reduce(e)}reduceRight(e,t){(0,_.it)(this._observable);const i=this._items;return 2===arguments.length?i.reduceRight(e,t):i.reduceRight(e)}remove(e){return(0,_.it)(this._observable),this.removeAt(this.indexOf(e))}removeAt(e){if((0,_.it)(this._observable),e<0||e>=this.length||this._emitBeforeChanges(s.REMOVE))return;const t=v(this._splice(e,1));return this._emitAfterChanges(s.REMOVE),t}removeMany(e){if((0,_.it)(this._observable),!e||!e.length||this._emitBeforeChanges(s.REMOVE))return[];const t=e instanceof c?e.toArray():e,i=this._items,r=[],n=t.length;for(let e=0;e<n;e++){const s=t[e],n=i.indexOf(s);if(n>-1){const s=1+S(t,i,e+1,n+1),a=this._splice(n,s);a&&a.length>0&&r.push.apply(r,a),e+=s-1}}return this._emitAfterChanges(s.REMOVE),r}reverse(){if((0,_.it)(this._observable),this._emitBeforeChanges(s.MOVE))return this;const e=this._splice(0,this.length);return e&&(e.reverse(),this._splice(0,0,e)),this._emitAfterChanges(s.MOVE),this}shift(){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.REMOVE))return;const e=v(this._splice(0,1));return this._emitAfterChanges(s.REMOVE),e}slice(e=0,t=this.length){return(0,_.it)(this._observable),this._createNewInstance({items:this._items.slice(e,t)})}some(e,t){return(0,_.it)(this._observable),this._items.some(e,t)}sort(e){if((0,_.it)(this._observable),!this.length||this._emitBeforeChanges(s.MOVE))return this;const t=(0,o.j0)(this._splice(0,this.length));return arguments.length?t.sort(e):t.sort(),this._splice(0,0,t),this._emitAfterChanges(s.MOVE),this}splice(e,t,...i){(0,_.it)(this._observable);const r=(t?s.REMOVE:0)|(i.length?s.ADD:0);if(this._emitBeforeChanges(r))return[];const n=this._splice(e,t,i)||[];return this._emitAfterChanges(r),n}toArray(){return(0,_.it)(this._observable),this._items.slice()}toJSON(){return(0,_.it)(this._observable),this.toArray()}toLocaleString(){return(0,_.it)(this._observable),this._items.toLocaleString()}toString(){return(0,_.it)(this._observable),this._items.toString()}unshift(...e){return(0,_.it)(this._observable),!e.length||this._emitBeforeChanges(s.ADD)||(this._splice(0,0,e),this._emitAfterChanges(s.ADD)),this.length}_createNewInstance(e){return new this.constructor(e)}_splice(e,t,i){const s=this._items,r=this.itemType;let n,a;if(!this._notifications&&this.hasEventListener("change")&&(this._notifications=[{listeners:this._chgListeners.slice(),items:this._items.slice(),changes:[]}],this._timer&&this._timer.remove(),this._timer=(0,h.Os)((()=>this._dispatchChange()))),t){if(a=s.splice(e,t),this.hasEventListener("before-remove")){const t=m.acquire();t.target=this,t.cancellable=!0;for(let i=0,r=a.length;i<r;i++)n=a[i],t.reset(n),this.emit("before-remove",t),t.defaultPrevented&&(a.splice(i,1),s.splice(e,0,n),e+=1,i-=1,r-=1);m.release(t)}if(this.length=this._items.length,this.hasEventListener("after-remove")){const e=m.acquire();e.target=this,e.cancellable=!1;const t=a.length;for(let i=0;i<t;i++)e.reset(a[i]),this.emit("after-remove",e);m.release(e)}}if(i&&i.length){if(r){const e=[];for(const t of i){const i=r.ensureType(t);null==i&&null!=t||e.push(i)}i=e}const t=this.hasEventListener("before-add"),n=this.hasEventListener("after-add"),a=e===this.length;if(t||n){const r=m.acquire();r.target=this,r.cancellable=!0;const l=m.acquire();l.target=this,l.cancellable=!1;for(const o of i)t?(r.reset(o),this.emit("before-add",r),r.defaultPrevented||(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),n&&(l.reset(o),this.emit("after-add",l)))):(a?s.push(o):s.splice(e++,0,o),this._set("length",s.length),l.reset(o),this.emit("after-add",l));m.release(l),m.release(r)}else{if(a)for(const e of i)s.push(e);else s.splice(e,0,...i);this._set("length",s.length)}}return(i&&i.length||a&&a.length)&&this._notifyChangeEvent(i,a),a}_emitBeforeChanges(e){let t=!1;if(this.hasEventListener("before-changes")){const i=m.acquire();i.target=this,i.cancellable=!0,i.type=e,this.emit("before-changes",i),t=i.defaultPrevented,m.release(i)}return t}_emitAfterChanges(e){if(this.hasEventListener("after-changes")){const t=m.acquire();t.target=this,t.cancellable=!1,t.type=e,this.emit("after-changes",t),m.release(t)}this._observable.notify()}_notifyChangeEvent(e,t){this.hasEventListener("change")&&this._notifications&&this._notifications[this._notifications.length-1].changes.push({added:e,removed:t})}_dispatchChange(){if(this._timer&&(this._timer.remove(),this._timer=null),!this._notifications)return;const e=this._notifications;this._notifications=null;for(const t of e){const e=t.changes;I.clear(),C.clear(),x.clear();for(const{added:t,removed:i}of e){if(t)if(0===x.size&&0===C.size)for(const e of t)I.add(e);else for(const e of t)C.has(e)?(x.add(e),C.delete(e)):x.has(e)||I.add(e);if(i)if(0===x.size&&0===I.size)for(const e of i)C.add(e);else for(const e of i)I.has(e)?I.delete(e):(x.delete(e),C.add(e))}const i=n.Z.acquire();I.forEach((e=>{i.push(e)}));const s=n.Z.acquire();C.forEach((e=>{s.push(e)}));const r=this._items,a=t.items,l=n.Z.acquire();if(x.forEach((e=>{a.indexOf(e)!==r.indexOf(e)&&l.push(e)})),t.listeners&&(i.length||s.length||l.length)){const e={target:this,added:i,removed:s,moved:l},r=t.listeners.length;for(let i=0;i<r;i++){const s=t.listeners[i];s.removed||s.callback.call(this,e)}}n.Z.release(i),n.Z.release(s),n.Z.release(l)}I.clear(),C.clear(),x.clear()}};D.ofType=e=>{if(!e)return c;if(R.has(e))return R.get(e);let t=null;if("function"==typeof e)t=e.prototype.declaredClass;else if(e.base)t=e.base.prototype.declaredClass;else for(const i in e.typeMap){const s=e.typeMap[i].prototype.declaredClass;t?t+=` | ${s}`:t=s}let i=class extends c{};return(0,r._)([(0,f.c)({Type:e,ensureType:"function"==typeof e?(0,p.se)(e):(0,p.N7)(e)})],i.prototype,"itemType",void 0),i=(0,r._)([(0,y.j)(`esri.core.Collection<${t}>`)],i),R.set(e,i),i},(0,r._)([(0,d.Cb)()],D.prototype,"length",void 0),(0,r._)([(0,d.Cb)()],D.prototype,"items",null),D=c=(0,r._)([(0,y.j)("esri.core.Collection")],D);const E=D},32448:(e,t,i)=>{i.d(t,{Z:()=>o});var s=i(43697),r=i(15923),n=i(50758),a=i(52011);class l{constructor(){this._emitter=new l.EventEmitter(this)}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}}!function(e){class t{constructor(e=null){this.target=e,this._listenersMap=null}clear(){this._listenersMap&&this._listenersMap.clear(),this._listenersMap=null}emit(e,t){const i=this._listenersMap&&this._listenersMap.get(e);if(!i)return!1;const s=this.target||this;return[...i].forEach((e=>{e.call(s,t)})),i.length>0}on(e,t){if(Array.isArray(e)){const i=e.map((e=>this.on(e,t)));return(0,n.AL)(i)}if(e.includes(","))throw new TypeError("Evented.on() with a comma delimited string of event types is not supported");this._listenersMap||(this._listenersMap=new Map);const i=this._listenersMap.get(e)||[];return i.push(t),this._listenersMap.set(e,i),{remove:()=>{const i=this._listenersMap&&this._listenersMap.get(e)||[],s=i.indexOf(t);s>=0&&i.splice(s,1)}}}once(e,t){const i=this.on(e,(e=>{i.remove(),t.call(null,e)}));return i}hasEventListener(e){const t=this._listenersMap&&this._listenersMap.get(e);return null!=t&&t.length>0}}e.EventEmitter=t,e.EventedMixin=e=>{let i=class extends e{constructor(){super(...arguments),this._emitter=new t}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};return i=(0,s._)([(0,a.j)("esri.core.Evented")],i),i};let i=class extends r.Z{constructor(){super(...arguments),this._emitter=new l.EventEmitter(this)}destroy(){this._emitter.clear()}emit(e,t){return this._emitter.emit(e,t)}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}hasEventListener(e){return this._emitter.hasEventListener(e)}};i=(0,s._)([(0,a.j)("esri.core.Evented")],i),e.EventedAccessor=i}(l||(l={}));const o=l},61247:(e,t,i)=>{i.d(t,{Z:()=>c});var s=i(43697),r=i(15923),n=i(46791),a=i(70586),l=i(5600),o=i(52011);let u=class extends r.Z{constructor(e){super(e),this._groups=new Map}destroy(){this.removeAll()}get size(){let e=0;return this._groups.forEach((t=>{e+=t.length})),e}add(e,t){if(!this._isHandle(e)&&!Array.isArray(e)&&!n.Z.isCollection(e))return this;const i=this._getOrCreateGroup(t);return Array.isArray(e)||n.Z.isCollection(e)?e.forEach((e=>this._isHandle(e)&&i.push(e))):i.push(e),this.notifyChange("size"),this}forEach(e,t){if("function"==typeof e)this._groups.forEach((t=>t.forEach(e)));else{const i=this._getGroup(e);i&&t&&i.forEach(t)}}has(e){return this._groups.has(this._ensureGroupKey(e))}remove(e){if(Array.isArray(e)||n.Z.isCollection(e))return e.forEach(this.remove,this),this;if(!this.has(e))return this;const t=this._getGroup(e);for(let e=0;e<t.length;e++)t[e].remove();return this._deleteGroup(e),this.notifyChange("size"),this}removeAll(){return this._groups.forEach((e=>{for(let t=0;t<e.length;t++)e[t].remove()})),this._groups.clear(),this.notifyChange("size"),this}_isHandle(e){return e&&!!e.remove}_getOrCreateGroup(e){if(this.has(e))return this._getGroup(e);const t=[];return this._groups.set(this._ensureGroupKey(e),t),t}_getGroup(e){return(0,a.j0)(this._groups.get(this._ensureGroupKey(e)))}_deleteGroup(e){return this._groups.delete(this._ensureGroupKey(e))}_ensureGroupKey(e){return e||"_default_"}};(0,s._)([(0,l.Cb)({readOnly:!0})],u.prototype,"size",null),u=(0,s._)([(0,o.j)("esri.core.Handles")],u);const c=u},69801:(e,t,i)=>{i.d(t,{WJ:()=>o,Xq:()=>l});var s,r,n=i(70586),a=i(44553);(r=s||(s={}))[r.ALL=0]="ALL",r[r.SOME=1]="SOME";class l{constructor(e,t,i){this._namespace=e,this._storage=t,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),this._namespace+=":",i&&(this._storage.registerRemoveFunc(this._namespace,i),this._removeFunc=!0)}destroy(){this._storage.clear(this._namespace),this._removeFunc&&this._storage.deregisterRemoveFunc(this._namespace),this._storage.deregister(this),this._storage=null}get namespace(){return this._namespace.slice(0,-1)}get hitRate(){return this._hit/(this._hit+this._miss)}get size(){return this._storage.size}get maxSize(){return this._storage.maxSize}resetHitRate(){this._hit=this._miss=0}put(e,t,i,s=0){this._storage.put(this._namespace+e,t,i,s)}get(e){const t=this._storage.get(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}pop(e){const t=this._storage.pop(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}updateSize(e,t,i){this._storage.updateSize(this._namespace+e,t,i)}clear(){this._storage.clear(this._namespace)}clearAll(){this._storage.clearAll()}getStats(){return this._storage.getStats()}resetStats(){this._storage.resetStats()}}class o{constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new a.Z,this._users=new a.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,t){this._removeFuncs.push([e,t])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace((t=>t[0]!==e))}get size(){return this._size}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimit()}put(e,t,i,r){const n=this._db.get(e);if(n&&(this._size-=n.size,this._db.delete(e),n.entry!==t&&this._notifyRemove(e,n.entry,s.ALL)),i>this._maxSize)return void this._notifyRemove(e,t,s.ALL);if(void 0===t)return void console.warn("Refusing to cache undefined entry ");if(!i||i<0)return void console.warn("Refusing to cache entry with invalid size "+i);const a=1+Math.max(r,-3)- -3;this._db.set(e,{entry:t,size:i,lifetime:a,lives:a}),this._size+=i,this._checkSizeLimit()}updateSize(e,t,i){const r=this._db.get(e);if(r&&r.entry===t){for(this._size-=r.size;i>this._maxSize;){const r=this._notifyRemove(e,t,s.SOME);if(!((0,n.pC)(r)&&r>0))return void this._db.delete(e);i=r}r.size=i,this._size+=i,this._checkSizeLimit()}}pop(e){const t=this._db.get(e);if(t)return this._size-=t.size,this._db.delete(e),++this._hit,t.entry;++this._miss}get(e){const t=this._db.get(e);if(void 0!==t)return this._db.delete(e),t.lives=t.lifetime,this._db.set(e,t),++this._hit,t.entry;++this._miss}getStats(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},i=new Array;this._db.forEach(((e,s)=>{const r=e.lifetime;i[r]=(i[r]||0)+e.size,this._users.forAll((i=>{const r=i.namespace;if(s.startsWith(r)){const i=t[r]||0;t[r]=i+e.size}}))}));const s={};this._users.forAll((e=>{const i=e.namespace;if(!isNaN(e.hitRate)&&e.hitRate>0){const r=t[i]||0;t[i]=r,s[i]=Math.round(100*e.hitRate)+"%"}else s[i]="0%"}));const r=Object.keys(t);r.sort(((e,i)=>t[i]-t[e])),r.forEach((i=>e[i]=Math.round(t[i]/2**20)+"MB / "+s[i]));for(let t=i.length-1;t>=0;--t){const s=i[t];s&&(e["Priority "+(t+-3-1)]=Math.round(s/this.size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll((e=>e.resetHitRate()))}clear(e){this._db.forEach(((t,i)=>{i.startsWith(e)&&(this._size-=t.size,this._db.delete(i),this._notifyRemove(i,t.entry,s.ALL))}))}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,s.ALL))),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,i){let s;return this._removeFuncs.some((r=>{if(e.startsWith(r[0])){const e=r[1](t,i);return"number"==typeof e&&(s=e),!0}return!1})),s}_checkSizeLimit(){if(!(this._size<=this._maxSize))for(const[e,t]of this._db){if(this._db.delete(e),t.lives<=1){this._size-=t.size;const i=this._notifyRemove(e,t.entry,s.SOME);(0,n.pC)(i)&&i>0&&(this._size+=i,t.lives=t.lifetime,t.size=i,this._db.set(e,t))}else--t.lives,this._db.set(e,t);if(this._size<=.9*this.maxSize)return}}}},52421:(e,t,i)=>{function s(e){return(t,i)=>{t[i]=e}}i.d(t,{c:()=>s})},22862:(e,t,i)=>{i.d(t,{Hg:()=>y,V7:()=>f,uD:()=>p});var s=i(15923),r=i(46791),n=i(70586),a=i(1153);const l=["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"];function o(e){return e instanceof s.Z}function u(e){return e instanceof r.Z?Object.keys(e.items):o(e)?(0,a.vw)(e).keys():e?Object.keys(e):[]}function c(e,t){return e instanceof r.Z?e.items[t]:e[t]}function h(e){return e?e.declaredClass:null}function d(e,t){const i=e.diff;if(i&&"function"==typeof i)return i(e,t);const s=u(e),r=u(t);if(0===s.length&&0===r.length)return;if(!s.length||!r.length||function(e,t){return!(!Array.isArray(e)||!Array.isArray(t))&&e.length!==t.length}(e,t))return{type:"complete",oldValue:e,newValue:t};const a=r.filter((e=>!s.includes(e))),p=s.filter((e=>!r.includes(e))),f=s.filter((i=>r.includes(i)&&c(e,i)!==c(t,i))).concat(a,p).sort(),y=h(e);if(y&&l.includes(y)&&f.length)return{type:"complete",oldValue:e,newValue:t};let _;const g=o(e)&&o(t);for(const s of f){const r=c(e,s),a=c(t,s);let l;if((g||"function"!=typeof r&&"function"!=typeof a)&&r!==a&&(null!=r||null!=a)){if(i&&i[s]&&"function"==typeof i[s])l=i[s](r,a);else if(r instanceof Date&&a instanceof Date){if(r.getTime()===a.getTime())continue;l={type:"complete",oldValue:r,newValue:a}}else l="object"==typeof r&&"object"==typeof a&&h(r)===h(a)?d(r,a):{type:"complete",oldValue:r,newValue:a};(0,n.pC)(l)&&((0,n.pC)(_)?_.diff[s]=l:_={type:"partial",diff:{[s]:l}})}}return _}function p(e,t){if((0,n.Wi)(e))return!1;const i=t.split(".");let s=e;for(const e of i){if("complete"===s.type)return!0;if("partial"!==s.type)return!1;{const t=s.diff[e];if(!t)return!1;s=t}}return!0}function f(e,t){for(const i of t)if(p(e,i))return!0;return!1}function y(e,t){if(!("function"==typeof e||"function"==typeof t||(0,n.Wi)(e)&&(0,n.Wi)(t)))return(0,n.Wi)(e)||(0,n.Wi)(t)||"object"==typeof e&&"object"==typeof t&&h(e)!==h(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},10661:(e,t,i)=>{i.d(t,{s:()=>r});var s=i(39020);class r{constructor(){this._observers=[]}observe(e){return this._observers.includes(e)||this._observers.push(e),new s.X(this._observers,e)}notify(){const e=this._observers.slice();for(let t=0;t<e.length;++t){const i=e[t];i.onInvalidated(),i.onCommitted()}}}},66643:(e,t,i)=>{i.d(t,{Ed:()=>n,UI:()=>a,mt:()=>o,q6:()=>l});var s=i(70586),r=i(95330);function n(e,t,i){return(0,r.as)(e.map(((e,s)=>t.apply(i,[e,s]))))}async function a(e,t,i){return(await(0,r.as)(e.map(((e,s)=>t.apply(i,[e,s]))))).map((e=>e.value))}async function l(e){if((0,s.Wi)(e))return{ok:!1,error:new Error("no promise provided")};try{return{ok:!0,value:await e}}catch(e){return{ok:!1,error:e}}}async function o(e){try{return{ok:!0,value:await e}}catch(e){return(0,r.r9)(e),{ok:!1,error:e}}}},17445:(e,t,i)=>{i.d(t,{N1:()=>d,YP:()=>o,Z_:()=>y,gx:()=>u,nn:()=>_,on:()=>h,tX:()=>g});var s=i(91460),r=i(50758),n=i(70586),a=i(95330),l=i(26258);function o(e,t,i={}){return c(e,t,i,p)}function u(e,t,i={}){return c(e,t,i,f)}function c(e,t,i={},s){let r=null;const a=i.once?(e,i)=>{s(e)&&((0,n.hw)(r),t(e,i))}:(e,i)=>{s(e)&&t(e,i)};if(r=(0,l.aQ)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return r}function h(e,t,i,a={}){let l=null,u=null,c=null;function h(){l&&u&&(u.remove(),a.onListenerRemove?.(l),l=null,u=null)}function d(e){a.once&&a.once&&(0,n.hw)(c),i(e)}const p=o(e,((e,i)=>{h(),(0,s.vT)(e)&&(l=e,u=(0,s.on)(e,t,d),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return c=(0,r.kB)((()=>{p.remove(),h()})),c}function d(e,t){return function(e,t,i){if((0,a.Hc)(i))return Promise.reject((0,a.zE)());const s=e();if(t?.(s))return Promise.resolve(s);let l=null;function o(){l=(0,n.hw)(l)}return new Promise(((s,n)=>{l=(0,r.AL)([(0,a.fu)(i,(()=>{o(),n((0,a.zE)())})),c(e,(e=>{o(),s(e)}),{sync:!1,once:!0},t??p)])}))}(e,f,t)}function p(e){return!0}function f(e){return!!e}i(87538);const y={sync:!0},_={initial:!0},g={sync:!0,initial:!0}},42033:(e,t,i)=>{i.d(t,{E:()=>r,_:()=>n});var s=i(70586);async function r(e,t){const{WhereClause:s}=await Promise.resolve().then(i.bind(i,41534));return s.create(e,t)}function n(e,t){return(0,s.pC)(e)?(0,s.pC)(t)?`(${e}) AND (${t})`:e:t}},60437:(e,t,i)=>{i.d(t,{Gv:()=>m,HH:()=>l,JR:()=>y,TC:()=>o,Tn:()=>d,Ue:()=>n,al:()=>a,cS:()=>f,dp:()=>c,fS:()=>g,op:()=>h,pp:()=>u,t8:()=>p});var s=i(70586),r=i(6570);function n(e=w){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function a(e,t,i,s,r,a,l=n()){return l[0]=e,l[1]=t,l[2]=i,l[3]=s,l[4]=r,l[5]=a,l}function l(e,t){const i=isFinite(e[2])||isFinite(e[5]);return new r.Z(i?{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],zmin:e[2],zmax:e[5],spatialReference:t}:{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],spatialReference:t})}function o(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e[4]=Math.max(e[4],t[4]),e[5]=Math.max(e[5],t[5])}function u(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[0]),e[4]=Math.max(e[4],t[1]),e[5]=Math.max(e[5],t[2])}function c(e,t=[0,0,0]){return t[0]=function(e){return e[0]>=e[3]?0:e[3]-e[0]}(e),t[1]=function(e){return e[1]>=e[4]?0:e[4]-e[1]}(e),t[2]=function(e){return e[2]>=e[5]?0:e[5]-e[2]}(e),t}function h(e,t,i=e){return i[0]=t[0],i[1]=t[1],i[2]=t[2],i!==e&&(i[3]=e[3],i[4]=e[4],i[5]=e[5]),i}function d(e,t,i=e){return i[3]=t[0],i[4]=t[1],i[5]=t[2],i!==e&&(i[0]=e[0],i[1]=e[1],i[2]=e[2]),e}function p(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function f(e){return e?p(e,m):n(m)}function y(e,t){return e[0]=t[0],e[1]=t[1],e[2]=Number.NEGATIVE_INFINITY,e[3]=t[2],e[4]=t[3],e[5]=Number.POSITIVE_INFINITY,e}function _(e){return 6===e.length}function g(e,t,i){if((0,s.Wi)(e)||(0,s.Wi)(t))return e===t;if(!_(e)||!_(t))return!1;if(i){for(let s=0;s<e.length;s++)if(!i(e[s],t[s]))return!1}else for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}i(24470);const m=[1/0,1/0,1/0,-1/0,-1/0,-1/0],w=[0,0,0,0,0,0];n()},24470:(e,t,i)=>{i.d(t,{HH:()=>o,SO:()=>u,Ue:()=>n,al:()=>a,cS:()=>p,jE:()=>c,kK:()=>h,oJ:()=>l,r3:()=>d}),i(80442),i(22021);var s=i(70586),r=i(6570);function n(e=y){return[e[0],e[1],e[2],e[3]]}function a(e,t,i,s,r=n()){return r[0]=e,r[1]=t,r[2]=i,r[3]=s,r}function l(e,t=n()){return t[0]=e.xmin,t[1]=e.ymin,t[2]=e.xmax,t[3]=e.ymax,t}function o(e,t){return new r.Z({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:t})}function u(e){return function(e){return(0,s.Wi)(e)||e[0]>=e[2]?0:e[2]-e[0]}(e)*function(e){return e[1]>=e[3]?0:e[3]-e[1]}(e)}function c(e,t,i){return t>=e[0]&&i>=e[1]&&t<=e[2]&&i<=e[3]}function h(e,t){return Math.max(t[0],e[0])<=Math.min(t[2],e[2])&&Math.max(t[1],e[1])<=Math.min(t[3],e[3])}function d(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}function p(e){return e?function(e,t){return e!==t&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3]),e}(e,f):n(f)}const f=[1/0,1/0,-1/0,-1/0],y=[0,0,0,0]},82526:(e,t,i)=>{i.d(t,{aX:()=>x});var s=i(68773),r=i(20102),n=i(92604),a=i(70586),l=i(38913),o=i(58901),u=i(82971),c=i(33955);const h={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new o.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator}),minus180Line:new o.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new o.Z({paths:[[[180,-180],[180,180]]],spatialReference:u.Z.WGS84}),minus180Line:new o.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:u.Z.WGS84})}};function d(e,t){return Math.ceil((e-t)/(2*t))}function p(e,t){const i=f(e);for(const e of i)for(const i of e)i[0]+=t;return e}function f(e){return(0,c.oU)(e)?e.rings:e.paths}var y=i(8744),_=i(40488),g=(i(66577),i(3172)),m=i(17452);function w(e){return{geometryType:(0,c.Ji)(e[0]),geometries:e.map((e=>e.toJSON()))}}const b=n.Z.getLogger("esri.geometry.support.normalizeUtils");function v(e){return"polygon"===e[0].type}function S(e){return"polyline"===e[0].type}function F(e,t,i){if(t){const t=function(e,t){if(!(e instanceof o.Z||e instanceof l.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw b.error(e),new r.Z(e)}const i=f(e),s=[];for(const e of i){const i=[];s.push(i),i.push([e[0][0],e[0][1]]);for(let s=0;s<e.length-1;s++){const r=e[s][0],n=e[s][1],a=e[s+1][0],l=e[s+1][1],o=Math.sqrt((a-r)*(a-r)+(l-n)*(l-n)),u=(l-n)/o,c=(a-r)/o,h=o/t;if(h>1){for(let e=1;e<=h-1;e++){const s=e*t,a=c*s+r,l=u*s+n;i.push([a,l])}const e=(o+Math.floor(h-1)*t)/2,s=c*e+r,a=u*e+n;i.push([s,a])}i.push([a,l])}}return function(e){return"polygon"===e.type}(e)?new l.Z({rings:s,spatialReference:e.spatialReference}):new o.Z({paths:s,spatialReference:e.spatialReference})}(e,1e6);e=(0,_.Sx)(t,!0)}return i&&(e=p(e,i)),e}function I(e,t,i){if(Array.isArray(e)){const s=e[0];if(s>t){const i=d(s,t);e[0]=s+i*(-2*t)}else if(s<i){const t=d(s,i);e[0]=s+t*(-2*i)}}else{const s=e.x;if(s>t){const i=d(s,t);e=e.clone().offset(i*(-2*t),0)}else if(s<i){const t=d(s,i);e=e.clone().offset(t*(-2*i),0)}}return e}function C(e,t){let i=-1;for(let s=0;s<t.cutIndexes.length;s++){const r=t.cutIndexes[s],n=t.geometries[s],a=f(n);for(let e=0;e<a.length;e++){const t=a[e];t.some((i=>{if(i[0]<180)return!0;{let i=0;for(let e=0;e<t.length;e++){const s=t[e][0];i=s>i?s:i}i=Number(i.toFixed(9));const s=-360*d(i,180);for(let i=0;i<t.length;i++){const t=n.getPoint(e,i);n.setPoint(e,i,t.clone().offset(s,0))}return!0}}))}if(r===i){if(v(e))for(const t of f(n))e[r]=e[r].addRing(t);else if(S(e))for(const t of f(n))e[r]=e[r].addPath(t)}else i=r,e[r]=n}return e}async function x(e,t,i){if(!Array.isArray(e))return x([e],t);t&&"string"!=typeof t&&b.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const r="string"==typeof t?t:t?.url??s.Z.geometryServiceUrl;let n,u,f,v,S,R,k,D,E=0;const T=[],A=[];for(const t of e)if((0,a.Wi)(t))A.push(t);else if(n||(n=t.spatialReference,u=(0,y.C5)(n),f=n.isWebMercator,R=f?102100:4326,v=h[R].maxX,S=h[R].minX,k=h[R].plus180Line,D=h[R].minus180Line),u)if("mesh"===t.type)A.push(t);else if("point"===t.type)A.push(I(t.clone(),v,S));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>I(e,v,S))),A.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,u);A.push(e.rings?new l.Z(e):e)}else if(t.extent){const e=t.extent,i=d(e.xmin,S)*(2*v);let s=0===i?t.clone():p(t.clone(),i);e.offset(i,0),e.intersects(k)&&e.xmax!==v?(E=e.xmax>E?e.xmax:E,s=F(s,f),T.push(s),A.push("cut")):e.intersects(D)&&e.xmin!==S?(E=e.xmax*(2*v)>E?e.xmax*(2*v):E,s=F(s,f,360),T.push(s),A.push("cut")):A.push(s)}else A.push(t.clone());else A.push(t);let N=d(E,v),L=-90;const O=N,P=new o.Z;for(;N>0;){const e=360*N-180;P.addPath([[e,L],[e,-1*L]]),L*=-1,N--}if(T.length>0&&O>0){const t=C(T,await async function(e,t,i,s){const r="string"==typeof e?(0,m.mN)(e):e,n=t[0].spatialReference,a={...s,query:{...r.query,f:"json",sr:JSON.stringify(n),target:JSON.stringify({geometryType:(0,c.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(i)}},l=await(0,g.default)(r.path+"/cut",a),{cutIndexes:o,geometries:u=[]}=l.data;return{cutIndexes:o,geometries:u.map((e=>{const t=(0,c.im)(e);return t.spatialReference=n,t}))}}(r,T,P,i)),s=[],n=[];for(let i=0;i<A.length;i++){const r=A[i];if("cut"!==r)n.push(r);else{const r=t.shift(),l=e[i];(0,a.pC)(l)&&"polygon"===l.type&&l.rings&&l.rings.length>1&&r.rings.length>=l.rings.length?(s.push(r),n.push("simplify")):n.push(f?(0,_.$)(r):r)}}if(!s.length)return n;const l=await async function(e,t,i){const s="string"==typeof e?(0,m.mN)(e):e,r=t[0].spatialReference,n=(0,c.Ji)(t[0]),a={...i,query:{...s.query,f:"json",sr:r.wkid?r.wkid:JSON.stringify(r),geometries:JSON.stringify(w(t))}};return function(e,t,i){const s=(0,c.q9)(t);return e.map((e=>{const t=s.fromJSON(e);return t.spatialReference=i,t}))}((await(0,g.default)(s.path+"/simplify",a)).data,n,r)}(r,s,i),o=[];for(let e=0;e<n.length;e++){const t=n[e];"simplify"!==t?o.push(t):o.push(f?(0,_.$)(l.shift()):l.shift())}return o}const j=[];for(let e=0;e<A.length;e++){const t=A[e];if("cut"!==t)j.push(t);else{const e=T.shift();j.push(!0===f?(0,_.$)(e):e)}}return j}},69285:(e,t,i)=>{i.d(t,{k:()=>a});var s=i(70586),r=i(67900),n=i(8744);function a(e,t,i){if((0,s.Wi)(t)||(0,s.Wi)(i)||i.vcsWkid||(0,n.fS)(t,i))return null;const a=(0,r._R)(t)/(0,r._R)(i);if(1===a)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){e&&null!=e.z&&(e.z*=t)}(e,a);case"polyline":case"esriGeometryPolyline":return e=>function(e,t){if(e)for(const i of e.paths)for(const e of i)e.length>2&&(e[2]*=t)}(e,a);case"polygon":case"esriGeometryPolygon":return e=>function(e,t){if(e)for(const i of e.rings)for(const e of i)e.length>2&&(e[2]*=t)}(e,a);case"multipoint":case"esriGeometryMultipoint":return e=>function(e,t){if(e)for(const i of e.points)i.length>2&&(i[2]*=t)}(e,a);case"extent":case"esriGeometryExtent":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,a);default:return null}}},54295:(e,t,i)=>{i.d(t,{V:()=>a});var s=i(43697),r=i(5600),n=(i(67676),i(80442),i(75215),i(52011));const a=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,s._)([(0,r.Cb)({type:String})],t.prototype,"apiKey",null),t=(0,s._)([(0,n.j)("esri.layers.mixins.APIKeyMixin")],t),t}},17287:(e,t,i)=>{i.d(t,{Y:()=>u});var s=i(43697),r=i(92604),n=i(70586),a=i(5600),l=(i(67676),i(80442),i(75215),i(52011)),o=i(66677);const u=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,o.Qc)(this.url);if((0,n.pC)(e)&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,o.Nm)(e,r.Z.getLogger(this.declaredClass)))}};return(0,s._)([(0,a.Cb)()],t.prototype,"title",null),(0,s._)([(0,a.Cb)({type:String})],t.prototype,"url",null),t=(0,s._)([(0,l.j)("esri.layers.mixins.ArcGISService")],t),t}},16859:(e,t,i)=>{i.d(t,{I:()=>b});var s=i(43697),r=i(40330),n=i(3172),a=i(66643),l=i(20102),o=i(92604),u=i(70586),c=i(95330),h=i(17452),d=i(5600),p=(i(67676),i(80442),i(75215),i(71715)),f=i(52011),y=i(30556),_=i(65587),g=i(15235),m=i(86082);const w=o.Z.getLogger("esri.layers.mixins.PortalLayer"),b=e=>{let t=class extends e{constructor(){super(...arguments),this.resourceReferences={portalItem:null,paths:[]},this.userHasEditingPrivileges=!0}destroy(){this.portalItem?.destroy(),this.portalItem=null}set portalItem(e){e!==this._get("portalItem")&&(this.removeOrigin("portal-item"),this._set("portalItem",e))}readPortalItem(e,t,i){if(t.itemId)return new g.default({id:t.itemId,portal:i&&i.portal})}writePortalItem(e,t){e&&e.id&&(t.itemId=e.id)}async loadFromPortal(e,t){if(this.portalItem&&this.portalItem.id)try{const s=await i.e(8062).then(i.bind(i,18062));return(0,c.k_)(t),await s.load({instance:this,supportedTypes:e.supportedTypes,validateItem:e.validateItem,supportsData:e.supportsData},t)}catch(e){throw(0,c.D_)(e)||w.warn(`Failed to load layer (${this.title}, ${this.id}) portal item (${this.portalItem.id})\n ${e}`),e}}async finishLoadEditablePortalLayer(e){this._set("userHasEditingPrivileges",await this._fetchUserHasEditingPrivileges(e).catch((e=>((0,c.r9)(e),!0))))}async _fetchUserHasEditingPrivileges(e){const t=this.url?r.id?.findCredential(this.url):null;if(!t)return!0;const i=v.credential===t?v.user:await this._fetchEditingUser(e);return v.credential=t,v.user=i,(0,u.Wi)(i)||null==i.privileges||i.privileges.includes("features:user:edit")}async _fetchEditingUser(e){const t=this.portalItem?.portal?.user;if(t)return t;const i=r.id.findServerInfo(this.url);if(!i?.owningSystemUrl)return null;const s=`${i.owningSystemUrl}/sharing/rest`,l=_.Z.getDefault();if(l&&l.loaded&&(0,h.Fv)(l.restUrl)===(0,h.Fv)(s))return l.user;const o=`${s}/community/self`,c=(0,u.pC)(e)?e.signal:null,d=await(0,a.q6)((0,n.default)(o,{authMode:"no-prompt",query:{f:"json"},signal:c}));return d.ok?m.default.fromJSON(d.value.data):null}read(e,t){t&&(t.layer=this),super.read(e,t)}write(e,t){const i=t&&t.portal,s=this.portalItem&&this.portalItem.id&&(this.portalItem.portal||_.Z.getDefault());return i&&s&&!(0,h.tm)(s.restUrl,i.restUrl)?(t.messages&&t.messages.push(new l.Z("layer:cross-portal",`The layer '${this.title} (${this.id})' cannot be persisted because it refers to an item on a different portal than the one being saved to. To save, set layer.portalItem to null or save to the same portal as the item associated with the layer`,{layer:this})),null):super.write(e,{...t,layer:this})}};return(0,s._)([(0,d.Cb)({type:g.default})],t.prototype,"portalItem",null),(0,s._)([(0,p.r)("web-document","portalItem",["itemId"])],t.prototype,"readPortalItem",null),(0,s._)([(0,y.c)("web-document","portalItem",{itemId:{type:String}})],t.prototype,"writePortalItem",null),(0,s._)([(0,d.Cb)({clonable:!1})],t.prototype,"resourceReferences",void 0),(0,s._)([(0,d.Cb)({readOnly:!0})],t.prototype,"userHasEditingPrivileges",void 0),t=(0,s._)([(0,f.j)("esri.layers.mixins.PortalLayer")],t),t},v={credential:null,user:null}},56765:(e,t,i)=>{i.d(t,{Z:()=>c});var s,r=i(43697),n=i(46791),a=i(96674),l=i(5600),o=(i(67676),i(80442),i(75215),i(52011));let u=s=class extends a.wq{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new n.Z}clone(){return new s({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,r._)([(0,l.Cb)({type:String,json:{write:!0}})],u.prototype,"floorField",void 0),(0,r._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllMode",void 0),(0,r._)([(0,l.Cb)({json:{read:!1,write:!1}})],u.prototype,"viewAllLevelIds",void 0),u=s=(0,r._)([(0,o.j)("esri.layers.support.LayerFloorInfo")],u);const c=u},66677:(e,t,i)=>{i.d(t,{B5:()=>h,DR:()=>p,G:()=>b,M8:()=>_,Nm:()=>g,Qc:()=>d,XG:()=>m,a7:()=>y,ld:()=>f,wH:()=>w});var s=i(70586),r=i(17452),n=i(25929);const a={mapserver:"MapServer",imageserver:"ImageServer",featureserver:"FeatureServer",sceneserver:"SceneServer",streamserver:"StreamServer",vectortileserver:"VectorTileServer"},l=Object.values(a),o=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/rest\\/services\\/(.+?)\\/(${l.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),u=new RegExp(`^((?:https?:)?\\/\\/\\S+?\\/([^\\/\\n]+)\\/(${l.join("|")}))(?:\\/(?:layers\\/)?(\\d+))?`,"i"),c=/(.*?)\/(?:layers\/)?(\d+)\/?$/i;function h(e){return!!o.test(e)}function d(e){if((0,s.Wi)(e))return null;const t=(0,r.mN)(e),i=t.path.match(o)||t.path.match(u);if(!i)return null;const[,n,l,c,h]=i,d=l.indexOf("/");return{title:f(-1!==d?l.slice(d+1):l),serverType:a[c.toLowerCase()],sublayer:null!=h&&""!==h?parseInt(h,10):null,url:{path:n}}}function p(e){const t=(0,r.mN)(e).path.match(c);return t?{serviceUrl:t[1],sublayerId:Number(t[2])}:null}function f(e){return(e=e.replace(/\s*[/_]+\s*/g," "))[0].toUpperCase()+e.slice(1)}function y(e,t){const i=[];if(e){const t=d(e);(0,s.pC)(t)&&t.title&&i.push(t.title)}if(t){const e=f(t);i.push(e)}if(2===i.length){if(i[0].toLowerCase().includes(i[1].toLowerCase()))return i[0];if(i[1].toLowerCase().includes(i[0].toLowerCase()))return i[1]}return i.join(" - ")}function _(e){if(!e)return!1;const t=(e=e.toLowerCase()).includes(".arcgis.com/"),i=e.includes("//services")||e.includes("//tiles")||e.includes("//features");return t&&i}function g(e,t){return e?(0,r.Qj)((0,r.Hu)(e,t)):e}function m(e){let{url:t}=e;if(!t)return{url:t};t=(0,r.Hu)(t,e.logger);const i=(0,r.mN)(t),n=d(i.path);let a;if((0,s.pC)(n))null!=n.sublayer&&null==e.layer.layerId&&(a=n.sublayer),t=n.url.path;else if(e.nonStandardUrlAllowed){const e=p(i.path);(0,s.pC)(e)&&(t=e.serviceUrl,a=e.sublayerId)}return{url:(0,r.Qj)(t),layerId:a}}function w(e,t,i,s,a){(0,n.w)(t,s,"url",a),s.url&&null!=e.layerId&&(s.url=(0,r.v_)(s.url,i,e.layerId.toString()))}function b(e){if(!e)return!1;const t=e.toLowerCase(),i=t.includes("/services/"),s=t.includes("/mapserver/wmsserver"),r=t.includes("/imageserver/wmsserver"),n=t.includes("/wmsserver");return i&&(s||r||n)}},15235:(e,t,i)=>{i.r(t),i.d(t,{default:()=>R});var s=i(43697),r=i(99880),n=i(20102),a=i(96674),l=i(22974),o=i(83379),u=i(70586),c=i(17452),h=i(5600),d=i(75215),p=i(71715),f=i(52011),y=i(6570),_=i(65587),g=i(15923),m=i(92604),w=(i(67676),i(80442),i(90578));const b=m.Z.getLogger("esri.portal.PortalItemResource");let v=class extends g.Z{constructor(e){super(e),this.portalItem=null}normalizeCtorArgs(e){return e&&e.portalItem&&e.path?{...e,path:this._normalizePath(e.path,e.portalItem)}:e}set path(e){(0,u.pC)(e)&&(0,c.YP)(e)?b.error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",e)}_castPath(e){return this._normalizePath(e,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(e="json",t){const i=this.url;if((0,u.Wi)(i))throw new n.Z("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal._request(i,{responseType:e,query:{token:this.portalItem.apiKey},signal:(0,u.U2)(t,"signal")})}async update(e,t){return(await i.e(7873).then(i.bind(i,97873))).addOrUpdateResource(this,"update",e,t)}hasPath(){return(0,u.pC)(this.path)}_normalizePath(e,t){return(0,u.Wi)(e)?e:(e=e.replace(/^\/+/,""),(0,u.pC)(t)&&(0,c.YP)(e)&&(e=(0,c.PF)(e,t.itemUrl)),e.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,""))}};(0,s._)([(0,h.Cb)()],v.prototype,"portalItem",void 0),(0,s._)([(0,h.Cb)({type:String,value:null})],v.prototype,"path",null),(0,s._)([(0,w.p)("path")],v.prototype,"_castPath",null),(0,s._)([(0,h.Cb)({type:String,readOnly:!0})],v.prototype,"url",null),(0,s._)([(0,h.Cb)({type:String,readOnly:!0})],v.prototype,"itemRelativeUrl",null),v=(0,s._)([(0,f.j)("esri.portal.PortalItemResource")],v);const S=v;let F=class extends g.Z{constructor(e){super(e),this.created=null,this.rating=null}};(0,s._)([(0,h.Cb)()],F.prototype,"created",void 0),(0,s._)([(0,h.Cb)()],F.prototype,"rating",void 0),F=(0,s._)([(0,f.j)("esri.portal.PortalRating")],F);const I=F;var C;let x=C=class extends((0,a.eC)(o.Z)){constructor(e){super(e),this.access=null,this.accessInformation=null,this.apiKey=null,this.applicationProxies=null,this.avgRating=null,this.categories=null,this.created=null,this.culture=null,this.description=null,this.extent=null,this.groupCategories=null,this.id=null,this.itemControl=null,this.licenseInfo=null,this.modified=null,this.name=null,this.numComments=null,this.numRatings=null,this.numViews=null,this.owner=null,this.ownerFolder=null,this.portal=null,this.screenshots=null,this.size=null,this.snippet=null,this.sourceJSON=null,this.spatialReference=null,this.tags=null,this.title=null,this.type=null,this.typeKeywords=null,this.url=null}static from(e){return(0,d.TJ)(C,e)}destroy(){this.portal=null}get displayName(){const e=this.type,t=this.typeKeywords||[];let i=e;return"Feature Service"===e||"Feature Collection"===e?i=t.includes("Table")?"Table":t.includes("Route Layer")?"Route Layer":t.includes("Markup")?"Markup":"Feature Layer":"Image Service"===e?i=t.includes("Elevation 3D Layer")?"Elevation Layer":t.includes("Tiled Imagery")?"Tiled Imagery Layer":"Imagery Layer":"Scene Service"===e?i="Scene Layer":"Video Service"===e?i="Video Layer":"Scene Package"===e?i="Scene Layer Package":"Stream Service"===e?i="Feature Layer":"Geoprocessing Service"===e&&this.portal&&this.portal.isPortal?i=t.includes("Web Tool")?"Tool":"Geoprocessing Service":"Geocoding Service"===e?i="Locator":"Geoenrichment Service"===e?i="GeoEnrichment Service":"Microsoft Powerpoint"===e?i="Microsoft PowerPoint":"GeoJson"===e?i="GeoJSON":"Globe Service"===e?i="Globe Layer":"Vector Tile Service"===e?i="Tile Layer":"netCDF"===e?i="NetCDF":"Map Service"===e?i=t.includes("Spatiotemporal")||!t.includes("Hosted Service")&&!t.includes("Tiled")||t.includes("Relational")?"Map Image Layer":"Tile Layer":e&&e.toLowerCase().includes("add in")?i=e.replace(/(add in)/gi,"Add-In"):"datastore catalog service"===e?i="Big Data File Share":"Compact Tile Package"===e?i="Tile Package (tpkx)":"OGCFeatureServer"===e?i="OGC Feature Layer":"web mapping application"===e&&t.includes("configurableApp")&&(i="Instant App"),i}readExtent(e){return e&&e.length?new y.Z(e[0][0],e[0][1],e[1][0],e[1][1]):null}get iconUrl(){const e=this.type&&this.type.toLowerCase()||"",t=this.typeKeywords||[];let i,s=!1,n=!1,a=!1,l=!1,o=!1,u=!1;return e.indexOf("service")>0||"feature collection"===e||"kml"===e||"wms"===e||"wmts"===e||"wfs"===e?(s=t.includes("Hosted Service"),"feature service"===e||"feature collection"===e||"kml"===e||"wfs"===e?(n=t.includes("Table"),a=t.includes("Route Layer"),l=t.includes("Markup"),o=t.includes("Spatiotemporal"),u=t.includes("UtilityNetwork"),i=o&&n?"spatiotemporaltable":n?"table":a?"routelayer":l?"markup":o?"spatiotemporal":s?"featureshosted":u?"utilitynetwork":"features"):i="map service"===e||"wms"===e||"wmts"===e?s||t.includes("Tiled")||"wmts"===e?"maptiles":"mapimages":"scene service"===e?t.includes("Line")?"sceneweblayerline":t.includes("3DObject")?"sceneweblayermultipatch":t.includes("Point")?"sceneweblayerpoint":t.includes("IntegratedMesh")?"sceneweblayermesh":t.includes("PointCloud")?"sceneweblayerpointcloud":t.includes("Polygon")?"sceneweblayerpolygon":t.includes("Building")?"sceneweblayerbuilding":t.includes("Voxel")?"sceneweblayervoxel":"sceneweblayer":"image service"===e?t.includes("Elevation 3D Layer")?"elevationlayer":t.includes("Tiled Imagery")?"tiledimagerylayer":"imagery":"stream service"===e?"streamlayer":"video service"===e?"mediaservice":"vector tile service"===e?"vectortile":"datastore catalog service"===e?"datastorecollection":"geocoding service"===e?"geocodeservice":"geoprocessing service"===e?t.includes("Web Tool")&&this.portal&&this.portal.isPortal?"tool":"layers":"geodata service"===e?"geodataservice":"layers"):i="web map"===e||"cityengine web scene"===e?"maps":"web scene"===e?t.includes("ViewingMode-Local")?"webscenelocal":"websceneglobal":"web mapping application"===e&&t.includes("configurableApp")?"instantapps":"web mapping application"===e||"mobile application"===e||"application"===e||"operation view"===e||"desktop application"===e?"apps":"map document"===e||"map package"===e||"published map"===e||"scene document"===e||"globe document"===e||"basemap package"===e||"mobile basemap package"===e||"mobile map package"===e||"project package"===e||"project template"===e||"pro map"===e||"layout"===e||"layer"===e&&t.includes("ArcGIS Pro")||"explorer map"===e&&t.indexOf("Explorer Document")?"mapsgray":"service definition"===e||"csv"===e||"shapefile"===e||"cad drawing"===e||"geojson"===e||"360 vr experience"===e||"netcdf"===e||"administrative report"===e?"datafiles":"explorer add in"===e||"desktop add in"===e||"windows viewer add in"===e||"windows viewer configuration"===e?"appsgray":"arcgis pro add in"===e||"arcgis pro configuration"===e?"addindesktop":"rule package"===e||"file geodatabase"===e||"sqlite geodatabase"===e||"csv collection"===e||"kml collection"===e||"windows mobile package"===e||"map template"===e||"desktop application template"===e||"gml"===e||"arcpad package"===e||"code sample"===e||"form"===e||"document link"===e||"earth configuration"===e||"operations dashboard add in"===e||"rules package"===e||"image"===e||"workflow manager package"===e||"explorer map"===e&&t.includes("Explorer Mapping Application")||t.includes("Document")?"datafilesgray":"network analysis service"===e||"geoprocessing service"===e||"geodata service"===e||"geometry service"===e||"geoprocessing package"===e||"locator package"===e||"geoprocessing sample"===e||"workflow manager service"===e?"toolsgray":"layer"===e||"layer package"===e||"explorer layer"===e?"layersgray":"scene package"===e?"scenepackage":"mobile scene package"===e?"mobilescenepackage":"tile package"===e||"compact tile package"===e?"tilepackage":"task file"===e?"taskfile":"report template"===e?"report-template":"statistical data collection"===e?"statisticaldatacollection":"insights workbook"===e?"workbook":"insights model"===e?"insightsmodel":"insights page"===e?"insightspage":"insights theme"===e?"insightstheme":"hub initiative"===e?"hubinitiative":"hubpage"===e?"hubpage":"hub event"===e?"hubevent":"hub site application"===e?"hubsite":"hub project"===e?"hubproject":"relational database connection"===e?"relationaldatabaseconnection":"big data file share"===e?"datastorecollection":"image collection"===e?"imagecollection":"style"===e?"style":"desktop style"===e?"desktopstyle":"dashboard"===e?"dashboard":"raster function template"===e?"rasterprocessingtemplate":"vector tile package"===e?"vectortilepackage":"ortho mapping project"===e?"orthomappingproject":"ortho mapping template"===e?"orthomappingtemplate":"solution"===e?"solutions":"geopackage"===e?"geopackage":"deep learning package"===e?"deeplearningpackage":"real time analytic"===e?"realtimeanalytics":"big data analytic"===e?"bigdataanalytics":"feed"===e?"feed":"excalibur imagery project"===e?"excaliburimageryproject":"notebook"===e?"notebook":"storymap"===e?"storymap":"survey123 add in"===e?"survey123addin":"mission"===e?"mission":"mission report"===e?"missionreport":"quickcapture project"===e?"quickcaptureproject":"pro report"===e?"proreport":"urban model"===e?"urbanmodel":"web experience"===e?"experiencebuilder":"web experience template"===e?"webexperiencetemplate":"experience builder widget"===e?"experiencebuilderwidget":"experience builder widget package"===e?"experiencebuilderwidgetpackage":"workflow"===e?"workflow":"insights script"===e?"insightsscript":"kernel gateway connection"===e?"kernelgatewayconnection":"hub initiative template"===e?"hubinitiativetemplate":"storymap theme"===e?"storymaptheme":"knowledge graph"===e?"knowledgegraph":"native application"===e?"nativeapp":"native application installer"===e?"nativeappinstaller":"link chart"===e?"linkchart":"investigation"===e?"investigation":"ogcfeatureserver"===e?"features":"pro project"===e?"proproject":"insights workbook package"===e?"insightsworkbookpackage":"apache parquet"===e?"apacheparquet":"notebook code snippets"===e?"notebookcodesnippets":"suitability model"===e?"suitabilitymodel":"esri classifier definition"===e?"classifierdefinition":"esri classification schema"===e?"classificationschema":"insights data engineering workbook"===e?"dataengineeringworkbook":"insights data engineering model"===e?"dataengineeringmodel":"deep learning studio project"===e?"deeplearningproject":"maps",i?(0,r.V)("esri/images/portal/"+i+"16.png"):null}get isLayer(){return["Map Service","Feature Service","Feature Collection","Scene Service","Image Service","Stream Service","Vector Tile Service","WMTS","WMS"].includes(this.type)}get itemUrl(){const e=this.get("portal.restUrl");return e&&this.id?`${e}/content/items/${this.id}`:null}get thumbnailUrl(){const e=this.itemUrl,t=this.thumbnail;return e&&t?this.portal._normalizeUrl(`${e}/info/${t}?f=json`):null}get userItemUrl(){const e=this.get("portal.restUrl");if(!e)return null;const t=this.owner||this.get("portal.user.username");return t?`${e}/content/users/${this.ownerFolder?`${t}/${this.ownerFolder}`:t}/items/${this.id}`:null}load(e){this.portal||(this.portal=_.Z.getDefault());const t=this.portal.load(e).then((()=>this.sourceJSON?this.sourceJSON:this.id&&this.itemUrl?this.portal._request(this.itemUrl,{signal:(0,u.pC)(e)?e.signal:null,query:{token:this.apiKey}}):{})).then((e=>{this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}addRating(e){const t={method:"post",query:{}};return e instanceof I&&(e=e.rating),isNaN(e)||"number"!=typeof e||(t.query.rating=e),this.portal._request(this.itemUrl+"/addRating",t).then((()=>new I({rating:e,created:new Date})))}clone(){const e={access:this.access,accessInformation:this.accessInformation,applicationProxies:(0,l.d9)(this.applicationProxies),avgRating:this.avgRating,categories:(0,l.d9)(this.categories),created:(0,l.d9)(this.created),culture:this.culture,description:this.description,extent:(0,l.d9)(this.extent),groupCategories:(0,l.d9)(this.groupCategories),id:this.id,itemControl:this.itemControl,licenseInfo:this.licenseInfo,modified:(0,l.d9)(this.modified),name:this.name,numComments:this.numComments,numRatings:this.numRatings,numViews:this.numViews,owner:this.owner,ownerFolder:this.ownerFolder,portal:this.portal,screenshots:(0,l.d9)(this.screenshots),size:this.size,snippet:this.snippet,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};return this.loaded&&(e.loadStatus="loaded"),new C({sourceJSON:this.sourceJSON}).set(e)}createPostQuery(){const e=this.toJSON();for(const t of["tags","typeKeywords","categories"])e[t]&&(e[t]=e[t].join(", "));const{extent:t}=e;return t&&(e.extent=JSON.stringify(t)),e}deleteRating(){return this.portal._request(this.itemUrl+"/deleteRating",{method:"post"}).then((()=>{}))}fetchData(e="json",t){return this.portal._request(this.itemUrl+"/data",{responseType:e,...t,query:{token:this.apiKey}})}fetchRating(e){return this.portal._request(this.itemUrl+"/rating",{query:{token:this.apiKey},...e}).then((e=>null!=e.rating?(e.created=new Date(e.created),new I(e)):null))}fetchRelatedItems(e,t){return this.portal._requestToTypedArray(this.itemUrl+"/relatedItems",{query:{...e,token:this.apiKey},...t},C)}getThumbnailUrl(e){let t=this.thumbnailUrl;return t&&e&&(t+=`&w=${e}`),t}reload(){return this.portal._request(this.itemUrl,{cacheBust:!0,query:{token:this.apiKey}}).then((e=>(this.sourceJSON=e,this.read(e),this)))}update(e){return this.id?this.load().then((()=>this.portal._signIn())).then((()=>{const t=e&&e.data,i={method:"post"};i.query=this.createPostQuery();for(const e in i.query)null===i.query[e]&&(i.query[e]="");return i.query.clearEmptyFields=!0,null!=t&&("string"==typeof t?i.query.text=t:"object"==typeof t&&(i.query.text=JSON.stringify(t))),this.portal._request(`${this.userItemUrl}/update`,i).then((()=>this.reload()))})):Promise.reject(new n.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}updateThumbnail(e){return this.id?this.load().then((()=>this.portal._signIn())).then((()=>{const t=e.thumbnail,i=e.filename,s={method:"post"};if("string"==typeof t)(0,c.HK)(t)?s.query={data:t}:s.query={url:(0,c.hF)(t)},(0,u.pC)(i)&&(s.query.filename=i);else{const e=new FormData;(0,u.pC)(i)?e.append("file",t,i):e.append("file",t),s.body=e}return this.portal._request(`${this.userItemUrl}/updateThumbnail`,s).then((()=>this.reload()))})):Promise.reject(new n.Z("portal:item-does-not-exist","The item does not exist yet and cannot be updated"))}async fetchResources(e={},t){return(await i.e(7873).then(i.bind(i,97873))).fetchResources(this,e,t)}async addResource(e,t,s){const r=await i.e(7873).then(i.bind(i,97873));return e.portalItem=this,r.addOrUpdateResource(e,"add",t,s)}async removeResource(e,t){const s=await i.e(7873).then(i.bind(i,97873));if(e.portalItem&&e.portalItem.itemUrl!==this.itemUrl)throw new n.Z("removeresource:portal-item-mismatch","The portal item associated with the provided resource does not match the item");return s.removeResource(this,e,t)}async removeAllResources(e){return(await i.e(7873).then(i.bind(i,97873))).removeAllResources(this,e)}resourceFromPath(e){return new S({portalItem:this,path:e})}toJSON(){const e=this.extent,t={accessInformation:this.accessInformation,categories:(0,l.d9)(this.categories),created:this.created&&this.created.getTime(),description:this.description,extent:e&&[[e.xmin,e.ymin],[e.xmax,e.ymax]],id:this.id,licenseInfo:this.licenseInfo,modified:this.modified&&this.modified.getTime(),name:this.name,owner:this.owner,ownerFolder:this.ownerFolder,snippet:this.snippet,spatialReference:this.spatialReference,tags:(0,l.d9)(this.tags),thumbnail:this.thumbnail,title:this.title,type:this.type,typeKeywords:(0,l.d9)(this.typeKeywords),url:this.url};return(0,l.yd)(t)}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new C({sourceJSON:e})}_getPostQuery(){const e=this.toJSON();for(const t in e)"tags"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"typeKeywords"===t&&null!==e[t]&&(e[t]=e[t].join(", ")),"extent"===t&&e[t]&&(e[t]=JSON.stringify(e[t]));return e}};(0,s._)([(0,h.Cb)({type:["private","shared","org","public"]})],x.prototype,"access",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"accessInformation",void 0),(0,s._)([(0,h.Cb)({type:String})],x.prototype,"apiKey",void 0),(0,s._)([(0,h.Cb)({json:{read:{source:"appProxies"}}})],x.prototype,"applicationProxies",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"avgRating",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"categories",void 0),(0,s._)([(0,h.Cb)({type:Date})],x.prototype,"created",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"culture",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"description",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"displayName",null),(0,s._)([(0,h.Cb)({type:y.Z})],x.prototype,"extent",void 0),(0,s._)([(0,p.r)("extent")],x.prototype,"readExtent",null),(0,s._)([(0,h.Cb)()],x.prototype,"groupCategories",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"iconUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"id",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"isLayer",null),(0,s._)([(0,h.Cb)()],x.prototype,"itemControl",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"itemUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"licenseInfo",void 0),(0,s._)([(0,h.Cb)({type:Date})],x.prototype,"modified",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"name",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numComments",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numRatings",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"numViews",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"owner",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"ownerFolder",void 0),(0,s._)([(0,h.Cb)({type:_.Z})],x.prototype,"portal",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"screenshots",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"size",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"snippet",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"sourceJSON",void 0),(0,s._)([(0,h.Cb)({type:String})],x.prototype,"spatialReference",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"tags",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"thumbnail",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"thumbnailUrl",null),(0,s._)([(0,h.Cb)()],x.prototype,"title",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"type",void 0),(0,s._)([(0,h.Cb)()],x.prototype,"typeKeywords",void 0),(0,s._)([(0,h.Cb)({type:String,json:{read(e,t){if("KML"!==t.type)return e;const i=this.portal?.restUrl;return e||(e=i&&this.id?`${i}/content/items/${this.id}/data`:null),e}}})],x.prototype,"url",void 0),(0,s._)([(0,h.Cb)({readOnly:!0})],x.prototype,"userItemUrl",null),x=C=(0,s._)([(0,f.j)("esri.portal.PortalItem")],x);const R=x},41818:(e,t,i)=>{i.d(t,{P:()=>a});var s=i(11282),r=i(34599),n=i(57444);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.executeQueryForCount)(a,n.Z.from(t),{...i}).then((e=>e.data.count))}},5396:(e,t,i)=>{i.d(t,{G:()=>a});var s=i(11282),r=i(34599),n=i(57444);async function a(e,t,i){const a=(0,s.en)(e);return(0,r.executeQueryForIds)(a,n.Z.from(t),{...i}).then((e=>e.data.objectIds))}},4967:(e,t,i)=>{i.d(t,{F:()=>o,e:()=>l});var s=i(11282),r=i(34599),n=i(74889),a=i(57444);async function l(e,t,i){const s=await o(e,t,i);return n.default.fromJSON(s)}async function o(e,t,i){const n=(0,s.en)(e),l={...i},o=a.Z.from(t),{data:u}=await(0,r.executeQuery)(n,o,o.sourceSpatialReference,l);return u}},98326:(e,t,i)=>{i.d(t,{Z:()=>h});var s,r=i(43697),n=i(96674),a=i(5600),l=(i(67676),i(80442),i(75215)),o=i(52011);const u={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let c=s=class extends n.wq{constructor(e){super(e),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:e}=this,t=function(e){const{exifInfo:t,exifName:i,tagName:s}=e;if(!t||!i||!s)return null;const r=t.find((e=>e.name===i));return r?function(e){const{tagName:t,tags:i}=e;if(!i||!t)return null;const s=i.find((e=>e.name===t));return s&&s.value||null}({tagName:s,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:e});return u[t]||null}clone(){return new s({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,r._)([(0,a.Cb)({type:String})],c.prototype,"contentType",void 0),(0,r._)([(0,a.Cb)()],c.prototype,"exifInfo",void 0),(0,r._)([(0,a.Cb)({readOnly:!0})],c.prototype,"orientationInfo",null),(0,r._)([(0,a.Cb)({type:l.z8})],c.prototype,"id",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"globalId",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"keywords",void 0),(0,r._)([(0,a.Cb)({type:String})],c.prototype,"name",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"parentGlobalId",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"parentObjectId",void 0),(0,r._)([(0,a.Cb)({type:l.z8})],c.prototype,"size",void 0),(0,r._)([(0,a.Cb)({json:{read:!1}})],c.prototype,"url",void 0),c=s=(0,r._)([(0,o.j)("esri.layers.support.AttachmentInfo")],c);const h=c},11282:(e,t,i)=>{i.d(t,{cv:()=>l,en:()=>a,lA:()=>n});var s=i(22974),r=i(17452);function n(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function a(e){return"string"==typeof e?(0,r.mN)(e):(0,s.d9)(e)}function l(e,t,i){const s={};for(const r in e){if("declaredClass"===r)continue;const n=e[r];if(null!=n&&"function"!=typeof n)if(Array.isArray(n)){s[r]=[];for(let e=0;e<n.length;e++)s[r][e]=l(n[e])}else if("object"==typeof n)if(n.toJSON){const e=n.toJSON(i&&i[r]);s[r]=t?e:JSON.stringify(e)}else s[r]=t?n:JSON.stringify(n);else s[r]=n}return s}},58333:(e,t,i)=>{i.d(t,{ET:()=>n,I4:()=>r,eG:()=>o,lF:()=>a,lj:()=>c,qP:()=>l,wW:()=>u});const s=[252,146,31,255],r={type:"esriSMS",style:"esriSMSCircle",size:6,color:s,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},n={type:"esriSLS",style:"esriSLSSolid",width:.75,color:s},a={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},l={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},o={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},u={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},c={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);