@arcgis/ai-components 5.2.0-next.110 → 5.2.0-next.111

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 (290) 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 +4 -5
  4. package/dist/agent-utils/LLMAgent.js +59 -59
  5. package/dist/agent-utils/WorkflowAgent.js +1 -1
  6. package/dist/agent-utils/index.js +1 -1
  7. package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
  8. package/dist/agent-utils/middlewares/middleware.js +1 -1
  9. package/dist/agent-utils/middlewares/trace.js +6 -6
  10. package/dist/agent-utils/middlewares/types.js +1 -1
  11. package/dist/agent-utils/tools/FunctionTool.js +1 -1
  12. package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
  13. package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
  14. package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
  15. package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
  16. package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
  17. package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
  18. package/dist/agentic-workflow/jsonTypes.d.ts +48 -8
  19. package/dist/agentic-workflow/nodes/HumanInTheLoopNode.d.ts +37 -0
  20. package/dist/agentic-workflow/types.d.ts +1 -1
  21. package/dist/agents/runtime/skill/createSkillAgent.d.ts +0 -1
  22. package/dist/agents/runtime/skill/createSkillAgent.js +50 -50
  23. package/dist/agents/runtime/skill/types.d.ts +2 -10
  24. package/dist/agents/runtime/skill/types.js +1 -1
  25. package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
  26. package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
  27. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
  28. package/dist/agents/tools/help/listFields/adapter.js +1 -1
  29. package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
  30. package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
  31. package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
  32. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
  33. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
  34. package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
  35. package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
  36. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
  37. package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
  38. package/dist/agents/tools/query/getAttribute/adapter.js +1 -1
  39. package/dist/agents/tools/query/getStatistics/adapter.js +1 -1
  40. package/dist/agents/tools/query/getTopFeatures/adapter.js +1 -1
  41. package/dist/agents/tools/query/queryFeatures/adapter.js +1 -1
  42. package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
  43. package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
  44. package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
  45. package/dist/agents/tools/shared/types.js +1 -1
  46. package/dist/cdn/2BNQ6A6J.js +2 -0
  47. package/dist/cdn/{FV6FHLYW.js → 2MWUBKWI.js} +2 -2
  48. package/dist/cdn/{GW3IVAAZ.js → 2O4DON37.js} +2 -2
  49. package/dist/cdn/{LL324IL6.js → 2W7LK4HA.js} +2 -2
  50. package/dist/cdn/33PB7ALY.js +2 -0
  51. package/dist/cdn/{FK2CVSXW.js → 33SFAZQG.js} +4 -4
  52. package/dist/cdn/{LLY5A2E2.js → 34O57OGV.js} +1 -1
  53. package/dist/cdn/{OALQBAZR.js → 3UEKINYC.js} +2 -2
  54. package/dist/cdn/434TAA3J.js +2 -0
  55. package/dist/cdn/{ZWIKFBOU.js → 4IU63OWQ.js} +2 -2
  56. package/dist/cdn/{XRVGYRXL.js → 5A355PGH.js} +2 -2
  57. package/dist/cdn/{TB2GJALS.js → 5HBAJ57P.js} +2 -2
  58. package/dist/cdn/{7Y43R7QJ.js → 5MK44FNO.js} +2 -2
  59. package/dist/cdn/{LXIKAXUT.js → 5Q2XRQS6.js} +2 -2
  60. package/dist/cdn/{UAZPINUQ.js → 6ECRQVHY.js} +2 -2
  61. package/dist/cdn/{BBEGLIZC.js → 6OOZSZRJ.js} +2 -2
  62. package/dist/cdn/6OUIUXAJ.js +2 -0
  63. package/dist/cdn/{Y4TYL2AL.js → 6P44KOKX.js} +2 -2
  64. package/dist/cdn/{LBTGOMCT.js → 73TMZQI5.js} +2 -2
  65. package/dist/cdn/{BJMGT6GV.js → 74CVYM72.js} +2 -2
  66. package/dist/cdn/{PJPP6LOS.js → 7EHOFQ2P.js} +2 -2
  67. package/dist/cdn/{24EIZVUM.js → 7KSFIRXB.js} +2 -2
  68. package/dist/cdn/{STOGCXJH.js → AHCXG7XF.js} +2 -2
  69. package/dist/cdn/{VLPELJUS.js → AOVJ34QE.js} +2 -2
  70. package/dist/cdn/{3KNLFIM3.js → APFZY4PI.js} +2 -2
  71. package/dist/cdn/{KBSXHSBX.js → AVRS6UCQ.js} +2 -2
  72. package/dist/cdn/{YOW3YKWR.js → AVZ5Y6BK.js} +2 -2
  73. package/dist/cdn/{477I66FH.js → AXTQU5YL.js} +11 -11
  74. package/dist/cdn/BBPD2AS7.js +2 -0
  75. package/dist/cdn/{HV7MVIQV.js → BFZ5S7NF.js} +2 -2
  76. package/dist/cdn/{HMMYCSOK.js → BL273EGZ.js} +2 -2
  77. package/dist/cdn/C7JPWFZE.js +2 -0
  78. package/dist/cdn/{KKCLHXHG.js → CCC6LBMY.js} +1 -1
  79. package/dist/cdn/{NNPA3NLK.js → CEKOEHB3.js} +2 -2
  80. package/dist/cdn/{W54XYT2A.js → CFAC4FN3.js} +2 -2
  81. package/dist/cdn/{53KIFJFA.js → COH3QXWG.js} +2 -2
  82. package/dist/cdn/{CX2HJ67C.js → DB2TFPIO.js} +2 -2
  83. package/dist/cdn/{EYGZJKVD.js → DE26DAW5.js} +2 -2
  84. package/dist/cdn/DG27JEYG.js +50 -0
  85. package/dist/cdn/DKA6PSYN.js +2 -0
  86. package/dist/cdn/{65LCK3GG.js → DQ2Z65UO.js} +2 -2
  87. package/dist/cdn/DWH23NJN.js +2 -0
  88. package/dist/cdn/EDXTPEEU.js +2 -0
  89. package/dist/cdn/{6KWGSXIN.js → ENM3L4AC.js} +2 -2
  90. package/dist/cdn/{XV7RMYLR.js → EVMIYZWD.js} +2 -2
  91. package/dist/cdn/{FHBRXZLV.js → EYOWRGDP.js} +2 -2
  92. package/dist/cdn/{45BDE3MG.js → EYY367WR.js} +2 -2
  93. package/dist/cdn/{27CK3JHY.js → F5NIRETW.js} +2 -2
  94. package/dist/cdn/{TFAJNKBC.js → FCI6M62J.js} +2 -2
  95. package/dist/cdn/{V4PJMCJZ.js → FDOMMK2M.js} +1 -1
  96. package/dist/cdn/{4OI4QEV7.js → FS7GXTTQ.js} +2 -2
  97. package/dist/cdn/{IHUWQOMK.js → FYZATVB3.js} +2 -2
  98. package/dist/cdn/{3PPXAIRE.js → H6P3WP5D.js} +2 -2
  99. package/dist/cdn/HHP5YLUI.js +2 -0
  100. package/dist/cdn/HIAQARIQ.js +2 -0
  101. package/dist/cdn/HMIDFTEI.js +2 -0
  102. package/dist/cdn/{4CFCV47G.js → HMNBUGH2.js} +2 -2
  103. package/dist/cdn/HR6GWPKX.js +2 -0
  104. package/dist/cdn/{V266DJ5V.js → ICBIUFK7.js} +2 -2
  105. package/dist/cdn/{BTOBEN7Q.js → IH26MIYY.js} +2 -2
  106. package/dist/cdn/{QAX6UF4L.js → IHP25JWI.js} +2 -2
  107. package/dist/cdn/{M2U456J5.js → IYLFJCJ2.js} +4 -4
  108. package/dist/cdn/{JMXXRRKQ.js → J6A4AS7E.js} +2 -2
  109. package/dist/cdn/{QTEPFTAU.js → JEBRN3EU.js} +2 -2
  110. package/dist/cdn/{G24MNC7D.js → JICNSK6Y.js} +2 -2
  111. package/dist/cdn/JQYLMTDP.js +2 -0
  112. package/dist/cdn/{275FFTBE.js → K5JVB6FU.js} +2 -2
  113. package/dist/cdn/K7XWGSLN.js +2 -0
  114. package/dist/cdn/{M3KKORBG.js → K7YQIJFT.js} +2 -2
  115. package/dist/cdn/KH4V4I3W.js +2 -0
  116. package/dist/cdn/KMLJS2VW.js +2 -0
  117. package/dist/cdn/{HNTSDY3J.js → LAVFUDUG.js} +2 -2
  118. package/dist/cdn/{L3BTURBA.js → LK7ZIQW6.js} +2 -2
  119. package/dist/cdn/{ZJWR4W2S.js → LOQ2PKV5.js} +58 -58
  120. package/dist/cdn/{X42ACC66.js → LXPGQNXQ.js} +2 -2
  121. package/dist/cdn/{TXZQZR3I.js → MJSIYEWN.js} +2 -2
  122. package/dist/cdn/{CSE6BHOJ.js → MWYBF3F3.js} +2 -2
  123. package/dist/cdn/{FDRAKF5D.js → MXTXJKFE.js} +2 -2
  124. package/dist/cdn/{7DOYUO7L.js → NEV6OZN3.js} +2 -2
  125. package/dist/cdn/{NBDOPGSN.js → O4NVW75A.js} +2 -2
  126. package/dist/cdn/{ZA7ZU2F7.js → OKVLGJAG.js} +2 -2
  127. package/dist/cdn/{SUC2MIGE.js → OMF6ITSG.js} +2 -2
  128. package/dist/cdn/{A6LBMS7A.js → ONQ6JSBJ.js} +1 -1
  129. package/dist/cdn/{CKUUYQLO.js → OZAZ277H.js} +2 -2
  130. package/dist/cdn/{2UJPYWWZ.js → P4GFYBBO.js} +2 -2
  131. package/dist/cdn/{XNUWVZN7.js → P4XZMBU5.js} +2 -2
  132. package/dist/cdn/{L2HLFWCV.js → POL6HKCG.js} +3 -3
  133. package/dist/cdn/{AP3KPOHN.js → POZYDAU2.js} +2 -2
  134. package/dist/cdn/{FTTLFIBV.js → PQ2DPOFM.js} +2 -2
  135. package/dist/cdn/{JUNMTIB3.js → PYGX4HN7.js} +2 -2
  136. package/dist/cdn/{ZY3JQCZQ.js → QNXI3WOF.js} +36 -36
  137. package/dist/cdn/{4VBOTWC3.js → QRMRID2M.js} +2 -2
  138. package/dist/cdn/{TLPZELG3.js → R74ZHFA6.js} +1 -1
  139. package/dist/cdn/{CAOMMQSY.js → RFVZ7KCG.js} +1 -1
  140. package/dist/cdn/{OF3TAARW.js → RHYNE5OE.js} +1 -1
  141. package/dist/cdn/{4YOG5F3W.js → RLEHNAIA.js} +1 -1
  142. package/dist/cdn/{RSM7MEVT.js → ROQGPAR5.js} +2 -2
  143. package/dist/cdn/RXF2NUOL.js +2 -0
  144. package/dist/cdn/{MZUDIQQH.js → SDWWUWAF.js} +2 -2
  145. package/dist/cdn/SHI76XUV.js +2 -0
  146. package/dist/cdn/SITY6L4S.js +2 -0
  147. package/dist/cdn/STHBRTTD.js +2 -0
  148. package/dist/cdn/{7UBTNDV6.js → SXM4NUT5.js} +2 -2
  149. package/dist/cdn/{XVJFPZTW.js → SZRJTQ54.js} +2 -2
  150. package/dist/cdn/TO2NY7EA.js +2 -0
  151. package/dist/cdn/{4IWDBEMN.js → TPULIO6I.js} +2 -2
  152. package/dist/cdn/TVEEQSMF.js +2 -0
  153. package/dist/cdn/TWU3QXAS.js +2 -0
  154. package/dist/cdn/{EGRRZTF6.js → TYATJUNF.js} +2 -2
  155. package/dist/cdn/UCTC4JN4.js +3 -0
  156. package/dist/cdn/{HI3XKFHD.js → UDRKUVZP.js} +2 -2
  157. package/dist/cdn/{JYNHWJUZ.js → UHEYPSOR.js} +2 -2
  158. package/dist/cdn/{VGLBH473.js → UHICISBZ.js} +2 -2
  159. package/dist/cdn/UO5PBOQR.js +2 -0
  160. package/dist/cdn/{BVUCNXC5.js → UZLQALHY.js} +1 -1
  161. package/dist/cdn/{SNG3WODY.js → V6HOUZPZ.js} +2 -2
  162. package/dist/cdn/{V52GSTOC.js → V7Y22FRP.js} +2 -2
  163. package/dist/cdn/{I72ST4JR.js → VAXH6RUQ.js} +2 -2
  164. package/dist/cdn/{NV7CL4S3.js → VNLSYVPE.js} +2 -2
  165. package/dist/cdn/VR3CF3ZY.js +2 -0
  166. package/dist/cdn/{VK6CCPTG.js → VWP2B4LB.js} +2 -2
  167. package/dist/cdn/VXFQANGJ.js +2 -0
  168. package/dist/cdn/WKZHFSH3.js +2 -0
  169. package/dist/cdn/{OXC2WP7W.js → WSWB3B7B.js} +2 -2
  170. package/dist/cdn/{EK3PM4L5.js → WVP73XWD.js} +2 -2
  171. package/dist/cdn/{SJMAKF4P.js → WXQ26G5Q.js} +2 -2
  172. package/dist/cdn/{2F4TPWZQ.js → XQ3NBBQ3.js} +1 -1
  173. package/dist/cdn/{VXLKTQ36.js → YHWYTHID.js} +2 -2
  174. package/dist/cdn/{XOTPSCNF.js → YIZ7PR2G.js} +2 -2
  175. package/dist/cdn/{T6W6F4TF.js → Z5XQLSYH.js} +2 -2
  176. package/dist/cdn/{Y6CV2NZR.js → ZFOG3KXV.js} +2 -2
  177. package/dist/cdn/{FPH52WOH.js → ZU2FHVNK.js} +2 -2
  178. package/dist/cdn/agent-utils/index.js +2 -2
  179. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -3
  180. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
  181. package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
  182. package/dist/cdn/index.js +2 -2
  183. package/dist/chunks/BaseWorkflow.js +1 -1
  184. package/dist/chunks/SKILL.js +1 -1
  185. package/dist/chunks/SKILL2.js +1 -1
  186. package/dist/chunks/SKILL3.js +1 -1
  187. package/dist/chunks/SKILL4.js +1 -1
  188. package/dist/chunks/adapter.js +1 -1
  189. package/dist/chunks/aiFactory.js +56 -50
  190. package/dist/chunks/arcgisKnowledgeGraph.js +2 -2
  191. package/dist/chunks/arcgisToolRegistry.js +1 -1
  192. package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
  193. package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
  194. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
  195. package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
  196. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
  197. package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
  198. package/dist/chunks/baseAgentState.js +1 -1
  199. package/dist/chunks/converterUtils.js +1 -1
  200. package/dist/chunks/dataExplorationAgent.js +1 -1
  201. package/dist/chunks/data_explore_filter_prompt.js +1 -1
  202. package/dist/chunks/data_explore_query_prompt.js +1 -1
  203. package/dist/chunks/embeddings.worker.js +1 -1
  204. package/dist/chunks/fetchAgentContext.js +1 -1
  205. package/dist/chunks/fetchService.js +1 -1
  206. package/dist/chunks/fieldStatistics.js +1 -1
  207. package/dist/chunks/field_descriptions_prompt.js +1 -1
  208. package/dist/chunks/formatFeatureAttributes.js +1 -1
  209. package/dist/chunks/generateLayerDescriptions.js +60 -63
  210. package/dist/chunks/graph.js +1 -1
  211. package/dist/chunks/helpAgent.js +1 -1
  212. package/dist/chunks/help_prompt.js +1 -1
  213. package/dist/chunks/index.js +1 -1
  214. package/dist/chunks/intent_prompt.js +1 -1
  215. package/dist/chunks/layerStylingGraph.js +1 -1
  216. package/dist/chunks/layer_descriptions_prompt.js +1 -1
  217. package/dist/chunks/layer_styling_prompt.js +1 -1
  218. package/dist/chunks/mergeWhereClauses.js +1 -1
  219. package/dist/chunks/navigationAgent.js +1 -1
  220. package/dist/chunks/navigation_intent_prompt.js +1 -1
  221. package/dist/chunks/navigation_tool_prompt.js +1 -1
  222. package/dist/chunks/orchestrator.js +1 -1
  223. package/dist/chunks/requireAgentServices.js +1 -1
  224. package/dist/chunks/resolvePointGeometryFilter.js +1 -1
  225. package/dist/chunks/runtime.js +1 -1
  226. package/dist/chunks/slottableRequestUtils.js +1 -1
  227. package/dist/chunks/state.js +26 -26
  228. package/dist/chunks/summarize_query_response_prompt.js +1 -1
  229. package/dist/chunks/useT9n.js +1 -1
  230. package/dist/chunks/utils.js +1 -1
  231. package/dist/chunks/utils2.js +1 -1
  232. package/dist/chunks/utils3.js +1 -1
  233. package/dist/components/arcgis-assistant/customElement.js +1 -1
  234. package/dist/components/arcgis-assistant-agent/customElement.js +362 -220
  235. package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
  236. package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
  237. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
  238. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
  239. package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
  240. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
  241. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
  242. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
  243. package/dist/components/arcgis-assistant-message/customElement.js +1 -1
  244. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  245. package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
  246. package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
  247. package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
  248. package/dist/components/arcgis-assistant-message-log/customElement.js +1 -1
  249. package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
  250. package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
  251. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
  252. package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
  253. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
  254. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  255. package/dist/docs/api.json +1 -1
  256. package/dist/docs/docs.json +1 -1
  257. package/dist/docs/web-types.json +1 -1
  258. package/dist/index.js +1 -1
  259. package/dist/loader.js +1 -1
  260. package/dist/utils/index.js +3 -3
  261. package/package.json +9 -9
  262. package/dist/cdn/25MBI4PD.js +0 -2
  263. package/dist/cdn/2LVYAXHG.js +0 -44
  264. package/dist/cdn/2WXXSZP5.js +0 -2
  265. package/dist/cdn/5X23DDDZ.js +0 -2
  266. package/dist/cdn/AUCKEB52.js +0 -2
  267. package/dist/cdn/B3HXSEBN.js +0 -2
  268. package/dist/cdn/BTTCBEPW.js +0 -2
  269. package/dist/cdn/EXMEB4X2.js +0 -2
  270. package/dist/cdn/FLUI6GCU.js +0 -2
  271. package/dist/cdn/FRYS2PZJ.js +0 -2
  272. package/dist/cdn/FSLQCZRN.js +0 -2
  273. package/dist/cdn/HKIA5PWU.js +0 -2
  274. package/dist/cdn/I3SUE2TR.js +0 -2
  275. package/dist/cdn/KAX4A7SF.js +0 -2
  276. package/dist/cdn/LIRT72WY.js +0 -2
  277. package/dist/cdn/M5B6X46F.js +0 -2
  278. package/dist/cdn/NGR5NVZE.js +0 -2
  279. package/dist/cdn/PUZ6RAFQ.js +0 -2
  280. package/dist/cdn/ROS22KOA.js +0 -2
  281. package/dist/cdn/SBNNJ5WA.js +0 -2
  282. package/dist/cdn/SDX46GZY.js +0 -2
  283. package/dist/cdn/SI22EJLC.js +0 -2
  284. package/dist/cdn/SXYKNDOF.js +0 -2
  285. package/dist/cdn/SZ2L5556.js +0 -2
  286. package/dist/cdn/UGIHS7OA.js +0 -2
  287. package/dist/cdn/VT5EWFH7.js +0 -2
  288. package/dist/cdn/XZF7Y6B2.js +0 -2
  289. package/dist/cdn/Y4ZOB6UH.js +0 -2
  290. package/dist/cdn/YIXASZUW.js +0 -2
