@arcgis/ai-components 6.0.0-next.0 → 6.0.0-next.2

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 (374) hide show
  1. package/dist/agent-utils/BaseAgent.js +1 -1
  2. package/dist/agent-utils/FunctionAgent.js +1 -1
  3. package/dist/agent-utils/LLMAgent.d.ts +9 -2
  4. package/dist/agent-utils/LLMAgent.js +46 -37
  5. package/dist/agent-utils/SkillAgent.js +1 -1
  6. package/dist/agent-utils/WorkflowAgent.js +1 -1
  7. package/dist/agent-utils/createSchema.js +1 -1
  8. package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
  9. package/dist/agent-utils/middlewares/middleware.js +1 -1
  10. package/dist/agent-utils/middlewares/trace.js +1 -1
  11. package/dist/agent-utils/middlewares/types.js +1 -1
  12. package/dist/agent-utils/tools/FunctionTool.d.ts +12 -1
  13. package/dist/agent-utils/tools/FunctionTool.js +16 -15
  14. package/dist/agent-utils/tools/MCPToolProvider.d.ts +54 -0
  15. package/dist/agent-utils/tools/MCPToolProvider.js +120 -0
  16. package/dist/agent-utils/tools/ToolProvider.d.ts +13 -0
  17. package/dist/agent-utils/tools/WebMCPToolProvider.d.ts +37 -0
  18. package/dist/agent-utils/tools/WebMCPToolProvider.js +71 -0
  19. package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
  20. package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
  21. package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
  22. package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
  23. package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
  24. package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
  25. package/dist/agents/agents/arcgisKnowledge/graph/arcgisKnowledgeGraph.js +1 -1
  26. package/dist/agents/agents/dataExploration/dataExplorationAgent.js +1 -1
  27. package/dist/agents/agents/dataExplorationGraph/graph/dataExplorationGraph.js +1 -1
  28. package/dist/agents/agents/help/helpAgent.js +1 -1
  29. package/dist/agents/agents/helpGraph/graph/helpGraph.js +1 -1
  30. package/dist/agents/agents/layerStyling/context/layerStylingContext.js +1 -1
  31. package/dist/agents/agents/layerStyling/graph/layerStylingGraph.js +1 -1
  32. package/dist/agents/agents/navigation/navigationAgent.js +1 -1
  33. package/dist/agents/agents/navigationGraph/graph/navigationGraph.js +1 -1
  34. package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
  35. package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
  36. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
  37. package/dist/agents/tools/help/listFields/adapter.js +1 -1
  38. package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
  39. package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
  40. package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
  41. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
  42. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
  43. package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
  44. package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
  45. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
  46. package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
  47. package/dist/agents/tools/query/getAttribute/adapter.js +29 -25
  48. package/dist/agents/tools/query/getStatistics/adapter.js +71 -67
  49. package/dist/agents/tools/query/getTopFeatures/adapter.js +75 -71
  50. package/dist/agents/tools/query/queryFeatures/adapter.js +41 -37
  51. package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
  52. package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
  53. package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
  54. package/dist/agents/tools/shared/types.js +1 -1
  55. package/dist/cdn/24KEZCPF.js +2 -0
  56. package/dist/cdn/{2UKFCF2J.js → 272R36XK.js} +2 -2
  57. package/dist/cdn/{FX4LV2S3.js → 2H32MDP2.js} +1 -1
  58. package/dist/cdn/{VAXH6RUQ.js → 2HNGMLFD.js} +2 -2
  59. package/dist/cdn/{3HV6OXCZ.js → 2JD3G7IW.js} +2 -2
  60. package/dist/cdn/2NOLMOEP.js +9 -0
  61. package/dist/cdn/{ZU2FHVNK.js → 2OW3DCUT.js} +2 -2
  62. package/dist/cdn/2PGZDONH.js +2 -0
  63. package/dist/cdn/2WY5MPMY.js +2 -0
  64. package/dist/cdn/{4OLV5LA7.js → 3COVQI26.js} +2 -2
  65. package/dist/cdn/{VIJVRJHL.js → 3UVQLYUK.js} +2 -2
  66. package/dist/cdn/{BIEX4MVV.js → 5HNKH5OK.js} +2 -2
  67. package/dist/cdn/{46DT6BIG.js → 5INBG23U.js} +1 -1
  68. package/dist/cdn/{MHUEU6MR.js → 5LBUP33F.js} +2 -2
  69. package/dist/cdn/{UZLQALHY.js → 5PV2GUZW.js} +1 -1
  70. package/dist/cdn/{UYEF3IKE.js → 5SRRG7WG.js} +2 -2
  71. package/dist/cdn/{AMFZY5QK.js → 5XZ5VL42.js} +2 -2
  72. package/dist/cdn/{IEAHAC6B.js → 63OF33IL.js} +2 -2
  73. package/dist/cdn/{7OQA4GCM.js → 6ELWX4W5.js} +2 -2
  74. package/dist/cdn/{OKVLGJAG.js → 6J3J7VLW.js} +2 -2
  75. package/dist/cdn/{AOVJ34QE.js → 6QOSUG64.js} +2 -2
  76. package/dist/cdn/{GVFJHADC.js → 6UGT2UG5.js} +2 -2
  77. package/dist/cdn/{VVWKEN53.js → 7APXFHDF.js} +3 -3
  78. package/dist/cdn/{QJOO6IIX.js → 7GDMXAF5.js} +2 -2
  79. package/dist/cdn/7JIXXYZR.js +2 -0
  80. package/dist/cdn/{2ZH5JNHL.js → 7OQK2F7O.js} +2 -2
  81. package/dist/cdn/{I7PHDOEQ.js → 7XVIZ7HK.js} +2 -2
  82. package/dist/cdn/{TRZJYWEB.js → A4ZVCRVF.js} +3 -3
  83. package/dist/cdn/{OVIQ5NSE.js → AGDGDULE.js} +2 -2
  84. package/dist/cdn/{TPULIO6I.js → AMA67DVI.js} +2 -2
  85. package/dist/cdn/AO42IPOX.js +2 -0
  86. package/dist/cdn/AOT3PM2Q.js +2 -0
  87. package/dist/cdn/{YO3L3XIH.js → AQ7KG25Q.js} +2 -2
  88. package/dist/cdn/{KKXOSV62.js → AWH4VDPD.js} +2 -2
  89. package/dist/cdn/AY2ZONWQ.js +2 -0
  90. package/dist/cdn/{B2JRBDJZ.js → BMVPOFHU.js} +2 -2
  91. package/dist/cdn/BWUQRZPK.js +2 -0
  92. package/dist/cdn/{EXIA3APU.js → C3VLDYS2.js} +2 -2
  93. package/dist/cdn/{PQ2DPOFM.js → C5Q6E7UC.js} +2 -2
  94. package/dist/cdn/{FDOMMK2M.js → CETIZ4IQ.js} +1 -1
  95. package/dist/cdn/{W3OJTTVX.js → COANVCKH.js} +2 -2
  96. package/dist/cdn/D7CRICBG.js +2 -0
  97. package/dist/cdn/D7FEOAW3.js +2 -0
  98. package/dist/cdn/{37EJSNE3.js → DY6MO2CA.js} +2 -2
  99. package/dist/cdn/EKMCGN6R.js +2 -0
  100. package/dist/cdn/EUIURCPS.js +2 -0
  101. package/dist/cdn/{NN6MELJ7.js → FGQH46Z2.js} +2 -2
  102. package/dist/cdn/FIZMK7GS.js +1 -0
  103. package/dist/cdn/FONIQ7VF.js +2 -0
  104. package/dist/cdn/G3KILEGJ.js +2 -0
  105. package/dist/cdn/{FYZATVB3.js → G7MCIFV2.js} +2 -2
  106. package/dist/cdn/{SDWWUWAF.js → GGAXXX5X.js} +2 -2
  107. package/dist/cdn/GS5JDPZH.js +2 -0
  108. package/dist/cdn/{KJZVYKWL.js → H4QWVTEZ.js} +2 -2
  109. package/dist/cdn/{HWNPZ4CF.js → H6J65TWL.js} +2 -2
  110. package/dist/cdn/{UHEYPSOR.js → HCPI2RJE.js} +2 -2
  111. package/dist/cdn/{TPMZRJEC.js → HJOWCZPL.js} +2 -2
  112. package/dist/cdn/HOMSK66Q.js +2 -0
  113. package/dist/cdn/{SBIYXWXZ.js → HTNKDDEV.js} +2 -2
  114. package/dist/cdn/{OFM2S6U7.js → HU527DML.js} +2 -2
  115. package/dist/cdn/I37ZJHTM.js +2 -0
  116. package/dist/cdn/{7DRHB24Z.js → I724KIFI.js} +2 -2
  117. package/dist/cdn/IH5P2PWJ.js +2 -0
  118. package/dist/cdn/{ZBRZU4XB.js → J3T5HB77.js} +2 -2
  119. package/dist/cdn/{ZMMUAYDN.js → JCWFLYB4.js} +2 -2
  120. package/dist/cdn/{IHP25JWI.js → JSRNLNOE.js} +2 -2
  121. package/dist/cdn/{MPWEXYYB.js → KDA5VPLO.js} +2 -2
  122. package/dist/cdn/KRPPMEOF.js +2 -0
  123. package/dist/cdn/{W6TS2TIE.js → KURNYULZ.js} +2 -2
  124. package/dist/cdn/{YOQCQAKT.js → L46O52F7.js} +2 -2
  125. package/dist/cdn/{W3ZLMBEE.js → L5OYOLWV.js} +3 -3
  126. package/dist/cdn/{M7TMD2HP.js → LDDP7NSY.js} +2 -2
  127. package/dist/cdn/{ZQTCPJUV.js → LGIXZLOP.js} +2 -2
  128. package/dist/cdn/{ENVTUTY6.js → LMAIOLS2.js} +2 -2
  129. package/dist/cdn/{CFAC4FN3.js → LWEKPFV6.js} +2 -2
  130. package/dist/cdn/M52LKZN7.js +2 -0
  131. package/dist/cdn/{6GQCLDLJ.js → M5UMOOL2.js} +2 -2
  132. package/dist/cdn/MHXM37QI.js +2 -0
  133. package/dist/cdn/{XI4BPYGB.js → MR3R5YHQ.js} +2 -2
  134. package/dist/cdn/{H7WJUUJT.js → MUSLUFKI.js} +2 -2
  135. package/dist/cdn/MYLY2ABI.js +2 -0
  136. package/dist/cdn/{2XXM52PS.js → N2GN5WOI.js} +3 -3
  137. package/dist/cdn/{2FUTKTNO.js → NAVK5JJ2.js} +3 -3
  138. package/dist/cdn/NDSYDURO.js +2 -0
  139. package/dist/cdn/{EU6YSCZL.js → NK2QRPS6.js} +2 -2
  140. package/dist/cdn/{GMZUN5SF.js → NYFL2F5L.js} +2 -2
  141. package/dist/cdn/{O62IJLTZ.js → OKDXM5D4.js} +2 -2
  142. package/dist/cdn/{I5OBL24F.js → OMUWBY75.js} +2 -2
  143. package/dist/cdn/{34O57OGV.js → OPQCY33W.js} +1 -1
  144. package/dist/cdn/{R74ZHFA6.js → OUMTV5H5.js} +1 -1
  145. package/dist/cdn/OZDRETY2.js +5 -0
  146. package/dist/cdn/{DYSPEU7W.js → PR4VMSKD.js} +1 -1
  147. package/dist/cdn/{V7ERVXIO.js → PXBS2FXE.js} +2 -2
  148. package/dist/cdn/{B4C7NIB5.js → Q7BJGEFH.js} +3 -3
  149. package/dist/cdn/QAVDW7A7.js +2 -0
  150. package/dist/cdn/{ONQ6JSBJ.js → QBZP6XOE.js} +1 -1
  151. package/dist/cdn/{OT5ECP4V.js → RFIN7KO6.js} +2 -2
  152. package/dist/cdn/RNJ7T5GF.js +2 -0
  153. package/dist/cdn/{Q6PCXSZT.js → S6OUM5X2.js} +2 -2
  154. package/dist/cdn/SG6PAUVR.js +2 -0
  155. package/dist/cdn/{U53SVXZK.js → SRXUC4QB.js} +2 -2
  156. package/dist/cdn/SUMXIUIS.js +2 -0
  157. package/dist/cdn/SW3D6QD4.js +2 -0
  158. package/dist/cdn/{GEFFWUB2.js → T2OYUOSO.js} +1 -1
  159. package/dist/cdn/T7LYQ56H.js +2 -0
  160. package/dist/cdn/{T2FKFOHE.js → TFXK2POV.js} +2 -2
  161. package/dist/cdn/{XQ3NBBQ3.js → TIQUULA4.js} +1 -1
  162. package/dist/cdn/{LCI5MEDN.js → TOUYGIGK.js} +2 -2
  163. package/dist/cdn/{DWMZ23QK.js → UJMM5QA4.js} +2 -2
  164. package/dist/cdn/UMTRLI63.js +2 -0
  165. package/dist/cdn/{MQSOVP27.js → UP7RW5K2.js} +2 -2
  166. package/dist/cdn/{J37GSI7C.js → UR2S7L6Z.js} +2 -2
  167. package/dist/cdn/{CEKOEHB3.js → UWHRBGWN.js} +2 -2
  168. package/dist/cdn/UXDRYDOD.js +11 -0
  169. package/dist/cdn/UZ7XFHYI.js +2 -0
  170. package/dist/cdn/V66TS2BB.js +2 -0
  171. package/dist/cdn/{AAUVOBPS.js → VINKTQFR.js} +1 -1
  172. package/dist/cdn/{U3ZTF2BC.js → VU7IOGNS.js} +2 -2
  173. package/dist/cdn/W2SIOY2B.js +3 -0
  174. package/dist/cdn/{WVMQ3I6F.js → W36IUEUB.js} +2 -2
  175. package/dist/cdn/{V6AQFRUC.js → WEBAQIUT.js} +2 -2
  176. package/dist/cdn/{WSIZ2OTL.js → WHIWOYHN.js} +1 -1
  177. package/dist/cdn/WOL5YMJ2.js +2 -0
  178. package/dist/cdn/{RBRHDEOB.js → X3YFCWQZ.js} +2 -2
  179. package/dist/cdn/{ICBIUFK7.js → X4EQEKM7.js} +2 -2
  180. package/dist/cdn/{UPSFL6U3.js → XBWGOD6I.js} +2 -2
  181. package/dist/cdn/XGDXTTYW.js +2 -0
  182. package/dist/cdn/{FFWPUYGD.js → XLHYQNAM.js} +2 -2
  183. package/dist/cdn/{NEV6OZN3.js → XMQJWPXI.js} +2 -2
  184. package/dist/cdn/{FXRZCD5Y.js → XQUKC4YK.js} +2 -2
  185. package/dist/cdn/{JEBRN3EU.js → XSH4B7FP.js} +2 -2
  186. package/dist/cdn/{LK7ZIQW6.js → XVWSIDZV.js} +2 -2
  187. package/dist/cdn/{J6A4AS7E.js → XYMIFFBW.js} +2 -2
  188. package/dist/cdn/{645SDZBB.js → Y3ZKMD47.js} +2 -2
  189. package/dist/cdn/{2GSHUAQ2.js → YAANCUW2.js} +2 -2
  190. package/dist/cdn/{XJUYG2M3.js → YD5LVM7V.js} +2 -2
  191. package/dist/cdn/{TTPTZBCM.js → YGI277SH.js} +2 -2
  192. package/dist/cdn/YGSDJ4V3.js +14 -0
  193. package/dist/cdn/YJEARDAZ.js +2 -0
  194. package/dist/cdn/{DXCDVRGL.js → YSEHJQ4L.js} +2 -2
  195. package/dist/cdn/Z44NI2YQ.js +2 -0
  196. package/dist/cdn/{74CVYM72.js → ZEDDYT24.js} +2 -2
  197. package/dist/cdn/{ZBBI5M2X.js → ZROI63CW.js} +2 -2
  198. package/dist/cdn/{ZKDCEL6K.js → ZUKM4DGB.js} +2 -2
  199. package/dist/cdn/ZVVNATCX.js +2 -0
  200. package/dist/cdn/agent-utils/BaseAgent.js +2 -2
  201. package/dist/cdn/agent-utils/FunctionAgent.js +2 -2
  202. package/dist/cdn/agent-utils/LLMAgent.js +2 -2
  203. package/dist/cdn/agent-utils/SkillAgent.js +2 -2
  204. package/dist/cdn/agent-utils/WorkflowAgent.js +2 -2
  205. package/dist/cdn/agent-utils/createSchema.js +2 -2
  206. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -2
  207. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
  208. package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
  209. package/dist/cdn/agent-utils/tools/FunctionTool.js +2 -2
  210. package/dist/cdn/agent-utils/tools/MCPToolProvider.js +15 -0
  211. package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -0
  212. package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +2 -2
  213. package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +2 -2
  214. package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +2 -2
  215. package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +2 -2
  216. package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +2 -2
  217. package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +2 -2
  218. package/dist/cdn/index.js +2 -2
  219. package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +2 -2
  220. package/dist/cdn/orchestrator/models/chatModel.js +2 -2
  221. package/dist/cdn/orchestrator/models/prompts.js +2 -2
  222. package/dist/cdn/orchestrator/signals.js +2 -2
  223. package/dist/cdn/orchestrator/state/runtime.js +2 -2
  224. package/dist/chunks/BaseWorkflow.js +1 -1
  225. package/dist/chunks/SKILL.js +1 -1
  226. package/dist/chunks/SKILL2.js +1 -1
  227. package/dist/chunks/SKILL3.js +1 -1
  228. package/dist/chunks/SKILL4.js +1 -1
  229. package/dist/chunks/adapter.js +1 -1
  230. package/dist/chunks/adapter2.js +1 -1
  231. package/dist/chunks/aiFactory.js +1 -1
  232. package/dist/chunks/aiUtilityService.js +1 -1
  233. package/dist/chunks/arcgisToolRegistry.js +1 -1
  234. package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
  235. package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
  236. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
  237. package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
  238. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
  239. package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
  240. package/dist/chunks/converterUtils.js +66 -110
  241. package/dist/chunks/createSkillAgent.js +1 -1
  242. package/dist/chunks/data_explore_filter_prompt.js +1 -1
  243. package/dist/chunks/data_explore_query_prompt.js +1 -1
  244. package/dist/chunks/embeddings.worker.js +1 -1
  245. package/dist/chunks/fetchAgentContext.js +1 -1
  246. package/dist/chunks/fetchService.js +1 -1
  247. package/dist/chunks/fetchUtils.js +1 -1
  248. package/dist/chunks/fieldStatistics.js +1 -1
  249. package/dist/chunks/field_descriptions_prompt.js +1 -1
  250. package/dist/chunks/formatFeatureAttributes.js +1 -1
  251. package/dist/chunks/getPrompt.js +1 -1
  252. package/dist/chunks/graph.js +1 -1
  253. package/dist/chunks/helpState.js +1 -1
  254. package/dist/chunks/help_prompt.js +1 -1
  255. package/dist/chunks/intent_prompt.js +1 -1
  256. package/dist/chunks/layerQueryToolCalling.js +1 -1
  257. package/dist/chunks/layerStylingState.js +1 -1
  258. package/dist/chunks/layer_descriptions_prompt.js +1 -1
  259. package/dist/chunks/layer_styling_prompt.js +1 -1
  260. package/dist/chunks/localization.js +1 -1
  261. package/dist/chunks/mergeWhereClauses.js +1 -1
  262. package/dist/chunks/modelConfig.js +1 -1
  263. package/dist/chunks/modelPricing.js +1 -1
  264. package/dist/chunks/navigationState.js +1 -1
  265. package/dist/chunks/navigation_intent_prompt.js +1 -1
  266. package/dist/chunks/navigation_tool_prompt.js +1 -1
  267. package/dist/chunks/observationSnapshot.js +1 -1
  268. package/dist/chunks/reducers.js +1 -1
  269. package/dist/chunks/requireAgentServices.js +1 -1
  270. package/dist/chunks/resolveFieldNames.js +9 -0
  271. package/dist/chunks/resolveGeometryFilter.js +1 -1
  272. package/dist/chunks/runtime.js +2 -2
  273. package/dist/chunks/runtime2.js +1 -1
  274. package/dist/chunks/runtimeSpans.js +1 -1
  275. package/dist/chunks/schema.js +1 -1
  276. package/dist/chunks/slottableRequestUtils.js +1 -1
  277. package/dist/chunks/state.js +1 -1
  278. package/dist/chunks/summarize_query_response_prompt.js +1 -1
  279. package/dist/chunks/textFormatters.js +1 -1
  280. package/dist/chunks/toolCallResponse.js +1 -1
  281. package/dist/chunks/useT9n.js +1 -1
  282. package/dist/chunks/utils.js +1 -1
  283. package/dist/chunks/utils2.js +1 -1
  284. package/dist/chunks/utils3.js +1 -1
  285. package/dist/chunks/webmapSchema.js +1 -1
  286. package/dist/components/arcgis-assistant/customElement.js +1 -1
  287. package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
  288. package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
  289. package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
  290. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
  291. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
  292. package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
  293. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
  294. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
  295. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
  296. package/dist/components/arcgis-assistant-message/customElement.js +1 -1
  297. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  298. package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
  299. package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
  300. package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
  301. package/dist/components/arcgis-assistant-message-log/customElement.js +5 -6
  302. package/dist/components/arcgis-assistant-message-log/index.js +5 -0
  303. package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
  304. package/dist/components/arcgis-assistant-message-text/customElement.js +11 -12
  305. package/dist/components/arcgis-assistant-message-text/index.js +5 -0
  306. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
  307. package/dist/components/arcgis-assistant-observation-inspector/customElement.js +1 -1
  308. package/dist/components/arcgis-assistant-observation-latency/customElement.js +1 -1
  309. package/dist/components/arcgis-assistant-observation-panel/customElement.js +1 -1
  310. package/dist/components/arcgis-assistant-observation-run/customElement.js +1 -1
  311. package/dist/components/arcgis-assistant-observation-usage/customElement.js +1 -1
  312. package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
  313. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
  314. package/dist/components/arcgis-assistant-user-message/customElement.js +8 -9
  315. package/dist/components/arcgis-assistant-user-message/index.js +5 -0
  316. package/dist/docs/api.json +1 -1
  317. package/dist/docs/docs.json +1 -1
  318. package/dist/docs/web-types.json +1 -1
  319. package/dist/index.js +1 -1
  320. package/dist/loader.js +1 -1
  321. package/dist/orchestrator/embeddings/cosineSimilarity.js +1 -1
  322. package/dist/orchestrator/embeddings/getEmbeddings.js +1 -1
  323. package/dist/orchestrator/embeddings/webmapEmbeddings.js +1 -1
  324. package/dist/orchestrator/models/chatModel.js +1 -1
  325. package/dist/orchestrator/models/prompts.js +1 -1
  326. package/dist/orchestrator/orchestrator/orchestrator.js +1 -1
  327. package/dist/orchestrator/orchestrator/orchestratorEvents.js +1 -1
  328. package/dist/orchestrator/signals.js +1 -1
  329. package/dist/orchestrator/state/runtime.js +1 -1
  330. package/dist/orchestrator/state/types.js +1 -1
  331. package/dist/orchestrator/types.js +1 -1
  332. package/dist/utils/index.js +1 -1
  333. package/package.json +8 -5
  334. package/dist/cdn/25CQLMB4.js +0 -2
  335. package/dist/cdn/34HKOU3T.js +0 -2
  336. package/dist/cdn/3WS4DSWD.js +0 -2
  337. package/dist/cdn/434TAA3J.js +0 -2
  338. package/dist/cdn/43OJZMBB.js +0 -2
  339. package/dist/cdn/4BRIOLDJ.js +0 -2
  340. package/dist/cdn/4KFTUBFL.js +0 -2
  341. package/dist/cdn/4ZPGFIE2.js +0 -2
  342. package/dist/cdn/6JCDY4FL.js +0 -2
  343. package/dist/cdn/7GQCNR4P.js +0 -11
  344. package/dist/cdn/A3KIOUWB.js +0 -2
  345. package/dist/cdn/BKKLQUK2.js +0 -2
  346. package/dist/cdn/CADNOKIK.js +0 -2
  347. package/dist/cdn/DQRKGYR3.js +0 -2
  348. package/dist/cdn/EOSKJPQV.js +0 -2
  349. package/dist/cdn/F7VQ3WH2.js +0 -2
  350. package/dist/cdn/FBIPIDP7.js +0 -2
  351. package/dist/cdn/GOET2CH4.js +0 -2
  352. package/dist/cdn/ISDNOFHU.js +0 -3
  353. package/dist/cdn/JZS6ZSWH.js +0 -2
  354. package/dist/cdn/KEBMHD4R.js +0 -9
  355. package/dist/cdn/KPHHXMRK.js +0 -2
  356. package/dist/cdn/LVSIZRTB.js +0 -2
  357. package/dist/cdn/OJP56R5R.js +0 -2
  358. package/dist/cdn/OYHYHALE.js +0 -2
  359. package/dist/cdn/QQPVN5MG.js +0 -2
  360. package/dist/cdn/QUZTFUWM.js +0 -1
  361. package/dist/cdn/REE4K4J7.js +0 -2
  362. package/dist/cdn/RFKOCMMT.js +0 -2
  363. package/dist/cdn/RKHDRUX5.js +0 -2
  364. package/dist/cdn/TGI7QCB2.js +0 -2
  365. package/dist/cdn/UALF45Q2.js +0 -2
  366. package/dist/cdn/WB5AFS42.js +0 -2
  367. package/dist/cdn/WC6SHIEX.js +0 -2
  368. package/dist/cdn/XPSPAZUD.js +0 -2
  369. package/dist/cdn/YAUQJ6NV.js +0 -2
  370. package/dist/cdn/YD3DLETZ.js +0 -2
  371. package/dist/cdn/YKKIJTJY.js +0 -2
  372. package/dist/cdn/ZCNCYKXW.js +0 -14
  373. package/dist/cdn/ZESTW6HJ.js +0 -2
  374. package/dist/cdn/ZS5P7NRI.js +0 -2
