@arcgis/ai-components 5.1.0-next.13 → 5.1.0-next.130

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 (611) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-utils/BaseAgent.d.ts +90 -0
  3. package/dist/agent-utils/BaseAgent.js +87 -0
  4. package/dist/agent-utils/FunctionAgent.d.ts +64 -0
  5. package/dist/agent-utils/FunctionAgent.js +98 -0
  6. package/dist/agent-utils/LLMAgent.d.ts +65 -0
  7. package/dist/agent-utils/LLMAgent.js +139 -0
  8. package/dist/agent-utils/WorkflowAgent.d.ts +44 -0
  9. package/dist/agent-utils/WorkflowAgent.js +70 -0
  10. package/dist/agent-utils/middlewares/humanInTheLoop.d.ts +152 -0
  11. package/dist/agent-utils/middlewares/humanInTheLoop.js +94 -0
  12. package/dist/agent-utils/middlewares/middleware.d.ts +25 -0
  13. package/dist/agent-utils/middlewares/middleware.js +44 -0
  14. package/dist/agent-utils/middlewares/trace.d.ts +25 -0
  15. package/dist/agent-utils/middlewares/trace.js +50 -0
  16. package/dist/agent-utils/middlewares/types.d.ts +123 -0
  17. package/dist/agent-utils/middlewares/types.js +2 -0
  18. package/dist/agent-utils/tools/FunctionTool.d.ts +127 -0
  19. package/dist/agent-utils/tools/FunctionTool.js +80 -0
  20. package/dist/agent-utils/types.d.ts +152 -0
  21. package/dist/agent-utils/workflows/BaseWorkflow.d.ts +87 -0
  22. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +72 -0
  23. package/dist/agent-utils/workflows/ConditionalWorkflow.js +61 -0
  24. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +58 -0
  25. package/dist/agent-utils/workflows/LoopWorkflow.js +56 -0
  26. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +68 -0
  27. package/dist/agent-utils/workflows/ParallelWorkflow.js +129 -0
  28. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +63 -0
  29. package/dist/agent-utils/workflows/RouterWorkflow.js +75 -0
  30. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +56 -0
  31. package/dist/agent-utils/workflows/SequentialWorkflow.js +69 -0
  32. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +74 -0
  33. package/dist/agent-utils/workflows/SwitchWorkflow.js +84 -0
  34. package/dist/assets/embeddings.worker-k9_Ou679.js +1 -0
  35. package/dist/cdn/3352JWU3.js +72 -0
  36. package/dist/cdn/43BXVTTX.js +3 -0
  37. package/dist/cdn/45WQFXC6.js +2 -0
  38. package/dist/cdn/53Z3R4OY.js +98 -0
  39. package/dist/cdn/5BWAWCMA.js +2 -0
  40. package/dist/cdn/6HIZCLMG.js +2 -0
  41. package/dist/cdn/6MS2XN27.js +2 -0
  42. package/dist/cdn/72HM6DTZ.js +22 -0
  43. package/dist/cdn/AZTWZFVA.js +16 -0
  44. package/dist/cdn/CKVNSPM3.js +141 -0
  45. package/dist/cdn/COFOUGFJ.js +4 -0
  46. package/dist/cdn/CY2AOS7J.js +2 -0
  47. package/dist/cdn/DPCBYJAM.js +2 -0
  48. package/dist/cdn/DQIMHH5V.js +2 -0
  49. package/dist/cdn/DXWRFET6.js +2 -0
  50. package/dist/cdn/F2QU4HAK.js +2 -0
  51. package/dist/cdn/FKSLZTUY.js +14 -0
  52. package/dist/cdn/H4ENPGSI.js +2 -0
  53. package/dist/cdn/HFQQORS4.js +2 -0
  54. package/dist/cdn/{LTBEINKG.js → HJGF7W5O.js} +12 -1
  55. package/dist/cdn/HWSIV5DK.js +2 -0
  56. package/dist/cdn/I3H52G4C.js +2 -0
  57. package/dist/cdn/IFB2ASIW.js +2 -0
  58. package/dist/cdn/KWORBODI.js +5 -0
  59. package/dist/cdn/LUWP3MUX.js +120 -0
  60. package/dist/cdn/LYJY5QUA.js +2 -0
  61. package/dist/cdn/M7C6Y752.js +2 -0
  62. package/dist/cdn/MFEAOGTZ.js +45 -0
  63. package/dist/cdn/NMWLJECU.js +122 -0
  64. package/dist/cdn/{62K6RJZZ.js → ORRZDP5H.js} +15 -2
  65. package/dist/cdn/P5M2HNJ7.js +2 -0
  66. package/dist/cdn/P7EGIU6K.js +2 -0
  67. package/dist/cdn/PTKZXFXB.js +31 -0
  68. package/dist/cdn/QLU3NT5J.js +2 -0
  69. package/dist/cdn/RBMBKUY6.js +44 -0
  70. package/dist/cdn/RJ6XMESZ.js +165 -0
  71. package/dist/cdn/SOCUKQVO.js +2 -0
  72. package/dist/cdn/TOYQ22PR.js +2 -0
  73. package/dist/cdn/URYKQKFE.js +3 -0
  74. package/dist/cdn/V7BWJN43.js +422 -0
  75. package/dist/cdn/VVG5FDCY.js +2 -0
  76. package/dist/cdn/VWMJ7HIK.js +77 -0
  77. package/dist/cdn/{W2A22QZU.js → WTEDVMFR.js} +14 -3
  78. package/dist/cdn/Y2L6M2RG.js +36 -0
  79. package/dist/cdn/ZP3SG5OG.js +108 -0
  80. package/dist/cdn/ZR5WU3UB.js +2 -0
  81. package/dist/cdn/ZSLJX22Z.js +3 -0
  82. package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -1
  83. package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -1
  84. package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -1
  85. package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -1
  86. package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -1
  87. package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -1
  88. package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -1
  89. package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -1
  90. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  91. package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -1
  92. package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -1
  93. package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -1
  94. package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -1
  95. package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -1
  96. package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -1
  97. package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -1
  98. package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -1
  99. package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -1
  100. package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -1
  101. package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -1
  102. package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -1
  103. package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -1
  104. package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -1
  105. package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -1
  106. package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -1
  107. package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -1
  108. package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -1
  109. package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -1
  110. package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -1
  111. package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -1
  112. package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -1
  113. package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -1
  114. package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -1
  115. package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -1
  116. package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -1
  117. package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -1
  118. package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -1
  119. package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -1
  120. package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -1
  121. package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -1
  122. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ar.json +1 -1
  123. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bg.json +1 -1
  124. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bs.json +1 -1
  125. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ca.json +1 -1
  126. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.cs.json +1 -1
  127. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.da.json +1 -1
  128. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.de.json +1 -1
  129. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.el.json +1 -1
  130. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.en.json +1 -1
  131. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.es.json +1 -1
  132. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.et.json +1 -1
  133. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fi.json +1 -1
  134. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fr.json +1 -1
  135. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.he.json +1 -1
  136. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hr.json +1 -1
  137. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hu.json +1 -1
  138. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.id.json +1 -1
  139. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.it.json +1 -1
  140. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ja.json +1 -1
  141. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ko.json +1 -1
  142. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lt.json +1 -1
  143. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lv.json +1 -1
  144. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.nl.json +1 -1
  145. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.no.json +1 -1
  146. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pl.json +1 -1
  147. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-BR.json +1 -1
  148. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-PT.json +1 -1
  149. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ro.json +1 -1
  150. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ru.json +1 -1
  151. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sk.json +1 -1
  152. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sl.json +1 -1
  153. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sr.json +1 -1
  154. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sv.json +1 -1
  155. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.th.json +1 -1
  156. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.tr.json +1 -1
  157. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.uk.json +1 -1
  158. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.vi.json +1 -1
  159. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-CN.json +1 -1
  160. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-HK.json +1 -1
  161. package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-TW.json +1 -1
  162. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ar.json +1 -1
  163. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bg.json +1 -1
  164. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bs.json +1 -1
  165. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ca.json +1 -1
  166. package/dist/cdn/assets/assistant-interrupt/t9n/messages.cs.json +1 -1
  167. package/dist/cdn/assets/assistant-interrupt/t9n/messages.da.json +1 -1
  168. package/dist/cdn/assets/assistant-interrupt/t9n/messages.de.json +1 -1
  169. package/dist/cdn/assets/assistant-interrupt/t9n/messages.el.json +1 -1
  170. package/dist/cdn/assets/assistant-interrupt/t9n/messages.es.json +1 -1
  171. package/dist/cdn/assets/assistant-interrupt/t9n/messages.et.json +1 -1
  172. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fi.json +1 -1
  173. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fr.json +1 -1
  174. package/dist/cdn/assets/assistant-interrupt/t9n/messages.he.json +1 -1
  175. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hr.json +1 -1
  176. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hu.json +1 -1
  177. package/dist/cdn/assets/assistant-interrupt/t9n/messages.id.json +1 -1
  178. package/dist/cdn/assets/assistant-interrupt/t9n/messages.it.json +1 -1
  179. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ja.json +1 -1
  180. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ko.json +1 -1
  181. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lt.json +1 -1
  182. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lv.json +1 -1
  183. package/dist/cdn/assets/assistant-interrupt/t9n/messages.nl.json +1 -1
  184. package/dist/cdn/assets/assistant-interrupt/t9n/messages.no.json +1 -1
  185. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pl.json +1 -1
  186. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-BR.json +1 -1
  187. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-PT.json +1 -1
  188. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ro.json +1 -1
  189. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ru.json +1 -1
  190. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sk.json +1 -1
  191. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sl.json +1 -1
  192. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sr.json +1 -1
  193. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sv.json +1 -1
  194. package/dist/cdn/assets/assistant-interrupt/t9n/messages.th.json +1 -1
  195. package/dist/cdn/assets/assistant-interrupt/t9n/messages.tr.json +1 -1
  196. package/dist/cdn/assets/assistant-interrupt/t9n/messages.uk.json +1 -1
  197. package/dist/cdn/assets/assistant-interrupt/t9n/messages.vi.json +1 -1
  198. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-CN.json +1 -1
  199. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-HK.json +1 -1
  200. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-TW.json +1 -1
  201. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ar.json +1 -0
  202. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bg.json +1 -0
  203. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bs.json +1 -0
  204. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ca.json +1 -0
  205. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.cs.json +1 -0
  206. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.da.json +1 -0
  207. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.de.json +1 -0
  208. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.el.json +1 -0
  209. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.en.json +1 -0
  210. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.es.json +1 -0
  211. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.et.json +1 -0
  212. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fi.json +1 -0
  213. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fr.json +1 -0
  214. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.he.json +1 -0
  215. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hr.json +1 -0
  216. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hu.json +1 -0
  217. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.id.json +1 -0
  218. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.it.json +1 -0
  219. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ja.json +1 -0
  220. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ko.json +1 -0
  221. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lt.json +1 -0
  222. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lv.json +1 -0
  223. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.nl.json +1 -0
  224. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.no.json +1 -0
  225. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pl.json +1 -0
  226. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-BR.json +1 -0
  227. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-PT.json +1 -0
  228. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ro.json +1 -0
  229. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ru.json +1 -0
  230. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sk.json +1 -0
  231. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sl.json +1 -0
  232. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sr.json +1 -0
  233. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sv.json +1 -0
  234. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.th.json +1 -0
  235. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.tr.json +1 -0
  236. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.uk.json +1 -0
  237. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.vi.json +1 -0
  238. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-CN.json +1 -0
  239. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-HK.json +1 -0
  240. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-TW.json +1 -0
  241. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ar.json +1 -0
  242. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bg.json +1 -0
  243. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bs.json +1 -0
  244. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ca.json +1 -0
  245. package/dist/cdn/assets/assistant-message-footer/t9n/messages.cs.json +1 -0
  246. package/dist/cdn/assets/assistant-message-footer/t9n/messages.da.json +1 -0
  247. package/dist/cdn/assets/assistant-message-footer/t9n/messages.de.json +1 -0
  248. package/dist/cdn/assets/assistant-message-footer/t9n/messages.el.json +1 -0
  249. package/dist/cdn/assets/assistant-message-footer/t9n/messages.en.json +1 -0
  250. package/dist/cdn/assets/assistant-message-footer/t9n/messages.es.json +1 -0
  251. package/dist/cdn/assets/assistant-message-footer/t9n/messages.et.json +1 -0
  252. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fi.json +1 -0
  253. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fr.json +1 -0
  254. package/dist/cdn/assets/assistant-message-footer/t9n/messages.he.json +1 -0
  255. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hr.json +1 -0
  256. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hu.json +1 -0
  257. package/dist/cdn/assets/assistant-message-footer/t9n/messages.id.json +1 -0
  258. package/dist/cdn/assets/assistant-message-footer/t9n/messages.it.json +1 -0
  259. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ja.json +1 -0
  260. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ko.json +1 -0
  261. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lt.json +1 -0
  262. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lv.json +1 -0
  263. package/dist/cdn/assets/assistant-message-footer/t9n/messages.nl.json +1 -0
  264. package/dist/cdn/assets/assistant-message-footer/t9n/messages.no.json +1 -0
  265. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pl.json +1 -0
  266. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-BR.json +1 -0
  267. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-PT.json +1 -0
  268. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ro.json +1 -0
  269. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ru.json +1 -0
  270. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sk.json +1 -0
  271. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sl.json +1 -0
  272. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sr.json +1 -0
  273. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sv.json +1 -0
  274. package/dist/cdn/assets/assistant-message-footer/t9n/messages.th.json +1 -0
  275. package/dist/cdn/assets/assistant-message-footer/t9n/messages.tr.json +1 -0
  276. package/dist/cdn/assets/assistant-message-footer/t9n/messages.uk.json +1 -0
  277. package/dist/cdn/assets/assistant-message-footer/t9n/messages.vi.json +1 -0
  278. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-CN.json +1 -0
  279. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-HK.json +1 -0
  280. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-TW.json +1 -0
  281. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ar.json +1 -0
  282. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bg.json +1 -0
  283. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bs.json +1 -0
  284. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ca.json +1 -0
  285. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.cs.json +1 -0
  286. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.da.json +1 -0
  287. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.de.json +1 -0
  288. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.el.json +1 -0
  289. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.en.json +1 -0
  290. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.es.json +1 -0
  291. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.et.json +1 -0
  292. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fi.json +1 -0
  293. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fr.json +1 -0
  294. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.he.json +1 -0
  295. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hr.json +1 -0
  296. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hu.json +1 -0
  297. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.id.json +1 -0
  298. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.it.json +1 -0
  299. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ja.json +1 -0
  300. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ko.json +1 -0
  301. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lt.json +1 -0
  302. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lv.json +1 -0
  303. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.nl.json +1 -0
  304. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.no.json +1 -0
  305. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pl.json +1 -0
  306. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-BR.json +1 -0
  307. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-PT.json +1 -0
  308. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ro.json +1 -0
  309. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ru.json +1 -0
  310. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sk.json +1 -0
  311. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sl.json +1 -0
  312. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sr.json +1 -0
  313. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sv.json +1 -0
  314. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.th.json +1 -0
  315. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.tr.json +1 -0
  316. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.uk.json +1 -0
  317. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.vi.json +1 -0
  318. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-CN.json +1 -0
  319. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-HK.json +1 -0
  320. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-TW.json +1 -0
  321. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ar.json +1 -0
  322. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bg.json +1 -0
  323. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bs.json +1 -0
  324. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ca.json +1 -0
  325. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.cs.json +1 -0
  326. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.da.json +1 -0
  327. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.de.json +1 -0
  328. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.el.json +1 -0
  329. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.en.json +1 -0
  330. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.es.json +1 -0
  331. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.et.json +1 -0
  332. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fi.json +1 -0
  333. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fr.json +1 -0
  334. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.he.json +1 -0
  335. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hr.json +1 -0
  336. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hu.json +1 -0
  337. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.id.json +1 -0
  338. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.it.json +1 -0
  339. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ja.json +1 -0
  340. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ko.json +1 -0
  341. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lt.json +1 -0
  342. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lv.json +1 -0
  343. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.nl.json +1 -0
  344. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.no.json +1 -0
  345. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pl.json +1 -0
  346. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-BR.json +1 -0
  347. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-PT.json +1 -0
  348. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ro.json +1 -0
  349. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ru.json +1 -0
  350. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sk.json +1 -0
  351. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sl.json +1 -0
  352. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sr.json +1 -0
  353. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sv.json +1 -0
  354. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.th.json +1 -0
  355. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.tr.json +1 -0
  356. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.uk.json +1 -0
  357. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.vi.json +1 -0
  358. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-CN.json +1 -0
  359. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-HK.json +1 -0
  360. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-TW.json +1 -0
  361. package/dist/cdn/index.js +1 -1
  362. package/dist/cdn/main.css +1 -1
  363. package/dist/chunks/BaseWorkflow.js +107 -0
  364. package/dist/chunks/adapter.js +3013 -0
  365. package/dist/chunks/arcgisKnowledgeGraph.js +191 -0
  366. package/dist/chunks/arcgis_knowledge_current_lc_context.js +8 -0
  367. package/dist/chunks/arcgis_knowledge_current_map_context.js +8 -0
  368. package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +101 -0
  369. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +48 -0
  370. package/dist/chunks/arcgis_knowledge_tool_prompt.js +34 -0
  371. package/dist/chunks/dataExplorationGraph.js +305 -0
  372. package/dist/chunks/data_explore_filter_prompt.js +125 -0
  373. package/dist/chunks/data_explore_query_prompt.js +144 -0
  374. package/dist/chunks/embeddings.worker.js +25 -0
  375. package/dist/chunks/field_descriptions_prompt.js +112 -0
  376. package/dist/chunks/generateLayerDescriptions.js +440 -0
  377. package/dist/chunks/graph.js +86 -0
  378. package/dist/chunks/helpGraph.js +123 -0
  379. package/dist/chunks/help_prompt.js +57 -0
  380. package/dist/chunks/intent_prompt.js +123 -0
  381. package/dist/chunks/layerStylingGraph.js +189 -0
  382. package/dist/chunks/layer_descriptions_prompt.js +59 -0
  383. package/dist/chunks/layer_styling_prompt.js +72 -0
  384. package/dist/chunks/navigationGraph.js +266 -0
  385. package/dist/chunks/navigation_intent_prompt.js +46 -0
  386. package/dist/chunks/navigation_tool_prompt.js +39 -0
  387. package/dist/chunks/orchestrator.js +567 -0
  388. package/dist/chunks/slottableRequestUtils.js +7 -0
  389. package/dist/chunks/state.js +71 -0
  390. package/dist/chunks/summarize_query_response_prompt.js +80 -0
  391. package/dist/chunks/toolCallResponse.js +29 -0
  392. package/dist/chunks/utils.js +47 -25
  393. package/dist/chunks/utils2.js +43 -4
  394. package/dist/chunks/utils3.js +16 -0
  395. package/dist/components/arcgis-assistant/customElement.d.ts +408 -29
  396. package/dist/components/arcgis-assistant/customElement.js +289 -124
  397. package/dist/components/arcgis-assistant/index.js +10 -2
  398. package/dist/components/arcgis-assistant/types.d.ts +122 -4
  399. package/dist/components/arcgis-assistant-agent/customElement.d.ts +23 -9
  400. package/dist/components/arcgis-assistant-agent/customElement.js +7 -7
  401. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -11
  402. package/dist/components/arcgis-assistant-chat/customElement.js +14 -14
  403. package/dist/components/arcgis-assistant-chat/index.js +0 -1
  404. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +13 -10
  405. package/dist/components/arcgis-assistant-chat-entry/customElement.js +52 -33
  406. package/dist/components/arcgis-assistant-chat-entry/index.js +1 -2
  407. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.d.ts +73 -6
  408. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +24 -8
  409. package/dist/components/arcgis-assistant-help-agent/customElement.d.ts +46 -6
  410. package/dist/components/arcgis-assistant-help-agent/customElement.js +27 -8
  411. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  412. package/dist/components/arcgis-assistant-interrupt/customElement.js +7 -7
  413. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  414. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  415. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +158 -0
  416. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +68 -0
  417. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +27 -8
  418. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  419. package/dist/components/arcgis-assistant-message/customElement.js +45 -0
  420. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  421. package/dist/components/arcgis-assistant-message/index.js +5 -0
  422. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +8 -0
  423. package/dist/components/arcgis-assistant-message-block/customElement.js +36 -0
  424. package/dist/components/arcgis-assistant-message-block/index.js +3 -0
  425. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +26 -0
  426. package/dist/components/arcgis-assistant-message-feedback/customElement.js +36 -0
  427. package/dist/components/arcgis-assistant-message-feedback/index.js +3 -0
  428. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +28 -0
  429. package/dist/components/arcgis-assistant-message-footer/customElement.js +62 -0
  430. package/dist/components/arcgis-assistant-message-footer/index.js +6 -0
  431. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +17 -0
  432. package/dist/components/arcgis-assistant-message-loading/customElement.js +23 -0
  433. package/dist/components/arcgis-assistant-message-loading/index.js +5 -0
  434. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +14 -0
  435. package/dist/components/arcgis-assistant-message-log/customElement.js +29 -0
  436. package/dist/components/arcgis-assistant-message-log/index.js +3 -0
  437. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +22 -0
  438. package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +100 -0
  439. package/dist/components/arcgis-assistant-message-read-aloud/index.d.ts +1 -0
  440. package/dist/components/arcgis-assistant-message-read-aloud/index.js +3 -0
  441. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +10 -0
  442. package/dist/components/arcgis-assistant-message-text/customElement.js +22 -0
  443. package/dist/components/arcgis-assistant-message-text/index.d.ts +1 -0
  444. package/dist/components/arcgis-assistant-message-text/index.js +1 -0
  445. package/dist/components/arcgis-assistant-navigation-agent/customElement.d.ts +53 -6
  446. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +25 -7
  447. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +36 -0
  448. package/dist/components/arcgis-assistant-speech-input/customElement.js +488 -0
  449. package/dist/components/arcgis-assistant-speech-input/index.d.ts +1 -0
  450. package/dist/components/arcgis-assistant-speech-input/index.js +2 -0
  451. package/dist/components/arcgis-assistant-speech-input/support/types.d.ts +20 -0
  452. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +19 -0
  453. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +27 -0
  454. package/dist/components/arcgis-assistant-suggested-prompts/index.d.ts +1 -0
  455. package/dist/components/arcgis-assistant-suggested-prompts/index.js +3 -0
  456. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +13 -0
  457. package/dist/components/arcgis-assistant-user-message/customElement.js +23 -0
  458. package/dist/components/arcgis-assistant-user-message/index.d.ts +1 -0
  459. package/dist/components/arcgis-assistant-user-message/index.js +2 -0
  460. package/dist/docs/api.json +1 -1
  461. package/dist/docs/docs.json +1 -1
  462. package/dist/docs/vscode.html-custom-data.json +1 -1
  463. package/dist/docs/web-types.json +1 -1
  464. package/dist/index.d.ts +62 -28
  465. package/dist/loader.js +17 -9
  466. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  467. package/dist/types/lumina.d.ts +71 -27
  468. package/dist/types/preact.d.ts +83 -32
  469. package/dist/types/react.d.ts +95 -37
  470. package/dist/types/stencil.d.ts +71 -27
  471. package/dist/utils/index.d.ts +466 -35
  472. package/dist/utils/index.js +115 -0
  473. package/package.json +32 -16
  474. package/dist/cdn/42P5MB3Z.js +0 -2
  475. package/dist/cdn/46Q4W2ZL.js +0 -2
  476. package/dist/cdn/577OUIE7.js +0 -3
  477. package/dist/cdn/5Q65B3QW.js +0 -2
  478. package/dist/cdn/5XHJVBOQ.js +0 -270
  479. package/dist/cdn/6T2EIYO4.js +0 -59
  480. package/dist/cdn/7JDZARL7.js +0 -2
  481. package/dist/cdn/AGZUEMOX.js +0 -2
  482. package/dist/cdn/BDLIIICB.js +0 -252
  483. package/dist/cdn/BSIB6MUI.js +0 -20
  484. package/dist/cdn/D6OOXTNF.js +0 -2
  485. package/dist/cdn/HN2HMAMX.js +0 -28
  486. package/dist/cdn/INU3EAWG.js +0 -2
  487. package/dist/cdn/JJPTDO6D.js +0 -2
  488. package/dist/cdn/JSQK2VFS.js +0 -2
  489. package/dist/cdn/JVR66VPL.js +0 -3
  490. package/dist/cdn/KKHKKCYH.js +0 -17
  491. package/dist/cdn/KQ6LEQHH.js +0 -14
  492. package/dist/cdn/MYKSIL6I.js +0 -2
  493. package/dist/cdn/OBS3OCJ2.js +0 -77
  494. package/dist/cdn/OJUEJ4RT.js +0 -2
  495. package/dist/cdn/PQHYDFCL.js +0 -2
  496. package/dist/cdn/SOWNHB7F.js +0 -30
  497. package/dist/cdn/US4TOBAZ.js +0 -2
  498. package/dist/cdn/VG7GKLZR.js +0 -4
  499. package/dist/cdn/WAO4LVNK.js +0 -67
  500. package/dist/cdn/WBSNYWJJ.js +0 -2
  501. package/dist/cdn/WFEBJPQ4.js +0 -2
  502. package/dist/cdn/WFVRLYYT.js +0 -2
  503. package/dist/cdn/X7WF7TCS.js +0 -2
  504. package/dist/cdn/ZGRFMSA2.js +0 -2
  505. package/dist/cdn/ZYQ6U2YH.js +0 -88
  506. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ar.json +0 -1
  507. package/dist/cdn/assets/assistant-chat-card/t9n/messages.bg.json +0 -1
  508. package/dist/cdn/assets/assistant-chat-card/t9n/messages.bs.json +0 -1
  509. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ca.json +0 -1
  510. package/dist/cdn/assets/assistant-chat-card/t9n/messages.cs.json +0 -1
  511. package/dist/cdn/assets/assistant-chat-card/t9n/messages.da.json +0 -1
  512. package/dist/cdn/assets/assistant-chat-card/t9n/messages.de.json +0 -1
  513. package/dist/cdn/assets/assistant-chat-card/t9n/messages.el.json +0 -1
  514. package/dist/cdn/assets/assistant-chat-card/t9n/messages.en.json +0 -1
  515. package/dist/cdn/assets/assistant-chat-card/t9n/messages.es.json +0 -1
  516. package/dist/cdn/assets/assistant-chat-card/t9n/messages.et.json +0 -1
  517. package/dist/cdn/assets/assistant-chat-card/t9n/messages.fi.json +0 -1
  518. package/dist/cdn/assets/assistant-chat-card/t9n/messages.fr.json +0 -1
  519. package/dist/cdn/assets/assistant-chat-card/t9n/messages.he.json +0 -1
  520. package/dist/cdn/assets/assistant-chat-card/t9n/messages.hr.json +0 -1
  521. package/dist/cdn/assets/assistant-chat-card/t9n/messages.hu.json +0 -1
  522. package/dist/cdn/assets/assistant-chat-card/t9n/messages.id.json +0 -1
  523. package/dist/cdn/assets/assistant-chat-card/t9n/messages.it.json +0 -1
  524. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ja.json +0 -1
  525. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ko.json +0 -1
  526. package/dist/cdn/assets/assistant-chat-card/t9n/messages.lt.json +0 -1
  527. package/dist/cdn/assets/assistant-chat-card/t9n/messages.lv.json +0 -1
  528. package/dist/cdn/assets/assistant-chat-card/t9n/messages.nl.json +0 -1
  529. package/dist/cdn/assets/assistant-chat-card/t9n/messages.no.json +0 -1
  530. package/dist/cdn/assets/assistant-chat-card/t9n/messages.pl.json +0 -1
  531. package/dist/cdn/assets/assistant-chat-card/t9n/messages.pt-BR.json +0 -1
  532. package/dist/cdn/assets/assistant-chat-card/t9n/messages.pt-PT.json +0 -1
  533. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ro.json +0 -1
  534. package/dist/cdn/assets/assistant-chat-card/t9n/messages.ru.json +0 -1
  535. package/dist/cdn/assets/assistant-chat-card/t9n/messages.sk.json +0 -1
  536. package/dist/cdn/assets/assistant-chat-card/t9n/messages.sl.json +0 -1
  537. package/dist/cdn/assets/assistant-chat-card/t9n/messages.sr.json +0 -1
  538. package/dist/cdn/assets/assistant-chat-card/t9n/messages.sv.json +0 -1
  539. package/dist/cdn/assets/assistant-chat-card/t9n/messages.th.json +0 -1
  540. package/dist/cdn/assets/assistant-chat-card/t9n/messages.tr.json +0 -1
  541. package/dist/cdn/assets/assistant-chat-card/t9n/messages.uk.json +0 -1
  542. package/dist/cdn/assets/assistant-chat-card/t9n/messages.vi.json +0 -1
  543. package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-CN.json +0 -1
  544. package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-HK.json +0 -1
  545. package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-TW.json +0 -1
  546. package/dist/cdn/assets/assistant-shell/t9n/messages.ar.json +0 -1
  547. package/dist/cdn/assets/assistant-shell/t9n/messages.bg.json +0 -1
  548. package/dist/cdn/assets/assistant-shell/t9n/messages.bs.json +0 -1
  549. package/dist/cdn/assets/assistant-shell/t9n/messages.ca.json +0 -1
  550. package/dist/cdn/assets/assistant-shell/t9n/messages.cs.json +0 -1
  551. package/dist/cdn/assets/assistant-shell/t9n/messages.da.json +0 -1
  552. package/dist/cdn/assets/assistant-shell/t9n/messages.de.json +0 -1
  553. package/dist/cdn/assets/assistant-shell/t9n/messages.el.json +0 -1
  554. package/dist/cdn/assets/assistant-shell/t9n/messages.en.json +0 -1
  555. package/dist/cdn/assets/assistant-shell/t9n/messages.es.json +0 -1
  556. package/dist/cdn/assets/assistant-shell/t9n/messages.et.json +0 -1
  557. package/dist/cdn/assets/assistant-shell/t9n/messages.fi.json +0 -1
  558. package/dist/cdn/assets/assistant-shell/t9n/messages.fr.json +0 -1
  559. package/dist/cdn/assets/assistant-shell/t9n/messages.he.json +0 -1
  560. package/dist/cdn/assets/assistant-shell/t9n/messages.hr.json +0 -1
  561. package/dist/cdn/assets/assistant-shell/t9n/messages.hu.json +0 -1
  562. package/dist/cdn/assets/assistant-shell/t9n/messages.id.json +0 -1
  563. package/dist/cdn/assets/assistant-shell/t9n/messages.it.json +0 -1
  564. package/dist/cdn/assets/assistant-shell/t9n/messages.ja.json +0 -1
  565. package/dist/cdn/assets/assistant-shell/t9n/messages.ko.json +0 -1
  566. package/dist/cdn/assets/assistant-shell/t9n/messages.lt.json +0 -1
  567. package/dist/cdn/assets/assistant-shell/t9n/messages.lv.json +0 -1
  568. package/dist/cdn/assets/assistant-shell/t9n/messages.nl.json +0 -1
  569. package/dist/cdn/assets/assistant-shell/t9n/messages.no.json +0 -1
  570. package/dist/cdn/assets/assistant-shell/t9n/messages.pl.json +0 -1
  571. package/dist/cdn/assets/assistant-shell/t9n/messages.pt-BR.json +0 -1
  572. package/dist/cdn/assets/assistant-shell/t9n/messages.pt-PT.json +0 -1
  573. package/dist/cdn/assets/assistant-shell/t9n/messages.ro.json +0 -1
  574. package/dist/cdn/assets/assistant-shell/t9n/messages.ru.json +0 -1
  575. package/dist/cdn/assets/assistant-shell/t9n/messages.sk.json +0 -1
  576. package/dist/cdn/assets/assistant-shell/t9n/messages.sl.json +0 -1
  577. package/dist/cdn/assets/assistant-shell/t9n/messages.sr.json +0 -1
  578. package/dist/cdn/assets/assistant-shell/t9n/messages.sv.json +0 -1
  579. package/dist/cdn/assets/assistant-shell/t9n/messages.th.json +0 -1
  580. package/dist/cdn/assets/assistant-shell/t9n/messages.tr.json +0 -1
  581. package/dist/cdn/assets/assistant-shell/t9n/messages.uk.json +0 -1
  582. package/dist/cdn/assets/assistant-shell/t9n/messages.vi.json +0 -1
  583. package/dist/cdn/assets/assistant-shell/t9n/messages.zh-CN.json +0 -1
  584. package/dist/cdn/assets/assistant-shell/t9n/messages.zh-HK.json +0 -1
  585. package/dist/cdn/assets/assistant-shell/t9n/messages.zh-TW.json +0 -1
  586. package/dist/cdn/utils.js +0 -2
  587. package/dist/components/arcgis-assistant-chat-card/customElement.d.ts +0 -39
  588. package/dist/components/arcgis-assistant-chat-card/customElement.js +0 -87
  589. package/dist/components/arcgis-assistant-chat-card/index.js +0 -8
  590. package/dist/components/arcgis-assistant-chat-card-content/customElement.d.ts +0 -12
  591. package/dist/components/arcgis-assistant-chat-card-content/customElement.js +0 -42
  592. package/dist/components/arcgis-assistant-chat-card-content/index.js +0 -3
  593. package/dist/components/arcgis-assistant-layer-filter-agent/customElement.d.ts +0 -8
  594. package/dist/components/arcgis-assistant-layer-filter-agent/customElement.js +0 -26
  595. package/dist/components/arcgis-assistant-layer-query-agent/customElement.d.ts +0 -8
  596. package/dist/components/arcgis-assistant-layer-query-agent/customElement.js +0 -26
  597. package/dist/components/arcgis-assistant-shell/customElement.d.ts +0 -40
  598. package/dist/components/arcgis-assistant-shell/customElement.js +0 -28
  599. package/dist/components/arcgis-assistant-shell/index.js +0 -6
  600. package/dist/utils.js +0 -13
  601. /package/dist/cdn/{CFT5BBC6.js → 77GAVZIK.js} +0 -0
  602. /package/dist/cdn/{W5CHGOOR.js → G7XK3XOR.js} +0 -0
  603. /package/dist/cdn/{LSGRWCAO.js → GH7EROHP.js} +0 -0
  604. /package/dist/cdn/{JDL3HFFX.js → MQ7QXIOW.js} +0 -0
  605. /package/dist/components/{arcgis-assistant-chat-card-content → arcgis-assistant-knowledge-agent}/index.d.ts +0 -0
  606. /package/dist/components/{arcgis-assistant-layer-filter-agent → arcgis-assistant-knowledge-agent}/index.js +0 -0
  607. /package/dist/components/{arcgis-assistant-chat-card → arcgis-assistant-message-block}/index.d.ts +0 -0
  608. /package/dist/components/{arcgis-assistant-layer-filter-agent → arcgis-assistant-message-feedback}/index.d.ts +0 -0
  609. /package/dist/components/{arcgis-assistant-layer-query-agent → arcgis-assistant-message-footer}/index.d.ts +0 -0
  610. /package/dist/components/{arcgis-assistant-shell → arcgis-assistant-message-loading}/index.d.ts +0 -0
  611. /package/dist/components/{arcgis-assistant-layer-query-agent/index.js → arcgis-assistant-message-log/index.d.ts} +0 -0