@@ -1,10 +1,10 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import{$ as Na,Dd as $a,d as dt,e as Ca,j as Gn,k as Oa,m as xc,n as Ec,o as Ra,u as $e,w as Sc,x as Tc}from"./CSE6BHOJ.js";import{a as Qt,b as Ip,c as Hn}from"./BVUCNXC5.js";var ld=Qt((JE,Os)=>{"use strict";var $m=Object.prototype.hasOwnProperty,ke="~";function mn(){}Object.create&&(mn.prototype=Object.create(null),new mn().__proto__||(ke=!1));function Pm(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function cd(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new Pm(r,n||e,i),s=ke?ke+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function bi(e,t){--e._eventsCount===0?e._events=new mn:delete e._events[t]}function xe(){this._events=new mn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)$m.call(r,n)&&t.push(ke?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};xe.prototype.listeners=function(t){var r=ke?ke+t:t,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};xe.prototype.listenerCount=function(t){var r=ke?ke+t:t,n=this._events[r];return n?n.fn?1:n.length:0};xe.prototype.emit=function(t,r,n,i,a,s){var o=ke?ke+t:t;if(!this._events[o])return!1;var c=this._events[o],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){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,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(t,c[d].fn,void 0,!0),l){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(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0};xe.prototype.on=function(t,r,n){return cd(this,t,r,n,!1)};xe.prototype.once=function(t,r,n){return cd(this,t,r,n,!0)};xe.prototype.removeListener=function(t,r,n,i){var a=ke?ke+t:t;if(!this._events[a])return this;if(!r)return bi(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&bi(this,a);else{for(var o=0,c=[],l=s.length;o<l;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:bi(this,a)}return this};xe.prototype.removeAllListeners=function(t){var r;return t?(r=ke?ke+t:t,this._events[r]&&bi(this,r)):(this._events=new mn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=ke;xe.EventEmitter=xe;typeof Os<"u"&&(Os.exports=xe)});var dd=Qt((KE,ud)=>{"use strict";ud.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var pd=Qt((YE,xi)=>{"use strict";var Mm=dd(),vi=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},fd=(e,t,r)=>new Promise((n,i)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);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 ${t} milliseconds`,o=r instanceof Error?r:new vi(s);typeof e.cancel=="function"&&e.cancel(),i(o)},t);Mm(e.then(n,i),()=>{clearTimeout(a)})});xi.exports=fd;xi.exports.default=fd;xi.exports.TimeoutError=vi});var hd=Qt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});function jm(e,t,r){let n=0,i=e.length;for(;i>0;){let a=i/2|0,s=n+a;r(e[s],t)<=0?(n=++s,i-=a+1):i=a}return n}Rs.default=jm});var md=Qt($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});var Lm=hd(),Ns=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=Lm.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};$s.default=Ns});var Si=Qt(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var Dm=ld(),gd=pd(),Um=md(),Ei=()=>{},zm=new gd.TimeoutError,Ps=class extends Dm{constructor(t){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ei,this._resolveIdle=Ei,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Um.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=t.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.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=Ei,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Ei,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;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 t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&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(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?t():gd.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(zm)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.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(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};Ms.default=Ps});var _p=Qt(ga=>{"use strict";ga.byteLength=xw;ga.toByteArray=Sw;ga.fromByteArray=Iw;var St=[],Qe=[],vw=typeof Uint8Array<"u"?Uint8Array:Array,cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rr=0,mp=cc.length;Rr<mp;++Rr)St[Rr]=cc[Rr],Qe[cc.charCodeAt(Rr)]=Rr;var Rr,mp;Qe[45]=62;Qe[95]=63;function gp(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function xw(e){var t=gp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Ew(e,t,r){return(t+r)*3/4-r}function Sw(e){var t,r=gp(e),n=r[0],i=r[1],a=new vw(Ew(e,n,i)),s=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)t=Qe[e.charCodeAt(c)]<<18|Qe[e.charCodeAt(c+1)]<<12|Qe[e.charCodeAt(c+2)]<<6|Qe[e.charCodeAt(c+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Qe[e.charCodeAt(c)]<<2|Qe[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Qe[e.charCodeAt(c)]<<10|Qe[e.charCodeAt(c+1)]<<4|Qe[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function Tw(e){return St[e>>18&63]+St[e>>12&63]+St[e>>6&63]+St[e&63]}function Aw(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(Tw(n));return i.join("")}function Iw(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(Aw(e,s,s+a>o?o:s+a));return n===1?(t=e[r-1],i.push(St[t>>2]+St[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(St[t>>10]+St[t>>4&63]+St[t<<2&63]+"=")),i.join("")}});var Ac=Object.defineProperty,L=(e,t)=>{let r={};for(var n in e)Ac(r,n,{get:e[n],enumerable:!0});return t||Ac(r,Symbol.toStringTag,{value:"Module"}),r};var kp=/([A-Z]+)([A-Z][a-z0-9]+)/g,Cp=/([a-z0-9])([A-Z])/g,Ic=/[-_\s]+/g;function Op(e){return e.replace(kp,"$1_$2").replace(Cp,"$1_$2").replace(Ic,"_").toLowerCase()}function Rp(e){let t=e.trim();return/[-_\s]/.test(t)?t.replace(Ic,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):t}function kc(e,t){return t?.[e]||Op(e)}function Zw(e,t){return t?.[e]||Rp(e)}function Cc(e,t,r){let n={};for(let i in e)Object.hasOwn(e,i)&&(n[t(i,r)]=e[i]);return n}var Rc="__lc_escaped__";function Np(e){return"lc"in e||Object.keys(e).length===1&&"__lc_escaped__"in e}function $p(e){return{[Rc]:e}}function Pp(e){return Object.keys(e).length===1&&"__lc_escaped__"in e}function Mp(e){return e!==null&&typeof e=="object"&&"lc_serializable"in e&&typeof e.toJSON=="function"}function jp(e){let t;return e!==null&&typeof e=="object"?"lc_id"in e&&Array.isArray(e.lc_id)?t=e.lc_id:t=[e.constructor?.name??"Object"]:t=[typeof e],{lc:1,type:"not_implemented",id:t}}function Vn(e,t=new WeakSet){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){if(t.has(e))return jp(e);if(Mp(e))return e;t.add(e);let r=e;if(Np(r))return t.delete(e),$p(r);let n={};for(let[i,a]of Object.entries(r))n[i]=Vn(a,t);return t.delete(e),n}return Array.isArray(e)?e.map(r=>Vn(r,t)):e}function Oc(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(Pp(t))return t[Rc];let r={};for(let[n,i]of Object.entries(t))r[n]=Oc(i);return r}return Array.isArray(e)?e.map(t=>Oc(t)):e}var Xw=L({Serializable:()=>ft,get_lc_unique_name:()=>Zn});function Nc(e){return Array.isArray(e)?[...e]:{...e}}function Lp(e,t){let r=Nc(e);for(let[n,i]of Object.entries(t)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Nc(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function Zn(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var ft=class $c{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Zn(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof $c||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},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(t,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,l=n,[u,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in l)||l[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?l[f]={}:Array.isArray(c[f])&&(l[f]=[])),c=c[f],l=l[f]}u in c&&c[u]!==void 0&&(l[u]=l[u]||c[u])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=Vn(c,a);let s=Cc(Object.keys(r).length?Lp(i,r):i,kc,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function Nt(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"&&"source_type"in e&&(e.source_type==="url"||e.source_type==="base64"||e.source_type==="text"||e.source_type==="id")}function Pc(e){return Nt(e)&&e.source_type==="url"&&"url"in e&&typeof e.url=="string"}function Mc(e){return Nt(e)&&e.source_type==="base64"&&"data"in e&&typeof e.data=="string"}function eb(e){return Nt(e)&&e.source_type==="text"&&"text"in e&&typeof e.text=="string"}function jc(e){return Nt(e)&&e.source_type==="id"&&"id"in e&&typeof e.id=="string"}function tb(e){if(Nt(e)){if(e.source_type==="url")return{type:"image_url",image_url:{url:e.url}};if(e.source_type==="base64"){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function rb(e){let t=e.split(";")[0].split("/");if(t.length!==2)throw new Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let a of e.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${e}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${e}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Pa({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=t?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function nb(e,t){if(e.type==="text"){if(!t.fromStandardTextBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type==="image"){if(!t.fromStandardImageBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type==="audio"){if(!t.fromStandardAudioBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type==="file"){if(!t.fromStandardFileBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw new Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function S(e,t){return $(e)&&e.type===t}function $(e){return typeof e=="object"&&e!==null}function de(e){return Array.isArray(e)}function g(e){return typeof e=="string"}function De(e){return typeof e=="number"}function qn(e){return e instanceof Uint8Array}function Ma(e){try{return JSON.parse(e)}catch{return}}var Ue=e=>e();function Dp(e){if(e.type==="char_location"&&g(e.document_title)&&De(e.start_char_index)&&De(e.end_char_index)&&g(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="page_location"&&g(e.document_title)&&De(e.start_page_number)&&De(e.end_page_number)&&g(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="content_block_location"&&g(e.document_title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="web_search_result_location"&&g(e.url)&&g(e.title)&&g(e.encrypted_index)&&g(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(e.type==="search_result_location"&&g(e.source)&&g(e.title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=e;return{...s,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function Dc(e){if(S(e,"document")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"file",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"file",fileId:e.source.file_id};if(e.source.type==="text"&&g(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(S(e,"image")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"image",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function Uc(e){function*t(){for(let r of e){let n=Dc(r);n?yield n:yield r}}return Array.from(t())}function Lc(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"text")&&g(n.text)){let{text:i,citations:a,...s}=n;if(de(a)&&a.length){let o=a.reduce((c,l)=>{let u=Dp(l);return u?[...c,u]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(S(n,"thinking")&&g(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(S(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(S(n,"tool_use")&&g(n.name)&&g(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(S(n,"input_json_delta")){if(Up(e)&&e.tool_call_chunks?.length){let i=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(S(n,"server_tool_use")&&g(n.name)&&g(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.query))return n.input.query;if(g(n.partial_json)){let s=Ma(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:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.code))return n.input.code;if(g(n.partial_json)){let s=Ma(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(S(n,"web_search_tool_result")&&g(n.tool_use_id)&&de(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)=>S(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(S(n,"code_execution_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(S(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(S(n,"mcp_tool_result")&&g(n.tool_use_id)&&$(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(S(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(S(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(S(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=Dc(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var zc={translateContent:Lc,translateContentChunk:Lc};function Up(e){return typeof e?._getType=="function"&&typeof e.concat=="function"&&e._getType()==="ai"}function zp(e){return Pc(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:Mc(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:jc(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function Bc(e){return e.map(zp)}function Fc(e){return!!(S(e,"image_url")&&$(e.image_url)||S(e,"input_audio")&&$(e.input_audio)||S(e,"file")&&$(e.file))}function Hc(e){if(S(e,"image_url")&&$(e.image_url)&&g(e.image_url.url)){let t=Pa({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}else{if(S(e,"input_audio")&&$(e.input_audio)&&g(e.input_audio.data)&&g(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(S(e,"file")&&$(e.file)&&g(e.file.data)){let t=Pa({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(g(e.file.file_id))return{type:"file",fileId:e.file.file_id}}}return e}function Bp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Wn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Fp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Wn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Wn(e){let t=[];for(let r of e)Fc(r)?t.push(Hc(r)):t.push(r);return t}function Hp(e){if(e.type==="url_citation"){let{url:t,title:r,start_index:n,end_index:i}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:i}}if(e.type==="file_citation"){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function Gc(e){function*t(){$(e.additional_kwargs?.reasoning)&&de(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((n,i)=>$(i)&&g(i.text)?`${n}${i.text}`:n,"")});let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r)if(S(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,l=$(o)?{...o}:{};g(s)&&(l.phase=s);let u=Object.keys(l).length>0?{extras:l}:{};Array.isArray(a)?yield{...c,...u,type:"text",text:String(i),annotations:a.map(Hp)}:yield{...c,...u,type:"text",text:String(i)}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if($(e.additional_kwargs)&&de(e.additional_kwargs.tool_outputs))for(let n of e.additional_kwargs.tool_outputs){if(S(n,"web_search_call")){let i={};if($(n.action)&&g(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={};$(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(S(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:de(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:de(n.results)?{results:n.results}:{}});continue}else if(S(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(S(n,"code_interpreter_call")){if(g(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),de(n.outputs)){let i=Ue(()=>{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(S(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(S(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(S(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(S(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(S(n,"tool_search_call")){let i={};$(n.arguments)&&Object.assign(i,n.arguments);let a={};g(n.execution)&&(a.execution=n.execution),g(n.status)&&(a.status=n.status),g(n.call_id)&&(a.call_id=n.call_id),yield{id:g(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(S(n,"tool_search_output")){let i={name:"tool_search"};g(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:de(n.tools)?n.tools:[]},extras:i};continue}else if(S(n,"image_generation_call")){g(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:g(n.id)?n.id:void 0,metadata:{status:g(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}$(n)&&(yield{type:"non_standard",value:n})}}return Array.from(t())}function Gp(e){function*t(){yield*Gc(e);for(let r of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(t())}var Vc={translateContent:e=>typeof e.content=="string"?Bp(e):Gc(e),translateContentChunk:e=>typeof e.content=="string"?Fp(e):Gp(e)};function Zc(e){return typeof e=="object"&&e!==null&&"type"in e&&"content"in e&&(typeof e.content=="string"||Array.isArray(e.content))}function qc(e,t="pretty"){return t==="pretty"?Vp(e):JSON.stringify(e)}function Vp(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(t.push(`${i}${r}${a}`),e.type==="ai"){let s=e;if(s.tool_calls&&s.tool_calls.length>0){t.push("Tool Calls:");for(let o of s.tool_calls){t.push(` ${o.name} (${o.id})`),t.push(` Call ID: ${o.id}`),t.push(" Args:");for(let[c,l]of Object.entries(o.args))t.push(` ${c}: ${typeof l=="object"?JSON.stringify(l):l}`)}}}if(e.type==="tool"){let s=e;s.name&&t.push(`Name: ${s.name}`)}return typeof e.content=="string"&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join(`
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{$ as Na,Dd as $a,d as dt,e as Ca,j as Gn,k as Oa,m as xc,n as Ec,o as Ra,u as $e,w as Sc,x as Tc}from"./MWYBF3F3.js";import{a as Qt,b as Ip,c as Hn}from"./UZLQALHY.js";var ld=Qt((JE,Os)=>{"use strict";var $m=Object.prototype.hasOwnProperty,ke="~";function mn(){}Object.create&&(mn.prototype=Object.create(null),new mn().__proto__||(ke=!1));function Pm(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function cd(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var a=new Pm(r,n||e,i),s=ke?ke+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function bi(e,t){--e._eventsCount===0?e._events=new mn:delete e._events[t]}function xe(){this._events=new mn,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)$m.call(r,n)&&t.push(ke?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};xe.prototype.listeners=function(t){var r=ke?ke+t:t,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};xe.prototype.listenerCount=function(t){var r=ke?ke+t:t,n=this._events[r];return n?n.fn?1:n.length:0};xe.prototype.emit=function(t,r,n,i,a,s){var o=ke?ke+t:t;if(!this._events[o])return!1;var c=this._events[o],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){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,u=new Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(t,c[d].fn,void 0,!0),l){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(!u)for(p=1,u=new Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0};xe.prototype.on=function(t,r,n){return cd(this,t,r,n,!1)};xe.prototype.once=function(t,r,n){return cd(this,t,r,n,!0)};xe.prototype.removeListener=function(t,r,n,i){var a=ke?ke+t:t;if(!this._events[a])return this;if(!r)return bi(this,a),this;var s=this._events[a];if(s.fn)s.fn===r&&(!i||s.once)&&(!n||s.context===n)&&bi(this,a);else{for(var o=0,c=[],l=s.length;o<l;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:bi(this,a)}return this};xe.prototype.removeAllListeners=function(t){var r;return t?(r=ke?ke+t:t,this._events[r]&&bi(this,r)):(this._events=new mn,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=ke;xe.EventEmitter=xe;typeof Os<"u"&&(Os.exports=xe)});var dd=Qt((KE,ud)=>{"use strict";ud.exports=(e,t)=>(t=t||(()=>{}),e.then(r=>new Promise(n=>{n(t())}).then(()=>r),r=>new Promise(n=>{n(t())}).then(()=>{throw r})))});var pd=Qt((YE,xi)=>{"use strict";var Mm=dd(),vi=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},fd=(e,t,r)=>new Promise((n,i)=>{if(typeof t!="number"||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0){n(e);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 ${t} milliseconds`,o=r instanceof Error?r:new vi(s);typeof e.cancel=="function"&&e.cancel(),i(o)},t);Mm(e.then(n,i),()=>{clearTimeout(a)})});xi.exports=fd;xi.exports.default=fd;xi.exports.TimeoutError=vi});var hd=Qt(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});function jm(e,t,r){let n=0,i=e.length;for(;i>0;){let a=i/2|0,s=n+a;r(e[s],t)<=0?(n=++s,i-=a+1):i=a}return n}Rs.default=jm});var md=Qt($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});var Lm=hd(),Ns=class{constructor(){this._queue=[]}enqueue(t,r){r=Object.assign({priority:0},r);let n={priority:r.priority,run:t};if(this.size&&this._queue[this.size-1].priority>=r.priority){this._queue.push(n);return}let i=Lm.default(this._queue,n,(a,s)=>s.priority-a.priority);this._queue.splice(i,0,n)}dequeue(){let t=this._queue.shift();return t?.run}filter(t){return this._queue.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this._queue.length}};$s.default=Ns});var Si=Qt(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var Dm=ld(),gd=pd(),Um=md(),Ei=()=>{},zm=new gd.TimeoutError,Ps=class extends Dm{constructor(t){var r,n,i,a;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=Ei,this._resolveIdle=Ei,t=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:Um.default},t),!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(n=(r=t.intervalCap)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(a=(i=t.interval)===null||i===void 0?void 0:i.toString())!==null&&a!==void 0?a:""}\` (${typeof t.interval})`);this._carryoverConcurrencyCount=t.carryoverConcurrencyCount,this._isIntervalIgnored=t.intervalCap===1/0||t.interval===0,this._intervalCap=t.intervalCap,this._interval=t.interval,this._queue=new t.queueClass,this._queueClass=t.queueClass,this.concurrency=t.concurrency,this._timeout=t.timeout,this._throwOnTimeout=t.throwOnTimeout===!0,this._isPaused=t.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=Ei,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=Ei,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let t=Date.now();if(this._intervalId===void 0){let r=this._intervalEnd-t;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 t=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let r=this._queue.dequeue();return r?(this.emit("active"),r(),t&&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(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this._concurrency=t,this._processQueue()}async add(t,r={}){return new Promise((n,i)=>{let a=async()=>{this._pendingCount++,this._intervalCount++;try{let s=this._timeout===void 0&&r.timeout===void 0?t():gd.default(Promise.resolve(t()),r.timeout===void 0?this._timeout:r.timeout,()=>{(r.throwOnTimeout===void 0?this._throwOnTimeout:r.throwOnTimeout)&&i(zm)});n(await s)}catch(s){i(s)}this._next()};this._queue.enqueue(a,r),this._tryToStartAnother(),this.emit("add")})}async addAll(t,r){return Promise.all(t.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(t=>{let r=this._resolveEmpty;this._resolveEmpty=()=>{r(),t()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(t=>{let r=this._resolveIdle;this._resolveIdle=()=>{r(),t()}})}get size(){return this._queue.size}sizeBy(t){return this._queue.filter(t).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(t){this._timeout=t}};Ms.default=Ps});var _p=Qt(ga=>{"use strict";ga.byteLength=xw;ga.toByteArray=Sw;ga.fromByteArray=Iw;var St=[],Qe=[],vw=typeof Uint8Array<"u"?Uint8Array:Array,cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Rr=0,mp=cc.length;Rr<mp;++Rr)St[Rr]=cc[Rr],Qe[cc.charCodeAt(Rr)]=Rr;var Rr,mp;Qe[45]=62;Qe[95]=63;function gp(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function xw(e){var t=gp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Ew(e,t,r){return(t+r)*3/4-r}function Sw(e){var t,r=gp(e),n=r[0],i=r[1],a=new vw(Ew(e,n,i)),s=0,o=i>0?n-4:n,c;for(c=0;c<o;c+=4)t=Qe[e.charCodeAt(c)]<<18|Qe[e.charCodeAt(c+1)]<<12|Qe[e.charCodeAt(c+2)]<<6|Qe[e.charCodeAt(c+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=t&255;return i===2&&(t=Qe[e.charCodeAt(c)]<<2|Qe[e.charCodeAt(c+1)]>>4,a[s++]=t&255),i===1&&(t=Qe[e.charCodeAt(c)]<<10|Qe[e.charCodeAt(c+1)]<<4|Qe[e.charCodeAt(c+2)]>>2,a[s++]=t>>8&255,a[s++]=t&255),a}function Tw(e){return St[e>>18&63]+St[e>>12&63]+St[e>>6&63]+St[e&63]}function Aw(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(Tw(n));return i.join("")}function Iw(e){for(var t,r=e.length,n=r%3,i=[],a=16383,s=0,o=r-n;s<o;s+=a)i.push(Aw(e,s,s+a>o?o:s+a));return n===1?(t=e[r-1],i.push(St[t>>2]+St[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(St[t>>10]+St[t>>4&63]+St[t<<2&63]+"=")),i.join("")}});var Ac=Object.defineProperty,L=(e,t)=>{let r={};for(var n in e)Ac(r,n,{get:e[n],enumerable:!0});return t||Ac(r,Symbol.toStringTag,{value:"Module"}),r};var kp=/([A-Z]+)([A-Z][a-z0-9]+)/g,Cp=/([a-z0-9])([A-Z])/g,Ic=/[-_\s]+/g;function Op(e){return e.replace(kp,"$1_$2").replace(Cp,"$1_$2").replace(Ic,"_").toLowerCase()}function Rp(e){let t=e.trim();return/[-_\s]/.test(t)?t.replace(Ic,"_").toLowerCase().replace(/_+([a-z0-9])/g,(r,n)=>n.toUpperCase()):t}function kc(e,t){return t?.[e]||Op(e)}function Zw(e,t){return t?.[e]||Rp(e)}function Cc(e,t,r){let n={};for(let i in e)Object.hasOwn(e,i)&&(n[t(i,r)]=e[i]);return n}var Rc="__lc_escaped__";function Np(e){return"lc"in e||Object.keys(e).length===1&&"__lc_escaped__"in e}function $p(e){return{[Rc]:e}}function Pp(e){return Object.keys(e).length===1&&"__lc_escaped__"in e}function Mp(e){return e!==null&&typeof e=="object"&&"lc_serializable"in e&&typeof e.toJSON=="function"}function jp(e){let t;return e!==null&&typeof e=="object"?"lc_id"in e&&Array.isArray(e.lc_id)?t=e.lc_id:t=[e.constructor?.name??"Object"]:t=[typeof e],{lc:1,type:"not_implemented",id:t}}function Vn(e,t=new WeakSet){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){if(t.has(e))return jp(e);if(Mp(e))return e;t.add(e);let r=e;if(Np(r))return t.delete(e),$p(r);let n={};for(let[i,a]of Object.entries(r))n[i]=Vn(a,t);return t.delete(e),n}return Array.isArray(e)?e.map(r=>Vn(r,t)):e}function Oc(e){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let t=e;if(Pp(t))return t[Rc];let r={};for(let[n,i]of Object.entries(t))r[n]=Oc(i);return r}return Array.isArray(e)?e.map(t=>Oc(t)):e}var Xw=L({Serializable:()=>ft,get_lc_unique_name:()=>Zn});function Nc(e){return Array.isArray(e)?[...e]:{...e}}function Lp(e,t){let r=Nc(e);for(let[n,i]of Object.entries(t)){let[a,...s]=n.split(".").reverse(),o=r;for(let c of s.reverse()){if(o[c]===void 0)break;o[c]=Nc(o[c]),o=o[c]}o[a]!==void 0&&(o[a]={lc:1,type:"secret",id:[i]})}return r}function Zn(e){let t=Object.getPrototypeOf(e);return typeof e.lc_name=="function"&&(typeof t.lc_name!="function"||e.lc_name()!==t.lc_name())?e.lc_name():e.name}var ft=class $c{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,Zn(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(t,...r){this.lc_serializable_keys!==void 0?this.lc_kwargs=Object.fromEntries(Object.entries(t||{}).filter(([n])=>this.lc_serializable_keys?.includes(n))):this.lc_kwargs=t??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof $c||typeof this.lc_kwargs!="object"||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();let t={},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(t,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,l=n,[u,...d]=o.split(".").reverse();for(let f of d.reverse()){if(!(f in c)||c[f]===void 0)return;(!(f in l)||l[f]===void 0)&&(typeof c[f]=="object"&&c[f]!=null?l[f]={}:Array.isArray(c[f])&&(l[f]=[])),c=c[f],l=l[f]}u in c&&c[u]!==void 0&&(l[u]=l[u]||c[u])});let i={},a=new WeakSet;a.add(this);for(let[o,c]of Object.entries(n))i[o]=Vn(c,a);let s=Cc(Object.keys(r).length?Lp(i,r):i,kc,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:s}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function Nt(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"&&"source_type"in e&&(e.source_type==="url"||e.source_type==="base64"||e.source_type==="text"||e.source_type==="id")}function Pc(e){return Nt(e)&&e.source_type==="url"&&"url"in e&&typeof e.url=="string"}function Mc(e){return Nt(e)&&e.source_type==="base64"&&"data"in e&&typeof e.data=="string"}function eb(e){return Nt(e)&&e.source_type==="text"&&"text"in e&&typeof e.text=="string"}function jc(e){return Nt(e)&&e.source_type==="id"&&"id"in e&&typeof e.id=="string"}function tb(e){if(Nt(e)){if(e.source_type==="url")return{type:"image_url",image_url:{url:e.url}};if(e.source_type==="base64"){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function rb(e){let t=e.split(";")[0].split("/");if(t.length!==2)throw new Error(`Invalid mime type: "${e}" - does not match type/subtype format.`);let r=t[0].trim(),n=t[1].trim();if(r===""||n==="")throw new Error(`Invalid mime type: "${e}" - type or subtype is empty.`);let i={};for(let a of e.split(";").slice(1)){let s=a.split("=");if(s.length!==2)throw new Error(`Invalid parameter syntax in mime type: "${e}".`);let o=s[0].trim(),c=s[1].trim();if(o==="")throw new Error(`Invalid parameter syntax in mime type: "${e}".`);i[o]=c}return{type:r,subtype:n,parameters:i}}function Pa({dataUrl:e,asTypedArray:t=!1}){let r=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/),n;if(r){n=r[1].toLowerCase();let i=t?Uint8Array.from(atob(r[2]),a=>a.charCodeAt(0)):r[2];return{mime_type:n,data:i}}}function nb(e,t){if(e.type==="text"){if(!t.fromStandardTextBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardTextBlock\` method.`);return t.fromStandardTextBlock(e)}if(e.type==="image"){if(!t.fromStandardImageBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardImageBlock\` method.`);return t.fromStandardImageBlock(e)}if(e.type==="audio"){if(!t.fromStandardAudioBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardAudioBlock\` method.`);return t.fromStandardAudioBlock(e)}if(e.type==="file"){if(!t.fromStandardFileBlock)throw new Error(`Converter for ${t.providerName} does not implement \`fromStandardFileBlock\` method.`);return t.fromStandardFileBlock(e)}throw new Error(`Unable to convert content block type '${e.type}' to provider-specific format: not recognized.`)}function S(e,t){return $(e)&&e.type===t}function $(e){return typeof e=="object"&&e!==null}function de(e){return Array.isArray(e)}function g(e){return typeof e=="string"}function De(e){return typeof e=="number"}function qn(e){return e instanceof Uint8Array}function Ma(e){try{return JSON.parse(e)}catch{return}}var Ue=e=>e();function Dp(e){if(e.type==="char_location"&&g(e.document_title)&&De(e.start_char_index)&&De(e.end_char_index)&&g(e.cited_text)){let{document_title:t,start_char_index:r,end_char_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="page_location"&&g(e.document_title)&&De(e.start_page_number)&&De(e.end_page_number)&&g(e.cited_text)){let{document_title:t,start_page_number:r,end_page_number:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="content_block_location"&&g(e.document_title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{document_title:t,start_block_index:r,end_block_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:r,endIndex:n,citedText:i}}if(e.type==="web_search_result_location"&&g(e.url)&&g(e.title)&&g(e.encrypted_index)&&g(e.cited_text)){let{url:t,title:r,encrypted_index:n,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:r,startIndex:Number(n),endIndex:Number(n),citedText:i}}if(e.type==="search_result_location"&&g(e.source)&&g(e.title)&&De(e.start_block_index)&&De(e.end_block_index)&&g(e.cited_text)){let{source:t,title:r,start_block_index:n,end_block_index:i,cited_text:a,...s}=e;return{...s,type:"citation",source:"search",url:t,title:r??void 0,startIndex:n,endIndex:i,citedText:a}}}function Dc(e){if(S(e,"document")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"file",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"file",fileId:e.source.file_id};if(e.source.type==="text"&&g(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(S(e,"image")&&$(e.source)&&"type"in e.source){if(e.source.type==="base64"&&g(e.source.media_type)&&g(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if(e.source.type==="url"&&g(e.source.url))return{type:"image",url:e.source.url};if(e.source.type==="file"&&g(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function Uc(e){function*t(){for(let r of e){let n=Dc(r);n?yield n:yield r}}return Array.from(t())}function Lc(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"text")&&g(n.text)){let{text:i,citations:a,...s}=n;if(de(a)&&a.length){let o=a.reduce((c,l)=>{let u=Dp(l);return u?[...c,u]:c},[]);yield{...s,type:"text",text:i,annotations:o};continue}else{yield{...s,type:"text",text:i};continue}}else if(S(n,"thinking")&&g(n.thinking)){let{thinking:i,signature:a,...s}=n;yield{...s,type:"reasoning",reasoning:i,signature:a};continue}else if(S(n,"redacted_thinking")){yield{type:"non_standard",value:n};continue}else if(S(n,"tool_use")&&g(n.name)&&g(n.id)){yield{type:"tool_call",id:n.id,name:n.name,args:n.input};continue}else if(S(n,"input_json_delta")){if(Up(e)&&e.tool_call_chunks?.length){let i=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:i.id,name:i.name,args:i.args,index:i.index};continue}}else if(S(n,"server_tool_use")&&g(n.name)&&g(n.id)){let{name:i,id:a}=n;if(i==="web_search"){yield{id:a,type:"server_tool_call",name:"web_search",args:{query:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.query))return n.input.query;if(g(n.partial_json)){let s=Ma(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:Ue(()=>{if(typeof n.input=="string")return n.input;if($(n.input)&&g(n.input.code))return n.input.code;if(g(n.partial_json)){let s=Ma(n.partial_json);if(s?.code)return s.code}return""})}};continue}}else if(S(n,"web_search_tool_result")&&g(n.tool_use_id)&&de(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)=>S(o,"web_search_result")?[...s,o.url]:s,[])}};continue}else if(S(n,"code_execution_tool_result")&&g(n.tool_use_id)&&$(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}else if(S(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}else if(S(n,"mcp_tool_result")&&g(n.tool_use_id)&&$(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(S(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}else if(S(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}else if(S(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}else{let i=Dc(n);if(i){yield i;continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var zc={translateContent:Lc,translateContentChunk:Lc};function Up(e){return typeof e?._getType=="function"&&typeof e.concat=="function"&&e._getType()==="ai"}function zp(e){return Pc(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:Mc(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:jc(e)?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e}function Bc(e){return e.map(zp)}function Fc(e){return!!(S(e,"image_url")&&$(e.image_url)||S(e,"input_audio")&&$(e.input_audio)||S(e,"file")&&$(e.file))}function Hc(e){if(S(e,"image_url")&&$(e.image_url)&&g(e.image_url.url)){let t=Pa({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}else{if(S(e,"input_audio")&&$(e.input_audio)&&g(e.input_audio.data)&&g(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(S(e,"file")&&$(e.file)&&g(e.file.data)){let t=Pa({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(g(e.file.file_id))return{type:"file",fileId:e.file.file_id}}}return e}function Bp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Wn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Fp(e){let t=[];typeof e.content=="string"?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...Wn(e.content));for(let r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}function Wn(e){let t=[];for(let r of e)Fc(r)?t.push(Hc(r)):t.push(r);return t}function Hp(e){if(e.type==="url_citation"){let{url:t,title:r,start_index:n,end_index:i}=e;return{type:"citation",url:t,title:r,startIndex:n,endIndex:i}}if(e.type==="file_citation"){let{file_id:t,filename:r,index:n}=e;return{type:"citation",title:r,startIndex:n,endIndex:n,fileId:t}}return e}function Gc(e){function*t(){$(e.additional_kwargs?.reasoning)&&de(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((n,i)=>$(i)&&g(i.text)?`${n}${i.text}`:n,"")});let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r)if(S(n,"text")){let{text:i,annotations:a,phase:s,extras:o,...c}=n,l=$(o)?{...o}:{};g(s)&&(l.phase=s);let u=Object.keys(l).length>0?{extras:l}:{};Array.isArray(a)?yield{...c,...u,type:"text",text:String(i),annotations:a.map(Hp)}:yield{...c,...u,type:"text",text:String(i)}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if($(e.additional_kwargs)&&de(e.additional_kwargs.tool_outputs))for(let n of e.additional_kwargs.tool_outputs){if(S(n,"web_search_call")){let i={};if($(n.action)&&g(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={};$(n.action)&&(a.action=n.action),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:a}}continue}else if(S(n,"file_search_call")){yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:de(n.queries)?n.queries:[]}},(n.status==="completed"||n.status==="failed")&&(yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":"error",output:de(n.results)?{results:n.results}:{}});continue}else if(S(n,"computer_call")){yield{type:"non_standard",value:n};continue}else if(S(n,"code_interpreter_call")){if(g(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),de(n.outputs)){let i=Ue(()=>{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(S(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(S(n,"mcp_call")){yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};continue}else if(S(n,"mcp_list_tools")){yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};continue}else if(S(n,"mcp_approval_request")){yield{type:"non_standard",value:n};continue}else if(S(n,"tool_search_call")){let i={};$(n.arguments)&&Object.assign(i,n.arguments);let a={};g(n.execution)&&(a.execution=n.execution),g(n.status)&&(a.status=n.status),g(n.call_id)&&(a.call_id=n.call_id),yield{id:g(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:i,...Object.keys(a).length>0?{extras:a}:{}};continue}else if(S(n,"tool_search_output")){let i={name:"tool_search"};g(n.execution)&&(i.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:g(n.id)?n.id:"",status:n.status==="completed"?"success":n.status==="failed"?"error":"success",output:{tools:de(n.tools)?n.tools:[]},extras:i};continue}else if(S(n,"image_generation_call")){g(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:g(n.id)?n.id:void 0,metadata:{status:g(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n};continue}$(n)&&(yield{type:"non_standard",value:n})}}return Array.from(t())}function Gp(e){function*t(){yield*Gc(e);for(let r of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:r.id,name:r.name,args:r.args}}return Array.from(t())}var Vc={translateContent:e=>typeof e.content=="string"?Bp(e):Gc(e),translateContentChunk:e=>typeof e.content=="string"?Fp(e):Gp(e)};function Zc(e){return typeof e=="object"&&e!==null&&"type"in e&&"content"in e&&(typeof e.content=="string"||Array.isArray(e.content))}function qc(e,t="pretty"){return t==="pretty"?Vp(e):JSON.stringify(e)}function Vp(e){let t=[],r=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,n=Math.floor((80-r.length)/2),i="=".repeat(n),a=r.length%2===0?i:`${i}=`;if(t.push(`${i}${r}${a}`),e.type==="ai"){let s=e;if(s.tool_calls&&s.tool_calls.length>0){t.push("Tool Calls:");for(let o of s.tool_calls){t.push(` ${o.name} (${o.id})`),t.push(` Call ID: ${o.id}`),t.push(" Args:");for(let[c,l]of Object.entries(o.args))t.push(` ${c}: ${typeof l=="object"?JSON.stringify(l):l}`)}}}if(e.type==="tool"){let s=e;s.name&&t.push(`Name: ${s.name}`)}return typeof e.content=="string"&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content)),t.join(`
3
3
  `)}var ja=Symbol.for("langchain.message");function Wc(e){return Array.isArray(e)?e:typeof e=="string"?e===""?[]:[{type:"text",text:e}]:e==null?[]:[e]}function Pe(e,t){if(typeof e=="string")return e===""?t:typeof t=="string"?e+t:Array.isArray(t)&&t.length===0?e:Array.isArray(t)&&t.some(r=>Nt(r))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];if(Array.isArray(t)){let r=Wc(e);return Nr(r,t)??[...r,...t]}else return t===""?e:Array.isArray(e)&&e.some(r=>Nt(r))?[...e,{type:"file",source_type:"text",text:t}]:[...Wc(e),{type:"text",text:t}]}function Xc(e,t){return e==="error"||t==="error"?"error":"success"}function Zp(e,t){function r(n,i){if(typeof n!="object"||n===null||n===void 0)return n;if(i>=t)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(e,0),null,2)}var Ie=class extends ft{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[ja]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){let t=typeof e=="string"||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,t.content===void 0&&t.contentBlocks!==void 0?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):t.content!==void 0?(this.content=t.content??[],this.response_metadata=t.response_metadata):(this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return typeof this.content=="string"?this.content:Array.isArray(this.content)?this.content.map(e=>typeof e=="string"?e:e.type==="text"?e.text:"").join(""):""}get contentBlocks(){let e=typeof this.content=="string"?[{type:"text",text:this.content}]:this.content;return[Bc,Wn,Uc].reduce((t,r)=>r(t),e)}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(e){return typeof e=="object"&&e!==null&&ja in e&&e[ja]===!0&&Zc(e)}static[Symbol.hasInstance](e){return this.isInstance(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[Symbol.for("nodejs.util.inspect.custom")](e){if(e===null)return this;let t=Zp(this._printableFields,Math.max(4,e));return`${this.constructor.lc_name()} ${t}`}toFormattedString(e="pretty"){return qc(this,e)}};function Eb(e){return Array.isArray(e)&&e.every(t=>typeof t.index=="number")}var qp=["index","created","timestamp"];function ce(e,t,r){let n=r?.ignoreKeys??qp;if(e==null&&t==null)return;if(e==null||t==null)return e??t;let i={...e};for(let[a,s]of Object.entries(t))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]=ce(i[a],s,r);else if(Array.isArray(i[a]))i[a]=Nr(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 Wp(e){return typeof e=="number"||typeof e=="string"}function Jc(e){return typeof e!="object"||e===null||!("index"in e)?!1:Wp(e.index)}function Kc(e){if(typeof e!="object"||e===null||!("id"in e))return!1;let t=e.id;return t!=null&&t!==""}function Yc(e){return e.endsWith("_delta")?e.slice(0,-6):e}function Jp(e,t){return typeof e!="object"||e===null||typeof t!="object"||t===null||!("type"in e)||!("type"in t)?!1:typeof e.type=="string"&&typeof t.type=="string"&&Yc(e.type)!==Yc(t.type)}function Kp(e,t){let r=Jc(t),n=Kc(t);return!r&&!n?-1:e.findIndex(i=>{let a=Jc(i),s=Kc(i);return r&&a?i.index!==t.index||Jp(i,t)?!1:s&&n?i.id===t.id:!0:!r&&!a&&n&&s?i.id===t.id:!1})}function Nr(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e||t;{let n=[...e];for(let i of t){let a=Kp(n,i);if(a!==-1)n[a]=ce(n[a],i,r);else{if(typeof i=="object"&&i!==null&&"text"in i&&i.text==="")continue;n.push(i)}}return n}}}function Qc(e,t,r){if(!(e==null&&t==null)){if(e==null||t==null)return e??t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.
4
4
  Left ${typeof e}
5
5
  Right ${typeof t}`);if(typeof e=="string"&&typeof t=="string")return e+t;if(Array.isArray(e)&&Array.isArray(t))return Nr(e,t,r);if(typeof e=="object"&&typeof t=="object")return ce(e,t,r);if(e===t)return e;throw new Error(`Can not merge objects of different types.
6
6
  Left ${e}
7
- Right ${t}`)}}var ze=class el extends Ie{static isInstance(t){if(!super.isInstance(t))return!1;let r=Object.getPrototypeOf(t);for(;r!==null;){if(r===el.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}static[Symbol.hasInstance](t){return this.isInstance(t)}};function tl(e){return typeof e.role=="string"}function rl(e){return typeof e?._getType=="function"}function Sb(e){return ze.isInstance(e)}var Cb=L({ToolMessage:()=>er,ToolMessageChunk:()=>Yp,defaultToolCallParser:()=>Da,isDirectToolOutput:()=>La,isToolMessage:()=>Xp,isToolMessageChunk:()=>Qp});function La(e){return e!=null&&typeof e=="object"&&"lc_direct_tool_output"in e&&e.lc_direct_tool_output===!0}var er=class extends Ie{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(e,t,r){let n=typeof e=="string"||Array.isArray(e)?{content:e,name:r,tool_call_id:t}:e;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Yp=class extends ze{type="tool";tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){let t=this.constructor;return new t({content:Pe(this.content,e.content),additional_kwargs:ce(this.additional_kwargs,e.additional_kwargs),response_metadata:ce(this.response_metadata,e.response_metadata),artifact:Qc(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Xc(this.status,e.status)})}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Da(e){let t=[],r=[];for(let n of e)if(n.function){let i=n.function.name;try{let a=JSON.parse(n.function.arguments);t.push({name:i||"",args:a||{},id:n.id})}catch{r.push({name:i,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[t,r]}function Xp(e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="tool"}function Qp(e){return e._getType()==="tool"}function Ua(e){switch(e){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function eh(e){if($(e.document)&&$(e.document.source)){let t=Ua($(e.document)&&g(e.document.format)?e.document.format:"");if($(e.document.source)){if($(e.document.source.s3Location)&&g(e.document.source.s3Location.uri))return{type:"file",mimeType:t,fileId:e.document.source.s3Location.uri};if(qn(e.document.source.bytes))return{type:"file",mimeType:t,data:e.document.source.bytes};if(g(e.document.source.text))return{type:"file",mimeType:t,data:Buffer.from(e.document.source.text).toString("base64")};if(de(e.document.source.content))return{type:"file",mimeType:t,data:e.document.source.content.reduce((r,n)=>$(n)&&g(n.text)?r+n.text:r,"")}}}return{type:"non_standard",value:e}}function th(e){if(S(e,"image")&&$(e.image)){let t=Ua($(e.image)&&g(e.image.format)?e.image.format:"");if($(e.image.source)){if($(e.image.source.s3Location)&&g(e.image.source.s3Location.uri))return{type:"image",mimeType:t,fileId:e.image.source.s3Location.uri};if(qn(e.image.source.bytes))return{type:"image",mimeType:t,data:e.image.source.bytes}}}return{type:"non_standard",value:e}}function rh(e){if(S(e,"video")&&$(e.video)){let t=Ua($(e.video)&&g(e.video.format)?e.video.format:"");if($(e.video.source)){if($(e.video.source.s3Location)&&g(e.video.source.s3Location.uri))return{type:"video",mimeType:t,fileId:e.video.source.s3Location.uri};if(qn(e.video.source.bytes))return{type:"video",mimeType:t,data:e.video.source.bytes}}}return{type:"non_standard",value:e}}function nl(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"reasoning")&&g(n.reasoning)){yield{...n,type:"reasoning",reasoning:n.reasoning};continue}else if(S(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(S(n,"citations_content")&&$(n.citationsContent)){yield{type:"text",text:de(n.citationsContent.content)?n.citationsContent.content.reduce((i,a)=>$(a)&&g(a.text)?i+a.text:i,""):"",annotations:de(n.citationsContent.citations)?n.citationsContent.citations.reduce((i,a)=>{if($(a)){let s=de(a.sourceContent)?a.sourceContent.reduce((c,l)=>$(l)&&g(l.text)?c+l.text:c,""):"",o=Ue(()=>{if($(a.location)){let c=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if($(c))return{source:De(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:De(c.start)?c.start:void 0,endIndex:De(c.end)?c.end:void 0}}return{}});i.push({type:"citation",citedText:s,...o})}return i},[]):[]};continue}else if(S(n,"document")&&$(n.document)){yield eh(n);continue}else if(S(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(S(n,"image")&&$(n.image)){yield th(n);continue}else if(S(n,"reasoning_content")&&$(n.reasoningText)&&g(n.reasoningText.text)){yield{type:"reasoning",reasoning:n.reasoningText.text,...g(n.reasoningText.signature)?{signature:n.reasoningText.signature}:{}};continue}else if(S(n,"reasoning_content")&&g(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(S(n,"text")&&g(n.text)){yield{type:"text",text:n.text};continue}else if(S(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(S(n,"tool_call"))continue;if(S(n,"video")&&$(n.video)){yield rh(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var il={translateContent:nl,translateContentChunk:nl};function al(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var sl={translateContent:al,translateContentChunk:al};function ol(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"text")&&g(n.text)){yield{type:"text",text:n.text};continue}else if(S(n,"thinking")&&g(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(S(n,"inlineData")&&$(n.inlineData)&&g(n.inlineData.mimeType)&&g(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(S(n,"functionCall")&&$(n.functionCall)&&g(n.functionCall.name)&&$(n.functionCall.args)){yield{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(S(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(S(n,"fileData")&&$(n.fileData)&&g(n.fileData.mimeType)&&g(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(S(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(S(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(t())}var cl={translateContent:ol,translateContentChunk:ol};function ll(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"reasoning")&&g(n.reasoning)){let i=Ue(()=>{let a=r.indexOf(n);if(de(e.additional_kwargs?.signatures)&&a>=0)return e.additional_kwargs.signatures.at(a)});g(i)?yield{type:"reasoning",reasoning:n.reasoning,signature:i}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(S(n,"thinking")&&g(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(S(n,"text")&&g(n.text)){yield{type:"text",text:n.text};continue}else if(S(n,"image_url")){if(g(n.image_url))if(n.image_url.startsWith("data:")){let i=n.image_url.match(/^data:([^;]+);base64,(.+)$/);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(S(n,"media")&&g(n.mimeType)&&g(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}}return Array.from(t())}var ul={translateContent:ll,translateContentChunk:ll};function dl(e){let t=[],r=e.additional_kwargs?.reasoning;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string"){let n=e.content,i=n.match(/<think>([\s\S]*?)<\/think>/);if(i){let a=i[1].trim();a.length>0&&t.push({type:"reasoning",reasoning:a}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&t.push({type:"text",text:n})}else for(let n of e.content)if(typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)){let i=n.text,a=i.match(/<think>([\s\S]*?)<\/think>/);if(a){let s=a[1].trim();s.length>0&&t.push({type:"reasoning",reasoning:s}),i=i.replace(/<think>[\s\S]*?<\/think>/,"").trim()}i.length>0&&t.push({type:"text",text:i})}for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var fl={translateContent:dl,translateContentChunk:dl};function pl(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var hl={translateContent:pl,translateContentChunk:pl};function ml(e){let t=[],r=e.additional_kwargs?.reasoning_details,n=!1;if(Array.isArray(r)&&r.length>0)for(let i of r){if(i==null||typeof i!="object")continue;let a=i.type;if(a==="reasoning.summary"){let s=i.summary;g(s)&&s.length>0&&(t.push({type:"reasoning",reasoning:s}),n=!0)}else if(a==="reasoning.text"){let s=i.text;g(s)&&s.length>0&&(t.push({type:"reasoning",reasoning:s}),n=!0)}}if(!n){let i=e.additional_kwargs?.reasoning_content;g(i)&&i.length>0&&t.push({type:"reasoning",reasoning:i})}if(typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let i of e.content)typeof i=="object"&&"type"in i&&i.type==="text"&&"text"in i&&g(i.text)&&t.push({type:"text",text:i.text});for(let i of e.tool_calls??[])t.push({type:"tool_call",id:i.id,name:i.name,args:i.args});return t}var gl={translateContent:ml,translateContentChunk:ml};function _l(e){let t=[];if($(e.additional_kwargs?.reasoning)){let n=e.additional_kwargs.reasoning;if(de(n.summary)){let i=n.summary.reduce((a,s)=>$(s)&&g(s.text)?`${a}${s.text}`:a,"");i.length>0&&t.push({type:"reasoning",reasoning:i})}}let r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var yl={translateContent:_l,translateContentChunk:_l};function wl(e){function*t(){let r=Ue(()=>{if(typeof e.content=="string")return e.additional_kwargs.originalTextContentBlock?[{...e.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:e.content}];{let n=e.additional_kwargs?.originalTextContentBlock;if(n?.thoughtSignature&&!e.content.some(i=>"thoughtSignature"in i)){let i=[...e.content];for(let a=i.length-1;a>=0;a--){let s=i[a];if(s.type==="text"&&!s.thought)return s.thoughtSignature=n.thoughtSignature,i}}return e.content}});for(let n of r){let i=Ue(()=>S(n,"text")&&g(n.text)?{type:"text",text:n.text}:S(n,"inlineData")&&$(n.inlineData)&&g(n.inlineData.mimeType)&&g(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:S(n,"functionCall")&&$(n.functionCall)&&g(n.functionCall.name)&&$(n.functionCall.args)?{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:S(n,"functionResponse")?{type:"non_standard",value:n}:S(n,"fileData")&&$(n.fileData)&&g(n.fileData.mimeType)&&g(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:S(n,"executableCode")?{type:"non_standard",value:n}:S(n,"codeExecutionResult")?{type:"non_standard",value:n}:{type:"non_standard",value:n}),a=Ue(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:i.type==="text"?i.text:"",reasoningContentBlock:i}:i),s={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...a};for(let o in s)s[o]===void 0&&delete s[o];yield s}}return Array.from(t())}var bl={translateContent:wl,translateContentChunk:wl};globalThis.lc_block_translators_registry??=new Map([["anthropic",zc],["bedrock-converse",il],["deepseek",sl],["google",bl],["google-genai",cl],["google-vertexai",ul],["groq",fl],["ollama",hl],["openai",Vc],["openrouter",gl],["xai",yl]]);function za(e){return globalThis.lc_block_translators_registry.get(e)}function vl(e,t){return ce(e,t)??{}}function xl(e,t){let r={};return(e?.audio!==void 0||t?.audio!==void 0)&&(r.audio=(e?.audio??0)+(t?.audio??0)),(e?.image!==void 0||t?.image!==void 0)&&(r.image=(e?.image??0)+(t?.image??0)),(e?.video!==void 0||t?.video!==void 0)&&(r.video=(e?.video??0)+(t?.video??0)),(e?.document!==void 0||t?.document!==void 0)&&(r.document=(e?.document??0)+(t?.document??0)),(e?.text!==void 0||t?.text!==void 0)&&(r.text=(e?.text??0)+(t?.text??0)),r}function nh(e,t){let r={...xl(e,t)};return(e?.cache_read!==void 0||t?.cache_read!==void 0)&&(r.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),(e?.cache_creation!==void 0||t?.cache_creation!==void 0)&&(r.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),r}function ih(e,t){let r={...xl(e,t)};return(e?.reasoning!==void 0||t?.reasoning!==void 0)&&(r.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),r}function Jn(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:nh(e?.input_token_details,t?.input_token_details),output_token_details:ih(e?.output_token_details,t?.output_token_details)}}function El(e){let t=Symbol.for(e);return{brand(r,n){let i=n?Symbol.for(`${e}.${n}`):t;class a extends r{[i]=!0;constructor(...o){super(...o)}static isInstance(o){return typeof o=="object"&&o!==null&&i in o&&o[i]===!0}static[Symbol.hasInstance](o){return this.isInstance(o)}}return Object.defineProperty(a,"name",{value:r.name}),a},sub(r){return El(`${e}.${r}`)},isInstance(r){return typeof r=="object"&&r!==null&&t in r&&r[t]===!0}}}var Sl=El("langchain");var h0=L({ContextOverflowError:()=>sh,LangChainError:()=>Ha,ModelAbortError:()=>ah,addLangChainErrorFields:()=>Ba,getRetryable:()=>Fa,ns:()=>Kn,stampRetryable:()=>At});function Ba(e,t){return e.lc_error_code=t,e.message=`${e.message}
7
+ Right ${t}`)}}var ze=class el extends Ie{static isInstance(t){if(!super.isInstance(t))return!1;let r=Object.getPrototypeOf(t);for(;r!==null;){if(r===el.prototype)return!0;r=Object.getPrototypeOf(r)}return!1}static[Symbol.hasInstance](t){return this.isInstance(t)}};function tl(e){return typeof e.role=="string"}function rl(e){return typeof e?._getType=="function"}function Sb(e){return ze.isInstance(e)}var Cb=L({ToolMessage:()=>er,ToolMessageChunk:()=>Yp,defaultToolCallParser:()=>Da,isDirectToolOutput:()=>La,isToolMessage:()=>Xp,isToolMessageChunk:()=>Qp});function La(e){return e!=null&&typeof e=="object"&&"lc_direct_tool_output"in e&&e.lc_direct_tool_output===!0}var er=class extends Ie{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(e,t,r){let n=typeof e=="string"||Array.isArray(e)?{content:e,name:r,tool_call_id:t}:e;super(n),this.tool_call_id=n.tool_call_id,this.artifact=n.artifact,this.status=n.status,this.metadata=n.metadata}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},Yp=class extends ze{type="tool";tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){let t=this.constructor;return new t({content:Pe(this.content,e.content),additional_kwargs:ce(this.additional_kwargs,e.additional_kwargs),response_metadata:ce(this.response_metadata,e.response_metadata),artifact:Qc(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:Xc(this.status,e.status)})}static isInstance(e){return super.isInstance(e)&&e.type==="tool"}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};function Da(e){let t=[],r=[];for(let n of e)if(n.function){let i=n.function.name;try{let a=JSON.parse(n.function.arguments);t.push({name:i||"",args:a||{},id:n.id})}catch{r.push({name:i,args:n.function.arguments,id:n.id,error:"Malformed args."})}}else continue;return[t,r]}function Xp(e){return typeof e=="object"&&e!==null&&"getType"in e&&typeof e.getType=="function"&&e.getType()==="tool"}function Qp(e){return e._getType()==="tool"}function Ua(e){switch(e){case"csv":return"text/csv";case"doc":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":return"image/jpeg";case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function eh(e){if($(e.document)&&$(e.document.source)){let t=Ua($(e.document)&&g(e.document.format)?e.document.format:"");if($(e.document.source)){if($(e.document.source.s3Location)&&g(e.document.source.s3Location.uri))return{type:"file",mimeType:t,fileId:e.document.source.s3Location.uri};if(qn(e.document.source.bytes))return{type:"file",mimeType:t,data:e.document.source.bytes};if(g(e.document.source.text))return{type:"file",mimeType:t,data:Buffer.from(e.document.source.text).toString("base64")};if(de(e.document.source.content))return{type:"file",mimeType:t,data:e.document.source.content.reduce((r,n)=>$(n)&&g(n.text)?r+n.text:r,"")}}}return{type:"non_standard",value:e}}function th(e){if(S(e,"image")&&$(e.image)){let t=Ua($(e.image)&&g(e.image.format)?e.image.format:"");if($(e.image.source)){if($(e.image.source.s3Location)&&g(e.image.source.s3Location.uri))return{type:"image",mimeType:t,fileId:e.image.source.s3Location.uri};if(qn(e.image.source.bytes))return{type:"image",mimeType:t,data:e.image.source.bytes}}}return{type:"non_standard",value:e}}function rh(e){if(S(e,"video")&&$(e.video)){let t=Ua($(e.video)&&g(e.video.format)?e.video.format:"");if($(e.video.source)){if($(e.video.source.s3Location)&&g(e.video.source.s3Location.uri))return{type:"video",mimeType:t,fileId:e.video.source.s3Location.uri};if(qn(e.video.source.bytes))return{type:"video",mimeType:t,data:e.video.source.bytes}}}return{type:"non_standard",value:e}}function nl(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"reasoning")&&g(n.reasoning)){yield{...n,type:"reasoning",reasoning:n.reasoning};continue}else if(S(n,"cache_point")){yield{type:"non_standard",value:n};continue}else if(S(n,"citations_content")&&$(n.citationsContent)){yield{type:"text",text:de(n.citationsContent.content)?n.citationsContent.content.reduce((i,a)=>$(a)&&g(a.text)?i+a.text:i,""):"",annotations:de(n.citationsContent.citations)?n.citationsContent.citations.reduce((i,a)=>{if($(a)){let s=de(a.sourceContent)?a.sourceContent.reduce((c,l)=>$(l)&&g(l.text)?c+l.text:c,""):"",o=Ue(()=>{if($(a.location)){let c=a.location.documentChar||a.location.documentPage||a.location.documentChunk;if($(c))return{source:De(c.documentIndex)?c.documentIndex.toString():void 0,startIndex:De(c.start)?c.start:void 0,endIndex:De(c.end)?c.end:void 0}}return{}});i.push({type:"citation",citedText:s,...o})}return i},[]):[]};continue}else if(S(n,"document")&&$(n.document)){yield eh(n);continue}else if(S(n,"guard_content")){yield{type:"non_standard",value:n};continue}else if(S(n,"image")&&$(n.image)){yield th(n);continue}else if(S(n,"reasoning_content")&&$(n.reasoningText)&&g(n.reasoningText.text)){yield{type:"reasoning",reasoning:n.reasoningText.text,...g(n.reasoningText.signature)?{signature:n.reasoningText.signature}:{}};continue}else if(S(n,"reasoning_content")&&g(n.reasoningText)){yield{type:"reasoning",reasoning:n.reasoningText};continue}else if(S(n,"text")&&g(n.text)){yield{type:"text",text:n.text};continue}else if(S(n,"tool_result")){yield{type:"non_standard",value:n};continue}else{if(S(n,"tool_call"))continue;if(S(n,"video")&&$(n.video)){yield rh(n);continue}}yield{type:"non_standard",value:n}}}return Array.from(t())}var il={translateContent:nl,translateContentChunk:nl};function al(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var sl={translateContent:al,translateContentChunk:al};function ol(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"text")&&g(n.text)){yield{type:"text",text:n.text};continue}else if(S(n,"thinking")&&g(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(S(n,"inlineData")&&$(n.inlineData)&&g(n.inlineData.mimeType)&&g(n.inlineData.data)){yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data};continue}else if(S(n,"functionCall")&&$(n.functionCall)&&g(n.functionCall.name)&&$(n.functionCall.args)){yield{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args};continue}else if(S(n,"functionResponse")){yield{type:"non_standard",value:n};continue}else if(S(n,"fileData")&&$(n.fileData)&&g(n.fileData.mimeType)&&g(n.fileData.fileUri)){yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri};continue}else if(S(n,"executableCode")){yield{type:"non_standard",value:n};continue}else if(S(n,"codeExecutionResult")){yield{type:"non_standard",value:n};continue}yield{type:"non_standard",value:n}}}return Array.from(t())}var cl={translateContent:ol,translateContentChunk:ol};function ll(e){function*t(){let r=typeof e.content=="string"?[{type:"text",text:e.content}]:e.content;for(let n of r){if(S(n,"reasoning")&&g(n.reasoning)){let i=Ue(()=>{let a=r.indexOf(n);if(de(e.additional_kwargs?.signatures)&&a>=0)return e.additional_kwargs.signatures.at(a)});g(i)?yield{type:"reasoning",reasoning:n.reasoning,signature:i}:yield{type:"reasoning",reasoning:n.reasoning};continue}else if(S(n,"thinking")&&g(n.thinking)){yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};continue}else if(S(n,"text")&&g(n.text)){if(n.text==="")continue;yield{type:"text",text:n.text};continue}else if(S(n,"image_url")){if(g(n.image_url))if(n.image_url.startsWith("data:")){let i=n.image_url.match(/^data:([^;]+);base64,(.+)$/);i?yield{type:"image",data:i[2],mimeType:i[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url};continue}else if(S(n,"media")&&g(n.mimeType)&&g(n.data)){yield{type:"file",mimeType:n.mimeType,data:n.data};continue}yield{type:"non_standard",value:n}}for(let n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args}}return Array.from(t())}var ul={translateContent:ll,translateContentChunk:ll};function dl(e){let t=[],r=e.additional_kwargs?.reasoning;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string"){let n=e.content,i=n.match(/<think>([\s\S]*?)<\/think>/);if(i){let a=i[1].trim();a.length>0&&t.push({type:"reasoning",reasoning:a}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&t.push({type:"text",text:n})}else for(let n of e.content)if(typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)){let i=n.text,a=i.match(/<think>([\s\S]*?)<\/think>/);if(a){let s=a[1].trim();s.length>0&&t.push({type:"reasoning",reasoning:s}),i=i.replace(/<think>[\s\S]*?<\/think>/,"").trim()}i.length>0&&t.push({type:"text",text:i})}for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var fl={translateContent:dl,translateContentChunk:dl};function pl(e){let t=[],r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var hl={translateContent:pl,translateContentChunk:pl};function ml(e){let t=[],r=e.additional_kwargs?.reasoning_details,n=!1;if(Array.isArray(r)&&r.length>0)for(let i of r){if(i==null||typeof i!="object")continue;let a=i.type;if(a==="reasoning.summary"){let s=i.summary;g(s)&&s.length>0&&(t.push({type:"reasoning",reasoning:s}),n=!0)}else if(a==="reasoning.text"){let s=i.text;g(s)&&s.length>0&&(t.push({type:"reasoning",reasoning:s}),n=!0)}}if(!n){let i=e.additional_kwargs?.reasoning_content;g(i)&&i.length>0&&t.push({type:"reasoning",reasoning:i})}if(typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let i of e.content)typeof i=="object"&&"type"in i&&i.type==="text"&&"text"in i&&g(i.text)&&t.push({type:"text",text:i.text});for(let i of e.tool_calls??[])t.push({type:"tool_call",id:i.id,name:i.name,args:i.args});return t}var gl={translateContent:ml,translateContentChunk:ml};function _l(e){let t=[];if($(e.additional_kwargs?.reasoning)){let n=e.additional_kwargs.reasoning;if(de(n.summary)){let i=n.summary.reduce((a,s)=>$(s)&&g(s.text)?`${a}${s.text}`:a,"");i.length>0&&t.push({type:"reasoning",reasoning:i})}}let r=e.additional_kwargs?.reasoning_content;if(g(r)&&r.length>0&&t.push({type:"reasoning",reasoning:r}),typeof e.content=="string")e.content.length>0&&t.push({type:"text",text:e.content});else for(let n of e.content)typeof n=="object"&&"type"in n&&n.type==="text"&&"text"in n&&g(n.text)&&t.push({type:"text",text:n.text});for(let n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}var yl={translateContent:_l,translateContentChunk:_l};function wl(e){function*t(){let r=Ue(()=>{if(typeof e.content=="string")return e.additional_kwargs.originalTextContentBlock?[{...e.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:e.content}];{let n=e.additional_kwargs?.originalTextContentBlock;if(n?.thoughtSignature&&!e.content.some(i=>"thoughtSignature"in i)){let i=[...e.content];for(let a=i.length-1;a>=0;a--){let s=i[a];if(s.type==="text"&&!s.thought)return s.thoughtSignature=n.thoughtSignature,i}}return e.content}});for(let n of r){let i=Ue(()=>S(n,"text")&&g(n.text)?{type:"text",text:n.text}:S(n,"inlineData")&&$(n.inlineData)&&g(n.inlineData.mimeType)&&g(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:S(n,"functionCall")&&$(n.functionCall)&&g(n.functionCall.name)&&$(n.functionCall.args)?{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:S(n,"functionResponse")?{type:"non_standard",value:n}:S(n,"fileData")&&$(n.fileData)&&g(n.fileData.mimeType)&&g(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:S(n,"executableCode")?{type:"non_standard",value:n}:S(n,"codeExecutionResult")?{type:"non_standard",value:n}:{type:"non_standard",value:n}),a=Ue(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:i.type==="text"?i.text:"",reasoningContentBlock:i}:i),s={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...a};for(let o in s)s[o]===void 0&&delete s[o];yield s}}return Array.from(t())}var bl={translateContent:wl,translateContentChunk:wl};globalThis.lc_block_translators_registry??=new Map([["anthropic",zc],["bedrock-converse",il],["deepseek",sl],["google",bl],["google-genai",cl],["google-vertexai",ul],["groq",fl],["ollama",hl],["openai",Vc],["openrouter",gl],["xai",yl]]);function za(e){return globalThis.lc_block_translators_registry.get(e)}function vl(e,t){return ce(e,t)??{}}function xl(e,t){let r={};return(e?.audio!==void 0||t?.audio!==void 0)&&(r.audio=(e?.audio??0)+(t?.audio??0)),(e?.image!==void 0||t?.image!==void 0)&&(r.image=(e?.image??0)+(t?.image??0)),(e?.video!==void 0||t?.video!==void 0)&&(r.video=(e?.video??0)+(t?.video??0)),(e?.document!==void 0||t?.document!==void 0)&&(r.document=(e?.document??0)+(t?.document??0)),(e?.text!==void 0||t?.text!==void 0)&&(r.text=(e?.text??0)+(t?.text??0)),r}function nh(e,t){let r={...xl(e,t)};return(e?.cache_read!==void 0||t?.cache_read!==void 0)&&(r.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),(e?.cache_creation!==void 0||t?.cache_creation!==void 0)&&(r.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),r}function ih(e,t){let r={...xl(e,t)};return(e?.reasoning!==void 0||t?.reasoning!==void 0)&&(r.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),r}function Jn(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:nh(e?.input_token_details,t?.input_token_details),output_token_details:ih(e?.output_token_details,t?.output_token_details)}}function El(e){let t=Symbol.for(e);return{brand(r,n){let i=n?Symbol.for(`${e}.${n}`):t;class a extends r{[i]=!0;constructor(...o){super(...o)}static isInstance(o){return typeof o=="object"&&o!==null&&i in o&&o[i]===!0}static[Symbol.hasInstance](o){return this.isInstance(o)}}return Object.defineProperty(a,"name",{value:r.name}),a},sub(r){return El(`${e}.${r}`)},isInstance(r){return typeof r=="object"&&r!==null&&t in r&&r[t]===!0}}}var Sl=El("langchain");var h0=L({ContextOverflowError:()=>sh,LangChainError:()=>Ha,ModelAbortError:()=>ah,addLangChainErrorFields:()=>Ba,getRetryable:()=>Fa,ns:()=>Kn,stampRetryable:()=>At});function Ba(e,t){return e.lc_error_code=t,e.message=`${e.message}
8
8
 
9
9
  Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${t}/
10
10
  `,e}var Kn=Sl.sub("error"),Tl=Symbol.for("langchain.errors.retryable");function At(e,t){if(typeof e!="object"||e===null)return e;try{Object.defineProperty(e,Tl,{value:t,configurable:!0})}catch{}return e}function Fa(e){if(!(typeof e!="object"||e===null))return Object.getOwnPropertyDescriptor(e,Tl)?.value}var Ha=class extends Kn.brand(Error){name="LangChainError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},ah=class extends Kn.brand(Ha,"model-abort"){name="ModelAbortError";partialOutput;constructor(e,t){super(e),this.partialOutput=t,At(this,!1)}},sh=class Al extends Kn.brand(Ha,"context-overflow"){name="ContextOverflowError";cause;constructor(t){super(t??"Input exceeded the model's context window."),At(this,!1)}static fromError(t){let r=new Al(t.message);return r.cause=t,r}};function $t(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="tool_call")}function Il(e){return!!(e&&typeof e=="object"&&"toolCall"in e&&e.toolCall!=null&&typeof e.toolCall=="object"&&"id"in e.toolCall&&typeof e.toolCall.id=="string")}var $r=class extends Error{output;constructor(e,t){super(e),this.output=t}};function b0(e,t=Ga){e=e.trim();let r=e.indexOf("```");if(r===-1)return t(e);let n=e.substring(r+3);n.startsWith(`json
@@ -172,7 +172,7 @@ data: ${JSON.stringify(i)}
172
172
 
173
173
  `)),n.close()}});return Re.fromReadableStream(r)}function ge(e,t){return e&&!Array.isArray(e)&&!(e instanceof Date)&&typeof e=="object"?e:{[t]:e}}var _e=class extends ft{lc_runnable=!0;name;getName(e){let t=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${t}${e}`:t}withRetry(e){return new lp({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new pa({bound:this,config:e,kwargs:{}})}withFallbacks(e){let t=Array.isArray(e)?e:e.fallbacks;return new gw({runnable:this,fallbacks:t})}_getOptionsList(e,t=0){if(Array.isArray(e)&&e.length!==t)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${t} inputs`);if(Array.isArray(e))return e.map(Y);if(t>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");let r=Object.fromEntries(Object.entries(e).filter(([n])=>n!=="runId"));return Array.from({length:t},(n,i)=>Y(i===0?e:r))}return Array.from({length:t},()=>Y(e))}async batch(e,t,r){let n=this._getOptionsList(t??{},e.length),i=new Ir({maxConcurrency:n[0]?.maxConcurrency??r?.maxConcurrency,onFailedAttempt:s=>{throw s}}),a=e.map((s,o)=>i.call(async()=>{try{return await this.invoke(s,n[o])}catch(c){if(r?.returnExceptions)return c;throw c}}));return Promise.all(a)}async*_streamIterator(e,t){yield this.invoke(e,t)}async stream(e,t){let r=Y(t),n=new Jt({generator:this._streamIterator(e,r),config:r});return await n.setup,Re.fromAsyncGenerator(n)}_separateRunnableConfigFromCallOptions(e){let t;e===void 0?t=Y(e):t=Y({callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});let r={...e};return delete r.callbacks,delete r.tags,delete r.metadata,delete r.runName,delete r.configurable,delete r.recursionLimit,delete r.maxConcurrency,delete r.runId,delete r.timeout,delete r.signal,[t,r]}async _callWithConfig(e,t,r){let n=Y(r),i=await(await qe(n))?.handleChainStart(this.toJSON(),ge(t,"input"),n.runId,n?.runType,void 0,void 0,n?.runName??this.getName());delete n.runId;let a;try{a=await it(e.call(this,t,n,i),n.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(ge(a,"output")),a}async _batchWithConfig(e,t,r,n){let i=this._getOptionsList(r??{},t.length),a=await Promise.all(i.map(qe)),s=await Promise.all(a.map(async(c,l)=>{let u=await c?.handleChainStart(this.toJSON(),ge(t[l],"input"),i[l].runId,i[l].runType,void 0,void 0,i[l].runName??this.getName());return delete i[l].runId,u})),o;try{o=await it(e.call(this,t,i,s,n),i?.[0]?.signal)}catch(c){throw await Promise.all(s.map(l=>l?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(ge(o,"output")))),o}_concatOutputChunks(e,t){return ia(e,t)}async*_transformStreamWithConfig(e,t,r){let n,i=!0,a,s=!0,o=Y(r),c=await qe(o),l=this;async function*u(){for await(let f of e){if(i)if(n===void 0)n=f;else try{n=l._concatOutputChunks(n,f)}catch{n=void 0,i=!1}yield f}}let d;try{let f=await ec(t.bind(this),u(),async()=>c?.handleChainStart(this.toJSON(),{input:""},o.runId,o.runType,void 0,void 0,o.runName??this.getName(),void 0,{lc_defers_inputs:!0}),o.signal,o);delete o.runId,d=f.setup;let p=d?.handlers.find(Kf),h=f.output;p!==void 0&&d!==void 0&&(h=p.tapOutputIterable(d.runId,h));let m=d?.handlers.find(nc);m!==void 0&&d!==void 0&&(h=m.tapOutputIterable(d.runId,h));for await(let b of h)if(yield b,s)if(a===void 0)a=b;else try{a=this._concatOutputChunks(a,b)}catch{a=void 0,s=!1}}catch(f){throw await d?.handleChainError(f,void 0,void 0,void 0,{inputs:ge(n,"input")}),f}await d?.handleChainEnd(a??{},void 0,void 0,void 0,{inputs:ge(n,"input")})}getGraph(e){let t=new fa,r=t.addNode({name:`${this.getName()}Input`,schema:vt.any()}),n=t.addNode(this),i=t.addNode({name:`${this.getName()}Output`,schema:vt.any()});return t.addEdge(r,n),t.addEdge(n,i),t}pipe(e){return new up({first:this,last:Or(e)})}pick(e){return this.pipe(new yw(e))}assign(e){return this.pipe(new _w(new ha({steps:e})))}async*transform(e,t){let r;for await(let n of e)r===void 0?r=n:r=this._concatOutputChunks(r,n);yield*this._streamIterator(r,Y(t))}async*streamLog(e,t,r){let n=new ua({...r,autoClose:!1,_schemaFormat:"original"}),i=Y(t);yield*this._streamLog(e,n,i)}async*_streamLog(e,t,r){let{callbacks:n}=r;if(n===void 0)r.callbacks=[t];else if(Array.isArray(n))r.callbacks=n.concat([t]);else{let o=n.copy();o.addHandler(t,!0),r.callbacks=o}let i=this.stream(e,r);async function a(){try{let o=await i;for await(let c of o){let l=new Et({ops:[{op:"add",path:"/streamed_output/-",value:c}]});await t.writer.write(l)}}finally{await t.writer.close()}}let s=a();try{for await(let o of t)yield o}finally{await s}}streamEvents(e,t,r){let n;if(t.version==="v1")n=this._streamEventsV1(e,t,r);else if(t.version==="v2")n=this._streamEventsV2(e,t,r);else throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');return t.encoding==="text/event-stream"?ap(n):Re.fromAsyncGenerator(n)}async*_streamEventsV2(e,t,r){let n=new Yf({...r,autoClose:!1}),i=Y(t),a=i.runId??Ge();i.runId=a;let s=i.callbacks;if(s===void 0)i.callbacks=[n];else if(Array.isArray(s))i.callbacks=s.concat(n);else{let p=s.copy();p.addHandler(n,!0),i.callbacks=p}let o=new AbortController,c=this;async function l(){let p;try{if(i.signal)if("any"in AbortSignal)p=AbortSignal.any([o.signal,i.signal]);else{let b=new AbortController;i.signal.addEventListener("abort",()=>b.abort(),{once:!0}),o.signal.addEventListener("abort",()=>b.abort(),{once:!0}),p=b.signal}else p=o.signal;let h=await c.stream(e,{...i,signal:p}),m=n.tapOutputIterable(a,h);for await(let b of m)if(o.signal.aborted)break}finally{await n.finish()}}let u=l(),d=!1,f;try{for await(let p of n){if(!d){p.data.input=e,d=!0,f=p.run_id,yield p;continue}p.run_id===f&&p.event.endsWith("_end")&&p.data?.input&&delete p.data.input,yield p}}finally{o.abort(),await u}}async*_streamEventsV1(e,t,r){let n,i=!1,a=Y(t),s=a.tags??[],o=a.metadata??{},c=a.runName??this.getName(),l=new ua({...r,autoClose:!1,_schemaFormat:"streaming_events"}),u=new Xf({...r}),d=this._streamLog(e,l,a);for await(let p of d){if(n?n=n.concat(p):n=la.fromRunLogPatch(p),n.state===void 0)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;let v={...n.state},x={run_id:v.id,event:`on_${v.type}_start`,name:c,tags:s,metadata:o,data:{input:e}};u.includeEvent(x,v.type)&&(yield x)}let h=p.ops.filter(v=>v.path.startsWith("/logs/")).map(v=>v.path.split("/")[2]),m=[...new Set(h)];for(let v of m){let x,I={},k=n.state.logs[v];if(k.end_time===void 0?k.streamed_output.length>0?x="stream":x="start":x="end",x==="start")k.inputs!==void 0&&(I.input=k.inputs);else if(x==="end")k.inputs!==void 0&&(I.input=k.inputs),I.output=k.final_output;else if(x==="stream"){let j=k.streamed_output.length;if(j!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${j} instead. Encountered in: "${k.name}"`);I={chunk:k.streamed_output[0]},k.streamed_output=[]}yield{event:`on_${k.type}_${x}`,name:k.name,run_id:k.id,tags:k.tags,metadata:k.metadata,data:I}}let{state:b}=n;if(b.streamed_output.length>0){let v=b.streamed_output.length;if(v!==1)throw new Error(`Expected exactly one chunk of streamed output, got ${v} instead. Encountered in: "${b.name}"`);let x={chunk:b.streamed_output[0]};b.streamed_output=[];let I={event:`on_${b.type}_stream`,run_id:b.id,tags:s,metadata:o,name:c,data:x};u.includeEvent(I,b.type)&&(yield I)}}let f=n?.state;if(f!==void 0){let p={event:`on_${f.type}_end`,name:c,run_id:f.id,tags:s,metadata:o,data:{output:f.final_output}};u.includeEvent(p,f.type)&&(yield p)}}static isRunnable(e){return Pn(e)}withListeners({onStart:e,onEnd:t,onError:r}){return new pa({bound:this,config:{},configFactories:[n=>({callbacks:[new ic({config:n,onStart:e,onEnd:t,onError:r})]})]})}asTool(e){return ww(this,e)}},pa=class op extends _e{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(t){super(t),this.bound=t.bound,this.kwargs=t.kwargs,this.config=t.config,this.configFactories=t.configFactories}getName(t){return this.bound.getName(t)}async _mergeConfig(...t){let r=xn(this.config,...t);return xn(r,...this.configFactories?await Promise.all(this.configFactories.map(async n=>await n(r))):[])}withConfig(t){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...t}})}withRetry(t){return new lp({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:t?.stopAfterAttempt,...t})}async invoke(t,r){return this.bound.invoke(t,await this._mergeConfig(r,this.kwargs))}async batch(t,r,n){let i=Array.isArray(r)?await Promise.all(r.map(async a=>this._mergeConfig(Y(a),this.kwargs))):await this._mergeConfig(Y(r),this.kwargs);return this.bound.batch(t,i,n)}_concatOutputChunks(t,r){return this.bound._concatOutputChunks(t,r)}async*_streamIterator(t,r){yield*this.bound._streamIterator(t,await this._mergeConfig(Y(r),this.kwargs))}async stream(t,r){return this.bound.stream(t,await this._mergeConfig(Y(r),this.kwargs))}async*transform(t,r){yield*this.bound.transform(t,await this._mergeConfig(Y(r),this.kwargs))}streamEvents(t,r,n){let i=this,a=async function*(){yield*i.bound.streamEvents(t,{...await i._mergeConfig(Y(r),i.kwargs),version:r.version},n)};return Re.fromAsyncGenerator(a())}static isRunnableBinding(t){return t.bound&&_e.isRunnable(t.bound)}withListeners({onStart:t,onEnd:r,onError:n}){return new op({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[i=>({callbacks:[new ic({config:i,onStart:t,onEnd:r,onError:n})]})]})}},IR=class cp extends _e{static lc_name(){return"RunnableEach"}lc_serializable=!0;lc_namespace=["langchain_core","runnables"];bound;constructor(t){super(t),this.bound=t.bound}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async _invoke(t,r,n){return this.bound.batch(t,ue(r,{callbacks:n?.getChild()}))}withListeners({onStart:t,onEnd:r,onError:n}){return new cp({bound:this.bound.withListeners({onStart:t,onEnd:r,onError:n})})}},lp=class extends pa{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,r){let n=e>1?`retry:attempt:${e}`:void 0;return ue(t,{callbacks:r?.getChild(n)})}async _invoke(e,t,r){return On(n=>super.invoke(e,this._patchConfigForRetry(n,t,r)),{onFailedAttempt:({error:n})=>this.onFailedAttempt(n,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,r,n){let i={};try{await On(async a=>{let s=e.map((d,f)=>f).filter(d=>i[d.toString()]===void 0||i[d.toString()]instanceof Error),o=s.map(d=>e[d]),c=s.map(d=>this._patchConfigForRetry(a,t?.[d],r?.[d])),l=await super.batch(o,c,{...n,returnExceptions:!0}),u;for(let d=0;d<l.length;d+=1){let f=l[d],p=s[d];f instanceof Error&&u===void 0&&(u=f,u.input=o[d]),i[p.toString()]=f}if(u)throw u;return l},{onFailedAttempt:({error:a})=>this.onFailedAttempt(a,a.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(n?.returnExceptions!==!0)throw a}return Object.keys(i).sort((a,s)=>parseInt(a,10)-parseInt(s,10)).map(a=>i[parseInt(a,10)])}async batch(e,t,r){return this._batchWithConfig(this._batch.bind(this),e,t,r)}},up=class Mn extends _e{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(t){super(t),this.first=t.first,this.middle=t.middle??this.middle,this.last=t.last,this.name=t.name,this.omitSequenceTags=t.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(t,r){let n=Y(r),i=await(await qe(n))?.handleChainStart(this.toJSON(),ge(t,"input"),n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a=t,s;try{let o=[this.first,...this.middle];for(let c=0;c<o.length;c+=1)a=await it(o[c].invoke(a,ue(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`)})),n.signal);if(n.signal?.aborted)throw Ht(n.signal);s=await this.last.invoke(a,ue(n,{callbacks:i?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(o){throw await i?.handleChainError(o),o}return await i?.handleChainEnd(ge(s,"output")),s}async batch(t,r,n){let i=this._getOptionsList(r??{},t.length),a=await Promise.all(i.map(qe)),s=await Promise.all(a.map(async(c,l)=>{let u=await c?.handleChainStart(this.toJSON(),ge(t[l],"input"),i[l].runId,void 0,void 0,void 0,i[l].runName);return delete i[l].runId,u})),o=t;try{for(let c=0;c<this.steps.length;c+=1)o=await it(this.steps[c].batch(o,s.map((l,u)=>{let d=l?.getChild(this.omitSequenceTags?void 0:`seq:step:${c+1}`);return ue(i[u],{callbacks:d})}),n),i[0]?.signal)}catch(c){throw await Promise.all(s.map(l=>l?.handleChainError(c))),c}return await Promise.all(s.map(c=>c?.handleChainEnd(ge(o,"output")))),o}_concatOutputChunks(t,r){return this.last._concatOutputChunks(t,r)}async*_streamIterator(t,r){let n=await qe(r),{runId:i,...a}=r??{},s=await n?.handleChainStart(this.toJSON(),ge(t,"input"),i,void 0,void 0,void 0,a?.runName),o=[this.first,...this.middle,this.last],c=!0,l;async function*u(){yield t}try{let d=o[0].transform(u(),ue(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let f=1;f<o.length;f+=1)d=await o[f].transform(d,ue(a,{callbacks:s?.getChild(this.omitSequenceTags?void 0:`seq:step:${f+1}`)}));for await(let f of d)if(r?.signal?.throwIfAborted(),yield f,c)if(l===void 0)l=f;else try{l=this._concatOutputChunks(l,f)}catch{l=void 0,c=!1}}catch(d){throw await s?.handleChainError(d),d}await s?.handleChainEnd(ge(l,"output"))}getGraph(t){let r=new fa,n=null;return this.steps.forEach((i,a)=>{let s=i.getGraph(t);a!==0&&s.trimFirstNode(),a!==this.steps.length-1&&s.trimLastNode(),r.extend(s);let o=s.firstNode();if(!o)throw new Error(`Runnable ${i} has no first node`);n&&r.addEdge(n,o),n=s.lastNode()}),r}pipe(t){return Mn.isRunnableSequence(t)?new Mn({first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}):new Mn({first:this.first,middle:[...this.middle,this.last],last:Or(t),name:this.name})}static isRunnableSequence(t){return Array.isArray(t.middle)&&_e.isRunnable(t)}static from([t,...r],n){let i={};return typeof n=="string"?i.name=n:n!==void 0&&(i=n),new Mn({...i,first:Or(t),middle:r.slice(0,-1).map(Or),last:Or(r[r.length-1])})}},ha=class dp extends _e{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(t){super(t),this.steps={};for(let[r,n]of Object.entries(t.steps))this.steps[r]=Or(n)}static from(t){return new dp({steps:t})}async invoke(t,r){let n=Y(r),i=await(await qe(n))?.handleChainStart(this.toJSON(),{input:t},n.runId,void 0,void 0,void 0,n?.runName);delete n.runId;let a={};try{let s=Object.entries(this.steps).map(async([o,c])=>{a[o]=await c.invoke(t,ue(n,{callbacks:i?.getChild(`map:key:${o}`)}))});await it(Promise.all(s),n.signal)}catch(s){throw await i?.handleChainError(s),s}return await i?.handleChainEnd(a),a}async*_transform(t,r,n){let i={...this.steps},a=na(t,Object.keys(i).length),s=new Map(Object.entries(i).map(([o,c],l)=>{let u=c.transform(a[l],ue(n,{callbacks:r?.getChild(`map:key:${o}`)}));return[o,u.next().then(d=>({key:o,gen:u,result:d}))]}));for(;s.size;){let{key:o,result:c,gen:l}=await it(Promise.race(s.values()),n?.signal);s.delete(o),c.done||(yield{[o]:c.value},s.set(o,l.next().then(u=>({key:o,gen:l,result:u}))))}}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let i=Y(r),a=new Jt({generator:this.transform(n(),i),config:i});return await a.setup,Re.fromAsyncGenerator(a)}},hw=class fp extends _e{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(t){if(super(t),!Li(t.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=t.func}async invoke(t,r){let[n]=this._getOptionsList(r??{},1),i=await qe(n);return it(this.func(ue(n,{callbacks:i}),t),n?.signal)}async*_streamIterator(t,r){let[n]=this._getOptionsList(r??{},1),i=await this.invoke(t,r);if(Yi(i)){for await(let a of i)n?.signal?.throwIfAborted(),yield a;return}if(If(i)){for(;;){n?.signal?.throwIfAborted();let a=i.next();if(a.done)break;yield a.value}return}yield i}static from(t){return new fp({func:t})}};function mw(e){if(Li(e))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}var pp=class hp extends _e{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(t){if(Li(t.func))return hw.from(t.func);super(t),mw(t.func),this.func=t.func}static from(t){return new hp({func:t})}async _invoke(t,r,n){return new Promise((i,a)=>{let s=ue(r,{callbacks:n?.getChild(),recursionLimit:(r?.recursionLimit??25)-1});be.runWithConfig(We(s),async()=>{try{let o=await this.func(t,{...s});if(o&&_e.isRunnable(o)){if(r?.recursionLimit===0)throw new Error("Recursion limit reached.");o=await o.invoke(t,{...s,recursionLimit:(s.recursionLimit??25)-1})}else if(Yi(o)){let c;for await(let l of Xi(s,o))if(r?.signal?.throwIfAborted(),c===void 0)c=l;else try{c=this._concatOutputChunks(c,l)}catch{c=l}o=c}else if(qo(o)){let c;for(let l of Jo(s,o))if(r?.signal?.throwIfAborted(),c===void 0)c=l;else try{c=this._concatOutputChunks(c,l)}catch{c=l}o=c}i(o)}catch(o){a(o)}})})}async invoke(t,r){return this._callWithConfig(this._invoke.bind(this),t,r)}async*_transform(t,r,n){let i;for await(let o of t)if(i===void 0)i=o;else try{i=this._concatOutputChunks(i,o)}catch{i=o}let a=ue(n,{callbacks:r?.getChild(),recursionLimit:(n?.recursionLimit??25)-1}),s=await new Promise((o,c)=>{be.runWithConfig(We(a),async()=>{try{o(await this.func(i,{...a,config:a}))}catch(l){c(l)}})});if(s&&_e.isRunnable(s)){if(n?.recursionLimit===0)throw new Error("Recursion limit reached.");let o=await s.stream(i,a);for await(let c of o)yield c}else if(Yi(s))for await(let o of Xi(a,s))n?.signal?.throwIfAborted(),yield o;else if(qo(s))for(let o of Jo(a,s))n?.signal?.throwIfAborted(),yield o;else yield s}transform(t,r){return this._transformStreamWithConfig(t,this._transform.bind(this),r)}async stream(t,r){async function*n(){yield t}let i=Y(r),a=new Jt({generator:this.transform(n(),i),config:i});return await a.setup,Re.fromAsyncGenerator(a)}},kR=class extends ha{},gw=class extends _e{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(let e of this.fallbacks)yield e}async invoke(e,t){let r=Y(t),n=await qe(r),{runId:i,...a}=r,s=await n?.handleChainStart(this.toJSON(),ge(e,"input"),i,void 0,void 0,void 0,a?.runName),o=ue(a,{callbacks:s?.getChild()});return await be.runWithConfig(o,async()=>{let c;for(let l of this.runnables()){r?.signal?.throwIfAborted();try{let u=await l.invoke(e,o);return await s?.handleChainEnd(ge(u,"output")),u}catch(u){c===void 0&&(c=u)}}throw c===void 0?new Error("No error stored at end of fallback."):(await s?.handleChainError(c),c)})}async*_streamIterator(e,t){let r=Y(t),n=await qe(r),{runId:i,...a}=r,s=await n?.handleChainStart(this.toJSON(),ge(e,"input"),i,void 0,void 0,void 0,a?.runName),o,c;for(let u of this.runnables()){r?.signal?.throwIfAborted();let d=ue(a,{callbacks:s?.getChild()});try{c=Xi(d,await u.stream(e,d));break}catch(f){o===void 0&&(o=f)}}if(c===void 0){let u=o??new Error("No error stored at end of fallback.");throw await s?.handleChainError(u),u}let l;try{for await(let u of c){yield u;try{l=l===void 0?l:this._concatOutputChunks(l,u)}catch{l=void 0}}}catch(u){throw await s?.handleChainError(u),u}await s?.handleChainEnd(ge(l,"output"))}async batch(e,t,r){if(r?.returnExceptions)throw new Error("Not implemented.");let n=this._getOptionsList(t??{},e.length),i=await Promise.all(n.map(o=>qe(o))),a=await Promise.all(i.map(async(o,c)=>{let l=await o?.handleChainStart(this.toJSON(),ge(e[c],"input"),n[c].runId,void 0,void 0,void 0,n[c].runName);return delete n[c].runId,l})),s;for(let o of this.runnables()){n[0].signal?.throwIfAborted();try{let c=await o.batch(e,a.map((l,u)=>ue(n[u],{callbacks:l?.getChild()})),r);return await Promise.all(a.map((l,u)=>l?.handleChainEnd(ge(c[u],"output")))),c}catch(c){s===void 0&&(s=c)}}throw s?(await Promise.all(a.map(o=>o?.handleChainError(s))),s):new Error("No error stored at end of fallbacks.")}};function Or(e){if(typeof e=="function")return new pp({func:e});if(_e.isRunnable(e))return e;if(!Array.isArray(e)&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e))t[r]=Or(n);return new ha({steps:t})}else throw new Error(`Expected a Runnable, function or object.
174
174
  Instead got an unsupported type.`)}var _w=class extends _e{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof ha&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){let r=await this.mapper.invoke(e,t);return{...e,...r}}async*_transform(e,t,r){let n=this.mapper.getStepsKeys(),[i,a]=na(e),s=this.mapper.transform(a,ue(r,{callbacks:t?.getChild()})),o=s.next();for await(let c of i){if(typeof c!="object"||Array.isArray(c))throw new Error(`RunnableAssign can only be used with objects as input, got ${typeof c}`);let l=Object.fromEntries(Object.entries(c).filter(([u])=>!n.includes(u)));Object.keys(l).length>0&&(yield l)}yield(await o).value;for await(let c of s)yield c}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=Y(t),i=new Jt({generator:this.transform(r(),n),config:n});return await i.setup,Re.fromAsyncGenerator(i)}},yw=class extends _e{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){(typeof e=="string"||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if(typeof this.keys=="string")return e[this.keys];{let t=this.keys.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0);return t.length===0?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async*_transform(e){for await(let t of e){let r=await this._pick(t);r!==void 0&&(yield r)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){async function*r(){yield e}let n=Y(t),i=new Jt({generator:this.transform(r(),n),config:n});return await i.setup,Re.fromAsyncGenerator(i)}},sp=class extends pa{name;description;schema;constructor(e){let t=up.from([pp.from(async r=>{let n;if($t(r))try{n=await zi(this.schema,r.args)}catch{throw new $r("Received tool input did not match expected schema",JSON.stringify(r.args))}else n=r;return n}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name});super({bound:t,config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};function ww(e,t){let r=t.name??e.getName(),n=t.description??af(t.schema);return Bi(t.schema)?new sp({name:r,description:n,schema:vt.object({input:vt.string()}).transform(i=>i.input),bound:e}):new sp({name:r,description:n,schema:t.schema,bound:e})}var BR=L({BasePromptValue:()=>ma,ChatPromptValue:()=>oc,ImagePromptValue:()=>bw,StringPromptValue:()=>sc}),ma=class extends ft{},sc=class extends ma{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new tr(this.value)]}},oc=class extends ma{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return Qn(this.messages)}toChatMessages(){return this.messages}},bw=class extends ma{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ImagePromptValue"}imageUrl;value;constructor(e){"imageUrl"in e||(e={imageUrl:e}),super(e),this.imageUrl=e.imageUrl}toString(){return this.imageUrl.url}toChatMessages(){return[new tr({content:[{type:"image_url",image_url:{detail:this.imageUrl.detail,url:this.imageUrl.url}}]})]}};var yp=Hn(_p(),1),kw=Object.defineProperty,Cw=(e,t,r)=>t in e?kw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ow=(e,t,r)=>(Cw(e,typeof t!="symbol"?t+"":t,r),r);function Rw(e,t){let r=Array.from({length:e.length},(n,i)=>({start:i,end:i+1}));for(;r.length>1;){let n=null;for(let i=0;i<r.length-1;i++){let a=e.slice(r[i].start,r[i+1].end),s=t.get(a.join(","));s!=null&&(n==null||s<n[0])&&(n=[s,i])}if(n!=null){let i=n[1];r[i]={start:r[i].start,end:r[i+1].end},r.splice(i+1,1)}else break}return r}function Nw(e,t){return e.length===1?[t.get(e.join(","))]:Rw(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}function $w(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}var lc=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;let r=e.bpe_ranks.split(`
175
- `).filter(Boolean).reduce((n,i)=>{let[a,s,...o]=i.split(" "),c=Number.parseInt(s,10);return o.forEach((l,u)=>n[l]=c+u),n},{});for(let[n,i]of Object.entries(r)){let a=yp.default.toByteArray(n);this.rankMap.set(a.join(","),i),this.textMap.set(i,a)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[i,a])=>(n[a]=this.textEncoder.encode(i),n),{})}encode(e,t=[],r="all"){let n=new RegExp(this.patStr,"ug"),i=lc.specialTokenRegex(Object.keys(this.specialTokens)),a=[],s=new Set(t==="all"?Object.keys(this.specialTokens):t),o=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!s.has(l)):r);if(o.size>0){let l=lc.specialTokenRegex([...o]),u=e.match(l);if(u!=null)throw new Error(`The text contains a special token that is not allowed: ${u[0]}`)}let c=0;for(;;){let l=null,u=c;for(;i.lastIndex=u,l=i.exec(e),!(l==null||s.has(l[0]));)u=l.index+1;let d=l?.index??e.length;for(let p of e.substring(c,d).matchAll(n)){let h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){a.push(m);continue}a.push(...Nw(h,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];a.push(f),c=l.index+l[0].length}return a}decode(e){let t=[],r=0;for(let a=0;a<e.length;++a){let s=e[a],o=this.textMap.get(s)??this.inverseSpecialTokens[s];o!=null&&(t.push(o),r+=o.length)}let n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.length;return this.textDecoder.decode(n)}},_a=lc;Ow(_a,"specialTokenRegex",e=>new RegExp(e.map(t=>$w(t)).join("|"),"g"));function uc(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var tN=L({encodingForModel:()=>wa,getEncoding:()=>wp}),ya={},Pw=new Ir({});async function wp(e){return e in ya||(ya[e]=Pw.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(t=>t.json()).then(t=>new _a(t)).catch(t=>{throw delete ya[e],t})),await ya[e]}async function wa(e){return wp(uc(e))}var uN=L({BaseLangChain:()=>va,BaseLanguageModel:()=>Uw,calculateMaxTokens:()=>Lw,getEmbeddingContextSize:()=>Mw,getModelContextSize:()=>bp,getModelNameForTiktoken:()=>ba,isOpenAITool:()=>jw}),ba=e=>e.startsWith("gpt-5")?"gpt-5":e.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":e.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":e.startsWith("gpt-4-32k")?"gpt-4-32k":e.startsWith("gpt-4-")?"gpt-4":e.startsWith("gpt-4o")?"gpt-4o":e,Mw=e=>e==="text-embedding-ada-002"?8191:2046,bp=e=>{switch(ba(e)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function jw(e){return typeof e!="object"||!e?!1:!!("type"in e&&e.type==="function"&&"function"in e&&typeof e.function=="object"&&e.function&&"name"in e.function&&"parameters"in e.function)}var Lw=async({prompt:e,modelName:t})=>{let r;try{r=(await wa(ba(t))).encode(e).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(e.length/4)}return bp(t)-r},Dw=()=>!1,va=class extends _e{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??Dw(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.2.8")}_addVersion(e,t){let r=this.metadata?.versions;this.metadata={...this.metadata,versions:{...typeof r=="object"&&r!==null?r:{},[e]:t}}}},Uw=class extends va{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...r}){let{cache:n,...i}=r;super({callbacks:e??t,...i}),typeof n=="object"?this.cache=n:n?this.cache=Ko.global():this.cache=void 0,this.caller=new Ir(r??{})}_encoding;async getNumTokens(e){let t;typeof e=="string"?t=e:t=e.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await wa("modelName"in this?ba(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(t).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new sc(e):Array.isArray(e)?new oc(e.map(Ml)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){let r={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([n,i])=>i!==void 0).map(([n,i])=>`${n}:${JSON.stringify(i)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}_filterInvocationParamsForTracing(e){let{tools:t,functions:r,messages:n,response_format:i,...a}=e;return a}};function dc(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function fc(e){return e!==void 0&&_e.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function pc(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&(Zr(e.schema)||e.schema!=null&&typeof e.schema=="object"&&"type"in e.schema&&typeof e.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(e.schema.type))}function vp(e){return pc(e)||fc(e)||dc(e)}var MN=L({BaseToolkit:()=>zw,DynamicStructuredTool:()=>Sp,DynamicTool:()=>Ep,StructuredTool:()=>hc,Tool:()=>xp,ToolInputParsingException:()=>$r,isLangChainTool:()=>vp,isRunnableToolLike:()=>fc,isStructuredTool:()=>dc,isStructuredToolParams:()=>pc,tool:()=>Bw}),hc=class extends va{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(e){super(e??{}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}async invoke(e,t){let r,n=Y(xn(this.defaultConfig,t));return $t(e)?(r=e.args,n={...n,toolCall:e}):r=e,this.call(r,n)}async call(e,t,r){let n=$t(e)?e.args:e,i;if(Zr(this.schema))try{i=await zi(this.schema,n)}catch(p){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
175
+ `).filter(Boolean).reduce((n,i)=>{let[a,s,...o]=i.split(" "),c=Number.parseInt(s,10);return o.forEach((l,u)=>n[l]=c+u),n},{});for(let[n,i]of Object.entries(r)){let a=yp.default.toByteArray(n);this.rankMap.set(a.join(","),i),this.textMap.set(i,a)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((n,[i,a])=>(n[a]=this.textEncoder.encode(i),n),{})}encode(e,t=[],r="all"){let n=new RegExp(this.patStr,"ug"),i=lc.specialTokenRegex(Object.keys(this.specialTokens)),a=[],s=new Set(t==="all"?Object.keys(this.specialTokens):t),o=new Set(r==="all"?Object.keys(this.specialTokens).filter(l=>!s.has(l)):r);if(o.size>0){let l=lc.specialTokenRegex([...o]),u=e.match(l);if(u!=null)throw new Error(`The text contains a special token that is not allowed: ${u[0]}`)}let c=0;for(;;){let l=null,u=c;for(;i.lastIndex=u,l=i.exec(e),!(l==null||s.has(l[0]));)u=l.index+1;let d=l?.index??e.length;for(let p of e.substring(c,d).matchAll(n)){let h=this.textEncoder.encode(p[0]),m=this.rankMap.get(h.join(","));if(m!=null){a.push(m);continue}a.push(...Nw(h,this.rankMap))}if(l==null)break;let f=this.specialTokens[l[0]];a.push(f),c=l.index+l[0].length}return a}decode(e){let t=[],r=0;for(let a=0;a<e.length;++a){let s=e[a],o=this.textMap.get(s)??this.inverseSpecialTokens[s];o!=null&&(t.push(o),r+=o.length)}let n=new Uint8Array(r),i=0;for(let a of t)n.set(a,i),i+=a.length;return this.textDecoder.decode(n)}},_a=lc;Ow(_a,"specialTokenRegex",e=>new RegExp(e.map(t=>$w(t)).join("|"),"g"));function uc(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}var tN=L({encodingForModel:()=>wa,getEncoding:()=>wp}),ya={},Pw=new Ir({});async function wp(e){return e in ya||(ya[e]=Pw.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(t=>t.json()).then(t=>new _a(t)).catch(t=>{throw delete ya[e],t})),await ya[e]}async function wa(e){return wp(uc(e))}var uN=L({BaseLangChain:()=>va,BaseLanguageModel:()=>Uw,calculateMaxTokens:()=>Lw,getEmbeddingContextSize:()=>Mw,getModelContextSize:()=>bp,getModelNameForTiktoken:()=>ba,isOpenAITool:()=>jw}),ba=e=>e.startsWith("gpt-5")?"gpt-5":e.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":e.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":e.startsWith("gpt-4-32k")?"gpt-4-32k":e.startsWith("gpt-4-")?"gpt-4":e.startsWith("gpt-4o")?"gpt-4o":e,Mw=e=>e==="text-embedding-ada-002"?8191:2046,bp=e=>{switch(ba(e)){case"gpt-5":case"gpt-5-turbo":case"gpt-5-turbo-preview":return 4e5;case"gpt-4o":case"gpt-4o-mini":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":return 128e3;case"gpt-4-turbo":case"gpt-4-turbo-preview":case"gpt-4-turbo-2024-04-09":case"gpt-4-0125-preview":case"gpt-4-1106-preview":return 128e3;case"gpt-4-32k":case"gpt-4-32k-0314":case"gpt-4-32k-0613":return 32768;case"gpt-4":case"gpt-4-0314":case"gpt-4-0613":return 8192;case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-16k-0613":return 16384;case"gpt-3.5-turbo":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-1106":case"gpt-3.5-turbo-0125":return 4096;case"text-davinci-003":case"text-davinci-002":return 4097;case"text-davinci-001":return 2049;case"text-curie-001":case"text-babbage-001":case"text-ada-001":return 2048;case"code-davinci-002":case"code-davinci-001":return 8e3;case"code-cushman-001":return 2048;case"claude-3-5-sonnet-20241022":case"claude-3-5-sonnet-20240620":case"claude-3-opus-20240229":case"claude-3-sonnet-20240229":case"claude-3-haiku-20240307":case"claude-2.1":return 2e5;case"claude-2.0":case"claude-instant-1.2":return 1e5;case"gemini-1.5-pro":case"gemini-1.5-pro-latest":case"gemini-1.5-flash":case"gemini-1.5-flash-latest":return 1e6;case"gemini-pro":case"gemini-pro-vision":return 32768;default:return 4097}};function jw(e){return typeof e!="object"||!e?!1:!!("type"in e&&e.type==="function"&&"function"in e&&typeof e.function=="object"&&e.function&&"name"in e.function&&"parameters"in e.function)}var Lw=async({prompt:e,modelName:t})=>{let r;try{r=(await wa(ba(t))).encode(e).length}catch{console.warn("Failed to calculate number of tokens, falling back to approximate count"),r=Math.ceil(e.length/4)}return bp(t)-r},Dw=()=>!1,va=class extends _e{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??Dw(),this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.2.9")}_addVersion(e,t){let r=this.metadata?.versions;this.metadata={...this.metadata,versions:{...typeof r=="object"&&r!==null?r:{},[e]:t}}}},Uw=class extends va{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...r}){let{cache:n,...i}=r;super({callbacks:e??t,...i}),typeof n=="object"?this.cache=n:n?this.cache=Ko.global():this.cache=void 0,this.caller=new Ir(r??{})}_encoding;async getNumTokens(e){let t;typeof e=="string"?t=e:t=e.map(n=>typeof n=="string"?n:n.type==="text"&&"text"in n?n.text:"").join("");let r=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await wa("modelName"in this?ba(this.modelName):"gpt2")}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}if(this._encoding)try{r=this._encoding.encode(t).length}catch(n){console.warn("Failed to calculate number of tokens, falling back to approximate count",n)}return r}static _convertInputToPromptValue(e){return typeof e=="string"?new sc(e):Array.isArray(e)?new oc(e.map(Ml)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){let r={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(r).filter(([n,i])=>i!==void 0).map(([n,i])=>`${n}:${JSON.stringify(i)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}_filterInvocationParamsForTracing(e){let{tools:t,functions:r,messages:n,response_format:i,...a}=e;return a}};function dc(e){return e!==void 0&&Array.isArray(e.lc_namespace)}function fc(e){return e!==void 0&&_e.isRunnable(e)&&"lc_name"in e.constructor&&typeof e.constructor.lc_name=="function"&&e.constructor.lc_name()==="RunnableToolLike"}function pc(e){return!!e&&typeof e=="object"&&"name"in e&&"schema"in e&&(Zr(e.schema)||e.schema!=null&&typeof e.schema=="object"&&"type"in e.schema&&typeof e.schema.type=="string"&&["null","boolean","object","array","number","string"].includes(e.schema.type))}function vp(e){return pc(e)||fc(e)||dc(e)}var MN=L({BaseToolkit:()=>zw,DynamicStructuredTool:()=>Sp,DynamicTool:()=>Ep,StructuredTool:()=>hc,Tool:()=>xp,ToolInputParsingException:()=>$r,isLangChainTool:()=>vp,isRunnableToolLike:()=>fc,isStructuredTool:()=>dc,isStructuredToolParams:()=>pc,tool:()=>Bw}),hc=class extends va{extras;returnDirect=!1;verboseParsingErrors=!1;get lc_namespace(){return["langchain","tools"]}responseFormat="content";defaultConfig;constructor(e){super(e??{}),this.verboseParsingErrors=e?.verboseParsingErrors??this.verboseParsingErrors,this.responseFormat=e?.responseFormat??this.responseFormat,this.defaultConfig=e?.defaultConfig??this.defaultConfig,this.metadata=e?.metadata??this.metadata,this.extras=e?.extras??this.extras}async invoke(e,t){let r,n=Y(xn(this.defaultConfig,t));return $t(e)?(r=e.args,n={...n,toolCall:e}):r=e,this.call(r,n)}async call(e,t,r){let n=$t(e)?e.args:e,i;if(Zr(this.schema))try{i=await zi(this.schema,n)}catch(p){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
176
176
  Details: ${p.message}`),of(p)&&(h=`${h}
177
177
 
178
178
  ${$a.prettifyError(p)}`),new $r(h,JSON.stringify(e))}else{let p=re(n,this.schema);if(!p.valid){let h="Received tool input did not match expected schema";throw this.verboseParsingErrors&&(h=`${h}
@@ -1,5 +1,5 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import"./BVUCNXC5.js";var e=`## Membership Bind Parameters
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"./UZLQALHY.js";var e=`## Membership Bind Parameters
3
3
 
4
4
  The current link chart contains a subset of entities and relationships from the database. Their membership is available to Cypher queries as lists of string identifiers through these bind parameters:
5
5
 
@@ -1,5 +1,5 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import"./BVUCNXC5.js";var e=`## Navigation Agent - Tool Intent Classifier
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"./UZLQALHY.js";var e=`## Navigation Agent - Tool Intent Classifier
3
3
 
4
4
  You are an assistant that classifies the assigned task intent for navigation agent.
5
5
 
@@ -1,5 +1,5 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import a from"./XV7RMYLR.js";import{c as C,e as N}from"./2WXXSZP5.js";import"./4OI4QEV7.js";import"./ZJWR4W2S.js";import"./M2U456J5.js";import"./CSE6BHOJ.js";import"./BVUCNXC5.js";export default $arcgis.t(([{property:B,subclass:D},{a:h,b:S,c:p,d:A}])=>{var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,P=(t,e,s,n)=>{for(var r=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&G(e,s,r),r},x=class extends A{constructor(t){super(t)}getAgents(){return this.agents}generate(){let t=this.getAgents();this.validateAgents(t);for(let o of t)o.generate();let e=S(t.flatMap(o=>o.getSchemas()));for(let[o]of t.entries())e[_(o)]=void 0;let s=C(e),n=this.buildNodes(t),r=this.buildEdges(t);return{workspace:s,createGraph:()=>N(n,r,s,{entryNode:this.getEntryNode(t)})}}getEntryNode(t){return y}isTerminalAgent(t,e){return!1}buildNodes(t){let e={};for(let[s,n]of t.entries()){let r=_(s),o=p(n,s);e[o]=async(a,u)=>{let l=await n.run(F(a,n),u),i={},m=i;return m[r]=l,i}}return e[y]=()=>({}),e[k]=s=>R(s,t),e}buildEdges(t){return[...t.map((e,s)=>({from:y,to:p(e,s)})),...t.map((e,s)=>({from:p(e,s),to:k}))]}};P([B()],x.prototype,"agents",2);x=P([D("ParallelWorkflow")],x);var y="__parallel_fanOut",k="__parallel_join";function _(t){return`__parallel_update_${t}`}function W(t,e){return Object.fromEntries(e.filter(s=>Object.hasOwn(t,s)).map(s=>[s,t[s]]))}function F(t,e){let s=e.inputSchema;return s?{...W(t,h(s)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function I(t,e){return t.outputSchema?W(e,h(t.outputSchema)):{}}function K(t,e){let s=t.agentExecutionContext?.messages??[],n=e.agentExecutionContext?.messages??[];return n.length>s.length?n.slice(s.length):void 0}function R(t,e){let s=[],n=[],r=[],o={},a={},u=new Set;for(let[m,J]of e.entries()){let E=_(m),d=t[E];if(a[E]=void 0,!d||typeof d!="object")continue;let c=d,b=c.outputMessage,O=K(t,c),v=c.summary,$=I(J,c),w=b.trim();typeof b=="string"&&w&&s.push(w);let j=v.trim();typeof v=="string"&&j&&n.push(j),Array.isArray(O)&&r.push(...O),c.status&&u.add(c.status);for(let[f,g]of Object.entries($))if(!(g===void 0||f.startsWith("__parallel_update_"))&&!M(t[f],g)){if(!Object.hasOwn(o,f)){o[f]=g;continue}if(!M(o[f],g))throw new Error(`ParallelWorkflow detected conflicting updates for state key "${f}".`)}}let l={...a,...o},i=l;return r.length>0&&(i.agentExecutionContext={...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages,...r]}),s.length&&(i.outputMessage=s.join(`
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./EVMIYZWD.js";import{c as C,e as N}from"./JQYLMTDP.js";import"./FS7GXTTQ.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:B,subclass:D},{a:h,b:S,c:p,d:A}])=>{var G=Object.defineProperty,z=Object.getOwnPropertyDescriptor,P=(t,e,s,n)=>{for(var r=n>1?void 0:n?z(e,s):e,o=t.length-1,a;o>=0;o--)(a=t[o])&&(r=(n?a(e,s,r):a(r))||r);return n&&r&&G(e,s,r),r},x=class extends A{constructor(t){super(t)}getAgents(){return this.agents}generate(){let t=this.getAgents();this.validateAgents(t);for(let o of t)o.generate();let e=S(t.flatMap(o=>o.getSchemas()));for(let[o]of t.entries())e[_(o)]=void 0;let s=C(e),n=this.buildNodes(t),r=this.buildEdges(t);return{workspace:s,createGraph:()=>N(n,r,s,{entryNode:this.getEntryNode(t)})}}getEntryNode(t){return y}isTerminalAgent(t,e){return!1}buildNodes(t){let e={};for(let[s,n]of t.entries()){let r=_(s),o=p(n,s);e[o]=async(a,u)=>{let l=await n.run(F(a,n),u),i={},m=i;return m[r]=l,i}}return e[y]=()=>({}),e[k]=s=>R(s,t),e}buildEdges(t){return[...t.map((e,s)=>({from:y,to:p(e,s)})),...t.map((e,s)=>({from:p(e,s),to:k}))]}};P([B()],x.prototype,"agents",2);x=P([D("ParallelWorkflow")],x);var y="__parallel_fanOut",k="__parallel_join";function _(t){return`__parallel_update_${t}`}function W(t,e){return Object.fromEntries(e.filter(s=>Object.hasOwn(t,s)).map(s=>[s,t[s]]))}function F(t,e){let s=e.inputSchema;return s?{...W(t,h(s)),agentExecutionContext:t.agentExecutionContext,outputMessage:t.outputMessage,status:void 0,summary:""}:{...t,status:void 0,summary:""}}function I(t,e){return t.outputSchema?W(e,h(t.outputSchema)):{}}function K(t,e){let s=t.agentExecutionContext?.messages??[],n=e.agentExecutionContext?.messages??[];return n.length>s.length?n.slice(s.length):void 0}function R(t,e){let s=[],n=[],r=[],o={},a={},u=new Set;for(let[m,J]of e.entries()){let E=_(m),d=t[E];if(a[E]=void 0,!d||typeof d!="object")continue;let c=d,b=c.outputMessage,O=K(t,c),v=c.summary,$=I(J,c),w=b.trim();typeof b=="string"&&w&&s.push(w);let j=v.trim();typeof v=="string"&&j&&n.push(j),Array.isArray(O)&&r.push(...O),c.status&&u.add(c.status);for(let[f,g]of Object.entries($))if(!(g===void 0||f.startsWith("__parallel_update_"))&&!M(t[f],g)){if(!Object.hasOwn(o,f)){o[f]=g;continue}if(!M(o[f],g))throw new Error(`ParallelWorkflow detected conflicting updates for state key "${f}".`)}}let l={...a,...o},i=l;return r.length>0&&(i.agentExecutionContext={...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages,...r]}),s.length&&(i.outputMessage=s.join(`
3
3
 
4
4
  `)),n.length&&(i.summary=n.join(`
5
5
 
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{d as b}from"./FS7GXTTQ.js";import{Ya as G,ka as w,r as E,s as y}from"./LOQ2PKV5.js";var x=new Set(["agentExecutionContext","outputMessage","summary","status"]);function O(r){let o=[...new Set([...r].filter(t=>x.has(t)))];if(o.length!==0)throw new Error(`custom state cannot define reserved runtime fields: ${o.join(", ")}.`)}function $(r){let o=Object.entries(r);return Object.fromEntries(o.map(([t,n])=>[t,w({reducer:(s,u)=>u,default:()=>n})]))}function S(r={}){O(Object.keys(r));let o=$(r);return w.Root({...o,agentExecutionContext:w({reducer:(t,n)=>({...t,...n}),default:b}),outputMessage:w({reducer:(t="",n)=>typeof n=="string"&&n.trim()?n:t,default:()=>""}),summary:w({reducer:(t="",n)=>typeof n=="string"?n:t,default:()=>""}),status:w({reducer:(t,n)=>n??t,default:()=>{}})})}function C(r,o=[]){let t=new Set(o);for(let s of r)for(let u of Object.keys(s.shape??{}))t.add(u);let n=Object.fromEntries([...t].map(s=>[s,void 0]));return S(n)}function P(r,o,t,n={}){let{agent:s,entryNode:u,middlewares:c=[]}=n,i=new G(t);if(Object.keys(r).length===0)throw new Error("Graph requires at least one node.");if(o.length===0)throw new Error("Graph requires at least one edge.");if(c.length>0&&!s)throw new Error("Graph middleware requires agent metadata.");let a=new Set(Object.keys(r)),m=new Map,g=new Map;for(let e of a)m.set(e,0),g.set(e,0);for(let e of o)"to"in e?(a.has(e.from)&&g.set(e.from,(g.get(e.from)??0)+1),a.has(e.to)&&m.set(e.to,(m.get(e.to)??0)+1)):a.has(e.from)&&g.set(e.from,(g.get(e.from)??0)+1);for(let[e,f]of Object.entries(r)){let h=N(s,e,c,async(d,p)=>await Promise.resolve(f(d,p))),l=async(d,p)=>await h(d,p);i=i.addNode(e,l)}for(let e of o)if("to"in e){let f=e.from,h=e.to;if(!a.has(f))throw new Error(`Graph edge references unknown from-node: ${f}`);if(!a.has(h))throw new Error(`Graph edge references unknown to-node: ${h}`);i.addEdge(f,h)}else{let f=e.from;if(!a.has(f))throw new Error(`Graph conditional edge references unknown from-node: ${f}`);i.addConditionalEdges(f,async(h,l)=>{let d=await e.decide(h,l);if(!d)return y;if(!a.has(d))throw new Error(`Graph conditional edge returned unknown node: ${d}`);return d})}let k=v(a,m,u);i.addEdge(E,k);let j=[...a].filter(e=>(g.get(e)??0)===0);for(let e of j)i.addEdge(e,y);return i}function N(r,o,t,n){return!t.length||!r?n:async(s,u)=>await t.reduceRight((c,i)=>async a=>await i.handler(a,c),async c=>{let i=await n(c.state,c.config);return{...c.state,...i}})({agent:r,config:u,nodeName:o,state:s})}function v(r,o,t){if(t){if(!r.has(t))throw new Error(`Graph entry node references unknown node: ${t}`);return t}let n=[...r].filter(s=>(o.get(s)??0)===0);if(n.length!==1)throw new Error(`Graph could not infer a single entry node (found ${n.length}). Provide an explicit entryNode or ensure exactly one node has no incoming edges.`);return n[0]}export{O as a,$ as b,S as c,C as d,P as e};
@@ -1,2 +1,2 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import{a as n}from"./A6LBMS7A.js";import{Dc as o}from"./M2U456J5.js";import{a as i}from"./5X23DDDZ.js";async function a(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function m(e,t){let{mapView:r}=n(t,["mapView"]);return await a(r)}var s=i.object({}),f=o(m,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:s});export{f as a};
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as n}from"./ONQ6JSBJ.js";import{Dc as o}from"./IYLFJCJ2.js";import{a as i}from"./VXFQANGJ.js";async function a(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function m(e,t){let{mapView:r}=n(t,["mapView"]);return await a(r)}var s=i.object({}),f=o(m,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:s});export{f as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./5Q2XRQS6.js";import"./ONQ6JSBJ.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToZoomTool};
@@ -1,2 +1,2 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import a from"./KKCLHXHG.js";import{a as m}from"./A6LBMS7A.js";import{Dc as f}from"./M2U456J5.js";import{a as o}from"./5X23DDDZ.js";export default $arcgis.t(([{b:c,c:h}])=>{var g=(a,e,i)=>{let t=a.createQuery();return t.outFields=[e],t.where=i||"1=1",t.num=1,t},w=async(a,e,i,t)=>{let r=t.map?.allLayers.find(y=>y.id===a),n=g(r,e,i.where),s=(await r.queryFeatures(n)).features[0],d=s?s.attributes[e]:null,u=c(r,e,d,t.timeZone),l=h(r,e);return{tool:"getAttribute",layerName:r.title??a,summary:`${l} = ${u}`,details:{fieldName:e,fieldAlias:l!==e?l:void 0,value:u,where:i.where}}};async function b({layerId:a,fieldName:e,query:i},t){let{mapView:r}=m(t,["mapView"]),n=await w(a,e,i,r);return JSON.stringify(n,null,2)}var p=o.object({layerId:o.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:o.string().describe("The name of the field/attribute from which to get a field value."),query:o.object({where:o.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),q=f(b,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:p});return q},a)
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./CCC6LBMY.js";import{a as m}from"./ONQ6JSBJ.js";import{Dc as f}from"./IYLFJCJ2.js";import{a as o}from"./VXFQANGJ.js";export default $arcgis.t(([{b:c,c:h}])=>{var g=(a,e,i)=>{let t=a.createQuery();return t.outFields=[e],t.where=i||"1=1",t.num=1,t},w=async(a,e,i,t)=>{let r=t.map?.allLayers.find(y=>y.id===a),n=g(r,e,i.where),s=(await r.queryFeatures(n)).features[0],d=s?s.attributes[e]:null,u=c(r,e,d,t.timeZone),l=h(r,e);return{tool:"getAttribute",layerName:r.title??a,summary:`${l} = ${u}`,details:{fieldName:e,fieldAlias:l!==e?l:void 0,value:u,where:i.where}}};async function b({layerId:a,fieldName:e,query:i},t){let{mapView:r}=m(t,["mapView"]),n=await w(a,e,i,r);return JSON.stringify(n,null,2)}var p=o.object({layerId:o.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:o.string().describe("The name of the field/attribute from which to get a field value."),query:o.object({where:o.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),q=f(b,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:p});return q},a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./K5JVB6FU.js";import"./ONQ6JSBJ.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToHomeExtentTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./AVRS6UCQ.js";import"./ONQ6JSBJ.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([a])=>{return a},a)
@@ -1,2 +1,2 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import a from"./XV7RMYLR.js";import{e as l}from"./2WXXSZP5.js";import"./4OI4QEV7.js";import"./ZJWR4W2S.js";import"./M2U456J5.js";import"./CSE6BHOJ.js";import"./BVUCNXC5.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./EVMIYZWD.js";import{e as l}from"./JQYLMTDP.js";import"./FS7GXTTQ.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)
@@ -1,5 +1,5 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/1.0/LICENSE.txt */
2
- import"./BVUCNXC5.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import"./UZLQALHY.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
3
3
  The Feature Layer is a collection of geographic features that represent real-world entities. Each feature in the layer has attributes that provide additional information about the feature. The layer may include point, line, or polygon geometries, depending on the type of data it represents.
4
4
  The geometry type for this layer is {layerGeometryType}.
5
5