@arcgis/core 4.34.0-next.1 → 4.34.0-next.3

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 (391) hide show
  1. package/Map.js +1 -1
  2. package/WebScene.js +1 -1
  3. package/analysis/DimensionAnalysis.js +1 -1
  4. package/analysis/LineOfSightAnalysis.js +1 -1
  5. package/analysis/ViewshedAnalysis.js +1 -1
  6. package/arcade/Voxel.js +1 -1
  7. package/arcade/functions/knowledgegraph.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/{253bcc3cc7bc4c2dc6ea.js → 03db109e9b695528c35d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{fc61d02286b6ff5447cc.js → 09da6b3085fc84cd69d5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{bf3555f91492a1a3b613.js → 09f76ca9b47b465c934f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{42d9989b2aad3ac28d4d.js → 0d78fc2c2bc1152f84db.js} +1 -1
  13. package/assets/esri/core/workers/chunks/0fd826e7f64a37aaaa1e.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ead5d4e271effc04def3.js → 1415d4e2f5f3193be004.js} +1 -1
  15. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +1 -0
  16. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +1 -0
  17. package/assets/esri/core/workers/chunks/{1c86aa3802d9ae0230ae.js → 28e31ac00dc95a1318e9.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{ece68a25651ef03fc95d.js → 342f61e784c9364a493b.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{0d23610475c85385fbff.js → 355e6bcdb401ada71f39.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{bba6d7615d8f3862fe70.js → 36f0046ff6b46adce7b7.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3adcf78ed1e7cd82666d.js +1 -0
  22. package/assets/esri/core/workers/chunks/{b0522dffa5600345c07e.js → 3e85e63148b5e93d3074.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{d2ebb72a43d995ed368a.js → 42bb9bb6fe44a47d9b81.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{6ee41e9c92ed8ba4c763.js → 4dd0a5f327fa5fc7249d.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{36b0d6b4089a96475201.js → 51ba7345c31e6eb79060.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{66e79aa02b3aa12b3778.js → 5200be8bce60fa831026.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{6b23ca6570357f9fb724.js → 52a57106a41b8c9483d7.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fa63b0f7fa799cb2f81d.js → 562800b0af52a38a311b.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{585c7b485c42555ec554.js → 61f9747c960d959b571b.js} +2 -2
  30. package/assets/esri/core/workers/chunks/{9fc35ec8185beba96715.js → 632d1a1287dde980479e.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{1d043965dcdc11b3aeaa.js → 63852887b3f07d50f7c9.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{32ee2708edd307954125.js → 7174150bf7595c22f976.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{e77371ddbaf4b2d9be8d.js → 74c0db9e3a62e9839b23.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{6ecc3a3737ae8622dfa4.js → 7b12607633bbdc318936.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{06eb4832b6c86744e52e.js → 8008f5479f4d16964088.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{d839a237d5edc243d645.js → 8aa8f9986b966ccb64e2.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{67338948e470c1251d8a.js → 8d14e957219364a81d5f.js} +3 -3
  38. package/assets/esri/core/workers/chunks/92a5dccb328229a9336b.js +1 -0
  39. package/assets/esri/core/workers/chunks/{631205dc4d73d49ec9ed.js → 95507ff0a243e451b99e.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{1051a5a57b2fb843a555.js → 9cd55043f3d789f41815.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{40f54c4f8ae63c6f3df9.js → a32dcd5bc4680374d30c.js} +1 -1
  42. package/assets/esri/core/workers/chunks/ad4f65d764654c70a117.js +1 -0
  43. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +1 -0
  44. package/assets/esri/core/workers/chunks/{ac2607f1e8cd2e99907c.js → b70f65ccee01d48a610e.js} +2 -2
  45. package/assets/esri/core/workers/chunks/{571252c9822d73cf7b01.js → b845586219f284a215b2.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{d7b640f7a181bd26c7c7.js → bac5e1d50b69f0d94694.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{9ca480eb8b2312381ccf.js → bcadcb709e622f2aaaf9.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{c16e0da7a19310c71e8b.js → c6cd8784a3e222eb2d4a.js} +1 -1
  49. package/assets/esri/core/workers/chunks/{97c148adf0347c69a79c.js → c9604f8df909ec4fad46.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{b87fec1753f164c845c5.js → ca76950d81ab4ebb65e1.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{faa40ef04604c7cce706.js → cb63ea6a53d3c2fc3179.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{54f4a1131f99468db076.js → d33a5d79f2163ad62b1d.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{55f087bca75c3f2a4515.js → d3c0d7799c92c6f0e7d3.js} +1 -1
  54. package/assets/esri/core/workers/chunks/{ca60b34c3e1ed2ff5934.js → dd2b316baae02bbdddac.js} +1 -1
  55. package/assets/esri/core/workers/chunks/{e3c1aea34ece8336dae1.js → e9aa1d9ded8a52a40c57.js} +1 -1
  56. package/assets/esri/core/workers/chunks/{80b596496800e8d60eb8.js → ed75e0962358523f4439.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{0cf979a093e9744d1e80.js → ef7955a2509be0f03ca2.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{b5d68d8460b7c15001dd.js → f1c6df5cf2ccb6ac47a1.js} +1 -1
  59. package/assets/esri/core/workers/chunks/f2aa8090827086c62dde.js +1 -0
  60. package/assets/esri/core/workers/chunks/{523046e04679e301797d.js → f3d97a4c4f433adbdab5.js} +1 -1
  61. package/assets/esri/core/workers/chunks/fd4c020297badcb81947.js +1 -0
  62. package/assets/esri/core/workers/chunks/{9a06476b834584d00d5c.js → feaf79b69d2e2a1f2aa2.js} +1 -1
  63. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  64. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  65. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  66. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  67. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  68. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  69. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  70. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  71. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  72. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  73. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  74. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  75. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  76. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  77. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  78. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  79. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  104. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
  105. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  106. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  107. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  108. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  109. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  110. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  111. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  112. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  113. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
  114. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  115. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  116. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  117. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  118. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  119. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  120. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  121. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  122. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  123. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  124. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  125. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  126. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  127. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  128. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  129. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  130. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  131. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  132. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  133. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  134. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  135. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  136. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  137. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  138. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  139. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  140. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  141. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  142. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  143. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  144. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  145. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  146. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  147. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  148. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  149. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  150. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  151. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  152. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  153. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  154. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  155. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  156. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  157. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  158. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  159. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  160. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  161. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  162. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  163. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  164. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  165. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  166. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  167. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  168. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  169. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  170. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  171. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  172. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  173. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  174. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  175. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  176. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  177. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  178. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  179. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  180. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  181. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  182. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  183. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  184. package/chunks/FocusAreaColor.glsl.js +10 -8
  185. package/chunks/Laserlines.glsl.js +2 -2
  186. package/chunks/cameraUtilsSpherical.js +1 -1
  187. package/chunks/persistableUrlUtils.js +1 -1
  188. package/chunks/sphere.js +1 -1
  189. package/chunks/vec42.js +1 -1
  190. package/config.js +1 -1
  191. package/core/accessorSupport/decorators/persistable.js +1 -1
  192. package/core/accessorSupport/ensureType.js +1 -1
  193. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  194. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  195. package/effects/FocusArea.js +5 -0
  196. package/effects/FocusAreaOutline.js +5 -0
  197. package/effects/FocusAreas.js +5 -0
  198. package/geometry/projection/projectPointToVector.js +1 -1
  199. package/geometry/projection/projectVectorToPoint.js +1 -1
  200. package/geometry/projection/projectVectorToVector.js +1 -1
  201. package/geometry/projection.js +1 -1
  202. package/geometry/projectionUtils.js +5 -0
  203. package/geometry/support/frustum.js +1 -1
  204. package/geometry/support/meshUtils/elevation.js +1 -1
  205. package/geometry/support/meshUtils/extent.js +1 -1
  206. package/geometry/support/sphere.js +1 -1
  207. package/interfaces.d.ts +171 -68
  208. package/kernel.js +1 -1
  209. package/layers/MapNotesLayer.js +1 -1
  210. package/layers/RouteLayer.js +1 -1
  211. package/layers/VideoLayer.js +1 -1
  212. package/layers/graphics/applyEditsUtils.js +1 -1
  213. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  214. package/layers/graphics/data/QueryEngine.js +1 -1
  215. package/layers/graphics/data/projectionSupport.js +1 -1
  216. package/layers/graphics/data/queryUtils.js +1 -1
  217. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  218. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  219. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  220. package/layers/ogc/wfsUtils.js +1 -1
  221. package/layers/orientedImagery/core/coverageUtils.js +1 -1
  222. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  223. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  224. package/layers/orientedImagery/transformations/utils.js +1 -1
  225. package/layers/support/ControlPointsGeoreference.js +1 -1
  226. package/layers/support/CornersGeoreference.js +1 -1
  227. package/layers/support/ElevationQuery.js +1 -1
  228. package/layers/support/ExtentAndRotationGeoreference.js +1 -1
  229. package/layers/support/GeoreferenceBase.js +1 -1
  230. package/layers/support/LocalMediaElementSource.js +1 -1
  231. package/layers/support/MediaElementView.js +1 -1
  232. package/layers/support/PolygonCollection.js +1 -1
  233. package/layers/support/SceneModification.js +1 -1
  234. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  235. package/layers/video/VideoController.js +1 -1
  236. package/networks/support/UNTraceConfiguration.js +1 -1
  237. package/networks/support/typeUtils.js +1 -1
  238. package/package.json +1 -1
  239. package/portal/schemas/definitions.js +1 -1
  240. package/portal/schemas/webScene.js +1 -1
  241. package/portal/support/portalItemUtils.js +1 -1
  242. package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
  243. package/rest/knowledgeGraph/GraphAddFieldIndexResult.js +5 -0
  244. package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +1 -1
  245. package/rest/knowledgeGraph/GraphAddPropertyResult.js +1 -1
  246. package/rest/knowledgeGraph/GraphDataModelOperationResult.js +5 -0
  247. package/rest/knowledgeGraph/GraphDeleteFieldIndexResult.js +5 -0
  248. package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +1 -1
  249. package/rest/knowledgeGraph/GraphDeletePropertyResult.js +1 -1
  250. package/rest/knowledgeGraph/GraphUpdateNamedTypesResult.js +1 -1
  251. package/rest/knowledgeGraph/GraphUpdatePropertyResult.js +1 -1
  252. package/rest/knowledgeGraph/GraphUpdateSearchIndexResult.js +1 -1
  253. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  254. package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +1 -1
  255. package/rest/knowledgeGraphService.js +1 -1
  256. package/rest/networks/support/CircuitPath.js +5 -0
  257. package/rest/networks/support/CircuitPathConnectivityElement.js +5 -0
  258. package/rest/networks/support/TraceLocation.js +1 -1
  259. package/rest/networks/support/TraceResult.js +1 -1
  260. package/smartMapping/renderers/pieChart.js +1 -1
  261. package/smartMapping/renderers/predominance.js +1 -1
  262. package/smartMapping/renderers/size.js +1 -1
  263. package/smartMapping/renderers/support/rendererUtils.js +1 -1
  264. package/smartMapping/renderers/support/spikeUtils.d.ts +4 -0
  265. package/smartMapping/renderers/support/spikeUtils.js +1 -1
  266. package/smartMapping/statistics/histogram.js +1 -1
  267. package/smartMapping/statistics/summaryStatistics.js +1 -1
  268. package/support/persistableUrlUtils.js +1 -1
  269. package/support/revision.js +1 -1
  270. package/views/2d/ViewStateManager.js +1 -1
  271. package/views/2d/constraints/GeometryConstraint.js +1 -1
  272. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  273. package/views/2d/grid/GridView2D.js +1 -1
  274. package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
  275. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  276. package/views/2d/layers/KMLLayerView2D.js +1 -1
  277. package/views/2d/layers/VideoLayerView2D.js +1 -1
  278. package/views/2d/viewpointUtils.js +1 -1
  279. package/views/3d/FocusAreasView.js +1 -1
  280. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
  281. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  282. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  283. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  284. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  285. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  286. package/views/3d/analysis/support/projectionUtils.js +1 -1
  287. package/views/3d/camera/constraintUtils/distance.js +1 -1
  288. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  289. package/views/3d/environment/EnvironmentManager.js +1 -1
  290. package/views/3d/interactive/Manipulator3D.js +1 -1
  291. package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
  292. package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
  293. package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
  294. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  295. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  296. package/views/3d/interactive/visualElements/support/Segment.js +1 -1
  297. package/views/3d/layers/FeatureLayerView3D.js +1 -1
  298. package/views/3d/layers/FlowSubView3D.js +1 -1
  299. package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
  300. package/views/3d/layers/SceneLayerWorker.js +1 -1
  301. package/views/3d/layers/TileLayerView3D.js +1 -1
  302. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  303. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  304. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  305. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  306. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  307. package/views/3d/layers/graphics/focusAreaStyle.js +1 -1
  308. package/views/3d/layers/graphics/graphicUtils.js +1 -1
  309. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  310. package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
  311. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  312. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  313. package/views/3d/state/NearFarHeuristic.js +1 -1
  314. package/views/3d/state/ViewStateManager.js +1 -1
  315. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  316. package/views/3d/state/utils/navigationUtils.js +1 -1
  317. package/views/3d/support/cameraUtils.js +1 -1
  318. package/views/3d/support/geometryUtils/sphere.js +1 -1
  319. package/views/3d/support/sunUtils.js +1 -1
  320. package/views/3d/support/viewpointUtils.js +1 -1
  321. package/views/3d/terrain/ExtentHelper.js +1 -1
  322. package/views/3d/terrain/OverlayManager.js +1 -1
  323. package/views/3d/terrain/OverlayRenderer.js +1 -1
  324. package/views/3d/webgl/RenderCamera.js +1 -1
  325. package/views/3d/webgl/RenderNode.js +1 -1
  326. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  327. package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
  328. package/views/3d/webgl-engine/effects/focusArea/FocusAreaEffect.js +5 -0
  329. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  330. package/views/3d/webgl-engine/effects/focusArea/FocusAreaOutlineItem.js +5 -0
  331. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  332. package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechniqueConfiguration.js +1 -1
  333. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  334. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  335. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  336. package/views/3d/webgl-engine/shaders/CompositingTechniqueConfiguration.js +1 -1
  337. package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
  338. package/views/SceneView.js +1 -1
  339. package/views/VideoView.js +1 -1
  340. package/views/View2D.js +1 -1
  341. package/views/interactive/GraphicManipulator.js +1 -1
  342. package/views/interactive/dragEventPipeline.js +1 -1
  343. package/views/interactive/snapping/GridSnappingEngine.js +1 -1
  344. package/views/interactive/snapping/SnappingManager.js +1 -1
  345. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  346. package/views/layers/SceneLayerView.js +1 -1
  347. package/views/support/projectionUtils.js +1 -1
  348. package/views/webgl/RenderingContext.js +1 -1
  349. package/views/webgl/Texture.js +1 -1
  350. package/webscene/Slide.js +1 -1
  351. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  352. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  353. package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
  354. package/widgets/CoordinateConversion/support/Format.js +1 -1
  355. package/widgets/Daylight/DaylightViewModel.js +1 -1
  356. package/widgets/Editor/EditorViewModel.js +1 -1
  357. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  358. package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
  359. package/widgets/Editor/UpdateWorkflow.js +1 -1
  360. package/widgets/Editor/Upload.js +1 -1
  361. package/widgets/Editor/components/Notices.js +1 -1
  362. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  363. package/widgets/Editor/workflowUtils.js +1 -1
  364. package/widgets/Editor.js +1 -1
  365. package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
  366. package/widgets/FeatureTable/FieldColumn.js +1 -1
  367. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  368. package/widgets/Features/FeaturesViewModel.js +1 -1
  369. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  370. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  371. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  372. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  373. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  374. package/widgets/Sketch/SketchViewModel.js +1 -1
  375. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  376. package/widgets/support/AnchorElementViewModel.js +1 -1
  377. package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
  378. package/widgets/support/tests.js +1 -1
  379. package/assets/esri/core/workers/chunks/094e8aae6dada24c8115.js +0 -1
  380. package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +0 -1
  381. package/assets/esri/core/workers/chunks/2b1486a466760d2152f5.js +0 -1
  382. package/assets/esri/core/workers/chunks/3a743653b786b010a57f.js +0 -1
  383. package/assets/esri/core/workers/chunks/62b2d3720693c93a60f2.js +0 -1
  384. package/assets/esri/core/workers/chunks/6d1e1a4fcb90ea8b6848.js +0 -1
  385. package/assets/esri/core/workers/chunks/87fc7b6c3e2d4f7775e2.js +0 -1
  386. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +0 -1
  387. package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +0 -1
  388. package/views/FocusArea.js +0 -5
  389. package/views/FocusAreaOutline.js +0 -5
  390. package/views/FocusAreaOutlineItem.js +0 -5
  391. package/views/FocusAreas.js +0 -5
@@ -1 +1 @@
1
- "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[788,2470,3186,3515,4342,4697],{10407:(e,t,r)=>{r.d(t,{It:()=>p,LG:()=>a,OM:()=>u,Sm:()=>c,Y:()=>l,bK:()=>o,mm:()=>h,sQ:()=>d});var i=r(80586),s=r(16930),n=r(28735);function a(e,t){if(!l(e,t)){const r=e.typeKeywords;r?r.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 r=e.typeKeywords;if(r){const e=r.indexOf(t);e>-1&&r.splice(e,1)}}function c(e,t,r){r?a(e,t):u(e,t)}async function d(e){const t=e.clone().normalize();let r;if(t.length>1)for(const e of t)r?e.width>r.width&&(r=e):r=e;else r=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.ci)(e);const r=s.A.WGS84;return await(0,i.initializeProjection)(t,r),(0,i.project)(e,r)}(r)}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 p(e){const{portal:t,isOrgItem:r,itemControl:i}=e,s=t.user?.privileges;let n=!s||s.includes("features:user:edit"),a=!!r&&!!s?.includes("features:user:fullEdit");const l="update"===i||"admin"===i;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},17311:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(90237),s=r(69622),n=r(60999),a=r(5503),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608)),u=r(30524),c=r(43668);let d=class extends s.A{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){return this.expressionsUsedInTitle.length>0?this._get("_arcadeTask")||(0,n.UT)((()=>(0,c.l)())):null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??r.e(9926).then(r.bind(r,29926)).then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new a.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 r=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(r.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:r,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(r,{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 r=this._arcadeTask.value.arcade.extractFieldLiterals(t.syntax);for(const t of r){const r=t.split("."),i=this.fieldsIndex.get(r.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const r of t){const t=this.fieldsIndex.get(r);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,r){try{const{attributes:i}=t,s=r?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:n}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(r.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const r=this._createFormattedAttributes(e,t,s).global;return n({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:r,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const r=t.getObjectId();if(null==r)return t;if(!(0,u.Kl)(this.requiredFields,t)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[r];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const r of e){if(!r.fieldName)continue;const e=this.fieldsIndex.get(r.fieldName),i=e?.name??r.fieldName;r.fieldName=i,t.set(i.toLowerCase(),r)}return t}_createFormattedAttributes(e,t,r="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],s={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const r=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{s[`expression/${e.name}`]=e.func({vars:{$feature:r}})}catch{}}const n={...t.attributes,...s};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:n,graphic:t,timeZone:r,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return(0,u.nw)(e).filter((e=>!(0===e.indexOf("relationships/")||0===e.indexOf("expression/"))))}};(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"_arcadeTask",null),(0,i._)([(0,l.MZ)()],d.prototype,"_featureUtils",void 0),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"featureUtilsPromise",null),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"calculatedExpressions",null),(0,i._)([(0,l.MZ)()],d.prototype,"displayField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"effectivePopupTemplate",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"expressionsUsedInTitle",null),(0,i._)([(0,l.MZ)()],d.prototype,"fieldsIndex",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"fieldInfoMap",null),(0,i._)([(0,l.MZ)()],d.prototype,"fields",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"objectIdField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"requiredFields",null),d=(0,i._)([(0,o.$)("esri.layers.support.TitleCreator")],d)},22671:(e,t,r)=>{r.d(t,{A:()=>m});var i,s=r(90237),n=r(52106),a=r(66552),l=r(25482),o=r(4718),u=r(10107),c=(r(44208),r(53966),r(36005)),d=r(40608),h=r(43937),p=r(16930),f=r(65864),y=r(50498),_=r(20437);const g=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=i=class extends l.A{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,n.A)}writeGeometryType(e,t,r,i){if(e)return void g.write(e,t,r,i);const{features:s}=this;if(s)for(const e of s)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,i=(0,f.rS)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=p.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(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 r=0;r<t.features.length;r++){const i=t.features[r];if(i.geometry){const t=e?.[r];i.geometry=t?.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,r],translate:[i,s]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((s-e)/r)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[i,s],scale:[n,a]}=r;let l=null,o=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;l=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;o=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*n+i),(e=>s-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const i=p.A.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const n=e[t],a=r.fromJSON(n),l=n.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=i);const o=n.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],r=o[e],s=r?.spatialReference;null==t||s||(t.spatialReference=i)}s.push(a)}return s}_quantizePoints(e,t,r){let i,s;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=r(l[1]);e===i&&a===s||(n.push([e-i,a-s]),i=e,s=a)}else i=t(l[0]),s=r(l[1]),n.push([i,s])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,f.Bi)(e)?e.rings:e.paths,s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],a=this._quantizePoints(n,t,r);a&&s.push(a)}return s.length>0?((0,f.Bi)(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,s){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,f.Bi)(e)?e.rings:e.paths;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];for(let e=0,s=i.length;e<s;e++){const s=i[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=r(l)}}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2]),r[3]=s(r[3])}}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];e>0?(a+=i[0],l+=i[1]):(a=i[0],l=i[1]),i[0]=t(a),i[1]=r(l)}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2]),t[3]=s(t[3])}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}}:null}};(0,s._)([(0,u.MZ)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,s._)([(0,u.MZ)({type:[n.A],json:{write:!0}})],m.prototype,"features",void 0),(0,s._)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,s._)([(0,u.MZ)({type:[_.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,s._)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,s._)([(0,h.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,s._)([(0,u.MZ)({types:y.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,s._)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,s._)([(0,u.MZ)({type:p.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,s._)([(0,h.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,s._)([(0,u.MZ)({json:{write:!0}})],m.prototype,"transform",void 0),m=i=(0,s._)([(0,d.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0},30235:(e,t,r)=>{r.d(t,{A:()=>f});var i=r(52106),s=r(87449),n=r(11221),a=r(89169),l=r(33325),o=r(80609),u=r(39516),c=r(91075),d=r(13600),h=r(33143),p=r(20437);class f extends n.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 r of this.fields)if("oid"===r.type||this._layer.objectIdField===r.name)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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=l.zl.Standardised,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 l.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_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 r of this.fields)t[r.name]=e.attributes[r.name];return new i.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){let n="",c=!1;if(null!==i&&(n=i.constructClause(),c=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.A([],[],!0,null);const d=this._createQuery();d.where=(0,u.mA)(d.where,null===r?null===t?"1=1":"":(0,o.YY)(r,l.zl.Standardised)),d.spatialRelationship=this._makeRelationshipEnum(e),d.outSpatialReference=this.spatialReference,d.orderByFields=""!==n?n.split(","):null,d.geometry=null===t?null:t,d.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(d);if(null===h)return new a.A([],[],c,null);this._checkCancelled(s);const p=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];p.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.A([],p,c,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 r=t.attributes[this._layer.objectIdField];e.push(r),this._featureCache[r]=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),r=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];r.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.A([],r,!1,null),this._wset}async _getFeatures(e,t,r){const i=[];-1!==t&&void 0===this._featureCache[t]&&i.push(t);for(let s=e._lastFetchedIndex;s<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&i.push(e._known[s]),i.length>r)));s++);if(0===i.length)return"success";throw new s.dr(s.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 r in e)t[r]=e[r];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 r=e.layerDefinition.objectIdField;const i=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)s.push(h.A.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!r){let t=!1;for(const i of e.layerDefinition.fields)if("oid"===i.type||"esriFieldTypeOID"===i.type){r=i.name,t=!0;break}if(!1===t){let t="FID",i=!0,s=0;for(;i;){let r=!0;for(const i of e.layerDefinition.fields)if(i.name===t){r=!1;break}!0===r?i=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let r=0;r<a.length;r++)n.push({geometry:e.featureSet.features[r].geometry,attributes:e.featureSet.features[r].attributes?this._cloneAttr(e.featureSet.features[r].attributes):{}}),n[r].attributes[t]=r;a=n,r=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof p.A?o.push(t):o.push(p.A.fromJSON(t));let u=n;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:s,typeIdField:i,objectIdField:r,spatialReference:t},_="esriGeometryNull"===u||null===u;_||(y.geometryType=u);const g=new d.default(y);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new f({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();t.where=this.objectIdField+"="+e.toString();const r=await this._layer.queryFeatures(t);return 1===r.features.length?r.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,r)=>{r.d(t,{BI:()=>_,D3:()=>f,XJ:()=>y,lc:()=>p,mX:()=>m,rU:()=>g,tH:()=>S});var i=r(799);const s="__begin__",n="__end__",a=new RegExp(s,"ig"),l=new RegExp(n,"ig"),o=new RegExp("^"+s,"i"),u=new RegExp(n+"$","i"),c='"',d=c+" + ",h=" + "+c;function p(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function f(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=p(e.labelExpression),t.type="conventional"),t}function _(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 g(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,i.HC)(e,(e=>s+'$feature["'+e+'"]'+n)),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,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,b=/^\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=F.exec(e)||b.exec(e);return t?t[1]||t[3]:(t=I.exec(e),t?t[2]:null)}},32756:(e,t,r)=>{r.d(t,{Rr:()=>o,fY:()=>c,ne:()=>u});var i=r(90237),s=r(93637),n=r(10107),a=(r(44208),r(53966),r(87811),r(40608)),l=r(91880);function o(e,t,r){if(!e)return null;const i=e.find((e=>!!e.field));if(!i)return null;const s=new l.A;return s.read(i,r),[s]}const u={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:o},write:{writer:function(e,t,r,i){const n=e.find((e=>!!e.field));n&&(0,s.sM)(r,[n.toJSON()],t)}}}},c=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,i._)([(0,n.MZ)(u)],t.prototype,"orderBy",void 0),t=(0,i._)([(0,a.$)("esri.layers.mixins.OrderedLayer")],t),t}},33143:(e,t,r)=>{r.d(t,{A:()=>h});var i=r(90237),s=r(69540),n=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),u=r(43937),c=r(80451),d=r(29005);let h=class extends(s.A.ClonableMixin(n.A)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,c.rS)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"id",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"name",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"domains",void 0),(0,i._)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,i._)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,i._)([(0,a.MZ)({type:[d.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,i._)([(0,o.$)("esri.layers.support.FeatureType")],h)},35704:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(87449),s=r(11221),n=r(89169),a=r(33325),l=r(80609),o=r(74887),u=r(88368),c=r(16930);class d extends s.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 n.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.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 t===a.J6.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.J6.Unknown:t)}_getFeature(e,t,r){return this._parent._getFeature(e,t,r)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_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,r){const i=new n.A([],e,!1,null),s=Math.min(t,e.length);if(await(this._parent?._getFeatures(i,-1,s,r)),this._checkCancelled(r),null==this._whereClauseFunction){for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(r)?this._idstates[e[t]]=a.J6.InFeatureSet:this._idstates[e[t]]=a.J6.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(r))}for(let r=0;r<t;r++)!0===l[r]?this._idstates[e[r]]=a.J6.InFeatureSet:this._idstates[e[r]]=a.J6.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,r,i,s){null!==this._whereClauseFunction||(null!==r?null!==this._whereclause&&(r=(0,l.kg)(this._whereclause,r)):r=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,r,i,s);let o;return this._checkCancelled(s),o=null!==this._whereClauseFunction?new n.A(a._candidates.slice().concat(a._known.slice()),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,r,i,s,n,a){if(null!==this._whereClauseFunction)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==s&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,s));const u=await this._parent._stat(e,t,r,i,o,n,a);return!1===u.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,r,i,s){return null===this._whereClauseFunction&&(null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o){if(null===this._parent)throw new i.dr(i.D_.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.kg)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o)}static registerAction(){s.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,r)=>{r.d(t,{C_:()=>h,OH:()=>y,Vh:()=>_,on:()=>d,pc:()=>g,wB:()=>o,z7:()=>u});var i=r(37955),s=r(36563),n=r(97768),a=r(74887),l=r(14012);function o(e,t,r={}){return c(e,t,r,p)}function u(e,t,r={}){return c(e,t,r,f)}function c(e,t,r={},i){let s=null;const a=r.once?(e,r)=>{i(e)&&((0,n.xt)(s),t(e,r))}:(e,r)=>{i(e)&&t(e,r)};if(s=(0,l.Cn)(e,a,r.sync,r.equals),r.initial){const t=e();a(t,t)}return s}function d(e,t,r,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,n.xt)(c),r(e)}const p=o(e,((e,r)=>{d(),(0,i.wb)(e)&&(l=e,u=(0,i.on)(e,t,h),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return c=(0,s.hA)((()=>{p.remove(),d()})),c}function h(e,t){return function(e,t,r){if((0,a.G4)(r))return Promise.reject((0,a.NK)());const i=e();if(t?.(i))return Promise.resolve(i);let l=null;function o(){l=(0,n.xt)(l)}return new Promise(((i,n)=>{l=(0,s.vE)([(0,a.u7)(r,(()=>{o(),n((0,a.NK)())})),c(e,(e=>{o(),i(e)}),{sync:!1,once:!0},t??p)])}))}(e,f,t)}function p(e){return!0}function f(e){return!!e}r(80559);const y={sync:!0},_={initial:!0},g={sync:!0,initial:!0}},39516:(e,t,r)=>{let i;async function s(){return null==i&&(i=Promise.all([r.e(8368),r.e(4123)]).then(r.bind(r,44123)).then((e=>new e.WhereClauseCache(500,500)))),i}async function n(e,t){const r=await s(),i=r.get(e,t);if(null==i)throw r.getError(e,t);return i}function a(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function l(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}r.d(t,{GP:()=>n,IW:()=>l,mA:()=>a})},40334:(e,t,r)=>{r.r(t),r.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>se,constructFeatureSet:()=>re,constructFeatureSetFromPortalItem:()=>de,constructFeatureSetFromRelationship:()=>ne,constructFeatureSetFromUrl:()=>te,convertToFeatureSet:()=>ce,createFeatureSetCollectionFromMap:()=>oe,createFeatureSetCollectionFromService:()=>ue,initialiseMetaDataCache:()=>X});var i=r(78888);class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,r){this._layerById[t]=r,this._layerByName[e]=r}async featureSetByName(e,t=!0,r=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,r=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}var n=r(78878),a=r(35704),l=r(52106),o=r(59534),u=r(68423),c=r(86691),d=r(87449),h=r(11221),p=r(89169),f=r(87594),y=r(33325),_=r(80609),g=r(1262),m=r(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,r,i){const s=new w;s.field=e;const n=m.A.create(t,{fieldsIndex:r,timeZone:i}),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 g.L8(g.Z7.MissingStatisticParameters);const t=m.A.create((0,_.Mi)(e.parseTree.args.value[0],y.zl.Standardised,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(n);if(null===a)throw new g.L8(g.Z7.UnsupportedSqlFunction,{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(s.typeofstat="MIN",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(s.typeofstat="MAX",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)s.typeofstat="COUNT",s.workingexpr=a.expr;else if("STDEV"===l){if(s.typeofstat="STDDEV",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(s.typeofstat="SUM",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new g.L8(g.Z7.UnsupportedSqlFunction,{function:l});if(s.typeofstat="VAR",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"var"})}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}var F=r(53966),b=r(80200),I=r(74639),S=r(44729),A=r(55612),v=r(15032),T=r(16930),x=r(20437),C=r(95466);const D=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 y.J6.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,r=1;const i=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"+r.toString(),r++)}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:i,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=D.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:i,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 T.A({wkid:4326});this.fields=[];const s=new w;s.field=this._nextUniqueName(e),s.tofieldname=this.objectIdField,s.workingexpr=m.A.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),s.typeofstat="MIN",this._decodedStatsfield.push(s);for(const t of this._decodedGroupbyfield){const r=new x.A;if(t.name=this._nextUniqueName(e),r.name=t.tofieldname,r.alias=r.name,(0,_.DA)(t.expression)){const e=this._parent.getField((0,_.YY)(t.expression,y.zl.Standardised));if(!e)throw new d.dr(d.D_.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),r.type=e.type,t.sqlType=e.type}else{r.type=this._convertToEsriFieldType((0,_.IY)(t.expression,this._parent.fields));const e=new x.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=r.type}this.fields.push(r)}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 r=new x.A;let i=null;const s=this._decodedStatsfield[t];s.field=this._nextUniqueName(e),s.tofieldname===this.objectIdField&&(this._internalObjectIdField=s.field),r.name=s.tofieldname,r.alias=r.name;const n=null!==s.workingexpr&&(0,_.DA)(s.workingexpr)?(0,_.YY)(s.workingexpr,y.zl.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(i=this._parent.getField(n),!i)throw new d.dr(d.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"MIN":case"MAX":if(""!==n){if(i=this._parent.getField(n),!i)throw new d.dr(d.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"COUNT":r.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(i=this._parent.getField(n),!i))throw new d.dr(d.D_.AggregationFieldNotFound);r.type="double"}this.fields.push(r)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,r,i){-1!==t&&this._featureCache[t];const s=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,s)?(await this._expandPagedSet(e,s,0,0,i),this._getFeatures(e,t,r,i)):"success"}async _getFilteredSet(e,t,r,i,s){if(""!==e)return new p.A([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==r)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,_.Ju)(r,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,r=null;break}if(null!==i){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===i.scanForField(this._decodedStatsfield[e].tofieldname)){i=null,l.ordered=!1;break}if(null!==i)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===i.scanForField(e.tofieldname)){i=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;r&&(e=this._reformulateWhereClauseWithoutGroupByFields(r));let t=null;i&&(t=this._reformulateOrderClauseWithoutGroupByFields(i));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(s),n=!0===l.nowhereclause?new p.A(a._candidates.slice().concat(a._known.slice()),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new p.A(a._candidates.slice(),a._known.slice(),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new p.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 f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=o;if(null!==r){let t=null;r&&(t=this._reformulateWhereClauseWithoutGroupByFields(r)),e=new a.A({parentfeatureset:e,whereclause:t})}n=new p.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 f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,_.bD)(e,t.tofieldname,(0,_.YY)(t.workingexpr,y.zl.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,_.bD)(e,t.tofieldname,(0,_.YY)(t.expression,y.zl.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,r){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,r),this._refineSetBlock(e,t,r)):(this._checkCancelled(r),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getPhysicalPage(e,t,r){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,r,[]);const i=await this._getAgregagtePhysicalPage(e,t,r);for(const e of i){const t={geometry:e.geometry,attributes:{}},r={};for(const t in e.attributes)r[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=r[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=r[e.field.toLowerCase()];if(null!=this._featureCache[t.attributes[this.objectIdField]])throw F.A.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${t.attributes[this.objectIdField]}`),new d.dr(d.D_.NeverReach);this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return i.length}_sequentialGetPhysicalItem(e,t,r,i){return new Promise(((s,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(r)),!0===e.pagesDefinition.internal.fullyResolved||0===t?s(i.length):this._nextAggregateItem(e,t,r,i,(n=>{null===n?s(i.length):(t-=1,s(this._sequentialGetPhysicalItem(e,t,r,i)))}),n)}))}_nextAggregateItem(e,t,r,i,s,a){try{(0,n.a0)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);i.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,s(null)}else e.pagesDefinition.internal.fullyResolved=!0,s(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const r=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return i.push(r),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(r.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void s(r)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,r,i,s,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,r){const i=[];for(const r of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(r);null!==e&&(e instanceof S.n||e instanceof v.k?i.push(e.toNumber()):e instanceof A.g?i.push(e.toMilliseconds()):i.push(e))}else i.push(null);r.attributes[t.tofieldname]=(0,I.s)(t.typeofstat,[i])}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.features[0].attributes[r.singlefield]:m.A.convertValueToStorageFormat(r.expression.calculateValue(e.features[0]),r.sqlType);t.attributes[r.tofieldname]=i}for(const r of this._decodedStatsfield)this._calculateFieldStat(e,r,t);const r=[];for(let i=0;i<this._decodedStatsfield.length;i++)r.push(this._calculateFieldStat(e,this._decodedStatsfield[i],t));if(null!=this._featureCache[t.attributes[this.objectIdField]])throw F.A.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${t.attributes[this.objectIdField]}`),new d.dr(d.D_.NeverReach);return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.attributes[r.singlefield]:r.expression.calculateValue(e);t+=null==i?":":":"+i.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=r(54784),L=r(54461),N=r(70333),E=r(61454),P=r(66395),O=r(50145),j=r(4576),M=r(39516),G=r(65864),U=r(21325),B=r(13600),q=r(54546),Z=r(61956),W=r(7562);class V 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 r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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=y.zl.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=y.zl.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=y.zl.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=y.zl.Standardised))}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 y.J6.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new Z.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 r="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this.recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this.recentlyUsedQueries.addToCache(t,i),i=i.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}async _getFilteredSet(e,t,r,i,s){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new p.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=this._createQuery();o.where=(0,M.mA)(o.where,null===r?null===t?"1=1":"":(0,_.YY)(r,n)),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(s),new p.A([],u,l,null)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=i.constructClause(),a=!0);const l=await this.databaseType(),o=null===r?null===t?"1=1":"":(0,_.YY)(r,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 p.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:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let r=!0;!0===this._removeGeometry&&(r=!1);const i=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new p.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:i.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:r,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,s),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,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=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,M.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(r),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[s+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=i+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 r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFeatures(e,t,r,i){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,r,i);let n=0;for(let i=e._lastFetchedIndex;i<e._known.length;i++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[i]]){let r=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[i]]){const s=t._featureMap[e._known[i]];null!==s&&(r=!0,this._featureCache[e._known[i]]=s)}}if(!1===r&&(e._known[i]!==t&&s.push(e._known[i]),s.length>=this._maxProcessingRate()-1))break}if(n>=r&&0===s.length)break}if(0===s.length)return"success";const a=this._createQuery();a.objectIds=s,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(i),void 0!==l.error)throw new d.dr(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,r,i,s,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=r.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 p=this._createQuery();p.where=(0,M.mA)(p.where,null===n?null===s?"1=1":"":(0,_.YY)(n,u)),p.spatialRelationship=this._makeRelationshipEnum(i),p.relationParameter=this._makeRelationshipParam(i),p.geometry=null===s?null:s,p.returnDistinctValues=!0,p.returnGeometry=!1,p.outFields=[c];const f=await this.executeQuery(p,"execute");if(this._checkCancelled(o),!f.hasOwnProperty("features"))throw new d.dr(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<f.features.length;e++){if(y){const t=f.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(f.features[e].attributes[c]);if(l.length>=a)break}return 0===f.features.length?l:f.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+f.features.length,t,r,i,s,n,a,l,o)}:l}async _distinctStat(e,t,r,i,s,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,r,i,s,n,[],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,r,i){const s=await this.databaseType();if(this.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};const n=this._createQuery();return n.where=(0,M.mA)(n.where,null===i?null===r?"1=1":"":(0,_.YY)(i,s)),n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===r?null:r,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,r,i,s,n,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,r,i,s):{calculated:!1};if(!1===u||!1===(0,_.DA)(t)&&!1===o||!1===t.isStandardized)return""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===c?""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,r,i,s,n,a);const h=await this.databaseType();if(this.isTable()&&i&&null!==r&&""!==r)return{calculated:!0,result:null};const p=this._createQuery();p.where=(0,M.mA)(p.where,null===s?null===i?"1=1":"":(0,_.YY)(s,h)),p.spatialRelationship=this._makeRelationshipEnum(r),p.relationParameter=this._makeRelationshipParam(r),p.geometry=null===i?null:i;const f=new W.A;f.statisticType=(0,O.Dp)(e),f.onStatisticField=(0,_.YY)(t,h),f.outStatisticFieldName="ARCADE_STAT_RESULT",p.returnGeometry=!1;let y="ARCADE_STAT_RESULT";p.outStatistics=[f];const g=await this.executeQuery(p,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new d.dr(d.D_.InvalidStatResponse);let m=!1;const w=g.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=g.features[0].attributes[y];return null!==e&&(e=new Date(g.features[0].attributes[y])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[y]}}_stat(e,t,r,i,s,n,a){return this._stats(e,t,r,i,s,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let r=!1;const i=this._layer.capabilities?.query,s=!0===i?.supportsSqlExpression;if(null!=i&&!0===i.supportsStatistics&&!0===i.supportsOrderBy&&(r=!0),r)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,_.DA)(t[e].workingexpr)&&!1===s)&&(r=!1);return!1!==r}_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,r,i,s,n,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,r)=>({name:t.normalizeFieldName(e)??e,asc:null==n||1===n._directions[r]})))}}let u="",c=!1;null!=n&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==o||(0,j.MJ)(e,0,e.length,n._fields,0,Math.min(n._fields.length,e.length),((e,t)=>e.toLowerCase()===t.toLowerCase())))&&(u=n.constructClause(),c=!0),""===u&&(u=e.join(","));const d=[];for(let e=0;e<t.length;e++){const r=new W.A;r.onStatisticField=null!==t[e].workingexpr?(0,_.YY)(t[e].workingexpr,l):"",r.outStatisticFieldName=t[e].field,r.statisticType=t[e].toStatisticsName(),d.push(r)}let h=this._maxQueryRate();const f=this._layer.capabilities?.query.maxRecordCount;null!=f&&f<h&&(h=f);const y=null===s?null===i?"1=1":"":(0,_.YY)(s,l);return new p.A([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(r),relationParam:this._makeRelationshipParam(r),outFields:["*"],useOIDpagination:!1,generatedOid:a,resultRecordCount:h,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===i?null:i,where:y,orderByFields:u,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1,keysetPagination:o}})}async _getAgregagtePhysicalPage(e,t,r){let i=e.pagesDefinition.where;if(!0===e.pagesDefinition.useOIDpagination&&(i=(0,M.mA)(i,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString())),null!=e.pagesDefinition.internal.keysetPagination?.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new d.dr(d.D_.NotImplemented);i=(0,M.mA)(i,(0,_.YY)(e.pagesDefinition.internal.keysetPagination.clause,await this.databaseType()))}const s=e.pagesDefinition.internal.lastRetrieved,n=s,a=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,M.mA)(o.where,i),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(r),!u.hasOwnProperty("features"))throw new d.dr(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[n+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.dr(d.D_.NeverReach);const t=[];for(let r=0;r<e.length;r++){const i=e[r],s=[`"${i.name.replace('"','""')}" ${i.asc?">":"<"} @last_${r}`];for(let t=0;t<r;t++){const r=e[t];s.push(`"${r.name.replace('"','""')}" = @last_${t}`)}t.push(s.join(" AND "))}const r=t.join(" OR ");return m.A.create(r)}(e.keyFields));for(let r=0;r<e.keyFields.length;r++){const i=e.keyFields[r].name;e.clause.parameters[`last_${r}`]=t.attributes[i]}}(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=s+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,r,i,s){const n=new B.default({url:e,outFields:null===t?["*"]:t});return new V({layer:n,spatialReference:r,lrucache:i,interceptor:s})}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,r,i,s){const n=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(n)){const a={objectIds:[e],returnMetadata:s};(t&&t>0||r&&r>0)&&(a.size=[t&&t>0?t:0,r&&r>0?r:t+1]),i&&i.length>0&&(a.attachmentTypes=i),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:n,query:a,method:"attachments"});const l=await n.queryAttachments(new q.A(a)),o=[];return l&&l[e]&&l[e].forEach((t=>{const r=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let i=null;s&&t.exifInfo&&(i=P.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new E.A(t.id,t.name,t.contentType,t.size,r,i,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,U.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const r=await(0,i.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(r.data){const e={},t=r.data;if(t?.relatedRecordGroups){const r=t.spatialReference;for(const i of t.relatedRecordGroups){const s=i.objectId,n=[];for(const e of i.relatedRecords){e.geometry&&(e.geometry.spatialReference=r);const t=new l.A({geometry:e.geometry?(0,G.rS)(e.geometry):null,attributes:e.attributes});n.push(t)}e[s]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new d.dr(d.D_.InvalidRequest)}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=(0,M.mA)(r.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.queryFeatures(r);return 1===i.features.length?i.features[0]:null}async getIdentityUser(){await this.load();const e=N.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=N.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const r=t.toLowerCase().indexOf("/rest/services");if(t=r>-1?t.slice(0,r):t,t){t+="/rest/info";try{const e=await(0,i.A)(t,{query:{f:"json"}});let r="";return e.data?.owningSystemUrl&&(r=e.data.owningSystemUrl),r}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new V({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 r=this._layer.parsedUrl?.path??null;if(r){const s=await(0,i.A)(r,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===r?null:r,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var Q=r(30235),J=r(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 r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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 y.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const r of this.fields)t[r.name]=e.attributes[r.name];return new l.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new p.A([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new p.A([],[],!0,null);if(n.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&!0===n.capabilities?.queryRelated.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=new J.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 n.source.queryRelatedFeatures(o);this._checkCancelled(s);const h=d[this._findObjectId]?d[this._findObjectId].features:[],f=[];for(let e=0;e<h.length;e++)this._featureCache[h[e].attributes[this._relatedLayer.objectIdField]]=h[e],f.push(h[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=r;return new p.A(y||_?f:[],y||_?[]:f,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==i&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(n=i.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!=r;let h=null,f=!0;!0===this._removeGeometry&&(f=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return h=new p.A(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(h,o,0,0,s),h}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}_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,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new J.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(r),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[s+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=i+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,r,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,i),this._getFeatures(e,t,r,i);let a=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(a++,a<=r&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[i]&&void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>r)))&&!(a>=r&&0===s.length);i++);if(0===s.length)return"success";throw new d.dr(d.D_.MissingFeatures)}async _refineSetBlock(e,t,r){return e}async _stat(e,t,r,i,s,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,r,i,s){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,r,i,s){return this._relatedLayer.queryAttachments(e,t,r,i,s)}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 $=r(23732),Y=r(92474),K=r(4146),H=r(80812);function X(){null===$.A.applicationCache&&($.A.applicationCache=new $.A)}async function ee(e,t,r){if($.A.applicationCache){const r=$.A.applicationCache.getLayerInfo(e);if(r){const i=await r;return new B.default({url:e,outFields:t,sourceJSON:i})}const i=new B.default({url:e,outFields:t}),s=(async()=>(await i.load(),i.sourceJSON))();if($.A.applicationCache){$.A.applicationCache.setLayerInfo(e,s);try{return await s,i}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return await s,i}if(null!=r){const i=r.getCachedLayerMetadata(e);if(i){const r=await i;return new B.default({url:e,outFields:t,sourceJSON:r})}const s=new B.default({url:e,outFields:t}),n=(async()=>(await s.load(),s.sourceJSON))();r.setCachedLayerMetadata(e,n);try{return await n,s}catch(t){throw r.removeCachedLayerMetadata(e,n),t}}return new B.default({url:e,outFields:t})}async function te(e,t,r,i,s,n=null){return re(await ee(e,["*"],s),t,r,i,s,n)}function re(e,t=null,r=null,i=!0,s=null,n=null){switch(e.type){case"catalog-footprint":return re(e.parent,t,r,i,s,n);case"subtype-sublayer":{const a=re(e.parent,t,r,i,s,n);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 Q.A({layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const a={layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n};return!e.url&&e.source?new Q.A(a):new V(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 r=t.getCachedServiceMetadata(e);if(null!=r)return r}const r=(async()=>{const t=await(0,i.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,r);try{return await r}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,r);try{return await r}catch(i){throw t.removeCachedServiceMetadata(e,r),i}}return r}async function se(e,t,r){const s={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},n=await ie(e,null);if(s.metadata=n,void 0!==n.controllerDatasetLayers?.utilityNetworkLayerId&&null!==n.controllerDatasetLayers.utilityNetworkLayerId){if(n.layers)for(const e of n.layers)s.layerNameLkp[e.id]=e.name;if(n.tables)for(const e of n.tables)s.layerNameLkp[e.id]=e.name;const a=n.controllerDatasetLayers.utilityNetworkLayerId;s.networkId=a;const l=await async function(e,t){const r="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==$.A.applicationCache){const e=$.A.applicationCache.getLayerInfo(r);if(null!==e)return e}const s=(async()=>{const r=await(0,i.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new d.dr(d.D_.DataElementsNotFound)})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(r,s);try{return await s}catch(e){throw $.A.applicationCache.clearLayerInfo(r),e}}return s}(e,a);if(l){s.queryelem=l,s.queryelem?.dataElement&&void 0!==s.queryelem.dataElement.schemaGeneration&&(s.unVersion=s.queryelem.dataElement.schemaGeneration),s.lkp={},s.queryelem.dataElement.domainNetworks||(s.queryelem.dataElement.domainNetworks=[]);for(const e of s.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}}if(s.queryelem.dataElement.terminalConfigurations)for(const e of s.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)s.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const n=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,i.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!==n.systemLayers?.associationsTableId&&null!==n.systemLayers.associationsTableId){let i=null;if(r&&s.unVersion<8){const r=[];s.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG")),i=await te(e+"/"+n.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null),await i.load(),s.unVersion>=4&&(i=i.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:i.getFieldsIndex(),timeZone:i.dateFieldsTimeZoneDefaultUTC})),await i.load())}return{lkp:s.lkp,associations:i,unVersion:s.unVersion,terminals:s.terminals,layerIdLookup:s.layerIdLookup,sourceIdLookup:s.sourceIdLookup}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function ne(e,t,r,i=null,s=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await te(o,i,s,n,a,l);return new z({layer:e,relatedLayer:u,relationship:t,objectId:r,spatialReference:i,outFields:s,includeGeometry:n,lrucache:a,interceptor:l})}a.A.registerAction(),R.registerAction(),c.A.registerAction(),k.A.registerAction(),L.A.registerAction();class ae extends s{constructor(e,t=null,r=null,i=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,r=null){const i=re(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async featureSetByName(e,t=!0,r=null){if(Y.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,y.eB)(t)&&t.title===e));if(null!=s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,y.eB)(t)&&t.title===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){if(Y.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,y.eB)(t)&&t.id===e));if(s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,y.eB)(t)&&t.id===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}}class le extends s{constructor(e,t=null,r=null,i=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,r=null){const i=re(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async _loadMetaData(){const e=await ie(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new le(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,r=null){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])t.name===e&&(n=t);if(!n)for(const t of s.tables??[])t.name===e&&(n=t);if(n){const e=await ee(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);e=null!=e?e.toString():"";for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of s.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await ee(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}}function oe(e,t,r=null,i=null){return new ae(e,t,r,i)}function ue(e,t,r=null,i=null){return new le(e,t,r,i)}function ce(e,t,r,i,s){if(null===e)return null;if((0,n.p)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof K.A&&(0,y.NI)(e)){const n=e;switch(t){case"datasource":return re(n,s,"outFields"in n?n.outFields:null,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return re(n,s,"outFields"in n?n.outFields:null,!0,r,i)}return null}if((0,n.$)(e)){switch(t){case"datasource":return re(e.parent,s,e.parent.outFields,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return re(e,s,e.parent.outFields,!0,r,i)}return null}return null}async function de(e,t,r,i,s,n,a,l=null){if($.A.applicationCache){const o=$.A.applicationCache.getLayerInfo(e+":"+n.url);if(o)return he(await o,t,r,i,s,a,l)}if(null!=a){const o=a.getCachedPortalItem(n.url,e);if(null!=o)return await he(await o,t,r,i,s,a,l)}const o=new H.default({id:e,portal:n}).load();$.A.applicationCache?$.A.applicationCache.setLayerInfo(e+":"+n.url,o):null!=a&&a.setCachedPortalItem(n.url,e,o);try{return await he(await o,t,r,i,s,a,l)}catch(t){throw $.A.applicationCache&&$.A.applicationCache.clearLayerInfo(e+":"+n.url),null!=a&&a.removeCachedPortalItem(n.url,e,o),t}}async function he(e,t,r,i,s,n,a){let l;if("Feature Service"===e.type||"Map Service"===e.type)l=await ee((0,y.Qi)(e.url??"")+"/"+t,["*"],n);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=n){const t=n.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=K.A.fromPortalItem(e);n.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(r){throw n.removeCachedPortalItemLayer(e.portal.url,e.id,t),r}}}else l=await K.A.fromPortalItem(e)}return re(l,r,i,s,n,a)}},41366:(e,t,r)=>{r.d(t,{K:()=>h,Q:()=>u});var i=r(90237),s=r(66552),n=r(53966),a=r(10107),l=(r(44208),r(87811),r(93223)),o=r(40608);const u=(0,s.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),c="percent-of-total",d="field",h=e=>{let t=class extends e{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,r=null!=this.normalizationTotal;return t||r?(e=t&&d||r&&c||null,t&&r&&n.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,i._)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],t.prototype,"normalizationField",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],t.prototype,"normalizationMaxValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],t.prototype,"normalizationMinValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],t.prototype,"normalizationTotal",void 0),(0,i._)([(0,l.e)(u,{name:"parameters.normalizationType"})],t.prototype,"normalizationType",null),t=(0,i._)([(0,o.$)("esri.rest.support.NormalizationBinParametersMixin")],t),t}},41560:(e,t,r)=>{r.d(t,{Ch:()=>a,mW:()=>n});var i=r(34727),s=r(39516);function n(e,t){return{...t,filterMode:e.mode}}function a(e,t,r){const n=function(e){if("manual"===u(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:r,maxScale:i}of e.filters)t[0]=Math.max(t[0],c(r)),t[1]=Math.min(t[1],d(i));return t}(e);if(n&&((0,i.gg)(t,n[0])||(0,i.ZH)(r,n[1])))return"";const a=Array.from(l(e,t,r)),o=function(e,t,r){if(0===e.length)return!0;const s=c(e.at(0)?.minScale),n=d(e.at(-1)?.maxScale);if((0,i.ZH)(s,t)||(0,i.gg)(n,r))return!0;for(let t=0;t<e.length-1;t++){const r=e[t],s=e[t+1];if((0,i.ZH)(c(s.minScale),d(r.maxScale)))return!0}return!1}(a,t,r)?"1=1":a.map((e=>e.where||"1=1")).reduce(((e,t)=>(0,s.IW)(e,t)),"");return o&&"1=1"!==o?o:""}function*l(e,t,r){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 i of e.filters)o(i.minScale,i.maxScale,t,r)&&(yield i)}}function o(e,t,r,s){return e=c(e),r=c(r),t=d(t),!(!(0,i.Sp)(r,e)&&(s??r)>e||(0,i.Hx)(t,r)||void 0!==s&&(0,i.Sp)(s,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,r)=>{r.d(t,{R:()=>s});var i=r(49186);let s=class e{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}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+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}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,r=""){const[s,n]=t.split("."),a=/^\s*\d+\s*$/;if(!s?.match||!a.test(s))throw new i.A((r&&r+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!n?.match||!a.test(n))throw new i.A((r&&r+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const l=parseInt(s,10),o=parseInt(n,10);return new e(l,o,r)}}},54461:(e,t,r)=>{r.d(t,{A:()=>l});var i=r(87449),s=r(11221),n=r(89169),a=r(33325);class l extends s.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 n.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(t===a.J6.NotInFeatureSet)return t;const r=this._idstates[e];return r===a.J6.InFeatureSet||r===a.J6.NotInFeatureSet?r:t===a.J6.InFeatureSet&&void 0===r?this._countedin<this._topnum?(this._idstates[e]=a.J6.InFeatureSet,this._countedin++,a.J6.InFeatureSet):(this._idstates[e]=a.J6.NotInFeatureSet,a.J6.NotInFeatureSet):a.J6.Unknown}async _expandPagedSet(e,t,r,s,n){if(null===this._parent)throw new i.dr(i.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,r,s,n);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,r,i){const s=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,i),this._getFeatures(e,t,r,i);-1!==t&&void 0===this._featureCache[t]&&s.push(t);let l=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(l++,l<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>a)));i++);if(0===s.length)return"success";const o=new n.A([],s,!1,null),u=Math.min(s.length,r);await this._parent._getFeatures(o,-1,u,i);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(s[e]);void 0!==t&&(this._featureCache[s[e]]=t)}return"success"}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const a=await this._getSet(s);return new n.A(a._candidates.slice().concat(a._known.slice()),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let r=0,i=null;const s=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.J6.InFeatureSet){if(e._known.push(e._candidates[n]),r+=1,null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.J6.NotInFeatureSet)null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),r+=1;else if(l===a.J6.Unknown)break;if(r>=t)break}null!==i&&s.push(i);for(let t=s.length-1;t>=0;t--)e._candidates.splice(s[t].start,s[t].end-s[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.A._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},55674:(e,t,r)=>{r.d(t,{Ad:()=>p,Gj:()=>_,QY:()=>h,lL:()=>g,xR:()=>f});var i=r(66131),s=r(49186),n=(r(44208),r(44729)),a=r(15032),l=r(65864),o=r(95466),u=r(43668),c=r(98623);const d=["geometry","scale","timeProperties"];function h(e,t){if(null!=t)for(const r of d)t.hasArcadeDependency(r)&&e.add(r);return e}function p(e,t){return y.create(e,t,null,["$feature","$view"])}function f(e,t,r){return y.create(e,t,r,["$feature","$view","$config"])}class y{static async create(e,t,r,i){const{arcade:n,Dictionary:a}=await(0,u.l)();let l;try{l=n.parseScript(e)}catch(t){throw new s.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const o=n.scriptUsesGeometryEngine(l);o&&await n.enableGeometrySupport(),await n.loadDependentModules(new Set,l,null,!1,o);const c={vars:i.reduce(((e,t)=>({...e,[t]:null})),{}),spatialReference:t,useAsync:!1},d=n.compileScript(l,c);let h=null;null!=r&&(h=new a(r),h.immutable=!0);const p=new a;return p.immutable=!1,p.setField("scale",0),new y(e,n,l,d,t,p,h,a)}constructor(e,t,r,i,s,n,a,l){this.script=e,this._arcade=t,this._syntaxTree=r,this._compiled=i,this._spatialReference=s,this._viewDict=n,this._configDict=a,this._dictionaryCtor=l,this._dependencies=new Map,this._featureReader=new _,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 r=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:s,currentEnd:n}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=s?null!=r?i.lY.epochToArcadeDate(s,r):i.lY.unknownEpochToArcadeDate(s):void 0,currentEnd:null!=n?null!=r?i.lY.epochToArcadeDate(n,r):i.lY.unknownEpochToArcadeDate(n):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:r})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class _{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,r){const i=t??new o.A(g(e.attributes));this._boundTarget=e,this._boundSchema.fields=i.fields,this._boundSchema.fieldsIndex=i,this._boundSchema.spatialReference=r}_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 r=this._getField(e);if(r)switch(r.type){case"date-only":case"esriFieldTypeDateOnly":return n.n.fromReader(this._boundTarget.attributes[r.name]);case"time-only":case"esriFieldTypeTimeOnly":return a.k.fromReader(this._boundTarget.attributes[r.name]);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return i.lY.fromReaderAsTimeStampOffset(this._boundTarget.attributes[r.name]);case"date":case"esriFieldTypeDate":{const t=this._boundTarget.attributes[r.name];return this.isUnknownDateTimeField(e)?i.lY.unknownEpochToArcadeDate(t):i.lY.epochToArcadeDate(t,this.contextTimeZone??c.qU)}default:return this._boundTarget.attributes[r.name]}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 g(e){const t=[];for(const r in e)t.push({name:r,alias:r,type:"string"==typeof e[r]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},58501:(e,t,r)=>{r.d(t,{q:()=>s});var i=r(62815);function s(e,t,r){if(!r?.features||!r.hasZ)return;const s=(0,i.N)(r.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of r.features)s(e.geometry)}},60999:(e,t,r)=>{r.d(t,{DZ:()=>f,Ke:()=>p,Tj:()=>c,UT:()=>y,jJ:()=>u});var i=r(90237),s=r(69622),n=r(97768),a=r(74887),l=r(10107),o=r(40608);function u(e,t,r){return(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))}async function c(e,t,r){return(await(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))).map((e=>e.value))}function d(e){return{ok:!0,value:e}}function h(e){return{ok:!1,error:e}}async function p(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 f(e){try{return d(await e)}catch(e){return(0,a.QP)(e),h(e)}}function y(e,t){return new _(e,t)}let _=class extends s.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,n.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),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,n.xt)(this._abortHandle),this._abortController=null}};(0,i._)([(0,l.MZ)()],_.prototype,"value",null),(0,i._)([(0,l.MZ)()],_.prototype,"error",null),(0,i._)([(0,l.MZ)()],_.prototype,"finished",null),(0,i._)([(0,l.MZ)()],_.prototype,"promise",void 0),(0,i._)([(0,l.MZ)()],_.prototype,"_result",void 0),_=(0,i._)([(0,o.$)("esri.core.asyncUtils.ReactiveTask")],_)},68423:(e,t,r)=>{r.d(t,{Gr:()=>m,IO:()=>y,a:()=>w,bV:()=>g,p8:()=>_});var i=r(52106),s=r(78502),n=r(87449),a=r(11221),l=r(89169),o=r(33325),u=r(80609),c=r(97768),d=r(1262),h=r(88368),p=r(16930);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class y extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class _ extends f{constructor(e,t,r){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}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 g extends f{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const e in r)this.reverseLkp[r[e]]=e;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,o.zl.Standardised,this.field.name,this.codefield instanceof h.A?(0,u.YY)(this.codefield,o.zl.Standardised):this.codefield,e.parameters);return r.includes(g.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:h.A.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,i=null,s){let n,a,l,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,r,i,s),e.qualifier,e.op);case"case-expression":{let i=" CASE ";"simple"===e.format&&(i+=this.evaluateNodeToWhereClause(e.operand,t,r,g.BADNESS,s));for(let n=0;n<e.clauses.length;n++)i+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,r,g.BADNESS,s)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,r,g.BADNESS,s);return null!==e.else&&(i+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,g.BADNESS,s)),i+=" END ",i}case"parameter":{const r=s[e.value.toLowerCase()];if("string"==typeof r)return"'"+r.toString().replaceAll("'","''")+"'";if((0,o.$P)(r))return(0,u.bm)(r,t);if((0,o.Lk)(r))return(0,u.bm)(r,t);if((0,o.eg)(r))return(0,u.F1)(r,t);if((0,o.rX)(r))return(0,u.R8)(r,t);if((0,o.f0)(r))return(0,u.Nf)(r,t);if(Array.isArray(r)){const e=[];for(let i=0;i<r.length;i++)"string"==typeof r[i]?e.push("'"+r[i].toString().replaceAll("'","''")+"'"):(0,o.$P)(r[i])||(0,o.Lk)(r[i])?e.push((0,u.bm)(r[i],t)):(0,o.eg)(r[i])?e.push((0,u.F1)(r[i],t)):(0,o.rX)(r[i])?e.push((0,u.R8)(r[i],t)):(0,o.f0)(r[i])?e.push((0,u.Nf)(r[i],t)):e.push(r[i].toString());return e}return r.toString()}case"expression-list":a=[];for(const n of e.value)a.push(this.evaluateNodeToWhereClause(n,t,r,i,s));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,g.BADNESS,s)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"IS":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";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" ("+i+" "+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+" "+i+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") "}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 r&&r.toLowerCase()===e.column.toLowerCase()?"("+i+")":(0,u.Kb)(e.column);case"data-type":return e.value;case"function":{const i=this.evaluateNodeToWhereClause(e.args,t,r,g.BADNESS,s);return(0,u.F6)(e.name,i,t)}}throw new d.L8(d.Z7.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof h.A?this.reverseLkp[h.A.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}class m extends f{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,o.zl.Standardised),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 r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;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 p.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,r,n){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,n),this._getFeatures(e,t,r,n);let u=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(u++,u<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&a.push(e._known[i]),a.length>=o)));i++);if(0===a.length)return"success";e=new l.A([],a,e._ordered,null);const c=Math.min(a.length,r);await(this._parent?._getFeatures(e,-1,c,n)),this._checkCancelled(n);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 r of this.adaptedFields)t[r.field.name]=r.extractValue(e);this._featureCache[e.id]=new i.A({attributes:t,geometry:(0,s.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new n.dr(n.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){let n=!1;const a=this._reformulateWithoutAdaptions(r);n=a.cannot,r=a.where;let o=!1;if(null!==i){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof y)&&!0===i.scanForField(t.field.name)){if(!(t instanceof _)){i=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}i&&e.length>0&&(i=i.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=(0,u.kg)(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,r,i,s);let d;return this._checkCancelled(s),d=!0===n?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 r of this.adaptedFields)if(!0===(0,u.Ju)(e,r.field.name)){const i=r.rewriteSql(e,this);if(!0!==i.rewritten){t.cannot=!0,t.where=null;break}t.where=i.where}return t}async _stat(e,t,r,i,s,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(s),l=l||o.cannot,null!==(s=o.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,!0===l)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,r,i,s,n,a);return!1===c.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,r,i,s){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const r of this.adaptedFields)if(e[t].toLowerCase()===r.field.name.toLowerCase()&&!(r instanceof y))return!1;const n=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)return!1;const t=r.clone();t.workingexpr=e.where,n.push(t)}else n.push(r)}const a=this._reformulateWithoutAdaptions(s);return!a.cannot&&(null!==(s=a.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._canDoAggregates(e,n,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,a,l){if(null===this._parent)throw new n.dr(n.D_.NeverReach);const o=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)throw new n.dr(n.D_.NeverReach);const t=r.clone();t.workingexpr=e.where,o.push(t)}else o.push(r)}const c=this._reformulateWithoutAdaptions(s);if(c.cannot)throw new n.dr(n.D_.NeverReach);return null!==(s=c.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,r,i,s,a,l)}}},73681:(e,t,r)=>{r.d(t,{n:()=>o});var i=r(49186),s=r(53966),n=r(46140),a=r(95466),l=r(55674);class o{static async from(e,t,r){const a=e.dictionary_version?n.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(r))h.delete(e);h.size&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:h});const p=await(0,l.xR)(e.expression,null,d);if(!p)throw new i.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const f=!a||!a.greaterEqual(4,0);f&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:a});const y=new u(r,f);return new o(f,c,p,y)}constructor(e,t,r,i){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=r,this._reader=i}get itemNames(){return this._itemNames}evaluate(e,t,r,i){try{return this._reader.bind(e,r,i),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){s.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?"":""+this._boundTarget.attributes[t.name]}}},77548:(e,t,r)=>{r.d(t,{tk:()=>d,BR:()=>c,wI:()=>u,Ov:()=>l,W_:()=>o,TU:()=>a,XX:()=>n});var i=r(70333),s=r(78888);r(5503),r(36563),r(36708),new WeakMap;const n={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 r=i.id?.findServerInfo(e);if(null!=r?.currentVersion)return r.owningSystemUrl||null;const n=e.toLowerCase().indexOf("/rest/services");if(-1===n)return null;const a=`${e.slice(0,n)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,s.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)}},86691:(e,t,r)=>{r.d(t,{A:()=>o});var i=r(78878),s=r(87449),n=r(11221),a=r(89169),l=r(87594);class o extends n.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 r=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(r);const i=new a.A([],[],!0,null);for(let e=0;e<r.length;e++)i._known.push(r[e].id);return i}async getIdColumnDictionary(e,t,r,s){if(r<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[r+1])return await(0,i.a0)(this._parent._expandPagedSet(e,n,0,0,s)),this.getIdColumnDictionary(e,t,r,s);let a=r+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;r+=l.length;const o=await(0,i.a0)(this._parent._getFeatureBatch(l,s));this._checkCancelled(s);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,r,s)}return e._candidates.length>0?(await(0,i.a0)(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,r,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_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 s.dr(s.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,r,null===i?this._orderbyclause:i,s);this._checkCancelled(s);const l=new a.A(n._candidates.slice(),n._known.slice(),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,s);return!1===o&&(null===t&&null===r||(e=new a.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.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,r)=>{function i(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}r.d(t,{A:()=>s});class s{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const r=t[e].match(/\S+/g);this._fields.push(r[0]),2===r.length?"asc"===r[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 r=0;r<this._fields.length;r++){const s=this.featureValue(e.feature,this._fields[r],r),n=this.featureValue(t.feature,this._fields[r],r);let a=0;if(a=1===this._directions[r]?i(s,n):-1*i(s,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let r=0;r<this._fields.length;r++){0!==r&&(t+=",");let i=this._fields[r];for(const t of e)if(i.toLowerCase()===t.field.toLowerCase()){i=t.newfield;break}t+=i,1===this._directions[r]?t+=" ASC":t+=" DESC"}return new s(t)}featureValue(e,t,r){const i=e.attributes[t];if(void 0!==i)return i;for(const i in e.attributes)if(t.toLowerCase()===i.toLowerCase())return this._fields[r]=i,e.attributes[i];return null}}},91880:(e,t,r)=>{r.d(t,{A:()=>c});var i,s=r(90237),n=r(66552),a=r(25482),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const u=new n.J({asc:"ascending",desc:"descending"});let c=class extends a.A{static{i=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,s._)([(0,l.MZ)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,s._)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],c.prototype,"valueExpression",void 0),(0,s._)([(0,l.MZ)({type:u.apiValues,json:{type:u.jsonValues,read:u.read,write:u.write}})],c.prototype,"order",void 0),c=i=(0,s._)([(0,o.$)("esri.layers.support.OrderByInfo")],c)},92935:(e,t,r)=>{var i;r.d(t,{X:()=>i}),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(i||(i={}))}}]);
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[788,2470,3186,3515,4342,4697],{10407:(e,t,r)=>{r.d(t,{It:()=>p,LG:()=>a,OM:()=>u,Sm:()=>c,Y:()=>l,bK:()=>o,mm:()=>h,sQ:()=>d});var i=r(98988),s=r(16930),n=r(28735);function a(e,t){if(!l(e,t)){const r=e.typeKeywords;r?r.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 r=e.typeKeywords;if(r){const e=r.indexOf(t);e>-1&&r.splice(e,1)}}function c(e,t,r){r?a(e,t):u(e,t)}async function d(e){const t=e.clone().normalize();let r;if(t.length>1)for(const e of t)r?e.width>r.width&&(r=e):r=e;else r=t[0];return async function(e){const t=e.spatialReference;if(t.isWGS84)return e.clone();if(t.isWebMercator)return(0,n.ci)(e);const r=s.A.WGS84;return await(0,i.initializeProjection)(t,r),(0,i.project)(e,r)}(r)}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 p(e){const{portal:t,isOrgItem:r,itemControl:i}=e,s=t.user?.privileges;let n=!s||s.includes("features:user:edit"),a=!!r&&!!s?.includes("features:user:fullEdit");const l="update"===i||"admin"===i;return l?a=n=!0:a&&(n=!0),{features:{edit:n,fullEdit:a},content:{updateItem:l}}}},17311:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(90237),s=r(69622),n=r(60999),a=r(5503),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608)),u=r(30524),c=r(43668);let d=class extends s.A{constructor(e){super(e),this._featureUtils=null,this.effectivePopupTemplate=null}get _arcadeTask(){return this.expressionsUsedInTitle.length>0?this._get("_arcadeTask")||(0,n.UT)((()=>(0,c.l)())):null}get featureUtilsPromise(){return this._get("featureUtilsPromise")??r.e(9926).then(r.bind(r,29926)).then((e=>this._featureUtils=e))}get calculatedExpressions(){const e=new a.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 r=this._arcadeTask.value.arcade.parseScript(t.expression,["$layer","$map","$datastore"]);if(r.isAsync){e.push({name:t.name,invalid:!0});break}e.push({name:t.name,syntax:r,invalid:!1,func:this._arcadeTask.value.arcade.compileScript(r,{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 r=this._arcadeTask.value.arcade.extractFieldLiterals(t.syntax);for(const t of r){const r=t.split("."),i=this.fieldsIndex.get(r.at(-1)??"");i&&e.add(i.name)}}catch{}const t=this._extractFieldNames(this.workingTitle);for(const r of t){const t=this.fieldsIndex.get(r);t&&e.add(t.name)}return e}get titleFromDisplayField(){let e="";return this.displayField&&(e=this.fieldsIndex.get(this.displayField)?.name??""),e||(e=this.fieldsIndex.get(this.objectIdField)?.name??""),e?`{${e}}`:""}get workingTitle(){const e=this.effectivePopupTemplate?this.effectivePopupTemplate.title:"";return""===e||null==e||this.hasBadExpressions||"string"!=typeof e?this.titleFromDisplayField:e}async getTitle(e,t,r){try{const{attributes:i}=t,s=r?.timeZone??"system",[{substituteFieldsInLinksAndAttributes:n}]=await Promise.all([this.featureUtilsPromise,this._arcadeTask?.promise]);if(r.fetchMissingFields&&(t=await this._checkAndReQueryGraphic(e,t)),this.workingTitle&&this.fieldInfoMap){const r=this._createFormattedAttributes(e,t,s).global;return n({attributes:i,expressionAttributes:null,fieldInfoMap:this.fieldInfoMap,globalAttributes:r,layer:e,text:this.workingTitle})}return""}catch{}return""}async _checkAndReQueryGraphic(e,t){const r=t.getObjectId();if(null==r)return t;if(!(0,u.Kl)(this.requiredFields,t)){const t=e.createQuery();t.where="1=1",t.outFields=[...this.requiredFields],t.objectIds=[r];const i=await e.queryFeatures(t);if(1===i?.features.length)return i.features[0]}return t}_createFieldInfoMap(e){const t=new Map;if(!e)return t;for(const r of e){if(!r.fieldName)continue;const e=this.fieldsIndex.get(r.fieldName),i=e?.name??r.fieldName;r.fieldName=i,t.set(i.toLowerCase(),r)}return t}_createFormattedAttributes(e,t,r="system"){const i=this.effectivePopupTemplate?.fieldInfos??[],s={};if(!this._featureUtils)return{};if(!this.hasBadExpressions&&this.calculatedExpressions.length>0&&this._arcadeTask?.value){const r=this._arcadeTask.value.Feature.createFromGraphicLikeObject(t.geometry,t.attributes,e,null);for(const e of this.calculatedExpressions)try{s[`expression/${e.name}`]=e.func({vars:{$feature:r}})}catch{}}const n={...t.attributes,...s};return{global:this._featureUtils.formatAttributes({fieldInfos:i,attributes:n,graphic:t,timeZone:r,layer:e,fieldInfoMap:this.fieldInfoMap}),content:[]}}_extractFieldNames(e){return(0,u.nw)(e).filter((e=>!(0===e.indexOf("relationships/")||0===e.indexOf("expression/"))))}};(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"_arcadeTask",null),(0,i._)([(0,l.MZ)()],d.prototype,"_featureUtils",void 0),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"featureUtilsPromise",null),(0,i._)([(0,l.MZ)({readOnly:!0})],d.prototype,"calculatedExpressions",null),(0,i._)([(0,l.MZ)()],d.prototype,"displayField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"effectivePopupTemplate",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"expressionsUsedInTitle",null),(0,i._)([(0,l.MZ)()],d.prototype,"fieldsIndex",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"fieldInfoMap",null),(0,i._)([(0,l.MZ)()],d.prototype,"fields",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"objectIdField",void 0),(0,i._)([(0,l.MZ)()],d.prototype,"requiredFields",null),d=(0,i._)([(0,o.$)("esri.layers.support.TitleCreator")],d)},22671:(e,t,r)=>{r.d(t,{A:()=>m});var i,s=r(90237),n=r(52106),a=r(66552),l=r(25482),o=r(4718),u=r(10107),c=(r(44208),r(53966),r(36005)),d=r(40608),h=r(43937),p=r(16930),f=r(65864),y=r(50498),_=r(20437);const g=new a.J({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let m=i=class extends l.A{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,n.A)}writeGeometryType(e,t,r,i){if(e)return void g.write(e,t,r,i);const{features:s}=this;if(s)for(const e of s)if(null!=e?.geometry)return void g.write(e.geometry.type,t,r,i)}readQueryGeometry(e,t){if(!e)return null;const r=!!e.spatialReference,i=(0,f.rS)(e);return i&&!r&&t.spatialReference&&(i.spatialReference=p.A.fromJSON(t.spatialReference)),i}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:r}=this;if(r)for(const e of r)if(e&&null!=e.geometry&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new i(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 r=0;r<t.features.length;r++){const i=t.features[r];if(i.geometry){const t=e?.[r];i.geometry=t?.toJSON()||i.geometry}}return t}quantize(e){const{scale:[t,r],translate:[i,s]}=e,n=this.features,a=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-i)/t)),(e=>Math.round((s-e)/r)));for(let e=0,t=n.length;e<t;e++)a?.(n[e].geometry)||(n.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:r}=this;if(!r)return this;const{translate:[i,s],scale:[n,a]}=r;let l=null,o=null;if(this.hasZ&&null!=r?.scale?.[2]){const{translate:[,,e],scale:[,,t]}=r;l=r=>r*t+e}if(this.hasM&&null!=r?.scale?.[3]){const{translate:[,,,e],scale:[,,,t]}=r;o=r=>null==r?r:r*t+e}const u=this._getHydrationFunction(e,(e=>e*n+i),(e=>s-e*a),l,o);for(const{geometry:e}of t)null!=e&&u&&u(e);return this.transform=null,this}readFeaturesWithClass(e,t,r){const i=p.A.fromJSON(t.spatialReference),s=[];for(let t=0;t<e.length;t++){const n=e[t],a=r.fromJSON(n),l=n.geometry?.spatialReference;null==a.geometry||l||(a.geometry.spatialReference=i);const o=n.aggregateGeometries,u=a.aggregateGeometries;if(o&&null!=u)for(const e in u){const t=u[e],r=o[e],s=r?.spatialReference;null==t||s||(t.spatialReference=i)}s.push(a)}return s}_quantizePoints(e,t,r){let i,s;const n=[];for(let a=0,l=e.length;a<l;a++){const l=e[a];if(a>0){const e=t(l[0]),a=r(l[1]);e===i&&a===s||(n.push([e-i,a-s]),i=e,s=a)}else i=t(l[0]),s=r(l[1]),n.push([i,s])}return n.length>0?n:null}_getQuantizationFunction(e,t,r){return"point"===e?e=>(e.x=t(e.x),e.y=r(e.y),e):"polyline"===e||"polygon"===e?e=>{const i=(0,f.Bi)(e)?e.rings:e.paths,s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e],a=this._quantizePoints(n,t,r);a&&s.push(a)}return s.length>0?((0,f.Bi)(e)?e.rings=s:e.paths=s,e):null}:"multipoint"===e?e=>{const i=this._quantizePoints(e.points,t,r);return i&&i.length>0?(e.points=i,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,r,i,s){return"point"===e?e=>{e.x=t(e.x),e.y=r(e.y),i&&(e.z=i(e.z))}:"polyline"===e||"polygon"===e?e=>{const n=(0,f.Bi)(e)?e.rings:e.paths;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];for(let e=0,s=i.length;e<s;e++){const s=i[e];e>0?(a+=s[0],l+=s[1]):(a=s[0],l=s[1]),s[0]=t(a),s[1]=r(l)}}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2]),r[3]=s(r[3])}}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=i(r[2])}}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];for(let e=0,r=t.length;e<r;e++){const r=t[e];r[2]=s(r[2])}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=r(e.ymin),e.xmax=t(e.xmax),e.ymax=r(e.ymax),i&&null!=e.zmax&&null!=e.zmin&&(e.zmax=i(e.zmax),e.zmin=i(e.zmin)),s&&null!=e.mmax&&null!=e.mmin&&(e.mmax=s(e.mmax),e.mmin=s(e.mmin))}:"multipoint"===e?e=>{const n=e.points;let a,l;for(let e=0,i=n.length;e<i;e++){const i=n[e];e>0?(a+=i[0],l+=i[1]):(a=i[0],l=i[1]),i[0]=t(a),i[1]=r(l)}if(i&&s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2]),t[3]=s(t[3])}else if(i)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=i(t[2])}else if(s)for(let e=0,t=n.length;e<t;e++){const t=n[e];t[2]=s(t[2])}}:null}};(0,s._)([(0,u.MZ)({type:String,json:{write:!0}})],m.prototype,"displayFieldName",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"exceededTransferLimit",void 0),(0,s._)([(0,u.MZ)({type:[n.A],json:{write:!0}})],m.prototype,"features",void 0),(0,s._)([(0,c.w)("features")],m.prototype,"readFeatures",null),(0,s._)([(0,u.MZ)({type:[_.A],json:{write:!0}})],m.prototype,"fields",void 0),(0,s._)([(0,u.MZ)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:g.read}}})],m.prototype,"geometryType",void 0),(0,s._)([(0,h.K)("geometryType")],m.prototype,"writeGeometryType",null),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasM",void 0),(0,s._)([(0,u.MZ)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],m.prototype,"hasZ",void 0),(0,s._)([(0,u.MZ)({types:y.yR,json:{write:!0}})],m.prototype,"queryGeometry",void 0),(0,s._)([(0,c.w)("queryGeometry")],m.prototype,"readQueryGeometry",null),(0,s._)([(0,u.MZ)({type:p.A,json:{write:!0}})],m.prototype,"spatialReference",void 0),(0,s._)([(0,h.K)("spatialReference")],m.prototype,"writeSpatialReference",null),(0,s._)([(0,u.MZ)({json:{write:!0}})],m.prototype,"transform",void 0),m=i=(0,s._)([(0,d.$)("esri.rest.support.FeatureSet")],m),m.prototype.toJSON.isDefaultToJSON=!0},30235:(e,t,r)=>{r.d(t,{A:()=>f});var i=r(52106),s=r(87449),n=r(11221),a=r(89169),l=r(33325),o=r(80609),u=r(39516),c=r(91075),d=r(13600),h=r(33143),p=r(20437);class f extends n.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 r of this.fields)if("oid"===r.type||this._layer.objectIdField===r.name)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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=l.zl.Standardised,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 l.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_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 r of this.fields)t[r.name]=e.attributes[r.name];return new i.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){let n="",c=!1;if(null!==i&&(n=i.constructClause(),c=!0),this.isTable()&&t&&null!==e&&""!==e)return new a.A([],[],!0,null);const d=this._createQuery();d.where=(0,u.mA)(d.where,null===r?null===t?"1=1":"":(0,o.YY)(r,l.zl.Standardised)),d.spatialRelationship=this._makeRelationshipEnum(e),d.outSpatialReference=this.spatialReference,d.orderByFields=""!==n?n.split(","):null,d.geometry=null===t?null:t,d.relationParameter=this._makeRelationshipParam(e);const h=await this._layer.queryFeatures(d);if(null===h)return new a.A([],[],c,null);this._checkCancelled(s);const p=[];return h.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];p.push(t),this._featureCache[t]=this._changeFeature(e)})),new a.A([],p,c,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 r=t.attributes[this._layer.objectIdField];e.push(r),this._featureCache[r]=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),r=[];return t.features.forEach((e=>{const t=e.attributes[this._layer.objectIdField];r.push(t),this._featureCache[t]=this._changeFeature(e)})),this._wset=new a.A([],r,!1,null),this._wset}async _getFeatures(e,t,r){const i=[];-1!==t&&void 0===this._featureCache[t]&&i.push(t);for(let s=e._lastFetchedIndex;s<e._known.length&&(e._lastFetchedIndex+=1,!(void 0===this._featureCache[e._known[s]]&&(e._known[s]!==t&&i.push(e._known[s]),i.length>r)));s++);if(0===i.length)return"success";throw new s.dr(s.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 r in e)t[r]=e[r];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 r=e.layerDefinition.objectIdField;const i=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const t of e.layerDefinition.types)s.push(h.A.fromJSON(t));let n=e.layerDefinition.geometryType;void 0===n&&(n=e.featureSet.geometryType||"");let a=e.featureSet.features;const l=t.toJSON();if(!r){let t=!1;for(const i of e.layerDefinition.fields)if("oid"===i.type||"esriFieldTypeOID"===i.type){r=i.name,t=!0;break}if(!1===t){let t="FID",i=!0,s=0;for(;i;){let r=!0;for(const i of e.layerDefinition.fields)if(i.name===t){r=!1;break}!0===r?i=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const n=[];for(let r=0;r<a.length;r++)n.push({geometry:e.featureSet.features[r].geometry,attributes:e.featureSet.features[r].attributes?this._cloneAttr(e.featureSet.features[r].attributes):{}}),n[r].attributes[t]=r;a=n,r=t}}const o=[];for(const t of e.layerDefinition.fields)t instanceof p.A?o.push(t):o.push(p.A.fromJSON(t));let u=n;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:s,typeIdField:i,objectIdField:r,spatialReference:t},_="esriGeometryNull"===u||null===u;_||(y.geometryType=u);const g=new d.default(y);return e?.layerDefinition?.subtypeField&&e?.layerDefinition?.subtypes&&g.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new f({layer:g,spatialReference:t,isTable:_})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();t.where=this.objectIdField+"="+e.toString();const r=await this._layer.queryFeatures(t);return 1===r.features.length?r.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,r)=>{r.d(t,{BI:()=>_,D3:()=>f,XJ:()=>y,lc:()=>p,mX:()=>m,rU:()=>g,tH:()=>S});var i=r(799);const s="__begin__",n="__end__",a=new RegExp(s,"ig"),l=new RegExp(n,"ig"),o=new RegExp("^"+s,"i"),u=new RegExp(n+"$","i"),c='"',d=c+" + ",h=" + "+c;function p(e){return e.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function f(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=p(e.labelExpression),t.type="conventional"),t}function _(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 g(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,i.HC)(e,(e=>s+'$feature["'+e+'"]'+n)),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,F=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,b=/^\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=F.exec(e)||b.exec(e);return t?t[1]||t[3]:(t=I.exec(e),t?t[2]:null)}},32756:(e,t,r)=>{r.d(t,{Rr:()=>o,fY:()=>c,ne:()=>u});var i=r(90237),s=r(93637),n=r(10107),a=(r(44208),r(53966),r(87811),r(40608)),l=r(91880);function o(e,t,r){if(!e)return null;const i=e.find((e=>!!e.field));if(!i)return null;const s=new l.A;return s.read(i,r),[s]}const u={type:[l.A],json:{origins:{"web-scene":{write:!1,read:!1}},name:"layerDefinition.orderBy",read:{reader:o},write:{writer:function(e,t,r,i){const n=e.find((e=>!!e.field));n&&(0,s.sM)(r,[n.toJSON()],t)}}}},c=e=>{let t=class extends e{constructor(){super(...arguments),this.orderBy=null}};return(0,i._)([(0,n.MZ)(u)],t.prototype,"orderBy",void 0),t=(0,i._)([(0,a.$)("esri.layers.mixins.OrderedLayer")],t),t}},33143:(e,t,r)=>{r.d(t,{A:()=>h});var i=r(90237),s=r(69540),n=r(25482),a=r(10107),l=(r(44208),r(53966),r(87811),r(36005)),o=r(40608),u=r(43937),c=r(80451),d=r(29005);let h=class extends(s.A.ClonableMixin(n.A)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const r of Object.keys(e))t[r]=(0,c.rS)(e[r]);return t}writeDomains(e,t){const r={};for(const t of Object.keys(e))e[t]&&(r[t]=e[t]?.toJSON());t.domains=r}};(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"id",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"name",void 0),(0,i._)([(0,a.MZ)({json:{write:!0}})],h.prototype,"domains",void 0),(0,i._)([(0,l.w)("domains")],h.prototype,"readDomains",null),(0,i._)([(0,u.K)("domains")],h.prototype,"writeDomains",null),(0,i._)([(0,a.MZ)({type:[d.A],json:{write:!0}})],h.prototype,"templates",void 0),h=(0,i._)([(0,o.$)("esri.layers.support.FeatureType")],h)},35704:(e,t,r)=>{r.d(t,{A:()=>d});var i=r(87449),s=r(11221),n=r(89169),a=r(33325),l=r(80609),o=r(74887),u=r(88368),c=r(16930);class d extends s.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 n.A(t._candidates.slice().concat(t._known.slice()),[],t._ordered,this._clonePageDefinition(t.pagesDefinition)):this._wset=new n.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 t===a.J6.NotInFeatureSet?t:(t=this._idstates[e],void 0===t?a.J6.Unknown:t)}_getFeature(e,t,r){return this._parent._getFeature(e,t,r)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_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,r){const i=new n.A([],e,!1,null),s=Math.min(t,e.length);if(await(this._parent?._getFeatures(i,-1,s,r)),this._checkCancelled(r),null==this._whereClauseFunction){for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);!0===this.executeWhereClause(r)?this._idstates[e[t]]=a.J6.InFeatureSet:this._idstates[e[t]]=a.J6.NotInFeatureSet}return"success"}const l=[];for(let t=0;t<s;t++){const r=this._parent?._featureFromCache(e[t]);l.push(await this.executeWhereClauseDeferred(r))}for(let r=0;r<t;r++)!0===l[r]?this._idstates[e[r]]=a.J6.InFeatureSet:this._idstates[e[r]]=a.J6.NotInFeatureSet;return"success"}async _getFilteredSet(e,t,r,i,s){null!==this._whereClauseFunction||(null!==r?null!==this._whereclause&&(r=(0,l.kg)(this._whereclause,r)):r=this._whereclause),await this._ensureLoaded();const a=await this._parent._getFilteredSet(e,t,r,i,s);let o;return this._checkCancelled(s),o=null!==this._whereClauseFunction?new n.A(a._candidates.slice().concat(a._known.slice()),[],a._ordered,this._clonePageDefinition(a.pagesDefinition)):new n.A(a._candidates.slice(),a._known.slice(),a._ordered,this._clonePageDefinition(a.pagesDefinition)),o}async _stat(e,t,r,i,s,n,a){if(null!==this._whereClauseFunction)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};let o=this._whereclause;null!==s&&null!==this._whereclause&&(o=(0,l.kg)(this._whereclause,s));const u=await this._parent._stat(e,t,r,i,o,n,a);return!1===u.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:u}async _canDoAggregates(e,t,r,i,s){return null===this._whereClauseFunction&&(null!==s?null!==this._whereclause&&(s=(0,l.kg)(this._whereclause,s)):s=this._whereclause,null!==this._parent&&this._parent._canDoAggregates(e,t,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o){if(null===this._parent)throw new i.dr(i.D_.NeverReach);return null!==n?null!==this._whereclause&&(n=(0,l.kg)(this._whereclause,n)):n=this._whereclause,this._parent._getAggregatePagesDataSourceDefinition(e,t,r,s,n,a,o)}static registerAction(){s.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,r)=>{r.d(t,{C_:()=>h,OH:()=>y,Vh:()=>_,on:()=>d,pc:()=>g,wB:()=>o,z7:()=>u});var i=r(37955),s=r(36563),n=r(97768),a=r(74887),l=r(14012);function o(e,t,r={}){return c(e,t,r,p)}function u(e,t,r={}){return c(e,t,r,f)}function c(e,t,r={},i){let s=null;const a=r.once?(e,r)=>{i(e)&&((0,n.xt)(s),t(e,r))}:(e,r)=>{i(e)&&t(e,r)};if(s=(0,l.Cn)(e,a,r.sync,r.equals),r.initial){const t=e();a(t,t)}return s}function d(e,t,r,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,n.xt)(c),r(e)}const p=o(e,((e,r)=>{d(),(0,i.wb)(e)&&(l=e,u=(0,i.on)(e,t,h),a.onListenerAdd?.(e))}),{sync:a.sync,initial:!0});return c=(0,s.hA)((()=>{p.remove(),d()})),c}function h(e,t){return function(e,t,r){if((0,a.G4)(r))return Promise.reject((0,a.NK)());const i=e();if(t?.(i))return Promise.resolve(i);let l=null;function o(){l=(0,n.xt)(l)}return new Promise(((i,n)=>{l=(0,s.vE)([(0,a.u7)(r,(()=>{o(),n((0,a.NK)())})),c(e,(e=>{o(),i(e)}),{sync:!1,once:!0},t??p)])}))}(e,f,t)}function p(e){return!0}function f(e){return!!e}r(80559);const y={sync:!0},_={initial:!0},g={sync:!0,initial:!0}},39516:(e,t,r)=>{let i;async function s(){return null==i&&(i=Promise.all([r.e(8368),r.e(4123)]).then(r.bind(r,44123)).then((e=>new e.WhereClauseCache(500,500)))),i}async function n(e,t){const r=await s(),i=r.get(e,t);if(null==i)throw r.getError(e,t);return i}function a(e,t){return e||=null,t||=null,"1=1"===e?t??e:"1=1"===t?e??t:e&&t?`(${e}) AND (${t})`:e??t}function l(e,t){return e||=null,t||=null,"1=1"===e||"1=1"===t||e===t?"1=1"===e?e:t:e&&t?`(${e}) OR (${t})`:e??t}r.d(t,{GP:()=>n,IW:()=>l,mA:()=>a})},40334:(e,t,r)=>{r.r(t),r.d(t,{constructAssociationMetaDataFeatureSetFromUrl:()=>se,constructFeatureSet:()=>re,constructFeatureSetFromPortalItem:()=>de,constructFeatureSetFromRelationship:()=>ne,constructFeatureSetFromUrl:()=>te,convertToFeatureSet:()=>ce,createFeatureSetCollectionFromMap:()=>oe,createFeatureSetCollectionFromService:()=>ue,initialiseMetaDataCache:()=>X});var i=r(78888);class s{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection",this._layerById={},this._layerByName={}}add(e,t,r){this._layerById[t]=r,this._layerByName[e]=r}async featureSetByName(e,t=!0,r=["*"]){return void 0===this._layerByName[e]?null:this._layerByName[e]}async featureSetById(e,t=!0,r=["*"]){return void 0===this._layerById[e]?null:this._layerById[e]}castToText(e=!1){return"object, FeatureSetCollection"}}var n=r(78878),a=r(35704),l=r(52106),o=r(59534),u=r(68423),c=r(86691),d=r(87449),h=r(11221),p=r(89169),f=r(87594),y=r(33325),_=r(80609),g=r(1262),m=r(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,r,i){const s=new w;s.field=e;const n=m.A.create(t,{fieldsIndex:r,timeZone:i}),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 g.L8(g.Z7.MissingStatisticParameters);const t=m.A.create((0,_.Mi)(e.parseTree.args.value[0],y.zl.Standardised,e.parameters),{fieldsIndex:e.fieldsIndex,timeZone:e.timeZone,currentUser:e.currentUser});return{name:e.parseTree.name,expr:t}}return null}(n);if(null===a)throw new g.L8(g.Z7.UnsupportedSqlFunction,{function:""});const l=a.name.toUpperCase().trim();if("MIN"===l){if(s.typeofstat="MIN",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"min"})}else if("MAX"===l){if(s.typeofstat="MAX",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"max"})}else if("COUNT"===l)s.typeofstat="COUNT",s.workingexpr=a.expr;else if("STDEV"===l){if(s.typeofstat="STDDEV",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"stdev"})}else if("SUM"===l){if(s.typeofstat="SUM",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"sum"})}else if("MEAN"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:l})}else if("AVG"===l){if(s.typeofstat="AVG",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"avg"})}else{if("VAR"!==l)throw new g.L8(g.Z7.UnsupportedSqlFunction,{function:l});if(s.typeofstat="VAR",s.workingexpr=a.expr,null===n)throw new g.L8(g.Z7.InvalidFunctionParameters,{function:"var"})}return s}toStatisticsName(){switch(this.typeofstat.toUpperCase()){case"MIN":return"min";case"MAX":return"max";case"SUM":return"sum";case"COUNT":default:return"count";case"VAR":return"var";case"STDDEV":return"stddev";case"AVG":return"avg"}}}var F=r(53966),b=r(80200),I=r(74639),S=r(44729),A=r(55612),v=r(15032),T=r(16930),x=r(20437),C=r(95466);const D=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 y.J6.InFeatureSet}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e={};let t=!1,r=1;const i=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"+r.toString(),r++)}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:i,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=D.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:i,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 T.A({wkid:4326});this.fields=[];const s=new w;s.field=this._nextUniqueName(e),s.tofieldname=this.objectIdField,s.workingexpr=m.A.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),s.typeofstat="MIN",this._decodedStatsfield.push(s);for(const t of this._decodedGroupbyfield){const r=new x.A;if(t.name=this._nextUniqueName(e),r.name=t.tofieldname,r.alias=r.name,(0,_.DA)(t.expression)){const e=this._parent.getField((0,_.YY)(t.expression,y.zl.Standardised));if(!e)throw new d.dr(d.D_.AggregationFieldNotFound);t.name=e.name,t.singlefield=e.name,this.phsyicalgroupbyfields.push(e.name),r.type=e.type,t.sqlType=e.type}else{r.type=this._convertToEsriFieldType((0,_.IY)(t.expression,this._parent.fields));const e=new x.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=r.type}this.fields.push(r)}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 r=new x.A;let i=null;const s=this._decodedStatsfield[t];s.field=this._nextUniqueName(e),s.tofieldname===this.objectIdField&&(this._internalObjectIdField=s.field),r.name=s.tofieldname,r.alias=r.name;const n=null!==s.workingexpr&&(0,_.DA)(s.workingexpr)?(0,_.YY)(s.workingexpr,y.zl.Standardised):"";switch(this._decodedStatsfield[t].typeofstat){case"SUM":if(""!==n){if(i=this._parent.getField(n),!i)throw new d.dr(d.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"MIN":case"MAX":if(""!==n){if(i=this._parent.getField(n),!i)throw new d.dr(d.D_.AggregationFieldNotFound);r.type=i.type}else r.type="double";break;case"COUNT":r.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==n&&(i=this._parent.getField(n),!i))throw new d.dr(d.D_.AggregationFieldNotFound);r.type="double"}this.fields.push(r)}}async _canDoAggregates(){return!1}async _getFeatures(e,t,r,i){-1!==t&&this._featureCache[t];const s=this._maxQuery;return!0===this._checkIfNeedToExpandKnownPage(e,s)?(await this._expandPagedSet(e,s,0,0,i),this._getFeatures(e,t,r,i)):"success"}async _getFilteredSet(e,t,r,i,s){if(""!==e)return new p.A([],[],!0,null);let n=null;const l={ordered:!1,nowhereclause:!1};if(await this._ensureLoaded(),null!==r)for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===(0,_.Ju)(r,this._decodedStatsfield[e].tofieldname)){l.nowhereclause=!0,r=null;break}if(null!==i){l.ordered=!0;for(let e=0;e<this._decodedStatsfield.length;e++)if(!0===i.scanForField(this._decodedStatsfield[e].tofieldname)){i=null,l.ordered=!1;break}if(null!==i)for(const e of this._decodedGroupbyfield)if(null===e.singlefield&&!0===i.scanForField(e.tofieldname)){i=null,l.ordered=!1;break}}if(!1!==this._candosimplegroupby&&await this._parent._canDoAggregates(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,null)){let e=null;r&&(e=this._reformulateWhereClauseWithoutGroupByFields(r));let t=null;i&&(t=this._reformulateOrderClauseWithoutGroupByFields(i));const a=await this._parent._getAggregatePagesDataSourceDefinition(this.phsyicalgroupbyfields,this._decodedStatsfield,"",null,e,t,this._internalObjectIdField);return this._checkCancelled(s),n=!0===l.nowhereclause?new p.A(a._candidates.slice().concat(a._known.slice()),[],!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)):new p.A(a._candidates.slice(),a._known.slice(),!0===l.ordered&&a._ordered,this._clonePageDefinition(a.pagesDefinition)),n}let o=this._parent;if(this._adaptedFields.length>0&&(o=new u.a({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null})),!0===l.nowhereclause)n=new p.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 f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}});else{let e=o;if(null!==r){let t=null;r&&(t=this._reformulateWhereClauseWithoutGroupByFields(r)),e=new a.A({parentfeatureset:e,whereclause:t})}n=new p.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 f.A(this.phsyicalgroupbyfields.join(",")+","+this._parent.objectIdField+" ASC")})}})}return n}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsfield)e=(0,_.bD)(e,t.tofieldname,(0,_.YY)(t.workingexpr,y.zl.Standardised),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupbyfield)t.tofieldname!==t.name&&(e=(0,_.bD)(e,t.tofieldname,(0,_.YY)(t.expression,y.zl.Standardised),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const e of this._decodedGroupbyfield)e.tofieldname!==e.name&&t.push({field:e.tofieldname,newfield:e.name});return t.length>0?e.replaceFields(t):e}_clonePageDefinition(e){return null===e?null:!0===e.aggregatefeaturesetpagedefinition?{aggregatefeaturesetpagedefinition:!0,resultRecordCount:e.resultRecordCount,resultOffset:e.resultOffset,internal:e.internal}:this._parent._clonePageDefinition(e)}async _refineSetBlock(e,t,r){return!0===this._checkIfNeedToExpandCandidatePage(e,this._maxQuery)?(await this._expandPagedSet(e,this._maxQuery,0,0,r),this._refineSetBlock(e,t,r)):(this._checkCancelled(r),e._candidates.length,this._refineKnowns(e,t),e._candidates.length,e._candidates.length,e)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getPhysicalPage(e,t,r){if(!0===e.pagesDefinition.aggregatefeaturesetpagedefinition)return this._sequentialGetPhysicalItem(e,e.pagesDefinition.resultRecordCount,r,[]);const i=await this._getAgregagtePhysicalPage(e,t,r);for(const e of i){const t={geometry:e.geometry,attributes:{}},r={};for(const t in e.attributes)r[t.toLowerCase()]=e.attributes[t];for(const e of this._decodedGroupbyfield)t.attributes[e.tofieldname]=r[e.name.toLowerCase()];for(const e of this._decodedStatsfield)t.attributes[e.tofieldname]=r[e.field.toLowerCase()];if(null!=this._featureCache[t.attributes[this.objectIdField]])throw F.A.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${t.attributes[this.objectIdField]}`),new d.dr(d.D_.NeverReach);this._featureCache[t.attributes[this.objectIdField]]=new l.A(t)}return i.length}_sequentialGetPhysicalItem(e,t,r,i){return new Promise(((s,n)=>{null===e.pagesDefinition.internal.iterator&&(e.pagesDefinition.internal.iterator=e.pagesDefinition.internal.subfeatureset.iterator(r)),!0===e.pagesDefinition.internal.fullyResolved||0===t?s(i.length):this._nextAggregateItem(e,t,r,i,(n=>{null===n?s(i.length):(t-=1,s(this._sequentialGetPhysicalItem(e,t,r,i)))}),n)}))}_nextAggregateItem(e,t,r,i,s,a){try{(0,n.a0)(e.pagesDefinition.internal.iterator.next()).then((n=>{if(null===n)if(null!==e.pagesDefinition.internal.workingItem){const t=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);i.push(t),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(t.attributes[this.objectIdField]),e.pagesDefinition.internal.fullyResolved=!0,s(null)}else e.pagesDefinition.internal.fullyResolved=!0,s(null);else{const l=this._generateAggregateHash(n);if(null===e.pagesDefinition.internal.workingItem)e.pagesDefinition.internal.workingItem={features:[n],id:l};else{if(l!==e.pagesDefinition.internal.workingItem.id){const r=this._calculateAndAppendAggregateItem(e.pagesDefinition.internal.workingItem);return i.push(r),e.pagesDefinition.internal.workingItem=null,e.pagesDefinition.internal.set.push(r.attributes[this.objectIdField]),t-=1,e.pagesDefinition.internal.workingItem={features:[n],id:l},void s(r)}e.pagesDefinition.internal.workingItem.features.push(n)}this._nextAggregateItem(e,t,r,i,s,a)}}),a)}catch(e){a(e)}}_calculateFieldStat(e,t,r){const i=[];for(const r of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(r);null!==e&&(e instanceof S.n||e instanceof v.k?i.push(e.toNumber()):e instanceof A.g?i.push(e.toMilliseconds()):i.push(e))}else i.push(null);r.attributes[t.tofieldname]=(0,I.s)(t.typeofstat,[i])}_calculateAndAppendAggregateItem(e){const t={attributes:{},geometry:null};for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.features[0].attributes[r.singlefield]:m.A.convertValueToStorageFormat(r.expression.calculateValue(e.features[0]),r.sqlType);t.attributes[r.tofieldname]=i}for(const r of this._decodedStatsfield)this._calculateFieldStat(e,r,t);const r=[];for(let i=0;i<this._decodedStatsfield.length;i++)r.push(this._calculateFieldStat(e,this._decodedStatsfield[i],t));if(null!=this._featureCache[t.attributes[this.objectIdField]])throw F.A.getLogger("esri.arcade.featureset.actions.GroupBy").error(`Duplicate object id returned: ${t.attributes[this.objectIdField]}`),new d.dr(d.D_.NeverReach);return this._featureCache[t.attributes[this.objectIdField]]=new l.A({attributes:t.attributes,geometry:t.geometry}),t}_generateAggregateHash(e){let t="";for(const r of this._decodedGroupbyfield){const i=r.singlefield?e.attributes[r.singlefield]:r.expression.calculateValue(e);t+=null==i?":":":"+i.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=r(54784),L=r(54461),N=r(70333),E=r(61454),P=r(66395),O=r(50145),j=r(4576),M=r(39516),G=r(65864),U=r(21325),B=r(13600),q=r(54546),Z=r(61956),W=r(7562);class V 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 r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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=y.zl.StandardisedNoInterval,null!=e&&e>=10.61&&(this._databaseType=y.zl.Standardised)):null!=e&&(e>=10.5&&(this._databaseType=y.zl.StandardisedNoInterval,this._requestStandardised=!0),e>=10.61&&(this._databaseType=y.zl.Standardised))}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 y.J6.InFeatureSet}async _refineSetBlock(e){return e}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new Z.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 r="execute"===t?this._layer.queryFeatures.bind(this._layer):"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this.recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this.recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this.recentlyUsedQueries.addToCache(t,i),i=i.catch((e=>{throw this.recentlyUsedQueries?.removeFromCache(t),e})))}return this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}async _getFilteredSet(e,t,r,i,s){const n=await this.databaseType();if(this.isTable()&&t&&null!==e&&""!==e)return new p.A([],[],!0,null);if(this._canUsePagination())return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=this._createQuery();o.where=(0,M.mA)(o.where,null===r?null===t?"1=1":"":(0,_.YY)(r,n)),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(s),new p.A([],u,l,null)}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;null!==i&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(n=i.constructClause(),a=!0);const l=await this.databaseType(),o=null===r?null===t?"1=1":"":(0,_.YY)(r,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 p.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:n,returnGeometry:!1,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}});else{let r=!0;!0===this._removeGeometry&&(r=!1);const i=this._overrideFields??this._fieldsIncludingObjectId(["*"]);d=new p.A([],["GETPAGES"],a,{spatialRel:this._makeRelationshipEnum(e),relationParam:this._makeRelationshipParam(e),outFields:i.join(","),resultRecordCount:u,resultOffset:0,geometry:null===t?null:t,where:o,orderByFields:n,returnGeometry:r,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}})}return await this._expandPagedSet(d,u,0,1,s),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,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=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,M.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(r),e.pagesDefinition.internal.lastPage!==n)return"done";const o=this._layer.objectIdField;for(let t=0;t<l.features.length;t++)e.pagesDefinition.internal.set[s+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=i+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 r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFeatures(e,t,r,i){const s=[];if(-1!==t&&void 0===this._featureCache[t]&&s.push(t),!0===this._checkIfNeedToExpandKnownPage(e,this._maxProcessingRate()))return await this._expandPagedSet(e,this._maxProcessingRate(),0,0,i),this._getFeatures(e,t,r,i);let n=0;for(let i=e._lastFetchedIndex;i<e._known.length;i++){if(e._lastFetchedIndex+=1,n++,void 0===this._featureCache[e._known[i]]){let r=!1;if(null!==this._layer._mode&&void 0!==this._layer._mode){const t=this._layer._mode;if(void 0!==t._featureMap[e._known[i]]){const s=t._featureMap[e._known[i]];null!==s&&(r=!0,this._featureCache[e._known[i]]=s)}}if(!1===r&&(e._known[i]!==t&&s.push(e._known[i]),s.length>=this._maxProcessingRate()-1))break}if(n>=r&&0===s.length)break}if(0===s.length)return"success";const a=this._createQuery();a.objectIds=s,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(i),void 0!==l.error)throw new d.dr(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,r,i,s,n,a,l,o){await this._ensureLoaded();const u=await this.databaseType();let c=r.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 p=this._createQuery();p.where=(0,M.mA)(p.where,null===n?null===s?"1=1":"":(0,_.YY)(n,u)),p.spatialRelationship=this._makeRelationshipEnum(i),p.relationParameter=this._makeRelationshipParam(i),p.geometry=null===s?null:s,p.returnDistinctValues=!0,p.returnGeometry=!1,p.outFields=[c];const f=await this.executeQuery(p,"execute");if(this._checkCancelled(o),!f.hasOwnProperty("features"))throw new d.dr(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<f.features.length;e++){if(y){const t=f.features[e].attributes[c];null!==t?l.push(new Date(t)):l.push(t)}else l.push(f.features[e].attributes[c]);if(l.length>=a)break}return 0===f.features.length?l:f.features.length===this._layer.capabilities?.query.maxRecordCount&&l.length<a?{calculated:!0,result:await this._getDistinctPages(e+f.features.length,t,r,i,s,n,a,l,o)}:l}async _distinctStat(e,t,r,i,s,n,a){return{calculated:!0,result:await this._getDistinctPages(0,e,t,r,i,s,n,[],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,r,i){const s=await this.databaseType();if(this.isTable()&&r&&null!==t&&""!==t)return{calculated:!0,result:0};const n=this._createQuery();return n.where=(0,M.mA)(n.where,null===i?null===r?"1=1":"":(0,_.YY)(i,s)),n.spatialRelationship=this._makeRelationshipEnum(t),n.relationParameter=this._makeRelationshipParam(t),n.geometry=null===r?null:r,n.returnGeometry=!1,{calculated:!0,result:await this.executeQuery(n,"executeForCount")}}async _stats(e,t,r,i,s,n,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,r,i,s):{calculated:!1};if(!1===u||!1===(0,_.DA)(t)&&!1===o||!1===t.isStandardized)return""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a);if("distinct"===e)return!1===c?""!==r||null!==s?{calculated:!1}:this._manualStat(e,t,n,a):this._distinctStat(e,t,r,i,s,n,a);const h=await this.databaseType();if(this.isTable()&&i&&null!==r&&""!==r)return{calculated:!0,result:null};const p=this._createQuery();p.where=(0,M.mA)(p.where,null===s?null===i?"1=1":"":(0,_.YY)(s,h)),p.spatialRelationship=this._makeRelationshipEnum(r),p.relationParameter=this._makeRelationshipParam(r),p.geometry=null===i?null:i;const f=new W.A;f.statisticType=(0,O.Dp)(e),f.onStatisticField=(0,_.YY)(t,h),f.outStatisticFieldName="ARCADE_STAT_RESULT",p.returnGeometry=!1;let y="ARCADE_STAT_RESULT";p.outStatistics=[f];const g=await this.executeQuery(p,"execute");if(!g.hasOwnProperty("features")||0===g.features.length)throw new d.dr(d.D_.InvalidStatResponse);let m=!1;const w=g.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=g.features[0].attributes[y];return null!==e&&(e=new Date(g.features[0].attributes[y])),{calculated:!0,result:e}}return{calculated:!0,result:g.features[0].attributes[y]}}_stat(e,t,r,i,s,n,a){return this._stats(e,t,r,i,s,n,a)}async _canDoAggregates(e,t){await this._ensureLoaded();let r=!1;const i=this._layer.capabilities?.query,s=!0===i?.supportsSqlExpression;if(null!=i&&!0===i.supportsStatistics&&!0===i.supportsOrderBy&&(r=!0),r)for(let e=0;e<t.length-1;e++)(!1===t[e].workingexpr?.isStandardized||!1===(0,_.DA)(t[e].workingexpr)&&!1===s)&&(r=!1);return!1!==r}_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,r,i,s,n,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,r)=>({name:t.normalizeFieldName(e)??e,asc:null==n||1===n._directions[r]})))}}let u="",c=!1;null!=n&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==o||(0,j.MJ)(e,0,e.length,n._fields,0,Math.min(n._fields.length,e.length),((e,t)=>e.toLowerCase()===t.toLowerCase())))&&(u=n.constructClause(),c=!0),""===u&&(u=e.join(","));const d=[];for(let e=0;e<t.length;e++){const r=new W.A;r.onStatisticField=null!==t[e].workingexpr?(0,_.YY)(t[e].workingexpr,l):"",r.outStatisticFieldName=t[e].field,r.statisticType=t[e].toStatisticsName(),d.push(r)}let h=this._maxQueryRate();const f=this._layer.capabilities?.query.maxRecordCount;null!=f&&f<h&&(h=f);const y=null===s?null===i?"1=1":"":(0,_.YY)(s,l);return new p.A([],["GETPAGES"],c,{groupbypage:!0,spatialRel:this._makeRelationshipEnum(r),relationParam:this._makeRelationshipParam(r),outFields:["*"],useOIDpagination:!1,generatedOid:a,resultRecordCount:h,resultOffset:0,groupByFieldsForStatistics:e,outStatistics:d,geometry:null===i?null:i,where:y,orderByFields:u,returnGeometry:!1,returnIdsOnly:!1,internal:{lastMaxId:-1,set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1,keysetPagination:o}})}async _getAgregagtePhysicalPage(e,t,r){let i=e.pagesDefinition.where;if(!0===e.pagesDefinition.useOIDpagination&&(i=(0,M.mA)(i,e.pagesDefinition.generatedOid+">"+e.pagesDefinition.internal.lastMaxId.toString())),null!=e.pagesDefinition.internal.keysetPagination?.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new d.dr(d.D_.NotImplemented);i=(0,M.mA)(i,(0,_.YY)(e.pagesDefinition.internal.keysetPagination.clause,await this.databaseType()))}const s=e.pagesDefinition.internal.lastRetrieved,n=s,a=e.pagesDefinition.internal.lastPage,o=this._createQuery();if(o.where=(0,M.mA)(o.where,i),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(r),!u.hasOwnProperty("features"))throw new d.dr(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[n+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.dr(d.D_.NeverReach);const t=[];for(let r=0;r<e.length;r++){const i=e[r],s=[`"${i.name.replace('"','""')}" ${i.asc?">":"<"} @last_${r}`];for(let t=0;t<r;t++){const r=e[t];s.push(`"${r.name.replace('"','""')}" = @last_${t}`)}t.push(s.join(" AND "))}const r=t.join(" OR ");return m.A.create(r)}(e.keyFields));for(let r=0;r<e.keyFields.length;r++){const i=e.keyFields[r].name;e.clause.parameters[`last_${r}`]=t.attributes[i]}}(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=s+u.features.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,c}static create(e,t,r,i,s){const n=new B.default({url:e,outFields:null===t?["*"]:t});return new V({layer:n,spatialReference:r,lrucache:i,interceptor:s})}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,r,i,s){const n=this._layer;if(function(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}(n)){const a={objectIds:[e],returnMetadata:s};(t&&t>0||r&&r>0)&&(a.size=[t&&t>0?t:0,r&&r>0?r:t+1]),i&&i.length>0&&(a.attachmentTypes=i),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:n,query:a,method:"attachments"});const l=await n.queryAttachments(new q.A(a)),o=[];return l&&l[e]&&l[e].forEach((t=>{const r=this._layer.parsedUrl.path+"/"+e.toString()+"/attachments/"+t.id.toString();let i=null;s&&t.exifInfo&&(i=P.A.convertJsonToArcade(t.exifInfo,"system",!0)),o.push(new E.A(t.id,t.name,t.contentType,t.size,r,i,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,U.YX)(e.outSpatialReference)),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:t,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const r=await(0,i.A)(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:t});if(r.data){const e={},t=r.data;if(t?.relatedRecordGroups){const r=t.spatialReference;for(const i of t.relatedRecordGroups){const s=i.objectId,n=[];for(const e of i.relatedRecords){e.geometry&&(e.geometry.spatialReference=r);const t=new l.A({geometry:e.geometry?(0,G.rS)(e.geometry):null,attributes:e.attributes});n.push(t)}e[s]={features:n,exceededTransferLimit:!0===t.exceededTransferLimit}}}return e}throw new d.dr(d.D_.InvalidRequest)}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=(0,M.mA)(r.where,this.objectIdField+"="+e.toString()),this.featureSetQueryInterceptor&&this.featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.queryFeatures(r);return 1===i.features.length?i.features[0]:null}async getIdentityUser(){await this.load();const e=N.id?.findCredential(this._layer.url);return e?e.userId:null}async getOwningSystemUrl(){await this.load();const e=N.id?.findServerInfo(this._layer.url);if(e)return e.owningSystemUrl;let t=this._layer.url;const r=t.toLowerCase().indexOf("/rest/services");if(t=r>-1?t.slice(0,r):t,t){t+="/rest/info";try{const e=await(0,i.A)(t,{query:{f:"json"}});let r="";return e.data?.owningSystemUrl&&(r=e.data.owningSystemUrl),r}catch(e){return""}}return""}getDataSourceFeatureSet(){const e=new V({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 r=this._layer.parsedUrl?.path??null;if(r){const s=await(0,i.A)(r,{responseType:"json",query:{f:"json"}});e=s?.data?.name??null,t=s?.data?.serviceItemId??null}const s=this._layer.title&&null!==(this._layer.parent??null);return this.featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===t?null:t,serviceLayerUrl:""===r?null:r,webMapLayerId:s?this._layer.id??null:null,webMapLayerTitle:s?this._layer.title??null:null,className:null,objectClassId:null},this.fsetInfo}}var Q=r(30235),J=r(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 r of this.fields)if("oid"===r.type)e.push(r),t.push(r.name);else for(const i of this._overrideFields)if(i.toLowerCase()===r.name.toLowerCase()){e.push(r),t.push(r.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 y.J6.InFeatureSet}_candidateIdTransform(e){return e}async _getSet(e){if(null===this._wset){await this._ensureLoaded();const t=await this._getFilteredSet("",null,null,null,e);return this._wset=t,t}return this._wset}_changeFeature(e){const t={};for(const r of this.fields)t[r.name]=e.attributes[r.name];return new l.A({geometry:!0===this._removeGeometry?null:e.geometry,attributes:t})}async _getFilteredSet(e,t,r,i,s){if(await this.databaseType(),this.isTable()&&t&&null!==e&&""!==e)return new p.A([],[],!0,null);const n=this._layer.nativeCapabilities();if(!1===n.canQueryRelated)return new p.A([],[],!0,null);if(n.capabilities?.queryRelated.supportsPagination)return this._getFilteredSetUsingPaging(e,t,r,i,s);let a="",l=!1;null!==i&&!0===n.capabilities?.queryRelated.supportsOrderBy&&(a=i.constructClause(),l=!0);const o=new J.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 n.source.queryRelatedFeatures(o);this._checkCancelled(s);const h=d[this._findObjectId]?d[this._findObjectId].features:[],f=[];for(let e=0;e<h.length;e++)this._featureCache[h[e].attributes[this._relatedLayer.objectIdField]]=h[e],f.push(h[e].attributes[this._relatedLayer.objectIdField]);const y=t&&null!==e&&""!==e,_=null!=r;return new p.A(y||_?f:[],y||_?[]:f,l,null)}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const e of t)if(e.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return!1===r&&t.push(this.objectIdField),t}async _getFilteredSetUsingPaging(e,t,r,i,s){let n="",a=!1;const l=this._layer.nativeCapabilities();null!==i&&!0===l.capabilities?.queryRelated.supportsOrderBy&&(n=i.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!=r;let h=null,f=!0;!0===this._removeGeometry&&(f=!1);const y=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map((e=>e.name)):["*"]);return h=new p.A(c||d?["GETPAGES"]:[],c||d?[]:["GETPAGES"],a,{outFields:y.join(","),resultRecordCount:o,resultOffset:0,objectIds:[this._findObjectId],where:"1=1",orderByFields:n,returnGeometry:f,returnIdsOnly:"false",internal:{set:[],lastRetrieved:0,lastPage:0,fullyResolved:!1}}),await this._expandPagedSet(h,o,0,0,s),h}_expandPagedSet(e,t,r,i,s){return this._expandPagedSetFeatureSet(e,t,r,i,s)}_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,r){const i=e.pagesDefinition.internal.lastRetrieved,s=i,n=e.pagesDefinition.internal.lastPage,a=this._layer.nativeCapabilities(),l=new J.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(r),e.pagesDefinition.internal.lastPage!==n)return 0;const u=o[this._findObjectId]?o[this._findObjectId].features:[];for(let t=0;t<u.length;t++)e.pagesDefinition.internal.set[s+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=i+u.length,e.pagesDefinition.internal.lastPage+=e.pagesDefinition.resultRecordCount,u.length}async _getFeatures(e,t,r,i){const s=[];-1!==t&&void 0===this._featureCache[t]&&s.push(t);const n=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,n))return await this._expandPagedSet(e,n,0,0,i),this._getFeatures(e,t,r,i);let a=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(a++,a<=r&&(e._lastFetchedIndex+=1),!("GETPAGES"!==e._known[i]&&void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>r)))&&!(a>=r&&0===s.length);i++);if(0===s.length)return"success";throw new d.dr(d.D_.MissingFeatures)}async _refineSetBlock(e,t,r){return e}async _stat(e,t,r,i,s,n,a){return{calculated:!1}}get gdbVersion(){return this._relatedLayer.gdbVersion}async _canDoAggregates(e,t,r,i,s){return!1}relationshipMetaData(){return this._relatedLayer.relationshipMetaData()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,r,i,s){return this._relatedLayer.queryAttachments(e,t,r,i,s)}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 $=r(23732),Y=r(92474),K=r(4146),H=r(80812);function X(){null===$.A.applicationCache&&($.A.applicationCache=new $.A)}async function ee(e,t,r){if($.A.applicationCache){const r=$.A.applicationCache.getLayerInfo(e);if(r){const i=await r;return new B.default({url:e,outFields:t,sourceJSON:i})}const i=new B.default({url:e,outFields:t}),s=(async()=>(await i.load(),i.sourceJSON))();if($.A.applicationCache){$.A.applicationCache.setLayerInfo(e,s);try{return await s,i}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}return await s,i}if(null!=r){const i=r.getCachedLayerMetadata(e);if(i){const r=await i;return new B.default({url:e,outFields:t,sourceJSON:r})}const s=new B.default({url:e,outFields:t}),n=(async()=>(await s.load(),s.sourceJSON))();r.setCachedLayerMetadata(e,n);try{return await n,s}catch(t){throw r.removeCachedLayerMetadata(e,n),t}}return new B.default({url:e,outFields:t})}async function te(e,t,r,i,s,n=null){return re(await ee(e,["*"],s),t,r,i,s,n)}function re(e,t=null,r=null,i=!0,s=null,n=null){switch(e.type){case"catalog-footprint":return re(e.parent,t,r,i,s,n);case"subtype-sublayer":{const a=re(e.parent,t,r,i,s,n);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 Q.A({layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const a={layer:e,spatialReference:t,outFields:r,includeGeometry:i,lrucache:s,interceptor:n};return!e.url&&e.source?new Q.A(a):new V(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 r=t.getCachedServiceMetadata(e);if(null!=r)return r}const r=(async()=>{const t=await(0,i.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,r);try{return await r}catch(t){throw $.A.applicationCache.clearLayerInfo(e),t}}if(null!=t){t.setCachedServiceMetadata(e,r);try{return await r}catch(i){throw t.removeCachedServiceMetadata(e,r),i}}return r}async function se(e,t,r){const s={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},n=await ie(e,null);if(s.metadata=n,void 0!==n.controllerDatasetLayers?.utilityNetworkLayerId&&null!==n.controllerDatasetLayers.utilityNetworkLayerId){if(n.layers)for(const e of n.layers)s.layerNameLkp[e.id]=e.name;if(n.tables)for(const e of n.tables)s.layerNameLkp[e.id]=e.name;const a=n.controllerDatasetLayers.utilityNetworkLayerId;s.networkId=a;const l=await async function(e,t){const r="QUERYDATAELEMTS:"+t.toString()+":"+e;if(null!==$.A.applicationCache){const e=$.A.applicationCache.getLayerInfo(r);if(null!==e)return e}const s=(async()=>{const r=await(0,i.A)(e+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([t.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new d.dr(d.D_.DataElementsNotFound)})();if(null!==$.A.applicationCache){$.A.applicationCache.setLayerInfo(r,s);try{return await s}catch(e){throw $.A.applicationCache.clearLayerInfo(r),e}}return s}(e,a);if(l){s.queryelem=l,s.queryelem?.dataElement&&void 0!==s.queryelem.dataElement.schemaGeneration&&(s.unVersion=s.queryelem.dataElement.schemaGeneration),s.lkp={},s.queryelem.dataElement.domainNetworks||(s.queryelem.dataElement.domainNetworks=[]);for(const e of s.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:s.layerNameLkp[t.layerId]??null};s.layerIdLookup.set(e.layerId,e),s.sourceIdLookup.set(e.sourceId,e),e.className&&(s.lkp[e.className]=e)}}if(s.queryelem.dataElement.terminalConfigurations)for(const e of s.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)s.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const n=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,i.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!==n.systemLayers?.associationsTableId&&null!==n.systemLayers.associationsTableId){let i=null;if(r&&s.unVersion<8){const r=[];s.unVersion>=4&&(r.push("STATUS"),r.push("PERCENTALONG")),i=await te(e+"/"+n.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...r],!1,null,null),await i.load(),s.unVersion>=4&&(i=i.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:i.getFieldsIndex(),timeZone:i.dateFieldsTimeZoneDefaultUTC})),await i.load())}return{lkp:s.lkp,associations:i,unVersion:s.unVersion,terminals:s.terminals,layerIdLookup:s.layerIdLookup,sourceIdLookup:s.sourceIdLookup}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:s.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function ne(e,t,r,i=null,s=null,n=!0,a=null,l=null){let o=e.serviceUrl();if(!o)return null;o="/"===o.charAt(o.length-1)?o+t.relatedTableId.toString():o+"/"+t.relatedTableId.toString();const u=await te(o,i,s,n,a,l);return new z({layer:e,relatedLayer:u,relationship:t,objectId:r,spatialReference:i,outFields:s,includeGeometry:n,lrucache:a,interceptor:l})}a.A.registerAction(),R.registerAction(),c.A.registerAction(),k.A.registerAction(),L.A.registerAction();class ae extends s{constructor(e,t=null,r=null,i=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,r=null){const i=re(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async featureSetByName(e,t=!0,r=null){if(Y.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,y.eB)(t)&&t.title===e));if(null!=s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,y.eB)(t)&&t.title===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){if(Y.A.isLoadable(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,r);null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=this._map.allLayers.find((t=>(0,y.eB)(t)&&t.id===e));if(s)return this._makeAndAddFeatureSet(s,t,r);if(this._map.allTables){const i=this._map.allTables.find((t=>(0,y.eB)(t)&&t.id===e));if(null!=i)return this._makeAndAddFeatureSet(i,t,r)}return null}}class le extends s{constructor(e,t=null,r=null,i=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=r,this._interceptor=i,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,r=null){const i=re(e,this._overrideSpatialReference,null===r?["*"]:r,t,this._lrucache);return this._instantLayers.push({featureset:i,opitem:e,includeGeometry:t,outFields:JSON.stringify(r)}),i}async _loadMetaData(){const e=await ie(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new le(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,r=null){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.title===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])t.name===e&&(n=t);if(!n)for(const t of s.tables??[])t.name===e&&(n=t);if(n){const e=await ee(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}async featureSetById(e,t=!0,r=["*"]){null===r&&(r=["*"]),r=(r=r.slice()).sort();const i=JSON.stringify(r);e=null!=e?e.toString():"";for(let r=0;r<this._instantLayers.length;r++){const s=this._instantLayers[r];if(s.opitem.id===e&&s.includeGeometry===t&&s.outFields===i)return this._instantLayers[r].featureset}const s=await this._loadMetaData();let n=null;for(const t of s.layers??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(!n)for(const t of s.tables??[])null!==t.id&&void 0!==t.id&&t.id.toString()===e&&(n=t);if(n){const e=await ee(this._url+"/"+n.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,r)}return null}}function oe(e,t,r=null,i=null){return new ae(e,t,r,i)}function ue(e,t,r=null,i=null){return new le(e,t,r,i)}function ce(e,t,r,i,s){if(null===e)return null;if((0,n.p)(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof K.A&&(0,y.NI)(e)){const n=e;switch(t){case"datasource":return re(n,s,"outFields"in n?n.outFields:null,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return re(n,s,"outFields"in n?n.outFields:null,!0,r,i)}return null}if((0,n.$)(e)){switch(t){case"datasource":return re(e.parent,s,e.parent.outFields,!0,r,i).getDataSourceFeatureSet();case"parent":case"root":return re(e,s,e.parent.outFields,!0,r,i)}return null}return null}async function de(e,t,r,i,s,n,a,l=null){if($.A.applicationCache){const o=$.A.applicationCache.getLayerInfo(e+":"+n.url);if(o)return he(await o,t,r,i,s,a,l)}if(null!=a){const o=a.getCachedPortalItem(n.url,e);if(null!=o)return await he(await o,t,r,i,s,a,l)}const o=new H.default({id:e,portal:n}).load();$.A.applicationCache?$.A.applicationCache.setLayerInfo(e+":"+n.url,o):null!=a&&a.setCachedPortalItem(n.url,e,o);try{return await he(await o,t,r,i,s,a,l)}catch(t){throw $.A.applicationCache&&$.A.applicationCache.clearLayerInfo(e+":"+n.url),null!=a&&a.removeCachedPortalItem(n.url,e,o),t}}async function he(e,t,r,i,s,n,a){let l;if("Feature Service"===e.type||"Map Service"===e.type)l=await ee((0,y.Qi)(e.url??"")+"/"+t,["*"],n);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=n){const t=n.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)l=await t;else{const t=K.A.fromPortalItem(e);n.setCachedPortalItemLayer(e.portal.url,e.id,t);try{l=await t}catch(r){throw n.removeCachedPortalItemLayer(e.portal.url,e.id,t),r}}}else l=await K.A.fromPortalItem(e)}return re(l,r,i,s,n,a)}},41366:(e,t,r)=>{r.d(t,{K:()=>h,Q:()=>u});var i=r(90237),s=r(66552),n=r(53966),a=r(10107),l=(r(44208),r(87811),r(93223)),o=r(40608);const u=(0,s.O)()({naturalLog:"natural-log",squareRoot:"square-root",percentOfTotal:"percent-of-total",log:"log",field:"field"}),c="percent-of-total",d="field",h=e=>{let t=class extends e{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,r=null!=this.normalizationTotal;return t||r?(e=t&&d||r&&c||null,t&&r&&n.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,i._)([(0,a.MZ)({type:String,json:{name:"parameters.normalizationField",write:!0}})],t.prototype,"normalizationField",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMaxValue",write:!0}})],t.prototype,"normalizationMaxValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationMinValue",write:!0}})],t.prototype,"normalizationMinValue",void 0),(0,i._)([(0,a.MZ)({type:Number,json:{name:"parameters.normalizationTotal",write:!0}})],t.prototype,"normalizationTotal",void 0),(0,i._)([(0,l.e)(u,{name:"parameters.normalizationType"})],t.prototype,"normalizationType",null),t=(0,i._)([(0,o.$)("esri.rest.support.NormalizationBinParametersMixin")],t),t}},41560:(e,t,r)=>{r.d(t,{Ch:()=>a,mW:()=>n});var i=r(34727),s=r(39516);function n(e,t){return{...t,filterMode:e.mode}}function a(e,t,r){const n=function(e){if("manual"===u(e))return null;const t=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:r,maxScale:i}of e.filters)t[0]=Math.max(t[0],c(r)),t[1]=Math.min(t[1],d(i));return t}(e);if(n&&((0,i.gg)(t,n[0])||(0,i.ZH)(r,n[1])))return"";const a=Array.from(l(e,t,r)),o=function(e,t,r){if(0===e.length)return!0;const s=c(e.at(0)?.minScale),n=d(e.at(-1)?.maxScale);if((0,i.ZH)(s,t)||(0,i.gg)(n,r))return!0;for(let t=0;t<e.length-1;t++){const r=e[t],s=e[t+1];if((0,i.ZH)(c(s.minScale),d(r.maxScale)))return!0}return!1}(a,t,r)?"1=1":a.map((e=>e.where||"1=1")).reduce(((e,t)=>(0,s.IW)(e,t)),"");return o&&"1=1"!==o?o:""}function*l(e,t,r){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 i of e.filters)o(i.minScale,i.maxScale,t,r)&&(yield i)}}function o(e,t,r,s){return e=c(e),r=c(r),t=d(t),!(!(0,i.Sp)(r,e)&&(s??r)>e||(0,i.Hx)(t,r)||void 0!==s&&(0,i.Sp)(s,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,r)=>{r.d(t,{R:()=>s});var i=r(49186);let s=class e{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}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+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}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,r=""){const[s,n]=t.split("."),a=/^\s*\d+\s*$/;if(!s?.match||!a.test(s))throw new i.A((r&&r+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:t});if(!n?.match||!a.test(n))throw new i.A((r&&r+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:t});const l=parseInt(s,10),o=parseInt(n,10);return new e(l,o,r)}}},54461:(e,t,r)=>{r.d(t,{A:()=>l});var i=r(87449),s=r(11221),n=r(89169),a=r(33325);class l extends s.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 n.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(t===a.J6.NotInFeatureSet)return t;const r=this._idstates[e];return r===a.J6.InFeatureSet||r===a.J6.NotInFeatureSet?r:t===a.J6.InFeatureSet&&void 0===r?this._countedin<this._topnum?(this._idstates[e]=a.J6.InFeatureSet,this._countedin++,a.J6.InFeatureSet):(this._idstates[e]=a.J6.NotInFeatureSet,a.J6.NotInFeatureSet):a.J6.Unknown}async _expandPagedSet(e,t,r,s,n){if(null===this._parent)throw new i.dr(i.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,r,s,n);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,r,i){const s=[],a=this._maxQueryRate();if(!0===this._checkIfNeedToExpandKnownPage(e,a))return await this._expandPagedSet(e,a,0,0,i),this._getFeatures(e,t,r,i);-1!==t&&void 0===this._featureCache[t]&&s.push(t);let l=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(l++,l<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&s.push(e._known[i]),s.length>a)));i++);if(0===s.length)return"success";const o=new n.A([],s,!1,null),u=Math.min(s.length,r);await this._parent._getFeatures(o,-1,u,i);for(let e=0;e<u;e++){const t=this._parent._featureFromCache(s[e]);void 0!==t&&(this._featureCache[s[e]]=t)}return"success"}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const a=await this._getSet(s);return new n.A(a._candidates.slice().concat(a._known.slice()),[],!1,this._clonePageDefinition(a.pagesDefinition))}_refineKnowns(e,t){let r=0,i=null;const s=[];for(let n=0;n<e._candidates.length;n++){const l=this._isInFeatureSet(e._candidates[n]);if(l===a.J6.InFeatureSet){if(e._known.push(e._candidates[n]),r+=1,null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),e._known.length>=this._topnum)break}else if(l===a.J6.NotInFeatureSet)null===i?i={start:n,end:n}:i.end===n-1?i.end=n:(s.push(i),i={start:n,end:n}),r+=1;else if(l===a.J6.Unknown)break;if(r>=t)break}null!==i&&s.push(i);for(let t=s.length-1;t>=0;t--)e._candidates.splice(s[t].start,s[t].end-s[t].start+1);this._setKnownLength(e)>this._topnum&&(e._known=e._known.slice(0,this._topnum)),this._setKnownLength(e)>=this._topnum&&(e._candidates=[])}async _stat(){return{calculated:!1}}async _canDoAggregates(){return!1}static registerAction(){s.A._featuresetFunctions.top=function(e){return new l({parentfeatureset:this,topnum:e})}}getFieldsIndex(){return this._parent.getFieldsIndex()}}},55674:(e,t,r)=>{r.d(t,{Ad:()=>p,Gj:()=>_,QY:()=>h,lL:()=>g,xR:()=>f});var i=r(66131),s=r(49186),n=(r(44208),r(44729)),a=r(15032),l=r(65864),o=r(95466),u=r(43668),c=r(98623);const d=["geometry","scale","timeProperties"];function h(e,t){if(null!=t)for(const r of d)t.hasArcadeDependency(r)&&e.add(r);return e}function p(e,t){return y.create(e,t,null,["$feature","$view"])}function f(e,t,r){return y.create(e,t,r,["$feature","$view","$config"])}class y{static async create(e,t,r,i){const{arcade:n,Dictionary:a}=await(0,u.l)();let l;try{l=n.parseScript(e)}catch(t){throw new s.A("arcade-bad-expression","Failed to parse arcade script",{script:e,error:t})}const o=n.scriptUsesGeometryEngine(l);o&&await n.enableGeometrySupport(),await n.loadDependentModules(new Set,l,null,!1,o);const c={vars:i.reduce(((e,t)=>({...e,[t]:null})),{}),spatialReference:t,useAsync:!1},d=n.compileScript(l,c);let h=null;null!=r&&(h=new a(r),h.immutable=!0);const p=new a;return p.immutable=!1,p.setField("scale",0),new y(e,n,l,d,t,p,h,a)}constructor(e,t,r,i,s,n,a,l){this.script=e,this._arcade=t,this._syntaxTree=r,this._compiled=i,this._spatialReference=s,this._viewDict=n,this._configDict=a,this._dictionaryCtor=l,this._dependencies=new Map,this._featureReader=new _,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 r=t.$view?.timeZone;if(t.$view){let e;if(this._viewDict.setField("scale",t.$view.scale),null!=t.$view.timeProperties){const{currentStart:s,currentEnd:n}=t.$view.timeProperties;e=new this._dictionaryCtor({currentStart:null!=s?null!=r?i.lY.epochToArcadeDate(s,r):i.lY.unknownEpochToArcadeDate(s):void 0,currentEnd:null!=n?null!=r?i.lY.epochToArcadeDate(n,r):i.lY.unknownEpochToArcadeDate(n):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:r})}repurposeFeature(e,t){return this._featureReader.bind(e,t,this._spatialReference),this._featureReader}references(e){return this._dependencies.get(e)??!1}}class _{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,r){const i=t??new o.A(g(e.attributes));this._boundTarget=e,this._boundSchema.fields=i.fields,this._boundSchema.fieldsIndex=i,this._boundSchema.spatialReference=r}_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 r=this._getField(e);if(r)switch(r.type){case"date-only":case"esriFieldTypeDateOnly":return n.n.fromReader(this._boundTarget.attributes[r.name]);case"time-only":case"esriFieldTypeTimeOnly":return a.k.fromReader(this._boundTarget.attributes[r.name]);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return i.lY.fromReaderAsTimeStampOffset(this._boundTarget.attributes[r.name]);case"date":case"esriFieldTypeDate":{const t=this._boundTarget.attributes[r.name];return this.isUnknownDateTimeField(e)?i.lY.unknownEpochToArcadeDate(t):i.lY.epochToArcadeDate(t,this.contextTimeZone??c.qU)}default:return this._boundTarget.attributes[r.name]}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 g(e){const t=[];for(const r in e)t.push({name:r,alias:r,type:"string"==typeof e[r]?"esriFieldTypeString":"esriFieldTypeDouble"});return t}},58501:(e,t,r)=>{r.d(t,{q:()=>s});var i=r(62815);function s(e,t,r){if(!r?.features||!r.hasZ)return;const s=(0,i.N)(r.geometryType,t,e.outSpatialReference);if(null!=s)for(const e of r.features)s(e.geometry)}},60999:(e,t,r)=>{r.d(t,{DZ:()=>f,Ke:()=>p,Tj:()=>c,UT:()=>y,jJ:()=>u});var i=r(90237),s=r(69622),n=r(97768),a=r(74887),l=r(10107),o=r(40608);function u(e,t,r){return(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))}async function c(e,t,r){return(await(0,a.Lx)(e.map(((e,i)=>t.apply(r,[e,i]))))).map((e=>e.value))}function d(e){return{ok:!0,value:e}}function h(e){return{ok:!1,error:e}}async function p(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 f(e){try{return d(await e)}catch(e){return(0,a.QP)(e),h(e)}}function y(e,t){return new _(e,t)}let _=class extends s.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,n.DC)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:r}=this._abortController;this.promise=e(r),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,n.xt)(this._abortHandle),this._abortController=null}};(0,i._)([(0,l.MZ)()],_.prototype,"value",null),(0,i._)([(0,l.MZ)()],_.prototype,"error",null),(0,i._)([(0,l.MZ)()],_.prototype,"finished",null),(0,i._)([(0,l.MZ)()],_.prototype,"promise",void 0),(0,i._)([(0,l.MZ)()],_.prototype,"_result",void 0),_=(0,i._)([(0,o.$)("esri.core.asyncUtils.ReactiveTask")],_)},68423:(e,t,r)=>{r.d(t,{Gr:()=>m,IO:()=>y,a:()=>w,bV:()=>g,p8:()=>_});var i=r(52106),s=r(78502),n=r(87449),a=r(11221),l=r(89169),o=r(33325),u=r(80609),c=r(97768),d=r(1262),h=r(88368),p=r(16930);class f{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class y extends f{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class _ extends f{constructor(e,t,r){super((0,o.ke)(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}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 g extends f{constructor(e,t,r){super(e),this.codefield=t,this.lkp=r,this.reverseLkp={};for(const e in r)this.reverseLkp[r[e]]=e;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,o.zl.Standardised,this.field.name,this.codefield instanceof h.A?(0,u.YY)(this.codefield,o.zl.Standardised):this.codefield,e.parameters);return r.includes(g.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:h.A.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,i=null,s){let n,a,l,c;switch(e.type){case"interval":return(0,u.oj)(this.evaluateNodeToWhereClause(e.value,t,r,i,s),e.qualifier,e.op);case"case-expression":{let i=" CASE ";"simple"===e.format&&(i+=this.evaluateNodeToWhereClause(e.operand,t,r,g.BADNESS,s));for(let n=0;n<e.clauses.length;n++)i+=" WHEN "+this.evaluateNodeToWhereClause(e.clauses[n].operand,t,r,g.BADNESS,s)+" THEN "+this.evaluateNodeToWhereClause(e.clauses[n].value,t,r,g.BADNESS,s);return null!==e.else&&(i+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,g.BADNESS,s)),i+=" END ",i}case"parameter":{const r=s[e.value.toLowerCase()];if("string"==typeof r)return"'"+r.toString().replaceAll("'","''")+"'";if((0,o.$P)(r))return(0,u.bm)(r,t);if((0,o.Lk)(r))return(0,u.bm)(r,t);if((0,o.eg)(r))return(0,u.F1)(r,t);if((0,o.rX)(r))return(0,u.R8)(r,t);if((0,o.f0)(r))return(0,u.Nf)(r,t);if(Array.isArray(r)){const e=[];for(let i=0;i<r.length;i++)"string"==typeof r[i]?e.push("'"+r[i].toString().replaceAll("'","''")+"'"):(0,o.$P)(r[i])||(0,o.Lk)(r[i])?e.push((0,u.bm)(r[i],t)):(0,o.eg)(r[i])?e.push((0,u.F1)(r[i],t)):(0,o.rX)(r[i])?e.push((0,u.R8)(r[i],t)):(0,o.f0)(r[i])?e.push((0,u.Nf)(r[i],t)):e.push(r[i].toString());return e}return r.toString()}case"expression-list":a=[];for(const n of e.value)a.push(this.evaluateNodeToWhereClause(n,t,r,i,s));return a;case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,g.BADNESS,s)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,i,s)+") ";case"IS":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new d.L8(d.Z7.UnsupportedIsRhs);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IS NOT NULL )";case"IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" IN ("+c+")) ";case"NOT IN":if(n=[],"expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const n=[];let a=!0;for(const t of e.right.value){if("string"!==t.type){a=!1;break}if(void 0===this.lkp[t.value]){a=!1;break}n.push(this.lkp[t.value].toString())}if(a)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return n=this.evaluateNodeToWhereClause(e.right,t,r,i,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+n.join(",")+")) "}return c=this.evaluateNodeToWhereClause(e.right,t,r,i,s),Array.isArray(c)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,i,s)+" NOT IN ("+c+")) ";case"BETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"NOTBETWEEN":return l=this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)," ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT BETWEEN "+l[0]+" AND "+l[1]+" ) ";case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";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" ("+i+" "+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+" "+i+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,g.BADNESS,s)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,g.BADNESS,s)+") "}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 r&&r.toLowerCase()===e.column.toLowerCase()?"("+i+")":(0,u.Kb)(e.column);case"data-type":return e.value;case"function":{const i=this.evaluateNodeToWhereClause(e.args,t,r,g.BADNESS,s);return(0,u.F6)(e.name,i,t)}}throw new d.L8(d.Z7.UnsupportedSyntax,{node:e.type})}extractValue(e){return this.codefield instanceof h.A?this.reverseLkp[h.A.convertValueToStorageFormat(this.codefield.calculateValueCompiled(e))]:this.reverseLkp[e.attributes[this.codefield]]}}class m extends f{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,o.zl.Standardised),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 r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;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 p.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,r,n){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,n),this._getFeatures(e,t,r,n);let u=0;for(let i=e._lastFetchedIndex;i<e._known.length&&(u++,u<=r&&(e._lastFetchedIndex+=1),!(void 0===this._featureCache[e._known[i]]&&(e._known[i]!==t&&a.push(e._known[i]),a.length>=o)));i++);if(0===a.length)return"success";e=new l.A([],a,e._ordered,null);const c=Math.min(a.length,r);await(this._parent?._getFeatures(e,-1,c,n)),this._checkCancelled(n);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 r of this.adaptedFields)t[r.field.name]=r.extractValue(e);this._featureCache[e.id]=new i.A({attributes:t,geometry:(0,s.Yq)(e.geometry)})}return"success"}async _fetchAndRefineFeatures(){throw new n.dr(n.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){let n=!1;const a=this._reformulateWithoutAdaptions(r);n=a.cannot,r=a.where;let o=!1;if(null!==i){o=!0;const e=[];for(const t of this.adaptedFields)if(!(t instanceof y)&&!0===i.scanForField(t.field.name)){if(!(t instanceof _)){i=null,o=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}i&&e.length>0&&(i=i.replaceFields(e))}null!==r?null!==this._extraFilter&&(r=(0,u.kg)(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const c=await this._parent._getFilteredSet(e,t,r,i,s);let d;return this._checkCancelled(s),d=!0===n?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 r of this.adaptedFields)if(!0===(0,u.Ju)(e,r.field.name)){const i=r.rewriteSql(e,this);if(!0!==i.rewritten){t.cannot=!0,t.where=null;break}t.where=i.where}return t}async _stat(e,t,r,i,s,n,a){let l=!1,o=this._reformulateWithoutAdaptions(t);if(l=o.cannot,t=o.where,o=this._reformulateWithoutAdaptions(s),l=l||o.cannot,null!==(s=o.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,!0===l)return null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1};const c=await this._parent._stat(e,t,r,i,s,n,a);return!1===c.calculated?null===s&&""===r&&null===i?this._manualStat(e,t,n,a):{calculated:!1}:c}async _canDoAggregates(e,t,r,i,s){if(null===this._parent)return!1;for(let t=0;t<e.length;t++)for(const r of this.adaptedFields)if(e[t].toLowerCase()===r.field.name.toLowerCase()&&!(r instanceof y))return!1;const n=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)return!1;const t=r.clone();t.workingexpr=e.where,n.push(t)}else n.push(r)}const a=this._reformulateWithoutAdaptions(s);return!a.cannot&&(null!==(s=a.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._canDoAggregates(e,n,r,i,s))}async _getAggregatePagesDataSourceDefinition(e,t,r,i,s,a,l){if(null===this._parent)throw new n.dr(n.D_.NeverReach);const o=[];for(let e=0;e<t.length;e++){const r=t[e];if(null!==r.workingexpr){const e=this._reformulateWithoutAdaptions(r.workingexpr);if(e.cannot)throw new n.dr(n.D_.NeverReach);const t=r.clone();t.workingexpr=e.where,o.push(t)}else o.push(r)}const c=this._reformulateWithoutAdaptions(s);if(c.cannot)throw new n.dr(n.D_.NeverReach);return null!==(s=c.where)?null!==this._extraFilter&&(s=(0,u.kg)(this._extraFilter,s)):s=this._extraFilter,this._parent._getAggregatePagesDataSourceDefinition(e,o,r,i,s,a,l)}}},73681:(e,t,r)=>{r.d(t,{n:()=>o});var i=r(49186),s=r(53966),n=r(46140),a=r(95466),l=r(55674);class o{static async from(e,t,r){const a=e.dictionary_version?n.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(r))h.delete(e);h.size&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:h});const p=await(0,l.xR)(e.expression,null,d);if(!p)throw new i.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const f=!a||!a.greaterEqual(4,0);f&&s.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:a});const y=new u(r,f);return new o(f,c,p,y)}constructor(e,t,r,i){this._requiresFieldCoercionToString=e,this._itemNames=t,this._compiled=r,this._reader=i}get itemNames(){return this._itemNames}evaluate(e,t,r,i){try{return this._reader.bind(e,r,i),this._compiled.evaluate(this._reader,{$view:{scale:t}})}catch(e){s.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?"":""+this._boundTarget.attributes[t.name]}}},77548:(e,t,r)=>{r.d(t,{tk:()=>d,BR:()=>c,wI:()=>u,Ov:()=>l,W_:()=>o,TU:()=>a,XX:()=>n});var i=r(70333),s=r(78888);r(5503),r(36563),r(36708),new WeakMap;const n={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 r=i.id?.findServerInfo(e);if(null!=r?.currentVersion)return r.owningSystemUrl||null;const n=e.toLowerCase().indexOf("/rest/services");if(-1===n)return null;const a=`${e.slice(0,n)}/rest/info`,l=null!=t?t.signal:null,{data:o}=await(0,s.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)}},86691:(e,t,r)=>{r.d(t,{A:()=>o});var i=r(78878),s=r(87449),n=r(11221),a=r(89169),l=r(87594);class o extends n.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 r=await this.getIdColumnDictionary(e,[],-1,t);this._orderbyclause?.order(r);const i=new a.A([],[],!0,null);for(let e=0;e<r.length;e++)i._known.push(r[e].id);return i}async getIdColumnDictionary(e,t,r,s){if(r<e._known.length-1){const n=this._maxQueryRate();if("GETPAGES"===e._known[r+1])return await(0,i.a0)(this._parent._expandPagedSet(e,n,0,0,s)),this.getIdColumnDictionary(e,t,r,s);let a=r+1;const l=[];for(;a<e._known.length&&"GETPAGES"!==e._known[a];)l.push(e._known[a]),a++;r+=l.length;const o=await(0,i.a0)(this._parent._getFeatureBatch(l,s));this._checkCancelled(s);for(const e of o)t.push({id:e.attributes[this.objectIdField],feature:e});return this.getIdColumnDictionary(e,t,r,s)}return e._candidates.length>0?(await(0,i.a0)(this._refineSetBlock(e,this._maxProcessingRate(),s)),this._checkCancelled(s),this.getIdColumnDictionary(e,t,r,s)):t}_isInFeatureSet(e){return this._parent._isInFeatureSet(e)}_getFeatures(e,t,r,i){return this._parent._getFeatures(e,t,r,i)}_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 s.dr(s.D_.NeverReach)}async _getFilteredSet(e,t,r,i,s){await this._ensureLoaded();const n=await this._parent._getFilteredSet(e,t,r,null===i?this._orderbyclause:i,s);this._checkCancelled(s);const l=new a.A(n._candidates.slice(),n._known.slice(),n._ordered,this._clonePageDefinition(n.pagesDefinition));let o=!0;if(n._candidates.length>0&&(o=!1),!1===l._ordered){let e=await this.manualOrderSet(l,s);return!1===o&&(null===t&&null===r||(e=new a.A(e._candidates.slice().concat(e._known.slice()),[],e._ordered,this._clonePageDefinition(e.pagesDefinition)))),e}return l}static registerAction(){n.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,r)=>{function i(e,t){return e===t?0:null===e?-1:null===t?1:e<t?-1:1}r.d(t,{A:()=>s});class s{constructor(e){const t=e.split(",");this._fields=[],this._directions=[];for(let e=0;e<t.length;e++){const r=t[e].match(/\S+/g);this._fields.push(r[0]),2===r.length?"asc"===r[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 r=0;r<this._fields.length;r++){const s=this.featureValue(e.feature,this._fields[r],r),n=this.featureValue(t.feature,this._fields[r],r);let a=0;if(a=1===this._directions[r]?i(s,n):-1*i(s,n),0!==a)return a}return 0}))}scanForField(e){for(let t=0;t<this._fields.length;t++)if(this._fields[t].toLowerCase().trim()===e.toLowerCase().trim())return!0;return!1}replaceFields(e){let t="";for(let r=0;r<this._fields.length;r++){0!==r&&(t+=",");let i=this._fields[r];for(const t of e)if(i.toLowerCase()===t.field.toLowerCase()){i=t.newfield;break}t+=i,1===this._directions[r]?t+=" ASC":t+=" DESC"}return new s(t)}featureValue(e,t,r){const i=e.attributes[t];if(void 0!==i)return i;for(const i in e.attributes)if(t.toLowerCase()===i.toLowerCase())return this._fields[r]=i,e.attributes[i];return null}}},91880:(e,t,r)=>{r.d(t,{A:()=>c});var i,s=r(90237),n=r(66552),a=r(25482),l=r(10107),o=(r(44208),r(53966),r(87811),r(40608));const u=new n.J({asc:"ascending",desc:"descending"});let c=class extends a.A{static{i=this}constructor(e){super(e),this.field=null,this.valueExpression=null,this.order="ascending"}clone(){return new i({field:this.field,valueExpression:this.valueExpression,order:this.order})}};(0,s._)([(0,l.MZ)({type:String,json:{write:!0}})],c.prototype,"field",void 0),(0,s._)([(0,l.MZ)({type:String,json:{write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],c.prototype,"valueExpression",void 0),(0,s._)([(0,l.MZ)({type:u.apiValues,json:{type:u.jsonValues,read:u.read,write:u.write}})],c.prototype,"order",void 0),c=i=(0,s._)([(0,o.$)("esri.layers.support.OrderByInfo")],c)},92935:(e,t,r)=>{var i;r.d(t,{X:()=>i}),function(e){e[e.SAVE=0]="SAVE",e[e.SAVE_AS=1]="SAVE_AS"}(i||(i={}))}}]);