@@ -0,0 +1,3013 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import me from "@arcgis/core/identity/IdentityManager.js";
3
+ import N from "@arcgis/core/portal/Portal.js";
4
+ import { Annotation as b, messagesStateReducer as Te } from "@langchain/langgraph/web";
5
+ import { n as qe, o as x, k as B, s as v, i as Ae } from "./generateLayerDescriptions.js";
6
+ import "@langchain/core/messages";
7
+ import "@langchain/core/callbacks/dispatch/web";
8
+ import "@langchain/openai";
9
+ import * as De from "@arcgis/core/core/reactiveUtils.js";
10
+ import "@arcgis/core/layers/FeatureLayer.js";
11
+ import he from "@arcgis/core/request.js";
12
+ import "@langchain/core/prompts";
13
+ import { tool as y } from "@langchain/core/tools";
14
+ import X from "@arcgis/core/config.js";
15
+ import Le from "@arcgis/core/Graphic.js";
16
+ import { addressToLocations as Pe } from "@arcgis/core/rest/locator.js";
17
+ import je from "@arcgis/core/symbols/PictureMarkerSymbol.js";
18
+ import i, { z as E } from "zod";
19
+ import Ge from "@arcgis/core/geometry/Extent.js";
20
+ import Se from "@arcgis/core/geometry/Point.js";
21
+ import { createRenderer as Oe } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
+ import { getSchemesByTag as Me, getSchemes as Qe } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
+ import { getBackgroundColorTheme as ye } from "@arcgis/core/views/support/colorUtils.js";
24
+ import { createAgeRenderer as _e, createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/color.js";
25
+ import { getSchemesByTag as ce } from "@arcgis/core/smartMapping/symbology/color.js";
26
+ import { createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
+ import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
+ import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
+ import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
+ import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
+ import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
+ import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
+ import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
+ import { getSchemesByTag as Xe } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
+ import { createAgeRenderer as et, createContinuousRenderer as tt } from "@arcgis/core/smartMapping/renderers/size.js";
36
+ import { createRenderer as rt } from "@arcgis/core/smartMapping/renderers/type.js";
37
+ import { getSchemesByTag as ot } from "@arcgis/core/smartMapping/symbology/type.js";
38
+ import { ToolNode as at } from "@langchain/langgraph/prebuilt";
39
+ import nt from "@arcgis/core/layers/support/FeatureEffect.js";
40
+ import ve from "@arcgis/core/layers/support/FeatureFilter.js";
41
+ import * as it from "@arcgis/core/geometry/operators/unionOperator.js";
42
+ import { formatDateOnly as st, convertDateFormatToIntlOptions as Q, formatTimeOnly as ct, formatDate as fe } from "@arcgis/core/intl.js";
43
+ import lt from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
44
+ import ut from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
45
+ import dt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
46
+ import pt from "@arcgis/core/rest/support/TopFilter.js";
47
+ import mt from "@arcgis/core/WebLinkChart.js";
48
+ import xe from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
49
+ import "@arcgis/core/views/LinkChartView.js";
50
+ import { fetchKnowledgeGraph as ge, executeQueryStreaming as ht, executeSearchStreaming as yt } from "@arcgis/core/rest/knowledgeGraphService.js";
51
+ import ft from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
52
+ const P = (e, t) => t ?? e, vn = b.Root({
53
+ ...qe(),
54
+ // internal to the navigation agent
55
+ intent: b({
56
+ reducer: P
57
+ }),
58
+ vectorSearchLayerResults: b({
59
+ reducer: P,
60
+ default: () => []
61
+ }),
62
+ vectorSearchFieldResults: b({
63
+ reducer: P
64
+ }),
65
+ navigationInternalState: b({
66
+ reducer: P,
67
+ default: () => ({
68
+ toolCallMessage: void 0
69
+ })
70
+ })
71
+ });
72
+ async function gt(e, t) {
73
+ const o = N.getDefault().helperServices, a = o.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? o.geocode[0];
74
+ if (!a)
75
+ throw new Error("No geocoding service found in helperServices.");
76
+ const n = a.url, c = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, l = (await Pe(n, {
77
+ address: { SingleLine: e },
78
+ outFields: ["Match_addr"]
79
+ }))?.[0];
80
+ if (!l?.extent || !l.location)
81
+ throw new Error(`Could not find location for: ${e}`);
82
+ const u = new je({
83
+ url: c,
84
+ width: 24,
85
+ height: 24
86
+ }), d = new Le({
87
+ geometry: l.location,
88
+ symbol: u
89
+ });
90
+ t.graphics.removeAll(), t.graphics.add(d), await t.goTo(l.extent);
91
+ const p = {
92
+ address: l.address ?? "",
93
+ location: l.location ? l.location.toJSON() : null,
94
+ extent: l.extent ? l.extent.toJSON() : null
95
+ };
96
+ return {
97
+ text: `Successfully zoomed to ${e}.`,
98
+ sharedStatePatch: { lastResolvedLocation: { value: p } }
99
+ };
100
+ }
101
+ const wt = ["mapView"];
102
+ function $(e) {
103
+ const r = e?.configurable?.context;
104
+ if (!r || typeof r != "object")
105
+ throw new Error("NavigationAgent context missing");
106
+ const o = wt.filter((a) => !(a in r));
107
+ if (o.length)
108
+ throw new Error(`NavigationAgent context missing: ${o.join(", ")}`);
109
+ return r;
110
+ }
111
+ async function bt({ address: e }, t) {
112
+ const { mapView: r } = $(t);
113
+ return await gt(e, r);
114
+ }
115
+ const Tt = i.object({
116
+ address: i.string().describe("The full address or place name to locate.")
117
+ }), xn = y(bt, {
118
+ name: "goToAddress",
119
+ description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
120
+ schema: Tt
121
+ });
122
+ async function St(e, t) {
123
+ const o = t.map.bookmarks;
124
+ if (!o || o.length === 0)
125
+ throw new Error("No bookmarks found in the map.");
126
+ const a = o.find((c) => c.name === e);
127
+ if (!a)
128
+ throw new Error(`Bookmark with name "${e}" not found.`);
129
+ const n = a.viewpoint;
130
+ if (!n)
131
+ throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
132
+ return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
133
+ }
134
+ async function vt({ bookmarkName: e }, t) {
135
+ const { mapView: r } = $(t);
136
+ return await Promise.resolve(St(e, r));
137
+ }
138
+ const xt = E.object({
139
+ bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
140
+ }), Rn = y(vt, {
141
+ name: "goToBookmark",
142
+ description: "Go to the extent of the bookmark with the given name.",
143
+ schema: xt
144
+ });
145
+ async function Rt(e, t, r) {
146
+ const o = r.map?.allLayers.find((c) => c.id === e);
147
+ if (!o)
148
+ return { text: `Error: Layer with id ${e} not found` };
149
+ const a = t?.trim() ? t : "1=1", n = o.createQuery();
150
+ n.where = a;
151
+ try {
152
+ const { extent: c, count: s } = await o.queryExtent(n);
153
+ if (s === 0)
154
+ return { text: `No features found in ${o.title} matching: ${a}`, where: a };
155
+ if (c)
156
+ await r.goTo(c);
157
+ else
158
+ return { text: `Error: Unable to determine extent for ${o.title}`, where: a };
159
+ const l = {
160
+ layerId: e,
161
+ layerTitle: o.title ?? e,
162
+ where: a,
163
+ count: s
164
+ };
165
+ return {
166
+ text: `Successfully zoomed to ${s} feature(s) in ${o.title} matching: ${a}`,
167
+ where: a,
168
+ sharedStatePatch: { lastNavigatedFeatures: { value: l } }
169
+ };
170
+ } catch (c) {
171
+ return console.error("Error in goToFeatures:", c), { text: `Error: ${c instanceof Error ? c.message : "Unknown error"}`, where: a };
172
+ }
173
+ }
174
+ async function $t({ layerId: e, where: t }, r) {
175
+ const { mapView: o } = $(r);
176
+ return await Rt(e, t, o);
177
+ }
178
+ const Ct = E.object({
179
+ layerId: E.string().describe("The layerId of the layer to zoom to."),
180
+ where: E.string().describe("The sql-92 where clause used to query features to zoom to")
181
+ }), $n = y($t, {
182
+ name: "goToFeatures",
183
+ description: "Go to the features that match the given filter related to the given layerId.",
184
+ schema: Ct
185
+ });
186
+ async function Et(e) {
187
+ const r = new Ge({
188
+ xmin: -180,
189
+ ymin: -90,
190
+ xmax: 180,
191
+ ymax: 90,
192
+ spatialReference: { wkid: 4326 }
193
+ }).expand(0.7);
194
+ return await e.goTo(r), { text: "Successfully zoomed to world extent" };
195
+ }
196
+ async function Ft(e, t) {
197
+ const { mapView: r } = $(t);
198
+ return await Et(r);
199
+ }
200
+ const Nt = E.object({}), Cn = y(Ft, {
201
+ name: "goToFullExtent",
202
+ description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
203
+ schema: Nt
204
+ });
205
+ async function It(e) {
206
+ const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
207
+ if (r)
208
+ await e.goTo(r);
209
+ else
210
+ throw new Error("Initial extent is undefined");
211
+ return { text: "Successfully zoomed to home extent" };
212
+ }
213
+ async function kt(e, t) {
214
+ const { mapView: r } = $(t);
215
+ return await It(r);
216
+ }
217
+ const zt = i.object({}), En = y(kt, {
218
+ name: "goToHomeExtent",
219
+ description: "Go to the initial web map view extent",
220
+ schema: zt
221
+ });
222
+ async function qt(e, t) {
223
+ await t.when();
224
+ const r = t.map?.allLayers.find((a) => a.id === e);
225
+ if (!r)
226
+ return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`), { text: `Could not find layer for: ${e}` };
227
+ let o;
228
+ return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? o = t.map.diagramNodesExtent : o = r.fullExtent, o ? (await t.goTo(o), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
229
+ }
230
+ async function At({ layerId: e }, t) {
231
+ const { mapView: r } = $(t);
232
+ return await qt(e, r);
233
+ }
234
+ const Dt = E.object({
235
+ layerId: E.string().describe("The id of the layer to navigate to")
236
+ }), Fn = y(At, {
237
+ name: "goToLayer",
238
+ description: "Zooms the map view to the full extent of the top matching layer.",
239
+ schema: Dt
240
+ });
241
+ async function Lt(e, t) {
242
+ return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
243
+ }
244
+ async function Pt({ scale: e }, t) {
245
+ const { mapView: r } = $(t);
246
+ return await Lt(e, r);
247
+ }
248
+ const jt = i.object({
249
+ scale: i.number().describe("The map scale of the view to go to.")
250
+ }), Nn = y(Pt, {
251
+ name: "goToScale",
252
+ description: "Go to the specified view scale.",
253
+ schema: jt
254
+ });
255
+ async function Gt(e, t, r) {
256
+ const a = {
257
+ target: new Se({
258
+ longitude: e.longitude,
259
+ latitude: e.latitude,
260
+ spatialReference: { wkid: 4326 }
261
+ })
262
+ };
263
+ return r?.zoom !== void 0 && (a.zoom = r.zoom), r?.scale !== void 0 && (a.scale = r.scale), await t.goTo(a), { text: `Successfully navigated to: ${[
264
+ `(${e.latitude}°, ${e.longitude}°)`,
265
+ r?.zoom !== void 0 ? `zoom ${r.zoom}` : "",
266
+ r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
267
+ ].filter(Boolean).join(", ")}` };
268
+ }
269
+ async function Ot({
270
+ center: e,
271
+ zoom: t,
272
+ scale: r
273
+ }, o) {
274
+ const { mapView: a } = $(o);
275
+ return await Gt(e, a, { zoom: t, scale: r });
276
+ }
277
+ const Mt = i.object({
278
+ center: i.object({
279
+ longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
280
+ latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
281
+ }),
282
+ zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
283
+ scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
284
+ }), In = y(Ot, {
285
+ name: "goToViewpoint",
286
+ description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
287
+ schema: Mt
288
+ });
289
+ async function Qt(e, t) {
290
+ return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
291
+ }
292
+ async function _t({ zoom: e }, t) {
293
+ const { mapView: r } = $(t);
294
+ return await Qt(e, r);
295
+ }
296
+ const Wt = i.object({
297
+ zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
298
+ }), kn = y(_t, {
299
+ name: "goToZoom",
300
+ description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
301
+ schema: Wt
302
+ }), we = /* @__PURE__ */ Object.assign({
303
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
304
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
305
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md": () => import("./arcgis_knowledge_lucene_generation_prompt.js").then((e) => e.default),
306
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md": () => import("./arcgis_knowledge_summarize_result_prompt.js").then((e) => e.default),
307
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt.js").then((e) => e.default),
308
+ "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt.js").then((e) => e.default),
309
+ "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt.js").then((e) => e.default),
310
+ "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt.js").then((e) => e.default),
311
+ "../agents/help/prompts/help_prompt.md": () => import("./help_prompt.js").then((e) => e.default),
312
+ "../agents/layerStyling/prompts/layer_styling_prompt.md": () => import("./layer_styling_prompt.js").then((e) => e.default),
313
+ "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
314
+ "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
315
+ });
316
+ async function te(e) {
317
+ const t = Object.entries(we).find(([r]) => r.endsWith(`/${e}.md`));
318
+ if (!t)
319
+ throw new Error(`Prompt not found: ${e}
320
+ Available prompts:
321
+ ${Object.keys(we).join(`
322
+ `)}`);
323
+ return await t[1]();
324
+ }
325
+ const Vt = (e, t = 300) => {
326
+ const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
327
+ return r.length > t ? `${r.slice(0, t)}...` : r;
328
+ }, Re = (e, t) => {
329
+ const o = e?.configurable?.services?.[t];
330
+ if (o == null)
331
+ throw new Error(`${t} missing in config.configurable.services`);
332
+ return o;
333
+ }, zn = (e, t) => (r, o) => {
334
+ const a = o?.configurable?.services;
335
+ for (const n of e)
336
+ if (!a?.[n])
337
+ throw new Error(`${t} requires services.${n} to be available.`);
338
+ return r;
339
+ };
340
+ async function Ut(e) {
341
+ const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
342
+ let c;
343
+ return n ? c = Me({
344
+ basemapTheme: await ye(o),
345
+ geometryType: r.geometryType,
346
+ includedTags: n,
347
+ numColors: Math.min(t.length, 8)
348
+ })[0] : c = Qe({
349
+ basemapTheme: await ye(o),
350
+ geometryType: r.geometryType,
351
+ numColors: Math.min(t.length, 8)
352
+ }).primaryScheme, {
353
+ layer: r,
354
+ view: o,
355
+ attributes: t.map((s) => ({
356
+ field: s,
357
+ label: r.fields.find((l) => l.name === s)?.alias ?? ""
358
+ })).slice(0, 8),
359
+ outlineOptimizationEnabled: !0,
360
+ sizeOptimizationEnabled: !0,
361
+ includeSizeVariable: a.includes("Size"),
362
+ pieChartScheme: c
363
+ };
364
+ }
365
+ async function Kt(e) {
366
+ return await Oe(e);
367
+ }
368
+ async function Bt({
369
+ arcgisMap: e,
370
+ arcgisMapView: t,
371
+ layerId: r,
372
+ fields: o,
373
+ colorSchemes: a,
374
+ includeSize: n
375
+ }) {
376
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
377
+ if (!s)
378
+ return `Could not find layer for id: ${r}`;
379
+ const u = {
380
+ styleName: n ? "chart-size" : "chart",
381
+ fields: o,
382
+ layer: s,
383
+ view: c,
384
+ colorSchemeTags: a
385
+ };
386
+ try {
387
+ const d = await Ut(u), p = await Kt(d);
388
+ return s.renderer = p.renderer, s.visible = !0, `Chart renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
389
+ } catch (d) {
390
+ return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
391
+ }
392
+ }
393
+ const Ht = ["mapView"];
394
+ function R(e) {
395
+ const r = e?.configurable?.context;
396
+ if (!r || typeof r != "object")
397
+ throw new Error("LayerStylingAgent context missing");
398
+ const o = Ht.filter((a) => !(a in r));
399
+ if (o.length)
400
+ throw new Error(`LayerStylingAgent context missing: ${o.join(", ")}`);
401
+ return r;
402
+ }
403
+ async function Jt({
404
+ layerId: e,
405
+ fields: t,
406
+ colorSchemes: r,
407
+ includeSize: o
408
+ }, a) {
409
+ const { mapView: n } = R(a);
410
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Bt({
411
+ arcgisMap: n.map,
412
+ arcgisMapView: n,
413
+ layerId: e,
414
+ fields: t,
415
+ colorSchemes: r,
416
+ includeSize: o
417
+ });
418
+ }
419
+ const Zt = i.object({
420
+ layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
421
+ fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
422
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
423
+ includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
424
+ }), qn = y(Jt, {
425
+ name: "chart",
426
+ description: `Label: Charts
427
+ Description: Show the values of two or more categories as a proportion of the total using a pie chart.
428
+ Keywords: pie, chart, all categories, breakdown, proportion
429
+ Example: Show the total number of homes built in each decade using a pie chart for each feature.
430
+ Fields: This style requires 2-8 number fields.
431
+
432
+ Label: Charts and Size
433
+ 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.
434
+ Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
435
+ 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.
436
+ Fields: This style requires 2-8 number fields.`,
437
+ schema: Zt
438
+ });
439
+ function Yt(e) {
440
+ const { fields: t, layer: r, view: o, theme: a, colorSchemeTags: n } = e, c = t[0];
441
+ let s;
442
+ return n && (s = ce({
443
+ geometryType: r.geometryType,
444
+ includedTags: n,
445
+ theme: a || "high-to-low"
446
+ })[0]), {
447
+ layer: r,
448
+ view: o,
449
+ startTime: c,
450
+ endTime: /* @__PURE__ */ new Date(),
451
+ theme: a,
452
+ sizeOptimizationEnabled: !0,
453
+ outlineOptimizationEnabled: !0,
454
+ colorScheme: s
455
+ };
456
+ }
457
+ async function Xt(e) {
458
+ return await _e(e);
459
+ }
460
+ async function er({
461
+ arcgisMap: e,
462
+ arcgisMapView: t,
463
+ layerId: r,
464
+ fields: o,
465
+ colorSchemes: a,
466
+ theme: n
467
+ }) {
468
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
469
+ if (!s)
470
+ return `Could not find layer for id: ${r}`;
471
+ const l = {
472
+ styleName: "color-age",
473
+ fields: o,
474
+ layer: s,
475
+ view: c,
476
+ colorSchemeTags: a,
477
+ theme: n
478
+ };
479
+ try {
480
+ const u = Yt(l), d = await Xt(u);
481
+ return s.renderer = d.renderer, s.visible = !0, `Color-age renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
482
+ } catch (u) {
483
+ return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
484
+ }
485
+ }
486
+ async function tr({
487
+ layerId: e,
488
+ fields: t,
489
+ colorSchemes: r,
490
+ theme: o
491
+ }, a) {
492
+ const { mapView: n } = R(a);
493
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await er({
494
+ arcgisMap: n.map,
495
+ arcgisMapView: n,
496
+ layerId: e,
497
+ fields: t,
498
+ colorSchemes: r,
499
+ theme: o
500
+ });
501
+ }
502
+ const rr = i.object({
503
+ layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
504
+ fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
505
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
506
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
507
+ }), An = y(tr, {
508
+ name: "color-age",
509
+ description: `Label: Age (color)
510
+ 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.
511
+ Keywords: since, age, how old, how long
512
+ Example: Show the age of each feature based on its reported date.
513
+ Fields: This style requires at least one field with a date type.`,
514
+ schema: rr
515
+ });
516
+ function or(e) {
517
+ const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
518
+ let { theme: n } = e, c = t[1];
519
+ const s = t[0];
520
+ let l;
521
+ return a && (l = ce({
522
+ geometryType: r.geometryType,
523
+ includedTags: a,
524
+ theme: n || "high-to-low"
525
+ })[0]), {
526
+ layer: r,
527
+ view: o,
528
+ field: s,
529
+ normalizationField: c,
530
+ theme: n,
531
+ sizeOptimizationEnabled: !0,
532
+ outlineOptimizationEnabled: !0,
533
+ colorScheme: l
534
+ };
535
+ }
536
+ async function ar(e) {
537
+ return await We(e);
538
+ }
539
+ async function nr({
540
+ arcgisMap: e,
541
+ arcgisMapView: t,
542
+ layerId: r,
543
+ fields: o,
544
+ colorSchemes: a,
545
+ theme: n
546
+ }) {
547
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
548
+ if (!s)
549
+ return `Could not find layer for id: ${r}`;
550
+ const l = {
551
+ styleName: "color",
552
+ fields: o,
553
+ layer: s,
554
+ view: c,
555
+ colorSchemeTags: a,
556
+ theme: n
557
+ };
558
+ try {
559
+ const u = or(l), d = await ar(u);
560
+ return s.renderer = d.renderer, s.visible = !0, `Color renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
561
+ } catch (u) {
562
+ return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
563
+ }
564
+ }
565
+ async function ir({
566
+ layerId: e,
567
+ fields: t,
568
+ colorSchemes: r,
569
+ theme: o
570
+ }, a) {
571
+ const { mapView: n } = R(a);
572
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await nr({
573
+ arcgisMap: n.map,
574
+ arcgisMapView: n,
575
+ layerId: e,
576
+ fields: t,
577
+ colorSchemes: r,
578
+ theme: o
579
+ });
580
+ }
581
+ const sr = i.object({
582
+ layerId: i.string().describe("The id of the layer to apply the color renderer to"),
583
+ fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
584
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
585
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
586
+ }), Dn = y(ir, {
587
+ name: "color",
588
+ description: `Label: Counts and Amounts (color)
589
+ Description: Vary color along a continuous color ramp to represent numeric or ranked data.
590
+ Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
591
+ Example: Color each feature based on the population density.
592
+ 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.`,
593
+ schema: sr
594
+ });
595
+ function cr(e) {
596
+ const { fields: t, layer: r, view: o, colorSchemeTags: a, theme: n } = e;
597
+ let c, s;
598
+ const l = t[0];
599
+ return a && (s = ce({
600
+ geometryType: r.geometryType,
601
+ includedTags: a,
602
+ theme: n || "high-to-low"
603
+ })[0]), {
604
+ layer: r,
605
+ view: o,
606
+ field: l,
607
+ normalizationField: c,
608
+ theme: n,
609
+ colorOptions: {
610
+ colorScheme: s
611
+ }
612
+ };
613
+ }
614
+ async function lr(e) {
615
+ return await Ve(e);
616
+ }
617
+ async function ur({
618
+ arcgisMap: e,
619
+ arcgisMapView: t,
620
+ layerId: r,
621
+ fields: o,
622
+ colorSchemes: a,
623
+ theme: n
624
+ }) {
625
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
626
+ if (!s)
627
+ return `Could not find layer for id: ${r}`;
628
+ const l = {
629
+ styleName: "color-size-univariate",
630
+ fields: o,
631
+ layer: s,
632
+ view: c,
633
+ colorSchemeTags: a,
634
+ theme: n
635
+ };
636
+ try {
637
+ const u = cr(l), d = await lr(u);
638
+ return s.renderer = d.renderer, s.visible = !0, `Color-size-univariate renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
639
+ } catch (u) {
640
+ return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
641
+ }
642
+ }
643
+ async function dr({
644
+ layerId: e,
645
+ fields: t,
646
+ colorSchemes: r,
647
+ theme: o
648
+ }, a) {
649
+ const { mapView: n } = R(a);
650
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await ur({
651
+ arcgisMap: n.map,
652
+ arcgisMapView: n,
653
+ layerId: e,
654
+ fields: t,
655
+ colorSchemes: r,
656
+ theme: o
657
+ });
658
+ }
659
+ const pr = i.object({
660
+ layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
661
+ fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
662
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
663
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
664
+ }), Ln = y(dr, {
665
+ name: "color-size-univariate",
666
+ description: `Label: Color and Size (univariate)
667
+ Description: Vary symbol size and color based on the values of two numeric attributes.
668
+ Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
669
+ 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.
670
+ 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.`,
671
+ schema: pr
672
+ });
673
+ function mr(e) {
674
+ const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
675
+ let n;
676
+ return a && (n = Ke({
677
+ includedTags: a,
678
+ numColors: Math.min(t.length, 8)
679
+ })[0]), {
680
+ layer: r,
681
+ view: o,
682
+ legendOptions: {
683
+ unit: "units"
684
+ },
685
+ attributes: t.map((c) => ({
686
+ field: c,
687
+ label: r.fields.find((s) => s.name === c)?.alias ?? ""
688
+ })).slice(0, 8),
689
+ outlineOptimizationEnabled: !0,
690
+ dotDensityScheme: n
691
+ };
692
+ }
693
+ async function hr(e) {
694
+ return await Ue(e);
695
+ }
696
+ async function yr({
697
+ arcgisMap: e,
698
+ arcgisMapView: t,
699
+ layerId: r,
700
+ fields: o,
701
+ colorSchemes: a
702
+ }) {
703
+ const n = t, c = e?.allLayers.find((l) => l.id === r);
704
+ if (!c)
705
+ return `Could not find layer for id: ${r}`;
706
+ const s = {
707
+ styleName: "dot-density",
708
+ fields: o,
709
+ layer: c,
710
+ view: n,
711
+ colorSchemeTags: a
712
+ };
713
+ try {
714
+ const l = mr(s), u = await hr(l);
715
+ return c.renderer = u.renderer, c.visible = !0, `Dot Density renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
716
+ } catch (l) {
717
+ return `Error applying dot density renderer: ${l instanceof Error ? l.message : String(l)}`;
718
+ }
719
+ }
720
+ async function fr({
721
+ layerId: e,
722
+ fields: t,
723
+ colorSchemes: r
724
+ }, o) {
725
+ const { mapView: a } = R(o);
726
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await yr({
727
+ arcgisMap: a.map,
728
+ arcgisMapView: a,
729
+ layerId: e,
730
+ fields: t,
731
+ colorSchemes: r
732
+ });
733
+ }
734
+ const gr = i.object({
735
+ layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
736
+ fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
737
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
738
+ }), Pn = y(fr, {
739
+ name: "dot-density",
740
+ description: `Dot Density
741
+ Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
742
+ **Use cases:**
743
+ - Population distribution visualization
744
+ - Comparing multiple categories within areas
745
+ - Showing spatial distribution patterns
746
+ **Examples:**
747
+ - Show the density of the population based on various race/ethnic groups
748
+ - Visualize distribution of different crops across regions
749
+ - Display demographic patterns within census tracts
750
+ **Fields:** Requires 2-8 number fields.
751
+ **Keywords:** density, how much, how many, total, number, amount`,
752
+ schema: gr
753
+ });
754
+ function wr(e) {
755
+ const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
756
+ let n;
757
+ const c = t[0];
758
+ return a && (n = He({
759
+ includedTags: a,
760
+ basemap: o.map?.basemap || "topo"
761
+ })[0]), {
762
+ layer: r,
763
+ view: o,
764
+ field: c,
765
+ heatmapScheme: n
766
+ };
767
+ }
768
+ async function br(e) {
769
+ return await Be(e);
770
+ }
771
+ async function Tr({
772
+ arcgisMap: e,
773
+ arcgisMapView: t,
774
+ layerId: r,
775
+ fields: o,
776
+ colorSchemes: a
777
+ }) {
778
+ const n = t, c = e?.allLayers.find((l) => l.id === r);
779
+ if (!c)
780
+ return `Could not find layer for id: ${r}`;
781
+ const s = {
782
+ styleName: "heatmap",
783
+ fields: o,
784
+ layer: c,
785
+ view: n,
786
+ colorSchemeTags: a
787
+ };
788
+ try {
789
+ const l = wr(s), u = await br(l);
790
+ return c.renderer = u.renderer, c.visible = !0, `Heatmap renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
791
+ } catch (l) {
792
+ return `Error applying heatmap renderer: ${l instanceof Error ? l.message : String(l)}`;
793
+ }
794
+ }
795
+ async function Sr({
796
+ layerId: e,
797
+ fields: t,
798
+ colorSchemes: r
799
+ }, o) {
800
+ const { mapView: a } = R(o);
801
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Tr({
802
+ arcgisMap: a.map,
803
+ arcgisMapView: a,
804
+ layerId: e,
805
+ fields: t,
806
+ colorSchemes: r
807
+ });
808
+ }
809
+ const vr = i.object({
810
+ layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
811
+ fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
812
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
813
+ }), jn = y(Sr, {
814
+ name: "heatmap",
815
+ description: `Label: Heat Map
816
+ Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
817
+ Keywords: density, heatmap, hot spots, pattern, cluster
818
+ Example: Create a heatmap
819
+ Fields: This typically requires zero or one field of type number.`,
820
+ schema: vr
821
+ });
822
+ function xr(e) {
823
+ const { fields: t, layer: r, view: o, styleName: a, colorSchemeTags: n } = e;
824
+ let c;
825
+ return n && (c = Ze({
826
+ geometryType: r.geometryType,
827
+ includedTags: n,
828
+ numColors: Math.min(t.length, 10)
829
+ })[0]), {
830
+ layer: r,
831
+ view: o,
832
+ fields: t.map((s) => ({ name: s })).slice(0, 9),
833
+ outlineOptimizationEnabled: !0,
834
+ sizeOptimizationEnabled: !0,
835
+ includeSizeVariable: a.includes("Size"),
836
+ predominanceScheme: c
837
+ };
838
+ }
839
+ async function Rr(e) {
840
+ return await Je(e);
841
+ }
842
+ async function $r({
843
+ arcgisMap: e,
844
+ arcgisMapView: t,
845
+ layerId: r,
846
+ fields: o,
847
+ colorSchemes: a,
848
+ includeSize: n
849
+ }) {
850
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
851
+ if (!s)
852
+ return `Could not find layer for id: ${r}`;
853
+ const u = {
854
+ styleName: n ? "predominance-size" : "predominance",
855
+ fields: o,
856
+ layer: s,
857
+ view: c,
858
+ colorSchemeTags: a
859
+ };
860
+ try {
861
+ const d = xr(u), p = await Rr(d);
862
+ return s.renderer = p.renderer, s.visible = !0, `Predominance renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
863
+ } catch (d) {
864
+ return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
865
+ }
866
+ }
867
+ async function Cr({
868
+ layerId: e,
869
+ fields: t,
870
+ colorSchemes: r,
871
+ includeSize: o
872
+ }, a) {
873
+ const { mapView: n } = R(a);
874
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await $r({
875
+ arcgisMap: n.map,
876
+ arcgisMapView: n,
877
+ layerId: e,
878
+ fields: t,
879
+ colorSchemes: r,
880
+ includeSize: o
881
+ });
882
+ }
883
+ const Er = i.object({
884
+ layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
885
+ fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
886
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
887
+ includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
888
+ }), Gn = y(Cr, {
889
+ name: "predominance",
890
+ description: `Label: Predominant category
891
+ Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
892
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
893
+ Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
894
+ Fields: This style relies on 2-10 number fields.
895
+
896
+ Label: Predominant category and Size
897
+ 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.
898
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
899
+ Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
900
+ Fields: This style relies on 2-10 number fields.`,
901
+ schema: Er
902
+ });
903
+ function Fr(e) {
904
+ const { fields: t, layer: r, view: o, colorSchemeTags: a } = e;
905
+ let n;
906
+ const c = {
907
+ field: t[0]
908
+ }, s = {
909
+ field: t[1]
910
+ };
911
+ return a && (n = Xe({
912
+ geometryType: r.geometryType,
913
+ includedTags: a
914
+ })[0]), {
915
+ layer: r,
916
+ view: o,
917
+ field1: c,
918
+ field2: s,
919
+ outlineOptimizationEnabled: !0,
920
+ sizeOptimizationEnabled: !0,
921
+ relationshipScheme: n
922
+ };
923
+ }
924
+ async function Nr(e) {
925
+ return await Ye(e);
926
+ }
927
+ async function Ir({
928
+ arcgisMap: e,
929
+ arcgisMapView: t,
930
+ layerId: r,
931
+ fields: o,
932
+ colorSchemes: a
933
+ }) {
934
+ const n = t, c = e?.allLayers.find((l) => l.id === r);
935
+ if (!c)
936
+ return `Could not find layer for id: ${r}`;
937
+ const s = {
938
+ styleName: "relationship",
939
+ fields: o,
940
+ layer: c,
941
+ view: n,
942
+ colorSchemeTags: a
943
+ };
944
+ try {
945
+ const l = Fr(s), u = await Nr(l);
946
+ return c.renderer = u.renderer, c.visible = !0, `Relationship renderer applied to layer: ${c.title ?? c.id} using fields ${o.join(", ")}`;
947
+ } catch (l) {
948
+ return `Error applying relationship renderer: ${l instanceof Error ? l.message : String(l)}`;
949
+ }
950
+ }
951
+ async function kr({
952
+ layerId: e,
953
+ fields: t,
954
+ colorSchemes: r
955
+ }, o) {
956
+ const { mapView: a } = R(o);
957
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ir({
958
+ arcgisMap: a.map,
959
+ arcgisMapView: a,
960
+ layerId: e,
961
+ fields: t,
962
+ colorSchemes: r
963
+ });
964
+ }
965
+ const zr = i.object({
966
+ layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
967
+ fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
968
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
969
+ }), On = y(kr, {
970
+ name: "relationship",
971
+ description: `Label: Relationship
972
+ Description: Overlays two color ramps to represent the relationship between two numeric attributes.
973
+ Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
974
+ Example: Show the relationship between tree height and carbon storage
975
+ Fields: This style requires two number fields.`,
976
+ schema: zr
977
+ });
978
+ function qr(e) {
979
+ const { fields: t, layer: r, view: o, theme: a } = e, n = t[0];
980
+ return {
981
+ layer: r,
982
+ view: o,
983
+ startTime: n,
984
+ endTime: /* @__PURE__ */ new Date(),
985
+ theme: a,
986
+ sizeOptimizationEnabled: !0,
987
+ outlineOptimizationEnabled: !0
988
+ };
989
+ }
990
+ async function Ar(e) {
991
+ return await et(e);
992
+ }
993
+ async function Dr({
994
+ arcgisMap: e,
995
+ arcgisMapView: t,
996
+ layerId: r,
997
+ fields: o,
998
+ colorSchemes: a,
999
+ theme: n
1000
+ }) {
1001
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
1002
+ if (!s)
1003
+ return `Could not find layer for id: ${r}`;
1004
+ const l = {
1005
+ styleName: "size-age",
1006
+ fields: o,
1007
+ layer: s,
1008
+ view: c,
1009
+ colorSchemeTags: a,
1010
+ theme: n
1011
+ };
1012
+ try {
1013
+ const u = qr(l), d = await Ar(u);
1014
+ return s.renderer = d.renderer, s.visible = !0, `Size-age renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
1015
+ } catch (u) {
1016
+ return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
1017
+ }
1018
+ }
1019
+ async function Lr({
1020
+ layerId: e,
1021
+ fields: t,
1022
+ colorSchemes: r,
1023
+ theme: o
1024
+ }, a) {
1025
+ const { mapView: n } = R(a);
1026
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Dr({
1027
+ arcgisMap: n.map,
1028
+ arcgisMapView: n,
1029
+ layerId: e,
1030
+ fields: t,
1031
+ colorSchemes: r,
1032
+ theme: o
1033
+ });
1034
+ }
1035
+ const Pr = i.object({
1036
+ layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
1037
+ fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1038
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1039
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1040
+ }), Mn = y(Lr, {
1041
+ name: "size-age",
1042
+ description: `Label: Age (size)
1043
+ 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.
1044
+ Keywords: since, age, how old, how long
1045
+ Example: Change the size of features so older features are larger than new features.
1046
+ Fields: This style requires at least one field with a date type.`,
1047
+ schema: Pr
1048
+ });
1049
+ function jr(e) {
1050
+ const { fields: t, layer: r, view: o } = e;
1051
+ let { theme: a } = e, n = t[1];
1052
+ const c = t[0];
1053
+ return {
1054
+ layer: r,
1055
+ view: o,
1056
+ field: c,
1057
+ normalizationField: n,
1058
+ theme: a,
1059
+ sizeOptimizationEnabled: !0,
1060
+ outlineOptimizationEnabled: !0
1061
+ };
1062
+ }
1063
+ async function Gr(e) {
1064
+ return await tt(e);
1065
+ }
1066
+ async function Or({
1067
+ arcgisMap: e,
1068
+ arcgisMapView: t,
1069
+ layerId: r,
1070
+ fields: o,
1071
+ colorSchemes: a,
1072
+ theme: n
1073
+ }) {
1074
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
1075
+ if (!s)
1076
+ return `Could not find layer for id: ${r}`;
1077
+ const l = {
1078
+ styleName: "size",
1079
+ fields: o,
1080
+ layer: s,
1081
+ view: c,
1082
+ colorSchemeTags: a,
1083
+ theme: n
1084
+ };
1085
+ try {
1086
+ const u = jr(l), d = await Gr(u);
1087
+ return s.renderer = d.renderer, s.visible = !0, `Size renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
1088
+ } catch (u) {
1089
+ return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
1090
+ }
1091
+ }
1092
+ async function Mr({
1093
+ layerId: e,
1094
+ fields: t,
1095
+ colorSchemes: r,
1096
+ theme: o
1097
+ }, a) {
1098
+ const { mapView: n } = R(a);
1099
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Or({
1100
+ arcgisMap: n.map,
1101
+ arcgisMapView: n,
1102
+ layerId: e,
1103
+ fields: t,
1104
+ colorSchemes: r,
1105
+ theme: o
1106
+ });
1107
+ }
1108
+ const Qr = i.object({
1109
+ layerId: i.string().describe("The id of the layer to apply the size renderer to"),
1110
+ fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1111
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1112
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1113
+ }), Qn = y(Mr, {
1114
+ name: "size",
1115
+ description: `Label: Counts and Amounts (size)
1116
+ Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
1117
+ Keywords: graduated size, proportional size, how much, total, number, amount, size
1118
+ Example: Vary the size of each point based on the total population.
1119
+ 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.
1120
+
1121
+ Label: Continuous Timeline (size)
1122
+ Description: Vary symbol sizes along a continuous ramp to represent dates.
1123
+ Keywords: graduated size, proportional size, classed size, how much, total, number, when
1124
+ Example: Vary the size of each feature based on the date a ticket was completed.
1125
+ Fields: This style requires a single field with a date type.`,
1126
+ schema: Qr
1127
+ });
1128
+ function _r(e) {
1129
+ const { fields: t, layer: r, view: o, colorSchemeTags: a } = e, n = t[0], c = t[1], s = t[2];
1130
+ let l;
1131
+ return a && (l = ot({
1132
+ geometryType: r.geometryType,
1133
+ includedTags: a
1134
+ })[0]), {
1135
+ layer: r,
1136
+ view: o,
1137
+ field: n,
1138
+ field2: c,
1139
+ field3: s,
1140
+ outlineOptimizationEnabled: !0,
1141
+ sizeOptimizationEnabled: !0,
1142
+ typeScheme: l
1143
+ };
1144
+ }
1145
+ async function Wr(e) {
1146
+ return await rt(e);
1147
+ }
1148
+ async function Vr({
1149
+ arcgisMap: e,
1150
+ arcgisMapView: t,
1151
+ layerId: r,
1152
+ fields: o,
1153
+ colorSchemes: a,
1154
+ theme: n
1155
+ }) {
1156
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
1157
+ if (!s)
1158
+ return `Could not find layer for id: ${r}`;
1159
+ const l = {
1160
+ styleName: "type",
1161
+ fields: o,
1162
+ layer: s,
1163
+ view: c,
1164
+ colorSchemeTags: a,
1165
+ theme: n
1166
+ };
1167
+ try {
1168
+ const u = _r(l), d = await Wr(u);
1169
+ return s.renderer = d.renderer, s.visible = !0, `Type renderer applied to layer: ${s.title ?? s.id} using fields ${o.join(", ")}`;
1170
+ } catch (u) {
1171
+ return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
1172
+ }
1173
+ }
1174
+ async function Ur({
1175
+ layerId: e,
1176
+ fields: t,
1177
+ colorSchemes: r,
1178
+ theme: o
1179
+ }, a) {
1180
+ const { mapView: n } = R(a);
1181
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Vr({
1182
+ arcgisMap: n.map,
1183
+ arcgisMapView: n,
1184
+ layerId: e,
1185
+ fields: t,
1186
+ colorSchemes: r,
1187
+ theme: o
1188
+ });
1189
+ }
1190
+ const Kr = i.object({
1191
+ layerId: i.string().describe("The id of the layer to apply the type renderer to"),
1192
+ fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1193
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1194
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1195
+ }), _n = y(Ur, {
1196
+ name: "type",
1197
+ description: `Label: Types (unique symbols)
1198
+ Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
1199
+ Keywords: categorical, category, type, unique, discrete, point of interest, region, group
1200
+ Example: Color each feature based on the region it belongs to
1201
+ Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1202
+ schema: Kr
1203
+ }), Wn = b.Root({
1204
+ ...B(),
1205
+ vectorSearchLayerIds: b(),
1206
+ vectorSearchFieldResults: b(),
1207
+ layerFieldInfo: b(),
1208
+ selectedLayerId: b()
1209
+ }), Vn = b.Root({
1210
+ ...B(),
1211
+ vectorSearchLayerIds: b(),
1212
+ vectorSearchFieldResults: b(),
1213
+ layerFieldInfo: b(),
1214
+ queryResponse: b(),
1215
+ dataExplorationMessages: b({
1216
+ reducer: Te,
1217
+ default: () => []
1218
+ })
1219
+ }), Br = ["mapView"];
1220
+ function I(e) {
1221
+ const r = e?.configurable?.context;
1222
+ if (!r || typeof r != "object")
1223
+ throw new Error("DataExplorationAgent context missing");
1224
+ const o = Br.filter((a) => !(a in r));
1225
+ if (o.length)
1226
+ throw new Error(`DataExplorationAgent context missing: ${o.join(", ")}`);
1227
+ return r;
1228
+ }
1229
+ const Hr = (e) => {
1230
+ const t = e.map?.allLayers.filter((o) => o.type === "feature");
1231
+ let r = 0;
1232
+ return t?.forEach((o) => {
1233
+ const a = o;
1234
+ a.featureEffect && (a.featureEffect = null, r++);
1235
+ }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1236
+ }, Jr = async (e, t) => {
1237
+ const { mapView: r } = I(t);
1238
+ return Hr(r);
1239
+ }, Zr = y(Jr, {
1240
+ name: "clearFilters",
1241
+ description: "Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",
1242
+ schema: i.object({})
1243
+ }), Yr = async (e) => {
1244
+ e.map?.allLayers.filter((a) => a.type === "feature")?.forEach((a) => {
1245
+ const n = a;
1246
+ n.featureEffect && (n.featureEffect = null);
1247
+ });
1248
+ const o = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1249
+ return o ? (await e.goTo(o), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1250
+ }, Xr = async (e, t) => {
1251
+ const { mapView: r } = I(t);
1252
+ return await Yr(r);
1253
+ }, eo = y(Xr, {
1254
+ name: "resetMap",
1255
+ description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
1256
+ schema: i.object({})
1257
+ }), be = 5;
1258
+ function U(e) {
1259
+ return "point" in e && e.point !== void 0;
1260
+ }
1261
+ function j(e) {
1262
+ return "layerId" in e && e.layerId !== void 0;
1263
+ }
1264
+ const H = async (e, t) => {
1265
+ if (U(e)) {
1266
+ const { point: r } = e;
1267
+ return { geometry: new Se({
1268
+ x: r.x,
1269
+ y: r.y,
1270
+ spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
1271
+ }) };
1272
+ }
1273
+ if (j(e)) {
1274
+ const r = t.map?.allLayers.find(
1275
+ (n) => n.id === e.layerId
1276
+ );
1277
+ if (!r)
1278
+ return { error: `Could not find geometry layer with ID: ${e.layerId}` };
1279
+ const o = r.title ?? r.id, a = e.where?.trim() || "1=1";
1280
+ try {
1281
+ const n = await r.queryFeatures({
1282
+ where: a,
1283
+ returnGeometry: !0,
1284
+ outSpatialReference: t.spatialReference,
1285
+ num: be + 1
1286
+ });
1287
+ if (!n.features.length)
1288
+ return {
1289
+ error: `No features found in geometry layer "${o}" with the specified where clause: ${a}`
1290
+ };
1291
+ if (n.features.length > be)
1292
+ return {
1293
+ error: `Geometry filter for layer "${o}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
1294
+ };
1295
+ const c = n.features.map((l) => l.geometry).filter((l) => !!l);
1296
+ if (!c.length)
1297
+ return { error: "No valid geometries found for the matched geometry layer features." };
1298
+ const s = c.length === 1 ? c[0] : it.executeMany(c);
1299
+ return s ? (s.spatialReference || (s.spatialReference = t.spatialReference), { geometry: s }) : { error: "Failed to combine geometries from geometry layer." };
1300
+ } catch (n) {
1301
+ return { error: `Failed to query geometry: ${String(n)}` };
1302
+ }
1303
+ }
1304
+ return { error: "Invalid geometry configuration provided" };
1305
+ }, to = async (e, t, r, o, a, n) => {
1306
+ const c = e.map?.allLayers.find((l) => l.id === t);
1307
+ if (!c)
1308
+ return { success: !1, error: `Layer '${t}' not found.` };
1309
+ const s = c.createQuery();
1310
+ s.where = r ?? "1=1", o && (s.geometry = o, s.spatialRelationship = "intersects", a && (s.distance = a), n && (s.units = n));
1311
+ try {
1312
+ const { extent: l, count: u } = await c.queryExtent(s);
1313
+ return !l || u === 0 ? {
1314
+ success: !1,
1315
+ error: `No features found for filter (where: ${s.where}${o ? ", spatial filter used" : ""})`
1316
+ } : (await e.goTo(l), { success: !0 });
1317
+ } catch (l) {
1318
+ return {
1319
+ success: !1,
1320
+ error: l instanceof Error ? l.message : String(l)
1321
+ };
1322
+ }
1323
+ }, ro = async (e, t, r, o, a, n) => {
1324
+ const c = t.map?.allLayers.find(
1325
+ (p) => p.id === e.layerId
1326
+ );
1327
+ if (!c)
1328
+ return `Could not find target layer with ID: ${e.layerId}`;
1329
+ let s;
1330
+ if (a) {
1331
+ const p = await H(a, t);
1332
+ if ("error" in p)
1333
+ return p.error;
1334
+ s = p.geometry;
1335
+ }
1336
+ if (c.featureEffect = null, c.featureEffect = new nt({
1337
+ filter: new ve({
1338
+ ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1339
+ geometry: s,
1340
+ spatialRelationship: "intersects",
1341
+ distance: a?.distance,
1342
+ units: a?.units
1343
+ }),
1344
+ includedEffect: r,
1345
+ excludedEffect: o
1346
+ }), c.visible = !0, n)
1347
+ return `Applied feature effects to "${c.title ?? e.layerId}" within current map extent.`;
1348
+ const l = e.objectIds?.length ? `${c.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await to(
1349
+ t,
1350
+ e.layerId,
1351
+ l,
1352
+ s,
1353
+ a?.distance,
1354
+ a?.units
1355
+ ), d = c.title ?? e.layerId;
1356
+ return u.success ? `Applied feature effects to target layer "${c.title ?? e.layerId}"${a && "layerId" in a ? ` using geometry from layer "${a.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${u.error}`;
1357
+ }, oo = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = i.enum(oo), ao = async ({
1358
+ targetLayer: e,
1359
+ geometryFilter: t,
1360
+ useCurrentExtent: r,
1361
+ includedEffect: o = "drop-shadow(2px, 2px, 2px, gray)",
1362
+ excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
1363
+ }, n) => {
1364
+ const { mapView: c } = I(n);
1365
+ return await ro(e, c, o, a, t, r);
1366
+ }, no = i.object({
1367
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1368
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1369
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1370
+ units: F.optional().describe("The units for the distance buffer.")
1371
+ }), io = i.object({
1372
+ point: i.object({
1373
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1374
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1375
+ spatialReference: i.object({
1376
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1377
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1378
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
1379
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1380
+ units: F.optional().describe("The units for the distance buffer.")
1381
+ }), so = i.object({
1382
+ targetLayer: i.object({
1383
+ layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
1384
+ where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
1385
+ objectIds: i.array(i.number()).optional().describe(
1386
+ "Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
1387
+ )
1388
+ }),
1389
+ geometryFilter: i.union([no, io]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1390
+ useCurrentExtent: i.boolean().optional().describe(
1391
+ "Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
1392
+ ),
1393
+ includedEffect: i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1394
+ "The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
1395
+ ),
1396
+ excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1397
+ "The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
1398
+ )
1399
+ }), co = y(ao, {
1400
+ name: "setFeatureEffect",
1401
+ description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
1402
+ schema: so
1403
+ }), re = (e) => {
1404
+ if (e instanceof Date)
1405
+ return Number.isNaN(e.getTime()) ? null : e;
1406
+ if (typeof e == "number" && Number.isFinite(e)) {
1407
+ const t = new Date(e);
1408
+ return Number.isNaN(t.getTime()) ? null : t;
1409
+ }
1410
+ return null;
1411
+ }, lo = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, uo = (e) => {
1412
+ if (typeof e == "string" && e)
1413
+ return e;
1414
+ const t = re(e);
1415
+ return t ? t.toISOString().slice(0, 10) : null;
1416
+ }, Un = () => {
1417
+ const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), o = (Math.abs(e) % 60).toString().padStart(2, "0"), a = `${t}${r}:${o}`;
1418
+ return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: a };
1419
+ }, po = (e, t, r) => {
1420
+ const o = t?.toLowerCase();
1421
+ if (o === "date-only") {
1422
+ const n = uo(e);
1423
+ return n ? st(n, Q("short-date")) : e;
1424
+ }
1425
+ if (o === "time-only") {
1426
+ if (typeof e == "string" && e)
1427
+ return ct(e, Q("long-time"));
1428
+ const n = re(e);
1429
+ return n ? fe(n, {
1430
+ ...Q("long-time"),
1431
+ timeZone: "UTC"
1432
+ }) : e;
1433
+ }
1434
+ const a = re(e);
1435
+ return a ? fe(a, {
1436
+ ...Q("short-date-short-time"),
1437
+ timeZone: lo(r)
1438
+ }) : e;
1439
+ }, $e = (e, t, r) => {
1440
+ if (e && typeof e != "function") {
1441
+ const o = "getField" in r && r.getField?.(e), a = o && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(o.name) : null;
1442
+ if (a?.type === "coded-value") {
1443
+ const c = a.codedValues.find((s) => s.code === t);
1444
+ return c ? c.name : null;
1445
+ }
1446
+ }
1447
+ return null;
1448
+ }, mo = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ho = (e) => {
1449
+ if (e instanceof Date)
1450
+ return Number.isNaN(e.getTime()) ? null : e;
1451
+ if (typeof e == "number" && Number.isFinite(e)) {
1452
+ const t = new Date(e);
1453
+ return Number.isNaN(t.getTime()) ? null : t;
1454
+ }
1455
+ if (typeof e == "string" && e) {
1456
+ const t = new Date(e);
1457
+ return Number.isNaN(t.getTime()) ? null : t;
1458
+ }
1459
+ return null;
1460
+ }, yo = (e, t) => {
1461
+ if (typeof e != "number")
1462
+ return e;
1463
+ const r = {};
1464
+ t.minimumFractionDigits !== void 0 && (r.minimumFractionDigits = t.minimumFractionDigits), t.maximumFractionDigits !== void 0 && (r.maximumFractionDigits = t.maximumFractionDigits), t.useGrouping === "always" ? r.useGrouping = !0 : t.useGrouping === "never" && (r.useGrouping = !1);
1465
+ try {
1466
+ return new Intl.NumberFormat(void 0, r).format(e);
1467
+ } catch {
1468
+ return e;
1469
+ }
1470
+ }, fo = (e, t, r) => {
1471
+ const o = ho(e);
1472
+ if (!o)
1473
+ return e;
1474
+ const a = {};
1475
+ t.dateStyle ? a.dateStyle = t.dateStyle : (t.year && (a.year = t.year), t.month && (a.month = t.month)), t.timeStyle && (a.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? a.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (a.hour12 = !1), a.timeZone = mo(r);
1476
+ try {
1477
+ return new Intl.DateTimeFormat(void 0, a).format(o);
1478
+ } catch {
1479
+ return e;
1480
+ }
1481
+ }, Ce = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ee = (e, t, r, o, a) => {
1482
+ if (r == null)
1483
+ return r;
1484
+ const c = e.getFieldConfiguration?.(t)?.fieldFormat;
1485
+ return c?.type === "number" ? yo(r, c) : c?.type === "date-time" ? fo(r, c, a) : po(r, o, a);
1486
+ }, go = (e, t, r, o) => {
1487
+ const a = e.fieldsIndex?.get(t), n = $e(t, r, e) ?? r;
1488
+ return Ee(e, t, n, a?.type, o);
1489
+ }, wo = (e, t) => Ce(e, t), Fe = (e, t, r) => {
1490
+ const o = e.objectIdField, a = t.features.map(
1491
+ (c) => c.attributes[o]
1492
+ ), n = t.features.map((c) => {
1493
+ const s = c.attributes, l = {};
1494
+ return e.fields.forEach((u) => {
1495
+ if (!Object.hasOwn(s, u.name))
1496
+ return;
1497
+ const d = s[u.name];
1498
+ if (u.name === o) {
1499
+ l[u.name] = d;
1500
+ return;
1501
+ }
1502
+ const p = $e(u.name, d, e) ?? d, m = Ce(e, u.name);
1503
+ l[m] = Ee(e, u.name, p, u.type, r);
1504
+ }), l;
1505
+ });
1506
+ return { objectIds: a, attributes: n };
1507
+ }, bo = (e, t, r) => {
1508
+ const o = e.createQuery();
1509
+ return o.outFields = [t], o.where = r || "1=1", o.num = 1, o;
1510
+ }, To = async (e, t, r, o) => {
1511
+ const a = o.map?.allLayers.find((m) => m.id === e), n = bo(a, t, r.where), s = (await a.queryFeatures(n)).features[0], l = s ? s.attributes[t] : null, u = go(a, t, l, o.timeZone), d = wo(a, t);
1512
+ return {
1513
+ tool: "getAttribute",
1514
+ layerName: a.title ?? e,
1515
+ summary: `${d} = ${u}`,
1516
+ details: {
1517
+ fieldName: t,
1518
+ fieldAlias: d !== t ? d : void 0,
1519
+ value: u,
1520
+ where: r.where
1521
+ }
1522
+ };
1523
+ };
1524
+ async function So({ layerId: e, fieldName: t, query: r }, o) {
1525
+ const { mapView: a } = I(o), n = await To(e, t, r, a);
1526
+ return JSON.stringify(n, null, 2);
1527
+ }
1528
+ const vo = i.object({
1529
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1530
+ fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
1531
+ query: i.object({
1532
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1533
+ })
1534
+ }), xo = y(So, {
1535
+ name: "getAttribute",
1536
+ description: "Returns an attribute value for a given feature.",
1537
+ schema: vo
1538
+ }), le = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
1539
+ function K(e, t) {
1540
+ let r = e ?? "";
1541
+ return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1542
+ }
1543
+ const Ro = async (e) => {
1544
+ const { targetLayer: t, fieldName: r, statisticType: o, mapView: a, layersAndFieldsRegistry: n, geometryFilter: c } = e, s = a.map?.allLayers.find((S) => S.id === t.layerId);
1545
+ if (!s)
1546
+ throw new Error(`Layer '${t.layerId}' not found.`);
1547
+ const l = await a.whenLayerView(s), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1548
+ if (!d)
1549
+ throw new Error(`Field '${r}' not found.`);
1550
+ let m, f;
1551
+ if (c) {
1552
+ const S = await H(c, a);
1553
+ if ("error" in S)
1554
+ throw new Error(S.error);
1555
+ if (!S.geometry)
1556
+ throw j(c) ? new Error(`No features found matching: ${c.where}`) : new Error("Failed to create geometry");
1557
+ if (j(c)) {
1558
+ const M = a.map?.allLayers.find((L) => L.id === c.layerId);
1559
+ m = {
1560
+ geometryLayerName: M?.title ?? M?.id,
1561
+ geometryLayerId: c.layerId,
1562
+ geometryWhere: c.where,
1563
+ distance: c.distance,
1564
+ units: c.units,
1565
+ applied: !0
1566
+ };
1567
+ } else U(c) && (m = {
1568
+ point: c.point,
1569
+ distance: c.distance,
1570
+ units: c.units,
1571
+ applied: !0
1572
+ });
1573
+ f = new ve({
1574
+ geometry: S.geometry,
1575
+ distance: c.distance,
1576
+ units: c.units,
1577
+ spatialRelationship: "intersects"
1578
+ });
1579
+ }
1580
+ const g = le(l, [r], !1);
1581
+ let h = null, w = null;
1582
+ const T = 10;
1583
+ if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1584
+ try {
1585
+ const S = {
1586
+ layer: s,
1587
+ useFeaturesInView: g,
1588
+ view: g ? a : void 0,
1589
+ field: r,
1590
+ sqlWhere: K(s.definitionExpression, t.where),
1591
+ ...f && { filter: f },
1592
+ outStatisticTypes: { include: [o] }
1593
+ };
1594
+ h = await lt(S);
1595
+ const M = ["string", "small-integer", "integer"], L = d.domain?.type === "coded-value" ? d.domain : null;
1596
+ (M.includes(d.type) || L) && (w = (await ut({
1597
+ layer: s,
1598
+ useFeaturesInView: g,
1599
+ view: g ? a : void 0,
1600
+ field: r,
1601
+ sqlWhere: K(s.definitionExpression, t.where),
1602
+ ...f && { filter: f }
1603
+ })).uniqueValueInfos.sort((z, ze) => ze.count - z.count).slice(0, T)), w && d.domain?.type === "coded-value" && (w = w.map((z) => ({
1604
+ ...z,
1605
+ value: L ? L.getName(z.value) ?? z.value : z.value
1606
+ })));
1607
+ } catch (S) {
1608
+ console.error("Statistics error:", S);
1609
+ }
1610
+ return {
1611
+ tool: "getStatistics",
1612
+ layerName: s.title ?? t.layerId,
1613
+ summary: `${o} = ${typeof h?.[o] == "number" ? h[o] : "N/A"}`,
1614
+ details: {
1615
+ fieldName: r,
1616
+ fieldAlias: p,
1617
+ statisticType: o,
1618
+ statistic: h?.[o] ?? null,
1619
+ summaryStatistics: h,
1620
+ uniqueValues: w,
1621
+ where: t.where,
1622
+ spatialFilterInfo: m
1623
+ }
1624
+ };
1625
+ };
1626
+ async function $o({
1627
+ targetLayer: e,
1628
+ fieldName: t,
1629
+ statisticType: r,
1630
+ geometryFilter: o
1631
+ }, a) {
1632
+ const n = Re(a, "layersAndFieldsRegistry"), { mapView: c } = I(a), s = await Ro({
1633
+ targetLayer: e,
1634
+ fieldName: t,
1635
+ statisticType: r,
1636
+ mapView: c,
1637
+ layersAndFieldsRegistry: n,
1638
+ geometryFilter: o
1639
+ });
1640
+ return JSON.stringify(s, null, 2);
1641
+ }
1642
+ const Co = i.object({
1643
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1644
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1645
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1646
+ units: F.optional().describe("The units for the distance buffer.")
1647
+ }), Eo = i.object({
1648
+ point: i.object({
1649
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1650
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1651
+ spatialReference: i.object({
1652
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1653
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1654
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
1655
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1656
+ units: F.optional().describe("The units for the distance buffer.")
1657
+ }), Fo = i.object({
1658
+ targetLayer: i.object({
1659
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1660
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1661
+ }),
1662
+ geometryFilter: i.union([Co, Eo]).optional().describe(
1663
+ "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."
1664
+ ),
1665
+ fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1666
+ statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1667
+ }), No = y($o, {
1668
+ name: "getStatistics",
1669
+ description: `Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
1670
+
1671
+ USE THIS TOOL FOR:
1672
+ - "What is the average/maximum/minimum/total [field]?" — aggregate computations
1673
+ - "Most common/frequent value of [field]?" — frequency analysis
1674
+ - Questions requiring a mathematical aggregation across many features
1675
+
1676
+ DO NOT USE FOR:
1677
+ - "How many features match X?" — use queryFeatures instead (it returns totalCount)
1678
+ - "Show / list / find features" — use queryFeatures instead
1679
+ - Simple counts of features matching a condition — use queryFeatures instead
1680
+
1681
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
1682
+ schema: Fo
1683
+ }), Io = async (e, t, r, o, a) => {
1684
+ const n = r.map?.allLayers.find((m) => m.id === e.layerId), c = await r.whenLayerView(n), s = n.title ?? e.layerId;
1685
+ let l;
1686
+ if (o) {
1687
+ const m = await H(o, r);
1688
+ if ("error" in m)
1689
+ return {
1690
+ tool: "getTopFeatures",
1691
+ layerName: s,
1692
+ summary: "Geometry lookup failed",
1693
+ details: { error: m.error }
1694
+ };
1695
+ if (!m.geometry)
1696
+ return {
1697
+ tool: "getTopFeatures",
1698
+ layerName: s,
1699
+ summary: "No features found for geometry filter",
1700
+ details: {
1701
+ error: `No features found matching: ${"where" in o ? o.where : "unknown criteria"}`
1702
+ }
1703
+ };
1704
+ l = m.geometry;
1705
+ } else a && (l = r.extent.clone());
1706
+ const u = t.groupByFields && t.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1707
+ try {
1708
+ let m;
1709
+ if (u) {
1710
+ const h = new dt({
1711
+ where: e.where || "1=1",
1712
+ outFields: p,
1713
+ orderByFields: e.orderByFields,
1714
+ geometry: l,
1715
+ spatialRelationship: l ? "intersects" : void 0,
1716
+ distance: o?.distance,
1717
+ units: o?.units,
1718
+ topFilter: new pt({
1719
+ topCount: t.topCount,
1720
+ groupByFields: t.groupByFields,
1721
+ orderByFields: t.orderByFields
1722
+ })
1723
+ });
1724
+ m = await n.queryTopFeatures(h);
1725
+ } else {
1726
+ const h = n.createQuery();
1727
+ h.where = K(n.definitionExpression, e.where || "1=1"), h.outFields = p.length ? p : ["*"], h.orderByFields = t.orderByFields, h.num = t.topCount, l && (h.geometry = l, h.spatialRelationship = "intersects"), o?.distance && (h.distance = o.distance), o?.units && (h.units = o.units), h.outSpatialReference = r.spatialReference;
1728
+ const w = le(c, e.outFields, a ?? !1);
1729
+ try {
1730
+ m = w ? await c.queryFeatures(h) : await n.queryFeatures(h);
1731
+ } catch (T) {
1732
+ console.warn("Client-side query failed, falling back to server:", T), m = await n.queryFeatures(h);
1733
+ }
1734
+ }
1735
+ const f = m.features.map((h) => h.attributes[d]), { attributes: g } = Fe(n, m, r.timeZone);
1736
+ return {
1737
+ tool: "getTopFeatures",
1738
+ layerName: s,
1739
+ summary: `Top ${t.topCount} features extracted`,
1740
+ details: {
1741
+ topCount: t.topCount,
1742
+ attributes: g,
1743
+ objectIds: f,
1744
+ objectIdField: d,
1745
+ where: e.where,
1746
+ orderByFields: t.orderByFields,
1747
+ ...u && { groupByFields: t.groupByFields }
1748
+ }
1749
+ };
1750
+ } catch (m) {
1751
+ return {
1752
+ tool: "getTopFeatures",
1753
+ layerName: s,
1754
+ summary: "Query failed",
1755
+ details: { error: m instanceof Error ? m.message : String(m) }
1756
+ };
1757
+ }
1758
+ }, ko = async ({
1759
+ targetLayer: e,
1760
+ topFilter: t,
1761
+ geometryFilter: r,
1762
+ useCurrentExtent: o
1763
+ }, a) => {
1764
+ const { mapView: n } = I(a), c = await Io(e, t, n, r, o);
1765
+ return JSON.stringify(c, null, 2);
1766
+ }, zo = i.object({
1767
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1768
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1769
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1770
+ units: F.optional().describe("The units for the distance buffer.")
1771
+ }), qo = i.object({
1772
+ point: i.object({
1773
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1774
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1775
+ spatialReference: i.object({
1776
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1777
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1778
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
1779
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1780
+ units: F.optional().describe("The units for the distance buffer.")
1781
+ }), Ao = i.object({
1782
+ targetLayer: i.object({
1783
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1784
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1785
+ orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1786
+ outFields: i.array(
1787
+ i.string().describe(
1788
+ '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 ("*").'
1789
+ ).default("*")
1790
+ )
1791
+ }),
1792
+ geometryFilter: i.union([zo, qo]).optional().describe(
1793
+ "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."
1794
+ ),
1795
+ topFilter: i.object({
1796
+ topCount: i.number().describe("Number of top features to return per group."),
1797
+ orderByFields: i.array(
1798
+ i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1799
+ ),
1800
+ groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
1801
+ }).required(),
1802
+ useCurrentExtent: i.boolean().optional().describe(
1803
+ "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)."
1804
+ )
1805
+ }), Do = y(ko, {
1806
+ name: "getTopFeatures",
1807
+ 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.',
1808
+ schema: Ao
1809
+ }), ee = 25, Lo = async (e, t, r, o) => {
1810
+ const a = t.map?.allLayers.find((h) => h.id === e.layerId), n = await t.whenLayerView(a), c = a.title ?? e.layerId;
1811
+ let s;
1812
+ if (r) {
1813
+ const h = await H(r, t);
1814
+ if ("error" in h) {
1815
+ const w = { error: h.error };
1816
+ if (j(r)) {
1817
+ const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1818
+ w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1819
+ } else U(r) && (w.point = r.point);
1820
+ return {
1821
+ tool: "queryFeatures",
1822
+ layerName: c,
1823
+ summary: "Geometry lookup failed",
1824
+ details: w
1825
+ };
1826
+ }
1827
+ if (!h.geometry) {
1828
+ const w = {};
1829
+ if (j(r)) {
1830
+ const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1831
+ w.error = `No features found matching: ${r.where}`, w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1832
+ } else U(r) && (w.error = "Failed to create point geometry", w.point = r.point);
1833
+ return {
1834
+ tool: "queryFeatures",
1835
+ layerName: c,
1836
+ summary: "No features found for geometry filter",
1837
+ details: w
1838
+ };
1839
+ }
1840
+ s = h.geometry;
1841
+ } else o && (s = t.extent.clone());
1842
+ const l = le(n, e.outFields, o ?? !1), u = a.objectIdField, d = a.createQuery();
1843
+ d.where = K(a.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])], d.orderByFields = e.orderByFields, s && (d.geometry = s, d.spatialRelationship = "intersects"), r?.distance && (d.distance = r.distance), r?.units && (d.units = r.units), d.outSpatialReference = t.spatialReference;
1844
+ let p, m;
1845
+ try {
1846
+ p = l ? await n.queryFeatureCount(d) : await a.queryFeatureCount(d), p > 0 && p <= ee && (m = l ? await n.queryFeatures(d) : await a.queryFeatures(d));
1847
+ } catch (h) {
1848
+ console.warn("Client-side query failed, falling back to server:", h), p = await a.queryFeatureCount(d), p > 0 && p <= ee && (m = await a.queryFeatures(d));
1849
+ }
1850
+ const { objectIds: f, attributes: g } = m ? Fe(a, m, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1851
+ return {
1852
+ tool: "queryFeatures",
1853
+ layerName: c,
1854
+ summary: `${p} features found`,
1855
+ details: {
1856
+ totalCount: p,
1857
+ where: e.where,
1858
+ orderByFields: e.orderByFields,
1859
+ outFields: e.outFields,
1860
+ ...f && { objectIds: f, objectIdField: u },
1861
+ ...g && { attributes: g },
1862
+ ...p > ee && {
1863
+ note: `${p} features found.`
1864
+ }
1865
+ }
1866
+ };
1867
+ };
1868
+ async function Po({
1869
+ targetLayer: e,
1870
+ geometryFilter: t,
1871
+ useCurrentExtent: r
1872
+ }, o) {
1873
+ const { mapView: a } = I(o), n = await Lo(e, a, t, r);
1874
+ return JSON.stringify(n, null, 2);
1875
+ }
1876
+ const jo = i.object({
1877
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1878
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1879
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1880
+ units: F.optional().describe("The units for the distance buffer.")
1881
+ }), Go = i.object({
1882
+ point: i.object({
1883
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1884
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1885
+ spatialReference: i.object({
1886
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1887
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1888
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
1889
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1890
+ units: F.optional().describe("The units for the distance buffer.")
1891
+ }), Oo = i.object({
1892
+ targetLayer: i.object({
1893
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1894
+ where: i.string().describe(
1895
+ "SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
1896
+ ),
1897
+ orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1898
+ outFields: i.array(
1899
+ i.string().describe(
1900
+ '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 ("*").'
1901
+ ).default("*")
1902
+ )
1903
+ }),
1904
+ geometryFilter: i.union([jo, Go]).optional().describe(
1905
+ "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."
1906
+ ),
1907
+ useCurrentExtent: i.boolean().optional().describe(
1908
+ "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
1909
+ )
1910
+ }), Mo = y(Po, {
1911
+ name: "queryFeatures",
1912
+ description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1913
+
1914
+ USE THIS TOOL FOR:
1915
+ - "Show / display / list features where..." — finding and listing features
1916
+ - "How many X are Y?" — counting features that match a condition
1917
+ - "Which features..." / "Find features..." — identifying specific features
1918
+ - Spatial queries — finding features near/within/intersecting other features
1919
+ - Any question where the user wants to SEE or COUNT matching features
1920
+
1921
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1922
+ schema: Oo
1923
+ }), Qo = [xo, No, Do, Mo], Kn = [co, eo, Zr], _o = new at(Qo, { handleToolErrors: !1 });
1924
+ async function Bn(e, t) {
1925
+ const { messages: r } = await _o.invoke({ messages: e.dataExplorationMessages }, t), o = [], a = [];
1926
+ for (const n of r) {
1927
+ const c = n.content;
1928
+ let s;
1929
+ typeof c != "string" && (s = {
1930
+ tool: n.name ?? "unknown",
1931
+ layerName: "unknown",
1932
+ summary: "Query failed",
1933
+ details: { error: "Skipping non-string tool output:", raw: c }
1934
+ });
1935
+ try {
1936
+ typeof c == "string" ? s = JSON.parse(c) : s = {
1937
+ tool: n.name ?? "unknown",
1938
+ layerName: "unknown",
1939
+ summary: "Query failed",
1940
+ details: { error: "Invalid tool output type", raw: c }
1941
+ };
1942
+ } catch {
1943
+ s = {
1944
+ tool: n.name ?? "unknown",
1945
+ layerName: "unknown",
1946
+ summary: "Query failed",
1947
+ details: { error: c }
1948
+ };
1949
+ }
1950
+ o.push(s), s.details && typeof s.details == "object" && "error" in s.details ? a.push(`- ${s.tool}: Error - ${String(s.details.error)}`) : a.push(`- ${s.layerName}: ${s.summary}`);
1951
+ }
1952
+ return await v({ text: `Finished executing layer query tool: ${a.join(", ")}` }, t), {
1953
+ ...e,
1954
+ dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1955
+ queryResponse: o,
1956
+ status: "success",
1957
+ summary: a.length > 0 ? Vt(a.join(`
1958
+ `)) : "Query executed."
1959
+ };
1960
+ }
1961
+ const Hn = b.Root({
1962
+ ...B(),
1963
+ // internal to the help agent
1964
+ helpInternalState: b({
1965
+ reducer: P,
1966
+ default: () => ({
1967
+ toolCallMessage: void 0
1968
+ })
1969
+ })
1970
+ }), Wo = (e, t) => {
1971
+ const r = Array.from(e.values()).find(
1972
+ ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1973
+ );
1974
+ if (!r) {
1975
+ const n = Array.from(e.values()).map((c) => c.layerItem.title).join(", ");
1976
+ return `Could not find a layer matching "${t}". Available layers: ${n}`;
1977
+ }
1978
+ const o = Array.from(r.fieldRegistry.values()), a = o.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1979
+ `);
1980
+ return `**${r.layerItem.title}** has ${o.length} field(s):
1981
+
1982
+ ${a}`;
1983
+ }, Vo = async ({ layerTitle: e }, t) => {
1984
+ const r = Re(t, "layersAndFieldsRegistry");
1985
+ return Wo(r, e);
1986
+ }, Jn = y(Vo, {
1987
+ name: "listLayerFields",
1988
+ description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
1989
+ schema: i.object({
1990
+ layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
1991
+ })
1992
+ }), Zn = b.Root({
1993
+ ...B(),
1994
+ intent: b({
1995
+ reducer: (e, t) => t
1996
+ }),
1997
+ arcgisKnowledgeMessages: b({
1998
+ reducer: Te,
1999
+ default: () => []
2000
+ }),
2001
+ arcgisKnowledgeToolResult: b({
2002
+ reducer: (e, t) => t,
2003
+ default: () => null
2004
+ })
2005
+ }), _ = {
2006
+ conversationId: ""
2007
+ };
2008
+ function ue(e) {
2009
+ const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2010
+ if (!t || t?.length !== 1)
2011
+ throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
2012
+ }
2013
+ function k(e) {
2014
+ return !!e?.map && !("activeLinkChartLayer" in e.map);
2015
+ }
2016
+ async function J(e) {
2017
+ !e || k(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2018
+ }
2019
+ function Z(e) {
2020
+ const r = e?.configurable?.context;
2021
+ if (!r || typeof r != "object")
2022
+ throw new Error("ArcgisKnowledgeAgent context missing");
2023
+ if (!("view" in r))
2024
+ throw new Error("View context missing");
2025
+ const o = r.view;
2026
+ return o.map && !("activeLinkChartLayer" in o.map) && ue(o), {
2027
+ view: o
2028
+ };
2029
+ }
2030
+ function Yn(e) {
2031
+ const r = e?.configurable?.context;
2032
+ if (Ne(e) === "knowledgeGraph")
2033
+ return "knowledgeGraph";
2034
+ const a = r.view;
2035
+ return k(a) ? (ue(a), "map") : "linkChart";
2036
+ }
2037
+ async function O(e) {
2038
+ const r = e?.configurable?.context;
2039
+ if (Ne(e) === "knowledgeGraph")
2040
+ return r;
2041
+ {
2042
+ const a = r.view.map;
2043
+ if (a && "activeLinkChartLayer" in a) {
2044
+ const n = a.knowledgeGraph?.url;
2045
+ if (!n)
2046
+ throw new Error("Knowledge graph url missing from link chart.");
2047
+ return {
2048
+ knowledgeGraph: await ge(n)
2049
+ };
2050
+ } else {
2051
+ ue(r.view);
2052
+ const c = (r.view.map?.allLayers.find(
2053
+ (l) => l.type === "knowledge-graph"
2054
+ )).url;
2055
+ if (!c)
2056
+ throw new Error("Knowledge graph url missing from map.");
2057
+ return {
2058
+ knowledgeGraph: await ge(c)
2059
+ };
2060
+ }
2061
+ }
2062
+ }
2063
+ function Ne(e) {
2064
+ const r = e?.configurable?.context;
2065
+ if (!r || typeof r != "object")
2066
+ throw new Error("ArcgisKnowledgeAgent context missing");
2067
+ if ("knowledgeGraph" in r && "view" in r)
2068
+ throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");
2069
+ if ("knowledgeGraph" in r)
2070
+ return "knowledgeGraph";
2071
+ if ("view" in r)
2072
+ return "view";
2073
+ throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2074
+ }
2075
+ class Uo {
2076
+ constructor(t) {
2077
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = de.fromDataModel(t);
2078
+ }
2079
+ }
2080
+ class de {
2081
+ constructor() {
2082
+ this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2083
+ mappingInfo: {
2084
+ identifierMapsTo: "UniformPropertyIdentifier",
2085
+ identifierPropertyName: "globalid"
2086
+ }
2087
+ };
2088
+ }
2089
+ static fromDataModel(t) {
2090
+ const r = new de();
2091
+ for (const o of t.entityTypes)
2092
+ r.entityTypes.push(G.fromEntityType(o));
2093
+ for (const o of t.relationshipTypes)
2094
+ r.relationshipTypes.push(Ko.fromRelationshipType(o));
2095
+ return r.identifierInfo = {
2096
+ mappingInfo: {
2097
+ identifierMapsTo: Bo(
2098
+ t.identifierInfo.identifierMappingInfo.identifierInfoType
2099
+ ),
2100
+ identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2101
+ }
2102
+ }, r.spatialReference = JSON.parse(JSON.stringify(t.spatialReference)), r;
2103
+ }
2104
+ // Generates a short summary of the types in the data model for LLM consumption.
2105
+ static getDataModelTypesSummary(t) {
2106
+ const r = t.entityTypes.map((a) => a.name).join(", "), o = t.relationshipTypes.map((a) => a.name).join(", ");
2107
+ return `Entity Types: ${r}.
2108
+ Relationship Types: ${o}.`;
2109
+ }
2110
+ }
2111
+ class G {
2112
+ constructor() {
2113
+ this.name = "", this.properties = [];
2114
+ }
2115
+ static fromEntityType(t) {
2116
+ const r = new G();
2117
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Ho(t.role);
2118
+ for (const o of t.properties) {
2119
+ const a = {
2120
+ name: o.name,
2121
+ alias: o.alias ? o.alias : void 0,
2122
+ fieldType: o.fieldType,
2123
+ role: Jo(o.role),
2124
+ geometryDef: o.fieldType === "esriFieldTypeGeometry" ? {
2125
+ geometryType: o.geometryType ?? "esriGeometryAny",
2126
+ hasM: o.hasM ? o.hasM : void 0,
2127
+ hasZ: o.hasZ ? o.hasZ : void 0
2128
+ } : void 0
2129
+ };
2130
+ r.properties.push(a);
2131
+ }
2132
+ return r;
2133
+ }
2134
+ }
2135
+ class Ko extends G {
2136
+ constructor() {
2137
+ super(...arguments), this.observedEndPoints = [];
2138
+ }
2139
+ static fromRelationshipType(t) {
2140
+ const r = G.fromEntityType(t);
2141
+ r.observedEndPoints = [];
2142
+ for (const o of t.endPoints)
2143
+ r.observedEndPoints.push({
2144
+ originEntityType: o.originEntityType,
2145
+ destinationEntityType: o.destinationEntityType
2146
+ });
2147
+ return r;
2148
+ }
2149
+ }
2150
+ const Bo = (e) => {
2151
+ switch (e) {
2152
+ case "esriIdentifierInfoTypeUNSPECIFIED":
2153
+ return "UNSPECIFIED";
2154
+ case "esriIdentifierInfoTypeDatabaseNative":
2155
+ return "DatabaseNative";
2156
+ case "esriIdentifierInfoTypeUniformProperty":
2157
+ return "UniformPropertyIdentifier";
2158
+ default:
2159
+ return e;
2160
+ }
2161
+ }, Ho = (e) => {
2162
+ switch (e) {
2163
+ case "Regular":
2164
+ return "esriGraphNamedObjectRegular";
2165
+ case "Provenance":
2166
+ return "esriGraphNamedObjectProvenance";
2167
+ case "Document":
2168
+ return "esriGraphNamedObjectDocument";
2169
+ default:
2170
+ return e;
2171
+ }
2172
+ };
2173
+ function Jo(e) {
2174
+ switch (e) {
2175
+ case "esriGraphPropertyRegular":
2176
+ return "Regular";
2177
+ case "esriGraphPropertyDocumentName":
2178
+ return "Document_Name";
2179
+ case "esriGraphPropertyDocumentTitle":
2180
+ return "Document_Title";
2181
+ case "esriGraphPropertyDocumentUrl":
2182
+ return "Document_Url";
2183
+ case "esriGraphPropertyDocumentText":
2184
+ return "Document_Text";
2185
+ case "esriGraphPropertyDocumentKeywords":
2186
+ return "Document_Keywords";
2187
+ case "esriGraphPropertyDocumentContentType":
2188
+ return "Document_ContentType";
2189
+ case "esriGraphPropertyDocumentMetadata":
2190
+ return "Document_Metadata";
2191
+ case "esriGraphPropertyDocumentFileExtension":
2192
+ return "Document_FileExtension";
2193
+ case "esriGraphPropertyProvenanceInstanceId":
2194
+ return "Provenance_InstanceId";
2195
+ case "esriGraphPropertyProvenanceSourceType":
2196
+ return "Provenance_SourceType";
2197
+ case "esriGraphPropertyProvenanceSourceName":
2198
+ return "Provenance_SourceName";
2199
+ case "esriGraphPropertyProvenanceSource":
2200
+ return "Provenance_Source";
2201
+ case "esriGraphPropertyProvenanceComment":
2202
+ return "Provenance_Comment";
2203
+ case "esriGraphPropertyProvenanceTypeName":
2204
+ return "Provenance_TypeName";
2205
+ case "esriGraphPropertyProvenancePropertyName":
2206
+ return "Provenance_PropertyName";
2207
+ default:
2208
+ return "Regular";
2209
+ }
2210
+ }
2211
+ function Y(e) {
2212
+ return e?.configurable?.abortSignal;
2213
+ }
2214
+ function Zo(e, t) {
2215
+ return t ? `${e}
2216
+
2217
+ Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
2218
+
2219
+ Attempt Number: ${t.attemptCount}
2220
+ Execution Error: ${t.executionError}
2221
+ Failed Query:
2222
+ ${t.failedGraphQuery}` : e;
2223
+ }
2224
+ async function Yo(e, t, r, o) {
2225
+ const { graphQuery: a, explanation: n } = await pe(e, t, r, o);
2226
+ return `Generated Graph Query:
2227
+ ${a}
2228
+
2229
+ Explanation: ${n}`;
2230
+ }
2231
+ async function pe(e, t, r, o, a) {
2232
+ const n = {
2233
+ message: Zo(e, a),
2234
+ context: new Uo(t)
2235
+ };
2236
+ _.conversationId && (n.conversationId = _.conversationId);
2237
+ const c = Y(o);
2238
+ await v({ text: "Attempting to generate a cypher query from your prompt..." }, o);
2239
+ const s = await he(`${r}/chat`, {
2240
+ method: "post",
2241
+ body: JSON.stringify(n),
2242
+ headers: {
2243
+ "Content-Type": "application/json",
2244
+ token: me.findCredential(N.getDefault().url)?.token ?? ""
2245
+ },
2246
+ signal: c
2247
+ });
2248
+ if (s.httpStatus !== 200)
2249
+ throw new Error(`Graph query service returned an error: ${s.httpStatus}`, {
2250
+ cause: s.data
2251
+ });
2252
+ _.conversationId || (_.conversationId = s.data.conversationId);
2253
+ let l = !1;
2254
+ const u = Date.now();
2255
+ let d = s.data.sequenceNumber, p = "", m = "", f = 1;
2256
+ for (; !l; ) {
2257
+ await new Promise((h) => setTimeout(h, 1e3)), await v(
2258
+ { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, f)}` },
2259
+ o
2260
+ ), f = f % 3 + 1;
2261
+ const g = await he(`${r}/chat`, {
2262
+ method: "post",
2263
+ body: JSON.stringify({
2264
+ conversationId: s.data.conversationId,
2265
+ inquiryId: s.data.inquiryId,
2266
+ ackSequenceNumber: d
2267
+ }),
2268
+ headers: {
2269
+ "Content-Type": "application/json",
2270
+ token: me.findCredential(N.getDefault().url)?.token ?? ""
2271
+ },
2272
+ signal: c
2273
+ });
2274
+ if (g.httpStatus !== 200)
2275
+ throw new Error(`Graph query service polling returned an error: ${g.httpStatus}`, {
2276
+ cause: g.data
2277
+ });
2278
+ if (g.data.context)
2279
+ p = g.data.context.graphQuery, m = g.data.message || "";
2280
+ else if (!g.data.hasMore)
2281
+ l = !0;
2282
+ else if (Date.now() - u > 6e4)
2283
+ throw new Error("Graph query service polling timed out after 1 minute.");
2284
+ d = g.data.sequenceNumber;
2285
+ }
2286
+ return { graphQuery: p, explanation: m };
2287
+ }
2288
+ const q = 3;
2289
+ function Ie(e, t = 100) {
2290
+ const r = {};
2291
+ for (const o of Object.entries(e.properties ?? {})) {
2292
+ const [a, n] = o;
2293
+ typeof n == "string" && n.length > t ? r[a] = `${n.slice(0, t)}... (truncated, original length: ${n.length})` : r[a] = n;
2294
+ }
2295
+ return e.properties = r, e;
2296
+ }
2297
+ function D(e) {
2298
+ 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);
2299
+ }
2300
+ const Xo = async ({
2301
+ kg: e,
2302
+ queryParams: t,
2303
+ targetStructure: r,
2304
+ targetStructureReducer: o,
2305
+ requestOptions: a,
2306
+ queryRowLimit: n,
2307
+ queryTimeoutMs: c
2308
+ }) => {
2309
+ let s = null, l = r;
2310
+ const u = new AbortController(), d = a?.signal, p = () => {
2311
+ u.abort(d?.reason);
2312
+ };
2313
+ d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2314
+ try {
2315
+ const m = await ht(e, t, a);
2316
+ s = m.resultHeader;
2317
+ const f = m.resultRowsStream.getReader();
2318
+ let g = 0;
2319
+ const h = Date.now(), w = !1;
2320
+ for (; ; ) {
2321
+ const { done: T, value: C } = await f.read();
2322
+ if (T)
2323
+ break;
2324
+ if (!w && c && Date.now() - h > c)
2325
+ return u.abort(), { type: "timeout" };
2326
+ for (const S of C) {
2327
+ if (g++, n && g > n)
2328
+ return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: s, processedResult: l };
2329
+ l = o(l, S);
2330
+ }
2331
+ }
2332
+ } catch (m) {
2333
+ return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: D(m), error: m };
2334
+ } finally {
2335
+ d?.removeEventListener("abort", p);
2336
+ }
2337
+ return { type: "success", rowLimitReached: !1, resultHeader: s, processedResult: l };
2338
+ };
2339
+ async function ke({
2340
+ prompt: e,
2341
+ kg: t,
2342
+ graphQueryServiceUrl: r,
2343
+ targetStructure: o,
2344
+ targetStructureReducer: a,
2345
+ requestOptions: n,
2346
+ queryRowLimit: c,
2347
+ queryTimeoutMs: s,
2348
+ config: l
2349
+ }) {
2350
+ let u;
2351
+ for (let d = 1; d <= q; d++) {
2352
+ let p;
2353
+ try {
2354
+ p = await pe(e, t.dataModel, r, l, u);
2355
+ } catch (g) {
2356
+ return {
2357
+ type: "generation-error",
2358
+ errorMessage: D(g),
2359
+ error: g
2360
+ };
2361
+ }
2362
+ await v(
2363
+ {
2364
+ text: `Attempting to execute query: ${p.graphQuery.substring(0, 500)}${p.graphQuery.length > 500 ? "..." : ""}`
2365
+ },
2366
+ l
2367
+ );
2368
+ const m = await Xo({
2369
+ kg: t,
2370
+ queryParams: new xe({
2371
+ openCypherQuery: p.graphQuery
2372
+ }),
2373
+ targetStructure: o,
2374
+ targetStructureReducer: a,
2375
+ requestOptions: n,
2376
+ queryRowLimit: c,
2377
+ queryTimeoutMs: s
2378
+ }), f = m.type === "aborted" ? "Query execution was aborted." : m.type === "timeout" ? "Query execution timed out." : m.type === "error" ? `Query failed with error: ${m.errorMessage}` : "";
2379
+ if (m.type === "success")
2380
+ return {
2381
+ type: "success",
2382
+ graphQuery: p.graphQuery,
2383
+ explanation: p.explanation,
2384
+ rowLimitReached: m.rowLimitReached,
2385
+ resultHeader: m.resultHeader,
2386
+ processedResult: m.processedResult
2387
+ };
2388
+ if (m.type === "aborted")
2389
+ return {
2390
+ type: "aborted",
2391
+ errorMessage: f,
2392
+ graphQuery: p.graphQuery,
2393
+ explanation: p.explanation
2394
+ };
2395
+ if (d >= q)
2396
+ return m.type === "timeout" ? {
2397
+ type: "timeout",
2398
+ errorMessage: f,
2399
+ graphQuery: p.graphQuery,
2400
+ explanation: p.explanation
2401
+ } : {
2402
+ type: "execution-error",
2403
+ errorMessage: f,
2404
+ error: m.error,
2405
+ graphQuery: p.graphQuery,
2406
+ explanation: p.explanation
2407
+ };
2408
+ u = {
2409
+ failedGraphQuery: p.graphQuery,
2410
+ executionError: f,
2411
+ attemptCount: d
2412
+ }, await v(
2413
+ { text: `Attempt ${d} failed with error: ${f}. Retrying...` },
2414
+ l
2415
+ );
2416
+ }
2417
+ throw new Error(
2418
+ `Failed to execute generated cypher due to an unexpected error after ${q} attempts.`
2419
+ );
2420
+ }
2421
+ const ea = async ({
2422
+ kg: e,
2423
+ searchQuery: t,
2424
+ typeCategoryFilter: r,
2425
+ namedTypesFilter: o,
2426
+ searchResultLimit: a,
2427
+ requestOptions: n
2428
+ }) => {
2429
+ const c = [];
2430
+ let s = [r];
2431
+ r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (s = ["entity", "relationship"]);
2432
+ const l = a ?? 1 / 0;
2433
+ try {
2434
+ for (const u of s) {
2435
+ const d = l - c.length;
2436
+ if (d <= 0)
2437
+ break;
2438
+ const f = (await yt(
2439
+ e,
2440
+ new ft({
2441
+ searchQuery: t,
2442
+ typeCategoryFilter: u,
2443
+ namedTypesFilter: o ?? void 0,
2444
+ num: d
2445
+ }),
2446
+ n
2447
+ )).resultRowsStream.getReader();
2448
+ let g = !1;
2449
+ for (; !g; ) {
2450
+ const { done: h, value: w } = await f.read();
2451
+ if (h) {
2452
+ g = !0;
2453
+ break;
2454
+ }
2455
+ for (const T of w)
2456
+ for (const C of T)
2457
+ c.push(C);
2458
+ }
2459
+ }
2460
+ } catch (u) {
2461
+ const d = D(u);
2462
+ return n?.signal?.aborted ? {
2463
+ type: "aborted",
2464
+ errorMessage: d,
2465
+ error: u
2466
+ } : { type: "error", errorMessage: d, error: u };
2467
+ }
2468
+ return {
2469
+ type: "success",
2470
+ results: c
2471
+ };
2472
+ };
2473
+ function ta(e, t) {
2474
+ A(e, (r) => {
2475
+ t.set(`${r.typeName}__${r.id}`, {
2476
+ id: r.id,
2477
+ typeName: r.typeName
2478
+ });
2479
+ });
2480
+ }
2481
+ function A(e, t) {
2482
+ if (!(!e || typeof e != "object")) {
2483
+ if (oa(e))
2484
+ for (const r of e.path)
2485
+ A(r, t);
2486
+ else if (ra(e))
2487
+ t(e);
2488
+ else if (Array.isArray(e))
2489
+ for (const r of e)
2490
+ A(r, t);
2491
+ else if (aa(e))
2492
+ for (const r of Object.values(e.properties ?? {}))
2493
+ A(r, t);
2494
+ }
2495
+ }
2496
+ function ra(e) {
2497
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2498
+ }
2499
+ function oa(e) {
2500
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2501
+ }
2502
+ function aa(e) {
2503
+ return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2504
+ }
2505
+ function na(e, t) {
2506
+ const r = [];
2507
+ for (const o of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
2508
+ const a = e.getMemberIdsByType(o.name);
2509
+ for (const n of a)
2510
+ r.push({ id: n, typeName: o.name });
2511
+ }
2512
+ return r;
2513
+ }
2514
+ function ia(e) {
2515
+ const t = [], r = [], a = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
2516
+ if (a?.generateAllSublayers)
2517
+ return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
2518
+ for (const [n, c] of a?.namedTypeDefinitions ?? [])
2519
+ if (c.useAllData)
2520
+ r.push(n);
2521
+ else
2522
+ for (const [s] of c.members)
2523
+ t.push({ id: s, typeName: n });
2524
+ return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
2525
+ }
2526
+ async function sa(e, t, r, o, a) {
2527
+ const { view: n } = o, c = await ke({
2528
+ prompt: e,
2529
+ kg: t,
2530
+ graphQueryServiceUrl: r,
2531
+ targetStructure: /* @__PURE__ */ new Map(),
2532
+ targetStructureReducer: (p, m) => {
2533
+ for (const f of m)
2534
+ ta(f, p);
2535
+ return p;
2536
+ },
2537
+ requestOptions: {
2538
+ signal: Y(a),
2539
+ timeout: a?.timeout
2540
+ },
2541
+ config: a
2542
+ });
2543
+ if (c.type !== "success") {
2544
+ const p = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2545
+ throw new Error(`Failed to add records to the link chart. ${p}`);
2546
+ }
2547
+ const { graphQuery: s, explanation: l, processedResult: u } = c, d = Array.from(u.values());
2548
+ return await v(
2549
+ {
2550
+ text: `Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`
2551
+ },
2552
+ a
2553
+ ), !k(n) && n?.map ? (await n.map.addRecords(d), await J(n), `Link Chart updated successfully. Cypher Query used:
2554
+ ${s}
2555
+
2556
+ Explanation: ${l}`) : (await n?.map?.allLayers.find(
2557
+ (m) => m.type === "knowledge-graph"
2558
+ )?.addRecords(d), `Map updated successfully. Cypher Query used:
2559
+ ${s}
2560
+
2561
+ Explanation: ${l}`);
2562
+ }
2563
+ const W = "addRecords", ca = i.object({
2564
+ prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
2565
+ }), la = async ({ prompt: e }, t) => {
2566
+ const { knowledgeGraph: r } = await O(t), o = Z(t), { view: a } = o, c = N.getDefault().helperServices;
2567
+ let s = e;
2568
+ if (k(a)) {
2569
+ const l = a.map, { allNamedTypesFullyDynamic: u, idTypePairs: d, dynamicTypes: p } = ia(l), m = await te("arcgis_knowledge_current_map_context");
2570
+ if (s = `${e}
2571
+
2572
+ ${m}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(p)}`, u)
2573
+ return {
2574
+ toolName: W,
2575
+ status: "success",
2576
+ summary: "No records have been added to the map because all data in the knowledge graph is contained in the map."
2577
+ };
2578
+ } else {
2579
+ const l = a.map, u = await te("arcgis_knowledge_current_lc_context"), d = na(l, r);
2580
+ s = `${e}
2581
+
2582
+ ${u}${JSON.stringify(d)}`;
2583
+ }
2584
+ try {
2585
+ const l = await sa(
2586
+ s,
2587
+ r,
2588
+ `${c.aiAssistantServices.url}${c.aiAssistantServices.graphQueryAssistant}`,
2589
+ o,
2590
+ t
2591
+ );
2592
+ return {
2593
+ toolName: W,
2594
+ status: "success",
2595
+ summary: l
2596
+ };
2597
+ } catch (l) {
2598
+ const u = D(l);
2599
+ return {
2600
+ toolName: W,
2601
+ status: "error",
2602
+ errorMessage: `Failed to add records to the link chart. ${u}`,
2603
+ error: l
2604
+ };
2605
+ }
2606
+ }, Xn = y(la, {
2607
+ name: W,
2608
+ 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.",
2609
+ schema: ca
2610
+ });
2611
+ async function ua(e, t) {
2612
+ return await t.map?.applyLayout(e), await J(t), `Successfully applied layout: ${e}.`;
2613
+ }
2614
+ const oe = "applyLayout", da = i.object({
2615
+ layout: i.enum([
2616
+ "organic-standard",
2617
+ "organic-community",
2618
+ "basic-grid",
2619
+ "hierarchical-bottom-to-top",
2620
+ "radial-root-centric",
2621
+ "tree-left-to-right",
2622
+ "geographic-organic-standard",
2623
+ "chronological-mono-timeline",
2624
+ "chronological-multi-timeline"
2625
+ ]).describe(
2626
+ "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"
2627
+ )
2628
+ }), pa = async ({ layout: e }, t) => {
2629
+ const { view: r } = Z(t);
2630
+ if (k(r))
2631
+ return {
2632
+ toolName: oe,
2633
+ status: "error",
2634
+ errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
2635
+ error: new Error()
2636
+ };
2637
+ {
2638
+ const o = await ua(e, r);
2639
+ return {
2640
+ toolName: oe,
2641
+ status: "success",
2642
+ summary: o
2643
+ };
2644
+ }
2645
+ }, ei = y(pa, {
2646
+ name: oe,
2647
+ description: "Apply a diagram layout to the link chart",
2648
+ schema: da
2649
+ });
2650
+ async function ma(e, t) {
2651
+ return t.map?.changeNonspatialDataDisplay(e), await J(t), `Successfully applied nonspatial visibility setting: ${e}.`;
2652
+ }
2653
+ const ae = "changeNonspatialVisibility", ha = i.object({
2654
+ setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2655
+ }), ya = async ({ setting: e }, t) => {
2656
+ const { view: r } = Z(t);
2657
+ if (k(r))
2658
+ return {
2659
+ toolName: ae,
2660
+ status: "error",
2661
+ errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
2662
+ error: new Error()
2663
+ };
2664
+ {
2665
+ const o = await ma(e, r);
2666
+ return {
2667
+ toolName: ae,
2668
+ status: "success",
2669
+ summary: o
2670
+ };
2671
+ }
2672
+ }, ti = y(ya, {
2673
+ name: ae,
2674
+ description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2675
+ schema: ha
2676
+ });
2677
+ async function fa(e, t, r, o, a) {
2678
+ let n, c = "";
2679
+ for (let s = 1; s <= q; s++) {
2680
+ const { graphQuery: l, explanation: u } = await pe(
2681
+ e,
2682
+ t.dataModel,
2683
+ r,
2684
+ a,
2685
+ n
2686
+ );
2687
+ try {
2688
+ await v({ text: `Attempting to create link chart from derived query: ${l}` }, a);
2689
+ const d = await mt.fromCypherQuery(
2690
+ t,
2691
+ new xe({
2692
+ openCypherQuery: l
2693
+ })
2694
+ );
2695
+ await v({ text: "Link chart created successfully, loading..." }, a), await d.load();
2696
+ const p = o.map;
2697
+ return o.map = d, await o.when(), await De.whenOnce(() => !o.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (o.map === d && (o.map = p), d.destroy(), {
2698
+ type: "error",
2699
+ message: `Query returned no results. Cypher Query used to create the link chart:
2700
+ ${l}
2701
+
2702
+ Explanation: ${u}`
2703
+ }) : (await J(o), {
2704
+ type: "success",
2705
+ message: `Link chart created successfully. Cypher Query used to create the link chart:
2706
+ ${l}
2707
+
2708
+ Explanation: ${u}`
2709
+ });
2710
+ } catch (d) {
2711
+ const p = D(d);
2712
+ if (s >= q) {
2713
+ c = p;
2714
+ break;
2715
+ }
2716
+ n = {
2717
+ failedGraphQuery: l,
2718
+ executionError: p,
2719
+ attemptCount: s
2720
+ }, await v(
2721
+ { text: `Attempt ${s} to create link chart failed with error: ${p}. Retrying ...` },
2722
+ a
2723
+ );
2724
+ }
2725
+ }
2726
+ return {
2727
+ type: "error",
2728
+ message: `Failed to create link chart after ${q} attempts. Last error: ${c}`
2729
+ };
2730
+ }
2731
+ const V = "createLinkChart", ga = i.object({
2732
+ prompt: i.string().describe(
2733
+ "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
2734
+ )
2735
+ }), wa = async ({ prompt: e }, t) => {
2736
+ const { knowledgeGraph: r } = await O(t), { view: o } = Z(t);
2737
+ if (k(o))
2738
+ return {
2739
+ toolName: V,
2740
+ status: "error",
2741
+ errorMessage: "The createLinkChart tool can only be used with a LinkChartView.",
2742
+ error: new Error()
2743
+ };
2744
+ {
2745
+ const n = N.getDefault().helperServices, c = await fa(
2746
+ e,
2747
+ r,
2748
+ `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2749
+ o,
2750
+ t
2751
+ );
2752
+ return c.type === "error" ? {
2753
+ toolName: V,
2754
+ status: "error",
2755
+ errorMessage: c.message,
2756
+ error: new Error()
2757
+ } : {
2758
+ toolName: V,
2759
+ status: "success",
2760
+ summary: c.message
2761
+ };
2762
+ }
2763
+ }, ri = y(wa, {
2764
+ name: V,
2765
+ 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.",
2766
+ schema: ga
2767
+ }), ne = "queryGraphData", ba = i.object({
2768
+ prompt: i.string().describe(
2769
+ `The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
2770
+
2771
+ REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
2772
+
2773
+ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`
2774
+ )
2775
+ }), Ta = async ({ prompt: e }, t) => {
2776
+ const { knowledgeGraph: r } = await O(t), a = N.getDefault().helperServices, n = await ke({
2777
+ prompt: e,
2778
+ kg: r,
2779
+ graphQueryServiceUrl: `${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
2780
+ targetStructure: new Array(),
2781
+ targetStructureReducer: (m, f) => (m.push(f), m),
2782
+ requestOptions: {
2783
+ signal: Y(t),
2784
+ timeout: t?.timeout
2785
+ },
2786
+ config: t
2787
+ });
2788
+ if (n.type !== "success") {
2789
+ const m = n.type === "generation-error" ? n.errorMessage : `${n.errorMessage} Cypher query: ${n.graphQuery}`;
2790
+ return {
2791
+ toolName: ne,
2792
+ status: "error",
2793
+ errorMessage: `Failed to query the knowledge graph. ${m}`,
2794
+ error: "error" in n ? n.error : null
2795
+ };
2796
+ }
2797
+ const { graphQuery: c, processedResult: s, resultHeader: l } = n, u = l.headerKeys;
2798
+ for (const m of s)
2799
+ for (const f of m)
2800
+ A(
2801
+ f,
2802
+ (g) => Ie(g)
2803
+ );
2804
+ const d = 50, p = s.slice(0, d).map((m) => JSON.stringify(m));
2805
+ return {
2806
+ toolName: ne,
2807
+ status: "success",
2808
+ summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
2809
+
2810
+ \`\`\`cypher
2811
+ ${c}
2812
+ \`\`\`
2813
+
2814
+ Query Results:
2815
+ ${p.length} result(s) found.
2816
+
2817
+ Column Headers: ${u.join(", ")}
2818
+
2819
+ ${p.length > d ? `Showing top ${d} results:
2820
+
2821
+ ` : `Results:
2822
+
2823
+ `}${p.join(`
2824
+ `)}
2825
+ `,
2826
+ details: {
2827
+ generatedQuery: c,
2828
+ resultHeader: l,
2829
+ queryResults: s
2830
+ }
2831
+ };
2832
+ }, oi = y(Ta, {
2833
+ name: ne,
2834
+ 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?'.",
2835
+ schema: ba
2836
+ }), ie = "generateCypher", Sa = i.object({
2837
+ prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2838
+ }), va = async ({ prompt: e }, t) => {
2839
+ const { knowledgeGraph: r } = await O(t), a = N.getDefault().helperServices;
2840
+ try {
2841
+ const n = await Yo(
2842
+ e,
2843
+ r.dataModel,
2844
+ `${a.aiAssistantServices.url}${a.aiAssistantServices.graphQueryAssistant}`,
2845
+ t
2846
+ );
2847
+ return {
2848
+ toolName: ie,
2849
+ status: "success",
2850
+ summary: n
2851
+ };
2852
+ } catch (n) {
2853
+ const c = D(n);
2854
+ return {
2855
+ toolName: ie,
2856
+ status: "error",
2857
+ errorMessage: `Failed to generate Cypher query. ${c}`,
2858
+ error: n
2859
+ };
2860
+ }
2861
+ }, ai = y(va, {
2862
+ name: ie,
2863
+ 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.",
2864
+ schema: Sa
2865
+ }), xa = (e) => {
2866
+ const t = e.dataModel, r = /* @__PURE__ */ new Map();
2867
+ for (const s of t.searchIndexes)
2868
+ if (s.supportedCategory !== "esriTypeMetaEntityProvenance")
2869
+ for (const [l, u] of s.searchProperties.entries()) {
2870
+ const d = r.get(l) ?? /* @__PURE__ */ new Set();
2871
+ u.propertyNames.forEach((p) => d.add(p)), r.set(l, d);
2872
+ }
2873
+ const o = t.entityTypes.filter((s) => r.has(s.name)), a = t.relationshipTypes.filter((s) => r.has(s.name)), n = `Entity Types:
2874
+ ${o.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2875
+ `)}`, c = `Relationship Types:
2876
+ ${a.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2877
+ `)}`;
2878
+ return `${n}
2879
+
2880
+ ${c}`;
2881
+ };
2882
+ async function Ra(e, t) {
2883
+ const r = await te("arcgis_knowledge_lucene_generation_prompt"), o = {
2884
+ inquiry: e,
2885
+ dataModelForSearch: xa(t)
2886
+ }, a = i.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), n = i.number().int().positive().nullable().describe(
2887
+ "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."
2888
+ ), c = i.array(
2889
+ i.enum(
2890
+ t.dataModel.entityTypes.map((u) => u.name).concat(t.dataModel.relationshipTypes.map((u) => u.name))
2891
+ )
2892
+ ).min(1), s = i.object({
2893
+ query: i.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
2894
+ typeFilters: c.nullable().describe(
2895
+ "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"
2896
+ ),
2897
+ typeCategoryFilter: a,
2898
+ resultLimit: n
2899
+ });
2900
+ return await Ae({
2901
+ promptText: r,
2902
+ inputVariables: o,
2903
+ schema: s
2904
+ });
2905
+ }
2906
+ const se = "searchGraphData", $a = i.object({
2907
+ prompt: i.string().describe(
2908
+ "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."
2909
+ )
2910
+ }), Ca = async ({ prompt: e }, t) => {
2911
+ const { knowledgeGraph: r } = await O(t);
2912
+ await v({ text: "Generating search query for the user inquiry" }, t);
2913
+ const o = await Ra(e, r);
2914
+ await v({ text: "Executing graph search with generated search query" }, t);
2915
+ const a = await ea({
2916
+ kg: r,
2917
+ searchQuery: o.query,
2918
+ typeCategoryFilter: o.typeCategoryFilter,
2919
+ namedTypesFilter: o.typeFilters,
2920
+ searchResultLimit: o.resultLimit,
2921
+ requestOptions: {
2922
+ signal: Y(t),
2923
+ timeout: t?.timeout
2924
+ }
2925
+ });
2926
+ if (a.type !== "success")
2927
+ return {
2928
+ toolName: se,
2929
+ status: "error",
2930
+ errorMessage: a.errorMessage,
2931
+ error: "error" in a ? a.error : null
2932
+ };
2933
+ for (const s of a.results)
2934
+ A(
2935
+ s,
2936
+ (l) => Ie(l)
2937
+ );
2938
+ const n = 10, c = a.results.slice(0, n);
2939
+ return {
2940
+ toolName: se,
2941
+ status: "success",
2942
+ summary: `To answer the query, the following lucene query was generated and executed:
2943
+ Query: ${o.query}
2944
+ Type Category Filter: ${o.typeCategoryFilter}
2945
+ Named Type Filters: ${o.typeFilters ? o.typeFilters.join(", ") : "None"}
2946
+ Result Limit: ${o.resultLimit ?? "No limit"}
2947
+
2948
+ Search Results: ${a.results.length} result(s) found.
2949
+
2950
+ ${a.results.length > n ? `Showing top ${n} results:
2951
+
2952
+ ` : ""}${c.map((s) => JSON.stringify(s)).join(`
2953
+ `)}`,
2954
+ details: {
2955
+ generatedQuery: o,
2956
+ searchResults: {
2957
+ ...a
2958
+ }
2959
+ }
2960
+ };
2961
+ }, ni = y(Ca, {
2962
+ name: se,
2963
+ description: "Allows users to search the knowledge graph for text matching their inquiry, 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.",
2964
+ schema: $a
2965
+ });
2966
+ export {
2967
+ An as A,
2968
+ Dn as B,
2969
+ Ln as C,
2970
+ Pn as D,
2971
+ jn as E,
2972
+ Gn as F,
2973
+ de as G,
2974
+ Hn as H,
2975
+ On as I,
2976
+ Mn as J,
2977
+ Qn as K,
2978
+ _n as L,
2979
+ Wn as M,
2980
+ vn as N,
2981
+ Un as O,
2982
+ Kn as P,
2983
+ Qo as Q,
2984
+ I as R,
2985
+ Vn as S,
2986
+ Bn as T,
2987
+ ei as a,
2988
+ ai as b,
2989
+ ti as c,
2990
+ ri as d,
2991
+ Xn as e,
2992
+ Re as f,
2993
+ te as g,
2994
+ Yn as h,
2995
+ O as i,
2996
+ Zn as j,
2997
+ xn as k,
2998
+ Jn as l,
2999
+ Rn as m,
3000
+ $n as n,
3001
+ Cn as o,
3002
+ En as p,
3003
+ oi as q,
3004
+ zn as r,
3005
+ ni as s,
3006
+ Vt as t,
3007
+ Fn as u,
3008
+ Nn as v,
3009
+ In as w,
3010
+ kn as x,
3011
+ $ as y,
3012
+ qn as z
3013
+ };