@@ -1,131 +1,135 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { tool as x } from "@langchain/core/tools";
3
3
  import t from "zod";
4
4
  import G from "@arcgis/core/rest/support/TopFeaturesQuery.js";
5
- import N from "@arcgis/core/rest/support/TopFilter.js";
6
- import { m as b, c as R } from "../../../../chunks/mergeWhereClauses.js";
7
- import { a as j } from "../../../../chunks/formatFeatureAttributes.js";
8
- import { g as D, s as Q, r as $ } from "../../../../chunks/resolveGeometryFilter.js";
9
- import { f as E } from "../../../../chunks/fetchAgentContext.js";
10
- import { distanceUnitsSchema as T } from "../../shared/types.js";
11
- const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) => e.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((e) => !!e), O = (r, e, a) => {
12
- if (a === "date") {
13
- const o = e instanceof Date ? e : typeof e == "number" ? new Date(e) : void 0;
14
- if (o && Number.isFinite(o.getTime())) {
15
- const l = o.toISOString().replace("T", " ").replace("Z", " +00:00");
16
- return `${r} = TIMESTAMP'${l}'`;
5
+ import R from "@arcgis/core/rest/support/TopFilter.js";
6
+ import { m as w, c as j } from "../../../../chunks/mergeWhereClauses.js";
7
+ import { a as D } from "../../../../chunks/formatFeatureAttributes.js";
8
+ import { g as Q, s as $, r as E } from "../../../../chunks/resolveGeometryFilter.js";
9
+ import { f as O } from "../../../../chunks/resolveFieldNames.js";
10
+ import { f as U } from "../../../../chunks/fetchAgentContext.js";
11
+ import { distanceUnitsSchema as B } from "../../shared/types.js";
12
+ const T = (o) => o.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) => e.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((e) => !!e), W = (o, e, n) => {
13
+ if (n === "date") {
14
+ const s = e instanceof Date ? e : typeof e == "number" ? new Date(e) : void 0;
15
+ if (s && Number.isFinite(s.getTime())) {
16
+ const l = s.toISOString().replace("T", " ").replace("Z", " +00:00");
17
+ return `${o} = TIMESTAMP'${l}'`;
17
18
  }
18
19
  return;
19
20
  }
20
21
  if (typeof e == "number" && Number.isFinite(e))
21
- return `${r} = ${e}`;
22
+ return `${o} = ${e}`;
22
23
  if (typeof e == "string")
23
- return `${r} = '${e.replace(/'/gu, "''")}'`;
24
- }, U = async (r, e, a, o, l) => {
25
- const i = a.map?.allLayers.find((s) => s.id === r.layerId), p = await a.whenLayerView(i), c = i.title ?? r.layerId;
24
+ return `${o} = '${e.replace(/'/gu, "''")}'`;
25
+ }, A = async (o, e, n, s, l) => {
26
+ const i = n.map?.allLayers.find((r) => r.id === o.layerId), p = await n.whenLayerView(i), c = i.title ?? o.layerId, y = O(
27
+ o.outFields,
28
+ i.fields.map((r) => r.name)
29
+ );
26
30
  let f;
27
- if (o) {
28
- const s = await D(o, a);
29
- if ("error" in s)
31
+ if (s) {
32
+ const r = await Q(s, n);
33
+ if ("error" in r)
30
34
  return {
31
35
  tool: "getTopFeatures",
32
36
  layerName: c,
33
37
  summary: "Geometry lookup failed",
34
- details: { error: s.error }
38
+ details: { error: r.error }
35
39
  };
36
- if (!s.geometry)
40
+ if (!r.geometry)
37
41
  return {
38
42
  tool: "getTopFeatures",
39
43
  layerName: c,
40
44
  summary: "No features found for geometry filter",
41
45
  details: {
42
- error: `No features found matching: ${"where" in o ? o.where : "unknown criteria"}`
46
+ error: `No features found matching: ${"where" in s ? s.where : "unknown criteria"}`
43
47
  }
44
48
  };
45
- f = s.geometry;
46
- } else l && (f = a.extent.clone());
47
- const w = e.groupByFields && e.groupByFields.length > 0, y = i.objectIdField, g = r.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...r.outFields, y])];
49
+ f = r.geometry;
50
+ } else l && (f = n.extent.clone());
51
+ const F = e.groupByFields && e.groupByFields.length > 0, g = i.objectIdField, b = y.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...y, g])];
48
52
  try {
49
- let s;
50
- if (w) {
53
+ let r;
54
+ if (F) {
51
55
  const u = new G({
52
- where: r.where || "1=1",
53
- outFields: g,
54
- orderByFields: r.orderByFields,
56
+ where: o.where || "1=1",
57
+ outFields: b,
58
+ orderByFields: o.orderByFields,
55
59
  geometry: f,
56
60
  spatialRelationship: f ? "intersects" : void 0,
57
- distance: o?.distance,
58
- units: o?.units,
59
- topFilter: new N({
61
+ distance: s?.distance,
62
+ units: s?.units,
63
+ topFilter: new R({
60
64
  topCount: e.topCount,
61
65
  groupByFields: e.groupByFields,
62
66
  orderByFields: e.orderByFields
63
67
  })
64
68
  });
65
- s = await i.queryTopFeatures(u);
69
+ r = await i.queryTopFeatures(u);
66
70
  } else {
67
71
  let u;
68
72
  if (e.topCount === 1) {
69
73
  const d = i.createQuery();
70
- d.where = b(i.definitionExpression, r.where || "1=1");
71
- const q = S(e.orderByFields)[0], h = i.fields.find((m) => m.name.toLowerCase() === q?.toLowerCase());
72
- if (h) {
74
+ d.where = w(i.definitionExpression, o.where || "1=1");
75
+ const N = T(e.orderByFields)[0], m = i.fields.find((h) => h.name.toLowerCase() === N?.toLowerCase());
76
+ if (m) {
73
77
  d.outFields = ["*"], d.orderByFields = e.orderByFields, d.num = e.topCount, d.returnGeometry = !1;
74
- const m = await i.queryFeatures(d), v = m.features[m.features.length - 1]?.attributes?.[h.name];
75
- u = O(h.name, v, h.type);
78
+ const h = await i.queryFeatures(d), q = h.features[h.features.length - 1]?.attributes?.[m.name];
79
+ u = W(m.name, q, m.type);
76
80
  }
77
81
  }
78
- const n = i.createQuery(), F = b(i.definitionExpression, r.where || "1=1");
79
- n.where = u ? b(F, u) : F, n.outFields = g.length ? g : ["*"], n.orderByFields = e.orderByFields, n.returnGeometry = !1, u || (n.num = e.topCount), f && (n.geometry = f, n.spatialRelationship = "intersects"), o?.distance && (n.distance = o.distance), o?.units && (n.units = o.units), n.outSpatialReference = a.spatialReference;
80
- const I = [
81
- .../* @__PURE__ */ new Set([...r.outFields, ...S(e.orderByFields)])
82
- ], k = R(p, I, l ?? !1);
82
+ const a = i.createQuery(), S = w(i.definitionExpression, o.where || "1=1");
83
+ a.where = u ? w(S, u) : S, a.outFields = b.length ? b : ["*"], a.orderByFields = e.orderByFields, a.returnGeometry = !1, u || (a.num = e.topCount), f && (a.geometry = f, a.spatialRelationship = "intersects"), s?.distance && (a.distance = s.distance), s?.units && (a.units = s.units), a.outSpatialReference = n.spatialReference;
84
+ const k = [
85
+ .../* @__PURE__ */ new Set([...y, ...T(e.orderByFields)])
86
+ ], v = j(p, k, l ?? !1);
83
87
  try {
84
- s = k ? await p.queryFeatures(n) : await i.queryFeatures(n);
88
+ r = v ? await p.queryFeatures(a) : await i.queryFeatures(a);
85
89
  } catch (d) {
86
- console.warn("Client-side query failed, falling back to server:", d), s = await i.queryFeatures(n);
90
+ console.warn("Client-side query failed, falling back to server:", d), r = await i.queryFeatures(a);
87
91
  }
88
92
  }
89
- const B = s.features.map((u) => u.attributes[y]), { attributes: C } = j(i, s, a.timeZone);
93
+ const C = r.features.map((u) => u.attributes[g]), { attributes: I } = D(i, r, n.timeZone);
90
94
  return {
91
95
  tool: "getTopFeatures",
92
96
  layerName: c,
93
97
  summary: `Top ${e.topCount} features extracted`,
94
98
  details: {
95
99
  topCount: e.topCount,
96
- attributes: C,
97
- objectIds: B,
98
- objectIdField: y,
99
- where: r.where,
100
+ attributes: I,
101
+ objectIds: C,
102
+ objectIdField: g,
103
+ where: o.where,
100
104
  orderByFields: e.orderByFields,
101
- ...w && { groupByFields: e.groupByFields }
105
+ ...F && { groupByFields: e.groupByFields }
102
106
  }
103
107
  };
104
- } catch (s) {
108
+ } catch (r) {
105
109
  return {
106
110
  tool: "getTopFeatures",
107
111
  layerName: c,
108
112
  summary: "Query failed",
109
- details: { error: s instanceof Error ? s.message : String(s) }
113
+ details: { error: r instanceof Error ? r.message : String(r) }
110
114
  };
111
115
  }
112
- }, W = async ({
113
- targetLayer: r,
116
+ }, V = async ({
117
+ targetLayer: o,
114
118
  topFilter: e,
115
- geometryFilter: a,
116
- useCurrentExtent: o
119
+ geometryFilter: n,
120
+ useCurrentExtent: s
117
121
  }, l) => {
118
- const { mapView: i } = E(l, ["mapView"]), p = $(
119
- a,
122
+ const { mapView: i } = U(l, ["mapView"]), p = E(
123
+ n,
120
124
  l.state?.agentExecutionContext?.sharedResources
121
- ), c = await U(r, e, i, p, o);
125
+ ), c = await A(o, e, i, p, s);
122
126
  return JSON.stringify(c, null, 2);
123
- }, A = t.object({
127
+ }, P = t.object({
124
128
  layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
125
129
  where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
126
130
  distance: t.number().optional().describe("The buffer distance around the geometry."),
127
- units: T.optional().describe("The units for the distance buffer.")
128
- }), V = t.object({
131
+ units: B.optional().describe("The units for the distance buffer.")
132
+ }), Y = t.object({
129
133
  point: t.object({
130
134
  x: t.number().describe("X coordinate (longitude) from navigation result"),
131
135
  y: t.number().describe("Y coordinate (latitude) from navigation result"),
@@ -134,8 +138,8 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
134
138
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
135
139
  }).describe("Point coordinates from a previous navigation/geocoding result"),
136
140
  distance: t.number().optional().describe("Optional buffer distance around the point."),
137
- units: T.optional().describe("The units for the distance buffer.")
138
- }), P = t.object({
141
+ units: B.optional().describe("The units for the distance buffer.")
142
+ }), Z = t.object({
139
143
  targetLayer: t.object({
140
144
  layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
141
145
  where: t.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -146,7 +150,7 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
146
150
  ).default("*")
147
151
  )
148
152
  }),
149
- geometryFilter: t.union([A, V, Q]).optional().describe(
153
+ geometryFilter: t.union([P, Y, $]).optional().describe(
150
154
  "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
151
155
  ),
152
156
  topFilter: t.object({
@@ -159,11 +163,11 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
159
163
  useCurrentExtent: t.boolean().optional().describe(
160
164
  "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)."
161
165
  )
162
- }), te = x(W, {
166
+ }), se = x(V, {
163
167
  name: "getTopFeatures",
164
168
  description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "latest", "earliest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). Display all the features that meet the ranking criteria, including ties at the cutoff value. orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
165
- schema: P
169
+ schema: Z
166
170
  });
167
171
  export {
168
- te as getTopFeaturesTool
172
+ se as getTopFeaturesTool
169
173
  };
@@ -1,55 +1,59 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { tool as v } from "@langchain/core/tools";
3
- import { a as C } from "../../../../chunks/formatFeatureAttributes.js";
4
- import { g as R, i as F, a as I, s as G, r as O } from "../../../../chunks/resolveGeometryFilter.js";
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { tool as C } from "@langchain/core/tools";
3
+ import { a as R } from "../../../../chunks/formatFeatureAttributes.js";
4
+ import { g as O, i as S, a as I, s as G, r as N } from "../../../../chunks/resolveGeometryFilter.js";
5
5
  import { c as j, m as x } from "../../../../chunks/mergeWhereClauses.js";
6
+ import { f as W } from "../../../../chunks/resolveFieldNames.js";
6
7
  import t from "zod";
7
- import { f as N } from "../../../../chunks/fetchAgentContext.js";
8
+ import { f as B } from "../../../../chunks/fetchAgentContext.js";
8
9
  import { distanceUnitsSchema as q } from "../../shared/types.js";
9
- const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), B = async (i, r, e, l) => {
10
- const a = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(a), f = a.title ?? i.layerId;
10
+ const p = 25, k = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), D = async (i, r, e, l) => {
11
+ const s = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(s), f = s.title ?? i.layerId;
11
12
  let h;
12
13
  if (e) {
13
- const u = await R(e, r);
14
+ const u = await O(e, r);
14
15
  if ("error" in u) {
15
- const s = { error: u.error };
16
- if (F(e)) {
16
+ const a = { error: u.error };
17
+ if (S(e)) {
17
18
  const c = r.map?.allLayers.find((y) => y.id === e.layerId);
18
- s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
19
- } else I(e) && (s.point = e.point);
19
+ a.geometryLayerName = c?.title ?? c?.id, a.geometryLayerId = e.layerId, a.geometryWhere = e.where;
20
+ } else I(e) && (a.point = e.point);
20
21
  return {
21
22
  tool: "queryFeatures",
22
23
  layerName: f,
23
24
  summary: "Geometry lookup failed",
24
- details: s
25
+ details: a
25
26
  };
26
27
  }
27
28
  if (!u.geometry) {
28
- const s = {};
29
- if (F(e)) {
29
+ const a = {};
30
+ if (S(e)) {
30
31
  const c = r.map?.allLayers.find((y) => y.id === e.layerId);
31
- s.error = `No features found matching: ${e.where}`, s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
32
- } else I(e) && (s.error = "Failed to create point geometry", s.point = e.point);
32
+ a.error = `No features found matching: ${e.where}`, a.geometryLayerName = c?.title ?? c?.id, a.geometryLayerId = e.layerId, a.geometryWhere = e.where;
33
+ } else I(e) && (a.error = "Failed to create point geometry", a.point = e.point);
33
34
  return {
34
35
  tool: "queryFeatures",
35
36
  layerName: f,
36
37
  summary: "No features found for geometry filter",
37
- details: s
38
+ details: a
38
39
  };
39
40
  }
40
41
  h = u.geometry;
41
42
  } else l && (h = r.extent.clone());
42
- const T = [
43
- .../* @__PURE__ */ new Set([...i.outFields, ...W(i.orderByFields)])
44
- ], b = j(d, T, l ?? !1), w = a.objectIdField, o = a.createQuery();
45
- o.where = x(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, h && (o.geometry = h, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
43
+ const v = [
44
+ .../* @__PURE__ */ new Set([...i.outFields, ...k(i.orderByFields)])
45
+ ], b = j(d, v, l ?? !1), w = s.objectIdField, o = s.createQuery();
46
+ o.where = x(s.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, h && (o.geometry = h, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
46
47
  let n, m;
47
48
  try {
48
- n = b ? await d.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (m = b ? await d.queryFeatures(o) : await a.queryFeatures(o));
49
+ n = b ? await d.queryFeatureCount(o) : await s.queryFeatureCount(o), n > 0 && n <= p && (m = b ? await d.queryFeatures(o) : await s.queryFeatures(o));
49
50
  } catch (u) {
50
- console.warn("Client-side query failed, falling back to server:", u), n = await a.queryFeatureCount(o), n > 0 && n <= p && (m = await a.queryFeatures(o));
51
+ console.warn("Client-side query failed, falling back to server:", u), n = await s.queryFeatureCount(o), n > 0 && n <= p && (m = await s.queryFeatures(o));
51
52
  }
52
- const { objectIds: g, attributes: S } = m ? C(a, m, r.timeZone) : { objectIds: void 0, attributes: void 0 };
53
+ const { objectIds: g, attributes: F } = m ? R(s, m, r.timeZone) : { objectIds: void 0, attributes: void 0 }, T = W(
54
+ i.outFields,
55
+ s.fields.map((u) => u.name)
56
+ );
53
57
  return {
54
58
  tool: "queryFeatures",
55
59
  layerName: f,
@@ -58,32 +62,32 @@ const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map
58
62
  totalCount: n,
59
63
  where: i.where,
60
64
  orderByFields: i.orderByFields,
61
- outFields: i.outFields,
65
+ outFields: T,
62
66
  ...g && { objectIds: g, objectIdField: w },
63
- ...S && { attributes: S },
67
+ ...F && { attributes: F },
64
68
  ...n > p && {
65
69
  note: `${n} features found.`
66
70
  }
67
71
  }
68
72
  };
69
73
  };
70
- async function k({
74
+ async function L({
71
75
  targetLayer: i,
72
76
  geometryFilter: r,
73
77
  useCurrentExtent: e
74
78
  }, l) {
75
- const { mapView: a } = N(l, ["mapView"]), d = O(
79
+ const { mapView: s } = B(l, ["mapView"]), d = N(
76
80
  r,
77
81
  l.state?.agentExecutionContext?.sharedResources
78
- ), f = await B(i, a, d, e);
82
+ ), f = await D(i, s, d, e);
79
83
  return JSON.stringify(f, null, 2);
80
84
  }
81
- const D = t.object({
85
+ const U = t.object({
82
86
  layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
83
87
  where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
84
88
  distance: t.number().optional().describe("The buffer distance around the geometry."),
85
89
  units: q.optional().describe("The units for the distance buffer.")
86
- }), L = t.object({
90
+ }), A = t.object({
87
91
  point: t.object({
88
92
  x: t.number().describe("X coordinate (longitude) from navigation result"),
89
93
  y: t.number().describe("Y coordinate (latitude) from navigation result"),
@@ -93,7 +97,7 @@ const D = t.object({
93
97
  }).describe("Point coordinates from a previous navigation/geocoding result"),
94
98
  distance: t.number().optional().describe("Optional buffer distance around the point."),
95
99
  units: q.optional().describe("The units for the distance buffer.")
96
- }), U = t.object({
100
+ }), E = t.object({
97
101
  targetLayer: t.object({
98
102
  layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
99
103
  where: t.string().describe(
@@ -106,13 +110,13 @@ const D = t.object({
106
110
  ).default("*")
107
111
  )
108
112
  }),
109
- geometryFilter: t.union([D, L, G]).optional().describe(
113
+ geometryFilter: t.union([U, A, G]).optional().describe(
110
114
  "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
111
115
  ),
112
116
  useCurrentExtent: t.boolean().optional().describe(
113
117
  "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)."
114
118
  )
115
- }), X = v(k, {
119
+ }), K = C(L, {
116
120
  name: "queryFeatures",
117
121
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
118
122
 
@@ -124,8 +128,8 @@ USE THIS TOOL FOR:
124
128
  - Any question where the user wants to SEE or COUNT matching features
125
129
 
126
130
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
127
- schema: U
131
+ schema: E
128
132
  });
129
133
  export {
130
- X as queryFeaturesTool
134
+ K as queryFeaturesTool
131
135
  };
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { tool as y } from "@langchain/core/tools";
3
3
  import t from "zod";
4
4
  import { f as h } from "../../../../chunks/fetchAgentContext.js";
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { tool as y } from "@langchain/core/tools";
3
3
  import i from "zod";
4
4
  import { f as n } from "../../../../chunks/fetchService.js";
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { ToolMessage as a } from "@langchain/core/messages";
3
3
  const i = (r) => typeof r == "object" && r !== null && "value" in r, c = ({ messages: r, schema: n, toolName: t }) => {
4
4
  for (let o = r.length - 1; o >= 0; o--) {
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import e from "zod";
3
3
  const t = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], i = e.enum(t);
4
4
  export {
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import b from"./Y3ZKMD47.js";import a from"./BMVPOFHU.js";import"./QBZP6XOE.js";import"./GS5JDPZH.js";import"./A4ZVCRVF.js";import"./N2GN5WOI.js";import"./272R36XK.js";import"./5PV2GUZW.js";export default $arcgis.t(([,a])=>{return a},a,b)
@@ -1,5 +1,5 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as Pe,c as Sn}from"./UZLQALHY.js";var cs=Pe((Mm,Vr)=>{"use strict";var pl=Object.prototype.hasOwnProperty,K="~";function Qe(){}Object.create&&(Qe.prototype=Object.create(null),new Qe().__proto__||(K=!1));function ml(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function os(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new ml(r,n||t,i),s=K?K+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],a]:t._events[s].push(a):(t._events[s]=a,t._eventsCount++),t}function kt(t,e){--t._eventsCount===0?t._events=new Qe:delete t._events[e]}function G(){this._events=new Qe,this._eventsCount=0}G.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)pl.call(r,n)&&e.push(K?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};G.prototype.listeners=function(e){var r=K?K+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,s=new Array(a);i<a;i++)s[i]=n[i].fn;return s};G.prototype.listenerCount=function(e){var r=K?K+e:e,n=this._events[r];return n?n.fn?1:n.length:0};G.prototype.emit=function(e,r,n,i,a,s){var o=K?K+e:e;if(!this._events[o])return!1;var c=this._events[o],u=arguments.length,l,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,a),!0;case 6:return c.fn.call(c.context,r,n,i,a,s),!0}for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var f=c.length,h;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!l)for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c[d].fn.apply(c[d].context,l)}}return!0};G.prototype.on=function(e,r,n){return os(this,e,r,n,!1)};G.prototype.once=function(e,r,n){return os(this,e,r,n,!0)};G.prototype.removeListener=function(e,r,n,i){var a=K?K+e:e;if(!this._events[a])return this;if(!r)return kt(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&kt(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==r||i&&!s[o].once||n&&s[o].context!==n)&&c.push(s[o]);c.length?this._events[a]=c.length===1?c[0]:c:kt(this,a)}return this};G.prototype.removeAllListeners=function(e){var r;return e?(r=K?K+e:e,this._events[r]&&kt(this,r)):(this._events=new Qe,this._eventsCount=0),this};G.prototype.off=G.prototype.removeListener;G.prototype.addListener=G.prototype.on;G.prefixed=K;G.EventEmitter=G;typeof Vr<"u"&&(Vr.exports=G)});var us=Pe((Nm,ls)=>{"use strict";ls.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var fs=Pe((Pm,$t)=>{"use strict";var _l=us(),Lt=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},ds=(t,e,r)=>new Promise((n,i)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let a=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){i(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,o=r instanceof Error?r:new Lt(s);typeof t.cancel=="function"&&t.cancel(),i(o)},e);_l(t.then(n,i),()=>{clearTimeout(a)})});$t.exports=ds;$t.exports.default=ds;$t.exports.TimeoutError=Lt});var hs=Pe(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});function gl(t,e,r){let n=0,i=t.length;for(;i>0;){let a=i/2|0,s=n+a;r(t[s],e)<=0?(n=++s,i-=a+1):i=a}return n}qr.default=gl});var ps=Pe(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var yl=hs(),Kr=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=yl.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Jr.default=Kr});var Qr=Pe(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});var wl=cs(),ms=fs(),bl=ps(),Ut=()=>{},El=new ms.TimeoutError,Wr=class extends wl{constructor(e){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ut,this._resolveIdle=Ut,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:bl.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=Ut,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Ut,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():ms.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(El)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Xr.default=Wr});var xn=Object.defineProperty,P=(t,e)=>{let r={};for(var n in t)xn(r,n,{get:t[n],enumerable:!0});return e||xn(r,Symbol.toStringTag,{value:"Module"}),r};var no=/([A-Z]+)([A-Z][a-z0-9]+)/g,io=/([a-z0-9])([A-Z])/g,Tn=/[-_\s]+/g;function ao(t){return t.replace(no,"$1_$2").replace(io,"$1_$2").replace(Tn,"_").toLowerCase()}function so(t){let e=t.trim();return/[-_\s]/.test(e)?e.replace(Tn,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):e}function An(t,e){return e?.[t]||ao(t)}function xu(t,e){return e?.[t]||so(t)}function In(t,e,r){let n={};for(let i in t)Object.hasOwn(t,i)&&(n[e(i,r)]=t[i]);return n}var On="__lc_escaped__";function oo(t){return"lc"in t||Object.keys(t).length===1&&"__lc_escaped__"in t}function co(t){return{[On]:t}}function lo(t){return Object.keys(t).length===1&&"__lc_escaped__"in t}function uo(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function fo(t){let e;return t!==null&&typeof t=="object"?"lc_id"in t&&Array.isArray(t.lc_id)?e=t.lc_id:e=[t.constructor?.name??"Object"]:e=[typeof t],{lc:1,type:"not_implemented",id:e}}function it(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return fo(t);if(uo(t))return t;e.add(t);let r=t;if(oo(r))return e.delete(t),co(r);let n={};for(let[i,a]of Object.entries(r))n[i]=it(a,e);return e.delete(t),n}return Array.isArray(t)?t.map(r=>it(r,e)):t}function Cn(t){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let e=t;if(lo(e))return e[On];let r={};for(let[n,i]of Object.entries(e))r[n]=Cn(i);return r}return Array.isArray(t)?t.map(e=>Cn(e)):t}var Ru=P({Serializable:()=>ke,get_lc_unique_name:()=>at});function Rn(t){return Array.isArray(t)?[...t]:{...t}}function ho(t,e){let r=Rn(t);for(let[n,i]of Object.entries(e)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Rn(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function at(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var ke=class Mn{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,at(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Mn||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,c)=>(o[c]=c in this?this[c]:this.lc_kwargs[c],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));Object.keys(r).forEach(o=>{let c=this,u=n,[l,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in u)||u[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?u[f]={}:Array.isArray(c[f])&&(u[f]=[])),c=c[f],u=u[f]}l in c&&c[l]!==void 0&&(u[l]=u[l]||c[l])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=it(c,a);let s=In(Object.keys(r).length?ho(i,r):i,An,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function pe(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function Nn(t){return pe(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function Pn(t){return pe(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function Nu(t){return pe(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function kn(t){return pe(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Pu(t){if(pe(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function ku(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let i={};for(let a of t.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Yt({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=e?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function Lu(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function g(t,e){return b(t)&&t.type===e}function b(t){return typeof t=="object"&&t!==null}function U(t){return Array.isArray(t)}function p(t){return typeof t=="string"}function Y(t){return typeof t=="number"}function st(t){return t instanceof Uint8Array}function Zt(t){try{return JSON.parse(t)}catch{return}}var Z=t=>t();function po(t){if(t.type==="char_location"&&p(t.document_title)&&Y(t.start_char_index)&&Y(t.end_char_index)&&p(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="page_location"&&p(t.document_title)&&Y(t.start_page_number)&&Y(t.end_page_number)&&p(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="content_block_location"&&p(t.document_title)&&Y(t.start_block_index)&&Y(t.end_block_index)&&p(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="web_search_result_location"&&p(t.url)&&p(t.title)&&p(t.encrypted_index)&&p(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(t.type==="search_result_location"&&p(t.source)&&p(t.title)&&Y(t.start_block_index)&&Y(t.end_block_index)&&p(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function $n(t){if(g(t,"document")&&b(t.source)&&"type"in t.source){if(t.source.type==="base64"&&p(t.source.media_type)&&p(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&p(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&p(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&p(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(g(t,"image")&&b(t.source)&&"type"in t.source){if(t.source.type==="base64"&&p(t.source.media_type)&&p(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&p(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&p(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function Un(t){function*e(){for(let r of t){let n=$n(r);n?yield n:yield r}}return Array.from(e())}function Ln(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(g(n,"text")&&p(n.text)){let{text:i,citations:a,...s}=n;if(U(a)&&a.length){let o=a.reduce((c,u)=>{let l=po(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(g(n,"thinking")&&p(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(g(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(g(n,"tool_use")&&p(n.name)&&p(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(g(n,"input_json_delta")){if(mo(t)&&t.tool_call_chunks?.length){let i=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(g(n,"server_tool_use")&&p(n.name)&&p(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Z(()=>{if(typeof n.input=="string")return n.input;if(b(n.input)&&p(n.input.query))return n.input.query;if(p(n.partial_json)){let s=Zt(n.partial_json);if(s?.query)return s.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:a,type:"server_tool_call",name:"code_execution",args:{code:Z(()=>{if(typeof n.input=="string")return n.input;if(b(n.input)&&p(n.input.code))return n.input.code;if(p(n.partial_json)){let s=Zt(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(g(n,"web_search_tool_result")&&p(n.tool_use_id)&&U(n.content)){let{content:i,tool_use_id:a}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:a,status:"success",output:{urls:i.reduce((s,o)=>g(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(g(n,"code_execution_tool_result")&&p(n.tool_use_id)&&b(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(g(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(g(n,"mcp_tool_result")&&p(n.tool_use_id)&&b(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(g(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(g(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(g(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=$n(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var jn={translateContent:Ln,translateContentChunk:Ln};function mo(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function _o(t){return Nn(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:Pn(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:kn(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Dn(t){return t.map(_o)}function Bn(t){return!!(g(t,"image_url")&&b(t.image_url)||g(t,"input_audio")&&b(t.input_audio)||g(t,"file")&&b(t.file))}function Hn(t){if(g(t,"image_url")&&b(t.image_url)&&p(t.image_url.url)){let e=Yt({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(g(t,"input_audio")&&b(t.input_audio)&&p(t.input_audio.data)&&p(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(g(t,"file")&&b(t.file)&&p(t.file.data)){let e=Yt({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(p(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function go(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...ot(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function yo(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...ot(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function ot(t){let e=[];for(let r of t)Bn(r)?e.push(Hn(r)):e.push(r);return e}function wo(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:i}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:i}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function Fn(t){function*e(){b(t.additional_kwargs?.reasoning)&&U(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((n,i)=>b(i)&&p(i.text)?`${n}${i.text}`:n,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(g(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,u=b(o)?{...o}:{};p(s)&&(u.phase=s);let l=Object.keys(u).length>0?{extras:u}:{};Array.isArray(a)?yield{...c,...l,type:"text",text:String(i),annotations:a.map(wo)}:yield{...c,...l,type:"text",text:String(i)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(b(t.additional_kwargs)&&U(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(g(n,"web_search_call")){let i={};if(b(n.action)&&p(n.action.query)&&(i.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:i},n.status==="completed"||n.status==="failed"){let a={};b(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(g(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:U(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:U(n.results)?{results:n.results}:{}});continue}else if(g(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(g(n,"code_interpreter_call")){if(p(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),U(n.outputs)){let i=Z(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let a of n.outputs)if(g(a,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:i??0,stderr:[0,void 0].includes(i)?void 0:String(a.logs),stdout:[0,void 0].includes(i)?String(a.logs):void 0}};continue}}continue}else if(g(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(g(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(g(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(g(n,"tool_search_call")){let i={};b(n.arguments)&&Object.assign(i,n.arguments);let a={};p(n.execution)&&(a.execution=n.execution),p(n.status)&&(a.status=n.status),p(n.call_id)&&(a.call_id=n.call_id),yield{id:p(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(g(n,"tool_search_output")){let i={name:"tool_search"};p(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:U(n.tools)?n.tools:[]},extras:i};continue}else if(g(n,"image_generation_call")){p(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:p(n.id)?n.id:void 0,metadata:{status:p(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}b(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function bo(t){function*e(){yield*Fn(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var Gn={translateContent:t=>typeof t.content=="string"?go(t):Fn(t),translateContentChunk:t=>typeof t.content=="string"?yo(t):bo(t)};function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}function Vn(t,e="pretty"){return e==="pretty"?Eo(t):JSON.stringify(t)}function Eo(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(e.push(`${i}${r}${a}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let o of s.tool_calls){e.push(` ${o.name} (${o.id})`),e.push(` Call ID: ${o.id}`),e.push(" Args:");for(let[c,u]of Object.entries(o.args))e.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import{a as Pe,c as Sn}from"./5PV2GUZW.js";var cs=Pe((Mm,Vr)=>{"use strict";var pl=Object.prototype.hasOwnProperty,K="~";function Qe(){}Object.create&&(Qe.prototype=Object.create(null),new Qe().__proto__||(K=!1));function ml(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function os(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new ml(r,n||t,i),s=K?K+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],a]:t._events[s].push(a):(t._events[s]=a,t._eventsCount++),t}function kt(t,e){--t._eventsCount===0?t._events=new Qe:delete t._events[e]}function G(){this._events=new Qe,this._eventsCount=0}G.prototype.eventNames=function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)pl.call(r,n)&&e.push(K?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e};G.prototype.listeners=function(e){var r=K?K+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,s=new Array(a);i<a;i++)s[i]=n[i].fn;return s};G.prototype.listenerCount=function(e){var r=K?K+e:e,n=this._events[r];return n?n.fn?1:n.length:0};G.prototype.emit=function(e,r,n,i,a,s){var o=K?K+e:e;if(!this._events[o])return!1;var c=this._events[o],u=arguments.length,l,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),u){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,a),!0;case 6:return c.fn.call(c.context,r,n,i,a,s),!0}for(d=1,l=new Array(u-1);d<u;d++)l[d-1]=arguments[d];c.fn.apply(c.context,l)}else{var f=c.length,h;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),u){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!l)for(h=1,l=new Array(u-1);h<u;h++)l[h-1]=arguments[h];c[d].fn.apply(c[d].context,l)}}return!0};G.prototype.on=function(e,r,n){return os(this,e,r,n,!1)};G.prototype.once=function(e,r,n){return os(this,e,r,n,!0)};G.prototype.removeListener=function(e,r,n,i){var a=K?K+e:e;if(!this._events[a])return this;if(!r)return kt(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&kt(this,a);else{for(var o=0,c=[],u=s.length;o<u;o++)(s[o].fn!==r||i&&!s[o].once||n&&s[o].context!==n)&&c.push(s[o]);c.length?this._events[a]=c.length===1?c[0]:c:kt(this,a)}return this};G.prototype.removeAllListeners=function(e){var r;return e?(r=K?K+e:e,this._events[r]&&kt(this,r)):(this._events=new Qe,this._eventsCount=0),this};G.prototype.off=G.prototype.removeListener;G.prototype.addListener=G.prototype.on;G.prefixed=K;G.EventEmitter=G;typeof Vr<"u"&&(Vr.exports=G)});var us=Pe((Nm,ls)=>{"use strict";ls.exports=(t,e)=>(e=e||(()=>{}),t.then(r=>new Promise(n=>{n(e())}).then(()=>r),r=>new Promise(n=>{n(e())}).then(()=>{throw r})))});var fs=Pe((Pm,$t)=>{"use strict";var _l=us(),Lt=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},ds=(t,e,r)=>new Promise((n,i)=>{if(typeof e!="number"||e<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(e===1/0){n(t);return}let a=setTimeout(()=>{if(typeof r=="function"){try{n(r())}catch(c){i(c)}return}let s=typeof r=="string"?r:`Promise timed out after ${e} milliseconds`,o=r instanceof Error?r:new Lt(s);typeof t.cancel=="function"&&t.cancel(),i(o)},e);_l(t.then(n,i),()=>{clearTimeout(a)})});$t.exports=ds;$t.exports.default=ds;$t.exports.TimeoutError=Lt});var hs=Pe(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});function gl(t,e,r){let n=0,i=t.length;for(;i>0;){let a=i/2|0,s=n+a;r(t[s],e)<=0?(n=++s,i-=a+1):i=a}return n}qr.default=gl});var ps=Pe(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});var yl=hs(),Kr=class{constructor(){this._queue=[]}enqueue(e,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:e};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=yl.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let e=this._queue.shift();return e?.run}filter(e){return this._queue.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this._queue.length}};Jr.default=Kr});var Qr=Pe(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});var wl=cs(),ms=fs(),bl=ps(),Ut=()=>{},El=new ms.TimeoutError,Wr=class extends wl{constructor(e){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ut,this._resolveIdle=Ut,e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:bl.default},e),!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=e.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=e.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||e.interval===0,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=e.throwOnTimeout===!0,this._isPaused=e.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=Ut,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Ut,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let e=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-e;if(r<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},r)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),e&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?e():ms.default(Promise.resolve(e()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(El)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(e=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),e()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(e=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}};Xr.default=Wr});var xn=Object.defineProperty,P=(t,e)=>{let r={};for(var n in t)xn(r,n,{get:t[n],enumerable:!0});return e||xn(r,Symbol.toStringTag,{value:"Module"}),r};var no=/([A-Z]+)([A-Z][a-z0-9]+)/g,io=/([a-z0-9])([A-Z])/g,Tn=/[-_\s]+/g;function ao(t){return t.replace(no,"$1_$2").replace(io,"$1_$2").replace(Tn,"_").toLowerCase()}function so(t){let e=t.trim();return/[-_\s]/.test(e)?e.replace(Tn,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):e}function An(t,e){return e?.[t]||ao(t)}function xu(t,e){return e?.[t]||so(t)}function In(t,e,r){let n={};for(let i in t)Object.hasOwn(t,i)&&(n[e(i,r)]=t[i]);return n}var On="__lc_escaped__";function oo(t){return"lc"in t||Object.keys(t).length===1&&"__lc_escaped__"in t}function co(t){return{[On]:t}}function lo(t){return Object.keys(t).length===1&&"__lc_escaped__"in t}function uo(t){return t!==null&&typeof t=="object"&&"lc_serializable"in t&&typeof t.toJSON=="function"}function fo(t){let e;return t!==null&&typeof t=="object"?"lc_id"in t&&Array.isArray(t.lc_id)?e=t.lc_id:e=[t.constructor?.name??"Object"]:e=[typeof t],{lc:1,type:"not_implemented",id:e}}function it(t,e=new WeakSet){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){if(e.has(t))return fo(t);if(uo(t))return t;e.add(t);let r=t;if(oo(r))return e.delete(t),co(r);let n={};for(let[i,a]of Object.entries(r))n[i]=it(a,e);return e.delete(t),n}return Array.isArray(t)?t.map(r=>it(r,e)):t}function Cn(t){if(t!==null&&typeof t=="object"&&!Array.isArray(t)){let e=t;if(lo(e))return e[On];let r={};for(let[n,i]of Object.entries(e))r[n]=Cn(i);return r}return Array.isArray(t)?t.map(e=>Cn(e)):t}var Ru=P({Serializable:()=>ke,get_lc_unique_name:()=>at});function Rn(t){return Array.isArray(t)?[...t]:{...t}}function ho(t,e){let r=Rn(t);for(let[n,i]of Object.entries(e)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Rn(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function at(t){let e=Object.getPrototypeOf(t);return typeof t.lc_name=="function"&&(typeof e.lc_name!="function"||t.lc_name()!==e.lc_name())?t.lc_name():t.name}var ke=class Mn{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,at(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof Mn||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let e={},r={},n=Object.keys(this.lc_kwargs).reduce((o,c)=>(o[c]=c in this?this[c]:this.lc_kwargs[c],o),{});for(let o=Object.getPrototypeOf(this);o;o=Object.getPrototypeOf(o))Object.assign(e,Reflect.get(o,"lc_aliases",this)),Object.assign(r,Reflect.get(o,"lc_secrets",this)),Object.assign(n,Reflect.get(o,"lc_attributes",this));Object.keys(r).forEach(o=>{let c=this,u=n,[l,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in u)||u[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?u[f]={}:Array.isArray(c[f])&&(u[f]=[])),c=c[f],u=u[f]}l in c&&c[l]!==void 0&&(u[l]=u[l]||c[l])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=it(c,a);let s=In(Object.keys(r).length?ho(i,r):i,An,e);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function pe(t){return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"source_type"in t&&(t.source_type==="url"||t.source_type==="base64"||t.source_type==="text"||t.source_type==="id")}function Nn(t){return pe(t)&&t.source_type==="url"&&"url"in t&&typeof t.url=="string"}function Pn(t){return pe(t)&&t.source_type==="base64"&&"data"in t&&typeof t.data=="string"}function Nu(t){return pe(t)&&t.source_type==="text"&&"text"in t&&typeof t.text=="string"}function kn(t){return pe(t)&&t.source_type==="id"&&"id"in t&&typeof t.id=="string"}function Pu(t){if(pe(t)){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url}};if(t.source_type==="base64"){if(!t.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${t.mime_type};base64,${t.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function ku(t){let e=t.split(";")[0].split("/");if(e.length!==2)throw new Error(`Invalid mime type: "${t}" - does not match type/subtype format.`);let r=e[0].trim(),n=e[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${t}" - type or subtype is empty.`);let i={};for(let a of t.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${t}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${t}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Yt({dataUrl:t,asTypedArray:e=!1}){let r=t.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=e?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function Lu(t,e){if(t.type==="text"){if(!e.fromStandardTextBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardTextBlock\` method.`);return e.fromStandardTextBlock(t)}if(t.type==="image"){if(!e.fromStandardImageBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardImageBlock\` method.`);return e.fromStandardImageBlock(t)}if(t.type==="audio"){if(!e.fromStandardAudioBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardAudioBlock\` method.`);return e.fromStandardAudioBlock(t)}if(t.type==="file"){if(!e.fromStandardFileBlock)throw new Error(`Converter for ${e.providerName} does not implement \`fromStandardFileBlock\` method.`);return e.fromStandardFileBlock(t)}throw new Error(`Unable to convert content block type '${t.type}' to provider-specific format: not recognized.`)}function g(t,e){return b(t)&&t.type===e}function b(t){return typeof t=="object"&&t!==null}function U(t){return Array.isArray(t)}function p(t){return typeof t=="string"}function Y(t){return typeof t=="number"}function st(t){return t instanceof Uint8Array}function Zt(t){try{return JSON.parse(t)}catch{return}}var Z=t=>t();function po(t){if(t.type==="char_location"&&p(t.document_title)&&Y(t.start_char_index)&&Y(t.end_char_index)&&p(t.cited_text)){let{document_title:e,start_char_index:r,end_char_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"char",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="page_location"&&p(t.document_title)&&Y(t.start_page_number)&&Y(t.end_page_number)&&p(t.cited_text)){let{document_title:e,start_page_number:r,end_page_number:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"page",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="content_block_location"&&p(t.document_title)&&Y(t.start_block_index)&&Y(t.end_block_index)&&p(t.cited_text)){let{document_title:e,start_block_index:r,end_block_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"block",title:e??void 0,startIndex:r,endIndex:n,citedText:i}}if(t.type==="web_search_result_location"&&p(t.url)&&p(t.title)&&p(t.encrypted_index)&&p(t.cited_text)){let{url:e,title:r,encrypted_index:n,cited_text:i,...a}=t;return{...a,type:"citation",source:"url",url:e,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(t.type==="search_result_location"&&p(t.source)&&p(t.title)&&Y(t.start_block_index)&&Y(t.end_block_index)&&p(t.cited_text)){let{source:e,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=t;return{...s,type:"citation",source:"search",url:e,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function $n(t){if(g(t,"document")&&b(t.source)&&"type"in t.source){if(t.source.type==="base64"&&p(t.source.media_type)&&p(t.source.data))return{type:"file",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&p(t.source.url))return{type:"file",url:t.source.url};if(t.source.type==="file"&&p(t.source.file_id))return{type:"file",fileId:t.source.file_id};if(t.source.type==="text"&&p(t.source.data))return{type:"file",mimeType:String(t.source.media_type??"text/plain"),data:t.source.data}}else if(g(t,"image")&&b(t.source)&&"type"in t.source){if(t.source.type==="base64"&&p(t.source.media_type)&&p(t.source.data))return{type:"image",mimeType:t.source.media_type,data:t.source.data};if(t.source.type==="url"&&p(t.source.url))return{type:"image",url:t.source.url};if(t.source.type==="file"&&p(t.source.file_id))return{type:"image",fileId:t.source.file_id}}}function Un(t){function*e(){for(let r of t){let n=$n(r);n?yield n:yield r}}return Array.from(e())}function Ln(t){function*e(){let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r){if(g(n,"text")&&p(n.text)){let{text:i,citations:a,...s}=n;if(U(a)&&a.length){let o=a.reduce((c,u)=>{let l=po(u);return l?[...c,l]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(g(n,"thinking")&&p(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(g(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(g(n,"tool_use")&&p(n.name)&&p(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(g(n,"input_json_delta")){if(mo(t)&&t.tool_call_chunks?.length){let i=t.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(g(n,"server_tool_use")&&p(n.name)&&p(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Z(()=>{if(typeof n.input=="string")return n.input;if(b(n.input)&&p(n.input.query))return n.input.query;if(p(n.partial_json)){let s=Zt(n.partial_json);if(s?.query)return s.query}return""})}};continue}else if(n.name==="code_execution"){yield{id:a,type:"server_tool_call",name:"code_execution",args:{code:Z(()=>{if(typeof n.input=="string")return n.input;if(b(n.input)&&p(n.input.code))return n.input.code;if(p(n.partial_json)){let s=Zt(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(g(n,"web_search_tool_result")&&p(n.tool_use_id)&&U(n.content)){let{content:i,tool_use_id:a}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:a,status:"success",output:{urls:i.reduce((s,o)=>g(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(g(n,"code_execution_tool_result")&&p(n.tool_use_id)&&b(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(g(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(g(n,"mcp_tool_result")&&p(n.tool_use_id)&&b(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(g(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(g(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(g(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=$n(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(e())}var jn={translateContent:Ln,translateContentChunk:Ln};function mo(t){return typeof t?._getType=="function"&&typeof t.concat=="function"&&t._getType()==="ai"}function _o(t){return Nn(t)?{type:t.type,mimeType:t.mime_type,url:t.url,metadata:t.metadata}:Pn(t)?{type:t.type,mimeType:t.mime_type??"application/octet-stream",data:t.data,metadata:t.metadata}:kn(t)?{type:t.type,mimeType:t.mime_type,fileId:t.id,metadata:t.metadata}:t}function Dn(t){return t.map(_o)}function Bn(t){return!!(g(t,"image_url")&&b(t.image_url)||g(t,"input_audio")&&b(t.input_audio)||g(t,"file")&&b(t.file))}function Hn(t){if(g(t,"image_url")&&b(t.image_url)&&p(t.image_url.url)){let e=Yt({dataUrl:t.image_url.url});return e?{type:"image",mimeType:e.mime_type,data:e.data}:{type:"image",url:t.image_url.url}}else{if(g(t,"input_audio")&&b(t.input_audio)&&p(t.input_audio.data)&&p(t.input_audio.format))return{type:"audio",data:t.input_audio.data,mimeType:`audio/${t.input_audio.format}`};if(g(t,"file")&&b(t.file)&&p(t.file.data)){let e=Yt({dataUrl:t.file.data});if(e)return{type:"file",data:e.data,mimeType:e.mime_type};if(p(t.file.file_id))return{type:"file",fileId:t.file.file_id}}}return t}function go(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...ot(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function yo(t){let e=[];typeof t.content=="string"?t.content.length>0&&e.push({type:"text",text:t.content}):e.push(...ot(t.content));for(let r of t.tool_calls??[])e.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return e}function ot(t){let e=[];for(let r of t)Bn(r)?e.push(Hn(r)):e.push(r);return e}function wo(t){if(t.type==="url_citation"){let{url:e,title:r,start_index:n,end_index:i}=t;return{type:"citation",url:e,title:r,startIndex:n,endIndex:i}}if(t.type==="file_citation"){let{file_id:e,filename:r,index:n}=t;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:e}}return t}function Fn(t){function*e(){b(t.additional_kwargs?.reasoning)&&U(t.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:t.additional_kwargs.reasoning.summary.reduce((n,i)=>b(i)&&p(i.text)?`${n}${i.text}`:n,"")});let r=typeof t.content=="string"?[{type:"text",text:t.content}]:t.content;for(let n of r)if(g(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,u=b(o)?{...o}:{};p(s)&&(u.phase=s);let l=Object.keys(u).length>0?{extras:u}:{};Array.isArray(a)?yield{...c,...l,type:"text",text:String(i),annotations:a.map(wo)}:yield{...c,...l,type:"text",text:String(i)}}for(let n of t.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(b(t.additional_kwargs)&&U(t.additional_kwargs.tool_outputs))for(let n of t.additional_kwargs.tool_outputs){if(g(n,"web_search_call")){let i={};if(b(n.action)&&p(n.action.query)&&(i.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:i},n.status==="completed"||n.status==="failed"){let a={};b(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(g(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:U(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:U(n.results)?{results:n.results}:{}});continue}else if(g(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(g(n,"code_interpreter_call")){if(p(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),U(n.outputs)){let i=Z(()=>{if(n.status!=="in_progress"){if(n.status==="completed")return 0;if(n.status==="incomplete")return 127;if(n.status!=="interpreting"&&n.status==="failed")return 1}});for(let a of n.outputs)if(g(a,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:i??0,stderr:[0,void 0].includes(i)?void 0:String(a.logs),stdout:[0,void 0].includes(i)?String(a.logs):void 0}};continue}}continue}else if(g(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(g(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(g(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(g(n,"tool_search_call")){let i={};b(n.arguments)&&Object.assign(i,n.arguments);let a={};p(n.execution)&&(a.execution=n.execution),p(n.status)&&(a.status=n.status),p(n.call_id)&&(a.call_id=n.call_id),yield{id:p(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(g(n,"tool_search_output")){let i={name:"tool_search"};p(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:p(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:U(n.tools)?n.tools:[]},extras:i};continue}else if(g(n,"image_generation_call")){p(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:p(n.id)?n.id:void 0,metadata:{status:p(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}b(n)&&(yield{type:"non_standard",value:n})}}return Array.from(e())}function bo(t){function*e(){yield*Fn(t);for(let r of t.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(e())}var Gn={translateContent:t=>typeof t.content=="string"?go(t):Fn(t),translateContentChunk:t=>typeof t.content=="string"?yo(t):bo(t)};function zn(t){return typeof t=="object"&&t!==null&&"type"in t&&"content"in t&&(typeof t.content=="string"||Array.isArray(t.content))}function Vn(t,e="pretty"){return e==="pretty"?Eo(t):JSON.stringify(t)}function Eo(t){let e=[],r=` ${t.type.charAt(0).toUpperCase()+t.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(e.push(`${i}${r}${a}`),t.type==="ai"){let s=t;if(s.tool_calls&&s.tool_calls.length>0){e.push("Tool Calls:");for(let o of s.tool_calls){e.push(` ${o.name} (${o.id})`),e.push(` Call ID: ${o.id}`),e.push(" Args:");for(let[c,u]of Object.entries(o.args))e.push(` ${c}: ${typeof u=="object"?JSON.stringify(u):u}`)}}}if(t.type==="tool"){let s=t;s.name&&e.push(`Name: ${s.name}`)}return typeof t.content=="string"&&t.content.trim()&&(e.length>1&&e.push(""),e.push(t.content)),e.join(`
3
3
  `)}var er=Symbol.for("langchain.message");function qn(t){return Array.isArray(t)?t:typeof t=="string"?t===""?[]:[{type:"text",text:t}]:t==null?[]:[t]}function W(t,e){if(typeof t=="string")return t===""?e:typeof e=="string"?t+e:Array.isArray(e)&&e.length===0?t:Array.isArray(e)&&e.some(r=>pe(r))?[{type:"text",source_type:"text",text:t},...e]:[{type:"text",text:t},...e];if(Array.isArray(e)){let r=qn(t);return Le(r,e)??[...r,...e]}else return e===""?t:Array.isArray(t)&&t.some(r=>pe(r))?[...t,{type:"file",source_type:"text",text:e}]:[...qn(t),{type:"text",text:e}]}function Xn(t,e){return t==="error"||e==="error"?"error":"success"}function vo(t,e){function r(n,i){if(typeof n!="object"||n===null||n===void 0)return n;if(i>=e)return Array.isArray(n)?"[Array]":"[Object]";if(Array.isArray(n))return n.map(s=>r(s,i+1));let a={};for(let s of Object.keys(n))a[s]=r(n[s],i+1);return a}return JSON.stringify(r(t,0),null,2)}var q=class extends ke{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[er]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(t){let e=typeof t=="string"||Array.isArray(t)?{content:t}:t;e.additional_kwargs||(e.additional_kwargs={}),e.response_metadata||(e.response_metadata={}),super(e),this.name=e.name,e.content===void 0&&e.contentBlocks!==void 0?(this.content=e.contentBlocks,this.response_metadata={output_version:"v1",...e.response_metadata}):e.content!==void 0?(this.content=e.content??[],this.response_metadata=e.response_metadata):(this.content=[],this.response_metadata=e.response_metadata),this.additional_kwargs=e.additional_kwargs,this.id=e.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(t=>typeof t=="string"?t:t.type==="text"?t.text:"").join(""):""}get contentBlocks(){let t=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[Dn,ot,Un].reduce((e,r)=>r(e),t)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(t){return typeof t=="object"&&t!==null&&er in t&&t[er]===!0&&zn(t)}static[Symbol.hasInstance](t){return this.isInstance(t)}_updateId(t){this.id=t,this.lc_kwargs.id=t}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](t){if(t===null)return this;let e=vo(this._printableFields,Math.max(4,t));return`${this.constructor.lc_name()} ${e}`}toFormattedString(t="pretty"){return Vn(this,t)}};function td(t){return Array.isArray(t)&&t.every(e=>typeof e.index=="number")}var So=["index","created","timestamp"];function L(t,e,r){let n=r?.ignoreKeys??So;if(t==null&&e==null)return;if(t==null||e==null)return t??e;let i={...t};for(let[a,s]of Object.entries(e))if(i[a]==null)i[a]=s;else{if(s==null)continue;if(typeof i[a]!=typeof s||Array.isArray(i[a])!==Array.isArray(s))throw new Error(`field[${a}] already exists in the message chunk, but with a different type.`);if(typeof i[a]=="string"){if(a==="type")continue;if(["id","name","output_version","model_provider"].includes(a))s&&(i[a]=s);else{if(n.includes(a))continue;i[a]+=s}}else if(typeof i[a]=="number"){if(n.includes(a))continue;i[a]=i[a]+s}else if(typeof i[a]=="object"&&!Array.isArray(i[a]))i[a]=L(i[a],s,r);else if(Array.isArray(i[a]))i[a]=Le(i[a],s,r);else{if(i[a]===s)continue;console.warn(`field[${a}] already exists in this message chunk and value has unsupported type.`)}}return i}function xo(t){return typeof t=="number"||typeof t=="string"}function Kn(t){return typeof t!="object"||t===null||!("index"in t)?!1:xo(t.index)}function Jn(t){if(typeof t!="object"||t===null||!("id"in t))return!1;let e=t.id;return e!=null&&e!==""}function Wn(t){return t.endsWith("_delta")?t.slice(0,-6):t}function To(t,e){return typeof t!="object"||t===null||typeof e!="object"||e===null||!("type"in t)||!("type"in e)?!1:typeof t.type=="string"&&typeof e.type=="string"&&Wn(t.type)!==Wn(e.type)}function Ao(t,e){let r=Kn(e),n=Jn(e);return!r&&!n?-1:t.findIndex(i=>{let a=Kn(i),s=Jn(i);return r&&a?i.index!==e.index||To(i,e)?!1:s&&n?i.id===e.id:!0:!r&&!a&&n&&s?i.id===e.id:!1})}function Le(t,e,r){if(!(t==null&&e==null)){if(t==null||e==null)return t||e;{let n=[...t];for(let i of e){let a=Ao(n,i);if(a!==-1)n[a]=L(n[a],i,r);else{if(typeof i=="object"&&i!==null&&"text"in i&&i.text==="")continue;n.push(i)}}return n}}}function Qn(t,e,r){if(!(t==null&&e==null)){if(t==null||e==null)return t??e;if(typeof t!=typeof e)throw new Error(`Cannot merge objects of different types.
4
4
  Left ${typeof t}
5
5
  Right ${typeof e}`);if(typeof t=="string"&&typeof e=="string")return t+e;if(Array.isArray(t)&&Array.isArray(e))return Le(t,e,r);if(typeof t=="object"&&typeof e=="object")return L(t,e,r);if(t===e)return t;throw new Error(`Can not merge objects of different types.
@@ -1,2 +1,2 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  export default $arcgis.t(([{formatDateOnly:h,convertDateFormatToIntlOptions:m,formatTimeOnly:N,formatDate:c}])=>{var T=new Set(["date","esrifieldtypedate","date-only","dateonly","esrifieldtypedateonly","time-only","timeonly","esrifieldtypetimeonly","timestamp-offset","timestampoffset","esrifieldtypetimestampoffset"]),y=e=>{if(!e)return!1;let t=e.toLowerCase();return T.has(t)},f=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},S=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,w=e=>{if(typeof e=="string"&&e)return e;let t=f(e);return t?t.toISOString().slice(0,10):null};var I=(e,t,n)=>{let r=t?.toLowerCase();if(r&&!y(r))return e;if(r==="date-only"){let o=w(e);return o?h(o,m("short-date")):e}if(r==="time-only"){if(typeof e=="string"&&e)return N(e,m("long-time"));let o=f(e);return o?c(o,{...m("long-time"),timeZone:"UTC"}):e}let i=f(e);return i?c(i,{...m("short-date-short-time"),timeZone:S(n)}):e},g=(e,t,n)=>{if(e&&typeof e!="function"){let r="getField"in n&&n.getField?.(e),i=r&&"getFieldDomain"in n&&n.getFieldDomain?n.getFieldDomain(r.name):null;if(i?.type==="coded-value"){let o=i.codedValues.find(s=>s.code===t);return o?o.name:null}}return null},O=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,v=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e=="string"&&e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},x=(e,t)=>{if(typeof e!="number")return e;let n={};t.minimumFractionDigits!==void 0&&(n.minimumFractionDigits=t.minimumFractionDigits),t.maximumFractionDigits!==void 0&&(n.maximumFractionDigits=t.maximumFractionDigits),t.useGrouping==="always"?n.useGrouping=!0:t.useGrouping==="never"&&(n.useGrouping=!1);try{return new Intl.NumberFormat(void 0,n).format(e)}catch{return e}},C=(e,t,n)=>{let r=v(e);if(!r)return e;let i={};t.dateStyle?i.dateStyle=t.dateStyle:(t.year&&(i.year=t.year),t.month&&(i.month=t.month)),t.timeStyle&&(i.timeStyle=t.timeStyle),t.timeStyle&&t.hour12==="always"?i.hour12=!0:t.timeStyle&&t.hour12==="never"&&(i.hour12=!1),i.timeZone=O(n);try{return new Intl.DateTimeFormat(void 0,i).format(r)}catch{return e}},p=(e,t)=>e.getFieldAlias?.(t)??e.fieldsIndex?.get(t)?.alias??e.fieldsIndex?.get(t)?.name??t,F=(e,t,n,r,i)=>{if(n==null)return n;let o=e.getFieldConfiguration?.(t)?.fieldFormat;return o?.type==="number"?x(n,o):o?.type==="date-time"?!r||y(r)?C(n,o,i):n:I(n,r,i)},j=(e,t,n,r)=>{let i=e.fieldsIndex?.get(t),o=g(t,n,e)??n;return F(e,t,o,i?.type,r)},G=(e,t)=>p(e,t),$=(e,t,n)=>{let r=e.objectIdField,i=t.features.map(s=>s.attributes[r]),o=t.features.map(s=>{let d=s.attributes,u={};return e.fields.forEach(a=>{if(!Object.hasOwn(d,a.name))return;let l=d[a.name];if(a.name===r){u[a.name]=l;return}let D=g(a.name,l,e)??l,b=p(e,a.name);u[b]=F(e,a.name,D,a.type,n)}),u});return{objectIds:i,attributes:o}};return{a:j,b:G,c:$}},"intl")