@arcgis/core 4.34.0-next.62 → 4.34.0-next.65

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 (270) hide show
  1. package/AggregateGraphic.js +1 -1
  2. package/Graphic.js +1 -1
  3. package/TrackGraphic.js +1 -1
  4. package/analysis/VolumeMeasurement/VolumeMeasurementCutFillOptions.js +1 -1
  5. package/analysis/VolumeMeasurementAnalysis.js +1 -1
  6. package/assets/esri/core/workers/RemoteClient.js +1 -1
  7. package/assets/esri/core/workers/chunks/{b68b54be3d67595a9446.js → 06ff5f34ad9bdf9705de.js} +77 -67
  8. package/assets/esri/core/workers/chunks/{5de7c2a80bd9c81cefe2.js → 070b29cba896f46537f9.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{8c0e11f781607239749d.js → 0a36df6fdab95785d1ce.js} +1 -1
  10. package/assets/esri/core/workers/chunks/0b01c87db77246632ad9.js +1 -0
  11. package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +1 -0
  12. package/assets/esri/core/workers/chunks/0cdf6b51f2a63f348530.js +1 -0
  13. package/assets/esri/core/workers/chunks/0d82cc6905b105b3568a.js +1 -0
  14. package/assets/esri/core/workers/chunks/10ec10ca361842efce92.js +1 -0
  15. package/assets/esri/core/workers/chunks/{bdc18ef9cdc8242f014e.js → 1143313f2f6f34deaad7.js} +1 -1
  16. package/assets/esri/core/workers/chunks/2394ac65d64e50399d76.js +1 -0
  17. package/assets/esri/core/workers/chunks/{69fbe363bb130fdd8146.js → 3d6f07e04f77cc0a7506.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{db7678104b18534482e3.js → 426232091caf8608e5f1.js} +1 -1
  19. package/assets/esri/core/workers/chunks/47febd4de836a33b51b1.js +1 -0
  20. package/assets/esri/core/workers/chunks/487afbf352d12c745430.js +1 -0
  21. package/assets/esri/core/workers/chunks/4fda6e90822bc0198b28.js +2 -0
  22. package/assets/esri/core/workers/chunks/{3fd09a7c05583a57a317.js → 5d12862042b6bf9f9d54.js} +1 -1
  23. package/assets/esri/core/workers/chunks/5d65987f2c1b5c56a799.js +1 -0
  24. package/assets/esri/core/workers/chunks/{ba0c7339fa19cc7cbde7.js → 5e1d6704ee0aa41b1d06.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{4ac127cefa3aa5e93e78.js → 657b01a6df8dc46c5209.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{71b222089f5e9dcee474.js → 6a1b652ccbf58ac44658.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{4050ddb580d364d9e205.js → 6ab435423acb0ed0b1c7.js} +1 -1
  28. package/assets/esri/core/workers/chunks/7b7f5028a488bb9c10f4.js +1 -0
  29. package/assets/esri/core/workers/chunks/{d83bdc13c3cad3eee7be.js → 7c3a1958990de095d3a1.js} +1 -1
  30. package/assets/esri/core/workers/chunks/808cfed7022e3846d5b2.js +1 -0
  31. package/assets/esri/core/workers/chunks/88b8f33ce1cbf8a0f855.js +33 -0
  32. package/assets/esri/core/workers/chunks/8bd5a0ff7dcf1067bf53.js +1 -0
  33. package/assets/esri/core/workers/chunks/{f462a138912e5379b6a7.js → 904c116c6b093e0e970c.js} +1 -1
  34. package/assets/esri/core/workers/chunks/99b20eef2893047fac10.js +1 -0
  35. package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +1 -0
  36. package/assets/esri/core/workers/chunks/{bb2ab663e3e5597f2104.js → a1bd4eecca1e3272bffb.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{8005ae652361f506bc5f.js → a29fb90226bd08157bd1.js} +1 -1
  38. package/assets/esri/core/workers/chunks/a596d6ccb6103e594031.js +1 -0
  39. package/assets/esri/core/workers/chunks/a5e6359fadbd699b1c8e.js +1 -0
  40. package/assets/esri/core/workers/chunks/a7f3cdd9a249ef4572ce.js +1 -0
  41. package/assets/esri/core/workers/chunks/{d2bdd52d2291306a4e47.js → a80d769b0ed025f0df64.js} +1 -1
  42. package/assets/esri/core/workers/chunks/a987731d1b5449d8fb0c.js +1 -0
  43. package/assets/esri/core/workers/chunks/af83dddddbfe25194527.js +1 -0
  44. package/assets/esri/core/workers/chunks/{4d8d942fbd6750bb7567.js → b057e6d593c1607cae61.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{d707538b150d79050336.js → b1f1a26e7a2ef5b783ee.js} +1 -1
  46. package/assets/esri/core/workers/chunks/c337c1a2dbc452780dd7.js +1 -0
  47. package/assets/esri/core/workers/chunks/{a35a439f053d1fe0541b.js → c601bbdafdee5074b04f.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{d7ce68667bb355ef8e5d.js → c7a386ac90e58eb71935.js} +1 -1
  49. package/assets/esri/core/workers/chunks/c8694a27e2cf28b010e8.js +1 -0
  50. package/assets/esri/core/workers/chunks/cf69f6afeaf1229e032c.js +1 -0
  51. package/assets/esri/core/workers/chunks/d1e8220dcae1d01d3c35.js +1 -0
  52. package/assets/esri/core/workers/chunks/e12e8d69c05c182b6a69.js +1 -0
  53. package/assets/esri/core/workers/chunks/{220c8d6338f236298720.js → e6457ac25c0829ee039c.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{c77a97c723b8c17df186.js → e72aee3f857aa473822c.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{8374d87176486c1fc90e.js → eadac757f74470b89a36.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{7c23be93d394f1bee941.js → f6107f844f4feed42828.js} +1 -1
  57. package/assets/esri/core/workers/chunks/f76774781865cb1411b0.js +1 -0
  58. package/assets/esri/core/workers/chunks/fd04df45cdcc6ff52554.js +1 -0
  59. package/assets/esri/layers/support/rasterFormats/qb3-wasm.wasm +0 -0
  60. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  61. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  62. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  63. package/assets/esri/themes/base/widgets/_Attribution.scss +0 -1
  64. package/assets/esri/themes/dark/main.css +1 -1
  65. package/assets/esri/themes/light/main.css +1 -1
  66. package/assets/esri/themes/light/view.css +1 -1
  67. package/chunks/ComponentShader.glsl.js +1 -1
  68. package/chunks/DefaultMaterial.glsl.js +2 -2
  69. package/chunks/Fog.glsl.js +2 -2
  70. package/chunks/GaussianSplat.glsl.js +7 -0
  71. package/chunks/GaussianSplatComposition.glsl.js +7 -0
  72. package/chunks/GaussianSplatDepthComposition.glsl.js +11 -0
  73. package/chunks/{BloomBlur.glsl.js → GlowBlur.glsl.js} +5 -5
  74. package/chunks/GlowComposition.glsl.js +41 -0
  75. package/chunks/Path.glsl.js +1 -1
  76. package/chunks/RealisticTree.glsl.js +40 -36
  77. package/chunks/lyr3DMain.js +1 -1
  78. package/chunks/lyr3DWorker.js +1 -1
  79. package/chunks/qb3-wasm.js +5 -0
  80. package/chunks/vxlLayer.js +1 -1
  81. package/config.js +1 -1
  82. package/geometry/ellipsoidUtils.js +1 -1
  83. package/geometry/operators/geodeticUtilsOperator.d.ts +6 -0
  84. package/geometry/support/heightModelInfoUtils.js +1 -1
  85. package/graphic/AggregateGraphicOrigin.js +5 -0
  86. package/graphic/CSVGraphicOrigin.js +1 -1
  87. package/graphic/CatalogGraphicOrigin.js +1 -1
  88. package/graphic/FeatureGraphicOrigin.js +1 -1
  89. package/graphic/GeoJSONGraphicOrigin.js +1 -1
  90. package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
  91. package/graphic/OGCFeatureGraphicOrigin.js +1 -1
  92. package/graphic/OrientedImageryGraphicOrigin.js +1 -1
  93. package/graphic/ParquetGraphicOrigin.js +1 -1
  94. package/graphic/StreamGraphicOrigin.js +1 -1
  95. package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
  96. package/graphic/TrackGraphicOrigin.js +5 -0
  97. package/graphic/WFSGraphicOrigin.js +1 -1
  98. package/graphic/getPopupProvider.js +5 -0
  99. package/interfaces.d.ts +795 -30
  100. package/kernel.js +1 -1
  101. package/layers/GaussianSplatLayer.js +1 -1
  102. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  103. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  104. package/layers/VoxelWasmPerSceneView.js +1 -1
  105. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  106. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  107. package/layers/mixins/FeatureReductionLayer.js +1 -1
  108. package/layers/mixins/TrackableLayer.js +1 -1
  109. package/layers/support/GaussianSplatAtlasPageAllocator.js +5 -0
  110. package/layers/support/gaussianSplatUtils.js +5 -0
  111. package/layers/support/rasterDatasets/MRFRaster.js +1 -1
  112. package/layers/support/rasterFormats/Qb3.js +5 -0
  113. package/layers/support/rasterFormats/RasterCodec.js +1 -1
  114. package/layers/support/tiles3DUtils.js +5 -0
  115. package/package.json +1 -1
  116. package/rest/knowledgeGraph/GraphApplyEditsResult.js +1 -1
  117. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  118. package/rest/knowledgeGraphService.js +1 -1
  119. package/rest/lastMileDelivery/enums.js +5 -0
  120. package/rest/lastMileDelivery.d.ts +10 -0
  121. package/rest/lastMileDelivery.js +5 -0
  122. package/rest/route/utils.js +1 -1
  123. package/rest/support/JobInfo.js +1 -1
  124. package/rest/support/LastMileDeliveryParameters.d.ts +4 -0
  125. package/rest/support/LastMileDeliveryParameters.js +5 -0
  126. package/support/revision.js +1 -1
  127. package/symbols/patterns/StylePattern3D.js +1 -1
  128. package/symbols/patterns/styles.js +1 -1
  129. package/unionTypes.d.ts +3 -0
  130. package/views/2d/analysis/AnalysisView2D.js +5 -0
  131. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +4 -0
  132. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +5 -0
  133. package/views/2d/analysis/analysisViewModuleImportUtils.js +5 -0
  134. package/views/2d/engine/webgl/Painter.js +1 -1
  135. package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
  136. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +5 -0
  137. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +5 -0
  138. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +5 -0
  139. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +5 -0
  140. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +5 -0
  141. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/utils.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
  143. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  144. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  145. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  146. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  147. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  148. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  149. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  150. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  151. package/views/2d/layers/support/visualVariableSimpleUtils.js +1 -1
  152. package/views/3d/analysis/AnalysisView3D.js +1 -1
  153. package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
  154. package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
  155. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  156. package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
  157. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization.js +5 -0
  158. package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +1 -1
  159. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +1 -1
  160. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  161. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  162. package/views/3d/analysis/SliceAnalysisView3D.js +1 -1
  163. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  164. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  165. package/views/3d/analysis/analysisViewModuleImportUtils.js +5 -0
  166. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  167. package/views/3d/environment/Fog.js +1 -1
  168. package/views/3d/environment/FogTechniqueConfiguration.js +1 -1
  169. package/views/3d/environment/Precipitation.js +1 -1
  170. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  171. package/views/3d/layers/GraphicsView3D.js +1 -1
  172. package/views/3d/layers/I3SMeshView3D.js +1 -1
  173. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  174. package/views/3d/layers/{IntegratedMesh3DTilesViewPerformanceInfo.js → Lyr3DViewPerformanceInfo.js} +1 -1
  175. package/views/3d/layers/Lyr3DWasm.js +1 -1
  176. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  177. package/views/3d/layers/graphics/Labeler.js +1 -1
  178. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  179. package/views/3d/layers/support/LayerViewAnalysisViewManager.js +1 -1
  180. package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
  181. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  182. package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
  183. package/views/3d/support/QualitySettings.js +1 -1
  184. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  185. package/views/3d/support/pointsOfInterest/ContentGeometryUpdates.js +1 -1
  186. package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  189. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
  190. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  191. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  192. package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
  193. package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +5 -5
  194. package/views/3d/webgl-engine/core/shaderLibrary/util/ComputeCovariance.glsl.js +40 -0
  195. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +59 -0
  196. package/views/3d/webgl-engine/core/shaderLibrary/util/QuaternionToRotationMatrix.glsl.js +23 -0
  197. package/views/3d/webgl-engine/effects/{bloom/BloomBlur.glsl.js → glow/GlowBlur.glsl.js} +1 -1
  198. package/views/3d/webgl-engine/effects/glow/GlowBlurTechnique.js +5 -0
  199. package/views/3d/webgl-engine/effects/{bloom/BloomBlurTechniqueConfiguration.js → glow/GlowBlurTechniqueConfiguration.js} +1 -1
  200. package/views/3d/webgl-engine/effects/{bloom/BloomComposition.glsl.js → glow/GlowComposition.glsl.js} +1 -1
  201. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechnique.js +5 -0
  202. package/views/3d/webgl-engine/effects/{bloom/BloomCompositionTechniqueConfiguration.js → glow/GlowCompositionTechniqueConfiguration.js} +1 -1
  203. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +5 -0
  204. package/views/3d/webgl-engine/effects/weather/SnowCover.glsl.js +10 -4
  205. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  206. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +5 -0
  207. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  208. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  209. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  210. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  211. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  212. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  213. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  214. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +5 -0
  215. package/views/3d/webgl-engine/shaders/GaussianSplatComposition.glsl.js +5 -0
  216. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechnique.js +5 -0
  217. package/views/3d/webgl-engine/shaders/GaussianSplatCompositionTechniqueConfiguration.js +5 -0
  218. package/views/3d/webgl-engine/shaders/GaussianSplatDepthComposition.glsl.js +5 -0
  219. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +5 -0
  220. package/views/3d/webgl-engine/shaders/GaussianSplatDepthTechnique.js +5 -0
  221. package/views/3d/webgl-engine/shaders/GaussianSplatTechnique.js +5 -0
  222. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +5 -0
  223. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  224. package/views/SceneView.js +1 -1
  225. package/views/VideoView.js +1 -1
  226. package/views/View2D.js +1 -1
  227. package/views/analysis/AnalysisView.js +5 -0
  228. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  229. package/views/layers/FeatureLayerView.js +1 -1
  230. package/views/support/AnalysisViewManager.js +1 -1
  231. package/views/webgl/FramebufferObject.js +1 -1
  232. package/widgets/Locate/LocateViewModel.js +1 -1
  233. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  234. package/assets/esri/core/workers/chunks/08d420cd7cfa19a10fa4.js +0 -1
  235. package/assets/esri/core/workers/chunks/17abab49db1813d3e192.js +0 -1
  236. package/assets/esri/core/workers/chunks/182383fd00008606bfaa.js +0 -1
  237. package/assets/esri/core/workers/chunks/188feb2bcbf8e48e3163.js +0 -1
  238. package/assets/esri/core/workers/chunks/3124a8516e815efec973.js +0 -1
  239. package/assets/esri/core/workers/chunks/3461701a15be46603c56.js +0 -1
  240. package/assets/esri/core/workers/chunks/36acf191a2d48560c796.js +0 -1
  241. package/assets/esri/core/workers/chunks/40e1fbfbf3f3979b3713.js +0 -1
  242. package/assets/esri/core/workers/chunks/4b1daffa97fd90a554a0.js +0 -1
  243. package/assets/esri/core/workers/chunks/4b68783e8d1415d0a171.js +0 -1
  244. package/assets/esri/core/workers/chunks/5915f5ba9064097aee79.js +0 -1
  245. package/assets/esri/core/workers/chunks/5ed7e139c72cd2b3ddba.js +0 -1
  246. package/assets/esri/core/workers/chunks/659f7e99b2d524ef53fb.js +0 -2
  247. package/assets/esri/core/workers/chunks/702d2c668dedf83421ca.js +0 -1
  248. package/assets/esri/core/workers/chunks/7b2ec80dca0fdb0442cf.js +0 -1
  249. package/assets/esri/core/workers/chunks/7b9178c3826f9ef52a00.js +0 -1
  250. package/assets/esri/core/workers/chunks/9a20390602126995f831.js +0 -1
  251. package/assets/esri/core/workers/chunks/a2150baf0661e2f28011.js +0 -1
  252. package/assets/esri/core/workers/chunks/a532614aa65fb52dee7b.js +0 -1
  253. package/assets/esri/core/workers/chunks/abededd48e0ea6cfec01.js +0 -1
  254. package/assets/esri/core/workers/chunks/ae1cb4c65d72217ae4d4.js +0 -1
  255. package/assets/esri/core/workers/chunks/c1c6202f7bef24b5db26.js +0 -1
  256. package/assets/esri/core/workers/chunks/c75b0243e5bb84738419.js +0 -1
  257. package/assets/esri/core/workers/chunks/d47c3431c501d77b1779.js +0 -1
  258. package/assets/esri/core/workers/chunks/eacc7fccdc3fb670ac8f.js +0 -33
  259. package/assets/esri/core/workers/chunks/f6d91256c4e5f8a0d5c0.js +0 -1
  260. package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +0 -1
  261. package/chunks/BloomComposition.glsl.js +0 -41
  262. package/graphic/isPopupProviderGraphicOrigin.js +0 -5
  263. package/views/2d/analysisViewModuleImportUtils.js +0 -5
  264. package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +0 -5
  265. package/views/3d/analysisViewModuleImportUtils.js +0 -5
  266. package/views/3d/webgl-engine/effects/bloom/BloomBlurTechnique.js +0 -5
  267. package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechnique.js +0 -5
  268. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +0 -5
  269. /package/assets/esri/core/workers/chunks/{659f7e99b2d524ef53fb.js.LICENSE.txt → 4fda6e90822bc0198b28.js.LICENSE.txt} +0 -0
  270. /package/views/3d/webgl-engine/effects/{bloom/BloomPresets.glsl.js → glow/GlowPresets.glsl.js} +0 -0
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[788,4342,5294,6719,7097,7694,8407],{6797:(e,t,i)=>{i.d(t,{Mj:()=>h,Ui:()=>p,w2:()=>f});var r=i(65008),n=i(7762),s=i(88620);const a=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function l(e){return e instanceof r.A}function o(e){return e instanceof n.A?Object.keys(e.items):l(e)?(0,s.oY)(e).keys():e?Object.keys(e):[]}function u(e,t){return e instanceof n.A?e.items[t]:e[t]}function c(e){return e?e.declaredClass:null}function d(e,t){const i=e.diff;if(i&&"function"==typeof i)return i(e,t);const r=o(e),n=o(t);if(0===r.length&&0===n.length)return;if(!r.length||!n.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 s=n.filter(e=>!r.includes(e)),h=r.filter(e=>!n.includes(e)),f=r.filter(i=>n.includes(i)&&u(e,i)!==u(t,i)).concat(s,h).sort(),p=c(e);if(p&&a.has(p)&&f.length)return{type:"complete",oldValue:e,newValue:t};let y;const g=l(e)&&l(t);for(const r of f){const n=u(e,r),s=u(t,r);let a;if((g||"function"!=typeof n&&"function"!=typeof s)&&n!==s&&(null!=n||null!=s)){if(i&&i[r]&&"function"==typeof i[r])a=i[r]?.(n,s);else if(n instanceof Date&&s instanceof Date){if(n.getTime()===s.getTime())continue;a={type:"complete",oldValue:n,newValue:s}}else a="object"==typeof n&&"object"==typeof s&&c(n)===c(s)?d(n,s):{type:"complete",oldValue:n,newValue:s};null!=a&&(null!=y?y.diff[r]=a:y={type:"partial",diff:{[r]:a}})}}return y}function h(e,t){return function(e,t){if(null==e)return!1;const i=t.split(".");let r=e;for(const e of i){if("complete"===r.type)return!0;if("partial"!==r.type)return!1;{const t=r.diff[e];if(!t)return!1;r=t}}return!0}(e,t)}function f(e,t){if(!e)return!1;if("partial"===e.type){const i=Object.keys(e.diff);return 1===i.length&&i[0]===t}return!1}function p(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&c(e)!==c(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},9762:(e,t,i)=>{i.r(t),i.d(t,{projectBuffer:()=>n});var r=i(37539);function n(e,t,i,n,s,a,l=Math.floor(e.length/3)){const o=(0,r.jd)(t,s);if(null==o)return!1;if(o===r.pO){if(e===n&&i===a)return!0;const t=i+3*l;for(let r=i,s=a;r<t;r++,s++)n[s]=e[r];return!0}const u=i+3*l;for(let t=i,r=a;t<u;t+=3,r+=3)o(e,t,n,r);return!0}},10407:(e,t,i)=>{i.d(t,{It:()=>f,LG:()=>a,OM:()=>u,Sm:()=>c,Y:()=>l,bK:()=>o,mm:()=>h,sQ:()=>d});var r=i(98988),n=i(16930),s=i(28735);function a(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,h.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}function c(e,t,i){i?a(e,t):u(e,t)}async function d(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,s.ci)(e);const i=n.A.WGS84;return await(0,r.initializeProjection)(t,i),(0,r.project)(e,i)}(i)}const h={CHARTS:"Charts",DYNAMIC:"Dynamic",DEVELOPER_BASEMAP:"DeveloperBasemap",GROUP_LAYER_MAP:"Map",HOSTED_SERVICE:"Hosted Service",JSAPI:"ArcGIS API for JavaScript",LOCAL_SCENE:"ViewingMode-Local",METADATA:"Metadata",MULTI_LAYER:"Multilayer",ORIENTED_IMAGERY_LAYER:"OrientedImageryLayer",SINGLE_LAYER:"Singlelayer",SUBTYPE_GROUP_LAYER:"SubtypeGroupLayer",SUBTYPE_GROUP_TABLE:"SubtypeGroupTable",TABLE:"Table",TILED_IMAGERY:"Tiled Imagery"};function f(e){const{portal:t,isOrgItem:i,itemControl:r}=e,n=t.user?.privileges;let s=!n||n.includes("features:user:edit"),a=!!i&&!!n?.includes("features:user:fullEdit");const l="update"===r||"admin"===r;return l?a=s=!0:a&&(s=!0),{features:{edit:s,fullEdit:a},content:{updateItem:l}}}},17311:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(31635),n=i(65008),s=i(4576),a=i(60999),l=i(7762),o=i(10107),u=(i(44208),i(53966),i(40608)),c=i(30524),d=i(43668);let h=class extends n.A{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){return this.expressionsUsedInTitle.length>0?this._get("_arcadeTask")||(0,a.UT)(()=>(0,d.l)()):null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??i.e(9926).then(i.bind(i,29926)).then(e=>this._featureUtils=e)}get calculatedExpressions(){const e=new l.A;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const i=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(i.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:i,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(i,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter(t=>e.includes(`{expression/${t.name.toLowerCase()}}`))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some(e=>!0===e.invalid)}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const t of this.calculatedExpressions?.toArray()??[])try{const i=this._arcadeTask.value.arcade.extractFieldLiterals(t.syntax);for(const t of i){const i=t.split("."),r=this.fieldsIndex.get(i.at(-1)??"");r&&e.add(r.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const i of t){const t=this.fieldsIndex.get(i);t&&e.add(t.name)}return null!=this.objectIdField&&e.add(this.objectIdField),e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,i){const r=t.getObjectId()??t.attributes[e.objectIdField];return(await this.getTitles(e,[t],i)).get(r)??""}async getTitles(e,t,i){const r=new Map,n=i?.timeZone??"system";try{const[{substituteFieldsInLinksAndAttributes:s}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);i?.fetchMissingFields&&(t=await this._checkAndReQueryGraphics(e,t));const{fieldInfoMap:a,workingTitle:l}=this,o=l&&a;t.forEach(t=>{const i=t.getObjectId()??t.attributes[e.objectIdField],u=o?s({attributes:t.attributes,expressionAttributes:null,fieldInfoMap:a,globalAttributes:this._createFormattedAttributes(e,t,n).global,layer:e,text:l}):"";r.set(i,u)})}catch{}return r}async _checkAndReQueryGraphics(e,t){const i=t.map(t=>t.getObjectId()??t.attributes[e.objectIdField]).filter(s.Ru);if(i.length!==t.length)return t;if(t.some(e=>!(0,c.Kl)(e,this.requiredFields))){const r=e.createQuery();r.where="1=1",r.outFields=[...this.requiredFields],r.objectIds=i;const n=await e.queryFeatures(r);if(n?.features.length===t.length)return n.features}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const i of e){if(!i.fieldName)continue;const e=this.fieldsIndex.get(i.fieldName),r=e?.name??i.fieldName;i.fieldName=r,t.set(r.toLowerCase(),i)}return t}_createFormattedAttributes(e,t,i="system"){const r=this.effectivePopupTemplate?.fieldInfos??[],n={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const i=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{n[`expression/${e.name}`]=e.func({vars:{$feature:i}})}catch{}}const s={...t.attributes,...n};return{global:this._featureUtils.formatAttributes({fieldInfos:r,attributes:s,graphic:t,timeZone:i,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return(0,c.nw)(e).filter(e=>!(e.startsWith("relationships/")||e.startsWith("expression/")))}};(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"_arcadeTask",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"_featureUtils",void 0),(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"featureUtilsPromise",null),(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"calculatedExpressions",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"displayField",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"effectivePopupTemplate",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"expressionsUsedInTitle",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fieldsIndex",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fieldInfoMap",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fields",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"objectIdField",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"requiredFields",null),h=(0,r.Cg)([(0,u.$)("esri.layers.support.TitleCreator")],h)},22671:(e,t,i)=>{i.d(t,{A:()=>m});var r,n=i(31635),s=i(52106),a=i(66552),l=i(25482),o=i(4718),u=i(10107),c=(i(44208),i(53966),i(36005)),d=i(40608),h=i(43937),f=i(16930),p=i(65864),y=i(50498),g=i(20437);const _=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=r=class extends l.o{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,s.A)}writeGeometryType(e,t,i,r){if(e)return void _.write(e,t,i,r);const{features:n}=this;if(n)for(const e of n)if(null!=e?.geometry)return void _.write(e.geometry.type,t,i,r)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,r=(0,p.rS)(e);return r&&!i&&t.spatialReference&&(r.spatialReference=f.A.fromJSON(t.spatialReference)),r}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new r(this.cloneProperties())}cloneProperties(){return(0,o.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const r=t.features[i];if(r.geometry){const t=e?.[i];r.geometry=t?.toJSON()||r.geometry}}return t}quantize(e){const{scale:[t,i],translate:[r,n]}=e,s=this.features,a=this._getQuantizationFunction(this.geometryType,e=>Math.round((e-r)/t),e=>Math.round((n-e)/i));for(let e=0,t=s.length;e<t;e++)a?.(s[e].geometry)||(s.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[r,n],scale:[s,a]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,e=>e*s+r,e=>n-e*a,l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,i){const r=f.A.fromJSON(t.spatialReference),n=[];for(let t=0;t<e.length;t++){const s=e[t],a=i.fromJSON(s),l=s.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=r);const o=s.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],i=o[e],n=i?.spatialReference;null==t||n||(t.spatialReference=r)}n.push(a)}return n}_quantizePoints(e,t,i){let r,n;const s=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=i(l[1]);e===r&&a===n||(s.push([e-r,a-n]),r=e,n=a)}else r=t(l[0]),n=i(l[1]),s.push([r,n])}return s.length>0?s:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const r=(0,p.Bi)(e)?e.rings:e.paths,n=[];for(let e=0,s=r.length;e<s;e++){const s=r[e],a=this._quantizePoints(s,t,i);a&&n.push(a)}return n.length>0?((0,p.Bi)(e)?e.rings=n:e.paths=n,e):null}:"multipoint"===e?e=>{const r=this._quantizePoints(e.points,t,i);return r&&r.length>0?(e.points=r,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,r,n){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),r&&(e.z=r(e.z))}:"polyline"===e||"polygon"===e?e=>{const s=(0,p.Bi)(e)?e.rings:e.paths;let a,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];for(let e=0,n=r.length;e<n;e++){const n=r[e];e>0?(a+=n[0],l+=n[1]):(a=n[0],l=n[1]),n[0]=t(a),n[1]=i(l)}}if(r&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2]),i[3]=n(i[3])}}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=n(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),r&&null!=e.zmax&&null!=e.zmin&&(e.zmax=r(e.zmax),e.zmin=r(e.zmin)),n&&null!=e.mmax&&null!=e.mmin&&(e.mmax=n(e.mmax),e.mmin=n(e.mmin))}:"multipoint"===e?e=>{const s=e.points;let a,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(a+=r[0],l+=r[1]):(a=r[0],l=r[1]),r[0]=t(a),r[1]=i(l)}if(r&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2]),t[3]=n(t[3])}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2])}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=n(t[2])}}:null}};(0,n.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,n.Cg)([(0,u.MZ)({type:[s.A],json:{write:!0}})],m.prototype,"features",void 0),(0,n.Cg)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,n.Cg)([(0,u.MZ)({type:[g.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,n.Cg)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:_.read}}})],m.prototype,"geometryType",void 0),(0,n.Cg)([(0,h.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,n.Cg)([(0,u.MZ)({types:y.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,n.Cg)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,n.Cg)([(0,u.MZ)({type:f.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,n.Cg)([(0,h.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,n.Cg)([(0,u.MZ)({json:{write:!0}})],m.prototype,"transform",void 0),m=r=(0,n.Cg)([(0,d.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0},30235:(e,t,i)=>{i.d(t,{A:()=>p});var r=i(52106),n=i(87449),s=i(11221),a=i(89169),l=i(33325),o=i(80609),u=i(39516),c=i(91075),d=i(29784),h=i(33143),f=i(20437);class p extends s.A{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 l.gO}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(),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||this._layer.objectIdField===i.name)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.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._databaseType=0,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return 0}_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}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,e.outFields=this._overrideFields??["*"],e.returnGeometry=!this._removeGeometry,e}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new r.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,n){let s="",l=!1;if(null!==r&&(s=r.constructClause(),l=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.A([],[],!0,null);const c=this._createQuery();c.where=(0,u.mA)(c.where,null===i?null===t?"1=1":"":(0,o.YY)(i,0)),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==s?s.split(","):null,c.geometry=null===t?null:t,c.relationParameter=this._makeRelationshipParam(e);const d=await this._layer.queryFeatures(c);if(null===d)return new a.A([],[],l,null);this._checkCancelled(n);const h=[];return d.features.forEach(e=>{const t=e.attributes[this._layer.objectIdField];h.push(t),this._featureCache[t]=this._changeFeature(e)}),new a.A([],h,l,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;if(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 a.A([],e,!1,null),this._wset}const e=this._createQuery();e.where="1=1";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 a.A([],i,!1,null),this._wset}async _getFeatures(e,t,i){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);for(let n=e._lastFetchedIndex;n<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[n]]&&(e._known[n]!==t&&r.push(e._known[n]),r.length>i)));n++);if(0===r.length)return"success";throw new n.d("MissingFeatures")}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 r=e.layerDefinition.typeIdField??"",n=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)n.push(h.A.fromJSON(t));let s=e.layerDefinition.geometryType;void 0===s&&(s=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const r of e.layerDefinition.fields)if("oid"===r.type||"esriFieldTypeOID"===r.type){i=r.name,t=!0;break}if(!1===t){let t="FID",r=!0,n=0;for(;r;){let i=!0;for(const r of e.layerDefinition.fields)if(r.name===t){i=!1;break}!0===i?r=!1:(n++,t="FID"+n.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const s=[];for(let i=0;i<a.length;i++)s.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),s[i].attributes[t]=i;a=s,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.A?o.push(t):o.push(f.A.fromJSON(t));let u=s;switch(u||(u=""),u){case"esriGeometryPoint":u="point";break;case"esriGeometryPolyline":u="polyline";break;case"esriGeometryPolygon":u="polygon";break;case"esriGeometryEnvelope":u="extent";break;case"esriGeometryMultipoint":u="multipoint";break;case"":case"esriGeometryNull":u="esriGeometryNull"}if("esriGeometryNull"!==u)for(const e of a)e.geometry&&e.geometry instanceof c.A==0&&(e.geometry.type=u,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const y={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:n,typeIdField:r,objectIdField:i,spatialReference:t},g="esriGeometryNull"===u||null===u;g||(y.geometryType=u);const _=new d.default(y);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&_.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new p({layer:_,spatialReference:t,isTable:g})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();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""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},32730:(e,t,i)=>{i.d(t,{BI:()=>g,D3:()=>p,XJ:()=>y,lc:()=>f,mX:()=>m,rU:()=>_,tH:()=>S});var r=i(799);const n="__begin__",s="__end__",a=new RegExp(n,"ig"),l=new RegExp(s,"ig"),o=new RegExp("^"+n,"i"),u=new RegExp(s+"$","i"),c='"',d=c+" + ",h=" + "+c;function f(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function p(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function y(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=f(e.labelExpression),t.type="conventional"),t}function g(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return m(t.expression);case"arcade":return t.expression}return null}function _(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(w);return t?.[1].trim()||null}(t.expression);case"arcade":return S(t.expression)}return null}function m(e){let t;return e?(t=(0,r.HC)(e,e=>n+'$feature["'+e+'"]'+s),t=o.test(t)?t.replace(o,""):c+t,t=u.test(t)?t.replace(u,""):t+c,t=t.replaceAll(a,d).replaceAll(l,h)):t='""',t}const w=/^\s*\{([^}]+)\}\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,I=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function S(e){if(!e)return null;let t=b.exec(e)||F.exec(e);return t?t[1]||t[3]:(t=I.exec(e),t?t[2]:null)}},32756:(e,t,i)=>{i.d(t,{Rr:()=>o,fY:()=>c,ne:()=>u});var r=i(31635),n=i(93637),s=i(10107),a=(i(44208),i(53966),i(87811),i(40608)),l=i(91880);function o(e,t,i){if(!e)return null;const r=e.find(e=>!!e.field);if(!r)return null;const n=new l.A;return n.read(r,i),[n]}const u={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:o},write:{writer:function(e,t,i,r){const s=e.find(e=>!!e.field);s&&(0,n.sM)(i,[s.toJSON()],t)}}}},c=e=>{const t=e;let i=class extends t{constructor(){super(...arguments),this.orderBy=null}};return(0,r.Cg)([(0,s.MZ)(u)],i.prototype,"orderBy",void 0),i=(0,r.Cg)([(0,a.$)("esri.layers.mixins.OrderedLayer")],i),i}},33143:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(31635),n=i(69540),s=i(25482),a=i(10107),l=(i(44208),i(53966),i(87811),i(36005)),o=i(40608),u=i(43937),c=i(80451),d=i(29005);let h=class extends((0,n.OU)(s.o)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,c.rS)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"id",void 0),(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"domains",void 0),(0,r.Cg)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,r.Cg)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,r.Cg)([(0,a.MZ)({type:[d.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,r.Cg)([(0,o.$)("esri.layers.support.FeatureType")],h)},35704:(e,t,i)=>{i.d(t,{A:()=>d});var r=i(87449),n=i(11221),s=i(89169),a=i(33325),l=i(80609),o=i(74887),u=i(88368),c=i(16930);class d extends n.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.A?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),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.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new c.A({wkid:4326}),this.geometryType=a.ik.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 s.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new s.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return 1===t?t:(t=this._idstates[e],void 0===t?2:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.$X)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const r=new s.A([],e,!1,null),n=Math.min(t,e.length);if(await(this._parent?._getFeatures(r,-1,n,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<n;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=0:this._idstates[e[t]]=1}return"success"}const a=[];for(let t=0;t<n;t++){const i=this._parent?._featureFromCache(e[t]);a.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===a[i]?this._idstates[e[i]]=0:this._idstates[e[i]]=1;return"success"}async _getFilteredSet(e,t,i,r,n){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.kg)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,r,n);let o;return this._checkCancelled(n),o=null!==this._whereClauseFunction?new s.A(a._candidates.slice().concat(a._known.slice()),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new s.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,i,r,n,s,a){if(null!==this._whereClauseFunction)return null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1};let o=this._whereclause;null!==n&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,n));const u=await this._parent._stat(e,t,i,r,o,s,a);return!1===u.calculated?null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,r,n){return null===this._whereClauseFunction&&(null!==n?null!==this._whereclause&&(n=(0,l.kg)(this._whereclause,n)):n=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,r,n))}async _getAggregatePagesDataSourceDefinition(e,t,i,n,s,a,o){if(null===this._parent)throw new r.d("NeverReach");return null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,n,s,a,o)}static registerAction(){n.A._featuresetFunctions.filter=function(e){if("function"==typeof e)return new d({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.A&&(t=e),new d({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},36708:(e,t,i)=>{i.d(t,{C_:()=>h,OH:()=>y,Vh:()=>g,on:()=>d,pc:()=>_,wB:()=>o,z7:()=>u});var r=i(37955),n=i(36563),s=i(97768),a=i(74887),l=i(14012);function o(e,t,i={}){return c(e,t,i,f)}function u(e,t,i={}){return c(e,t,i,p)}function c(e,t,i={},r){let n=null;const a=i.once?(e,i)=>{r(e)&&((0,s.xt)(n),t(e,i))}:(e,i)=>{r(e)&&t(e,i)};if(n=(0,l.Cn)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return n}function d(e,t,i,a={}){let l=null,u=null,c=null;function d(){l&&u&&(u.remove(),a.onListenerRemove?.(l),l=null,u=null)}function h(e){a.once&&a.once&&(0,s.xt)(c),i(e)}const f=o(e,(e,i)=>{d(),(0,r.wb)(e)&&(l=e,u=(0,r.on)(e,t,h),a.onListenerAdd?.(e))},{sync:a.sync,initial:!0});return c=(0,n.hA)(()=>{f.remove(),d()}),c}function h(e,t){return function(e,t,i){if((0,a.G4)(i))return Promise.reject((0,a.NK)());const r=e();if(t?.(r))return Promise.resolve(r);let l=null;function o(){l=(0,s.xt)(l)}return new Promise((r,s)=>{l=(0,n.vE)([(0,a.u7)(i,()=>{o(),s((0,a.NK)())}),c(e,e=>{o(),r(e)},{sync:!1,once:!0},t??f)])})}(e,p,t)}function f(e){return!0}function p(e){return!!e}i(80559);const y={sync:!0},g={initial:!0},_={sync:!0,initial:!0}},37539:(e,t,i)=>{i.d(t,{pO:()=>y,jd:()=>h,Tp:()=>f,w5:()=>d});var r=i(34727),n=i(83047),s=i(73941),a=i(79258);Math.PI;const l=a.$O.radius,o=a.$O.eccentricitySquared,u={a1:l*o,a2:l*o*l*o,a3:l*o*o/2,a4:l*o*l*o*2.5,a5:l*o+l*o*o/2,a6:1-o};a.$O.radius,a.$O.flattening,a.Sw.radius,a.Sw.flattening,a.sH.radius,a.sH.flattening,a.sH.radius;var c=i(21325);const d={2:{5:y,7:null,9:null,10:y,1:S,6:null,8:null,0:null,3:_,11:m,2:y,4:x},5:{5:y,7:null,9:null,10:y,1:S,6:null,8:null,0:null,3:_,11:m,2:y,4:x},7:{5:null,7:y,9:null,10:y,1:null,6:I,8:null,0:null,3:null,11:null,2:null,4:null},9:{5:null,7:null,9:y,10:y,1:null,6:null,8:F,0:null,3:null,11:null,2:null,4:null},3:{5:g,7:null,9:null,10:g,1:function(e,t,i,r){const n=e[t]/P,s=N-2*Math.atan(Math.exp(-e[t+1]/P)),a=P+e[t+2],l=Math.cos(s)*a;i[r]=Math.cos(n)*l,i[r+1]=Math.sin(n)*l,i[r+2]=Math.sin(s)*a},6:null,8:null,0:null,3:y,11:function(e,t,i,r){g(e,t,i,r),m(i,r,i,r)},2:g,4:function(e,t,i,r){g(e,t,i,r),x(i,r,i,r)}},4:{5:R,7:null,9:null,10:R,1:function(e,t,i,r){R(e,t,i,r),S(i,r,i,r)},6:null,8:null,0:null,3:function(e,t,i,r){R(e,t,i,r),_(i,r,i,r)},11:function(e,t,i,r){R(e,t,i,r),m(i,r,i,r)},2:R,4:y},1:{5:C,7:null,9:null,10:C,1:y,6:null,8:null,0:null,3:function(e,t,i,r){C(e,t,i,r),_(i,r,i,r)},11:function(e,t,i,r){C(e,t,i,r),m(i,r,i,r)},2:C,4:function(e,t,i,r){C(e,t,i,r),x(i,r,i,r)}},6:{5:null,7:T,9:null,10:T,1:null,6:y,8:null,0:null,3:null,11:null,2:null,4:null},8:{5:null,7:null,9:A,10:A,1:null,6:null,8:y,0:null,3:null,11:null,2:null,4:null},0:{5:null,7:null,9:null,10:null,1:null,6:null,8:null,0:y,3:null,11:null,2:null,4:null},10:{5:y,7:y,9:y,10:y,1:S,6:I,8:F,0:null,3:_,11:m,2:y,4:x},11:{5:w,7:null,9:null,10:w,1:function(e,t,i,r){w(e,t,i,r),S(i,r,i,r)},6:null,8:null,0:null,3:function(e,t,i,r){w(e,t,i,r),_(i,r,i,r)},11:y,2:w,4:function(e,t,i,r){w(e,t,i,r),x(i,r,i,r)}}};function h(e,t){return f(e,t)?.projector}function f(e,t){if(null==e||null==t)return null;if(k.source.spatialReference===e&&k.dest.spatialReference===t)return k;const i=p(e,k.source),r=p(t,k.dest);return 0===i&&0===r?(0,c.aI)(e,t)?k.projector=y:k.projector=null:k.projector=d[i][r],k}function p(e,t){return e?t.spatialReference===e?t.spatialReferenceId:(t.spatialReference=e,"metersPerUnit"in t&&(t.metersPerUnit=(0,n.GA)(e,1)),(0,s.jA)(e)?t.spatialReferenceId=1:(0,c.oT)(e)?t.spatialReferenceId=2:(0,c.K8)(e)?t.spatialReferenceId=3:(0,c.r1)(e)?t.spatialReferenceId=11:e.wkt===s.Ro.wkt?t.spatialReferenceId=4:4490===e.wkid?t.spatialReferenceId=5:e.wkt===s.FY.wkt?t.spatialReferenceId=6:e.wkt===s.LJ.wkt?t.spatialReferenceId=8:(0,c.q8)(e)?t.spatialReferenceId=7:(0,c.KQ)(e)?t.spatialReferenceId=9:t.spatialReferenceId=0):0}function y(e,t,i,r){e!==i&&(i[r++]=e[t++],i[r++]=e[t++],i[r]=e[t])}function g(e,t,i,r){i[r]=L*(e[t]/P),i[r+1]=L*(N-2*Math.atan(Math.exp(-e[t+1]/P))),i[r+2]=e[t+2]}function _(e,t,i,n){!function(e,t,i,n,s){const a=.4999999*Math.PI,l=(0,r.qE)(D*e[t+1],-a,a),o=Math.sin(l);i[n++]=D*e[t]*s.radius,i[n++]=s.halfSemiMajorAxis*Math.log((1+o)/(1-o)),i[n]=e[t+2]}(e,t,i,n,a.$O)}function m(e,t,i,r){i[r]=e[t]*M,i[r+1]=e[t+1]*M,i[r+2]=e[t+2]}function w(e,t,i,r){i[r]=e[t]*E,i[r+1]=e[t+1]*E,i[r+2]=e[t+2]}function b(e,t,i,r,n){const s=n+e[t+2],a=D*e[t+1],l=D*e[t],o=Math.cos(a)*s;i[r]=Math.cos(l)*o,i[r+1]=Math.sin(l)*o,i[r+2]=Math.sin(a)*s}function F(e,t,i,r){b(e,t,i,r,a.Sw.radius)}function I(e,t,i,r){b(e,t,i,r,a.sH.radius)}function S(e,t,i,r){b(e,t,i,r,a.$O.radius)}function v(e,t,i,n,s){const a=e[t],l=e[t+1],o=e[t+2],u=Math.sqrt(a*a+l*l+o*o),c=(0,r.YN)(o/(0===u?1:u)),d=Math.atan2(l,a);i[n++]=L*d,i[n++]=L*c,i[n]=u-s}function A(e,t,i,r){v(e,t,i,r,a.Sw.radius)}function T(e,t,i,r){v(e,t,i,r,a.sH.radius)}function C(e,t,i,r){v(e,t,i,r,a.$O.radius)}function x(e,t,i,r){!function(e,t,i,r,n){const s=D*e[t],a=D*e[t+1],l=e[t+2],o=Math.sin(a),u=Math.cos(a),c=n.radius/Math.sqrt(1-n.eccentricitySquared*o*o);i[r++]=(c+l)*u*Math.cos(s),i[r++]=(c+l)*u*Math.sin(s),i[r++]=(c*(1-n.eccentricitySquared)+l)*o}(e,t,i,r,a.$O)}function R(e,t,i,r){const n=u,s=e[t],l=e[t+1],o=e[t+2];let c,d,h,f,p,y,g,_,m,w,b,F,I,S,v,A,T,C,x,R,k;c=Math.abs(o),d=s*s+l*l,h=Math.sqrt(d),f=d+o*o,p=Math.sqrt(f),R=Math.atan2(l,s),y=o*o/f,g=d/f,S=n.a2/p,v=n.a3-n.a4/p,g>.3?(_=c/p*(1+g*(n.a1+S+y*v)/p),x=Math.asin(_),w=_*_,m=Math.sqrt(1-w)):(m=h/p*(1-y*(n.a5-S-g*v)/p),x=Math.acos(m),w=1-m*m,_=Math.sqrt(w)),b=1-a.$O.eccentricitySquared*w,F=a.$O.radius/Math.sqrt(b),I=n.a6*F,S=h-F*m,v=c-I*_,T=m*S+_*v,A=m*v-_*S,C=A/(I/b+T),x+=C,k=T+A*C/2,o<0&&(x=-x),i[r++]=L*R,i[r++]=L*x,i[r]=k}const k={source:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},projector:y},D=(0,r.kU)(1),L=(0,r.KJ)(1),N=.5*Math.PI,P=a.$O.radius,M=P*Math.PI/180,E=180/(P*Math.PI)},40334:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>re,constructFeatureSet:()=>te,constructFeatureSetFromPortalItem:()=>ce,constructFeatureSetFromRelationship:()=>ne,constructFeatureSetFromUrl:()=>ee,convertToFeatureSet:()=>ue,createFeatureSetCollectionFromMap:()=>le,createFeatureSetCollectionFromService:()=>oe,initialiseMetaDataCache:()=>H});var r=i(78888);class n{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(e=!1){return"object, FeatureSetCollection"}}var s=i(78878),a=i(35704),l=i(52106),o=i(59534),u=i(68423),c=i(86691),d=i(87449),h=i(11221),f=i(89169),p=i(87594),y=i(33325),g=i(80609),_=i(1262),m=i(88368);class w{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new w;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,r){const n=new w;n.field=e;const s=m.A.create(t,{fieldsIndex:i,timeZone:r}),a=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 _.L("MissingStatisticParameters");const t=m.A.create((0,g.Mi)(e.parseTree.args.value[0],0,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(s);if(null===a)throw new _.L("UnsupportedSqlFunction",{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(n.typeofstat="MIN",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"min"})}else if("MAX"===l){if(n.typeofstat="MAX",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"max"})}else if("COUNT"===l)n.typeofstat="COUNT",n.workingexpr=a.expr;else if("STDEV"===l){if(n.typeofstat="STDDEV",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"stdev"})}else if("SUM"===l){if(n.typeofstat="SUM",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"sum"})}else if("MEAN"===l){if(n.typeofstat="AVG",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:l})}else if("AVG"===l){if(n.typeofstat="AVG",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"avg"})}else{if("VAR"!==l)throw new _.L("UnsupportedSqlFunction",{function:l});if(n.typeofstat="VAR",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"var"})}return n}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"}}}var b=i(80200),F=i(74639),I=i(44729),S=i(55612),v=i(15032),A=i(16930),T=i(20437),C=i(95466);const x=new o.b(["MIN","MAX","VAR","STDDEV","COUNT","SUM","AVG"],[["VARIANCE","VAR"],["AVERAGE","AVG"],["MEAN","AVG"],["STDEV","STDDEV"]]);class R extends h.A{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 0}_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 r=this._parent?this._parent.getFieldsIndex():new C.A([]);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 w;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof m.A?e.expression:m.A.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=x.lookup(e.statistic)??"COUNT",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 m.A?e.expression:m.A.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};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,this.subtypes=null,this.subtypeField=""}else this.geometryType=y.ik.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new A.A({wkid:4326});this.fields=[];const n=new w;n.field=this._nextUniqueName(e),n.tofieldname=this.objectIdField,n.workingexpr=m.A.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),n.typeofstat="MIN",this._decodedStatsfield.push(n);for(const t of this._decodedGroupbyfield){const i=new T.A;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,g.DA)(t.expression)){const e=this._parent.getField((0,g.YY)(t.expression,0));if(!e)throw new d.d("AggregationFieldNotFound");t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type,t.sqlType=e.type}else{i.type=this._convertToEsriFieldType((0,g.IY)(t.expression,this._parent.fields));const e=new T.A;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new u.Gr(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=i.type}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new u.IO(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new T.A;let r=null;const n=this._decodedStatsfield[t];n.field=this._nextUniqueName(e),n.tofieldname===this.objectIdField&&(this._internalObjectIdField=n.field),i.name=n.tofieldname,i.alias=i.name;const s=null!==n.workingexpr&&(0,g.DA)(n.workingexpr)?(0,g.YY)(n.workingexpr,0):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==s){if(r=this._parent.getField(s),!r)throw new d.d("AggregationFieldNotFound");i.type=r.type}else i.type="double";break;case"MIN":case"MAX":if(""!==s){if(r=this._parent.getField(s),!r)throw new d.d("AggregationFieldNotFound");i.type=r.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==s&&(r=this._parent.getField(s),!r))throw new d.d("AggregationFieldNotFound");i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,r){-1!==t&&this._featureCache[t];const n=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,n)?(await this._expandPagedSet(e,n,0,0,r),this._getFeatures(e,t,i,r)):"success"}async _getFilteredSet(e,t,i,r,n){if(""!==e)return new f.A([],[],!0,null);let s=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,g.Ju)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==r){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===r.scanForField(this._decodedStatsfield[e].tofieldname)){r=null,l.ordered=!1;break}if(null!==r)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===r.scanForField(e.tofieldname)){r=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;r&&(t=this._reformulateOrderClauseWithoutGroupByFields(r));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(n),s=!0===l.nowhereclause?new f.A(a._candidates.slice().concat(a._known.slice()),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new f.A(a._candidates.slice(),a._known.slice(),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),s}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)s=new f.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.A({parentfeatureset:o,orderbyclause:new p.A(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.A({parentfeatureset:e,whereclause:t})}s=new f.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.A({parentfeatureset:e,orderbyclause:new p.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return s}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,g.bD)(e,t.tofieldname,(0,g.YY)(t.workingexpr,0),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,g.bD)(e,t.tofieldname,(0,g.YY)(t.expression,0),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,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const r=await this._getAgregagtePhysicalPage(e,t,i);for(const e of r){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return r.length}_sequentialGetPhysicalItem(e,t,i,r){return new Promise((n,s)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?n(r.length):this._nextAggregateItem(e,t,i,r,s=>{null===s?n(r.length):(t-=1,n(this._sequentialGetPhysicalItem(e,t,i,r)))},s)})}_nextAggregateItem(e,t,i,r,n,a){try{(0,s.a0)(e.pagesDefinition.internal.iterator.next()).then(s=>{if(null===s)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);r.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,n(null)}else e.pagesDefinition.internal.fullyResolved=!0,n(null);else{const l=this._generateAggregateHash(s);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[s],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return r.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[s],id:l},void n(i)}e.pagesDefinition.internal.workingItem.features.push(s)}this._nextAggregateItem(e,t,i,r,n,a)}},a)}catch(e){a(e)}}_calculateFieldStat(e,t,i){const r=[];for(const i of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(i);null!==e&&(e instanceof I.n||e instanceof v.k?r.push(e.toNumber()):e instanceof S.g?r.push(e.toMilliseconds()):r.push(e))}else r.push(null);i.attributes[t.tofieldname]=(0,F.s)(t.typeofstat,[r])}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.features[0].attributes[i.singlefield]:m.A.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=r}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let r=0;r<this._decodedStatsfield.length;r++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[r],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==r?":":":"+r.toString()}return(0,b.d)(t,b.T.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){h.A._featuresetFunctions.groupby=function(e,t){return new R({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var k=i(54784),D=i(54461),L=i(70333),N=i(61454),P=i(66395),M=i(50145),E=i(4576),O=i(39516),j=i(65864),G=i(21325),q=i(29784),B=i(54546),U=i(61956),Z=i(7562);class W extends h.A{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 y.gO}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,y.JB)(e.toJSON());return(0,b.d)(t,b.T.String)}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(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,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 r of this._overrideFields)if(r.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=1,null!=e&&e>=10.61&&(this._databaseType=0)):null!=e&&(e>=10.5&&(this._databaseType=1,this._requestStandardised=!0),e>=10.61&&(this._databaseType=0))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return 0}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.A;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),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}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?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}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const i="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=i(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=i(e)),r}async _getFilteredSet(e,t,i,r,n){const s=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new f.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,r,n);let a="",l=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=r.constructClause(),l=!0);const o=this._createQuery();o.where=(0,O.mA)(o.where,null===i?null===t?"1=1":"":(0,g.YY)(i,s)),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(n),new f.A([],u,l,null)}_expandPagedSet(e,t,i,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}async _getFilteredSetUsingPaging(e,t,i,r,n){let s="",a=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(s=r.constructClause(),a=!0);const l=await this.databaseType(),o=null===i?null===t?"1=1":"":(0,g.YY)(i,l);let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);let d=null;if(!0===this._pageJustIds)d=new f.A([],["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:s,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const r=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new f.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:r.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:s,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,n),d}_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 r=e.pagesDefinition.internal.lastRetrieved,n=r,s=e.pagesDefinition.internal.lastPage,a=this._createQuery();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=(0,O.mA)(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!==s)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[n+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=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=r+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();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,r){const n=[];if(-1!==t&&void 0===this._featureCache[t]&&n.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,r),this._getFeatures(e,t,i,r);let s=0;for(let r=e._lastFetchedIndex;r<e._known.length;r++){if(e._lastFetchedIndex+=1,s++,void 0===this._featureCache[e._known[r]]){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[r]]){const n=t._featureMap[e._known[r]];null!==n&&(i=!0,this._featureCache[e._known[r]]=n)}}if(!1===i&&(e._known[r]!==t&&n.push(e._known[r]),n.length>=this._maxProcessingRate()-1))break}if(s>=i&&0===n.length)break}if(0===n.length)return"success";const a=this._createQuery();a.objectIds=n,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(r),void 0!==l.error)throw new d.d("RequestFailed",{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,r,n,s,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===c.toLowerCase()){c=h[e].name;break}const f=this._createQuery();f.where=(0,O.mA)(f.where,null===s?null===n?"1=1":"":(0,g.YY)(s,u)),f.spatialRelationship=this._makeRelationshipEnum(r),f.relationParameter=this._makeRelationshipParam(r),f.geometry=null===n?null:n,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[c];const p=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!p.hasOwnProperty("features"))throw new d.d("InvalidStatResponse");let y=!1;for(let e=0;e<h.length;e++)if(h[e].name===c){"date"===h[e].type&&(y=!0);break}for(let e=0;e<p.features.length;e++){if(y){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,r,n,s,a,l,o)}:l}async _distinctStat(e,t,i,r,n,s,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,r,n,s,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,r){const n=await this.databaseType();if(this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};const s=this._createQuery();return s.where=(0,O.mA)(s.where,null===r?null===i?"1=1":"":(0,g.YY)(r,n)),s.spatialRelationship=this._makeRelationshipEnum(t),s.relationParameter=this._makeRelationshipParam(t),s.geometry=null===i?null:i,s.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(s,"executeForCount")}}async _stats(e,t,i,r,n,s,a){await this._ensureLoaded();const l=this._layer.capabilities?.query,o=!!l?.supportsSqlExpression,u=!!l?.supportsStatistics,c=!!l?.supportsDistinct;if("count"===e)return c?this._countstat(e,i,r,n):{calculated:!1};if(!1===u||!1===(0,g.DA)(t)&&!1===o||!1===t.isStandardized)return""!==i||null!==n?{calculated:!1}:this._manualStat(e,t,s,a);if("distinct"===e)return!1===c?""!==i||null!==n?{calculated:!1}:this._manualStat(e,t,s,a):this._distinctStat(e,t,i,r,n,s,a);const h=await this.databaseType();if(this.isTable()&&r&&null!==i&&""!==i)return{calculated:!0,result:null};const f=this._createQuery();f.where=(0,O.mA)(f.where,null===n?null===r?"1=1":"":(0,g.YY)(n,h)),f.spatialRelationship=this._makeRelationshipEnum(i),f.relationParameter=this._makeRelationshipParam(i),f.geometry=null===r?null:r;const p=new Z.A;p.statisticType=(0,M.Dp)(e),p.onStatisticField=(0,g.YY)(t,h),p.outStatisticFieldName="ARCADE_STAT_RESULT",f.returnGeometry=!1;let y="ARCADE_STAT_RESULT";f.outStatistics=[p];const _=await this.executeQuery(f,"execute");if(!_.hasOwnProperty("features")||0===_.features.length)throw new d.d("InvalidStatResponse");let m=!1;const w=_.fields??[];for(let e=0;e<w.length;e++)if("ARCADE_STAT_RESULT"===w[e].name.toUpperCase()){y=w[e].name,"date"===w[e].type&&(m=!0);break}if(m){let e=_.features[0].attributes[y];return null!==e&&(e=new Date(_.features[0].attributes[y])),{calculated:!0,result:e}}return{calculated:!0,result:_.features[0].attributes[y]}}_stat(e,t,i,r,n,s,a){return this._stats(e,t,i,r,n,s,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const r=this._layer.capabilities?.query,n=!0===r?.supportsSqlExpression;if(null!=r&&!0===r.supportsStatistics&&!0===r.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,g.DA)(t[e].workingexpr)&&!1===n)&&(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,r,n,s,a){await this._ensureLoaded();const l=await this.databaseType();let o=null;if(!this._layer.capabilities.query.supportsPaginationOnAggregatedQueries){const t=this.getFieldsIndex();o={keyFields:e.map((e,i)=>({name:t.normalizeFieldName(e)??e,asc:null==s||1===s._directions[i]}))}}let u="",c=!1;null!=s&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==o||(0,E.MJ)(e,0,e.length,s._fields,0,Math.min(s._fields.length,e.length),(e,t)=>e.toLowerCase()===t.toLowerCase()))&&(u=s.constructClause(),c=!0),""===u&&(u=e.join(","));const d=[];for(let e=0;e<t.length;e++){const i=new Z.A;i.onStatisticField=null!==t[e].workingexpr?(0,g.YY)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),d.push(i)}let h=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<h&&(h=p);const y=null===n?null===r?"1=1":"":(0,g.YY)(n,l);return new f.A([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:!1,generatedOid:a,resultRecordCount:h,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===r?null:r,where:y,orderByFields:u,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1,keysetPagination:o}})}async _getAgregagtePhysicalPage(e,t,i){let r=e.pagesDefinition.where;if(!0===e.pagesDefinition.useOIDpagination&&(r=(0,O.mA)(r,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString())),null!=e.pagesDefinition.internal.keysetPagination?.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new d.d("NotImplemented");r=(0,O.mA)(r,(0,g.YY)(e.pagesDefinition.internal.keysetPagination.clause,await this.databaseType()))}const n=e.pagesDefinition.internal.lastRetrieved,s=n,a=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,O.mA)(o.where,r),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 d.d("InvalidStatResponse");const c=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[s+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.A({attributes:u.features[e].attributes,geometry:null}));return e.pagesDefinition.internal.keysetPagination?0!==u.features.length&&u.exceededTransferLimit?function(e,t){null==e.clause&&(e.clause=function(e){if(0===e.length)throw new d.d("NeverReach");const t=[];for(let i=0;i<e.length;i++){const r=e[i],n=[`"${r.name.replaceAll('"','""')}" ${r.asc?">":"<"} @last_${i}`];for(let t=0;t<i;t++){const i=e[t];n.push(`"${i.name.replaceAll('"','""')}" = @last_${t}`)}t.push(n.join(" AND "))}const i=t.join(" OR ");return m.A.create(i)}(e.keyFields));for(let i=0;i<e.keyFields.length;i++){const r=e.keyFields[i].name;e.clause.parameters[`last_${i}`]=t.attributes[r]}}(e.pagesDefinition.internal.keysetPagination,c.at(-1)):e.pagesDefinition.internal.fullyResolved=!0:!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=n+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,r,n){const s=new q.default({url:e,outFields:null===t?["*"]:t});return new W({layer:s,spatialReference:i,lrucache:r,interceptor:n})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,y.Qi)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,r,n){const s=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(s)){const a={objectIds:[e],returnMetadata:n};(t&&t>0||i&&i>0)&&(a.size=[t&&t>0?t:0,i&&i>0?i:t+1]),r&&r.length>0&&(a.attachmentTypes=r),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:s,query:a,method:"attachments"});const l=await s.queryAttachments(new B.A(a)),o=[];return l&&l[e]&&l[e].forEach(t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let r=null;n&&t.exifInfo&&(r=P.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new N.A(t.id,t.name,t.contentType,t.size,i,r,t.keywords??null))}),o}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&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,G.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,r.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const i=t.spatialReference;for(const r of t.relatedRecordGroups){const n=r.objectId,s=[];for(const e of r.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.A({geometry:e.geometry?(0,j.rS)(e.geometry):null,attributes:e.attributes});s.push(t)}e[n]={features:s,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new d.d("InvalidRequest")}async getFeatureByObjectId(e,t){const i=this._createQuery();i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=(0,O.mA)(i.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const r=await this._layer.queryFeatures(i);return 1===r.features.length?r.features[0]:null}async getIdentityUser(){await this.load();const e=L.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=L.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.slice(0,i):t,t){t+="/rest/info";try{const e=await(0,r.A)(t,{query:{f:"json"}});let i="";return e.data?.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new W({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const n=await(0,r.A)(i,{responseType:"json",query:{f:"json"}});e=n?.data?.name??null,t=n?.data?.serviceItemId??null}const n=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===i?null:i,webMapLayerId:n?this._layer.id??null:null,webMapLayerTitle:n?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var V=i(30235),Q=i(26591);class z extends h.A{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,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 y.gO}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(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,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 r of this._overrideFields)if(r.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,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return 0}_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.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,n){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new f.A([],[],!0,null);const s=this._layer.nativeCapabilities();if(!1===s.canQueryRelated)return new f.A([],[],!0,null);if(s.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,r,n);let a="",l=!1;null!==r&&!0===s.capabilities?.queryRelated.supportsOrderBy&&(a=r.constructClause(),l=!0);const o=new Q.default;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 d=await s.source.queryRelatedFeatures(o);this._checkCancelled(n);const h=d[this._findObjectId]?d[this._findObjectId].features:[],p=[];for(let e=0;e<h.length;e++)this._featureCache[h[e].attributes[this._relatedLayer.objectIdField]]=h[e],p.push(h[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,g=null!=i;return new f.A(y||g?p:[],y||g?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();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,r,n){let s="",a=!1;const l=this._layer.nativeCapabilities();null!==r&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(s=r.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,d=null!=i;let h=null,p=!0;!0===this._removeGeometry&&(p=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]);return h=new f.A(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:s,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(h,o,0,0,n),h}_expandPagedSet(e,t,i,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}_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 r=e.pagesDefinition.internal.lastRetrieved,n=r,s=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new Q.default;!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!==s)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[n+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=r+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,r){const n=[];-1!==t&&void 0===this._featureCache[t]&&n.push(t);const s=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,s))return await this._expandPagedSet(e,s,0,0,r),this._getFeatures(e,t,i,r);let a=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[r]&&void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&n.push(e._known[r]),n.length>i)))&&!(a>=i&&0===n.length);r++);if(0===n.length)return"success";throw new d.d("MissingFeatures")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,r,n,s,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,r,n){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,r,n){return this._relatedLayer.queryAttachments(e,t,i,r,n)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var $=i(23732),J=i(92474),Y=i(4146),K=i(80812);function H(){null===$.A.applicationCache&&($.A.applicationCache=new $.A)}async function X(e,t,i){if($.A.applicationCache){const i=$.A.applicationCache.getLayerInfo(e);if(i){const r=await i;return new q.default({url:e,outFields:t,sourceJSON:r})}const r=new q.default({url:e,outFields:t}),n=(async()=>(await r.load(),r.sourceJSON))();if($.A.applicationCache){$.A.applicationCache.setLayerInfo(e,n);try{return await n,r}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return await n,r}if(null!=i){const r=i.getCachedLayerMetadata(e);if(r){const i=await r;return new q.default({url:e,outFields:t,sourceJSON:i})}const n=new q.default({url:e,outFields:t}),s=(async()=>(await n.load(),n.sourceJSON))();i.setCachedLayerMetadata(e,s);try{return await s,n}catch(t){throw i.removeCachedLayerMetadata(e,s),t}}return new q.default({url:e,outFields:t})}async function ee(e,t,i,r,n,s=null){return te(await X(e,["*"],n),t,i,r,n,s)}function te(e,t=null,i=null,r=!0,n=null,s=null){switch(e.type){case"catalog-footprint":return te(e.parent,t,i,r,n,s);case"subtype-sublayer":{const a=te(e.parent,t,i,r,n,s);return a.filter(m.A.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:a.dateFieldsTimeZoneDefaultUTC}))}case"csv":case"geojson":case"knowledge-graph-sublayer":case"wfs":return new V.A({layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:n,interceptor:s});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const a={layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:n,interceptor:s};return!e.url&&e.source?new V.A(a):new W(a)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function ie(e,t){if(null!==$.A.applicationCache){const t=$.A.applicationCache.getLayerInfo(e);if(null!==t)return t}if(null!=t){const i=t.getCachedServiceMetadata(e);if(null!=i)return i}const i=(async()=>{const t=await(0,r.A)(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!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(e,i);try{return await i}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,i);try{return await i}catch(r){throw t.removeCachedServiceMetadata(e,i),r}}return i}async function re(e,t,i){const n={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},s=await ie(e,null);if(n.metadata=s,void 0!==s.controllerDatasetLayers?.utilityNetworkLayerId&&null!==s.controllerDatasetLayers.utilityNetworkLayerId){if(s.layers)for(const e of s.layers)n.layerNameLkp[e.id]=e.name;if(s.tables)for(const e of s.tables)n.layerNameLkp[e.id]=e.name;const a=s.controllerDatasetLayers.utilityNetworkLayerId;n.networkId=a;const l=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==$.A.applicationCache){const e=$.A.applicationCache.getLayerInfo(i);if(null!==e)return e}const n=(async()=>{const i=await(0,r.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new d.d("DataElementsNotFound")})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(i,n);try{return await n}catch(e){throw $.A.applicationCache.clearLayerInfo(i),e}}return n}(e,a);if(l){n.queryelem=l,n.queryelem?.dataElement&&void 0!==n.queryelem.dataElement.schemaGeneration&&(n.unVersion=n.queryelem.dataElement.schemaGeneration),n.lkp={},n.queryelem.dataElement.domainNetworks||(n.queryelem.dataElement.domainNetworks=[]);for(const e of n.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:n.layerNameLkp[t.layerId]??null};n.layerIdLookup.set(e.layerId,e),n.sourceIdLookup.set(e.sourceId,e),e.className&&(n.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:n.layerNameLkp[t.layerId]??null};n.layerIdLookup.set(e.layerId,e),n.sourceIdLookup.set(e.sourceId,e),e.className&&(n.lkp[e.className]=e)}}if(n.queryelem.dataElement.terminalConfigurations)for(const e of n.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)n.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const s=await async function(e){if(null!==$.A.applicationCache){const t=$.A.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.A)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+a);if(void 0!==s.systemLayers?.associationsTableId&&null!==s.systemLayers.associationsTableId){let r=null;if(i&&n.unVersion<8){const i=[];n.unVersion>=4&&(i.push("STATUS"),i.push("PERCENTALONG")),r=await ee(e+"/"+s.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...i],!1,null,null),await r.load(),n.unVersion>=4&&(r=r.filter(m.A.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)",{fieldsIndex:r.getFieldsIndex(),timeZone:r.dateFieldsTimeZoneDefaultUTC})),await r.load())}return{lkp:n.lkp,associations:r,unVersion:n.unVersion,terminals:n.terminals,layerIdLookup:n.layerIdLookup,sourceIdLookup:n.sourceIdLookup}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function ne(e,t,i,r=null,n=null,s=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o=o.endsWith("/")?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await ee(o,r,n,s,a,l);return new z({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:r,outFields:n,includeGeometry:s,lrucache:a,interceptor:l})}a.A.registerAction(),R.registerAction(),c.A.registerAction(),k.A.registerAction(),D.A.registerAction();class se extends n{constructor(e,t=null,i=null,r=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const r=te(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async featureSetByName(e,t=!0,i=null){if((0,J.Zm)(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.title===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find(t=>(0,y.eB)(t)&&t.title===e);if(null!=n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.allTables){const r=this._map.allTables.find(t=>(0,y.eB)(t)&&t.title===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){if((0,J.Zm)(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.id===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find(t=>(0,y.eB)(t)&&t.id===e);if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.allTables){const r=this._map.allTables.find(t=>(0,y.eB)(t)&&t.id===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,i)}return null}}class ae extends n{constructor(e,t=null,i=null,r=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const r=te(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async _loadMetaData(){const e=await ie(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ae(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.title===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=await this._loadMetaData();let s=null;for(const t of n.layers??[])t.name===e&&(s=t);if(!s)for(const t of n.tables??[])t.name===e&&(s=t);if(s){const e=await X(this._url+"/"+s.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.id===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=await this._loadMetaData();let s=null;for(const t of n.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(s=t);if(!s)for(const t of n.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(s=t);if(s){const e=await X(this._url+"/"+s.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}}function le(e,t,i=null,r=null){return new se(e,t,i,r)}function oe(e,t,i=null,r=null){return new ae(e,t,i,r)}function ue(e,t,i,r,n){if(null===e)return null;if((0,s.m)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof Y.A&&(0,y.NI)(e)){const s=e;switch(t){case"datasource":return te(s,n,"outFields"in s?s.outFields:null,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return te(s,n,"outFields"in s?s.outFields:null,!0,i,r)}return null}if((0,s.$)(e)){switch(t){case"datasource":return te(e.parent,n,e.parent.outFields,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return te(e,n,e.parent.outFields,!0,i,r)}return null}return null}async function ce(e,t,i,r,n,s,a,l=null){if($.A.applicationCache){const o=$.A.applicationCache.getLayerInfo(e+":"+s.url);if(o)return de(await o,t,i,r,n,a,l)}if(null!=a){const o=a.getCachedPortalItem(s.url,e);if(null!=o)return await de(await o,t,i,r,n,a,l)}const o=new K.default({id:e,portal:s}).load();$.A.applicationCache?$.A.applicationCache.setLayerInfo(e+":"+s.url,o):null!=a&&a.setCachedPortalItem(s.url,e,o);try{return await de(await o,t,i,r,n,a,l)}catch(t){throw $.A.applicationCache&&$.A.applicationCache.clearLayerInfo(e+":"+s.url),null!=a&&a.removeCachedPortalItem(s.url,e,o),t}}async function de(e,t,i,r,n,s,a){let l;if("Feature Service"===e.type||"Map Service"===e.type)l=await X((0,y.Qi)(e.url??"")+"/"+t,["*"],s);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=s){const t=s.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=Y.A.fromPortalItem(e);s.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(i){throw s.removeCachedPortalItemLayer(e.portal.url,e.id,t),i}}}else l=await Y.A.fromPortalItem(e)}return te(l,i,r,n,s,a)}},41366:(e,t,i)=>{i.d(t,{K:()=>h,Q:()=>u});var r=i(31635),n=i(66552),s=i(53966),a=i(10107),l=(i(44208),i(87811),i(93223)),o=i(40608);const u=(0,n.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),c="percent-of-total",d="field",h=e=>{const t=e;let i=class extends t{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType");const t=!!this.normalizationField,i=null!=this.normalizationTotal;return t||i?(e=t&&d||i&&c||null,t&&i&&s.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==d&&e!==c||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],i.prototype,"normalizationField",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],i.prototype,"normalizationMaxValue",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],i.prototype,"normalizationMinValue",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],i.prototype,"normalizationTotal",void 0),(0,r.Cg)([(0,l.e)(u,{name:"parameters.normalizationType"})],i.prototype,"normalizationType",null),i=(0,r.Cg)([(0,o.$)("esri.rest.support.NormalizationBinParametersMixin")],i),i}},41560:(e,t,i)=>{i.d(t,{Ch:()=>a,mW:()=>s});var r=i(34727),n=i(39516);function s(e,t){return{...t,filterMode:e.mode}}function a(e,t,i){const s=function(e){if("manual"===u(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:i,maxScale:r}of e.filters)t[0]=Math.max(t[0],c(i)),t[1]=Math.min(t[1],d(r));return t}(e);if(s&&((0,r.gg)(t,s[0])||(0,r.ZH)(i,s[1])))return"";const a=Array.from(l(e,t,i)),o=function(e,t,i){if(0===e.length)return!0;const n=c(e.at(0)?.minScale),s=d(e.at(-1)?.maxScale);if((0,r.ZH)(n,t)||(0,r.gg)(s,i))return!0;for(let t=0;t<e.length-1;t++){const i=e[t],n=e[t+1];if((0,r.ZH)(c(n.minScale),d(i.maxScale)))return!0}return!1}(a,t,i)?"1=1":a.map(e=>e.where||"1=1").reduce((e,t)=>(0,n.IW)(e,t),"");return o&&"1=1"!==o?o:""}function*l(e,t,i){if("manual"===u(e)){const t=e.filters.find(t=>t.id===e.activeFilterId);t&&(yield t)}else{"object"==typeof t&&(t=t.scale);for(const r of e.filters)o(r.minScale,r.maxScale,t,i)&&(yield r)}}function o(e,t,i,n){return e=c(e),i=c(i),t=d(t),!(!(0,r.Sp)(i,e)&&(n??i)>e||(0,r.Hx)(t,i)||void 0!==n&&(0,r.Sp)(n,e))}function u(e){return"mode"in e?e.mode:e.filterMode}function c(e){return e||Number.POSITIVE_INFINITY}function d(e){return e||0}},46140:(e,t,i)=>{i.d(t,{R:()=>n});var r=i(49186);let n=class e{constructor(e,t,i=""){this.major=e,this.minor=t,this._context=i}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",i=this._context&&this._context+" ";throw new r.A(t+"unsupported-version",`Required major ${i}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,i=""){const[n,s]=t.split("."),a=/^\s*\d+\s*$/;if(!n?.match||!a.test(n))throw new r.A((i&&i+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!s?.match||!a.test(s))throw new r.A((i&&i+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const l=parseInt(n,10),o=parseInt(s,10);return new e(l,o,i)}}},50498:(e,t,i)=>{i.d(t,{Ye:()=>d,gy:()=>c,yR:()=>h});var r=i(66552),n=i(5443),s=i(91075),a=i(48526),l=i(86738),o=i(39829),u=i(82799);const c=(0,r.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),d=(0,r.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"}),h={base:s.A,key:"type",typeMap:{extent:n.A,multipoint:a.A,point:l.A,polyline:u.A,polygon:o.A}}},52106:(e,t,i)=>{i.d(t,{A:()=>b});var r,n=i(31635),s=i(13874),a=i(69540),l=i(51447),o=i(25482),u=i(53966),c=i(36708),d=i(24326),h=i(10107),f=(i(44208),i(87811),i(40608)),p=i(12195),y=i(65864),g=i(50498),_=i(54339),m=i(33910);function w(e){if(null==e)return null;const t={};for(const i in e){const r=e[i];r&&(t[i]=r.toJSON())}return 0!==Object.keys(t).length?t:null}let b=class extends((0,a.OU)(o.o)){static{r=this}constructor(e){super(e),this.isAggregate=!1,this.layer=null,this.origin=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:(0,d.c)(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&(0,l.eF)(u.A.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(e){const t=this._get("aggregateGeometries");JSON.stringify(t)!==JSON.stringify(e)&&this._set("aggregateGeometries",e)}set attributes(e){const t=this._get("attributes");t!==e&&(this._set("attributes",e),this._notifyLayer("attributes",t,e))}set geometry(e){const t=this._get("geometry");t!==e&&(this._set("geometry",e),"mesh"!==e?.type&&this._notifyLayer("geometry",t,e))}set popupTemplate(e){const t=this._get("popupTemplate");t!==e&&(this._set("popupTemplate",e),this._notifyLayer("popupTemplate",t,e))}set symbol(e){const t=this._get("symbol");t!==e&&(this._set("symbol",e),this._notifyLayer("symbol",t,e))}get version(){return this._version}set visible(e){const t=this._get("visible");t!==e&&(this._set("visible",e),this._notifyLayer("visible",t,e))}cloneShallow(){return new r({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(e=!1){if(this.popupTemplate)return this.popupTemplate;const t=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const i of[t,this.sourceLayer,this.layer])if(i&&"object"==typeof i){if("popupTemplate"in i&&i.popupTemplate)return i.popupTemplate;if(e&&"defaultPopupTemplate"in i&&null!=i.defaultPopupTemplate)return i.defaultPopupTemplate}return null}getAttribute(e){return this.attributes?.[e]}setAttribute(e,t){if(this.attributes){const i=this.getAttribute(e);this.attributes[e]=t,this._notifyLayer("attributes",i,t,e)}else this.attributes={[e]:t}}getObjectId(){const e=this.sourceLayer??this.layer;return e?(0,_.r)(this,e):null}getGlobalId(){const e=this.sourceLayer??this.layer;return e&&"globalIdField"in e&&e.globalIdField?this.getAttribute(e.globalIdField):null}toJSON(){return{aggregateGeometries:w(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:(0,p.W)(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(e={}){const{geometry:t}=this;if("mesh"===t?.type){const i={origin:t.origin,transform:t.transform};this._notifyLayer("origin-transform",i,i,e.action)}}_notifyLayer(e,t,i,r){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const n={graphic:this,property:e,oldValue:t,newValue:i};"origin-transform"===e&&(n.action=r),"attributes"===e&&(n.attributeName=r),this.layer.graphicChanged(n)}_watchMeshGeometryChanges(){this.addHandles([(0,c.z7)(()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0,({localMatrix:e,origin:t})=>{this._lastMeshTransform.localMatrix===e&&this._lastMeshTransform.origin===t||(this._lastMeshTransform.localMatrix=e,this._lastMeshTransform.origin=t,this.notifyMeshTransformChanged())}),(0,c.z7)(()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0,()=>{const e=this.geometry;"mesh"===e?.type&&e.vertexSpace.origin?(this._lastMeshTransform.localMatrix=e.transform?.localMatrix,this._lastMeshTransform.origin=e.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)},{equals:(e,t)=>e===t,sync:!0})])}};(0,n.Cg)([(0,h.MZ)({value:null,json:{read:function(e){if(!e)return null;const t={};for(const i in e){const r=(0,y.rS)(e[i]);r&&(t[i]=r)}return 0!==Object.keys(t).length?t:null}}})],b.prototype,"aggregateGeometries",null),(0,n.Cg)([(0,h.MZ)({value:null})],b.prototype,"attributes",null),(0,n.Cg)([(0,h.MZ)({value:null,types:g.yR,json:{read:y.rS}})],b.prototype,"geometry",null),(0,n.Cg)([(0,h.MZ)({type:Boolean})],b.prototype,"isAggregate",void 0),(0,n.Cg)([(0,h.MZ)({clonable:!1})],b.prototype,"layer",void 0),(0,n.Cg)([(0,h.MZ)({clonable:"reference"})],b.prototype,"origin",void 0),(0,n.Cg)([(0,h.MZ)({type:s.A,value:null})],b.prototype,"popupTemplate",null),(0,n.Cg)([(0,h.MZ)({clonable:"reference"})],b.prototype,"sourceLayer",void 0),(0,n.Cg)([(0,h.MZ)({value:null,types:m.Es})],b.prototype,"symbol",null),(0,n.Cg)([(0,h.MZ)({clonable:!1,json:{read:!1,write:!1}})],b.prototype,"_version",void 0),(0,n.Cg)([(0,h.MZ)({type:Boolean,value:!0})],b.prototype,"visible",null),b=r=(0,n.Cg)([(0,f.$)("esri.Graphic")],b)},54461:(e,t,i)=>{i.d(t,{A:()=>a});var r=i(87449),n=i(11221),s=i(89169);class a extends n.A{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 s.A(t._candidates.slice(),t._known.slice(),!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(1===t)return t;const i=this._idstates[e];return 0===i||1===i?i:0===t&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=0,this._countedin++,0):(this._idstates[e]=1,1):2}async _expandPagedSet(e,t,i,n,s){if(null===this._parent)throw new r.d("NotImplemented");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 a=await this._parent._expandPagedSet(e,t,i,n,s);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,i,r){const n=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,r),this._getFeatures(e,t,i,r);-1!==t&&void 0===this._featureCache[t]&&n.push(t);let l=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&n.push(e._known[r]),n.length>a)));r++);if(0===n.length)return"success";const o=new s.A([],n,!1,null),u=Math.min(n.length,i);await this._parent._getFeatures(o,-1,u,r);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,r,n){await this._ensureLoaded();const a=await this._getSet(n);return new s.A(a._candidates.slice().concat(a._known.slice()),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,r=null;const n=[];for(let s=0;s<e._candidates.length;s++){const a=this._isInFeatureSet(e._candidates[s]);if(0===a){if(e._known.push(e._candidates[s]),i+=1,null===r?r={start:s,end:s}:r.end===s-1?r.end=s:(n.push(r),r={start:s,end:s}),e._known.length>=this._topnum)break}else if(1===a)null===r?r={start:s,end:s}:r.end===s-1?r.end=s:(n.push(r),r={start:s,end:s}),i+=1;else if(2===a)break;if(i>=t)break}null!==r&&n.push(r);for(let t=n.length-1;t>=0;t--)e._candidates.splice(n[t].start,n[t].end-n[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(){n.A._featuresetFunctions.top=function(e){return new a({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},55674:(e,t,i)=>{i.d(t,{Ad:()=>f,Gj:()=>g,QY:()=>h,lL:()=>_,xR:()=>p});var r=i(66131),n=i(49186),s=(i(44208),i(44729)),a=i(15032),l=i(65864),o=i(95466),u=i(43668),c=i(98623);const d=["geometry","scale","timeProperties"];function h(e,t){if(null!=t)for(const i of d)t.hasArcadeDependency(i)&&e.add(i);return e}function f(e,t){return y.create(e,t,null,["$feature","$view"])}function p(e,t,i){return y.create(e,t,i,["$feature","$view","$config"])}class y{static async create(e,t,i,r){const{arcade:s,Dictionary:a}=await(0,u.l)();let l;try{l=s.parseScript(e)}catch(t){throw new n.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const o=s.scriptUsesGeometryEngine(l);o&&await s.enableGeometrySupport(),await s.loadDependentModules(new Set,l,null,!1,o);const c={vars:r.reduce((e,t)=>({...e,[t]:null}),{}),spatialReference:t,useAsync:!1},d=s.compileScript(l,c);let h=null;null!=i&&(h=new a(i),h.immutable=!0);const f=new a;return f.immutable=!1,f.setField("scale",0),new y(e,s,l,d,t,f,h,a)}constructor(e,t,i,r,n,s,a,l){this.script=e,this._arcade=t,this._syntaxTree=i,this._compiled=r,this._spatialReference=n,this._viewDict=s,this._configDict=a,this._dictionaryCtor=l,this._dependencies=new Map,this._featureReader=new g,this._dependencies.set("geometry",t.scriptTouchesGeometry(this._syntaxTree)),this._dependencies.set("scale",this._arcade.referencesMember(this._syntaxTree,"scale")),this._dependencies.set("timeProperties",this._arcade.scriptUsesViewProperties(this._syntaxTree,["timeProperties"]))}evaluate(e,t){const i=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:n,currentEnd:s}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=n?null!=i?r.lY.epochToArcadeDate(n,i):r.lY.unknownEpochToArcadeDate(n):void 0,currentEnd:null!=s?null!=i?r.lY.epochToArcadeDate(s,i):r.lY.unknownEpochToArcadeDate(s):void 0,startIncluded:!0,endIncluded:!0})}this._viewDict.setField("timeProperties",e)}return this._compiled({vars:{$view:this._viewDict,$config:this._configDict,$feature:e},spatialReference:this._spatialReference,timeZone:i})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class g{constructor(){this._boundTarget=null,this._boundSchema={fields:null,fieldsIndex:null,spatialReference:null,get geometryType(){return null},get objectIdField(){return null}},this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}bind(e,t,i){const r=t??new o.A(_(e.attributes));this._boundTarget=e,this._boundSchema.fields=r.fields,this._boundSchema.fieldsIndex=r,this._boundSchema.spatialReference=i}_getField(e){return this._boundSchema.fieldsIndex.get(e)}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this._boundSchema.fieldsIndex.has(e)}geometry(){if("fromJSON"in this._boundTarget)return this._boundTarget.geometry;const e=(0,l.rS)(this._boundTarget.geometry);if(e){if(!this._boundSchema.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");e.spatialReference=this._boundSchema.spatialReference}return e}isUnknownDateTimeField(e){return this._boundSchema.fieldsIndex.getTimeZone(e)===c.L5}field(e,t=!0){const i=this._getField(e);if(i){const t=this._boundTarget.attributes[i.name];if(null==t)return null;switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return s.n.fromReader(t);case"time-only":case"esriFieldTypeTimeOnly":return a.k.fromReader(t);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return r.lY.fromReaderAsTimeStampOffset(t);case"date":case"esriFieldTypeDate":return this.isUnknownDateTimeField(e)?r.lY.unknownEpochToArcadeDate(t):r.lY.epochToArcadeDate(t,this.contextTimeZone??c.qU);default:return t}}if(t)throw new Error(`Field ${e} does not exist`);return null}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this._boundSchema.fieldsIndex.fields.map(e=>e.name)}castToText(e=!1){return JSON.stringify(this._boundTarget)}gdbVersion(){return null}fullSchema(){return this._boundSchema}castAsJson(e=null){return{attributes:this._boundTarget.attributes,geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}}function _(e){const t=[];for(const i in e)t.push({name:i,alias:i,type:"string"==typeof e[i]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},58501:(e,t,i)=>{i.d(t,{q:()=>n});var r=i(62815);function n(e,t,i){if(!i?.features||!i.hasZ)return;const n=(0,r.N)(i.geometryType,t,e.outSpatialReference);if(null!=n)for(const e of i.features)n(e.geometry)}},60999:(e,t,i)=>{i.d(t,{DZ:()=>p,Ke:()=>f,Tj:()=>c,UT:()=>y,jJ:()=>u});var r=i(31635),n=i(65008),s=i(97768),a=i(74887),l=i(10107),o=i(40608);function u(e,t,i){return(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))}async function c(e,t,i){return(await(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))).map(e=>e.value)}function d(e){return{ok:!0,value:e}}function h(e){return{ok:!1,error:e}}async function f(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return d(await e)}catch(e){return h(e)}}async function p(e){try{return d(await e)}catch(e){return(0,a.QP)(e),h(e)}}function y(e,t){return new g(e,t)}let g=class extends n.A{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,s.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:i}=this._abortController;this.promise=e(i),this.promise.then(e=>{this._result=d(e),this._cleanup()},e=>{this._result=h(e),this._cleanup()}),this._abortHandle=(0,a.u7)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,s.xt)(this._abortHandle),this._abortController=null}};(0,r.Cg)([(0,l.MZ)()],g.prototype,"value",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"error",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"finished",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"promise",void 0),(0,r.Cg)([(0,l.MZ)()],g.prototype,"_result",void 0),g=(0,r.Cg)([(0,o.$)("esri.core.asyncUtils.ReactiveTask")],g)},62815:(e,t,i)=>{i.d(t,{N:()=>a});var r=i(83047),n=i(73941),s=i(21325);function a(e,t,i){if(null==t||null==i||i.vcsWkid||(0,s.aI)(t,i)||(0,n.xP)(t)||(0,n.xP)(i))return null;const a=(0,r.G9)(t)/(0,r.G9)(i);if(1===a)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){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"esriGeometryEnvelope":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,a);default:return null}}},68423:(e,t,i)=>{i.d(t,{Gr:()=>m,IO:()=>y,a:()=>w,bV:()=>_,p8:()=>g});var r=i(52106),n=i(78502),s=i(87449),a=i(11221),l=i(89169),o=i(33325),u=i(80609),c=i(97768),d=i(1262),h=i(88368),f=i(16930);class p{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class y extends p{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class g extends p{constructor(e,t,i){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.bD)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class _ extends p{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}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,0,this.field.name,this.codefield instanceof h.A?(0,u.YY)(this.codefield,0):this.codefield,e.parameters);return i.includes(_.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:h.A.create(i,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,i=null,r=null,n){let s,a,l,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,i,r,n),e.qualifier,e.op);case"case-expression":{let r=" CASE ";"simple"===e.format&&(r+=this.evaluateNodeToWhereClause(e.operand,t,i,_.BADNESS,n));for(let s=0;s<e.clauses.length;s++)r+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[s].operand,t,i,_.BADNESS,n)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[s].value,t,i,_.BADNESS,n);return null!==e.else&&(r+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,_.BADNESS,n)),r+=" END ",r}case"parameter":{const i=n[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if((0,o.$P)(i))return(0,u.bm)(i,t);if((0,o.Lk)(i))return(0,u.bm)(i,t);if((0,o.eg)(i))return(0,u.F1)(i,t);if((0,o.rX)(i))return(0,u.R8)(i,t);if((0,o.f0)(i))return(0,u.Nf)(i,t);if(Array.isArray(i)){const e=[];for(let r=0;r<i.length;r++)"string"==typeof i[r]?e.push("'"+i[r].toString().replaceAll("'","''")+"'"):(0,o.$P)(i[r])||(0,o.Lk)(i[r])?e.push((0,u.bm)(i[r],t)):(0,o.eg)(i[r])?e.push((0,u.F1)(i[r],t)):(0,o.rX)(i[r])?e.push((0,u.R8)(i[r],t)):(0,o.f0)(i[r])?e.push((0,u.Nf)(i[r],t)):e.push(i[r].toString());return e}return i.toString()}case"expression-list":a=[];for(const s of e.value)a.push(this.evaluateNodeToWhereClause(s,t,i,r,n));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,_.BADNESS,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,r,n)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,r,n)+") ";case"IS":if("null"!==e.right.type)throw new d.L("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new d.L("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IS NOT NULL )";case"IN":if(s=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];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}s.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+s.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,t,i,r,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+s.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,n),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+c+")) ";case"NOT IN":if(s=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];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}s.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+s.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,t,i,r,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+s.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,n),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+c+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";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" ("+r+" "+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+" "+r+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.C6)(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+r+")":(0,u.Kb)(e.column);case"data-type":return e.value;case"function":{const r=this.evaluateNodeToWhereClause(e.args,t,i,_.BADNESS,n);return(0,u.F6)(e.name,r,t)}}throw new d.L("UnsupportedSyntax",{node:e.type})}extractValue(e){if(this.codefield instanceof h.A){const t=this.codefield.calculateValueCompiled(e);return this.reverseLkp[h.A.convertValueToStorageFormat(t)]}return this.reverseLkp[e.attributes[this.codefield]]}}class m extends p{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.bD)(e,this.field.name,(0,u.YY)(this._sql,0),t.getFieldsIndex())}}extractValue(e){return h.A.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class w extends a.A{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_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 f.A({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.ik.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=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),(0,c.Lw)(t),this._wset=new l.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,s){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,s),this._getFeatures(e,t,i,s);let u=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&a.push(e._known[r]),a.length>=o)));r++);if(0===a.length)return"success";e=new l.A([],a,e._ordered,null);const c=Math.min(a.length,i);await(this._parent?._getFeatures(e,-1,c,s)),this._checkCancelled(s);const d=[];for(let e=0;e<c;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&d.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of d){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new r.A({attributes:t,geometry:(0,n.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new s.d("NeverReach")}async _getFilteredSet(e,t,i,r,n){let s=!1;const a=this._reformulateWithoutAdaptions(i);s=a.cannot,i=a.where;let o=!1;if(null!==r){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof y)&&!0===r.scanForField(t.field.name)){if(!(t instanceof g)){r=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}r&&e.length>0&&(r=r.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,u.kg)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,r,n);let d;return this._checkCancelled(n),d=!0===s?new l.A(c._candidates.slice().concat(c._known.slice()),[],!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new l.A(c._candidates.slice(),c._known.slice(),!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),d}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,u.Ju)(e,i.field.name)){const r=i.rewriteSql(e,this);if(!0!==r.rewritten){t.cannot=!0,t.where=null;break}t.where=r.where}return t}async _stat(e,t,i,r,n,s,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(n),l=l||o.cannot,null!==(n=o.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,!0===l)return null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1};const c=await this._parent._stat(e,t,i,r,n,s,a);return!1===c.calculated?null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,r,n){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 y))return!1;const s=[];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,s.push(t)}else s.push(i)}const a=this._reformulateWithoutAdaptions(n);return!a.cannot&&(null!==(n=a.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,this._parent._canDoAggregates(e,s,i,r,n))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,l){if(null===this._parent)throw new s.d("NeverReach");const o=[];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 s.d("NeverReach");const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const c=this._reformulateWithoutAdaptions(n);if(c.cannot)throw new s.d("NeverReach");return null!==(n=c.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,r,n,a,l)}}},73681:(e,t,i)=>{i.d(t,{n:()=>o});var r=i(49186),n=i(53966),s=i(46140),a=i(95466),l=i(55674);class o{static async from(e,t,i){const a=e.dictionary_version?s.R.parse(e.dictionary_version):null,c=new Set(e.itemsNames),d={};if(t)for(const e in t)d[e]=t[e];if(e.authoringInfo.configuration)for(const t of e.authoringInfo.configuration)d.hasOwnProperty(t.name)||(d[t.name]=t.value);const h=new Set(e.authoringInfo.symbol);for(const e of Object.keys(i))h.delete(e);h.size&&n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:h});const f=await(0,l.xR)(e.expression,null,d);if(!f)throw new r.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const p=!a||!a.greaterEqual(4,0);p&&n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:a});const y=new u(i,p);return new o(p,c,f,y)}constructor(e,t,i,r){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=i,this._reader=r}get itemNames(){return this._itemNames}evaluate(e,t,i,r){try{return this._reader.bind(e,i,r),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:e})}return null}createDictionaryFieldsIndex(e){if(!this._requiresFieldCoercionToString)return new a.A(e);const t=e.map(e=>({...e,type:"esriFieldTypeString"}));return new a.A(t)}}class u extends l.Gj{constructor(e,t){super(),this._fieldMap=e,this._requiresFieldCoercionToString=t}_getField(e){const t=this._fieldMap[e]??e;return this._boundSchema.fieldsIndex.get(t)}field(e){if(!this._requiresFieldCoercionToString)return super.field(e,!1);const t=this._getField(e);return null==t||null==this._boundTarget.attributes[t.name]?"":""+this._boundTarget.attributes[t.name]}}},77548:(e,t,i)=>{i.d(t,{Gh:()=>y,tk:()=>d,BR:()=>c,wI:()=>u,G$:()=>f,$x:()=>h,Ov:()=>l,W_:()=>o,OP:()=>p,TU:()=>a,XX:()=>s});var r=i(70333),n=i(78888);i(7762),i(84952),i(36563),i(36708),new WeakMap;const s={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function a(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function o(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}async function u(e,t){const i=r.id?.findServerInfo(e);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const s=e.toLowerCase().indexOf("/rest/services");if(-1===s)return null;const a=`${e.slice(0,s)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,n.A)(a,{query:{f:"json"},responseType:"json",signal:l});return o?.owningSystemUrl||null}function c(e){return function(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function d(e){return!!function(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function h(e,t){return null}function f(e){return null}function p(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function y(e,t){if(!t||!p(e))return;const i=(e.url,null);i&&(e.url=i)}},86691:(e,t,i)=>{i.d(t,{A:()=>o});var r=i(78878),n=i(87449),s=i(11221),a=i(89169),l=i(87594);class o extends s.A{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 r=new a.A([],[],!0,null);for(let e=0;e<i.length;e++)r._known.push(i[e].id);return r}async getIdColumnDictionary(e,t,i,n){if(i<e._known.length-1){const s=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,r.a0)(this._parent._expandPagedSet(e,s,0,0,n)),this.getIdColumnDictionary(e,t,i,n);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,r.a0)(this._parent._getFeatureBatch(l,n));this._checkCancelled(n);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,n)}return e._candidates.length>0?(await(0,r.a0)(this._refineSetBlock(e,this._maxProcessingRate(),n)),this._checkCancelled(n),this.getIdColumnDictionary(e,t,i,n)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_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 n.d("NeverReach")}async _getFilteredSet(e,t,i,r,n){await this._ensureLoaded();const s=await this._parent._getFilteredSet(e,t,i,null===r?this._orderbyclause:r,n);this._checkCancelled(n);const l=new a.A(s._candidates.slice(),s._known.slice(),s._ordered,this._clonePageDefinition(s.pagesDefinition));let o=!0;if(s._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,n);return!1===o&&(null===t&&null===i||(e=new a.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){s.A._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.A(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},87594:(e,t,i)=>{function r(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{A:()=>n});class n{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 n=this.featureValue(e.feature,this._fields[i],i),s=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?r(n,s):-1*r(n,s),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 r=this._fields[i];for(const t of e)if(r.toLowerCase()===t.field.toLowerCase()){r=t.newfield;break}t+=r,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new n(t)}featureValue(e,t,i){const r=e.attributes[t];if(void 0!==r)return r;for(const r in e.attributes)if(t.toLowerCase()===r.toLowerCase())return this._fields[i]=r,e.attributes[r];return null}}},91880:(e,t,i)=>{i.d(t,{A:()=>c});var r,n=i(31635),s=i(66552),a=i(25482),l=i(10107),o=(i(44208),i(53966),i(87811),i(40608));const u=new s.J({asc:"ascending",desc:"descending"});let c=class extends a.o{static{r=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new r({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,n.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,n.Cg)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],c.prototype,"valueExpression",void 0),(0,n.Cg)([(0,l.MZ)({type:u.apiValues,json:{type:u.jsonValues,read:u.read,write:u.write}})],c.prototype,"order",void 0),c=r=(0,n.Cg)([(0,o.$)("esri.layers.support.OrderByInfo")],c)},98988:(e,t,i)=>{i.r(t),i.d(t,{canProjectWithoutEngine:()=>z,getTransformation:()=>q,getTransformations:()=>B,initializeProjection:()=>J,isEqualBaseGCS:()=>$,isLoaded:()=>D,isLoadedOrLoad:()=>L,isLoadedOrLoadFor:()=>N,load:()=>M,project:()=>E,projectExtent:()=>se,projectMany:()=>O,projectMultipoint:()=>X,projectOrLoad:()=>j,projectOrLoadMany:()=>G,projectPoint:()=>K,projectPolygon:()=>re,projectPolyline:()=>te,projectWithZConversion:()=>Q,projectWithoutEngine:()=>Y,requiresLoad:()=>P,test:()=>W,tryProjectWithZConversion:()=>V,unload:()=>Z});var r=i(49186),n=i(74887),s=i(62788),a=i(95488),l=i(51850),o=i(21276),u=i(73941),c=i(5443),d=i(48526),h=i(83290),f=i(86738),p=i(39829),y=i(82799),g=i(16930),_=i(9762),m=i(37539);function w(e,t,i,r,n,s){return b[0]=e,b[1]=t,b[2]=i,(0,_.projectBuffer)(b,r,0,n,s,0)}const b=(0,l.vt)();let F=0;class I{static fromGE(e){const t=new I;return t._wkt=e.wkt,t._wkid=e.wkid,t._isInverse=e.isInverse,t}constructor(e){this.uid=F++,e?(this._wkt=null!=e.wkt?e.wkt:null,this._wkid=null!=e.wkid?e.wkid:-1,this._isInverse=null!=e.isInverse&&!0===e.isInverse):(this._wkt=null,this._wkid=-1,this._isInverse=!1)}get wkt(){return this._wkt}set wkt(e){this._wkt=e,this.uid=F++}get wkid(){return this._wkid}set wkid(e){this._wkid=e,this.uid=F++}get isInverse(){return this._isInverse}set isInverse(e){this._isInverse=e,this.uid=F++}getInverse(){const e=new I;return e._wkt=this.wkt,e._wkid=this._wkid,e._isInverse=!this.isInverse,e}}class S{static cacheKey(e,t){return[e.wkid?.toString()??"-1",e.wkt?.toString()??"",e.wkt2?.toString()??"",t.wkid?.toString()??"-1",t.wkt?.toString()??"",t.wkt2?.toString()??""].join()}static fromGE(e){const t=new S;let i="";for(const r of e.steps){const e=I.fromGE(r);t.steps.push(e),i+=e.uid.toString()+","}return t._cachedProjection={},t._gtlistentry=null,t._chain=i,t}constructor(e){if(this.steps=[],this._cachedProjection={},this._chain="",this._gtlistentry=null,e?.steps)for(const t of e.steps)t instanceof I?this.steps.push(t):this.steps.push(new I({wkid:t.wkid,wkt:t.wkt,isInverse:t.isInverse}))}getInverse(){const e=new S;e.steps=[];for(let t=this.steps.length-1;t>=0;t--){const i=this.steps[t];e.steps.push(i.getInverse())}return e}getGTListEntry(){let e="";for(const t of this.steps)e+=t.uid.toString()+",";return e!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=e),this._gtlistentry}assignCachedGe(e,t,i){this._cachedProjection[S.cacheKey(e,t)]=i}getCachedGeTransformation(e,t){let i="";for(const e of this.steps)i+=e.uid.toString()+",";i!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=i);const r=this._cachedProjection[S.cacheKey(e,t)];return void 0===r?null:r}}var v=i(21325),A=i(62815);let T=null,C=null,x=null,R={};const k=new a.I;function D(){return!!T&&(0,h.i)()}function L(){return!!D()||((0,s.gc)(k),M(),!1)}function N(e,t){return!e||!t||z(e,t)||L()}function P(e,t){return!z(e,t)&&!D()}function M(e){return null==x&&(x=Promise.all([(0,h.l)(),i.e(9930).then(i.bind(i,49930)).then(e=>e.g),i.e(2731).then(i.bind(i,12731))])),x.then(([,t,{hydratedAdapter:i}])=>{(0,n.Te)(e),C=i,T=t.default,T._enableProjection(h.p),k.notify()})}function E(e,t,i=null,r=null){return Array.isArray(e)?0===e.length?[]:((0,o.H)(e),O(C,e,e[0].spatialReference,t,i,r)):((0,o.f)(e),O(C,[e],e.spatialReference,t,i,r)[0])}function O(e,t,i,r,n=null,s=null){if(null==i||null==r)return t;if(z(i,r,n))return t.map(e=>Y(e,i,r));if(null==n&&(0,u.jA)(i))return t.map(e=>Y(e,i,g.A.WGS84)).map(e=>V(e,r));if(null==n&&(0,u.jA)(r))return t.map(e=>V(e,g.A.WGS84)).map(e=>Y(e,g.A.WGS84,r));if(null==n){const e=S.cacheKey(i,r);void 0!==R[e]?n=R[e]:(null==(n=q(i,r,void 0))&&(n=new S),R[e]=n)}if(null==T||null==e)throw new U;return null!=s?T._project(e,t,i,r,n,s):T._project(e,t,i,r,n)}function j(e,t){const i=G([e],t);return null!=i.pending?{pending:i.pending,geometry:null}:null!=i.geometries?{pending:null,geometry:i.geometries[0]}:{pending:null,geometry:null}}function G(e,t){if(!D())for(const i of e)if(null!=i&&!(0,v.aI)(i.spatialReference,t)&&(0,v.fn)(i.spatialReference)&&(0,v.fn)(t)&&!z(i.spatialReference,t))return(0,s.gc)(k),{pending:M(),geometries:null};return{pending:null,geometries:e.map(e=>null==e?null:(0,v.aI)(e.spatialReference,t)?e:(0,v.fn)(e.spatialReference)&&(0,v.fn)(t)?V(e,t):null)}}function q(e,t,i=null){if(null==e||null==t)return null;if(null==T||null==C)throw new U;const r=T._getTransformation(C,e,t,i,i?.spatialReference);return null!==r?S.fromGE(r):null}function B(e,t,i=null){if(null==T||null==C)throw new U;const r=T._getTransformationBySuitability(C,e,t,i,i?.spatialReference);if(null!==r){const e=[];for(const t of r)e.push(S.fromGE(t));return e}return[]}class U extends r.A{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}}function Z(){T=null,C=null,x=null,R={}}const W={get loadPromise(){return x}};function V(e,t){try{const i=E(e,t);if(null==i)return null;"xmin"in e&&"xmin"in i&&(i.zmin=e.zmin,i.zmax=e.zmax);const r=(0,A.N)(i.type,e.spatialReference,t);return null!=r&&r(i),i}catch(e){if(!(e instanceof U))throw e;return null}}async function Q(e,t,i){const r=e.spatialReference;return null!=r&&null!=t&&await J(r,t,null,i),V(e,t)}function z(e,t,i){return!i&&(!!(0,v.aI)(e,t)||(0,v.fn)(e)&&(0,v.fn)(t)&&!!(0,m.jd)(e,t))}function $(e,t){if((0,v.aI)(e,t))return!0;if(!(0,v.fn)(e)||!(0,v.fn)(t))return!1;const i=(0,v.oT)(e)||(0,v.K8)(e)||(0,v.x1)(e),r=(0,v.oT)(t)||(0,v.K8)(t)||(0,v.x1)(t);return i&&r}async function J(e,t,i,r){if(D())return(0,n.NO)(r);if(Array.isArray(e)){for(const{source:t,dest:i,geographicTransformation:n}of e)if(t&&i&&!z(t,i,n))return M(r)}else if(e&&t&&!z(e,t,i))return M(r);return(0,n.NO)(r)}function Y(e,t,i){return e?"x"in e?H(e,t,new f.A,i,0):"xmin"in e?ae(e,t,new c.A,i,0):"rings"in e?ne(e,t,new p.A,i,0):"paths"in e?ie(e,t,new y.A,i,0):"points"in e?ee(e,t,new d.A,i,0):null:null}function K(e,t,i=t.spatialReference,r=0){return null!=i&&null!=e.spatialReference&&null!=H(e,e.spatialReference,t,i,r)}function H(e,t,i,r,n){oe[0]=e.x,oe[1]=e.y;const s=e.z;return oe[2]=void 0!==s?s:n,(0,_.projectBuffer)(oe,t,0,oe,r,0)?(i.x=oe[0],i.y=oe[1],i.spatialReference=r,void 0!==s||(0,u.xP)(r)?(i.z=oe[2],i.hasZ=!0):(i.z=void 0,i.hasZ=!1),void 0===e.m?(i.m=void 0,i.hasM=!1):(i.m=e.m,i.hasM=!0),i):null}function X(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ee(e,e.spatialReference,t,i,r)}function ee(e,t,i,r,n){const{points:s,hasZ:a,hasM:l}=e,o=[],c=s.length,d=[];for(const e of s)d.push(e[0],e[1],a?e[2]:n);if(!(0,_.projectBuffer)(d,t,0,d,r,0,c))return null;const h=a||(0,u.xP)(r);for(let e=0;e<c;++e){const t=3*e,i=d[t],r=d[t+1];h&&l?o.push([i,r,d[t+2],s[e][3]]):h?o.push([i,r,d[t+2]]):l?o.push([i,r,s[e][2]]):o.push([i,r])}return i.points=o,i.spatialReference=r,i.hasZ=a,i.hasM=l,i}function te(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ie(e,e.spatialReference,t,i,r)}function ie(e,t,i,r,n){const{paths:s,hasZ:a,hasM:l}=e,o=[];if(!le(s,a??!1,l??!1,t,o,r,n))return null;const c=a||(0,u.xP)(r);return i.paths=o,i.spatialReference=r,i.hasZ=c,i.hasM=l,i}function re(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ne(e,e.spatialReference,t,i,r)}function ne(e,t,i,r,n){const{rings:s,hasZ:a,hasM:l}=e,o=[];if(!le(s,a??!1,l??!1,t,o,r,n))return null;const c=a||(0,u.xP)(r);return i.rings=o,i.spatialReference=r,i.hasZ=c,i.hasM=l,i}function se(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ae(e,e.spatialReference,t,i,r)}function ae(e,t,i,r,n){const{xmin:s,ymin:a,xmax:l,ymax:o,hasZ:c,hasM:d}=e;if(!w(s,a,c?e.zmin:n,t,oe,r))return null;const h=c||(0,u.xP)(r);return i.xmin=oe[0],i.ymin=oe[1],h&&(i.zmin=oe[2]),w(l,o,c?e.zmax:n,t,oe,r)?(i.xmax=oe[0],i.ymax=oe[1],h&&(i.zmax=oe[2]),d&&(i.mmin=e.mmin,i.mmax=e.mmax),i.spatialReference=r,i):null}function le(e,t,i,r,n,s,a=0){const l=new Array;for(const i of e)for(const e of i)l.push(e[0],e[1],t?e[2]:a);if(!(0,_.projectBuffer)(l,r,0,l,s,0))return!1;let o=0;n.length=0;const c=t||(0,u.xP)(s);for(const t of e){const e=new Array;for(const r of t)c&&i?e.push([l[o++],l[o++],l[o++],r[3]]):c?e.push([l[o++],l[o++],l[o++]]):i?(e.push([l[o++],l[o++],r[2]]),o++):(e.push([l[o++],l[o++]]),o++);n.push(e)}return!0}const oe=(0,l.vt)()}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[788,4342,5294,6719,7097,7694,8407],{6797:(e,t,i)=>{i.d(t,{Mj:()=>h,Ui:()=>p,w2:()=>f});var r=i(65008),n=i(7762),s=i(88620);const a=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function l(e){return e instanceof r.A}function o(e){return e instanceof n.A?Object.keys(e.items):l(e)?(0,s.oY)(e).keys():e?Object.keys(e):[]}function u(e,t){return e instanceof n.A?e.items[t]:e[t]}function c(e){return e?e.declaredClass:null}function d(e,t){const i=e.diff;if(i&&"function"==typeof i)return i(e,t);const r=o(e),n=o(t);if(0===r.length&&0===n.length)return;if(!r.length||!n.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 s=n.filter(e=>!r.includes(e)),h=r.filter(e=>!n.includes(e)),f=r.filter(i=>n.includes(i)&&u(e,i)!==u(t,i)).concat(s,h).sort(),p=c(e);if(p&&a.has(p)&&f.length)return{type:"complete",oldValue:e,newValue:t};let y;const g=l(e)&&l(t);for(const r of f){const n=u(e,r),s=u(t,r);let a;if((g||"function"!=typeof n&&"function"!=typeof s)&&n!==s&&(null!=n||null!=s)){if(i&&i[r]&&"function"==typeof i[r])a=i[r]?.(n,s);else if(n instanceof Date&&s instanceof Date){if(n.getTime()===s.getTime())continue;a={type:"complete",oldValue:n,newValue:s}}else a="object"==typeof n&&"object"==typeof s&&c(n)===c(s)?d(n,s):{type:"complete",oldValue:n,newValue:s};null!=a&&(null!=y?y.diff[r]=a:y={type:"partial",diff:{[r]:a}})}}return y}function h(e,t){return function(e,t){if(null==e)return!1;const i=t.split(".");let r=e;for(const e of i){if("complete"===r.type)return!0;if("partial"!==r.type)return!1;{const t=r.diff[e];if(!t)return!1;r=t}}return!0}(e,t)}function f(e,t){if(!e)return!1;if("partial"===e.type){const i=Object.keys(e.diff);return 1===i.length&&i[0]===t}return!1}function p(e,t){if("function"!=typeof e&&"function"!=typeof t&&(null!=e||null!=t))return null==e||null==t||"object"==typeof e&&"object"==typeof t&&c(e)!==c(t)?{type:"complete",oldValue:e,newValue:t}:d(e,t)}},9762:(e,t,i)=>{i.r(t),i.d(t,{projectBuffer:()=>n});var r=i(37539);function n(e,t,i,n,s,a,l=Math.floor(e.length/3)){const o=(0,r.jd)(t,s);if(null==o)return!1;if(o===r.pO){if(e===n&&i===a)return!0;const t=i+3*l;for(let r=i,s=a;r<t;r++,s++)n[s]=e[r];return!0}const u=i+3*l;for(let t=i,r=a;t<u;t+=3,r+=3)o(e,t,n,r);return!0}},10407:(e,t,i)=>{i.d(t,{It:()=>f,LG:()=>a,OM:()=>u,Sm:()=>c,Y:()=>l,bK:()=>o,mm:()=>h,sQ:()=>d});var r=i(98988),n=i(16930),s=i(28735);function a(e,t){if(!l(e,t)){const i=e.typeKeywords;i?i.push(t):e.typeKeywords=[t]}}function l(e,t){return!!e.typeKeywords?.includes(t)}function o(e){return l(e,h.HOSTED_SERVICE)}function u(e,t){const i=e.typeKeywords;if(i){const e=i.indexOf(t);e>-1&&i.splice(e,1)}}function c(e,t,i){i?a(e,t):u(e,t)}async function d(e){const t=e.clone().normalize();let i;if(t.length>1)for(const e of t)i?e.width>i.width&&(i=e):i=e;else i=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,s.ci)(e);const i=n.A.WGS84;return await(0,r.initializeProjection)(t,i),(0,r.project)(e,i)}(i)}const h={CHARTS:"Charts",DYNAMIC:"Dynamic",DEVELOPER_BASEMAP:"DeveloperBasemap",GROUP_LAYER_MAP:"Map",HOSTED_SERVICE:"Hosted Service",JSAPI:"ArcGIS API for JavaScript",LOCAL_SCENE:"ViewingMode-Local",METADATA:"Metadata",MULTI_LAYER:"Multilayer",ORIENTED_IMAGERY_LAYER:"OrientedImageryLayer",SINGLE_LAYER:"Singlelayer",SUBTYPE_GROUP_LAYER:"SubtypeGroupLayer",SUBTYPE_GROUP_TABLE:"SubtypeGroupTable",TABLE:"Table",TILED_IMAGERY:"Tiled Imagery"};function f(e){const{portal:t,isOrgItem:i,itemControl:r}=e,n=t.user?.privileges;let s=!n||n.includes("features:user:edit"),a=!!i&&!!n?.includes("features:user:fullEdit");const l="update"===r||"admin"===r;return l?a=s=!0:a&&(s=!0),{features:{edit:s,fullEdit:a},content:{updateItem:l}}}},17311:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(31635),n=i(65008),s=i(4576),a=i(60999),l=i(7762),o=i(10107),u=(i(44208),i(53966),i(40608)),c=i(30524),d=i(43668);let h=class extends n.A{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){return this.expressionsUsedInTitle.length>0?this._get("_arcadeTask")||(0,a.UT)(()=>(0,d.l)()):null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??i.e(9926).then(i.bind(i,29926)).then(e=>this._featureUtils=e)}get calculatedExpressions(){const e=new l.A;if(!this.expressionsUsedInTitle.length)return e;if(!this._arcadeTask?.value){for(const t of this.expressionsUsedInTitle??[])e.push({name:t.name,invalid:!0});return e}for(const t of this.expressionsUsedInTitle)try{const i=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(i.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:i,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(i,{vars:{$feature:"any"}})})}catch{e.push({name:t.name,invalid:!0});break}return e}get expressionsUsedInTitle(){let e=this.effectivePopupTemplate?.title??"";return"string"!=typeof e?[]:(e=e.toLowerCase(),this.effectivePopupTemplate?.expressionInfos?.filter(t=>e.includes(`{expression/${t.name.toLowerCase()}}`))??[])}get fieldInfoMap(){return this._featureUtils?this._createFieldInfoMap(this._featureUtils.getAllFieldInfos(this.effectivePopupTemplate)):null}get hasBadExpressions(){return this.calculatedExpressions.some(e=>!0===e.invalid)}get requiredFields(){const e=new Set;if(this._arcadeTask?.value&&!this.hasBadExpressions)for(const t of this.calculatedExpressions?.toArray()??[])try{const i=this._arcadeTask.value.arcade.extractFieldLiterals(t.syntax);for(const t of i){const i=t.split("."),r=this.fieldsIndex.get(i.at(-1)??"");r&&e.add(r.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const i of t){const t=this.fieldsIndex.get(i);t&&e.add(t.name)}return null!=this.objectIdField&&e.add(this.objectIdField),e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,i){const r=t.getObjectId()??t.attributes[e.objectIdField];return(await this.getTitles(e,[t],i)).get(r)??""}async getTitles(e,t,i){const r=new Map,n=i?.timeZone??"system";try{const[{substituteFieldsInLinksAndAttributes:s}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);i?.fetchMissingFields&&(t=await this._checkAndReQueryGraphics(e,t));const{fieldInfoMap:a,workingTitle:l}=this,o=l&&a;t.forEach(t=>{const i=t.getObjectId()??t.attributes[e.objectIdField],u=o?s({attributes:t.attributes,expressionAttributes:null,fieldInfoMap:a,globalAttributes:this._createFormattedAttributes(e,t,n).global,layer:e,text:l}):"";r.set(i,u)})}catch{}return r}async _checkAndReQueryGraphics(e,t){const i=t.map(t=>t.getObjectId()??t.attributes[e.objectIdField]).filter(s.Ru);if(i.length!==t.length)return t;if(t.some(e=>!(0,c.Kl)(e,this.requiredFields))){const r=e.createQuery();r.where="1=1",r.outFields=[...this.requiredFields],r.objectIds=i;const n=await e.queryFeatures(r);if(n?.features.length===t.length)return n.features}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const i of e){if(!i.fieldName)continue;const e=this.fieldsIndex.get(i.fieldName),r=e?.name??i.fieldName;i.fieldName=r,t.set(r.toLowerCase(),i)}return t}_createFormattedAttributes(e,t,i="system"){const r=this.effectivePopupTemplate?.fieldInfos??[],n={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const i=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{n[`expression/${e.name}`]=e.func({vars:{$feature:i}})}catch{}}const s={...t.attributes,...n};return{global:this._featureUtils.formatAttributes({fieldInfos:r,attributes:s,graphic:t,timeZone:i,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return(0,c.nw)(e).filter(e=>!(e.startsWith("relationships/")||e.startsWith("expression/")))}};(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"_arcadeTask",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"_featureUtils",void 0),(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"featureUtilsPromise",null),(0,r.Cg)([(0,o.MZ)({readOnly:!0})],h.prototype,"calculatedExpressions",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"displayField",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"effectivePopupTemplate",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"expressionsUsedInTitle",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fieldsIndex",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fieldInfoMap",null),(0,r.Cg)([(0,o.MZ)()],h.prototype,"fields",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"objectIdField",void 0),(0,r.Cg)([(0,o.MZ)()],h.prototype,"requiredFields",null),h=(0,r.Cg)([(0,u.$)("esri.layers.support.TitleCreator")],h)},22671:(e,t,i)=>{i.d(t,{A:()=>m});var r,n=i(31635),s=i(52106),a=i(66552),l=i(25482),o=i(4718),u=i(10107),c=(i(44208),i(53966),i(36005)),d=i(40608),h=i(43937),f=i(16930),p=i(65864),y=i(50498),g=i(20437);const _=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=r=class extends l.o{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){return this.readFeaturesWithClass(e,t,s.A)}writeGeometryType(e,t,i,r){if(e)return void _.write(e,t,i,r);const{features:n}=this;if(n)for(const e of n)if(null!=e?.geometry)return void _.write(e.geometry.type,t,i,r)}readQueryGeometry(e,t){if(!e)return null;const i=!!e.spatialReference,r=(0,p.rS)(e);return r&&!i&&t.spatialReference&&(r.spatialReference=f.A.fromJSON(t.spatialReference)),r}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:i}=this;if(i)for(const e of i)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new r(this.cloneProperties())}cloneProperties(){return(0,o.o8)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let i=0;i<t.features.length;i++){const r=t.features[i];if(r.geometry){const t=e?.[i];r.geometry=t?.toJSON()||r.geometry}}return t}quantize(e){const{scale:[t,i],translate:[r,n]}=e,s=this.features,a=this._getQuantizationFunction(this.geometryType,e=>Math.round((e-r)/t),e=>Math.round((n-e)/i));for(let e=0,t=s.length;e<t;e++)a?.(s[e].geometry)||(s.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:i}=this;if(!i)return this;const{translate:[r,n],scale:[s,a]}=i;let l=null,o=null;if(this.hasZ&&null!=i?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=i;l=i=>i*t+e}if(this.hasM&&null!=i?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=i;o=i=>null==i?i:i*t+e}const u=this._getHydrationFunction(e,e=>e*s+r,e=>n-e*a,l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,i){const r=f.A.fromJSON(t.spatialReference),n=[];for(let t=0;t<e.length;t++){const s=e[t],a=i.fromJSON(s),l=s.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=r);const o=s.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],i=o[e],n=i?.spatialReference;null==t||n||(t.spatialReference=r)}n.push(a)}return n}_quantizePoints(e,t,i){let r,n;const s=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=i(l[1]);e===r&&a===n||(s.push([e-r,a-n]),r=e,n=a)}else r=t(l[0]),n=i(l[1]),s.push([r,n])}return s.length>0?s:null}_getQuantizationFunction(e,t,i){return"point"===e?e=>(e.x=t(e.x),e.y=i(e.y),e):"polyline"===e||"polygon"===e?e=>{const r=(0,p.Bi)(e)?e.rings:e.paths,n=[];for(let e=0,s=r.length;e<s;e++){const s=r[e],a=this._quantizePoints(s,t,i);a&&n.push(a)}return n.length>0?((0,p.Bi)(e)?e.rings=n:e.paths=n,e):null}:"multipoint"===e?e=>{const r=this._quantizePoints(e.points,t,i);return r&&r.length>0?(e.points=r,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,i,r,n){return"point"===e?e=>{e.x=t(e.x),e.y=i(e.y),r&&(e.z=r(e.z))}:"polyline"===e||"polygon"===e?e=>{const s=(0,p.Bi)(e)?e.rings:e.paths;let a,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];for(let e=0,n=r.length;e<n;e++){const n=r[e];e>0?(a+=n[0],l+=n[1]):(a=n[0],l=n[1]),n[0]=t(a),n[1]=i(l)}}if(r&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2]),i[3]=n(i[3])}}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=r(i[2])}}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];for(let e=0,i=t.length;e<i;e++){const i=t[e];i[2]=n(i[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=i(e.ymin),e.xmax=t(e.xmax),e.ymax=i(e.ymax),r&&null!=e.zmax&&null!=e.zmin&&(e.zmax=r(e.zmax),e.zmin=r(e.zmin)),n&&null!=e.mmax&&null!=e.mmin&&(e.mmax=n(e.mmax),e.mmin=n(e.mmin))}:"multipoint"===e?e=>{const s=e.points;let a,l;for(let e=0,r=s.length;e<r;e++){const r=s[e];e>0?(a+=r[0],l+=r[1]):(a=r[0],l=r[1]),r[0]=t(a),r[1]=i(l)}if(r&&n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2]),t[3]=n(t[3])}else if(r)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=r(t[2])}else if(n)for(let e=0,t=s.length;e<t;e++){const t=s[e];t[2]=n(t[2])}}:null}};(0,n.Cg)([(0,u.MZ)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,n.Cg)([(0,u.MZ)({type:[s.A],json:{write:!0}})],m.prototype,"features",void 0),(0,n.Cg)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,n.Cg)([(0,u.MZ)({type:[g.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,n.Cg)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:_.read}}})],m.prototype,"geometryType",void 0),(0,n.Cg)([(0,h.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,n.Cg)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,n.Cg)([(0,u.MZ)({types:y.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,n.Cg)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,n.Cg)([(0,u.MZ)({type:f.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,n.Cg)([(0,h.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,n.Cg)([(0,u.MZ)({json:{write:!0}})],m.prototype,"transform",void 0),m=r=(0,n.Cg)([(0,d.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0},30235:(e,t,i)=>{i.d(t,{A:()=>p});var r=i(52106),n=i(87449),s=i(11221),a=i(89169),l=i(33325),o=i(80609),u=i(39516),c=i(91075),d=i(29784),h=i(33143),f=i(20437);class p extends s.A{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 l.gO}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(),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||this._layer.objectIdField===i.name)e.push(i),t.push(i.name);else for(const r of this._overrideFields)if(r.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._databaseType=0,this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}_isInFeatureSet(){return 0}_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}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,e.outFields=this._overrideFields??["*"],e.returnGeometry=!this._removeGeometry,e}_changeFeature(e){const t={};for(const i of this.fields)t[i.name]=e.attributes[i.name];return new r.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,n){let s="",l=!1;if(null!==r&&(s=r.constructClause(),l=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.A([],[],!0,null);const c=this._createQuery();c.where=(0,u.mA)(c.where,null===i?null===t?"1=1":"":(0,o.YY)(i,0)),c.spatialRelationship=this._makeRelationshipEnum(e),c.outSpatialReference=this.spatialReference,c.orderByFields=""!==s?s.split(","):null,c.geometry=null===t?null:t,c.relationParameter=this._makeRelationshipParam(e);const d=await this._layer.queryFeatures(c);if(null===d)return new a.A([],[],l,null);this._checkCancelled(n);const h=[];return d.features.forEach(e=>{const t=e.attributes[this._layer.objectIdField];h.push(t),this._featureCache[t]=this._changeFeature(e)}),new a.A([],h,l,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;if(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 a.A([],e,!1,null),this._wset}const e=this._createQuery();e.where="1=1";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 a.A([],i,!1,null),this._wset}async _getFeatures(e,t,i){const r=[];-1!==t&&void 0===this._featureCache[t]&&r.push(t);for(let n=e._lastFetchedIndex;n<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[n]]&&(e._known[n]!==t&&r.push(e._known[n]),r.length>i)));n++);if(0===r.length)return"success";throw new n.d("MissingFeatures")}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 r=e.layerDefinition.typeIdField??"",n=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)n.push(h.A.fromJSON(t));let s=e.layerDefinition.geometryType;void 0===s&&(s=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!i){let t=!1;for(const r of e.layerDefinition.fields)if("oid"===r.type||"esriFieldTypeOID"===r.type){i=r.name,t=!0;break}if(!1===t){let t="FID",r=!0,n=0;for(;r;){let i=!0;for(const r of e.layerDefinition.fields)if(r.name===t){i=!1;break}!0===i?r=!1:(n++,t="FID"+n.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const s=[];for(let i=0;i<a.length;i++)s.push({geometry:e.featureSet.features[i].geometry,attributes:e.featureSet.features[i].attributes?this._cloneAttr(e.featureSet.features[i].attributes):{}}),s[i].attributes[t]=i;a=s,i=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof f.A?o.push(t):o.push(f.A.fromJSON(t));let u=s;switch(u||(u=""),u){case"esriGeometryPoint":u="point";break;case"esriGeometryPolyline":u="polyline";break;case"esriGeometryPolygon":u="polygon";break;case"esriGeometryEnvelope":u="extent";break;case"esriGeometryMultipoint":u="multipoint";break;case"":case"esriGeometryNull":u="esriGeometryNull"}if("esriGeometryNull"!==u)for(const e of a)e.geometry&&e.geometry instanceof c.A==0&&(e.geometry.type=u,void 0===e.geometry.spatialReference&&(e.geometry.spatialReference=l));else for(const e of a)e.geometry&&(e.geometry=null);const y={outFields:["*"],source:a,fields:o,hasZ:!0===e?.layerDefinition?.hasZ||!0===e?.featureSet?.hasZ,hasM:!0===e?.layerDefinition?.hasM||!0===e?.featureSet?.hasM,types:n,typeIdField:r,objectIdField:i,spatialReference:t},g="esriGeometryNull"===u||null===u;g||(y.geometryType=u);const _=new d.default(y);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&_.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new p({layer:_,spatialReference:t,isTable:g})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();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""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return this._layer?.timeInfo}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return this.fsetInfo??{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}},32730:(e,t,i)=>{i.d(t,{BI:()=>g,D3:()=>p,XJ:()=>y,lc:()=>f,mX:()=>m,rU:()=>_,tH:()=>S});var r=i(799);const n="__begin__",s="__end__",a=new RegExp(n,"ig"),l=new RegExp(s,"ig"),o=new RegExp("^"+n,"i"),u=new RegExp(s+"$","i"),c='"',d=c+" + ",h=" + "+c;function f(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function p(e){return e.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function y(e){const t={expression:"",type:"none"};return e.labelExpressionInfo?e.labelExpressionInfo.value?(t.expression=e.labelExpressionInfo.value,t.type="conventional"):e.labelExpressionInfo.expression&&(t.expression=e.labelExpressionInfo.expression,t.type="arcade"):null!=e.labelExpression&&(t.expression=f(e.labelExpression),t.type="conventional"),t}function g(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return m(t.expression);case"arcade":return t.expression}return null}function _(e){const t=y(e);if(!t)return null;switch(t.type){case"conventional":return function(e){const t=e?.match(w);return t?.[1].trim()||null}(t.expression);case"arcade":return S(t.expression)}return null}function m(e){let t;return e?(t=(0,r.HC)(e,e=>n+'$feature["'+e+'"]'+s),t=o.test(t)?t.replace(o,""):c+t,t=u.test(t)?t.replace(u,""):t+c,t=t.replaceAll(a,d).replaceAll(l,h)):t='""',t}const w=/^\s*\{([^}]+)\}\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,I=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function S(e){if(!e)return null;let t=b.exec(e)||F.exec(e);return t?t[1]||t[3]:(t=I.exec(e),t?t[2]:null)}},32756:(e,t,i)=>{i.d(t,{Rr:()=>o,fY:()=>c,ne:()=>u});var r=i(31635),n=i(93637),s=i(10107),a=(i(44208),i(53966),i(87811),i(40608)),l=i(91880);function o(e,t,i){if(!e)return null;const r=e.find(e=>!!e.field);if(!r)return null;const n=new l.A;return n.read(r,i),[n]}const u={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:o},write:{writer:function(e,t,i,r){const s=e.find(e=>!!e.field);s&&(0,n.sM)(i,[s.toJSON()],t)}}}},c=e=>{const t=e;let i=class extends t{constructor(){super(...arguments),this.orderBy=null}};return(0,r.Cg)([(0,s.MZ)(u)],i.prototype,"orderBy",void 0),i=(0,r.Cg)([(0,a.$)("esri.layers.mixins.OrderedLayer")],i),i}},33143:(e,t,i)=>{i.d(t,{A:()=>h});var r=i(31635),n=i(69540),s=i(25482),a=i(10107),l=(i(44208),i(53966),i(87811),i(36005)),o=i(40608),u=i(43937),c=i(80451),d=i(29005);let h=class extends((0,n.OU)(s.o)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const i of Object.keys(e))t[i]=(0,c.rS)(e[i]);return t}writeDomains(e,t){const i={};for(const t of Object.keys(e))e[t]&&(i[t]=e[t]?.toJSON());t.domains=i}};(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"id",void 0),(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"name",void 0),(0,r.Cg)([(0,a.MZ)({json:{write:!0}})],h.prototype,"domains",void 0),(0,r.Cg)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,r.Cg)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,r.Cg)([(0,a.MZ)({type:[d.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,r.Cg)([(0,o.$)("esri.layers.support.FeatureType")],h)},35704:(e,t,i)=>{i.d(t,{A:()=>d});var r=i(87449),n=i(11221),s=i(89169),a=i(33325),l=i(80609),o=i(74887),u=i(88368),c=i(16930);class d extends n.A{constructor(e){super(e),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof u.A?(this._whereclause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereclause=null)}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),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.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new c.A({wkid:4326}),this.geometryType=a.ik.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 s.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new s.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){let t=this._parent?._isInFeatureSet(e);return 1===t?t:(t=this._idstates[e],void 0===t?2:t)}_getFeature(e,t,i){return this._parent._getFeature(e,t,i)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_featureFromCache(e){return this._parent._featureFromCache(e)}executeWhereClause(e){return this._whereclause?.testFeature(e)??!1}async executeWhereClauseDeferred(e){if(null!==this._whereClauseFunction){const t=this._whereClauseFunction(e);return(0,o.$X)(t),t}return this.executeWhereClause(e)}async _fetchAndRefineFeatures(e,t,i){const r=new s.A([],e,!1,null),n=Math.min(t,e.length);if(await(this._parent?._getFeatures(r,-1,n,i)),this._checkCancelled(i),null==this._whereClauseFunction){for(let t=0;t<n;t++){const i=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(i)?this._idstates[e[t]]=0:this._idstates[e[t]]=1}return"success"}const a=[];for(let t=0;t<n;t++){const i=this._parent?._featureFromCache(e[t]);a.push(await this.executeWhereClauseDeferred(i))}for(let i=0;i<t;i++)!0===a[i]?this._idstates[e[i]]=0:this._idstates[e[i]]=1;return"success"}async _getFilteredSet(e,t,i,r,n){null!==this._whereClauseFunction||(null!==i?null!==this._whereclause&&(i=(0,l.kg)(this._whereclause,i)):i=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,i,r,n);let o;return this._checkCancelled(n),o=null!==this._whereClauseFunction?new s.A(a._candidates.slice().concat(a._known.slice()),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new s.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,i,r,n,s,a){if(null!==this._whereClauseFunction)return null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1};let o=this._whereclause;null!==n&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,n));const u=await this._parent._stat(e,t,i,r,o,s,a);return!1===u.calculated?null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1}:u}async _canDoAggregates(e,t,i,r,n){return null===this._whereClauseFunction&&(null!==n?null!==this._whereclause&&(n=(0,l.kg)(this._whereclause,n)):n=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,i,r,n))}async _getAggregatePagesDataSourceDefinition(e,t,i,n,s,a,o){if(null===this._parent)throw new r.d("NeverReach");return null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,i,n,s,a,o)}static registerAction(){n.A._featuresetFunctions.filter=function(e){if("function"==typeof e)return new d({parentfeatureset:this,whereclause:e});let t=null;return e instanceof u.A&&(t=e),new d({parentfeatureset:this,whereclause:t})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},36708:(e,t,i)=>{i.d(t,{C_:()=>h,OH:()=>y,Vh:()=>g,on:()=>d,pc:()=>_,wB:()=>o,z7:()=>u});var r=i(37955),n=i(36563),s=i(97768),a=i(74887),l=i(14012);function o(e,t,i={}){return c(e,t,i,f)}function u(e,t,i={}){return c(e,t,i,p)}function c(e,t,i={},r){let n=null;const a=i.once?(e,i)=>{r(e)&&((0,s.xt)(n),t(e,i))}:(e,i)=>{r(e)&&t(e,i)};if(n=(0,l.Cn)(e,a,i.sync,i.equals),i.initial){const t=e();a(t,t)}return n}function d(e,t,i,a={}){let l=null,u=null,c=null;function d(){l&&u&&(u.remove(),a.onListenerRemove?.(l),l=null,u=null)}function h(e){a.once&&a.once&&(0,s.xt)(c),i(e)}const f=o(e,(e,i)=>{d(),(0,r.wb)(e)&&(l=e,u=(0,r.on)(e,t,h),a.onListenerAdd?.(e))},{sync:a.sync,initial:!0});return c=(0,n.hA)(()=>{f.remove(),d()}),c}function h(e,t){return function(e,t,i){if((0,a.G4)(i))return Promise.reject((0,a.NK)());const r=e();if(t?.(r))return Promise.resolve(r);let l=null;function o(){l=(0,s.xt)(l)}return new Promise((r,s)=>{l=(0,n.vE)([(0,a.u7)(i,()=>{o(),s((0,a.NK)())}),c(e,e=>{o(),r(e)},{sync:!1,once:!0},t??f)])})}(e,p,t)}function f(e){return!0}function p(e){return!!e}i(80559);const y={sync:!0},g={initial:!0},_={sync:!0,initial:!0}},37539:(e,t,i)=>{i.d(t,{pO:()=>y,jd:()=>h,Tp:()=>f,w5:()=>d});var r=i(34727),n=i(83047),s=i(73941),a=i(79258);Math.PI;const l=a.$O.radius,o=a.$O.eccentricitySquared,u={a1:l*o,a2:l*o*l*o,a3:l*o*o/2,a4:l*o*l*o*2.5,a5:l*o+l*o*o/2,a6:1-o};a.$O.radius,a.$O.flattening,a.Sw.radius,a.Sw.flattening,a.sH.radius,a.sH.flattening,a.sH.radius;var c=i(21325);const d={2:{5:y,7:null,9:null,10:y,1:S,6:null,8:null,0:null,3:_,11:m,2:y,4:x},5:{5:y,7:null,9:null,10:y,1:S,6:null,8:null,0:null,3:_,11:m,2:y,4:x},7:{5:null,7:y,9:null,10:y,1:null,6:I,8:null,0:null,3:null,11:null,2:null,4:null},9:{5:null,7:null,9:y,10:y,1:null,6:null,8:F,0:null,3:null,11:null,2:null,4:null},3:{5:g,7:null,9:null,10:g,1:function(e,t,i,r){const n=e[t]/N,s=P-2*Math.atan(Math.exp(-e[t+1]/N)),a=N+e[t+2],l=Math.cos(s)*a;i[r]=Math.cos(n)*l,i[r+1]=Math.sin(n)*l,i[r+2]=Math.sin(s)*a},6:null,8:null,0:null,3:y,11:function(e,t,i,r){g(e,t,i,r),m(i,r,i,r)},2:g,4:function(e,t,i,r){g(e,t,i,r),x(i,r,i,r)}},4:{5:R,7:null,9:null,10:R,1:function(e,t,i,r){R(e,t,i,r),S(i,r,i,r)},6:null,8:null,0:null,3:function(e,t,i,r){R(e,t,i,r),_(i,r,i,r)},11:function(e,t,i,r){R(e,t,i,r),m(i,r,i,r)},2:R,4:y},1:{5:C,7:null,9:null,10:C,1:y,6:null,8:null,0:null,3:function(e,t,i,r){C(e,t,i,r),_(i,r,i,r)},11:function(e,t,i,r){C(e,t,i,r),m(i,r,i,r)},2:C,4:function(e,t,i,r){C(e,t,i,r),x(i,r,i,r)}},6:{5:null,7:T,9:null,10:T,1:null,6:y,8:null,0:null,3:null,11:null,2:null,4:null},8:{5:null,7:null,9:A,10:A,1:null,6:null,8:y,0:null,3:null,11:null,2:null,4:null},0:{5:null,7:null,9:null,10:null,1:null,6:null,8:null,0:y,3:null,11:null,2:null,4:null},10:{5:y,7:y,9:y,10:y,1:S,6:I,8:F,0:null,3:_,11:m,2:y,4:x},11:{5:w,7:null,9:null,10:w,1:function(e,t,i,r){w(e,t,i,r),S(i,r,i,r)},6:null,8:null,0:null,3:function(e,t,i,r){w(e,t,i,r),_(i,r,i,r)},11:y,2:w,4:function(e,t,i,r){w(e,t,i,r),x(i,r,i,r)}}};function h(e,t){return f(e,t)?.projector}function f(e,t){if(null==e||null==t)return null;if(k.source.spatialReference===e&&k.dest.spatialReference===t)return k;const i=p(e,k.source),r=p(t,k.dest);return 0===i&&0===r?(0,c.aI)(e,t)?k.projector=y:k.projector=null:k.projector=d[i][r],k}function p(e,t){return e?t.spatialReference===e?t.spatialReferenceId:(t.spatialReference=e,"metersPerUnit"in t&&(t.metersPerUnit=(0,n.GA)(e,1)),(0,s.jA)(e)?t.spatialReferenceId=1:(0,c.oT)(e)?t.spatialReferenceId=2:(0,c.K8)(e)?t.spatialReferenceId=3:(0,c.r1)(e)?t.spatialReferenceId=11:e.wkt===s.Ro.wkt?t.spatialReferenceId=4:4490===e.wkid?t.spatialReferenceId=5:e.wkt===s.FY.wkt?t.spatialReferenceId=6:e.wkt===s.LJ.wkt?t.spatialReferenceId=8:(0,c.q8)(e)?t.spatialReferenceId=7:(0,c.KQ)(e)?t.spatialReferenceId=9:t.spatialReferenceId=0):0}function y(e,t,i,r){e!==i&&(i[r++]=e[t++],i[r++]=e[t++],i[r]=e[t])}function g(e,t,i,r){i[r]=L*(e[t]/N),i[r+1]=L*(P-2*Math.atan(Math.exp(-e[t+1]/N))),i[r+2]=e[t+2]}function _(e,t,i,n){!function(e,t,i,n,s){const a=.4999999*Math.PI,l=(0,r.qE)(D*e[t+1],-a,a),o=Math.sin(l);i[n++]=D*e[t]*s.radius,i[n++]=s.halfSemiMajorAxis*Math.log((1+o)/(1-o)),i[n]=e[t+2]}(e,t,i,n,a.$O)}function m(e,t,i,r){i[r]=e[t]*E,i[r+1]=e[t+1]*E,i[r+2]=e[t+2]}function w(e,t,i,r){i[r]=e[t]*M,i[r+1]=e[t+1]*M,i[r+2]=e[t+2]}function b(e,t,i,r,n){const s=n+e[t+2],a=D*e[t+1],l=D*e[t],o=Math.cos(a)*s;i[r]=Math.cos(l)*o,i[r+1]=Math.sin(l)*o,i[r+2]=Math.sin(a)*s}function F(e,t,i,r){b(e,t,i,r,a.Sw.radius)}function I(e,t,i,r){b(e,t,i,r,a.sH.radius)}function S(e,t,i,r){b(e,t,i,r,a.$O.radius)}function v(e,t,i,n,s){const a=e[t],l=e[t+1],o=e[t+2],u=Math.sqrt(a*a+l*l+o*o),c=(0,r.YN)(o/(0===u?1:u)),d=Math.atan2(l,a);i[n++]=L*d,i[n++]=L*c,i[n]=u-s}function A(e,t,i,r){v(e,t,i,r,a.Sw.radius)}function T(e,t,i,r){v(e,t,i,r,a.sH.radius)}function C(e,t,i,r){v(e,t,i,r,a.$O.radius)}function x(e,t,i,r){!function(e,t,i,r,n){const s=D*e[t],a=D*e[t+1],l=e[t+2],o=Math.sin(a),u=Math.cos(a),c=n.radius/Math.sqrt(1-n.eccentricitySquared*o*o);i[r++]=(c+l)*u*Math.cos(s),i[r++]=(c+l)*u*Math.sin(s),i[r++]=(c*(1-n.eccentricitySquared)+l)*o}(e,t,i,r,a.$O)}function R(e,t,i,r){const n=u,s=e[t],l=e[t+1],o=e[t+2];let c,d,h,f,p,y,g,_,m,w,b,F,I,S,v,A,T,C,x,R,k;c=Math.abs(o),d=s*s+l*l,h=Math.sqrt(d),f=d+o*o,p=Math.sqrt(f),R=Math.atan2(l,s),y=o*o/f,g=d/f,S=n.a2/p,v=n.a3-n.a4/p,g>.3?(_=c/p*(1+g*(n.a1+S+y*v)/p),x=Math.asin(_),w=_*_,m=Math.sqrt(1-w)):(m=h/p*(1-y*(n.a5-S-g*v)/p),x=Math.acos(m),w=1-m*m,_=Math.sqrt(w)),b=1-a.$O.eccentricitySquared*w,F=a.$O.radius/Math.sqrt(b),I=n.a6*F,S=h-F*m,v=c-I*_,T=m*S+_*v,A=m*v-_*S,C=A/(I/b+T),x+=C,k=T+A*C/2,o<0&&(x=-x),i[r++]=L*R,i[r++]=L*x,i[r]=k}const k={source:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},dest:{spatialReference:null,spatialReferenceId:0,metersPerUnit:1},projector:y},D=(0,r.kU)(1),L=(0,r.KJ)(1),P=.5*Math.PI,N=a.$O.radius,E=N*Math.PI/180,M=180/(N*Math.PI)},40334:(e,t,i)=>{i.r(t),i.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>re,constructFeatureSet:()=>te,constructFeatureSetFromPortalItem:()=>ce,constructFeatureSetFromRelationship:()=>ne,constructFeatureSetFromUrl:()=>ee,convertToFeatureSet:()=>ue,createFeatureSetCollectionFromMap:()=>le,createFeatureSetCollectionFromService:()=>oe,initialiseMetaDataCache:()=>H});var r=i(78888);class n{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(e=!1){return"object, FeatureSetCollection"}}var s=i(78878),a=i(35704),l=i(52106),o=i(59534),u=i(68423),c=i(86691),d=i(87449),h=i(11221),f=i(89169),p=i(87594),y=i(33325),g=i(80609),_=i(1262),m=i(88368);class w{constructor(){this.field="",this.tofieldname="",this.typeofstat="MIN",this.workingexpr=null}clone(){const e=new w;return e.field=this.field,e.tofieldname=this.tofieldname,e.typeofstat=this.typeofstat,e.workingexpr=this.workingexpr,e}static parseStatField(e,t,i,r){const n=new w;n.field=e;const s=m.A.create(t,{fieldsIndex:i,timeZone:r}),a=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 _.L("MissingStatisticParameters");const t=m.A.create((0,g.Mi)(e.parseTree.args.value[0],0,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(s);if(null===a)throw new _.L("UnsupportedSqlFunction",{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(n.typeofstat="MIN",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"min"})}else if("MAX"===l){if(n.typeofstat="MAX",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"max"})}else if("COUNT"===l)n.typeofstat="COUNT",n.workingexpr=a.expr;else if("STDEV"===l){if(n.typeofstat="STDDEV",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"stdev"})}else if("SUM"===l){if(n.typeofstat="SUM",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"sum"})}else if("MEAN"===l){if(n.typeofstat="AVG",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:l})}else if("AVG"===l){if(n.typeofstat="AVG",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"avg"})}else{if("VAR"!==l)throw new _.L("UnsupportedSqlFunction",{function:l});if(n.typeofstat="VAR",n.workingexpr=a.expr,null===s)throw new _.L("InvalidFunctionParameters",{function:"var"})}return n}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"}}}var b=i(80200),F=i(74639),I=i(44729),S=i(55612),v=i(15032),A=i(16930),T=i(20437),C=i(95466);const x=new o.b(["MIN","MAX","VAR","STDDEV","COUNT","SUM","AVG"],[["VARIANCE","VAR"],["AVERAGE","AVG"],["MEAN","AVG"],["STDEV","STDDEV"]]);class R extends h.A{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 0}_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 r=this._parent?this._parent.getFieldsIndex():new C.A([]);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 w;t.field=e.name,t.tofieldname=e.name,t.workingexpr=e.expression instanceof m.A?e.expression:m.A.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=x.lookup(e.statistic)??"COUNT",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 m.A?e.expression:m.A.create(e.expression,{fieldsIndex:r,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};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,this.subtypes=null,this.subtypeField=""}else this.geometryType=y.ik.point,this.typeIdField="",this.types=null,this.subtypes=null,this.subtypeField="",this.spatialReference=new A.A({wkid:4326});this.fields=[];const n=new w;n.field=this._nextUniqueName(e),n.tofieldname=this.objectIdField,n.workingexpr=m.A.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),n.typeofstat="MIN",this._decodedStatsfield.push(n);for(const t of this._decodedGroupbyfield){const i=new T.A;if(t.name=this._nextUniqueName(e),i.name=t.tofieldname,i.alias=i.name,(0,g.DA)(t.expression)){const e=this._parent.getField((0,g.YY)(t.expression,0));if(!e)throw new d.d("AggregationFieldNotFound");t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),i.type=e.type,t.sqlType=e.type}else{i.type=this._convertToEsriFieldType((0,g.IY)(t.expression,this._parent.fields));const e=new T.A;e.name=t.name,e.alias=e.name,this.phsyicalgroupbyfields.push(t.name),this._adaptedFields.push(new u.Gr(e,t.expression)),this._candosimplegroupby=!1,t.sqlType=i.type}this.fields.push(i)}if(this._adaptedFields.length>0)for(const e of this._parent.fields)this._adaptedFields.push(new u.IO(e));for(let t=0;t<this._decodedStatsfield.length;t++){const i=new T.A;let r=null;const n=this._decodedStatsfield[t];n.field=this._nextUniqueName(e),n.tofieldname===this.objectIdField&&(this._internalObjectIdField=n.field),i.name=n.tofieldname,i.alias=i.name;const s=null!==n.workingexpr&&(0,g.DA)(n.workingexpr)?(0,g.YY)(n.workingexpr,0):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==s){if(r=this._parent.getField(s),!r)throw new d.d("AggregationFieldNotFound");i.type=r.type}else i.type="double";break;case"MIN":case"MAX":if(""!==s){if(r=this._parent.getField(s),!r)throw new d.d("AggregationFieldNotFound");i.type=r.type}else i.type="double";break;case"COUNT":i.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==s&&(r=this._parent.getField(s),!r))throw new d.d("AggregationFieldNotFound");i.type="double"}this.fields.push(i)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,i,r){-1!==t&&this._featureCache[t];const n=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,n)?(await this._expandPagedSet(e,n,0,0,r),this._getFeatures(e,t,i,r)):"success"}async _getFilteredSet(e,t,i,r,n){if(""!==e)return new f.A([],[],!0,null);let s=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,g.Ju)(i,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,i=null;break}if(null!==r){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===r.scanForField(this._decodedStatsfield[e].tofieldname)){r=null,l.ordered=!1;break}if(null!==r)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===r.scanForField(e.tofieldname)){r=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;r&&(t=this._reformulateOrderClauseWithoutGroupByFields(r));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(n),s=!0===l.nowhereclause?new f.A(a._candidates.slice().concat(a._known.slice()),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new f.A(a._candidates.slice(),a._known.slice(),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),s}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)s=new f.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.A({parentfeatureset:o,orderbyclause:new p.A(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.A({parentfeatureset:e,whereclause:t})}s=new f.A(["GETPAGES"],[],!1,{aggregatefeaturesetpagedefinition:!0,resultOffset:0,resultRecordCount:this._maxQuery,internal:{fullyResolved:!1,workingItem:null,type:"manual",iterator:null,set:[],subfeatureset:new c.A({parentfeatureset:e,orderbyclause:new p.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return s}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,g.bD)(e,t.tofieldname,(0,g.YY)(t.workingexpr,0),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,g.bD)(e,t.tofieldname,(0,g.YY)(t.expression,0),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,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}async _getPhysicalPage(e,t,i){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,i,[]);const r=await this._getAgregagtePhysicalPage(e,t,i);for(const e of r){const t={geometry:e.geometry,attributes:{}},i={};for(const t in e.attributes)i[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=i[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=i[e.field.toLowerCase()];this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return r.length}_sequentialGetPhysicalItem(e,t,i,r){return new Promise((n,s)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(i)),!0===e.pagesDefinition.internal.fullyResolved||0===t?n(r.length):this._nextAggregateItem(e,t,i,r,s=>{null===s?n(r.length):(t-=1,n(this._sequentialGetPhysicalItem(e,t,i,r)))},s)})}_nextAggregateItem(e,t,i,r,n,a){try{(0,s.a0)(e.pagesDefinition.internal.iterator.next()).then(s=>{if(null===s)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);r.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,n(null)}else e.pagesDefinition.internal.fullyResolved=!0,n(null);else{const l=this._generateAggregateHash(s);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[s],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const i=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return r.push(i),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(i.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[s],id:l},void n(i)}e.pagesDefinition.internal.workingItem.features.push(s)}this._nextAggregateItem(e,t,i,r,n,a)}},a)}catch(e){a(e)}}_calculateFieldStat(e,t,i){const r=[];for(const i of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(i);null!==e&&(e instanceof I.n||e instanceof v.k?r.push(e.toNumber()):e instanceof S.g?r.push(e.toMilliseconds()):r.push(e))}else r.push(null);i.attributes[t.tofieldname]=(0,F.s)(t.typeofstat,[r])}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.features[0].attributes[i.singlefield]:m.A.convertValueToStorageFormat(i.expression.calculateValue(e.features[0]),i.sqlType);t.attributes[i.tofieldname]=r}for(const i of this._decodedStatsfield)this._calculateFieldStat(e,i,t);const i=[];for(let r=0;r<this._decodedStatsfield.length;r++)i.push(this._calculateFieldStat(e,this._decodedStatsfield[r],t));return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const i of this._decodedGroupbyfield){const r=i.singlefield?e.attributes[i.singlefield]:i.expression.calculateValue(e);t+=null==r?":":":"+r.toString()}return(0,b.d)(t,b.T.String)}async _stat(){return{calculated:!1}}async getFeatureByObjectId(){return null}static registerAction(){h.A._featuresetFunctions.groupby=function(e,t){return new R({parentfeatureset:this,groupbyfields:e,statsfields:t})}}}var k=i(54784),D=i(54461),L=i(70333),P=i(61454),N=i(66395),E=i(50145),M=i(4576),O=i(39516),j=i(65864),G=i(21325),q=i(29784),B=i(54546),U=i(61956),Z=i(7562);class W extends h.A{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 y.gO}end(){return this._layer}optimisePagingFeatureQueries(e){this._pageJustIds=e}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+(0,y.JB)(e.toJSON());return(0,b.d)(t,b.T.String)}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(),this.hasZ=!0===this._layer?.capabilities?.data?.supportsZ,this.hasM=!0===this._layer?.capabilities?.data?.supportsM,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 r of this._overrideFields)if(r.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=1,null!=e&&e>=10.61&&(this._databaseType=0)):null!=e&&(e>=10.5&&(this._databaseType=1,this._requestStandardised=!0),e>=10.61&&(this._databaseType=0))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}_isInFeatureSet(){return 0}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.A;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),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}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?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}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const i="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let r=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);r=this.recentlyUsedQueries.getFromCache(t),null===r&&(r=i(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=i(e)),r}async _getFilteredSet(e,t,i,r,n){const s=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new f.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,i,r,n);let a="",l=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=r.constructClause(),l=!0);const o=this._createQuery();o.where=(0,O.mA)(o.where,null===i?null===t?"1=1":"":(0,g.YY)(i,s)),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(n),new f.A([],u,l,null)}_expandPagedSet(e,t,i,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}async _getFilteredSetUsingPaging(e,t,i,r,n){let s="",a=!1;null!==r&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(s=r.constructClause(),a=!0);const l=await this.databaseType(),o=null===i?null===t?"1=1":"":(0,g.YY)(i,l);let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);let d=null;if(!0===this._pageJustIds)d=new f.A([],["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:s,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let i=!0;!0===this._removeGeometry&&(i=!1);const r=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new f.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:r.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:s,returnGeometry:i,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,n),d}_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 r=e.pagesDefinition.internal.lastRetrieved,n=r,s=e.pagesDefinition.internal.lastPage,a=this._createQuery();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=(0,O.mA)(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!==s)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[n+t]=l.features[t].attributes[o];if(!1===this._pageJustIds)for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=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=r+l.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,"done"}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();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,r){const n=[];if(-1!==t&&void 0===this._featureCache[t]&&n.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,r),this._getFeatures(e,t,i,r);let s=0;for(let r=e._lastFetchedIndex;r<e._known.length;r++){if(e._lastFetchedIndex+=1,s++,void 0===this._featureCache[e._known[r]]){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[r]]){const n=t._featureMap[e._known[r]];null!==n&&(i=!0,this._featureCache[e._known[r]]=n)}}if(!1===i&&(e._known[r]!==t&&n.push(e._known[r]),n.length>=this._maxProcessingRate()-1))break}if(s>=i&&0===n.length)break}if(0===n.length)return"success";const a=this._createQuery();a.objectIds=n,a.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),a.returnGeometry=!0,!0===this._removeGeometry&&(a.returnGeometry=!1),a.outSpatialReference=this.spatialReference;const l=await this.executeQuery(a,"execute");if(this._checkCancelled(r),void 0!==l.error)throw new d.d("RequestFailed",{reason:l.error});const o=this._layer.objectIdField;for(let e=0;e<l.features.length;e++)this._featureCache[l.features[e].attributes[o]]=l.features[e];return"success"}async _getDistinctPages(e,t,i,r,n,s,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=i.parseTree.column;const h=this._layer.fields??[];for(let e=0;e<h.length;e++)if(h[e].name.toLowerCase()===c.toLowerCase()){c=h[e].name;break}const f=this._createQuery();f.where=(0,O.mA)(f.where,null===s?null===n?"1=1":"":(0,g.YY)(s,u)),f.spatialRelationship=this._makeRelationshipEnum(r),f.relationParameter=this._makeRelationshipParam(r),f.geometry=null===n?null:n,f.returnDistinctValues=!0,f.returnGeometry=!1,f.outFields=[c];const p=await this.executeQuery(f,"execute");if(this._checkCancelled(o),!p.hasOwnProperty("features"))throw new d.d("InvalidStatResponse");let y=!1;for(let e=0;e<h.length;e++)if(h[e].name===c){"date"===h[e].type&&(y=!0);break}for(let e=0;e<p.features.length;e++){if(y){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,r,n,s,a,l,o)}:l}async _distinctStat(e,t,i,r,n,s,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,i,r,n,s,[],a)}}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}async _countstat(e,t,i,r){const n=await this.databaseType();if(this.isTable()&&i&&null!==t&&""!==t)return{calculated:!0,result:0};const s=this._createQuery();return s.where=(0,O.mA)(s.where,null===r?null===i?"1=1":"":(0,g.YY)(r,n)),s.spatialRelationship=this._makeRelationshipEnum(t),s.relationParameter=this._makeRelationshipParam(t),s.geometry=null===i?null:i,s.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(s,"executeForCount")}}async _stats(e,t,i,r,n,s,a){await this._ensureLoaded();const l=this._layer.capabilities?.query,o=!!l?.supportsSqlExpression,u=!!l?.supportsStatistics,c=!!l?.supportsDistinct;if("count"===e)return c?this._countstat(e,i,r,n):{calculated:!1};if(!1===u||!1===(0,g.DA)(t)&&!1===o||!1===t.isStandardized)return""!==i||null!==n?{calculated:!1}:this._manualStat(e,t,s,a);if("distinct"===e)return!1===c?""!==i||null!==n?{calculated:!1}:this._manualStat(e,t,s,a):this._distinctStat(e,t,i,r,n,s,a);const h=await this.databaseType();if(this.isTable()&&r&&null!==i&&""!==i)return{calculated:!0,result:null};const f=this._createQuery();f.where=(0,O.mA)(f.where,null===n?null===r?"1=1":"":(0,g.YY)(n,h)),f.spatialRelationship=this._makeRelationshipEnum(i),f.relationParameter=this._makeRelationshipParam(i),f.geometry=null===r?null:r;const p=new Z.A;p.statisticType=(0,E.Dp)(e),p.onStatisticField=(0,g.YY)(t,h),p.outStatisticFieldName="ARCADE_STAT_RESULT",f.returnGeometry=!1;let y="ARCADE_STAT_RESULT";f.outStatistics=[p];const _=await this.executeQuery(f,"execute");if(!_.hasOwnProperty("features")||0===_.features.length)throw new d.d("InvalidStatResponse");let m=!1;const w=_.fields??[];for(let e=0;e<w.length;e++)if("ARCADE_STAT_RESULT"===w[e].name.toUpperCase()){y=w[e].name,"date"===w[e].type&&(m=!0);break}if(m){let e=_.features[0].attributes[y];return null!==e&&(e=new Date(_.features[0].attributes[y])),{calculated:!0,result:e}}return{calculated:!0,result:_.features[0].attributes[y]}}_stat(e,t,i,r,n,s,a){return this._stats(e,t,i,r,n,s,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let i=!1;const r=this._layer.capabilities?.query,n=!0===r?.supportsSqlExpression;if(null!=r&&!0===r.supportsStatistics&&!0===r.supportsOrderBy&&(i=!0),i)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,g.DA)(t[e].workingexpr)&&!1===n)&&(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,r,n,s,a){await this._ensureLoaded();const l=await this.databaseType();let o=null;if(!this._layer.capabilities.query.supportsPaginationOnAggregatedQueries){const t=this.getFieldsIndex();o={keyFields:e.map((e,i)=>({name:t.normalizeFieldName(e)??e,asc:null==s||1===s._directions[i]}))}}let u="",c=!1;null!=s&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==o||(0,M.MJ)(e,0,e.length,s._fields,0,Math.min(s._fields.length,e.length),(e,t)=>e.toLowerCase()===t.toLowerCase()))&&(u=s.constructClause(),c=!0),""===u&&(u=e.join(","));const d=[];for(let e=0;e<t.length;e++){const i=new Z.A;i.onStatisticField=null!==t[e].workingexpr?(0,g.YY)(t[e].workingexpr,l):"",i.outStatisticFieldName=t[e].field,i.statisticType=t[e].toStatisticsName(),d.push(i)}let h=this._maxQueryRate();const p=this._layer.capabilities?.query.maxRecordCount;null!=p&&p<h&&(h=p);const y=null===n?null===r?"1=1":"":(0,g.YY)(n,l);return new f.A([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(i),relationParam:this._makeRelationshipParam(i),outFields:["*"],useOIDpagination:!1,generatedOid:a,resultRecordCount:h,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===r?null:r,where:y,orderByFields:u,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1,keysetPagination:o}})}async _getAgregagtePhysicalPage(e,t,i){let r=e.pagesDefinition.where;if(!0===e.pagesDefinition.useOIDpagination&&(r=(0,O.mA)(r,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString())),null!=e.pagesDefinition.internal.keysetPagination?.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new d.d("NotImplemented");r=(0,O.mA)(r,(0,g.YY)(e.pagesDefinition.internal.keysetPagination.clause,await this.databaseType()))}const n=e.pagesDefinition.internal.lastRetrieved,s=n,a=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,O.mA)(o.where,r),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 d.d("InvalidStatResponse");const c=[];if(e.pagesDefinition.internal.lastPage!==a)return[];u.features.length>0&&void 0===u.features[0].attributes[e.pagesDefinition.generatedOid]&&(e.pagesDefinition.generatedOid=e.pagesDefinition.generatedOid.toLowerCase());for(let t=0;t<u.features.length;t++)e.pagesDefinition.internal.set[s+t]=u.features[t].attributes[e.pagesDefinition.generatedOid];for(let e=0;e<u.features.length;e++)c.push(new l.A({attributes:u.features[e].attributes,geometry:null}));return e.pagesDefinition.internal.keysetPagination?0!==u.features.length&&u.exceededTransferLimit?function(e,t){null==e.clause&&(e.clause=function(e){if(0===e.length)throw new d.d("NeverReach");const t=[];for(let i=0;i<e.length;i++){const r=e[i],n=[`"${r.name.replaceAll('"','""')}" ${r.asc?">":"<"} @last_${i}`];for(let t=0;t<i;t++){const i=e[t];n.push(`"${i.name.replaceAll('"','""')}" = @last_${t}`)}t.push(n.join(" AND "))}const i=t.join(" OR ");return m.A.create(i)}(e.keyFields));for(let i=0;i<e.keyFields.length;i++){const r=e.keyFields[i].name;e.clause.parameters[`last_${i}`]=t.attributes[r]}}(e.pagesDefinition.internal.keysetPagination,c.at(-1)):e.pagesDefinition.internal.fullyResolved=!0:!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=n+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,i,r,n){const s=new q.default({url:e,outFields:null===t?["*"]:t});return new W({layer:s,spatialReference:i,lrucache:r,interceptor:n})}relationshipMetaData(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return(0,y.Qi)(this._layer.parsedUrl.path)}async queryAttachments(e,t,i,r,n){const s=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(s)){const a={objectIds:[e],returnMetadata:n};(t&&t>0||i&&i>0)&&(a.size=[t&&t>0?t:0,i&&i>0?i:t+1]),r&&r.length>0&&(a.attachmentTypes=r),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:s,query:a,method:"attachments"});const l=await s.queryAttachments(new B.A(a)),o=[];return l&&l[e]&&l[e].forEach(t=>{const i=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let r=null;n&&t.exifInfo&&(r=N.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new P.A(t.id,t.name,t.contentType,t.size,i,r,t.keywords??null))}),o}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&&e.objectIds.length>0&&(t.objectIds=e.objectIds.join(",")),e.outSpatialReference&&(t.outSR=(0,G.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await(0,r.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const i=t.spatialReference;for(const r of t.relatedRecordGroups){const n=r.objectId,s=[];for(const e of r.relatedRecords){e.geometry&&(e.geometry.spatialReference=i);const t=new l.A({geometry:e.geometry?(0,j.rS)(e.geometry):null,attributes:e.attributes});s.push(t)}e[n]={features:s,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new d.d("InvalidRequest")}async getFeatureByObjectId(e,t){const i=this._createQuery();i.outFields=t,i.returnGeometry=!1,i.outSpatialReference=this.spatialReference,i.where=(0,O.mA)(i.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:i,method:"execute"});const r=await this._layer.queryFeatures(i);return 1===r.features.length?r.features[0]:null}async getIdentityUser(){await this.load();const e=L.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=L.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.slice(0,i):t,t){t+="/rest/info";try{const e=await(0,r.A)(t,{query:{f:"json"}});let i="";return e.data?.owningSystemUrl&&(i=e.data.owningSystemUrl),i}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new W({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this.recentlyUsedQueries??void 0,interceptor:this.featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this.fsetInfo)return this.fsetInfo;let e=null,t="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const n=await(0,r.A)(i,{responseType:"json",query:{f:"json"}});e=n?.data?.name??null,t=n?.data?.serviceItemId??null}const n=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===i?null:i,webMapLayerId:n?this._layer.id??null:null,webMapLayerTitle:n?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var V=i(30235),Q=i(26591);class z extends h.A{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,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 y.gO}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(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,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 r of this._overrideFields)if(r.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,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return await this._relatedLayer.databaseType(),this._databaseType=this._relatedLayer._databaseType,this._databaseType}isTable(){return this._relatedLayer.isTable()}_isInFeatureSet(){return 0}_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.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,i,r,n){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new f.A([],[],!0,null);const s=this._layer.nativeCapabilities();if(!1===s.canQueryRelated)return new f.A([],[],!0,null);if(s.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,i,r,n);let a="",l=!1;null!==r&&!0===s.capabilities?.queryRelated.supportsOrderBy&&(a=r.constructClause(),l=!0);const o=new Q.default;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 d=await s.source.queryRelatedFeatures(o);this._checkCancelled(n);const h=d[this._findObjectId]?d[this._findObjectId].features:[],p=[];for(let e=0;e<h.length;e++)this._featureCache[h[e].attributes[this._relatedLayer.objectIdField]]=h[e],p.push(h[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,g=null!=i;return new f.A(y||g?p:[],y||g?[]:p,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();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,r,n){let s="",a=!1;const l=this._layer.nativeCapabilities();null!==r&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(s=r.constructClause(),a=!0),await this.databaseType();let o=this._maxQueryRate();const u=l.capabilities?.query.maxRecordCount;null!=u&&u<o&&(o=u);const c=t&&null!==e&&""!==e,d=null!=i;let h=null,p=!0;!0===this._removeGeometry&&(p=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]);return h=new f.A(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:s,returnGeometry:p,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(h,o,0,0,n),h}_expandPagedSet(e,t,i,r,n){return this._expandPagedSetFeatureSet(e,t,i,r,n)}_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 r=e.pagesDefinition.internal.lastRetrieved,n=r,s=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new Q.default;!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!==s)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[n+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=r+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,i,r){const n=[];-1!==t&&void 0===this._featureCache[t]&&n.push(t);const s=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,s))return await this._expandPagedSet(e,s,0,0,r),this._getFeatures(e,t,i,r);let a=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(a++,a<=i&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[r]&&void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&n.push(e._known[r]),n.length>i)))&&!(a>=i&&0===n.length);r++);if(0===n.length)return"success";throw new d.d("MissingFeatures")}async _refineSetBlock(e,t,i){return e}async _stat(e,t,i,r,n,s,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,i,r,n){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,i,r,n){return this._relatedLayer.queryAttachments(e,t,i,r,n)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer?.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer?.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer?.editFieldsInfo??null}get timeInfo(){return this._relatedLayer?.timeInfo??null}async getFeatureSetInfo(){return this.fsetInfo??this._layer.featureSetInfo}}var $=i(23732),J=i(92474),Y=i(4146),K=i(80812);function H(){null===$.A.applicationCache&&($.A.applicationCache=new $.A)}async function X(e,t,i){if($.A.applicationCache){const i=$.A.applicationCache.getLayerInfo(e);if(i){const r=await i;return new q.default({url:e,outFields:t,sourceJSON:r})}const r=new q.default({url:e,outFields:t}),n=(async()=>(await r.load(),r.sourceJSON))();if($.A.applicationCache){$.A.applicationCache.setLayerInfo(e,n);try{return await n,r}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return await n,r}if(null!=i){const r=i.getCachedLayerMetadata(e);if(r){const i=await r;return new q.default({url:e,outFields:t,sourceJSON:i})}const n=new q.default({url:e,outFields:t}),s=(async()=>(await n.load(),n.sourceJSON))();i.setCachedLayerMetadata(e,s);try{return await s,n}catch(t){throw i.removeCachedLayerMetadata(e,s),t}}return new q.default({url:e,outFields:t})}async function ee(e,t,i,r,n,s=null){return te(await X(e,["*"],n),t,i,r,n,s)}function te(e,t=null,i=null,r=!0,n=null,s=null){switch(e.type){case"catalog-footprint":return te(e.parent,t,i,r,n,s);case"subtype-sublayer":{const a=te(e.parent,t,i,r,n,s);return a.filter(m.A.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:a.dateFieldsTimeZoneDefaultUTC}))}case"csv":case"geojson":case"knowledge-graph-sublayer":case"wfs":return new V.A({layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:n,interceptor:s});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const a={layer:e,spatialReference:t,outFields:i,includeGeometry:r,lrucache:n,interceptor:s};return!e.url&&e.source?new V.A(a):new W(a)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function ie(e,t){if(null!==$.A.applicationCache){const t=$.A.applicationCache.getLayerInfo(e);if(null!==t)return t}if(null!=t){const i=t.getCachedServiceMetadata(e);if(null!=i)return i}const i=(async()=>{const t=await(0,r.A)(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!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(e,i);try{return await i}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,i);try{return await i}catch(r){throw t.removeCachedServiceMetadata(e,i),r}}return i}async function re(e,t,i){const n={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},s=await ie(e,null);if(n.metadata=s,void 0!==s.controllerDatasetLayers?.utilityNetworkLayerId&&null!==s.controllerDatasetLayers.utilityNetworkLayerId){if(s.layers)for(const e of s.layers)n.layerNameLkp[e.id]=e.name;if(s.tables)for(const e of s.tables)n.layerNameLkp[e.id]=e.name;const a=s.controllerDatasetLayers.utilityNetworkLayerId;n.networkId=a;const l=await async function(e,t){const i="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==$.A.applicationCache){const e=$.A.applicationCache.getLayerInfo(i);if(null!==e)return e}const n=(async()=>{const i=await(0,r.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(i.data){const e=i.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new d.d("DataElementsNotFound")})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(i,n);try{return await n}catch(e){throw $.A.applicationCache.clearLayerInfo(i),e}}return n}(e,a);if(l){n.queryelem=l,n.queryelem?.dataElement&&void 0!==n.queryelem.dataElement.schemaGeneration&&(n.unVersion=n.queryelem.dataElement.schemaGeneration),n.lkp={},n.queryelem.dataElement.domainNetworks||(n.queryelem.dataElement.domainNetworks=[]);for(const e of n.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:n.layerNameLkp[t.layerId]??null};n.layerIdLookup.set(e.layerId,e),n.sourceIdLookup.set(e.sourceId,e),e.className&&(n.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:n.layerNameLkp[t.layerId]??null};n.layerIdLookup.set(e.layerId,e),n.sourceIdLookup.set(e.sourceId,e),e.className&&(n.lkp[e.className]=e)}}if(n.queryelem.dataElement.terminalConfigurations)for(const e of n.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)n.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const s=await async function(e){if(null!==$.A.applicationCache){const t=$.A.applicationCache.getLayerInfo(e);if(null!==t)return t}const t=(async()=>{const t=await(0,r.A)(e,{responseType:"json",query:{f:"json"}});return t.data?t.data:null})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(e,t);try{return await t}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return t}(e+"/"+a);if(void 0!==s.systemLayers?.associationsTableId&&null!==s.systemLayers.associationsTableId){let r=null;if(i&&n.unVersion<8){const i=[];n.unVersion>=4&&(i.push("STATUS"),i.push("PERCENTALONG")),r=await ee(e+"/"+s.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...i],!1,null,null),await r.load(),n.unVersion>=4&&(r=r.filter(m.A.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)",{fieldsIndex:r.getFieldsIndex(),timeZone:r.dateFieldsTimeZoneDefaultUTC})),await r.load())}return{lkp:n.lkp,associations:r,unVersion:n.unVersion,terminals:n.terminals,layerIdLookup:n.layerIdLookup,sourceIdLookup:n.sourceIdLookup}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:n.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function ne(e,t,i,r=null,n=null,s=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o=o.endsWith("/")?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await ee(o,r,n,s,a,l);return new z({layer:e,relatedLayer:u,relationship:t,objectId:i,spatialReference:r,outFields:n,includeGeometry:s,lrucache:a,interceptor:l})}a.A.registerAction(),R.registerAction(),c.A.registerAction(),k.A.registerAction(),D.A.registerAction();class se extends n{constructor(e,t=null,i=null,r=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,i=null){const r=te(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async featureSetByName(e,t=!0,i=null){if((0,J.Zm)(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.title===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find(t=>(0,y.eB)(t)&&t.title===e);if(null!=n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.allTables){const r=this._map.allTables.find(t=>(0,y.eB)(t)&&t.title===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){if((0,J.Zm)(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,i);null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.id===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=this._map.allLayers.find(t=>(0,y.eB)(t)&&t.id===e);if(n)return this._makeAndAddFeatureSet(n,t,i);if(this._map.allTables){const r=this._map.allTables.find(t=>(0,y.eB)(t)&&t.id===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,i)}return null}}class ae extends n{constructor(e,t=null,i=null,r=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=i,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,i=null){const r=te(e,this._overrideSpatialReference,null===i?["*"]:i,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(i)}),r}async _loadMetaData(){const e=await ie(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new ae(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,i=null){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.title===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=await this._loadMetaData();let s=null;for(const t of n.layers??[])t.name===e&&(s=t);if(!s)for(const t of n.tables??[])t.name===e&&(s=t);if(s){const e=await X(this._url+"/"+s.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}async featureSetById(e,t=!0,i=["*"]){null===i&&(i=["*"]),i=(i=i.slice()).sort();const r=JSON.stringify(i);e=null!=e?e.toString():"";for(let i=0;i<this._instantLayers.length;i++){const n=this._instantLayers[i];if(n.opitem.id===e&&n.includeGeometry===t&&n.outFields===r)return this._instantLayers[i].featureset}const n=await this._loadMetaData();let s=null;for(const t of n.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(s=t);if(!s)for(const t of n.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(s=t);if(s){const e=await X(this._url+"/"+s.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,i)}return null}}function le(e,t,i=null,r=null){return new se(e,t,i,r)}function oe(e,t,i=null,r=null){return new ae(e,t,i,r)}function ue(e,t,i,r,n){if(null===e)return null;if((0,s.m)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof Y.A&&(0,y.NI)(e)){const s=e;switch(t){case"datasource":return te(s,n,"outFields"in s?s.outFields:null,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return te(s,n,"outFields"in s?s.outFields:null,!0,i,r)}return null}if((0,s.$)(e)){switch(t){case"datasource":return te(e.parent,n,e.parent.outFields,!0,i,r).getDataSourceFeatureSet();case"parent":case"root":return te(e,n,e.parent.outFields,!0,i,r)}return null}return null}async function ce(e,t,i,r,n,s,a,l=null){if($.A.applicationCache){const o=$.A.applicationCache.getLayerInfo(e+":"+s.url);if(o)return de(await o,t,i,r,n,a,l)}if(null!=a){const o=a.getCachedPortalItem(s.url,e);if(null!=o)return await de(await o,t,i,r,n,a,l)}const o=new K.default({id:e,portal:s}).load();$.A.applicationCache?$.A.applicationCache.setLayerInfo(e+":"+s.url,o):null!=a&&a.setCachedPortalItem(s.url,e,o);try{return await de(await o,t,i,r,n,a,l)}catch(t){throw $.A.applicationCache&&$.A.applicationCache.clearLayerInfo(e+":"+s.url),null!=a&&a.removeCachedPortalItem(s.url,e,o),t}}async function de(e,t,i,r,n,s,a){let l;if("Feature Service"===e.type||"Map Service"===e.type)l=await X((0,y.Qi)(e.url??"")+"/"+t,["*"],s);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=s){const t=s.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=Y.A.fromPortalItem(e);s.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(i){throw s.removeCachedPortalItemLayer(e.portal.url,e.id,t),i}}}else l=await Y.A.fromPortalItem(e)}return te(l,i,r,n,s,a)}},41366:(e,t,i)=>{i.d(t,{K:()=>h,Q:()=>u});var r=i(31635),n=i(66552),s=i(53966),a=i(10107),l=(i(44208),i(87811),i(93223)),o=i(40608);const u=(0,n.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),c="percent-of-total",d="field",h=e=>{const t=e;let i=class extends t{constructor(){super(...arguments),this.normalizationField=null,this.normalizationMaxValue=null,this.normalizationMinValue=null,this.normalizationTotal=null}get normalizationType(){let e=this._get("normalizationType");const t=!!this.normalizationField,i=null!=this.normalizationTotal;return t||i?(e=t&&d||i&&c||null,t&&i&&s.A.getLogger(this).warn("warning: both normalizationField and normalizationTotal are set!")):e!==d&&e!==c||(e=null),e}set normalizationType(e){this._set("normalizationType",e)}};return(0,r.Cg)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],i.prototype,"normalizationField",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],i.prototype,"normalizationMaxValue",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],i.prototype,"normalizationMinValue",void 0),(0,r.Cg)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],i.prototype,"normalizationTotal",void 0),(0,r.Cg)([(0,l.e)(u,{name:"parameters.normalizationType"})],i.prototype,"normalizationType",null),i=(0,r.Cg)([(0,o.$)("esri.rest.support.NormalizationBinParametersMixin")],i),i}},41560:(e,t,i)=>{i.d(t,{Ch:()=>a,mW:()=>s});var r=i(34727),n=i(39516);function s(e,t){return{...t,filterMode:e.mode}}function a(e,t,i){const s=function(e){if("manual"===u(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:i,maxScale:r}of e.filters)t[0]=Math.max(t[0],c(i)),t[1]=Math.min(t[1],d(r));return t}(e);if(s&&((0,r.gg)(t,s[0])||(0,r.ZH)(i,s[1])))return"";const a=Array.from(l(e,t,i)),o=function(e,t,i){if(0===e.length)return!0;const n=c(e.at(0)?.minScale),s=d(e.at(-1)?.maxScale);if((0,r.ZH)(n,t)||(0,r.gg)(s,i))return!0;for(let t=0;t<e.length-1;t++){const i=e[t],n=e[t+1];if((0,r.ZH)(c(n.minScale),d(i.maxScale)))return!0}return!1}(a,t,i)?"1=1":a.map(e=>e.where||"1=1").reduce((e,t)=>(0,n.IW)(e,t),"");return o&&"1=1"!==o?o:""}function*l(e,t,i){if("manual"===u(e)){const t=e.filters.find(t=>t.id===e.activeFilterId);t&&(yield t)}else{"object"==typeof t&&(t=t.scale);for(const r of e.filters)o(r.minScale,r.maxScale,t,i)&&(yield r)}}function o(e,t,i,n){return e=c(e),i=c(i),t=d(t),!(!(0,r.Sp)(i,e)&&(n??i)>e||(0,r.Hx)(t,i)||void 0!==n&&(0,r.Sp)(n,e))}function u(e){return"mode"in e?e.mode:e.filterMode}function c(e){return e||Number.POSITIVE_INFINITY}function d(e){return e||0}},46140:(e,t,i)=>{i.d(t,{R:()=>n});var r=i(49186);let n=class e{constructor(e,t,i=""){this.major=e,this.minor=t,this._context=i}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",i=this._context&&this._context+" ";throw new r.A(t+"unsupported-version",`Required major ${i}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new e(this.major,this.minor,this._context)}static parse(t,i=""){const[n,s]=t.split("."),a=/^\s*\d+\s*$/;if(!n?.match||!a.test(n))throw new r.A((i&&i+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!s?.match||!a.test(s))throw new r.A((i&&i+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const l=parseInt(n,10),o=parseInt(s,10);return new e(l,o,i)}}},50498:(e,t,i)=>{i.d(t,{Ye:()=>d,gy:()=>c,yR:()=>h});var r=i(66552),n=i(5443),s=i(91075),a=i(48526),l=i(86738),o=i(39829),u=i(82799);const c=(0,r.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon"}),d=(0,r.O)()({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh"}),h={base:s.A,key:"type",typeMap:{extent:n.A,multipoint:a.A,point:l.A,polyline:u.A,polygon:o.A}}},52106:(e,t,i)=>{i.d(t,{A:()=>F});var r,n=i(31635),s=i(13874),a=i(69540),l=i(51447),o=i(25482),u=i(53966),c=i(36708),d=i(24326),h=i(10107),f=(i(44208),i(87811),i(40608)),p=i(12195),y=i(65864),g=i(50498),_=i(60950),m=i(54339),w=i(33910);function b(e){if(null==e)return null;const t={};for(const i in e){const r=e[i];r&&(t[i]=r.toJSON())}return 0!==Object.keys(t).length?t:null}let F=class extends((0,a.OU)(o.o)){static{r=this}constructor(e){super(e),this.isAggregate=!1,this.layer=null,this.origin=null,this.sourceLayer=null,this._version=0,Object.defineProperty(this,"uid",{value:(0,d.c)(),configurable:!0}),Object.defineProperty(this,"_lastMeshTransform",{value:{},configurable:!0,writable:!0,enumerable:!1}),arguments.length>1&&(0,l.eF)(u.A.getLogger(this),"Graphic",{version:"4.30"})}initialize(){this._watchMeshGeometryChanges()}set aggregateGeometries(e){const t=this._get("aggregateGeometries");JSON.stringify(t)!==JSON.stringify(e)&&this._set("aggregateGeometries",e)}set attributes(e){const t=this._get("attributes");t!==e&&(this._set("attributes",e),this._notifyLayer("attributes",t,e))}set geometry(e){const t=this._get("geometry");t!==e&&(this._set("geometry",e),"mesh"!==e?.type&&this._notifyLayer("geometry",t,e))}set popupTemplate(e){const t=this._get("popupTemplate");t!==e&&(this._set("popupTemplate",e),this._notifyLayer("popupTemplate",t,e))}set symbol(e){const t=this._get("symbol");t!==e&&(this._set("symbol",e),this._notifyLayer("symbol",t,e))}get version(){return this._version}set visible(e){const t=this._get("visible");t!==e&&(this._set("visible",e),this._notifyLayer("visible",t,e))}cloneShallow(){return new r({aggregateGeometries:this.aggregateGeometries,attributes:this.attributes,geometry:this.geometry,isAggregate:this.isAggregate,layer:this.layer,popupTemplate:this.popupTemplate,sourceLayer:this.sourceLayer,symbol:this.symbol,visible:this.visible,origin:this.origin})}getEffectivePopupTemplate(e=!1){if(this.popupTemplate)return this.popupTemplate;const t=(0,_.E_)(this.origin);if(t)return t.popupTemplate??(e?t.defaultPopupTemplate:null)??null;const i=this.origin&&"layer"in this.origin?this.origin.layer:null;for(const t of[i,this.sourceLayer,this.layer])if(t&&"object"==typeof t){if("popupTemplate"in t&&t.popupTemplate)return t.popupTemplate;if(e&&"defaultPopupTemplate"in t&&null!=t.defaultPopupTemplate)return t.defaultPopupTemplate}return null}getAttribute(e){return this.attributes?.[e]}setAttribute(e,t){if(this.attributes){const i=this.getAttribute(e);this.attributes[e]=t,this._notifyLayer("attributes",i,t,e)}else this.attributes={[e]:t}}getObjectId(){const e=this.sourceLayer??this.layer;return e?(0,m.r)(this,e):null}getGlobalId(){const e=this.sourceLayer??this.layer;return e&&"globalIdField"in e&&e.globalIdField?this.getAttribute(e.globalIdField):null}toJSON(){return{aggregateGeometries:b(this.aggregateGeometries),geometry:null!=this.geometry?this.geometry.toJSON():null,symbol:null!=this.symbol?this.symbol.toJSON():null,attributes:(0,p.W)(this.attributes)?this.attributes.toJSON():{...this.attributes},popupTemplate:this.popupTemplate?.toJSON()??null}}notifyMeshTransformChanged(e={}){const{geometry:t}=this;if("mesh"===t?.type){const i={origin:t.origin,transform:t.transform};this._notifyLayer("origin-transform",i,i,e.action)}}_notifyLayer(e,t,i,r){if(this._version++,!this.layer||!("graphicChanged"in this.layer))return;const n={graphic:this,property:e,oldValue:t,newValue:i};"origin-transform"===e&&(n.action=r),"attributes"===e&&(n.attributeName=r),this.layer.graphicChanged(n)}_watchMeshGeometryChanges(){this.addHandles([(0,c.z7)(()=>"mesh"===this.geometry?.type&&this.geometry.vertexSpace.origin?{localMatrix:this.geometry.transform?.localMatrix,origin:this.geometry.vertexSpace.origin}:void 0,({localMatrix:e,origin:t})=>{this._lastMeshTransform.localMatrix===e&&this._lastMeshTransform.origin===t||(this._lastMeshTransform.localMatrix=e,this._lastMeshTransform.origin=t,this.notifyMeshTransformChanged())}),(0,c.z7)(()=>"mesh"===this.geometry?.type?{vertexAttributes:this.geometry.vertexAttributes}:void 0,()=>{const e=this.geometry;"mesh"===e?.type&&e.vertexSpace.origin?(this._lastMeshTransform.localMatrix=e.transform?.localMatrix,this._lastMeshTransform.origin=e.vertexSpace.origin):(this._lastMeshTransform.localMatrix=void 0,this._lastMeshTransform.origin=void 0),this._notifyLayer("geometry",this.geometry,this.geometry)},{equals:(e,t)=>e===t,sync:!0})])}};(0,n.Cg)([(0,h.MZ)({value:null,json:{read:function(e){if(!e)return null;const t={};for(const i in e){const r=(0,y.rS)(e[i]);r&&(t[i]=r)}return 0!==Object.keys(t).length?t:null}}})],F.prototype,"aggregateGeometries",null),(0,n.Cg)([(0,h.MZ)({value:null})],F.prototype,"attributes",null),(0,n.Cg)([(0,h.MZ)({value:null,types:g.yR,json:{read:y.rS}})],F.prototype,"geometry",null),(0,n.Cg)([(0,h.MZ)({type:Boolean})],F.prototype,"isAggregate",void 0),(0,n.Cg)([(0,h.MZ)({clonable:!1})],F.prototype,"layer",void 0),(0,n.Cg)([(0,h.MZ)({clonable:"reference"})],F.prototype,"origin",void 0),(0,n.Cg)([(0,h.MZ)({type:s.A,value:null})],F.prototype,"popupTemplate",null),(0,n.Cg)([(0,h.MZ)({clonable:"reference"})],F.prototype,"sourceLayer",void 0),(0,n.Cg)([(0,h.MZ)({value:null,types:w.Es})],F.prototype,"symbol",null),(0,n.Cg)([(0,h.MZ)({clonable:!1,json:{read:!1,write:!1}})],F.prototype,"_version",void 0),(0,n.Cg)([(0,h.MZ)({type:Boolean,value:!0})],F.prototype,"visible",null),F=r=(0,n.Cg)([(0,f.$)("esri.Graphic")],F)},54461:(e,t,i)=>{i.d(t,{A:()=>a});var r=i(87449),n=i(11221),s=i(89169);class a extends n.A{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 s.A(t._candidates.slice(),t._known.slice(),!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(1===t)return t;const i=this._idstates[e];return 0===i||1===i?i:0===t&&void 0===i?this._countedin<this._topnum?(this._idstates[e]=0,this._countedin++,0):(this._idstates[e]=1,1):2}async _expandPagedSet(e,t,i,n,s){if(null===this._parent)throw new r.d("NotImplemented");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 a=await this._parent._expandPagedSet(e,t,i,n,s);return this._setKnownLength(e)>this._topnum&&(e._known.length=this._topnum),this._setKnownLength(e)>=this._topnum&&(e._candidates.length=0),a}async _getFeatures(e,t,i,r){const n=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,r),this._getFeatures(e,t,i,r);-1!==t&&void 0===this._featureCache[t]&&n.push(t);let l=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(l++,l<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&n.push(e._known[r]),n.length>a)));r++);if(0===n.length)return"success";const o=new s.A([],n,!1,null),u=Math.min(n.length,i);await this._parent._getFeatures(o,-1,u,r);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,r,n){await this._ensureLoaded();const a=await this._getSet(n);return new s.A(a._candidates.slice().concat(a._known.slice()),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let i=0,r=null;const n=[];for(let s=0;s<e._candidates.length;s++){const a=this._isInFeatureSet(e._candidates[s]);if(0===a){if(e._known.push(e._candidates[s]),i+=1,null===r?r={start:s,end:s}:r.end===s-1?r.end=s:(n.push(r),r={start:s,end:s}),e._known.length>=this._topnum)break}else if(1===a)null===r?r={start:s,end:s}:r.end===s-1?r.end=s:(n.push(r),r={start:s,end:s}),i+=1;else if(2===a)break;if(i>=t)break}null!==r&&n.push(r);for(let t=n.length-1;t>=0;t--)e._candidates.splice(n[t].start,n[t].end-n[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(){n.A._featuresetFunctions.top=function(e){return new a({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},55674:(e,t,i)=>{i.d(t,{Ad:()=>f,Gj:()=>g,QY:()=>h,lL:()=>_,xR:()=>p});var r=i(66131),n=i(49186),s=(i(44208),i(44729)),a=i(15032),l=i(65864),o=i(95466),u=i(43668),c=i(98623);const d=["geometry","scale","timeProperties"];function h(e,t){if(null!=t)for(const i of d)t.hasArcadeDependency(i)&&e.add(i);return e}function f(e,t){return y.create(e,t,null,["$feature","$view"])}function p(e,t,i){return y.create(e,t,i,["$feature","$view","$config"])}class y{static async create(e,t,i,r){const{arcade:s,Dictionary:a}=await(0,u.l)();let l;try{l=s.parseScript(e)}catch(t){throw new n.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const o=s.scriptUsesGeometryEngine(l);o&&await s.enableGeometrySupport(),await s.loadDependentModules(new Set,l,null,!1,o);const c={vars:r.reduce((e,t)=>({...e,[t]:null}),{}),spatialReference:t,useAsync:!1},d=s.compileScript(l,c);let h=null;null!=i&&(h=new a(i),h.immutable=!0);const f=new a;return f.immutable=!1,f.setField("scale",0),new y(e,s,l,d,t,f,h,a)}constructor(e,t,i,r,n,s,a,l){this.script=e,this._arcade=t,this._syntaxTree=i,this._compiled=r,this._spatialReference=n,this._viewDict=s,this._configDict=a,this._dictionaryCtor=l,this._dependencies=new Map,this._featureReader=new g,this._dependencies.set("geometry",t.scriptTouchesGeometry(this._syntaxTree)),this._dependencies.set("scale",this._arcade.referencesMember(this._syntaxTree,"scale")),this._dependencies.set("timeProperties",this._arcade.scriptUsesViewProperties(this._syntaxTree,["timeProperties"]))}evaluate(e,t){const i=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:n,currentEnd:s}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=n?null!=i?r.lY.epochToArcadeDate(n,i):r.lY.unknownEpochToArcadeDate(n):void 0,currentEnd:null!=s?null!=i?r.lY.epochToArcadeDate(s,i):r.lY.unknownEpochToArcadeDate(s):void 0,startIncluded:!0,endIncluded:!0})}this._viewDict.setField("timeProperties",e)}return this._compiled({vars:{$view:this._viewDict,$config:this._configDict,$feature:e},spatialReference:this._spatialReference,timeZone:i})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class g{constructor(){this._boundTarget=null,this._boundSchema={fields:null,fieldsIndex:null,spatialReference:null,get geometryType(){return null},get objectIdField(){return null}},this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}bind(e,t,i){const r=t??new o.A(_(e.attributes));this._boundTarget=e,this._boundSchema.fields=r.fields,this._boundSchema.fieldsIndex=r,this._boundSchema.spatialReference=i}_getField(e){return this._boundSchema.fieldsIndex.get(e)}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this._boundSchema.fieldsIndex.has(e)}geometry(){if("fromJSON"in this._boundTarget)return this._boundTarget.geometry;const e=(0,l.rS)(this._boundTarget.geometry);if(e){if(!this._boundSchema.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");e.spatialReference=this._boundSchema.spatialReference}return e}isUnknownDateTimeField(e){return this._boundSchema.fieldsIndex.getTimeZone(e)===c.L5}field(e,t=!0){const i=this._getField(e);if(i){const t=this._boundTarget.attributes[i.name];if(null==t)return null;switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return s.n.fromReader(t);case"time-only":case"esriFieldTypeTimeOnly":return a.k.fromReader(t);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return r.lY.fromReaderAsTimeStampOffset(t);case"date":case"esriFieldTypeDate":return this.isUnknownDateTimeField(e)?r.lY.unknownEpochToArcadeDate(t):r.lY.epochToArcadeDate(t,this.contextTimeZone??c.qU);default:return t}}if(t)throw new Error(`Field ${e} does not exist`);return null}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this._boundSchema.fieldsIndex.fields.map(e=>e.name)}castToText(e=!1){return JSON.stringify(this._boundTarget)}gdbVersion(){return null}fullSchema(){return this._boundSchema}castAsJson(e=null){return{attributes:this._boundTarget.attributes,geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}}function _(e){const t=[];for(const i in e)t.push({name:i,alias:i,type:"string"==typeof e[i]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},58501:(e,t,i)=>{i.d(t,{q:()=>n});var r=i(62815);function n(e,t,i){if(!i?.features||!i.hasZ)return;const n=(0,r.N)(i.geometryType,t,e.outSpatialReference);if(null!=n)for(const e of i.features)n(e.geometry)}},60950:(e,t,i)=>{i.d(t,{E_:()=>n,ym:()=>r});const r=Symbol("popupProvider");function n(e){return function(e){return!!e&&r in e}(e)?e[r]:null}},60999:(e,t,i)=>{i.d(t,{DZ:()=>p,Ke:()=>f,Tj:()=>c,UT:()=>y,jJ:()=>u});var r=i(31635),n=i(65008),s=i(97768),a=i(74887),l=i(10107),o=i(40608);function u(e,t,i){return(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))}async function c(e,t,i){return(await(0,a.Lx)(e.map((e,r)=>t.apply(i,[e,r])))).map(e=>e.value)}function d(e){return{ok:!0,value:e}}function h(e){return{ok:!1,error:e}}async function f(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return d(await e)}catch(e){return h(e)}}async function p(e){try{return d(await e)}catch(e){return(0,a.QP)(e),h(e)}}function y(e,t){return new g(e,t)}let g=class extends n.A{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,s.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:i}=this._abortController;this.promise=e(i),this.promise.then(e=>{this._result=d(e),this._cleanup()},e=>{this._result=h(e),this._cleanup()}),this._abortHandle=(0,a.u7)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,s.xt)(this._abortHandle),this._abortController=null}};(0,r.Cg)([(0,l.MZ)()],g.prototype,"value",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"error",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"finished",null),(0,r.Cg)([(0,l.MZ)()],g.prototype,"promise",void 0),(0,r.Cg)([(0,l.MZ)()],g.prototype,"_result",void 0),g=(0,r.Cg)([(0,o.$)("esri.core.asyncUtils.ReactiveTask")],g)},62815:(e,t,i)=>{i.d(t,{N:()=>a});var r=i(83047),n=i(73941),s=i(21325);function a(e,t,i){if(null==t||null==i||i.vcsWkid||(0,s.aI)(t,i)||(0,n.xP)(t)||(0,n.xP)(i))return null;const a=(0,r.G9)(t)/(0,r.G9)(i);if(1===a)return null;switch(e){case"point":case"esriGeometryPoint":return e=>function(e,t){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"esriGeometryEnvelope":return e=>function(e,t){e&&null!=e.zmin&&null!=e.zmax&&(e.zmin*=t,e.zmax*=t)}(e,a);default:return null}}},68423:(e,t,i)=>{i.d(t,{Gr:()=>m,IO:()=>y,a:()=>w,bV:()=>_,p8:()=>g});var r=i(52106),n=i(78502),s=i(87449),a=i(11221),l=i(89169),o=i(33325),u=i(80609),c=i(97768),d=i(1262),h=i(88368),f=i(16930);class p{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class y extends p{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class g extends p{constructor(e,t,i){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=i}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:(0,u.bD)(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class _ extends p{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}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const i=this.evaluateNodeToWhereClause(e.parseTree,0,this.field.name,this.codefield instanceof h.A?(0,u.YY)(this.codefield,0):this.codefield,e.parameters);return i.includes(_.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:h.A.create(i,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,i=null,r=null,n){let s,a,l,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,i,r,n),e.qualifier,e.op);case"case-expression":{let r=" CASE ";"simple"===e.format&&(r+=this.evaluateNodeToWhereClause(e.operand,t,i,_.BADNESS,n));for(let s=0;s<e.clauses.length;s++)r+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[s].operand,t,i,_.BADNESS,n)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[s].value,t,i,_.BADNESS,n);return null!==e.else&&(r+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,i,_.BADNESS,n)),r+=" END ",r}case"parameter":{const i=n[e.value.toLowerCase()];if("string"==typeof i)return"'"+i.toString().replaceAll("'","''")+"'";if((0,o.$P)(i))return(0,u.bm)(i,t);if((0,o.Lk)(i))return(0,u.bm)(i,t);if((0,o.eg)(i))return(0,u.F1)(i,t);if((0,o.rX)(i))return(0,u.R8)(i,t);if((0,o.f0)(i))return(0,u.Nf)(i,t);if(Array.isArray(i)){const e=[];for(let r=0;r<i.length;r++)"string"==typeof i[r]?e.push("'"+i[r].toString().replaceAll("'","''")+"'"):(0,o.$P)(i[r])||(0,o.Lk)(i[r])?e.push((0,u.bm)(i[r],t)):(0,o.eg)(i[r])?e.push((0,u.F1)(i[r],t)):(0,o.rX)(i[r])?e.push((0,u.R8)(i[r],t)):(0,o.f0)(i[r])?e.push((0,u.Nf)(i[r],t)):e.push(i[r].toString());return e}return i.toString()}case"expression-list":a=[];for(const s of e.value)a.push(this.evaluateNodeToWhereClause(s,t,i,r,n));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,i,_.BADNESS,n)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" AND "+this.evaluateNodeToWhereClause(e.right,t,i,r,n)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" OR "+this.evaluateNodeToWhereClause(e.right,t,i,r,n)+") ";case"IS":if("null"!==e.right.type)throw new d.L("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new d.L("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IS NOT NULL )";case"IN":if(s=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];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}s.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+s.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,t,i,r,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+s.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,n),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" IN ("+c+")) ";case"NOT IN":if(s=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];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}s.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+s.join(",")+")) "}return s=this.evaluateNodeToWhereClause(e.right,t,i,r,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+s.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,i,r,n),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,r,n)+" NOT IN ("+c+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)," ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";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" ("+r+" "+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+" "+r+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,i,_.BADNESS,n)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,i,_.BADNESS,n)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return(0,u.C6)(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return i&&i.toLowerCase()===e.column.toLowerCase()?"("+r+")":(0,u.Kb)(e.column);case"data-type":return e.value;case"function":{const r=this.evaluateNodeToWhereClause(e.args,t,i,_.BADNESS,n);return(0,u.F6)(e.name,r,t)}}throw new d.L("UnsupportedSyntax",{node:e.type})}extractValue(e){if(this.codefield instanceof h.A){const t=this.codefield.calculateValueCompiled(e);return this.reverseLkp[h.A.convertValueToStorageFormat(t)]}return this.reverseLkp[e.attributes[this.codefield]]}}class m extends p{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:(0,u.bD)(e,this.field.name,(0,u.YY)(this._sql,0),t.getFieldsIndex())}}extractValue(e){return h.A.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class w extends a.A{static findField(e,t){for(const i of e)if(i.name.toLowerCase()===t.toString().toLowerCase())return i;return null}constructor(e){super(e),this._calcFunc=null,this.declaredClass="esri.arcade.featureset.actions.Adapted",this.adaptedFields=[],this._extraFilter=null,this._extraFilter=e.extraFilter,this._parent=e.parentfeatureset,this._maxProcessing=30,this.adaptedFields=e.adaptedFields}_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 f.A({wkid:4326}),this.objectIdField="",this.globalIdField="",this.geometryType=o.ik.point,this.typeIdField="",this.types=null,this.subtypeField=null,this.subtypes=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),(0,c.Lw)(t),this._wset=new l.A(t._candidates.slice(),t._known.slice(),t._ordered,this._clonePageDefinition(t.pagesDefinition)),this._wset}return this._wset}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}async _getFeatures(e,t,i,s){const a=[];-1!==t&&void 0===this._featureCache[t]&&a.push(t);const o=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,o))return await this._expandPagedSet(e,o,0,0,s),this._getFeatures(e,t,i,s);let u=0;for(let r=e._lastFetchedIndex;r<e._known.length&&(u++,u<=i&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[r]]&&(e._known[r]!==t&&a.push(e._known[r]),a.length>=o)));r++);if(0===a.length)return"success";e=new l.A([],a,e._ordered,null);const c=Math.min(a.length,i);await(this._parent?._getFeatures(e,-1,c,s)),this._checkCancelled(s);const d=[];for(let e=0;e<c;e++){const t=this._parent?._featureFromCache(a[e]);void 0!==t&&d.push({geometry:t.geometry,attributes:t.attributes,id:a[e]})}for(const e of d){const t=[];for(const i of this.adaptedFields)t[i.field.name]=i.extractValue(e);this._featureCache[e.id]=new r.A({attributes:t,geometry:(0,n.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new s.d("NeverReach")}async _getFilteredSet(e,t,i,r,n){let s=!1;const a=this._reformulateWithoutAdaptions(i);s=a.cannot,i=a.where;let o=!1;if(null!==r){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof y)&&!0===r.scanForField(t.field.name)){if(!(t instanceof g)){r=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}r&&e.length>0&&(r=r.replaceFields(e))}null!==i?null!==this._extraFilter&&(i=(0,u.kg)(this._extraFilter,i)):i=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,i,r,n);let d;return this._checkCancelled(n),d=!0===s?new l.A(c._candidates.slice().concat(c._known.slice()),[],!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)):new l.A(c._candidates.slice(),c._known.slice(),!0===o&&c._ordered,this._clonePageDefinition(c.pagesDefinition)),d}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const i of this.adaptedFields)if(!0===(0,u.Ju)(e,i.field.name)){const r=i.rewriteSql(e,this);if(!0!==r.rewritten){t.cannot=!0,t.where=null;break}t.where=r.where}return t}async _stat(e,t,i,r,n,s,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(n),l=l||o.cannot,null!==(n=o.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,!0===l)return null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1};const c=await this._parent._stat(e,t,i,r,n,s,a);return!1===c.calculated?null===n&&""===i&&null===r?this._manualStat(e,t,s,a):{calculated:!1}:c}async _canDoAggregates(e,t,i,r,n){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 y))return!1;const s=[];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,s.push(t)}else s.push(i)}const a=this._reformulateWithoutAdaptions(n);return!a.cannot&&(null!==(n=a.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,this._parent._canDoAggregates(e,s,i,r,n))}async _getAggregatePagesDataSourceDefinition(e,t,i,r,n,a,l){if(null===this._parent)throw new s.d("NeverReach");const o=[];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 s.d("NeverReach");const t=i.clone();t.workingexpr=e.where,o.push(t)}else o.push(i)}const c=this._reformulateWithoutAdaptions(n);if(c.cannot)throw new s.d("NeverReach");return null!==(n=c.where)?null!==this._extraFilter&&(n=(0,u.kg)(this._extraFilter,n)):n=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,i,r,n,a,l)}}},73681:(e,t,i)=>{i.d(t,{n:()=>o});var r=i(49186),n=i(53966),s=i(46140),a=i(95466),l=i(55674);class o{static async from(e,t,i){const a=e.dictionary_version?s.R.parse(e.dictionary_version):null,c=new Set(e.itemsNames),d={};if(t)for(const e in t)d[e]=t[e];if(e.authoringInfo.configuration)for(const t of e.authoringInfo.configuration)d.hasOwnProperty(t.name)||(d[t.name]=t.value);const h=new Set(e.authoringInfo.symbol);for(const e of Object.keys(i))h.delete(e);h.size&&n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:h});const f=await(0,l.xR)(e.expression,null,d);if(!f)throw new r.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const p=!a||!a.greaterEqual(4,0);p&&n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:a});const y=new u(i,p);return new o(p,c,f,y)}constructor(e,t,i,r){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=i,this._reader=r}get itemNames(){return this._itemNames}evaluate(e,t,i,r){try{return this._reader.bind(e,i,r),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){n.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:e})}return null}createDictionaryFieldsIndex(e){if(!this._requiresFieldCoercionToString)return new a.A(e);const t=e.map(e=>({...e,type:"esriFieldTypeString"}));return new a.A(t)}}class u extends l.Gj{constructor(e,t){super(),this._fieldMap=e,this._requiresFieldCoercionToString=t}_getField(e){const t=this._fieldMap[e]??e;return this._boundSchema.fieldsIndex.get(t)}field(e){if(!this._requiresFieldCoercionToString)return super.field(e,!1);const t=this._getField(e);return null==t||null==this._boundTarget.attributes[t.name]?"":""+this._boundTarget.attributes[t.name]}}},77548:(e,t,i)=>{i.d(t,{Gh:()=>y,tk:()=>d,BR:()=>c,wI:()=>u,G$:()=>f,$x:()=>h,Ov:()=>l,W_:()=>o,OP:()=>p,TU:()=>a,XX:()=>s});var r=i(70333),n=i(78888);i(7762),i(84952),i(36563),i(36708),new WeakMap;const s={Point:"SceneLayer","3DObject":"SceneLayer",IntegratedMesh:"IntegratedMeshLayer",PointCloud:"PointCloudLayer",Building:"BuildingSceneLayer"};function a(e){const t=e?.type;return"building-scene"===t||"integrated-mesh"===t||"point-cloud"===t||"scene"===t}function l(e){return"feature"===e?.type&&!e.url&&"memory"===e.source?.type}function o(e){const t=e?.type;return("feature"===t||"subtype-group"===t||"oriented-imagery"===t)&&"feature-layer"===e?.source?.type}async function u(e,t){const i=r.id?.findServerInfo(e);if(null!=i?.currentVersion)return i.owningSystemUrl||null;const s=e.toLowerCase().indexOf("/rest/services");if(-1===s)return null;const a=`${e.slice(0,s)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,n.A)(a,{query:{f:"json"},responseType:"json",signal:l});return o?.owningSystemUrl||null}function c(e){return function(e){if(!("capabilities"in e))return!1;switch(e.type){case"catalog":case"catalog-footprint":case"csv":case"feature":case"geojson":case"imagery":case"knowledge-graph-sublayer":case"ogc-feature":case"oriented-imagery":case"scene":case"sublayer":case"subtype-group":case"subtype-sublayer":case"wfs":return!0;default:return!1}}(e)?"effectiveCapabilities"in e?e.effectiveCapabilities:e.capabilities:null}function d(e){return!!function(e){if(!("editingEnabled"in e))return!1;switch(e.type){case"csv":case"feature":case"geojson":case"oriented-imagery":case"scene":case"subtype-group":case"subtype-sublayer":return!0;default:return!1}}(e)&&("effectiveEditingEnabled"in e?e.effectiveEditingEnabled:e.editingEnabled)}function h(e,t){return null}function f(e){return null}function p(e){return!e||"Feature Service"===e.type&&!e.sourceUrl}function y(e,t){if(!t||!p(e))return;const i=(e.url,null);i&&(e.url=i)}},86691:(e,t,i)=>{i.d(t,{A:()=>o});var r=i(78878),n=i(87449),s=i(11221),a=i(89169),l=i(87594);class o extends s.A{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 r=new a.A([],[],!0,null);for(let e=0;e<i.length;e++)r._known.push(i[e].id);return r}async getIdColumnDictionary(e,t,i,n){if(i<e._known.length-1){const s=this._maxQueryRate();if("GETPAGES"===e._known[i+1])return await(0,r.a0)(this._parent._expandPagedSet(e,s,0,0,n)),this.getIdColumnDictionary(e,t,i,n);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,r.a0)(this._parent._getFeatureBatch(l,n));this._checkCancelled(n);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,i,n)}return e._candidates.length>0?(await(0,r.a0)(this._refineSetBlock(e,this._maxProcessingRate(),n)),this._checkCancelled(n),this.getIdColumnDictionary(e,t,i,n)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,i,r){return this._parent._getFeatures(e,t,i,r)}_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 n.d("NeverReach")}async _getFilteredSet(e,t,i,r,n){await this._ensureLoaded();const s=await this._parent._getFilteredSet(e,t,i,null===r?this._orderbyclause:r,n);this._checkCancelled(n);const l=new a.A(s._candidates.slice(),s._known.slice(),s._ordered,this._clonePageDefinition(s.pagesDefinition));let o=!0;if(s._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,n);return!1===o&&(null===t&&null===i||(e=new a.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){s.A._featuresetFunctions.orderBy=function(e){return""===e?this:new o({parentfeatureset:this,orderbyclause:new l.A(e)})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},87594:(e,t,i)=>{function r(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}i.d(t,{A:()=>n});class n{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 n=this.featureValue(e.feature,this._fields[i],i),s=this.featureValue(t.feature,this._fields[i],i);let a=0;if(a=1===this._directions[i]?r(n,s):-1*r(n,s),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 r=this._fields[i];for(const t of e)if(r.toLowerCase()===t.field.toLowerCase()){r=t.newfield;break}t+=r,1===this._directions[i]?t+=" ASC":t+=" DESC"}return new n(t)}featureValue(e,t,i){const r=e.attributes[t];if(void 0!==r)return r;for(const r in e.attributes)if(t.toLowerCase()===r.toLowerCase())return this._fields[i]=r,e.attributes[r];return null}}},91880:(e,t,i)=>{i.d(t,{A:()=>c});var r,n=i(31635),s=i(66552),a=i(25482),l=i(10107),o=(i(44208),i(53966),i(87811),i(40608));const u=new s.J({asc:"ascending",desc:"descending"});let c=class extends a.o{static{r=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new r({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,n.Cg)([(0,l.MZ)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,n.Cg)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],c.prototype,"valueExpression",void 0),(0,n.Cg)([(0,l.MZ)({type:u.apiValues,json:{type:u.jsonValues,read:u.read,write:u.write}})],c.prototype,"order",void 0),c=r=(0,n.Cg)([(0,o.$)("esri.layers.support.OrderByInfo")],c)},98988:(e,t,i)=>{i.r(t),i.d(t,{canProjectWithoutEngine:()=>z,getTransformation:()=>q,getTransformations:()=>B,initializeProjection:()=>J,isEqualBaseGCS:()=>$,isLoaded:()=>D,isLoadedOrLoad:()=>L,isLoadedOrLoadFor:()=>P,load:()=>E,project:()=>M,projectExtent:()=>se,projectMany:()=>O,projectMultipoint:()=>X,projectOrLoad:()=>j,projectOrLoadMany:()=>G,projectPoint:()=>K,projectPolygon:()=>re,projectPolyline:()=>te,projectWithZConversion:()=>Q,projectWithoutEngine:()=>Y,requiresLoad:()=>N,test:()=>W,tryProjectWithZConversion:()=>V,unload:()=>Z});var r=i(49186),n=i(74887),s=i(62788),a=i(95488),l=i(51850),o=i(21276),u=i(73941),c=i(5443),d=i(48526),h=i(83290),f=i(86738),p=i(39829),y=i(82799),g=i(16930),_=i(9762),m=i(37539);function w(e,t,i,r,n,s){return b[0]=e,b[1]=t,b[2]=i,(0,_.projectBuffer)(b,r,0,n,s,0)}const b=(0,l.vt)();let F=0;class I{static fromGE(e){const t=new I;return t._wkt=e.wkt,t._wkid=e.wkid,t._isInverse=e.isInverse,t}constructor(e){this.uid=F++,e?(this._wkt=null!=e.wkt?e.wkt:null,this._wkid=null!=e.wkid?e.wkid:-1,this._isInverse=null!=e.isInverse&&!0===e.isInverse):(this._wkt=null,this._wkid=-1,this._isInverse=!1)}get wkt(){return this._wkt}set wkt(e){this._wkt=e,this.uid=F++}get wkid(){return this._wkid}set wkid(e){this._wkid=e,this.uid=F++}get isInverse(){return this._isInverse}set isInverse(e){this._isInverse=e,this.uid=F++}getInverse(){const e=new I;return e._wkt=this.wkt,e._wkid=this._wkid,e._isInverse=!this.isInverse,e}}class S{static cacheKey(e,t){return[e.wkid?.toString()??"-1",e.wkt?.toString()??"",e.wkt2?.toString()??"",t.wkid?.toString()??"-1",t.wkt?.toString()??"",t.wkt2?.toString()??""].join()}static fromGE(e){const t=new S;let i="";for(const r of e.steps){const e=I.fromGE(r);t.steps.push(e),i+=e.uid.toString()+","}return t._cachedProjection={},t._gtlistentry=null,t._chain=i,t}constructor(e){if(this.steps=[],this._cachedProjection={},this._chain="",this._gtlistentry=null,e?.steps)for(const t of e.steps)t instanceof I?this.steps.push(t):this.steps.push(new I({wkid:t.wkid,wkt:t.wkt,isInverse:t.isInverse}))}getInverse(){const e=new S;e.steps=[];for(let t=this.steps.length-1;t>=0;t--){const i=this.steps[t];e.steps.push(i.getInverse())}return e}getGTListEntry(){let e="";for(const t of this.steps)e+=t.uid.toString()+",";return e!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=e),this._gtlistentry}assignCachedGe(e,t,i){this._cachedProjection[S.cacheKey(e,t)]=i}getCachedGeTransformation(e,t){let i="";for(const e of this.steps)i+=e.uid.toString()+",";i!==this._chain&&(this._gtlistentry=null,this._cachedProjection={},this._chain=i);const r=this._cachedProjection[S.cacheKey(e,t)];return void 0===r?null:r}}var v=i(21325),A=i(62815);let T=null,C=null,x=null,R={};const k=new a.I;function D(){return!!T&&(0,h.i)()}function L(){return!!D()||((0,s.gc)(k),E(),!1)}function P(e,t){return!e||!t||z(e,t)||L()}function N(e,t){return!z(e,t)&&!D()}function E(e){return null==x&&(x=Promise.all([(0,h.l)(),i.e(9930).then(i.bind(i,49930)).then(e=>e.g),i.e(2731).then(i.bind(i,12731))])),x.then(([,t,{hydratedAdapter:i}])=>{(0,n.Te)(e),C=i,T=t.default,T._enableProjection(h.p),k.notify()})}function M(e,t,i=null,r=null){return Array.isArray(e)?0===e.length?[]:((0,o.H)(e),O(C,e,e[0].spatialReference,t,i,r)):((0,o.f)(e),O(C,[e],e.spatialReference,t,i,r)[0])}function O(e,t,i,r,n=null,s=null){if(null==i||null==r)return t;if(z(i,r,n))return t.map(e=>Y(e,i,r));if(null==n&&(0,u.jA)(i))return t.map(e=>Y(e,i,g.A.WGS84)).map(e=>V(e,r));if(null==n&&(0,u.jA)(r))return t.map(e=>V(e,g.A.WGS84)).map(e=>Y(e,g.A.WGS84,r));if(null==n){const e=S.cacheKey(i,r);void 0!==R[e]?n=R[e]:(null==(n=q(i,r,void 0))&&(n=new S),R[e]=n)}if(null==T||null==e)throw new U;return null!=s?T._project(e,t,i,r,n,s):T._project(e,t,i,r,n)}function j(e,t){const i=G([e],t);return null!=i.pending?{pending:i.pending,geometry:null}:null!=i.geometries?{pending:null,geometry:i.geometries[0]}:{pending:null,geometry:null}}function G(e,t){if(!D())for(const i of e)if(null!=i&&!(0,v.aI)(i.spatialReference,t)&&(0,v.fn)(i.spatialReference)&&(0,v.fn)(t)&&!z(i.spatialReference,t))return(0,s.gc)(k),{pending:E(),geometries:null};return{pending:null,geometries:e.map(e=>null==e?null:(0,v.aI)(e.spatialReference,t)?e:(0,v.fn)(e.spatialReference)&&(0,v.fn)(t)?V(e,t):null)}}function q(e,t,i=null){if(null==e||null==t)return null;if(null==T||null==C)throw new U;const r=T._getTransformation(C,e,t,i,i?.spatialReference);return null!==r?S.fromGE(r):null}function B(e,t,i=null){if(null==T||null==C)throw new U;const r=T._getTransformationBySuitability(C,e,t,i,i?.spatialReference);if(null!==r){const e=[];for(const t of r)e.push(S.fromGE(t));return e}return[]}class U extends r.A{constructor(){super("projection:not-loaded","projection engine not fully loaded yet, please call load()")}}function Z(){T=null,C=null,x=null,R={}}const W={get loadPromise(){return x}};function V(e,t){try{const i=M(e,t);if(null==i)return null;"xmin"in e&&"xmin"in i&&(i.zmin=e.zmin,i.zmax=e.zmax);const r=(0,A.N)(i.type,e.spatialReference,t);return null!=r&&r(i),i}catch(e){if(!(e instanceof U))throw e;return null}}async function Q(e,t,i){const r=e.spatialReference;return null!=r&&null!=t&&await J(r,t,null,i),V(e,t)}function z(e,t,i){return!i&&(!!(0,v.aI)(e,t)||(0,v.fn)(e)&&(0,v.fn)(t)&&!!(0,m.jd)(e,t))}function $(e,t){if((0,v.aI)(e,t))return!0;if(!(0,v.fn)(e)||!(0,v.fn)(t))return!1;const i=(0,v.oT)(e)||(0,v.K8)(e)||(0,v.x1)(e),r=(0,v.oT)(t)||(0,v.K8)(t)||(0,v.x1)(t);return i&&r}async function J(e,t,i,r){if(D())return(0,n.NO)(r);if(Array.isArray(e)){for(const{source:t,dest:i,geographicTransformation:n}of e)if(t&&i&&!z(t,i,n))return E(r)}else if(e&&t&&!z(e,t,i))return E(r);return(0,n.NO)(r)}function Y(e,t,i){return e?"x"in e?H(e,t,new f.A,i,0):"xmin"in e?ae(e,t,new c.A,i,0):"rings"in e?ne(e,t,new p.A,i,0):"paths"in e?ie(e,t,new y.A,i,0):"points"in e?ee(e,t,new d.A,i,0):null:null}function K(e,t,i=t.spatialReference,r=0){return null!=i&&null!=e.spatialReference&&null!=H(e,e.spatialReference,t,i,r)}function H(e,t,i,r,n){oe[0]=e.x,oe[1]=e.y;const s=e.z;return oe[2]=void 0!==s?s:n,(0,_.projectBuffer)(oe,t,0,oe,r,0)?(i.x=oe[0],i.y=oe[1],i.spatialReference=r,void 0!==s||(0,u.xP)(r)?(i.z=oe[2],i.hasZ=!0):(i.z=void 0,i.hasZ=!1),void 0===e.m?(i.m=void 0,i.hasM=!1):(i.m=e.m,i.hasM=!0),i):null}function X(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ee(e,e.spatialReference,t,i,r)}function ee(e,t,i,r,n){const{points:s,hasZ:a,hasM:l}=e,o=[],c=s.length,d=[];for(const e of s)d.push(e[0],e[1],a?e[2]:n);if(!(0,_.projectBuffer)(d,t,0,d,r,0,c))return null;const h=a||(0,u.xP)(r);for(let e=0;e<c;++e){const t=3*e,i=d[t],r=d[t+1];h&&l?o.push([i,r,d[t+2],s[e][3]]):h?o.push([i,r,d[t+2]]):l?o.push([i,r,s[e][2]]):o.push([i,r])}return i.points=o,i.spatialReference=r,i.hasZ=a,i.hasM=l,i}function te(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ie(e,e.spatialReference,t,i,r)}function ie(e,t,i,r,n){const{paths:s,hasZ:a,hasM:l}=e,o=[];if(!le(s,a??!1,l??!1,t,o,r,n))return null;const c=a||(0,u.xP)(r);return i.paths=o,i.spatialReference=r,i.hasZ=c,i.hasM=l,i}function re(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ne(e,e.spatialReference,t,i,r)}function ne(e,t,i,r,n){const{rings:s,hasZ:a,hasM:l}=e,o=[];if(!le(s,a??!1,l??!1,t,o,r,n))return null;const c=a||(0,u.xP)(r);return i.rings=o,i.spatialReference=r,i.hasZ=c,i.hasM=l,i}function se(e,t,i=t.spatialReference,r=0){return null!=e.spatialReference&&null!=i&&null!=ae(e,e.spatialReference,t,i,r)}function ae(e,t,i,r,n){const{xmin:s,ymin:a,xmax:l,ymax:o,hasZ:c,hasM:d}=e;if(!w(s,a,c?e.zmin:n,t,oe,r))return null;const h=c||(0,u.xP)(r);return i.xmin=oe[0],i.ymin=oe[1],h&&(i.zmin=oe[2]),w(l,o,c?e.zmax:n,t,oe,r)?(i.xmax=oe[0],i.ymax=oe[1],h&&(i.zmax=oe[2]),d&&(i.mmin=e.mmin,i.mmax=e.mmax),i.spatialReference=r,i):null}function le(e,t,i,r,n,s,a=0){const l=new Array;for(const i of e)for(const e of i)l.push(e[0],e[1],t?e[2]:a);if(!(0,_.projectBuffer)(l,r,0,l,s,0))return!1;let o=0;n.length=0;const c=t||(0,u.xP)(s);for(const t of e){const e=new Array;for(const r of t)c&&i?e.push([l[o++],l[o++],l[o++],r[3]]):c?e.push([l[o++],l[o++],l[o++]]):i?(e.push([l[o++],l[o++],r[2]]),o++):(e.push([l[o++],l[o++]]),o++);n.push(e)}return!0}const oe=(0,l.vt)()}}]);