@arcgis/ai-components 5.2.0-next.9 → 5.2.0-next.91

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 (315) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  4. package/dist/agent-utils/LLMAgent.d.ts +7 -4
  5. package/dist/agent-utils/LLMAgent.js +4 -2
  6. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  7. package/dist/agent-utils/WorkflowAgent.js +14 -15
  8. package/dist/agent-utils/index.d.ts +177 -0
  9. package/dist/agent-utils/index.js +167 -0
  10. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  11. package/dist/agent-utils/middlewares/trace.js +25 -33
  12. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  13. package/dist/agent-utils/types.d.ts +37 -8
  14. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  17. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  18. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  19. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  20. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  21. package/dist/agentic-workflow/Edge.d.ts +16 -0
  22. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  23. package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
  24. package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
  25. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  26. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  27. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  28. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  29. package/dist/agentic-workflow/types.d.ts +29 -0
  30. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  31. package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
  32. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  33. package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
  34. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  35. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +109 -0
  36. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  37. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  38. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  39. package/dist/agents/tools/navigation/goToAddress/adapter.js +52 -0
  40. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  41. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  42. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  43. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  44. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  45. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  46. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  47. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  48. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  49. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  50. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  51. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  52. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  53. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  54. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  55. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  56. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  57. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  58. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  59. package/dist/agents/tools/query/getStatistics/adapter.js +154 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +127 -0
  64. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  65. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  66. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  67. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  68. package/dist/cdn/2EY3BQQX.js +2 -0
  69. package/dist/cdn/2PTPBAIN.js +2 -0
  70. package/dist/cdn/34O57OGV.js +2 -0
  71. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  72. package/dist/cdn/434TAA3J.js +2 -0
  73. package/dist/cdn/4EBLRHYE.js +2 -0
  74. package/dist/cdn/4HDDRBIY.js +2 -0
  75. package/dist/cdn/4KOV2NEI.js +9 -0
  76. package/dist/cdn/4NJ2FF7H.js +2 -0
  77. package/dist/cdn/4OGR5QKS.js +2 -0
  78. package/dist/cdn/4WIDLQUH.js +2 -0
  79. package/dist/cdn/5FL5BTTX.js +66 -0
  80. package/dist/cdn/5WYRJMBW.js +2 -0
  81. package/dist/cdn/5X7EG7D2.js +2 -0
  82. package/dist/cdn/5ZFUGNRN.js +2 -0
  83. package/dist/cdn/6HF36IKA.js +2 -0
  84. package/dist/cdn/6KFMRBAA.js +2 -0
  85. package/dist/cdn/6VJXUIXY.js +3 -0
  86. package/dist/cdn/7BCQMK6D.js +2 -0
  87. package/dist/cdn/7DFXYMEA.js +2 -0
  88. package/dist/cdn/7M6VKBTK.js +6 -0
  89. package/dist/cdn/7SRLZQVC.js +5 -0
  90. package/dist/cdn/7V6OSTFC.js +2 -0
  91. package/dist/cdn/7VAQUCBU.js +9 -0
  92. package/dist/cdn/7ZFAFKJT.js +2 -0
  93. package/dist/cdn/ACJTJLZN.js +2 -0
  94. package/dist/cdn/AI6DYOKR.js +181 -0
  95. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  96. package/dist/cdn/APFZY4PI.js +2 -0
  97. package/dist/cdn/AT4XVTJR.js +44 -0
  98. package/dist/cdn/AZCIDPML.js +2 -0
  99. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  100. package/dist/cdn/C5ZL5Z52.js +18 -0
  101. package/dist/cdn/CCC6LBMY.js +2 -0
  102. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  103. package/dist/cdn/CJMUJXPL.js +2 -0
  104. package/dist/cdn/COL6QYGQ.js +2 -0
  105. package/dist/cdn/CP5BVGJU.js +2 -0
  106. package/dist/cdn/CZM4URK7.js +2 -0
  107. package/dist/cdn/DP6O6PMH.js +2 -0
  108. package/dist/cdn/{V2P4AIGG.js → EKB7CAMM.js} +1 -1
  109. package/dist/cdn/EWLXNGKH.js +208 -0
  110. package/dist/cdn/EYNEYD34.js +2 -0
  111. package/dist/cdn/FDDQ67BG.js +2 -0
  112. package/dist/cdn/FDOMMK2M.js +2 -0
  113. package/dist/cdn/FQH3HOFH.js +2 -0
  114. package/dist/cdn/{GGSZM7KV.js → FUZ77UGP.js} +6 -4
  115. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  116. package/dist/cdn/GFEOVHJK.js +2 -0
  117. package/dist/cdn/HHFNQR6Z.js +2 -0
  118. package/dist/cdn/HIPQ3VRW.js +2 -0
  119. package/dist/cdn/HKSFWTWK.js +14 -0
  120. package/dist/cdn/HMUWQCXU.js +2 -0
  121. package/dist/cdn/IBZ2NEAO.js +2 -0
  122. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  123. package/dist/cdn/IHP25JWI.js +99 -0
  124. package/dist/cdn/J6A4AS7E.js +22 -0
  125. package/dist/cdn/J6SZIQJA.js +2 -0
  126. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  127. package/dist/cdn/JJJZ7FOM.js +2 -0
  128. package/dist/cdn/JKIESH74.js +2 -0
  129. package/dist/cdn/JO5ETMPS.js +2 -0
  130. package/dist/cdn/K2R6XVK3.js +2 -0
  131. package/dist/cdn/KCU4FWF7.js +2 -0
  132. package/dist/cdn/KITIP6J2.js +2 -0
  133. package/dist/cdn/KWD2ECTM.js +2 -0
  134. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  135. package/dist/cdn/LLUGJKAQ.js +2 -0
  136. package/dist/cdn/LPR72QZF.js +36 -0
  137. package/dist/cdn/{DHOVCT6R.js → MKOQJXQQ.js} +1 -1
  138. package/dist/cdn/MWYBF3F3.js +66 -0
  139. package/dist/cdn/NEV6OZN3.js +71 -0
  140. package/dist/cdn/OAKRPM7D.js +2 -0
  141. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  142. package/dist/cdn/OL5656NI.js +2 -0
  143. package/dist/cdn/ONQ6JSBJ.js +2 -0
  144. package/dist/cdn/OWTGH34K.js +2 -0
  145. package/dist/cdn/OYSPNIJI.js +156 -0
  146. package/dist/cdn/PEYYWXFE.js +2 -0
  147. package/dist/cdn/PKUDO2RC.js +3 -0
  148. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  149. package/dist/cdn/PSYRZMX2.js +2 -0
  150. package/dist/cdn/PUHRBGKB.js +2 -0
  151. package/dist/cdn/Q57QWN5W.js +2 -0
  152. package/dist/cdn/QCFICJ7U.js +3 -0
  153. package/dist/cdn/QNNGPA3Q.js +2 -0
  154. package/dist/cdn/R74ZHFA6.js +2 -0
  155. package/dist/cdn/RBE55SWR.js +2 -0
  156. package/dist/cdn/RHYNE5OE.js +2 -0
  157. package/dist/cdn/RLEHNAIA.js +2 -0
  158. package/dist/cdn/RSNGZQCQ.js +2 -0
  159. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  160. package/dist/cdn/SHD6YFSR.js +2 -0
  161. package/dist/cdn/SUYWKYWI.js +22 -0
  162. package/dist/cdn/SZ2QSSB3.js +2 -0
  163. package/dist/cdn/T4RIGOXB.js +2 -0
  164. package/dist/cdn/{3PKJWIC3.js → TMZ6DF22.js} +1 -1
  165. package/dist/cdn/TPULIO6I.js +34 -0
  166. package/dist/cdn/U2D53TAX.js +14 -0
  167. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  168. package/dist/cdn/UHZG7SKO.js +2 -0
  169. package/dist/cdn/UZLQALHY.js +2 -0
  170. package/dist/cdn/V52XWEGV.js +11 -0
  171. package/dist/cdn/V6F3HEK7.js +2 -0
  172. package/dist/cdn/V6HOUZPZ.js +2 -0
  173. package/dist/cdn/VAXH6RUQ.js +134 -0
  174. package/dist/cdn/VLLZ2FFU.js +2 -0
  175. package/dist/cdn/VNJMTA6O.js +2 -0
  176. package/dist/cdn/VOKXKU7M.js +56 -0
  177. package/dist/cdn/VXFQANGJ.js +2 -0
  178. package/dist/cdn/W5JPJWMM.js +2 -0
  179. package/dist/cdn/WKTQVBFJ.js +2 -0
  180. package/dist/cdn/WNNMKCKS.js +2 -0
  181. package/dist/cdn/WP7ORLSB.js +6 -0
  182. package/dist/cdn/WR2SQX3J.js +2 -0
  183. package/dist/cdn/X3COUAXY.js +4 -0
  184. package/dist/cdn/Y7XD7ZRD.js +2 -0
  185. package/dist/cdn/YEZ3AMNX.js +2 -0
  186. package/dist/cdn/YLVJA4ZE.js +2 -0
  187. package/dist/cdn/YQSU6IUO.js +2 -0
  188. package/dist/cdn/Z5W4V7RC.js +2 -0
  189. package/dist/cdn/ZLWWWTH4.js +2 -0
  190. package/dist/cdn/ZOEMBHRF.js +2 -0
  191. package/dist/cdn/ZQMBJ6MI.js +2 -0
  192. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  193. package/dist/cdn/ZVGUAOXE.js +2 -0
  194. package/dist/cdn/agent-utils/index.js +2 -0
  195. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  196. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  197. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  198. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  199. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  200. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  201. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  202. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  203. package/dist/cdn/index.js +1 -1
  204. package/dist/chunks/adapter.js +1299 -2113
  205. package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
  206. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  207. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  208. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  209. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  210. package/dist/chunks/baseAgentState.js +56 -0
  211. package/dist/chunks/converterUtils.js +66 -41
  212. package/dist/chunks/dataExplorationGraph.js +133 -177
  213. package/dist/chunks/data_explore_query_prompt.js +9 -4
  214. package/dist/chunks/fetchAgentContext.js +13 -0
  215. package/dist/chunks/fetchService.js +10 -0
  216. package/dist/chunks/fieldStatistics.js +79 -0
  217. package/dist/chunks/formatFeatureAttributes.js +132 -0
  218. package/dist/chunks/generateLayerDescriptions.js +259 -282
  219. package/dist/chunks/helpGraph.js +35 -25
  220. package/dist/chunks/help_prompt.js +34 -17
  221. package/dist/chunks/index.js +11 -0
  222. package/dist/chunks/intent_prompt.js +16 -0
  223. package/dist/chunks/layerStylingGraph.js +37 -31
  224. package/dist/chunks/mergeWhereClauses.js +15 -0
  225. package/dist/chunks/navigationGraph.js +124 -103
  226. package/dist/chunks/navigation_intent_prompt.js +8 -2
  227. package/dist/chunks/orchestrator.js +298 -139
  228. package/dist/chunks/slottableRequestUtils.js +3 -7
  229. package/dist/chunks/state.js +21 -27
  230. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  231. package/dist/chunks/toolCallResponse.js +14 -10
  232. package/dist/chunks/types.js +59 -0
  233. package/dist/chunks/utils2.js +11 -11
  234. package/dist/components/arcgis-assistant/customElement.d.ts +72 -0
  235. package/dist/components/arcgis-assistant/customElement.js +416 -172
  236. package/dist/components/arcgis-assistant/index.js +2 -3
  237. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  238. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  239. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  240. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  241. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  242. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  243. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  244. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  245. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  246. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  247. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  248. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  249. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  250. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  251. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  252. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  253. package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
  254. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  255. package/dist/components/arcgis-assistant-message/index.js +2 -0
  256. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  257. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  258. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
  259. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  260. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  261. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  262. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  263. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  264. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  265. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  266. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  267. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  268. package/dist/docs/api.json +1 -1
  269. package/dist/docs/docs.json +1 -1
  270. package/dist/docs/vscode.html-custom-data.json +1 -1
  271. package/dist/docs/web-types.json +1 -1
  272. package/dist/loader.js +9 -8
  273. package/dist/oauth-callback.html +1 -1
  274. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  275. package/dist/types/lumina.d.ts +10 -8
  276. package/dist/types/preact.d.ts +10 -8
  277. package/dist/types/react.d.ts +10 -8
  278. package/dist/types/stencil.d.ts +12 -10
  279. package/dist/utils/index.d.ts +8 -8
  280. package/dist/utils/index.js +56 -55
  281. package/package.json +32 -12
  282. package/dist/cdn/2AXF774U.js +0 -2
  283. package/dist/cdn/462JBSEV.js +0 -422
  284. package/dist/cdn/53ZCUPKK.js +0 -22
  285. package/dist/cdn/5QAHYX7Y.js +0 -5
  286. package/dist/cdn/5XRDJL7R.js +0 -14
  287. package/dist/cdn/7BCR6TUO.js +0 -2
  288. package/dist/cdn/7GH7VSB2.js +0 -2
  289. package/dist/cdn/7PLV4QH6.js +0 -2
  290. package/dist/cdn/AXDZBBNL.js +0 -45
  291. package/dist/cdn/DDLZOMUY.js +0 -2
  292. package/dist/cdn/EECZLT6C.js +0 -166
  293. package/dist/cdn/ETRWZ3MS.js +0 -108
  294. package/dist/cdn/F2AHA4GB.js +0 -54
  295. package/dist/cdn/FX5JFRDL.js +0 -2
  296. package/dist/cdn/H7422XUG.js +0 -2
  297. package/dist/cdn/HB5A5R2E.js +0 -2
  298. package/dist/cdn/I6HNBTWY.js +0 -2
  299. package/dist/cdn/I7SRZPVS.js +0 -72
  300. package/dist/cdn/IG6YKZH3.js +0 -3
  301. package/dist/cdn/JVIKKZND.js +0 -3
  302. package/dist/cdn/KMQ3SP4I.js +0 -5
  303. package/dist/cdn/MH5RPXHM.js +0 -2
  304. package/dist/cdn/NVI3I46B.js +0 -2
  305. package/dist/cdn/OAVEHGB6.js +0 -2
  306. package/dist/cdn/OH64RMOR.js +0 -4
  307. package/dist/cdn/P26NON3Z.js +0 -16
  308. package/dist/cdn/QR54T33D.js +0 -2
  309. package/dist/cdn/RVOAPUBN.js +0 -2
  310. package/dist/cdn/S3VPZFWQ.js +0 -36
  311. package/dist/cdn/SXDLXCIM.js +0 -2
  312. package/dist/cdn/TR7RL3IK.js +0 -2
  313. package/dist/cdn/USMDJUFS.js +0 -2
  314. package/dist/cdn/Y333DGV6.js +0 -2
  315. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -0,0 +1,71 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"./UZLQALHY.js";var e=`## Who you are
3
+
4
+ You are a map assistant embedded inside a GIS application. You have no knowledge of history, science, people, events, cooking, or anything outside of this map and its data. You only know what is described in the Map Context below.
5
+
6
+ If asked anything outside of that context, you simply don't have that information \u2014 respond naturally and redirect to something you _can_ help with, using specific layer and field names from the map context.
7
+
8
+ Example of how to handle unknown topics:
9
+ "I don't have information on that \u2014 I only know about this map. You could ask me to list all layers in the map, or capabilities of this assistant."
10
+
11
+ ---
12
+
13
+ ## Your capabilities
14
+
15
+ You can help users with:
16
+
17
+ - Listing the layers in this map
18
+ - Listing the fields in a specific layer (use the tool)
19
+ - Suggesting specific queries using actual layer and field names
20
+ - Summarizing what this map contains and what users can do with it
21
+ - Letting users know when a map-related action isn't supported (e.g. charts, tables), and that it may be added in the future
22
+
23
+ ---
24
+
25
+ ## Input
26
+
27
+ Assigned task:
28
+ {assignedTask}
29
+
30
+ Latest user request:
31
+ {userRequest}
32
+
33
+ Prior steps:
34
+ {priorSteps}
35
+
36
+ Use the assigned task as the primary instruction. The question will **not** be restated again here.
37
+ Use the latest user request as supporting context.
38
+ Use prior steps only to explain a previous result, failure, or likely next action.
39
+
40
+ ---
41
+
42
+ ## Map Context
43
+
44
+ {layerSummary}
45
+
46
+ ## Available agents (capabilities)
47
+
48
+ {agents}
49
+
50
+ ### Response Guidelines
51
+
52
+ When suggesting what users can ask, be SPECIFIC using actual layer names:
53
+
54
+ - "Show me water sources with elevation above 500"
55
+ - "Filter Protected Areas in Panama by protection level"
56
+ - "Zoom to Watershed Boundaries"
57
+
58
+ For "what can I ask" responses, provide 3-5 specific example queries using fields from the context.
59
+
60
+ For off-topic questions:
61
+ "I can only help with this map. Try asking me to filter [LayerName] by [FieldName], or zoom to a location."
62
+
63
+ ---
64
+
65
+ ## Format
66
+
67
+ - Keep responses concise
68
+ - Use bullet points for lists
69
+ - Use new lines (\\n) and appropriate formatting in your response
70
+ - Use actual layer and field names from the map context in any suggestions
71
+ `;export{e as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./CCC6LBMY.js";import{a as F,b as T}from"./34O57OGV.js";import a from"./QNNGPA3Q.js";import{a as h}from"./ONQ6JSBJ.js";import{Dc as g}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([I,x,{c:b,d:y},{d:w}])=>{var k=o=>o.flatMap(t=>t.split(",")).map(t=>t.trim()).map(t=>t.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(t=>!!t),j=async(o,t,n,a,u)=>{let s=n.map?.allLayers.find(i=>i.id===o.layerId),d=await n.whenLayerView(s),c=s.title??o.layerId,l;if(a){let i=await b(a,n);if("error"in i)return{tool:"getTopFeatures",layerName:c,summary:"Geometry lookup failed",details:{error:i.error}};if(!i.geometry)return{tool:"getTopFeatures",layerName:c,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in a?a.where:"unknown criteria"}`}};l=i.geometry}else u&&(l=n.extent.clone());let m=t.groupByFields&&t.groupByFields.length>0,p=s.objectIdField,f=o.outFields.includes("*")?["*"]:[...new Set([...o.outFields,p])];try{let i;if(m){let r=new I({where:o.where||"1=1",outFields:f,orderByFields:o.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new x({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});i=await s.queryTopFeatures(r)}else{let r=s.createQuery();r.where=T(s.definitionExpression,o.where||"1=1"),r.outFields=f.length?f:["*"],r.orderByFields=t.orderByFields,r.returnGeometry=!1,r.num=t.topCount,l&&(r.geometry=l,r.spatialRelationship="intersects"),a?.distance&&(r.distance=a.distance),a?.units&&(r.units=a.units),r.outSpatialReference=n.spatialReference;let C=[...new Set([...o.outFields,...k(t.orderByFields)])],v=F(d,C,u??!1);try{i=v?await d.queryFeatures(r):await s.queryFeatures(r)}catch(N){console.warn("Client-side query failed, falling back to server:",N),i=await s.queryFeatures(r)}}let B=i.features.map(r=>r.attributes[p]),{attributes:S}=w(s,i,n.timeZone);return{tool:"getTopFeatures",layerName:c,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:S,objectIds:B,objectIdField:p,where:o.where,orderByFields:t.orderByFields,...m&&{groupByFields:t.groupByFields}}}}catch(i){return{tool:"getTopFeatures",layerName:c,summary:"Query failed",details:{error:i instanceof Error?i.message:String(i)}}}},q=async({targetLayer:o,topFilter:t,geometryFilter:n,useCurrentExtent:a},u)=>{let{mapView:s}=h(u,["mapView"]),d=await j(o,t,s,n,a);return JSON.stringify(d,null,2)},R=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:y.optional().describe("The units for the distance buffer.")}),L=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:y.optional().describe("The units for the distance buffer.")}),D=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([R,L]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),topFilter:e.object({topCount:e.number().describe("Number of top features to return per group."),orderByFields:e.array(e.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:e.array(e.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:e.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),$=g(q,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:D});return $},"rest/support/TopFeaturesQuery","rest/support/TopFilter",a,b)
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var o=`(function(){"use strict";const h=(a,r)=>{if(a.length!==r.length)throw new Error("Vectors must be the same length");let c=0,t=0,e=0;for(let n=0;n<a.length;++n){const s=a[n],l=r[n];c+=s*l,t+=s*s,e+=l*l}const i=Math.sqrt(t*e);if(i===0)return 0;const m=c/i;return Math.max(-1,Math.min(1,m))},f=(a,r,c=.6)=>{const t=[],e=[...a];for(;t.length<r&&e.length>0;){let i=-1,m=-1/0;for(let n=0;n<e.length;n++){const s=e[n].score,l=t.length===0?0:Math.max(...t.map(o=>h(e[n].vector,o.vector))),d=c*s-(1-c)*l;d>m&&(m=d,i=n)}t.push(e[i]),e.splice(i,1)}return t.map(({name:i,score:m})=>({name:i,score:m}))};let p=[];const u=new Map,v=12,y=10,M=a=>{p=a.layers.map(r=>({id:r.id,vector:r.vector}))},E=a=>{u.clear();for(const r of a.layers){const c=r.fields.map(t=>({name:t.name,vector:t.vector}));u.set(r.id,c)}};globalThis.addEventListener("message",a=>{(async()=>{const{type:r,webmapEmbeddings:c,layerIdForFieldsSearch:t=[],requestId:e,precomputedEmbedding:i,minScore:m=0,topResults:n=v}=a.data;switch(r){case"generateEmbeddings":{c&&(M(c),E(c)),globalThis.postMessage("completed");break}case"layerSearch":{if(p.length>0)try{const s=p.map(o=>({id:o.id,vector:o.vector,score:h(i,o.vector)})),d=f(s.map(o=>({name:o.id,vector:o.vector,score:o.score})),y).map(({name:o,score:b})=>({id:o,score:b}));globalThis.postMessage({requestId:e,results:d})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Calculation error"})}else globalThis.postMessage({requestId:e,results:[],error:"Layer embeddings not initialized"});break}case"fieldSearch":{if(t.length>0)try{const s=t.map(l=>{const d=u.get(l);if(!d)return{layerId:l,results:[]};const o=d.map(g=>({name:g.name,vector:g.vector,score:h(i,g.vector)})).filter(({score:g})=>g>=m),b=f(o,n);return{layerId:l,results:b}});globalThis.postMessage({requestId:e,results:s})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Field search calculation error"})}break}default:console.warn("Unknown message type:",r)}})()})})();
2
+ import"./UZLQALHY.js";var o=`(function(){"use strict";const h=(a,r)=>{if(a.length!==r.length)throw new Error("Vectors must be the same length");let c=0,t=0,e=0;for(let n=0;n<a.length;++n){const s=a[n],l=r[n];c+=s*l,t+=s*s,e+=l*l}const i=Math.sqrt(t*e);if(i===0)return 0;const m=c/i;return Math.max(-1,Math.min(1,m))},f=(a,r,c=.6)=>{const t=[],e=[...a];for(;t.length<r&&e.length>0;){let i=-1,m=-1/0;for(let n=0;n<e.length;n++){const s=e[n].score,l=t.length===0?0:Math.max(...t.map(o=>h(e[n].vector,o.vector))),d=c*s-(1-c)*l;d>m&&(m=d,i=n)}t.push(e[i]),e.splice(i,1)}return t.map(({name:i,score:m})=>({name:i,score:m}))};let p=[];const u=new Map,v=12,y=10,M=a=>{p=a.layers.map(r=>({id:r.id,vector:r.vector}))},E=a=>{u.clear();for(const r of a.layers){const c=r.fields.map(t=>({name:t.name,vector:t.vector}));u.set(r.id,c)}};globalThis.addEventListener("message",a=>{(async()=>{const{type:r,webmapEmbeddings:c,layerIdForFieldsSearch:t=[],requestId:e,precomputedEmbedding:i,minScore:m=0,topResults:n=v}=a.data;switch(r){case"generateEmbeddings":{c&&(M(c),E(c)),globalThis.postMessage("completed");break}case"layerSearch":{if(p.length>0)try{const s=p.map(o=>({id:o.id,vector:o.vector,score:h(i,o.vector)})),d=f(s.map(o=>({name:o.id,vector:o.vector,score:o.score})),y).map(({name:o,score:b})=>({id:o,score:b}));globalThis.postMessage({requestId:e,results:d})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Calculation error"})}else globalThis.postMessage({requestId:e,results:[],error:"Layer embeddings not initialized"});break}case"fieldSearch":{if(t.length>0)try{const s=t.map(l=>{const d=u.get(l);if(!d)return{layerId:l,results:[]};const o=d.map(g=>({name:g.name,vector:g.vector,score:h(i,g.vector)})).filter(({score:g})=>g>=m),b=f(o,n);return{layerId:l,results:b}});globalThis.postMessage({requestId:e,results:s})}catch(s){globalThis.postMessage({requestId:e,results:[],error:s instanceof Error?s.message:"Field search calculation error"})}break}default:console.warn("Unknown message type:",r)}})()})})();
3
3
  `,r=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",o],{type:"text/javascript;charset=utf-8"});function a(t){let e;try{if(e=r&&(self.URL||self.webkitURL).createObjectURL(r),!e)throw"";let s=new Worker(e,{name:t?.name});return s.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),s}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(o),{name:t?.name})}}export{a as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./OWTGH34K.js";import{e as l}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:p,subclass:m},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>l(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};n([p()],h.prototype,"workflow",2);n([p()],h.prototype,"inputSchema",2);n([p()],h.prototype,"outputSchema",2);h=n([m("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function i(o,e){let t=o?.configurable?.context;if(!t||typeof t!="object")throw new Error("Agent context missing");let n=e.filter(r=>!(r in t));if(n.length)throw new Error(`Agent context missing: ${n.join(", ")}`);return t}export{i as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{c}from"./ZLWWWTH4.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
@@ -0,0 +1,156 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import i from"./KWD2ECTM.js";import h from"./U2D53TAX.js";import f from"./OAKRPM7D.js";import e from"./V52XWEGV.js";import c from"./AT4XVTJR.js";import{e as R,f as le}from"./7M6VKBTK.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./JKIESH74.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as N,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as A}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Le},{getSchemesByTag:Fe,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:Je},{createRenderer:We},{getSchemesByTag:Ze},{createRenderer:Xe},{getSchemesByTag:Ye},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,me,he])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
3
+ Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Pe(e)){let{lg_tool_call:i,...s}=e;r=[await this.runTool(i,t,s)]}else{let i;if(Te(e))i=e;else if(De(e))i=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(i.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),n;for(let c=i.length-1;c>=0;c-=1){let l=i[c];if(A(l)){n=l;break}}if(n==null||!A(n))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(n.tool_calls?.filter(c=>c.id==null||!s.has(c.id)).map(c=>this.runTool(c,t,e))??[])}if(!r.some(P))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let i of r)P(i)?i.graph===D.PARENT&&Array.isArray(i.goto)&&i.goto.every(s=>ne(s))?a?a.goto.push(...i.goto):a=new D({graph:D.PARENT,goto:i.goto}):o.push(i):o.push(Array.isArray(e)?[i]:{messages:[i]});return a&&o.push(a),o}};var zo=y.Root({llmInputMessages:y({reducer:(e,t)=>N([],t),default:()=>[]})});var I=(e,t)=>t??e,Fa=y.Root({...le(),intent:y({reducer:I}),vectorSearchLayerResults:y({reducer:I,default:()=>[]}),vectorSearchFieldResults:y({reducer:I}),navigationInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),Me=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./J6A4AS7E.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./TPULIO6I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md":()=>import("./IHP25JWI.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./CEKOEHB3.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./VAXH6RUQ.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./AOVJ34QE.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./PQ2DPOFM.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./SDWWUWAF.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./FYZATVB3.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./NEV6OZN3.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./ICBIUFK7.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./JEBRN3EU.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./UHEYPSOR.js").then(e=>e.default)});async function F(e){let t=Object.entries(Me).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
+ Available prompts:
5
+ ${Object.keys(Me).join(`
6
+ `)}`);return await t[1]()}var ct=(e,t=300)=>{let r=e.replace(/\s+/gu," ").replace(/[*_`#>\-]/gu,"").trim();return r.length>t?`${r.slice(0,t)}...`:r},Qa=(e,t)=>(r,o)=>{let a=o?.configurable?.services;for(let i of e)if(!a?.[i])throw new Error(`${t} requires services.${i} to be available.`);return r},Ga=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponse:y(),dataExplorationMessages:y({reducer:N,default:()=>[]})}),dt=[he,me,ye,fe],Va=[pe,ue,de],ut=new O(dt,{handleToolErrors:!1});async function Ba(e,t){let{messages:r}=await ut.invoke({messages:e.dataExplorationMessages},t),o=[],a=[];for(let i of r){let s=i.content,n;typeof s!="string"&&(n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:s}});try{typeof s=="string"?n=JSON.parse(s):n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Invalid tool output type",raw:s}}}catch{n={tool:i.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:s}}}o.push(n),n.details&&typeof n.details=="object"&&"error"in n.details?a.push(`- ${n.tool}: Error - ${String(n.details.error)}`):a.push(`- ${n.layerName}: ${n.summary}`)}return await b({text:`Finished executing layer query tool: ${a.join(", ")}`},t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,...r],queryResponse:o,status:"success",summary:a.length>0?ct(a.join(`
7
+ `)):"Query executed."}}async function pt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i?s=Fe({basemapTheme:await xe(o),geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,8)})[0]:s=Qe({basemapTheme:await xe(o),geometryType:r.geometryType,numColors:Math.min(t.length,8)}).primaryScheme,{layer:r,view:o,attributes:t.map(n=>({field:n,label:r.fields.find(c=>c.name===n)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),pieChartScheme:s}}async function ht(e){return await Le(e)}async function mt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"chart-size":"chart",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=await pt(c),u=await ht(l);return n.renderer=u.renderer,n.visible=!0,`Chart renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying chart renderer: ${l instanceof Error?l.message:String(l)}`}}var yt=["mapView"];function v(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("LayerStylingAgent context missing");let r=yt.filter(o=>!(o in t));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return t}async function ft({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await mt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var gt=d.object({layerId:d.string().describe("The id of the layer to apply the chart renderer to"),fields:d.array(d.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Ka=g(ft,{name:"chart",description:`Label: Charts
8
+ Description: Show the values of two or more categories as a proportion of the total using a pie chart.
9
+ Keywords: pie, chart, all categories, breakdown, proportion
10
+ Example: Show the total number of homes built in each decade using a pie chart for each feature.
11
+ Fields: This style requires 2-8 number fields.
12
+
13
+ Label: Charts and Size
14
+ Description: Show the values of two or more categories as a proportion of the total using a pie chart and use size to capture the total amount or magnitude.
15
+ Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
16
+ Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
17
+ Fields: This style requires 2-8 number fields.`,schema:gt});function wt(e){let{fields:t,layer:r,view:o,theme:a,colorSchemeTags:i}=e,s=t[0],n;return i&&(n=re({geometryType:r.geometryType,includedTags:i,theme:a||"high-to-low"})[0]),{layer:r,view:o,startTime:s,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:n}}async function bt(e){return await Ge(e)}async function Tt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=wt(c),u=await bt(l);return n.renderer=u.renderer,n.visible=!0,`Color-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function vt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Tt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var St=d.object({layerId:d.string().describe("The id of the layer to apply the color-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ua=g(vt,{name:"color-age",description:`Label: Age (color)
18
+ Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
19
+ Keywords: since, age, how old, how long
20
+ Example: Show the age of each feature based on its reported date.
21
+ Fields: This style requires at least one field with a date type.`,schema:St});function xt(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,{theme:i}=e,s=t[1],n=t[0],c;return a&&(c=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:n,normalizationField:s,theme:i,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:c}}async function Et(e){return await Ve(e)}async function Mt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=xt(c),u=await Et(l);return n.renderer=u.renderer,n.visible=!0,`Color renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color renderer: ${l instanceof Error?l.message:String(l)}`}}async function _t({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Mt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var kt=d.object({layerId:d.string().describe("The id of the layer to apply the color renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ha=g(_t,{name:"color",description:`Label: Counts and Amounts (color)
22
+ Description: Vary color along a continuous color ramp to represent numeric or ranked data.
23
+ Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
24
+ Example: Color each feature based on the population density.
25
+ Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:kt});function $t(e){let{fields:t,layer:r,view:o,colorSchemeTags:a,theme:i}=e,s,n,c=t[0];return a&&(n=re({geometryType:r.geometryType,includedTags:a,theme:i||"high-to-low"})[0]),{layer:r,view:o,field:c,normalizationField:s,theme:i,colorOptions:{colorScheme:n}}}async function At(e){return await Be(e)}async function Nt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"color-size-univariate",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=$t(c),u=await At(l);return n.renderer=u.renderer,n.visible=!0,`Color-size-univariate renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying color-size-univariate renderer: ${l instanceof Error?l.message:String(l)}`}}async function Rt({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Nt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var It=d.object({layerId:d.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:d.array(d.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Ja=g(Rt,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
26
+ Description: Vary symbol size and color based on the values of two numeric attributes.
27
+ Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
28
+ Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
29
+ Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:It});function Ct(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i;return a&&(i=Ue({includedTags:a,numColors:Math.min(t.length,8)})[0]),{layer:r,view:o,legendOptions:{unit:"units"},attributes:t.map(s=>({field:s,label:r.fields.find(n=>n.name===s)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,dotDensityScheme:i}}async function qt(e){return await Ke(e)}async function zt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"dot-density",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ct(n),l=await qt(c);return s.renderer=l.renderer,s.visible=!0,`Dot Density renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying dot density renderer: ${c instanceof Error?c.message:String(c)}`}}async function Dt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await zt({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Pt=d.object({layerId:d.string().describe("The id of the layer to apply the dot density renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Wa=g(Dt,{name:"dot-density",description:`Dot Density
30
+ Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
31
+ **Use cases:**
32
+ - Population distribution visualization
33
+ - Comparing multiple categories within areas
34
+ - Showing spatial distribution patterns
35
+ **Examples:**
36
+ - Show the density of the population based on various race/ethnic groups
37
+ - Visualize distribution of different crops across regions
38
+ - Display demographic patterns within census tracts
39
+ **Fields:** Requires 2-8 number fields.
40
+ **Keywords:** density, how much, how many, total, number, amount`,schema:Pt});function Ot(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s=t[0];return a&&(i=Je({includedTags:a,basemap:o.map?.basemap||"topo"})[0]),{layer:r,view:o,field:s,heatmapScheme:i}}async function jt(e){return await He(e)}async function Lt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"heatmap",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ot(n),l=await jt(c);return s.renderer=l.renderer,s.visible=!0,`Heatmap renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying heatmap renderer: ${c instanceof Error?c.message:String(c)}`}}async function Ft({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Lt({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Qt=d.object({layerId:d.string().describe("The id of the layer to apply the heatmap renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Za=g(Ft,{name:"heatmap",description:`Label: Heat Map
41
+ Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
42
+ Keywords: density, heatmap, hot spots, pattern, cluster
43
+ Example: Create a heatmap
44
+ Fields: This typically requires zero or one field of type number.`,schema:Qt});function Gt(e){let{fields:t,layer:r,view:o,styleName:a,colorSchemeTags:i}=e,s;return i&&(s=Ze({geometryType:r.geometryType,includedTags:i,numColors:Math.min(t.length,10)})[0]),{layer:r,view:o,fields:t.map(n=>({name:n})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:a.includes("Size"),predominanceScheme:s}}async function Vt(e){return await We(e)}async function Bt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,includeSize:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:i?"predominance-size":"predominance",fields:o,layer:n,view:s,colorSchemeTags:a};try{let l=Gt(c),u=await Vt(l);return n.renderer=u.renderer,n.visible=!0,`Predominance renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying predominance renderer: ${l instanceof Error?l.message:String(l)}`}}async function Kt({layerId:e,fields:t,colorSchemes:r,includeSize:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await Bt({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,includeSize:o})}var Ut=d.object({layerId:d.string().describe("The id of the layer to apply the predominance renderer to"),fields:d.array(d.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),Xa=g(Kt,{name:"predominance",description:`Label: Predominant category
45
+ Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
46
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
47
+ Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
48
+ Fields: This style relies on 2-10 number fields.
49
+
50
+ Label: Predominant category and Size
51
+ Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value. Also varies the size of each symbol based on the total of all categories.
52
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
53
+ Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
54
+ Fields: This style relies on 2-10 number fields.`,schema:Ut});function Ht(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i,s={field:t[0]},n={field:t[1]};return a&&(i=Ye({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field1:s,field2:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:i}}async function Jt(e){return await Xe(e)}async function Wt({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a}){let i=t,s=e?.allLayers.find(c=>c.id===r);if(!s)return`Could not find layer for id: ${r}`;let n={styleName:"relationship",fields:o,layer:s,view:i,colorSchemeTags:a};try{let c=Ht(n),l=await Jt(c);return s.renderer=l.renderer,s.visible=!0,`Relationship renderer applied to layer: ${s.title??s.id} using fields ${o.join(", ")}`}catch(c){return`Error applying relationship renderer: ${c instanceof Error?c.message:String(c)}`}}async function Zt({layerId:e,fields:t,colorSchemes:r},o){let{mapView:a}=v(o);return await T({type:"show-legend",data:{layerIds:[e]}},o),await Wt({arcgisMap:a.map,arcgisMapView:a,layerId:e,fields:t,colorSchemes:r})}var Xt=d.object({layerId:d.string().describe("The id of the layer to apply the relationship renderer to"),fields:d.array(d.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Ya=g(Zt,{name:"relationship",description:`Label: Relationship
55
+ Description: Overlays two color ramps to represent the relationship between two numeric attributes.
56
+ Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
57
+ Example: Show the relationship between tree height and carbon storage
58
+ Fields: This style requires two number fields.`,schema:Xt});function Yt(e){let{fields:t,layer:r,view:o,theme:a}=e,i=t[0];return{layer:r,view:o,startTime:i,endTime:new Date,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function er(e){return await et(e)}async function tr({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size-age",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=Yt(c),u=await er(l);return n.renderer=u.renderer,n.visible=!0,`Size-age renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function rr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await tr({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var or=d.object({layerId:d.string().describe("The id of the layer to apply the size-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),en=g(rr,{name:"size-age",description:`Label: Age (size)
59
+ Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
60
+ Keywords: since, age, how old, how long
61
+ Example: Change the size of features so older features are larger than new features.
62
+ Fields: This style requires at least one field with a date type.`,schema:or});function ar(e){let{fields:t,layer:r,view:o}=e,{theme:a}=e,i=t[1],s=t[0];return{layer:r,view:o,field:s,normalizationField:i,theme:a,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function nr(e){return await tt(e)}async function ir({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"size",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=ar(c),u=await nr(l);return n.renderer=u.renderer,n.visible=!0,`Size renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying size renderer: ${l instanceof Error?l.message:String(l)}`}}async function sr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ir({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var lr=d.object({layerId:d.string().describe("The id of the layer to apply the size renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),tn=g(sr,{name:"size",description:`Label: Counts and Amounts (size)
63
+ Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
64
+ Keywords: graduated size, proportional size, how much, total, number, amount, size
65
+ Example: Vary the size of each point based on the total population.
66
+ Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.
67
+
68
+ Label: Continuous Timeline (size)
69
+ Description: Vary symbol sizes along a continuous ramp to represent dates.
70
+ Keywords: graduated size, proportional size, classed size, how much, total, number, when
71
+ Example: Vary the size of each feature based on the date a ticket was completed.
72
+ Fields: This style requires a single field with a date type.`,schema:lr});function cr(e){let{fields:t,layer:r,view:o,colorSchemeTags:a}=e,i=t[0],s=t[1],n=t[2],c;return a&&(c=ot({geometryType:r.geometryType,includedTags:a})[0]),{layer:r,view:o,field:i,field2:s,field3:n,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:c}}async function dr(e){return await rt(e)}async function ur({arcgisMap:e,arcgisMapView:t,layerId:r,fields:o,colorSchemes:a,theme:i}){let s=t,n=e?.allLayers.find(l=>l.id===r);if(!n)return`Could not find layer for id: ${r}`;let c={styleName:"type",fields:o,layer:n,view:s,colorSchemeTags:a,theme:i};try{let l=cr(c),u=await dr(l);return n.renderer=u.renderer,n.visible=!0,`Type renderer applied to layer: ${n.title??n.id} using fields ${o.join(", ")}`}catch(l){return`Error applying type renderer: ${l instanceof Error?l.message:String(l)}`}}async function pr({layerId:e,fields:t,colorSchemes:r,theme:o},a){let{mapView:i}=v(a);return await T({type:"show-legend",data:{layerIds:[e]}},a),await ur({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:t,colorSchemes:r,theme:o})}var hr=d.object({layerId:d.string().describe("The id of the layer to apply the type renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),rn=g(pr,{name:"type",description:`Label: Types (unique symbols)
73
+ Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
74
+ Keywords: categorical, category, type, unique, discrete, point of interest, region, group
75
+ Example: Color each feature based on the region it belongs to
76
+ Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:hr}),on=y.Root({...R(),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),selectedLayerId:y()}),an=y.Root({...R(),helpInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),nn=y.Root({...R(),intent:y({reducer:(e,t)=>t}),arcgisKnowledgeMessages:y({reducer:N,default:()=>[]}),arcgisKnowledgeToolResult:y({reducer:(e,t)=>t,default:()=>null})});function oe(e){let t=e.map?.allLayers.filter(r=>r.type==="knowledge-graph");if(!t||t?.length!==1)throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.")}function x(e){return!!e?.map&&"activeLinkChartLayer"in e.map}async function Q(e){!x(e)||!e.map.diagramNodesExtent||await e.goTo(e.map.diagramNodesExtent)}function q(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if(!("view"in t))throw new Error("View context missing");let r=t.view;return r.map&&!("activeLinkChartLayer"in r.map)&&oe(r),{view:r}}function sn(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return"knowledgeGraph";let r=t.view;return x(r)?"linkChart":(oe(r),"map")}async function z(e){let t=e?.configurable?.context;if($e(e)==="knowledgeGraph")return t;{let r=t.view.map;if(r&&"activeLinkChartLayer"in r){let o=r.knowledgeGraph?.url;if(!o)throw new Error("Knowledge graph url missing from link chart.");return{knowledgeGraph:await Ee(o)}}else{oe(t.view);let o=(t.view.map?.allLayers.find(a=>a.type==="knowledge-graph")).url;if(!o)throw new Error("Knowledge graph url missing from map.");return{knowledgeGraph:await Ee(o)}}}}function $e(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("ArcgisKnowledgeAgent context missing");if("knowledgeGraph"in t&&"view"in t)throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");if("knowledgeGraph"in t)return"knowledgeGraph";if("view"in t)return"view";throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.")}var H=class{constructor(t){this.dataModel=t,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=J.fromDataModel(t)}},J=class e{constructor(){this.schemaType="ArcgisGraphSchema",this.entityTypes=[],this.relationshipTypes=[],this.identifierInfo={mappingInfo:{identifierMapsTo:"UniformPropertyIdentifier",identifierPropertyName:"globalid"}}}static fromDataModel(t){let r=new e;for(let o of t.entityTypes)r.entityTypes.push(C.fromEntityType(o));for(let o of t.relationshipTypes)r.relationshipTypes.push(W.fromRelationshipType(o));return r.identifierInfo={mappingInfo:{identifierMapsTo:mr(t.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(t.spatialReference)),r}static getDataModelTypesSummary(t){let r=t.entityTypes.map(a=>a.name).join(", "),o=t.relationshipTypes.map(a=>a.name).join(", ");return`Entity Types: ${r}.
77
+ Relationship Types: ${o}.`}},C=class e{constructor(){this.name="",this.properties=[]}static fromEntityType(t){let r=new e;r.name=t.name,r.alias=t.alias?t.alias:void 0,r.role=yr(t.role);for(let o of t.properties){let a={name:o.name,alias:o.alias?o.alias:void 0,fieldType:o.fieldType,role:fr(o.role),geometryDef:o.fieldType==="esriFieldTypeGeometry"?{geometryType:o.geometryType??"esriGeometryAny",hasM:o.hasM?o.hasM:void 0,hasZ:o.hasZ?o.hasZ:void 0}:void 0};r.properties.push(a)}return r}},W=class extends C{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(t){let r=C.fromEntityType(t);r.observedEndPoints=[];for(let o of t.endPoints)r.observedEndPoints.push({originEntityType:o.originEntityType,destinationEntityType:o.destinationEntityType});return r}},mr=e=>{switch(e){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return e}},yr=e=>{switch(e){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return e}};function fr(e){switch(e){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function G(e){return e?.signal}async function gr(e,t){let r=await F("arcgis_knowledge_cypher_query_prompt");return t?`${e} ${r}
78
+
79
+ Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
80
+
81
+ Attempt Number: ${t.attemptCount}
82
+ Execution Error: ${t.executionError}
83
+ Failed Query:
84
+ ${t.failedGraphQuery}`:`${e} ${r}`}async function wr(e,t,r,o){let{graphQuery:a,explanation:i}=await ae(e,t,r,o);return{graphQuery:a,explanation:i}}async function ae(e,t,r,o,a){let i={message:await gr(e,a),context:new H(t)},s=G(o);await b({text:"Attempting to generate a cypher query from your prompt..."},o);let n=await Se(`${r}/chat`,{method:"post",body:JSON.stringify(i),headers:{"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${ve.findCredential(_.getDefault().url)?.token??""}`},signal:s});if(n.httpStatus!==200)throw new Error(`Graph query service returned an error: ${n.httpStatus}`,{cause:n.data});let c=!1,l=Date.now(),u=n.data.sequenceNumber,p="",h="",w=1;for(;!c;){await new Promise(f=>setTimeout(f,1e3)),await b({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,w)}`},o),w=w%3+1;let m=await Se(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:n.data.conversationId,inquiryId:n.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json","X-Esri-Authorization":`Bearer ${ve.findCredential(_.getDefault().url)?.token??""}`},signal:s});if(m.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${m.httpStatus}`,{cause:m.data});if(m.data.context?.kind){if(m.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${m.data.message}`,{cause:m.data});p=m.data.context.graphQuery,h=m.data.message||"",c=!0}else if(!m.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=m.data.sequenceNumber}return{graphQuery:p,explanation:h}}function br(e,t){E(e,r=>{t.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function E(e,t){if(!(!e||typeof e!="object")){if(vr(e))for(let r of e.path)E(r,t);else if(Tr(e))t(e);else if(Array.isArray(e))for(let r of e)E(r,t);else if(Sr(e))for(let r of Object.values(e.properties??{}))E(r,t)}}function Tr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:"id"in e&&"typeName"in e}function vr(e){return!e||typeof e!="object"||Array.isArray(e)?!1:e&&"path"in e&&Array.isArray(e.path)}function Sr(e){return!e||typeof e!="object"||Array.isArray(e)||"id"in e?!1:"properties"in e&&typeof e.properties=="object"}function xr(e,t){let r=[],o=[],a=[[t.dataModel.entityTypes,r],[t.dataModel.relationshipTypes,o]];for(let[i,s]of a)for(let n of i){let c=e.getMemberIdsByType(n.name);s.push(...c)}return{entityIds:r,relationshipIds:o}}function Er(e,t){let r={entityIds:new Array,relationshipIds:new Array},o=[],a=e?.allLayers.find(n=>n.type==="knowledge-graph")?.inclusionModeDefinition;if(!a)return{allNamedTypesFullyDynamic:!0,bindParameters:r,nonDynamicTypes:o};let i=[[t.dataModel.entityTypes,r.entityIds],[t.dataModel.relationshipTypes,r.relationshipIds]],s=!0;for(let[n,c]of i)for(let l of n){let u=a.namedTypeDefinitions.get(l.name);if(!u){s=!1,o.push(l.name);continue}if(!u.useAllData){s=!1,o.push(l.name);for(let[p]of u.members||[])c.push(p)}}return{allNamedTypesFullyDynamic:s,bindParameters:r,nonDynamicTypes:o}}var M=3;function Ae(e,t=100){let r={};for(let o of Object.entries(e.properties??{})){let[a,i]=o;typeof i=="string"&&i.length>t?r[a]=`${i.slice(0,t)}... (truncated, original length: ${i.length})`:r[a]=i}return e.properties=r,e}function k(e){return typeof e!="object"||e===null?String(e):"details"in e&&typeof e.details=="object"&&e.details!==null&&"errorMessage"in e.details&&typeof e.details.errorMessage=="string"?e.details.errorMessage:"message"in e&&typeof e.message=="string"?e.message:String(e)}var Mr=async({kg:e,queryParams:t,targetStructure:r,targetStructureReducer:o,requestOptions:a,queryRowLimit:i,queryTimeoutMs:s})=>{let n=null,c=r,l=new AbortController,u=a?.signal,p=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",p,{once:!0}));try{let h=await nt(e,t,a);n=h.resultHeader;let w=h.resultRowsStream.getReader(),m=0,f=Date.now(),S=!1;for(;;){let{done:V,value:Ce}=await w.read();if(V)break;if(!S&&s&&Date.now()-f>s)return l.abort(),{type:"timeout"};for(let qe of Ce){if(m++,i&&m>i)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:n,processedResult:c};c=o(c,qe)}}}catch(h){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:k(h),error:h}}finally{u?.removeEventListener("abort",p)}return{type:"success",rowLimitReached:!1,resultHeader:n,processedResult:c}};async function Ne({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c,config:l}){let u;for(let p=1;p<=M;p++){let h;try{h=await ae(e,r.dataModel,o,l,u)}catch(S){return{type:"generation-error",errorMessage:k(S),error:S}}await b({text:`Attempting to execute query: ${h.graphQuery.substring(0,500)}${h.graphQuery.length>500?"...":""}`},l);let w=await _r(h.graphQuery,t),m=await Mr({kg:r,queryParams:new ke({openCypherQuery:h.graphQuery,bindParameters:w}),targetStructure:a,targetStructureReducer:i,requestOptions:s,queryRowLimit:n,queryTimeoutMs:c}),f=m.type==="aborted"?"Query execution was aborted.":m.type==="timeout"?"Query execution timed out.":m.type==="error"?`Query failed with error: ${m.errorMessage}`:"";if(m.type==="success")return{type:"success",graphQuery:h.graphQuery,explanation:h.explanation,rowLimitReached:m.rowLimitReached,resultHeader:m.resultHeader,processedResult:m.processedResult};if(m.type==="aborted")return{type:"aborted",errorMessage:f,graphQuery:h.graphQuery,explanation:h.explanation};if(p>=M)return m.type==="timeout"?{type:"timeout",errorMessage:f,graphQuery:h.graphQuery,explanation:h.explanation}:{type:"execution-error",errorMessage:f,error:m.error,graphQuery:h.graphQuery,explanation:h.explanation};u={failedGraphQuery:h.graphQuery,executionError:f,attemptCount:p},await b({text:`Attempt ${p} failed with error: ${f}. Retrying...`},l)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${M} attempts.`)}var _r=async(e,t)=>{if(!t)return{};let{bindParameters:r,parseErrors:o}=await lt(e);if(o)return t;let a={};for(let i of r)i in t&&(a[i]=t[i]);return a},kr=async({kg:e,searchQuery:t,typeCategoryFilter:r,namedTypesFilter:o,searchResultLimit:a,requestOptions:i})=>{let s=[],n=[r];r==="both"&&!e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(n=["entity","relationship"]);let c=a??1/0;try{for(let l of n){let u=c-s.length;if(u<=0)break;let p=(await it(e,new st({searchQuery:t,typeCategoryFilter:l,namedTypesFilter:o??void 0,num:u}),i)).resultRowsStream.getReader(),h=!1;for(;!h;){let{done:w,value:m}=await p.read();if(w){h=!0;break}for(let f of m)for(let S of f)s.push(S)}}}catch(l){let u=k(l);return i?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:s}},Re="IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";async function Ie({prompt:e,view:t,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:o=!1}){let a=[e];if(o&&a.push(Re),x(t)){let u=await F("arcgis_knowledge_current_lc_context"),p=xr(t.map,r);return a.push(u),{enhancedPrompt:a.join(`
85
+
86
+ `),bindParameters:p,allNamedTypesFullyDynamic:!1}}let i=t.map,{allNamedTypesFullyDynamic:s,bindParameters:n,nonDynamicTypes:c}=Er(i,r);if(s)return{enhancedPrompt:a.join(`
87
+
88
+ `),bindParameters:n,allNamedTypesFullyDynamic:!0};let l=(await F("arcgis_knowledge_current_map_context")).replaceAll("{nonDynamicTypes}",JSON.stringify(c));return a.push(l),{enhancedPrompt:a.join(`
89
+
90
+ `),bindParameters:n,allNamedTypesFullyDynamic:s}}async function $r(e,t,r,o,a,i){let{view:s}=a,n=await Ne({prompt:e,bindParameters:t,kg:r,graphQueryServiceUrl:o,targetStructure:new Map,targetStructureReducer:(h,w)=>{for(let m of w)br(m,h);return h},requestOptions:{signal:G(i),timeout:i?.timeout},config:i});if(n.type!=="success"){let h=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${h}`)}let{graphQuery:c,explanation:l,processedResult:u}=n,p=Array.from(u.values());return await b({text:`Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`},i),x(s)?(await s.map.addRecords(p),await Q(s),{generatedQuery:c,explanation:l,addedIdTypePairs:p}):(await s?.map?.allLayers.find(h=>h.type==="knowledge-graph")?.addRecords(p),{generatedQuery:c,explanation:l,addedIdTypePairs:p})}var j="addRecords",Ar=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart.")}),Nr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=q(t),{view:a}=o,i=_.getDefault().helperServices,{enhancedPrompt:s,bindParameters:n,allNamedTypesFullyDynamic:c}=await Ie({prompt:e,view:a,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!0});if(c)return{toolName:j,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}};try{let{generatedQuery:l,explanation:u,addedIdTypePairs:p}=await $r(s,n,r,`${i.aiAssistantServices.url}${i.aiAssistantServices.graphQueryAssistant}`,o,t);return{toolName:j,status:"success",summary:`Records added successfully. Cypher Query used: ${l}
91
+
92
+ Number of records added: ${p.length}`,details:{generatedQuery:l,explanation:u,addedIdTypePairs:p}}}catch(l){let u=k(l);return{toolName:j,status:"error",errorMessage:`Failed to add records to the link chart. ${u}`,error:l}}},ln=g(Nr,{name:j,description:`Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
93
+
94
+ example prompts:
95
+ - "add all suppliers and the parts they produce to the link chart"
96
+ - "show me the competitors of company x and add them to the link chart"
97
+ - "add the relationships between company x and company y to the link chart"
98
+ - "expand all the companies"
99
+ - "expand company x through all the buildings it owns"
100
+ - "connect company x and company y"
101
+ - "connect all buildings on the link chart"
102
+ `,schema:Ar});async function Rr(e,t){return await t.map?.applyLayout(e),await Q(t),{appliedLayout:e}}var Z="applyLayout",Ir=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Cr=async({layout:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedLayout:o}=await Rr(e,r);return{toolName:Z,status:"success",summary:`Successfully applied layout: ${o}.`,details:{appliedLayout:o}}}else return{toolName:Z,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error}},cn=g(Cr,{name:Z,description:"Apply a diagram layout to the link chart",schema:Ir});async function qr(e,t){return t.map?.changeNonspatialDataDisplay(e),await Q(t),{appliedNonspatialDataDisplayMode:e}}var X="changeNonspatialVisibility",zr=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Dr=async({setting:e},t)=>{let{view:r}=q(t);if(x(r)){let{appliedNonspatialDataDisplayMode:o}=await qr(e,r);return{toolName:X,status:"success",summary:`Successfully applied nonspatial visibility setting: ${o}.`,details:{appliedNonspatialDataDisplayMode:o}}}else return{toolName:X,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error}},dn=g(Dr,{name:X,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:zr});async function Pr(e,t,r,o,a){let i,s="";for(let n=1;n<=M;n++){let{graphQuery:c,explanation:l}=await ae(e,t.dataModel,r,a,i);try{await b({text:`Attempting to create link chart from derived query: ${c}`},a);let u=await at.fromCypherQuery(t,new ke({openCypherQuery:c}));await b({text:"Link chart created successfully, loading..."},a),await u.load();let p=o.map;return o.map=u,await o.when(),await _e.whenOnce(()=>!o.updating),u.entityCount===0&&u.relationshipCount===0?(o.map===u&&(o.map=p),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
103
+ ${c}
104
+
105
+ Explanation: ${l}`}):(await Q(o),{type:"success",graphQuery:c,explanation:l})}catch(u){let p=k(u);if(n>=M){s=p;break}i={failedGraphQuery:c,executionError:p,attemptCount:n},await b({text:`Attempt ${n} to create link chart failed with error: ${p}. Retrying ...`},a)}}return{type:"error",errorMessage:`Failed to create link chart after ${M} attempts. Last error: ${s}`}}var L="createLinkChart",Or=d.object({prompt:d.string().describe("The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it.")}),jr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),{view:o}=q(t);if(x(o)){let a=_.getDefault().helperServices,i=await Pr(`${e}
106
+
107
+ ${Re}`,r,`${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,o,t);if(i.type==="error")return{toolName:L,status:"error",errorMessage:i.errorMessage,error:new Error};let{graphQuery:s,explanation:n}=i;return{toolName:L,status:"success",summary:`Link chart created successfully. Cypher Query used to create the link chart:
108
+ ${s}
109
+
110
+ Explanation: ${n}`,details:{generatedQuery:s,explanation:n}}}else return{toolName:L,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error}},un=g(jr,{name:L,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",schema:Or}),Y="queryGraphData",Lr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user.")}),Fr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices,a=e,i=null,s=null;try{({view:s}=q(t))}catch{}s&&({enhancedPrompt:a,bindParameters:i}=await Ie({prompt:e,view:s,knowledgeGraph:r,includeReturnEntityAndRelationshipContext:!1}));let n=await Ne({prompt:a,bindParameters:i,kg:r,graphQueryServiceUrl:`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,S)=>(f.push(S),f),requestOptions:{signal:G(t),timeout:t?.timeout},config:t});if(n.type!=="success"){let f=n.type==="generation-error"?n.errorMessage:`${n.errorMessage} Cypher query: ${n.graphQuery}`;return{toolName:Y,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in n?n.error:null}}let{graphQuery:c,explanation:l,processedResult:u,resultHeader:p}=n,h=p.headerKeys;for(let f of u)for(let S of f)E(S,V=>Ae(V));let w=50,m=u.slice(0,w).map(f=>JSON.stringify(f));return{toolName:Y,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
111
+
112
+ \`\`\`cypher
113
+ ${c}
114
+ \`\`\`
115
+
116
+ Query Results:
117
+ ${m.length} result(s) found.
118
+
119
+ Column Headers: ${h.join(", ")}
120
+
121
+ ${m.length>w?`Showing top ${w} results:
122
+
123
+ `:`Results:
124
+
125
+ `}${m.join(`
126
+ `)}
127
+ `,details:{generatedQuery:c,explanation:l,resultHeader:{headerKeys:h,exceededTransferLimit:p.exceededTransferLimit,outSpatialReference:p.outSpatialReference},queryResults:u}}},pn=g(Fr,{name:Y,description:"Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",schema:Lr}),ee="generateCypher",Qr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),Gr=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t),o=_.getDefault().helperServices;try{let{graphQuery:a,explanation:i}=await wr(e,r.dataModel,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,t);return{toolName:ee,status:"success",summary:`Generated Graph Query:
128
+ ${a}
129
+
130
+ Explanation: ${i}`,details:{generatedQuery:a,explanation:i}}}catch(a){let i=k(a);return{toolName:ee,status:"error",errorMessage:`Failed to generate Cypher query. ${i}`,error:a}}},hn=g(Gr,{name:ee,description:"Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",schema:Qr}),Vr=e=>{let t=e.dataModel,r=new Map;for(let n of t.searchIndexes)if(n.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[c,l]of n.searchProperties.entries()){let u=r.get(c)??new Set;l.propertyNames.forEach(p=>u.add(p)),r.set(c,u)}let o=t.entityTypes.filter(n=>r.has(n.name)),a=t.relationshipTypes.filter(n=>r.has(n.name)),i=`Entity Types:
131
+ ${o.map(({name:n})=>`${n}: [${Array.from(r.get(n)??[]).join(", ")}]`).join(`
132
+ `)}`,s=`Relationship Types:
133
+ ${a.map(({name:n})=>`${n}: [${Array.from(r.get(n)??[]).join(", ")}]`).join(`
134
+ `)}`;return`${i}
135
+
136
+ ${s}`};async function Br(e,t,r){let o=await F("arcgis_knowledge_lucene_generation_prompt"),a={inquiry:e,dataModelForSearch:Vr(t)},i=d.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),s=d.number().int().positive().nullable().describe("The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."),n=d.array(d.enum(t.dataModel.entityTypes.map(l=>l.name).concat(t.dataModel.relationshipTypes.map(l=>l.name)))).min(1),c=d.object({query:d.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:n.nullable().describe("Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"),typeCategoryFilter:i,resultLimit:s});return await ce({promptText:o,inputVariables:a,schema:c,config:r})}var te="searchGraphData",Kr=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results.")}),Ur=async({prompt:e},t)=>{let{knowledgeGraph:r}=await z(t);await b({text:"Generating search query for the user inquiry"},t);let o=await Br(e,r,t);await b({text:"Executing graph search with generated search query"},t);let a=await kr({kg:r,searchQuery:o.query,typeCategoryFilter:o.typeCategoryFilter,namedTypesFilter:o.typeFilters,searchResultLimit:o.resultLimit,requestOptions:{signal:G(t),timeout:t?.timeout}});if(a.type!=="success")return{toolName:te,status:"error",errorMessage:a.errorMessage,error:"error"in a?a.error:null};for(let n of a.results)E(n,c=>Ae(c));let i=10,s=a.results.slice(0,i);return{toolName:te,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
137
+ Query: ${o.query}
138
+ Type Category Filter: ${o.typeCategoryFilter}
139
+ Named Type Filters: ${o.typeFilters?o.typeFilters.join(", "):"None"}
140
+ Result Limit: ${o.resultLimit??"No limit"}
141
+
142
+ Search Results: ${a.results.length} result(s) found.
143
+
144
+ ${a.results.length>i?`Showing top ${i} results:
145
+
146
+ `:""}${s.map(n=>JSON.stringify(n)).join(`
147
+ `)}`,details:{generatedSearchQuery:o,searchResults:a.results}}},mn=g(Ur,{name:te,description:`
148
+ Search the knowledge graph using one or more search texts, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.
149
+ Example prompts:
150
+ - "Find 'Bradley'"
151
+ - "find the person john smith"
152
+ - "find all people named smith"
153
+ - "Find all references to 'delayed parts shipment'"
154
+ - "Find all reports authored by someone with the title of 'Researcher'"
155
+ - "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
156
+ - "Search for all john smiths and show their global ids`,schema:Kr});return{a:O,b:Fa,c:F,d:ct,e:Qa,f:Ga,g:dt,h:Va,i:Ba,j:Ka,k:Ua,l:Ha,m:Ja,n:Wa,o:Za,p:Xa,q:Ya,r:en,s:tn,t:rn,u:on,v:an,w:nn,x:sn,y:z,z:J,A:ln,B:cn,C:dn,D:un,E:pn,F:hn,G:mn}},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","applications/KnowledgeStudio/generalSharedKgUtils",a,c,e,f,h,i)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as d,b as S,c as v}from"./CP5BVGJU.js";import b from"./OWTGH34K.js";import{d as f,e as y}from"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import{c as u}from"./HHFNQR6Z.js";import{b as c}from"./VOKXKU7M.js";import{Y as g,y as l}from"./EWLXNGKH.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,r,e,s)=>{for(var o=s>1?void 0:s?x(r,e):r,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(s?p(r,e,o):p(o))||o);return s&&o&&k(r,e,o),o},i=class extends w{constructor(t){super(t),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=f(this.getSchemas());this._set("workspace",t);let r=this.id,e={[r]:this._invoke.bind(this)},s=[{from:r,decide:()=>{}}];this._set("createGraph",()=>y(e,s,t,{agent:this,entryNode:r,middlewares:this.middlewares}))}async _invoke(t,r){try{return this.outputSchema?await this._invokeStructured(t,r):await this._invokeUnstructured(t,r)}catch(e){if(l(e))throw e;let s=e instanceof Error?e.message:String(e);return d({outputMessage:s},"failed",s)}}async _invokeStructured(t,r){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},r);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,r){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},r)).messages,s=e.at(-1)?.content??"",o=typeof s=="string"?s:JSON.stringify(s),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let r=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(r[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(r)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./6VJXUIXY.js";import{a as E}from"./5FL5BTTX.js";import{a as I}from"./434TAA3J.js";import{b as L}from"./V6F3HEK7.js";import{a as R}from"./3UEKINYC.js";import"./RLEHNAIA.js";import a from"./AT4XVTJR.js";import"./7M6VKBTK.js";import{g as S,h as c,k as P,l as C,n as d,t as y,u as v,v as A,x as _,z as T}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([z,{whenOnce:B,watch:q,when:V},j,,F,,,N,{property:m,subclass:H},,{b:D}])=>{var W=S`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function $(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...$(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?$(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...$(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
3
+ `),i=!1,e=0,n=0;for(let r of s)/^\s*(```|~~~)/u.test(r)&&(i=!i),n+=r.length+1,r.trim()===""&&!i&&(e=n);return e<t.length?e:0}_trimIncompleteTail(t){let s=t.lastIndexOf("<");if(s!==-1&&!t.includes(">",s))return t.slice(0,s);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let e=t.lastIndexOf("[");if(e!==-1){let n=t.slice(e);if(!/\[[^\]]*\]\([^)]*\)/u.test(n))return t.slice(0,e)}return t}_earliestUnclosedTag(t){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,e=[];for(let n=i.exec(t);n;n=i.exec(t)){let[,r,a,l]=n,h=a.toLowerCase();if(!(s.has(h)||l==="/"))if(r==="/"){for(let g=e.length-1;g>=0;g--)if(e[g].name===h){e.splice(g);break}}else e.push({name:h,index:n.index})}return e.length?e[0].index:-1}};function G(o){let t=new f;return t.push(o),t.finalize()}var Z=async o=>await new Promise(t=>setTimeout(t,o));async function*J(o,{chunkSize:t=15,delay:s=50}={}){let i=new f;for(let e=0;e<o.length;e+=t)yield i.push(o.slice(e,e+t)),await Z(s);yield i.finalize()}var K=Object.defineProperty,Q=Object.getOwnPropertyDescriptor,u=(o,t,s,i)=>{for(var e=i>1?void 0:i?Q(t,s):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(e=(i?r(t,s,e):r(e))||e);return i&&e&&K(t,s,e),e},M=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*O(o,t,s,i,e=!1){if(e){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:G(o)},runId:t};return}for await(let n of J(o)){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:n},runId:t}}}var p=class extends N{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await B(()=>!this.view.updating),this._set("orchestrator",await D.init({agents:[...this.agents],runtimeEventsEnabled:this.runtimeEventsEnabled,view:this.view??void 0})),this.addHandles([q(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let s=[],i,e="pending";try{let n=this.orchestrator.ask(o);for await(let r of n)switch(e=r.runId,r.type){case"runtime":{yield{type:"runtime",event:r,runId:e};break}case"trace":{this._set("processingStep",r.data.text),s.push(r.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let a=r.result,l=!!a.content.length,h=!!i?.length;if(!l&&!h){yield{type:"completed",error:"No response received.",log:s,runId:e};return}let g=a.content;if(yield{type:"block-start",blockType:"text",runId:e},yield*O(g,e,s,t,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:e},h)for(let k of i){if(t?.aborted){yield{type:"cancelled",log:s,runId:e};return}let{type:b,data:w}=k;if(yield{type:"block-start",blockType:b,runId:e},b==="text"){let U=typeof w?.content=="string"?w.content:"";yield*O(U,e,s,t,this.streamingDisabled)}else yield{type:"block-data",blockType:b,data:w,runId:e};yield{type:"block-end",blockType:b,runId:e}}yield{type:"completed",response:g,blocks:i,log:s,runId:e};return}case"ux-suggestion":{let a=r.suggestion;i=i?[...i,a]:[a];break}case"interrupt":{let{kind:a,message:l,metadata:h}=r.interrupt,g=Array.isArray(h)?h.filter(b=>typeof b=="string"):[],k=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:l,options:g};case"singleSelection":return{type:"single-select",message:l,options:g};case"multipleSelection":return{type:"multi-select",message:l,options:g};case"textInput":return{type:"text-input",message:l};default:return{type:a,message:l,options:g}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:k,runId:e};break}case"cancelled":{yield{type:"cancelled",log:s,runId:e};return}case"error":{if(t?.aborted||M(r.error)){yield{type:"cancelled",log:s,runId:e};return}yield{type:"completed",error:r.error.message,log:s,runId:e};return}default:{console.warn("Unknown event type:",r);break}}}catch(n){if(t?.aborted||M(n)){yield{type:"cancelled",log:s,runId:e};return}console.warn("Error during message processing:",n),yield{type:"completed",error:"An error occurred during message processing.",log:s,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};u([m({readOnly:!0})],p.prototype,"orchestrator",2);u([m()],p.prototype,"agents",2);u([m()],p.prototype,"portal",2);u([m()],p.prototype,"view",2);u([m()],p.prototype,"streamingDisabled",2);u([m()],p.prototype,"runtimeEventsEnabled",2);u([m({readOnly:!0})],p.prototype,"loading",2);u([m({readOnly:!0})],p.prototype,"processing",2);u([m({readOnly:!0})],p.prototype,"processingStep",2);p=u([H("OrchestratorController")],p);var X="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",Y="Embeddings not found for this web map.",tt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",x=class extends A{constructor(){super(...arguments),this._messages=L({blocking:!0}),this.#t=y(),this.#l=y(),this.#s=y(),this.#e=null,this.#r=new Map,this.#i=j.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let s=t.detail;this.submitInterrupt(s)},this.#c=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let s=t.detail;this._inputValue="",this.arcgisSubmit.emit(s),this.submitMessage(s)},this.#h=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#g=t=>{t.stopPropagation();let s=t.detail;this.arcgisFeedback.emit(s)},this.#d=t=>{t.stopPropagation();let s=t.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new z([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.userAvatarEnabled=!1,this.arcgisCancel=d(),this.arcgisError=d(),this.arcgisFeedback=d(),this.arcgisInterrupt=d(),this.arcgisInterruptCancel=d(),this.arcgisInterruptSubmit=d(),this.arcgisPromptSelect=d(),this.arcgisReady=d(),this.arcgisResponse=d(),this.arcgisRuntime=d({bubbles:!1,composed:!1}),this.arcgisSlottableRequest=d({bubbles:!1,composed:!1}),this.arcgisSubmit=d()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,runtimeEventsEnabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5,userAvatarEnabled:5}}static{this.styles=W}#t;#l;#s;#e;#r;#i;#a;#n;#c;#h;#g;#d;#p;get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#o()}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}async submitMessage(t){let s=t.trim();if(!s||(this.messages.push({id:Date.now().toString(),role:"user",content:s}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this._orchestratorController.ask(s,this.#e?.signal);for await(let e of i){let n=e.runId,r=this.messages.at(-1);switch(e.type){case"runtime":this.arcgisRuntime.emit(e.event);break;case"block-start":{this._isAnswering=!0;let a={type:e.blockType,isPending:!0};if(r?.role==="assistant"&&r.id===n){let l=[...r.blocks??[],a];this.messages.splice(-1,1,{...r,blocks:l})}else this.messages.push({role:"assistant",blocks:[a],id:n,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1],{blockType:h,data:g}=e;if(l?.type!==h||!l.isPending)break;h==="text"?a[a.length-1]={...l,data:{...l.data,parts:g?.parts}}:a[a.length-1]={...l,data:{...l.data,...g??{}}},this.messages.splice(-1,1,{...r,blocks:a});break}case"block-end":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1];if(l?.type!==e.blockType||!l.isPending)break;let h=l;a[a.length-1]={...h,data:{...h.data},isPending:!1},this.messages.splice(-1,1,{...r,blocks:a});break}case"completed":e.error?(this.messages.push({role:"assistant",log:e.log,error:e.error,id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]):r?.role==="assistant"&&r.id===n&&this.messages.splice(-1,1,{...r,content:e.response,blocks:r.blocks?.map(a=>({...a,data:{...a.data},isPending:!1}))??[],isStreaming:!1,log:e.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...e.payload,id:n},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":r?.role==="assistant"&&r.id===n?this.messages.splice(-1,1,{...r,blocks:r.blocks?.filter(a=>a.type==="text"||!a.isPending)??[],isStreaming:!1,log:e.log,error:`(${this._messages.stoppedByUserLabel})`}):(this.messages.push({role:"assistant",log:e.log,error:`(${this._messages.stoppedByUserLabel})`,id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#o()}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#c),this.#t.value?.addEventListener("arcgisCancel",this.#h),this.#t.value?.addEventListener("arcgisFeedback",this.#g);let t=V(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),s=this.messages.on("after-add",i=>{let e=i.item;e.role==="assistant"&&(e.error||e.content)&&this.arcgisResponse.emit(e)});return queueMicrotask(()=>{this.#o().then(i=>{i?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),s.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#c),this.#t.value?.removeEventListener("arcgisCancel",this.#h),this.#t.value?.removeEventListener("arcgisFeedback",this.#g),this._orchestratorController?.destroy(),this._orchestratorController=null}})}async#o(){try{let t=R(this.el,this.referenceElement);await t?.componentOnReady();let s=[...this.#r.values()];return s.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:s,portal:this.#i,runtimeEventsEnabled:this.runtimeEventsEnabled,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),this.requestUpdate(),!0):(this._error=this._messages.noAgentsFoundMessage,!1)}catch(t){return this._error=t?.message??this._messages.orchestratorInitializationErrorMessage,C(this)(t),!1}}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:c`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t?c`<calcite-link slot=link @click=${async()=>{try{let s=await F.getCredential(`${t.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#o()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}catch(s){this._error=s?.message??this._messages.signInErrorMessage,this.arcgisError.emit(new Error(this._error)),P("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title=${this._messages.signInToArcGISOnlineLabel??_}>${this._messages.signInLabel}</calcite-link>`:c`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===X?c`<div slot=message>${Y}</div><calcite-link slot=link .href=${tt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel??_}>${this._messages.readMoreLabel}</calcite-link>`:c`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return c`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${v(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?c`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((s,i)=>c`<slot name=${I(t.id,i)??_} slot=${I(t.id,i)??_}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:c`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?c`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>`:c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${v(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt} ${v(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#l.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};T("arcgis-assistant",x);return x},"core/Collection","core/reactiveUtils","portal/Portal","request","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`# ArcGIS Online Map Viewer \u2014 Layer Filter Tool Calling Assistant
2
+ import"./UZLQALHY.js";var e=`# ArcGIS Online Map Viewer \u2014 Layer Filter Tool Calling Assistant
3
3
 
4
4
  You are an assistant that helps manage layer filters and visual effects for **ArcGIS Online Map Viewer** by selecting and calling the appropriate tool.
5
5
 
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./VNJMTA6O.js";import"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./Z5W4V7RC.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToZoomTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./WKTQVBFJ.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToLayerTool};
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as e,b as n}from"./4KOV2NEI.js";import"./5FL5BTTX.js";import{g as r,h as i,v as s,z as c}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=r`.container{border-radius:var(--calcite-border-radius);margin-bottom:var(--calcite-spacing-md)}.block{margin:0;background-color:var(--calcite-color-foreground-1);width:100%;max-height:300px;overflow:auto}.entry{margin-left:var(--calcite-spacing-sm);padding:var(--calcite-spacing-xxs) var(--calcite-spacing-lg);border-left:1px solid var(--calcite-color-border-1)}`,o=class extends s{constructor(){super(...arguments),this.logEnabled=!1,this.showLog=!1}static{this.properties={logEnabled:5,showLog:5,log:0}}static{this.styles=l}render(){return this.log?.length&&this.showLog&&this.logEnabled?i`<div class="container"><div class="block"><calcite-accordion appearance=transparent icon-position=start icon-type=chevron scale=s>${this.log.map(a=>{let t=a.includes(`
3
+ `)||a.length>70;return i`<calcite-accordion-item .heading=${t?`${a.substring(0,70)}...`:a} .expanded=${t}><div class="entry">${t?e(n(a)):null}</div></calcite-accordion-item>`})}</calcite-accordion></div></div>`:null}};c("arcgis-assistant-message-log",o);export{o as ArcgisAssistantMessageLog};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([y,u])=>{var m=750;function c(e){return"point"in e&&e.point!==void 0}function d(e){return"layerId"in e&&e.layerId!==void 0}var w=async(e,a)=>{if(c(e)){let{point:r}=e;return{geometry:new y({x:r.x,y:r.y,spatialReference:r.spatialReference?{wkid:r.spatialReference.wkid}:a.spatialReference})}}if(d(e)){let r=a.map?.allLayers.find(t=>t.id===e.layerId);if(!r)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let l=r.title??r.id,s=e.where?.trim()||"1=1";try{let t=await r.queryFeatures({where:s,returnGeometry:!0,outSpatialReference:a.spatialReference,num:m+1});if(!t.features.length)return{error:`No features found in geometry layer "${l}" with the specified where clause: ${s}`};if(t.features.length>m)return{error:`Geometry filter for layer "${l}" matched too many features (${t.features.length}+). Please narrow the geometry layer filter.`};let i=t.features.map(o=>o.geometry).filter(o=>!!o);if(!i.length)return{error:"No valid geometries found for the matched geometry layer features."};let n=i.length===1?i[0]:u.executeMany(i);return n?(n.spatialReference||(n.spatialReference=a.spatialReference),{geometry:n}):{error:"Failed to combine geometries from geometry layer."}}catch(t){return{error:`Failed to query geometry: ${String(t)}`}}}return{error:"Invalid geometry configuration provided"}},g=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],R=f.enum(g);return{a:c,b:d,c:w,d:R}},"geometry/Point","geometry/operators/unionOperator")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ var s=t=>t.replace(o,(e,n)=>`${n===0?"":"-"}${e.toLowerCase()}`),o=/[A-Z]+(?![a-z])|[A-Z]/gu;var r="randomUUID"in crypto,c=()=>{if(r)return crypto.randomUUID();let t=crypto.getRandomValues(new Uint16Array(8));t[3]=t[3]&4095|16384,t[4]=t[4]&16383|32768;let e=n=>t[n].toString(16).padStart(4,"0");return`${e(0)+e(1)}-${e(2)}-${e(3)}-${e(4)}-${e(5)}${e(6)}${e(7)}`};export{s as a,c as b};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./5WYRJMBW.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as clearFiltersTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ export default $arcgis.t(([F,$])=>{var w=10,N=["string","small-integer","integer"],b=async(l,e,{includeSummaryStatistics:d=!0,includeUniqueValues:f=!0}={})=>{let u=null,i=null;try{if(e.type!=="geometry"&&e.type!=="oid"&&e.type!=="global-id"){d&&(u=await F({layer:l,field:e.name}));let s=e.domain?.type==="coded-value"?e.domain:null;f&&(N.includes(e.type)||s)&&(i=(await $({layer:l,field:e.name})).uniqueValueInfos.sort((n,y)=>y.count-n.count).slice(0,w),s&&(i=i.map(n=>({...n,value:s.getName(n.value)??n.value}))))}}catch(s){console.error(`Error fetching statistics for field ${e.name}:`,s)}return{summaryStatistics:u,uniqueValues:i}};function x(l,e){return["string","small-integer","integer"].includes(l)||e==="coded-value"}async function j(l,e,d,f=!0){let u=[],i=[],s=[];for(let n of l){let y=function(a){let t=e.get(a)?.layerItem;return t?[t.name&&`Name: ${t.name}`,t.title&&`Title: ${t.title}`,t.description&&`Description: ${t.description}`].filter(Boolean).join(" | "):a},{layerId:r,results:I}=n,V=d.map?.allLayers.find(a=>a.id===r),p=e.get(r)?.fieldRegistry;if(!p)continue;let c=u.find(a=>a.layerId===r);c||(c={layerId:r,layerSummary:y(r),fieldInfos:[]},u.push(c));for(let a of I){let t=p.get(a.name);if(!t)continue;let o=t.statistics,g=f&&!o?.summaryStatistics,S=x(t.type,t.domain?.type)&&!o?.uniqueValues,h=g||S;if(s.push({layerId:r,fieldName:t.name,didFetchStatistics:h}),h){let v=b(V,t,{includeSummaryStatistics:g,includeUniqueValues:S}).then(q=>{let m={summaryStatistics:o?.summaryStatistics??null,uniqueValues:o?.uniqueValues??null};g&&(m.summaryStatistics=q.summaryStatistics),S&&(m.uniqueValues=q.uniqueValues),p.set(t.name,{...t,statistics:m}),t.statistics=m});i.push(v)}c.fieldInfos.push(t)}}return await Promise.all(i),{layerFieldInfo:u,didFetchStatistics:i.length>0,fieldStatisticsFetchStatus:s}}return j},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues")
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ var d=(...o)=>{let t=[];for(let n=0;n<o.length;++n){let s=o[n];if(typeof s=="string")t.push(s);else if(Array.isArray(s))t.push.apply(t,s);else if(typeof s=="object")for(let a in s)s[a]&&t.push(a)}let e=t.join(" ");return t.length=0,e},u=(o,t)=>{let e=o;for(;e;){if(e===t)return!0;if(!e.parentNode)return!1;e.parentNode instanceof ShadowRoot?e=e.parentNode.host:e=e.parentNode}return!1},g=(o,t,e)=>{let n=m(t).subscribe;return n(s=>{s.some(r=>u(o,r.target))&&e()})},l={},m=o=>{let t=o.join(","),e=l[t];if(e!==void 0)return e;let n=new Set,s=new MutationObserver(r=>n.forEach(c=>c(r)));globalThis.document&&s.observe(document.documentElement,{attributes:!0,attributeFilter:o,subtree:!0});let a={subscribe:r=>(n.add(r),()=>{n.delete(r),n.size===0&&(s.disconnect(),l[t]=void 0)})};return l[t]=a,a},i=(o,t)=>{let e=o;for(;e;){let n=e.closest?.(t);if(n)return n;let s=e.getRootNode?.();if(s===globalThis.document)return;e=s?.host}};var h=(o,t,e)=>i(o,`[${t}]`)?.getAttribute(t)??e;export{d as a,g as b,i as c,h as d};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as r}from"./V6F3HEK7.js";import"./RLEHNAIA.js";import{g as a,h as e,n as s,v as c,z as l}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var o=a`:host{padding:var(--calcite-spacing-md);background:var(--calcite-panel-background-color, var(--calcite-color-background))}calcite-panel{border-radius:var(--calcite-dialog-corner-radius, var(--calcite-corner-radius-sm));border:0 solid var(--calcite-color-brand);border-block-start-width:4px;box-shadow:var(--calcite-shadow-md);width:100%;--calcite-panel-border-color: none}.interrupt-content{padding:0 var(--calcite-spacing-md);background:var(--calcite-color-foreground-1)}`,i=class extends c{constructor(){super(...arguments),this._messages=r({blocking:!0}),this._selectedOptions=[],this.arcgisCancel=s(),this.arcgisSubmit=s()}static{this.properties={_selectedOptions:16,type:1,message:1,options:0}}static{this.styles=o}_renderInterruptOptions(){switch(this.type){case"single-select":return e`<calcite-list selection-mode=single-persist .label=${this._messages.optionsLabel} @calciteListChange=${t=>this._selectedOptions=t.target.selectedItems[0]?.value}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return e`<calcite-list selection-mode=multiple .label=${this._messages.optionsLabel} @calciteListChange=${t=>this._selectedOptions=t.target.selectedItems.map(n=>n.value)}>${this.options?.map(t=>e`<calcite-list-item .label=${t} .value=${t}></calcite-list-item>`)}</calcite-list>`;case"boolean-choice":return null;case"text-input":return e`<calcite-input .label=${this._messages.enterTextLabel} @calciteInputInput=${t=>this._selectedOptions=t.target.value}></calcite-input>`}}render(){return e`<calcite-panel .description=${this.message}><div class="interrupt-content">${this._renderInterruptOptions()}</div>${this.type==="boolean-choice"?e`<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisSubmit.emit(!1)}>${this._messages.declineButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid @click=${()=>this.arcgisSubmit.emit(!0)}>${this._messages.approveButtonLabel}</calcite-button>`:e`<calcite-button slot=footer-end appearance=outline @click=${()=>this.arcgisCancel.emit()}>${this._messages.cancelButtonLabel}</calcite-button><calcite-button slot=footer-end appearance=solid .disabled=${!this._selectedOptions.length} @click=${()=>this.arcgisSubmit.emit(this._selectedOptions)}>${this._messages.submitButtonLabel}</calcite-button>`}</calcite-panel>`}};l("arcgis-assistant-interrupt",i);export{i as ArcgisAssistantInterrupt};
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`# ArcGIS JavaScript SDK FeatureLayerView Query Assistant
2
+ import"./UZLQALHY.js";var e=`# ArcGIS JavaScript SDK FeatureLayerView Query Assistant
3
3
 
4
4
  You are a GIS assistant that generates query parameters for the ArcGIS JavaScript SDK FeatureLayerView \`queryFeatures()\` method.
5
5
 
@@ -39,10 +39,13 @@ Prior steps:
39
39
  Last navigated features from shared state (if available):
40
40
  {lastNavigatedFeatures}
41
41
 
42
+ Last resolved location from shared state (if available):
43
+ {lastResolvedLocation}
44
+
42
45
  Use the assigned task as the primary instruction for the current query.
43
46
  Use the latest user request as supporting context when needed.
44
47
  Use prior steps only when the assigned task or user request clearly depends on earlier results.
45
- Use lastNavigatedFeatures as authoritative context for map-navigation references when present.
48
+ Use shared-state context (\`lastResolvedLocation\`, \`lastNavigatedFeatures\`) for referential follow-ups when relevant.
46
49
  Use chat history only when necessary to understand conversational references, and do not override the assigned task.
47
50
 
48
51
  ### Anchor selection rule (strict, single source of truth)
@@ -50,8 +53,9 @@ Use chat history only when necessary to understand conversational references, an
50
53
  When the request is referential (for example: "this", "it", "that", "those", "them", "of those", "the same one(s)"), choose exactly one anchor using this priority order:
51
54
 
52
55
  1. Explicit entity named in the current request (if present)
53
- 2. \`lastNavigatedFeatures\` (if present)
54
- 3. The immediately previous successful relevant step from \`priorSteps\`
56
+ 2. \`lastResolvedLocation\` (if present and the request refers to a place/location)
57
+ 3. \`lastNavigatedFeatures\` (if present)
58
+ 4. The immediately previous successful relevant step from \`priorSteps\`
55
59
 
56
60
  After selecting the anchor, keep that anchor for this query and do not switch to an older entity.
57
61
  If \`lastNavigatedFeatures\` is used as the anchor, reuse its \`layerId\` and \`where\` for query scope unless the current request explicitly overrides it.
@@ -78,7 +82,8 @@ Start with a fresh WHERE clause for each new question. Do not inherit filters fr
78
82
 
79
83
  This is an exception to the "fresh WHERE clause" rule above.
80
84
 
81
- - If the anchored context indicates \`useCurrentExtent: true\`, use \`useCurrentExtent: true\` with \`where: "1=1"\`.
85
+ - If the anchored context is \`lastResolvedLocation\` with a point, prefer \`geometryFilter.point\` and use \`where: "1=1"\` unless the user asked for additional attribute filters.
86
+ - Only use \`useCurrentExtent: true\` when the user explicitly asks about the current view/map extent (for example: "in my view", "on my map", "visible now").
82
87
  - If the anchored context includes specific feature IDs/objectIds, scope to those IDs.
83
88
  - Otherwise, use the anchored \`layerId\` + \`where\` combination.
84
89
 
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as n}from"./V6F3HEK7.js";import"./RLEHNAIA.js";import{g as i,h as a,v as t,z as e}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var r=i`:host{display:contents}.icon{padding:var(--calcite-spacing-sm);border-radius:var(--calcite-spacing-xl);background:var(--calcite-color-brand);color:var(--calcite-color-foreground-1)}.loading-container{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);padding:0 var(--calcite-spacing-sm)}.loading{display:flex;align-items:center;gap:var(--calcite-spacing-sm)}.text{font-style:italic;word-wrap:break-word;word-break:break-all;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;line-clamp:1;-webkit-box-orient:vertical}.skeleton-block{display:flex;flex-direction:column;gap:var(--calcite-spacing-sm);width:100%}.skeleton-text{display:block;height:.95em;border-radius:var(--calcite-border-radius);background:linear-gradient(90deg,color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent),color-mix(in srgb,var(--calcite-color-foreground-3) 85%,transparent),color-mix(in srgb,var(--calcite-color-foreground-2) 65%,transparent));background-size:200% 100%;animation:assistant-message-loading-shimmer 1.2s ease-in-out infinite;width:85%}.skeleton-text:last-child{width:70%}@keyframes assistant-message-loading-shimmer{0%{background-position:-150% 0}to{background-position:150% 0}}@media(prefers-reduced-motion){.skeleton-text{animation:none}}`,s=class extends t{constructor(){super(...arguments),this._messages=n({blocking:!0}),this.loading=!1,this.loadingMessage="",this.assistantAvatarEnabled=!1}static{this.properties={loading:5,loadingMessage:1,assistantAvatarEnabled:5,interrupts:0}}static{this.styles=r}render(){return this.loading?a`<arcgis-assistant-message .assistantAvatarEnabled=${this.assistantAvatarEnabled} footer-disabled>${this.assistantAvatarEnabled?a`<slot name=icon slot=icon><calcite-icon class="icon" icon=effects scale=s></calcite-icon></slot>`:null}<slot name=content slot=content><arcgis-assistant-interrupt-preview .interrupts=${this.interrupts}></arcgis-assistant-interrupt-preview><div class="loading-container"><div class="loading"><calcite-loader .label=${this._messages.loadingLabel} inline></calcite-loader><div class="text">${this.loadingMessage}</div></div><div class="skeleton-block"><span class="skeleton-text"></span><span class="skeleton-text"></span></div></div></slot></arcgis-assistant-message>`:null}};e("arcgis-assistant-message-loading",s);export{s as ArcgisAssistantMessageLoading};