@esri/solutions-components 5.1.0-next.17 → 5.1.0-next.171

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 (1559) hide show
  1. package/dist/cdn/{AJY7XD7A.js → 23SGJQLW.js} +1 -1
  2. package/dist/cdn/275IZ5I6.js +5 -0
  3. package/dist/cdn/2B4SGB3I.js +2 -0
  4. package/dist/cdn/{CEP54NLT.js → 2C4DK6YC.js} +1 -1
  5. package/dist/cdn/{QQSP7HQH.js → 2EXGHOIM.js} +1 -1
  6. package/dist/cdn/2L62YUIH.js +2 -0
  7. package/dist/cdn/2MCOUOTQ.js +2 -0
  8. package/dist/cdn/2R7Y2ZVX.js +2 -0
  9. package/dist/cdn/2RL6H5TB.js +2 -0
  10. package/dist/cdn/2TEBTKD4.js +2 -0
  11. package/dist/cdn/{NC34DM4N.js → 2UCURPVT.js} +1 -1
  12. package/dist/cdn/{DZB3263I.js → 2X3SHREV.js} +1 -1
  13. package/dist/cdn/37P3IMFV.js +2 -0
  14. package/dist/cdn/3A3CPQX4.js +2 -0
  15. package/dist/cdn/{IO5DIUTT.js → 3E7MYA66.js} +1 -1
  16. package/dist/cdn/{VXMIT5WR.js → 3IHDWRXV.js} +1 -1
  17. package/dist/cdn/3JCHYXHA.js +2 -0
  18. package/dist/cdn/{VIWNXKUP.js → 3NKGACT7.js} +1 -1
  19. package/dist/cdn/{7Y32UJS4.js → 3QIWKYQY.js} +1 -1
  20. package/dist/cdn/463CZQF6.js +2 -0
  21. package/dist/cdn/{SIUUQBL4.js → 47FRMYZ4.js} +1 -1
  22. package/dist/cdn/4A77MNRM.js +2 -0
  23. package/dist/cdn/4D46WTPB.js +2 -0
  24. package/dist/cdn/4L7TJNAM.js +43 -0
  25. package/dist/cdn/{7JEVFHRJ.js → 4OKIVS32.js} +1 -1
  26. package/dist/cdn/4RCC4KA2.js +2 -0
  27. package/dist/cdn/4SORDX5Z.js +7 -0
  28. package/dist/cdn/{T537IZUH.js → 4Z6UJJJR.js} +1 -1
  29. package/dist/cdn/54A4C4RG.js +2 -0
  30. package/dist/cdn/54TJQLYJ.js +69 -0
  31. package/dist/cdn/56DNSWXG.js +2 -0
  32. package/dist/cdn/{5UQRM2YJ.js → 5BN62I7L.js} +1 -1
  33. package/dist/cdn/5FWKODDH.js +2 -0
  34. package/dist/cdn/5IDPOFIN.js +2 -0
  35. package/dist/cdn/{26K4UTAF.js → 5IIGQVJO.js} +1 -1
  36. package/dist/cdn/5JBZ6L5Q.js +6 -0
  37. package/dist/cdn/{UF67SSGX.js → 5LSNDSHW.js} +1 -1
  38. package/dist/cdn/5N4KGIIY.js +2 -0
  39. package/dist/cdn/{4HFHJOS3.js → 5O53T3SW.js} +1 -1
  40. package/dist/cdn/{LPJHRY3Y.js → 5VIB2BPJ.js} +1 -1
  41. package/dist/cdn/{XXQKFENH.js → 62CPZJO5.js} +1 -1
  42. package/dist/cdn/{T745GPG3.js → 62QGEVBO.js} +1 -1
  43. package/dist/cdn/6F7QJJQO.js +2 -0
  44. package/dist/cdn/6FY64JKN.js +2 -0
  45. package/dist/cdn/6HZBPFHA.js +2 -0
  46. package/dist/cdn/6KO7AYJN.js +2 -0
  47. package/dist/cdn/6LN2ZRAZ.js +2 -0
  48. package/dist/cdn/6WNKGSHD.js +2 -0
  49. package/dist/cdn/6WPQPRJ5.js +49 -0
  50. package/dist/cdn/{UK4O67GV.js → 6XWFCHCJ.js} +1 -1
  51. package/dist/cdn/73EY5SIB.js +2 -0
  52. package/dist/cdn/743J2ZUC.js +2 -0
  53. package/dist/cdn/77753TPX.js +2 -0
  54. package/dist/cdn/7CGCLEYB.js +2 -0
  55. package/dist/cdn/{CSW2JRVE.js → 7MNSZGMB.js} +1 -1
  56. package/dist/cdn/{TUGKPWRB.js → 7NUJ4IS5.js} +1 -1
  57. package/dist/cdn/7OHSJ5SV.js +2 -0
  58. package/dist/cdn/7P57UVVG.js +2 -0
  59. package/dist/cdn/{FTMEQQF5.js → 7V57GR4X.js} +1 -1
  60. package/dist/cdn/{3XVYTVMS.js → 7VQB43WL.js} +1 -1
  61. package/dist/cdn/7X2SPNNK.js +82 -0
  62. package/dist/cdn/{LI7Q44Z6.js → 7ZJBP3SS.js} +1 -1
  63. package/dist/cdn/{3SRDS4KQ.js → 7ZSO7MSX.js} +1 -1
  64. package/dist/cdn/A6ZTIX3P.js +2 -0
  65. package/dist/cdn/ADURBGIK.js +50 -0
  66. package/dist/cdn/{LF3HQQMS.js → AEALFROI.js} +1 -1
  67. package/dist/cdn/{45M33Q5G.js → AJZDBHB6.js} +1 -1
  68. package/dist/cdn/{5EBHORLK.js → AM6QSTRH.js} +1 -1
  69. package/dist/cdn/APNDTPBA.js +2 -0
  70. package/dist/cdn/ARFBMFQW.js +2 -0
  71. package/dist/cdn/AS6VINEU.js +16 -0
  72. package/dist/cdn/{KXT52OBS.js → AYJ5ZPU6.js} +1 -1
  73. package/dist/cdn/AYSQIO6L.js +2 -0
  74. package/dist/cdn/{LCWLPXAF.js → BIX5DRQP.js} +1 -1
  75. package/dist/cdn/{NWTG35WX.js → BOFA5RH7.js} +1 -1
  76. package/dist/cdn/{7DVOR4SY.js → BOSEAFVW.js} +1 -1
  77. package/dist/cdn/BWWX52HV.js +27 -0
  78. package/dist/cdn/{E57JPXDR.js → BXSBR2GT.js} +1 -1
  79. package/dist/cdn/{P2YLMWCT.js → C5AR5K23.js} +1 -1
  80. package/dist/cdn/C5KDPY7R.js +2 -0
  81. package/dist/cdn/{M7GWNGTJ.js → CARCFJRD.js} +1 -1
  82. package/dist/cdn/CJ3EZE7U.js +2 -0
  83. package/dist/cdn/{KZFMPHCV.js → CLRLOHTR.js} +1 -1
  84. package/dist/cdn/CMCEF65U.js +2 -0
  85. package/dist/cdn/CONTIW5Q.js +340 -0
  86. package/dist/cdn/CRDFUDM4.js +45 -0
  87. package/dist/cdn/{36HEIJAI.js → CS5N3DOL.js} +1 -1
  88. package/dist/cdn/{UVHM4PU5.js → CUG5CROK.js} +1 -1
  89. package/dist/cdn/{XC7LLCVS.js → CVXDL2AT.js} +1 -1
  90. package/dist/cdn/{EYBEUSBG.js → CWXZSWUA.js} +1 -1
  91. package/dist/cdn/D22STVK5.js +2 -0
  92. package/dist/cdn/{CZJPS7CF.js → D52QVYYU.js} +1 -1
  93. package/dist/cdn/D6U5SMQX.js +2 -0
  94. package/dist/cdn/{35HRMJUI.js → D6ZGMSQF.js} +1 -1
  95. package/dist/cdn/{MWFCDDBC.js → D7G4LZRG.js} +1 -1
  96. package/dist/cdn/DFHULDJT.js +3 -0
  97. package/dist/cdn/DGGIENYR.js +2 -0
  98. package/dist/cdn/{73O55ZBJ.js → DGQQF6WF.js} +1 -1
  99. package/dist/cdn/{3AQ7U2PF.js → DIBK4RSG.js} +1 -1
  100. package/dist/cdn/{7KEONOFN.js → DMENKRSP.js} +1 -1
  101. package/dist/cdn/{NLTK53B2.js → DQ47P6ES.js} +1 -1
  102. package/dist/cdn/DSJRQHKW.js +2 -0
  103. package/dist/cdn/{DWAYOC2L.js → DWKKP34X.js} +1 -1
  104. package/dist/cdn/E25ZWVBK.js +33 -0
  105. package/dist/cdn/E3F63VW4.js +2 -0
  106. package/dist/cdn/{HYB5LBMY.js → E7CWZMS4.js} +1 -1
  107. package/dist/cdn/EBAOA6CS.js +2 -0
  108. package/dist/cdn/{JMU5KKZH.js → EG5KPZQ2.js} +1 -1
  109. package/dist/cdn/{T3JHAFWW.js → EIF4KZBD.js} +1 -1
  110. package/dist/cdn/EL3OIP52.js +31 -0
  111. package/dist/cdn/{XPIAEAK5.js → EMPMQDRQ.js} +1 -1
  112. package/dist/cdn/ENLFOYSI.js +13 -0
  113. package/dist/cdn/ERLDQUNI.js +2 -0
  114. package/dist/cdn/{X4LKJTY5.js → ES63XK5X.js} +1 -1
  115. package/dist/cdn/ESJJVBZM.js +2 -0
  116. package/dist/cdn/EWS72RFR.js +2 -0
  117. package/dist/cdn/EXBEKVP5.js +2 -0
  118. package/dist/cdn/{MFJF6OXL.js → F4MS4NQL.js} +1 -1
  119. package/dist/cdn/F5463ORT.js +2 -0
  120. package/dist/cdn/{UDGR2GC5.js → FCJFAZ4S.js} +1 -1
  121. package/dist/cdn/{H3LJVYII.js → FE6JCIZY.js} +1 -1
  122. package/dist/cdn/{FFDZB5TW.js → FFZ2XVRE.js} +1 -1
  123. package/dist/cdn/FK6Q2LYR.js +2 -0
  124. package/dist/cdn/{XVRRQMOP.js → FSF3T3OT.js} +1 -1
  125. package/dist/cdn/FUW3T6S6.js +2 -0
  126. package/dist/cdn/{BPAYAR53.js → FVR5S6DL.js} +1 -1
  127. package/dist/cdn/FYJMHXWV.js +2 -0
  128. package/dist/cdn/G2H3X6NS.js +2 -0
  129. package/dist/cdn/{XTUL7OCR.js → G4V4JPFI.js} +1 -1
  130. package/dist/cdn/GDUCH242.js +2 -0
  131. package/dist/cdn/{3FMOO3PJ.js → GF4QELNV.js} +1 -1
  132. package/dist/cdn/GSCHQNQD.js +56 -0
  133. package/dist/cdn/GSR2GEY7.js +2 -0
  134. package/dist/cdn/{QMD2WK5F.js → GUSPFJUQ.js} +1 -1
  135. package/dist/cdn/{ELD2UQO4.js → GXZWJXHM.js} +1 -1
  136. package/dist/cdn/H4LZV33O.js +2 -0
  137. package/dist/cdn/{DIDOZ4J6.js → HB56DBBP.js} +5 -5
  138. package/dist/cdn/HGOH5KSX.js +2 -0
  139. package/dist/cdn/HIB4BVGK.js +2 -0
  140. package/dist/cdn/{NDUAEC62.js → HIPZRG2Q.js} +1 -1
  141. package/dist/cdn/{K5ZIHTQC.js → HJZRCLYP.js} +1 -1
  142. package/dist/cdn/HKFXHTYU.js +2 -0
  143. package/dist/cdn/{7DHQVMKX.js → HM2QALUN.js} +1 -1
  144. package/dist/cdn/HOCCKT72.js +2 -0
  145. package/dist/cdn/HUYLWWWJ.js +2 -0
  146. package/dist/cdn/HXNARVYH.js +3 -0
  147. package/dist/cdn/HYQVSB6C.js +2 -0
  148. package/dist/cdn/{I3D5WRYZ.js → I4VWG355.js} +1 -1
  149. package/dist/cdn/I5E3PM26.js +29 -0
  150. package/dist/cdn/I6EH3H6Z.js +2 -0
  151. package/dist/cdn/IADXB53D.js +2 -0
  152. package/dist/cdn/{FZ7WJ3YG.js → IAEFPE3L.js} +1 -1
  153. package/dist/cdn/ICY4O6XV.js +2 -0
  154. package/dist/cdn/{KU62OLRE.js → IHG7KTNC.js} +1 -1
  155. package/dist/cdn/{WMPUJYLT.js → INLWMPGE.js} +1 -1
  156. package/dist/cdn/IP7IUAM5.js +2 -0
  157. package/dist/cdn/{FJAJKPL6.js → IQVJCQTP.js} +1 -1
  158. package/dist/cdn/{6XELM7OM.js → IXJFVKYN.js} +1 -1
  159. package/dist/cdn/IXPNZCW6.js +2 -0
  160. package/dist/cdn/{IKN5RLJ4.js → IXRFWVBT.js} +1 -1
  161. package/dist/cdn/IZSQYFWM.js +2 -0
  162. package/dist/cdn/JCGZXASG.js +2 -0
  163. package/dist/cdn/JINR6G2D.js +2 -0
  164. package/dist/cdn/JJLYSRRX.js +2 -0
  165. package/dist/cdn/JS2MTHHP.js +2 -0
  166. package/dist/cdn/{ZF724O2R.js → JUPIKTGO.js} +1 -1
  167. package/dist/cdn/K6O33P5T.js +2 -0
  168. package/dist/cdn/{TZL2746B.js → KAGDNHPY.js} +1 -1
  169. package/dist/cdn/KDDHPA54.js +2 -0
  170. package/dist/cdn/{JLQYLRUP.js → KDHI3OWQ.js} +1 -1
  171. package/dist/cdn/{NOIG2A4U.js → KMTYPOFM.js} +1 -1
  172. package/dist/cdn/KR2PPIBX.js +2 -0
  173. package/dist/cdn/KWAQEZ3T.js +136 -0
  174. package/dist/cdn/LGBRHJBY.js +109 -0
  175. package/dist/cdn/{E7W2OZL3.js → LOWGHGDS.js} +1 -1
  176. package/dist/cdn/{LPBP7CBN.js → LP2JYX4X.js} +1 -1
  177. package/dist/cdn/LPFG5XTA.js +19 -0
  178. package/dist/cdn/LQ6PZESP.js +2 -0
  179. package/dist/cdn/LUIN5XSX.js +2 -0
  180. package/dist/cdn/LV5KMTCD.js +2 -0
  181. package/dist/cdn/{FDO2JBGW.js → LVK2J23W.js} +1 -1
  182. package/dist/cdn/LVYAW6XF.js +2 -0
  183. package/dist/cdn/LWJF6EXD.js +85 -0
  184. package/dist/cdn/LWQ4SBU2.js +2 -0
  185. package/dist/cdn/{RNTJMF4O.js → LXNQ32NZ.js} +1 -1
  186. package/dist/cdn/{2H7KJUZG.js → M6AOD7GG.js} +1 -1
  187. package/dist/cdn/{XG3T3NF3.js → MBAQ324M.js} +1 -1
  188. package/dist/cdn/MBT2S4J5.js +2 -0
  189. package/dist/cdn/MFVXFKKM.js +46 -0
  190. package/dist/cdn/MIV34H66.js +2 -0
  191. package/dist/cdn/{XIUYW7RN.js → MKDVJPNY.js} +1 -1
  192. package/dist/cdn/{57DOBXD6.js → MKSUYITL.js} +1 -1
  193. package/dist/cdn/MV7GEGP5.js +98 -0
  194. package/dist/cdn/{USM62FP5.js → MVDJOENC.js} +19 -19
  195. package/dist/cdn/{TVCG3ZCH.js → MW3IJQRQ.js} +1 -1
  196. package/dist/cdn/{B3R52L7H.js → N22MFQSQ.js} +1 -1
  197. package/dist/cdn/{3OQ24P5P.js → N33J6JX2.js} +1 -1
  198. package/dist/cdn/{BDXIKPLU.js → N7BXCDA3.js} +1 -1
  199. package/dist/cdn/{YUPT4BTA.js → NKEQVKHZ.js} +1 -1
  200. package/dist/cdn/NQH7ZZWD.js +2 -0
  201. package/dist/cdn/{KDE2RXEH.js → NVIMZ7ZS.js} +1 -1
  202. package/dist/cdn/O4DB2EXV.js +2 -0
  203. package/dist/cdn/{BIRAQCVT.js → OAEZN4D5.js} +1 -1
  204. package/dist/cdn/OGH565H7.js +3 -0
  205. package/dist/cdn/OJDW3XGU.js +2 -0
  206. package/dist/cdn/OTQLLNFG.js +2 -0
  207. package/dist/cdn/{JDVVMD4S.js → OZ7YBTKR.js} +1 -1
  208. package/dist/cdn/{KHHT54BU.js → PKOJQT4I.js} +1 -1
  209. package/dist/cdn/{4NALIU6Y.js → PLQEDCUG.js} +1 -1
  210. package/dist/cdn/PLXHBQBF.js +146 -0
  211. package/dist/cdn/PM4EFNB2.js +2 -0
  212. package/dist/cdn/{FV7G3BY6.js → PM7QF66M.js} +1 -1
  213. package/dist/cdn/{HBPD3T7H.js → PPFEO3UH.js} +1 -1
  214. package/dist/cdn/{QHYG6C3L.js → PSBOV4IR.js} +1 -1
  215. package/dist/cdn/{EYXOOK3V.js → PWER63DX.js} +1 -1
  216. package/dist/cdn/{LNLCO244.js → Q2K6BUCN.js} +1 -1
  217. package/dist/cdn/{ANX2J4ID.js → Q3WGKNJH.js} +1 -1
  218. package/dist/cdn/QH343537.js +56 -0
  219. package/dist/cdn/{PJ5ORVU5.js → QJICQ4W3.js} +1 -1
  220. package/dist/cdn/QKSC4XFL.js +2 -0
  221. package/dist/cdn/QMAV4UTN.js +2 -0
  222. package/dist/cdn/{UH4IH4MC.js → QQYN7RED.js} +1 -1
  223. package/dist/cdn/QZ2ZMWIH.js +2 -0
  224. package/dist/cdn/R27S3IDW.js +2 -0
  225. package/dist/cdn/RDJIKSXN.js +439 -0
  226. package/dist/cdn/RDRCAA3H.js +4 -0
  227. package/dist/cdn/{DKB6JTUF.js → RKZXRHZK.js} +1 -1
  228. package/dist/cdn/RLMMQ5UC.js +18 -0
  229. package/dist/cdn/{DLBZRD4H.js → RLSY4VUQ.js} +1 -1
  230. package/dist/cdn/ROGRXRFI.js +2 -0
  231. package/dist/cdn/RWHR4UZT.js +2 -0
  232. package/dist/cdn/{CZKXDUOH.js → RXM4BHPK.js} +1 -1
  233. package/dist/cdn/S26SZJC7.js +113 -0
  234. package/dist/cdn/S4GBMN37.js +2 -0
  235. package/dist/cdn/S5RB3GMN.js +2 -0
  236. package/dist/cdn/S7HFWITF.js +2 -0
  237. package/dist/cdn/{5ZVSYUD7.js → SDX7YG23.js} +1 -1
  238. package/dist/cdn/SGFSVWTY.js +7 -0
  239. package/dist/cdn/SHQFXQEI.js +2 -0
  240. package/dist/cdn/SJLSYFK3.js +2 -0
  241. package/dist/cdn/SNA7NRRQ.js +115 -0
  242. package/dist/cdn/{NH5526ON.js → SNBTGG5B.js} +1 -1
  243. package/dist/cdn/T3EPRHTT.js +4 -0
  244. package/dist/cdn/T5R4UF7Y.js +2 -0
  245. package/dist/cdn/{3T3GPK27.js → T6EKXYZA.js} +1 -1
  246. package/dist/cdn/TCUNTTNI.js +2 -0
  247. package/dist/cdn/TFO2AK45.js +2 -0
  248. package/dist/cdn/{ZYRNI524.js → TJDAE43J.js} +1 -1
  249. package/dist/cdn/TLIIJ2QC.js +122 -0
  250. package/dist/cdn/{NM3YBQUM.js → TWJ6DAY5.js} +1 -1
  251. package/dist/cdn/TZHRYPII.js +2 -0
  252. package/dist/cdn/{B6IICRWD.js → U2LBV6VU.js} +1 -1
  253. package/dist/cdn/U76GHEKJ.js +71 -0
  254. package/dist/cdn/{DZLVEIWW.js → UCYR537P.js} +1 -1
  255. package/dist/cdn/UIZL3C3H.js +2 -0
  256. package/dist/cdn/UUKV62PY.js +109 -0
  257. package/dist/cdn/V5BIPD5T.js +2 -0
  258. package/dist/cdn/V6N4G75E.js +2 -0
  259. package/dist/cdn/VDI7SDRK.js +5 -0
  260. package/dist/cdn/VDZT4UXB.js +36 -0
  261. package/dist/cdn/VHSGX4DC.js +2 -0
  262. package/dist/cdn/VJBL5ZUX.js +2 -0
  263. package/dist/cdn/{B7J5RZIJ.js → VJDUPEFF.js} +1 -1
  264. package/dist/cdn/VKHBBAXO.js +2 -0
  265. package/dist/cdn/VLBNRURV.js +2 -0
  266. package/dist/cdn/VLF76E2L.js +2 -0
  267. package/dist/cdn/{7GPGKDLH.js → VNTPM6CQ.js} +1 -1
  268. package/dist/cdn/{HDRMSU3L.js → VPFXIGOI.js} +1 -1
  269. package/dist/cdn/{JLYGSQEC.js → VUXNHQGR.js} +1 -1
  270. package/dist/cdn/VY364MR6.js +2 -0
  271. package/dist/cdn/WDASGI72.js +2 -0
  272. package/dist/cdn/{2TR3Y7HD.js → WFIMYIS3.js} +1 -1
  273. package/dist/cdn/WKRSOM6J.js +2 -0
  274. package/dist/cdn/WNVC3PSY.js +2 -0
  275. package/dist/cdn/WRWWRMHZ.js +4 -0
  276. package/dist/cdn/X6TQNCB3.js +2 -0
  277. package/dist/cdn/{AM5URNYD.js → XH6MM3RE.js} +1 -1
  278. package/dist/cdn/XKFX43FE.js +2 -0
  279. package/dist/cdn/XQ7SXIHI.js +2 -0
  280. package/dist/cdn/{S423P2GA.js → Y2AUIXNK.js} +1 -1
  281. package/dist/cdn/Y2MAVMNV.js +2 -0
  282. package/dist/cdn/{3IHLJADI.js → YKB6256M.js} +1 -1
  283. package/dist/cdn/YM4U4HSN.js +2 -0
  284. package/dist/cdn/{C44FH5Z2.js → YOBHTTO5.js} +1 -1
  285. package/dist/cdn/YPDXQEUA.js +77 -0
  286. package/dist/cdn/{JUUVYK2H.js → YQHYMLC7.js} +1 -1
  287. package/dist/cdn/YSQDSGSF.js +2 -0
  288. package/dist/cdn/YUI2MSOK.js +2 -0
  289. package/dist/cdn/{2BTU374O.js → YUKIKHOU.js} +1 -1
  290. package/dist/cdn/{AA7X6GKH.js → YUWXPLTE.js} +1 -1
  291. package/dist/cdn/YVWFYZTI.js +4 -0
  292. package/dist/cdn/YWX2U5OD.js +2 -0
  293. package/dist/cdn/{W2ZZLJGQ.js → ZBX2SDO5.js} +1 -1
  294. package/dist/cdn/{U6ALIHIC.js → ZNWZWFMH.js} +1 -1
  295. package/dist/cdn/ZPEVEBJD.js +121 -0
  296. package/dist/cdn/{DBHZRNFR.js → ZSO2PDMV.js} +1 -1
  297. package/dist/cdn/ZWASNOIQ.js +2 -0
  298. package/dist/cdn/{G2ME4BAQ.js → ZX3UHK6P.js} +1 -1
  299. package/dist/cdn/{OC2DD3AB.js → ZZOMKTFL.js} +1 -1
  300. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +1 -1
  301. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +1 -1
  302. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +1 -1
  303. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +1 -1
  304. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +1 -1
  305. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +1 -1
  306. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +1 -1
  307. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +1 -1
  308. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.en.json +1 -1
  309. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +1 -1
  310. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +1 -1
  311. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +1 -1
  312. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +1 -1
  313. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +1 -1
  314. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +1 -1
  315. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +1 -1
  316. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +1 -1
  317. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +1 -1
  318. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +1 -1
  319. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.json +1 -1
  320. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +1 -1
  321. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +1 -1
  322. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +1 -1
  323. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +1 -1
  324. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +1 -1
  325. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +1 -1
  326. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +1 -1
  327. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +1 -1
  328. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +1 -1
  329. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +1 -1
  330. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +1 -1
  331. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +1 -1
  332. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +1 -1
  333. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +1 -1
  334. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +1 -1
  335. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +1 -1
  336. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +1 -1
  337. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +1 -1
  338. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +1 -1
  339. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +1 -1
  340. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +1 -1
  341. package/dist/cdn/assets/buffer-tools/t9n/messages.ar.json +1 -1
  342. package/dist/cdn/assets/buffer-tools/t9n/messages.bg.json +1 -1
  343. package/dist/cdn/assets/buffer-tools/t9n/messages.bs.json +1 -1
  344. package/dist/cdn/assets/buffer-tools/t9n/messages.ca.json +1 -1
  345. package/dist/cdn/assets/buffer-tools/t9n/messages.cs.json +1 -1
  346. package/dist/cdn/assets/buffer-tools/t9n/messages.da.json +1 -1
  347. package/dist/cdn/assets/buffer-tools/t9n/messages.de.json +1 -1
  348. package/dist/cdn/assets/buffer-tools/t9n/messages.el.json +1 -1
  349. package/dist/cdn/assets/buffer-tools/t9n/messages.en.json +1 -1
  350. package/dist/cdn/assets/buffer-tools/t9n/messages.es.json +1 -1
  351. package/dist/cdn/assets/buffer-tools/t9n/messages.et.json +1 -1
  352. package/dist/cdn/assets/buffer-tools/t9n/messages.fi.json +1 -1
  353. package/dist/cdn/assets/buffer-tools/t9n/messages.fr.json +1 -1
  354. package/dist/cdn/assets/buffer-tools/t9n/messages.he.json +1 -1
  355. package/dist/cdn/assets/buffer-tools/t9n/messages.hr.json +1 -1
  356. package/dist/cdn/assets/buffer-tools/t9n/messages.hu.json +1 -1
  357. package/dist/cdn/assets/buffer-tools/t9n/messages.id.json +1 -1
  358. package/dist/cdn/assets/buffer-tools/t9n/messages.it.json +1 -1
  359. package/dist/cdn/assets/buffer-tools/t9n/messages.ja.json +1 -1
  360. package/dist/cdn/assets/buffer-tools/t9n/messages.json +1 -1
  361. package/dist/cdn/assets/buffer-tools/t9n/messages.ko.json +1 -1
  362. package/dist/cdn/assets/buffer-tools/t9n/messages.lt.json +1 -1
  363. package/dist/cdn/assets/buffer-tools/t9n/messages.lv.json +1 -1
  364. package/dist/cdn/assets/buffer-tools/t9n/messages.nl.json +1 -1
  365. package/dist/cdn/assets/buffer-tools/t9n/messages.no.json +1 -1
  366. package/dist/cdn/assets/buffer-tools/t9n/messages.pl.json +1 -1
  367. package/dist/cdn/assets/buffer-tools/t9n/messages.pt-BR.json +1 -1
  368. package/dist/cdn/assets/buffer-tools/t9n/messages.pt-PT.json +1 -1
  369. package/dist/cdn/assets/buffer-tools/t9n/messages.ro.json +1 -1
  370. package/dist/cdn/assets/buffer-tools/t9n/messages.ru.json +1 -1
  371. package/dist/cdn/assets/buffer-tools/t9n/messages.sk.json +1 -1
  372. package/dist/cdn/assets/buffer-tools/t9n/messages.sl.json +1 -1
  373. package/dist/cdn/assets/buffer-tools/t9n/messages.sr.json +1 -1
  374. package/dist/cdn/assets/buffer-tools/t9n/messages.sv.json +1 -1
  375. package/dist/cdn/assets/buffer-tools/t9n/messages.th.json +1 -1
  376. package/dist/cdn/assets/buffer-tools/t9n/messages.tr.json +1 -1
  377. package/dist/cdn/assets/buffer-tools/t9n/messages.uk.json +1 -1
  378. package/dist/cdn/assets/buffer-tools/t9n/messages.vi.json +1 -1
  379. package/dist/cdn/assets/buffer-tools/t9n/messages.zh-CN.json +1 -1
  380. package/dist/cdn/assets/buffer-tools/t9n/messages.zh-HK.json +1 -1
  381. package/dist/cdn/assets/buffer-tools/t9n/messages.zh-TW.json +1 -1
  382. package/dist/cdn/assets/card-manager/t9n/messages.ar.json +1 -1
  383. package/dist/cdn/assets/card-manager/t9n/messages.bg.json +1 -1
  384. package/dist/cdn/assets/card-manager/t9n/messages.bs.json +1 -1
  385. package/dist/cdn/assets/card-manager/t9n/messages.ca.json +1 -1
  386. package/dist/cdn/assets/card-manager/t9n/messages.cs.json +1 -1
  387. package/dist/cdn/assets/card-manager/t9n/messages.da.json +1 -1
  388. package/dist/cdn/assets/card-manager/t9n/messages.de.json +1 -1
  389. package/dist/cdn/assets/card-manager/t9n/messages.el.json +1 -1
  390. package/dist/cdn/assets/card-manager/t9n/messages.en.json +1 -1
  391. package/dist/cdn/assets/card-manager/t9n/messages.es.json +1 -1
  392. package/dist/cdn/assets/card-manager/t9n/messages.et.json +1 -1
  393. package/dist/cdn/assets/card-manager/t9n/messages.fi.json +1 -1
  394. package/dist/cdn/assets/card-manager/t9n/messages.fr.json +1 -1
  395. package/dist/cdn/assets/card-manager/t9n/messages.he.json +1 -1
  396. package/dist/cdn/assets/card-manager/t9n/messages.hr.json +1 -1
  397. package/dist/cdn/assets/card-manager/t9n/messages.hu.json +1 -1
  398. package/dist/cdn/assets/card-manager/t9n/messages.id.json +1 -1
  399. package/dist/cdn/assets/card-manager/t9n/messages.it.json +1 -1
  400. package/dist/cdn/assets/card-manager/t9n/messages.ja.json +1 -1
  401. package/dist/cdn/assets/card-manager/t9n/messages.json +1 -1
  402. package/dist/cdn/assets/card-manager/t9n/messages.ko.json +1 -1
  403. package/dist/cdn/assets/card-manager/t9n/messages.lt.json +1 -1
  404. package/dist/cdn/assets/card-manager/t9n/messages.lv.json +1 -1
  405. package/dist/cdn/assets/card-manager/t9n/messages.nl.json +1 -1
  406. package/dist/cdn/assets/card-manager/t9n/messages.no.json +1 -1
  407. package/dist/cdn/assets/card-manager/t9n/messages.pl.json +1 -1
  408. package/dist/cdn/assets/card-manager/t9n/messages.pt-BR.json +1 -1
  409. package/dist/cdn/assets/card-manager/t9n/messages.pt-PT.json +1 -1
  410. package/dist/cdn/assets/card-manager/t9n/messages.ro.json +1 -1
  411. package/dist/cdn/assets/card-manager/t9n/messages.ru.json +1 -1
  412. package/dist/cdn/assets/card-manager/t9n/messages.sk.json +1 -1
  413. package/dist/cdn/assets/card-manager/t9n/messages.sl.json +1 -1
  414. package/dist/cdn/assets/card-manager/t9n/messages.sr.json +1 -1
  415. package/dist/cdn/assets/card-manager/t9n/messages.sv.json +1 -1
  416. package/dist/cdn/assets/card-manager/t9n/messages.th.json +1 -1
  417. package/dist/cdn/assets/card-manager/t9n/messages.tr.json +1 -1
  418. package/dist/cdn/assets/card-manager/t9n/messages.uk.json +1 -1
  419. package/dist/cdn/assets/card-manager/t9n/messages.vi.json +1 -1
  420. package/dist/cdn/assets/card-manager/t9n/messages.zh-CN.json +1 -1
  421. package/dist/cdn/assets/card-manager/t9n/messages.zh-HK.json +1 -1
  422. package/dist/cdn/assets/card-manager/t9n/messages.zh-TW.json +1 -1
  423. package/dist/cdn/assets/consent-manager/t9n/messages.de.json +1 -1
  424. package/dist/cdn/assets/create-feature/t9n/messages.ar.json +1 -1
  425. package/dist/cdn/assets/create-feature/t9n/messages.bg.json +1 -1
  426. package/dist/cdn/assets/create-feature/t9n/messages.bs.json +1 -1
  427. package/dist/cdn/assets/create-feature/t9n/messages.ca.json +1 -1
  428. package/dist/cdn/assets/create-feature/t9n/messages.cs.json +1 -1
  429. package/dist/cdn/assets/create-feature/t9n/messages.da.json +1 -1
  430. package/dist/cdn/assets/create-feature/t9n/messages.de.json +1 -1
  431. package/dist/cdn/assets/create-feature/t9n/messages.el.json +1 -1
  432. package/dist/cdn/assets/create-feature/t9n/messages.en.json +1 -1
  433. package/dist/cdn/assets/create-feature/t9n/messages.es.json +1 -1
  434. package/dist/cdn/assets/create-feature/t9n/messages.et.json +1 -1
  435. package/dist/cdn/assets/create-feature/t9n/messages.fi.json +1 -1
  436. package/dist/cdn/assets/create-feature/t9n/messages.fr.json +1 -1
  437. package/dist/cdn/assets/create-feature/t9n/messages.he.json +1 -1
  438. package/dist/cdn/assets/create-feature/t9n/messages.hr.json +1 -1
  439. package/dist/cdn/assets/create-feature/t9n/messages.hu.json +1 -1
  440. package/dist/cdn/assets/create-feature/t9n/messages.id.json +1 -1
  441. package/dist/cdn/assets/create-feature/t9n/messages.it.json +1 -1
  442. package/dist/cdn/assets/create-feature/t9n/messages.ja.json +1 -1
  443. package/dist/cdn/assets/create-feature/t9n/messages.json +1 -1
  444. package/dist/cdn/assets/create-feature/t9n/messages.ko.json +1 -1
  445. package/dist/cdn/assets/create-feature/t9n/messages.lt.json +1 -1
  446. package/dist/cdn/assets/create-feature/t9n/messages.lv.json +1 -1
  447. package/dist/cdn/assets/create-feature/t9n/messages.nl.json +1 -1
  448. package/dist/cdn/assets/create-feature/t9n/messages.no.json +1 -1
  449. package/dist/cdn/assets/create-feature/t9n/messages.pl.json +1 -1
  450. package/dist/cdn/assets/create-feature/t9n/messages.pt-BR.json +1 -1
  451. package/dist/cdn/assets/create-feature/t9n/messages.pt-PT.json +1 -1
  452. package/dist/cdn/assets/create-feature/t9n/messages.ro.json +1 -1
  453. package/dist/cdn/assets/create-feature/t9n/messages.ru.json +1 -1
  454. package/dist/cdn/assets/create-feature/t9n/messages.sk.json +1 -1
  455. package/dist/cdn/assets/create-feature/t9n/messages.sl.json +1 -1
  456. package/dist/cdn/assets/create-feature/t9n/messages.sr.json +1 -1
  457. package/dist/cdn/assets/create-feature/t9n/messages.sv.json +1 -1
  458. package/dist/cdn/assets/create-feature/t9n/messages.th.json +1 -1
  459. package/dist/cdn/assets/create-feature/t9n/messages.tr.json +1 -1
  460. package/dist/cdn/assets/create-feature/t9n/messages.uk.json +1 -1
  461. package/dist/cdn/assets/create-feature/t9n/messages.vi.json +1 -1
  462. package/dist/cdn/assets/create-feature/t9n/messages.zh-CN.json +1 -1
  463. package/dist/cdn/assets/create-feature/t9n/messages.zh-HK.json +1 -1
  464. package/dist/cdn/assets/create-feature/t9n/messages.zh-TW.json +1 -1
  465. package/dist/cdn/assets/create-related-feature/t9n/messages.ar.json +1 -1
  466. package/dist/cdn/assets/create-related-feature/t9n/messages.bg.json +1 -1
  467. package/dist/cdn/assets/create-related-feature/t9n/messages.bs.json +1 -1
  468. package/dist/cdn/assets/create-related-feature/t9n/messages.ca.json +1 -1
  469. package/dist/cdn/assets/create-related-feature/t9n/messages.cs.json +1 -1
  470. package/dist/cdn/assets/create-related-feature/t9n/messages.da.json +1 -1
  471. package/dist/cdn/assets/create-related-feature/t9n/messages.de.json +1 -1
  472. package/dist/cdn/assets/create-related-feature/t9n/messages.el.json +1 -1
  473. package/dist/cdn/assets/create-related-feature/t9n/messages.en.json +1 -1
  474. package/dist/cdn/assets/create-related-feature/t9n/messages.es.json +1 -1
  475. package/dist/cdn/assets/create-related-feature/t9n/messages.et.json +1 -1
  476. package/dist/cdn/assets/create-related-feature/t9n/messages.fi.json +1 -1
  477. package/dist/cdn/assets/create-related-feature/t9n/messages.fr.json +1 -1
  478. package/dist/cdn/assets/create-related-feature/t9n/messages.he.json +1 -1
  479. package/dist/cdn/assets/create-related-feature/t9n/messages.hr.json +1 -1
  480. package/dist/cdn/assets/create-related-feature/t9n/messages.hu.json +1 -1
  481. package/dist/cdn/assets/create-related-feature/t9n/messages.id.json +1 -1
  482. package/dist/cdn/assets/create-related-feature/t9n/messages.it.json +1 -1
  483. package/dist/cdn/assets/create-related-feature/t9n/messages.ja.json +1 -1
  484. package/dist/cdn/assets/create-related-feature/t9n/messages.json +1 -1
  485. package/dist/cdn/assets/create-related-feature/t9n/messages.ko.json +1 -1
  486. package/dist/cdn/assets/create-related-feature/t9n/messages.lt.json +1 -1
  487. package/dist/cdn/assets/create-related-feature/t9n/messages.lv.json +1 -1
  488. package/dist/cdn/assets/create-related-feature/t9n/messages.nl.json +1 -1
  489. package/dist/cdn/assets/create-related-feature/t9n/messages.no.json +1 -1
  490. package/dist/cdn/assets/create-related-feature/t9n/messages.pl.json +1 -1
  491. package/dist/cdn/assets/create-related-feature/t9n/messages.pt-BR.json +1 -1
  492. package/dist/cdn/assets/create-related-feature/t9n/messages.pt-PT.json +1 -1
  493. package/dist/cdn/assets/create-related-feature/t9n/messages.ro.json +1 -1
  494. package/dist/cdn/assets/create-related-feature/t9n/messages.ru.json +1 -1
  495. package/dist/cdn/assets/create-related-feature/t9n/messages.sk.json +1 -1
  496. package/dist/cdn/assets/create-related-feature/t9n/messages.sl.json +1 -1
  497. package/dist/cdn/assets/create-related-feature/t9n/messages.sr.json +1 -1
  498. package/dist/cdn/assets/create-related-feature/t9n/messages.sv.json +1 -1
  499. package/dist/cdn/assets/create-related-feature/t9n/messages.th.json +1 -1
  500. package/dist/cdn/assets/create-related-feature/t9n/messages.tr.json +1 -1
  501. package/dist/cdn/assets/create-related-feature/t9n/messages.uk.json +1 -1
  502. package/dist/cdn/assets/create-related-feature/t9n/messages.vi.json +1 -1
  503. package/dist/cdn/assets/create-related-feature/t9n/messages.zh-CN.json +1 -1
  504. package/dist/cdn/assets/create-related-feature/t9n/messages.zh-HK.json +1 -1
  505. package/dist/cdn/assets/create-related-feature/t9n/messages.zh-TW.json +1 -1
  506. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ar.json +1 -1
  507. package/dist/cdn/assets/crowdsource-manager/t9n/messages.bg.json +1 -1
  508. package/dist/cdn/assets/crowdsource-manager/t9n/messages.bs.json +1 -1
  509. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ca.json +1 -1
  510. package/dist/cdn/assets/crowdsource-manager/t9n/messages.cs.json +1 -1
  511. package/dist/cdn/assets/crowdsource-manager/t9n/messages.da.json +1 -1
  512. package/dist/cdn/assets/crowdsource-manager/t9n/messages.de.json +1 -1
  513. package/dist/cdn/assets/crowdsource-manager/t9n/messages.el.json +1 -1
  514. package/dist/cdn/assets/crowdsource-manager/t9n/messages.en.json +1 -1
  515. package/dist/cdn/assets/crowdsource-manager/t9n/messages.es.json +1 -1
  516. package/dist/cdn/assets/crowdsource-manager/t9n/messages.et.json +1 -1
  517. package/dist/cdn/assets/crowdsource-manager/t9n/messages.fi.json +1 -1
  518. package/dist/cdn/assets/crowdsource-manager/t9n/messages.fr.json +1 -1
  519. package/dist/cdn/assets/crowdsource-manager/t9n/messages.he.json +1 -1
  520. package/dist/cdn/assets/crowdsource-manager/t9n/messages.hr.json +1 -1
  521. package/dist/cdn/assets/crowdsource-manager/t9n/messages.hu.json +1 -1
  522. package/dist/cdn/assets/crowdsource-manager/t9n/messages.id.json +1 -1
  523. package/dist/cdn/assets/crowdsource-manager/t9n/messages.it.json +1 -1
  524. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ja.json +1 -1
  525. package/dist/cdn/assets/crowdsource-manager/t9n/messages.json +1 -1
  526. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ko.json +1 -1
  527. package/dist/cdn/assets/crowdsource-manager/t9n/messages.lt.json +1 -1
  528. package/dist/cdn/assets/crowdsource-manager/t9n/messages.lv.json +1 -1
  529. package/dist/cdn/assets/crowdsource-manager/t9n/messages.nl.json +1 -1
  530. package/dist/cdn/assets/crowdsource-manager/t9n/messages.no.json +1 -1
  531. package/dist/cdn/assets/crowdsource-manager/t9n/messages.pl.json +1 -1
  532. package/dist/cdn/assets/crowdsource-manager/t9n/messages.pt-BR.json +1 -1
  533. package/dist/cdn/assets/crowdsource-manager/t9n/messages.pt-PT.json +1 -1
  534. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ro.json +1 -1
  535. package/dist/cdn/assets/crowdsource-manager/t9n/messages.ru.json +1 -1
  536. package/dist/cdn/assets/crowdsource-manager/t9n/messages.sk.json +1 -1
  537. package/dist/cdn/assets/crowdsource-manager/t9n/messages.sl.json +1 -1
  538. package/dist/cdn/assets/crowdsource-manager/t9n/messages.sr.json +1 -1
  539. package/dist/cdn/assets/crowdsource-manager/t9n/messages.sv.json +1 -1
  540. package/dist/cdn/assets/crowdsource-manager/t9n/messages.th.json +1 -1
  541. package/dist/cdn/assets/crowdsource-manager/t9n/messages.tr.json +1 -1
  542. package/dist/cdn/assets/crowdsource-manager/t9n/messages.uk.json +1 -1
  543. package/dist/cdn/assets/crowdsource-manager/t9n/messages.vi.json +1 -1
  544. package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-CN.json +1 -1
  545. package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-HK.json +1 -1
  546. package/dist/cdn/assets/crowdsource-manager/t9n/messages.zh-TW.json +1 -1
  547. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ar.json +1 -1
  548. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.bg.json +1 -1
  549. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.bs.json +1 -1
  550. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ca.json +1 -1
  551. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.cs.json +1 -1
  552. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.da.json +1 -1
  553. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.de.json +1 -1
  554. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.el.json +1 -1
  555. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.en.json +1 -1
  556. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.es.json +1 -1
  557. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.et.json +1 -1
  558. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.fi.json +1 -1
  559. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.fr.json +1 -1
  560. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.he.json +1 -1
  561. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.hr.json +1 -1
  562. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.hu.json +1 -1
  563. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.id.json +1 -1
  564. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.it.json +1 -1
  565. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ja.json +1 -1
  566. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.json +1 -1
  567. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ko.json +1 -1
  568. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.lt.json +1 -1
  569. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.lv.json +1 -1
  570. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.nl.json +1 -1
  571. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.no.json +1 -1
  572. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pl.json +1 -1
  573. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pt-BR.json +1 -1
  574. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.pt-PT.json +1 -1
  575. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ro.json +1 -1
  576. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.ru.json +1 -1
  577. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sk.json +1 -1
  578. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sl.json +1 -1
  579. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sr.json +1 -1
  580. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.sv.json +1 -1
  581. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.th.json +1 -1
  582. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.tr.json +1 -1
  583. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.uk.json +1 -1
  584. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.vi.json +1 -1
  585. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-CN.json +1 -1
  586. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-HK.json +1 -1
  587. package/dist/cdn/assets/crowdsource-reporter/t9n/messages.zh-TW.json +1 -1
  588. package/dist/cdn/assets/edit-card/t9n/messages.ar.json +1 -1
  589. package/dist/cdn/assets/edit-card/t9n/messages.bg.json +1 -1
  590. package/dist/cdn/assets/edit-card/t9n/messages.bs.json +1 -1
  591. package/dist/cdn/assets/edit-card/t9n/messages.ca.json +1 -1
  592. package/dist/cdn/assets/edit-card/t9n/messages.cs.json +1 -1
  593. package/dist/cdn/assets/edit-card/t9n/messages.da.json +1 -1
  594. package/dist/cdn/assets/edit-card/t9n/messages.de.json +1 -1
  595. package/dist/cdn/assets/edit-card/t9n/messages.el.json +1 -1
  596. package/dist/cdn/assets/edit-card/t9n/messages.en.json +1 -1
  597. package/dist/cdn/assets/edit-card/t9n/messages.es.json +1 -1
  598. package/dist/cdn/assets/edit-card/t9n/messages.et.json +1 -1
  599. package/dist/cdn/assets/edit-card/t9n/messages.fi.json +1 -1
  600. package/dist/cdn/assets/edit-card/t9n/messages.fr.json +1 -1
  601. package/dist/cdn/assets/edit-card/t9n/messages.he.json +1 -1
  602. package/dist/cdn/assets/edit-card/t9n/messages.hr.json +1 -1
  603. package/dist/cdn/assets/edit-card/t9n/messages.hu.json +1 -1
  604. package/dist/cdn/assets/edit-card/t9n/messages.id.json +1 -1
  605. package/dist/cdn/assets/edit-card/t9n/messages.it.json +1 -1
  606. package/dist/cdn/assets/edit-card/t9n/messages.ja.json +1 -1
  607. package/dist/cdn/assets/edit-card/t9n/messages.json +1 -1
  608. package/dist/cdn/assets/edit-card/t9n/messages.ko.json +1 -1
  609. package/dist/cdn/assets/edit-card/t9n/messages.lt.json +1 -1
  610. package/dist/cdn/assets/edit-card/t9n/messages.lv.json +1 -1
  611. package/dist/cdn/assets/edit-card/t9n/messages.nl.json +1 -1
  612. package/dist/cdn/assets/edit-card/t9n/messages.no.json +1 -1
  613. package/dist/cdn/assets/edit-card/t9n/messages.pl.json +1 -1
  614. package/dist/cdn/assets/edit-card/t9n/messages.pt-BR.json +1 -1
  615. package/dist/cdn/assets/edit-card/t9n/messages.pt-PT.json +1 -1
  616. package/dist/cdn/assets/edit-card/t9n/messages.ro.json +1 -1
  617. package/dist/cdn/assets/edit-card/t9n/messages.ru.json +1 -1
  618. package/dist/cdn/assets/edit-card/t9n/messages.sk.json +1 -1
  619. package/dist/cdn/assets/edit-card/t9n/messages.sl.json +1 -1
  620. package/dist/cdn/assets/edit-card/t9n/messages.sr.json +1 -1
  621. package/dist/cdn/assets/edit-card/t9n/messages.sv.json +1 -1
  622. package/dist/cdn/assets/edit-card/t9n/messages.th.json +1 -1
  623. package/dist/cdn/assets/edit-card/t9n/messages.tr.json +1 -1
  624. package/dist/cdn/assets/edit-card/t9n/messages.uk.json +1 -1
  625. package/dist/cdn/assets/edit-card/t9n/messages.vi.json +1 -1
  626. package/dist/cdn/assets/edit-card/t9n/messages.zh-CN.json +1 -1
  627. package/dist/cdn/assets/edit-card/t9n/messages.zh-HK.json +1 -1
  628. package/dist/cdn/assets/edit-card/t9n/messages.zh-TW.json +1 -1
  629. package/dist/cdn/assets/field-selection/t9n/messages.no.json +1 -1
  630. package/dist/cdn/assets/info-card/t9n/messages.ar.json +1 -1
  631. package/dist/cdn/assets/info-card/t9n/messages.bg.json +1 -1
  632. package/dist/cdn/assets/info-card/t9n/messages.bs.json +1 -1
  633. package/dist/cdn/assets/info-card/t9n/messages.ca.json +1 -1
  634. package/dist/cdn/assets/info-card/t9n/messages.cs.json +1 -1
  635. package/dist/cdn/assets/info-card/t9n/messages.da.json +1 -1
  636. package/dist/cdn/assets/info-card/t9n/messages.de.json +1 -1
  637. package/dist/cdn/assets/info-card/t9n/messages.el.json +1 -1
  638. package/dist/cdn/assets/info-card/t9n/messages.en.json +1 -1
  639. package/dist/cdn/assets/info-card/t9n/messages.es.json +1 -1
  640. package/dist/cdn/assets/info-card/t9n/messages.et.json +1 -1
  641. package/dist/cdn/assets/info-card/t9n/messages.fi.json +1 -1
  642. package/dist/cdn/assets/info-card/t9n/messages.fr.json +1 -1
  643. package/dist/cdn/assets/info-card/t9n/messages.he.json +1 -1
  644. package/dist/cdn/assets/info-card/t9n/messages.hr.json +1 -1
  645. package/dist/cdn/assets/info-card/t9n/messages.hu.json +1 -1
  646. package/dist/cdn/assets/info-card/t9n/messages.id.json +1 -1
  647. package/dist/cdn/assets/info-card/t9n/messages.it.json +1 -1
  648. package/dist/cdn/assets/info-card/t9n/messages.ja.json +1 -1
  649. package/dist/cdn/assets/info-card/t9n/messages.json +1 -1
  650. package/dist/cdn/assets/info-card/t9n/messages.ko.json +1 -1
  651. package/dist/cdn/assets/info-card/t9n/messages.lt.json +1 -1
  652. package/dist/cdn/assets/info-card/t9n/messages.lv.json +1 -1
  653. package/dist/cdn/assets/info-card/t9n/messages.nl.json +1 -1
  654. package/dist/cdn/assets/info-card/t9n/messages.no.json +1 -1
  655. package/dist/cdn/assets/info-card/t9n/messages.pl.json +1 -1
  656. package/dist/cdn/assets/info-card/t9n/messages.pt-BR.json +1 -1
  657. package/dist/cdn/assets/info-card/t9n/messages.pt-PT.json +1 -1
  658. package/dist/cdn/assets/info-card/t9n/messages.ro.json +1 -1
  659. package/dist/cdn/assets/info-card/t9n/messages.ru.json +1 -1
  660. package/dist/cdn/assets/info-card/t9n/messages.sk.json +1 -1
  661. package/dist/cdn/assets/info-card/t9n/messages.sl.json +1 -1
  662. package/dist/cdn/assets/info-card/t9n/messages.sr.json +1 -1
  663. package/dist/cdn/assets/info-card/t9n/messages.sv.json +1 -1
  664. package/dist/cdn/assets/info-card/t9n/messages.th.json +1 -1
  665. package/dist/cdn/assets/info-card/t9n/messages.tr.json +1 -1
  666. package/dist/cdn/assets/info-card/t9n/messages.uk.json +1 -1
  667. package/dist/cdn/assets/info-card/t9n/messages.vi.json +1 -1
  668. package/dist/cdn/assets/info-card/t9n/messages.zh-CN.json +1 -1
  669. package/dist/cdn/assets/info-card/t9n/messages.zh-HK.json +1 -1
  670. package/dist/cdn/assets/info-card/t9n/messages.zh-TW.json +1 -1
  671. package/dist/cdn/assets/layer-table/t9n/messages.ar.json +1 -1
  672. package/dist/cdn/assets/layer-table/t9n/messages.bg.json +1 -1
  673. package/dist/cdn/assets/layer-table/t9n/messages.bs.json +1 -1
  674. package/dist/cdn/assets/layer-table/t9n/messages.ca.json +1 -1
  675. package/dist/cdn/assets/layer-table/t9n/messages.cs.json +1 -1
  676. package/dist/cdn/assets/layer-table/t9n/messages.da.json +1 -1
  677. package/dist/cdn/assets/layer-table/t9n/messages.de.json +1 -1
  678. package/dist/cdn/assets/layer-table/t9n/messages.el.json +1 -1
  679. package/dist/cdn/assets/layer-table/t9n/messages.en.json +1 -1
  680. package/dist/cdn/assets/layer-table/t9n/messages.es.json +1 -1
  681. package/dist/cdn/assets/layer-table/t9n/messages.et.json +1 -1
  682. package/dist/cdn/assets/layer-table/t9n/messages.fi.json +1 -1
  683. package/dist/cdn/assets/layer-table/t9n/messages.fr.json +1 -1
  684. package/dist/cdn/assets/layer-table/t9n/messages.he.json +1 -1
  685. package/dist/cdn/assets/layer-table/t9n/messages.hr.json +1 -1
  686. package/dist/cdn/assets/layer-table/t9n/messages.hu.json +1 -1
  687. package/dist/cdn/assets/layer-table/t9n/messages.id.json +1 -1
  688. package/dist/cdn/assets/layer-table/t9n/messages.it.json +1 -1
  689. package/dist/cdn/assets/layer-table/t9n/messages.ja.json +1 -1
  690. package/dist/cdn/assets/layer-table/t9n/messages.json +1 -1
  691. package/dist/cdn/assets/layer-table/t9n/messages.ko.json +1 -1
  692. package/dist/cdn/assets/layer-table/t9n/messages.lt.json +1 -1
  693. package/dist/cdn/assets/layer-table/t9n/messages.lv.json +1 -1
  694. package/dist/cdn/assets/layer-table/t9n/messages.nl.json +1 -1
  695. package/dist/cdn/assets/layer-table/t9n/messages.no.json +1 -1
  696. package/dist/cdn/assets/layer-table/t9n/messages.pl.json +1 -1
  697. package/dist/cdn/assets/layer-table/t9n/messages.pt-BR.json +1 -1
  698. package/dist/cdn/assets/layer-table/t9n/messages.pt-PT.json +1 -1
  699. package/dist/cdn/assets/layer-table/t9n/messages.ro.json +1 -1
  700. package/dist/cdn/assets/layer-table/t9n/messages.ru.json +1 -1
  701. package/dist/cdn/assets/layer-table/t9n/messages.sk.json +1 -1
  702. package/dist/cdn/assets/layer-table/t9n/messages.sl.json +1 -1
  703. package/dist/cdn/assets/layer-table/t9n/messages.sr.json +1 -1
  704. package/dist/cdn/assets/layer-table/t9n/messages.sv.json +1 -1
  705. package/dist/cdn/assets/layer-table/t9n/messages.th.json +1 -1
  706. package/dist/cdn/assets/layer-table/t9n/messages.tr.json +1 -1
  707. package/dist/cdn/assets/layer-table/t9n/messages.uk.json +1 -1
  708. package/dist/cdn/assets/layer-table/t9n/messages.vi.json +1 -1
  709. package/dist/cdn/assets/layer-table/t9n/messages.zh-CN.json +1 -1
  710. package/dist/cdn/assets/layer-table/t9n/messages.zh-HK.json +1 -1
  711. package/dist/cdn/assets/layer-table/t9n/messages.zh-TW.json +1 -1
  712. package/dist/cdn/assets/map-card/t9n/messages.ar.json +1 -1
  713. package/dist/cdn/assets/map-card/t9n/messages.bg.json +1 -1
  714. package/dist/cdn/assets/map-card/t9n/messages.bs.json +1 -1
  715. package/dist/cdn/assets/map-card/t9n/messages.ca.json +1 -1
  716. package/dist/cdn/assets/map-card/t9n/messages.cs.json +1 -1
  717. package/dist/cdn/assets/map-card/t9n/messages.da.json +1 -1
  718. package/dist/cdn/assets/map-card/t9n/messages.de.json +1 -1
  719. package/dist/cdn/assets/map-card/t9n/messages.el.json +1 -1
  720. package/dist/cdn/assets/map-card/t9n/messages.en.json +1 -1
  721. package/dist/cdn/assets/map-card/t9n/messages.es.json +1 -1
  722. package/dist/cdn/assets/map-card/t9n/messages.et.json +1 -1
  723. package/dist/cdn/assets/map-card/t9n/messages.fi.json +1 -1
  724. package/dist/cdn/assets/map-card/t9n/messages.fr.json +1 -1
  725. package/dist/cdn/assets/map-card/t9n/messages.he.json +1 -1
  726. package/dist/cdn/assets/map-card/t9n/messages.hr.json +1 -1
  727. package/dist/cdn/assets/map-card/t9n/messages.hu.json +1 -1
  728. package/dist/cdn/assets/map-card/t9n/messages.id.json +1 -1
  729. package/dist/cdn/assets/map-card/t9n/messages.it.json +1 -1
  730. package/dist/cdn/assets/map-card/t9n/messages.ja.json +1 -1
  731. package/dist/cdn/assets/map-card/t9n/messages.json +1 -1
  732. package/dist/cdn/assets/map-card/t9n/messages.ko.json +1 -1
  733. package/dist/cdn/assets/map-card/t9n/messages.lt.json +1 -1
  734. package/dist/cdn/assets/map-card/t9n/messages.lv.json +1 -1
  735. package/dist/cdn/assets/map-card/t9n/messages.nl.json +1 -1
  736. package/dist/cdn/assets/map-card/t9n/messages.no.json +1 -1
  737. package/dist/cdn/assets/map-card/t9n/messages.pl.json +1 -1
  738. package/dist/cdn/assets/map-card/t9n/messages.pt-BR.json +1 -1
  739. package/dist/cdn/assets/map-card/t9n/messages.pt-PT.json +1 -1
  740. package/dist/cdn/assets/map-card/t9n/messages.ro.json +1 -1
  741. package/dist/cdn/assets/map-card/t9n/messages.ru.json +1 -1
  742. package/dist/cdn/assets/map-card/t9n/messages.sk.json +1 -1
  743. package/dist/cdn/assets/map-card/t9n/messages.sl.json +1 -1
  744. package/dist/cdn/assets/map-card/t9n/messages.sr.json +1 -1
  745. package/dist/cdn/assets/map-card/t9n/messages.sv.json +1 -1
  746. package/dist/cdn/assets/map-card/t9n/messages.th.json +1 -1
  747. package/dist/cdn/assets/map-card/t9n/messages.tr.json +1 -1
  748. package/dist/cdn/assets/map-card/t9n/messages.uk.json +1 -1
  749. package/dist/cdn/assets/map-card/t9n/messages.vi.json +1 -1
  750. package/dist/cdn/assets/map-card/t9n/messages.zh-CN.json +1 -1
  751. package/dist/cdn/assets/map-card/t9n/messages.zh-HK.json +1 -1
  752. package/dist/cdn/assets/map-card/t9n/messages.zh-TW.json +1 -1
  753. package/dist/cdn/assets/map-picker/t9n/messages.ar.json +1 -1
  754. package/dist/cdn/assets/map-picker/t9n/messages.bg.json +1 -1
  755. package/dist/cdn/assets/map-picker/t9n/messages.bs.json +1 -1
  756. package/dist/cdn/assets/map-picker/t9n/messages.ca.json +1 -1
  757. package/dist/cdn/assets/map-picker/t9n/messages.cs.json +1 -1
  758. package/dist/cdn/assets/map-picker/t9n/messages.da.json +1 -1
  759. package/dist/cdn/assets/map-picker/t9n/messages.de.json +1 -1
  760. package/dist/cdn/assets/map-picker/t9n/messages.el.json +1 -1
  761. package/dist/cdn/assets/map-picker/t9n/messages.en.json +1 -1
  762. package/dist/cdn/assets/map-picker/t9n/messages.es.json +1 -1
  763. package/dist/cdn/assets/map-picker/t9n/messages.et.json +1 -1
  764. package/dist/cdn/assets/map-picker/t9n/messages.fi.json +1 -1
  765. package/dist/cdn/assets/map-picker/t9n/messages.fr.json +1 -1
  766. package/dist/cdn/assets/map-picker/t9n/messages.he.json +1 -1
  767. package/dist/cdn/assets/map-picker/t9n/messages.hr.json +1 -1
  768. package/dist/cdn/assets/map-picker/t9n/messages.hu.json +1 -1
  769. package/dist/cdn/assets/map-picker/t9n/messages.id.json +1 -1
  770. package/dist/cdn/assets/map-picker/t9n/messages.it.json +1 -1
  771. package/dist/cdn/assets/map-picker/t9n/messages.ja.json +1 -1
  772. package/dist/cdn/assets/map-picker/t9n/messages.json +1 -1
  773. package/dist/cdn/assets/map-picker/t9n/messages.ko.json +1 -1
  774. package/dist/cdn/assets/map-picker/t9n/messages.lt.json +1 -1
  775. package/dist/cdn/assets/map-picker/t9n/messages.lv.json +1 -1
  776. package/dist/cdn/assets/map-picker/t9n/messages.nl.json +1 -1
  777. package/dist/cdn/assets/map-picker/t9n/messages.no.json +1 -1
  778. package/dist/cdn/assets/map-picker/t9n/messages.pl.json +1 -1
  779. package/dist/cdn/assets/map-picker/t9n/messages.pt-BR.json +1 -1
  780. package/dist/cdn/assets/map-picker/t9n/messages.pt-PT.json +1 -1
  781. package/dist/cdn/assets/map-picker/t9n/messages.ro.json +1 -1
  782. package/dist/cdn/assets/map-picker/t9n/messages.ru.json +1 -1
  783. package/dist/cdn/assets/map-picker/t9n/messages.sk.json +1 -1
  784. package/dist/cdn/assets/map-picker/t9n/messages.sl.json +1 -1
  785. package/dist/cdn/assets/map-picker/t9n/messages.sr.json +1 -1
  786. package/dist/cdn/assets/map-picker/t9n/messages.sv.json +1 -1
  787. package/dist/cdn/assets/map-picker/t9n/messages.th.json +1 -1
  788. package/dist/cdn/assets/map-picker/t9n/messages.tr.json +1 -1
  789. package/dist/cdn/assets/map-picker/t9n/messages.uk.json +1 -1
  790. package/dist/cdn/assets/map-picker/t9n/messages.vi.json +1 -1
  791. package/dist/cdn/assets/map-picker/t9n/messages.zh-CN.json +1 -1
  792. package/dist/cdn/assets/map-picker/t9n/messages.zh-HK.json +1 -1
  793. package/dist/cdn/assets/map-picker/t9n/messages.zh-TW.json +1 -1
  794. package/dist/cdn/assets/solution-builder-assistant/images/conduct-field-inspections.png +0 -0
  795. package/dist/cdn/assets/solution-builder-assistant/images/locate-points-of-interest.png +0 -0
  796. package/dist/cdn/assets/solution-builder-assistant/images/manage-spatial-data.png +0 -0
  797. package/dist/cdn/assets/solution-builder-assistant/images/solutions-builder-draft-thumbnail.png +0 -0
  798. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ar.json +1 -0
  799. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.bg.json +1 -0
  800. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.bs.json +1 -0
  801. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ca.json +1 -0
  802. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.cs.json +1 -0
  803. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.da.json +1 -0
  804. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.de.json +1 -0
  805. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.el.json +1 -0
  806. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.en.json +1 -0
  807. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.es.json +1 -0
  808. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.et.json +1 -0
  809. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.fi.json +1 -0
  810. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.fr.json +1 -0
  811. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.he.json +1 -0
  812. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.hr.json +1 -0
  813. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.hu.json +1 -0
  814. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.id.json +1 -0
  815. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.it.json +1 -0
  816. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ja.json +1 -0
  817. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.json +1 -0
  818. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ko.json +1 -0
  819. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.lt.json +1 -0
  820. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.lv.json +1 -0
  821. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.nl.json +1 -0
  822. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.no.json +1 -0
  823. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pl.json +1 -0
  824. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pt-BR.json +1 -0
  825. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.pt-PT.json +1 -0
  826. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ro.json +1 -0
  827. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.ru.json +1 -0
  828. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sk.json +1 -0
  829. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sl.json +1 -0
  830. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sr.json +1 -0
  831. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.sv.json +1 -0
  832. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.th.json +1 -0
  833. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.tr.json +1 -0
  834. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.uk.json +1 -0
  835. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.vi.json +1 -0
  836. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-CN.json +1 -0
  837. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-HK.json +1 -0
  838. package/dist/cdn/assets/solution-builder-assistant/t9n/messages.zh-TW.json +1 -0
  839. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ar.json +1 -1
  840. package/dist/cdn/assets/solution-configure-titles/t9n/messages.bg.json +1 -1
  841. package/dist/cdn/assets/solution-configure-titles/t9n/messages.bs.json +1 -1
  842. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ca.json +1 -1
  843. package/dist/cdn/assets/solution-configure-titles/t9n/messages.cs.json +1 -1
  844. package/dist/cdn/assets/solution-configure-titles/t9n/messages.da.json +1 -1
  845. package/dist/cdn/assets/solution-configure-titles/t9n/messages.de.json +1 -1
  846. package/dist/cdn/assets/solution-configure-titles/t9n/messages.el.json +1 -1
  847. package/dist/cdn/assets/solution-configure-titles/t9n/messages.en.json +1 -1
  848. package/dist/cdn/assets/solution-configure-titles/t9n/messages.es.json +1 -1
  849. package/dist/cdn/assets/solution-configure-titles/t9n/messages.et.json +1 -1
  850. package/dist/cdn/assets/solution-configure-titles/t9n/messages.fi.json +1 -1
  851. package/dist/cdn/assets/solution-configure-titles/t9n/messages.fr.json +1 -1
  852. package/dist/cdn/assets/solution-configure-titles/t9n/messages.he.json +1 -1
  853. package/dist/cdn/assets/solution-configure-titles/t9n/messages.hr.json +1 -1
  854. package/dist/cdn/assets/solution-configure-titles/t9n/messages.hu.json +1 -1
  855. package/dist/cdn/assets/solution-configure-titles/t9n/messages.id.json +1 -1
  856. package/dist/cdn/assets/solution-configure-titles/t9n/messages.it.json +1 -1
  857. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ja.json +1 -1
  858. package/dist/cdn/assets/solution-configure-titles/t9n/messages.json +1 -1
  859. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ko.json +1 -1
  860. package/dist/cdn/assets/solution-configure-titles/t9n/messages.lt.json +1 -1
  861. package/dist/cdn/assets/solution-configure-titles/t9n/messages.lv.json +1 -1
  862. package/dist/cdn/assets/solution-configure-titles/t9n/messages.nl.json +1 -1
  863. package/dist/cdn/assets/solution-configure-titles/t9n/messages.no.json +1 -1
  864. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pl.json +1 -1
  865. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-BR.json +1 -1
  866. package/dist/cdn/assets/solution-configure-titles/t9n/messages.pt-PT.json +1 -1
  867. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ro.json +1 -1
  868. package/dist/cdn/assets/solution-configure-titles/t9n/messages.ru.json +1 -1
  869. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sk.json +1 -1
  870. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sl.json +1 -1
  871. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sr.json +1 -1
  872. package/dist/cdn/assets/solution-configure-titles/t9n/messages.sv.json +1 -1
  873. package/dist/cdn/assets/solution-configure-titles/t9n/messages.th.json +1 -1
  874. package/dist/cdn/assets/solution-configure-titles/t9n/messages.tr.json +1 -1
  875. package/dist/cdn/assets/solution-configure-titles/t9n/messages.uk.json +1 -1
  876. package/dist/cdn/assets/solution-configure-titles/t9n/messages.vi.json +1 -1
  877. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-CN.json +1 -1
  878. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-HK.json +1 -1
  879. package/dist/cdn/assets/solution-configure-titles/t9n/messages.zh-TW.json +1 -1
  880. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ar.json +1 -1
  881. package/dist/cdn/assets/solution-deployed-card/t9n/messages.bg.json +1 -1
  882. package/dist/cdn/assets/solution-deployed-card/t9n/messages.bs.json +1 -1
  883. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ca.json +1 -1
  884. package/dist/cdn/assets/solution-deployed-card/t9n/messages.cs.json +1 -1
  885. package/dist/cdn/assets/solution-deployed-card/t9n/messages.da.json +1 -1
  886. package/dist/cdn/assets/solution-deployed-card/t9n/messages.de.json +1 -1
  887. package/dist/cdn/assets/solution-deployed-card/t9n/messages.el.json +1 -1
  888. package/dist/cdn/assets/solution-deployed-card/t9n/messages.en.json +1 -1
  889. package/dist/cdn/assets/solution-deployed-card/t9n/messages.es.json +1 -1
  890. package/dist/cdn/assets/solution-deployed-card/t9n/messages.et.json +1 -1
  891. package/dist/cdn/assets/solution-deployed-card/t9n/messages.fi.json +1 -1
  892. package/dist/cdn/assets/solution-deployed-card/t9n/messages.fr.json +1 -1
  893. package/dist/cdn/assets/solution-deployed-card/t9n/messages.he.json +1 -1
  894. package/dist/cdn/assets/solution-deployed-card/t9n/messages.hr.json +1 -1
  895. package/dist/cdn/assets/solution-deployed-card/t9n/messages.hu.json +1 -1
  896. package/dist/cdn/assets/solution-deployed-card/t9n/messages.id.json +1 -1
  897. package/dist/cdn/assets/solution-deployed-card/t9n/messages.it.json +1 -1
  898. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ja.json +1 -1
  899. package/dist/cdn/assets/solution-deployed-card/t9n/messages.json +1 -1
  900. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ko.json +1 -1
  901. package/dist/cdn/assets/solution-deployed-card/t9n/messages.lt.json +1 -1
  902. package/dist/cdn/assets/solution-deployed-card/t9n/messages.lv.json +1 -1
  903. package/dist/cdn/assets/solution-deployed-card/t9n/messages.nl.json +1 -1
  904. package/dist/cdn/assets/solution-deployed-card/t9n/messages.no.json +1 -1
  905. package/dist/cdn/assets/solution-deployed-card/t9n/messages.pl.json +1 -1
  906. package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-BR.json +1 -1
  907. package/dist/cdn/assets/solution-deployed-card/t9n/messages.pt-PT.json +1 -1
  908. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ro.json +1 -1
  909. package/dist/cdn/assets/solution-deployed-card/t9n/messages.ru.json +1 -1
  910. package/dist/cdn/assets/solution-deployed-card/t9n/messages.sk.json +1 -1
  911. package/dist/cdn/assets/solution-deployed-card/t9n/messages.sl.json +1 -1
  912. package/dist/cdn/assets/solution-deployed-card/t9n/messages.sr.json +1 -1
  913. package/dist/cdn/assets/solution-deployed-card/t9n/messages.sv.json +1 -1
  914. package/dist/cdn/assets/solution-deployed-card/t9n/messages.th.json +1 -1
  915. package/dist/cdn/assets/solution-deployed-card/t9n/messages.tr.json +1 -1
  916. package/dist/cdn/assets/solution-deployed-card/t9n/messages.uk.json +1 -1
  917. package/dist/cdn/assets/solution-deployed-card/t9n/messages.vi.json +1 -1
  918. package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-CN.json +1 -1
  919. package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-HK.json +1 -1
  920. package/dist/cdn/assets/solution-deployed-card/t9n/messages.zh-TW.json +1 -1
  921. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ar.json +1 -1
  922. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bg.json +1 -1
  923. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.bs.json +1 -1
  924. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ca.json +1 -1
  925. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.cs.json +1 -1
  926. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.da.json +1 -1
  927. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.de.json +1 -1
  928. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.el.json +1 -1
  929. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.en.json +1 -1
  930. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.es.json +1 -1
  931. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.et.json +1 -1
  932. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fi.json +1 -1
  933. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.fr.json +1 -1
  934. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.he.json +1 -1
  935. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hr.json +1 -1
  936. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.hu.json +1 -1
  937. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.id.json +1 -1
  938. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.it.json +1 -1
  939. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ja.json +1 -1
  940. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.json +1 -1
  941. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ko.json +1 -1
  942. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lt.json +1 -1
  943. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.lv.json +1 -1
  944. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.nl.json +1 -1
  945. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.no.json +1 -1
  946. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pl.json +1 -1
  947. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-BR.json +1 -1
  948. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.pt-PT.json +1 -1
  949. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ro.json +1 -1
  950. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.ru.json +1 -1
  951. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sk.json +1 -1
  952. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sl.json +1 -1
  953. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sr.json +1 -1
  954. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.sv.json +1 -1
  955. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.th.json +1 -1
  956. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.tr.json +1 -1
  957. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.uk.json +1 -1
  958. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.vi.json +1 -1
  959. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-CN.json +1 -1
  960. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-HK.json +1 -1
  961. package/dist/cdn/assets/solution-deployed-card-panel/t9n/messages.zh-TW.json +1 -1
  962. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fi.json +1 -1
  963. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.fr.json +1 -1
  964. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.ja.json +1 -1
  965. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.nl.json +1 -1
  966. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.sk.json +1 -1
  967. package/dist/cdn/assets/solution-deploying-dialog/t9n/messages.tr.json +1 -1
  968. package/dist/cdn/assets/solution-details-card/t9n/messages.ar.json +1 -1
  969. package/dist/cdn/assets/solution-details-card/t9n/messages.bg.json +1 -1
  970. package/dist/cdn/assets/solution-details-card/t9n/messages.bs.json +1 -1
  971. package/dist/cdn/assets/solution-details-card/t9n/messages.ca.json +1 -1
  972. package/dist/cdn/assets/solution-details-card/t9n/messages.cs.json +1 -1
  973. package/dist/cdn/assets/solution-details-card/t9n/messages.da.json +1 -1
  974. package/dist/cdn/assets/solution-details-card/t9n/messages.de.json +1 -1
  975. package/dist/cdn/assets/solution-details-card/t9n/messages.el.json +1 -1
  976. package/dist/cdn/assets/solution-details-card/t9n/messages.en.json +1 -1
  977. package/dist/cdn/assets/solution-details-card/t9n/messages.es.json +1 -1
  978. package/dist/cdn/assets/solution-details-card/t9n/messages.et.json +1 -1
  979. package/dist/cdn/assets/solution-details-card/t9n/messages.fi.json +1 -1
  980. package/dist/cdn/assets/solution-details-card/t9n/messages.fr.json +1 -1
  981. package/dist/cdn/assets/solution-details-card/t9n/messages.he.json +1 -1
  982. package/dist/cdn/assets/solution-details-card/t9n/messages.hr.json +1 -1
  983. package/dist/cdn/assets/solution-details-card/t9n/messages.hu.json +1 -1
  984. package/dist/cdn/assets/solution-details-card/t9n/messages.id.json +1 -1
  985. package/dist/cdn/assets/solution-details-card/t9n/messages.it.json +1 -1
  986. package/dist/cdn/assets/solution-details-card/t9n/messages.ja.json +1 -1
  987. package/dist/cdn/assets/solution-details-card/t9n/messages.json +1 -1
  988. package/dist/cdn/assets/solution-details-card/t9n/messages.ko.json +1 -1
  989. package/dist/cdn/assets/solution-details-card/t9n/messages.lt.json +1 -1
  990. package/dist/cdn/assets/solution-details-card/t9n/messages.lv.json +1 -1
  991. package/dist/cdn/assets/solution-details-card/t9n/messages.nl.json +1 -1
  992. package/dist/cdn/assets/solution-details-card/t9n/messages.no.json +1 -1
  993. package/dist/cdn/assets/solution-details-card/t9n/messages.pl.json +1 -1
  994. package/dist/cdn/assets/solution-details-card/t9n/messages.pt-BR.json +1 -1
  995. package/dist/cdn/assets/solution-details-card/t9n/messages.pt-PT.json +1 -1
  996. package/dist/cdn/assets/solution-details-card/t9n/messages.ro.json +1 -1
  997. package/dist/cdn/assets/solution-details-card/t9n/messages.ru.json +1 -1
  998. package/dist/cdn/assets/solution-details-card/t9n/messages.sk.json +1 -1
  999. package/dist/cdn/assets/solution-details-card/t9n/messages.sl.json +1 -1
  1000. package/dist/cdn/assets/solution-details-card/t9n/messages.sr.json +1 -1
  1001. package/dist/cdn/assets/solution-details-card/t9n/messages.sv.json +1 -1
  1002. package/dist/cdn/assets/solution-details-card/t9n/messages.th.json +1 -1
  1003. package/dist/cdn/assets/solution-details-card/t9n/messages.tr.json +1 -1
  1004. package/dist/cdn/assets/solution-details-card/t9n/messages.uk.json +1 -1
  1005. package/dist/cdn/assets/solution-details-card/t9n/messages.vi.json +1 -1
  1006. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-CN.json +1 -1
  1007. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-HK.json +1 -1
  1008. package/dist/cdn/assets/solution-details-card/t9n/messages.zh-TW.json +1 -1
  1009. package/dist/cdn/assets/solution-details-panel/t9n/messages.ar.json +1 -1
  1010. package/dist/cdn/assets/solution-details-panel/t9n/messages.bg.json +1 -1
  1011. package/dist/cdn/assets/solution-details-panel/t9n/messages.bs.json +1 -1
  1012. package/dist/cdn/assets/solution-details-panel/t9n/messages.ca.json +1 -1
  1013. package/dist/cdn/assets/solution-details-panel/t9n/messages.cs.json +1 -1
  1014. package/dist/cdn/assets/solution-details-panel/t9n/messages.da.json +1 -1
  1015. package/dist/cdn/assets/solution-details-panel/t9n/messages.de.json +1 -1
  1016. package/dist/cdn/assets/solution-details-panel/t9n/messages.el.json +1 -1
  1017. package/dist/cdn/assets/solution-details-panel/t9n/messages.en.json +1 -1
  1018. package/dist/cdn/assets/solution-details-panel/t9n/messages.es.json +1 -1
  1019. package/dist/cdn/assets/solution-details-panel/t9n/messages.et.json +1 -1
  1020. package/dist/cdn/assets/solution-details-panel/t9n/messages.fi.json +1 -1
  1021. package/dist/cdn/assets/solution-details-panel/t9n/messages.fr.json +1 -1
  1022. package/dist/cdn/assets/solution-details-panel/t9n/messages.he.json +1 -1
  1023. package/dist/cdn/assets/solution-details-panel/t9n/messages.hr.json +1 -1
  1024. package/dist/cdn/assets/solution-details-panel/t9n/messages.hu.json +1 -1
  1025. package/dist/cdn/assets/solution-details-panel/t9n/messages.id.json +1 -1
  1026. package/dist/cdn/assets/solution-details-panel/t9n/messages.it.json +1 -1
  1027. package/dist/cdn/assets/solution-details-panel/t9n/messages.ja.json +1 -1
  1028. package/dist/cdn/assets/solution-details-panel/t9n/messages.json +1 -1
  1029. package/dist/cdn/assets/solution-details-panel/t9n/messages.ko.json +1 -1
  1030. package/dist/cdn/assets/solution-details-panel/t9n/messages.lt.json +1 -1
  1031. package/dist/cdn/assets/solution-details-panel/t9n/messages.lv.json +1 -1
  1032. package/dist/cdn/assets/solution-details-panel/t9n/messages.nl.json +1 -1
  1033. package/dist/cdn/assets/solution-details-panel/t9n/messages.no.json +1 -1
  1034. package/dist/cdn/assets/solution-details-panel/t9n/messages.pl.json +1 -1
  1035. package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-BR.json +1 -1
  1036. package/dist/cdn/assets/solution-details-panel/t9n/messages.pt-PT.json +1 -1
  1037. package/dist/cdn/assets/solution-details-panel/t9n/messages.ro.json +1 -1
  1038. package/dist/cdn/assets/solution-details-panel/t9n/messages.ru.json +1 -1
  1039. package/dist/cdn/assets/solution-details-panel/t9n/messages.sk.json +1 -1
  1040. package/dist/cdn/assets/solution-details-panel/t9n/messages.sl.json +1 -1
  1041. package/dist/cdn/assets/solution-details-panel/t9n/messages.sr.json +1 -1
  1042. package/dist/cdn/assets/solution-details-panel/t9n/messages.sv.json +1 -1
  1043. package/dist/cdn/assets/solution-details-panel/t9n/messages.th.json +1 -1
  1044. package/dist/cdn/assets/solution-details-panel/t9n/messages.tr.json +1 -1
  1045. package/dist/cdn/assets/solution-details-panel/t9n/messages.uk.json +1 -1
  1046. package/dist/cdn/assets/solution-details-panel/t9n/messages.vi.json +1 -1
  1047. package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-CN.json +1 -1
  1048. package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-HK.json +1 -1
  1049. package/dist/cdn/assets/solution-details-panel/t9n/messages.zh-TW.json +1 -1
  1050. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ar.json +1 -1
  1051. package/dist/cdn/assets/solution-item-accordion/t9n/messages.bg.json +1 -1
  1052. package/dist/cdn/assets/solution-item-accordion/t9n/messages.bs.json +1 -1
  1053. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ca.json +1 -1
  1054. package/dist/cdn/assets/solution-item-accordion/t9n/messages.cs.json +1 -1
  1055. package/dist/cdn/assets/solution-item-accordion/t9n/messages.da.json +1 -1
  1056. package/dist/cdn/assets/solution-item-accordion/t9n/messages.de.json +1 -1
  1057. package/dist/cdn/assets/solution-item-accordion/t9n/messages.el.json +1 -1
  1058. package/dist/cdn/assets/solution-item-accordion/t9n/messages.en.json +1 -1
  1059. package/dist/cdn/assets/solution-item-accordion/t9n/messages.es.json +1 -1
  1060. package/dist/cdn/assets/solution-item-accordion/t9n/messages.et.json +1 -1
  1061. package/dist/cdn/assets/solution-item-accordion/t9n/messages.fi.json +1 -1
  1062. package/dist/cdn/assets/solution-item-accordion/t9n/messages.fr.json +1 -1
  1063. package/dist/cdn/assets/solution-item-accordion/t9n/messages.he.json +1 -1
  1064. package/dist/cdn/assets/solution-item-accordion/t9n/messages.hr.json +1 -1
  1065. package/dist/cdn/assets/solution-item-accordion/t9n/messages.hu.json +1 -1
  1066. package/dist/cdn/assets/solution-item-accordion/t9n/messages.id.json +1 -1
  1067. package/dist/cdn/assets/solution-item-accordion/t9n/messages.it.json +1 -1
  1068. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ja.json +1 -1
  1069. package/dist/cdn/assets/solution-item-accordion/t9n/messages.json +1 -1
  1070. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ko.json +1 -1
  1071. package/dist/cdn/assets/solution-item-accordion/t9n/messages.lt.json +1 -1
  1072. package/dist/cdn/assets/solution-item-accordion/t9n/messages.lv.json +1 -1
  1073. package/dist/cdn/assets/solution-item-accordion/t9n/messages.nl.json +1 -1
  1074. package/dist/cdn/assets/solution-item-accordion/t9n/messages.no.json +1 -1
  1075. package/dist/cdn/assets/solution-item-accordion/t9n/messages.pl.json +1 -1
  1076. package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-BR.json +1 -1
  1077. package/dist/cdn/assets/solution-item-accordion/t9n/messages.pt-PT.json +1 -1
  1078. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ro.json +1 -1
  1079. package/dist/cdn/assets/solution-item-accordion/t9n/messages.ru.json +1 -1
  1080. package/dist/cdn/assets/solution-item-accordion/t9n/messages.sk.json +1 -1
  1081. package/dist/cdn/assets/solution-item-accordion/t9n/messages.sl.json +1 -1
  1082. package/dist/cdn/assets/solution-item-accordion/t9n/messages.sr.json +1 -1
  1083. package/dist/cdn/assets/solution-item-accordion/t9n/messages.sv.json +1 -1
  1084. package/dist/cdn/assets/solution-item-accordion/t9n/messages.th.json +1 -1
  1085. package/dist/cdn/assets/solution-item-accordion/t9n/messages.tr.json +1 -1
  1086. package/dist/cdn/assets/solution-item-accordion/t9n/messages.uk.json +1 -1
  1087. package/dist/cdn/assets/solution-item-accordion/t9n/messages.vi.json +1 -1
  1088. package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-CN.json +1 -1
  1089. package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-HK.json +1 -1
  1090. package/dist/cdn/assets/solution-item-accordion/t9n/messages.zh-TW.json +1 -1
  1091. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ar.json +1 -1
  1092. package/dist/cdn/assets/solutions-all-shell/t9n/messages.bg.json +1 -1
  1093. package/dist/cdn/assets/solutions-all-shell/t9n/messages.bs.json +1 -1
  1094. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ca.json +1 -1
  1095. package/dist/cdn/assets/solutions-all-shell/t9n/messages.cs.json +1 -1
  1096. package/dist/cdn/assets/solutions-all-shell/t9n/messages.da.json +1 -1
  1097. package/dist/cdn/assets/solutions-all-shell/t9n/messages.de.json +1 -1
  1098. package/dist/cdn/assets/solutions-all-shell/t9n/messages.el.json +1 -1
  1099. package/dist/cdn/assets/solutions-all-shell/t9n/messages.en.json +1 -1
  1100. package/dist/cdn/assets/solutions-all-shell/t9n/messages.es.json +1 -1
  1101. package/dist/cdn/assets/solutions-all-shell/t9n/messages.et.json +1 -1
  1102. package/dist/cdn/assets/solutions-all-shell/t9n/messages.fi.json +1 -1
  1103. package/dist/cdn/assets/solutions-all-shell/t9n/messages.fr.json +1 -1
  1104. package/dist/cdn/assets/solutions-all-shell/t9n/messages.he.json +1 -1
  1105. package/dist/cdn/assets/solutions-all-shell/t9n/messages.hr.json +1 -1
  1106. package/dist/cdn/assets/solutions-all-shell/t9n/messages.hu.json +1 -1
  1107. package/dist/cdn/assets/solutions-all-shell/t9n/messages.id.json +1 -1
  1108. package/dist/cdn/assets/solutions-all-shell/t9n/messages.it.json +1 -1
  1109. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ja.json +1 -1
  1110. package/dist/cdn/assets/solutions-all-shell/t9n/messages.json +1 -1
  1111. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ko.json +1 -1
  1112. package/dist/cdn/assets/solutions-all-shell/t9n/messages.lt.json +1 -1
  1113. package/dist/cdn/assets/solutions-all-shell/t9n/messages.lv.json +1 -1
  1114. package/dist/cdn/assets/solutions-all-shell/t9n/messages.nl.json +1 -1
  1115. package/dist/cdn/assets/solutions-all-shell/t9n/messages.no.json +1 -1
  1116. package/dist/cdn/assets/solutions-all-shell/t9n/messages.pl.json +1 -1
  1117. package/dist/cdn/assets/solutions-all-shell/t9n/messages.pt-BR.json +1 -1
  1118. package/dist/cdn/assets/solutions-all-shell/t9n/messages.pt-PT.json +1 -1
  1119. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ro.json +1 -1
  1120. package/dist/cdn/assets/solutions-all-shell/t9n/messages.ru.json +1 -1
  1121. package/dist/cdn/assets/solutions-all-shell/t9n/messages.sk.json +1 -1
  1122. package/dist/cdn/assets/solutions-all-shell/t9n/messages.sl.json +1 -1
  1123. package/dist/cdn/assets/solutions-all-shell/t9n/messages.sr.json +1 -1
  1124. package/dist/cdn/assets/solutions-all-shell/t9n/messages.sv.json +1 -1
  1125. package/dist/cdn/assets/solutions-all-shell/t9n/messages.th.json +1 -1
  1126. package/dist/cdn/assets/solutions-all-shell/t9n/messages.tr.json +1 -1
  1127. package/dist/cdn/assets/solutions-all-shell/t9n/messages.uk.json +1 -1
  1128. package/dist/cdn/assets/solutions-all-shell/t9n/messages.vi.json +1 -1
  1129. package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-CN.json +1 -1
  1130. package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-HK.json +1 -1
  1131. package/dist/cdn/assets/solutions-all-shell/t9n/messages.zh-TW.json +1 -1
  1132. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +1 -1
  1133. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +1 -1
  1134. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +1 -1
  1135. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +1 -1
  1136. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +1 -1
  1137. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +1 -1
  1138. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +1 -1
  1139. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +1 -1
  1140. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.en.json +1 -1
  1141. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +1 -1
  1142. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +1 -1
  1143. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +1 -1
  1144. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +1 -1
  1145. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +1 -1
  1146. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +1 -1
  1147. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +1 -1
  1148. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +1 -1
  1149. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +1 -1
  1150. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +1 -1
  1151. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.json +1 -1
  1152. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +1 -1
  1153. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +1 -1
  1154. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +1 -1
  1155. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +1 -1
  1156. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +1 -1
  1157. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +1 -1
  1158. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +1 -1
  1159. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +1 -1
  1160. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +1 -1
  1161. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +1 -1
  1162. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +1 -1
  1163. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +1 -1
  1164. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +1 -1
  1165. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +1 -1
  1166. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +1 -1
  1167. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +1 -1
  1168. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +1 -1
  1169. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +1 -1
  1170. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +1 -1
  1171. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +1 -1
  1172. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +1 -1
  1173. package/dist/cdn/assets/solutions-deploy-app-nav/t9n/messages.ar.json +1 -1
  1174. package/dist/cdn/assets/solutions-deployed-list/t9n/messages.en.json +1 -0
  1175. package/dist/cdn/assets/solutions-deployed-list/t9n/messages.json +1 -0
  1176. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ar.json +1 -1
  1177. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.bg.json +1 -1
  1178. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.bs.json +1 -1
  1179. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ca.json +1 -1
  1180. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.cs.json +1 -1
  1181. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.da.json +1 -1
  1182. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.de.json +1 -1
  1183. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.el.json +1 -1
  1184. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.en.json +1 -1
  1185. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.es.json +1 -1
  1186. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.et.json +1 -1
  1187. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.fi.json +1 -1
  1188. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.fr.json +1 -1
  1189. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.he.json +1 -1
  1190. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.hr.json +1 -1
  1191. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.hu.json +1 -1
  1192. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.id.json +1 -1
  1193. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.it.json +1 -1
  1194. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ja.json +1 -1
  1195. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.json +1 -1
  1196. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ko.json +1 -1
  1197. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.lt.json +1 -1
  1198. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.lv.json +1 -1
  1199. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.nl.json +1 -1
  1200. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.no.json +1 -1
  1201. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pl.json +1 -1
  1202. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pt-BR.json +1 -1
  1203. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.pt-PT.json +1 -1
  1204. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ro.json +1 -1
  1205. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.ru.json +1 -1
  1206. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sk.json +1 -1
  1207. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sl.json +1 -1
  1208. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sr.json +1 -1
  1209. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.sv.json +1 -1
  1210. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.th.json +1 -1
  1211. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.tr.json +1 -1
  1212. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.uk.json +1 -1
  1213. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.vi.json +1 -1
  1214. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-CN.json +1 -1
  1215. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-HK.json +1 -1
  1216. package/dist/cdn/assets/solutions-filter-panel/t9n/messages.zh-TW.json +1 -1
  1217. package/dist/cdn/index.js +1 -1
  1218. package/dist/cdn/main.css +1 -1
  1219. package/dist/chunks/Auth.js +160 -67
  1220. package/dist/chunks/CardsFetcher.js +288 -0
  1221. package/dist/chunks/assessBuildRequest.js +116 -0
  1222. package/dist/chunks/assessUpdateRequest.js +85 -0
  1223. package/dist/chunks/assistantResponse.js +46 -0
  1224. package/dist/chunks/cardFetchingUtils.js +23 -304
  1225. package/dist/chunks/cardsHelpers.js +11 -11
  1226. package/dist/chunks/classifyIntent.js +88 -0
  1227. package/dist/chunks/converter.js +949 -0
  1228. package/dist/chunks/deployAppContexts.js +4 -3
  1229. package/dist/chunks/deployFlowController.js +46 -0
  1230. package/dist/chunks/description.js +16 -0
  1231. package/dist/chunks/description2.js +36 -0
  1232. package/dist/chunks/designSolution.js +118 -0
  1233. package/dist/chunks/downloadUtils.js +246 -235
  1234. package/dist/chunks/explainValidationFailure.js +32 -0
  1235. package/dist/chunks/findExistingSolution.js +22 -0
  1236. package/dist/chunks/getItemIcon.js +19 -10
  1237. package/dist/chunks/getRelatedInfos.js +1 -1
  1238. package/dist/chunks/helpers.js +110 -519
  1239. package/dist/chunks/interfaces.js +472 -0
  1240. package/dist/chunks/popupUtils.js +3 -3
  1241. package/dist/chunks/queryUtils.js +3 -3
  1242. package/dist/chunks/solution-builder-assistant.js +1137 -0
  1243. package/dist/chunks/solution-deploy-dialog.js +183 -150
  1244. package/dist/chunks/solutions-deploy-app-nav.js +38 -39
  1245. package/dist/chunks/solutions_explorer_description.js +19 -0
  1246. package/dist/chunks/templates.js +65 -0
  1247. package/dist/chunks/transformQuery.js +49 -0
  1248. package/dist/chunks/updateDesign.js +5 -0
  1249. package/dist/chunks/validators.js +131 -0
  1250. package/dist/components/arcgis-solutions-assistant/customElement.d.ts +83 -83
  1251. package/dist/components/arcgis-solutions-assistant/customElement.js +1666 -1539
  1252. package/dist/components/arcgis-solutions-assistant/index.js +7 -8
  1253. package/dist/components/buffer-tools/customElement.d.ts +11 -4
  1254. package/dist/components/buffer-tools/customElement.js +5 -5
  1255. package/dist/components/card-manager/customElement.d.ts +39 -6
  1256. package/dist/components/card-manager/customElement.js +128 -26
  1257. package/dist/components/card-manager/index.js +2 -1
  1258. package/dist/components/consent-manager/customElement.d.ts +2 -2
  1259. package/dist/components/consent-manager/customElement.js +23 -3958
  1260. package/dist/components/create-feature/customElement.d.ts +55 -5
  1261. package/dist/components/create-feature/customElement.js +422 -306
  1262. package/dist/components/create-feature/index.js +4 -1
  1263. package/dist/components/create-related-feature/customElement.d.ts +16 -8
  1264. package/dist/components/create-related-feature/customElement.js +64 -84
  1265. package/dist/components/create-related-feature/index.js +1 -0
  1266. package/dist/components/crowdsource-manager/customElement.d.ts +8 -0
  1267. package/dist/components/crowdsource-manager/customElement.js +59 -46
  1268. package/dist/components/crowdsource-reporter/customElement.d.ts +32 -6
  1269. package/dist/components/crowdsource-reporter/customElement.js +82 -56
  1270. package/dist/components/deduct-calculator/customElement.js +5 -5
  1271. package/dist/components/delete-button/customElement.d.ts +2 -2
  1272. package/dist/components/delete-button/customElement.js +1 -1
  1273. package/dist/components/delete-dialog/customElement.d.ts +3 -3
  1274. package/dist/components/edit-card/customElement.d.ts +15 -7
  1275. package/dist/components/edit-card/customElement.js +37 -42
  1276. package/dist/components/edit-card/index.js +1 -0
  1277. package/dist/components/feature-details/customElement.d.ts +7 -6
  1278. package/dist/components/feature-details/customElement.js +5 -5
  1279. package/dist/components/feature-list/customElement.d.ts +5 -4
  1280. package/dist/components/feature-list/customElement.js +7 -7
  1281. package/dist/components/field-selection/customElement.d.ts +6 -4
  1282. package/dist/components/field-selection/customElement.js +75 -67
  1283. package/dist/components/info-card/customElement.d.ts +34 -10
  1284. package/dist/components/info-card/customElement.js +93 -86
  1285. package/dist/components/info-card/index.js +1 -0
  1286. package/dist/components/layer-list/customElement.d.ts +3 -3
  1287. package/dist/components/layer-list/customElement.js +3 -3
  1288. package/dist/components/layer-list-widget/customElement.d.ts +6 -9
  1289. package/dist/components/layer-list-widget/customElement.js +12 -29
  1290. package/dist/components/layer-list-widget/index.js +1 -0
  1291. package/dist/components/layer-table/customElement.d.ts +46 -3
  1292. package/dist/components/layer-table/customElement.js +182 -99
  1293. package/dist/components/map-basemap-gallery/customElement.d.ts +6 -8
  1294. package/dist/components/map-basemap-gallery/customElement.js +31 -38
  1295. package/dist/components/map-basemap-gallery/index.js +1 -0
  1296. package/dist/components/map-card/customElement.d.ts +44 -10
  1297. package/dist/components/map-card/customElement.js +81 -57
  1298. package/dist/components/map-card/index.js +1 -0
  1299. package/dist/components/map-draw-tools/customElement.d.ts +15 -11
  1300. package/dist/components/map-draw-tools/customElement.js +80 -114
  1301. package/dist/components/map-draw-tools/index.js +1 -0
  1302. package/dist/components/map-floor-filter/customElement.d.ts +6 -8
  1303. package/dist/components/map-floor-filter/customElement.js +22 -45
  1304. package/dist/components/map-floor-filter/index.js +1 -0
  1305. package/dist/components/map-fullscreen/customElement.d.ts +6 -4
  1306. package/dist/components/map-fullscreen/customElement.js +14 -34
  1307. package/dist/components/map-fullscreen/index.js +1 -0
  1308. package/dist/components/map-layer-picker/customElement.d.ts +2 -2
  1309. package/dist/components/map-layer-picker/customElement.js +14 -9
  1310. package/dist/components/map-legend/customElement.d.ts +6 -8
  1311. package/dist/components/map-legend/customElement.js +14 -30
  1312. package/dist/components/map-legend/index.js +1 -0
  1313. package/dist/components/map-picker/customElement.d.ts +7 -1
  1314. package/dist/components/map-picker/customElement.js +3 -3
  1315. package/dist/components/map-search/customElement.d.ts +8 -6
  1316. package/dist/components/map-search/customElement.js +25 -52
  1317. package/dist/components/map-search/index.js +1 -0
  1318. package/dist/components/map-select-tools/customElement.d.ts +24 -12
  1319. package/dist/components/map-select-tools/customElement.js +49 -60
  1320. package/dist/components/map-select-tools/index.js +1 -0
  1321. package/dist/components/map-tools/customElement.d.ts +15 -7
  1322. package/dist/components/map-tools/customElement.js +92 -100
  1323. package/dist/components/map-tools/index.js +2 -1
  1324. package/dist/components/pci-calculator/customElement.js +5 -5
  1325. package/dist/components/pdf-download/customElement.d.ts +3 -3
  1326. package/dist/components/pdf-download/customElement.js +1 -1
  1327. package/dist/components/public-notification/customElement.d.ts +15 -11
  1328. package/dist/components/public-notification/customElement.js +158 -74
  1329. package/dist/components/refine-selection/customElement.d.ts +15 -9
  1330. package/dist/components/refine-selection/customElement.js +20 -20
  1331. package/dist/components/selection-tool/customElement.d.ts +3 -3
  1332. package/dist/components/selection-tool/customElement.js +3 -3
  1333. package/dist/components/solution-builder-assistant/customElement.d.ts +342 -0
  1334. package/dist/components/solution-builder-assistant/customElement.js +21 -0
  1335. package/dist/components/solution-builder-assistant/index.d.ts +1 -0
  1336. package/dist/components/solution-builder-assistant/index.js +30 -0
  1337. package/dist/components/solution-configure-titles/customElement.js +103 -83
  1338. package/dist/components/solution-delete-dialog/customElement.js +41 -34
  1339. package/dist/components/solution-deploy-dialog/customElement.d.ts +9 -3
  1340. package/dist/components/solution-deploy-dialog/customElement.js +4 -3
  1341. package/dist/components/solution-deploy-dialog/index.js +1 -1
  1342. package/dist/components/solution-deployed-card/customElement.d.ts +2 -0
  1343. package/dist/components/solution-deployed-card/customElement.js +3 -2
  1344. package/dist/components/solution-deployed-card/index.js +1 -0
  1345. package/dist/components/solution-deployed-card-panel/customElement.d.ts +15 -0
  1346. package/dist/components/solution-deployed-card-panel/customElement.js +130 -56
  1347. package/dist/components/solution-deployed-card-panel/index.js +2 -1
  1348. package/dist/components/solution-deploying-dialog/customElement.js +16 -16
  1349. package/dist/components/solution-details-card/customElement.d.ts +4 -0
  1350. package/dist/components/solution-details-card/customElement.js +39 -27
  1351. package/dist/components/solution-details-card/index.js +1 -0
  1352. package/dist/components/solution-details-panel/customElement.d.ts +15 -4
  1353. package/dist/components/solution-details-panel/customElement.js +253 -244
  1354. package/dist/components/solution-details-panel/index.js +2 -0
  1355. package/dist/components/solution-item-accordion/customElement.d.ts +17 -4
  1356. package/dist/components/solution-item-accordion/customElement.js +69 -36
  1357. package/dist/components/solution-item-accordion/index.js +1 -0
  1358. package/dist/components/solution-item-diagram/customElement.js +252 -212
  1359. package/dist/components/solution-item-icon/customElement.d.ts +6 -0
  1360. package/dist/components/solution-item-icon/customElement.js +13 -12
  1361. package/dist/components/solution-resource-card/customElement.js +8 -7
  1362. package/dist/components/solution-snapshot-gallery/customElement.js +11 -9
  1363. package/dist/components/solution-social-share/customElement.js +15 -14
  1364. package/dist/components/solution-user-avatar/customElement.js +1 -1
  1365. package/dist/components/solutions-all-panel/customElement.d.ts +2 -0
  1366. package/dist/components/solutions-all-panel/customElement.js +59 -40
  1367. package/dist/components/solutions-all-shell/customElement.d.ts +4 -0
  1368. package/dist/components/solutions-all-shell/customElement.js +84 -39
  1369. package/dist/components/solutions-deploy-app/customElement.d.ts +21 -0
  1370. package/dist/components/solutions-deploy-app/customElement.js +843 -118
  1371. package/dist/components/solutions-deploy-app/index.js +7 -0
  1372. package/dist/components/solutions-deploy-app-nav/customElement.d.ts +6 -0
  1373. package/dist/components/solutions-deploy-app-nav/customElement.js +4 -5
  1374. package/dist/components/solutions-deployed-list/customElement.d.ts +43 -0
  1375. package/dist/components/solutions-deployed-list/customElement.js +64 -0
  1376. package/dist/components/solutions-deployed-list/index.d.ts +1 -0
  1377. package/dist/components/solutions-deployed-list/index.js +3 -0
  1378. package/dist/components/solutions-deployed-panel/customElement.js +43 -32
  1379. package/dist/components/solutions-deployed-panel/index.js +0 -1
  1380. package/dist/components/solutions-deployed-shell/customElement.js +22 -18
  1381. package/dist/components/solutions-deployed-shell/index.js +0 -1
  1382. package/dist/components/solutions-filter-panel/customElement.d.ts +2 -6
  1383. package/dist/components/solutions-filter-panel/customElement.js +49 -63
  1384. package/dist/components/solutions-filter-panel/index.js +0 -3
  1385. package/dist/components/solutions-resources-section/customElement.js +10 -9
  1386. package/dist/components/solutions-resources-shell/customElement.d.ts +7 -0
  1387. package/dist/components/solutions-resources-shell/customElement.js +92 -50
  1388. package/dist/components/solutions-searchsort-toolbar/customElement.js +16 -19
  1389. package/dist/docs/api.json +1 -1
  1390. package/dist/docs/docs.json +1 -1
  1391. package/dist/docs/vscode.html-custom-data.json +1 -1
  1392. package/dist/docs/web-types.json +1 -1
  1393. package/dist/index.d.ts +20 -6
  1394. package/dist/index.js +25 -24
  1395. package/dist/loader.js +29 -27
  1396. package/dist/solutions-components_commit.txt +5 -8
  1397. package/dist/types/lumina.d.ts +54 -25
  1398. package/dist/types/preact.d.ts +56 -25
  1399. package/dist/types/react.d.ts +58 -25
  1400. package/dist/types/stencil.d.ts +54 -25
  1401. package/dist/utils/Auth.d.ts +13 -2
  1402. package/dist/utils/getRelatedInfos.d.ts +4 -0
  1403. package/dist/utils/interfaces.d.ts +203 -31
  1404. package/package.json +42 -34
  1405. package/dist/cdn/27G6RESZ.js +0 -2
  1406. package/dist/cdn/2L7O5T7N.js +0 -2
  1407. package/dist/cdn/2RBKFT3Q.js +0 -2
  1408. package/dist/cdn/2WPJOTMI.js +0 -2
  1409. package/dist/cdn/2XQOWXMT.js +0 -2
  1410. package/dist/cdn/3JF5JLS4.js +0 -2
  1411. package/dist/cdn/3ME5BVUE.js +0 -2
  1412. package/dist/cdn/3PT5ULE3.js +0 -2
  1413. package/dist/cdn/3SYLXG32.js +0 -2
  1414. package/dist/cdn/3WO3DS32.js +0 -2
  1415. package/dist/cdn/45ZS4SG7.js +0 -2
  1416. package/dist/cdn/4GHX4MVD.js +0 -50
  1417. package/dist/cdn/4L3MVJ5S.js +0 -2
  1418. package/dist/cdn/5326HZ74.js +0 -2
  1419. package/dist/cdn/57JYZYF5.js +0 -2
  1420. package/dist/cdn/5FKEDJRU.js +0 -2
  1421. package/dist/cdn/5GIHSPJZ.js +0 -2
  1422. package/dist/cdn/5KD4GK7Y.js +0 -2
  1423. package/dist/cdn/5QCBD6ZZ.js +0 -2
  1424. package/dist/cdn/5S3WZLB5.js +0 -2
  1425. package/dist/cdn/5TZ7Q4JG.js +0 -2
  1426. package/dist/cdn/66Q5IRVS.js +0 -2
  1427. package/dist/cdn/6DLDJH6I.js +0 -2
  1428. package/dist/cdn/6G7RA3PN.js +0 -2
  1429. package/dist/cdn/6UXP2Q63.js +0 -2
  1430. package/dist/cdn/73AX72WY.js +0 -2
  1431. package/dist/cdn/743J5TBS.js +0 -2
  1432. package/dist/cdn/74557KPJ.js +0 -2
  1433. package/dist/cdn/7J2VRW7S.js +0 -2
  1434. package/dist/cdn/7YIQXDUF.js +0 -2
  1435. package/dist/cdn/7ZMHT4SH.js +0 -2
  1436. package/dist/cdn/A2LNKTGU.js +0 -2
  1437. package/dist/cdn/A5STEAY7.js +0 -2
  1438. package/dist/cdn/ABTC2V7J.js +0 -2
  1439. package/dist/cdn/AC3MHBPK.js +0 -2
  1440. package/dist/cdn/AF2YWYJQ.js +0 -2
  1441. package/dist/cdn/AGC6ZWMH.js +0 -2
  1442. package/dist/cdn/AKDP6MCB.js +0 -2
  1443. package/dist/cdn/AT2EES2R.js +0 -21
  1444. package/dist/cdn/ATVUAP2X.js +0 -2
  1445. package/dist/cdn/AVNCYWKK.js +0 -2
  1446. package/dist/cdn/BEGKM3ZM.js +0 -2
  1447. package/dist/cdn/BJMKDP4O.js +0 -2
  1448. package/dist/cdn/BK3QFV3M.js +0 -2
  1449. package/dist/cdn/BMJN3MIR.js +0 -2
  1450. package/dist/cdn/BPOWO72Z.js +0 -2
  1451. package/dist/cdn/D4QQZVLI.js +0 -2
  1452. package/dist/cdn/DIKAKOU5.js +0 -2
  1453. package/dist/cdn/DMRQFYLJ.js +0 -174
  1454. package/dist/cdn/DQ4POWIJ.js +0 -2
  1455. package/dist/cdn/DQV46RIT.js +0 -2
  1456. package/dist/cdn/E7HQ4JJ2.js +0 -2
  1457. package/dist/cdn/EGFXSDFS.js +0 -2
  1458. package/dist/cdn/EJRSL3ID.js +0 -2
  1459. package/dist/cdn/EPRDKJSD.js +0 -2
  1460. package/dist/cdn/F372CSCW.js +0 -2
  1461. package/dist/cdn/FXHBHZKG.js +0 -2
  1462. package/dist/cdn/GGBXY3NT.js +0 -2
  1463. package/dist/cdn/GTKRTZK6.js +0 -2
  1464. package/dist/cdn/HBJZGW4L.js +0 -2
  1465. package/dist/cdn/HBQN25RR.js +0 -4
  1466. package/dist/cdn/HMB3LHBC.js +0 -2
  1467. package/dist/cdn/HPQPI754.js +0 -2
  1468. package/dist/cdn/I4PUORX4.js +0 -2
  1469. package/dist/cdn/IORIFDK6.js +0 -2
  1470. package/dist/cdn/IUPEGG4M.js +0 -2
  1471. package/dist/cdn/J33ST6ZG.js +0 -2
  1472. package/dist/cdn/J5VTBFGR.js +0 -2
  1473. package/dist/cdn/JALU4653.js +0 -2
  1474. package/dist/cdn/JK75TUSP.js +0 -2
  1475. package/dist/cdn/JUXXPW6I.js +0 -2
  1476. package/dist/cdn/JYLXH6OM.js +0 -2
  1477. package/dist/cdn/K5JYHCQ7.js +0 -2
  1478. package/dist/cdn/K5VEUOS3.js +0 -2
  1479. package/dist/cdn/K7XOFXRK.js +0 -7
  1480. package/dist/cdn/KD46EE7M.js +0 -2
  1481. package/dist/cdn/KKYXQLBJ.js +0 -2
  1482. package/dist/cdn/KPBEUIQV.js +0 -2
  1483. package/dist/cdn/KSXW3QKP.js +0 -2
  1484. package/dist/cdn/KWCJDOZU.js +0 -2
  1485. package/dist/cdn/KZDTATOG.js +0 -2
  1486. package/dist/cdn/LD2NUKM3.js +0 -2
  1487. package/dist/cdn/LDHJGX5G.js +0 -2
  1488. package/dist/cdn/LI4CAGAZ.js +0 -2
  1489. package/dist/cdn/LO5Q55JH.js +0 -2
  1490. package/dist/cdn/LPNQJBCN.js +0 -2
  1491. package/dist/cdn/LWUSGNUB.js +0 -2
  1492. package/dist/cdn/M4OPXH3T.js +0 -2
  1493. package/dist/cdn/M7YK4K5M.js +0 -2
  1494. package/dist/cdn/MWVSVTGT.js +0 -2
  1495. package/dist/cdn/MZ3QZD4K.js +0 -2
  1496. package/dist/cdn/MZLEP53S.js +0 -2
  1497. package/dist/cdn/N2ROUAUM.js +0 -2
  1498. package/dist/cdn/N7HJKCUK.js +0 -2
  1499. package/dist/cdn/N7OY2PSZ.js +0 -2
  1500. package/dist/cdn/NGCFEPQE.js +0 -4
  1501. package/dist/cdn/NIUMAAOQ.js +0 -2
  1502. package/dist/cdn/NOOFAZCT.js +0 -2
  1503. package/dist/cdn/NSITJP7B.js +0 -2
  1504. package/dist/cdn/NZS3YVIT.js +0 -2
  1505. package/dist/cdn/OQFRVQQZ.js +0 -2
  1506. package/dist/cdn/OYQYXNHJ.js +0 -2
  1507. package/dist/cdn/P4FX4W2X.js +0 -2
  1508. package/dist/cdn/P4KZ6OZF.js +0 -4
  1509. package/dist/cdn/P5Q3LVYT.js +0 -2
  1510. package/dist/cdn/P6IYN2TS.js +0 -2
  1511. package/dist/cdn/PJH3H7LZ.js +0 -2
  1512. package/dist/cdn/PYBOC3DB.js +0 -2
  1513. package/dist/cdn/PZOAAAVI.js +0 -2
  1514. package/dist/cdn/QHG54NVK.js +0 -2
  1515. package/dist/cdn/QI5LXFA7.js +0 -2
  1516. package/dist/cdn/QPIMTXPL.js +0 -2
  1517. package/dist/cdn/QWRM254M.js +0 -2
  1518. package/dist/cdn/R3TKXDOE.js +0 -6
  1519. package/dist/cdn/RDXJFHLV.js +0 -2
  1520. package/dist/cdn/REOO5ZGK.js +0 -2
  1521. package/dist/cdn/RKMY6VWP.js +0 -2
  1522. package/dist/cdn/RTPXDRZ7.js +0 -2
  1523. package/dist/cdn/SENL26AU.js +0 -3
  1524. package/dist/cdn/SSO3AN4U.js +0 -2
  1525. package/dist/cdn/SXD7ZWLW.js +0 -27
  1526. package/dist/cdn/SZRONHSX.js +0 -2
  1527. package/dist/cdn/T2WSMUVL.js +0 -2
  1528. package/dist/cdn/TBQQ6OPX.js +0 -2
  1529. package/dist/cdn/TH52564W.js +0 -2
  1530. package/dist/cdn/THKPPH7G.js +0 -2
  1531. package/dist/cdn/TP5EQUBD.js +0 -2
  1532. package/dist/cdn/TRJ6EQRD.js +0 -2
  1533. package/dist/cdn/TU5GZK4M.js +0 -2
  1534. package/dist/cdn/U3LEZXNT.js +0 -2
  1535. package/dist/cdn/UFJWRZWQ.js +0 -2
  1536. package/dist/cdn/ULCILXSA.js +0 -2
  1537. package/dist/cdn/ULXATJK5.js +0 -2
  1538. package/dist/cdn/UME5GDA2.js +0 -2
  1539. package/dist/cdn/VDEFBT2N.js +0 -2
  1540. package/dist/cdn/VFC4CM23.js +0 -2
  1541. package/dist/cdn/VJEG4LOG.js +0 -2
  1542. package/dist/cdn/VJYMTG4U.js +0 -2
  1543. package/dist/cdn/VPTZV5YV.js +0 -2
  1544. package/dist/cdn/VRE7NUZ2.js +0 -2
  1545. package/dist/cdn/WCPWYPN2.js +0 -2
  1546. package/dist/cdn/XBR2PGVO.js +0 -7
  1547. package/dist/cdn/XCILPMDZ.js +0 -2
  1548. package/dist/cdn/XK6Q5TUT.js +0 -2
  1549. package/dist/cdn/XKDPK7SD.js +0 -2
  1550. package/dist/cdn/XTDFTH5X.js +0 -2
  1551. package/dist/cdn/XYFIAJPT.js +0 -2
  1552. package/dist/cdn/Y6I6QW4M.js +0 -2
  1553. package/dist/cdn/YMOLIY64.js +0 -2
  1554. package/dist/cdn/YTK4IGLJ.js +0 -2
  1555. package/dist/cdn/Z6H6J4QH.js +0 -2
  1556. package/dist/cdn/ZDQANIMG.js +0 -2
  1557. package/dist/cdn/ZSHMK5VX.js +0 -2
  1558. package/dist/cdn/ZVFUYLAQ.js +0 -2
  1559. /package/dist/cdn/{YVNP437O.js → WV7QX3ED.js} +0 -0
@@ -0,0 +1,340 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{d as _r,e as to,f as Li,g as Di,h as Fi}from"./NQH7ZZWD.js";import{a as Ni}from"./ESJJVBZM.js";import{a as ic,b as ac,c as lc,f as rs,g as ns,j as cc}from"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import{b as jl,c as zl}from"./2B4SGB3I.js";import{b as Ii}from"./RLSY4VUQ.js";import"./RDRCAA3H.js";import{a as Fl}from"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import{$ as Gl,Aa as Qo,Ab as ts,Ba as Yo,Bb as fe,Ca as Xo,Da as yr,Ea as w,Fa as N,Ga as Ri,Ha as $i,J as Kl,K as Ae,L as Wl,M as qo,N as Si,O as Ei,P as Bo,Q as Yn,R as q,Ra as S,S as Ci,T as j,U as Be,V as it,W as Ko,X as Hl,Y as Vl,Z as ki,_ as Wo,a as me,aa as Jl,b as K,ba as Xn,ca as Ho,da as Zl,ea as Ql,fa as Yl,g as Bl,ga as Vo,ha as Xl,ia as Pt,j as qe,ja as Oi,k as Ot,ka as Go,kb as sc,la as $,ma as x,na as Mt,oa as at,pa as ec,qa as Jo,ra as tc,s as Uo,sa as rc,ta as Zo,ua as Pi,va as gr,wa as Mi,wb as eo,xa as nc,y as Qn,ya as oc,zb as es}from"./RDJIKSXN.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import{l as Ul,v as Ti}from"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import{b as Dl}from"./HIPZRG2Q.js";import{F as $l,G as Nl,H as Ll,L as vi,h as Cl,i as st,k as kl,l as Ai,q as xi,t as Ol,w as Pl,x as Ml,y as Rl}from"./T3EPRHTT.js";import{c as El}from"./EXBEKVP5.js";export default $arcgis.t(([gl,uW,pW,Hd,Ig,Tg,Dg,_W,bW,CG,rA,dp,pr,Ja,_p,,pp,Ug,{addressToLocations:qg},Bg,Kg,wp,{createRenderer:Wg},{getSchemesByTag:Hg,getSchemes:Vg},{getBackgroundColorTheme:mp},{createAgeRenderer:Gg,createContinuousRenderer:Jg},{getSchemesByTag:sl},{createContinuousRenderer:Zg},{createRenderer:Qg},{getSchemesByTag:Yg},{createRenderer:Xg},{getSchemesByTag:ey},{createRenderer:ty},{getSchemesByTag:ry},{createRenderer:ny},{getSchemesByTag:oy},{createAgeRenderer:sy,createContinuousRenderer:iy},{createRenderer:ay},{getSchemesByTag:ly},cy,bp,Ap,{formatDateOnly:uy,convertDateFormatToIntlOptions:Gs,formatTimeOnly:dy,formatDate:fp},py,my,fy,hy,gy,xp,,{fetchKnowledgeGraph:hp,executeQueryStreaming:yy,executeSearchStreaming:_y},wy,,,,,,,,,,,,,,,,,,,,,,,,,kV,PV,,,,,,,,,,,,,yA,Lp,_A,tJ,nJ,LA,DA,{r:ql},{r:Zn}])=>{var ro=class extends Rl{constructor(e){if(super(e),this.it=Ai,e.type!==Pl.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Ai||e==null)return this._t=void 0,this.it=e;if(e===kl)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};ro.directiveName="unsafeHTML",ro.resultType=1;var uc=Ml(ro);var d=w;async function os(t,e,r){if(r===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
3
+
4
+ If you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`,"and explicitly pass in a config parameter.",`
5
+
6
+ Or, if you are calling this from a custom tool, ensure you're using the "tool" helper constructor as documented here:`,`
7
+ |`,`
8
+ \u2514-> https://js.langchain.com/docs/how_to/custom_tools#tool-function`,`
9
+ `].join(" "));let n=await Jl(r),o=n?.getParentRunId();n!==void 0&&o!==void 0&&await n.handleCustomEvent?.(t,e,o)}var J=async(t,e)=>{await os("trace_message",t,e)},ge=async(t,e)=>{await os("graph_ux_suggestion",t,e)};var om={openai:{package:"@langchain/openai",className:"ChatOpenAI"},anthropic:{package:"@langchain/anthropic",className:"ChatAnthropic"},azure_openai:{package:"@langchain/openai",className:"AzureChatOpenAI"},cohere:{package:"@langchain/cohere",className:"ChatCohere"},google:{package:"@langchain/google",className:"ChatGoogle"},"google-vertexai":{package:"@langchain/google-vertexai",className:"ChatVertexAI"},"google-vertexai-web":{package:"@langchain/google-vertexai-web",className:"ChatVertexAI"},"google-genai":{package:"@langchain/google-genai",className:"ChatGoogleGenerativeAI"},ollama:{package:"@langchain/ollama",className:"ChatOllama"},mistralai:{package:"@langchain/mistralai",className:"ChatMistralAI"},mistral:{package:"@langchain/mistralai",className:"ChatMistralAI"},groq:{package:"@langchain/groq",className:"ChatGroq"},bedrock:{package:"@langchain/aws",className:"ChatBedrockConverse"},aws:{package:"@langchain/aws",className:"ChatBedrockConverse"},deepseek:{package:"@langchain/deepseek",className:"ChatDeepSeek"},xai:{package:"@langchain/xai",className:"ChatXAI"},cerebras:{package:"@langchain/cerebras",className:"ChatCerebras"},fireworks:{package:"@langchain/fireworks",className:"ChatFireworks"},together:{package:"@langchain/together-ai",className:"ChatTogetherAI",hasCircularDependency:!0},perplexity:{package:"@langchain/perplexity",className:"ChatPerplexity"}},vv=Object.keys(om);var Ui=Symbol.for("langgraph-zod");Ui in globalThis||(globalThis[Ui]=new WeakSet);function pc(t){let e=globalThis[Ui];e.has(t)||(Object.defineProperty(t,"langgraph",{get(){let r=this;return{metadata(n){return ts(r,{jsonSchemaExtra:n})},reducer(n,o){return ts(r,{default:Go(r),reducer:{schema:o,fn:n}})}}}}),e.add(t))}try{pc(x.ZodType.prototype),pc(w.ZodType.prototype)}catch(t){throw new Error("Failed to extend Zod with LangGraph-related methods. This is most likely a bug, consider opening an issue and/or using `withLangGraph` to augment your Zod schema.",{cause:t})}var mc=class extends Ql{constructor(t){super(),this.parent=t,this._map=this.parent._map}add(t,...e){let r=e[0];if(r&&!r?.default){let n=Go(t);n!=null&&(r.default=n)}return super.add(t,...e)}},am=new mc(es);var vm=x.function().args(x.custom(),x.custom(),x.custom()).returns(x.union([x.string(),x.promise(x.string())])),Im=["approve","edit","reject"],Tm=x.enum(Im),Sm=x.object({allowedDecisions:x.array(Tm),description:x.union([x.string(),vm]).optional(),argsSchema:x.record(x.any()).optional()}),vS=x.object({interruptOn:x.record(x.union([x.boolean(),Sm])).optional(),descriptionPrefix:x.string().default("Tool execution requires approval")});var km=`<role>
10
+ Context Extraction Assistant
11
+ </role>
12
+
13
+ <primary_objective>
14
+ Your sole objective in this task is to extract the highest quality/most relevant context from the conversation history below.
15
+ </primary_objective>
16
+
17
+ <objective_information>
18
+ You're nearing the total number of input tokens you can accept, so you must extract the highest quality/most relevant pieces of information from your conversation history.
19
+ This context will then overwrite the conversation history presented below. Because of this, ensure the context you extract is only the most important information to your overall goal.
20
+ </objective_information>
21
+
22
+ <instructions>
23
+ The conversation history below will be replaced with the context you extract in this step. Because of this, you must do your very best to extract and record all of the most important context from the conversation history.
24
+ You want to ensure that you don't repeat any actions you've already completed, so the context you extract from the conversation history should be focused on the most important information to your overall goal.
25
+ </instructions>
26
+
27
+ The user will message you with the full message history you'll be extracting context from, to then replace. Carefully read over it all, and think deeply about what information is most important to your overall goal that should be saved:
28
+
29
+ With all of this in mind, please carefully read over the entire conversation history, and extract the most important and relevant context to replace it so that you can free up space in the conversation history.
30
+ Respond ONLY with the extracted context. Do not include any additional information, or text before or after the extracted context.
31
+
32
+ <messages>
33
+ Messages to summarize:
34
+ {messages}
35
+ </messages>`;var Om=x.function().args(x.array(x.custom())).returns(x.union([x.number(),x.promise(x.number())])),Vi=x.object({fraction:x.number().gt(0,"Fraction must be greater than 0").max(1,"Fraction must be less than or equal to 1").optional(),tokens:x.number().positive("Tokens must be greater than 0").optional(),messages:x.number().int("Messages must be an integer").positive("Messages must be greater than 0").optional()}).refine(t=>[t.fraction,t.tokens,t.messages].filter(e=>e!==void 0).length>=1,{message:"At least one of fraction, tokens, or messages must be provided"}),xc=x.object({fraction:x.number().min(0,"Messages must be non-negative").max(1,"Fraction must be less than or equal to 1").optional(),tokens:x.number().min(0,"Tokens must be greater than or equal to 0").optional(),messages:x.number().int("Messages must be an integer").min(0,"Messages must be non-negative").optional()}).refine(t=>[t.fraction,t.tokens,t.messages].filter(e=>e!==void 0).length===1,{message:"Exactly one of fraction, tokens, or messages must be provided"}),US=x.object({model:x.custom(),trigger:x.union([Vi,x.array(Vi)]).optional(),keep:xc.optional(),tokenCounter:Om.optional(),summaryPrompt:x.string().default(km),trimTokensToSummarize:x.number().optional(),summaryPrefix:x.string().optional(),maxTokensBeforeSummary:x.number().optional(),messagesToKeep:x.number().optional()});var YS=x.object({model:x.string().or(x.instanceof(tc)).optional(),systemPrompt:x.string().optional(),maxTools:x.number().optional(),alwaysInclude:x.array(x.string()).optional()});var sE=x.object({applyToInput:x.boolean().optional(),applyToOutput:x.boolean().optional(),applyToToolResults:x.boolean().optional()});var uE=x.object({rules:x.record(x.string(),x.instanceof(RegExp).describe("Regular expression pattern to match PII")).optional()});var Pm=["continue","error","end"],Mm="continue";var Rm=x.enum(Pm).default(Mm);x.object({toolName:x.string().optional(),threadLimit:x.number().optional(),runLimit:x.number().optional(),exitBehavior:Rm});var AE=x.object({threadToolCallCount:x.record(x.string(),x.number()).default({}),runToolCallCount:x.record(x.string(),x.number()).default({})});var $m=x.enum(["pending","in_progress","completed"]).describe("Status of the todo"),Nm=x.object({content:x.string().describe("Content of the todo item"),status:$m}),kE=x.object({todos:x.array(Nm).default([])});var $E=x.object({threadLimit:x.number().optional(),runLimit:x.number().optional(),exitBehavior:x.enum(["error","end"]).optional()}),NE=x.object({threadModelCallCount:x.number().default(0),runModelCallCount:x.number().default(0)});var ss=x.object({maxRetries:x.number().min(0).default(2),retryOn:x.union([x.function().args(x.instanceof(Error)).returns(x.boolean()),x.array(x.custom())]).default(()=>()=>!0),backoffFactor:x.number().min(0).default(2),initialDelayMs:x.number().min(0).default(1e3),maxDelayMs:x.number().min(0).default(6e4),jitter:x.boolean().default(!0)});var JE=x.object({onFailure:x.union([x.literal("error"),x.literal("continue"),x.function().args(x.instanceof(Error)).returns(x.string())]).default("continue")}).merge(ss);var nC=x.object({tools:x.array(x.union([x.custom(),x.custom(),x.string()])).optional(),onFailure:x.union([x.literal("error"),x.literal("continue"),x.literal("raise"),x.literal("return_message"),x.function().args(x.instanceof(Error)).returns(x.string())]).default("continue")}).merge(ss);var _C=x.object({enableCaching:x.boolean().optional(),ttl:x.enum(["5m","1h"]).optional(),minMessagesToCache:x.number().optional(),unsupportedModelBehavior:x.enum(["ignore","warn","raise"]).optional()});function no(t,e){return t.lc_error_code=e,t.message=`${t.message}
36
+
37
+ Troubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${e}/
38
+ `,t}function k(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function _(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var Gi=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return Gi=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function oo(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var so=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var T=class extends Error{},W=class t extends T{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.requestID=o?.get("x-request-id"),this.error=r;let s=r;this.code=s?.code,this.param=s?.param,this.type=s?.type}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new lt({message:n,cause:so(r)});let s=r?.error;return e===400?new br(e,s,n,o):e===401?new Ar(e,s,n,o):e===403?new xr(e,s,n,o):e===404?new vr(e,s,n,o):e===409?new Ir(e,s,n,o):e===422?new Tr(e,s,n,o):e===429?new Sr(e,s,n,o):e>=500?new Er(e,s,n,o):new t(e,s,n,o)}},H=class extends W{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},lt=class extends W{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},Me=class extends lt{constructor({message:e}={}){super({message:e??"Request timed out."})}},br=class extends W{},Ar=class extends W{},xr=class extends W{},vr=class extends W{},Ir=class extends W{},Tr=class extends W{},Sr=class extends W{},Er=class extends W{},Cr=class extends T{constructor(){super("Could not parse response content as the length limit was reached")}},kr=class extends T{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Re=class extends Error{constructor(e){super(e)}},$t=class extends W{constructor(e,r,n){let o="OAuth2 authentication error",s;if(r&&typeof r=="object"){let i=r;s=i.error;let a=i.error_description;a&&typeof a=="string"?o=a:s&&(o=s)}super(e,r,o,n),this.error_code=s}},io=class extends T{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var qm=/^[a-z][a-z0-9+.-]*:/i,Sc=t=>qm.test(t),ue=t=>(ue=Array.isArray,ue(t)),Ji=ue;function is(t){return typeof t!="object"?{}:t??{}}function Zi(t){if(!t)return!0;for(let e in t)return!1;return!0}function Ec(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ao(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var Cc=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new T(`${t} must be an integer`);if(e<0)throw new T(`${t} must be a positive integer`);return e};var kc=t=>{try{return JSON.parse(t)}catch{return}};var $e=t=>new Promise(e=>setTimeout(e,t));var ct="6.44.0";var Rc=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function Bm(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var Km=()=>{let t=Bm();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ct,"X-Stainless-OS":Pc(Deno.build.os),"X-Stainless-Arch":Oc(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ct,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ct,"X-Stainless-OS":Pc(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Oc(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Wm();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ct,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ct,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Wm(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,s=n[2]||0,i=n[3]||0;return{browser:e,version:`${o}.${s}.${i}`}}}return null}var Oc=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Pc=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Mc,$c=()=>Mc??(Mc=Km());function as(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Qi(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function ls(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Qi({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function Yi(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Xi(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var Lc=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var ea="RFC3986",ta=t=>String(t),ra={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:ta},Dc="RFC1738";var cs=(t,e)=>(cs=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),cs(t,e)),Ne=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var na=1024,Fc=(t,e,r,n,o)=>{if(t.length===0)return t;let s=t;if(typeof t=="symbol"?s=Symbol.prototype.toString.call(t):typeof t!="string"&&(s=String(t)),r==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let i="";for(let a=0;a<s.length;a+=na){let c=s.length>=na?s.slice(a,a+na):s,l=[];for(let u=0;u<c.length;++u){let m=c.charCodeAt(u);if(m===45||m===46||m===95||m===126||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||o===Dc&&(m===40||m===41)){l[l.length]=c.charAt(u);continue}if(m<128){l[l.length]=Ne[m];continue}if(m<2048){l[l.length]=Ne[192|m>>6]+Ne[128|m&63];continue}if(m<55296||m>=57344){l[l.length]=Ne[224|m>>12]+Ne[128|m>>6&63]+Ne[128|m&63];continue}u+=1,m=65536+((m&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=Ne[240|m>>18]+Ne[128|m>>12&63]+Ne[128|m>>6&63]+Ne[128|m&63]}i+=l.join("")}return i};function jc(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function oa(t,e){if(ue(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Uc={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},qc=function(t,e){Array.prototype.push.apply(t,ue(e)?e:[e])},zc,ee={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Fc,encodeValuesOnly:!1,format:ea,formatter:ta,indices:!1,serializeDate(t){return(zc??(zc=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function Vm(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var sa={};function Bc(t,e,r,n,o,s,i,a,c,l,u,m,f,h,b,A,E,y){let v=t,C=y,L=0,B=!1;for(;(C=C.get(sa))!==void 0&&!B;){let Q=C.get(t);if(L+=1,typeof Q<"u"){if(Q===L)throw new RangeError("Cyclic object value");B=!0}typeof C.get(sa)>"u"&&(L=0)}if(typeof l=="function"?v=l(e,v):v instanceof Date?v=f?.(v):r==="comma"&&ue(v)&&(v=oa(v,function(Q){return Q instanceof Date?f?.(Q):Q})),v===null){if(s)return c&&!A?c(e,ee.encoder,E,"key",h):e;v=""}if(Vm(v)||jc(v)){if(c){let Q=A?e:c(e,ee.encoder,E,"key",h);return[b?.(Q)+"="+b?.(c(v,ee.encoder,E,"value",h))]}return[b?.(e)+"="+b?.(String(v))]}let P=[];if(typeof v>"u")return P;let z;if(r==="comma"&&ue(v))A&&c&&(v=oa(v,c)),z=[{value:v.length>0?v.join(",")||null:void 0}];else if(ue(l))z=l;else{let Q=Object.keys(v);z=u?Q.sort(u):Q}let U=a?String(e).replace(/\./g,"%2E"):String(e),ne=n&&ue(v)&&v.length===1?U+"[]":U;if(o&&ue(v)&&v.length===0)return ne+"[]";for(let Q=0;Q<z.length;++Q){let X=z[Q],Tl=typeof X=="object"&&typeof X.value<"u"?X.value:v[X];if(i&&Tl===null)continue;let bi=m&&a?X.replace(/\./g,"%2E"):X,rm=ue(v)?typeof r=="function"?r(ne,bi):ne:ne+(m?"."+bi:"["+bi+"]");y.set(t,L);let Sl=new WeakMap;Sl.set(sa,y),qc(P,Bc(Tl,rm,r,n,o,s,i,a,r==="comma"&&A&&ue(v)?null:c,l,u,m,f,h,b,A,E,Sl))}return P}function Gm(t=ee){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||ee.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=ea;if(typeof t.format<"u"){if(!cs(ra,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=ra[r],o=ee.filter;(typeof t.filter=="function"||ue(t.filter))&&(o=t.filter);let s;if(t.arrayFormat&&t.arrayFormat in Uc?s=t.arrayFormat:"indices"in t?s=t.indices?"indices":"repeat":s=ee.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let i=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:ee.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:ee.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:ee.allowEmptyArrays,arrayFormat:s,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:ee.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?ee.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:ee.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:ee.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:ee.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:ee.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:ee.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:ee.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:ee.strictNullHandling}}function Kc(t,e={}){let r=t,n=Gm(e),o,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):ue(n.filter)&&(s=n.filter,o=s);let i=[];if(typeof r!="object"||r===null)return"";let a=Uc[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let f=0;f<o.length;++f){let h=o[f];n.skipNulls&&r[h]===null||qc(i,Bc(r[h],h,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=i.join(n.delimiter),m=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?m+="utf8=%26%2310003%3B&":m+="utf8=%E2%9C%93&"),u.length>0?m+u:""}function Wc(t){return Kc(t,{arrayFormat:"brackets"})}function Gc(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var Hc;function Or(t){let e;return(Hc??(e=new globalThis.TextEncoder,Hc=e.encode.bind(e)))(t)}var Vc;function ia(t){let e;return(Vc??(e=new globalThis.TextDecoder,Vc=e.decode.bind(e)))(t)}var ye,_e,Nt=class{constructor(){ye.set(this,void 0),_e.set(this,void 0),k(this,ye,new Uint8Array,"f"),k(this,_e,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Or(e):e;k(this,ye,Gc([_(this,ye,"f"),r]),"f");let n=[],o;for(;(o=Zm(_(this,ye,"f"),_(this,_e,"f")))!=null;){if(o.carriage&&_(this,_e,"f")==null){k(this,_e,o.index,"f");continue}if(_(this,_e,"f")!=null&&(o.index!==_(this,_e,"f")+1||o.carriage)){n.push(ia(_(this,ye,"f").subarray(0,_(this,_e,"f")-1))),k(this,ye,_(this,ye,"f").subarray(_(this,_e,"f")),"f"),k(this,_e,null,"f");continue}let s=_(this,_e,"f")!==null?o.preceding-1:o.preceding,i=ia(_(this,ye,"f").subarray(0,s));n.push(i),k(this,ye,_(this,ye,"f").subarray(o.index),"f"),k(this,_e,null,"f")}return n}flush(){return _(this,ye,"f").length?this.decode(`
39
+ `):[]}};ye=new WeakMap,_e=new WeakMap;Nt.NEWLINE_CHARS=new Set([`
40
+ `,"\r"]);Nt.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Zm(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function Jc(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var ds={off:0,error:200,warn:300,info:400,debug:500},aa=(t,e,r)=>{if(t){if(Ec(ds,t))return t;Z(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(ds))}`)}};function lo(){}function us(t,e,r){return!e||ds[t]>ds[r]?lo:e[t].bind(e)}var Qm={error:lo,warn:lo,info:lo,debug:lo},Zc=new WeakMap;function Z(t){let e=t.logger,r=t.logLevel??"off";if(!e)return Qm;let n=Zc.get(e);if(n&&n[0]===r)return n[1];let o={error:us("error",e,r),warn:us("warn",e,r),info:us("info",e,r),debug:us("debug",e,r)};return Zc.set(e,[r,o]),o}var We=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="api-key"||e.toLowerCase()==="x-api-key"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var co,Le=class t{constructor(e,r,n){this.iterator=e,co.set(this,void 0),this.controller=r,k(this,co,n,"f")}static fromSSEResponse(e,r,n,o){let s=!1,i=n?Z(n):console;async function*a(){if(s)throw new T("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let c=!1;try{for await(let l of Ym(e,r))if(!c){if(l.data.startsWith("[DONE]")){c=!0;continue}if(l.event===null||!l.event.startsWith("thread.")){let u;try{u=JSON.parse(l.data)}catch(m){throw i.error("Could not parse message into JSON:",l.data),i.error("From chunk:",l.raw),m}if(u&&u.error)throw new W(void 0,u.error,void 0,e.headers);yield o?{event:l.event,data:u}:u}else{let u;try{u=JSON.parse(l.data)}catch(m){throw console.error("Could not parse message into JSON:",l.data),console.error("From chunk:",l.raw),m}if(l.event=="error")throw new W(void 0,u.error,u.message,void 0);yield{event:l.event,data:u}}}c=!0}catch(l){if(oo(l))return;throw l}finally{c||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*s(){let a=new Nt,c=Yi(e);for await(let l of c)for(let u of a.decode(l))yield u;for(let l of a.flush())yield l}async function*i(){if(o)throw new T("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let a=!1;try{for await(let c of s())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(oo(c))return;throw c}finally{a||r.abort()}}return new t(i,r,n)}[(co=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=s=>({next:()=>{if(s.length===0){let i=n.next();e.push(i),r.push(i)}return s.shift()}});return[new t(()=>o(e),this.controller,_(this,co,"f")),new t(()=>o(r),this.controller,_(this,co,"f"))]}toReadableStream(){let e=this,r;return Qi({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:s}=await r.next();if(s)return n.close();let i=Or(JSON.stringify(o)+`
41
+ `);n.enqueue(i)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*Ym(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new T("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new T("Attempted to iterate over a response with no body");let r=new la,n=new Nt,o=Yi(t.body);for await(let s of Xm(o))for(let i of n.decode(s)){let a=r.decode(i);a&&(yield a)}for(let s of n.flush()){let i=r.decode(s);i&&(yield i)}}async function*Xm(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Or(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let s;for(;(s=Jc(e))!==-1;)yield e.slice(0,s),e=e.slice(s)}e.length>0&&(yield e)}var la=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
42
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],s}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=ef(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function ef(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function ps(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:s}=e,i=await(async()=>{if(e.options.stream)return Z(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t,e.options.__synthesizeEventData):Le.fromSSEResponse(r,e.controller,t,e.options.__synthesizeEventData);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let c=r.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(r.headers.get("content-length")==="0")return;let f=await r.json();return ca(f,r)}return await r.text()})();return Z(t).debug(`[${n}] response parsed`,We({retryOfRequestLogID:o,url:r.url,status:r.status,body:i,durationMs:Date.now()-s})),i}function ca(t,e){return!t||typeof t!="object"||Array.isArray(t)?t:Object.defineProperty(t,"_request_id",{value:e.headers.get("x-request-id"),enumerable:!1})}var uo,Lt=class t extends Promise{constructor(e,r,n=ps){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,uo.set(this,void 0),k(this,uo,e,"f")}_thenUnwrap(e){return new t(_(this,uo,"f"),this.responsePromise,async(r,n)=>ca(e(await this.parseResponse(r,n),n),n.response))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r,request_id:r.headers.get("x-request-id")}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(_(this,uo,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};uo=new WeakMap;var ms,Pr=class{constructor(e,r,n,o){ms.set(this,void 0),k(this,ms,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new T("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await _(this,ms,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(ms=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},po=class extends Lt{constructor(e,r,n){super(e,r,async(o,s)=>new n(o,s.response,await ps(o,s),s.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},de=class extends Pr{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.object=n.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}},R=class extends Pr{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.getPaginatedItems(),r=e[e.length-1]?.id;return r?{...this.options,query:{...is(this.options.query),after:r}}:null}},D=class extends Pr{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.last_id=n.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.last_id;return e?{...this.options,query:{...is(this.options.query),after:e}}:null}},Y=class extends Pr{constructor(e,r,n,o){super(e,r,n,o),this.data=n.data||[],this.has_more=n.has_more||!1,this.next=n.next||null}getPaginatedItems(){return this.data??[]}hasNextPage(){return this.has_more===!1?!1:super.hasNextPage()}nextPageRequestOptions(){let e=this.next;return e?{...this.options,query:{...is(this.options.query),after:e}}:null}};var rf={jwt:"urn:ietf:params:oauth:token-type:jwt",id:"urn:ietf:params:oauth:token-type:id_token"},nf="urn:ietf:params:oauth:grant-type:token-exchange",fs=class{constructor(e,r){this.cachedToken=null,this.refreshPromise=null,this.tokenExchangeUrl="https://auth.openai.com/oauth/token",this.config=e,this.fetch=r??as()}async getToken(){if(!this.cachedToken||this.isTokenExpired(this.cachedToken)){if(this.refreshPromise)return await this.refreshPromise;this.refreshPromise=this.refreshToken();try{return await this.refreshPromise}finally{this.refreshPromise=null}}return this.needsRefresh(this.cachedToken)&&!this.refreshPromise&&(this.refreshPromise=this.refreshToken().finally(()=>{this.refreshPromise=null})),this.cachedToken.token}async refreshToken(){let e=await this.config.provider.getToken(),r={grant_type:nf,subject_token:e,subject_token_type:rf[this.config.provider.tokenType],identity_provider_id:this.config.identityProviderId,service_account_id:this.config.serviceAccountId};this.config.clientId&&(r.client_id=this.config.clientId);let n=await this.fetch(this.tokenExchangeUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!n.ok){let a=await n.text(),c;try{c=JSON.parse(a)}catch{}throw n.status===400||n.status===401||n.status===403?new $t(n.status,c,n.headers):W.generate(n.status,c,`Token exchange failed with status ${n.status}`,n.headers)}let o=await n.json(),s=o.expires_in||3600,i=Date.now()+s*1e3;return this.cachedToken={token:o.access_token,expiresAt:i},o.access_token}isTokenExpired(e){return Date.now()>=e.expiresAt}needsRefresh(e){let n=(this.config.refreshBufferSeconds??1200)*1e3;return Date.now()>=e.expiresAt-n}invalidateToken(){this.cachedToken=null,this.refreshPromise=null}};var pa=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function Mr(t,e,r){return pa(),new File(t,e??"unknown_file",r)}function mo(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var hs=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function",ut=async(t,e)=>ua(t.body)?{...t,body:await Yc(t.body,e)}:t,pe=async(t,e)=>({...t,body:await Yc(t.body,e)}),Qc=new WeakMap;function of(t){let e=typeof t=="function"?t:t.fetch,r=Qc.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,s=new FormData;return s.toString()!==await new o(s).text()}catch{return!0}})();return Qc.set(e,n),n}var Yc=async(t,e)=>{if(!await of(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>da(r,n,o))),r},Xc=t=>t instanceof Blob&&"name"in t,sf=t=>typeof t=="object"&&t!==null&&(t instanceof Response||hs(t)||Xc(t)),ua=t=>{if(sf(t))return!0;if(Array.isArray(t))return t.some(ua);if(t&&typeof t=="object"){for(let e in t)if(ua(t[e]))return!0}return!1},da=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,Mr([await r.blob()],mo(r)));else if(hs(r))t.append(e,Mr([await new Response(ls(r)).blob()],mo(r)));else if(Xc(r))t.append(e,r,mo(r));else if(Array.isArray(r))await Promise.all(r.map(n=>da(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>da(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var eu=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",af=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&eu(t),lf=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function fo(t,e,r){if(pa(),t=await t,af(t))return t instanceof File?t:Mr([await t.arrayBuffer()],t.name);if(lf(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),Mr(await ma(o),e,r)}let n=await ma(t);if(e||(e=mo(t)),!r?.type){let o=n.find(s=>typeof s=="object"&&"type"in s&&s.type);typeof o=="string"&&(r={...r,type:o})}return Mr(n,e,r)}async function ma(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(eu(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(hs(t))for await(let r of t)e.push(...await ma(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${cf(t)}`)}return e}function cf(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}var g=class{constructor(e){this._client=e}};function ru(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var tu=Object.freeze(Object.create(null)),df=(t=ru)=>function(r,...n){if(r.length===1)return r[0];let o=!1,s=[],i=r.reduce((u,m,f)=>{/[?#]/.test(m)&&(o=!0);let h=n[f],b=(o?encodeURIComponent:t)(""+h);return f!==n.length&&(h==null||typeof h=="object"&&h.toString===Object.getPrototypeOf(Object.getPrototypeOf(h.hasOwnProperty??tu)??tu)?.toString)&&(b=h+"",s.push({start:u.length+m.length,length:b.length,error:`Value of type ${Object.prototype.toString.call(h).slice(8,-1)} is not a valid path parameter`})),u+m+(f===n.length?"":b)},""),a=i.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=c.exec(a))!==null;)s.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(s.sort((u,m)=>u.start-m.start),s.length>0){let u=0,m=s.reduce((f,h)=>{let b=" ".repeat(h.start-u),A="^".repeat(h.length);return u=h.start+h.length,f+b+A},"");throw new T(`Path parameters result in path with invalid segments:
43
+ ${s.map(f=>f.error).join(`
44
+ `)}
45
+ ${i}
46
+ ${m}`)}return i},p=df(ru);var Dt=class extends g{list(e,r={},n){return this._client.getAPIList(p`/chat/completions/${e}/messages`,R,{query:r,...n,__security:{bearerAuth:!0}})}};function ho(t){return t!==void 0&&"function"in t&&t.function!==void 0}function ou(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function go(t){return t?.$brand==="auto-parseable-response-format"}function Ft(t){return t?.$brand==="auto-parseable-tool"}function su(t,e){return!e||!fa(e)?{...t,choices:t.choices.map(r=>(au(r.message.tool_calls),{...r,message:{...r.message,parsed:null,...r.message.tool_calls?{tool_calls:r.message.tool_calls}:void 0}}))}:yo(t,e)}function yo(t,e){let r=t.choices.map(n=>{if(n.finish_reason==="length")throw new Cr;if(n.finish_reason==="content_filter")throw new kr;return au(n.message.tool_calls),{...n,message:{...n.message,...n.message.tool_calls?{tool_calls:n.message.tool_calls?.map(o=>ff(e,o))??void 0}:void 0,parsed:n.message.content&&!n.message.refusal?mf(e,n.message.content):null}}});return{...t,choices:r}}function mf(t,e){return t.response_format?.type!=="json_schema"?null:t.response_format?.type==="json_schema"?"$parseRaw"in t.response_format?t.response_format.$parseRaw(e):JSON.parse(e):null}function ff(t,e){let r=t.tools?.find(n=>ho(n)&&n.function?.name===e.function.name);return{...e,function:{...e.function,parsed_arguments:Ft(r)?r.$parseRaw(e.function.arguments):r?.function.strict?JSON.parse(e.function.arguments):null}}}function iu(t,e){if(!t||!("tools"in t)||!t.tools)return!1;let r=t.tools?.find(n=>ho(n)&&n.function?.name===e.function.name);return ho(r)&&(Ft(r)||r?.function.strict||!1)}function fa(t){return go(t.response_format)?!0:t.tools?.some(e=>Ft(e)||e.type==="function"&&e.function.strict===!0)??!1}function au(t){for(let e of t||[])if(e.type!=="function")throw new T(`Currently only \`function\` tool calls are supported; Received \`${e.type}\``)}function lu(t){for(let e of t??[]){if(e.type!=="function")throw new T(`Currently only \`function\` tool types support auto-parsing; Received \`${e.type}\``);if(e.function.strict!==!0)throw new T(`The \`${e.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var Rr=t=>t?.role==="assistant",ha=t=>t?.role==="tool";var ga,gs,ys,_o,wo,_s,bo,He,Ao,ws,bs,$r,cu,dt=class{constructor(){ga.add(this),this.controller=new AbortController,gs.set(this,void 0),ys.set(this,()=>{}),_o.set(this,()=>{}),wo.set(this,void 0),_s.set(this,()=>{}),bo.set(this,()=>{}),He.set(this,{}),Ao.set(this,!1),ws.set(this,!1),bs.set(this,!1),$r.set(this,!1),k(this,gs,new Promise((e,r)=>{k(this,ys,e,"f"),k(this,_o,r,"f")}),"f"),k(this,wo,new Promise((e,r)=>{k(this,_s,e,"f"),k(this,bo,r,"f")}),"f"),_(this,gs,"f").catch(()=>{}),_(this,wo,"f").catch(()=>{})}_run(e){setTimeout(()=>{e().then(()=>{this._emitFinal(),this._emit("end")},_(this,ga,"m",cu).bind(this))},0)}_connected(){this.ended||(_(this,ys,"f").call(this),this._emit("connect"))}get ended(){return _(this,Ao,"f")}get errored(){return _(this,ws,"f")}get aborted(){return _(this,bs,"f")}abort(){this.controller.abort()}on(e,r){return(_(this,He,"f")[e]||(_(this,He,"f")[e]=[])).push({listener:r}),this}off(e,r){let n=_(this,He,"f")[e];if(!n)return this;let o=n.findIndex(s=>s.listener===r);return o>=0&&n.splice(o,1),this}once(e,r){return(_(this,He,"f")[e]||(_(this,He,"f")[e]=[])).push({listener:r,once:!0}),this}emitted(e){return new Promise((r,n)=>{k(this,$r,!0,"f"),e!=="error"&&this.once("error",n),this.once(e,r)})}async done(){k(this,$r,!0,"f"),await _(this,wo,"f")}_emit(e,...r){if(_(this,Ao,"f"))return;e==="end"&&(k(this,Ao,!0,"f"),_(this,_s,"f").call(this));let n=_(this,He,"f")[e];if(n&&(_(this,He,"f")[e]=n.filter(o=>!o.once),n.forEach(({listener:o})=>o(...r))),e==="abort"){let o=r[0];!_(this,$r,"f")&&!n?.length&&Promise.reject(o),_(this,_o,"f").call(this,o),_(this,bo,"f").call(this,o),this._emit("end");return}if(e==="error"){let o=r[0];!_(this,$r,"f")&&!n?.length&&Promise.reject(o),_(this,_o,"f").call(this,o),_(this,bo,"f").call(this,o),this._emit("end")}}_emitFinal(){}};gs=new WeakMap,ys=new WeakMap,_o=new WeakMap,wo=new WeakMap,_s=new WeakMap,bo=new WeakMap,He=new WeakMap,Ao=new WeakMap,ws=new WeakMap,bs=new WeakMap,$r=new WeakMap,ga=new WeakSet,cu=function(e){if(k(this,ws,!0,"f"),e instanceof Error&&e.name==="AbortError"&&(e=new H),e instanceof H)return k(this,bs,!0,"f"),this._emit("abort",e);if(e instanceof T)return this._emit("error",e);if(e instanceof Error){let r=new T(e.message);return r.cause=e,this._emit("error",r)}return this._emit("error",new T(String(e)))};function uu(t){return typeof t.parse=="function"}var he,ya,As,_a,wa,ba,du,pu,hf=10,Nr=class extends dt{constructor(){super(...arguments),he.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(e){this._chatCompletions.push(e),this._emit("chatCompletion",e);let r=e.choices[0]?.message;return r&&this._addMessage(r),e}_addMessage(e,r=!0){if("content"in e||(e.content=null),this.messages.push(e),r){if(this._emit("message",e),ha(e)&&e.content)this._emit("functionToolCallResult",e.content);else if(Rr(e)&&e.tool_calls)for(let n of e.tool_calls)n.type==="function"&&this._emit("functionToolCall",n.function)}}async finalChatCompletion(){await this.done();let e=this._chatCompletions[this._chatCompletions.length-1];if(!e)throw new T("stream ended without producing a ChatCompletion");return e}async finalContent(){return await this.done(),_(this,he,"m",ya).call(this)}async finalMessage(){return await this.done(),_(this,he,"m",As).call(this)}async finalFunctionToolCall(){return await this.done(),_(this,he,"m",_a).call(this)}async finalFunctionToolCallResult(){return await this.done(),_(this,he,"m",wa).call(this)}async totalUsage(){return await this.done(),_(this,he,"m",ba).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let e=this._chatCompletions[this._chatCompletions.length-1];e&&this._emit("finalChatCompletion",e);let r=_(this,he,"m",As).call(this);r&&this._emit("finalMessage",r);let n=_(this,he,"m",ya).call(this);n&&this._emit("finalContent",n);let o=_(this,he,"m",_a).call(this);o&&this._emit("finalFunctionToolCall",o);let s=_(this,he,"m",wa).call(this);s!=null&&this._emit("finalFunctionToolCallResult",s),this._chatCompletions.some(i=>i.usage)&&this._emit("totalUsage",_(this,he,"m",ba).call(this))}async _createChatCompletion(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_(this,he,"m",du).call(this,r);let s=await e.chat.completions.create({...r,stream:!1},{...n,signal:this.controller.signal});return this._connected(),this._addChatCompletion(yo(s,r))}async _runChatCompletion(e,r,n){for(let o of r.messages)this._addMessage(o,!1);return await this._createChatCompletion(e,r,n)}async _runTools(e,r,n){let o="tool",{tool_choice:s="auto",stream:i,...a}=r,c=typeof s!="string"&&s.type==="function"&&s?.function?.name,{maxChatCompletions:l=hf}=n||{},u=r.tools.map(h=>{if(Ft(h)){if(!h.$callback)throw new T("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:h.$callback,name:h.function.name,description:h.function.description||"",parameters:h.function.parameters,parse:h.$parseRaw,strict:!0}}}return h}),m={};for(let h of u)h.type==="function"&&(m[h.function.name||h.function.function.name]=h.function);let f="tools"in r?u.map(h=>h.type==="function"?{type:"function",function:{name:h.function.name||h.function.function.name,parameters:h.function.parameters,description:h.function.description,strict:h.function.strict}}:h):void 0;for(let h of r.messages)this._addMessage(h,!1);for(let h=0;h<l;++h){let A=(await this._createChatCompletion(e,{...a,tool_choice:s,tools:f,messages:[...this.messages]},n)).choices[0]?.message;if(!A)throw new T("missing message in ChatCompletion response");if(!A.tool_calls?.length)return;for(let E of A.tool_calls){if(E.type!=="function")continue;let y=E.id,{name:v,arguments:C}=E.function,L=m[v];if(L){if(c&&c!==v){let U=`Invalid tool_call: ${JSON.stringify(v)}. ${JSON.stringify(c)} requested. Please try again`;this._addMessage({role:o,tool_call_id:y,content:U});continue}}else{let U=`Invalid tool_call: ${JSON.stringify(v)}. Available options are: ${Object.keys(m).map(ne=>JSON.stringify(ne)).join(", ")}. Please try again`;this._addMessage({role:o,tool_call_id:y,content:U});continue}let B;try{B=uu(L)?await L.parse(C):C}catch(U){let ne=U instanceof Error?U.message:String(U);this._addMessage({role:o,tool_call_id:y,content:ne});continue}let P=await L.function(B,this),z=_(this,he,"m",pu).call(this,P);if(this._addMessage({role:o,tool_call_id:y,content:z}),c)return}}}};he=new WeakSet,ya=function(){return _(this,he,"m",As).call(this).content??null},As=function(){let e=this.messages.length;for(;e-- >0;){let r=this.messages[e];if(Rr(r))return{...r,content:r.content??null,refusal:r.refusal??null}}throw new T("stream ended without producing a ChatCompletionMessage with role=assistant")},_a=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(Rr(r)&&r?.tool_calls?.length)for(let n=r.tool_calls.length-1;n>=0;n--){let o=r.tool_calls[n];if(o?.type==="function")return o.function}}},wa=function(){for(let e=this.messages.length-1;e>=0;e--){let r=this.messages[e];if(ha(r)&&r.content!=null&&typeof r.content=="string"&&this.messages.some(n=>n.role==="assistant"&&n.tool_calls?.some(o=>o.type==="function"&&o.id===r.tool_call_id)))return r.content}},ba=function(){let e={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:r}of this._chatCompletions)r&&(e.completion_tokens+=r.completion_tokens,e.prompt_tokens+=r.prompt_tokens,e.total_tokens+=r.total_tokens);return e},du=function(e){if(e.n!=null&&e.n>1)throw new T("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},pu=function(e){return typeof e=="string"?e:e===void 0?"undefined":JSON.stringify(e)};var xo=class t extends Nr{static runTools(e,r,n){let o=new t,s={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,s)),o}_addMessage(e,r=!0){super._addMessage(e,r),Rr(e)&&e.content&&this._emit("content",e.content)}};var oe={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511},Aa=class extends Error{},xa=class extends Error{};function gf(t,e=oe.ALL){if(typeof t!="string")throw new TypeError(`expecting str, got ${typeof t}`);if(!t.trim())throw new Error(`${t} is empty`);return yf(t.trim(),e)}var yf=(t,e)=>{let r=t.length,n=0,o=f=>{throw new Aa(`${f} at position ${n}`)},s=f=>{throw new xa(`${f} at position ${n}`)},i=()=>(m(),n>=r&&o("Unexpected end of input"),t[n]==='"'?a():t[n]==="{"?c():t[n]==="["?l():t.substring(n,n+4)==="null"||oe.NULL&e&&r-n<4&&"null".startsWith(t.substring(n))?(n+=4,null):t.substring(n,n+4)==="true"||oe.BOOL&e&&r-n<4&&"true".startsWith(t.substring(n))?(n+=4,!0):t.substring(n,n+5)==="false"||oe.BOOL&e&&r-n<5&&"false".startsWith(t.substring(n))?(n+=5,!1):t.substring(n,n+8)==="Infinity"||oe.INFINITY&e&&r-n<8&&"Infinity".startsWith(t.substring(n))?(n+=8,1/0):t.substring(n,n+9)==="-Infinity"||oe.MINUS_INFINITY&e&&1<r-n&&r-n<9&&"-Infinity".startsWith(t.substring(n))?(n+=9,-1/0):t.substring(n,n+3)==="NaN"||oe.NAN&e&&r-n<3&&"NaN".startsWith(t.substring(n))?(n+=3,NaN):u()),a=()=>{let f=n,h=!1;for(n++;n<r&&(t[n]!=='"'||h&&t[n-1]==="\\");)h=t[n]==="\\"?!h:!1,n++;if(t.charAt(n)=='"')try{return JSON.parse(t.substring(f,++n-Number(h)))}catch(b){s(String(b))}else if(oe.STR&e)try{return JSON.parse(t.substring(f,n-Number(h))+'"')}catch{return JSON.parse(t.substring(f,t.lastIndexOf("\\"))+'"')}o("Unterminated string literal")},c=()=>{n++,m();let f={};try{for(;t[n]!=="}";){if(m(),n>=r&&oe.OBJ&e)return f;let h=a();m(),n++;try{let b=i();Object.defineProperty(f,h,{value:b,writable:!0,enumerable:!0,configurable:!0})}catch(b){if(oe.OBJ&e)return f;throw b}m(),t[n]===","&&n++}}catch{if(oe.OBJ&e)return f;o("Expected '}' at end of object")}return n++,f},l=()=>{n++;let f=[];try{for(;t[n]!=="]";)f.push(i()),m(),t[n]===","&&n++}catch{if(oe.ARR&e)return f;o("Expected ']' at end of array")}return n++,f},u=()=>{if(n===0){t==="-"&&oe.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t)}catch(h){if(oe.NUM&e)try{return t[t.length-1]==="."?JSON.parse(t.substring(0,t.lastIndexOf("."))):JSON.parse(t.substring(0,t.lastIndexOf("e")))}catch{}s(String(h))}}let f=n;for(t[n]==="-"&&n++;t[n]&&!",]}".includes(t[n]);)n++;n==r&&!(oe.NUM&e)&&o("Unterminated number literal");try{return JSON.parse(t.substring(f,n))}catch{t.substring(f,n)==="-"&&oe.NUM&e&&o("Not sure what '-' is");try{return JSON.parse(t.substring(f,t.lastIndexOf("e")))}catch(b){s(String(b))}}},m=()=>{for(;n<r&&`
47
+ \r `.includes(t[n]);)n++};return i()},va=t=>gf(t,oe.ALL^oe.NUM);var te,Ve,Lr,pt,Ia,xs,Ta,Sa,Ea,vs,Ca,mu,jt=class t extends Nr{constructor(e){super(),te.add(this),Ve.set(this,void 0),Lr.set(this,void 0),pt.set(this,void 0),k(this,Ve,e,"f"),k(this,Lr,[],"f")}get currentChatCompletionSnapshot(){return _(this,pt,"f")}static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static createChatCompletion(e,r,n){let o=new t(r);return o._run(()=>o._runChatCompletion(e,{...r,stream:!0},{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createChatCompletion(e,r,n){super._createChatCompletion;let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_(this,te,"m",Ia).call(this);let s=await e.chat.completions.create({...r,stream:!0},{...n,signal:this.controller.signal});this._connected();for await(let i of s)_(this,te,"m",Ta).call(this,i);if(s.controller.signal?.aborted)throw new H;return this._addChatCompletion(_(this,te,"m",vs).call(this))}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),_(this,te,"m",Ia).call(this),this._connected();let o=Le.fromReadableStream(e,this.controller),s;for await(let i of o)s&&s!==i.id&&this._addChatCompletion(_(this,te,"m",vs).call(this)),_(this,te,"m",Ta).call(this,i),s=i.id;if(o.controller.signal?.aborted)throw new H;return this._addChatCompletion(_(this,te,"m",vs).call(this))}[(Ve=new WeakMap,Lr=new WeakMap,pt=new WeakMap,te=new WeakSet,Ia=function(){this.ended||k(this,pt,void 0,"f")},xs=function(r){let n=_(this,Lr,"f")[r.index];return n||(n={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},_(this,Lr,"f")[r.index]=n,n)},Ta=function(r){if(this.ended)return;let n=_(this,te,"m",mu).call(this,r);this._emit("chunk",r,n);for(let o of r.choices){let s=n.choices[o.index];o.delta.content!=null&&s.message?.role==="assistant"&&s.message?.content&&(this._emit("content",o.delta.content,s.message.content),this._emit("content.delta",{delta:o.delta.content,snapshot:s.message.content,parsed:s.message.parsed})),o.delta.refusal!=null&&s.message?.role==="assistant"&&s.message?.refusal&&this._emit("refusal.delta",{delta:o.delta.refusal,snapshot:s.message.refusal}),o.logprobs?.content!=null&&s.message?.role==="assistant"&&this._emit("logprobs.content.delta",{content:o.logprobs?.content,snapshot:s.logprobs?.content??[]}),o.logprobs?.refusal!=null&&s.message?.role==="assistant"&&this._emit("logprobs.refusal.delta",{refusal:o.logprobs?.refusal,snapshot:s.logprobs?.refusal??[]});let i=_(this,te,"m",xs).call(this,s);s.finish_reason&&(_(this,te,"m",Ea).call(this,s),i.current_tool_call_index!=null&&_(this,te,"m",Sa).call(this,s,i.current_tool_call_index));for(let a of o.delta.tool_calls??[])i.current_tool_call_index!==a.index&&(_(this,te,"m",Ea).call(this,s),i.current_tool_call_index!=null&&_(this,te,"m",Sa).call(this,s,i.current_tool_call_index)),i.current_tool_call_index=a.index;for(let a of o.delta.tool_calls??[]){let c=s.message.tool_calls?.[a.index];c?.type&&(c?.type==="function"?this._emit("tool_calls.function.arguments.delta",{name:c.function?.name,index:a.index,arguments:c.function.arguments,parsed_arguments:c.function.parsed_arguments,arguments_delta:a.function?.arguments??""}):(c?.type,void 0))}}},Sa=function(r,n){if(_(this,te,"m",xs).call(this,r).done_tool_calls.has(n))return;let s=r.message.tool_calls?.[n];if(!s)throw new Error("no tool call snapshot");if(!s.type)throw new Error("tool call snapshot missing `type`");if(s.type==="function"){let i=_(this,Ve,"f")?.tools?.find(a=>ho(a)&&a.function.name===s.function.name);this._emit("tool_calls.function.arguments.done",{name:s.function.name,index:n,arguments:s.function.arguments,parsed_arguments:Ft(i)?i.$parseRaw(s.function.arguments):i?.function.strict?JSON.parse(s.function.arguments):null})}else s.type},Ea=function(r){let n=_(this,te,"m",xs).call(this,r);if(r.message.content&&!n.content_done){n.content_done=!0;let o=_(this,te,"m",Ca).call(this);this._emit("content.done",{content:r.message.content,parsed:o?o.$parseRaw(r.message.content):null})}r.message.refusal&&!n.refusal_done&&(n.refusal_done=!0,this._emit("refusal.done",{refusal:r.message.refusal})),r.logprobs?.content&&!n.logprobs_content_done&&(n.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:r.logprobs.content})),r.logprobs?.refusal&&!n.logprobs_refusal_done&&(n.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:r.logprobs.refusal}))},vs=function(){if(this.ended)throw new T("stream has ended, this shouldn't happen");let r=_(this,pt,"f");if(!r)throw new T("request ended without sending any chunks");return k(this,pt,void 0,"f"),k(this,Lr,[],"f"),_f(r,_(this,Ve,"f"))},Ca=function(){let r=_(this,Ve,"f")?.response_format;return go(r)?r:null},mu=function(r){var n,o,s,i;let a=_(this,pt,"f"),{choices:c,...l}=r;a?Object.assign(a,l):a=k(this,pt,{...l,choices:[]},"f");for(let{delta:u,finish_reason:m,index:f,logprobs:h=null,...b}of r.choices){let A=a.choices[f];if(A||(A=a.choices[f]={finish_reason:m,index:f,message:{},logprobs:h,...b}),h)if(!A.logprobs)A.logprobs=Object.assign({},h);else{let{content:P,refusal:z,...U}=h;Object.assign(A.logprobs,U),P&&((n=A.logprobs).content??(n.content=[]),A.logprobs.content.push(...P)),z&&((o=A.logprobs).refusal??(o.refusal=[]),A.logprobs.refusal.push(...z))}if(m&&(A.finish_reason=m,_(this,Ve,"f")&&fa(_(this,Ve,"f")))){if(m==="length")throw new Cr;if(m==="content_filter")throw new kr}if(Object.assign(A,b),!u)continue;let{content:E,refusal:y,function_call:v,role:C,tool_calls:L,...B}=u;if(Object.assign(A.message,B),y&&(A.message.refusal=(A.message.refusal||"")+y),C&&(A.message.role=C),v&&(A.message.function_call?(v.name&&(A.message.function_call.name=v.name),v.arguments&&((s=A.message.function_call).arguments??(s.arguments=""),A.message.function_call.arguments+=v.arguments)):A.message.function_call=v),E&&(A.message.content=(A.message.content||"")+E,!A.message.refusal&&_(this,te,"m",Ca).call(this)&&(A.message.parsed=va(A.message.content))),L){A.message.tool_calls||(A.message.tool_calls=[]);for(let{index:P,id:z,type:U,function:ne,...Q}of L){let X=(i=A.message.tool_calls)[P]??(i[P]={});Object.assign(X,Q),z&&(X.id=z),U&&(X.type=U),ne&&(X.function??(X.function={name:ne.name??"",arguments:""})),ne?.name&&(X.function.name=ne.name),ne?.arguments&&(X.function.arguments+=ne.arguments,iu(_(this,Ve,"f"),X)&&(X.function.parsed_arguments=va(X.function.arguments)))}}}return a},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("chunk",o=>{let s=r.shift();s?s.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((s,i)=>r.push({resolve:s,reject:i})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new Le(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}};function _f(t,e){let{id:r,choices:n,created:o,model:s,system_fingerprint:i,...a}=t,c={...a,id:r,choices:n.map(({message:l,finish_reason:u,index:m,logprobs:f,...h})=>{if(!u)throw new T(`missing finish_reason for choice ${m}`);let{content:b=null,function_call:A,tool_calls:E,...y}=l,v=l.role;if(!v)throw new T(`missing role for choice ${m}`);if(A){let{arguments:C,name:L}=A;if(C==null)throw new T(`missing function_call.arguments for choice ${m}`);if(!L)throw new T(`missing function_call.name for choice ${m}`);return{...h,message:{content:b,function_call:{arguments:C,name:L},role:v,refusal:l.refusal??null},finish_reason:u,index:m,logprobs:f}}return E?{...h,index:m,finish_reason:u,logprobs:f,message:{...y,role:v,content:b,refusal:l.refusal??null,tool_calls:E.map((C,L)=>{let{function:B,type:P,id:z,...U}=C,{arguments:ne,name:Q,...X}=B||{};if(z==null)throw new T(`missing choices[${m}].tool_calls[${L}].id
48
+ ${Is(t)}`);if(P==null)throw new T(`missing choices[${m}].tool_calls[${L}].type
49
+ ${Is(t)}`);if(Q==null)throw new T(`missing choices[${m}].tool_calls[${L}].function.name
50
+ ${Is(t)}`);if(ne==null)throw new T(`missing choices[${m}].tool_calls[${L}].function.arguments
51
+ ${Is(t)}`);return{...U,id:z,type:P,function:{...X,name:Q,arguments:ne}}})}}:{...h,message:{...y,content:b,role:v,refusal:l.refusal??null},finish_reason:u,index:m,logprobs:f}}),created:o,model:s,object:"chat.completion",...i?{system_fingerprint:i}:{}};return su(c,e)}function Is(t){return JSON.stringify(t)}var vo=class t extends jt{static fromReadableStream(e){let r=new t(null);return r._run(()=>r._fromReadableStream(e)),r}static runTools(e,r,n){let o=new t(r),s={...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"runTools"}};return o._run(()=>o._runTools(e,r,s)),o}};var Ge=class extends g{constructor(){super(...arguments),this.messages=new Dt(this._client)}create(e,r){return this._client.post("/chat/completions",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/chat/completions/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/chat/completions/${e}`,{body:r,...n,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/chat/completions",R,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/chat/completions/${e}`,{...r,__security:{bearerAuth:!0}})}parse(e,r){return lu(e.tools),this._client.chat.completions.create(e,{...r,headers:{...r?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap(n=>yo(n,e))}runTools(e,r){return e.stream?vo.runTools(this._client,e,r):xo.runTools(this._client,e,r)}stream(e,r){return jt.createChatCompletion(this._client,e,r)}};Ge.Messages=Dt;var mt=class extends g{constructor(){super(...arguments),this.completions=new Ge(this._client)}};mt.Completions=Ge;var Dr=class extends g{create(e,r){return this._client.post("/organization/admin_api_keys",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/admin_api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/admin_api_keys",R,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/admin_api_keys/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Fr=class extends g{list(e={},r){return this._client.getAPIList("/organization/audit_logs",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}};var jr=class extends g{create(e,r){return this._client.post("/organization/certificates",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r={},n){return this._client.get(p`/organization/certificates/${e}`,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/certificates/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/certificates",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/certificates/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}activate(e,r){return this._client.getAPIList("/organization/certificates/activate",de,{body:e,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}deactivate(e,r){return this._client.getAPIList("/organization/certificates/deactivate",de,{body:e,method:"post",...r,__security:{adminAPIKeyAuth:!0}})}};var zr=class extends g{retrieve(e){return this._client.get("/organization/data_retention",{...e,__security:{adminAPIKeyAuth:!0}})}update(e,r){return this._client.post("/organization/data_retention",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}};var Ur=class extends g{create(e,r){return this._client.post("/organization/invites",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/invites/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/invites",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/invites/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var qr=class extends g{create(e,r){return this._client.post("/organization/roles",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/roles/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/roles",Y,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/roles/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Br=class extends g{create(e,r){return this._client.post("/organization/spend_alerts",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/spend_alerts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/spend_alerts/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/spend_alerts",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/spend_alerts/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Kr=class extends g{audioSpeeches(e,r){return this._client.get("/organization/usage/audio_speeches",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}audioTranscriptions(e,r){return this._client.get("/organization/usage/audio_transcriptions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}codeInterpreterSessions(e,r){return this._client.get("/organization/usage/code_interpreter_sessions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}completions(e,r){return this._client.get("/organization/usage/completions",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}costs(e,r){return this._client.get("/organization/costs",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}embeddings(e,r){return this._client.get("/organization/usage/embeddings",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}fileSearchCalls(e,r){return this._client.get("/organization/usage/file_search_calls",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}images(e,r){return this._client.get("/organization/usage/images",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}moderations(e,r){return this._client.get("/organization/usage/moderations",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}vectorStores(e,r){return this._client.get("/organization/usage/vector_stores",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}webSearchCalls(e,r){return this._client.get("/organization/usage/web_search_calls",{query:e,...r,__security:{adminAPIKeyAuth:!0}})}};var Wr=class extends g{create(e,r,n){return this._client.post(p`/organization/groups/${e}/roles`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{group_id:o}=r;return this._client.get(p`/organization/groups/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/groups/${e}/roles`,Y,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{group_id:o}=r;return this._client.delete(p`/organization/groups/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var Hr=class extends g{create(e,r,n){return this._client.post(p`/organization/groups/${e}/users`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{group_id:o}=r;return this._client.get(p`/organization/groups/${o}/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/groups/${e}/users`,Y,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{group_id:o}=r;return this._client.delete(p`/organization/groups/${o}/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var ft=class extends g{constructor(){super(...arguments),this.users=new Hr(this._client),this.roles=new Wr(this._client)}create(e,r){return this._client.post("/organization/groups",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/groups/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/groups/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/groups",Y,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/groups/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};ft.Users=Hr;ft.Roles=Wr;var Vr=class extends g{retrieve(e,r,n){let{project_id:o}=r;return this._client.get(p`/organization/projects/${o}/api_keys/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/api_keys`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/organization/projects/${o}/api_keys/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var Gr=class extends g{list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/certificates`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}activate(e,r,n){return this._client.getAPIList(p`/organization/projects/${e}/certificates/activate`,de,{body:r,method:"post",...n,__security:{adminAPIKeyAuth:!0}})}deactivate(e,r,n){return this._client.getAPIList(p`/organization/projects/${e}/certificates/deactivate`,de,{body:r,method:"post",...n,__security:{adminAPIKeyAuth:!0}})}};var Jr=class extends g{retrieve(e,r){return this._client.get(p`/organization/projects/${e}/data_retention`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/projects/${e}/data_retention`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}};var Zr=class extends g{retrieve(e,r){return this._client.get(p`/organization/projects/${e}/hosted_tool_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/projects/${e}/hosted_tool_permissions`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}};var Qr=class extends g{retrieve(e,r){return this._client.get(p`/organization/projects/${e}/model_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/projects/${e}/model_permissions`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/projects/${e}/model_permissions`,{...r,__security:{adminAPIKeyAuth:!0}})}};var Yr=class extends g{listRateLimits(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/rate_limits`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}updateRateLimit(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/organization/projects/${o}/rate_limits/${e}`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}};var Xr=class extends g{create(e,r,n){return this._client.post(p`/projects/${e}/roles`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o}=r;return this._client.get(p`/projects/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/projects/${o}/roles/${e}`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/projects/${e}/roles`,Y,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/projects/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var en=class extends g{create(e,r,n){return this._client.post(p`/organization/projects/${e}/service_accounts`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o}=r;return this._client.get(p`/organization/projects/${o}/service_accounts/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/organization/projects/${o}/service_accounts/${e}`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/service_accounts`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/organization/projects/${o}/service_accounts/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var tn=class extends g{create(e,r,n){return this._client.post(p`/organization/projects/${e}/spend_alerts`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o}=r;return this._client.get(p`/organization/projects/${o}/spend_alerts/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/organization/projects/${o}/spend_alerts/${e}`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/spend_alerts`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/organization/projects/${o}/spend_alerts/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var rn=class extends g{create(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/projects/${o}/groups/${e}/roles`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o,group_id:s}=r;return this._client.get(p`/projects/${o}/groups/${s}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r,n){let{project_id:o,...s}=r;return this._client.getAPIList(p`/projects/${o}/groups/${e}/roles`,Y,{query:s,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o,group_id:s}=r;return this._client.delete(p`/projects/${o}/groups/${s}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var zt=class extends g{constructor(){super(...arguments),this.roles=new rn(this._client)}create(e,r,n){return this._client.post(p`/organization/projects/${e}/groups`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o,...s}=r;return this._client.get(p`/organization/projects/${o}/groups/${e}`,{query:s,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/groups`,Y,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/organization/projects/${o}/groups/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};zt.Roles=rn;var nn=class extends g{create(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/projects/${o}/users/${e}/roles`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o,user_id:s}=r;return this._client.get(p`/projects/${o}/users/${s}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r,n){let{project_id:o,...s}=r;return this._client.getAPIList(p`/projects/${o}/users/${e}/roles`,Y,{query:s,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o,user_id:s}=r;return this._client.delete(p`/projects/${o}/users/${s}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var Ut=class extends g{constructor(){super(...arguments),this.roles=new nn(this._client)}create(e,r,n){return this._client.post(p`/organization/projects/${e}/users`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{project_id:o}=r;return this._client.get(p`/organization/projects/${o}/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){let{project_id:o,...s}=r;return this._client.post(p`/organization/projects/${o}/users/${e}`,{body:s,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/projects/${e}/users`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{project_id:o}=r;return this._client.delete(p`/organization/projects/${o}/users/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};Ut.Roles=nn;var ie=class extends g{constructor(){super(...arguments),this.users=new Ut(this._client),this.serviceAccounts=new en(this._client),this.apiKeys=new Vr(this._client),this.rateLimits=new Yr(this._client),this.modelPermissions=new Qr(this._client),this.hostedToolPermissions=new Zr(this._client),this.groups=new zt(this._client),this.roles=new Xr(this._client),this.dataRetention=new Jr(this._client),this.spendAlerts=new tn(this._client),this.certificates=new Gr(this._client)}create(e,r){return this._client.post("/organization/projects",{body:e,...r,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r){return this._client.get(p`/organization/projects/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/projects/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/projects",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}archive(e,r){return this._client.post(p`/organization/projects/${e}/archive`,{...r,__security:{adminAPIKeyAuth:!0}})}};ie.Users=Ut;ie.ServiceAccounts=en;ie.APIKeys=Vr;ie.RateLimits=Yr;ie.ModelPermissions=Qr;ie.HostedToolPermissions=Zr;ie.Groups=zt;ie.Roles=Xr;ie.DataRetention=Jr;ie.SpendAlerts=tn;ie.Certificates=Gr;var on=class extends g{create(e,r,n){return this._client.post(p`/organization/users/${e}/roles`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r,n){let{user_id:o}=r;return this._client.get(p`/organization/users/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/organization/users/${e}/roles`,Y,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{user_id:o}=r;return this._client.delete(p`/organization/users/${o}/roles/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var qt=class extends g{constructor(){super(...arguments),this.roles=new on(this._client)}retrieve(e,r){return this._client.get(p`/organization/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}update(e,r,n){return this._client.post(p`/organization/users/${e}`,{body:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e={},r){return this._client.getAPIList("/organization/users",D,{query:e,...r,__security:{adminAPIKeyAuth:!0}})}delete(e,r){return this._client.delete(p`/organization/users/${e}`,{...r,__security:{adminAPIKeyAuth:!0}})}};qt.Roles=on;var ae=class extends g{constructor(){super(...arguments),this.auditLogs=new Fr(this._client),this.adminAPIKeys=new Dr(this._client),this.usage=new Kr(this._client),this.invites=new Ur(this._client),this.users=new qt(this._client),this.groups=new ft(this._client),this.roles=new qr(this._client),this.dataRetention=new zr(this._client),this.spendAlerts=new Br(this._client),this.certificates=new jr(this._client),this.projects=new ie(this._client)}};ae.AuditLogs=Fr;ae.AdminAPIKeys=Dr;ae.Usage=Kr;ae.Invites=Ur;ae.Users=qt;ae.Groups=ft;ae.Roles=qr;ae.DataRetention=zr;ae.SpendAlerts=Br;ae.Certificates=jr;ae.Projects=ie;var ht=class extends g{constructor(){super(...arguments),this.organization=new ae(this._client)}};ht.Organization=ae;var fu=Symbol("brand.privateNullableHeaders");function*Gf(t){if(!t)return;if(fu in t){let{values:n,nulls:o}=t;yield*n.entries();for(let s of o)yield[s,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Ji(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let s=Ji(n[1])?n[1]:[n[1]],i=!1;for(let a of s)a!==void 0&&(e&&!i&&(i=!0,yield[o,null]),yield[o,a])}}var I=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[s,i]of Gf(n)){let a=s.toLowerCase();o.has(a)||(e.delete(s),o.add(a)),i===null?(e.delete(s),r.add(a)):(e.append(s,i),r.delete(a))}}return{[fu]:!0,values:e,nulls:r}};var sn=class extends g{create(e,r){return this._client.post("/audio/speech",{body:e,...r,headers:I([{Accept:"application/octet-stream"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var an=class extends g{create(e,r){return this._client.post("/audio/transcriptions",pe({body:e,...r,stream:e.stream??!1,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}};var ln=class extends g{create(e,r){return this._client.post("/audio/translations",pe({body:e,...r,__metadata:{model:e.model},__security:{bearerAuth:!0}},this._client))}};var De=class extends g{constructor(){super(...arguments),this.transcriptions=new an(this._client),this.translations=new ln(this._client),this.speech=new sn(this._client)}};De.Transcriptions=an;De.Translations=ln;De.Speech=sn;var Bt=class extends g{create(e,r){return this._client.post("/batches",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/batches/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/batches",R,{query:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(p`/batches/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}};var cn=class extends g{create(e,r){return this._client.post("/assistants",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/assistants/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/assistants/${e}`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/assistants",R,{query:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/assistants/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var un=class extends g{create(e,r){return this._client.post("/realtime/sessions",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var dn=class extends g{create(e,r){return this._client.post("/realtime/transcription_sessions",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}};var gt=class extends g{constructor(){super(...arguments),this.sessions=new un(this._client),this.transcriptionSessions=new dn(this._client)}};gt.Sessions=un;gt.TranscriptionSessions=dn;var pn=class extends g{create(e,r){return this._client.post("/chatkit/sessions",{body:e,...r,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(p`/chatkit/sessions/${e}/cancel`,{...r,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}};var mn=class extends g{retrieve(e,r){return this._client.get(p`/chatkit/threads/${e}`,{...r,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/chatkit/threads",D,{query:e,...r,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/chatkit/threads/${e}`,{...r,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},r?.headers]),__security:{bearerAuth:!0}})}listItems(e,r={},n){return this._client.getAPIList(p`/chatkit/threads/${e}/items`,D,{query:r,...n,headers:I([{"OpenAI-Beta":"chatkit_beta=v1"},n?.headers]),__security:{bearerAuth:!0}})}};var yt=class extends g{constructor(){super(...arguments),this.sessions=new pn(this._client),this.threads=new mn(this._client)}};yt.Sessions=pn;yt.Threads=mn;var fn=class extends g{create(e,r,n){return this._client.post(p`/threads/${e}/messages`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(p`/threads/${o}/messages/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){let{thread_id:o,...s}=r;return this._client.post(p`/threads/${o}/messages/${e}`,{body:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/threads/${e}/messages`,R,{query:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,r,n){let{thread_id:o}=r;return this._client.delete(p`/threads/${o}/messages/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}};var hn=class extends g{retrieve(e,r,n){let{thread_id:o,run_id:s,...i}=r;return this._client.get(p`/threads/${o}/runs/${s}/steps/${e}`,{query:i,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e,r,n){let{thread_id:o,...s}=r;return this._client.getAPIList(p`/threads/${o}/runs/${e}/steps`,R,{query:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}};var hu=t=>{if(typeof Buffer<"u"){let e=Buffer.from(t,"base64");return Array.from(new Float32Array(e.buffer,e.byteOffset,e.length/Float32Array.BYTES_PER_ELEMENT))}else{let e=atob(t),r=e.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=e.charCodeAt(o);return Array.from(new Float32Array(n.buffer))}};var xe=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()||void 0};var le,Wt,ka,Fe,Ts,ve,Ht,gn,Kt,Cs,we,Ss,Es,So,Io,To,gu,yu,_u,wu,bu,Au,xu,Je=class extends dt{constructor(){super(...arguments),le.add(this),ka.set(this,[]),Fe.set(this,{}),Ts.set(this,{}),ve.set(this,void 0),Ht.set(this,void 0),gn.set(this,void 0),Kt.set(this,void 0),Cs.set(this,void 0),we.set(this,void 0),Ss.set(this,void 0),Es.set(this,void 0),So.set(this,void 0)}[(ka=new WeakMap,Fe=new WeakMap,Ts=new WeakMap,ve=new WeakMap,Ht=new WeakMap,gn=new WeakMap,Kt=new WeakMap,Cs=new WeakMap,we=new WeakMap,Ss=new WeakMap,Es=new WeakMap,So=new WeakMap,le=new WeakSet,Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let s=r.shift();s?s.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((s,i)=>r.push({resolve:s,reject:i})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}static fromReadableStream(e){let r=new Wt;return r._run(()=>r._fromReadableStream(e)),r}async _fromReadableStream(e,r){let n=r?.signal;n&&(n.aborted&&this.controller.abort(),n.addEventListener("abort",()=>this.controller.abort())),this._connected();let o=Le.fromReadableStream(e,this.controller);for await(let s of o)_(this,le,"m",Io).call(this,s);if(o.controller.signal?.aborted)throw new H;return this._addRun(_(this,le,"m",To).call(this))}toReadableStream(){return new Le(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(e,r,n,o){let s=new Wt;return s._run(()=>s._runToolAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),s}async _createToolAssistantStream(e,r,n,o){let s=o?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));let i={...n,stream:!0},a=await e.submitToolOutputs(r,i,{...o,signal:this.controller.signal});this._connected();for await(let c of a)_(this,le,"m",Io).call(this,c);if(a.controller.signal?.aborted)throw new H;return this._addRun(_(this,le,"m",To).call(this))}static createThreadAssistantStream(e,r,n){let o=new Wt;return o._run(()=>o._threadAssistantStream(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}static createAssistantStream(e,r,n,o){let s=new Wt;return s._run(()=>s._runAssistantStream(e,r,n,{...o,headers:{...o?.headers,"X-Stainless-Helper-Method":"stream"}})),s}currentEvent(){return _(this,Ss,"f")}currentRun(){return _(this,Es,"f")}currentMessageSnapshot(){return _(this,ve,"f")}currentRunStepSnapshot(){return _(this,So,"f")}async finalRunSteps(){return await this.done(),Object.values(_(this,Fe,"f"))}async finalMessages(){return await this.done(),Object.values(_(this,Ts,"f"))}async finalRun(){if(await this.done(),!_(this,Ht,"f"))throw Error("Final run was not received.");return _(this,Ht,"f")}async _createThreadAssistantStream(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort()));let s={...r,stream:!0},i=await e.createAndRun(s,{...n,signal:this.controller.signal});this._connected();for await(let a of i)_(this,le,"m",Io).call(this,a);if(i.controller.signal?.aborted)throw new H;return this._addRun(_(this,le,"m",To).call(this))}async _createAssistantStream(e,r,n,o){let s=o?.signal;s&&(s.aborted&&this.controller.abort(),s.addEventListener("abort",()=>this.controller.abort()));let i={...n,stream:!0},a=await e.create(r,i,{...o,signal:this.controller.signal});this._connected();for await(let c of a)_(this,le,"m",Io).call(this,c);if(a.controller.signal?.aborted)throw new H;return this._addRun(_(this,le,"m",To).call(this))}static accumulateDelta(e,r){for(let[n,o]of Object.entries(r)){if(!e.hasOwnProperty(n)){e[n]=o;continue}let s=e[n];if(s==null){e[n]=o;continue}if(n==="index"||n==="type"){e[n]=o;continue}if(typeof s=="string"&&typeof o=="string")s+=o;else if(typeof s=="number"&&typeof o=="number")s+=o;else if(ao(s)&&ao(o))s=this.accumulateDelta(s,o);else if(Array.isArray(s)&&Array.isArray(o)){if(s.every(i=>typeof i=="string"||typeof i=="number")){s.push(...o);continue}for(let i of o){if(!ao(i))throw new Error(`Expected array delta entry to be an object but got: ${i}`);let a=i.index;if(a==null)throw console.error(i),new Error("Expected array delta entry to have an `index` property");if(typeof a!="number")throw new Error(`Expected array delta entry \`index\` property to be a number but got ${a}`);let c=s[a];c==null?s.push(i):s[a]=this.accumulateDelta(c,i)}continue}else throw Error(`Unhandled record type: ${n}, deltaValue: ${o}, accValue: ${s}`);e[n]=s}return e}_addRun(e){return e}async _threadAssistantStream(e,r,n){return await this._createThreadAssistantStream(r,e,n)}async _runAssistantStream(e,r,n,o){return await this._createAssistantStream(r,e,n,o)}async _runToolAssistantStream(e,r,n,o){return await this._createToolAssistantStream(r,e,n,o)}};Wt=Je,Io=function(e){if(!this.ended)switch(k(this,Ss,e,"f"),_(this,le,"m",_u).call(this,e),e.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":_(this,le,"m",xu).call(this,e);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":_(this,le,"m",yu).call(this,e);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":_(this,le,"m",gu).call(this,e);break;case"error":throw new Error("Encountered an error event in event processing - errors should be processed earlier");default:}},To=function(){if(this.ended)throw new T("stream has ended, this shouldn't happen");if(!_(this,Ht,"f"))throw Error("Final run has not been received");return _(this,Ht,"f")},gu=function(e){let[r,n]=_(this,le,"m",bu).call(this,e,_(this,ve,"f"));k(this,ve,r,"f"),_(this,Ts,"f")[r.id]=r;for(let o of n){let s=r.content[o.index];s?.type=="text"&&this._emit("textCreated",s.text)}switch(e.event){case"thread.message.created":this._emit("messageCreated",e.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",e.data.delta,r),e.data.delta.content)for(let o of e.data.delta.content){if(o.type=="text"&&o.text){let s=o.text,i=r.content[o.index];if(i&&i.type=="text")this._emit("textDelta",s,i.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(o.index!=_(this,gn,"f")){if(_(this,Kt,"f"))switch(_(this,Kt,"f").type){case"text":this._emit("textDone",_(this,Kt,"f").text,_(this,ve,"f"));break;case"image_file":this._emit("imageFileDone",_(this,Kt,"f").image_file,_(this,ve,"f"));break}k(this,gn,o.index,"f")}k(this,Kt,r.content[o.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(_(this,gn,"f")!==void 0){let o=e.data.content[_(this,gn,"f")];if(o)switch(o.type){case"image_file":this._emit("imageFileDone",o.image_file,_(this,ve,"f"));break;case"text":this._emit("textDone",o.text,_(this,ve,"f"));break}}_(this,ve,"f")&&this._emit("messageDone",e.data),k(this,ve,void 0,"f")}},yu=function(e){let r=_(this,le,"m",wu).call(this,e);switch(k(this,So,r,"f"),e.event){case"thread.run.step.created":this._emit("runStepCreated",e.data);break;case"thread.run.step.delta":let n=e.data.delta;if(n.step_details&&n.step_details.type=="tool_calls"&&n.step_details.tool_calls&&r.step_details.type=="tool_calls")for(let s of n.step_details.tool_calls)s.index==_(this,Cs,"f")?this._emit("toolCallDelta",s,r.step_details.tool_calls[s.index]):(_(this,we,"f")&&this._emit("toolCallDone",_(this,we,"f")),k(this,Cs,s.index,"f"),k(this,we,r.step_details.tool_calls[s.index],"f"),_(this,we,"f")&&this._emit("toolCallCreated",_(this,we,"f")));this._emit("runStepDelta",e.data.delta,r);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":k(this,So,void 0,"f"),e.data.step_details.type=="tool_calls"&&_(this,we,"f")&&(this._emit("toolCallDone",_(this,we,"f")),k(this,we,void 0,"f")),this._emit("runStepDone",e.data,r);break;case"thread.run.step.in_progress":break}},_u=function(e){_(this,ka,"f").push(e),this._emit("event",e)},wu=function(e){switch(e.event){case"thread.run.step.created":return _(this,Fe,"f")[e.data.id]=e.data,e.data;case"thread.run.step.delta":let r=_(this,Fe,"f")[e.data.id];if(!r)throw Error("Received a RunStepDelta before creation of a snapshot");let n=e.data;if(n.delta){let o=Wt.accumulateDelta(r,n.delta);_(this,Fe,"f")[e.data.id]=o}return _(this,Fe,"f")[e.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":_(this,Fe,"f")[e.data.id]=e.data;break}if(_(this,Fe,"f")[e.data.id])return _(this,Fe,"f")[e.data.id];throw new Error("No snapshot available")},bu=function(e,r){let n=[];switch(e.event){case"thread.message.created":return[e.data,n];case"thread.message.delta":if(!r)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let o=e.data;if(o.delta.content)for(let s of o.delta.content)if(s.index in r.content){let i=r.content[s.index];r.content[s.index]=_(this,le,"m",Au).call(this,s,i)}else r.content[s.index]=s,n.push(s);return[r,n];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(r)return[r,n];throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},Au=function(e,r){return Wt.accumulateDelta(r,e)},xu=function(e){switch(k(this,Es,e.data,"f"),e.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":k(this,Ht,e.data,"f"),_(this,we,"f")&&(this._emit("toolCallDone",_(this,we,"f")),k(this,we,void 0,"f"));break;case"thread.run.cancelling":break}};var Vt=class extends g{constructor(){super(...arguments),this.steps=new hn(this._client)}create(e,r,n){let{include:o,...s}=r;return this._client.post(p`/threads/${e}/runs`,{query:{include:o},body:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}retrieve(e,r,n){let{thread_id:o}=r;return this._client.get(p`/threads/${o}/runs/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){let{thread_id:o,...s}=r;return this._client.post(p`/threads/${o}/runs/${e}`,{body:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/threads/${e}/runs`,R,{query:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}cancel(e,r,n){let{thread_id:o}=r;return this._client.post(p`/threads/${o}/runs/${e}/cancel`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(o.id,{thread_id:e},n)}createAndStream(e,r,n){return Je.createAssistantStream(e,this._client.beta.threads.runs,r,n)}async poll(e,r,n){let o=I([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:s,response:i}=await this.retrieve(e,r,{...n,headers:{...n?.headers,...o}}).withResponse();switch(s.status){case"queued":case"in_progress":case"cancelling":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.headers.get("openai-poll-after-ms");if(c){let l=parseInt(c);isNaN(l)||(a=l)}}await $e(a);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return s}}}stream(e,r,n){return Je.createAssistantStream(e,this._client.beta.threads.runs,r,n)}submitToolOutputs(e,r,n){let{thread_id:o,...s}=r;return this._client.post(p`/threads/${o}/runs/${e}/submit_tool_outputs`,{body:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),stream:r.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async submitToolOutputsAndPoll(e,r,n){let o=await this.submitToolOutputs(e,r,n);return await this.poll(o.id,r,n)}submitToolOutputsStream(e,r,n){return Je.createToolAssistantStream(e,this._client.beta.threads.runs,r,n)}};Vt.Steps=hn;var _t=class extends g{constructor(){super(...arguments),this.runs=new Vt(this._client),this.messages=new fn(this._client)}create(e={},r){return this._client.post("/threads",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/threads/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/threads/${e}`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/threads/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}createAndRun(e,r){return this._client.post("/threads/runs",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),stream:e.stream??!1,__synthesizeEventData:!0,__security:{bearerAuth:!0}})}async createAndRunPoll(e,r){let n=await this.createAndRun(e,r);return await this.runs.poll(n.id,{thread_id:n.thread_id},r)}createAndRunStream(e,r){return Je.createThreadAssistantStream(e,this._client.beta.threads,r)}};_t.Runs=Vt;_t.Messages=fn;var Ie=class extends g{constructor(){super(...arguments),this.realtime=new gt(this._client),this.chatkit=new yt(this._client),this.assistants=new cn(this._client),this.threads=new _t(this._client)}};Ie.Realtime=gt;Ie.ChatKit=yt;Ie.Assistants=cn;Ie.Threads=_t;var Gt=class extends g{create(e,r){return this._client.post("/completions",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}};var yn=class extends g{retrieve(e,r,n){let{container_id:o}=r;return this._client.get(p`/containers/${o}/files/${e}/content`,{...n,headers:I([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var Jt=class extends g{constructor(){super(...arguments),this.content=new yn(this._client)}create(e,r,n){return this._client.post(p`/containers/${e}/files`,ut({body:r,...n,__security:{bearerAuth:!0}},this._client))}retrieve(e,r,n){let{container_id:o}=r;return this._client.get(p`/containers/${o}/files/${e}`,{...n,__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/containers/${e}/files`,R,{query:r,...n,__security:{bearerAuth:!0}})}delete(e,r,n){let{container_id:o}=r;return this._client.delete(p`/containers/${o}/files/${e}`,{...n,headers:I([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}};Jt.Content=yn;var wt=class extends g{constructor(){super(...arguments),this.files=new Jt(this._client)}create(e,r){return this._client.post("/containers",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/containers/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/containers",R,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/containers/${e}`,{...r,headers:I([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}};wt.Files=Jt;var _n=class extends g{create(e,r,n){let{include:o,...s}=r;return this._client.post(p`/conversations/${e}/items`,{query:{include:o},body:s,...n,__security:{bearerAuth:!0}})}retrieve(e,r,n){let{conversation_id:o,...s}=r;return this._client.get(p`/conversations/${o}/items/${e}`,{query:s,...n,__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/conversations/${e}/items`,D,{query:r,...n,__security:{bearerAuth:!0}})}delete(e,r,n){let{conversation_id:o}=r;return this._client.delete(p`/conversations/${o}/items/${e}`,{...n,__security:{bearerAuth:!0}})}};var bt=class extends g{constructor(){super(...arguments),this.items=new _n(this._client)}create(e={},r){return this._client.post("/conversations",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/conversations/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/conversations/${e}`,{body:r,...n,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/conversations/${e}`,{...r,__security:{bearerAuth:!0}})}};bt.Items=_n;var Zt=class extends g{create(e,r){let n=!!e.encoding_format,o=n?e.encoding_format:"base64";n&&Z(this._client).debug("embeddings/user defined encoding_format:",e.encoding_format);let s=this._client.post("/embeddings",{body:{...e,encoding_format:o},...r,__security:{bearerAuth:!0}});return n?s:(Z(this._client).debug("embeddings/decoding base64 embeddings from base64"),s._thenUnwrap(i=>(i&&i.data&&i.data.forEach(a=>{let c=a.embedding;a.embedding=hu(c)}),i)))}};var wn=class extends g{retrieve(e,r,n){let{eval_id:o,run_id:s}=r;return this._client.get(p`/evals/${o}/runs/${s}/output_items/${e}`,{...n,__security:{bearerAuth:!0}})}list(e,r,n){let{eval_id:o,...s}=r;return this._client.getAPIList(p`/evals/${o}/runs/${e}/output_items`,R,{query:s,...n,__security:{bearerAuth:!0}})}};var Qt=class extends g{constructor(){super(...arguments),this.outputItems=new wn(this._client)}create(e,r,n){return this._client.post(p`/evals/${e}/runs`,{body:r,...n,__security:{bearerAuth:!0}})}retrieve(e,r,n){let{eval_id:o}=r;return this._client.get(p`/evals/${o}/runs/${e}`,{...n,__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/evals/${e}/runs`,R,{query:r,...n,__security:{bearerAuth:!0}})}delete(e,r,n){let{eval_id:o}=r;return this._client.delete(p`/evals/${o}/runs/${e}`,{...n,__security:{bearerAuth:!0}})}cancel(e,r,n){let{eval_id:o}=r;return this._client.post(p`/evals/${o}/runs/${e}`,{...n,__security:{bearerAuth:!0}})}};Qt.OutputItems=wn;var At=class extends g{constructor(){super(...arguments),this.runs=new Qt(this._client)}create(e,r){return this._client.post("/evals",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/evals/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/evals/${e}`,{body:r,...n,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/evals",R,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/evals/${e}`,{...r,__security:{bearerAuth:!0}})}};At.Runs=Qt;var Yt=class extends g{create(e,r){return this._client.post("/files",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(p`/files/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/files",R,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/files/${e}`,{...r,__security:{bearerAuth:!0}})}content(e,r){return this._client.get(p`/files/${e}/content`,{...r,headers:I([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}async waitForProcessing(e,{pollInterval:r=5e3,maxWait:n=1800*1e3}={}){let o=new Set(["processed","error","deleted"]),s=Date.now(),i=await this.retrieve(e);for(;!i.status||!o.has(i.status);)if(await $e(r),i=await this.retrieve(e),Date.now()-s>n)throw new Me({message:`Giving up on waiting for file ${e} to finish processing after ${n} milliseconds.`});return i}};var bn=class extends g{};var An=class extends g{run(e,r){return this._client.post("/fine_tuning/alpha/graders/run",{body:e,...r,__security:{bearerAuth:!0}})}validate(e,r){return this._client.post("/fine_tuning/alpha/graders/validate",{body:e,...r,__security:{bearerAuth:!0}})}};var Xt=class extends g{constructor(){super(...arguments),this.graders=new An(this._client)}};Xt.Graders=An;var xn=class extends g{create(e,r,n){return this._client.getAPIList(p`/fine_tuning/checkpoints/${e}/permissions`,de,{body:r,method:"post",...n,__security:{adminAPIKeyAuth:!0}})}retrieve(e,r={},n){return this._client.get(p`/fine_tuning/checkpoints/${e}/permissions`,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/fine_tuning/checkpoints/${e}/permissions`,D,{query:r,...n,__security:{adminAPIKeyAuth:!0}})}delete(e,r,n){let{fine_tuned_model_checkpoint:o}=r;return this._client.delete(p`/fine_tuning/checkpoints/${o}/permissions/${e}`,{...n,__security:{adminAPIKeyAuth:!0}})}};var er=class extends g{constructor(){super(...arguments),this.permissions=new xn(this._client)}};er.Permissions=xn;var vn=class extends g{list(e,r={},n){return this._client.getAPIList(p`/fine_tuning/jobs/${e}/checkpoints`,R,{query:r,...n,__security:{bearerAuth:!0}})}};var tr=class extends g{constructor(){super(...arguments),this.checkpoints=new vn(this._client)}create(e,r){return this._client.post("/fine_tuning/jobs",{body:e,...r,__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/fine_tuning/jobs/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/fine_tuning/jobs",R,{query:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(p`/fine_tuning/jobs/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}listEvents(e,r={},n){return this._client.getAPIList(p`/fine_tuning/jobs/${e}/events`,R,{query:r,...n,__security:{bearerAuth:!0}})}pause(e,r){return this._client.post(p`/fine_tuning/jobs/${e}/pause`,{...r,__security:{bearerAuth:!0}})}resume(e,r){return this._client.post(p`/fine_tuning/jobs/${e}/resume`,{...r,__security:{bearerAuth:!0}})}};tr.Checkpoints=vn;var Te=class extends g{constructor(){super(...arguments),this.methods=new bn(this._client),this.jobs=new tr(this._client),this.checkpoints=new er(this._client),this.alpha=new Xt(this._client)}};Te.Methods=bn;Te.Jobs=tr;Te.Checkpoints=er;Te.Alpha=Xt;var In=class extends g{};var xt=class extends g{constructor(){super(...arguments),this.graderModels=new In(this._client)}};xt.GraderModels=In;var rr=class extends g{createVariation(e,r){return this._client.post("/images/variations",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}edit(e,r){return this._client.post("/images/edits",pe({body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}},this._client))}generate(e,r){return this._client.post("/images/generations",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})}};var nr=class extends g{retrieve(e,r){return this._client.get(p`/models/${e}`,{...r,__security:{bearerAuth:!0}})}list(e){return this._client.getAPIList("/models",de,{...e,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/models/${e}`,{...r,__security:{bearerAuth:!0}})}};var or=class extends g{create(e,r){return this._client.post("/moderations",{body:e,...r,__security:{bearerAuth:!0}})}};var Tn=class extends g{accept(e,r,n){return this._client.post(p`/realtime/calls/${e}/accept`,{body:r,...n,headers:I([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}hangup(e,r){return this._client.post(p`/realtime/calls/${e}/hangup`,{...r,headers:I([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}refer(e,r,n){return this._client.post(p`/realtime/calls/${e}/refer`,{body:r,...n,headers:I([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}reject(e,r={},n){return this._client.post(p`/realtime/calls/${e}/reject`,{body:r,...n,headers:I([{Accept:"*/*"},n?.headers]),__security:{bearerAuth:!0}})}};var Sn=class extends g{create(e,r){return this._client.post("/realtime/client_secrets",{body:e,...r,__security:{bearerAuth:!0}})}};var Ze=class extends g{constructor(){super(...arguments),this.clientSecrets=new Sn(this._client),this.calls=new Tn(this._client)}};Ze.ClientSecrets=Sn;Ze.Calls=Tn;function vu(t,e){return!e||!Th(e)?{...t,output_parsed:null,output:t.output.map(r=>r.type==="function_call"?{...r,parsed_arguments:null}:r.type==="message"?{...r,content:r.content.map(n=>({...n,parsed:null}))}:r)}:Oa(t,e)}function Oa(t,e){let r=t.output.map(o=>{if(o.type==="function_call")return{...o,parsed_arguments:Ch(e,o)};if(o.type==="message"){let s=o.content.map(i=>i.type==="output_text"?{...i,parsed:Ih(e,i.text)}:i);return{...o,content:s}}return o}),n=Object.assign({},t,{output:r});return Object.getOwnPropertyDescriptor(t,"output_text")||Eo(n),Object.defineProperty(n,"output_parsed",{enumerable:!0,get(){for(let o of n.output)if(o.type==="message"){for(let s of o.content)if(s.type==="output_text"&&s.parsed!==null)return s.parsed}return null}}),n}function Ih(t,e){return t.text?.format?.type!=="json_schema"?null:"$parseRaw"in t.text?.format?(t.text?.format).$parseRaw(e):JSON.parse(e)}function Th(t){return!!go(t.text?.format)}function Sh(t){return t?.$brand==="auto-parseable-tool"}function Eh(t,e){return t.find(r=>r.type==="function"&&r.name===e)}function Ch(t,e){let r=Eh(t.tools??[],e.name);return{...e,...e,parsed_arguments:Sh(r)?r.$parseRaw(e.arguments):r?.strict?JSON.parse(e.arguments):null}}function Eo(t){let e=[];for(let r of t.output)if(r.type==="message")for(let n of r.content)n.type==="output_text"&&e.push(n.text);t.output_text=e.join("")}var En,ks,vt,Os,Iu,Tu,Su,Eu,Ps=class t extends dt{constructor(e){super(),En.add(this),ks.set(this,void 0),vt.set(this,void 0),Os.set(this,void 0),k(this,ks,e,"f")}static createResponse(e,r,n){let o=new t(r);return o._run(()=>o._createOrRetrieveResponse(e,r,{...n,headers:{...n?.headers,"X-Stainless-Helper-Method":"stream"}})),o}async _createOrRetrieveResponse(e,r,n){let o=n?.signal;o&&(o.aborted&&this.controller.abort(),o.addEventListener("abort",()=>this.controller.abort())),_(this,En,"m",Iu).call(this);let s,i=null;"response_id"in r?(s=await e.responses.retrieve(r.response_id,{stream:!0},{...n,signal:this.controller.signal,stream:!0}),i=r.starting_after??null):s=await e.responses.create({...r,stream:!0},{...n,signal:this.controller.signal}),this._connected();for await(let a of s)_(this,En,"m",Tu).call(this,a,i);if(s.controller.signal?.aborted)throw new H;return _(this,En,"m",Su).call(this)}[(ks=new WeakMap,vt=new WeakMap,Os=new WeakMap,En=new WeakSet,Iu=function(){this.ended||k(this,vt,void 0,"f")},Tu=function(r,n){if(this.ended)return;let o=(i,a)=>{(n==null||a.sequence_number>n)&&this._emit(i,a)},s=_(this,En,"m",Eu).call(this,r);switch(o("event",r),r.type){case"response.output_text.delta":{let i=s.output[r.output_index];if(!i)throw new T(`missing output at index ${r.output_index}`);if(i.type==="message"){let a=i.content[r.content_index];if(!a)throw new T(`missing content at index ${r.content_index}`);if(a.type!=="output_text")throw new T(`expected content to be 'output_text', got ${a.type}`);o("response.output_text.delta",{...r,snapshot:a.text})}break}case"response.function_call_arguments.delta":{let i=s.output[r.output_index];if(!i)throw new T(`missing output at index ${r.output_index}`);i.type==="function_call"&&o("response.function_call_arguments.delta",{...r,snapshot:i.arguments});break}default:o(r.type,r);break}},Su=function(){if(this.ended)throw new T("stream has ended, this shouldn't happen");let r=_(this,vt,"f");if(!r)throw new T("request ended without sending any events");k(this,vt,void 0,"f");let n=kh(r,_(this,ks,"f"));return k(this,Os,n,"f"),n},Eu=function(r){let n=_(this,vt,"f");if(!n){if(r.type!=="response.created")throw new T(`When snapshot hasn't been set yet, expected 'response.created' event, got ${r.type}`);return n=k(this,vt,r.response,"f"),n}switch(r.type){case"response.output_item.added":{n.output.push(r.item);break}case"response.content_part.added":{let o=n.output[r.output_index];if(!o)throw new T(`missing output at index ${r.output_index}`);let s=o.type,i=r.part;s==="message"&&i.type!=="reasoning_text"?o.content.push(i):s==="reasoning"&&i.type==="reasoning_text"&&(o.content||(o.content=[]),o.content.push(i));break}case"response.output_text.delta":{let o=n.output[r.output_index];if(!o)throw new T(`missing output at index ${r.output_index}`);if(o.type==="message"){let s=o.content[r.content_index];if(!s)throw new T(`missing content at index ${r.content_index}`);if(s.type!=="output_text")throw new T(`expected content to be 'output_text', got ${s.type}`);s.text+=r.delta}break}case"response.function_call_arguments.delta":{let o=n.output[r.output_index];if(!o)throw new T(`missing output at index ${r.output_index}`);o.type==="function_call"&&(o.arguments+=r.delta);break}case"response.reasoning_text.delta":{let o=n.output[r.output_index];if(!o)throw new T(`missing output at index ${r.output_index}`);if(o.type==="reasoning"){let s=o.content?.[r.content_index];if(!s)throw new T(`missing content at index ${r.content_index}`);if(s.type!=="reasoning_text")throw new T(`expected content to be 'reasoning_text', got ${s.type}`);s.text+=r.delta}break}case"response.completed":{k(this,vt,r.response,"f");break}}return n},Symbol.asyncIterator)](){let e=[],r=[],n=!1;return this.on("event",o=>{let s=r.shift();s?s.resolve(o):e.push(o)}),this.on("end",()=>{n=!0;for(let o of r)o.resolve(void 0);r.length=0}),this.on("abort",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),this.on("error",o=>{n=!0;for(let s of r)s.reject(o);r.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:n?{value:void 0,done:!0}:new Promise((s,i)=>r.push({resolve:s,reject:i})).then(s=>s?{value:s,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}async finalResponse(){await this.done();let e=_(this,Os,"f");if(!e)throw new T("stream ended without producing a ChatCompletion");return e}};function kh(t,e){return vu(t,e)}var Cn=class extends g{list(e,r={},n){return this._client.getAPIList(p`/responses/${e}/input_items`,R,{query:r,...n,__security:{bearerAuth:!0}})}};var kn=class extends g{count(e={},r){return this._client.post("/responses/input_tokens",{body:e,...r,__security:{bearerAuth:!0}})}};var je=class extends g{constructor(){super(...arguments),this.inputItems=new Cn(this._client),this.inputTokens=new kn(this._client)}create(e,r){return this._client.post("/responses",{body:e,...r,stream:e.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(n=>("object"in n&&n.object==="response"&&Eo(n),n))}retrieve(e,r={},n){return this._client.get(p`/responses/${e}`,{query:r,...n,stream:r?.stream??!1,__security:{bearerAuth:!0}})._thenUnwrap(o=>("object"in o&&o.object==="response"&&Eo(o),o))}delete(e,r){return this._client.delete(p`/responses/${e}`,{...r,headers:I([{Accept:"*/*"},r?.headers]),__security:{bearerAuth:!0}})}parse(e,r){return this._client.responses.create(e,r)._thenUnwrap(n=>Oa(n,e))}stream(e,r){return Ps.createResponse(this._client,e,r)}cancel(e,r){return this._client.post(p`/responses/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}compact(e,r){return this._client.post("/responses/compact",{body:e,...r,__security:{bearerAuth:!0}})}};je.InputItems=Cn;je.InputTokens=kn;var On=class extends g{retrieve(e,r){return this._client.get(p`/skills/${e}/content`,{...r,headers:I([{Accept:"application/binary"},r?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var Pn=class extends g{retrieve(e,r,n){let{skill_id:o}=r;return this._client.get(p`/skills/${o}/versions/${e}/content`,{...n,headers:I([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}};var sr=class extends g{constructor(){super(...arguments),this.content=new Pn(this._client)}create(e,r={},n){return this._client.post(p`/skills/${e}/versions`,ut({body:r,...n,__security:{bearerAuth:!0}},this._client))}retrieve(e,r,n){let{skill_id:o}=r;return this._client.get(p`/skills/${o}/versions/${e}`,{...n,__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/skills/${e}/versions`,R,{query:r,...n,__security:{bearerAuth:!0}})}delete(e,r,n){let{skill_id:o}=r;return this._client.delete(p`/skills/${o}/versions/${e}`,{...n,__security:{bearerAuth:!0}})}};sr.Content=Pn;var Qe=class extends g{constructor(){super(...arguments),this.content=new On(this._client),this.versions=new sr(this._client)}create(e={},r){return this._client.post("/skills",ut({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(p`/skills/${e}`,{...r,__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/skills/${e}`,{body:r,...n,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/skills",R,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/skills/${e}`,{...r,__security:{bearerAuth:!0}})}};Qe.Content=On;Qe.Versions=sr;var Mn=class extends g{create(e,r,n){return this._client.post(p`/uploads/${e}/parts`,pe({body:r,...n,__security:{bearerAuth:!0}},this._client))}};var It=class extends g{constructor(){super(...arguments),this.parts=new Mn(this._client)}create(e,r){return this._client.post("/uploads",{body:e,...r,__security:{bearerAuth:!0}})}cancel(e,r){return this._client.post(p`/uploads/${e}/cancel`,{...r,__security:{bearerAuth:!0}})}complete(e,r,n){return this._client.post(p`/uploads/${e}/complete`,{body:r,...n,__security:{bearerAuth:!0}})}};It.Parts=Mn;var Cu=async t=>{let e=await Promise.allSettled(t),r=e.filter(o=>o.status==="rejected");if(r.length){for(let o of r)console.error(o.reason);throw new Error(`${r.length} promise(s) failed - see the above errors`)}let n=[];for(let o of e)o.status==="fulfilled"&&n.push(o.value);return n};var Rn=class extends g{create(e,r,n){return this._client.post(p`/vector_stores/${e}/file_batches`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(p`/vector_stores/${o}/file_batches/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}cancel(e,r,n){let{vector_store_id:o}=r;return this._client.post(p`/vector_stores/${o}/file_batches/${e}/cancel`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,n){let o=await this.create(e,r);return await this.poll(e,o.id,n)}listFiles(e,r,n){let{vector_store_id:o,...s}=r;return this._client.getAPIList(p`/vector_stores/${o}/file_batches/${e}/files`,R,{query:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}async poll(e,r,n){let o=I([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let{data:s,response:i}=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse();switch(s.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=i.headers.get("openai-poll-after-ms");if(c){let l=parseInt(c);isNaN(l)||(a=l)}}await $e(a);break;case"failed":case"cancelled":case"completed":return s}}}async uploadAndPoll(e,{files:r,fileIds:n=[]},o){if(r==null||r.length==0)throw new Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let s=o?.maxConcurrency??5,i=Math.min(s,r.length),a=this._client,c=r.values(),l=[...n];async function u(f){for(let h of f){let b=await a.files.create({file:h,purpose:"assistants"},o);l.push(b.id)}}let m=Array(i).fill(c).map(u);return await Cu(m),await this.createAndPoll(e,{file_ids:l})}};var $n=class extends g{create(e,r,n){return this._client.post(p`/vector_stores/${e}/files`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r,n){let{vector_store_id:o}=r;return this._client.get(p`/vector_stores/${o}/files/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){let{vector_store_id:o,...s}=r;return this._client.post(p`/vector_stores/${o}/files/${e}`,{body:s,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e,r={},n){return this._client.getAPIList(p`/vector_stores/${e}/files`,R,{query:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}delete(e,r,n){let{vector_store_id:o}=r;return this._client.delete(p`/vector_stores/${o}/files/${e}`,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}async createAndPoll(e,r,n){let o=await this.create(e,r,n);return await this.poll(e,o.id,n)}async poll(e,r,n){let o=I([n?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":n?.pollIntervalMs?.toString()??void 0}]);for(;;){let s=await this.retrieve(r,{vector_store_id:e},{...n,headers:o}).withResponse(),i=s.data;switch(i.status){case"in_progress":let a=5e3;if(n?.pollIntervalMs)a=n.pollIntervalMs;else{let c=s.response.headers.get("openai-poll-after-ms");if(c){let l=parseInt(c);isNaN(l)||(a=l)}}await $e(a);break;case"failed":case"completed":return i}}}async upload(e,r,n){let o=await this._client.files.create({file:r,purpose:"assistants"},n);return this.create(e,{file_id:o.id},n)}async uploadAndPoll(e,r,n){let o=await this.upload(e,r,n);return await this.poll(e,o.id,n)}content(e,r,n){let{vector_store_id:o}=r;return this._client.getAPIList(p`/vector_stores/${o}/files/${e}/content`,de,{...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}};var Ye=class extends g{constructor(){super(...arguments),this.files=new $n(this._client),this.fileBatches=new Rn(this._client)}create(e,r){return this._client.post("/vector_stores",{body:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}retrieve(e,r){return this._client.get(p`/vector_stores/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}update(e,r,n){return this._client.post(p`/vector_stores/${e}`,{body:r,...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/vector_stores",R,{query:e,...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/vector_stores/${e}`,{...r,headers:I([{"OpenAI-Beta":"assistants=v2"},r?.headers]),__security:{bearerAuth:!0}})}search(e,r,n){return this._client.getAPIList(p`/vector_stores/${e}/search`,de,{body:r,method:"post",...n,headers:I([{"OpenAI-Beta":"assistants=v2"},n?.headers]),__security:{bearerAuth:!0}})}};Ye.Files=$n;Ye.FileBatches=Rn;var ir=class extends g{create(e,r){return this._client.post("/videos",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}retrieve(e,r){return this._client.get(p`/videos/${e}`,{...r,__security:{bearerAuth:!0}})}list(e={},r){return this._client.getAPIList("/videos",D,{query:e,...r,__security:{bearerAuth:!0}})}delete(e,r){return this._client.delete(p`/videos/${e}`,{...r,__security:{bearerAuth:!0}})}createCharacter(e,r){return this._client.post("/videos/characters",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}downloadContent(e,r={},n){return this._client.get(p`/videos/${e}/content`,{query:r,...n,headers:I([{Accept:"application/binary"},n?.headers]),__security:{bearerAuth:!0},__binaryResponse:!0})}edit(e,r){return this._client.post("/videos/edits",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}extend(e,r){return this._client.post("/videos/extensions",pe({body:e,...r,__security:{bearerAuth:!0}},this._client))}getCharacter(e,r){return this._client.get(p`/videos/characters/${e}`,{...r,__security:{bearerAuth:!0}})}remix(e,r,n){return this._client.post(p`/videos/${e}/remix`,ut({body:r,...n,__security:{bearerAuth:!0}},this._client))}};var Nn,ku,Ms,ar=class extends g{constructor(){super(...arguments),Nn.add(this)}async unwrap(e,r,n=this._client.webhookSecret,o=300){return await this.verifySignature(e,r,n,o),JSON.parse(e)}async verifySignature(e,r,n=this._client.webhookSecret,o=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!="function"||typeof crypto.subtle.verify!="function")throw new Error("Webhook signature verification is only supported when the `crypto` global is defined");_(this,Nn,"m",ku).call(this,n);let s=I([r]).values,i=_(this,Nn,"m",Ms).call(this,s,"webhook-signature"),a=_(this,Nn,"m",Ms).call(this,s,"webhook-timestamp"),c=_(this,Nn,"m",Ms).call(this,s,"webhook-id"),l=parseInt(a,10);if(isNaN(l))throw new Re("Invalid webhook timestamp format");let u=Math.floor(Date.now()/1e3);if(u-l>o)throw new Re("Webhook timestamp is too old");if(l>u+o)throw new Re("Webhook timestamp is too new");let m=i.split(" ").map(A=>A.startsWith("v1,")?A.substring(3):A),f=n.startsWith("whsec_")?Buffer.from(n.replace("whsec_",""),"base64"):Buffer.from(n,"utf-8"),h=c?`${c}.${a}.${e}`:`${a}.${e}`,b=await crypto.subtle.importKey("raw",f,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let A of m)try{let E=Buffer.from(A,"base64");if(await crypto.subtle.verify("HMAC",b,E,new TextEncoder().encode(h)))return}catch{continue}throw new Re("The given webhook signature does not match the expected signature")}};Nn=new WeakSet,ku=function(e){if(typeof e!="string"||e.length===0)throw new Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},Ms=function(e,r){if(!e)throw new Error("Headers are required");let n=e.get(r);if(n==null)throw new Error(`Missing required header: ${r}`);return n};var Pa,Ma,Rs,Pu,Fh="workload-identity-auth",O=class{constructor({baseURL:e=xe("OPENAI_BASE_URL"),apiKey:r=xe("OPENAI_API_KEY")??null,adminAPIKey:n=xe("OPENAI_ADMIN_KEY")??null,organization:o=xe("OPENAI_ORG_ID")??null,project:s=xe("OPENAI_PROJECT_ID")??null,webhookSecret:i=xe("OPENAI_WEBHOOK_SECRET")??null,workloadIdentity:a,...c}={}){Pa.add(this),Rs.set(this,void 0),this.completions=new Gt(this),this.chat=new mt(this),this.embeddings=new Zt(this),this.files=new Yt(this),this.images=new rr(this),this.audio=new De(this),this.moderations=new or(this),this.models=new nr(this),this.fineTuning=new Te(this),this.graders=new xt(this),this.vectorStores=new Ye(this),this.webhooks=new ar(this),this.beta=new Ie(this),this.batches=new Bt(this),this.uploads=new It(this),this.admin=new ht(this),this.responses=new je(this),this.realtime=new Ze(this),this.conversations=new bt(this),this.evals=new At(this),this.containers=new wt(this),this.skills=new Qe(this),this.videos=new ir(this);let l={apiKey:r,adminAPIKey:n,organization:o,project:s,webhookSecret:i,workloadIdentity:a,...c,baseURL:e||"https://api.openai.com/v1"};if(r&&a)throw new T("The `apiKey` and `workloadIdentity` options are mutually exclusive");if(!r&&!n&&!a)throw new T("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");if(!l.dangerouslyAllowBrowser&&Rc())throw new T(`It looks like you're running in a browser-like environment.
52
+
53
+ This is disabled by default, as it risks exposing your secret API credentials to attackers.
54
+ If you understand the risks and have appropriate mitigations in place,
55
+ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
56
+
57
+ new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
58
+
59
+ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
60
+ `);this.baseURL=l.baseURL,this.timeout=l.timeout??Ma.DEFAULT_TIMEOUT,this.logger=l.logger??console;let u="warn";this.logLevel=u,this.logLevel=aa(l.logLevel,"ClientOptions.logLevel",this)??aa(xe("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??u,this.fetchOptions=l.fetchOptions,this.maxRetries=l.maxRetries??2,this.fetch=l.fetch??as(),k(this,Rs,Lc,"f");let m=xe("OPENAI_CUSTOM_HEADERS");if(m){let f={};for(let h of m.split(`
61
+ `)){let b=h.indexOf(":");b>=0&&(f[h.substring(0,b).trim()]=h.substring(b+1).trim())}l.defaultHeaders=I([f,l.defaultHeaders])}this._options=l,a&&(this._workloadIdentityAuth=new fs(a,this.fetch)),this.apiKey=typeof r=="string"?r:null,this.adminAPIKey=n,this.organization=o,this.project=s,this.webhookSecret=i}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this._options.apiKey,adminAPIKey:this.adminAPIKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r},n={bearerAuth:!0,adminAPIKeyAuth:!0}){if(!(e.get("authorization")||e.get("api-key"))&&!(r.has("authorization")||r.has("api-key"))&&!(this._workloadIdentityAuth&&n.bearerAuth))throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted')}async authHeaders(e,r={bearerAuth:!0,adminAPIKeyAuth:!0}){return I([r.bearerAuth?await this.bearerAuth(e):null,r.adminAPIKeyAuth?await this.adminAPIKeyAuth(e):null])}async bearerAuth(e){if(this._workloadIdentityAuth)return I([{Authorization:`Bearer ${await this._workloadIdentityAuth.getToken()}`}]);if(this.apiKey!=null)return I([{Authorization:`Bearer ${this.apiKey}`}])}async adminAPIKeyAuth(e){if(this.adminAPIKey!=null)return I([{Authorization:`Bearer ${this.adminAPIKey}`}])}stringifyQuery(e){return Wc(e)}getUserAgent(){return`${this.constructor.name}/JS ${ct}`}defaultIdempotencyKey(){return`stainless-node-retry-${Gi()}`}makeStatusError(e,r,n,o){return W.generate(e,r,n,o)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof T?n:new T(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new T(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let o=!_(this,Pa,"m",Pu).call(this)&&n||this.baseURL,s=Sc(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),i=this.defaultQuery(),a=Object.fromEntries(s.searchParams);return(!Zi(i)||!Zi(a))&&(r={...a,...i,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(e){(e.__security??{bearerAuth:!0}).bearerAuth&&await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new Lt(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,s=o.maxRetries??this.maxRetries;r==null&&(r=s),await this.prepareOptions(o);let{req:i,url:a,timeout:c}=await this.buildRequest(o,{retryCount:s-r});await this.prepareRequest(i,{url:a,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,m=Date.now();if(Z(this).debug(`[${l}] sending request`,We({retryOfRequestLogID:n,method:o.method,url:a,options:o,headers:i.headers})),o.signal?.aborted)throw new H;let f=o.__security??{bearerAuth:!0},h=new AbortController,b=await this.fetchWithAuth(a,i,c,h,f).catch(so),A=Date.now();if(b instanceof globalThis.Error){let v=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new H;let C=oo(b)||/timed? ?out/i.test(String(b)+("cause"in b?String(b.cause):""));if(r)return Z(this).info(`[${l}] connection ${C?"timed out":"failed"} - ${v}`),Z(this).debug(`[${l}] connection ${C?"timed out":"failed"} (${v})`,We({retryOfRequestLogID:n,url:a,durationMs:A-m,message:b.message})),this.retryRequest(o,r,n??l);throw Z(this).info(`[${l}] connection ${C?"timed out":"failed"} - error; no more retries left`),Z(this).debug(`[${l}] connection ${C?"timed out":"failed"} (error; no more retries left)`,We({retryOfRequestLogID:n,url:a,durationMs:A-m,message:b.message})),b instanceof $t||b instanceof io?b:C?new Me:new lt({message:jh(b),cause:b})}let E=[...b.headers.entries()].filter(([v])=>v==="x-request-id").map(([v,C])=>", "+v+": "+JSON.stringify(C)).join(""),y=`[${l}${u}${E}] ${i.method} ${a} ${b.ok?"succeeded":"failed"} with status ${b.status} in ${A-m}ms`;if(!b.ok){if(b.status===401&&this._workloadIdentityAuth&&f.bearerAuth&&!o.__metadata?.hasStreamingBody&&!o.__metadata?.workloadIdentityTokenRefreshed)return await Xi(b.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...o,__metadata:{...o.__metadata,workloadIdentityTokenRefreshed:!0}},r,n??l);let v=await this.shouldRetry(b);if(r&&v){let U=`retrying, ${r} attempts remaining`;return await Xi(b.body),Z(this).info(`${y} - ${U}`),Z(this).debug(`[${l}] response error (${U})`,We({retryOfRequestLogID:n,url:b.url,status:b.status,headers:b.headers,durationMs:A-m})),this.retryRequest(o,r,n??l,b.headers)}let C=v?"error; no more retries left":"error; not retryable";Z(this).info(`${y} - ${C}`);let L=await b.text().catch(U=>so(U).message),B=kc(L),P=B?void 0:L;throw Z(this).debug(`[${l}] response error (${C})`,We({retryOfRequestLogID:n,url:b.url,status:b.status,headers:b.headers,message:P,durationMs:Date.now()-m})),this.makeStatusError(b.status,B,P,b.headers)}return Z(this).info(y),Z(this).debug(`[${l}] response start`,We({retryOfRequestLogID:n,url:b.url,status:b.status,headers:b.headers,durationMs:A-m})),{response:b,options:o,controller:h,requestLogID:l,retryOfRequestLogID:n,startTime:m}}getAPIList(e,r,n){return this.requestAPIList(r,n&&"then"in n?n.then(o=>({method:"get",path:e,...o})):{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new po(this,n,e)}async fetchWithAuth(e,r,n,o,s={bearerAuth:!0,adminAPIKeyAuth:!0}){if(this._workloadIdentityAuth&&s.bearerAuth){let a=r.headers,c=a.get("Authorization");if(!c||c===`Bearer ${Fh}`){let l=await this._workloadIdentityAuth.getToken();a.set("Authorization",`Bearer ${l}`)}}return await this.fetchWithTimeout(e,r,n,o)}async fetchWithTimeout(e,r,n,o){let{signal:s,method:i,...a}=r||{},c=this._makeAbort(o);s&&s.addEventListener("abort",c,{once:!0});let l=setTimeout(c,n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,m={signal:o.signal,...u?{duplex:"half"}:{},method:"GET",...a};i&&(m.method=i.toUpperCase());try{return await this.fetch.call(void 0,e,m)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let s,i=o?.get("retry-after-ms");if(i){let c=parseFloat(i);Number.isNaN(c)||(s=c)}let a=o?.get("retry-after");if(a&&!s){let c=parseFloat(a);Number.isNaN(c)?s=Date.parse(a)-Date.now():s=c*1e3}if(s===void 0){let c=e.maxRetries??this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(r,c)}return await $e(s),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let s=r-e,i=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return i*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:s,query:i,defaultBaseURL:a}=n,c=this.buildURL(s,i,a);"timeout"in n&&Cc("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:u,isStreamingBody:m}=this.buildBody({options:n});m&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:f,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let s={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let i=I([s,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...$c(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e,e.__security??{bearerAuth:!0}),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(i,e.__security??{bearerAuth:!0}),i.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let n=I([r]),o=typeof globalThis.ReadableStream<"u"&&e instanceof globalThis.ReadableStream,s=!o&&(typeof e=="string"||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof globalThis.Blob<"u"&&e instanceof globalThis.Blob||e instanceof URLSearchParams||e instanceof FormData);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||o?{bodyHeaders:void 0,body:e,isStreamingBody:!s}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:ls(e),isStreamingBody:!0}:typeof e=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e),isStreamingBody:!1}:{..._(this,Rs,"f").call(this,{body:e,headers:n}),isStreamingBody:!1}}};Ma=O,Rs=new WeakMap,Pa=new WeakSet,Pu=function(){return this.baseURL!=="https://api.openai.com/v1"};O.OpenAI=Ma;O.DEFAULT_TIMEOUT=6e5;O.OpenAIError=T;O.APIError=W;O.APIConnectionError=lt;O.APIConnectionTimeoutError=Me;O.APIUserAbortError=H;O.NotFoundError=vr;O.ConflictError=Ir;O.RateLimitError=Sr;O.BadRequestError=br;O.AuthenticationError=Ar;O.InternalServerError=Er;O.PermissionDeniedError=xr;O.UnprocessableEntityError=Tr;O.InvalidWebhookSignatureError=Re;O.toFile=fo;O.Completions=Gt;O.Chat=mt;O.Embeddings=Zt;O.Files=Yt;O.Images=rr;O.Audio=De;O.Moderations=or;O.Models=nr;O.FineTuning=Te;O.Graders=xt;O.VectorStores=Ye;O.Webhooks=ar;O.Beta=Ie;O.Batches=Bt;O.Uploads=It;O.Admin=ht;O.Responses=je;O.Realtime=Ze;O.Conversations=bt;O.Evals=At;O.Containers=wt;O.Skills=Qe;O.Videos=ir;function jh(t){if(zh(t))return"Connection error. This may be caused by passing an undici dispatcher, such as ProxyAgent, that is incompatible with the fetch implementation. If you are using undici's ProxyAgent, pass the fetch implementation from the same undici package: import { fetch, ProxyAgent } from 'undici'; new OpenAI({ fetch, fetchOptions: { dispatcher: new ProxyAgent(...) } });"}function zh(t){let e=t;for(let r=0;r<8&&e&&typeof e=="object";r++){let n=e;if(n.code==="UND_ERR_INVALID_ARG"&&typeof n.message=="string"&&n.message.includes("invalid onRequestStart method"))return!0;e=n.cause}return!1}function Uh(t){return!!(String(t).includes("context_length_exceeded")||"message"in t&&typeof t.message=="string"&&(t.message.includes("Input tokens exceed the configured limit")||t.message.includes("exceeds the context window")||t.message.includes("maximum context length")))}function Se(t){if(!t||typeof t!="object")return t;let e;return t.constructor.name===Me.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="TimeoutError"):t.constructor.name===H.name&&"message"in t&&typeof t.message=="string"?(e=new Error(t.message),e.name="AbortError"):Uh(t)?e=Wl.fromError(t):"status"in t&&t.status===400&&"message"in t&&typeof t.message=="string"&&t.message.includes("tool_calls")?e=no(t,"INVALID_TOOL_RESULTS"):"status"in t&&t.status===401?e=no(t,"MODEL_AUTHENTICATION"):"status"in t&&t.status===429?e=no(t,"MODEL_RATE_LIMIT"):"status"in t&&t.status===404?e=no(t,"MODEL_NOT_FOUND"):e=t,e}var Ee=t=>t();function Xe(t){return t?!!(/^o\d/.test(t??"")||t.startsWith("gpt-5")&&!t.startsWith("gpt-5-chat")):!1}function qh(t){return t.role!=="system"&&t.role!=="developer"&&t.role!=="assistant"&&t.role!=="user"&&t.role!=="function"&&t.role!=="tool"&&console.warn(`Unknown message role: ${t.role}`),t.role}function $a(t){return t.metadata?.filename??t.metadata?.name??t.metadata?.title}var Bh="LC_AUTOGENERATED";function Ln(t){let e=t.metadata?.filename??t.metadata?.name??t.metadata?.title;return e||(console.warn("OpenAI may require a filename for file uploads. Specify a filename in the content block metadata, e.g.: { type: 'file', mimeType: '...', data: '...', metadata: { filename: 'my-file.pdf' } }. Using placeholder filename 'LC_AUTOGENERATED'."),Bh)}function et(t){let e=t._getType();switch(e){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":if(!Ko.isInstance(t))throw new Error("Invalid generic chat message");return qh(t);default:throw new Error(`Unknown message type: ${e}`)}}function Mu(t){return!!(t.includes("gpt-5.2-pro")||t.includes("gpt-5.4-pro")||t.includes("gpt-5.5-pro")||t.includes("codex"))}function tt(t){let{azureOpenAIApiDeploymentName:e,azureOpenAIApiInstanceName:r,azureOpenAIApiKey:n,azureOpenAIBasePath:o,baseURL:s,azureADTokenProvider:i,azureOpenAIEndpoint:a}=t;if((n||i)&&o&&e)return`${o}/${e}`;if((n||i)&&a&&e)return`${a}/openai/deployments/${e}`;if(n||i){if(!r)throw new Error("azureOpenAIApiInstanceName is required when using azureOpenAIApiKey");if(!e)throw new Error("azureOpenAIApiDeploymentName is a required parameter when using azureOpenAIApiKey");return`https://${r}.openai.azure.com/openai/deployments/${e}`}return s}function Na(t){return typeof Headers<"u"&&t!==null&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Headers]"}function Ru(t){let e=Ee(()=>{if(Na(t))return t;if(Array.isArray(t))return new Headers(t);if(typeof t=="object"&&t!==null&&"values"in t&&Na(t.values))return t.values;if(typeof t=="object"&&t!==null){let r=Object.entries(t).filter(([,n])=>typeof n=="string").map(([n,o])=>[n,o]);return new Headers(r)}return new Headers});return Object.fromEntries(e.entries())}function $u(){let t=Kl();return(t==="node"||t==="deno")&&(t=`(${t}/${process.version}; ${process.platform}; ${process.arch})`),t}function rt(t,e=!1,r="1.0.0"){let n=Ru(t),o=$u(),s=`langchainjs${e?"-azure":""}-openai`;return{...n,"User-Agent":n["User-Agent"]?`${s}/${r} (${o})${n["User-Agent"]}`:`${s}/${r} (${o})`}}function Nu(t,e){let r;return yr(t)?r=$i(t):r=t,e?.strict!==void 0&&(r.function.strict=e.strict),r}function Kh(t){return t.anyOf!==void 0&&Array.isArray(t.anyOf)}function Lu(t){let e=["namespace functions {",""];for(let r of t)r.description&&e.push(`// ${r.description}`),Object.keys(r.parameters.properties??{}).length>0?(e.push(`type ${r.name} = (_: {`),e.push(Du(r.parameters,0)),e.push("}) => any;")):e.push(`type ${r.name} = () => any;`),e.push("");return e.push("} // namespace functions"),e.join(`
62
+ `)}function Du(t,e){let r=[];for(let[n,o]of Object.entries(t.properties??{}))o.description&&e<2&&r.push(`// ${o.description}`),t.required?.includes(n)?r.push(`${n}: ${$s(o,e)},`):r.push(`${n}?: ${$s(o,e)},`);return r.map(n=>" ".repeat(e)+n).join(`
63
+ `)}function $s(t,e){if(Kh(t))return t.anyOf.map(r=>$s(r,e)).join(" | ");switch(t.type){case"string":return t.enum?t.enum.map(r=>`"${r}"`).join(" | "):"string";case"number":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"integer":return t.enum?t.enum.map(r=>`${r}`).join(" | "):"number";case"boolean":return"boolean";case"null":return"null";case"object":return["{",Du(t,e+2),"}"].join(`
64
+ `);case"array":return t.items?`${$s(t.items,e)}[]`:"any[]";default:return""}}function Ns(t){if(t)return t==="any"||t==="required"?"required":t==="auto"?"auto":t==="none"?"none":typeof t=="string"?{type:"function",function:{name:t}}:t}function Dn(t){return"type"in t&&t.type!=="function"}function Fu(t){return typeof t=="object"&&t!==null&&"extras"in t&&typeof t.extras=="object"&&t.extras!==null&&"providerToolDefinition"in t.extras&&typeof t.extras.providerToolDefinition=="object"&&t.extras.providerToolDefinition!==null}function ju(t){return t!=null&&typeof t=="object"&&"type"in t&&t.type!=="function"}function lr(t){return typeof t=="object"&&t!==null&&"metadata"in t&&typeof t.metadata=="object"&&t.metadata!==null&&"customTool"in t.metadata&&typeof t.metadata.customTool=="object"&&t.metadata.customTool!==null}function Ls(t){return"type"in t&&t.type==="custom"&&"custom"in t&&typeof t.custom=="object"&&t.custom!==null}function zu(t){if(t.type==="custom_tool_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:t.name,isCustomTool:!0,args:{input:t.input}}}function Uu(t){if(t.type==="computer_call")return{...t,type:"tool_call",call_id:t.id,id:t.call_id,name:"computer_use",isComputerTool:!0,args:{action:t.action}}}function qu(t){return typeof t=="object"&&t!==null&&"type"in t&&t.type==="tool_call"&&"isComputerTool"in t&&t.isComputerTool===!0}function Bu(t,e){return typeof t!="object"||t===null||!("type"in t)||t.type!=="tool_call"?!1:!!("isCustomTool"in t&&t.isCustomTool===!0||e&&"id"in t&&typeof t.id=="string"&&t.id in e)}function Ku(t){let e=()=>{if(t.custom.format){if(t.custom.format.type==="grammar")return{type:"grammar",definition:t.custom.format.grammar.definition,syntax:t.custom.format.grammar.syntax};if(t.custom.format.type==="text")return{type:"text"}}};return{type:"custom",name:t.custom.name,description:t.custom.description,format:e()}}function Wu(t){let e=()=>{if(t.format){if(t.format.type==="grammar")return{type:"grammar",grammar:{definition:t.format.definition,syntax:t.format.syntax}};if(t.format.type==="text")return{type:"text"}}};return{type:"custom",custom:{name:t.name,description:t.description,format:e()}}}var Vu=Symbol("Let zodToJsonSchema decide on which parser to use"),Hu={name:void 0,$refStrategy:"root",effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",nullableStrategy:"from-target",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Gu=t=>typeof t=="string"?{...Hu,basePath:["#"],definitions:{},name:t}:{...Hu,basePath:["#"],definitions:{},...t};var Co=t=>"_def"in t?t._def:t;function Ju(t){if(!t)return!0;for(let e in t)return!1;return!0}var Zu=t=>{let e=Gu(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,currentPath:r,propertyPath:void 0,seenRefs:new Set,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[Co(o),{def:Co(o),path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function La(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function F(t,e,r,n,o){t[e]=r,La(t,e,n,o)}function Qu(){return{}}function Yu(t,e){let r={type:"array"};return t.type?._def?.typeName!==$.ZodAny&&(r.items=M(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&F(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&F(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(F(r,"minItems",t.exactLength.value,t.exactLength.message,e),F(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Xu(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?F(r,"minimum",n.value,n.message,e):F(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),F(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?F(r,"maximum",n.value,n.message,e):F(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),F(r,"maximum",n.value,n.message,e));break;case"multipleOf":F(r,"multipleOf",n.value,n.message,e);break}return r}function ed(){return{type:"boolean"}}function td(t,e){return M(t.type._def,e)}var rd=(t,e)=>M(t.innerType._def,e);function Da(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Da(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Wh(t,e)}}var Wh=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":F(r,"minimum",n.value,n.message,e);break;case"max":F(r,"maximum",n.value,n.message,e);break}return r};function nd(t,e){return{...M(t.innerType._def,e),default:t.defaultValue()}}function od(t,e,r){return e.effectStrategy==="input"?M(t.schema._def,e,r):{}}function sd(t){return{type:"string",enum:[...t.values]}}var Hh=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function id(t,e){let r=[M(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),M(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(Hh(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function ad(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Fa,cr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Fa===void 0&&(Fa=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Fa),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/};function Ds(t,e){let r={type:"string"};function n(o){return e.patternStrategy==="escape"?Vh(o):o}if(t.checks)for(let o of t.checks)switch(o.kind){case"min":F(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e);break;case"max":F(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Ce(r,"email",o.message,e);break;case"format:idn-email":Ce(r,"idn-email",o.message,e);break;case"pattern:zod":ke(r,cr.email,o.message,e);break}break;case"url":Ce(r,"uri",o.message,e);break;case"uuid":Ce(r,"uuid",o.message,e);break;case"regex":ke(r,o.regex,o.message,e);break;case"cuid":ke(r,cr.cuid,o.message,e);break;case"cuid2":ke(r,cr.cuid2,o.message,e);break;case"startsWith":ke(r,RegExp(`^${n(o.value)}`),o.message,e);break;case"endsWith":ke(r,RegExp(`${n(o.value)}$`),o.message,e);break;case"datetime":Ce(r,"date-time",o.message,e);break;case"date":Ce(r,"date",o.message,e);break;case"time":Ce(r,"time",o.message,e);break;case"duration":Ce(r,"duration",o.message,e);break;case"length":F(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,o.message,e),F(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value,o.message,e);break;case"includes":{ke(r,RegExp(n(o.value)),o.message,e);break}case"ip":{o.version!=="v6"&&Ce(r,"ipv4",o.message,e),o.version!=="v4"&&Ce(r,"ipv6",o.message,e);break}case"emoji":ke(r,cr.emoji,o.message,e);break;case"ulid":{ke(r,cr.ulid,o.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Ce(r,"binary",o.message,e);break}case"contentEncoding:base64":{F(r,"contentEncoding","base64",o.message,e);break}case"pattern:zod":{ke(r,cr.base64,o.message,e);break}}break}case"nanoid":ke(r,cr.nanoid,o.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}var Vh=t=>Array.from(t).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),Ce=(t,e,r,n)=>{t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):F(t,"format",e,r,n)},ke=(t,e,r,n)=>{t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:ld(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):F(t,"pattern",ld(e,n),r,n)},ld=(t,e)=>{let r=typeof t=="function"?t():t;if(!e.applyRegexFlags||!r.flags)return r.source;let n={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},o=n.i?r.source.toLowerCase():r.source,s="",i=!1,a=!1,c=!1;for(let l=0;l<o.length;l++){if(i){s+=o[l],i=!1;continue}if(n.i){if(a){if(o[l].match(/[a-z]/)){c?(s+=o[l],s+=`${o[l-2]}-${o[l]}`.toUpperCase(),c=!1):o[l+1]==="-"&&o[l+2]?.match(/[a-z]/)?(s+=o[l],c=!0):s+=`${o[l]}${o[l].toUpperCase()}`;continue}}else if(o[l].match(/[a-z]/)){s+=`[${o[l]}${o[l].toUpperCase()}]`;continue}}if(n.m){if(o[l]==="^"){s+=`(^|(?<=[\r
65
+ ]))`;continue}else if(o[l]==="$"){s+=`($|(?=[\r
66
+ ]))`;continue}}if(n.s&&o[l]==="."){s+=a?`${o[l]}\r
67
+ `:`[${o[l]}\r
68
+ ]`;continue}s+=o[l],o[l]==="\\"?i=!0:a&&o[l]==="]"?a=!1:!a&&o[l]==="["&&(a=!0)}try{let l=new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return s};function Fs(t,e){if(e.target==="openApi3"&&t.keyType?._def.typeName===$.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??{}}),{}),additionalProperties:!1};let r={type:"object",additionalProperties:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===$.ZodString&&t.keyType._def.checks?.length){let n=Object.entries(Ds(t.keyType._def,e)).reduce((o,[s,i])=>s==="type"?o:{...o,[s]:i},{});return{...r,propertyNames:n}}else if(t.keyType?._def.typeName===$.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};return r}function cd(t,e){if(e.mapStrategy==="record")return Fs(t,e);let r=M(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function ud(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function dd(){return{not:{}}}function pd(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ko={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fd(t,e){if(e.target==="openApi3")return md(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in ko&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=ko[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return md(t,e)}var md=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>M(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function hd(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"||e.nullableStrategy==="property"?{type:ko[t.innerType._def.typeName],nullable:!0}:{type:[ko[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=M(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function gd(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",La(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?F(r,"minimum",n.value,n.message,e):F(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),F(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?F(r,"maximum",n.value,n.message,e):F(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),F(r,"maximum",n.value,n.message,e));break;case"multipleOf":F(r,"multipleOf",n.value,n.message,e);break}return r}function Gh(t,e){return e.removeAdditionalStrategy==="strict"?t.catchall._def.typeName==="ZodNever"?t.unknownKeys!=="strict":M(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:t.catchall._def.typeName==="ZodNever"?t.unknownKeys==="passthrough":M(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function yd(t,e){let r={type:"object",...Object.entries(t.shape()).reduce((n,[o,s])=>{if(s===void 0||s._def===void 0)return n;let i=[...e.currentPath,"properties",o],a=M(s._def,{...e,currentPath:i,propertyPath:i});if(a===void 0)return n;if(e.openaiStrictMode&&s.isOptional()&&!s.isNullable()&&typeof s._def?.defaultValue>"u")throw new Error(`Zod field at \`${i.join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);return{properties:{...n.properties,[o]:a},required:s.isOptional()&&!e.openaiStrictMode?n.required:[...n.required,o]}},{properties:{},required:[]}),additionalProperties:Gh(t,e)};return r.required.length||delete r.required,r}var _d=(t,e)=>{if(e.propertyPath&&e.currentPath.slice(0,e.propertyPath.length).toString()===e.propertyPath.toString())return M(t.innerType._def,{...e,currentPath:e.currentPath});let r=M(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:{}},r]}:{}};var wd=(t,e)=>{if(e.pipeStrategy==="input")return M(t.in._def,e);if(e.pipeStrategy==="output")return M(t.out._def,e);let r=M(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=M(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function bd(t,e){return M(t.type._def,e)}function Ad(t,e){let n={type:"array",uniqueItems:!0,items:M(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&F(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&F(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function xd(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>M(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:M(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>M(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function vd(){return{not:{}}}function Id(){return{}}var Td=(t,e)=>M(t.innerType._def,e);function M(t,e,r=!1){let n=e.seen.get(t);if(e.override){let i=e.override?.(t,e,n,r);if(i!==Vu)return i}if(n&&!r){let i=Jh(n,e);if(i!==void 0)return"$ref"in i&&e.seenRefs.add(i.$ref),i}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=Qh(t,t.typeName,e,r);return s&&Yh(t,e,s),o.jsonSchema=s,s}var Jh=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"extract-to-root":let r=t.path.slice(e.basePath.length+1).join("_");return r!==e.name&&e.nameStrategy==="duplicate-ref"&&(e.definitions[r]=t.def),{$ref:[...e.basePath,e.definitionPath,r].join("/")};case"relative":return{$ref:Zh(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((n,o)=>e.currentPath[o]===n)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},Zh=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")},Qh=(t,e,r,n)=>{switch(e){case $.ZodString:return Ds(t,r);case $.ZodNumber:return gd(t,r);case $.ZodObject:return yd(t,r);case $.ZodBigInt:return Xu(t,r);case $.ZodBoolean:return ed();case $.ZodDate:return Da(t,r);case $.ZodUndefined:return vd();case $.ZodNull:return pd(r);case $.ZodArray:return Yu(t,r);case $.ZodUnion:case $.ZodDiscriminatedUnion:return fd(t,r);case $.ZodIntersection:return id(t,r);case $.ZodTuple:return xd(t,r);case $.ZodRecord:return Fs(t,r);case $.ZodLiteral:return ad(t,r);case $.ZodEnum:return sd(t);case $.ZodNativeEnum:return ud(t);case $.ZodNullable:return hd(t,r);case $.ZodOptional:return _d(t,r);case $.ZodMap:return cd(t,r);case $.ZodSet:return Ad(t,r);case $.ZodLazy:return M(t.getter()._def,r);case $.ZodPromise:return bd(t,r);case $.ZodNaN:case $.ZodNever:return dd();case $.ZodEffects:return od(t,r,n);case $.ZodAny:return Qu();case $.ZodUnknown:return Id();case $.ZodDefault:return nd(t,r);case $.ZodBranded:return td(t,r);case $.ZodReadonly:return Td(t,r);case $.ZodCatch:return rd(t,r);case $.ZodPipeline:return wd(t,r);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(o=>{})(e)}},Yh=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var ja=(t,e)=>{let r=Zu(e),n=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=M(t._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??{},s=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;s!==void 0&&(o.title=s);let i=(()=>{if(Ju(r.definitions))return;let c={},l=new Set;for(let u=0;u<500;u++){let m=Object.entries(r.definitions).filter(([f])=>!l.has(f));if(m.length===0)break;for(let[f,h]of m)c[f]=M(Co(h),{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0)??{},l.add(f)}return c})(),a=n===void 0?i?{...o,[r.definitionPath]:i}:o:r.nameStrategy==="duplicate-ref"?{...o,...i||r.seenRefs.size?{[r.definitionPath]:{...i,...r.seenRefs.size?{[n]:o}:void 0}}:void 0}:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...i,[n]:o}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":r.target==="jsonSchema2019-09"&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),a};function Sd(t){if(t.type!=="object")throw new Error(`Root schema must have type: 'object' but got type: ${t.type?`'${t.type}'`:"undefined"}`);let e=structuredClone(t);return nt(e,[],e)}function za(t){if(typeof t=="boolean")return!1;if(t.type==="null")return!0;for(let e of t.oneOf??[])if(za(e))return!0;for(let e of t.anyOf??[])if(za(e))return!0;return!1}function nt(t,e,r){if(typeof t=="boolean")throw new TypeError(`Expected object schema but got boolean; path=${e.join("/")}`);if(!ur(t))throw new TypeError(`Expected ${JSON.stringify(t)} to be an object; path=${e.join("/")}`);let n=t.$defs;if(ur(n))for(let[f,h]of Object.entries(n))nt(h,[...e,"$defs",f],r);let o=t.definitions;if(ur(o))for(let[f,h]of Object.entries(o))nt(h,[...e,"definitions",f],r);t.type==="object"&&!("additionalProperties"in t)&&(t.additionalProperties=!1);let i=t.required??[],a=t.properties;if(ur(a)){for(let[f,h]of Object.entries(a))if(!za(h)&&!i.includes(f))throw new Error(`Zod field at \`${[...e,"properties",f].join("/")}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`);t.required=Object.keys(a),t.properties=Object.fromEntries(Object.entries(a).map(([f,h])=>[f,nt(h,[...e,"properties",f],r)]))}let c=t.items;ur(c)&&(t.items=nt(c,[...e,"items"],r));let l=t.anyOf;Array.isArray(l)&&(t.anyOf=l.map((f,h)=>nt(f,[...e,"anyOf",String(h)],r)));let u=t.allOf;if(Array.isArray(u))if(u.length===1){let f=nt(u[0],[...e,"allOf","0"],r);Object.assign(t,f),delete t.allOf}else t.allOf=u.map((f,h)=>nt(f,[...e,"allOf",String(h)],r));t.default===null&&delete t.default;let m=t.$ref;if(m&&eg(t,1)){if(typeof m!="string")throw new TypeError(`Received non-string $ref - ${m}; path=${e.join("/")}`);let f=Xh(r,m);if(typeof f=="boolean")throw new Error(`Expected \`$ref: ${m}\` to resolve to an object schema but got boolean`);if(!ur(f))throw new Error(`Expected \`$ref: ${m}\` to resolve to an object but got ${JSON.stringify(f)}`);return Object.assign(t,{...f,...t}),delete t.$ref,nt(t,e,r)}return t}function Xh(t,e){if(!e.startsWith("#/"))throw new Error(`Unexpected $ref format ${JSON.stringify(e)}; Does not start with #/`);let r=e.slice(2).split("/"),n=t;for(let o of r){if(!ur(n))throw new Error(`encountered non-object entry while resolving ${e} - ${JSON.stringify(n)}`);let s=n[o];if(s===void 0)throw new Error(`Key ${o} not found while resolving ${e}`);n=s}return n}function ur(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function eg(t,e){let r=0;for(let n in t)if(r++,r>e)return!0;return!1}function tg(t,e){return ja(t,{openaiStrictMode:!0,name:e.name,nameStrategy:"duplicate-ref",$refStrategy:"extract-to-root",nullableStrategy:"property"})}function rg(t){return Sd(Yl(t,{target:"draft-7"}))}function ng(t){return"_zod"in t}function Ed(t,e,r){return ou({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:ng(t)?rg(t):tg(t,{name:e})}},n=>t.parse(JSON.parse(n)))}var Cd=["jsonSchema","functionCalling","jsonMode"];function kd(t,e){if(typeof e<"u"&&!Cd.includes(e))throw new Error(`Invalid method: ${e}. Supported methods are: ${Cd.join(", ")}`);let r=!t.startsWith("gpt-3")&&!t.startsWith("gpt-4-")&&t!=="gpt-4";if(r&&!e)return"jsonSchema";if(!r&&e==="jsonSchema")throw new Error(`JSON Schema is not supported for model "${t}". Please use a different method, e.g. "functionCalling" or "jsonMode".`);return e??"functionCalling"}function og(t,e){let r={...t};return Object.defineProperties(r,{$brand:{value:"auto-parseable-response-format",enumerable:!1},$parseRaw:{value:e,enumerable:!1}}),r}function Od(t,e,r){if(Xl(t))return Ed(t,e,r);if(Vo(t))return og({type:"json_schema",json_schema:{...r,name:e,strict:!0,schema:Mt(t,{cycles:"ref",reused:"ref",override(n){n.jsonSchema.title=e}})}},n=>Zl(t,JSON.parse(n)));throw new Error("Unsupported schema response format")}function Pd(t,e){if(e&&typeof e=="object"&&"images"in e&&Array.isArray(e.images)){let r=e.images.filter(n=>typeof n?.image_url?.url=="string").map(n=>({type:"image",url:n.image_url.url}));return[{type:"text",text:t},...r]}return t}var Md={"gpt-4o-2024-11-20":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.3-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-pro":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:272e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-mini":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-ada-002":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-chat-latest":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"codex-mini-latest":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.1-codex-max":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-05-13":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.2-chat-latest":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.2-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o1:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.1":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini-deep-research":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.3-codex-spark":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},o3:{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-3-small":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1536,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1-nano":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"text-embedding-3-large":{maxInputTokens:8191,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:3072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-3.5-turbo":{maxInputTokens:16385,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1,imageUrlInputs:!1,pdfToolMessage:!1,imageToolMessage:!1,toolChoice:!0},"gpt-5.1-codex-mini":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.2":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4-turbo":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:4096,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o4-mini":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4.1-mini":{maxInputTokens:1047576,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.4":{maxInputTokens:105e4,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-preview":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.4-pro":{maxInputTokens:105e4,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.5":{maxInputTokens:105e4,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:13e4,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.5-pro":{maxInputTokens:105e4,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-pro":{maxInputTokens:2e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.1-codex":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.2-pro":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o3-mini":{maxInputTokens:2e5,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:1e5,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o-2024-08-06":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-mini":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5.1-chat-latest":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-5-nano":{maxInputTokens:4e5,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:128e3,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"o1-mini":{maxInputTokens:128e3,imageInputs:!1,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0},"gpt-4o":{maxInputTokens:128e3,imageInputs:!0,audioInputs:!1,pdfInputs:!0,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0,imageUrlInputs:!0,pdfToolMessage:!0,imageToolMessage:!0,toolChoice:!0}};function Fn(t,e){return typeof t=="string"?{model:t,...e??{}}:t??e}var dr=class extends Qo{temperature;topP;frequencyPenalty;presencePenalty;n;logitBias;model="gpt-3.5-turbo";modelKwargs;stop;stopSequences;user;timeout;streaming=!1;streamUsage=!0;maxTokens;logprobs;topLogprobs;apiKey;organization;__includeRawResponse;client;clientConfig;supportsStrictToolCalling;audio;modalities;reasoning;zdrEnabled;service_tier;promptCacheKey;promptCacheRetention;verbosity;defaultOptions;_llmType(){return"openai"}static lc_name(){return"ChatOpenAI"}get callKeys(){return[...super.callKeys,"options","function_call","functions","tools","tool_choice","promptIndex","response_format","seed","reasoning","reasoning_effort","service_tier"]}lc_serializable=!0;get lc_secrets(){return{apiKey:"OPENAI_API_KEY",organization:"OPENAI_ORGANIZATION"}}get lc_aliases(){return{apiKey:"openai_api_key",modelName:"model"}}get lc_serializable_keys(){return["configuration","logprobs","topLogprobs","prefixMessages","supportsStrictToolCalling","modalities","audio","temperature","maxTokens","topP","frequencyPenalty","presencePenalty","n","logitBias","user","streaming","streamUsage","model","modelName","modelKwargs","stop","stopSequences","timeout","apiKey","cache","maxConcurrency","maxRetries","verbose","callbacks","tags","metadata","disableStreaming","zdrEnabled","reasoning","promptCacheKey","promptCacheRetention","verbosity"]}getLsParams(t){let e=this.invocationParams(t);return{ls_provider:"openai",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:e.temperature??void 0,ls_max_tokens:e.max_tokens??void 0,ls_stop:t.stop}}_identifyingParams(){return{model_name:this.model,...this.invocationParams(),...this.clientConfig}}identifyingParams(){return this._identifyingParams()}constructor(t){super(t??{});let e=typeof t?.configuration?.apiKey=="string"||typeof t?.configuration?.apiKey=="function"?t?.configuration?.apiKey:void 0;this.apiKey=t?.apiKey??e??Ae("OPENAI_API_KEY"),this.organization=t?.configuration?.organization??Ae("OPENAI_ORGANIZATION"),this.model=t?.model??t?.modelName??this.model,this.modelKwargs=t?.modelKwargs??{},this.timeout=t?.timeout,this.temperature=t?.temperature??this.temperature,this.topP=t?.topP??this.topP,this.frequencyPenalty=t?.frequencyPenalty??this.frequencyPenalty,this.presencePenalty=t?.presencePenalty??this.presencePenalty,this.logprobs=t?.logprobs,this.topLogprobs=t?.topLogprobs,this.n=t?.n??this.n,this.logitBias=t?.logitBias,this.stop=t?.stopSequences??t?.stop,this.stopSequences=this.stop,this.user=t?.user,this.__includeRawResponse=t?.__includeRawResponse,this.audio=t?.audio,this.modalities=t?.modalities,this.reasoning=t?.reasoning,this.maxTokens=t?.maxCompletionTokens??t?.maxTokens,this.promptCacheKey=t?.promptCacheKey??this.promptCacheKey,this.promptCacheRetention=t?.promptCacheRetention??this.promptCacheRetention,this.verbosity=t?.verbosity??this.verbosity,this.disableStreaming=t?.disableStreaming===!0,this.streaming=t?.streaming===!0,this.disableStreaming&&(this.streaming=!1),t?.streaming===!1&&(this.disableStreaming=!0),this.streamUsage=t?.streamUsage??this.streamUsage,this.disableStreaming&&(this.streamUsage=!1),this.clientConfig={apiKey:this.apiKey,organization:this.organization,dangerouslyAllowBrowser:!0,...t?.configuration},t?.supportsStrictToolCalling!==void 0&&(this.supportsStrictToolCalling=t.supportsStrictToolCalling),t?.service_tier!==void 0&&(this.service_tier=t.service_tier),this.zdrEnabled=t?.zdrEnabled??!1,this._addVersion("@langchain/openai","1.4.7")}_getReasoningParams(t){if(!Xe(this.model))return;let e;return this.reasoning!==void 0&&(e={...e,...this.reasoning}),t?.reasoning!==void 0&&(e={...e,...t.reasoning}),t?.reasoningEffort!==void 0&&e?.effort===void 0&&(e={...e,effort:t.reasoningEffort}),e}_getResponseFormat(t){return t&&t.type==="json_schema"&&t.json_schema.schema&&Pt(t.json_schema.schema)?Od(t.json_schema.schema,t.json_schema.name,{description:t.json_schema.description}):t}_combineCallOptions(t){return{...this.defaultOptions,...t??{}}}_getClientOptions(t){if(!this.client){let e=tt({baseURL:this.clientConfig.baseURL}),r={...this.clientConfig,baseURL:e,timeout:this.timeout,maxRetries:0};r.baseURL||delete r.baseURL,r.defaultHeaders=rt(r.defaultHeaders),this.client=new O(r)}return{...this.clientConfig,...t}}_convertChatOpenAIToolToCompletionsTool(t,e){return lr(t)?Wu(t.metadata.customTool):Jo(t)?e?.strict!==void 0?{...t,function:{...t.function,strict:e.strict}}:t:Nu(t,e)}bindTools(t,e){let r;return e?.strict!==void 0?r=e.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling),this.withConfig({tools:t.map(n=>{if(Dn(n)||lr(n))return n;if(Fu(n))return n.extras.providerToolDefinition;let o=this._convertChatOpenAIToolToCompletionsTool(n,{strict:r});return yr(n)&&n.extras?.defer_loading===!0?{...o,defer_loading:!0}:o}),...e})}async stream(t,e){return super.stream(t,this._combineCallOptions(e))}async invoke(t,e){return super.invoke(t,this._combineCallOptions(e))}_combineLLMOutput(...t){return t.reduce((e,r)=>(r&&r.tokenUsage&&(e.tokenUsage.completionTokens+=r.tokenUsage.completionTokens??0,e.tokenUsage.promptTokens+=r.tokenUsage.promptTokens??0,e.tokenUsage.totalTokens+=r.tokenUsage.totalTokens??0),e),{tokenUsage:{completionTokens:0,promptTokens:0,totalTokens:0}})}async getNumTokensFromMessages(t){let e=0,r=0,n=0;this.model==="gpt-3.5-turbo-0301"?(r=4,n=-1):(r=3,n=1);let o=await Promise.all(t.map(async s=>{let[i,a]=await Promise.all([this.getNumTokens(s.content),this.getNumTokens(et(s))]),c=s.name!==void 0?n+await this.getNumTokens(s.name):0,l=i+r+a+c,u=s;if(u._getType()==="function"&&(l-=2),u.additional_kwargs?.function_call&&(l+=3),u?.additional_kwargs.function_call?.name&&(l+=await this.getNumTokens(u.additional_kwargs.function_call?.name)),u.additional_kwargs.function_call?.arguments)try{l+=await this.getNumTokens(JSON.stringify(JSON.parse(u.additional_kwargs.function_call?.arguments)))}catch(m){console.error("Error parsing function arguments",m,JSON.stringify(u.additional_kwargs.function_call)),l+=await this.getNumTokens(u.additional_kwargs.function_call?.arguments)}return e+=l,l}));return e+=3,{totalCount:e,countPerMessage:o}}async _getNumTokensFromGenerations(t){return(await Promise.all(t.map(async e=>e.message.additional_kwargs?.function_call?(await this.getNumTokensFromMessages([e.message])).countPerMessage[0]:await this.getNumTokens(e.message.content)))).reduce((e,r)=>e+r,0)}async _getEstimatedTokenCountFromPrompt(t,e,r){let n=(await this.getNumTokensFromMessages(t)).totalCount;if(e&&r!=="auto"){let o=Lu(e);n+=await this.getNumTokens(o),n+=9}return e&&t.find(o=>o._getType()==="system")&&(n-=4),r==="none"?n+=1:typeof r=="object"&&(n+=await this.getNumTokens(r.name)+4),n}async moderateContent(t,e){let r=this._getClientOptions(e?.options),n={input:t,model:e?.model??"omni-moderation-latest"};return this.caller.call(async()=>{try{return await this.client.moderations.create(n,r)}catch(o){throw Se(o)}})}get profile(){return Md[this.model]??{}}_getStructuredOutputMethod(t){let e={...t};if(!this.model.startsWith("gpt-3")&&!this.model.startsWith("gpt-4-")&&this.model!=="gpt-4"){if(e?.method===void 0)return"jsonSchema"}else e.method==="jsonSchema"&&console.warn(`[WARNING]: JSON Schema is not supported for model "${this.model}". Falling back to tool calling.`);return e.method}withStructuredOutput(t,e){let r,n,{schema:o,name:s,includeRaw:i}={...e,schema:t};if(e?.strict!==void 0&&e.method==="jsonMode")throw new Error("Argument `strict` is only supported for `method` = 'function_calling'");let a=kd(this.model,e?.method);if(a==="jsonMode"){n=Mi(o);let c=Mt(o);r=this.withConfig({outputVersion:"v0",response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"json_mode"},schema:{title:s??"extract",...c}}})}else if(a==="jsonSchema"){let c=Mt(o),l={name:s??"extract",description:Oi(c),schema:Pt(o)?o:c,strict:e?.strict};if(r=this.withConfig({outputVersion:"v0",response_format:{type:"json_schema",json_schema:l},ls_structured_output_format:{kwargs:{method:"json_schema"},schema:{title:l.name,description:l.description,...c}}}),Pt(o)||Ho(o)){let u=Mi(o);n=at.from(async m=>"parsed"in m.additional_kwargs?m.additional_kwargs.parsed:u.invoke(m.content))}else n=new rc}else{let c=s??"extract",l=Mt(o),u;Pt(o)||Ho(o)?u={name:c,description:l.description,parameters:l}:typeof o.name=="string"&&typeof o.parameters=="object"&&o.parameters!=null?(u=o,c=o.name):(c=o.title??c,u={name:c,description:o.description??"",parameters:o}),r=this.withConfig({outputVersion:"v0",tools:[{type:"function",function:u}],tool_choice:{type:"function",function:{name:c}},ls_structured_output_format:{kwargs:{method:"function_calling"},schema:{title:c,...l}},...e?.strict!==void 0?{strict:e.strict}:{}}),n=nc(o,c)}return oc(r,n,i)}};var js={providerName:"ChatOpenAI",fromStandardTextBlock(t){return{type:"text",text:t.text}},fromStandardImageBlock(t){if(t.source_type==="url")return{type:"image_url",image_url:{url:t.url,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};if(t.source_type==="base64")return{type:"image_url",image_url:{url:`data:${t.mime_type??""};base64,${t.data}`,...t.metadata?.detail?{detail:t.metadata.detail}:{}}};throw new Error(`Image content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardAudioBlock(t){if(t.source_type==="url"){let e=Ei({dataUrl:t.url});if(!e)throw new Error(`URL audio blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);let r=e.mime_type||t.mime_type||"",n;try{n=Si(r)}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(n.type!=="audio"||n.subtype!=="wav"&&n.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:n.subtype,data:e.data}}}if(t.source_type==="base64"){let e;try{e=Si(t.mime_type??"")}catch{throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`)}if(e.type!=="audio"||e.subtype!=="wav"&&e.subtype!=="mp3")throw new Error(`Audio blocks with source_type ${t.source_type} must have mime type of audio/wav or audio/mp3`);return{type:"input_audio",input_audio:{format:e.subtype,data:t.data}}}throw new Error(`Audio content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)},fromStandardFileBlock(t){if(t.source_type==="url"){let e=Ei({dataUrl:t.url}),r=Ln(t);if(!e)throw new Error(`URL file blocks with source_type ${t.source_type} must be formatted as a data URL for ChatOpenAI`);return{type:"file",file:{file_data:t.url,filename:r}}}if(t.source_type==="base64"){let e=Ln(t);return{type:"file",file:{file_data:`data:${t.mime_type??""};base64,${t.data}`,filename:e}}}if(t.source_type==="id")return{type:"file",file:{file_id:t.id}};throw new Error(`File content blocks with source_type ${t.source_type} are not supported for ChatOpenAI`)}},Ua=({message:t,rawResponse:e,includeRawResponse:r})=>{let n=t.tool_calls,o=t.reasoning_content;switch(t.role){case"assistant":{let s=[],i=[];for(let l of n??[])try{s.push(Zo(l,{returnId:!0}))}catch(u){i.push(gr(l,u.message))}let a={function_call:t.function_call,tool_calls:n};r!==void 0&&(a.__raw_response=e),o!==void 0&&(a.reasoning_content=o);let c={model_provider:"openai",model_name:e.model,...e.system_fingerprint?{usage:{...e.usage},system_fingerprint:e.system_fingerprint}:{}};return t.audio&&(a.audio=t.audio),new j({content:Pd(t.content||"",e.choices?.[0]?.message),tool_calls:s,invalid_tool_calls:i,additional_kwargs:a,response_metadata:c,id:e.id})}default:return new Ko(t.content||"",t.role??"unknown")}},qa=({delta:t,rawResponse:e,includeRawResponse:r,defaultRole:n})=>{let o=t.role??n,s=t.content??"",i;t.function_call?i={function_call:t.function_call}:t.tool_calls?i={tool_calls:t.tool_calls}:i={},r&&(i.__raw_response=e),t.reasoning_content!==void 0&&(i.reasoning_content=t.reasoning_content),t.audio&&(i.audio={...t.audio,index:e.choices[0].index});let a={model_provider:"openai",usage:{...e.usage}};if(o==="user")return new ki({content:s,response_metadata:a});if(o==="assistant"){let c=[];if(Array.isArray(t.tool_calls))for(let l of t.tool_calls)c.push({name:l.function?.name,args:l.function?.arguments,id:l.id,index:l.index,type:"tool_call_chunk"});return new it({content:s,tool_call_chunks:c,additional_kwargs:i,id:e.id,response_metadata:a})}else return o==="system"?new Wo({content:s,response_metadata:a}):o==="developer"?new Wo({content:s,response_metadata:a,additional_kwargs:{__openai_role__:"developer"}}):o==="function"?new Vl({content:s,additional_kwargs:i,name:t.name,response_metadata:a}):o==="tool"?new Ci({content:s,additional_kwargs:i,tool_call_id:t.tool_call_id,response_metadata:a}):new Hl({content:s,role:o,response_metadata:a})},Rd=t=>{if(t.type==="image"){if(t.url)return{type:"image_url",image_url:{url:t.url}};if(t.data)return{type:"image_url",image_url:{url:`data:${t.mimeType};base64,${t.data}`}}}if(t.type==="audio"&&t.data){let e=Gl(()=>{let[,r]=t.mimeType.split("/");return r==="wav"||r==="mp3"?r:"wav"});return{type:"input_audio",input_audio:{data:t.data.toString(),format:e}}}if(t.type==="file"){if(t.data){let e=Ln(t);return{type:"file",file:{file_data:`data:${t.mimeType};base64,${t.data}`,filename:e}}}if(t.fileId)return{type:"file",file:{file_id:t.fileId}}}},$d=({message:t,model:e})=>{let r=et(t);if(r==="system"&&Xe(e)&&(r="developer"),r==="developer")return{role:"developer",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="system")return{role:"system",content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="assistant"){let o={role:"assistant",content:t.contentBlocks.filter(s=>s.type==="text")};return j.isInstance(t)&&t.tool_calls?.length?o.tool_calls=t.tool_calls.map(Pi):t.additional_kwargs.tool_calls!=null&&(o.tool_calls=t.additional_kwargs.tool_calls),o}else{if(r==="tool"&&q.isInstance(t))return{role:"tool",tool_call_id:t.tool_call_id,content:t.contentBlocks.filter(o=>o.type==="text")};if(r==="function")return{role:"function",name:t.name??"",content:t.contentBlocks.filter(o=>o.type==="text").join("")}}function*n(o){for(let s of o){s.type==="text"&&(yield{type:"text",text:s.text});let i=Rd(s);i&&(yield i)}}return{role:"user",content:Array.from(n(t.contentBlocks))}},Oo=({messages:t,model:e})=>t.flatMap(r=>{if("output_version"in r.response_metadata&&r.response_metadata?.output_version==="v1")return $d({message:r});let n=et(r);n==="system"&&Xe(e)&&(n="developer");let o=typeof r.content=="string"?r.content:r.content.flatMap(i=>qo(i)?Bo(i,js):typeof i=="object"&&i!==null&&"type"in i&&i.type==="tool_use"?[]:i),s={role:n,content:o};return r.name!=null&&(s.name=r.name),r.additional_kwargs.function_call!=null&&(s.function_call=r.additional_kwargs.function_call),j.isInstance(r)&&r.tool_calls?.length?s.tool_calls=r.tool_calls.map(Pi):(r.additional_kwargs.tool_calls!=null&&(s.tool_calls=r.additional_kwargs.tool_calls),q.isInstance(r)&&r.tool_call_id!=null&&(s.tool_call_id=r.tool_call_id)),r.additional_kwargs.audio&&typeof r.additional_kwargs.audio=="object"&&"id"in r.additional_kwargs.audio?[s,{role:"assistant",audio:{id:r.additional_kwargs.audio.id}}]:s});var zs=class extends dr{constructor(t,e){super(Fn(t,e))}invocationParams(t,e){let r;t?.strict!==void 0?r=t.strict:this.supportsStrictToolCalling!==void 0&&(r=this.supportsStrictToolCalling);let n={};t?.stream_options!==void 0?n={stream_options:t.stream_options}:this.streamUsage&&(this.streaming||e?.streaming)&&(n={stream_options:{include_usage:!0}});let o={model:this.model,temperature:this.temperature,top_p:this.topP,frequency_penalty:this.frequencyPenalty,presence_penalty:this.presencePenalty,logprobs:this.logprobs,top_logprobs:this.topLogprobs,n:this.n,logit_bias:this.logitBias,stop:t?.stop??this.stopSequences,user:this.user,stream:this.streaming,functions:t?.functions,function_call:t?.function_call,tools:t?.tools?.length?t.tools.map(i=>this._convertChatOpenAIToolToCompletionsTool(i,{strict:r})):void 0,tool_choice:Ns(t?.tool_choice),response_format:this._getResponseFormat(t?.response_format),seed:t?.seed,...n,parallel_tool_calls:t?.parallel_tool_calls,...this.audio||t?.audio?{audio:this.audio||t?.audio}:{},...this.modalities||t?.modalities?{modalities:this.modalities||t?.modalities}:{},...this.modelKwargs,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,verbosity:t?.verbosity??this.verbosity};t?.prediction!==void 0&&(o.prediction=t.prediction),this.service_tier!==void 0&&(o.service_tier=this.service_tier),t?.service_tier!==void 0&&(o.service_tier=t.service_tier);let s=this._getReasoningParams(t);return s!==void 0&&s.effort!==void 0&&(o.reasoning_effort=s.effort),Xe(o.model)?o.max_completion_tokens=this.maxTokens===-1?void 0:this.maxTokens:o.max_tokens=this.maxTokens===-1?void 0:this.maxTokens,o}async _generate(t,e,r){e.signal?.throwIfAborted();let n={},o=this.invocationParams(e),s=Oo({messages:t,model:this.model});if(o.stream){let i=this._streamResponseChunks(t,e,r),a={};for await(let h of i){h.message.response_metadata={...h.generationInfo,...h.message.response_metadata};let b=h.generationInfo?.completion??0;a[b]===void 0?a[b]=h:a[b]=a[b].concat(h)}let c=Object.entries(a).sort(([h],[b])=>parseInt(h,10)-parseInt(b,10)).map(([h,b])=>b),{functions:l,function_call:u}=this.invocationParams(e),m=await this._getEstimatedTokenCountFromPrompt(t,l,u),f=await this._getNumTokensFromGenerations(c);return n.input_tokens=m,n.output_tokens=f,n.total_tokens=m+f,{generations:c,llmOutput:{estimatedTokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}else{let i=await this.completionWithRetry({...o,stream:!1,messages:s},{signal:e?.signal,...e?.options}),{completion_tokens:a,prompt_tokens:c,total_tokens:l,prompt_tokens_details:u,completion_tokens_details:m}=i?.usage??{};a&&(n.output_tokens=(n.output_tokens??0)+a),c&&(n.input_tokens=(n.input_tokens??0)+c),l&&(n.total_tokens=(n.total_tokens??0)+l),(u?.audio_tokens!==null||u?.cached_tokens!==null)&&(n.input_token_details={...u?.audio_tokens!==null&&{audio:u?.audio_tokens},...u?.cached_tokens!==null&&{cache_read:u?.cached_tokens}}),(m?.audio_tokens!==null||m?.reasoning_tokens!==null)&&(n.output_token_details={...m?.audio_tokens!==null&&{audio:m?.audio_tokens},...m?.reasoning_tokens!==null&&{reasoning:m?.reasoning_tokens}});let f=[];for(let h of i?.choices??[]){let b={text:h.message?.content??"",message:this._convertCompletionsMessageToBaseMessage(h.message??{role:"assistant"},i)};b.generationInfo={...h.finish_reason?{finish_reason:h.finish_reason}:{},...h.logprobs?{logprobs:h.logprobs}:{}},Be(b.message)&&(b.message.usage_metadata=n),b.message=new j(Object.fromEntries(Object.entries(b.message).filter(([A])=>!A.startsWith("lc_")))),f.push(b)}return{generations:f,llmOutput:{tokenUsage:{promptTokens:n.input_tokens,completionTokens:n.output_tokens,totalTokens:n.total_tokens}}}}}async*_streamResponseChunks(t,e,r){let n=Oo({messages:t,model:this.model}),o={...this.invocationParams(e,{streaming:!0}),messages:n,stream:!0},s,i=await this.completionWithRetry(o,e),a;for await(let c of i){if(e.signal?.aborted)return;let l=c?.choices?.[0];if(c.usage&&(a=c.usage),!l)continue;let{delta:u}=l;if(!u)continue;let m=this._convertCompletionsDeltaToBaseMessageChunk(u,c,s);s=u.role??s;let f={prompt:e.promptIndex??0,completion:l.index??0};if(typeof m.content!="string"){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}let h={...f};l.finish_reason!=null&&(h.finish_reason=l.finish_reason,h.system_fingerprint=c.system_fingerprint,h.model_name=c.model,h.service_tier=c.service_tier),this.logprobs&&(h.logprobs=l.logprobs);let b=new Xn({message:m,text:m.content,generationInfo:h});yield b,await r?.handleLLMNewToken(b.text??"",f,void 0,void 0,void 0,{chunk:b})}if(a){let c={...a.prompt_tokens_details?.audio_tokens!==null&&{audio:a.prompt_tokens_details?.audio_tokens},...a.prompt_tokens_details?.cached_tokens!==null&&{cache_read:a.prompt_tokens_details?.cached_tokens}},l={...a.completion_tokens_details?.audio_tokens!==null&&{audio:a.completion_tokens_details?.audio_tokens},...a.completion_tokens_details?.reasoning_tokens!==null&&{reasoning:a.completion_tokens_details?.reasoning_tokens}},u=new Xn({message:new it({content:"",response_metadata:{usage:{...a}},usage_metadata:{input_tokens:a.prompt_tokens,output_tokens:a.completion_tokens,total_tokens:a.total_tokens,...Object.keys(c).length>0&&{input_token_details:c},...Object.keys(l).length>0&&{output_token_details:l}}}),text:""});yield u,await r?.handleLLMNewToken(u.text??"",{prompt:0,completion:0},void 0,void 0,void 0,{chunk:u})}if(e.signal?.aborted)throw new Error("AbortError")}async completionWithRetry(t,e){let r=this._getClientOptions(e),n=t.response_format&&t.response_format.type==="json_schema";return this.caller.call(async()=>{try{return n&&!t.stream?await this.client.chat.completions.parse(t,r):await this.client.chat.completions.create(t,r)}catch(o){throw Se(o)}})}_convertCompletionsDeltaToBaseMessageChunk(t,e,r){return qa({delta:t,rawResponse:e,includeRawResponse:this.__includeRawResponse,defaultRole:r})}_convertCompletionsMessageToBaseMessage(t,e){return Ua({message:t,rawResponse:e,includeRawResponse:this.__includeRawResponse})}};var Us="__openai_function_call_ids__",qs="__openai_custom_tool_call_ids__";function Ud(t){return t.type==="url_citation"?{type:"citation",source:"url_citation",url:t.url,title:t.title,startIndex:t.start_index,endIndex:t.end_index}:t.type==="file_citation"?{type:"citation",source:"file_citation",title:t.filename,startIndex:t.index,file_id:t.file_id}:t.type==="container_file_citation"?{type:"citation",source:"container_file_citation",title:t.filename,startIndex:t.start_index,endIndex:t.end_index,file_id:t.file_id,container_id:t.container_id}:t.type==="file_path"?{type:"citation",source:"file_path",startIndex:t.index,file_id:t.file_id}:{type:"non_standard",value:t}}function ig(t){if(t.type==="url_citation"||t.type==="file_citation"||t.type==="container_file_citation"||t.type==="file_path")return t;if(t.type==="citation"){let e=t;if(e.source==="url_citation")return{type:"url_citation",url:e.url??"",title:e.title??"",start_index:e.startIndex??0,end_index:e.endIndex??0};if(e.source==="file_citation")return{type:"file_citation",file_id:e.file_id??"",filename:e.title??"",index:e.startIndex??0};if(e.source==="container_file_citation")return{type:"container_file_citation",file_id:e.file_id??"",filename:e.title??"",container_id:e.container_id??"",start_index:e.startIndex??0,end_index:e.endIndex??0};if(e.source==="file_path")return{type:"file_path",file_id:e.file_id??"",index:e.startIndex??0}}return t.type==="non_standard"?t.value:t}var Ba=t=>{let e={...t?.input_tokens_details?.cached_tokens!=null&&{cache_read:t?.input_tokens_details?.cached_tokens}},r={...t?.output_tokens_details?.reasoning_tokens!=null&&{reasoning:t?.output_tokens_details?.reasoning_tokens}};return{input_tokens:t?.input_tokens??0,output_tokens:t?.output_tokens??0,total_tokens:t?.total_tokens??0,input_token_details:e,output_token_details:r}},Bs=t=>{if(t.error){let a=new Error(t.error.message);throw a.name=t.error.code,a}let e=[],r=[],n=[],o=t.output.map(a=>{if(a.type==="function_call"&&"parsed_arguments"in a){let c={...a};return delete c.parsed_arguments,c}return a}),s={model_provider:"openai",model:t.model,created_at:t.created_at,id:t.id,incomplete_details:t.incomplete_details,metadata:t.metadata,object:t.object,output:o,status:t.status,user:t.user,service_tier:t.service_tier,model_name:t.model},i={};for(let a of t.output)if(a.type==="message")e.push(...a.content.flatMap(c=>c.type==="output_text"?("parsed"in c&&c.parsed!=null&&(i.parsed=c.parsed),{type:"text",text:c.text,annotations:c.annotations.map(Ud),...a.phase!==null?{phase:a.phase}:{}}):c.type==="refusal"?(i.refusal=c.refusal,[]):c));else if(a.type==="function_call"){let c={function:{name:a.name,arguments:a.arguments},id:a.call_id};try{r.push(Zo(c,{returnId:!0}))}catch(l){let u;typeof l=="object"&&l!=null&&"message"in l&&typeof l.message=="string"&&(u=l.message),n.push(gr(c,u))}i[Us]??={},a.id&&(i[Us][a.call_id]=a.id)}else if(a.type==="reasoning"){i.reasoning=a;let c=a.summary?.map(l=>l.text).filter(Boolean).join("");c&&e.push({type:"reasoning",reasoning:c})}else if(a.type==="custom_tool_call"){let c=zu(a);c?(r.push(c),i[qs]??={},a.id&&a.call_id&&(i[qs][a.call_id]=a.id)):n.push(gr(a,"Malformed custom tool call"))}else if(a.type==="computer_call"){let c=Uu(a);c?r.push(c):n.push(gr(a,"Malformed computer call"))}else a.type==="image_generation_call"?(a.result&&e.push({type:"image",mimeType:"image/png",data:a.result,id:a.id,metadata:{status:a.status}}),i.tool_outputs??=[],i.tool_outputs.push(a)):(i.tool_outputs??=[],i.tool_outputs.push(a));return new j({id:t.id,content:e,tool_calls:r,invalid_tool_calls:n,usage_metadata:Ba(t.usage),additional_kwargs:i,response_metadata:s})},qd=t=>{let e=(t.summary.length>1?t.summary.reduce((r,n)=>{let o=r[r.length-1];return o.index===n.index?o.text+=n.text:r.push(n),r},[{...t.summary[0]}]):t.summary).map(r=>Object.fromEntries(Object.entries(r).filter(([n])=>n!=="index")));return{...t,summary:e}},Ka=t=>{let e=[],r={},n,o=[],s={model_provider:"openai"},i={},a;if(t.type==="response.output_text.delta")e.push({type:"text",text:t.delta,index:t.content_index});else if(t.type==="response.output_text.annotation.added")e.push({type:"text",text:"",annotations:[Ud(t.annotation)],index:t.content_index});else if(t.type==="response.output_item.added"&&t.item.type==="message"){let c="phase"in t.item?t.item.phase:void 0;c&&e.push({type:"text",text:"",phase:c,index:0})}else if(t.type==="response.output_item.added"&&t.item.type==="function_call")o.push({type:"tool_call_chunk",name:t.item.name,args:t.item.arguments,id:t.item.call_id,index:t.output_index}),i[Us]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.added"&&t.item.type==="custom_tool_call")o.push({type:"tool_call_chunk",isCustomTool:!0,name:t.item.name,args:t.item.input,id:t.item.call_id,index:t.output_index}),i[qs]={[t.item.call_id]:t.item.id};else if(t.type==="response.output_item.done"&&t.item.type==="computer_call")o.push({type:"tool_call_chunk",name:"computer_use",args:JSON.stringify({action:t.item.action}),id:t.item.call_id,index:t.output_index}),i.tool_outputs=[t.item];else if(t.type==="response.output_item.done"&&t.item.type==="image_generation_call")t.item.result&&e.push({type:"image",mimeType:"image/png",data:t.item.result,id:t.item.id,metadata:{status:t.item.status}}),i.tool_outputs=[t.item];else if(t.type==="response.output_item.done"&&["web_search_call","file_search_call","code_interpreter_call","shell_call","local_shell_call","mcp_call","mcp_list_tools","mcp_approval_request","custom_tool_call","tool_search_call","tool_search_output"].includes(t.item.type))i.tool_outputs=[t.item];else if(t.type==="response.created")a=t.response.id,s.id=t.response.id,s.model_name=t.response.model,s.model=t.response.model;else if(t.type==="response.completed"||t.type==="response.incomplete"){a=t.response.id;let c=Bs(t.response);if(n=Ba(t.response.usage),t.response.text?.format?.type==="json_schema"&&c.text)try{i.parsed??=JSON.parse(c.text)}catch{}for(let[l,u]of Object.entries(t.response))l!=="id"&&(l==="output"?s[l]=c.response_metadata.output:s[l]=u)}else if(t.type==="response.function_call_arguments.delta"||t.type==="response.custom_tool_call_input.delta")o.push({type:"tool_call_chunk",args:t.delta,index:t.output_index,...t.type==="response.custom_tool_call_input.delta"?{isCustomTool:!0}:{}});else if(t.type==="response.web_search_call.completed"||t.type==="response.file_search_call.completed")r={tool_outputs:{id:t.item_id,type:t.type.replace("response.","").replace(".completed",""),status:"completed"}};else if(t.type==="response.refusal.done")i.refusal=t.refusal;else if(t.type==="response.output_item.added"&&"item"in t&&t.item.type==="reasoning"){let c=t.item.summary?t.item.summary.map((u,m)=>({...u,index:m})):void 0;i.reasoning={id:t.item.id,type:t.item.type,...c?{summary:c}:{}};let l=t.item.summary?.map(u=>u.text).filter(Boolean).join("");l&&e.push({type:"reasoning",reasoning:l})}else if(t.type==="response.reasoning_summary_part.added")i.reasoning={type:"reasoning",summary:[{...t.part,index:t.summary_index}]},t.part.text&&e.push({type:"reasoning",reasoning:t.part.text,index:t.summary_index});else if(t.type==="response.reasoning_summary_text.delta")i.reasoning={type:"reasoning",summary:[{text:t.delta,type:"summary_text",index:t.summary_index}]},t.delta&&e.push({type:"reasoning",reasoning:t.delta,index:t.summary_index});else return t.type==="response.image_generation_call.partial_image",null;return new Xn({text:e.map(c=>c.text).join(""),message:new it({id:a,content:e,tool_call_chunks:o,usage_metadata:n,additional_kwargs:i,response_metadata:s}),generationInfo:r})},Bd=t=>{let e=j.isInstance(t)&&t.response_metadata?.model_provider==="openai";function*r(){let n=Ee(()=>{try{let y=et(t);return y==="system"||y==="developer"||y==="assistant"||y==="user"?y:"assistant"}catch{return"assistant"}}),o,s=new Set,i=new Set,a=new Map,c=new Map;function*l(){if(!o)return;let y=o.content;(typeof y=="string"&&y.length>0||Array.isArray(y)&&y.length>0)&&(yield o),o=void 0}let u=(y,v)=>{o||(o={type:"message",role:n,content:[],...v?{phase:v}:{}}),typeof o.content=="string"?o.content=o.content.length>0?[{type:"input_text",text:o.content},...y]:[...y]:o.content.push(...y)},m=y=>{if(typeof y=="string")return y;try{return JSON.stringify(y??{})}catch{return"{}"}},f=y=>{let v=Ee(()=>{let C=y.metadata?.detail;return C==="low"||C==="high"||C==="auto"?C:"auto"});if(y.fileId)return{type:"input_image",detail:v,file_id:y.fileId};if(y.url)return{type:"input_image",detail:v,image_url:y.url};if(y.data){let C=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64");return{type:"input_image",detail:v,image_url:`data:${y.mimeType??"image/png"};base64,${C}`}}},h=y=>{if(y.fileId){let v=$a(y);return{type:"input_file",file_id:y.fileId,...v?{filename:v}:{}}}if(y.url){let v=$a(y);return{...v?{filename:v}:{},type:"input_file",file_url:y.url}}if(y.data){let v=Ln(y),C=typeof y.data=="string"?y.data:Buffer.from(y.data).toString("base64");return{type:"input_file",file_data:`data:${y.mimeType??"application/octet-stream"};base64,${C}`,filename:v}}},b=y=>{let v=Ee(()=>{if(Array.isArray(y.summary)){let B=y.summary?.map(P=>P?.text).filter(P=>typeof P=="string")??[];if(B.length>0)return B}return y.reasoning?[y.reasoning]:[]}),C=v.length>0?v.map(B=>({type:"summary_text",text:B})):[{type:"summary_text",text:""}],L={type:"reasoning",id:y.id??"",summary:C};return y.reasoning&&(L.content=[{type:"reasoning_text",text:y.reasoning}]),L},A=y=>({type:"function_call",name:y.name??"",call_id:y.id??"",arguments:m(y.args)}),E=y=>{let v=m(y.output),C=y.status==="success"?"completed":y.status==="error"?"incomplete":void 0;return{type:"function_call_output",call_id:y.toolCallId??"",output:v,...C?{status:C}:{}}};for(let y of t.contentBlocks)if(y.type==="text"){let v=Ee(()=>{if("extras"in y&&typeof y.extras=="object"&&y.extras!==null&&"phase"in y.extras)return y.extras.phase});u([{type:"input_text",text:y.text}],v)}else if(y.type!=="invalid_tool_call"){if(y.type==="reasoning")yield*l(),yield b(y);else if(y.type==="tool_call"){yield*l();let v=y.id??"";v&&(s.add(v),a.delete(v)),yield A(y)}else if(y.type==="tool_call_chunk"){if(y.id){let v=a.get(y.id)??{name:y.name,args:[]};y.name&&(v.name=y.name),y.args&&v.args.push(y.args),a.set(y.id,v)}}else if(y.type==="server_tool_call"){yield*l();let v=y.id??"";v&&(i.add(v),c.delete(v)),yield A(y)}else if(y.type==="server_tool_call_chunk"){if(y.id){let v=c.get(y.id)??{name:y.name,args:[]};y.name&&(v.name=y.name),y.args&&v.args.push(y.args),c.set(y.id,v)}}else if(y.type==="server_tool_call_result")yield*l(),yield E(y);else if(y.type!=="audio")if(y.type==="file"){let v=h(y);v&&u([v])}else if(y.type==="image"){let v=f(y);v&&u([v])}else if(y.type==="video"){let v=h(y);v&&u([v])}else y.type==="text-plain"?y.text&&u([{type:"input_text",text:y.text}]):y.type==="non_standard"&&e&&(yield*l(),yield y.value)}yield*l();for(let[y,v]of a){if(!y||s.has(y))continue;let C=v.args.join("");!v.name&&!C||(yield{type:"function_call",call_id:y,name:v.name??"",arguments:C})}for(let[y,v]of c){if(!y||i.has(y))continue;let C=v.args.join("");!v.name&&!C||(yield{type:"function_call",call_id:y,name:v.name??"",arguments:C})}}return Array.from(r())},Ks=({messages:t,zdrEnabled:e,model:r})=>t.flatMap(n=>{let o=n.response_metadata;if(o?.output_version==="v1")return Bd(n);let s=n.additional_kwargs,i=et(n);if(i==="system"&&Xe(r)&&(i="developer"),i==="function")throw new Error("Function messages are not supported in Responses API");if(i==="tool"){let a=n;if(s?.type==="computer_call_output")return{type:"computer_call_output",output:(()=>{if(typeof a.content=="string")return{type:"input_image",image_url:a.content};if(Array.isArray(a.content)){let l=a.content.find(f=>f.type==="input_image");if(l)return l;let u=a.content.find(f=>f.type==="computer_screenshot");if(u)return u;let m=a.content.find(f=>f.type==="image_url");if(m)return{type:"input_image",image_url:typeof m.image_url=="string"?m.image_url:m.image_url.url}}throw new Error("Invalid computer call output")})(),call_id:a.tool_call_id};if(a.additional_kwargs?.customTool)return{type:"custom_tool_call_output",call_id:a.tool_call_id,output:a.content};let c=Array.isArray(a.content)&&a.content.every(l=>typeof l=="object"&&l!==null&&"type"in l&&(l.type==="input_file"||l.type==="input_image"||l.type==="input_text"));return{type:"function_call_output",call_id:a.tool_call_id,id:a.id?.startsWith("fc_")?a.id:void 0,output:c?a.content:typeof a.content!="string"?JSON.stringify(a.content):a.content}}if(i==="assistant"){if(!e&&o?.output!=null&&Array.isArray(o?.output)&&o?.output.length>0&&o?.output.every(A=>"type"in A))return o?.output;let a=[],c=s?.reasoning,l=!!c?.encrypted_content;if(c&&(!e||l)){let A=qd(c);a.push(A)}let{content:u}=n;if(s?.refusal&&(typeof u=="string"&&(u=[{type:"output_text",text:u,annotations:[]}]),u=[...u,{type:"refusal",refusal:s.refusal}]),typeof u=="string"||u.length>0){let A={type:"message",role:"assistant",...n.id&&!e&&n.id.startsWith("msg_")?{id:n.id}:{},content:Ee(()=>typeof u=="string"?u:u.flatMap(E=>{if(E.type==="text"){let y=E;return{type:"output_text",text:y.text,annotations:(y.annotations??[]).map(ig)}}return E.type==="output_text"||E.type==="refusal"?E:[]})),phase:Ee(()=>{if(Array.isArray(u))return u.find(E=>"phase"in E&&typeof E.phase=="string")?.phase})};a.push(A)}let m=s?.[Us],f=s?.[qs];j.isInstance(n)&&n.tool_calls?.length?a.push(...n.tool_calls.map(A=>Bu(A,f)?{type:"custom_tool_call",id:"call_id"in A&&typeof A.call_id=="string"?A.call_id:f?.[A.id??""]??"",call_id:A.id??"",input:A.args.input,name:A.name}:qu(A)?{type:"computer_call",id:A.call_id,call_id:A.id??"",action:A.args.action}:{type:"function_call",name:A.name,arguments:JSON.stringify(A.args),call_id:A.id,...e?{}:{id:m?.[A.id]}})):s?.tool_calls&&a.push(...s.tool_calls.map(A=>({type:"function_call",name:A.function.name,call_id:A.id,arguments:A.function.arguments,...e?{}:{id:m?.[A.id]}})));let h=o?.output?.length?o?.output:s.tool_outputs,b=["computer_call","mcp_call","code_interpreter_call","image_generation_call","shell_call","local_shell_call"];if(h!=null){let A=h?.filter(E=>b.includes(E.type));A.length>0&&a.push(...A)}return a}if(i==="user"||i==="system"||i==="developer"){if(typeof n.content=="string")return{type:"message",role:i,content:n.content};let a=[],c=n.content.flatMap(l=>(l.type==="mcp_approval_response"&&a.push({type:"mcp_approval_response",approval_request_id:l.approval_request_id,approve:l.approve}),qo(l)?Bo(l,js):l.type==="text"?{type:"input_text",text:l.text}:l.type==="image_url"?{type:"input_image",image_url:Ee(()=>{if(typeof l.image_url=="string")return l.image_url;if(typeof l.image_url=="object"&&l.image_url!==null&&"url"in l.image_url)return l.image_url.url}),detail:Ee(()=>{if(typeof l.image_url=="string")return"auto";if(typeof l.image_url=="object"&&l.image_url!==null&&"detail"in l.image_url)return l.image_url.detail})}:l.type==="input_text"||l.type==="input_image"||l.type==="input_file"?l:[]));return c.length>0&&a.push({type:"message",role:i,content:c}),a}return console.warn(`Unsupported role found when converting to OpenAI Responses API: ${i}`),[]});var Ws=class extends dr{constructor(t,e){super(Fn(t,e))}invocationParams(t){let e;t?.strict!==void 0&&(e=t.strict),e===void 0&&this.supportsStrictToolCalling!==void 0&&(e=this.supportsStrictToolCalling);let r={model:this.model,temperature:this.temperature,top_p:this.topP,user:this.user,service_tier:this.service_tier,stream:this.streaming,previous_response_id:t?.previous_response_id,truncation:t?.truncation,include:t?.include,tools:t?.tools?.length?this._reduceChatOpenAITools(t.tools,{stream:this.streaming,strict:e}):void 0,tool_choice:ju(t?.tool_choice)?t?.tool_choice:(()=>{let o=Ns(t?.tool_choice);if(typeof o=="object"&&"type"in o){if(o.type==="function")return{type:"function",name:o.function.name};if(o.type==="allowed_tools")return{type:"allowed_tools",mode:o.allowed_tools.mode,tools:o.allowed_tools.tools};if(o.type==="custom")return{type:"custom",name:o.custom.name}}})(),text:(()=>{if(t?.text)return t.text;let o=this._getResponseFormat(t?.response_format);return o?.type==="json_schema"?o.json_schema.schema!=null?{format:{type:"json_schema",schema:o.json_schema.schema,description:o.json_schema.description,name:o.json_schema.name,strict:o.json_schema.strict},verbosity:t?.verbosity}:void 0:{format:o,verbosity:t?.verbosity}})(),parallel_tool_calls:t?.parallel_tool_calls,max_output_tokens:this.maxTokens===-1?void 0:this.maxTokens,prompt_cache_key:t?.promptCacheKey??this.promptCacheKey,prompt_cache_retention:t?.promptCacheRetention??this.promptCacheRetention,...this.zdrEnabled?{store:!1}:{},...this.modelKwargs},n=this._getReasoningParams(t);return n!==void 0&&(r.reasoning=n),r}async _generate(t,e,r){e.signal?.throwIfAborted();let n=this.invocationParams(e);if(n.stream){let o=this._streamResponseChunks(t,e,r),s;for await(let i of o)i.message.response_metadata={...i.generationInfo,...i.message.response_metadata},s=s?.concat(i)??i;return{generations:s?[s]:[],llmOutput:{estimatedTokenUsage:s?.message?.usage_metadata}}}else{let o=await this.completionWithRetry({input:Ks({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),...n,stream:!1},{signal:e?.signal,...e?.options});return{generations:[{text:o.output_text,message:Bs(o)}],llmOutput:{id:o.id,estimatedTokenUsage:o.usage?{promptTokens:o.usage.input_tokens,completionTokens:o.usage.output_tokens,totalTokens:o.usage.total_tokens}:void 0}}}}async*_streamResponseChunks(t,e,r){let n=await this.completionWithRetry({...this.invocationParams(e),input:Ks({messages:t,zdrEnabled:this.zdrEnabled??!1,model:this.model}),stream:!0},e);for await(let o of n){if(e.signal?.aborted)return;let s=Ka(o);s!=null&&(yield s,await r?.handleLLMNewToken(s.text||"",{prompt:e.promptIndex??0,completion:0},void 0,void 0,void 0,{chunk:s}))}}async completionWithRetry(t,e){return this.caller.call(async()=>{let r=this._getClientOptions(e);try{return t.text?.format?.type==="json_schema"&&!t.stream?await this.client.responses.parse(t,r):await this.client.responses.create(t,r)}catch(n){throw Se(n)}})}_reduceChatOpenAITools(t,e){let r=[];for(let n of t)if(Dn(n))n.type==="image_generation"&&e?.stream&&(n.partial_images=1),r.push(n);else if(lr(n)){let o=n.metadata.customTool;r.push({type:"custom",name:o.name,description:o.description,format:o.format})}else if(Jo(n)){let o={};for(let[s,i]of Object.entries(n))s!=="type"&&s!=="function"&&(o[s]=i);r.push({type:"function",name:n.function.name,parameters:n.function.parameters,description:n.function.description,strict:e?.strict??null,...o})}else Ls(n)&&r.push(Ku(n));return r}};var jn=class Kd extends dr{useResponsesApi=!1;responses;completions;get lc_serializable_keys(){return[...super.lc_serializable_keys,"useResponsesApi"]}get callKeys(){return[...super.callKeys,"useResponsesApi"]}fields;constructor(e,r){let n=Fn(e,r);super(n),this.fields=n,this.useResponsesApi=n?.useResponsesApi??!1,this.responses=n?.responses??new Ws(n),this.completions=n?.completions??new zs(n)}_useResponsesApi(e){let r=e?.tools?.some(Dn),n=e?.previous_response_id!=null||e?.text!=null||e?.truncation!=null||e?.include!=null||e?.reasoning?.summary!=null||this.reasoning?.summary!=null,o=e?.tools?.some(Ls)||e?.tools?.some(lr);return this.useResponsesApi||r||n||o||Mu(this.model)}getLsParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.getLsParams(r):this.completions.getLsParams(r)}invocationParams(e){let r=this._combineCallOptions(e);return this._useResponsesApi(e)?this.responses.invocationParams(r):this.completions.invocationParams(r)}async _generate(e,r,n){return this._useResponsesApi(r)?this.responses._generate(e,r,n):this.completions._generate(e,r,n)}async*_streamResponseChunks(e,r,n){if(this._useResponsesApi(r)){yield*this.responses._streamResponseChunks(e,this._combineCallOptions(r),n);return}yield*this.completions._streamResponseChunks(e,this._combineCallOptions(r),n)}withConfig(e){let r=new Kd(this.fields);return r.defaultOptions={...this.defaultOptions,...e},r}};var Po=class extends ec{model="text-embedding-ada-002";modelName;batchSize=512;stripNewLines=!0;dimensions;timeout;organization;encodingFormat;client;clientConfig;apiKey;constructor(t){let e={maxConcurrency:2,...t};super(e);let r=e?.apiKey??e?.openAIApiKey??Ae("OPENAI_API_KEY");this.organization=e?.configuration?.organization??Ae("OPENAI_ORGANIZATION"),this.model=e?.model??e?.modelName??this.model,this.modelName=this.model,this.batchSize=e?.batchSize??this.batchSize,this.stripNewLines=e?.stripNewLines??this.stripNewLines,this.timeout=e?.timeout,this.dimensions=e?.dimensions,this.encodingFormat=e?.encodingFormat,this.clientConfig={apiKey:r,organization:this.organization,dangerouslyAllowBrowser:!0,...t?.configuration}}async embedDocuments(t){let e=Ri(this.stripNewLines?t.map(s=>s.replace(/\n/g," ")):t,this.batchSize),r=e.map(s=>{let i={model:this.model,input:s};return this.dimensions&&(i.dimensions=this.dimensions),this.encodingFormat&&(i.encoding_format=this.encodingFormat),this.embeddingWithRetry(i)}),n=await Promise.all(r),o=[];for(let s=0;s<n.length;s+=1){let i=e[s],{data:a}=n[s];for(let c=0;c<i.length;c+=1)o.push(a[c].embedding)}return o}async embedQuery(t){let e={model:this.model,input:this.stripNewLines?t.replace(/\n/g," "):t};this.dimensions&&(e.dimensions=this.dimensions),this.encodingFormat&&(e.encoding_format=this.encodingFormat);let{data:r}=await this.embeddingWithRetry(e);return r[0].embedding}async embeddingWithRetry(t){if(!this.client){let r=tt({baseURL:this.clientConfig.baseURL}),n={...this.clientConfig,baseURL:r,timeout:this.timeout,maxRetries:0};n.baseURL||delete n.baseURL,n.defaultHeaders=rt(n.defaultHeaders),this.client=new O(n)}let e={};return this.caller.call(async()=>{try{return await this.client.embeddings.create(t,e)}catch(r){throw Se(r)}})}};var ug=w.object({type:w.literal("screenshot")}),dg=w.object({type:w.literal("click"),x:w.number(),y:w.number(),button:w.enum(["left","right","wheel","back","forward"]).default("left")}),pg=w.object({type:w.literal("double_click"),x:w.number(),y:w.number(),button:w.enum(["left","right","wheel","back","forward"]).default("left")}),mg=w.object({type:w.literal("drag"),path:w.array(w.object({x:w.number(),y:w.number()}))}),fg=w.object({type:w.literal("keypress"),keys:w.array(w.string())}),hg=w.object({type:w.literal("move"),x:w.number(),y:w.number()}),gg=w.object({type:w.literal("scroll"),x:w.number(),y:w.number(),scroll_x:w.number(),scroll_y:w.number()}),yg=w.object({type:w.literal("type"),text:w.string()}),_g=w.object({type:w.literal("wait"),duration:w.number().optional()}),wg=w.union([ug,dg,pg,mg,fg,hg,gg,yg,_g]),TB=w.object({action:wg});var bg=w.object({type:w.literal("exec"),command:w.array(w.string()),env:w.record(w.string(),w.string()).optional(),working_directory:w.string().optional(),timeout_ms:w.number().optional(),user:w.string().optional()}),kB=w.union([bg]);var RB=w.object({commands:w.array(w.string()).describe("Array of shell commands to execute"),timeout_ms:w.number().optional().describe("Optional timeout in milliseconds for the commands"),max_output_length:w.number().optional().describe("Optional maximum number of characters to return from each command")});var Ag=w.object({type:w.literal("create_file"),path:w.string(),diff:w.string()}),xg=w.object({type:w.literal("update_file"),path:w.string(),diff:w.string()}),vg=w.object({type:w.literal("delete_file"),path:w.string()}),DB=w.union([Ag,xg,vg]);var Vd={advanced:"gpt-5.2",default:"gpt-5-mini",fast:"gpt-5.4-nano"},Ha={default:"text-embedding-ada-002"},Wa=new Map,Hs=null,Sg=()=>{let t=Hd.getDefault().helperServices;if(!t?.aiModels?.url)throw new Error("AI Models Service URL is not defined in the portal's helper services.");return t.aiModels.url},Gd=async t=>{let e=Sg();Wa.size===0&&(Hs||(Hs=(async()=>{try{let n=await fetch(`${e}/models`);if(!n.ok)throw new Error("Failed to fetch AI service discovery data.");(await n.json()).models.forEach(o=>Wa.set(o.name,o))}catch(n){throw Hs=null,n}})()),await Hs);let r=Wa.get(t);if(!r)throw new Error(`Model '${t}' is not available in the discovery service.`);return r.endpoint},Eg=async(t="default")=>await Gd(Vd[t]),Jd=async(t="default")=>await Gd(Ha[t]),Un=(t,e)=>e,Zd=(t,e)=>({...t,...e}),Qd=(t="",e)=>{let r=typeof e=="string"?e.trim():"";if(!r)return t;let n=t.trim();if(!n)return r;if(n===r)return t;let o=n.split(`
69
+
70
+ `);return o[o.length-1]?.trim()===r?t:`${t}
71
+
72
+ ${r}`},Yd=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}}),Tt=()=>({agentExecutionContext:S({reducer:Zd,default:Yd}),outputMessage:S({reducer:Qd,default:()=>""}),summary:S({reducer:Un,default:()=>""}),status:S({reducer:Un})}),Va=()=>({...Tt(),sharedStatePatch:S({reducer:Un})}),Cg=S.Root({agentExecutionContext:S({default:Yd,reducer:Zd}),currentIntent:S({default:()=>"none",reducer:Un}),lastExecutedAgent:S({default:()=>"",reducer:Un}),requiresFollowUp:S({default:()=>!0,reducer:Un}),stepCount:S({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:S({default:()=>"",reducer:Qd})});var kg=t=>typeof t=="string"&&t.length>0?t:void 0,Og=()=>Ol(),Pg=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,Mg=t=>{let e=t?.configurable;return{conversationId:kg(e?.thread_id),abortSignal:t?.signal,requestId:Og(),requestSource:Pg(Tg.applicationName)}},Xd=async({config:t})=>{let e=Hd.getDefault(),r=(await Ig.getCredential(`${e.url}/sharing`))?.token;return async(n,o)=>{let{conversationId:s,abortSignal:i,requestId:a,requestSource:c}=Mg(t),l=new Headers(o?.headers);l.delete("Authorization"),l.delete("api-key"),r&&r.length>0&&(l.set("X-Esri-Authorization",`Bearer ${r}`),l.set("X-Esri-Request-Source",c)),s&&s.length>0&&l.set("X-Esri-Conversation-Id",s),a.length>0&&l.set("X-Esri-Request-Id",a);let u=i&&o?.signal?AbortSignal.any([i,o.signal]):o?.signal??i;return await fetch(n,{...o,headers:l,signal:u})}},Ga=async(t={})=>{let{modelTier:e="default",temperature:r=0,config:n}=t,o=Vd[e],s=await Eg(e);return new jn({modelName:o,apiKey:"dummy-key",...e!=="default"&&{temperature:r},configuration:{baseURL:s,fetch:await Xd({config:n})}})},ep=async(t={})=>{let{tier:e="default",config:r}=t,n=Ha[e],o=await Jd(e);return new Po({modelName:n,apiKey:"dummy-key",configuration:{baseURL:o,fetch:await Xd({config:r})},batchSize:2048,maxConcurrency:10})},Rg=w.object({id:w.string().min(1),name:w.string().min(1),description:w.string().min(1)});w.array(Rg);var tp="0.1",zn=1536,rp="openai",np=Ha.default,op=`Name: {name}
73
+ Title: {title}
74
+ Description: {description}`,sp=`Name: {name}
75
+ Alias: {alias}
76
+ Description: {description}`,ip=w.object({schemaVersion:w.literal(tp),modified:w.number().int().nonnegative(),embeddings:w.object({modelProvider:w.literal(rp),model:w.literal(np),dimensions:w.literal(zn),templates:w.object({layer:w.string().default(op),field:w.string().default(sp)})}),layers:w.array(w.object({id:w.string().min(1),name:w.string().min(1),title:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zn,{message:`Layer vector must be exactly ${zn} dimensions`}),fields:w.array(w.object({name:w.string().min(1),alias:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zn,{message:`Field vector must be exactly ${zn} dimensions`})}))})).default([])});var ap=(t,e)=>{let r=Yo.fromTemplate(t);return Xo.fromMessages([r,...e])},$g=async t=>{let{promptText:e,modelTier:r,temperature:n,messages:o,config:s}=t,i=ap(e,o??[]),a=await Ga({modelTier:r,temperature:n,config:s});return i.pipe(a)},Vs=async t=>{let{promptText:e,modelTier:r="default",temperature:n=0,messages:o,inputVariables:s,config:i}=t,a=await(await $g({promptText:e,modelTier:r,temperature:n,messages:o,config:i})).invoke(s??{},i);if(typeof a=="string")return a;let c=a.content;return typeof c=="string"?c:JSON.stringify(c)},Mo=async t=>{let{promptText:e,modelTier:r="default",temperature:n=0,messages:o,inputVariables:s,schema:i,config:a}=t,c=ap(e,o??[]),l=(await Ga({modelTier:r,temperature:n,config:a})).withStructuredOutput(i);return await c.pipe(l).invoke(s??{},a)};var Ng=d.object({name:d.string(),description:d.string(),valueType:d.string(),alias:d.string()}),oW=d.object({fields:d.array(Ng)});var sW=d.object({title:d.string(),description:d.string(),name:d.string().nullable()});var lp=async t=>{try{return await(await ep()).embedDocuments(t)}catch(e){throw console.error("Failed to generate embeddings:",e),e}};var up=t=>Array.isArray(t)&&t.every(Yn),Fg=t=>typeof t=="object"&&t!=null&&"messages"in t&&up(t.messages),jg=t=>typeof t=="object"&&t!=null&&"lg_tool_call"in t,ot=class extends sc{tools;handleToolErrors=!0;trace=!1;constructor(t,e){let{name:r,tags:n,handleToolErrors:o}=e??{};super({name:r,tags:n,func:(s,i)=>this.run(s,i)}),this.tools=t,this.handleToolErrors=o??this.handleToolErrors}async runTool(t,e,r){let n=this.tools.find(o=>o.name===t.name);try{if(n===void 0)throw new Error(`Tool "${t.name}" not found.`);let o={...t,type:"tool_call"},s={...e,state:r,toolCallId:t.id??"",config:e,context:e.context,store:e.store??null,writer:e.writer??e.configurable?.writer??null},i=await n.invoke(o,s);return Yn(i)&&i.getType()==="tool"||Ot(i)?i:new q({status:"success",name:n.name,content:typeof i=="string"?i:JSON.stringify(i),tool_call_id:t.id})}catch(o){if(!this.handleToolErrors||Qn(o))throw o;return new q({status:"error",content:`Error: ${o.message}
77
+ Please fix your mistakes.`,name:t.name,tool_call_id:t.id??""})}}async run(t,e){let r;if(jg(t)){let{lg_tool_call:s,...i}=t;r=[await this.runTool(s,e,i)]}else{let s;if(up(t))s=t;else if(Fg(t))s=t.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let i=new Set(s.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),a;for(let c=s.length-1;c>=0;c-=1){let l=s[c];if(Be(l)){a=l;break}}if(a==null||!Be(a))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(a.tool_calls?.filter(c=>c.id==null||!i.has(c.id)).map(c=>this.runTool(c,e,t))??[])}if(!r.some(Ot))return Array.isArray(t)?r:{messages:r};let n=[],o=null;for(let s of r)Ot(s)?s.graph===qe.PARENT&&Array.isArray(s.goto)&&s.goto.every(i=>Bl(i))?o?o.goto.push(...s.goto):o=new qe({graph:qe.PARENT,goto:s.goto}):n.push(s):n.push(Array.isArray(t)?[s]:{messages:[s]});return o&&n.push(o),n}};var n2=S.Root({llmInputMessages:S({reducer:(t,e)=>eo([],e),default:()=>[]})});var Ro=(t,e)=>e??t,by=S.Root({...Va(),intent:S({reducer:Ro}),vectorSearchLayerResults:S({reducer:Ro,default:()=>[]}),vectorSearchFieldResults:S({reducer:Ro}),navigationInternalState:S({reducer:Ro,default:()=>({toolCallMessage:void 0})})});async function Ay(t,e){let r=pr.getDefault().helperServices,n=r.geocode.find(u=>u.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!n)throw new Error("No geocoding service found in helperServices.");let o=n.url,s=`${Ja.assetsPath?.endsWith("/")?Ja.assetsPath:`${Ja.assetsPath}/`}esri/images/search/search-symbol-32.png`,i=(await qg(o,{address:{SingleLine:t},outFields:["Match_addr"]}))?.[0];if(!i?.extent||!i.location)throw new Error(`Could not find location for: ${t}`);let a=new Bg({url:s,width:24,height:24}),c=new Ug({geometry:i.location,symbol:a});e.graphics.removeAll(),e.graphics.add(c),await e.goTo(i.extent);let l={address:i.address??"",location:i.location?i.location.toJSON():null,extent:i.extent?i.extent.toJSON():null};return{text:`Successfully zoomed to ${t}.`,sharedStatePatch:{lastResolvedLocation:{value:l}}}}var xy=["mapView"];function ze(t){let e=t?.configurable?.context;if(!e||typeof e!="object")throw new Error("NavigationAgent context missing");let r=xy.filter(n=>!(n in e));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return e}async function vy({address:t},e){let{mapView:r}=ze(e);return await Ay(t,r)}var Iy=d.object({address:d.string().describe("The full address or place name to locate.")}),Ty=N(vy,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Iy});async function Sy(t,e){let r=e.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let n=r.find(s=>s.name===t);if(!n)throw new Error(`Bookmark with name "${t}" not found.`);let o=n.viewpoint;if(!o)throw new Error(`Bookmark with name "${t}" does not have a valid viewpoint.`);return await e.goTo(o),{text:`Navigated to bookmark: ${t}`}}async function Ey({bookmarkName:t},e){let{mapView:r}=ze(e);return await Promise.resolve(Sy(t,r))}var Cy=w.object({bookmarkName:w.string().describe("The name of the bookmark to navigate to.")}),ky=N(Ey,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Cy});async function Oy(t,e,r){let n=r.map?.allLayers.find(i=>i.id===t);if(!n)return{text:`Error: Layer with id ${t} not found`};let o=e?.trim()?e:"1=1",s=n.createQuery();s.where=o;try{let{extent:i,count:a}=await n.queryExtent(s);if(a===0)return{text:`No features found in ${n.title} matching: ${o}`,where:o};if(i)await r.goTo(i);else return{text:`Error: Unable to determine extent for ${n.title}`,where:o};let c={layerId:t,layerTitle:n.title??t,where:o,count:a};return{text:`Successfully zoomed to ${a} feature(s) in ${n.title} matching: ${o}`,where:o,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(i){return console.error("Error in goToFeatures:",i),{text:`Error: ${i instanceof Error?i.message:"Unknown error"}`,where:o}}}async function Py({layerId:t,where:e},r){let{mapView:n}=ze(r);return await Oy(t,e,n)}var My=w.object({layerId:w.string().describe("The layerId of the layer to zoom to."),where:w.string().describe("The sql-92 where clause used to query features to zoom to")}),Ry=N(Py,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:My});async function $y(t){let e=new Kg({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await t.goTo(e),{text:"Successfully zoomed to world extent"}}async function Ny(t,e){let{mapView:r}=ze(e);return await $y(r)}var Ly=w.object({}),Dy=N(Ny,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ly});async function Fy(t){let e=t.map.initialViewProperties?.viewpoint?.targetGeometry;if(e)await t.goTo(e);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function jy(t,e){let{mapView:r}=ze(e);return await Fy(r)}var zy=d.object({}),Uy=N(jy,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:zy});async function qy(t,e){await e.when();let r=e.map?.allLayers.find(o=>o.id===t);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${t}`),{text:`Could not find layer for: ${t}`};let n;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&e.map?.activeLinkChartLayer?n=e.map.diagramNodesExtent:n=r.fullExtent,n?(await e.goTo(n),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function By({layerId:t},e){let{mapView:r}=ze(e);return await qy(t,r)}var Ky=w.object({layerId:w.string().describe("The id of the layer to navigate to")}),Wy=N(By,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Ky});async function Hy(t,e){return await e.goTo({scale:t}),{text:`Successfully zoomed to: ${t}`}}async function Vy({scale:t},e){let{mapView:r}=ze(e);return await Hy(t,r)}var Gy=d.object({scale:d.number().describe("The map scale of the view to go to.")}),Jy=N(Vy,{name:"goToScale",description:"Go to the specified view scale.",schema:Gy});async function Zy(t,e,r){let n={target:new wp({longitude:t.longitude,latitude:t.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(n.zoom=r.zoom),r?.scale!==void 0&&(n.scale=r.scale),await e.goTo(n),{text:`Successfully navigated to: ${[`(${t.latitude}\xB0, ${t.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function Qy({center:t,zoom:e,scale:r},n){let{mapView:o}=ze(n);return await Zy(t,o,{zoom:e,scale:r})}var Yy=d.object({center:d.object({longitude:d.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:d.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:d.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:d.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Xy=N(Qy,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:Yy});async function e_(t,e){return await e.goTo({zoom:t}),{text:`Successfully zoomed to: ${t}`}}async function t_({zoom:t},e){let{mapView:r}=ze(e);return await e_(t,r)}var r_=d.object({zoom:d.number().min(1).max(20).describe("The zoom level of the view to go to.")}),n_=N(t_,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:r_}),gp=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./VDI7SDRK.js").then(t=>t.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./275IZ5I6.js").then(t=>t.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./MV7GEGP5.js").then(t=>t.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./CRDFUDM4.js").then(t=>t.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./EL3OIP52.js").then(t=>t.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./TLIIJ2QC.js").then(t=>t.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./PLXHBQBF.js").then(t=>t.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./YPDXQEUA.js").then(t=>t.default),"../agents/help/prompts/help_prompt.md":()=>import("./U76GHEKJ.js").then(t=>t.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./54TJQLYJ.js").then(t=>t.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./6WPQPRJ5.js").then(t=>t.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./VDZT4UXB.js").then(t=>t.default)});async function St(t){let e=Object.entries(gp).find(([r])=>r.endsWith(`/${t}.md`));if(!e)throw new Error(`Prompt not found: ${t}
78
+ Available prompts:
79
+ ${Object.keys(gp).join(`
80
+ `)}`);return await e[1]()}var Kn=(t,e)=>{let r=t?.configurable?.services?.[e];if(r==null)throw new Error(`${e} missing in config.configurable.services`);return r};async function o_(t){let{fields:e,layer:r,view:n,styleName:o,colorSchemeTags:s}=t,i;return s?i=Hg({basemapTheme:await mp(n),geometryType:r.geometryType,includedTags:s,numColors:Math.min(e.length,8)})[0]:i=Vg({basemapTheme:await mp(n),geometryType:r.geometryType,numColors:Math.min(e.length,8)}).primaryScheme,{layer:r,view:n,attributes:e.map(a=>({field:a,label:r.fields.find(c=>c.name===a)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:o.includes("Size"),pieChartScheme:i}}async function s_(t){return await Wg(t)}async function i_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,includeSize:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:s?"chart-size":"chart",fields:n,layer:a,view:i,colorSchemeTags:o};try{let l=await o_(c),u=await s_(l);return a.renderer=u.renderer,a.visible=!0,`Chart renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying chart renderer: ${l instanceof Error?l.message:String(l)}`}}var a_=["mapView"];function Oe(t){let e=t?.configurable?.context;if(!e||typeof e!="object")throw new Error("LayerStylingAgent context missing");let r=a_.filter(n=>!(n in e));if(r.length)throw new Error(`LayerStylingAgent context missing: ${r.join(", ")}`);return e}async function l_({layerId:t,fields:e,colorSchemes:r,includeSize:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await i_({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,includeSize:n})}var c_=d.object({layerId:d.string().describe("The id of the layer to apply the chart renderer to"),fields:d.array(d.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),u_=N(l_,{name:"chart",description:`Label: Charts
81
+ Description: Show the values of two or more categories as a proportion of the total using a pie chart.
82
+ Keywords: pie, chart, all categories, breakdown, proportion
83
+ Example: Show the total number of homes built in each decade using a pie chart for each feature.
84
+ Fields: This style requires 2-8 number fields.
85
+
86
+ Label: Charts and Size
87
+ Description: Show the values of two or more categories as a proportion of the total using a pie chart and use size to capture the total amount or magnitude.
88
+ Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
89
+ Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
90
+ Fields: This style requires 2-8 number fields.`,schema:c_});function d_(t){let{fields:e,layer:r,view:n,theme:o,colorSchemeTags:s}=t,i=e[0],a;return s&&(a=sl({geometryType:r.geometryType,includedTags:s,theme:o||"high-to-low"})[0]),{layer:r,view:n,startTime:i,endTime:new Date,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:a}}async function p_(t){return await Gg(t)}async function m_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"color-age",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=d_(c),u=await p_(l);return a.renderer=u.renderer,a.visible=!0,`Color-age renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying color-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function f_({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await m_({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var h_=d.object({layerId:d.string().describe("The id of the layer to apply the color-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),g_=N(f_,{name:"color-age",description:`Label: Age (color)
91
+ Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
92
+ Keywords: since, age, how old, how long
93
+ Example: Show the age of each feature based on its reported date.
94
+ Fields: This style requires at least one field with a date type.`,schema:h_});function y_(t){let{fields:e,layer:r,view:n,colorSchemeTags:o}=t,{theme:s}=t,i=e[1],a=e[0],c;return o&&(c=sl({geometryType:r.geometryType,includedTags:o,theme:s||"high-to-low"})[0]),{layer:r,view:n,field:a,normalizationField:i,theme:s,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:c}}async function __(t){return await Jg(t)}async function w_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"color",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=y_(c),u=await __(l);return a.renderer=u.renderer,a.visible=!0,`Color renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying color renderer: ${l instanceof Error?l.message:String(l)}`}}async function b_({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await w_({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var A_=d.object({layerId:d.string().describe("The id of the layer to apply the color renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the color renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),x_=N(b_,{name:"color",description:`Label: Counts and Amounts (color)
95
+ Description: Vary color along a continuous color ramp to represent numeric or ranked data.
96
+ Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
97
+ Example: Color each feature based on the population density.
98
+ Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:A_});function v_(t){let{fields:e,layer:r,view:n,colorSchemeTags:o,theme:s}=t,i,a,c=e[0];return o&&(a=sl({geometryType:r.geometryType,includedTags:o,theme:s||"high-to-low"})[0]),{layer:r,view:n,field:c,normalizationField:i,theme:s,colorOptions:{colorScheme:a}}}async function I_(t){return await Zg(t)}async function T_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"color-size-univariate",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=v_(c),u=await I_(l);return a.renderer=u.renderer,a.visible=!0,`Color-size-univariate renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying color-size-univariate renderer: ${l instanceof Error?l.message:String(l)}`}}async function S_({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await T_({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var E_=d.object({layerId:d.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:d.array(d.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),C_=N(S_,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
99
+ Description: Vary symbol size and color based on the values of two numeric attributes.
100
+ Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
101
+ Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
102
+ Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:E_});function k_(t){let{fields:e,layer:r,view:n,colorSchemeTags:o}=t,s;return o&&(s=Yg({includedTags:o,numColors:Math.min(e.length,8)})[0]),{layer:r,view:n,legendOptions:{unit:"units"},attributes:e.map(i=>({field:i,label:r.fields.find(a=>a.name===i)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,dotDensityScheme:s}}async function O_(t){return await Qg(t)}async function P_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o}){let s=e,i=t?.allLayers.find(c=>c.id===r);if(!i)return`Could not find layer for id: ${r}`;let a={styleName:"dot-density",fields:n,layer:i,view:s,colorSchemeTags:o};try{let c=k_(a),l=await O_(c);return i.renderer=l.renderer,i.visible=!0,`Dot Density renderer applied to layer: ${i.title??i.id} using fields ${n.join(", ")}`}catch(c){return`Error applying dot density renderer: ${c instanceof Error?c.message:String(c)}`}}async function M_({layerId:t,fields:e,colorSchemes:r},n){let{mapView:o}=Oe(n);return await ge({type:"show-legend",data:{layerIds:[t]}},n),await P_({arcgisMap:o.map,arcgisMapView:o,layerId:t,fields:e,colorSchemes:r})}var R_=d.object({layerId:d.string().describe("The id of the layer to apply the dot density renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),$_=N(M_,{name:"dot-density",description:`Dot Density
103
+ Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
104
+ **Use cases:**
105
+ - Population distribution visualization
106
+ - Comparing multiple categories within areas
107
+ - Showing spatial distribution patterns
108
+ **Examples:**
109
+ - Show the density of the population based on various race/ethnic groups
110
+ - Visualize distribution of different crops across regions
111
+ - Display demographic patterns within census tracts
112
+ **Fields:** Requires 2-8 number fields.
113
+ **Keywords:** density, how much, how many, total, number, amount`,schema:R_});function N_(t){let{fields:e,layer:r,view:n,colorSchemeTags:o}=t,s,i=e[0];return o&&(s=ey({includedTags:o,basemap:n.map?.basemap||"topo"})[0]),{layer:r,view:n,field:i,heatmapScheme:s}}async function L_(t){return await Xg(t)}async function D_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o}){let s=e,i=t?.allLayers.find(c=>c.id===r);if(!i)return`Could not find layer for id: ${r}`;let a={styleName:"heatmap",fields:n,layer:i,view:s,colorSchemeTags:o};try{let c=N_(a),l=await L_(c);return i.renderer=l.renderer,i.visible=!0,`Heatmap renderer applied to layer: ${i.title??i.id} using fields ${n.join(", ")}`}catch(c){return`Error applying heatmap renderer: ${c instanceof Error?c.message:String(c)}`}}async function F_({layerId:t,fields:e,colorSchemes:r},n){let{mapView:o}=Oe(n);return await ge({type:"show-legend",data:{layerIds:[t]}},n),await D_({arcgisMap:o.map,arcgisMapView:o,layerId:t,fields:e,colorSchemes:r})}var j_=d.object({layerId:d.string().describe("The id of the layer to apply the heatmap renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),z_=N(F_,{name:"heatmap",description:`Label: Heat Map
114
+ Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
115
+ Keywords: density, heatmap, hot spots, pattern, cluster
116
+ Example: Create a heatmap
117
+ Fields: This typically requires zero or one field of type number.`,schema:j_});function U_(t){let{fields:e,layer:r,view:n,styleName:o,colorSchemeTags:s}=t,i;return s&&(i=ry({geometryType:r.geometryType,includedTags:s,numColors:Math.min(e.length,10)})[0]),{layer:r,view:n,fields:e.map(a=>({name:a})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:o.includes("Size"),predominanceScheme:i}}async function q_(t){return await ty(t)}async function B_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,includeSize:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:s?"predominance-size":"predominance",fields:n,layer:a,view:i,colorSchemeTags:o};try{let l=U_(c),u=await q_(l);return a.renderer=u.renderer,a.visible=!0,`Predominance renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying predominance renderer: ${l instanceof Error?l.message:String(l)}`}}async function K_({layerId:t,fields:e,colorSchemes:r,includeSize:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await B_({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,includeSize:n})}var W_=d.object({layerId:d.string().describe("The id of the layer to apply the predominance renderer to"),fields:d.array(d.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),includeSize:d.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),H_=N(K_,{name:"predominance",description:`Label: Predominant category
118
+ Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
119
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
120
+ Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
121
+ Fields: This style relies on 2-10 number fields.
122
+
123
+ Label: Predominant category and Size
124
+ Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value. Also varies the size of each symbol based on the total of all categories.
125
+ Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
126
+ Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
127
+ Fields: This style relies on 2-10 number fields.`,schema:W_});function V_(t){let{fields:e,layer:r,view:n,colorSchemeTags:o}=t,s,i={field:e[0]},a={field:e[1]};return o&&(s=oy({geometryType:r.geometryType,includedTags:o})[0]),{layer:r,view:n,field1:i,field2:a,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:s}}async function G_(t){return await ny(t)}async function J_({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o}){let s=e,i=t?.allLayers.find(c=>c.id===r);if(!i)return`Could not find layer for id: ${r}`;let a={styleName:"relationship",fields:n,layer:i,view:s,colorSchemeTags:o};try{let c=V_(a),l=await G_(c);return i.renderer=l.renderer,i.visible=!0,`Relationship renderer applied to layer: ${i.title??i.id} using fields ${n.join(", ")}`}catch(c){return`Error applying relationship renderer: ${c instanceof Error?c.message:String(c)}`}}async function Z_({layerId:t,fields:e,colorSchemes:r},n){let{mapView:o}=Oe(n);return await ge({type:"show-legend",data:{layerIds:[t]}},n),await J_({arcgisMap:o.map,arcgisMapView:o,layerId:t,fields:e,colorSchemes:r})}var Q_=d.object({layerId:d.string().describe("The id of the layer to apply the relationship renderer to"),fields:d.array(d.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use")}),Y_=N(Z_,{name:"relationship",description:`Label: Relationship
128
+ Description: Overlays two color ramps to represent the relationship between two numeric attributes.
129
+ Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
130
+ Example: Show the relationship between tree height and carbon storage
131
+ Fields: This style requires two number fields.`,schema:Q_});function X_(t){let{fields:e,layer:r,view:n,theme:o}=t,s=e[0];return{layer:r,view:n,startTime:s,endTime:new Date,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function ew(t){return await sy(t)}async function tw({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"size-age",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=X_(c),u=await ew(l);return a.renderer=u.renderer,a.visible=!0,`Size-age renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying size-age renderer: ${l instanceof Error?l.message:String(l)}`}}async function rw({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await tw({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var nw=d.object({layerId:d.string().describe("The id of the layer to apply the size-age renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),ow=N(rw,{name:"size-age",description:`Label: Age (size)
132
+ Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
133
+ Keywords: since, age, how old, how long
134
+ Example: Change the size of features so older features are larger than new features.
135
+ Fields: This style requires at least one field with a date type.`,schema:nw});function sw(t){let{fields:e,layer:r,view:n}=t,{theme:o}=t,s=e[1],i=e[0];return{layer:r,view:n,field:i,normalizationField:s,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function iw(t){return await iy(t)}async function aw({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"size",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=sw(c),u=await iw(l);return a.renderer=u.renderer,a.visible=!0,`Size renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying size renderer: ${l instanceof Error?l.message:String(l)}`}}async function lw({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await aw({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var cw=d.object({layerId:d.string().describe("The id of the layer to apply the size renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),uw=N(lw,{name:"size",description:`Label: Counts and Amounts (size)
136
+ Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
137
+ Keywords: graduated size, proportional size, how much, total, number, amount, size
138
+ Example: Vary the size of each point based on the total population.
139
+ Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.
140
+
141
+ Label: Continuous Timeline (size)
142
+ Description: Vary symbol sizes along a continuous ramp to represent dates.
143
+ Keywords: graduated size, proportional size, classed size, how much, total, number, when
144
+ Example: Vary the size of each feature based on the date a ticket was completed.
145
+ Fields: This style requires a single field with a date type.`,schema:cw});function dw(t){let{fields:e,layer:r,view:n,colorSchemeTags:o}=t,s=e[0],i=e[1],a=e[2],c;return o&&(c=ly({geometryType:r.geometryType,includedTags:o})[0]),{layer:r,view:n,field:s,field2:i,field3:a,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:c}}async function pw(t){return await ay(t)}async function mw({arcgisMap:t,arcgisMapView:e,layerId:r,fields:n,colorSchemes:o,theme:s}){let i=e,a=t?.allLayers.find(l=>l.id===r);if(!a)return`Could not find layer for id: ${r}`;let c={styleName:"type",fields:n,layer:a,view:i,colorSchemeTags:o,theme:s};try{let l=dw(c),u=await pw(l);return a.renderer=u.renderer,a.visible=!0,`Type renderer applied to layer: ${a.title??a.id} using fields ${n.join(", ")}`}catch(l){return`Error applying type renderer: ${l instanceof Error?l.message:String(l)}`}}async function fw({layerId:t,fields:e,colorSchemes:r,theme:n},o){let{mapView:s}=Oe(o);return await ge({type:"show-legend",data:{layerIds:[t]}},o),await mw({arcgisMap:s.map,arcgisMapView:s,layerId:t,fields:e,colorSchemes:r,theme:n})}var hw=d.object({layerId:d.string().describe("The id of the layer to apply the type renderer to"),fields:d.array(d.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:d.array(d.string()).optional().describe("Optional color scheme tags to use"),theme:d.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),gw=N(fw,{name:"type",description:`Label: Types (unique symbols)
146
+ Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
147
+ Keywords: categorical, category, type, unique, discrete, point of interest, region, group
148
+ Example: Color each feature based on the region it belongs to
149
+ Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:hw}),yw=S.Root({...Tt(),vectorSearchLayerIds:S(),vectorSearchFieldResults:S(),layerFieldInfo:S(),selectedLayerId:S()}),_w=S.Root({...Tt(),vectorSearchLayerIds:S(),vectorSearchFieldResults:S(),layerFieldInfo:S(),queryResponse:S(),dataExplorationMessages:S({reducer:eo,default:()=>[]})}),ww=["mapView"];function Et(t){let e=t?.configurable?.context;if(!e||typeof e!="object")throw new Error("DataExplorationAgent context missing");let r=ww.filter(n=>!(n in e));if(r.length)throw new Error(`DataExplorationAgent context missing: ${r.join(", ")}`);return e}var bw=t=>{let e=t.map?.allLayers.filter(n=>n.type==="feature"),r=0;return e?.forEach(n=>{let o=n;o.featureEffect&&(o.featureEffect=null,r++)}),r>0?`Cleared filters from ${r} layer(s). View unchanged.`:"No active filters to clear. View unchanged."},Aw=async(t,e)=>{let{mapView:r}=Et(e);return bw(r)},pH=N(Aw,{name:"clearFilters",description:"Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",schema:d.object({})}),xw=async t=>{t.map?.allLayers.filter(r=>r.type==="feature")?.forEach(r=>{let n=r;n.featureEffect&&(n.featureEffect=null)});let e=t.map.initialViewProperties?.viewpoint?.targetGeometry;return e?(await t.goTo(e),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},vw=async(t,e)=>{let{mapView:r}=Et(e);return await xw(r)},mH=N(vw,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:d.object({})}),yp=750;function Ys(t){return"point"in t&&t.point!==void 0}function $o(t){return"layerId"in t&&t.layerId!==void 0}var ti=async(t,e)=>{if(Ys(t)){let{point:r}=t;return{geometry:new wp({x:r.x,y:r.y,spatialReference:r.spatialReference?{wkid:r.spatialReference.wkid}:e.spatialReference})}}if($o(t)){let r=e.map?.allLayers.find(s=>s.id===t.layerId);if(!r)return{error:`Could not find geometry layer with ID: ${t.layerId}`};let n=r.title??r.id,o=t.where?.trim()||"1=1";try{let s=await r.queryFeatures({where:o,returnGeometry:!0,outSpatialReference:e.spatialReference,num:yp+1});if(!s.features.length)return{error:`No features found in geometry layer "${n}" with the specified where clause: ${o}`};if(s.features.length>yp)return{error:`Geometry filter for layer "${n}" matched too many features (${s.features.length}+). Please narrow the geometry layer filter.`};let i=s.features.map(c=>c.geometry).filter(c=>!!c);if(!i.length)return{error:"No valid geometries found for the matched geometry layer features."};let a=i.length===1?i[0]:Ap.executeMany(i);return a?(a.spatialReference||(a.spatialReference=e.spatialReference),{geometry:a}):{error:"Failed to combine geometries from geometry layer."}}catch(s){return{error:`Failed to query geometry: ${String(s)}`}}}return{error:"Invalid geometry configuration provided"}},Iw=async(t,e,r,n,o,s)=>{let i=t.map?.allLayers.find(c=>c.id===e);if(!i)return{success:!1,error:`Layer '${e}' not found.`};let a=i.createQuery();a.where=r??"1=1",n&&(a.geometry=n,a.spatialRelationship="intersects",o&&(a.distance=o),s&&(a.units=s));try{let{extent:c,count:l}=await i.queryExtent(a);return!c||l===0?{success:!1,error:`No features found for filter (where: ${a.where}${n?", spatial filter used":""})`}:(await t.goTo(c),{success:!0})}catch(c){return{success:!1,error:c instanceof Error?c.message:String(c)}}},Tw=async(t,e,r,n,o,s)=>{let i=e.map?.allLayers.find(m=>m.id===t.layerId);if(!i)return`Could not find target layer with ID: ${t.layerId}`;let a;if(o){let m=await ti(o,e);if("error"in m)return m.error;a=m.geometry}if(i.featureEffect=null,i.featureEffect=new cy({filter:new bp({...t.objectIds?.length?{objectIds:t.objectIds}:{where:t.where},geometry:a,spatialRelationship:"intersects",distance:o?.distance,units:o?.units}),includedEffect:r,excludedEffect:n}),i.visible=!0,s)return`Applied feature effects to "${i.title??t.layerId}" within current map extent.`;let c=t.objectIds?.length?`${i.objectIdField} IN (${t.objectIds.join(",")})`:t.where,l=await Iw(e,t.layerId,c,a,o?.distance,o?.units),u=i.title??t.layerId;return l.success?`Applied feature effects to target layer "${i.title??t.layerId}"${o&&"layerId"in o?` using geometry from layer "${o.layerId}"`:""}.`:`Applied filter to "${u}" but no features matched. ${l.error}`},Sw=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],Ct=d.enum(Sw),Ew=async({targetLayer:t,geometryFilter:e,useCurrentExtent:r,includedEffect:n="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:o="grayscale(100%) opacity(60%) blur(2px)"},s)=>{let{mapView:i}=Et(s);return await Tw(t,i,n,o,e,r)},Cw=d.object({layerId:d.string().describe("The layerId of the layer containing the geometry by which to filter."),where:d.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:d.number().optional().describe("The buffer distance around the geometry."),units:Ct.optional().describe("The units for the distance buffer.")}),kw=d.object({point:d.object({x:d.number().describe("X coordinate (longitude) from navigation result"),y:d.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:d.object({wkid:d.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:d.number().optional().describe("Optional buffer distance around the point."),units:Ct.optional().describe("The units for the distance buffer.")}),Ow=d.object({targetLayer:d.object({layerId:d.string().describe("The layerId of the layer on which to set a feature effect."),where:d.string().describe("The SQL-92 where clause representing the features to emphasize."),objectIds:d.array(d.number()).optional().describe("Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause.")}),geometryFilter:d.union([Cw,kw]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),useCurrentExtent:d.boolean().optional().describe("Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."),includedEffect:d.string().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:d.string().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),fH=N(Ew,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:Ow}),Qa=t=>{if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"&&Number.isFinite(t)){let e=new Date(t);return Number.isNaN(e.getTime())?null:e}return null},Pw=t=>!t||t==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:t==="unknown"?"UTC":t,Mw=t=>{if(typeof t=="string"&&t)return t;let e=Qa(t);return e?e.toISOString().slice(0,10):null};var Rw=(t,e,r)=>{let n=e?.toLowerCase();if(n==="date-only"){let s=Mw(t);return s?uy(s,Gs("short-date")):t}if(n==="time-only"){if(typeof t=="string"&&t)return dy(t,Gs("long-time"));let s=Qa(t);return s?fp(s,{...Gs("long-time"),timeZone:"UTC"}):t}let o=Qa(t);return o?fp(o,{...Gs("short-date-short-time"),timeZone:Pw(r)}):t},vp=(t,e,r)=>{if(t&&typeof t!="function"){let n="getField"in r&&r.getField?.(t),o=n&&"getFieldDomain"in r&&r.getFieldDomain?r.getFieldDomain(n.name):null;if(o?.type==="coded-value"){let s=o.codedValues.find(i=>i.code===e);return s?s.name:null}}return null},$w=t=>!t||t==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:t==="unknown"?"UTC":t,Nw=t=>{if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;if(typeof t=="number"&&Number.isFinite(t)){let e=new Date(t);return Number.isNaN(e.getTime())?null:e}if(typeof t=="string"&&t){let e=new Date(t);return Number.isNaN(e.getTime())?null:e}return null},Lw=(t,e)=>{if(typeof t!="number")return t;let r={};e.minimumFractionDigits!==void 0&&(r.minimumFractionDigits=e.minimumFractionDigits),e.maximumFractionDigits!==void 0&&(r.maximumFractionDigits=e.maximumFractionDigits),e.useGrouping==="always"?r.useGrouping=!0:e.useGrouping==="never"&&(r.useGrouping=!1);try{return new Intl.NumberFormat(void 0,r).format(t)}catch{return t}},Dw=(t,e,r)=>{let n=Nw(t);if(!n)return t;let o={};e.dateStyle?o.dateStyle=e.dateStyle:(e.year&&(o.year=e.year),e.month&&(o.month=e.month)),e.timeStyle&&(o.timeStyle=e.timeStyle),e.timeStyle&&e.hour12==="always"?o.hour12=!0:e.timeStyle&&e.hour12==="never"&&(o.hour12=!1),o.timeZone=$w(r);try{return new Intl.DateTimeFormat(void 0,o).format(n)}catch{return t}},Ip=(t,e)=>t.getFieldAlias?.(e)??t.fieldsIndex?.get(e)?.alias??t.fieldsIndex?.get(e)?.name??e,Tp=(t,e,r,n,o)=>{if(r==null)return r;let s=t.getFieldConfiguration?.(e)?.fieldFormat;return s?.type==="number"?Lw(r,s):s?.type==="date-time"?Dw(r,s,o):Rw(r,n,o)},Fw=(t,e,r,n)=>{let o=t.fieldsIndex?.get(e),s=vp(e,r,t)??r;return Tp(t,e,s,o?.type,n)},jw=(t,e)=>Ip(t,e),Sp=(t,e,r)=>{let n=t.objectIdField,o=e.features.map(i=>i.attributes[n]),s=e.features.map(i=>{let a=i.attributes,c={};return t.fields.forEach(l=>{if(!Object.hasOwn(a,l.name))return;let u=a[l.name];if(l.name===n){c[l.name]=u;return}let m=vp(l.name,u,t)??u,f=Ip(t,l.name);c[f]=Tp(t,l.name,m,l.type,r)}),c});return{objectIds:o,attributes:s}},zw=(t,e,r)=>{let n=t.createQuery();return n.outFields=[e],n.where=r||"1=1",n.num=1,n},Uw=async(t,e,r,n)=>{let o=n.map?.allLayers.find(u=>u.id===t),s=zw(o,e,r.where),i=(await o.queryFeatures(s)).features[0],a=i?i.attributes[e]:null,c=Fw(o,e,a,n.timeZone),l=jw(o,e);return{tool:"getAttribute",layerName:o.title??t,summary:`${l} = ${c}`,details:{fieldName:e,fieldAlias:l!==e?l:void 0,value:c,where:r.where}}};async function qw({layerId:t,fieldName:e,query:r},n){let{mapView:o}=Et(n),s=await Uw(t,e,r,o);return JSON.stringify(s,null,2)}var Bw=d.object({layerId:d.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:d.string().describe("The name of the field/attribute from which to get a field value."),query:d.object({where:d.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Kw=N(qw,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:Bw}),il=(t,e,r)=>r?t.hasAllFeaturesInView&&t.availableFields===e:t.hasAllFeatures&&t.availableFields===e;function Xs(t,e){let r=t??"";return e!=null&&e&&(r=r?`(${r}) AND (${e})`:e),r||null}var Ww=async t=>{let{targetLayer:e,fieldName:r,statisticType:n,mapView:o,layersAndFieldsRegistry:s,geometryFilter:i}=t,a=o.map?.allLayers.find(y=>y.id===e.layerId);if(!a)throw new Error(`Layer '${e.layerId}' not found.`);let c=await o.whenLayerView(a),l=s.get(e.layerId)?.fieldRegistry.get(r),u=l?.alias;if(!l)throw new Error(`Field '${r}' not found.`);let m,f;if(i){let y=await ti(i,o);if("error"in y)throw new Error(y.error);if(!y.geometry)throw $o(i)?new Error(`No features found matching: ${i.where}`):new Error("Failed to create geometry");if($o(i)){let v=o.map?.allLayers.find(C=>C.id===i.layerId);m={geometryLayerName:v?.title??v?.id,geometryLayerId:i.layerId,geometryWhere:i.where,distance:i.distance,units:i.units,applied:!0}}else Ys(i)&&(m={point:i.point,distance:i.distance,units:i.units,applied:!0});f=new bp({geometry:y.geometry,distance:i.distance,units:i.units,spatialRelationship:"intersects"})}let h=il(c,[r],!1),b=null,A=null,E=10;if(l.type!=="geometry"&&l.type!=="oid"&&l.type!=="global-id")try{let y={layer:a,useFeaturesInView:h,view:h?o:void 0,field:r,sqlWhere:Xs(a.definitionExpression,e.where),...f&&{filter:f},outStatisticTypes:{include:[n]}};b=await py(y);let v=["string","small-integer","integer"],C=l.domain?.type==="coded-value"?l.domain:null;(v.includes(l.type)||C)&&(A=(await my({layer:a,useFeaturesInView:h,view:h?o:void 0,field:r,sqlWhere:Xs(a.definitionExpression,e.where),...f&&{filter:f}})).uniqueValueInfos.sort((L,B)=>B.count-L.count).slice(0,E)),A&&l.domain?.type==="coded-value"&&(A=A.map(L=>({...L,value:C?C.getName(L.value)??L.value:L.value})))}catch(y){console.error("Statistics error:",y)}return{tool:"getStatistics",layerName:a.title??e.layerId,summary:`${n} = ${typeof b?.[n]=="number"?b[n]:"N/A"}`,details:{fieldName:r,fieldAlias:u,statisticType:n,statistic:b?.[n]??null,summaryStatistics:b,uniqueValues:A,where:e.where,spatialFilterInfo:m}}};async function Hw({targetLayer:t,fieldName:e,statisticType:r,geometryFilter:n},o){let s=Kn(o,"layersAndFieldsRegistry"),{mapView:i}=Et(o),a=await Ww({targetLayer:t,fieldName:e,statisticType:r,mapView:i,layersAndFieldsRegistry:s,geometryFilter:n});return JSON.stringify(a,null,2)}var Vw=d.object({layerId:d.string().describe("The layerId of the layer containing the geometry by which to filter."),where:d.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:d.number().optional().describe("The buffer distance around the geometry."),units:Ct.optional().describe("The units for the distance buffer.")}),Gw=d.object({point:d.object({x:d.number().describe("X coordinate (longitude) from navigation result"),y:d.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:d.object({wkid:d.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:d.number().optional().describe("Optional buffer distance around the point."),units:Ct.optional().describe("The units for the distance buffer.")}),Jw=d.object({targetLayer:d.object({layerId:d.string().describe("The layerId of the layer containing the field from which to get a value."),where:d.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:d.union([Vw,Gw]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),fieldName:d.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:d.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Zw=N(Hw,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
150
+
151
+ USE THIS TOOL FOR:
152
+ - "What is the average/maximum/minimum/total [field]?" \u2014 aggregate computations
153
+ - "Most common/frequent value of [field]?" \u2014 frequency analysis
154
+ - Questions requiring a mathematical aggregation across many features
155
+
156
+ DO NOT USE FOR:
157
+ - "How many features match X?" \u2014 use queryFeatures instead (it returns totalCount)
158
+ - "Show / list / find features" \u2014 use queryFeatures instead
159
+ - Simple counts of features matching a condition \u2014 use queryFeatures instead
160
+
161
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:Jw}),Qw=async(t,e,r,n,o)=>{let s=r.map?.allLayers.find(f=>f.id===t.layerId),i=await r.whenLayerView(s),a=s.title??t.layerId,c;if(n){let f=await ti(n,r);if("error"in f)return{tool:"getTopFeatures",layerName:a,summary:"Geometry lookup failed",details:{error:f.error}};if(!f.geometry)return{tool:"getTopFeatures",layerName:a,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in n?n.where:"unknown criteria"}`}};c=f.geometry}else o&&(c=r.extent.clone());let l=e.groupByFields&&e.groupByFields.length>0,u=s.objectIdField,m=t.outFields.includes("*")?["*"]:[...new Set([...t.outFields,u])];try{let f;if(l){let A=new fy({where:t.where||"1=1",outFields:m,orderByFields:t.orderByFields,geometry:c,spatialRelationship:c?"intersects":void 0,distance:n?.distance,units:n?.units,topFilter:new hy({topCount:e.topCount,groupByFields:e.groupByFields,orderByFields:e.orderByFields})});f=await s.queryTopFeatures(A)}else{let A=s.createQuery();A.where=Xs(s.definitionExpression,t.where||"1=1"),A.outFields=m.length?m:["*"],A.orderByFields=e.orderByFields,A.num=e.topCount,c&&(A.geometry=c,A.spatialRelationship="intersects"),n?.distance&&(A.distance=n.distance),n?.units&&(A.units=n.units),A.outSpatialReference=r.spatialReference;let E=il(i,t.outFields,o??!1);try{f=E?await i.queryFeatures(A):await s.queryFeatures(A)}catch(y){console.warn("Client-side query failed, falling back to server:",y),f=await s.queryFeatures(A)}}let h=f.features.map(A=>A.attributes[u]),{attributes:b}=Sp(s,f,r.timeZone);return{tool:"getTopFeatures",layerName:a,summary:`Top ${e.topCount} features extracted`,details:{topCount:e.topCount,attributes:b,objectIds:h,objectIdField:u,where:t.where,orderByFields:e.orderByFields,...l&&{groupByFields:e.groupByFields}}}}catch(f){return{tool:"getTopFeatures",layerName:a,summary:"Query failed",details:{error:f instanceof Error?f.message:String(f)}}}},Yw=async({targetLayer:t,topFilter:e,geometryFilter:r,useCurrentExtent:n},o)=>{let{mapView:s}=Et(o),i=await Qw(t,e,s,r,n);return JSON.stringify(i,null,2)},Xw=d.object({layerId:d.string().describe("The layerId of the layer containing the geometry by which to filter."),where:d.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:d.number().optional().describe("The buffer distance around the geometry."),units:Ct.optional().describe("The units for the distance buffer.")}),eb=d.object({point:d.object({x:d.number().describe("X coordinate (longitude) from navigation result"),y:d.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:d.object({wkid:d.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:d.number().optional().describe("Optional buffer distance around the point."),units:Ct.optional().describe("The units for the distance buffer.")}),tb=d.object({targetLayer:d.object({layerId:d.string().describe("The layerId of the layer containing the field from which to get a value."),where:d.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:d.array(d.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:d.array(d.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:d.union([Xw,eb]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),topFilter:d.object({topCount:d.number().describe("Number of top features to return per group."),orderByFields:d.array(d.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:d.array(d.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:d.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),rb=N(Yw,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:tb}),Za=25,nb=async(t,e,r,n)=>{let o=e.map?.allLayers.find(A=>A.id===t.layerId),s=await e.whenLayerView(o),i=o.title??t.layerId,a;if(r){let A=await ti(r,e);if("error"in A){let E={error:A.error};if($o(r)){let y=e.map?.allLayers.find(v=>v.id===r.layerId);E.geometryLayerName=y?.title??y?.id,E.geometryLayerId=r.layerId,E.geometryWhere=r.where}else Ys(r)&&(E.point=r.point);return{tool:"queryFeatures",layerName:i,summary:"Geometry lookup failed",details:E}}if(!A.geometry){let E={};if($o(r)){let y=e.map?.allLayers.find(v=>v.id===r.layerId);E.error=`No features found matching: ${r.where}`,E.geometryLayerName=y?.title??y?.id,E.geometryLayerId=r.layerId,E.geometryWhere=r.where}else Ys(r)&&(E.error="Failed to create point geometry",E.point=r.point);return{tool:"queryFeatures",layerName:i,summary:"No features found for geometry filter",details:E}}a=A.geometry}else n&&(a=e.extent.clone());let c=il(s,t.outFields,n??!1),l=o.objectIdField,u=o.createQuery();u.where=Xs(o.definitionExpression,t.where||"1=1"),u.outFields=t.outFields.includes("*")?["*"]:[...new Set([...t.outFields,l])],u.orderByFields=t.orderByFields,a&&(u.geometry=a,u.spatialRelationship="intersects"),r?.distance&&(u.distance=r.distance),r?.units&&(u.units=r.units),u.outSpatialReference=e.spatialReference;let m,f;try{m=c?await s.queryFeatureCount(u):await o.queryFeatureCount(u),m>0&&m<=Za&&(f=c?await s.queryFeatures(u):await o.queryFeatures(u))}catch(A){console.warn("Client-side query failed, falling back to server:",A),m=await o.queryFeatureCount(u),m>0&&m<=Za&&(f=await o.queryFeatures(u))}let{objectIds:h,attributes:b}=f?Sp(o,f,e.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:i,summary:`${m} features found`,details:{totalCount:m,where:t.where,orderByFields:t.orderByFields,outFields:t.outFields,...h&&{objectIds:h,objectIdField:l},...b&&{attributes:b},...m>Za&&{note:`${m} features found.`}}}};async function ob({targetLayer:t,geometryFilter:e,useCurrentExtent:r},n){let{mapView:o}=Et(n),s=await nb(t,o,e,r);return JSON.stringify(s,null,2)}var sb=d.object({layerId:d.string().describe("The layerId of the layer containing the geometry by which to filter."),where:d.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:d.number().optional().describe("The buffer distance around the geometry."),units:Ct.optional().describe("The units for the distance buffer.")}),ib=d.object({point:d.object({x:d.number().describe("X coordinate (longitude) from navigation result"),y:d.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:d.object({wkid:d.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:d.number().optional().describe("Optional buffer distance around the point."),units:Ct.optional().describe("The units for the distance buffer.")}),ab=d.object({targetLayer:d.object({layerId:d.string().describe("The layerId of the layer containing the field from which to get a value."),where:d.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:d.array(d.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:d.array(d.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:d.union([sb,ib]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),useCurrentExtent:d.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer).")}),lb=N(ob,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
162
+
163
+ USE THIS TOOL FOR:
164
+ - "Show / display / list features where..." \u2014 finding and listing features
165
+ - "How many X are Y?" \u2014 counting features that match a condition
166
+ - "Which features..." / "Find features..." \u2014 identifying specific features
167
+ - Spatial queries \u2014 finding features near/within/intersecting other features
168
+ - Any question where the user wants to SEE or COUNT matching features
169
+
170
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:ab}),Ep=[Kw,Zw,rb,lb];var hH=new ot(Ep,{handleToolErrors:!1});var cb=S.Root({...Tt(),helpInternalState:S({reducer:Ro,default:()=>({toolCallMessage:void 0})})}),ub=(t,e)=>{let r=Array.from(t.values()).find(({layerItem:s})=>s.title?.toLowerCase().includes(e.toLowerCase()));if(!r){let s=Array.from(t.values()).map(i=>i.layerItem.title).join(", ");return`Could not find a layer matching "${e}". Available layers: ${s}`}let n=Array.from(r.fieldRegistry.values()),o=n.map(s=>`- **${s.alias||s.name}** (\`${s.name}\`, ${s.type})${s.description?`: ${s.description}`:""}`).join(`
171
+ `);return`**${r.layerItem.title}** has ${n.length} field(s):
172
+
173
+ ${o}`},db=async({layerTitle:t},e)=>{let r=Kn(e,"layersAndFieldsRegistry");return ub(r,t)},pb=N(db,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:d.object({layerTitle:d.string().describe("The title or partial title of the layer to list fields for.")})}),mb=S.Root({...Tt(),intent:S({reducer:(t,e)=>e}),arcgisKnowledgeMessages:S({reducer:eo,default:()=>[]}),arcgisKnowledgeToolResult:S({reducer:(t,e)=>e,default:()=>null})}),Js={conversationId:""};function Cp(t){let e=t.map?.allLayers.filter(r=>r.type==="knowledge-graph");if(!e||e?.length!==1)throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.")}function Wn(t){return!!t?.map&&!("activeLinkChartLayer"in t.map)}async function ri(t){!t||Wn(t)||!t.map?.diagramNodesExtent||await t.goTo(t.map.diagramNodesExtent)}function ni(t){let e=t?.configurable?.context;if(!e||typeof e!="object")throw new Error("ArcgisKnowledgeAgent context missing");if(!("view"in e))throw new Error("View context missing");let r=e.view;return r.map&&!("activeLinkChartLayer"in r.map)&&Cp(r),{view:r}}async function Hn(t){let e=t?.configurable?.context;if(fb(t)==="knowledgeGraph")return e;{let r=e.view.map;if(r&&"activeLinkChartLayer"in r){let n=r.knowledgeGraph?.url;if(!n)throw new Error("Knowledge graph url missing from link chart.");return{knowledgeGraph:await hp(n)}}else{Cp(e.view);let n=(e.view.map?.allLayers.find(o=>o.type==="knowledge-graph")).url;if(!n)throw new Error("Knowledge graph url missing from map.");return{knowledgeGraph:await hp(n)}}}}function fb(t){let e=t?.configurable?.context;if(!e||typeof e!="object")throw new Error("ArcgisKnowledgeAgent context missing");if("knowledgeGraph"in e&&"view"in e)throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");if("knowledgeGraph"in e)return"knowledgeGraph";if("view"in e)return"view";throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.")}var Ya=class{constructor(e){this.dataModel=e,this.kind="GraphQueryGenerationRequest",this.explainQuery=!0,this.schemaInformation=ei.fromDataModel(e)}},ei=class t{constructor(){this.schemaType="ArcgisGraphSchema",this.entityTypes=[],this.relationshipTypes=[],this.identifierInfo={mappingInfo:{identifierMapsTo:"UniformPropertyIdentifier",identifierPropertyName:"globalid"}}}static fromDataModel(e){let r=new t;for(let n of e.entityTypes)r.entityTypes.push(No.fromEntityType(n));for(let n of e.relationshipTypes)r.relationshipTypes.push(Xa.fromRelationshipType(n));return r.identifierInfo={mappingInfo:{identifierMapsTo:hb(e.identifierInfo.identifierMappingInfo.identifierInfoType),identifierPropertyName:e.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName}},r.spatialReference=JSON.parse(JSON.stringify(e.spatialReference)),r}static getDataModelTypesSummary(e){let r=e.entityTypes.map(o=>o.name).join(", "),n=e.relationshipTypes.map(o=>o.name).join(", ");return`Entity Types: ${r}.
174
+ Relationship Types: ${n}.`}},No=class t{constructor(){this.name="",this.properties=[]}static fromEntityType(e){let r=new t;r.name=e.name,r.alias=e.alias?e.alias:void 0,r.role=gb(e.role);for(let n of e.properties){let o={name:n.name,alias:n.alias?n.alias:void 0,fieldType:n.fieldType,role:yb(n.role),geometryDef:n.fieldType==="esriFieldTypeGeometry"?{geometryType:n.geometryType??"esriGeometryAny",hasM:n.hasM?n.hasM:void 0,hasZ:n.hasZ?n.hasZ:void 0}:void 0};r.properties.push(o)}return r}},Xa=class extends No{constructor(){super(...arguments),this.observedEndPoints=[]}static fromRelationshipType(e){let r=No.fromEntityType(e);r.observedEndPoints=[];for(let n of e.endPoints)r.observedEndPoints.push({originEntityType:n.originEntityType,destinationEntityType:n.destinationEntityType});return r}},hb=t=>{switch(t){case"esriIdentifierInfoTypeUNSPECIFIED":return"UNSPECIFIED";case"esriIdentifierInfoTypeDatabaseNative":return"DatabaseNative";case"esriIdentifierInfoTypeUniformProperty":return"UniformPropertyIdentifier";default:return t}},gb=t=>{switch(t){case"Regular":return"esriGraphNamedObjectRegular";case"Provenance":return"esriGraphNamedObjectProvenance";case"Document":return"esriGraphNamedObjectDocument";default:return t}};function yb(t){switch(t){case"esriGraphPropertyRegular":return"Regular";case"esriGraphPropertyDocumentName":return"Document_Name";case"esriGraphPropertyDocumentTitle":return"Document_Title";case"esriGraphPropertyDocumentUrl":return"Document_Url";case"esriGraphPropertyDocumentText":return"Document_Text";case"esriGraphPropertyDocumentKeywords":return"Document_Keywords";case"esriGraphPropertyDocumentContentType":return"Document_ContentType";case"esriGraphPropertyDocumentMetadata":return"Document_Metadata";case"esriGraphPropertyDocumentFileExtension":return"Document_FileExtension";case"esriGraphPropertyProvenanceInstanceId":return"Provenance_InstanceId";case"esriGraphPropertyProvenanceSourceType":return"Provenance_SourceType";case"esriGraphPropertyProvenanceSourceName":return"Provenance_SourceName";case"esriGraphPropertyProvenanceSource":return"Provenance_Source";case"esriGraphPropertyProvenanceComment":return"Provenance_Comment";case"esriGraphPropertyProvenanceTypeName":return"Provenance_TypeName";case"esriGraphPropertyProvenancePropertyName":return"Provenance_PropertyName";default:return"Regular"}}function oi(t){return t?.signal}function _b(t,e){return e?`${t}
175
+
176
+ Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
177
+
178
+ Attempt Number: ${e.attemptCount}
179
+ Execution Error: ${e.executionError}
180
+ Failed Query:
181
+ ${e.failedGraphQuery}`:t}async function wb(t,e,r,n){let{graphQuery:o,explanation:s}=await al(t,e,r,n);return{graphQuery:o,explanation:s}}async function al(t,e,r,n,o){let s={message:_b(t,o),context:new Ya(e)};Js.conversationId&&(s.conversationId=Js.conversationId);let i=oi(n);await J({text:"Attempting to generate a cypher query from your prompt..."},n);let a=await pp(`${r}/chat`,{method:"post",body:JSON.stringify(s),headers:{"Content-Type":"application/json",token:dp.findCredential(pr.getDefault().url)?.token??""},signal:i});if(a.httpStatus!==200)throw new Error(`Graph query service returned an error: ${a.httpStatus}`,{cause:a.data});Js.conversationId||(Js.conversationId=a.data.conversationId);let c=!1,l=Date.now(),u=a.data.sequenceNumber,m="",f="",h=1;for(;!c;){await new Promise(A=>setTimeout(A,1e3)),await J({text:`Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,h)}`},n),h=h%3+1;let b=await pp(`${r}/chat`,{method:"post",body:JSON.stringify({conversationId:a.data.conversationId,inquiryId:a.data.inquiryId,ackSequenceNumber:u}),headers:{"Content-Type":"application/json",token:dp.findCredential(pr.getDefault().url)?.token??""},signal:i});if(b.httpStatus!==200)throw new Error(`Graph query service polling returned an error: ${b.httpStatus}`,{cause:b.data});if(b.data.context?.kind){if(b.data.context.kind!=="GraphQueryGenerationResponse")throw new Error(`Unexpected response from graph query service polling. Message: ${b.data.message}`,{cause:b.data});m=b.data.context.graphQuery,f=b.data.message||"",c=!0}else if(!b.data.hasMore)c=!0;else if(Date.now()-l>6e4)throw new Error("Graph query service polling timed out after 1 minute.");u=b.data.sequenceNumber}return{graphQuery:m,explanation:f}}var qn=3;function kp(t,e=100){let r={};for(let n of Object.entries(t.properties??{})){let[o,s]=n;typeof s=="string"&&s.length>e?r[o]=`${s.slice(0,e)}... (truncated, original length: ${s.length})`:r[o]=s}return t.properties=r,t}function Vn(t){return typeof t!="object"||t===null?String(t):"details"in t&&typeof t.details=="object"&&t.details!==null&&"errorMessage"in t.details&&typeof t.details.errorMessage=="string"?t.details.errorMessage:"message"in t&&typeof t.message=="string"?t.message:String(t)}var bb=async({kg:t,queryParams:e,targetStructure:r,targetStructureReducer:n,requestOptions:o,queryRowLimit:s,queryTimeoutMs:i})=>{let a=null,c=r,l=new AbortController,u=o?.signal,m=()=>{l.abort(u?.reason)};u&&(u.aborted?l.abort(u.reason):u.addEventListener("abort",m,{once:!0}));try{let f=await yy(t,e,o);a=f.resultHeader;let h=f.resultRowsStream.getReader(),b=0,A=Date.now(),E=!1;for(;;){let{done:y,value:v}=await h.read();if(y)break;if(!E&&i&&Date.now()-A>i)return l.abort(),{type:"timeout"};for(let C of v){if(b++,s&&b>s)return l.abort(),{type:"success",rowLimitReached:!0,resultHeader:a,processedResult:c};c=n(c,C)}}}catch(f){return l.signal.aborted?{type:"aborted"}:{type:"error",errorMessage:Vn(f),error:f}}finally{u?.removeEventListener("abort",m)}return{type:"success",rowLimitReached:!1,resultHeader:a,processedResult:c}};async function Op({prompt:t,kg:e,graphQueryServiceUrl:r,targetStructure:n,targetStructureReducer:o,requestOptions:s,queryRowLimit:i,queryTimeoutMs:a,config:c}){let l;for(let u=1;u<=qn;u++){let m;try{m=await al(t,e.dataModel,r,c,l)}catch(b){return{type:"generation-error",errorMessage:Vn(b),error:b}}await J({text:`Attempting to execute query: ${m.graphQuery.substring(0,500)}${m.graphQuery.length>500?"...":""}`},c);let f=await bb({kg:e,queryParams:new xp({openCypherQuery:m.graphQuery}),targetStructure:n,targetStructureReducer:o,requestOptions:s,queryRowLimit:i,queryTimeoutMs:a}),h=f.type==="aborted"?"Query execution was aborted.":f.type==="timeout"?"Query execution timed out.":f.type==="error"?`Query failed with error: ${f.errorMessage}`:"";if(f.type==="success")return{type:"success",graphQuery:m.graphQuery,explanation:m.explanation,rowLimitReached:f.rowLimitReached,resultHeader:f.resultHeader,processedResult:f.processedResult};if(f.type==="aborted")return{type:"aborted",errorMessage:h,graphQuery:m.graphQuery,explanation:m.explanation};if(u>=qn)return f.type==="timeout"?{type:"timeout",errorMessage:h,graphQuery:m.graphQuery,explanation:m.explanation}:{type:"execution-error",errorMessage:h,error:f.error,graphQuery:m.graphQuery,explanation:m.explanation};l={failedGraphQuery:m.graphQuery,executionError:h,attemptCount:u},await J({text:`Attempt ${u} failed with error: ${h}. Retrying...`},c)}throw new Error(`Failed to execute generated cypher due to an unexpected error after ${qn} attempts.`)}var Ab=async({kg:t,searchQuery:e,typeCategoryFilter:r,namedTypesFilter:n,searchResultLimit:o,requestOptions:s})=>{let i=[],a=[r];r==="both"&&!t.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth")&&(a=["entity","relationship"]);let c=o??1/0;try{for(let l of a){let u=c-i.length;if(u<=0)break;let m=(await _y(t,new wy({searchQuery:e,typeCategoryFilter:l,namedTypesFilter:n??void 0,num:u}),s)).resultRowsStream.getReader(),f=!1;for(;!f;){let{done:h,value:b}=await m.read();if(h){f=!0;break}for(let A of b)for(let E of A)i.push(E)}}}catch(l){let u=Vn(l);return s?.signal?.aborted?{type:"aborted",errorMessage:u,error:l}:{type:"error",errorMessage:u,error:l}}return{type:"success",results:i}};function xb(t,e){Bn(t,r=>{e.set(`${r.typeName}__${r.id}`,{id:r.id,typeName:r.typeName})})}function Bn(t,e){if(!(!t||typeof t!="object")){if(Ib(t))for(let r of t.path)Bn(r,e);else if(vb(t))e(t);else if(Array.isArray(t))for(let r of t)Bn(r,e);else if(Tb(t))for(let r of Object.values(t.properties??{}))Bn(r,e)}}function vb(t){return!t||typeof t!="object"||Array.isArray(t)?!1:"id"in t&&"typeName"in t}function Ib(t){return!t||typeof t!="object"||Array.isArray(t)?!1:t&&"path"in t&&Array.isArray(t.path)}function Tb(t){return!t||typeof t!="object"||Array.isArray(t)||"id"in t?!1:"properties"in t&&typeof t.properties=="object"}function Sb(t,e){let r=[];for(let n of[...e.dataModel.entityTypes,...e.dataModel.relationshipTypes]){let o=t.getMemberIdsByType(n.name);for(let s of o)r.push({id:s,typeName:n.name})}return r}function Eb(t){let e=[],r=[],n=t?.allLayers.find(o=>o.type==="knowledge-graph")?.inclusionModeDefinition;if(n?.generateAllSublayers)return{allNamedTypesFullyDynamic:!0,idTypePairs:e,dynamicTypes:r};for(let[o,s]of n?.namedTypeDefinitions??[])if(s.useAllData)r.push(o);else for(let[i]of s.members)e.push({id:i,typeName:o});return{allNamedTypesFullyDynamic:!1,idTypePairs:e,dynamicTypes:r}}async function Cb(t,e,r,n,o){let{view:s}=n,i=await Op({prompt:t,kg:e,graphQueryServiceUrl:r,targetStructure:new Map,targetStructureReducer:(m,f)=>{for(let h of f)xb(h,m);return m},requestOptions:{signal:oi(o),timeout:o?.timeout},config:o});if(i.type!=="success"){let m=i.type==="generation-error"?i.errorMessage:`${i.errorMessage} Cypher query: ${i.graphQuery}`;throw new Error(`Failed to add records to the link chart. ${m}`)}let{graphQuery:a,explanation:c,processedResult:l}=i,u=Array.from(l.values());return await J({text:`Query Results parsed into ${u.length} unique relationships and entities. Atempting to add to link chart...`},o),!Wn(s)&&s?.map?(await s.map.addRecords(u),await ri(s),{generatedQuery:a,explanation:c,addedIdTypePairs:u}):(await s?.map?.allLayers.find(m=>m.type==="knowledge-graph")?.addRecords(u),{generatedQuery:a,explanation:c,addedIdTypePairs:u})}var Zs="addRecords",kb=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be run.")}),Ob=async({prompt:t},e)=>{let{knowledgeGraph:r}=await Hn(e),n=ni(e),{view:o}=n,s=pr.getDefault().helperServices,i=t;if(Wn(o)){let a=o.map,{allNamedTypesFullyDynamic:c,idTypePairs:l,dynamicTypes:u}=Eb(a),m=await St("arcgis_knowledge_current_map_context");if(i=`${t}
182
+
183
+ ${m}${JSON.stringify(l)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(u)}`,c)return{toolName:Zs,status:"success",summary:"No records have been added to the map because all data in the knowledge graph is contained in the map.",details:{generatedQuery:"N/A",explanation:"All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",addedIdTypePairs:[]}}}else{let a=o.map,c=await St("arcgis_knowledge_current_lc_context"),l=Sb(a,r);i=`${t}
184
+
185
+ ${c}${JSON.stringify(l)}`}try{let{generatedQuery:a,explanation:c,addedIdTypePairs:l}=await Cb(i,r,`${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,n,e);return{toolName:Zs,status:"success",summary:`Records added successfully. Cypher Query used: ${a}
186
+
187
+ Number of records added: ${l.length}`,details:{generatedQuery:a,explanation:c,addedIdTypePairs:l}}}catch(a){let c=Vn(a);return console.error(`Failed to add records to the link chart. ${c}`,a),{toolName:Zs,status:"error",errorMessage:`Failed to add records to the link chart. ${c}`,error:a}}},Pb=N(Ob,{name:Zs,description:"Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt.",schema:kb});async function Mb(t,e){return await e.map?.applyLayout(t),await ri(e),{appliedLayout:t}}var el="applyLayout",Rb=d.object({layout:d.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),$b=async({layout:t},e)=>{let{view:r}=ni(e);if(Wn(r))return{toolName:el,status:"error",errorMessage:"The applyLayout tool can only be used with a LinkChartView.",error:new Error};{let{appliedLayout:n}=await Mb(t,r);return{toolName:el,status:"success",summary:`Successfully applied layout: ${n}.`,details:{appliedLayout:n}}}},Nb=N($b,{name:el,description:"Apply a diagram layout to the link chart",schema:Rb});async function Lb(t,e){return e.map?.changeNonspatialDataDisplay(t),await ri(e),{appliedNonspatialDataDisplayMode:t}}var tl="changeNonspatialVisibility",Db=d.object({setting:d.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Fb=async({setting:t},e)=>{let{view:r}=ni(e);if(Wn(r))return{toolName:tl,status:"error",errorMessage:"The changeNonspatialVisibility tool can only be used with a LinkChartView.",error:new Error};{let{appliedNonspatialDataDisplayMode:n}=await Lb(t,r);return{toolName:tl,status:"success",summary:`Successfully applied nonspatial visibility setting: ${n}.`,details:{appliedNonspatialDataDisplayMode:n}}}},jb=N(Fb,{name:tl,description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:Db});async function zb(t,e,r,n,o){let s,i="";for(let a=1;a<=qn;a++){let{graphQuery:c,explanation:l}=await al(t,e.dataModel,r,o,s);try{await J({text:`Attempting to create link chart from derived query: ${c}`},o);let u=await gy.fromCypherQuery(e,new xp({openCypherQuery:c}));await J({text:"Link chart created successfully, loading..."},o),await u.load();let m=n.map;return n.map=u,await n.when(),await _p.whenOnce(()=>!n.updating),u.entityCount===0&&u.relationshipCount===0?(n.map===u&&(n.map=m),u.destroy(),{type:"error",errorMessage:`Query returned no results. Cypher Query used to create the link chart:
188
+ ${c}
189
+
190
+ Explanation: ${l}`}):(await ri(n),{type:"success",graphQuery:c,explanation:l})}catch(u){let m=Vn(u);if(a>=qn){i=m;break}s={failedGraphQuery:c,executionError:m,attemptCount:a},await J({text:`Attempt ${a} to create link chart failed with error: ${m}. Retrying ...`},o)}}return{type:"error",errorMessage:`Failed to create link chart after ${qn} attempts. Last error: ${i}`}}var Qs="createLinkChart",Ub=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization.")}),qb=async({prompt:t},e)=>{let{knowledgeGraph:r}=await Hn(e),{view:n}=ni(e);if(Wn(n))return{toolName:Qs,status:"error",errorMessage:"The createLinkChart tool can only be used with a LinkChartView.",error:new Error};{let o=pr.getDefault().helperServices,s=await zb(t,r,`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,n,e);if(s.type==="error")return{toolName:Qs,status:"error",errorMessage:s.errorMessage,error:new Error};let{graphQuery:i,explanation:a}=s;return{toolName:Qs,status:"success",summary:`Link chart created successfully. Cypher Query used to create the link chart:
191
+ ${i}
192
+
193
+ Explanation: ${a}`,details:{generatedQuery:i,explanation:a}}}},Bb=N(qb,{name:Qs,description:"Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt.",schema:Ub}),rl="queryGraphData",Kb=d.object({prompt:d.string().describe(`The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
194
+
195
+ REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
196
+
197
+ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`)}),Wb=async({prompt:t},e)=>{let{knowledgeGraph:r}=await Hn(e),n=pr.getDefault().helperServices,o=await Op({prompt:t,kg:r,graphQueryServiceUrl:`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,targetStructure:new Array,targetStructureReducer:(f,h)=>(f.push(h),f),requestOptions:{signal:oi(e),timeout:e?.timeout},config:e});if(o.type!=="success"){let f=o.type==="generation-error"?o.errorMessage:`${o.errorMessage} Cypher query: ${o.graphQuery}`;return{toolName:rl,status:"error",errorMessage:`Failed to query the knowledge graph. ${f}`,error:"error"in o?o.error:null}}let{graphQuery:s,explanation:i,processedResult:a,resultHeader:c}=o,l=c.headerKeys;for(let f of a)for(let h of f)Bn(h,b=>kp(b));let u=50,m=a.slice(0,u).map(f=>JSON.stringify(f));return{toolName:rl,status:"success",summary:`To answer the inquiry, the following cypher query was executed against the knowledge graph:
198
+
199
+ \`\`\`cypher
200
+ ${s}
201
+ \`\`\`
202
+
203
+ Query Results:
204
+ ${m.length} result(s) found.
205
+
206
+ Column Headers: ${l.join(", ")}
207
+
208
+ ${m.length>u?`Showing top ${u} results:
209
+
210
+ `:`Results:
211
+
212
+ `}${m.join(`
213
+ `)}
214
+ `,details:{generatedQuery:s,explanation:i,resultHeader:c,queryResults:a}}},Hb=N(Wb,{name:rl,description:"Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",schema:Kb}),nl="generateCypher",Vb=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),Gb=async({prompt:t},e)=>{let{knowledgeGraph:r}=await Hn(e),n=pr.getDefault().helperServices;try{let{graphQuery:o,explanation:s}=await wb(t,r.dataModel,`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,e);return{toolName:nl,status:"success",summary:`Generated Graph Query:
215
+ ${o}
216
+
217
+ Explanation: ${s}`,details:{generatedQuery:o,explanation:s}}}catch(o){let s=Vn(o);return{toolName:nl,status:"error",errorMessage:`Failed to generate Cypher query. ${s}`,error:o}}},Jb=N(Gb,{name:nl,description:"Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",schema:Vb}),Zb=t=>{let e=t.dataModel,r=new Map;for(let a of e.searchIndexes)if(a.supportedCategory!=="esriTypeMetaEntityProvenance")for(let[c,l]of a.searchProperties.entries()){let u=r.get(c)??new Set;l.propertyNames.forEach(m=>u.add(m)),r.set(c,u)}let n=e.entityTypes.filter(a=>r.has(a.name)),o=e.relationshipTypes.filter(a=>r.has(a.name)),s=`Entity Types:
218
+ ${n.map(({name:a})=>`${a}: [${Array.from(r.get(a)??[]).join(", ")}]`).join(`
219
+ `)}`,i=`Relationship Types:
220
+ ${o.map(({name:a})=>`${a}: [${Array.from(r.get(a)??[]).join(", ")}]`).join(`
221
+ `)}`;return`${s}
222
+
223
+ ${i}`};async function Qb(t,e){let r=await St("arcgis_knowledge_lucene_generation_prompt"),n={inquiry:t,dataModelForSearch:Zb(e)},o=d.enum(["entity","relationship","both"]).describe("The graph element category to search against - entity, relationship, or both"),s=d.number().int().positive().nullable().describe("The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."),i=d.array(d.enum(e.dataModel.entityTypes.map(c=>c.name).concat(e.dataModel.relationshipTypes.map(c=>c.name)))).min(1),a=d.object({query:d.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),typeFilters:i.nullable().describe("Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"),typeCategoryFilter:o,resultLimit:s});return await Mo({promptText:r,inputVariables:n,schema:a})}var ol="searchGraphData",Yb=d.object({prompt:d.string().describe("The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results.")}),Xb=async({prompt:t},e)=>{let{knowledgeGraph:r}=await Hn(e);await J({text:"Generating search query for the user inquiry"},e);let n=await Qb(t,r);await J({text:"Executing graph search with generated search query"},e);let o=await Ab({kg:r,searchQuery:n.query,typeCategoryFilter:n.typeCategoryFilter,namedTypesFilter:n.typeFilters,searchResultLimit:n.resultLimit,requestOptions:{signal:oi(e),timeout:e?.timeout}});if(o.type!=="success")return{toolName:ol,status:"error",errorMessage:o.errorMessage,error:"error"in o?o.error:null};for(let a of o.results)Bn(a,c=>kp(c));let s=10,i=o.results.slice(0,s);return{toolName:ol,status:"success",summary:`To answer the query, the following lucene query was generated and executed:
224
+ Query: ${n.query}
225
+ Type Category Filter: ${n.typeCategoryFilter}
226
+ Named Type Filters: ${n.typeFilters?n.typeFilters.join(", "):"None"}
227
+ Result Limit: ${n.resultLimit??"No limit"}
228
+
229
+ Search Results: ${o.results.length} result(s) found.
230
+
231
+ ${o.results.length>s?`Showing top ${s} results:
232
+
233
+ `:""}${i.map(a=>JSON.stringify(a)).join(`
234
+ `)}`,details:{generatedSearchQuery:n,searchResults:o.results}}},eA=N(Xb,{name:ol,description:"Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",schema:Yb});var MH=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
235
+ This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
236
+
237
+ Supported actions:
238
+ - **Zooming**: Adjust the map's zoom level (e.g., "Zoom to level 10", "Zoom in").
239
+ - **Viewpoints**: Navigate to a specific center point with optional zoom or scale (e.g., "Center the map on San Francisco at zoom level 16").
240
+ - **Scales**: Set the map to a specific scale (e.g., "Set the map scale to 1:50,000").
241
+ - **Layers**: Zoom to the full extent of a specific layer (e.g., "Go to the water mains layer"). For the purposes of link charts, if the user requests to go to the extent of a link chart or the entities/nodes within it, that should be treated as a request to use the goToLayer tool on the link chart layer
242
+ - **Features**: Zoom to features in a layer that match a filter (e.g., "Zoom to all schools in the city").
243
+ - **Bookmarks**: Navigate to a predefined bookmark extent (e.g., "Go to the Downtown bookmark").
244
+ - **Extents**: Reset to the initial web map extent or zoom to the full world extent (e.g., "Reset the map", "Zoom to the full world extent").
245
+ - **Addresses**: Zoom to an address or place name (e.g., "Zoom to 1600 Pennsylvania Ave").
246
+
247
+ _Example: “Zoom to Texas”_
248
+ _Example: “Go to the water mains layer”_
249
+ _Example: “Zoom to to the extent of my link chart”_
250
+ _Example: “Center the map on San Francisco at scale 50000”_
251
+ _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
252
+ _Example: “Go to the Downtown bookmark”_
253
+ _Example: “Where is Mount Rainier?”_`;var lV=String.raw`- **layerStyling** — User wants to change how features are drawn or styled on the map based on their data, such as applying color, size, transparency, symbols, or charts according to field values.
254
+ _Example: “Color points by sales amount”_
255
+ _Example: “Show population density with a color gradient”_
256
+ _Example: “Create a relationship map between height and depth”_
257
+ _Example: “Vary circle sizes according to population”_`;var MV=String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
258
+ The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
259
+ _Example: “Only show stations where Brand is Shell”_
260
+ _Example: “Make Shell stations stand out on the map”_
261
+ _Example: “Gray out all stations that aren’t Shell”_
262
+ This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
263
+ _Example: “How many features are there?”_
264
+ _Example: “What’s the average population?”_
265
+ _Example: “Which values are in the status field?”_
266
+
267
+ This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`;var JV=String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
268
+
269
+ _Example: “Tell me about this map”_
270
+ _Example: “List all layers in this map”_
271
+ _Example: “List fields in protected areas layer”_
272
+ _Example: “What agents are available to me?”_
273
+ _Example: “What can you do?”_
274
+ _Example: “What can I ask”_
275
+
276
+ If the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent so it can politely refuse and redirect to map-related questions.
277
+
278
+ IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond that the requested action is not supported.
279
+ _Example: "Create a chart"_
280
+ _Example: "Create a table"_`;var mG=String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
281
+ This agent has two categories of skills: those that work with an active link chart visualization of a subset of the data in the knowledge graph, and those that work with the knowledge graph data more generally against the entire dataset in the service and database.
282
+ For link charts, the agent enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
283
+ expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
284
+ that exist out from specified entities and adding those to the link chart, changing whether or not nonspatial data is visible, or changing the layout of the link chart.
285
+ This agent is designed to handle requests that manipulate the specific link chart.
286
+ For knowledge graph data more generally, the agent can generate Open Cypher queries based on user prompts that represent inquiries into the data of the knowledge service and its graph database,
287
+ and can alternatively use those queries to create a new link chart visualization from the results if requested.
288
+
289
+ Supported actions:
290
+ - **Change or Apply Layout**: Changes the current layout visualization strategy of the link chart (e.g., "Change the layout to basic-grid", "Apply hierarchical layout"). Valid layout types include organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline. A best effort should be made to transform the user's request into one of these layout types.
291
+ - **Change Nonspatial Data Visibility**: Changes whether or not nonspatial data is visible on the link chart (e.g., "Show nonspatial data", "Hide nonspatial data"). Valid settings are "hidden" and "visible". A best effort should be made to transform the user's request into one of these settings.
292
+ - **Generate a cypher query**: Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance. The user should explicitly request that a cypher query be returned - if they do not, the purpose of the query is for one of the other tools or skills.
293
+ - **Create a New Link Chart from a user prompt**: Identifies that the users prompt is an inquiry into the data of the knowledge service and its graph database and creates a new link chart from the results. The user should have requested that a link chart be created or made(or similar term) from their prompt
294
+ - **Add Records (entities or relationships)**: Identifies that the users prompt is an inquiry into the data of the knowledge graph service and its graph database, and that the user wants to take the result of the inquiry and add those entities and/or relationships to the link chart. The generated query should be syntactically correct and optimized for performance.
295
+ - **Search Graph Data**: Generates and runs a lucene syntax query based on the user's prompt, returning matching entity and relationship records from the knowledge graph.
296
+ - **Query Graph Data**: Generates and executes a cypher query based on the user's prompt, and displays the results in the chat pane, allowing the user to explore the data in their knowledge graph.
297
+
298
+ _example: "Change the layout to hierarchical-bottom-to-top"_
299
+ _example: "Apply radial-root-centric layout"_
300
+ _example: "Show nonspatial data"_
301
+ _example: "Hide nonspatial data"_
302
+ _example: "Turn off nonspatial visibility"_
303
+ _example: "Generate a cypher query to find all entities connected to 'Entity A' via 'Relationship X' that were created after 2020"_
304
+ _example: "Generate a query to find all employees of Company Esri who joined after 2015 and are located in California"_
305
+ _example: "Tell me how to find all products supplied by Supplier Y that have a price greater than $1000"_
306
+ _example: "Create a new link chart showing all entities related to 'Entity B' through 'Relationship Y'"_
307
+ _example: "Find all people who work for Microsoft and put them on a new link chart"_
308
+ _example: "Add all entities connected to 'Entity C' via 'Relationship Z' to the current link chart"_
309
+ _example: "Add all the people who work for Esri to the current link chart, and all the cars that they drive"_
310
+ _example: "Find all the products supplied by Supplier X and add them to my visualization"_
311
+ _example: "Expand the link chart from 'Entity D' to show its direct connections"_
312
+ _example: "Find all the cars and then add everything up to two hops away from them on the link chart"_
313
+ _example: "Connect Emma and Rob on the link chart if there is a relationship between them"
314
+ _example: "Discover and add all the relationships originating at 'Entity E' to the link chart"_
315
+ _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
316
+ _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
317
+ _example: "Find John Smith and all people he has made phone calls to in the last year"_
318
+ _example: "What is the average age of all people who work for Esri?"_`;var nA=(t,e)=>{if(t.length!==e.length)throw new Error("Vectors must be the same length");let r=0,n=0,o=0;for(let a=0;a<t.length;++a){let c=t[a],l=e[a];r+=c*l,n+=c*c,o+=l*l}let s=Math.sqrt(n*o);if(s===0)return 0;let i=r/s;return Math.max(-1,Math.min(1,i))},Pp=Vs,kt=Mo;var Pe=J,Mp=lp,Rp=nA;var ii=()=>Tt();var cl={};El(cl,{JsonPatchError:()=>V,_areEquals:()=>jo,applyOperation:()=>mr,applyPatch:()=>Jn,applyReducer:()=>lA,deepClone:()=>iA,getValueByPointer:()=>di,validate:()=>Np,validator:()=>pi});var oA=(function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),sA=Object.prototype.hasOwnProperty;function li(t,e){return sA.call(t,e)}function ci(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r<e.length;r++)e[r]=""+r;return e}if(Object.keys)return Object.keys(t);var n=[];for(var o in t)li(t,o)&&n.push(o);return n}function ce(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function ui(t){for(var e=0,r=t.length,n;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Ue(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Do(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function ai(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)if(ai(t[e]))return!0}else if(typeof t=="object"){for(var n=ci(t),o=n.length,s=0;s<o;s++)if(ai(t[n[s]]))return!0}}return!1}function $p(t,e){var r=[t];for(var n in e){var o=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
319
+ `)}var Fo=(function(t){oA(e,t);function e(r,n,o,s,i){var a=this.constructor,c=t.call(this,$p(r,{name:n,index:o,operation:s,tree:i}))||this;return c.name=n,c.index=o,c.operation=s,c.tree=i,Object.setPrototypeOf(c,a.prototype),c.message=$p(r,{name:n,index:o,operation:s,tree:i}),c}return e})(Error);var V=Fo,iA=ce,Gn={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){var n=di(r,this.path);n&&(n=ce(n));var o=mr(r,{op:"remove",path:this.from}).removed;return mr(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(t,e,r){var n=di(r,this.from);return mr(r,{op:"add",path:this.path,value:ce(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:jo(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},aA={add:function(t,e,r){return ui(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:Gn.move,copy:Gn.copy,test:Gn.test,_get:Gn._get};function di(t,e){if(e=="")return t;var r={op:"_get",path:e};return mr(t,r),r.value}function mr(t,e,r,n,o,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(e,0,t,e.path):pi(e,0)),e.path===""){var i={newDocument:t};if(e.op==="add")return i.newDocument=e.value,i;if(e.op==="replace")return i.newDocument=e.value,i.removed=t,i;if(e.op==="move"||e.op==="copy")return i.newDocument=di(t,e.from),e.op==="move"&&(i.removed=t),i;if(e.op==="test"){if(i.test=jo(t,e.value),i.test===!1)throw new V("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return i.newDocument=t,i}else{if(e.op==="remove")return i.removed=t,i.newDocument=null,i;if(e.op==="_get")return e.value=t,i;if(r)throw new V("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,t);return i}}else{n||(t=ce(t));var a=e.path||"",c=a.split("/"),l=t,u=1,m=c.length,f=void 0,h=void 0,b=void 0;for(typeof r=="function"?b=r:b=pi;;){if(h=c[u],h&&h.indexOf("~")!=-1&&(h=Do(h)),o&&(h=="__proto__"||h=="prototype"&&u>0&&c[u-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&f===void 0&&(l[h]===void 0?f=c.slice(0,u).join("/"):u==m-1&&(f=e.path),f!==void 0&&b(e,0,t,f)),u++,Array.isArray(l)){if(h==="-")h=l.length;else{if(r&&!ui(h))throw new V("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,t);ui(h)&&(h=~~h)}if(u>=m){if(r&&e.op==="add"&&h>l.length)throw new V("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,t);var i=aA[e.op].call(e,l,h,t);if(i.test===!1)throw new V("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return i}}else if(u>=m){var i=Gn[e.op].call(e,l,h,t);if(i.test===!1)throw new V("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return i}if(l=l[h],r&&u<m&&(!l||typeof l!="object"))throw new V("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,t)}}}function Jn(t,e,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!0),r&&!Array.isArray(e))throw new V("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=ce(t));for(var s=new Array(e.length),i=0,a=e.length;i<a;i++)s[i]=mr(t,e[i],r,!0,o,i),t=s[i].newDocument;return s.newDocument=t,s}function lA(t,e,r){var n=mr(t,e);if(n.test===!1)throw new V("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function pi(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new V("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Gn[t.op]){if(typeof t.path!="string")throw new V("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new V('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new V("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new V("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&ai(t.value))throw new V("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var o=t.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==s)throw new V("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new V("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var i={op:"_get",path:t.from,value:void 0},a=Np([i],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new V("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new V("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function Np(t,e,r){try{if(!Array.isArray(t))throw new V("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Jn(ce(e),ce(t),r||!0);else{r=r||pi;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(o){if(o instanceof V)return o;throw o}}function jo(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),o,s,i;if(r&&n){if(s=t.length,s!=e.length)return!1;for(o=s;o--!==0;)if(!jo(t[o],e[o]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(t);if(s=a.length,s!==Object.keys(e).length)return!1;for(o=s;o--!==0;)if(!e.hasOwnProperty(a[o]))return!1;for(o=s;o--!==0;)if(i=a[o],!jo(t[i],e[i]))return!1;return!0}return t!==t&&e!==e}var ml={};El(ml,{compare:()=>gA,generate:()=>ul,observe:()=>hA,unobserve:()=>fA});var dl=new WeakMap,cA=(function(){function t(e){this.observers=new Map,this.obj=e}return t})(),uA=(function(){function t(e,r){this.callback=e,this.observer=r}return t})();function dA(t){return dl.get(t)}function pA(t,e){return t.observers.get(e)}function mA(t,e){t.observers.delete(e.callback)}function fA(t,e){e.unobserve()}function hA(t,e){var r=[],n,o=dA(t);if(!o)o=new cA(t),dl.set(t,o);else{var s=pA(o,e);n=s&&s.observer}if(n)return n;if(n={},o.value=ce(t),e){n.callback=e,n.next=null;var i=function(){ul(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(i)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=t,n.unobserve=function(){ul(n),clearTimeout(n.next),mA(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(e,new uA(e,n)),n}function ul(t,e){e===void 0&&(e=!1);var r=dl.get(t.object);pl(r.value,t.object,t.patches,"",e),t.patches.length&&Jn(r.value,t.patches);var n=t.patches;return n.length>0&&(t.patches=[],t.callback&&t.callback(n)),n}function pl(t,e,r,n,o){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=ci(e),i=ci(t),a=!1,c=!1,l=i.length-1;l>=0;l--){var u=i[l],m=t[u];if(li(e,u)&&!(e[u]===void 0&&m!==void 0&&Array.isArray(e)===!1)){var f=e[u];typeof m=="object"&&m!=null&&typeof f=="object"&&f!=null&&Array.isArray(m)===Array.isArray(f)?pl(m,f,r,n+"/"+Ue(u),o):m!==f&&(a=!0,o&&r.push({op:"test",path:n+"/"+Ue(u),value:ce(m)}),r.push({op:"replace",path:n+"/"+Ue(u),value:ce(f)}))}else Array.isArray(t)===Array.isArray(e)?(o&&r.push({op:"test",path:n+"/"+Ue(u),value:ce(m)}),r.push({op:"remove",path:n+"/"+Ue(u)}),c=!0):(o&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&s.length==i.length))for(var l=0;l<s.length;l++){var u=s[l];!li(t,u)&&e[u]!==void 0&&r.push({op:"add",path:n+"/"+Ue(u),value:ce(e[u])})}}}function gA(t,e,r){r===void 0&&(r=!1);var n=[];return pl(t,e,n,"",r),n}var zG=Object.assign({},cl,ml,{JsonPatchError:Fo,deepClone:ce,escapePathComponent:Ue,unescapePathComponent:Do});var Dp={advanced:"gpt-5.2",default:"gpt-5-mini",fast:"gpt-5.4-nano"},wA={default:"text-embedding-ada-002"},fl=new Map,mi=null,bA=()=>{let t=Lp.getDefault().helperServices;if(!t?.aiModels?.url)throw new Error("AI Models Service URL is not defined in the portal's helper services.");return t.aiModels.url},AA=async t=>{let e=bA();fl.size===0&&(mi||(mi=(async()=>{try{let n=await fetch(`${e}/models`);if(!n.ok)throw new Error("Failed to fetch AI service discovery data.");(await n.json()).models.forEach(o=>fl.set(o.name,o))}catch(n){throw mi=null,n}})()),await mi);let r=fl.get(t);if(!r)throw new Error(`Model '${t}' is not available in the discovery service.`);return r.endpoint},xA=async(t="default")=>await AA(Dp[t]);var hl=(t,e)=>e,vA=(t,e)=>({...t,...e}),IA=(t="",e)=>{let r=typeof e=="string"?e.trim():"";if(!r)return t;let n=t.trim();if(!n)return r;if(n===r)return t;let o=n.split(`
320
+
321
+ `);return o[o.length-1]?.trim()===r?t:`${t}
322
+
323
+ ${r}`},TA=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}});var oJ=S.Root({agentExecutionContext:S({default:TA,reducer:vA}),currentIntent:S({default:()=>"none",reducer:hl}),lastExecutedAgent:S({default:()=>"",reducer:hl}),requiresFollowUp:S({default:()=>!0,reducer:hl}),stepCount:S({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:S({default:()=>"",reducer:IA})});var SA=t=>async(e,r)=>{let n=new Headers(r?.headers);return n.delete("Authorization"),n.delete("api-key"),t&&t.length>0&&(n.set("X-Esri-Authorization",`Bearer ${t}`),n.set("X-Esri-Request-Source","MapsSDK")),await fetch(e,{...r,headers:n})},EA=async(t="default",e=0)=>{let r=Lp.getDefault(),n=await yA.getCredential(`${r.url}/sharing`),o=Dp[t],s=await xA(t);return new jn({modelName:o,apiKey:"dummy-key",...t!=="default"&&{temperature:e},configuration:{baseURL:s,fetch:SA(n.token)}})};var CA=w.object({id:w.string().min(1),name:w.string().min(1),description:w.string().min(1)});w.array(CA);var kA="0.1",zo=1536,OA="openai",PA=wA.default,MA=`Name: {name}
324
+ Title: {title}
325
+ Description: {description}`,RA=`Name: {name}
326
+ Alias: {alias}
327
+ Description: {description}`,sJ=w.object({schemaVersion:w.literal(kA),modified:w.number().int().nonnegative(),embeddings:w.object({modelProvider:w.literal(OA),model:w.literal(PA),dimensions:w.literal(zo),templates:w.object({layer:w.string().default(MA),field:w.string().default(RA)})}),layers:w.array(w.object({id:w.string().min(1),name:w.string().min(1),title:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zo,{message:`Layer vector must be exactly ${zo} dimensions`}),fields:w.array(w.object({name:w.string().min(1),alias:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zo,{message:`Field vector must be exactly ${zo} dimensions`})}))})).default([])});var $A=(t,e)=>{let r=Yo.fromTemplate(t);return Xo.fromMessages([r,...e])};var Fp=async t=>{let{promptText:e,modelTier:r="default",temperature:n=0,messages:o,inputVariables:s,schema:i}=t,a=$A(e,o??[]),c=(await EA(r,n)).withStructuredOutput(i);return await a.pipe(c).invoke(s??{})};var NA=d.object({name:d.string(),description:d.string(),valueType:d.string(),alias:d.string()}),iJ=d.object({fields:d.array(NA)});var aJ=d.object({title:d.string(),description:d.string(),name:d.string().nullable()});var FA=Cl`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}@media(resolution:1.25dppx),(resolution:1.75dppx){.chat-panel{margin-top:.5px}}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;async function be(t,e){let r=Object.entries(t).find(([n])=>n.endsWith(`/${e}.md`));if(!r)throw new Error(`Prompt not found: ${e}
328
+ Available prompts:
329
+ ${Object.keys(t).join(`
330
+ `)}`);return await r[1]()}function _i(t){return t?.configurable?.context?.translations}function Up(t){if(typeof window>"u"||t.length<=1)return;let e=t.map(n=>n.solution.id),r=t.map(n=>n.solution.title);window.dispatchEvent(new CustomEvent("searchTermSet",{detail:{scope:"all-solutions",searchTerm:""}})),window.dispatchEvent(new CustomEvent("solutionMatchesFromAssistant",{detail:{solutionIds:e,solutionTitles:r},bubbles:!0,composed:!0})),window.dispatchEvent(new CustomEvent("navTabSelected",{detail:{tabType:"all-solutions"}}))}function qp(t){if(typeof window>"u"||!t)return;let e=new CustomEvent("solutionIDFromAssistant",{detail:t,bubbles:!0,composed:!0});window.dispatchEvent(e)}var jA=w.object({needsContext:w.boolean().describe("True when the explorer query requires added context from prior turns."),rewrittenQuery:w.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")}),jp=t=>t?.signal?.aborted??!1,Bp=Object.assign({"./prompts/solutions_explorer_description.md":()=>import("./AS6VINEU.js").then(t=>t.default),"./prompts/transformQuery.md":()=>import("./MFVXFKKM.js").then(t=>t.default)});function zA(t){return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g,'<sup><a href="$2">&#91;$1&#93;</a></sup>')}function UA(t){return t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,r,n)=>`<img src="${n}" alt="${r}" style="width: 100%;">`)}function qA(t,e){let r=[];return(e?.configurable?.context?.configContext.allCards??[]).forEach(n=>{let o=n.title;if(!o)return;let s=new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`,"giu"),i=!1;t=t.replace(s,(a,c,l)=>{let u=l.slice(0,c);return/<img[^>]*alt\s*=\s*["'][^"']*$/i.test(u)?a:(i=!0,`<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)}),i&&r.push({solution:{title:n.title,id:n.deployCommonId,snippet:n.snippet,description:n.description},score:100})}),{source:t,allMatches:r}}function BA(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat`:null}function Kp(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat`:null}async function _l(t,e,r){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",token:r},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP ${n.status} calling ${e}`);return n.json()}var KA=t=>new Promise(e=>setTimeout(e,t));async function WA(t,e){let r=t.agentExecutionContext.userRequest,n=e?.configurable?.context?.lastTurnAgent,o=t.agentExecutionContext.messages??[];if(!n||o.length<=1||n==="explorer")return r;try{let s=await be(Bp,"transformQuery"),i=await kt({promptText:s,modelTier:"advanced",temperature:0,schema:jA,messages:o.slice(-11),inputVariables:{query:r,lastTurnAgent:n}});if(i.needsContext&&i.rewrittenQuery.trim())return console.debug(`Rephrased query from "${r}" to "${i.rewrittenQuery.trim()}"`),i.rewrittenQuery.trim()}catch{}return r}var HA=S.Root({...ii(),solutionResponse:S({reducer:(t,e)=>e??null,default:()=>null}),documentSkillUrl:S({reducer:(t,e)=>e??null,default:()=>null}),conversationId:S({reducer:(t,e)=>e??t,default:()=>null})}),VA=()=>new fe(HA).addNode("initializeAgent",JA).addNode("askSolutionsQuestions",GA).addEdge(me,"initializeAgent").addEdge("initializeAgent","askSolutionsQuestions").addEdge("askSolutionsQuestions",K),Wp=async(t,e,r,n)=>{if(!t)return;let o=Kp(t);if(!o)return;let s={context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:r,use_llm:!1}}}}};n&&(s.conversationId=n),_l(s,o,e??"")},GA=async(t,e)=>{if(jp(e))return{};let r=_i(e),n=t.documentSkillUrl,o=[],s=await WA(t,e);await Pe({text:r.agentProgress.explorerAgentSearching},e);let i=await _l({message:s,conversationId:e?.configurable?.context?.convoId??void 0,context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:e?.configurable?.context?.configContext.locale??"en",use_llm:!1}}}}},n,e?.configurable?.context?.token??"");i.conversationId&&e?.configurable?.context?.setConversationId&&e.configurable.context.setConversationId(i.conversationId);let a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},c="",l=async u=>{let m=u.context?.results?.[0]?.reply??"";if(m!==""){let h=zA(m),b=UA(h),A=qA(b,e);c=A.source,o=[...o,...A.allMatches.filter(E=>!o.some(y=>y.solution.id===E.solution.id))]}let f=u.context?.results?.[0]?.status?.currentStatusStep;if(f){let h="";f===1?h=r.agentProgress.explorerAgentReading:f===2?h=r.agentProgress.explorerAgentReviewing:f===3&&(h=r.agentProgress.explorerAgentPreparing),await Pe({text:h},e)}};for(await l(i);a.hasMore;){if(jp(e))return{};await KA(500),i=await _l({conversationId:a.conversationId,ackSequenceNumber:a.ackSequenceNumber,inquiryId:a.inquiryId},n,e?.configurable?.context?.token??""),a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},await l(i)}return Kp(e?.configurable?.context.portal)&&Wp(e?.configurable?.context.portal,e?.configurable?.context.token??"",e?.configurable?.context.configContext.locale??"en",a.conversationId),o.length&&(o.length===1?qp(o[0].solution.id):Up(o)),{outputMessage:c,summary:c,status:"success",solutionResponse:a,conversationId:a.conversationId}},JA=async(t,e)=>{let r=null;return t.documentSkillUrl===null&&e?.configurable?.context?.portal&&(r=BA(e.configurable.context.portal)),{documentSkillUrl:r}};await be(Bp,"solutions_explorer_description");var Hp=t=>{if(t&&Array.isArray(t.id)&&t.id.length>0)return t.id[t.id.length-1].replace("Message","").toLowerCase();if(t&&typeof t._getType=="function")try{return t._getType()}catch{return"human"}return"human"},ZA=t=>{let e=Hp(t);if(t&&t.kwargs)return{role:e,...t.kwargs};if(t&&typeof t=="object"){let r={role:e,content:typeof t.content=="string"?t.content:String(t.content||"")};return t.id&&(r.id=t.id),t.name&&(r.name=t.name),t.additional_kwargs&&(r.additional_kwargs=t.additional_kwargs),t.response_metadata&&(r.response_metadata=t.response_metadata),r}return{role:"human",content:String(t)}},QA=t=>Hp(t)==="human",YA=(t,e=3)=>t.filter(r=>QA(r)).slice(-e).map(ZA),XA=(t,e=" ")=>YA(t).map(r=>r.content).join(e).trim(),ex={understandingRequest:"Understanding your request...",selectTemplatePrompt:"This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.",searchingExistingSolutions:"Searching for existing solutions...",existingSolutionMatch:"I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?",continueBuildingYes:"Yes, I want to build a new solution",continueBuildingNo:"No, I\u2019ll review existing solutions",continueBuildingDeclined:"Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.",creatingDesign:"Generating solution design...",updatingDesign:"Updating solution design...",applyChangeFailed:"I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.",createDesignFailed:"I wasn't able to create a solution design from that request. Please try rephrasing and try again.",discardMessage:"Are you sure you want to discard your solution?",discardForNewSolution:"I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?"},tx={builderMessages:ex},yi=class t{constructor(e,r,n=!0){this.isValid=!0,this.issues=[],this.fieldNameRegistry=null,this.response=e,this.template=r,this.newDesign=n,this.validate()}static{this.INVALID_NAME_CHARS=/[><~`$^+=|]/gu}static{this.NAME_MAX_LENGTH=250}static{this.DESCRIPTION_MAX_LENGTH=2048}static{this.FIELD_NAME_MAX_LENGTH=31}validate(){this.compareModels(),this.validateResponse()}compareModels(){this._compareStrings(),this._compareItems(),this._compareFeatureLayers()}validateResponse(){this._validateSolutionProps(),this._validateItems(),this._validateFeatureLayer()}_compareStrings(){let e=new Set(this.response.solution.strings.map(n=>n.key)),r=new Map(this.template.solution.strings.map(n=>[n.key,n]));[...r.keys()].every(n=>e.has(n))||(this.newDesign?this._reconcileStringKeys():this._logIssue("String keys in llm response do not match the template."));for(let n of this.response.solution.strings){if(n.value)continue;let o=r.get(n.key)?.value;this.newDesign&&o?(n.value=o,this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)):this._logIssue(`String key '${n.key}' has no value in the design. It must be populated.`)}}_reconcileStringKeys(){let e=new Set(this.response.solution.strings.map(r=>r.key));for(let r of this.template.solution.strings)e.has(r.key)||(this.response.solution.strings.push({...r}),this._logAutoFix(`String key '${r.key}' was missing from the design. Auto-fixed by re-adding it from the template.`))}_compareItems(){let e=new Set(this.template.items.map(n=>n.id)),r=new Set(this.response.items.map(n=>n.id));e.size===r.size&&[...e].every(n=>r.has(n))||(this.newDesign?this._reconcileItems():this._logIssue("Item IDs in design do not match the template."))}_reconcileItems(){let e=new Set(this.template.items.map(i=>i.id)),r=new Set(this.response.items.map(i=>i.id)),n=[...r].filter(i=>!e.has(i)),o=[...e].filter(i=>!r.has(i));if(e.size===r.size&&n.length===1&&o.length===1){let i=n[0],a=o[0],c=this.response.items.find(l=>l.id===i);if(c){c.id=a,this._logAutoFix(`Item id '${i}' did not match the template id '${a}'. Auto-fixed in place.`);return}}n.length&&(this.response.items=this.response.items.filter(i=>e.has(i.id)),this._logAutoFix(`Removed items not present in the template: ${n.join(", ")}.`));let s=this.template.items.filter(i=>!r.has(i.id));if(s.length){this.response.items=[...s.map(i=>({...i})),...this.response.items];for(let i of s)this._logAutoFix(`Item '${i.id}' was missing from the design. Auto-fixed by adding it from the template.`)}}_compareFeatureLayers(){let e=this.template.featureLayer,r=this.response.featureLayer;if(e.itemId!==r.itemId){let n=r.itemId;r.itemId=e.itemId,this._logAutoFix(`Feature Layer itemId '${n}' did not match the template. Auto-fixed to '${e.itemId}'.`)}if(!e.addLayers){let n=new Set(e.layers.map(s=>s.id)),o=new Set(r.layers.map(s=>s.id));if(!(n.size===o.size&&[...n].every(s=>o.has(s))))this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);else for(let s of e.layers){if(s.type){let a=r.layers.find(c=>c.id===s.id);if(a&&a.type!==s.type)if(this.newDesign){let c=a.type;a.type=s.type,this._logAutoFix(`Layer '${s.id}' type '${c}' is immutable. Auto-fixed back to template type '${s.type}'.`)}else this._logIssue(`Layer '${s.id}' type '${a.type}' does not match template type '${s.type}'. This layer type is immutable.`)}let i=r.layers.find(a=>a.id===s.id);i&&this._validateRequiredFields(i,s)}}}_validateRequiredFields(e,r){let n=new Map(e.requiredFields.map(o=>[o.name.toLowerCase(),o]));for(let o of r.requiredFields){let s=n.get(o.name.toLowerCase());if(!s){this.newDesign?(e.requiredFields.push({...o}),this._logAutoFix(`Layer '${e.name}' was missing required field '${o.name}'. Auto-fixed by re-adding it from the template.`)):this._logIssue(`Layer '${e.name}' is missing required field '${o.name}'.`);continue}this._enforceRequiredFieldImmutability(e,s,o)}}_enforceRequiredFieldImmutability(e,r,n){let o=[];if(r.type!==n.type&&o.push("type"),(r.length??null)!==(n.length??null)&&o.push("length"),this._choiceListsEqual(r.choiceList,n.choiceList)||o.push("choiceList"),!o.length)return;let s=o.length===1?"property":"properties";this.newDesign?(r.type=n.type,r.length=n.length,r.choiceList=Array.isArray(n.choiceList)?[...n.choiceList]:n.choiceList??null,this._logAutoFix(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). Auto-fixed by reverting to the template.`)):this._logIssue(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). These cannot be modified.`)}_choiceListsEqual(e,r){let n=Array.isArray(e)?e:null,o=Array.isArray(r)?r:null;if(n===null&&o===null)return!0;if(n===null||o===null)return!1;let s=new Set(n),i=new Set(o);return s.size===i.size&&[...s].every(a=>i.has(a))}_validateSolutionProps(){let e=this.response.solution.title??"",r=this.response.solution.description,n=/[/\\]/u.test(e),o=this.newDesign?e.replace(/[/\\]/gu,""):e;this.newDesign&&o!==e?(this.response.solution.title=o,this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")):!this.newDesign&&n&&this._logIssue("Solution title contains forbidden forward or back slashes.");let s=rs(o);if(s.isValid||this._tryFixName(s.errorType,o,i=>{this.response.solution.title=i},"Solution title","Solution Title")||this._logIssue(`Solution title is invalid (${s.errorType}).`),r){let i=ns(r,t.DESCRIPTION_MAX_LENGTH,!0);i.isValid||this._tryFixDescription(r,a=>{this.response.solution.description=a},"Solution description")||this._logIssue(`Solution description is invalid (${i.errorType}).`)}}_validateItems(){for(let e of this.response.items){let r=rs(e.title??"");if(r.isValid||this._tryFixName(r.errorType,e.title??"",n=>{e.title=n},`Item '${e.id}' title`,"Item Title")||this._logIssue(`Item '${e.id}' title is invalid (${r.errorType}).`),e.description){let n=ns(e.description,t.DESCRIPTION_MAX_LENGTH,!0);n.isValid||this._tryFixDescription(e.description,o=>{e.description=o},`Item '${e.id}' description`)||this._logIssue(`Item '${e.id}' description is invalid (${n.errorType}).`)}}}_validateFeatureLayer(){this.response.featureLayer.layers.length||this._logIssue("Feature layer item must contain at least one layer.");let e=this.response.featureLayer.layers.map(r=>r.name.toLowerCase());e.length!==new Set(e).size&&(this.newDesign?this._dedupeLayerNames(this.response.featureLayer.layers):this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${e}.`));for(let r of this.response.featureLayer.layers)this._validateLayer(r,this.response.featureLayer.addLayers)}_dedupeLayerNames(e){let r=new Set;for(let n of e){let o=(n.name??"").toLowerCase();if(r.has(o)){let s=n.name;n.name=this._makeUniqueName(n.name??"Layer",r),this._logAutoFix(`Duplicate layer name '${s}'. Auto-fixed to '${n.name}'.`)}r.add(n.name.toLowerCase())}}_validateLayer(e,r){!r&&e.typeMutable===!0&&e.type==="Table"&&(this.newDesign?(e.type="Point",this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)):this._logIssue(`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`));let n=rs(e.name??"");if(n.isValid||this._tryFixName(n.errorType,e.name??"",o=>{e.name=o},`Layer '${e.name}' name`,"Layer Title")||this._logIssue(`Layer '${e.name}' name is invalid (${n.errorType}).`),e.description){let o=ns(e.description,t.DESCRIPTION_MAX_LENGTH,!0);o.isValid||this._tryFixDescription(e.description,s=>{e.description=s},`Layer '${e.name}' description`)||this._logIssue(`Layer '${e.name}' description is invalid (${o.errorType}).`)}this._validateLayerFields(e)}_validateLayerFields(e){let r=e.systemFields??[];this.fieldNameRegistry=new Set([...e.customFields,...e.requiredFields,...r].map(s=>s.name.toLowerCase()));for(let s of[...e.customFields,...e.requiredFields])this._validateField(s);this.fieldNameRegistry=null;let n=new Set(e.requiredFields.map(s=>s.name.toLowerCase())),o=new Set(n);for(let s of e.customFields){let i=s.name.toLowerCase();if(o.has(i)){let a=n.has(i)?"a required field name":"another field with the same name";if(this.newDesign){let c=s.name;s.name=this._makeUniqueName(s.name,o),this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${a}. Auto-fixed to '${s.name}'.`)}else this._logIssue(`Layer '${e.name}' field '${s.name}' collides with ${a}.`)}o.add(s.name.toLowerCase())}}_validateField(e){let r=/^\p{L}/u,n=/^.[\p{L}\p{M}\p{N}_]*$/u;e.alias||(this.newDesign?(e.alias=e.name,this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)):this._logIssue(`Field '${e.name}' has no display name (alias).`));let o=r.test(e.name),s=n.test(e.name);if(!o||!s)if(this.newDesign){let i=e.name;e.name=this._makeUniqueName(this._sanitizeFieldName(e.name),this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' had an invalid name. Auto-fixed to '${e.name}'.`)}else o||this._logIssue(`Field '${e.name}' does not start with a letter.`),s||this._logIssue(`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`);if(e.name.length>t.FIELD_NAME_MAX_LENGTH)if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(e.name,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters.`);if(ic.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);if(ac.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a reserved system field name. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a reserved system field name.`);if(Array.isArray(e.choiceList)&&e.type!=="string"&&(this.newDesign?e.choiceList.length?(e.type="string",this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)):(e.choiceList=null,this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)):this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)),e.type==="string"&&this._validateStringFieldLength(e),Array.isArray(e.choiceList)&&(this.newDesign?this._autoFixChoiceList(e):this._logChoiceListIssues(e)),Array.isArray(e.choiceList)&&e.length!=null){let i=Math.max(...e.choiceList.map(a=>a.length));i>e.length&&(this.newDesign?(this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters. Auto-fixing to ${i}.`),e.length=i):this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters.`))}}_autoFixChoiceList(e){let r=e.choiceList,n=r.filter(s=>s?.trim());n.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`),r=n,e.choiceList=r);let o=[...new Set(r)];o.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`),r=o,e.choiceList=r),r.length||(this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`),e.choiceList=null)}_logChoiceListIssues(e){if(Array.isArray(e.choiceList)){if(!e.choiceList.length){this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);return}e.choiceList.some(r=>!r?.trim())&&this._logIssue(`A blank domain value was added to Field '${e.name}'.`),e.choiceList.length!==new Set(e.choiceList).size&&this._logIssue(`Field '${e.name}' has duplicate domain values.`)}}_validateStringFieldLength(e){if(this.newDesign&&e.length===255&&(e.length=256),typeof e.length!="number"||Number.isNaN(e.length)){this._handleInvalidStringFieldLength(e,256);return}let r=e.length;if(!cc(r).isValid){let n=r>4e3?4e3:256;this._handleInvalidStringFieldLength(e,n)}}_handleInvalidStringFieldLength(e,r){this.newDesign?(this._logAutoFix(`Field '${e.name}' has an invalid length. Auto-fixing to ${r}.`),e.length=r):this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)}_makeUniqueName(e,r){let n=e,o=1;for(;r.has(n.toLowerCase());)n=`${e}_${o}`,o+=1;return n}_getUniqueTruncatedFieldName(e,r){let n=t.FIELD_NAME_MAX_LENGTH,o=e.slice(0,n),s=o,i=1;for(;r.has(s.toLowerCase());){let a=`_${i}`,c=Math.max(1,n-a.length);s=`${o.slice(0,c)}${a}`,i+=1}return s}_sanitizeItemName(e,r=t.NAME_MAX_LENGTH){let n=(e??"").replace(new RegExp(lc.source,"gu"),"").replace(t.INVALID_NAME_CHARS,"").replace(/\s+/gu," ").trim();return n.length>r&&(n=n.slice(0,r).trim()),n}_sanitizeDescription(e,r=t.DESCRIPTION_MAX_LENGTH){let n=(e??"").replace(/[<>]/gu,"");return n.length>r&&(n=n.slice(0,r)),n}_sanitizeFieldName(e){let r=(e??"").replace(/[^\p{L}\p{M}\p{N}_]/gu,"");return r.length===0?r="field":/^\p{L}/u.test(r)||(r=`f_${r}`),r}_tryFixName(e,r,n,o,s){if(!this.newDesign)return!1;if(e==="empty")return n(s),this._logAutoFix(`${o} was empty. Auto-fixed to '${s}'.`),!0;let i=this._sanitizeItemName(r)||s;return n(i),this._logAutoFix(`${o} was invalid (${e}). Auto-fixed to '${i}'.`),!0}_tryFixDescription(e,r,n){if(!this.newDesign)return!1;let o=this._sanitizeDescription(e);return r(o),this._logAutoFix(`${n} was invalid. Auto-fixed to a sanitized value.`),!0}_logAutoFix(e){console.debug(e)}_logIssue(e){console.debug(e),this.issues.push(e),this.isValid=!1}},rx=d.object({key:d.string().describe("Stable key identifier for the string."),value:d.string().describe("Display value for the string."),description:d.string().describe("Explanation of where/how the string is used.")}),nx=d.object({id:d.string().describe("ArcGIS item id (32 hex characters)."),title:d.string().describe("Item title."),description:d.string().describe("Item description."),type:d.enum(["Feature Layer (hosted)","Feature Layer (hosted, view)","Web Map","Instant App","Dashboard","Web Experience","Form","Table (hosted)","Table (hosted, view)","Hub Site Application","Hub Page","CSV","Data Pipeline","Desktop Application Template","Group","Notebook","QuickCapture Project"]).describe("ArcGIS item type.")}),zp=d.object({name:d.string().describe("Field name."),type:d.enum(["string","integer","double","date","oid","guid","globalid"]).describe("Field data type."),alias:d.string().describe("Field alias for display."),description:d.string().describe("Field description."),choiceList:d.array(d.string()).nullable().describe("List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."),length:d.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")}),ox=d.object({id:d.number().int().describe("Layer/table id within the feature service."),type:d.enum(["Point","Polyline","Polygon","Table"]).describe("Layer type."),typeMutable:d.boolean().describe("Indicates whether the layer type can be changed."),name:d.string().describe("Layer/table name."),description:d.string().describe("Layer/table description."),customFields:d.array(zp).describe("User/business fields specific to the solution."),requiredFields:d.array(zp).describe("Fields required for solution functionality (e.g., relationship keys).")}),sx=d.object({itemId:d.string().describe("ArcGIS item id for the feature layer."),addLayers:d.boolean().describe("Indicates whether new layers can be added during solution design."),layers:d.array(ox)}),bl=d.object({response:d.string().describe("Conversational response to the user's query."),solution:d.object({itemId:d.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),title:d.string().describe("Title of the solution."),description:d.string().describe("Description of the solution."),tags:d.array(d.string()).describe("Keywords/tags associated with the solution."),strings:d.array(rx).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")}),items:d.array(nx).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),featureLayer:sx.describe("Primary feature layer item and its schema/layers/tables details.")}),ix=d.object({op:d.enum(["add","remove","replace","move","copy"]).describe("RFC 6902 operation type."),path:d.string().describe("RFC 6901 JSON Pointer to the target location."),value:d.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null \u2014 not an empty string \u2014 for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),from:d.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null \u2014 not an empty string \u2014 for all other operations.")}),ax=d.object({response:d.string().describe("Conversational response describing the accepted design changes."),patches:d.array(ix).describe("Minimal RFC 6902 patch operations needed to update the current design.")}),lx=d.object({response:d.string().describe("Short, user-friendly explanation of why the requested update was not applied.")}),cx=d.object({assistantResponse:d.string().describe("Natural-language response for the user."),isValidUpdate:d.boolean().describe("True only when the request is in scope for supported design updates.")}),ux=d.object({matchedTitles:d.array(d.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")}),dx=d.object({templateId:d.string().min(1).describe("Template id from the available template list."),confidence:d.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),templateDescription:d.string().min(1).describe("Short action\u2011oriented description of the template in the user's use case/workflow, starting with a verb.")}),px=d.object({assistantResponse:d.string().nullable().describe("Natural-language response for the user."),isValidUseCase:d.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),matchedTemplates:d.array(dx).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")}),mx=t=>t.length?t.map((e,r)=>`${r+1}. ${e}`).join(`
331
+ `):"No validation errors were provided.",fx=async t=>{let{query:e,validationIssues:r,recentMessages:n,fallbackMessage:o,promptModules:s}=t;try{return(await Fp({promptText:await be(s,"explainValidationFailure"),modelTier:"fast",temperature:0,schema:lx,messages:n,inputVariables:{query:e,validationIssueCount:String(r.length),validationIssues:mx(r)}})).response?.trim()||o}catch(i){return console.warn("Natural language response failed:",{error:i}),o}},Al=t=>t in _r,hx=5,gx=.8,yx=.5,_x="Web Mapping Application",wx="Embeddings",fi=null,yl=null,hi=null,gi=null,bx="Build",fr=Object.assign({"./prompts/assessBuildRequest.md":()=>import("./S26SZJC7.js").then(t=>t.default),"./prompts/assessUpdateRequest.md":()=>import("./7X2SPNNK.js").then(t=>t.default),"./prompts/description.md":()=>import("./E25ZWVBK.js").then(t=>t.default),"./prompts/designSolution.md":()=>import("./SNA7NRRQ.js").then(t=>t.default),"./prompts/explainValidationFailure.md":()=>import("./I5E3PM26.js").then(t=>t.default),"./prompts/findExistingSolution.md":()=>import("./LPFG5XTA.js").then(t=>t.default),"./prompts/updateDesign.md":()=>import("./MBT2S4J5.js").then(t=>t.default)}),Ax=tx.builderMessages,G=t=>t?.signal?.aborted??!1,re=(t,e,r)=>_i(e)?.builderMessages?.[t]??Ax[t],Vp=t=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("arcgis-solution-design-update",{detail:t}))},xx=async(t,e,r)=>{if(!t)return null;let n=`type:"${_x}" AND typekeywords:${wx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:1}))?.results?.[0]??null};async function vx(t,e,r,n){try{let o=await xx(t,e,r);if(!o||G(n))return null;let s=new DA({id:o.id});return await s.load(),G(n)?null:await s.fetchData("json")}catch{return null}}var Ix=async(t,e,r)=>{if(!t)return[];let n=`type:Solution AND typekeywords:${bx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:100}))?.results??[]},Tx=async(t,e,r)=>{try{let n=await Ul(t,{params:e?{token:e}:void 0,portal:r}),o=n?.buildSolution;if(!o)return null;let s=n?.params,i=s&&typeof s=="object"&&!Array.isArray(s)?s:null;return{buildSolution:o,params:i}}catch{return null}},hr=(t,e={})=>{let r=t;return"itemId"in e&&(r={...r,solution:{...r.solution,itemId:e.itemId??null}}),e.sourceBuildSolution!=null&&(r={...r,sourceBuildSolution:e.sourceBuildSolution}),"params"in e&&(r={...r,params:e.params??null}),"templateId"in e&&(r={...r,templateId:e.templateId??null}),r},Gp=(t,e)=>{if(t==null||e==null)return{ok:!1,error:"design or sourceBuildSolution is null/undefined"};try{let r=structuredClone(e);return new Ni({buildSolution:r}).applyLlmTemplate(t),{ok:!0}}catch(r){return{ok:!1,error:r instanceof Error?r.stack??r.message:String(r)}}},xl=async t=>{if(yl){Object.entries(yl).forEach(([i,a])=>{_r[i]&&(_r[i].initialTemplate=a)});return}let e=t?.configurable?.context?.token,r=Zp(t),n=Qp(t);if(!r){console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");return}let o=await Ix(r,e,n),s={};G(t)||(await Promise.all(o.map(async i=>{let a=i.properties?.templateInfo;if(!a||typeof a!="object")return;let c=a.id;if(typeof c!="string"||s[c])return;let l=await Tx(i.id,e,n);if(!l||G(t))return;let{buildSolution:u,params:m}=l;if(typeof u=="object"&&u!==null&&"solution"in u){let h=u.solution;h.thumbnailUrl=i.thumbnail?`${n??"https://www.arcgis.com/sharing/rest"}/content/items/${i.id}/info/${i.thumbnail}`:void 0,h.item=i}let f={...a,buildSolution:u};s[c]=hr(new Ni(f).dumpToLlmTemplate(),{itemId:i.id,sourceBuildSolution:structuredClone(u),params:m?structuredClone(m):null}),_r[c]={...a,initialTemplate:s[c]}})),yl=s)},Jp=t=>{let e=t?.configurable?.context?.token;return typeof e!="string"||!e.trim()?null:e},Zp=t=>{let e=t?.configurable?.context?.configContext?.primarySolutionsGroupId;return typeof e!="string"||!e.trim()?null:e},Qp=t=>{let e=t?.configurable?.context?.configContext?.portalURL;if(!(typeof e!="string"||!e.trim()))return`${e.replace(/\/+$/,"")}/sharing/rest`},Sx=async t=>{await Promise.all([Xp(t),xl(t)])},Yp=async t=>{let e=Jp(t);(!hi||e&&e!==gi)&&(gi=e??gi,hi=Sx(t).catch(r=>{throw hi=null,gi=null,r})),await hi};async function Xp(t){if(fi)return fi;let e=Zp(t);if(!e)return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."),null;let r=Qp(t),n=t?.configurable?.context?.configContext?.portalURL;if(await new LA(n?{url:n}:void 0).load(),G(t))return null;let o=Jp(t)??void 0,s=await vx(e,o,r,t);return G(t)?null:s?(fi=s.items,fi):null}var Ex=()=>Object.entries(_r).map(([t,e])=>`ID: ${t}
332
+ Label: ${e.label}
333
+ Description: ${e.description}`).join(`
334
+
335
+ `),Cx=t=>{let e=t?.configurable?.context?.solutionDesignJson;if(typeof e!="string"||!e.trim())return null;try{let r=JSON.parse(e),n=hr({response:"",...r},{itemId:r?.solution?.itemId??null}),o=bl.safeParse(n);if(!o.success)return null;let{response:s,...i}=o.data,a=r.templateId,c=typeof a=="string"&&Al(a)?a:null;return hr(i,{sourceBuildSolution:r.sourceBuildSolution,templateId:c,params:r.params??null})}catch{return null}},kx=S.Root({...ii(),templateDescription:S({reducer:(t,e)=>typeof e=="string"||e===null?e:t??null,default:()=>null}),currentDesign:S({reducer:(t=null,e)=>e===void 0?t:e??null,default:()=>null}),assessment:S({reducer:(t=null,e)=>e===void 0?t:e??null,default:()=>null}),selectedTemplate:S({reducer:(t=null,e)=>e===void 0?t:e??null,default:()=>null}),updateAssessment:S({reducer:(t=null,e)=>e===void 0?t:e??null,default:()=>null}),existingMatches:S({reducer:(t=[],e)=>e===void 0?t:e??[],default:()=>[]}),continueBuilding:S({reducer:(t=null,e)=>e===void 0?t:e??null,default:()=>null})}),Ox=(t,e)=>{if(G(e))return{};let r=Cx(e),n=r?.templateId??null,o={};return JSON.stringify(t.currentDesign)!==JSON.stringify(r)&&(o.currentDesign=r),n&&t.selectedTemplate!==n&&(o.selectedTemplate=n),o},Px=async(t,e)=>{if(G(e))return{};await Pe({text:re("understandingRequest",e)},e),await Yp(e);let r=t.agentExecutionContext.userRequest,n=Ex(),o=t.agentExecutionContext.messages.slice(-11),s=await kt({promptText:await be(fr,"assessBuildRequest"),modelTier:"advanced",temperature:0,schema:px,messages:o,inputVariables:{query:r,availableTemplates:n}}),i=s.matchedTemplates.filter(m=>Al(m.templateId)),a={...s,matchedTemplates:i},[c,l]=i,u=c&&c.confidence>=gx&&(l===void 0||c.confidence-l.confidence>=yx)?c.templateId:null;return{assessment:a,selectedTemplate:u,existingMatches:[],continueBuilding:null}},Mx=t=>{let e=t.assessment?.assistantResponse??"";return{outputMessage:e,summary:e,status:"success"}},Rx=async(t,e)=>{if(G(e))return{};let{currentDesign:r}=t;if(!r)return{updateAssessment:{assistantResponse:"",isValidUpdate:!0}};await Pe({text:re("understandingRequest",e)},e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11);return{updateAssessment:await kt({promptText:await be(fr,"assessUpdateRequest"),modelTier:"advanced",temperature:0,schema:cx,messages:o,inputVariables:{currentDesign:JSON.stringify(Di(r)),query:n}})}},$x=(t,e)=>{let r=t.updateAssessment?.assistantResponse??re("applyChangeFailed",e);return{outputMessage:r,summary:r,status:"success"}},Nx=(t,e)=>{if(G(e))return{};let{hitlResponse:r}=e.configurable,n="selectTemplate",o=t.assessment?.matchedTemplates.filter(c=>Al(c.templateId))??[],s=o.map(c=>`${c.templateDescription}`);if(r?.agentId!=="solutionBuilder"||r.id!==n){let c={agentId:"solutionBuilder",id:n,kind:"singleSelection",message:re("selectTemplatePrompt",e),metadata:[...s]};throw new Uo(c)}let i=String(r.payload??""),a=s.findIndex(c=>c===i);return{selectedTemplate:(a>=0?o[a]:void 0)?.templateId??o[0]?.templateId??null}},Lx=async(t,e)=>{if(G(e))return{};await Pe({text:re("searchingExistingSolutions",e)},e);let r=t.agentExecutionContext.userRequest,n=XA(t.agentExecutionContext.messages)||r,o=await Xp(e);if(G(e))return{};if(!o)return console.warn("Solutions Search: failed to load solution embeddings cache; skipping search."),{existingMatches:[]};if(!o.length)return{existingMatches:[]};let[s]=await Mp([n]);if(G(e))return{};let i=o.map(u=>({solution:u,score:Rp(s,u.embedding)}));i.sort((u,m)=>m.score-u.score);let a=i.slice(0,hx);if(!a.length)return{existingMatches:[]};let c=a.map(({solution:u})=>`${u.title}
336
+ Snippet: ${u.snippet}
337
+ Description: ${u.description}`).join(`
338
+
339
+ `),l=t.agentExecutionContext.messages.slice(-11);return{existingMatches:(await kt({promptText:await be(fr,"findExistingSolution"),modelTier:"fast",temperature:0,schema:ux,messages:l,inputVariables:{query:r,candidates:c}})).matchedTitles.map(u=>a.find(({solution:m})=>m.title===u)).filter(u=>u!==void 0)}},Dx=(t,e)=>{if(G(e))return{};let{existingMatches:r}=t,{hitlResponse:n}=e.configurable,o=`confirmExistingSolution:${r[0].solution.id}`;if(n?.agentId!=="solutionBuilder"||n.id!==o){r.length===1?qp(r[0].solution.id):Up(r);let a=re("existingSolutionMatch",e),c=[re("continueBuildingYes",e),re("continueBuildingNo",e)],l={agentId:"solutionBuilder",id:o,kind:"singleSelection",message:a,metadata:c};throw new Uo(l)}let s=String(n.payload??"").trim(),i=re("continueBuildingNo",e);return{continueBuilding:s!==i}},Fx=(t,e)=>{let r=re("continueBuildingDeclined",e);return{outputMessage:r,summary:r,status:"success"}},em=async(t,e)=>{if(G(e))return{};if(await Yp(e),G(e))return{};let{currentDesign:r}=t,n=t.agentExecutionContext.userRequest;await Pe({text:re("creatingDesign",e)},e);let o=to(t.selectedTemplate);if(o?.initialTemplate||(await xl(e),o=to(t.selectedTemplate)),G(e))return{};if(!o?.initialTemplate)throw new Error("No hydrated templates are available for solution design.");let s=hr(r??o.initialTemplate,{itemId:(r??o.initialTemplate)?.solution?.itemId??null,sourceBuildSolution:r?.sourceBuildSolution??o.initialTemplate.sourceBuildSolution,params:r?.params??o.initialTemplate.params??null}),i=t.agentExecutionContext.messages.slice(-11),a=await kt({promptText:await be(fr,"designSolution"),modelTier:"advanced",temperature:0,schema:bl,messages:i,inputVariables:{currentDesign:JSON.stringify(Li(s)),templateInstructions:o.instructions,query:n}});if(await Pe({text:" of design solution 1"},e),G(e))return{};let{response:c,featureLayer:l,...u}=a,m=Fi(l,s.featureLayer),f=hr({...u,featureLayer:m},{itemId:s?.solution?.itemId,sourceBuildSolution:s.sourceBuildSolution,templateId:t.selectedTemplate??null,params:s.params??null}),h=new yi(f,o.initialTemplate);if(!h.isValid)return console.warn("[SolutionBuilder] designSolution validation failed:",{issues:h.issues,llmResponse:a}),{outputMessage:re("createDesignFailed",e)};let b=f.sourceBuildSolution,A=Gp(f,b);if(!A.ok){console.warn("[SolutionBuilder] designSolution Esri JSON conversion failed:",{error:A.error,llmResponse:a,design:f});let E=re("createDesignFailed",e);return{outputMessage:E,summary:E,status:"success"}}return G(e)?{}:(Vp(f),{outputMessage:c,summary:c,status:"success",currentDesign:f})},jx=async(t,e)=>{if(G(e))return{};let{currentDesign:r}=t;if(!r)return em(t,e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11);await Pe({text:re("updatingDesign",e)},e);let s;try{s=await kt({promptText:await be(fr,"updateDesign"),modelTier:"advanced",temperature:0,schema:ax,messages:o,inputVariables:{currentDesign:JSON.stringify(Di(r)),query:n}})}catch(P){console.warn("[SolutionBuilder] updateDesign structured prompt failed:",P);let z=re("applyChangeFailed",e);return{outputMessage:z,summary:z,status:"success"}}let{response:i,patches:a}=s;if(!a||a.length===0)return{outputMessage:i,summary:i,status:"success"};let c=P=>{try{return JSON.parse(P)}catch{let z=P.replace(/[\u0000-\u001F]/g,U=>{switch(U){case"\b":return"\\b";case"\f":return"\\f";case`
340
+ `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return"\\u"+U.charCodeAt(0).toString(16).padStart(4,"0")}});try{return JSON.parse(z)}catch{return P}}},l=[...a.map(P=>({op:P.op,path:P.path.replace(/\/+$/,""),...P.value!=null&&P.value!==""?{value:c(P.value)}:{},...P.from!=null&&P.from!==""?{from:P.from}:{}}))].sort((P,z)=>P.op!=="remove"||z.op!=="remove"?0:z.path.localeCompare(P.path,void 0,{numeric:!0})),u=structuredClone(Li(r));try{Jn(u,l,!0)}catch(P){console.warn("[SolutionBuilder] updateDesign JSON patch failed:",{error:P,llmResponse:s,patches:l,patchTarget:u});let z=re("applyChangeFailed",e);return{outputMessage:z,summary:z,status:"success"}}let m=hr({response:"",...u},{itemId:r.solution?.itemId??null}),f=bl.safeParse(m);if(!f.success){console.warn("[SolutionBuilder] updateDesign schema validation failed:",{errors:f.error.issues,llmResponse:s,patchedDesign:m});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}let{response:h,featureLayer:b,...A}=f.data,E=Fi(b,r.featureLayer),y=hr({...A,featureLayer:E},{itemId:r.solution?.itemId,sourceBuildSolution:r.sourceBuildSolution,templateId:r.templateId??t.selectedTemplate??null,params:r.params??null}),v=to(t.selectedTemplate);if(v?.initialTemplate||(await xl(e),v=to(t.selectedTemplate)),G(e))return{};if(!v?.initialTemplate)throw new Error("No hydrated templates are available for solution design.");let C=new yi(y,v.initialTemplate,!1);if(!C.isValid){console.warn("[SolutionBuilder] updateDesign validation failed:",{issues:C.issues,llmResponse:s,patchedDesign:y});let P=await fx({query:n,validationIssues:C.issues,recentMessages:o,fallbackMessage:re("applyChangeFailed",e),promptModules:fr});return{outputMessage:P,summary:P,status:"success"}}let L=y.sourceBuildSolution,B=Gp(y,L);if(!B.ok){console.warn("[SolutionBuilder] updateDesign Esri JSON conversion failed:",{error:B.error,llmResponse:s,design:y});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}return G(e)?{}:(Vp(y),{outputMessage:i,summary:i,status:"success",currentDesign:y})},zx=t=>t.currentDesign!==null?"assessUpdateRequest":"assessBuildRequest",Ux=t=>!t.updateAssessment||!t.updateAssessment.isValidUpdate?"invalidUpdateExit":"updateDesign",qx=t=>!t.assessment||!t.assessment.isValidUseCase?"invalidBuildExit":!t.selectedTemplate&&t.assessment.matchedTemplates.length>1?"selectTemplateHIL":"findExistingSolutions",Bx=t=>t.existingMatches.length>0?"confirmContinueBuildingHIL":"designSolution",Kx=t=>t.continueBuilding===!1?"declineContinueBuildingExit":"designSolution",Wx=()=>new fe(kx).addNode("syncCurrentDesignFromContext",Ox).addNode("assessBuildRequest",Px).addNode("assessUpdateRequest",Rx).addNode("invalidBuildExit",Mx).addNode("invalidUpdateExit",$x).addNode("selectTemplateHIL",Nx).addNode("findExistingSolutions",Lx).addNode("confirmContinueBuildingHIL",Dx).addNode("declineContinueBuildingExit",Fx).addNode("designSolution",em).addNode("updateDesign",jx).addEdge(me,"syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext",zx,{assessUpdateRequest:"assessUpdateRequest",assessBuildRequest:"assessBuildRequest"}).addConditionalEdges("assessUpdateRequest",Ux,{invalidUpdateExit:"invalidUpdateExit",updateDesign:"updateDesign"}).addConditionalEdges("assessBuildRequest",qx,{invalidBuildExit:"invalidBuildExit",selectTemplateHIL:"selectTemplateHIL",findExistingSolutions:"findExistingSolutions"}).addEdge("invalidBuildExit",K).addEdge("invalidUpdateExit",K).addEdge("selectTemplateHIL","findExistingSolutions").addConditionalEdges("findExistingSolutions",Bx,{confirmContinueBuildingHIL:"confirmContinueBuildingHIL",designSolution:"designSolution"}).addConditionalEdges("confirmContinueBuildingHIL",Kx,{declineContinueBuildingExit:"declineContinueBuildingExit",designSolution:"designSolution"}).addEdge("declineContinueBuildingExit",K).addEdge("designSolution",K).addEdge("updateDesign",K);await be(fr,"description");var Hx=w.object({tool:w.enum(["explorer","builder","other"]).describe("The selected tool based on the user\u2019s intent using the conversation context."),confidence:w.number().min(0).max(1).describe("A confidence score (0.00\u20131.00)."),rationale:w.string().min(1).describe("A brief rationale for the tool choice (\u2264140 characters)")}),wi=t=>t?.signal?.aborted??!1,vl=Object.assign({"./prompts/assistantResponse.md":()=>import("./4L7TJNAM.js").then(t=>t.default),"./prompts/classifyIntent.md":()=>import("./LWJF6EXD.js").then(t=>t.default),"./prompts/description.md":()=>import("./ENLFOYSI.js").then(t=>t.default)}),Vx=t=>{let e=t?.configurable?.context?.solutionDesignJson,r=t?.configurable?.context?.lastTurnAgent,n=r==="assistant"?"other":r,o=!1;if(typeof e=="string"&&e.trim())try{o=JSON.parse(e).solution!=null}catch{o=!1}return{activeSolutionDesign:o,lastTool:n}},Il=(t,e)=>{let r=t?.configurable?.context?.setLastTurnAgent;typeof r=="function"&&r(e);let n=new CustomEvent("assistantProcessing",{detail:{finished:!0,agent:e}});window.dispatchEvent(n)},tm=S.Root({...ii(),selectedTool:S({reducer:(t,e)=>e??null,default:()=>null}),intentRationale:S({reducer:(t,e)=>e??null,default:()=>null})}),Gx=async(t,e)=>{if(wi(e))return{};let r=_i(e);await Pe({text:r?.builderMessages.understandingRequest},e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11),{activeSolutionDesign:s,lastTool:i}=Vx(e),a=await be(vl,"classifyIntent"),c=await kt({promptText:a,modelTier:"advanced",temperature:0,schema:Hx,messages:o,inputVariables:{query:n,activeSolutionDesign:s,lastTool:i}});return{selectedTool:c.tool,intentRationale:c.rationale}},Jx=async(t,e)=>{if(wi(e))return{};let r=await VA().compile().invoke(t,e);return Il(e,"explorer"),r},Zx=async(t,e)=>{if(wi(e))return{};let r=await Wx().compile().invoke(t,e);return Il(e,"builder"),r},Qx=async(t,e)=>{if(wi(e))return{};let r=_i(e),n=t.agentExecutionContext.userRequest;await Pe({text:r?.executingSolutionsAssistantAgent},e);let o=await be(vl,"assistantResponse"),s=t.agentExecutionContext.messages.slice(-11),i=await Pp({promptText:o,modelTier:"advanced",temperature:0,messages:s,inputVariables:{query:n}});return Il(e,"assistant"),{outputMessage:i,summary:i,status:"success"}},Yx=t=>t.selectedTool??"other",Xx=()=>new fe(tm).addNode("classifyIntent",Gx).addNode("routeToExplorer",Jx).addNode("routeToBuilder",Zx).addNode("assistantResponse",Qx).addEdge(me,"classifyIntent").addConditionalEdges("classifyIntent",Yx,{explorer:"routeToExplorer",builder:"routeToBuilder",other:"assistantResponse"}).addEdge("routeToExplorer",K).addEdge("routeToBuilder",K).addEdge("assistantResponse",K),ev=await be(vl,"description"),tv={id:"solutionsAssistant",name:"Solutions Assistant Agent",description:ev,createGraph:Xx,workspace:tm},rv="https://links.esri.com/solutions/agol-organizational-account",nv="https://links.esri.com/solutions/configure-assistants",wl=class extends Ll{constructor(){super(),this.open=!1,this.userFirstName="",this.builderVisible=!1,this.hasActiveBuilderDesign=!1,this._conversationId=void 0,this._lastTurnAgent=void 0,this._lastResponseAgent=void 0,this._orgSettings={aiAssistantsEnabled:!1,blockBetaApps:!0,colocateCompute:!1},this._suggestedPrompts=[],this._hasInteracted=!1,this._isMobile=window.innerWidth<=800,this._translations=Fl({name:"arcgis-solutions-assistant",blocking:!0}),this._builderWidth=48,this._solutionDesignJson='{ "solution": null }',this._isAssistantBusy=!1,this._isBuilderBusy=!1,this._preChatCheck=!1,this._showNewChatConfirm=!1,this._assistantRef=$l(),this._configContextConsumer=Ii({context:jl,subscribe:!0,callback:e=>{e?.portalURL&&(gl.portalUrl=e.portalURL),e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings)}}),this._builderDesignContextConsumer=Ii({context:zl,subscribe:!0,callback:e=>{e?.design&&(this._solutionDesignJson=JSON.stringify(e.design,null,2))}}),this._handleResize=()=>{this._isMobile=window.innerWidth<=800},this._chatStartTime=null,this._responseMetadata=new Map,this._pendingResponseAgent=void 0,this._handleAssistantProcessingFinished=e=>{let r=e;if(r.detail?.finished&&this._chatStartTime!==null){let n=r.detail.agent;this._lastResponseAgent=n,this._pendingResponseAgent=n;let o=ql(this._chatStartTime);this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Chat",dimensions:[n],metrics:[o]}),this._chatStartTime=null}},this.closeAssistant=xi(),this.assistantProcessing=xi(),this._handleAssistantLinkClick=e=>{let r=e.composedPath().find(n=>n instanceof HTMLAnchorElement);if(r?.href)if(e.preventDefault(),r.target.indexOf("solutionId:")>-1){let n=r.target.split("solutionId:")[1];this._emitItemIdFromAI(n)}else window.open(r.href,"_blank","noopener,noreferrer")},this._onSolutionDesignUpdate=e=>{let r=e.detail;this._solutionDesignJson=r?JSON.stringify(r,null,2):'{ "solution": null }'},this._handleSignIn=()=>{this._configContextConsumer.value?.authentication?.signIn("aiOpen")},this._checkURLOpenParameter=()=>{this.open=this._configContextConsumer.value?.authentication?.SignInParam==="aiOpen"||this.open},this.listenOn(window,"arcgisFeedback",e=>{let r=e.detail,{agentPicked:n,taskAssigned:o,userMessage:s}=this._parseAgentPickedAndTask(r),i=this._responseMetadata.get(r.id),a=i?.agent??n??"",c=i?.userMessage??i?.userMessage??s??o??"";this._sendFeedback(r.content,c,r.feedback?.positive?"Good":r.feedback?.positive===!1?"Bad":"N/A",a)}),this.listenOn(window,"clearAssistantConversation",()=>{this._clearConversation()})}static{this.properties={open:5,userFirstName:1,builderVisible:5,hasActiveBuilderDesign:5,_conversationId:16,_lastTurnAgent:16,_lastResponseAgent:16,_orgSettings:16,_suggestedPrompts:16,_hasInteracted:16,_isMobile:16,_translations:16,_builderWidth:16,_solutionDesignJson:16,_isAssistantBusy:16,_isBuilderBusy:16,_preChatCheck:16,_showNewChatConfirm:16}}static{this.styles=FA}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}connectedCallback(){super.connectedCallback(),window.addEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.addEventListener("click",this._handleAssistantLinkClick),window.addEventListener("resize",this._handleResize),window.addEventListener("assistantProcessing",this._handleAssistantProcessingFinished),this._builderDesignContextConsumer}disconnectedCallback(){window.removeEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.removeEventListener("click",this._handleAssistantLinkClick),window.removeEventListener("resize",this._handleResize),window.removeEventListener("assistantProcessing",this._handleAssistantProcessingFinished),super.disconnectedCallback()}loaded(){this._checkURLOpenParameter()}load(){gl.applicationName="Solutions",this._configContextConsumer.value?.portalURL&&(gl.portalUrl=this._configContextConsumer.value.portalURL)}firstUpdated(e){this._loadUserFirstName()}willUpdate(e){e.has("open")&&this.open&&window.dispatchEvent(new CustomEvent("openAssistant")),this._configContextConsumer.value?.authentication&&this._configContextConsumer.value?.userSession?.token&&(this._preChatCheck||(Wp(this._configContextConsumer.value?.authentication.Portal,this._configContextConsumer.value?.userSession?.token,this._configContextConsumer.value?.locale??"en"),this._preChatCheck=!0)),this._configContextConsumer.value?.userSession?.token&&this._configContextConsumer.value?.authentication?.CanUseAI}_renderNoSign(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage??vi} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`}_renderNoPermission(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${uc(this._translations.noPermissionMessage.replace("{{orgUrl}}",rv).replace("{{configAI}}",nv))}</div></calcite-notice>`}render(){let e=this._suggestedPrompts.length>0?this._suggestedPrompts:this._hasInteracted?[]:Object.values(this._translations.defaultFollowUpQuestions);return this._suggestedPrompts.length>0?e=this._suggestedPrompts:this._hasInteracted||(e=[...Object.values(this._translations.defaultFollowUpQuestions)]),st`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token?this._configContextConsumer.value?.authentication?.CanUseAI?st`${!this._isMobile&&st`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Toggle Builder Panel",dimensions:[this.builderVisible?"Close":"Open"]}),window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"))}} scale=m slot=header-actions-end></calcite-action>`||""}${!this._isMobile&&st`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>`||""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage??vi} .suggestedPrompts=${e} @arcgisSubmit=${()=>{this._suggestedPrompts=[],e=[],this._hasInteracted=!0,this._chatStartTime=Date.now(),this.assistantProcessing.emit(!0)}} @arcgisFeedback=${r=>{r.detail&&console.log("arcgis feedback: ",r.detail)}} @arcgisResponse=${()=>{let r=this._pendingResponseAgent??this._lastResponseAgent;if(r){let n=o=>{if(this._captureResponseMetadata(r)){this._pendingResponseAgent=void 0;return}o<3&&requestAnimationFrame(()=>n(o+1))};requestAnimationFrame(()=>n(1))}this.assistantProcessing.emit(!1)}} ${Nl(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${()=>{this.hasActiveBuilderDesign?this._showNewChatConfirm=!0:(this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["No Active Design"]}),this._clearConversation())}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${tv} .context=${{token:this._configContextConsumer.value?.userSession?.token,configContext:this._configContextConsumer.value,convoId:this._conversationId,portal:this._configContextConsumer.value?.authentication.Portal,assistantRef:this._assistantRef,translations:this._translations,solutionDesignJson:this._solutionDesignJson,lastTurnAgent:this._lastTurnAgent,setConversationId:r=>{this._conversationId=r},setLastTurnAgent:r=>{this._lastTurnAgent=r},clearSuggestedPrompts:()=>{this._suggestedPrompts=[]}}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>`:this._renderNoPermission():this._renderNoSign()}${this._showNewChatConfirm&&st`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${()=>{this._showNewChatConfirm=!1}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["With Design Discard"]}),this._showNewChatConfirm=!1,window.dispatchEvent(new CustomEvent("requestBuilderDiscard"))}} slot=footer-end>${this._translations.discard}</calcite-button></calcite-dialog>`||""}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${()=>{this.closeAssistant.emit(!0)}} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`}_clearConversation(){this._conversationId=void 0,this._lastTurnAgent=void 0,this._lastResponseAgent=void 0,this._pendingResponseAgent=void 0,this._suggestedPrompts=[],this._hasInteracted=!1,this._responseMetadata.clear(),this._assistantRef.value?.clearChatHistory()}_sendFeedback(e,r,n,o){let s=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(r)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({agent:o}))}&field:version=${encodeURIComponent("v2")}`;window.open(s,"_blank")}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let r=e.fullName.split(" ")[0];this.userFirstName=r}}catch{}}_captureResponseMetadata(e){let r=Array.from(this._assistantRef.value?.messages||[]);for(let n=r.length-1;n>=0;n--){let o=r[n];if(o.role==="assistant"&&!this._responseMetadata.has(o.id)){let s;for(let i=n-1;i>=0;i--){let a=r[i];if(a.role==="user"){s=a.content;break}}return this._responseMetadata.set(o.id,{agent:e,userMessage:s}),!0}}return!1}_parseAgentPickedAndTask(e){let r=Array.from(this._assistantRef.value?.messages||[]),n=e.log||[],o=[...r].sort((u,m)=>m.id-u.id).find(u=>u.role==="user"&&u.id<=e.id)?.content||null,s=n.find(u=>typeof u=="string"&&u.includes("Agent picked:"))??null;if(!s)return{agentPicked:null,taskAssigned:null,userMessage:o};let i=/Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i,a=s.match(i);if(!a)return{agentPicked:null,taskAssigned:null,userMessage:o};let c=a[1].trim(),l=a[2].trim();return{agentPicked:c,taskAssigned:l,userMessage:o}}_emitItemIdFromAI(e){let r=new CustomEvent("solutionIDFromAssistant",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(r)}};Dl("arcgis-solutions-assistant",wl);return wl},"config","identity/IdentityManager","portal/Portal","portal/Portal","identity/IdentityManager","config","core/reactiveUtils","layers/FeatureLayer","request","layers/FeatureLayer","core/reactiveUtils","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","Graphic","rest/locator","symbols/PictureMarkerSymbol","geometry/Extent","geometry/Point","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","portal/Portal","portal/PortalItem",a,b)