@bkm016/basalt 0.1.18 → 0.1.20

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 (979) hide show
  1. package/README.md +1 -1
  2. package/chunk-0b2brwjc.js +3 -0
  3. package/chunk-0bgg0hdd.js +2 -0
  4. package/chunk-0g8rtf05.js +18 -0
  5. package/chunk-0wwd4q6h.js +5 -0
  6. package/chunk-11xxfc0x.js +3 -0
  7. package/chunk-1gaj43fx.js +2 -0
  8. package/chunk-1tbv5t08.js +5 -0
  9. package/chunk-204c01mz.js +25 -0
  10. package/chunk-29g01nrz.js +20 -0
  11. package/chunk-2fts9k52.js +3 -0
  12. package/chunk-30bbdzma.js +16 -0
  13. package/chunk-3phf8eg6.js +3 -0
  14. package/chunk-3r38vbt5.js +2 -0
  15. package/chunk-3sg32v3n.js +2 -0
  16. package/chunk-4dgqcp6q.js +2 -0
  17. package/chunk-4fbj3k59.js +3 -0
  18. package/chunk-4wc2gbhe.js +2 -0
  19. package/chunk-51pfvmhh.js +470 -0
  20. package/chunk-5e7yegea.js +2 -0
  21. package/chunk-5ja0vsam.js +10 -0
  22. package/chunk-5tsfqsmf.js +2 -0
  23. package/chunk-6en06hkk.js +2 -0
  24. package/chunk-6hatfwsq.js +2 -0
  25. package/chunk-78ky455y.js +4 -0
  26. package/chunk-7kz9435k.js +11 -0
  27. package/chunk-8mqaq042.js +2 -0
  28. package/chunk-9qzyn98b.js +3 -0
  29. package/chunk-a1vdrgsh.js +59 -0
  30. package/chunk-a2z1cy84.js +2 -0
  31. package/chunk-a3fpx924.js +3 -0
  32. package/chunk-agb771ak.js +3 -0
  33. package/chunk-ak9rkrf3.js +5 -0
  34. package/chunk-as2mwf79.js +2 -0
  35. package/chunk-bkhsva5n.js +7 -0
  36. package/chunk-c5pg2875.js +3552 -0
  37. package/chunk-cks36jdh.js +8 -0
  38. package/chunk-cwrf78vs.js +3 -0
  39. package/chunk-d2f0hq8z.js +2 -0
  40. package/chunk-e0ytnnwt.js +3 -0
  41. package/chunk-e3bgzeb3.js +3 -0
  42. package/chunk-enmrpjpt.js +3 -0
  43. package/chunk-eps1epfr.js +4 -0
  44. package/chunk-ewr51fwc.js +3 -0
  45. package/chunk-eyyxqb6y.js +7 -0
  46. package/chunk-fgjw0r6g.js +12 -0
  47. package/chunk-g9hsrrj5.js +2 -0
  48. package/chunk-gg3kfa12.js +3 -0
  49. package/chunk-gpceyezp.js +2 -0
  50. package/chunk-gs5aebwh.js +2 -0
  51. package/chunk-h2pp8mnh.js +4 -0
  52. package/chunk-h4n0gg11.js +2 -0
  53. package/chunk-jzya0e5n.js +7 -0
  54. package/chunk-mde2dd79.js +2 -0
  55. package/chunk-ncb0tyaw.js +2 -0
  56. package/chunk-np2xnt1g.js +3 -0
  57. package/chunk-nszq2z0w.js +2 -0
  58. package/chunk-p0e82mee.js +3 -0
  59. package/chunk-qxpx8dn6.js +12 -0
  60. package/chunk-s819vmwh.js +3 -0
  61. package/chunk-s8m4svhf.js +3 -0
  62. package/chunk-sm9fpy18.js +390 -0
  63. package/chunk-svx7mz0w.js +25 -0
  64. package/chunk-tb3zsqe8.js +3 -0
  65. package/chunk-tp885r8h.js +39 -0
  66. package/chunk-tpeg9fkd.js +2 -0
  67. package/chunk-tpetsqzt.js +9 -0
  68. package/chunk-v0mw006s.js +15 -0
  69. package/chunk-v7da0aqn.js +7 -0
  70. package/chunk-vzrmdaba.js +2 -0
  71. package/chunk-w045zk55.js +2 -0
  72. package/chunk-w6nc3jn7.js +2 -0
  73. package/chunk-w9fdcchk.js +3 -0
  74. package/chunk-wj09qkyw.js +3 -0
  75. package/chunk-x1y4s01x.js +31 -0
  76. package/chunk-y3vap4a1.js +10 -0
  77. package/chunk-y83tnkr3.js +11 -0
  78. package/chunk-yk29stq0.js +5 -0
  79. package/chunk-ys2fds2x.js +3 -0
  80. package/chunk-yshdvnsp.js +2 -0
  81. package/chunk-z9p2ry9w.js +3 -0
  82. package/chunk-zkjnt298.js +3 -0
  83. package/compiled.js +10 -10
  84. package/package.json +1 -1
  85. package/ui-test-worker.js +37 -37
  86. package/web/chunk-08w40agf.js +34 -0
  87. package/web/chunk-08w40agf.js.br +0 -0
  88. package/web/chunk-08w40agf.js.gz +0 -0
  89. package/web/chunk-0bfypmyv.js +1 -0
  90. package/web/chunk-0bfypmyv.js.br +2 -0
  91. package/web/chunk-0bfypmyv.js.gz +0 -0
  92. package/web/chunk-0h0whn75.js +24 -0
  93. package/web/chunk-0h0whn75.js.br +0 -0
  94. package/web/chunk-0h0whn75.js.gz +0 -0
  95. package/web/chunk-0pzs9k06.js +1 -0
  96. package/web/chunk-0pzs9k06.js.br +0 -0
  97. package/web/chunk-0pzs9k06.js.gz +0 -0
  98. package/web/chunk-0rvx1z2b.js +1 -0
  99. package/web/chunk-0rvx1z2b.js.br +0 -0
  100. package/web/chunk-0rvx1z2b.js.gz +0 -0
  101. package/web/chunk-0tcmnvab.js +2 -0
  102. package/web/chunk-0tcmnvab.js.br +0 -0
  103. package/web/chunk-0tcmnvab.js.gz +0 -0
  104. package/web/chunk-0wqmwnd8.js +2 -0
  105. package/web/chunk-0wqmwnd8.js.br +0 -0
  106. package/web/chunk-0wqmwnd8.js.gz +0 -0
  107. package/web/chunk-0z10aqp1.js +2 -0
  108. package/web/chunk-0z10aqp1.js.br +0 -0
  109. package/web/chunk-0z10aqp1.js.gz +0 -0
  110. package/web/chunk-12vcrj7y.js +1 -0
  111. package/web/chunk-12vcrj7y.js.br +0 -0
  112. package/web/chunk-12vcrj7y.js.gz +0 -0
  113. package/web/chunk-186rp10x.js +62 -0
  114. package/web/chunk-186rp10x.js.br +0 -0
  115. package/web/chunk-186rp10x.js.gz +0 -0
  116. package/web/chunk-1cwyy3gh.js +2 -0
  117. package/web/chunk-1cwyy3gh.js.br +0 -0
  118. package/web/chunk-1cwyy3gh.js.gz +0 -0
  119. package/web/chunk-1ecsxh85.js +1 -0
  120. package/web/chunk-1ecsxh85.js.br +0 -0
  121. package/web/chunk-1ecsxh85.js.gz +0 -0
  122. package/web/chunk-1ghnag5v.js +2 -0
  123. package/web/chunk-1ghnag5v.js.br +0 -0
  124. package/web/chunk-1ghnag5v.js.gz +0 -0
  125. package/web/chunk-1ps9fj5n.js +2 -0
  126. package/web/chunk-1ps9fj5n.js.br +0 -0
  127. package/web/chunk-1ps9fj5n.js.gz +0 -0
  128. package/web/chunk-1ratg1jd.js +332 -0
  129. package/web/chunk-1ratg1jd.js.br +0 -0
  130. package/web/chunk-1ratg1jd.js.gz +0 -0
  131. package/web/chunk-1yvcxpp2.js +7 -0
  132. package/web/chunk-1yvcxpp2.js.br +0 -0
  133. package/web/chunk-1yvcxpp2.js.gz +0 -0
  134. package/web/chunk-2r3w0pt0.js +8 -0
  135. package/web/chunk-2r3w0pt0.js.br +0 -0
  136. package/web/chunk-2r3w0pt0.js.gz +0 -0
  137. package/web/chunk-2rnnvxa5.js +291 -0
  138. package/web/chunk-2rnnvxa5.js.br +0 -0
  139. package/web/chunk-2rnnvxa5.js.gz +0 -0
  140. package/web/chunk-2stffcvc.js +1 -0
  141. package/web/chunk-2stffcvc.js.br +0 -0
  142. package/web/chunk-2stffcvc.js.gz +0 -0
  143. package/web/chunk-2svqgkqw.js +1 -0
  144. package/web/chunk-2svqgkqw.js.br +0 -0
  145. package/web/chunk-2svqgkqw.js.gz +0 -0
  146. package/web/chunk-366a11ec.js +1 -0
  147. package/web/chunk-366a11ec.js.br +0 -0
  148. package/web/chunk-366a11ec.js.gz +0 -0
  149. package/web/chunk-37hmswdk.js +7 -0
  150. package/web/chunk-37hmswdk.js.br +0 -0
  151. package/web/chunk-37hmswdk.js.gz +0 -0
  152. package/web/chunk-3fd6mgf0.js +1 -0
  153. package/web/chunk-3fd6mgf0.js.br +0 -0
  154. package/web/chunk-3fd6mgf0.js.gz +0 -0
  155. package/web/chunk-4mypk63p.js +2 -0
  156. package/web/chunk-4mypk63p.js.br +0 -0
  157. package/web/chunk-4mypk63p.js.gz +0 -0
  158. package/web/chunk-52tt9qt4.js +2 -0
  159. package/web/chunk-52tt9qt4.js.br +0 -0
  160. package/web/chunk-52tt9qt4.js.gz +0 -0
  161. package/web/chunk-53cg6pxm.js +142 -0
  162. package/web/chunk-53cg6pxm.js.br +0 -0
  163. package/web/chunk-53cg6pxm.js.gz +0 -0
  164. package/web/chunk-59h87pvn.js +12 -0
  165. package/web/chunk-59h87pvn.js.br +0 -0
  166. package/web/chunk-59h87pvn.js.gz +0 -0
  167. package/web/chunk-5cp4n5ck.js +2 -0
  168. package/web/chunk-5cp4n5ck.js.br +0 -0
  169. package/web/chunk-5cp4n5ck.js.gz +0 -0
  170. package/web/chunk-6a3wt5c5.js +30 -0
  171. package/web/chunk-6a3wt5c5.js.br +0 -0
  172. package/web/chunk-6a3wt5c5.js.gz +0 -0
  173. package/web/chunk-6n1ha6ta.js +7 -0
  174. package/web/chunk-6n1ha6ta.js.br +0 -0
  175. package/web/chunk-6n1ha6ta.js.gz +0 -0
  176. package/web/chunk-6pbhqbv0.js +1 -0
  177. package/web/chunk-6pbhqbv0.js.br +0 -0
  178. package/web/chunk-6pbhqbv0.js.gz +0 -0
  179. package/web/chunk-72st75n7.js +70 -0
  180. package/web/chunk-72st75n7.js.br +0 -0
  181. package/web/chunk-72st75n7.js.gz +0 -0
  182. package/web/chunk-7cf1kk45.js +1 -0
  183. package/web/chunk-7cf1kk45.js.br +2 -0
  184. package/web/chunk-7cf1kk45.js.gz +0 -0
  185. package/web/chunk-7h59ac2b.js +38 -0
  186. package/web/chunk-7h59ac2b.js.br +0 -0
  187. package/web/chunk-7h59ac2b.js.gz +0 -0
  188. package/web/chunk-81xbfpbq.js +41 -0
  189. package/web/chunk-81xbfpbq.js.br +0 -0
  190. package/web/chunk-81xbfpbq.js.gz +0 -0
  191. package/web/chunk-82q4e8ff.js +1 -0
  192. package/web/chunk-82q4e8ff.js.br +0 -0
  193. package/web/chunk-82q4e8ff.js.gz +0 -0
  194. package/web/chunk-89crtpnw.js +1 -0
  195. package/web/chunk-89crtpnw.js.br +0 -0
  196. package/web/chunk-89crtpnw.js.gz +0 -0
  197. package/web/chunk-89e8629e.js +1 -0
  198. package/web/chunk-89e8629e.js.br +0 -0
  199. package/web/chunk-89e8629e.js.gz +0 -0
  200. package/web/chunk-9n1nsdqs.js +1 -0
  201. package/web/chunk-9n1nsdqs.js.br +0 -0
  202. package/web/chunk-9n1nsdqs.js.gz +0 -0
  203. package/web/chunk-9r7nbre7.js +2 -0
  204. package/web/chunk-9r7nbre7.js.br +0 -0
  205. package/web/chunk-9r7nbre7.js.gz +0 -0
  206. package/web/chunk-9y9nwaqj.js +1 -0
  207. package/web/chunk-9y9nwaqj.js.br +0 -0
  208. package/web/chunk-9y9nwaqj.js.gz +0 -0
  209. package/web/chunk-a8qe7kvz.js +1 -0
  210. package/web/chunk-a8qe7kvz.js.br +0 -0
  211. package/web/chunk-a8qe7kvz.js.gz +0 -0
  212. package/web/chunk-ahdca62g.js +1 -0
  213. package/web/chunk-ahdca62g.js.br +0 -0
  214. package/web/chunk-ahdca62g.js.gz +0 -0
  215. package/web/chunk-apr33amc.js +140 -0
  216. package/web/chunk-apr33amc.js.br +0 -0
  217. package/web/chunk-apr33amc.js.gz +0 -0
  218. package/web/chunk-aw9bwd4w.js +3 -0
  219. package/web/chunk-aw9bwd4w.js.br +0 -0
  220. package/web/chunk-aw9bwd4w.js.gz +0 -0
  221. package/web/chunk-bg0qgabv.js +1 -0
  222. package/web/chunk-bg0qgabv.js.br +0 -0
  223. package/web/chunk-bg0qgabv.js.gz +0 -0
  224. package/web/chunk-bks2k04k.js +2 -0
  225. package/web/chunk-bks2k04k.js.br +0 -0
  226. package/web/chunk-bks2k04k.js.gz +0 -0
  227. package/web/chunk-c28crzwk.js +120 -0
  228. package/web/chunk-c28crzwk.js.br +0 -0
  229. package/web/chunk-c28crzwk.js.gz +0 -0
  230. package/web/chunk-cmhxtckb.js +2 -0
  231. package/web/chunk-cmhxtckb.js.br +0 -0
  232. package/web/chunk-cmhxtckb.js.gz +0 -0
  233. package/web/chunk-d7f85w1y.js +1 -0
  234. package/web/chunk-d7f85w1y.js.br +0 -0
  235. package/web/chunk-d7f85w1y.js.gz +0 -0
  236. package/web/chunk-dmhezjv3.js +217 -0
  237. package/web/chunk-dmhezjv3.js.br +0 -0
  238. package/web/chunk-dmhezjv3.js.gz +0 -0
  239. package/web/chunk-dmzvhbpn.js +292 -0
  240. package/web/chunk-dmzvhbpn.js.br +0 -0
  241. package/web/chunk-dmzvhbpn.js.gz +0 -0
  242. package/web/chunk-e2z3kdhw.js +39 -0
  243. package/web/chunk-e2z3kdhw.js.br +0 -0
  244. package/web/chunk-e2z3kdhw.js.gz +0 -0
  245. package/web/chunk-e65y60v1.js +2 -0
  246. package/web/chunk-e65y60v1.js.br +0 -0
  247. package/web/chunk-e65y60v1.js.gz +0 -0
  248. package/web/chunk-ed8qqn45.js +2 -0
  249. package/web/chunk-ed8qqn45.js.br +0 -0
  250. package/web/chunk-ed8qqn45.js.gz +0 -0
  251. package/web/chunk-ef1h0tt7.js +2 -0
  252. package/web/chunk-ef1h0tt7.js.br +0 -0
  253. package/web/chunk-ef1h0tt7.js.gz +0 -0
  254. package/web/chunk-eqmghkwh.js +1 -0
  255. package/web/chunk-eqmghkwh.js.br +0 -0
  256. package/web/chunk-eqmghkwh.js.gz +0 -0
  257. package/web/chunk-esckazz2.js +1 -0
  258. package/web/chunk-esckazz2.js.br +0 -0
  259. package/web/chunk-esckazz2.js.gz +0 -0
  260. package/web/chunk-ezj5rjqr.js +4 -0
  261. package/web/chunk-ezj5rjqr.js.br +0 -0
  262. package/web/chunk-ezj5rjqr.js.gz +0 -0
  263. package/web/chunk-fjrgg82c.js +139 -0
  264. package/web/chunk-fjrgg82c.js.br +0 -0
  265. package/web/chunk-fjrgg82c.js.gz +0 -0
  266. package/web/chunk-g3vbtxgy.js +2 -0
  267. package/web/chunk-g3vbtxgy.js.br +0 -0
  268. package/web/chunk-g3vbtxgy.js.gz +0 -0
  269. package/web/chunk-gbcf0rdk.js +1 -0
  270. package/web/chunk-gbcf0rdk.js.br +0 -0
  271. package/web/chunk-gbcf0rdk.js.gz +0 -0
  272. package/web/chunk-gj6bdv1y.js +200 -0
  273. package/web/chunk-gj6bdv1y.js.br +0 -0
  274. package/web/chunk-gj6bdv1y.js.gz +0 -0
  275. package/web/chunk-gk1bc3c3.js +2 -0
  276. package/web/chunk-gk1bc3c3.js.br +0 -0
  277. package/web/chunk-gk1bc3c3.js.gz +0 -0
  278. package/web/chunk-gpjytpyw.js +2 -0
  279. package/web/chunk-gpjytpyw.js.br +0 -0
  280. package/web/chunk-gpjytpyw.js.gz +0 -0
  281. package/web/chunk-h1c0m3g4.js +99 -0
  282. package/web/chunk-h1c0m3g4.js.br +0 -0
  283. package/web/chunk-h1c0m3g4.js.gz +0 -0
  284. package/web/chunk-h1qv0cpd.css +1 -0
  285. package/web/chunk-h1qv0cpd.css.br +0 -0
  286. package/web/chunk-h1qv0cpd.css.gz +0 -0
  287. package/web/chunk-hj067dfg.js +1 -0
  288. package/web/chunk-hj067dfg.js.br +2 -0
  289. package/web/chunk-hj067dfg.js.gz +0 -0
  290. package/web/chunk-hq7e5xgd.js +1 -0
  291. package/web/chunk-hq7e5xgd.js.br +0 -0
  292. package/web/chunk-hq7e5xgd.js.gz +0 -0
  293. package/web/chunk-hqt1f3fm.js +24 -0
  294. package/web/chunk-hqt1f3fm.js.br +0 -0
  295. package/web/chunk-hqt1f3fm.js.gz +0 -0
  296. package/web/chunk-hwxj58j5.js +2 -0
  297. package/web/chunk-hwxj58j5.js.br +0 -0
  298. package/web/chunk-hwxj58j5.js.gz +0 -0
  299. package/web/chunk-hxzb25a8.js +1 -0
  300. package/web/chunk-hxzb25a8.js.br +0 -0
  301. package/web/chunk-hxzb25a8.js.gz +0 -0
  302. package/web/chunk-j4942vkb.js +1 -0
  303. package/web/chunk-j4942vkb.js.br +0 -0
  304. package/web/chunk-j4942vkb.js.gz +0 -0
  305. package/web/chunk-jmnzcm1f.js +21 -0
  306. package/web/chunk-jmnzcm1f.js.br +0 -0
  307. package/web/chunk-jmnzcm1f.js.gz +0 -0
  308. package/web/chunk-js940jjj.js +40 -0
  309. package/web/chunk-js940jjj.js.br +0 -0
  310. package/web/chunk-js940jjj.js.gz +0 -0
  311. package/web/chunk-jy9vkfbf.js +1 -0
  312. package/web/chunk-jy9vkfbf.js.br +0 -0
  313. package/web/chunk-jy9vkfbf.js.gz +0 -0
  314. package/web/chunk-k1d0y72z.js +2 -0
  315. package/web/chunk-k1d0y72z.js.br +0 -0
  316. package/web/chunk-k1d0y72z.js.gz +0 -0
  317. package/web/chunk-k4pknkvp.js +16 -0
  318. package/web/chunk-k4pknkvp.js.br +0 -0
  319. package/web/chunk-k4pknkvp.js.gz +0 -0
  320. package/web/chunk-k6fwzn0z.js +324 -0
  321. package/web/chunk-k6fwzn0z.js.br +0 -0
  322. package/web/chunk-k6fwzn0z.js.gz +0 -0
  323. package/web/chunk-kdegb6pd.js +169 -0
  324. package/web/chunk-kdegb6pd.js.br +0 -0
  325. package/web/chunk-kdegb6pd.js.gz +0 -0
  326. package/web/chunk-kedjfh66.js +2 -0
  327. package/web/chunk-kedjfh66.js.br +0 -0
  328. package/web/chunk-kedjfh66.js.gz +0 -0
  329. package/web/chunk-kh0xyffx.js +1 -0
  330. package/web/chunk-kh0xyffx.js.br +0 -0
  331. package/web/chunk-kh0xyffx.js.gz +0 -0
  332. package/web/chunk-ktvxgxsd.js +2 -0
  333. package/web/chunk-ktvxgxsd.js.br +0 -0
  334. package/web/chunk-ktvxgxsd.js.gz +0 -0
  335. package/web/chunk-mbpv2w5h.js +78 -0
  336. package/web/chunk-mbpv2w5h.js.br +0 -0
  337. package/web/chunk-mbpv2w5h.js.gz +0 -0
  338. package/web/chunk-mh3nkkpx.js +84 -0
  339. package/web/chunk-mh3nkkpx.js.br +0 -0
  340. package/web/chunk-mh3nkkpx.js.gz +0 -0
  341. package/web/chunk-mhzqgzh0.js +89 -0
  342. package/web/chunk-mhzqgzh0.js.br +0 -0
  343. package/web/chunk-mhzqgzh0.js.gz +0 -0
  344. package/web/chunk-mj8dzc8q.js +214 -0
  345. package/web/chunk-mj8dzc8q.js.br +0 -0
  346. package/web/chunk-mj8dzc8q.js.gz +0 -0
  347. package/web/chunk-mwfrxgbs.js +2 -0
  348. package/web/chunk-mwfrxgbs.js.br +0 -0
  349. package/web/chunk-mwfrxgbs.js.gz +0 -0
  350. package/web/chunk-n419cees.js +1 -0
  351. package/web/chunk-n419cees.js.br +0 -0
  352. package/web/chunk-n419cees.js.gz +0 -0
  353. package/web/chunk-n45fgfyt.js +1 -0
  354. package/web/chunk-n45fgfyt.js.br +2 -0
  355. package/web/chunk-n45fgfyt.js.gz +0 -0
  356. package/web/chunk-n5v71fas.js +2 -0
  357. package/web/chunk-n5v71fas.js.br +0 -0
  358. package/web/chunk-n5v71fas.js.gz +0 -0
  359. package/web/chunk-nb58m79v.js +89 -0
  360. package/web/chunk-nb58m79v.js.br +0 -0
  361. package/web/chunk-nb58m79v.js.gz +0 -0
  362. package/web/chunk-nsna2v2r.js +1 -0
  363. package/web/chunk-nsna2v2r.js.br +0 -0
  364. package/web/chunk-nsna2v2r.js.gz +0 -0
  365. package/web/chunk-nxdp58nf.js +1 -0
  366. package/web/chunk-nxdp58nf.js.br +0 -0
  367. package/web/chunk-nxdp58nf.js.gz +0 -0
  368. package/web/chunk-nytgs01h.js +1 -0
  369. package/web/chunk-nytgs01h.js.br +0 -0
  370. package/web/chunk-nytgs01h.js.gz +0 -0
  371. package/web/chunk-p76f6cf4.js +2 -0
  372. package/web/chunk-p76f6cf4.js.br +0 -0
  373. package/web/chunk-p76f6cf4.js.gz +0 -0
  374. package/web/chunk-pkxn54jm.js +1 -0
  375. package/web/chunk-pkxn54jm.js.br +0 -0
  376. package/web/chunk-pkxn54jm.js.gz +0 -0
  377. package/web/chunk-q0srq8g5.js +1 -0
  378. package/web/chunk-q0srq8g5.js.br +0 -0
  379. package/web/chunk-q0srq8g5.js.gz +0 -0
  380. package/web/chunk-qgtqwmkb.js +1 -0
  381. package/web/chunk-qgtqwmkb.js.br +2 -0
  382. package/web/chunk-qgtqwmkb.js.gz +0 -0
  383. package/web/chunk-qjg6dw46.js +1134 -0
  384. package/web/chunk-qjg6dw46.js.br +0 -0
  385. package/web/chunk-qjg6dw46.js.gz +0 -0
  386. package/web/chunk-qjjxevxe.js +1 -0
  387. package/web/chunk-qjjxevxe.js.br +0 -0
  388. package/web/chunk-qjjxevxe.js.gz +0 -0
  389. package/web/chunk-qx5ab39c.js +4 -0
  390. package/web/chunk-qx5ab39c.js.br +0 -0
  391. package/web/chunk-qx5ab39c.js.gz +0 -0
  392. package/web/chunk-qygjhm63.js +1 -0
  393. package/web/chunk-qygjhm63.js.br +0 -0
  394. package/web/chunk-qygjhm63.js.gz +0 -0
  395. package/web/chunk-recfg8af.js +2 -0
  396. package/web/chunk-recfg8af.js.br +0 -0
  397. package/web/chunk-recfg8af.js.gz +0 -0
  398. package/web/chunk-rfsg5rke.js +1 -0
  399. package/web/chunk-rfsg5rke.js.br +2 -0
  400. package/web/chunk-rfsg5rke.js.gz +0 -0
  401. package/web/chunk-s7h50avx.js +2 -0
  402. package/web/chunk-s7h50avx.js.br +0 -0
  403. package/web/chunk-s7h50avx.js.gz +0 -0
  404. package/web/chunk-sk47kk5j.js +1 -0
  405. package/web/chunk-sk47kk5j.js.br +0 -0
  406. package/web/chunk-sk47kk5j.js.gz +0 -0
  407. package/web/chunk-t9heac9a.js +2 -0
  408. package/web/chunk-t9heac9a.js.br +0 -0
  409. package/web/chunk-t9heac9a.js.gz +0 -0
  410. package/web/chunk-tg3f9xmp.js +1 -0
  411. package/web/chunk-tg3f9xmp.js.br +0 -0
  412. package/web/chunk-tg3f9xmp.js.gz +0 -0
  413. package/web/chunk-tgeeggkh.js +1 -0
  414. package/web/chunk-tgeeggkh.js.br +0 -0
  415. package/web/chunk-tgeeggkh.js.gz +0 -0
  416. package/web/chunk-v2bkkhb8.js +303 -0
  417. package/web/chunk-v2bkkhb8.js.br +0 -0
  418. package/web/chunk-v2bkkhb8.js.gz +0 -0
  419. package/web/chunk-v5p2fds9.js +36 -0
  420. package/web/chunk-v5p2fds9.js.br +0 -0
  421. package/web/chunk-v5p2fds9.js.gz +0 -0
  422. package/web/chunk-v6snw1sw.js +1 -0
  423. package/web/chunk-v6snw1sw.js.br +0 -0
  424. package/web/chunk-v6snw1sw.js.gz +0 -0
  425. package/web/chunk-veadbga2.js +1 -0
  426. package/web/chunk-veadbga2.js.br +2 -0
  427. package/web/chunk-veadbga2.js.gz +0 -0
  428. package/web/chunk-vh2prc6k.js +1 -0
  429. package/web/chunk-vh2prc6k.js.br +0 -0
  430. package/web/chunk-vh2prc6k.js.gz +0 -0
  431. package/web/chunk-vhpzp7zd.js +2 -0
  432. package/web/chunk-vhpzp7zd.js.br +0 -0
  433. package/web/chunk-vhpzp7zd.js.gz +0 -0
  434. package/web/chunk-vpbnyz43.js +98 -0
  435. package/web/chunk-vpbnyz43.js.br +0 -0
  436. package/web/chunk-vpbnyz43.js.gz +0 -0
  437. package/web/chunk-vxadngbp.js +2 -0
  438. package/web/chunk-vxadngbp.js.br +3 -0
  439. package/web/chunk-vxadngbp.js.gz +0 -0
  440. package/web/chunk-wa8wr2y9.js +106 -0
  441. package/web/chunk-wa8wr2y9.js.br +0 -0
  442. package/web/chunk-wa8wr2y9.js.gz +0 -0
  443. package/web/chunk-wbxz2bjb.js +1 -0
  444. package/web/chunk-wbxz2bjb.js.br +0 -0
  445. package/web/chunk-wbxz2bjb.js.gz +0 -0
  446. package/web/chunk-wgzatts8.js +1 -0
  447. package/web/chunk-wgzatts8.js.br +0 -0
  448. package/web/chunk-wgzatts8.js.gz +0 -0
  449. package/web/chunk-whczyxqw.js +1 -0
  450. package/web/chunk-whczyxqw.js.br +0 -0
  451. package/web/chunk-whczyxqw.js.gz +0 -0
  452. package/web/chunk-wmzz2crn.js +1 -0
  453. package/web/chunk-wmzz2crn.js.br +0 -0
  454. package/web/chunk-wmzz2crn.js.gz +0 -0
  455. package/web/chunk-wvqcbp4a.js +1 -0
  456. package/web/chunk-wvqcbp4a.js.br +0 -0
  457. package/web/chunk-wvqcbp4a.js.gz +0 -0
  458. package/web/chunk-wvvrdqgb.js +1 -0
  459. package/web/chunk-wvvrdqgb.js.br +2 -0
  460. package/web/chunk-wvvrdqgb.js.gz +0 -0
  461. package/web/chunk-x2hxq5yr.js +55 -0
  462. package/web/chunk-x2hxq5yr.js.br +0 -0
  463. package/web/chunk-x2hxq5yr.js.gz +0 -0
  464. package/web/chunk-x8bnp6vr.js +1 -0
  465. package/web/chunk-x8bnp6vr.js.br +0 -0
  466. package/web/chunk-x8bnp6vr.js.gz +0 -0
  467. package/web/chunk-xp9tdb5t.js +1 -0
  468. package/web/chunk-xp9tdb5t.js.br +2 -0
  469. package/web/chunk-xp9tdb5t.js.gz +0 -0
  470. package/web/chunk-xvmzsftt.js +2 -0
  471. package/web/chunk-xvmzsftt.js.br +0 -0
  472. package/web/chunk-xvmzsftt.js.gz +0 -0
  473. package/web/chunk-y10hsdq4.js +1 -0
  474. package/web/chunk-y10hsdq4.js.br +0 -0
  475. package/web/chunk-y10hsdq4.js.gz +0 -0
  476. package/web/chunk-ye7vge7s.js +1 -0
  477. package/web/chunk-ye7vge7s.js.br +0 -0
  478. package/web/chunk-ye7vge7s.js.gz +0 -0
  479. package/web/chunk-zbzgd8kn.js +2 -0
  480. package/web/chunk-zbzgd8kn.js.br +0 -0
  481. package/web/chunk-zbzgd8kn.js.gz +0 -0
  482. package/web/chunk-zhwqscat.js +1 -0
  483. package/web/chunk-zhwqscat.js.br +0 -0
  484. package/web/chunk-zhwqscat.js.gz +0 -0
  485. package/web/chunk-znrsm604.js +370 -0
  486. package/web/chunk-znrsm604.js.br +0 -0
  487. package/web/chunk-znrsm604.js.gz +0 -0
  488. package/web/chunk-zthww0ws.js +1 -0
  489. package/web/chunk-zthww0ws.js.br +0 -0
  490. package/web/chunk-zthww0ws.js.gz +0 -0
  491. package/web/index.html +3 -1
  492. package/web/index.html.br +0 -0
  493. package/web/index.html.gz +0 -0
  494. package/worker.js +1 -1
  495. package/chunk-02q61grt.js +0 -3
  496. package/chunk-03r6s8pm.js +0 -2
  497. package/chunk-09fsdkd3.js +0 -5
  498. package/chunk-0bg4w7ht.js +0 -3
  499. package/chunk-0s4r7k7j.js +0 -2
  500. package/chunk-27kw4nth.js +0 -2
  501. package/chunk-2ag9mvms.js +0 -10
  502. package/chunk-2shwjp8q.js +0 -3
  503. package/chunk-3114vstw.js +0 -2
  504. package/chunk-31meb34a.js +0 -2
  505. package/chunk-34w345mt.js +0 -2
  506. package/chunk-3amfr8zp.js +0 -7
  507. package/chunk-40nk2jjt.js +0 -2
  508. package/chunk-49bz6hg5.js +0 -25
  509. package/chunk-4hgkwa4k.js +0 -3
  510. package/chunk-4wfd77kc.js +0 -2
  511. package/chunk-55kpabb3.js +0 -2
  512. package/chunk-5p2asrj6.js +0 -2
  513. package/chunk-65hg0v7e.js +0 -2
  514. package/chunk-67qw30cj.js +0 -3770
  515. package/chunk-6rehcf49.js +0 -12
  516. package/chunk-6vkz3wqz.js +0 -25
  517. package/chunk-81yk0kj2.js +0 -3
  518. package/chunk-885vf5kb.js +0 -2
  519. package/chunk-8wy08x0d.js +0 -2
  520. package/chunk-9cqa9trx.js +0 -4
  521. package/chunk-ae45qq4z.js +0 -2
  522. package/chunk-ag3em5yv.js +0 -4
  523. package/chunk-b5k5p49x.js +0 -2
  524. package/chunk-b84vbfjc.js +0 -2
  525. package/chunk-dkpgstr2.js +0 -18
  526. package/chunk-dzn4c87v.js +0 -3
  527. package/chunk-e5xsyr0n.js +0 -3
  528. package/chunk-f97ma522.js +0 -3
  529. package/chunk-f9yneea6.js +0 -3
  530. package/chunk-fk43jgwe.js +0 -31
  531. package/chunk-frjqjdkx.js +0 -11
  532. package/chunk-fycz7ap5.js +0 -2
  533. package/chunk-fzefs6kn.js +0 -3
  534. package/chunk-g1n8k4dg.js +0 -5
  535. package/chunk-g5mdw639.js +0 -3
  536. package/chunk-gnvx44kj.js +0 -10
  537. package/chunk-gpympx0t.js +0 -467
  538. package/chunk-gyp2jn7d.js +0 -3
  539. package/chunk-hambwbfz.js +0 -7
  540. package/chunk-j02kqpvq.js +0 -5
  541. package/chunk-j1h7pabk.js +0 -7
  542. package/chunk-j6hn9qz6.js +0 -3
  543. package/chunk-jfx4c32t.js +0 -8
  544. package/chunk-jjj8a18b.js +0 -59
  545. package/chunk-k3c32v59.js +0 -3
  546. package/chunk-k8j3fvx5.js +0 -2
  547. package/chunk-kcn3af9r.js +0 -12
  548. package/chunk-m45dpnd1.js +0 -16
  549. package/chunk-m4wf04dz.js +0 -15
  550. package/chunk-m8k6t63k.js +0 -2
  551. package/chunk-nrggp4x6.js +0 -2
  552. package/chunk-nt549hv5.js +0 -2
  553. package/chunk-pg4mtrdy.js +0 -3
  554. package/chunk-psr4rxnn.js +0 -20
  555. package/chunk-qhhv81gd.js +0 -2
  556. package/chunk-qprms4rt.js +0 -2
  557. package/chunk-r0pm6dap.js +0 -3
  558. package/chunk-rck0kx09.js +0 -2
  559. package/chunk-rsn8ad6s.js +0 -2
  560. package/chunk-skzh3q1s.js +0 -2
  561. package/chunk-sm4b3q49.js +0 -3
  562. package/chunk-ste3ek53.js +0 -3
  563. package/chunk-trw86cmb.js +0 -11
  564. package/chunk-tv7met41.js +0 -3
  565. package/chunk-w33aapmk.js +0 -39
  566. package/chunk-wkqrsfrb.js +0 -389
  567. package/chunk-wxngqzqs.js +0 -3
  568. package/chunk-xafx1p7z.js +0 -3
  569. package/chunk-xgfqmm46.js +0 -2
  570. package/chunk-xr77j4f8.js +0 -9
  571. package/chunk-ykstnss8.js +0 -3
  572. package/chunk-yqv7ej5r.js +0 -5
  573. package/chunk-z97bcdg2.js +0 -3
  574. package/chunk-z9s7pwv5.js +0 -7
  575. package/web/chunk-013et20n.js +0 -2
  576. package/web/chunk-013et20n.js.br +0 -0
  577. package/web/chunk-013et20n.js.gz +0 -0
  578. package/web/chunk-0ernj3c0.js +0 -1
  579. package/web/chunk-0ernj3c0.js.br +0 -0
  580. package/web/chunk-0ernj3c0.js.gz +0 -0
  581. package/web/chunk-0j65yg1p.js +0 -1
  582. package/web/chunk-0j65yg1p.js.br +0 -0
  583. package/web/chunk-0j65yg1p.js.gz +0 -0
  584. package/web/chunk-0khcpaa8.js +0 -1
  585. package/web/chunk-0khcpaa8.js.br +0 -0
  586. package/web/chunk-0khcpaa8.js.gz +0 -0
  587. package/web/chunk-0wbdd74r.js +0 -1
  588. package/web/chunk-0wbdd74r.js.br +0 -2
  589. package/web/chunk-0wbdd74r.js.gz +0 -0
  590. package/web/chunk-1f2wvhq9.js +0 -1
  591. package/web/chunk-1f2wvhq9.js.br +0 -0
  592. package/web/chunk-1f2wvhq9.js.gz +0 -0
  593. package/web/chunk-1q2kmv35.js +0 -332
  594. package/web/chunk-1q2kmv35.js.br +0 -0
  595. package/web/chunk-1q2kmv35.js.gz +0 -0
  596. package/web/chunk-1tfrm3pk.js +0 -2
  597. package/web/chunk-1tfrm3pk.js.br +0 -0
  598. package/web/chunk-1tfrm3pk.js.gz +0 -0
  599. package/web/chunk-2qt5fy5n.js +0 -1
  600. package/web/chunk-2qt5fy5n.js.br +0 -0
  601. package/web/chunk-2qt5fy5n.js.gz +0 -0
  602. package/web/chunk-2sxtb709.js +0 -1
  603. package/web/chunk-2sxtb709.js.br +0 -0
  604. package/web/chunk-2sxtb709.js.gz +0 -0
  605. package/web/chunk-2wrwm0qe.js +0 -1
  606. package/web/chunk-2wrwm0qe.js.br +0 -0
  607. package/web/chunk-2wrwm0qe.js.gz +0 -0
  608. package/web/chunk-2wwj27b9.js +0 -7
  609. package/web/chunk-2wwj27b9.js.br +0 -0
  610. package/web/chunk-2wwj27b9.js.gz +0 -0
  611. package/web/chunk-33mmrjdp.js +0 -1
  612. package/web/chunk-33mmrjdp.js.br +0 -2
  613. package/web/chunk-33mmrjdp.js.gz +0 -0
  614. package/web/chunk-33tb7q04.js +0 -2
  615. package/web/chunk-33tb7q04.js.br +0 -0
  616. package/web/chunk-33tb7q04.js.gz +0 -0
  617. package/web/chunk-3txb4sha.js +0 -1
  618. package/web/chunk-3txb4sha.js.br +0 -0
  619. package/web/chunk-3txb4sha.js.gz +0 -0
  620. package/web/chunk-3xgfsx7y.js +0 -2
  621. package/web/chunk-3xgfsx7y.js.br +0 -0
  622. package/web/chunk-3xgfsx7y.js.gz +0 -0
  623. package/web/chunk-40jka4r7.js +0 -2
  624. package/web/chunk-40jka4r7.js.br +0 -0
  625. package/web/chunk-40jka4r7.js.gz +0 -0
  626. package/web/chunk-41vh5n86.js +0 -1
  627. package/web/chunk-41vh5n86.js.br +0 -0
  628. package/web/chunk-41vh5n86.js.gz +0 -0
  629. package/web/chunk-5kz048x3.js +0 -2
  630. package/web/chunk-5kz048x3.js.br +0 -0
  631. package/web/chunk-5kz048x3.js.gz +0 -0
  632. package/web/chunk-5mbz8yj9.js +0 -3
  633. package/web/chunk-5mbz8yj9.js.br +0 -0
  634. package/web/chunk-5mbz8yj9.js.gz +0 -0
  635. package/web/chunk-6024wfxb.js +0 -30
  636. package/web/chunk-6024wfxb.js.br +0 -0
  637. package/web/chunk-6024wfxb.js.gz +0 -0
  638. package/web/chunk-6ey4c6gw.js +0 -2
  639. package/web/chunk-6ey4c6gw.js.br +0 -0
  640. package/web/chunk-6ey4c6gw.js.gz +0 -0
  641. package/web/chunk-6q3p851n.js +0 -1
  642. package/web/chunk-6q3p851n.js.br +0 -2
  643. package/web/chunk-6q3p851n.js.gz +0 -0
  644. package/web/chunk-74g3wh08.js +0 -2
  645. package/web/chunk-74g3wh08.js.br +0 -0
  646. package/web/chunk-74g3wh08.js.gz +0 -0
  647. package/web/chunk-78akzkgs.js +0 -84
  648. package/web/chunk-78akzkgs.js.br +0 -0
  649. package/web/chunk-78akzkgs.js.gz +0 -0
  650. package/web/chunk-7ck99bsp.js +0 -62
  651. package/web/chunk-7ck99bsp.js.br +0 -0
  652. package/web/chunk-7ck99bsp.js.gz +0 -0
  653. package/web/chunk-7fjbyns9.js +0 -1
  654. package/web/chunk-7fjbyns9.js.br +0 -0
  655. package/web/chunk-7fjbyns9.js.gz +0 -0
  656. package/web/chunk-7n6b2xra.js +0 -21
  657. package/web/chunk-7n6b2xra.js.br +0 -0
  658. package/web/chunk-7n6b2xra.js.gz +0 -0
  659. package/web/chunk-7p4mcqkd.js +0 -78
  660. package/web/chunk-7p4mcqkd.js.br +0 -0
  661. package/web/chunk-7p4mcqkd.js.gz +0 -0
  662. package/web/chunk-7ztwkhg5.js +0 -1
  663. package/web/chunk-7ztwkhg5.js.br +0 -0
  664. package/web/chunk-7ztwkhg5.js.gz +0 -0
  665. package/web/chunk-823etvc3.js +0 -99
  666. package/web/chunk-823etvc3.js.br +0 -0
  667. package/web/chunk-823etvc3.js.gz +0 -0
  668. package/web/chunk-8ec53vjd.js +0 -1
  669. package/web/chunk-8ec53vjd.js.br +0 -0
  670. package/web/chunk-8ec53vjd.js.gz +0 -0
  671. package/web/chunk-8g55ytgz.js +0 -1
  672. package/web/chunk-8g55ytgz.js.br +0 -0
  673. package/web/chunk-8g55ytgz.js.gz +0 -0
  674. package/web/chunk-8nxjthxc.js +0 -1
  675. package/web/chunk-8nxjthxc.js.br +0 -0
  676. package/web/chunk-8nxjthxc.js.gz +0 -0
  677. package/web/chunk-8q76yd76.js +0 -291
  678. package/web/chunk-8q76yd76.js.br +0 -0
  679. package/web/chunk-8q76yd76.js.gz +0 -0
  680. package/web/chunk-9kbrjmtz.js +0 -1
  681. package/web/chunk-9kbrjmtz.js.br +0 -0
  682. package/web/chunk-9kbrjmtz.js.gz +0 -0
  683. package/web/chunk-9s4bh6qm.js +0 -40
  684. package/web/chunk-9s4bh6qm.js.br +0 -0
  685. package/web/chunk-9s4bh6qm.js.gz +0 -0
  686. package/web/chunk-9vf3zy3d.js +0 -2
  687. package/web/chunk-9vf3zy3d.js.br +0 -0
  688. package/web/chunk-9vf3zy3d.js.gz +0 -0
  689. package/web/chunk-a449xjq6.js +0 -7
  690. package/web/chunk-a449xjq6.js.br +0 -0
  691. package/web/chunk-a449xjq6.js.gz +0 -0
  692. package/web/chunk-b05eay33.js +0 -1
  693. package/web/chunk-b05eay33.js.br +0 -0
  694. package/web/chunk-b05eay33.js.gz +0 -0
  695. package/web/chunk-bdypt5mj.js +0 -142
  696. package/web/chunk-bdypt5mj.js.br +0 -0
  697. package/web/chunk-bdypt5mj.js.gz +0 -0
  698. package/web/chunk-ccy2q2z0.js +0 -2
  699. package/web/chunk-ccy2q2z0.js.br +0 -0
  700. package/web/chunk-ccy2q2z0.js.gz +0 -0
  701. package/web/chunk-ceg13tma.js +0 -2
  702. package/web/chunk-ceg13tma.js.br +0 -0
  703. package/web/chunk-ceg13tma.js.gz +0 -0
  704. package/web/chunk-ch60a61d.js +0 -2
  705. package/web/chunk-ch60a61d.js.br +0 -0
  706. package/web/chunk-ch60a61d.js.gz +0 -0
  707. package/web/chunk-czvdg0c5.js +0 -1
  708. package/web/chunk-czvdg0c5.js.br +0 -0
  709. package/web/chunk-czvdg0c5.js.gz +0 -0
  710. package/web/chunk-drr7mqg2.js +0 -1
  711. package/web/chunk-drr7mqg2.js.br +0 -0
  712. package/web/chunk-drr7mqg2.js.gz +0 -0
  713. package/web/chunk-dsa5m3h6.js +0 -200
  714. package/web/chunk-dsa5m3h6.js.br +0 -0
  715. package/web/chunk-dsa5m3h6.js.gz +0 -0
  716. package/web/chunk-dww3grm3.js +0 -24
  717. package/web/chunk-dww3grm3.js.br +0 -0
  718. package/web/chunk-dww3grm3.js.gz +0 -0
  719. package/web/chunk-e187gt5x.js +0 -1
  720. package/web/chunk-e187gt5x.js.br +0 -0
  721. package/web/chunk-e187gt5x.js.gz +0 -0
  722. package/web/chunk-emxa4wv3.js +0 -2
  723. package/web/chunk-emxa4wv3.js.br +0 -0
  724. package/web/chunk-emxa4wv3.js.gz +0 -0
  725. package/web/chunk-ey0zwvbx.js +0 -1
  726. package/web/chunk-ey0zwvbx.js.br +0 -0
  727. package/web/chunk-ey0zwvbx.js.gz +0 -0
  728. package/web/chunk-ey14knbn.js +0 -2
  729. package/web/chunk-ey14knbn.js.br +0 -0
  730. package/web/chunk-ey14knbn.js.gz +0 -0
  731. package/web/chunk-fba06jm8.js +0 -1132
  732. package/web/chunk-fba06jm8.js.br +0 -0
  733. package/web/chunk-fba06jm8.js.gz +0 -0
  734. package/web/chunk-fh56vgfx.js +0 -39
  735. package/web/chunk-fh56vgfx.js.br +0 -0
  736. package/web/chunk-fh56vgfx.js.gz +0 -0
  737. package/web/chunk-ft05x3my.js +0 -169
  738. package/web/chunk-ft05x3my.js.br +0 -0
  739. package/web/chunk-ft05x3my.js.gz +0 -0
  740. package/web/chunk-fzmrnh17.js +0 -303
  741. package/web/chunk-fzmrnh17.js.br +0 -0
  742. package/web/chunk-fzmrnh17.js.gz +0 -0
  743. package/web/chunk-gbt7asd7.js +0 -2
  744. package/web/chunk-gbt7asd7.js.br +0 -0
  745. package/web/chunk-gbt7asd7.js.gz +0 -0
  746. package/web/chunk-gh9fkn3t.js +0 -1
  747. package/web/chunk-gh9fkn3t.js.br +0 -2
  748. package/web/chunk-gh9fkn3t.js.gz +0 -0
  749. package/web/chunk-h1syyjqq.js +0 -2
  750. package/web/chunk-h1syyjqq.js.br +0 -0
  751. package/web/chunk-h1syyjqq.js.gz +0 -0
  752. package/web/chunk-h7byk4z3.js +0 -140
  753. package/web/chunk-h7byk4z3.js.br +0 -0
  754. package/web/chunk-h7byk4z3.js.gz +0 -0
  755. package/web/chunk-hby0hkv4.js +0 -1
  756. package/web/chunk-hby0hkv4.js.br +0 -0
  757. package/web/chunk-hby0hkv4.js.gz +0 -0
  758. package/web/chunk-hjvsp2yx.js +0 -1
  759. package/web/chunk-hjvsp2yx.js.br +0 -0
  760. package/web/chunk-hjvsp2yx.js.gz +0 -0
  761. package/web/chunk-hpjzy5ww.js +0 -1
  762. package/web/chunk-hpjzy5ww.js.br +0 -0
  763. package/web/chunk-hpjzy5ww.js.gz +0 -0
  764. package/web/chunk-hzfp8kqx.js +0 -217
  765. package/web/chunk-hzfp8kqx.js.br +0 -0
  766. package/web/chunk-hzfp8kqx.js.gz +0 -0
  767. package/web/chunk-j6jjk46a.js +0 -2
  768. package/web/chunk-j6jjk46a.js.br +0 -0
  769. package/web/chunk-j6jjk46a.js.gz +0 -0
  770. package/web/chunk-j8f0m1dq.js +0 -1
  771. package/web/chunk-j8f0m1dq.js.br +0 -0
  772. package/web/chunk-j8f0m1dq.js.gz +0 -0
  773. package/web/chunk-jc178ad5.js +0 -2
  774. package/web/chunk-jc178ad5.js.br +0 -0
  775. package/web/chunk-jc178ad5.js.gz +0 -0
  776. package/web/chunk-jcsf0ke5.js +0 -41
  777. package/web/chunk-jcsf0ke5.js.br +0 -0
  778. package/web/chunk-jcsf0ke5.js.gz +0 -0
  779. package/web/chunk-jg43a2xk.js +0 -139
  780. package/web/chunk-jg43a2xk.js.br +0 -0
  781. package/web/chunk-jg43a2xk.js.gz +0 -0
  782. package/web/chunk-jrgdxqtq.js +0 -7
  783. package/web/chunk-jrgdxqtq.js.br +0 -0
  784. package/web/chunk-jrgdxqtq.js.gz +0 -0
  785. package/web/chunk-js8dvtfg.js +0 -2
  786. package/web/chunk-js8dvtfg.js.br +0 -0
  787. package/web/chunk-js8dvtfg.js.gz +0 -0
  788. package/web/chunk-jt0s9qs7.js +0 -1
  789. package/web/chunk-jt0s9qs7.js.br +0 -0
  790. package/web/chunk-jt0s9qs7.js.gz +0 -0
  791. package/web/chunk-jv5faf88.js +0 -34
  792. package/web/chunk-jv5faf88.js.br +0 -0
  793. package/web/chunk-jv5faf88.js.gz +0 -0
  794. package/web/chunk-k295x81w.js +0 -370
  795. package/web/chunk-k295x81w.js.br +0 -0
  796. package/web/chunk-k295x81w.js.gz +0 -0
  797. package/web/chunk-k3aa37pw.js +0 -2
  798. package/web/chunk-k3aa37pw.js.br +0 -0
  799. package/web/chunk-k3aa37pw.js.gz +0 -0
  800. package/web/chunk-k6wxwgp1.js +0 -55
  801. package/web/chunk-k6wxwgp1.js.br +0 -0
  802. package/web/chunk-k6wxwgp1.js.gz +0 -0
  803. package/web/chunk-k9vc7kp2.js +0 -292
  804. package/web/chunk-k9vc7kp2.js.br +0 -0
  805. package/web/chunk-k9vc7kp2.js.gz +0 -0
  806. package/web/chunk-kxyws7q7.js +0 -1
  807. package/web/chunk-kxyws7q7.js.br +0 -0
  808. package/web/chunk-kxyws7q7.js.gz +0 -0
  809. package/web/chunk-mcgf645h.js +0 -1
  810. package/web/chunk-mcgf645h.js.br +0 -4
  811. package/web/chunk-mcgf645h.js.gz +0 -0
  812. package/web/chunk-mj3tshy8.js +0 -214
  813. package/web/chunk-mj3tshy8.js.br +0 -0
  814. package/web/chunk-mj3tshy8.js.gz +0 -0
  815. package/web/chunk-mnb2wdvy.js +0 -24
  816. package/web/chunk-mnb2wdvy.js.br +0 -0
  817. package/web/chunk-mnb2wdvy.js.gz +0 -0
  818. package/web/chunk-ndf58dgc.js +0 -1
  819. package/web/chunk-ndf58dgc.js.br +0 -0
  820. package/web/chunk-ndf58dgc.js.gz +0 -0
  821. package/web/chunk-nhpm5nd5.js +0 -2
  822. package/web/chunk-nhpm5nd5.js.br +0 -0
  823. package/web/chunk-nhpm5nd5.js.gz +0 -0
  824. package/web/chunk-nwxjdetb.js +0 -1
  825. package/web/chunk-nwxjdetb.js.br +0 -0
  826. package/web/chunk-nwxjdetb.js.gz +0 -0
  827. package/web/chunk-nyjfcard.js +0 -106
  828. package/web/chunk-nyjfcard.js.br +0 -0
  829. package/web/chunk-nyjfcard.js.gz +0 -0
  830. package/web/chunk-pcfjcy3a.js +0 -324
  831. package/web/chunk-pcfjcy3a.js.br +0 -0
  832. package/web/chunk-pcfjcy3a.js.gz +0 -0
  833. package/web/chunk-pry6wdbe.js +0 -1
  834. package/web/chunk-pry6wdbe.js.br +0 -0
  835. package/web/chunk-pry6wdbe.js.gz +0 -0
  836. package/web/chunk-pvahdcgy.js +0 -2
  837. package/web/chunk-pvahdcgy.js.br +0 -0
  838. package/web/chunk-pvahdcgy.js.gz +0 -0
  839. package/web/chunk-q3njnnef.js +0 -16
  840. package/web/chunk-q3njnnef.js.br +0 -0
  841. package/web/chunk-q3njnnef.js.gz +0 -0
  842. package/web/chunk-qxvqkkmw.js +0 -1
  843. package/web/chunk-qxvqkkmw.js.br +0 -0
  844. package/web/chunk-qxvqkkmw.js.gz +0 -0
  845. package/web/chunk-qych3sbs.js +0 -1
  846. package/web/chunk-qych3sbs.js.br +0 -0
  847. package/web/chunk-qych3sbs.js.gz +0 -0
  848. package/web/chunk-rbmp2e4b.js +0 -1
  849. package/web/chunk-rbmp2e4b.js.br +0 -0
  850. package/web/chunk-rbmp2e4b.js.gz +0 -0
  851. package/web/chunk-rcre1stj.js +0 -1
  852. package/web/chunk-rcre1stj.js.br +0 -0
  853. package/web/chunk-rcre1stj.js.gz +0 -0
  854. package/web/chunk-rdb6091n.js +0 -89
  855. package/web/chunk-rdb6091n.js.br +0 -0
  856. package/web/chunk-rdb6091n.js.gz +0 -0
  857. package/web/chunk-ryw7xnab.js +0 -1
  858. package/web/chunk-ryw7xnab.js.br +0 -0
  859. package/web/chunk-ryw7xnab.js.gz +0 -0
  860. package/web/chunk-sbbmy02e.js +0 -2
  861. package/web/chunk-sbbmy02e.js.br +0 -0
  862. package/web/chunk-sbbmy02e.js.gz +0 -0
  863. package/web/chunk-sgbc835w.js +0 -2
  864. package/web/chunk-sgbc835w.js.br +0 -0
  865. package/web/chunk-sgbc835w.js.gz +0 -0
  866. package/web/chunk-sydy10mb.js +0 -1
  867. package/web/chunk-sydy10mb.js.br +0 -0
  868. package/web/chunk-sydy10mb.js.gz +0 -0
  869. package/web/chunk-t0ywnp5e.js +0 -1
  870. package/web/chunk-t0ywnp5e.js.br +0 -0
  871. package/web/chunk-t0ywnp5e.js.gz +0 -0
  872. package/web/chunk-t72jq97z.js +0 -2
  873. package/web/chunk-t72jq97z.js.br +0 -0
  874. package/web/chunk-t72jq97z.js.gz +0 -0
  875. package/web/chunk-tfcc9bcz.js +0 -4
  876. package/web/chunk-tfcc9bcz.js.br +0 -0
  877. package/web/chunk-tfcc9bcz.js.gz +0 -0
  878. package/web/chunk-v2bvbgfc.js +0 -2
  879. package/web/chunk-v2bvbgfc.js.br +0 -0
  880. package/web/chunk-v2bvbgfc.js.gz +0 -0
  881. package/web/chunk-v7zq4vc9.js +0 -12
  882. package/web/chunk-v7zq4vc9.js.br +0 -0
  883. package/web/chunk-v7zq4vc9.js.gz +0 -0
  884. package/web/chunk-vh8pkcem.css +0 -1
  885. package/web/chunk-vh8pkcem.css.br +0 -0
  886. package/web/chunk-vh8pkcem.css.gz +0 -0
  887. package/web/chunk-vq3sby7x.js +0 -1
  888. package/web/chunk-vq3sby7x.js.br +0 -0
  889. package/web/chunk-vq3sby7x.js.gz +0 -0
  890. package/web/chunk-vszya05r.js +0 -2
  891. package/web/chunk-vszya05r.js.br +0 -0
  892. package/web/chunk-vszya05r.js.gz +0 -0
  893. package/web/chunk-was9xf03.js +0 -8
  894. package/web/chunk-was9xf03.js.br +0 -0
  895. package/web/chunk-was9xf03.js.gz +0 -0
  896. package/web/chunk-we1v1829.js +0 -2
  897. package/web/chunk-we1v1829.js.br +0 -0
  898. package/web/chunk-we1v1829.js.gz +0 -0
  899. package/web/chunk-wfa1c8dn.js +0 -1
  900. package/web/chunk-wfa1c8dn.js.br +0 -0
  901. package/web/chunk-wfa1c8dn.js.gz +0 -0
  902. package/web/chunk-wg2exnxe.js +0 -1
  903. package/web/chunk-wg2exnxe.js.br +0 -2
  904. package/web/chunk-wg2exnxe.js.gz +0 -0
  905. package/web/chunk-wvd3zj1m.js +0 -70
  906. package/web/chunk-wvd3zj1m.js.br +0 -0
  907. package/web/chunk-wvd3zj1m.js.gz +0 -0
  908. package/web/chunk-wzmxtr30.js +0 -1
  909. package/web/chunk-wzmxtr30.js.br +0 -0
  910. package/web/chunk-wzmxtr30.js.gz +0 -0
  911. package/web/chunk-x815g7yp.js +0 -1
  912. package/web/chunk-x815g7yp.js.br +0 -0
  913. package/web/chunk-x815g7yp.js.gz +0 -0
  914. package/web/chunk-x8ps0p82.js +0 -98
  915. package/web/chunk-x8ps0p82.js.br +0 -0
  916. package/web/chunk-x8ps0p82.js.gz +0 -0
  917. package/web/chunk-xea3snym.js +0 -1
  918. package/web/chunk-xea3snym.js.br +0 -0
  919. package/web/chunk-xea3snym.js.gz +0 -0
  920. package/web/chunk-xg4v60m7.js +0 -1
  921. package/web/chunk-xg4v60m7.js.br +0 -0
  922. package/web/chunk-xg4v60m7.js.gz +0 -0
  923. package/web/chunk-xhr9jrjt.js +0 -89
  924. package/web/chunk-xhr9jrjt.js.br +0 -0
  925. package/web/chunk-xhr9jrjt.js.gz +0 -0
  926. package/web/chunk-xp90g2e7.js +0 -36
  927. package/web/chunk-xp90g2e7.js.br +0 -0
  928. package/web/chunk-xp90g2e7.js.gz +0 -0
  929. package/web/chunk-xs1g97qa.js +0 -2
  930. package/web/chunk-xs1g97qa.js.br +0 -0
  931. package/web/chunk-xs1g97qa.js.gz +0 -0
  932. package/web/chunk-xyk1wpr4.js +0 -1
  933. package/web/chunk-xyk1wpr4.js.br +0 -3
  934. package/web/chunk-xyk1wpr4.js.gz +0 -0
  935. package/web/chunk-yavbdwyt.js +0 -1
  936. package/web/chunk-yavbdwyt.js.br +0 -0
  937. package/web/chunk-yavbdwyt.js.gz +0 -0
  938. package/web/chunk-yfnhnsxe.js +0 -4
  939. package/web/chunk-yfnhnsxe.js.br +0 -0
  940. package/web/chunk-yfnhnsxe.js.gz +0 -0
  941. package/web/chunk-yk965yth.js +0 -1
  942. package/web/chunk-yk965yth.js.br +0 -0
  943. package/web/chunk-yk965yth.js.gz +0 -0
  944. package/web/chunk-ynhcjhsx.js +0 -2
  945. package/web/chunk-ynhcjhsx.js.br +0 -0
  946. package/web/chunk-ynhcjhsx.js.gz +0 -0
  947. package/web/chunk-ypmm1gts.js +0 -1
  948. package/web/chunk-ypmm1gts.js.br +0 -0
  949. package/web/chunk-ypmm1gts.js.gz +0 -0
  950. package/web/chunk-yssx5a5q.js +0 -1
  951. package/web/chunk-yssx5a5q.js.br +0 -0
  952. package/web/chunk-yssx5a5q.js.gz +0 -0
  953. package/web/chunk-z0a8cnq8.js +0 -1
  954. package/web/chunk-z0a8cnq8.js.br +0 -0
  955. package/web/chunk-z0a8cnq8.js.gz +0 -0
  956. package/web/chunk-z1afsvbv.js +0 -2
  957. package/web/chunk-z1afsvbv.js.br +0 -0
  958. package/web/chunk-z1afsvbv.js.gz +0 -0
  959. package/web/chunk-z1ka8jtd.js +0 -2
  960. package/web/chunk-z1ka8jtd.js.br +0 -0
  961. package/web/chunk-z1ka8jtd.js.gz +0 -0
  962. package/web/chunk-z7tdzen9.js +0 -1
  963. package/web/chunk-z7tdzen9.js.br +0 -0
  964. package/web/chunk-z7tdzen9.js.gz +0 -0
  965. package/web/chunk-zbwjj06m.js +0 -38
  966. package/web/chunk-zbwjj06m.js.br +0 -0
  967. package/web/chunk-zbwjj06m.js.gz +0 -0
  968. package/web/chunk-zd2j189j.js +0 -1
  969. package/web/chunk-zd2j189j.js.br +0 -0
  970. package/web/chunk-zd2j189j.js.gz +0 -0
  971. package/web/chunk-zfgpq4n4.js +0 -120
  972. package/web/chunk-zfgpq4n4.js.br +0 -0
  973. package/web/chunk-zfgpq4n4.js.gz +0 -0
  974. package/web/chunk-zgas56xw.js +0 -1
  975. package/web/chunk-zgas56xw.js.br +0 -0
  976. package/web/chunk-zgas56xw.js.gz +0 -0
  977. package/web/chunk-zkfepf91.js +0 -1
  978. package/web/chunk-zkfepf91.js.br +0 -0
  979. package/web/chunk-zkfepf91.js.gz +0 -0
package/chunk-6vkz3wqz.js DELETED
@@ -1,25 +0,0 @@
1
- // @bun
2
- import{A}from"./chunk-f97ma522.js";import{wn,z}from"./chunk-09fsdkd3.js";import{Gr,zr,jr,Vr,Kr}from"./chunk-r0pm6dap.js";import{Tt,Pt}from"./chunk-xafx1p7z.js";import{se}from"./chunk-keq5kv9b.js";import{pe}from"./chunk-fj56fznw.js";import{Se,he,dr,J,en,we}from"./chunk-02q61grt.js";import{w}from"./chunk-b516bp7n.js";import{Q}from"./chunk-tv7met41.js";import{B,Ie,H,Ue,fe,ce,ae,Z}from"./chunk-kcn3af9r.js";import{a,r}from"./chunk-g5mdw639.js";var Ra=r(function(ye){var fl=ye&&ye.__extends||function(){var n=function(s,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,c){i.__proto__=c}||function(i,c){for(var l in c)if(c.hasOwnProperty(l))i[l]=c[l]},n(s,t)};return function(s,t){n(s,t);function i(){this.constructor=s}s.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(ye,"__esModule",{value:!0});var X=256,Li=function(){function n(s){if(s===void 0)s="=";this._paddingCharacter=s}return n.prototype.encodedLength=function(s){if(!this._paddingCharacter)return(s*8+5)/6|0;return(s+2)/3*4|0},n.prototype.encode=function(s){var t="",i=0;for(;i<s.length-2;i+=3){var c=s[i]<<16|s[i+1]<<8|s[i+2];t+=this._encodeByte(c>>>18&63),t+=this._encodeByte(c>>>12&63),t+=this._encodeByte(c>>>6&63),t+=this._encodeByte(c>>>0&63)}var l=s.length-i;if(l>0){var c=s[i]<<16|(l===2?s[i+1]<<8:0);if(t+=this._encodeByte(c>>>18&63),t+=this._encodeByte(c>>>12&63),l===2)t+=this._encodeByte(c>>>6&63);else t+=this._paddingCharacter||"";t+=this._paddingCharacter||""}return t},n.prototype.maxDecodedLength=function(s){if(!this._paddingCharacter)return(s*6+7)/8|0;return s/4*3|0},n.prototype.decodedLength=function(s){return this.maxDecodedLength(s.length-this._getPaddingLength(s))},n.prototype.decode=function(s){if(s.length===0)return new Uint8Array(0);var t=this._getPaddingLength(s),i=s.length-t,c=new Uint8Array(this.maxDecodedLength(i)),l=0,d=0,h=0,f=0,g=0,v=0,_=0;for(;d<i-4;d+=4)f=this._decodeChar(s.charCodeAt(d+0)),g=this._decodeChar(s.charCodeAt(d+1)),v=this._decodeChar(s.charCodeAt(d+2)),_=this._decodeChar(s.charCodeAt(d+3)),c[l++]=f<<2|g>>>4,c[l++]=g<<4|v>>>2,c[l++]=v<<6|_,h|=f&X,h|=g&X,h|=v&X,h|=_&X;if(d<i-1)f=this._decodeChar(s.charCodeAt(d)),g=this._decodeChar(s.charCodeAt(d+1)),c[l++]=f<<2|g>>>4,h|=f&X,h|=g&X;if(d<i-2)v=this._decodeChar(s.charCodeAt(d+2)),c[l++]=g<<4|v>>>2,h|=v&X;if(d<i-3)_=this._decodeChar(s.charCodeAt(d+3)),c[l++]=v<<6|_,h|=_&X;if(h!==0)throw Error("Base64Coder: incorrect characters for decoding");return c},n.prototype._encodeByte=function(s){var t=s;return t+=65,t+=25-s>>>8&6,t+=51-s>>>8&-75,t+=61-s>>>8&-15,t+=62-s>>>8&3,String.fromCharCode(t)},n.prototype._decodeChar=function(s){var t=X;return t+=(42-s&s-44)>>>8&-X+s-43+62,t+=(46-s&s-48)>>>8&-X+s-47+63,t+=(47-s&s-58)>>>8&-X+s-48+52,t+=(64-s&s-91)>>>8&-X+s-65+0,t+=(96-s&s-123)>>>8&-X+s-97+26,t},n.prototype._getPaddingLength=function(s){var t=0;if(this._paddingCharacter){for(var i=s.length-1;i>=0;i--){if(s[i]!==this._paddingCharacter)break;t++}if(s.length<4||t>2)throw Error("Base64Coder: incorrect padding")}return t},n}();ye.Coder=Li;var or=new Li;function pl(n){return or.encode(n)}ye.encode=pl;function ml(n){return or.decode(n)}ye.decode=ml;var xa=function(n){fl(s,n);function s(){return n!==null&&n.apply(this,arguments)||this}return s.prototype._encodeByte=function(t){var i=t;return i+=65,i+=25-t>>>8&6,i+=51-t>>>8&-75,i+=61-t>>>8&-13,i+=62-t>>>8&49,String.fromCharCode(i)},s.prototype._decodeChar=function(t){var i=X;return i+=(44-t&t-46)>>>8&-X+t-45+62,i+=(94-t&t-96)>>>8&-X+t-95+63,i+=(47-t&t-58)>>>8&-X+t-48+52,i+=(64-t&t-91)>>>8&-X+t-65+0,i+=(96-t&t-123)>>>8&-X+t-97+26,i},s}(Li);ye.URLSafeCoder=xa;var va=new xa;function _l(n){return va.encode(n)}ye.encodeURLSafe=_l;function gl(n){return va.decode(n)}ye.decodeURLSafe=gl;ye.encodedLength=function(n){return or.encodedLength(n)};ye.maxDecodedLength=function(n){return or.maxDecodedLength(n)};ye.decodedLength=function(n){return or.decodedLength(n)}});var Aa=r(function(Ea,Qn){(function(n,s){var t={};s(t);var i=t.default;for(var c in t)i[c]=t[c];if(typeof Qn==="object"&&typeof Qn.exports==="object")Qn.exports=i;else if(typeof define==="function"&&define.amd)define(function(){return i});else n.sha256=i})(Ea,function(n){n.__esModule=!0,n.digestLength=32,n.blockSize=64;var s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function t(_,k,y,x,P){var S,E,b,M,C,O,V,F,G,W,U,ve,nt;while(P>=64){S=k[0],E=k[1],b=k[2],M=k[3],C=k[4],O=k[5],V=k[6],F=k[7];for(W=0;W<16;W++)U=x+W*4,_[W]=(y[U]&255)<<24|(y[U+1]&255)<<16|(y[U+2]&255)<<8|y[U+3]&255;for(W=16;W<64;W++)G=_[W-2],ve=(G>>>17|G<<15)^(G>>>19|G<<13)^G>>>10,G=_[W-15],nt=(G>>>7|G<<25)^(G>>>18|G<<14)^G>>>3,_[W]=(ve+_[W-7]|0)+(nt+_[W-16]|0);for(W=0;W<64;W++)ve=(((C>>>6|C<<26)^(C>>>11|C<<21)^(C>>>25|C<<7))+(C&O^~C&V)|0)+(F+(s[W]+_[W]|0)|0)|0,nt=((S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10))+(S&E^S&b^E&b)|0,F=V,V=O,O=C,C=M+ve|0,M=b,b=E,E=S,S=ve+nt|0;k[0]+=S,k[1]+=E,k[2]+=b,k[3]+=M,k[4]+=C,k[5]+=O,k[6]+=V,k[7]+=F,x+=64,P-=64}return x}var i=function(){function _(){this.digestLength=n.digestLength,this.blockSize=n.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return _.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},_.prototype.clean=function(){for(var k=0;k<this.buffer.length;k++)this.buffer[k]=0;for(var k=0;k<this.temp.length;k++)this.temp[k]=0;this.reset()},_.prototype.update=function(k,y){if(y===void 0)y=k.length;if(this.finished)throw Error("SHA256: can't update because hash was finished.");var x=0;if(this.bytesHashed+=y,this.bufferLength>0){while(this.bufferLength<64&&y>0)this.buffer[this.bufferLength++]=k[x++],y--;if(this.bufferLength===64)t(this.temp,this.state,this.buffer,0,64),this.bufferLength=0}if(y>=64)x=t(this.temp,this.state,k,x,y),y%=64;while(y>0)this.buffer[this.bufferLength++]=k[x++],y--;return this},_.prototype.finish=function(k){if(!this.finished){var y=this.bytesHashed,x=this.bufferLength,P=y/536870912|0,S=y<<3,E=y%64<56?64:128;this.buffer[x]=128;for(var b=x+1;b<E-8;b++)this.buffer[b]=0;this.buffer[E-8]=P>>>24&255,this.buffer[E-7]=P>>>16&255,this.buffer[E-6]=P>>>8&255,this.buffer[E-5]=P>>>0&255,this.buffer[E-4]=S>>>24&255,this.buffer[E-3]=S>>>16&255,this.buffer[E-2]=S>>>8&255,this.buffer[E-1]=S>>>0&255,t(this.temp,this.state,this.buffer,0,E),this.finished=!0}for(var b=0;b<8;b++)k[b*4+0]=this.state[b]>>>24&255,k[b*4+1]=this.state[b]>>>16&255,k[b*4+2]=this.state[b]>>>8&255,k[b*4+3]=this.state[b]>>>0&255;return this},_.prototype.digest=function(){var k=new Uint8Array(this.digestLength);return this.finish(k),k},_.prototype._saveState=function(k){for(var y=0;y<this.state.length;y++)k[y]=this.state[y]},_.prototype._restoreState=function(k,y){for(var x=0;x<this.state.length;x++)this.state[x]=k[x];this.bytesHashed=y,this.finished=!1,this.bufferLength=0},_}();n.Hash=i;var c=function(){function _(k){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var y=new Uint8Array(this.blockSize);if(k.length>this.blockSize)new i().update(k).finish(y).clean();else for(var x=0;x<k.length;x++)y[x]=k[x];for(var x=0;x<y.length;x++)y[x]^=54;this.inner.update(y);for(var x=0;x<y.length;x++)y[x]^=106;this.outer.update(y),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var x=0;x<y.length;x++)y[x]=0}return _.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},_.prototype.clean=function(){for(var k=0;k<this.istate.length;k++)this.ostate[k]=this.istate[k]=0;this.inner.clean(),this.outer.clean()},_.prototype.update=function(k){return this.inner.update(k),this},_.prototype.finish=function(k){if(this.outer.finished)this.outer.finish(k);else this.inner.finish(k),this.outer.update(k,this.digestLength).finish(k);return this},_.prototype.digest=function(){var k=new Uint8Array(this.digestLength);return this.finish(k),k},_}();n.HMAC=c;function l(_){var k=new i().update(_),y=k.digest();return k.clean(),y}n.hash=l,n.default=l;function d(_,k){var y=new c(_).update(k),x=y.digest();return y.clean(),x}n.hmac=d;function h(_,k,y,x){var P=x[0];if(P===0)throw Error("hkdf: cannot expand more");if(k.reset(),P>1)k.update(_);if(y)k.update(y);k.update(x),k.finish(_),x[0]++}var f=new Uint8Array(n.digestLength);function g(_,k,y,x){if(k===void 0)k=f;if(x===void 0)x=32;var P=new Uint8Array([1]),S=d(k,_),E=new c(S),b=new Uint8Array(E.digestLength),M=b.length,C=new Uint8Array(x);for(var O=0;O<x;O++){if(M===b.length)h(b,E,y,P),M=0;C[O]=b[M++]}return E.clean(),b.fill(0),P.fill(0),C}n.hkdf=g;function v(_,k,y,x){var P=new c(_),S=P.digestLength,E=new Uint8Array(4),b=new Uint8Array(S),M=new Uint8Array(S),C=new Uint8Array(x);for(var O=0;O*S<x;O++){var V=O+1;E[0]=V>>>24&255,E[1]=V>>>16&255,E[2]=V>>>8&255,E[3]=V>>>0&255,P.reset(),P.update(k),P.update(E),P.finish(M);for(var F=0;F<S;F++)b[F]=M[F];for(var F=2;F<=y;F++){P.reset(),P.update(M).finish(M);for(var G=0;G<S;G++)b[G]^=M[G]}for(var F=0;F<S&&O*S+F<x;F++)C[O*S+F]=b[F]}for(var O=0;O<S;O++)b[O]=M[O]=0;for(var O=0;O<4;O++)E[O]=0;return P.clean(),C}n.pbkdf2=v})});var Pa=r(function(Ia){Object.defineProperty(Ia,"__esModule",{value:!0});Ia.timingSafeEqual=wl;function Ta(n,s=""){if(!n)throw Error(s)}function wl(n,s){if(n.byteLength!==s.byteLength)return!1;if(!(n instanceof DataView))n=new DataView(ArrayBuffer.isView(n)?n.buffer:n);if(!(s instanceof DataView))s=new DataView(ArrayBuffer.isView(s)?s.buffer:s);Ta(n instanceof DataView),Ta(s instanceof DataView);let t=n.byteLength,i=0,c=-1;while(++c<t)i|=n.getUint8(c)^s.getUint8(c);return i===0}});var La=r(function(Na){Object.defineProperty(Na,"__esModule",{value:!0});Na.Webhook=Na.WebhookVerificationError=void 0;var Zn=Ra(),Ca=Aa(),Oa=Pa(),Ma=300;class Fi extends Error{constructor(n){super(n);Object.setPrototypeOf(this,Fi.prototype),this.name="ExtendableError",this.stack=Error(n).stack}}class Je extends Fi{constructor(n){super(n);Object.setPrototypeOf(this,Je.prototype),this.name="WebhookVerificationError"}}Na.WebhookVerificationError=Je;class cr{constructor(n,s){if((s===null||s===void 0?void 0:s.format)==="raw")if(n instanceof Uint8Array)this.key=n;else this.key=Uint8Array.from(n,(t)=>t.charCodeAt(0));else{if(typeof n!=="string")throw Error("Expected secret to be of type string");if(n.startsWith(cr.prefix))n=n.substring(cr.prefix.length);this.key=Zn.decode(n)}if(this.key.length===0)throw Error("Secret can't be empty.")}verify(n,s,t){var i;let c=(i=t===null||t===void 0?void 0:t.jsonParse)!==null&&i!==void 0?i:!0,l={};for(let x of Object.keys(s))l[x.toLowerCase()]=s[x];let d=l["webhook-id"],h=l["webhook-signature"],f=l["webhook-timestamp"];if(!h||!d||!f)throw new Je("Missing required headers");let g=this.verifyTimestamp(f),_=this.sign(d,g,n).split(",")[1],k=h.split(" "),y=new globalThis.TextEncoder;for(let x of k){let[P,S]=x.split(",");if(P!=="v1")continue;if(Oa.timingSafeEqual(y.encode(S),y.encode(_))){let E=n.toString();if(E==="")return;if(c)return JSON.parse(E);else return}}throw new Je("No matching signature found")}sign(n,s,t){if(typeof t==="string");else if(t.constructor.name==="Buffer")t=t.toString();else throw Error("Expected payload to be of type string or Buffer.");let i=new TextEncoder,c=Math.floor(s.getTime()/1000),l=i.encode(`${n}.${c}.${t}`);return`v1,${Zn.encode(Ca.hmac(this.key,l))}`}verifyTimestamp(n){let s=Math.floor(Date.now()/1000),t=parseInt(n,10);if(Number.isNaN(t))throw new Je("Invalid Signature Headers");if(s-t>Ma)throw new Je("Message timestamp too old");if(t>s+Ma)throw new Je("Message timestamp too new");return new Date(t*1000)}}Na.Webhook=cr;cr.prefix="whsec_"});function o(n,s,t,i,c){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!c)throw TypeError("Private accessor was defined without a setter");if(typeof s==="function"?n!==s||!c:!s.has(n))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?c.call(n,t):c?c.value=t:s.set(n,t),t}function e(n,s,t,i){if(t==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof s==="function"?n!==s||!i:!s.has(n))throw TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(n):i?i.value:s.get(n)}function Me(n){return typeof n==="object"&&n!==null&&(("name"in n)&&n.name==="AbortError"||("message"in n)&&String(n.message).includes("FetchRequestCanceledException"))}var st=(n)=>{if(n instanceof Error)return n;if(typeof n==="object"&&n!==null){try{let s=Object.prototype.toString.call(n);if(s==="[object Error]"||s==="[object DOMException]"){let t=Error(n.message,n.cause?{cause:n.cause}:{});if(n.stack)t.stack=n.stack;if(n.cause&&!t.cause)t.cause=n.cause;if(n.name)t.name=n.name;return t}}catch{}try{return Error(JSON.stringify(n))}catch{}}return Error(n)};var u=(()=>{class n extends Error{}return n})();class K extends u{constructor(n,s,t,i,c){super(`${K.makeMessage(n,s,t)}`);this.status=n,this.headers=i,this.requestID=i?.get("request-id"),this.workspaceID=i?.get("anthropic-workspace-id"),this.error=s,this.type=c??null}static makeMessage(n,s,t){let i=s?.message?typeof s.message==="string"?s.message:JSON.stringify(s.message):s?JSON.stringify(s):t;if(n&&i)return`${n} ${i}`;if(n)return`${n} status code (no body)`;if(i)return i;return"(no status code or body)"}static generate(n,s,t,i){if(!n||!i)return new Ke({message:t,cause:st(s)});let c=s,l=c?.error?.type;if(n===400)return new bn(n,c,t,i,l);if(n===401)return new kn(n,c,t,i,l);if(n===403)return new Sn(n,c,t,i,l);if(n===404)return new xn(n,c,t,i,l);if(n===409)return new vn(n,c,t,i,l);if(n===422)return new Rn(n,c,t,i,l);if(n===429)return new En(n,c,t,i,l);if(n>=500)return new An(n,c,t,i,l);return new K(n,c,t,i,l)}}class oe extends K{constructor({message:n}={}){super(void 0,void 0,n||"Request was aborted.",void 0)}}class Ke extends K{constructor({message:n,cause:s}){super(void 0,void 0,n||"Connection error.",void 0);if(s)this.cause=s}}class yn extends Ke{constructor({message:n}={}){super({message:n??"Request timed out."})}}class ci extends u{constructor(n,{cause:s}={}){super(n??"Retryable error.");if(s!==void 0)this.cause=s}}class bn extends K{}class kn extends K{}class Sn extends K{}class xn extends K{}class vn extends K{}class Rn extends K{}class En extends K{}class An extends K{}var Ac=/^[a-z][a-z0-9+.-]*:/i,So=(n)=>Ac.test(n),ie=(n)=>(ie=Array.isArray,ie(n)),li=ie;function jt(n){if(typeof n!=="object")return{};return n??{}}function ui(n){if(!n)return!0;for(let s in n)return!1;return!0}function xo(n,s){return Object.prototype.hasOwnProperty.call(n,s)}function di(n){return n!=null&&typeof n==="object"&&!Array.isArray(n)}var Tn=(n,s)=>{if(typeof s!=="number"||!Number.isInteger(s))throw new u(`${n} must be an integer`);if(s<0)throw new u(`${n} must be a positive integer`);return s};var In=(n)=>{try{return JSON.parse(n)}catch(s){return}};function Ve(n){}var Ce=(n,s)=>new Promise((t)=>{if(s?.aborted)return t();let i=()=>{clearTimeout(c),t()},c=setTimeout(()=>{s?.removeEventListener("abort",i),t()},n);s?.addEventListener("abort",i,{once:!0})});var Re="0.129.0";var Ao=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function Tc(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var Ic=()=>{let n=Tc();if(n==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":Ro(Deno.build.os),"X-Stainless-Arch":vo(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":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process?.version??"unknown"};if(n==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":Ro(globalThis.process.platform??"unknown"),"X-Stainless-Arch":vo(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let s=Pc();if(s)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${s.browser}`,"X-Stainless-Runtime-Version":s.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Re,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Pc(){if(typeof navigator>"u"||!navigator)return null;let n=[{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:s,pattern:t}of n){let i=t.exec(navigator.userAgent);if(i){let c=i[1]||0,l=i[2]||0,d=i[3]||0;return{browser:s,version:`${c}.${l}.${d}`}}}return null}var vo=(n)=>{if(n==="x32")return"x32";if(n==="x86_64"||n==="x64")return"x64";if(n==="arm")return"arm";if(n==="aarch64"||n==="arm64")return"arm64";if(n)return`other:${n}`;return"unknown"},Ro=(n)=>{if(n=n.toLowerCase(),n.includes("ios"))return"iOS";if(n==="android")return"Android";if(n==="darwin")return"MacOS";if(n==="win32")return"Windows";if(n==="freebsd")return"FreeBSD";if(n==="openbsd")return"OpenBSD";if(n==="linux")return"Linux";if(n)return`Other:${n}`;return"Unknown"},Eo,qt=()=>Eo??(Eo=Ic());var Pn=new WeakMap,To=typeof globalThis.FinalizationRegistry==="function"?new globalThis.FinalizationRegistry((n)=>$e(n)):null;function Mc(n,s){return()=>n.removeEventListener("abort",s)}function Io(n,s,t){Pn.set(n,Mc(s,t))}function Po(n,s){if(Pn.has(s))To?.register(n,s,s)}function $e(n){let s=Pn.get(n);if(s)Pn.delete(n),To?.unregister(n),s()}function Mo(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function hi(...n){let s=globalThis.ReadableStream;if(typeof s>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new s(...n)}function Mn(n){let s=Symbol.asyncIterator in n?n[Symbol.asyncIterator]():n[Symbol.iterator]();return hi({start(){},async pull(t){let{done:i,value:c}=await s.next();if(i)t.close();else t.enqueue(c)},async cancel(){await s.return?.()}})}function zt(n){if(n[Symbol.asyncIterator])return n;let s=n.getReader();return{async next(){try{let t=await s.read();if(t?.done)s.releaseLock();return t}catch(t){throw s.releaseLock(),t}},async return(){let t=s.cancel();return s.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Co(n){if(n===null||typeof n!=="object")return;if(n[Symbol.asyncIterator]){await n[Symbol.asyncIterator]().return?.();return}let s=n.getReader(),t=s.cancel();s.releaseLock(),await t}var Oo=({headers:n,body:s})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(s)});var fi="RFC3986",pi=(n)=>String(n),mi={RFC1738:(n)=>String(n).replace(/%20/g,"+"),RFC3986:pi},No="RFC1738";var Cn=(n,s)=>(Cn=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Cn(n,s)),Le=(()=>{let n=[];for(let s=0;s<256;++s)n.push("%"+((s<16?"0":"")+s.toString(16)).toUpperCase());return n})();var _i=1024,$o=(n,s,t,i,c)=>{if(n.length===0)return n;let l=n;if(typeof n==="symbol")l=Symbol.prototype.toString.call(n);else if(typeof n!=="string")l=String(n);if(t==="iso-8859-1")return escape(l).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});let d="";for(let h=0;h<l.length;h+=_i){let f=l.length>=_i?l.slice(h,h+_i):l,g=[];for(let v=0;v<f.length;++v){let _=f.charCodeAt(v);if(_===45||_===46||_===95||_===126||_>=48&&_<=57||_>=65&&_<=90||_>=97&&_<=122||c===No&&(_===40||_===41)){g[g.length]=f.charAt(v);continue}if(_<128){g[g.length]=Le[_];continue}if(_<2048){g[g.length]=Le[192|_>>6]+Le[128|_&63];continue}if(_<55296||_>=57344){g[g.length]=Le[224|_>>12]+Le[128|_>>6&63]+Le[128|_&63];continue}v+=1,_=65536+((_&1023)<<10|f.charCodeAt(v)&1023),g[g.length]=Le[240|_>>18]+Le[128|_>>12&63]+Le[128|_>>6&63]+Le[128|_&63]}d+=g.join("")}return d};function Lo(n){if(!n||typeof n!=="object")return!1;return!!(n.constructor&&n.constructor.isBuffer&&n.constructor.isBuffer(n))}function gi(n,s){if(ie(n)){let t=[];for(let i=0;i<n.length;i+=1)t.push(s(n[i]));return t}return s(n)}var Ho={brackets(n){return String(n)+"[]"},comma:"comma",indices(n,s){return String(n)+"["+s+"]"},repeat(n){return String(n)}},Do=function(n,s){Array.prototype.push.apply(n,ie(s)?s:[s])},Fo,te={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:$o,encodeValuesOnly:!1,format:fi,formatter:pi,indices:!1,serializeDate(n){return(Fo??(Fo=Function.prototype.call.bind(Date.prototype.toISOString)))(n)},skipNulls:!1,strictNullHandling:!1};function Nc(n){return typeof n==="string"||typeof n==="number"||typeof n==="boolean"||typeof n==="symbol"||typeof n==="bigint"}var wi={};function Wo(n,s,t,i,c,l,d,h,f,g,v,_,k,y,x,P,S,E){let b=n,M=E,C=0,O=!1;while((M=M.get(wi))!==void 0&&!O){let U=M.get(n);if(C+=1,typeof U<"u")if(U===C)throw RangeError("Cyclic object value");else O=!0;if(typeof M.get(wi)>"u")C=0}if(typeof g==="function")b=g(s,b);else if(b instanceof Date)b=k?.(b);else if(t==="comma"&&ie(b))b=gi(b,function(U){if(U instanceof Date)return k?.(U);return U});if(b===null){if(l)return f&&!P?f(s,te.encoder,S,"key",y):s;b=""}if(Nc(b)||Lo(b)){if(f){let U=P?s:f(s,te.encoder,S,"key",y);return[x?.(U)+"="+x?.(f(b,te.encoder,S,"value",y))]}return[x?.(s)+"="+x?.(String(b))]}let V=[];if(typeof b>"u")return V;let F;if(t==="comma"&&ie(b)){if(P&&f)b=gi(b,f);F=[{value:b.length>0?b.join(",")||null:void 0}]}else if(ie(g))F=g;else{let U=Object.keys(b);F=v?U.sort(v):U}let G=h?String(s).replace(/\./g,"%2E"):String(s),W=i&&ie(b)&&b.length===1?G+"[]":G;if(c&&ie(b)&&b.length===0)return W+"[]";for(let U=0;U<F.length;++U){let ve=F[U],nt=typeof ve==="object"&&typeof ve.value<"u"?ve.value:b[ve];if(d&&nt===null)continue;let ai=_&&h?ve.replace(/\./g,"%2E"):ve,Rc=ie(b)?typeof t==="function"?t(W,ai):W:W+(_?"."+ai:"["+ai+"]");E.set(n,C);let ko=new WeakMap;ko.set(wi,E),Do(V,Wo(nt,Rc,t,i,c,l,d,h,t==="comma"&&P&&ie(b)?null:f,g,v,_,k,y,x,P,S,ko))}return V}function $c(n=te){if(typeof n.allowEmptyArrays<"u"&&typeof n.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof n.encodeDotInKeys<"u"&&typeof n.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(n.encoder!==null&&typeof n.encoder<"u"&&typeof n.encoder!=="function")throw TypeError("Encoder has to be a function.");let s=n.charset||te.charset;if(typeof n.charset<"u"&&n.charset!=="utf-8"&&n.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=fi;if(typeof n.format<"u"){if(!Cn(mi,n.format))throw TypeError("Unknown format option provided.");t=n.format}let i=mi[t],c=te.filter;if(typeof n.filter==="function"||ie(n.filter))c=n.filter;let l;if(n.arrayFormat&&n.arrayFormat in Ho)l=n.arrayFormat;else if("indices"in n)l=n.indices?"indices":"repeat";else l=te.arrayFormat;if("commaRoundTrip"in n&&typeof n.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let d=typeof n.allowDots>"u"?!!n.encodeDotInKeys===!0?!0:te.allowDots:!!n.allowDots;return{addQueryPrefix:typeof n.addQueryPrefix==="boolean"?n.addQueryPrefix:te.addQueryPrefix,allowDots:d,allowEmptyArrays:typeof n.allowEmptyArrays==="boolean"?!!n.allowEmptyArrays:te.allowEmptyArrays,arrayFormat:l,charset:s,charsetSentinel:typeof n.charsetSentinel==="boolean"?n.charsetSentinel:te.charsetSentinel,commaRoundTrip:!!n.commaRoundTrip,delimiter:typeof n.delimiter>"u"?te.delimiter:n.delimiter,encode:typeof n.encode==="boolean"?n.encode:te.encode,encodeDotInKeys:typeof n.encodeDotInKeys==="boolean"?n.encodeDotInKeys:te.encodeDotInKeys,encoder:typeof n.encoder==="function"?n.encoder:te.encoder,encodeValuesOnly:typeof n.encodeValuesOnly==="boolean"?n.encodeValuesOnly:te.encodeValuesOnly,filter:c,format:t,formatter:i,serializeDate:typeof n.serializeDate==="function"?n.serializeDate:te.serializeDate,skipNulls:typeof n.skipNulls==="boolean"?n.skipNulls:te.skipNulls,sort:typeof n.sort==="function"?n.sort:null,strictNullHandling:typeof n.strictNullHandling==="boolean"?n.strictNullHandling:te.strictNullHandling}}function jo(n,s={}){let t=n,i=$c(s),c,l;if(typeof i.filter==="function")l=i.filter,t=l("",t);else if(ie(i.filter))l=i.filter,c=l;let d=[];if(typeof t!=="object"||t===null)return"";let h=Ho[i.arrayFormat],f=h==="comma"&&i.commaRoundTrip;if(!c)c=Object.keys(t);if(i.sort)c.sort(i.sort);let g=new WeakMap;for(let k=0;k<c.length;++k){let y=c[k];if(i.skipNulls&&t[y]===null)continue;Do(d,Wo(t[y],y,h,f,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,g))}let v=d.join(i.delimiter),_=i.addQueryPrefix===!0?"?":"";if(i.charsetSentinel)if(i.charset==="iso-8859-1")_+="utf8=%26%2310003%3B&";else _+="utf8=%E2%9C%93&";return v.length>0?_+v:""}function qo(n){return jo(n,{arrayFormat:"brackets"})}var Ko="urn:ietf:params:oauth:grant-type:jwt-bearer",Vo="refresh_token",On="/v1/oauth/token",it="oauth-2025-04-20",Jo="oidc-federation-2026-04-01",Go=120,mt=30,Yo=5,zo=1048576;function Nn(n){if(!n)return;let s;try{s=new URL(n)}catch(i){throw new D(`Invalid token endpoint base URL "${n}": ${i}`)}if(s.protocol==="https:")return;let t=s.hostname.toLowerCase().replace(/^\[|\]$/g,"");if(s.protocol==="http:"&&(t==="localhost"||t==="127.0.0.1"||t==="::1"))return;throw new D(`Refusing to send credential over non-https token endpoint "${n}"`)}async function $n(n,s){let t=await Hc(n),i;try{i=JSON.parse(t)}catch{throw new D(`Token endpoint returned non-JSON response (status ${n.status})`,n.status,le(t),s)}if(!i.access_token)throw new D(`Token endpoint response missing access_token: ${JSON.stringify(le(i))}`,n.status,le(i),s);if(i.token_type&&i.token_type.toLowerCase()!=="bearer")throw new D(`Token endpoint response: unsupported token_type "${i.token_type}" (want Bearer)`,n.status,le(i),s);return i}var yi=2000,Fc=new Set(["error","error_description","error_uri"]);function le(n){if(n==null)return n;if(typeof n==="string"){let s;try{s=JSON.parse(n)}catch{if(n.length<=yi)return n;return n.slice(0,yi)+`... <${n.length-yi} more chars>`}return JSON.stringify(le(s))}if(typeof n==="object"&&!Array.isArray(n)){let s={};for(let[t,i]of Object.entries(n))if(Fc.has(t))s[t]=i;return s}return null}async function Ln(n,s=(t)=>console.warn(`anthropic-sdk: ${t}`)){if(typeof process>"u"||process.platform==="win32")return;let{fs:t}=await import("./chunk-03r6s8pm.js"),i=n,c;try{i=await t.promises.realpath(n),c=await t.promises.stat(i)}catch{return}let l=c.mode&511;if(l&18)throw new D(`Credentials file at ${i} is group/world-writable (mode 0o${l.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${i}\`.`);if(l&36)throw new D(`Credentials file at ${i} is group/world-readable (mode 0o${l.toString(8)}); run \`chmod 600 ${i}\` before retrying.`);if(typeof process.getuid==="function"&&c.uid!==process.getuid())s(`credentials file at ${i} is owned by uid ${c.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function Fn(n,s){let{fs:t,path:i}=await import("./chunk-03r6s8pm.js"),c=i.dirname(n);await t.promises.mkdir(c,{recursive:!0,mode:448});let l=`${n}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let d=await t.promises.open(l,"w",384);try{await d.writeFile(JSON.stringify(s,null,2)),await d.sync()}finally{await d.close()}await t.promises.rename(l,n)}catch(d){throw await t.promises.unlink(l).catch(()=>{}),d}try{let d=await t.promises.open(c,"r");try{await d.sync()}finally{await d.close()}}catch{}}async function Hc(n){if(!n.body)return"";let s=n.body.getReader(),t=[],i=0;for(;;){let{done:l,value:d}=await s.read();if(l)break;if(i+d.length>zo){let h=zo-i;if(h>0)t.push(d.subarray(0,h));await s.cancel();break}t.push(d),i+=d.length}let c;if(t.length===1)c=t[0];else{c=new Uint8Array(t.reduce((d,h)=>d+h.length,0));let l=0;for(let d of t)c.set(d,l),l+=d.length}return new TextDecoder("utf-8").decode(c)}class D extends u{constructor(n,s=null,t=null,i=null){super(n);this.statusCode=s,this.body=t,this.requestId=i}}function Oe(){return Math.floor(Date.now()/1000)}class bi{constructor(n,s){this.cached=null,this.pendingRefresh=null,this.nextForce=!1,this.lastAdvisoryError=0,this.provider=n,this.onAdvisoryRefreshError=s}async getToken(){let n=this.nextForce;this.nextForce=!1;let s=this.cached;if(n||s==null)return(await this.refresh(n)).token;if(s.expiresAt==null)return s.token;let t=s.expiresAt-Oe();if(t>Go)return s.token;if(t>mt)return this.backgroundRefresh(),s.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(n=!1){if(this.pendingRefresh&&!n)return this.pendingRefresh;return this.doRefresh(n)}backgroundRefresh(){if(this.pendingRefresh)return;if(Oe()-this.lastAdvisoryError<Yo)return;this.doRefresh().catch((n)=>{this.lastAdvisoryError=Oe(),this.onAdvisoryRefreshError?.(n)})}doRefresh(n=!1){return this.pendingRefresh=this.provider(n?{forceRefresh:!0}:void 0).then((s)=>(this.cached=s,this.pendingRefresh=null,s),(s)=>{throw this.pendingRefresh=null,s}),this.pendingRefresh}}var N=(n)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[n]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(n)?.trim()||void 0;return};function Zo(n){let s=0;for(let c of n)s+=c.length;let t=new Uint8Array(s),i=0;for(let c of n)t.set(c,i),i+=c.length;return t}var Xo;function sr(n){let s;return(Xo??(s=new globalThis.TextEncoder,Xo=s.encode.bind(s)))(n)}var Qo;function Ft(n){let s;return(Qo??(s=new globalThis.TextDecoder,Qo=s.decode.bind(s)))(n)}var ea=(n)=>{if(typeof globalThis.Buffer<"u"){let s=globalThis.Buffer.from(n,"base64");return new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}if(typeof atob<"u"){let s=atob(n),t=new Uint8Array(s.length);for(let i=0;i<s.length;i++)t[i]=s.charCodeAt(i);return t}throw new u("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")};var Kt="warn",Dn={off:0,error:200,warn:300,info:400,debug:500},Bn=(n,s,t)=>{if(!n)return;if(xo(Dn,n))return n;t.warn(`${s} was set to ${JSON.stringify(n)}, expected one of ${JSON.stringify(Object.keys(Dn))}`);return};function _t(){}function Hn(n,s,t){if(!s||Dn[n]>Dn[t])return _t;else return s[n].bind(s)}var Dc={error:_t,warn:_t,info:_t,debug:_t},ta=new WeakMap;function Si(n,s){let t=ta.get(n);if(t&&t[0]===s)return t[1];let i={error:Hn("error",n,s),warn:Hn("warn",n,s),info:Hn("info",n,s),debug:Hn("debug",n,s)};return ta.set(n,[s,i]),i}function L(n){let s=n.logger,t=n.logLevel??"off";if(!s)return Dc;return Si(s,t)}var ra,ki;function na(){let n=N("ANTHROPIC_LOG");if(!ki||n!==ra)ra=n,ki=Si(console,Bn(n,"process.env['ANTHROPIC_LOG']",Si(console,Kt))??Kt);return ki}function Fe(n,s,t){if(n.debug===_t)return;n.debug(s,Bc(t))}var Bc=(n)=>{if(n.options)n.options={...n.options},delete n.options.headers;if(n.headers)n.headers=Object.fromEntries((n.headers instanceof Headers?[...n.headers]:Object.entries(n.headers)).map(([s,t])=>[s,s.toLowerCase()==="authorization"||s.toLowerCase()==="api-key"||s.toLowerCase()==="x-api-key"||s.toLowerCase()==="cookie"||s.toLowerCase()==="set-cookie"?"***":t]));if("retryOfRequestLogID"in n){if(n.retryOfRequestLogID)n.retryOf=n.retryOfRequestLogID;delete n.retryOfRequestLogID}return n};var Wn=function(){let{crypto:n}=globalThis;if(n?.randomUUID)return Wn=n.randomUUID.bind(n),n.randomUUID();let s=new Uint8Array(1),t=n?()=>n.getRandomValues(s)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(i)=>(+i^t()&15>>+i/4).toString(16))};var jn="1.0",Wc=/^[A-Za-z0-9_.-]+$/;function sa(n){if(!n)throw Error("profile name is empty");if(n==="."||n==="..")throw Error(`profile name "${n}" is not allowed`);if(n.includes("/")||n.includes("\\"))throw Error(`profile name "${n}" must not contain path separators`);if(!Wc.test(n))throw Error(`profile name "${n}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var ia=async(n)=>{var s,t;let i=await xi();if(i===null)return null;let c=n??await aa();if(c===null)return null;sa(c);let{fs:l,path:d}=await import("./chunk-03r6s8pm.js"),h=d.join(i,"configs",`${c}.json`),f;try{f=await l.promises.readFile(h,"utf-8")}catch(_){if(_?.code!=="ENOENT")throw Error(`failed to read config file ${h}: ${_}`);f=null}if(f===null){let _=N("ANTHROPIC_ORGANIZATION_ID"),k=N("ANTHROPIC_IDENTITY_TOKEN_FILE"),y=N("ANTHROPIC_FEDERATION_RULE_ID");if(y&&_)return{fromFile:!1,config:{organization_id:_,workspace_id:N("ANTHROPIC_WORKSPACE_ID"),base_url:N("ANTHROPIC_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:y,service_account_id:N("ANTHROPIC_SERVICE_ACCOUNT_ID"),identity_token:k?{source:"file",path:k}:void 0,scope:N("ANTHROPIC_SCOPE")}}};return null}let g;try{g=JSON.parse(f)}catch(_){throw Error(`failed to parse config file ${h}: ${_}`)}if(!g.authentication)throw Error(`config file ${h} is missing "authentication"`);let v=g.authentication.type;if(v!=="oidc_federation"&&v!=="user_oauth")throw Error(`authentication.type "${v}" is not a known authentication type`);if(g.organization_id??(g.organization_id=N("ANTHROPIC_ORGANIZATION_ID")),g.workspace_id??(g.workspace_id=N("ANTHROPIC_WORKSPACE_ID")),g.base_url??(g.base_url=N("ANTHROPIC_BASE_URL")),(s=g.authentication).scope??(s.scope=N("ANTHROPIC_SCOPE")),g.authentication.type==="oidc_federation"){if(!g.authentication.identity_token){let _=N("ANTHROPIC_IDENTITY_TOKEN_FILE");if(_)g.authentication.identity_token={source:"file",path:_}}if(!g.authentication.federation_rule_id)g.authentication.federation_rule_id=N("ANTHROPIC_FEDERATION_RULE_ID")??"";(t=g.authentication).service_account_id??(t.service_account_id=N("ANTHROPIC_SERVICE_ACCOUNT_ID"))}return{config:g,fromFile:!0}};var oa=async(n,s)=>{if(n?.authentication.credentials_path)return n.authentication.credentials_path;let t=await xi();if(!t)return null;let i=s??await aa();if(!i)return null;sa(i);let{path:c}=await import("./chunk-03r6s8pm.js");return c.join(t,"credentials",`${i}.json`)},xi=async()=>{if(!Uc())return null;let{path:n}=await import("./chunk-03r6s8pm.js"),s=N("ANTHROPIC_CONFIG_DIR");if(s)return s;if(qt()["X-Stainless-OS"]==="Windows"){let l=N("APPDATA");if(l)return n.join(l,"Anthropic");let d=N("USERPROFILE");if(d)return n.join(d,"AppData","Roaming","Anthropic");return null}let i=N("XDG_CONFIG_HOME");if(i)return n.join(i,"anthropic");let c=N("HOME");if(c)return n.join(c,".config","anthropic");return null},Uc=()=>{let n=qt()["X-Stainless-Runtime"];return n==="node"||n==="deno"},aa=async()=>{let n=await xi();if(!n)return null;let s=N("ANTHROPIC_PROFILE");if(s)return s;let{fs:t,path:i}=await import("./chunk-03r6s8pm.js"),c=i.join(n,"active_config");try{return(await t.promises.readFile(c,"utf-8")).trim()||"default"}catch(l){if(l?.code!=="ENOENT")throw Error(`failed to read ${c}: ${l}`);return"default"}};function vi(n){if(!n)throw new u("Identity token file path is empty");return async()=>{let{fs:s}=await import("./chunk-03r6s8pm.js"),t;try{t=await s.promises.readFile(n,"utf-8")}catch(c){throw new u(`Failed to read identity token file at ${n}: ${c}`)}let i=t.trim();if(!i)throw new u(`Identity token file at ${n} is empty`);return i}}function ca(n){if(!n)throw new u("Identity token value is empty");return()=>n}function la(n){return async()=>{Nn(n.baseURL);let s=await n.identityTokenProvider();if(s.length>16384)throw new D(`Identity token is ${Math.ceil(s.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let t={grant_type:Ko,assertion:s,federation_rule_id:n.federationRuleId,organization_id:n.organizationId};if(n.serviceAccountId)t.service_account_id=n.serviceAccountId;if(n.workspaceId)t.workspace_id=n.workspaceId;let i=`${n.baseURL}${On}`,c;try{c=await n.fetch(i,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":`${it},${Jo}`,"User-Agent":n.userAgent||`anthropic-sdk-typescript/${Re} oidcFederationProvider`},body:JSON.stringify(t)})}catch(f){throw new D(`Failed to reach token endpoint ${i}: ${f}`)}let l=c.headers.get("Request-Id");if(!c.ok){let f=await c.text().catch(()=>""),g=le(f),v="";if(c.status===401)v=` Ensure your federation rule matches your identity token. ${n.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the ANTHROPIC_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Claude Console for more details.`;throw new D(`Token exchange failed with status ${c.status}${l?` (request-id ${l})`:""}: ${g}${v}`,c.status,g,l)}let d=await $n(c,l),h=Number(d.expires_in);if(!Number.isFinite(h))throw new D(`Token endpoint response missing required fields: ${JSON.stringify(le(d))}`,c.status,le(d),l);return{token:d.access_token,expiresAt:Oe()+h}}}function ua(n){return async(s)=>{let{fs:t}=await import("./chunk-03r6s8pm.js");await Ln(n.credentialsPath,n.onSafetyWarning);let i;try{i=await t.promises.readFile(n.credentialsPath,"utf-8")}catch(S){throw new D(`Credentials file not found at ${n.credentialsPath}: ${S}`)}let c;try{c=JSON.parse(i)}catch(S){throw new D(`Credentials file at ${n.credentialsPath} is not valid JSON: ${S}`)}let l=c.access_token;if(!l)throw new D(`Credentials file at ${n.credentialsPath} must include 'access_token'`);let d=c.expires_at;if(!s?.forceRefresh&&(d==null||Oe()<d-mt))return{token:l,expiresAt:d??null};let h=c.refresh_token;if(!n.clientId||!h)throw new D(`Access token at ${n.credentialsPath} has expired and no refresh is available (client_id ${n.clientId?"set":"empty"}, refresh_token ${h?"set":"empty"})`);Nn(n.baseURL);let f={grant_type:Vo,refresh_token:h,client_id:n.clientId},g=`${n.baseURL}${On}`,v;try{v=await n.fetch(g,{method:"POST",headers:{"Content-Type":"application/json","anthropic-beta":it,"User-Agent":n.userAgent||`anthropic-sdk-typescript/${Re} userOAuthProvider`},body:JSON.stringify(f)})}catch(S){throw new D(`User OAuth refresh failed to reach token endpoint: ${S}`)}let _=v.headers.get("Request-Id");if(!v.ok){let S=await v.text().catch(()=>"");throw new D(`User OAuth refresh failed (HTTP ${v.status}): ${le(S)}`,v.status,le(S),_)}let k=await $n(v,_),y=Number(k.expires_in);if(!Number.isFinite(y))throw new D(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(le(k))}`,v.status,le(k),_);let x=Oe()+y,P=k.refresh_token||h;return await Fn(n.credentialsPath,{...c,version:jn,type:"oauth_token",access_token:k.access_token,expires_at:x,refresh_token:P}),{token:k.access_token,expiresAt:x}}}function Ri(n,s){let t=n.authentication.credentials_path??null,i=(n.base_url||s.baseURL).replace(/\/+$/,""),c=jc(n,t,i,s),l={};if(n.workspace_id&&n.authentication.type==="user_oauth")l["anthropic-workspace-id"]=n.workspace_id;return{provider:c,extraHeaders:l,baseURL:n.base_url||void 0}}async function da(n,s){let t=await ia(s);if(!t)return null;let{config:i,fromFile:c}=t,l=i.authentication.credentials_path||!c?i:{...i,authentication:{...i.authentication,credentials_path:await oa(i,s)??void 0}};return Ri(l,n)}function jc(n,s,t,i){switch(n.authentication.type){case"oidc_federation":{let c=n.authentication,l=qc(c);if(!l)throw new D("oidc_federation config requires an identity token (set authentication.identity_token, ANTHROPIC_IDENTITY_TOKEN_FILE, or ANTHROPIC_IDENTITY_TOKEN)");if(!c.federation_rule_id)throw new D("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via ANTHROPIC_FEDERATION_RULE_ID (profile takes precedence).");if(!n.organization_id)throw new D("oidc_federation config requires organization_id (set ANTHROPIC_ORGANIZATION_ID or config.organization_id)");let d=la({identityTokenProvider:l,federationRuleId:c.federation_rule_id,organizationId:n.organization_id,serviceAccountId:c.service_account_id,workspaceId:n.workspace_id,baseURL:t,fetch:i.fetch,userAgent:i.userAgent});if(s)return zc(d,s,i.onCacheWriteError,i.onSafetyWarning);return d}case"user_oauth":{if(!s)throw new D("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return ua({credentialsPath:s,clientId:n.authentication.client_id,baseURL:t,fetch:i.fetch,userAgent:i.userAgent,onSafetyWarning:i.onSafetyWarning})}default:{let c=n.authentication.type;throw new D(`authentication.type "${c}" is not a known authentication type`)}}}function qc(n){if(n.identity_token){let i=n.identity_token.source;if(i!=="file")throw new D(`identity_token.source "${i}" is not supported by this SDK version (only "file")`);if(!n.identity_token.path)throw new D('identity_token.source "file" requires a non-empty path');return vi(n.identity_token.path)}let s=N("ANTHROPIC_IDENTITY_TOKEN_FILE");if(s)return vi(s);let t=N("ANTHROPIC_IDENTITY_TOKEN");if(t)return ca(t);return null}function zc(n,s,t,i){return async(c)=>{let{fs:l}=await import("./chunk-03r6s8pm.js");await Ln(s,i);let d;try{let f=await l.promises.readFile(s,"utf-8");d=JSON.parse(f);let g=d?.access_token;if(g&&!c?.forceRefresh){let v=d?.expires_at;if(v==null||Oe()<v-mt)return{token:g,expiresAt:v??null}}}catch(f){if(f?.code!=="ENOENT"&&!(f instanceof SyntaxError))t?.(f)}let h=await n(c);try{await Fn(s,{...d??{},version:jn,type:"oauth_token",access_token:h.token,expires_at:h.expiresAt})}catch(f){t?.(f)}return h}}var _e,ge,Vt=(()=>{class n{constructor(){_e.set(this,void 0),ge.set(this,void 0),o(this,_e,new Uint8Array,"f"),o(this,ge,null,"f")}decode(s){if(s==null)return[];let t=s instanceof ArrayBuffer?new Uint8Array(s):typeof s==="string"?sr(s):s;o(this,_e,Zo([e(this,_e,"f"),t]),"f");let i=[],c;while((c=Kc(e(this,_e,"f"),e(this,ge,"f")))!=null){if(c.carriage&&e(this,ge,"f")==null){o(this,ge,c.index,"f");continue}if(e(this,ge,"f")!=null&&(c.index!==e(this,ge,"f")+1||c.carriage)){i.push(Ft(e(this,_e,"f").subarray(0,e(this,ge,"f")-1))),o(this,_e,e(this,_e,"f").subarray(e(this,ge,"f")),"f"),o(this,ge,null,"f");continue}let l=e(this,ge,"f")!==null?c.preceding-1:c.preceding,d=Ft(e(this,_e,"f").subarray(0,l));i.push(d),o(this,_e,e(this,_e,"f").subarray(c.index),"f"),o(this,ge,null,"f")}return i}flush(){if(!e(this,_e,"f").length)return[];return this.decode(`
3
- `)}}return _e=new WeakMap,ge=new WeakMap,n.NEWLINE_CHARS=new Set([`
4
- `,"\r"]),n.NEWLINE_REGEXP=/\r\n|[\n\r]/g,n})();function Kc(n,s){for(let c=s??0;c<n.length;c++){if(n[c]===10)return{preceding:c,index:c+1,carriage:!1};if(n[c]===13)return{preceding:c,index:c+1,carriage:!0}}return null}var Jt,He=(()=>{class n{constructor(s,t,i){this.iterator=s,Jt.set(this,void 0),this.controller=t,o(this,Jt,i,"f")}static rawEvents(s,t=new AbortController){return ha(s,t)}static fromSSEResponse(s,t,i){let c=!1,l=i?L(i):console;async function*d(){if(c)throw new u("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");c=!0;let h=!1;try{for await(let f of ha(s,t)){if(f.event==="completion")try{yield JSON.parse(f.data)}catch(g){throw l.error("Could not parse message into JSON:",f.data),l.error("From chunk:",f.raw),g}if(f.event==="message_start"||f.event==="message_delta"||f.event==="message_stop"||f.event==="content_block_start"||f.event==="content_block_delta"||f.event==="content_block_stop"||f.event==="message"||f.event==="user.message"||f.event==="user.interrupt"||f.event==="user.tool_confirmation"||f.event==="user.custom_tool_result"||f.event==="user.tool_result"||f.event==="agent.message"||f.event==="agent.thinking"||f.event==="agent.tool_use"||f.event==="agent.tool_result"||f.event==="agent.mcp_tool_use"||f.event==="agent.mcp_tool_result"||f.event==="agent.custom_tool_use"||f.event==="agent.thread_context_compacted"||f.event==="session.status_running"||f.event==="session.status_idle"||f.event==="session.status_rescheduled"||f.event==="session.status_terminated"||f.event==="session.error"||f.event==="session.deleted"||f.event==="session.updated"||f.event==="span.model_request_start"||f.event==="span.model_request_end"||f.event==="span.outcome_evaluation_start"||f.event==="span.outcome_evaluation_ongoing"||f.event==="span.outcome_evaluation_end"||f.event==="user.define_outcome"||f.event==="agent.thread_message_received"||f.event==="agent.thread_message_sent"||f.event==="agent.session_thread_message_received"||f.event==="agent.session_thread_message_sent"||f.event==="session.thread_created"||f.event==="session.thread_status_created"||f.event==="session.thread_status_running"||f.event==="session.thread_status_idle"||f.event==="session.thread_status_rescheduled"||f.event==="session.thread_status_terminated"||f.event==="event_start"||f.event==="event_delta"||f.event==="system.message")try{yield JSON.parse(f.data)}catch(g){throw l.error("Could not parse message into JSON:",f.data),l.error("From chunk:",f.raw),g}if(f.event==="ping")continue;if(f.event==="error"){let g=In(f.data)??f.data,v=g?.error?.type;throw new K(void 0,g,void 0,s.headers,v)}}h=!0}catch(f){if(Me(f))return;throw f}finally{if(!h)t.abort();$e(t)}}return new n(d,t,i)}static fromReadableStream(s,t,i){let c=!1;async function*l(){let h=new Vt,f=zt(s);for await(let g of f)for(let v of h.decode(g))yield v;for(let g of h.flush())yield g}async function*d(){if(c)throw new u("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");c=!0;let h=!1;try{for await(let f of l()){if(h)continue;if(f)yield JSON.parse(f)}h=!0}catch(f){if(Me(f))return;throw f}finally{if(!h)t.abort();$e(t)}}return new n(d,t,i)}[(Jt=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let s=[],t=[],i=this.iterator(),c=(l)=>({next:()=>{if(l.length===0){let d=i.next();s.push(d),t.push(d)}return l.shift()}});return[new n(()=>c(s),this.controller,e(this,Jt,"f")),new n(()=>c(t),this.controller,e(this,Jt,"f"))]}toReadableStream(){let s=this,t;return hi({async start(){t=s[Symbol.asyncIterator]()},async pull(i){try{let{value:c,done:l}=await t.next();if(l)return i.close();let d=sr(JSON.stringify(c)+`
5
- `);i.enqueue(d)}catch(c){i.error(c)}},async cancel(){await t.return?.()}})}}return n})();async function*ha(n,s){if(!n.body){if(s.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new u("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new u("Attempted to iterate over a response with no body")}let t=new fa,i=new Vt,c=zt(n.body);for await(let l of c)for(let d of i.decode(l)){let h=t.decode(d);if(h)yield h}for(let l of i.flush()){let d=t.decode(l);if(d)yield d}}class fa{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(n){if(n.endsWith("\r"))n=n.substring(0,n.length-1);if(!n){if(!this.event&&!this.data.length)return null;let c={event:this.event,data:this.data.join(`
6
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],c}if(this.chunks.push(n),n.startsWith(":"))return null;let[s,t,i]=Vc(n,":");if(i.startsWith(" "))i=i.substring(1);if(s==="event")this.event=i;else if(s==="data")this.data.push(i);return null}}function Vc(n,s){let t=n.indexOf(s);if(t!==-1)return[n.substring(0,t),s,n.substring(t+s.length)];return[n,"",""]}async function qn(n,s){let{response:t,requestLogID:i,retryOfRequestLogID:c,startTime:l}=s,d=await(async()=>{if(s.options.stream)return L(n).debug("response",t.status,t.url,t.headers,t.body),He.fromSSEResponse(t,s.controller,n);if(t.status===204)return null;if(s.options.__binaryResponse)return t;let f=t.headers.get("content-type")?.split(";")[0]?.trim();if(f?.includes("application/json")||f?.endsWith("+json")){if(t.headers.get("content-length")==="0")return;let k=await t.json();return Gt(k,t)}return await t.text()})().finally(()=>{if(!s.options.stream&&!s.options.__binaryResponse)$e(s.controller)});return Fe(L(n),`[${i}] response parsed`,{retryOfRequestLogID:c,url:t.url,status:t.status,body:d,durationMs:Date.now()-l}),d}function Gt(n,s){if(!n||typeof n!=="object"||Array.isArray(n))return n;return Object.defineProperties(n,{_request_id:{value:s.headers.get("request-id"),enumerable:!1},_workspace_id:{value:s.headers.get("anthropic-workspace-id"),enumerable:!1}})}var ma=new WeakSet;function Ei(n){return typeof n==="object"&&n!==null&&ma.has(n)}function _a(n){let s=new Set;while(typeof n==="object"&&n!==null&&!s.has(n)){if(s.add(n),Ei(n)||Me(n)||n instanceof Ke||n instanceof ci)return!0;n=n.cause}return!1}function Ai(n,s,t,i){return async(c,l={})=>{if(s.length===0)return n.call(void 0,c,l);let d=l.headers instanceof Headers?l.headers:new Headers(l.headers),h=await Gc(n,s,t,i)({...l,headers:d,url:typeof c==="string"?c:c instanceof URL?c.href:c.url});if(h.bodyUsed||h.body?.locked)throw new u("middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it");return h}}function Jc(n,s){let t=new WeakMap;return{options:n,logger:s?L(s):na(),parse(i){if(n?.stream&&i.ok)return pa(i,n,s);let c=t.get(i);if(!c)c=pa(i,n,s),t.set(i,c);return c}}}async function pa(n,s,t){if(n.bodyUsed||n.body?.locked)throw new u("cannot ctx.parse() a response whose body was already consumed; call ctx.parse() instead of reading the body, or read via response.clone()");if(s?.stream&&n.ok)return He.fromSSEResponse(n.clone(),new AbortController,t);if(n.status===204)return null;if(s?.__binaryResponse)return n;let c=n.headers.get("content-type")?.split(";")[0]?.trim();if(c?.includes("application/json")||c?.endsWith("+json")){if(n.headers.get("content-length")==="0")return;return Gt(await n.clone().json(),n)}return await n.clone().text()}function Gc(n,s,t,i){let c=async({url:d,...h})=>{try{return await n.call(void 0,d,h)}catch(f){let g=st(f);throw ma.add(g),g}},l=Jc(t,i);for(let d=s.length-1;d>=0;d--){let h=s[d],f=c;c=async(g)=>h(g,f,l)}return c}var Yt,zn=(()=>{class n extends Promise{constructor(s,t,i=qn){super((c)=>{c(null)});this.responsePromise=t,this.parseResponse=i,Yt.set(this,void 0),o(this,Yt,s,"f")}_thenUnwrap(s){return new n(e(this,Yt,"f"),this.responsePromise,async(t,i)=>Gt(s(await this.parseResponse(t,i),i),i.response))}asResponse(){return this.responsePromise.then((s)=>s.response)}async withResponse(){let[s,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:s,response:t,request_id:t.headers.get("request-id"),workspace_id:t.headers.get("anthropic-workspace-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((s)=>this.parseResponse(e(this,Yt,"f"),s));return this.parsedPromise}then(s,t){return this.parse().then(s,t)}catch(s){return this.parse().catch(s)}finally(s){return this.parse().finally(s)}}return Yt=new WeakMap,n})();var Kn,Ti=(()=>{class n{constructor(s,t,i,c){Kn.set(this,void 0),o(this,Kn,s,"f"),this.options=c,this.response=t,this.body=i}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let s=this.nextPageRequestOptions();if(!s)throw new u("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await e(this,Kn,"f").requestAPIList(this.constructor,s)}async*iterPages(){let s=this;yield s;while(s.hasNextPage())s=await s.getNextPage(),yield s}async*[(Kn=new WeakMap,Symbol.asyncIterator)](){for await(let s of this.iterPages())for(let t of s.getPaginatedItems())yield t}}return n})(),ga=(()=>{class n extends zn{constructor(s,t,i){super(s,t,async(c,l)=>new i(c,l.response,await qn(c,l),l.options))}async*[Symbol.asyncIterator](){let s=await this;for await(let t of s)yield t}}return n})();class re extends Ti{constructor(n,s,t,i){super(n,s,t,i);this.data=t.data||[],this.has_more=t.has_more||!1,this.first_id=t.first_id||null,this.last_id=t.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){if(this.options.query?.before_id){let s=this.first_id;if(!s)return null;return{...this.options,query:{...jt(this.options.query),before_id:s}}}let n=this.last_id;if(!n)return null;return{...this.options,query:{...jt(this.options.query),after_id:n}}}}class T extends Ti{constructor(n,s,t,i){super(n,s,t,i);this.data=t.data||[],this.next_page=t.next_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let n=this.next_page;if(!n)return null;return{...this.options,query:{...jt(this.options.query),page:n}}}}class Ii extends Ti{constructor(n,s,t,i){super(n,s,t,i);this.data=t.data||[],this.next_page=t.next_page||null,this.prev_page=t.prev_page||null}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){let n=this.next_page;if(!n)return null;return{...this.options,query:{...jt(this.options.query),page:n}}}}var Mi=()=>{if(typeof File>"u"){let{process:n}=globalThis,s=typeof n?.versions?.node==="string"&&parseInt(n.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(s?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function ot(n,s,t){return Mi(),new File(n,s??"",t)}function Xt(n,s){let t=typeof n==="object"&&n!==null&&(("name"in n)&&n.name&&String(n.name)||("url"in n)&&n.url&&String(n.url)||("filename"in n)&&n.filename&&String(n.filename)||("path"in n)&&n.path&&String(n.path))||"";return s?t.split(/[\\/]/).pop()||void 0:t}var Ci=(n)=>n!=null&&typeof n==="object"&&typeof n[Symbol.asyncIterator]==="function";var Ee=async(n,s,t=!0)=>({...n,body:await Qc(n.body,s,t)}),wa=new WeakMap;function Xc(n){let s=typeof n==="function"?n:n.fetch,t=wa.get(s);if(t)return t;let i=(async()=>{try{let c="Response"in s?s.Response:(await s("data:,")).constructor,l=new FormData;if(l.toString()===await new c(l).text())return!1;return!0}catch{return!0}})();return wa.set(s,i),i}var Qc=async(n,s,t=!0)=>{if(!await Xc(s))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let i=new FormData;return await Promise.all(Object.entries(n||{}).map(([c,l])=>Pi(i,c,l,t))),i};var Pi=async(n,s,t,i)=>{if(t===void 0)return;if(t==null)throw TypeError(`Received null for "${s}"; to pass null in FormData, you must use the string 'null'`);if(typeof t==="string"||typeof t==="number"||typeof t==="boolean")n.append(s,String(t));else if(t instanceof Response){let c={},l=t.headers.get("Content-Type");if(l)c={type:l};n.append(s,ot([await t.blob()],Xt(t,i),c))}else if(Ci(t))n.append(s,ot([await new Response(Mn(t)).blob()],Xt(t,i)));else if(t instanceof Blob){let l=typeof File<"u"&&t instanceof File?t.name:Xt(t,i);n.append(s,ot([t],l,{type:t.type}))}else if(Array.isArray(t))await Promise.all(t.map((c)=>Pi(n,s+"[]",c,i)));else if(typeof t.then==="function")throw TypeError(`Received a Promise for "${s}"; await it first, e.g. \`await toFile(...)\``);else if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))throw TypeError(`Received ${t.constructor.name} for "${s}"; to upload raw bytes, wrap them with \`await toFile(bytes, 'filename')\``);else if(typeof t==="object")await Promise.all(Object.entries(t).map(([c,l])=>Pi(n,`${s}[${c}]`,l,i)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${t} instead`)};var ya=(n)=>n!=null&&typeof n==="object"&&typeof n.size==="number"&&typeof n.type==="string"&&typeof n.text==="function"&&typeof n.slice==="function"&&typeof n.arrayBuffer==="function",Zc=(n)=>n!=null&&typeof n==="object"&&typeof n.name==="string"&&typeof n.lastModified==="number"&&ya(n),el=(n)=>n!=null&&typeof n==="object"&&typeof n.url==="string"&&typeof n.blob==="function";async function Ni(n,s,t){if(Mi(),n=await n,s||(s=n instanceof File?n.name:Xt(n,!0)),Zc(n)){if(n instanceof File&&s==null&&t==null)return n;return ot([await n.arrayBuffer()],s??n.name,{type:n.type,lastModified:n.lastModified,...t})}if(el(n)){let c=await n.blob();return s||(s=new URL(n.url).pathname.split(/[\\/]/).pop()),ot(await Oi(c),s,t)}let i=await Oi(n);if(!t?.type){let c=i.find((l)=>typeof l==="object"&&("type"in l)&&l.type);if(typeof c==="string")t={...t,type:c}}return ot(i,s,t)}async function Oi(n){let s=[];if(typeof n==="string"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer)s.push(n);else if(ya(n))s.push(n instanceof Blob?n:await n.arrayBuffer());else if(Ci(n))for await(let t of n)s.push(...await Oi(t));else{let t=n?.constructor?.name;throw Error(`Unexpected data type: ${typeof n}${t?`; constructor: ${t}`:""}${tl(n)}`)}return s}function tl(n){if(typeof n!=="object"||n===null)return"";return`; props: [${Object.getOwnPropertyNames(n).map((t)=>`"${t}"`).join(", ")}]`}class R{constructor(n){this._client=n}}var ba=Symbol.for("brand.privateNullableHeaders");function*nl(n){if(!n)return;if(ba in n){let{values:i,nulls:c}=n;yield*i.entries();for(let l of c)yield[l,null];return}let s=!1,t;if(n instanceof Headers)t=n.entries();else if(li(n))t=n;else s=!0,t=Object.entries(n??{});for(let i of t){let c=i[0];if(typeof c!=="string")throw TypeError("expected header name to be a string");let l=li(i[1])?i[1]:[i[1]],d=!1;for(let h of l){if(h===void 0)continue;if(s&&!d)d=!0,yield[c,Vn];yield[c,h]}}}var Vn=Symbol("clear"),sl=new Set(["x-stainless-helper"]),il=(n,s)=>{let t=n?n.split(",").map((i)=>i.trim()).filter(Boolean):[];for(let i of s.split(",").map((c)=>c.trim()))if(i&&!t.includes(i))t.push(i);return t.join(", ")},p=(n)=>{let s=new Headers,t=new Set;for(let i of n){let c=new Set;for(let[l,d]of nl(i)){let h=l.toLowerCase();if(sl.has(h)){if(d===Vn)continue;if(d===null)s.delete(l),t.add(h);else s.set(l,il(s.get(l),d)),t.delete(h);continue}if(d===Vn||!c.has(h)){if(s.delete(l),c.add(h),d===Vn)continue}if(d===null)s.delete(l),t.add(h);else s.append(l,d),t.delete(h)}}return{[ba]:!0,values:s,nulls:t}};function Sa(n){return n.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var ka=Object.freeze(Object.create(null)),ol=(n=Sa)=>function(t,...i){if(t.length===1)return t[0];let c=!1,l=[],d=t.reduce((v,_,k)=>{if(/[?#]/.test(_))c=!0;let y=i[k],x=(c?encodeURIComponent:n)(""+y);if(k!==i.length&&(y==null||typeof y==="object"&&y.toString===Object.getPrototypeOf(Object.getPrototypeOf(y.hasOwnProperty??ka)??ka)?.toString))x=y+"",l.push({start:v.length+_.length,length:x.length,error:`Value of type ${Object.prototype.toString.call(y).slice(8,-1)} is not a valid path parameter`});return v+_+(k===i.length?"":x)},""),h=d.split(/[?#]/,1)[0],f=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,g;while((g=f.exec(h))!==null)l.push({start:g.index,length:g[0].length,error:`Value "${g[0]}" can't be safely passed as a path parameter`});if(l.sort((v,_)=>v.start-_.start),l.length>0){let v=0,_=l.reduce((k,y)=>{let x=" ".repeat(y.start-v),P="^".repeat(y.length);return v=y.start+y.length,k+x+P},"");throw new u(`Path parameters result in path with invalid segments:
7
- ${l.map((k)=>k.error).join(`
8
- `)}
9
- ${d}
10
- ${_}`)}return d},m=ol(Sa);class Qt extends R{retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/deployment_runs/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/deployment_runs?beta=true",T,{query:c,...s,headers:p([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}}class Zt extends R{create(n,s){let{betas:t,workspace_id:i,...c}=n;return this._client.post("/v1/deployments?beta=true",{body:c,...s,headers:p([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/deployments/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}update(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/deployments/${n}?beta=true`,{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/deployments?beta=true",T,{query:c,...s,headers:p([{"anthropic-beta":[...t??[],"managed-agents-2026-04-01"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}archive(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/deployments/${n}/archive?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}pause(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/deployments/${n}/pause?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}run(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/deployments/${n}/run?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}unpause(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/deployments/${n}/unpause?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}class er extends R{create(n,s){let{betas:t,workspace_id:i,...c}=n;return this._client.post("/v1/dreams?beta=true",{body:c,...s,headers:p([{"anthropic-beta":[...t??[],"dreaming-2026-04-21"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/dreams/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/dreams?beta=true",T,{query:c,...s,headers:p([{"anthropic-beta":[...t??[],"dreaming-2026-04-21"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}archive(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/dreams/${n}/archive?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}cancel(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/dreams/${n}/cancel?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var Jn="x-stainless-helper",wt="x-stainless-helper-method";function Gn(n){return{["x-stainless-helper"]:n}}var gt=Symbol("anthropic.sdk.stainlessHelper");function tr(n){return typeof n==="object"&&n!==null&&gt in n}function $i(n,s){let t=new Set;if(n){for(let i of n)if(tr(i))t.add(i[gt])}if(s)for(let i of s){if(tr(i))t.add(i[gt]);let c=i.content;if(Array.isArray(c))for(let l of c){if(tr(l))t.add(l[gt]);let d=l?.tool?.definition;if(tr(d))t.add(d[gt])}}return Array.from(t)}function Yn(n,s){let t=$i(n,s);if(t.length===0)return{};return{["x-stainless-helper"]:t.join(", ")}}function Xn(n){if(tr(n))return{["x-stainless-helper"]:n[gt]};return{}}class rr extends R{list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/files?beta=true",T,{query:c,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}delete(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.delete(m`/v1/files/${n}?beta=true`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}download(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/files/${n}/content?beta=true`,{...t,headers:p([{Accept:"application/binary",...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers]),__binaryResponse:!0})}retrieveMetadata(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/files/${n}?beta=true`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}upload(n,s){let{betas:t,workspace_id:i,...c}=n;return this._client.post("/v1/files?beta=true",Ee({body:c,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},Xn(c.file),s?.headers])},this._client))}}class nr extends R{retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/models/${n}?beta=true`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/models?beta=true",re,{query:c,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}}class ir extends R{create(n,s){let{betas:t,workspace_id:i,...c}=n;return this._client.post("/v1/user_profiles?beta=true",{body:c,...s,headers:p([{"anthropic-beta":[...t??[],"user-profiles-2026-08-18"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/user_profiles/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}update(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/user_profiles/${n}?beta=true`,{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/user_profiles?beta=true",T,{query:c,...s,headers:p([{"anthropic-beta":[...t??[],"user-profiles-2026-08-18"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}createEnrollmentURL(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/user_profiles/${n}/enrollment_url?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var Fa=a(La(),1);class ur extends R{parseUnverified(n){return JSON.parse(n)}unwrap(n,s){let t=s?.headers;if(t==null)throw Error("Webhook headers are required in order to verify the signature");let i=s.key===void 0?this._client.webhookKey:s.key;if(!i)throw Error("Webhook key must not be null or empty in order to unwrap");return new Fa.Webhook(i).verify(n,t),JSON.parse(n)}}class hr extends R{list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/agents/${n}/versions?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var es=(()=>{class n extends R{constructor(){super(...arguments);this.versions=new hr(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/agents?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l,...d}=t??{};return this._client.get(m`/v1/agents/${s}?beta=true`,{query:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/agents/${s}?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/agents?beta=true",T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/agents/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Versions=hr,n})();function Ge(n,s){if(!n)return()=>{};if(n.aborted)return s.abort(),()=>{};let t=()=>s.abort();return n.addEventListener("abort",t),()=>n.removeEventListener("abort",t)}function be(n,s){return n instanceof K&&n.status===s}function vl(n){return n instanceof K&&typeof n.status==="number"&&n.status>=400&&n.status<500}function at(n){return vl(n)&&!be(n,408)&&!be(n,409)&&!be(n,429)}function ts(n,s,t){return Math.min(s*2**n,t)}function Ha(n,s){return n+Math.random()*(s-n)}function rs(n){return n*(1-Math.random()*0.25)}function ns(n,{authToken:s,helper:t}){if(!s)throw new u(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(s)}`);let i=n,c=i._options.defaultHeaders,l=i._authState?.extraHeaders,d=l?Object.fromEntries(Object.entries(l).filter(([f])=>{let g=f.toLowerCase();return g!=="authorization"&&g!=="x-api-key"})):void 0,h=p([d,c,{[Jn]:t}]);return n.withOptions({apiKey:null,authToken:s,baseURL:n.baseURL,credentials:void 0,defaultHeaders:h})}var yt,ss,Ae,is,os,as,fr,pr,bt,kt,cs,St,mr,Rl=999,El=1000,Al=60000,Tl=300000,_r=(()=>{class n{constructor(s){yt.set(this,void 0),ss.set(this,!1),Ae.set(this,void 0),is.set(this,void 0),os.set(this,void 0),as.set(this,void 0),fr.set(this,void 0),pr.set(this,void 0),bt.set(this,void 0),this.client=s.client,this.environmentId=s.environmentId,this.environmentKey=s.environmentKey,this.workerId=s.workerId??Ml(),o(this,yt,ns(s.client,{authToken:s.environmentKey,helper:"environments-work-poller"}),"f"),o(this,os,s.autoStop??!0,"f"),o(this,as,s.drain??!1,"f"),o(this,fr,s.blockMs===void 0?Rl:s.blockMs,"f"),o(this,pr,s.reclaimOlderThanMs??null,"f"),o(this,bt,s.requestOptions,"f"),o(this,Ae,new AbortController,"f"),o(this,is,Ge(s.signal,e(this,Ae,"f")),"f")}get signal(){return e(this,Ae,"f").signal}abort(){e(this,Ae,"f").abort()}async*[(yt=new WeakMap,ss=new WeakMap,Ae=new WeakMap,is=new WeakMap,os=new WeakMap,as=new WeakMap,fr=new WeakMap,pr=new WeakMap,bt=new WeakMap,Symbol.asyncIterator)](){if(e(this,ss,"f"))throw new u("Cannot iterate over a consumed WorkPoller");o(this,ss,!0,"f");let s=L(this.client);s.info("poller starting",{component:"work-poller",environment_id:this.environmentId});let t=new Pl(s,this.environmentId);try{let i=0;while(!e(this,Ae,"f").signal.aborted){let c;try{c=await e(this,yt,"f").beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...e(this,fr,"f")!==null?{block_ms:e(this,fr,"f")}:{},...e(this,pr,"f")!==null?{reclaim_older_than_ms:e(this,pr,"f")}:{}},{headers:p([e(this,bt,"f")?.headers]),signal:e(this,Ae,"f").signal})}catch(l){if(e(this,Ae,"f").signal.aborted)return;if(at(l))throw s.error("poll failed permanently, stopping poller",{error:String(l)}),l;let d=rs(Il(i));s.warn("poll failed, backing off",{error:String(l),backoff_ms:d}),i++,await Ce(d,e(this,Ae,"f").signal);continue}if(i=0,c==null){if(e(this,as,"f"))return;t.onEmptyPoll(),await Ce(Ha(1000,3000),e(this,Ae,"f").signal);continue}t.onClaim(),s.info("claimed work",{component:"work-poller",environment_id:this.environmentId,work_id:c.id,work_type:c.data.type});try{await e(this,yt,"f").beta.environments.work.ack(c.id,{environment_id:c.environment_id},{headers:p([e(this,bt,"f")?.headers]),signal:e(this,Ae,"f").signal})}catch(l){s.error("ack failed",{work_id:c.id,error:String(l)});continue}try{yield c}finally{if(e(this,os,"f"))try{await e(this,yt,"f").beta.environments.work.stop(c.id,{environment_id:c.environment_id},{headers:p([e(this,bt,"f")?.headers])})}catch(l){if(!be(l,409))s.warn("stop failed",{work_id:c.id,error:String(l)})}}}}finally{e(this,is,"f").call(this)}}}return n})();function Il(n){return ts(n,El,Al)}var Pl=(()=>{class n{constructor(s,t){kt.set(this,void 0),cs.set(this,void 0),St.set(this,void 0),mr.set(this,0),o(this,kt,s,"f"),o(this,cs,t,"f")}onEmptyPoll(){let s=Date.now(),t={component:"work-poller",environment_id:e(this,cs,"f")};if(e(this,St,"f")===void 0)o(this,St,o(this,mr,s,"f"),"f"),e(this,kt,"f").info("idle; polling for work",t);else if(s-e(this,mr,"f")>=Tl)o(this,mr,s,"f"),e(this,kt,"f").info(`still polling; idle for ${Math.round((s-e(this,St,"f"))/1000)}s`,t);else e(this,kt,"f").debug("poll returned no work",t)}onClaim(){o(this,St,void 0,"f")}}return kt=new WeakMap,cs=new WeakMap,St=new WeakMap,mr=new WeakMap,n})();function Ml(){let s=globalThis.process?.env?.HOSTNAME;return s?`${s}-${Wn()}`:Wn()}var xt,Ye,vt,Da=(()=>{class n{constructor(){xt.set(this,[]),Ye.set(this,[]),vt.set(this,!1)}push(s){if(e(this,vt,"f"))return!1;let t=e(this,Ye,"f").shift();if(t)t({done:!1,value:s});else e(this,xt,"f").push(s);return!0}close(){if(e(this,vt,"f"))return;o(this,vt,!0,"f");while(e(this,Ye,"f").length>0)e(this,Ye,"f").shift()({done:!0,value:void 0})}next(s){if(e(this,xt,"f").length>0)return Promise.resolve({done:!1,value:e(this,xt,"f").shift()});if(e(this,vt,"f")||s?.aborted)return Promise.resolve({done:!0,value:void 0});return new Promise((t)=>{let i=(l)=>{s?.removeEventListener("abort",c),t(l)},c=()=>{let l=e(this,Ye,"f").indexOf(i);if(l>=0)e(this,Ye,"f").splice(l,1);t({done:!0,value:void 0})};e(this,Ye,"f").push(i),s?.addEventListener("abort",c,{once:!0})})}tryShift(){return e(this,xt,"f").shift()}}return xt=new WeakMap,Ye=new WeakMap,vt=new WeakMap,n})();var I=(()=>{class n extends Error{constructor(s){let t=typeof s==="string"?s:s.map((i)=>{if(i.type==="text")return i.text;return`[${i.type}]`}).join(" ");super(t);this.name="ToolError",this.content=s}}return n})();function Hi(n){return"name"in n?n.name:("mcp_server_name"in n)?n.mcp_server_name:n.type}function Cl(n){return n instanceof I?n.content:`Error: ${n instanceof Error?n.message:String(n)}`}async function Ba(n,s,t){try{let i=n.parse?n.parse(s):s;return{content:await n.run(i,t),isError:!1}}catch(i){return{content:Cl(i),isError:!0}}}var gr,ls,Rt,ct,Ne,Y,us,ne,ds,wr,hs,ee,Et,ke,At,Xe,It,qe,fs,yr,Te,ps,Wa,Ua,ja,qa,Di,za,ms,_s,Bi,Ka,Va;var Ja=500,Ol=1e4,Nl=120000,$l=30000,Ll=1000,Fl=30000,Hl=300000,Dl=60000;function Ga(n){return n.type==="session.status_idle"&&n.stop_reason?.type==="end_turn"}var Bl=(()=>{class n{constructor(s,t){gr.set(this,void 0),ls.set(this,void 0),Rt.set(this,new Set),ct.set(this,!1),Ne.set(this,void 0),o(this,gr,s,"f"),o(this,ls,t,"f")}noteEvent(s){if(s.type==="user.tool_confirmation")return;if(Ga(s))this.arm();else this.disarm()}block(s){if(e(this,Rt,"f").add(s),e(this,Ne,"f")!==void 0)o(this,ct,!0,"f"),clearTimeout(e(this,Ne,"f")),o(this,Ne,void 0,"f")}unblock(s){if(e(this,Rt,"f").delete(s),e(this,Rt,"f").size===0&&e(this,ct,"f"))this.arm()}arm(){if(e(this,gr,"f")<=0)return;if(e(this,Rt,"f").size>0){o(this,ct,!0,"f");return}if(o(this,ct,!1,"f"),e(this,Ne,"f")!==void 0)clearTimeout(e(this,Ne,"f"));o(this,Ne,setTimeout(e(this,ls,"f"),e(this,gr,"f")),"f")}disarm(){if(o(this,ct,!1,"f"),e(this,Ne,"f")!==void 0)clearTimeout(e(this,Ne,"f")),o(this,Ne,void 0,"f")}}return gr=new WeakMap,ls=new WeakMap,Rt=new WeakMap,ct=new WeakMap,Ne=new WeakMap,n})(),br=(()=>{class n{constructor(s,t){Y.add(this),us.set(this,!1),ne.set(this,void 0),ds.set(this,void 0),wr.set(this,void 0),hs.set(this,void 0),ee.set(this,void 0),Et.set(this,new Set),ke.set(this,new Set),At.set(this,new Map),Xe.set(this,new Map),It.set(this,new Da),qe.set(this,0),fs.set(this,Hl),yr.set(this,null),Te.set(this,void 0),this.client=t.client,this.sessionId=s,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??Dl,o(this,ee,L(t.client),"f"),o(this,hs,new Map(t.tools.map((i)=>[Hi(i),i])),"f"),o(this,ne,new AbortController,"f"),o(this,ds,Ge(t.signal,e(this,ne,"f")),"f"),o(this,wr,t.requestOptions,"f"),o(this,Te,new Bl(this.maxIdleMs,()=>{e(this,ee,"f").info("session idle after end_turn; stopping",{component:"session-tool-runner",session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),e(this,ne,"f").abort()}),"f")}get signal(){return e(this,ne,"f").signal}abort(){e(this,ne,"f").abort()}_setSendRetryWindow(s){o(this,fs,s,"f")}async*[(us=new WeakMap,ne=new WeakMap,ds=new WeakMap,wr=new WeakMap,hs=new WeakMap,ee=new WeakMap,Et=new WeakMap,ke=new WeakMap,At=new WeakMap,Xe=new WeakMap,It=new WeakMap,qe=new WeakMap,fs=new WeakMap,yr=new WeakMap,Te=new WeakMap,Y=new WeakSet,Symbol.asyncIterator)](){if(e(this,us,"f"))throw new u("Cannot iterate over a consumed SessionToolRunner");o(this,us,!0,"f"),e(this,ee,"f").info("session tool runner starting",{component:"session-tool-runner",session_id:this.sessionId});let s=e(this,Y,"m",Wa).call(this).catch((t)=>{if(!e(this,ne,"f").signal.aborted)e(this,ee,"f").error("stream loop failed",{error:String(t)});e(this,ne,"f").abort()});try{while(!0){let i=await e(this,It,"f").next(e(this,ne,"f").signal);if(i.done)break;yield i.value}await s;let t;while((t=e(this,It,"f").tryShift())!==void 0)yield t}finally{e(this,ne,"f").abort(),e(this,Te,"f").disarm(),await s;try{await e(this,Y,"m",Va).call(this)}catch(t){e(this,ee,"f").warn("drain failed",{error:String(t)})}e(this,It,"f").close();for(let t of this.tools)try{await t.close?.()}catch(i){e(this,ee,"f").warn("tool.close failed",{tool:Hi(t),error:String(i)})}e(this,ds,"f").call(this)}}}return ps=function(){return{...e(this,wr,"f"),headers:p([Gn("session-tool-runner"),e(this,wr,"f")?.headers]),signal:e(this,ne,"f").signal}},Wa=async function(){let t=e(this,ne,"f"),i=Ja;while(!t.signal.aborted){try{let c=await this.client.beta.sessions.events.stream(this.sessionId,{},e(this,Y,"m",ps).call(this));await e(this,Y,"m",Ua).call(this);for await(let l of c)if(i=Ja,await e(this,Y,"m",qa).call(this,l))return}catch(c){if(t.signal.throwIfAborted(),at(c))throw e(this,ee,"f").error("permanent stream failure, shutting down",{error:String(c)}),t.abort(),c;e(this,ee,"f").warn("stream disconnected, reconnecting",{error:String(c),backoff_ms:i})}t.signal.throwIfAborted(),await Ce(i,t.signal),i=Math.min(i*2,Ol)}},Ua=async function(){let t=e(this,ne,"f"),i=[],c=!1;try{for await(let h of this.client.beta.sessions.events.list(this.sessionId,{limit:1000},e(this,Y,"m",ps).call(this)))e(this,Y,"m",ja).call(this,h,i),c=Ga(h)}catch(h){t.signal.throwIfAborted(),e(this,ee,"f").warn("reconcile list failed",{error:String(h)});for(let f of i)e(this,Et,"f").delete(f.id);return}let l=i.filter((h)=>!e(this,ke,"f").has(h.id));e(this,Te,"f").disarm();for(let h of l)await e(this,Y,"m",Di).call(this,h);for(let h of[...e(this,Xe,"f").values()]){let f=e(this,At,"f").get(h.id);if(f!==void 0)await e(this,Y,"m",ms).call(this,h,f)}let d=l.filter((h)=>!e(this,ke,"f").has(h.id)&&!e(this,Xe,"f").has(h.id));if(c&&d.length===0)e(this,Te,"f").arm();else e(this,Te,"f").disarm()},ja=function(t,i){if(t.type==="agent.tool_use"||t.type==="agent.custom_tool_use"){if(e(this,Et,"f").add(t.id),!e(this,ke,"f").has(t.id))i.push(t)}else if(t.type==="user.tool_result")e(this,ke,"f").add(t.tool_use_id);else if(t.type==="user.custom_tool_result")e(this,ke,"f").add(t.custom_tool_use_id);else if(t.type==="user.tool_confirmation"){if(!e(this,ke,"f").has(t.tool_use_id))e(this,At,"f").set(t.tool_use_id,t.result)}},qa=async function(t){switch(e(this,Te,"f").noteEvent(t),t.type){case"agent.tool_use":case"agent.custom_tool_use":if(!e(this,Et,"f").has(t.id))e(this,Et,"f").add(t.id),await e(this,Y,"m",Di).call(this,t);return!1;case"user.tool_confirmation":return await e(this,Y,"m",za).call(this,t),!1;case"user.tool_result":return e(this,ke,"f").add(t.tool_use_id),!1;case"user.custom_tool_result":return e(this,ke,"f").add(t.custom_tool_use_id),!1;case"session.status_terminated":case"session.deleted":return e(this,ee,"f").info("session terminated",{component:"session-tool-runner",session_id:this.sessionId}),e(this,ne,"f").abort(),!0;default:return!1}},Di=async function(t){let i=t.evaluated_permission,c=i==="deny"?"deny":e(this,At,"f").get(t.id);if(c===void 0){if(i===void 0||i==="allow")await e(this,Y,"m",Bi).call(this,t,void 0);else if(!e(this,Xe,"f").has(t.id))e(this,ee,"f").info("tool call awaiting confirmation; holding",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,Xe,"f").set(t.id,t),e(this,Te,"f").block(t.id);return}await e(this,Y,"m",ms).call(this,t,c)},za=async function(t){e(this,At,"f").set(t.tool_use_id,t.result);let i=e(this,Xe,"f").get(t.tool_use_id);if(i===void 0)return;await e(this,Y,"m",ms).call(this,i,t.result)},ms=async function(t,i){let c=e(this,Xe,"f").delete(t.id);if(i==="allow"){if(e(this,ee,"f").info("tool call confirmed",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),!c)e(this,Te,"f").block(t.id);try{await e(this,Y,"m",Bi).call(this,t,"allow")}finally{e(this,Te,"f").unblock(t.id)}return}if(c)e(this,Te,"f").unblock(t.id);e(this,ke,"f").add(t.id),e(this,ee,"f").info("tool call denied; not executing",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,Y,"m",_s).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:"deny"})},_s=function(t){e(this,It,"f").push(t)},Bi=async function(t,i){var c,l;if(e(this,ke,"f").has(t.id))return;e(this,ee,"f").info("executing tool",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),o(this,qe,(c=e(this,qe,"f"),c++,c),"f");try{let d=e(this,hs,"f").get(t.name);if(!d){e(this,ee,"f").info("tool not owned by this runner; leaving the tool_use_id pending for its owner",{component:"session-tool-runner",session_id:this.sessionId,tool:t.name,tool_use_id:t.id}),e(this,Y,"m",_s).call(this,{event:t,toolUseId:t.id,name:t.name,isError:!1,posted:!1,confirmation:i});return}let h,f,g=new AbortController,v=Ge(e(this,ne,"f").signal,g),_=setTimeout(()=>g.abort(),Nl);try{let x=await Ba(d,t.input,{toolUse:t,toolUseBlock:t,signal:g.signal});h=x.content,f=x.isError}finally{clearTimeout(_),v()}let k=Wl(t,f,Ul(h)),y=await e(this,Y,"m",Ka).call(this,k,t.id);e(this,Y,"m",_s).call(this,{event:t,result:k,toolUseId:t.id,name:t.name,isError:f,posted:y,confirmation:i})}finally{if(o(this,qe,(l=e(this,qe,"f"),l--,l),"f"),e(this,qe,"f")===0)e(this,yr,"f")?.call(this)}},Ka=async function(t,i){let c=e(this,ne,"f"),l=Date.now(),d,h=0;while(!0){h++,c.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[t]},e(this,Y,"m",ps).call(this)),e(this,ke,"f").add(i),!0}catch(f){if(d=f,at(f))break;let g=e(this,fs,"f")-(Date.now()-l);if(g<=0)break;let v=Math.min(rs(ts(h-1,Ll,Fl)),g);e(this,ee,"f").warn("tool result send failed; retrying",{tool_use_id:i,attempt:h,backoff_ms:v,error:String(f)}),await Ce(v,c.signal)}}return e(this,ee,"f").error("failed to send tool result",{tool_use_id:i,attempts:h,error:String(d)}),!1},Va=async function(){if(e(this,qe,"f")===0)return;if(await Promise.race([new Promise((t)=>o(this,yr,t,"f")),Ce($l)]),o(this,yr,null,"f"),e(this,qe,"f")>0)e(this,ee,"f").warn("drain timeout exceeded")},n})();function Wl(n,s,t){if(n.type==="agent.custom_tool_use")return{type:"user.custom_tool_result",custom_tool_use_id:n.id,is_error:s,content:t};return{type:"user.tool_result",tool_use_id:n.id,is_error:s,content:t}}function Ul(n){if(typeof n==="string")return[{type:"text",text:n||"(no output)"}];let s=n.map((t)=>{if(t.type==="text")return{type:"text",text:t.text||"(no output)"};if(t.type==="image"||t.type==="document")return t;if(t.type==="search_result")return{type:"search_result",source:t.source,title:t.title,content:t.content.map((i)=>({type:"text",text:i.text})),citations:{enabled:t.citations?.enabled??!1}};return{type:"text",text:JSON.stringify(t)}});return s.length>0?s:[{type:"text",text:"(no output)"}]}var Uo=15000,Ya=5000;function Un(n,s){if(!(n>=Ya))throw new u(`${s} must be at least ${Ya}ms (got ${n}); to run without memory sync, pass \`memorySyncIntervalMs: null\` to the worker instead`)}var gs,kr,Wi,Sr,Mt,Xa=30000,jl=90000,ql="NO_HEARTBEAT";function zl(n){return n.resources.some((s)=>s.type==="memory_store")}function Kl(n){if(!n)return null;let s;try{let i=n.replace(/-/g,"+").replace(/_/g,"/"),c=i.padEnd(Math.ceil(i.length/4)*4,"=");s=JSON.parse(Ft(ea(c)))}catch{return null}if(s===null||typeof s!=="object"||Array.isArray(s))return null;let t=s.sessions_token;return typeof t==="string"&&t!==""?t:null}var Ui=(()=>{class n{constructor(s){if(gs.add(this),kr.set(this,void 0),s.unrestrictedPaths!==void 0)throw new u("The `unrestrictedPaths` option you passed to EnvironmentWorker (or client.beta.environments.work.worker()) is no longer supported. The worker's file tools (read, write, edit, glob, grep) are now always confined to `workdir` plus the session's memory folders. Remove `unrestrictedPaths` from your options; to let the file tools reach any other directory, add it to `AgentToolContext.allowedRoots` from a `tools` factory.");if(this.client=s.client,this.environmentId=s.environmentId,this.environmentKey=s.environmentKey,this.tools=s.tools,this.workdir=s.workdir??process.cwd(),this.maxFileBytes=s.maxFileBytes,this.maxIdleMs=s.maxIdleMs,s.memorySyncIntervalMs!=null)Un(s.memorySyncIntervalMs,"memorySyncIntervalMs");this.memorySyncIntervalMs=s.memorySyncIntervalMs,this.memorySyncDeletions=s.memorySyncDeletions??"enabled",this.workerId=s.workerId,this.requestOptions=s.requestOptions,o(this,kr,s.signal,"f")}async run(s){let{environmentId:t,environmentKey:i}=this;if(t===void 0||i===void 0)throw new u("EnvironmentWorker.run: environmentId and environmentKey are required to poll for work");let c=s??e(this,kr,"f"),l=new _r({client:this.client,environmentId:t,environmentKey:i,...this.workerId!==void 0?{workerId:this.workerId}:{},...c?{signal:c}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},autoStop:!1});for await(let d of l)try{await e(this,gs,"m",Wi).call(this,d,i,l.signal)}catch(h){if(l.signal?.aborted)throw h;L(this.client).error("work item failed",{work_id:d.id,error:String(h)})}}async handleItem(s){let t=s?.workId??N("ANTHROPIC_WORK_ID"),i=s?.environmentId??N("ANTHROPIC_ENVIRONMENT_ID"),c=s?.sessionId??N("ANTHROPIC_SESSION_ID"),l=(s?.environmentKey??this.environmentKey??N("ANTHROPIC_ENVIRONMENT_KEY"))||void 0,d=s?.workSecret||N("ANTHROPIC_WORK_SECRET")||null;if(!t)throw new u("handleItem: workId is required \u2014 pass it or set ANTHROPIC_WORK_ID");if(!i)throw new u("handleItem: environmentId is required \u2014 pass it or set ANTHROPIC_ENVIRONMENT_ID");if(!c)throw new u("handleItem: sessionId is required \u2014 pass it or set ANTHROPIC_SESSION_ID");if(!l&&!d)throw new u("handleItem: environmentKey is required when there is no work secret \u2014 pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY");let h={id:t,environment_id:i,secret:d,data:{type:"session",id:c}};await e(this,gs,"m",Wi).call(this,h,l,s?.signal??e(this,kr,"f"))}}return kr=new WeakMap,gs=new WeakSet,Wi=async function(t,i,c){let l=L(this.client),d=Kl(t.secret),h=d??i;if(h===void 0)throw new u("handleItem: the work item carried a secret payload but no sessions token could be extracted, and there is no environment key to fall back to; the poller must issue a secret whose payload carries `sessions_token`, or provide the environment key (pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY)");if(t.secret&&d===null)l.warn("work item carried a secret payload but no sessions token could be extracted; falling back to the environment key",{work_id:t.id});let f=ns(this.client,{authToken:h,helper:"environments-worker"}),g=t.data.id,v=new AbortController,_=Ge(c,v),k=new Jl(v),y=await import("./chunk-m45dpnd1.js"),x,P,S=Yl(f,t,k,l,this.requestOptions,(C)=>{x=C,P?._setSendRetryWindow(C)}).catch((C)=>{if(!v.signal.aborted)l.error("heartbeat loop failed",{work_id:t.id,error:String(C)});v.abort()}),E=async()=>{},b,M=!1;try{if(t.data.type!=="session"){l.debug("skipping non-session work item",{work_id:t.id,type:t.data.type});return}let C=await f.beta.sessions.retrieve(g);if(d===null&&this.memorySyncIntervalMs!==null&&zl(C))throw new y.SessionMemoryError(`cannot mount the session's memories: the work item carried no sessions token (work_id=${t.id}, session_id=${g}); the memory endpoints reject the environment key, so the poller must issue a per-item \`secret\` carrying \`sessions_token\`, or set \`memorySyncIntervalMs: null\` to run without memory`);let O={workdir:this.workdir,client:f,session:C,...this.maxFileBytes!==void 0?{maxFileBytes:this.maxFileBytes}:{}};try{E=await y.setupSkills(O)}catch(F){l.warn("skill setup failed",{session_id:g,work_id:t.id,error:String(F)})}if(d!==null&&this.memorySyncIntervalMs!==null)b=new y.SessionMemoryStores(f,{workdir:this.workdir,...this.memorySyncIntervalMs!==void 0?{syncIntervalMs:this.memorySyncIntervalMs}:{},syncDeletions:this.memorySyncDeletions}),await b.download(C),O.allowedRoots=b.roots,O.readOnlyRoots=b.readOnlyRoots;else l.debug("memory stores disabled for this item",{work_id:t.id});let V=typeof this.tools==="function"?this.tools(O):this.tools??y.betaAgentToolset20260401(O);if(P=new br(g,{client:f,tools:V,...this.maxIdleMs!==void 0?{maxIdleMs:this.maxIdleMs}:{},...this.requestOptions!==void 0?{requestOptions:this.requestOptions}:{},signal:v.signal}),x!==void 0)P._setSendRetryWindow(x);for await(let F of P)if(b)await b.syncIfDue();M=!v.signal.aborted}finally{try{await E().catch((C)=>{l.warn("skill cleanup failed",{session_id:g,work_id:t.id,error:String(C)})})}finally{if(b){let C=y.MEMORY_FLUSH_TIMEOUT_MS;if(M){if(await Qa(b.finish(),C))l.warn(`final memory sync cut off after ${C}ms; the flush that follows still uploads changed files`,{session_id:g,work_id:t.id})}let O=new AbortController;if(await Qa(b.flushWrites(O.signal),C))O.abort(),l.warn(`memory flush cut off after ${C}ms; changed files it had not uploaded yet are not saved`,{session_id:g,work_id:t.id});await b.dispose().catch((F)=>{l.warn("memory store cleanup failed",{session_id:g,work_id:t.id,error:String(F)})})}}if(k.finish("runner_done"),_(),await S,k.lost)l.info("lease lost; released without stopping it",{session_id:g,work_id:t.id});else await Vl(f,t,l,this.requestOptions)}},n})();async function Qa(n,s){let t;try{return await Promise.race([n.then(()=>!1,()=>!1),new Promise((i)=>{t=setTimeout(()=>i(!0),s)})])}finally{if(t!==void 0)clearTimeout(t)}}async function Vl(n,s,t,i){try{await n.beta.environments.work.stop(s.id,{environment_id:s.environment_id,force:!0},{...i,headers:p([i?.headers])})}catch(c){if(!be(c,409))t.error("force-stop on exit failed",{work_id:s.id,error:String(c)})}}var Jl=(()=>{class n{constructor(s){Sr.set(this,void 0),Mt.set(this,void 0),o(this,Sr,s,"f")}get signal(){return e(this,Sr,"f").signal}finish(s){o(this,Mt,e(this,Mt,"f")??s,"f"),e(this,Sr,"f").abort()}get lost(){return e(this,Mt,"f")==="lease_lost"||e(this,Mt,"f")==="assumed_lost"}}return Sr=new WeakMap,Mt=new WeakMap,n})();function Gl(n){let s=n instanceof K?n.error:void 0;for(let t of["error","details","current_state"]){if(!di(s))return{};s=s[t]}return di(s)?s:{}}async function Yl(n,s,t,i,c,l){let d=Xa,h=jl,f=Date.now(),g=ql,v=async()=>{let _=new AbortController,k=Ge(t.signal,_),y=setTimeout(()=>_.abort(),d);try{let x=await n.beta.environments.work.heartbeat(s.id,{environment_id:s.environment_id,expected_last_heartbeat:g},{...c,headers:p([c?.headers]),signal:_.signal});if(f=Date.now(),g=x.last_heartbeat,x.ttl_seconds>0)h=x.ttl_seconds*1000,d=Math.max(1000,Math.min(h/2,Xa)),l?.(h);if(x.state==="stopping"||x.state==="stopped")i.info("heartbeat signals shutdown",{work_id:s.id,state:x.state}),t.finish("control_plane_stop");if(!x.lease_extended)i.warn("lease not extended, shutting down",{work_id:s.id}),t.finish("control_plane_stop")}catch(x){if(t.signal.throwIfAborted(),be(x,412)){let P=Gl(x);i.error("lease lost: heartbeat precondition failed",{work_id:s.id,server_state:P.state,server_ttl_seconds:P.ttl_seconds,server_last_heartbeat:P.last_heartbeat}),t.finish("lease_lost");return}if(at(x))throw i.error("permanent heartbeat failure",{work_id:s.id,error:String(x)}),t.finish("heartbeat_rejected"),x;if(Date.now()-f>h){i.error("lease assumed lost: no successful heartbeat in ttl",{work_id:s.id,ttl_ms:h,error:String(x)}),t.finish("assumed_lost");return}i.warn("transient heartbeat failure",{work_id:s.id,error:String(x)})}finally{clearTimeout(y),k()}};await v();while(!t.signal.aborted)await Ce(d,t.signal),t.signal.throwIfAborted(),await v()}var ws=(()=>{class n extends R{retrieve(s,t,i){let{environment_id:c,betas:l,workspace_id:d}=t;return this._client.get(m`/v1/environments/${c}/work/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},i?.headers])})}update(s,t,i){let{environment_id:c,betas:l,workspace_id:d,...h}=t;return this._client.post(m`/v1/environments/${c}/work/${s}?beta=true`,{body:h,...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},i?.headers])})}list(s,t={},i){let{betas:c,...l}=t??{};return this._client.getAPIList(m`/v1/environments/${s}/work?beta=true`,T,{query:l,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}ack(s,t,i){let{environment_id:c,betas:l}=t;return this._client.post(m`/v1/environments/${c}/work/${s}/ack?beta=true`,{...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}heartbeat(s,t,i){let{environment_id:c,desired_ttl_seconds:l,expected_last_heartbeat:d,betas:h}=t;return this._client.post(m`/v1/environments/${c}/work/${s}/heartbeat?beta=true`,{query:{desired_ttl_seconds:l,expected_last_heartbeat:d},...i,headers:p([{"anthropic-beta":[...h??[],"managed-agents-2026-04-01"].toString()},i?.headers])})}poll(s,t={},i){let{betas:c,"Anthropic-Worker-ID":l,...d}=t??{};return this._client.get(m`/v1/environments/${s}/work/poll?beta=true`,{query:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"Anthropic-Worker-ID":l}:void 0},i?.headers])})}stats(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/environments/${s}/work/stats?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}stop(s,t,i){let{environment_id:c,betas:l,workspace_id:d,...h}=t;return this._client.post(m`/v1/environments/${c}/work/${s}/stop?beta=true`,{body:h,...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},i?.headers])})}poller(s){return new _r({...s,client:this._client})}worker(s){return new Ui({...s,client:this._client})}}return n.WorkPoller=_r,n.EnvironmentWorker=Ui,n})();var ys=(()=>{class n extends R{constructor(){super(...arguments);this.work=new ws(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/environments?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/environments/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/environments/${s}?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/environments?beta=true",T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/environments/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/environments/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Work=ws,n})();class xr extends R{create(n,s,t){let{view:i,betas:c,workspace_id:l,...d}=s;return this._client.post(m`/v1/memory_stores/${n}/memories?beta=true`,{query:{view:i},body:d,...t,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}retrieve(n,s,t){let{memory_store_id:i,betas:c,workspace_id:l,...d}=s;return this._client.get(m`/v1/memory_stores/${i}/memories/${n}?beta=true`,{query:d,...t,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(n,s,t){let{memory_store_id:i,view:c,betas:l,workspace_id:d,...h}=s;return this._client.post(m`/v1/memory_stores/${i}/memories/${n}?beta=true`,{query:{view:c},body:h,...t,headers:p([{"anthropic-beta":[...l??[],"agent-memory-2026-07-22"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/memory_stores/${n}/memories?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,s,t){let{memory_store_id:i,expected_content_sha256:c,betas:l,workspace_id:d}=s;return this._client.delete(m`/v1/memory_stores/${i}/memories/${n}?beta=true`,{query:{expected_content_sha256:c},...t,headers:p([{"anthropic-beta":[...l??[],"agent-memory-2026-07-22"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},t?.headers])})}}class vr extends R{retrieve(n,s,t){let{memory_store_id:i,betas:c,workspace_id:l,...d}=s;return this._client.get(m`/v1/memory_stores/${i}/memory_versions/${n}?beta=true`,{query:d,...t,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/memory_stores/${n}/memory_versions?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}redact(n,s,t){let{memory_store_id:i,betas:c,workspace_id:l}=s;return this._client.post(m`/v1/memory_stores/${i}/memory_versions/${n}/redact?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var bs=(()=>{class n extends R{constructor(){super(...arguments);this.memories=new xr(this._client),this.memoryVersions=new vr(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/memory_stores?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/memory_stores/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/memory_stores/${s}?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/memory_stores?beta=true",T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/memory_stores/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/memory_stores/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"agent-memory-2026-07-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Memories=xr,n.MemoryVersions=vr,n})();var ks=(()=>{class n{constructor(s,t){this.iterator=s,this.controller=t}async*decoder(){let s=new Vt;for await(let t of this.iterator)for(let i of s.decode(t))yield JSON.parse(i);for(let t of s.flush())yield JSON.parse(t)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse(s,t){if(!s.body){if(t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new u("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new u("Attempted to iterate over a response with no body")}return new n(zt(s.body),t)}}return n})();class Rr extends R{create(n,s){let{betas:t,user_profile_id:i,workspace_id:c,...l}=n;return this._client.post("/v1/messages/batches?beta=true",{body:l,...s,headers:p([{"anthropic-beta":[...t??[],"message-batches-2024-09-24"].toString(),...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},s?.headers])})}retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/messages/batches/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/messages/batches?beta=true",re,{query:c,...s,headers:p([{"anthropic-beta":[...t??[],"message-batches-2024-09-24"].toString(),...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}delete(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.delete(m`/v1/messages/batches/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}cancel(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.post(m`/v1/messages/batches/${n}/cancel?beta=true`,{...t,headers:p([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}async results(n,s={},t){let i=await this.retrieve(n,s,t);if(!i.results_url)throw new u(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{betas:c,workspace_id:l}=s??{};return this._client.get(i.results_url,{...t,headers:p([{"anthropic-beta":[...c??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((d,h)=>ks.fromResponse(h.response,h.controller))}}var Ss={"claude-opus-4@20250514":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};function Za(n){return n?.output_format??n?.output_config?.format}function ji(n,s,t){let i=Za(s);if(!s||!("parse"in(i??{})))return{...n,content:n.content.map((c)=>{if(c.type==="text"){let l=Object.defineProperty({...c},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(l,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return c}),parsed_output:null};return qi(n,s,t)}function qi(n,s,t){let i=null,c=n.content.map((l)=>{if(l.type==="text"){let d=nu(s,l.text);if(i===null)i=d;let h=Object.defineProperty({...l},"parsed_output",{value:d,enumerable:!1});return Object.defineProperty(h,"parsed",{get(){return t.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),d},enumerable:!1})}return l});return{...n,content:c,parsed_output:i}}function nu(n,s){let t=Za(n);if(t?.type!=="json_schema")return null;try{if("parse"in t)return t.parse(s);return JSON.parse(s)}catch(i){throw new u(`Failed to parse structured output: ${i}`)}}var su=(n)=>{let s=0,t=[];while(s<n.length){let i=n[s];if(i==="\\"){s++;continue}if(i==="{"){t.push({type:"brace",value:"{"}),s++;continue}if(i==="}"){t.push({type:"brace",value:"}"}),s++;continue}if(i==="["){t.push({type:"paren",value:"["}),s++;continue}if(i==="]"){t.push({type:"paren",value:"]"}),s++;continue}if(i===":"){t.push({type:"separator",value:":"}),s++;continue}if(i===","){t.push({type:"delimiter",value:","}),s++;continue}if(i==='"'){let h=s+1,f=h,g=!1;while(!0){if(f=n.indexOf('"',f),f===-1){g=!0;break}let v=0,_=f-1;while(_>=h&&n[_]==="\\")v++,_--;if(v%2===0)break;f++}if(g)s=n.length;else t.push({type:"string",value:n.slice(h,f)}),s=f+1;continue}if(i&&/\s/.test(i)){s++;continue}let l=/[0-9]/;if(i&&l.test(i)||i==="-"||i==="."){let h="";if(i==="-")h+=i,i=n[++s];while(i&&(l.test(i)||i==="."||i==="e"||i==="E"||(i==="-"||i==="+")&&(h[h.length-1]==="e"||h[h.length-1]==="E")))h+=i,i=n[++s];t.push({type:"number",value:h,unterminated:s===n.length});continue}let d=/[a-z]/i;if(i&&d.test(i)){let h="";while(i&&d.test(i)){if(s===n.length)break;h+=i,i=n[++s]}if(h=="true"||h=="false"||h==="null")t.push({type:"name",value:h});else{s++;continue}continue}s++}return t},iu=(n)=>{let s=[];for(let l of n)if(l.type==="brace"||l.type==="paren")if(l.value==="{"||l.value==="[")s.push(l.value);else s.pop();let t=s[s.length-1],i=n.length,c=/^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][-+]?[0-9]+)?$/;while(i>0){let l=n[i-1];switch(l.type){case"separator":i--;continue;case"number":if(l.unterminated||!c.test(l.value)){i--;continue}break;case"string":let d=n[i-2];if(t==="{"&&(d?.type==="delimiter"||d?.type==="brace"&&d.value==="{")){i--;continue}break;case"delimiter":i--;break}break}return n.slice(0,i)},ou=(n)=>{let s=[];if(n.map((t)=>{if(t.type==="brace")if(t.value==="{")s.push("}");else s.splice(s.lastIndexOf("}"),1);if(t.type==="paren")if(t.value==="[")s.push("]");else s.splice(s.lastIndexOf("]"),1)}),s.length>0)s.reverse().map((t)=>{if(t==="}")n.push({type:"brace",value:"}"});else if(t==="]")n.push({type:"paren",value:"]"})});return n},au=(n)=>{let s="";return n.map((t)=>{switch(t.type){case"string":s+='"'+t.value+'"';break;default:s+=t.value;break}}),s},ec=(n)=>JSON.parse(au(ou(iu(su(n)))));var Qe="__json_buf";function xs(n,s){let t={};for(let l of Object.keys(n))if(l!=="input")t[l]=n[l];Object.defineProperty(t,Qe,{value:s,enumerable:!1,writable:!0});let i,c=!1;return Object.defineProperty(t,"input",{enumerable:!0,configurable:!0,get(){if(!c)i=s?ec(s):{},c=!0;return i}}),t}var ue,Ze,Ct,Er,vs,Ar,Tr,Rs,Ir,De,Pr,Es,As,lt,Ts,Is,Ps,Mr,zi,tc,Cr,Ki,Vi,Ji,rc,Gi;function Yi(n){return n.type==="tool_use"||n.type==="server_tool_use"||n.type==="mcp_tool_use"}var Ms=(()=>{class n{constructor(s,t){ue.add(this),this.messages=[],this.receivedMessages=[],Ze.set(this,void 0),Ct.set(this,null),this.controller=new AbortController,Er.set(this,void 0),vs.set(this,()=>{}),Ar.set(this,()=>{}),Tr.set(this,void 0),Rs.set(this,()=>{}),Ir.set(this,()=>{}),De.set(this,{}),Pr.set(this,!1),Es.set(this,!1),As.set(this,!1),lt.set(this,!1),Ts.set(this,void 0),Is.set(this,void 0),Ps.set(this,void 0),Mr.set(this,void 0),Cr.set(this,(i)=>{if(o(this,Es,!0,"f"),Me(i))i=new oe;if(i instanceof oe)return o(this,As,!0,"f"),this._emit("abort",i);if(i instanceof u)return this._emit("error",i);if(i instanceof Error){let c=new u(i.message);return c.cause=i,this._emit("error",c)}return this._emit("error",new u(String(i)))}),o(this,Er,new Promise((i,c)=>{o(this,vs,i,"f"),o(this,Ar,c,"f")}),"f"),o(this,Tr,new Promise((i,c)=>{o(this,Rs,i,"f"),o(this,Ir,c,"f")}),"f"),e(this,Er,"f").catch(()=>{}),e(this,Tr,"f").catch(()=>{}),o(this,Ct,s,"f"),o(this,Mr,t?.logger??console,"f")}get response(){return e(this,Ts,"f")}get request_id(){return e(this,Is,"f")}get workspace_id(){return e(this,Ps,"f")}async withResponse(){o(this,lt,!0,"f");let s=await e(this,Er,"f");if(!s)throw Error("Could not resolve a `Response` object");return{data:this,response:s,request_id:s.headers.get("request-id"),workspace_id:s.headers.get("anthropic-workspace-id")}}static fromReadableStream(s){let t=new n(null);return t._run(()=>t._fromReadableStream(s)),t}static createMessage(s,t,i,{logger:c}={}){let l=new n(t,{logger:c});for(let d of t.messages)l._addMessageParam(d);return o(l,Ct,{...t,stream:!0},"f"),l._run(()=>l._createMessage(s,{...t,stream:!0},{...i,headers:{...i?.headers,[wt]:"stream"}})),l}_run(s){s().then(()=>{this._emitFinal(),this._emit("end")},e(this,Cr,"f"))}_addMessageParam(s){this.messages.push(s)}_addMessage(s,t=!0){if(this.receivedMessages.push(s),t)this._emit("message",s)}async _createMessage(s,t,i){let c=i?.signal,l;if(c){if(c.aborted)this.controller.abort();l=this.controller.abort.bind(this.controller),c.addEventListener("abort",l)}try{e(this,ue,"m",Ki).call(this);let{response:d,data:h}=await s.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(d);for await(let f of h)e(this,ue,"m",Vi).call(this,f);if(h.controller.signal?.aborted)throw new oe;e(this,ue,"m",Ji).call(this)}finally{if(c&&l)c.removeEventListener("abort",l)}}_connected(s){if(this.ended)return;o(this,Ts,s,"f"),o(this,Is,s?.headers.get("request-id"),"f"),o(this,Ps,s?.headers.get("anthropic-workspace-id"),"f"),e(this,vs,"f").call(this,s),this._emit("connect")}get ended(){return e(this,Pr,"f")}get errored(){return e(this,Es,"f")}get aborted(){return e(this,As,"f")}abort(){this.controller.abort()}on(s,t){return(e(this,De,"f")[s]||(e(this,De,"f")[s]=[])).push({listener:t}),this}off(s,t){let i=e(this,De,"f")[s];if(!i)return this;let c=i.findIndex((l)=>l.listener===t);if(c>=0)i.splice(c,1);return this}once(s,t){return(e(this,De,"f")[s]||(e(this,De,"f")[s]=[])).push({listener:t,once:!0}),this}emitted(s){return new Promise((t,i)=>{if(o(this,lt,!0,"f"),s!=="error")this.once("error",i);this.once(s,t)})}async done(){o(this,lt,!0,"f"),await e(this,Tr,"f")}get currentMessage(){return e(this,Ze,"f")}async finalMessage(){return await this.done(),e(this,ue,"m",zi).call(this)}async finalText(){return await this.done(),e(this,ue,"m",tc).call(this)}_emit(s,...t){if(e(this,Pr,"f"))return;if(s==="end")o(this,Pr,!0,"f"),e(this,Rs,"f").call(this);let i=e(this,De,"f")[s];if(i)e(this,De,"f")[s]=i.filter((c)=>!c.once),i.forEach(({listener:c})=>c(...t));if(s==="abort"){let c=t[0];if(!e(this,lt,"f")&&!i?.length)Promise.reject(c);e(this,Ar,"f").call(this,c),e(this,Ir,"f").call(this,c),this._emit("end");return}if(s==="error"){let c=t[0];if(!e(this,lt,"f")&&!i?.length)Promise.reject(c);e(this,Ar,"f").call(this,c),e(this,Ir,"f").call(this,c),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",e(this,ue,"m",zi).call(this))}async _fromReadableStream(s,t){let i=t?.signal,c;if(i){if(i.aborted)this.controller.abort();c=this.controller.abort.bind(this.controller),i.addEventListener("abort",c)}try{e(this,ue,"m",Ki).call(this),this._connected(null);let l=He.fromReadableStream(s,this.controller);for await(let d of l)e(this,ue,"m",Vi).call(this,d);if(l.controller.signal?.aborted)throw new oe;e(this,ue,"m",Ji).call(this)}finally{if(i&&c)i.removeEventListener("abort",c)}}[(Ze=new WeakMap,Ct=new WeakMap,Er=new WeakMap,vs=new WeakMap,Ar=new WeakMap,Tr=new WeakMap,Rs=new WeakMap,Ir=new WeakMap,De=new WeakMap,Pr=new WeakMap,Es=new WeakMap,As=new WeakMap,lt=new WeakMap,Ts=new WeakMap,Is=new WeakMap,Ps=new WeakMap,Mr=new WeakMap,Cr=new WeakMap,ue=new WeakSet,zi=function(){if(this.receivedMessages.length===0)throw new u("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},tc=function(){if(this.receivedMessages.length===0)throw new u("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((i)=>i.type==="text").map((i)=>i.text);if(t.length===0)throw new u("stream ended without producing a content block with type=text");return t.join(" ")},Ki=function(){if(this.ended)return;o(this,Ze,void 0,"f")},Vi=function(t){if(this.ended)return;let i=e(this,ue,"m",rc).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let c=i.content.at(-1);switch(t.delta.type){case"text_delta":{if(c.type==="text")this._emit("text",t.delta.text,c.text||"");break}case"citations_delta":{if(c.type==="text")this._emit("citation",t.delta.citation,c.citations??[]);break}case"input_json_delta":{if(Yi(c)&&e(this,De,"f").inputJson?.length){let l;try{l=c.input}catch(d){e(this,Cr,"f").call(this,e(this,ue,"m",Gi).call(this,c,d));break}this._emit("inputJson",t.delta.partial_json,l)}break}case"thinking_delta":{if(c.type==="thinking")this._emit("thinking",t.delta.thinking,c.thinking);break}case"signature_delta":{if(c.type==="thinking")this._emit("signature",c.signature);break}case"compaction_delta":{if(c.type==="compaction"&&c.content)this._emit("compaction",c.content);break}default:Ve(t.delta)}break}case"message_stop":{this._addMessageParam(i),this._addMessage(ji(i,e(this,Ct,"f"),{logger:e(this,Mr,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{o(this,Ze,i,"f");break}case"content_block_start":case"message_delta":break}},Ji=function(){if(this.ended)throw new u("stream has ended, this shouldn't happen");let t=e(this,Ze,"f");if(!t)throw new u("request ended without sending any chunks");return o(this,Ze,void 0,"f"),ji(t,e(this,Ct,"f"),{logger:e(this,Mr,"f")})},rc=function(t){let i=e(this,Ze,"f");if(t.type==="message_start"){if(i)throw new u(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new u(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":if(i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.stop_details=t.delta.stop_details,i.usage.output_tokens=t.usage.output_tokens,t.delta.container!=null)i.container=t.delta.container;if(t.context_management!=null)i.context_management=t.context_management;if(t.input_transformations!=null)i.input_transformations=t.input_transformations;if(t.usage.input_tokens!=null)i.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)i.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.iterations!=null)i.usage.iterations=t.usage.iterations;if(t.usage.fallback_credit!=null)i.usage.fallback_credit=t.usage.fallback_credit;if(t.usage.output_tokens_details!=null)i.usage.output_tokens_details=t.usage.output_tokens_details;return i;case"content_block_start":if(i.content.push(t.content_block),t.content_block.type==="fallback")i.model=t.content_block.to.model;return i;case"content_block_delta":{let c=i.content.at(t.index);switch(t.delta.type){case"text_delta":{if(c?.type==="text")i.content[t.index]={...c,text:(c.text||"")+t.delta.text};break}case"citations_delta":{if(c?.type==="text")i.content[t.index]={...c,citations:[...c.citations??[],t.delta.citation]};break}case"input_json_delta":{if(c&&Yi(c)){let l=(c[Qe]||"")+t.delta.partial_json;i.content[t.index]=xs(c,l)}break}case"thinking_delta":{if(c?.type==="thinking")i.content[t.index]={...c,thinking:c.thinking+t.delta.thinking};break}case"signature_delta":{if(c?.type==="thinking")i.content[t.index]={...c,signature:t.delta.signature};break}case"compaction_delta":{if(c?.type==="compaction"){let l={...c,content:t.delta.content};if("encrypted_content"in t.delta)l.encrypted_content=t.delta.encrypted_content;i.content[t.index]=l}break}default:Ve(t.delta)}return i}case"content_block_stop":{let c=i.content.at(t.index);if(c&&Yi(c)&&Qe in c){let l;try{l=c.input}catch(d){l={},e(this,Cr,"f").call(this,e(this,ue,"m",Gi).call(this,c,d))}Object.defineProperty(c,"input",{value:l,enumerable:!0,configurable:!0,writable:!0})}return i}}},Gi=function(t,i){let c=t[Qe];return new u(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${i}. JSON: ${c}`)},Symbol.asyncIterator)](){let s=[],t=[],i=!1;return this.on("streamEvent",(c)=>{let l=t.shift();if(l)l.resolve(c);else s.push(c)}),this.on("end",()=>{i=!0;for(let c of t)c.resolve(void 0);t.length=0}),this.on("abort",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),this.on("error",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),{next:async()=>{if(!s.length){if(i)return{value:void 0,done:!0};return new Promise((l,d)=>t.push({resolve:l,reject:d})).then((l)=>l?{value:l,done:!1}:{value:void 0,done:!0})}return{value:s.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new He(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}return n})();var ze,Cs,ut,Ot,Os,dt,Nt,Ns,nc,$s,Ls,Xi=(()=>{class n extends Ms{constructor(s,t){super(s);ze.add(this),Cs.set(this,void 0),ut.set(this,0),Ot.set(this,[]),Os.set(this,[]),dt.set(this,void 0),Nt.set(this,[]),Ns.set(this,!1),o(this,Cs,t,"f")}get toolCalls(){return e(this,Os,"f")}static start(s,t,i,c){let l=new n({...t,stream:!0},c);for(let d of t.messages)l._addMessageParam(d);return l._run(()=>l._createMessage(s,{...t,stream:!0},{...i,headers:{...i?.headers,[wt]:"stream"}})),l}_emit(s,...t){var i;if(s!=="streamEvent"||this.ended){super._emit(s,...t);return}o(this,ut,(i=e(this,ut,"f"),i++,i),"f");let[c,l]=t,d=c.type==="content_block_stop"?l.content[c.index]:void 0,h=d?.type==="tool_use"?d:void 0;if(h)e(this,Os,"f").push(h);super._emit(s,...t),e(this,ze,"m",nc).call(this,c,h),e(this,ze,"m",$s).call(this)}[(Cs=new WeakMap,ut=new WeakMap,Ot=new WeakMap,Os=new WeakMap,dt=new WeakMap,Nt=new WeakMap,Ns=new WeakMap,ze=new WeakSet,Symbol.asyncIterator)](){let s=super[Symbol.asyncIterator](),t={handled:e(this,ut,"f")};e(this,Ot,"f").push(t);let i=!1;return{next:async()=>{if(i)i=!1,t.handled++,e(this,ze,"m",$s).call(this);try{let c=await s.next();if(i=!c.done,c.done)e(this,ze,"m",Ls).call(this,t);return c}catch(c){throw e(this,ze,"m",Ls).call(this,t),c}},return:async()=>{let c=s.return?.();return e(this,ze,"m",Ls).call(this,t),await c??{value:void 0,done:!0}}}}}return nc=function(t,i){if(e(this,Ns,"f"))return;if(t.type==="content_block_start"&&t.content_block.type==="fallback"){o(this,Ns,!0,"f"),o(this,dt,void 0,"f");return}let c=t.type==="content_block_start"||t.type==="message_delta"&&t.delta.stop_reason==="tool_use";if(e(this,dt,"f")&&c)e(this,Nt,"f").push({toolUse:e(this,dt,"f"),event:e(this,ut,"f")}),o(this,dt,void 0,"f");if(i)o(this,dt,i,"f")},$s=function(){if(this.errored||this.controller.signal.aborted)return;let t=Math.min(e(this,ut,"f"),...e(this,Ot,"f").map((i)=>i.handled));while(e(this,Nt,"f")[0]&&e(this,Nt,"f")[0].event<=t)e(this,Cs,"f").call(this,e(this,Nt,"f").shift().toolUse)},Ls=function(t){let i=e(this,Ot,"f").indexOf(t);if(i>=0)e(this,Ot,"f").splice(i,1),e(this,ze,"m",$s).call(this)},n})();function ar(){let n,s;return{promise:new Promise((i,c)=>{n=i,s=c}),resolve:n,reject:s}}var q,$t,ht,j,de,me,et,Be,tt,Or,xe,We,Lt,Ht,ft,Qi,sc,Zi,eo,Nr,Fs,ic,to,ro,oc,no,io=(()=>{class n{constructor(s,t,i){q.add(this),this.client=s,$t.set(this,!1),ht.set(this,!1),j.set(this,void 0),de.set(this,void 0),me.set(this,void 0),et.set(this,void 0),Be.set(this,void 0),tt.set(this,void 0),Or.set(this,0),xe.set(this,{status:"idle"}),We.set(this,void 0),Lt.set(this,null),Ht.set(this,new Map),ft.set(this,[]),ac(t),cu(t),cc(t),o(this,j,{params:{...t,messages:JSON.parse(JSON.stringify(t.messages))}},"f");let c=$i(t.tools,t.messages);o(this,de,{...i,headers:p([Gn("BetaToolRunner"),c.length?{[Jn]:c.join(", ")}:void 0,i?.headers])},"f"),o(this,tt,ar(),"f")}async*[($t=new WeakMap,ht=new WeakMap,j=new WeakMap,de=new WeakMap,me=new WeakMap,et=new WeakMap,Be=new WeakMap,tt=new WeakMap,Or=new WeakMap,xe=new WeakMap,We=new WeakMap,Lt=new WeakMap,Ht=new WeakMap,ft=new WeakMap,q=new WeakSet,Symbol.asyncIterator)](){var s;if(e(this,$t,"f"))throw new u("Cannot iterate over a consumed stream");o(this,$t,!0,"f"),o(this,ht,!0,"f"),o(this,Be,void 0,"f");try{while(!0)try{if(e(this,j,"f").params.max_iterations&&e(this,Or,"f")>=e(this,j,"f").params.max_iterations)break;if(e(this,q,"m",oc).call(this),e(this,xe,"f").status==="scheduled"&&uc(e(this,Lt,"f"))!=="resume"){yield*e(this,q,"m",eo).call(this,e(this,xe,"f").config);continue}o(this,ht,!1,"f"),o(this,Be,void 0,"f"),o(this,Or,(s=e(this,Or,"f"),s++,s),"f"),o(this,me,void 0,"f");let{max_iterations:t,runToolsEagerly:i,...c}=e(this,j,"f").params;if(yield*e(this,q,"m",Qi).call(this,c),!e(this,ht,"f")){let d=await e(this,me,"f"),h=uc(d.stop_reason);o(this,Lt,d.stop_reason,"f"),e(this,j,"f").params.messages.push({role:d.role,content:du(d.content)});let{container:f}=e(this,j,"f").params;if(d.container){if(f==null)e(this,j,"f").params.container=d.container.id;else if(typeof f==="object"&&f.id==null)e(this,j,"f").params.container={...f,id:d.container.id}}if(h==="stop"){yield*e(this,q,"m",to).call(this);break}if(h==="resume")continue}else o(this,Lt,null,"f");let l=await e(this,q,"m",ro).call(this,e(this,j,"f").params.messages.at(-1));if(l)e(this,j,"f").params.messages.push(l);else if(!e(this,ht,"f")){yield*e(this,q,"m",to).call(this);break}}finally{e(this,et,"f")?.abort(),o(this,et,void 0,"f")}if(await e(this,q,"m",Zi).call(this),!e(this,me,"f"))throw new u("ToolRunner concluded without a message from the server");e(this,tt,"f").resolve(await e(this,me,"f"))}catch(t){throw o(this,$t,!1,"f"),e(this,tt,"f").promise.catch(()=>{}),e(this,tt,"f").reject(t),o(this,tt,ar(),"f"),t}}setMessagesParams(s){let t=typeof s==="function"?s(e(this,j,"f").params):s;if(ac(t),cc(t),e(this,xe,"f").status!=="idle")so(t);if(e(this,xe,"f").status==="in_flight"&&t.messages!==e(this,j,"f").params.messages)throw new u("Message params can't be changed while the conversation is being compacted, because the compaction response is about to replace them. Change them after this iteration instead.");e(this,j,"f").params=t,o(this,ht,!0,"f"),o(this,Be,void 0,"f")}setRequestOptions(s){if(typeof s==="function")o(this,de,s(e(this,de,"f")),"f");else o(this,de,{...e(this,de,"f"),...s},"f")}async generateToolResponse(s=e(this,de,"f").signal){let t=await e(this,me,"f")??this.params.messages.at(-1);if(!t)return null;return e(this,q,"m",ro).call(this,t,s)}deferToolCall(s){let t=typeof s==="string"?s:s.id;if(e(this,We,"f")&&!e(this,We,"f").has(t))e(this,We,"f").set(t,{status:"held"})}get deferredToolCalls(){let s=e(this,et,"f"),t=e(this,We,"f");if(!(s instanceof Xi)||!t)return[];return s.toolCalls.filter((i)=>t.get(i.id)?.status==="held")}done(){return e(this,tt,"f").promise}async runUntilDone(){if(!e(this,$t,"f"))for await(let s of this);return this.done()}get params(){return e(this,j,"f").params}pushMessages(...s){this.setMessagesParams((t)=>({...t,messages:[...t.messages,...s]}))}compactBeforeNextTurn(s){if(e(this,xe,"f").status==="in_flight")return;so(e(this,j,"f").params),o(this,xe,{status:"scheduled",config:s??{type:"summarize"}},"f")}addTools(...s){for(let t of s){if("name"in t)e(this,Ht,"f").set(t.name,"run"in t?t:null);e(this,ft,"f").push({type:"addition",tool:t})}}removeTools(...s){for(let t of s){let i=typeof t==="string"?t:t.name;e(this,Ht,"f").set(i,null),e(this,ft,"f").push({type:"removal",name:i})}}then(s,t){return this.runUntilDone().then(s,t)}}return Qi=async function*(t){if(await e(this,q,"m",Zi).call(this),o(this,We,void 0,"f"),t.stream)o(this,et,e(this,j,"f").params.runToolsEagerly?e(this,q,"m",sc).call(this,t):this.client.beta.messages.stream({...t},e(this,de,"f")),"f"),o(this,me,e(this,et,"f").finalMessage(),"f"),e(this,me,"f").catch(()=>{}),yield e(this,et,"f");else o(this,me,this.client.beta.messages.create({...t,stream:!1},e(this,de,"f")),"f"),yield e(this,me,"f")},sc=function(t){let i=new Map;return o(this,We,i,"f"),Xi.start(this.client.beta.messages,t,e(this,de,"f"),(c)=>{if(i.has(c.id))return;let l=dc(e(this,q,"m",Nr).call(this),e(this,q,"m",Fs).call(this),c,e(this,de,"f"));l.catch(()=>{}),i.set(c.id,{status:"started",result:l})})},Zi=async function(){let t=[...e(this,We,"f")?.values()??[]].filter((i)=>i.status==="started");await Promise.allSettled(t.map((i)=>i.result))},eo=async function*(t){so(e(this,j,"f").params);let{max_iterations:i,runToolsEagerly:c,...l}=e(this,j,"f").params,d=lu(l);o(this,xe,{status:"in_flight"},"f"),o(this,Be,void 0,"f");let h=e(this,me,"f");try{yield*e(this,q,"m",Qi).call(this,{...d,compaction:t});let f=await e(this,me,"f");if(f.content.some((g)=>g.type==="compaction"&&g.content))e(this,q,"m",ic).call(this),e(this,j,"f").params.messages=[{role:f.role,content:f.content}];else L(this.client).warn("Compaction produced no summary; keeping the conversation as it is."),o(this,me,h,"f")}finally{o(this,xe,{status:"idle"},"f")}},Nr=function(){let t=new Map;for(let i of e(this,j,"f").params.tools)if("run"in i)t.set(i.name,i);for(let[i,c]of e(this,Ht,"f"))if(c)t.set(i,c);else t.delete(i);return t},Fs=function(){let t=new Set(e(this,q,"m",Nr).call(this).keys());for(let i of[...e(this,j,"f").params.messages,e(this,q,"m",no).call(this)]){if(typeof i.content==="string")continue;for(let c of i.content)if(i.role==="system")lc(c,t);else if(i.role==="assistant"&&c.type==="compaction")for(let l of c.tool_changes??[])lc(l,t)}return t},ic=function(){let t=e(this,q,"m",Fs).call(this);for(let i of e(this,q,"m",Nr).call(this).keys())if(!t.has(i))e(this,Ht,"f").set(i,null)},to=async function*(){if(e(this,xe,"f").status!=="scheduled")return;let t=e(this,j,"f").params.messages.at(-1)?.content;if(Array.isArray(t)&&t.some((i)=>i.type==="tool_use")){L(this.client).warn("The pending compaction was skipped because the last turn ended with tool calls that were not run. Call `compactBeforeNextTurn()` again if you continue the conversation."),o(this,xe,{status:"idle"},"f");return}yield*e(this,q,"m",eo).call(this,e(this,xe,"f").config)},ro=async function(t,i=e(this,de,"f").signal){if(e(this,Be,"f")!==void 0)return e(this,Be,"f");return o(this,Be,uu(e(this,q,"m",Nr).call(this),e(this,q,"m",Fs).call(this),t,{...e(this,de,"f"),signal:i},e(this,We,"f")),"f"),e(this,Be,"f")},oc=function(){if(e(this,Lt,"f")==="pause_turn"||e(this,ft,"f").length===0)return;e(this,j,"f").params.messages.push(e(this,q,"m",no).call(this)),o(this,ft,[],"f")},no=function(){let t=[];for(let i of e(this,ft,"f")){if(i.type==="removal"){t.push({type:"tool_removal",tool:{type:"tool_reference",name:i.name}});continue}let c=i.tool;if("run"in i.tool){let{run:l,parse:d,close:h,...f}=i.tool;c=f}t.push({type:"tool_addition",tool:{type:"tool_definition",definition:c}})}return{role:"system",content:t}},n})();function ac(n){if("compaction"in n&&n.compaction!=null)throw new u("`compaction` cannot be set on a tool runner: every request in the loop would compact again. Call `runner.compactBeforeNextTurn()` when the conversation should be compacted instead.")}function cu(n){if("compactionControl"in n&&n.compactionControl!=null)throw new u("`compactionControl` has been removed from the tool runner. Use server-side compaction instead: call `runner.compactBeforeNextTurn()` when the conversation should be compacted.")}function cc(n){if(n.runToolsEagerly&&!n.stream)throw TypeError("`runToolsEagerly: true` needs `stream: true` in the tool runner's params, because a reply that isn't streamed arrives whole.")}function so(n){if(n.context_management?.edits?.some((s)=>s.type.startsWith("compact_")))throw new u("`compactBeforeNextTurn()` can't be used while `context_management` has a compaction edit, because the API doesn't accept a compaction block together with one. Remove the edit first.")}function lu(n){let{context_management:s,stop_sequences:t,output_format:i,...c}=n,l=({format:d,...h})=>h;if(c.tool_choice?.type==="any"||c.tool_choice?.type==="tool")delete c.tool_choice;if(c.output_config)c.output_config=l(c.output_config);if(Array.isArray(c.fallbacks))c.fallbacks=c.fallbacks.map((d)=>d.output_config?{...d,output_config:l(d.output_config)}:d);return c}async function uu(n,s,t,i,c){if(!t||t.role!=="assistant"||!t.content||typeof t.content==="string")return null;let l=t.content.filter((h)=>h.type==="tool_use");if(l.length===0)return null;return{role:"user",content:await Promise.all(l.map((h)=>{let f=c?.get(h.id);if(f?.status==="started")return f.result;let g=dc(n,s,h,i);return c?.set(h.id,{status:"started",result:g}),g}))}}async function dc(n,s,t,i){let c=s.has(t.name)?n.get(t.name):void 0;if(!c)return hu(t);try{let l=t.input;if("parse"in c&&c.parse)l=c.parse(l);let d=await c.run(l,{toolUse:t,toolUseBlock:t,signal:i?.signal});return{type:"tool_result",tool_use_id:t.id,content:d}}catch(l){return{type:"tool_result",tool_use_id:t.id,content:l instanceof I?l.content:`Error: ${l instanceof Error?l.message:String(l)}`,is_error:!0}}}function du(n){return n}function hu(n){return{type:"tool_result",tool_use_id:n.id,content:`Error: Tool '${n.name}' not found`,is_error:!0}}function lc(n,s){switch(n.type){case"tool_removal":case"tool_addition":fu(n,s);break}}function fu(n,s){let t=pu(n.tool);if(t===void 0)return;if(n.type==="tool_removal")s.delete(t);else s.add(t)}function pu(n){switch(n.type){case"tool_reference":return n.name;case"tool_definition":return"name"in n.definition?n.definition.name:void 0;default:return}}function uc(n){if(n===null)return"stop";switch(n){case"tool_use":return"run_tools";case"pause_turn":case"compaction":return"resume";case"end_turn":case"stop_sequence":case"max_tokens":case"model_context_window_exceeded":case"refusal":return"stop";default:return Ve(n),"stop"}}var hc={},mu=["claude-mythos-preview","claude-opus-4-6"],Hs=(()=>{class n extends R{constructor(){super(...arguments);this.batches=new Rr(this._client)}create(s,t){let i=fc(s),{betas:c,user_profile_id:l,workspace_id:d,...h}=i;if(h.model in hc)console.warn(`The model '${h.model}' is deprecated and will reach end-of-life on ${hc[h.model]}
11
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(mu.includes(h.model)&&h.thinking&&h.thinking.type==="enabled")console.warn(`Using Claude with ${h.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let f=t?.timeout??this._client._options.timeout;if(!h.stream&&f==null){let v=Ss[h.model]??void 0;f=this._client.calculateNonstreamingTimeout(h.max_tokens,v)}let g=Yn(h.tools,h.messages);return this._client.post("/v1/messages?beta=true",{body:h,timeout:f??600000,...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-user-profile-id":l}:void 0,...d!=null?{"anthropic-workspace-id":d}:void 0},g,t?.headers]),stream:i.stream??!1})}parse(s,t){return t={...t,headers:p([{"anthropic-beta":[...s.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(s,t).then((i)=>qi(i,s,{logger:this._client.logger??console}))}stream(s,t){return Ms.createMessage(this,s,t)}countTokens(s,t){let i=fc(s),{betas:c,user_profile_id:l,workspace_id:d,...h}=i;return this._client.post("/v1/messages/count_tokens?beta=true",{body:h,...t,headers:p([{"anthropic-beta":[...c??[],"token-counting-2024-11-01"].toString(),...l!=null?{"anthropic-user-profile-id":l}:void 0,...d!=null?{"anthropic-workspace-id":d}:void 0},t?.headers])})}toolRunner(s,t){return new io(this._client,s,t)}}return n.Batches=Rr,n.BetaToolRunner=io,n.ToolError=I,n})();function fc(n){if(!n.output_format)return n;if(n.output_config?.format)throw new u("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:s,...t}=n;return{...t,output_config:{...n.output_config,format:s}}}class $r extends R{retrieve(n,s){return this._client.get(m`/v1/organizations/api_keys/${n}?beta=true`,s)}update(n,s,t){return this._client.post(m`/v1/organizations/api_keys/${n}?beta=true`,{body:s,...t})}list(n={},s){return this._client.getAPIList("/v1/organizations/api_keys?beta=true",re,{query:n,...s})}}class Lr extends R{retrieve(n){return this._client.get("/v1/organizations/compliance_settings?beta=true",n)}update(n,s){return this._client.post("/v1/organizations/compliance_settings?beta=true",{body:n,...s})}}class Fr extends R{create(n,s){return this._client.post("/v1/organizations/external_keys?beta=true",{body:n,...s})}retrieve(n,s){return this._client.get(m`/v1/organizations/external_keys/${n}?beta=true`,s)}update(n,s,t){return this._client.post(m`/v1/organizations/external_keys/${n}?beta=true`,{body:s,...t})}list(n={},s){return this._client.getAPIList("/v1/organizations/external_keys?beta=true",T,{query:n,...s})}delete(n,s){return this._client.delete(m`/v1/organizations/external_keys/${n}?beta=true`,s)}validate(n,s){return this._client.post(m`/v1/organizations/external_keys/${n}/validate?beta=true`,s)}}class Hr extends R{create(n,s){return this._client.post("/v1/organizations/invites?beta=true",{body:n,...s})}retrieve(n,s){return this._client.get(m`/v1/organizations/invites/${n}?beta=true`,s)}list(n={},s){return this._client.getAPIList("/v1/organizations/invites?beta=true",re,{query:n,...s})}delete(n,s){return this._client.delete(m`/v1/organizations/invites/${n}?beta=true`,s)}}class Dr extends R{list(n={},s){return this._client.getAPIList("/v1/organizations/rate_limits?beta=true",T,{query:n,...s})}}class Br extends R{retrieve(n,s){return this._client.get(m`/v1/organizations/users/${n}?beta=true`,s)}update(n,s,t){return this._client.post(m`/v1/organizations/users/${n}?beta=true`,{body:s,...t})}list(n={},s){return this._client.getAPIList("/v1/organizations/users?beta=true",re,{query:n,...s})}remove(n,s){return this._client.delete(m`/v1/organizations/users/${n}?beta=true`,s)}}class Wr extends R{create(n,s){let{betas:t,...i}=n;return this._client.post("/v1/organizations/federation_issuers?beta=true",{body:i,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0},s?.headers])})}retrieve(n,s={},t){let{betas:i}=s??{};return this._client.get(m`/v1/organizations/federation_issuers/${n}?beta=true`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}update(n,s,t){let{betas:i,...c}=s;return this._client.post(m`/v1/organizations/federation_issuers/${n}?beta=true`,{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}list(n={},s){let{betas:t,...i}=n??{};return this._client.getAPIList("/v1/organizations/federation_issuers?beta=true",T,{query:i,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0},s?.headers])})}archive(n,s={},t){let{betas:i}=s??{};return this._client.post(m`/v1/organizations/federation_issuers/${n}/archive?beta=true`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}}class Ur extends R{list(n,s={},t){let{betas:i,...c}=s??{};return this._client.getAPIList(m`/v1/organizations/federation_rules/${n}/workspaces?beta=true`,T,{query:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(n,s,t){let{betas:i,...c}=s;return this._client.post(m`/v1/organizations/federation_rules/${n}/workspaces?beta=true`,{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(n,s,t){let{federation_rule_id:i,betas:c}=s;return this._client.delete(m`/v1/organizations/federation_rules/${i}/workspaces/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var Ds=(()=>{class n extends R{constructor(){super(...arguments);this.workspaces=new Ur(this._client)}create(s,t){let{betas:i,...c}=s;return this._client.post("/v1/organizations/federation_rules?beta=true",{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c}=t??{};return this._client.get(m`/v1/organizations/federation_rules/${s}?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}update(s,t,i){let{betas:c,...l}=t;return this._client.post(m`/v1/organizations/federation_rules/${s}?beta=true`,{body:l,...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}list(s={},t){let{betas:i,...c}=s??{};return this._client.getAPIList("/v1/organizations/federation_rules?beta=true",T,{query:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}archive(s,t={},i){let{betas:c}=t??{};return this._client.post(m`/v1/organizations/federation_rules/${s}/archive?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}}return n.Workspaces=Ur,n})();var Bs=(()=>{class n extends R{constructor(){super(...arguments);this.issuers=new Wr(this._client),this.rules=new Ds(this._client)}}return n.Issuers=Wr,n.Rules=Ds,n})();class qr extends R{list(n,s={},t){let{betas:i,...c}=s??{};return this._client.getAPIList(m`/v1/organizations/service_accounts/${n}/workspaces?beta=true`,T,{query:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(n,s,t){let{betas:i,...c}=s;return this._client.post(m`/v1/organizations/service_accounts/${n}/workspaces?beta=true`,{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(n,s,t){let{service_account_id:i,betas:c}=s;return this._client.delete(m`/v1/organizations/service_accounts/${i}/workspaces/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var Ws=(()=>{class n extends R{constructor(){super(...arguments);this.workspaces=new qr(this._client)}create(s,t){let{betas:i,...c}=s;return this._client.post("/v1/organizations/service_accounts?beta=true",{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c}=t??{};return this._client.get(m`/v1/organizations/service_accounts/${s}?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}update(s,t,i){let{betas:c,...l}=t;return this._client.post(m`/v1/organizations/service_accounts/${s}?beta=true`,{body:l,...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}list(s={},t){let{betas:i,...c}=s??{};return this._client.getAPIList("/v1/organizations/service_accounts?beta=true",T,{query:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}archive(s,t={},i){let{betas:c}=t??{};return this._client.post(m`/v1/organizations/service_accounts/${s}/archive?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},i?.headers])})}}return n.Workspaces=qr,n})();class Jr extends R{retrieve(n,s,t){let{workspace_id:i}=s;return this._client.get(m`/v1/organizations/workspaces/${i}/members/${n}?beta=true`,t)}update(n,s,t){let{workspace_id:i,...c}=s;return this._client.post(m`/v1/organizations/workspaces/${i}/members/${n}?beta=true`,{body:c,...t})}list(n,s={},t){return this._client.getAPIList(m`/v1/organizations/workspaces/${n}/members?beta=true`,re,{query:s,...t})}add(n,s,t){return this._client.post(m`/v1/organizations/workspaces/${n}/members?beta=true`,{body:s,...t})}remove(n,s,t){let{workspace_id:i}=s;return this._client.delete(m`/v1/organizations/workspaces/${i}/members/${n}?beta=true`,t)}}class Yr extends R{list(n,s={},t){return this._client.getAPIList(m`/v1/organizations/workspaces/${n}/rate_limits?beta=true`,T,{query:s,...t})}}class Xr extends R{retrieve(n,s,t){let{workspace_id:i,betas:c}=s;return this._client.get(m`/v1/organizations/workspaces/${i}/service_accounts/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}update(n,s,t){let{workspace_id:i,betas:c,...l}=s;return this._client.post(m`/v1/organizations/workspaces/${i}/service_accounts/${n}?beta=true`,{body:l,...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,...c}=s??{};return this._client.getAPIList(m`/v1/organizations/workspaces/${n}/service_accounts?beta=true`,T,{query:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}add(n,s,t){let{betas:i,...c}=s;return this._client.post(m`/v1/organizations/workspaces/${n}/service_accounts?beta=true`,{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}remove(n,s,t){let{workspace_id:i,betas:c}=s;return this._client.delete(m`/v1/organizations/workspaces/${i}/service_accounts/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0},t?.headers])})}}var Us=(()=>{class n extends R{constructor(){super(...arguments);this.rateLimits=new Yr(this._client),this.members=new Jr(this._client),this.serviceAccounts=new Xr(this._client)}create(s,t){let{betas:i,...c}=s;return this._client.post("/v1/organizations/workspaces?beta=true",{body:c,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers])})}retrieve(s,t){return this._client.get(m`/v1/organizations/workspaces/${s}?beta=true`,t)}update(s,t,i){return this._client.post(m`/v1/organizations/workspaces/${s}?beta=true`,{body:t,...i})}list(s={},t){return this._client.getAPIList("/v1/organizations/workspaces?beta=true",re,{query:s,...t})}archive(s,t){return this._client.post(m`/v1/organizations/workspaces/${s}/archive?beta=true`,t)}}return n.RateLimits=Yr,n.Members=Jr,n.ServiceAccounts=Xr,n})();var js=(()=>{class n extends R{constructor(){super(...arguments);this.apiKeys=new $r(this._client),this.externalKeys=new Fr(this._client),this.federation=new Bs(this._client),this.invites=new Hr(this._client),this.serviceAccounts=new Ws(this._client),this.users=new Br(this._client),this.workspaces=new Us(this._client),this.rateLimits=new Dr(this._client),this.complianceSettings=new Lr(this._client)}retrieve(s){return this._client.get("/v1/organizations/me?beta=true",s)}}return n.APIKeys=$r,n.ExternalKeys=Fr,n.Federation=Bs,n.Invites=Hr,n.ServiceAccounts=Ws,n.Users=Br,n.Workspaces=Us,n.RateLimits=Dr,n.ComplianceSettings=Lr,n})();var qs=(()=>{class n extends R{list(s,t={},i){let{betas:c,workspace_id:l,...d}=t??{};return this._client.getAPIList(m`/v1/sessions/${s}/events?beta=true`,T,{query:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}send(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/sessions/${s}/events?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}stream(s,t={},i){let{betas:c,workspace_id:l,...d}=t??{};return this._client.get(m`/v1/sessions/${s}/events/stream?beta=true`,{query:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers]),stream:!0})}toolRunner(s,t){return new br(s,{...t,client:this._client})}}return n.SessionToolRunner=br,n})();class Qr extends R{retrieve(n,s,t){let{session_id:i,betas:c,workspace_id:l}=s;return this._client.get(m`/v1/sessions/${i}/resources/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(n,s,t){let{session_id:i,betas:c,workspace_id:l,...d}=s;return this._client.post(m`/v1/sessions/${i}/resources/${n}?beta=true`,{body:d,...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/sessions/${n}/resources?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,s,t){let{session_id:i,betas:c,workspace_id:l}=s;return this._client.delete(m`/v1/sessions/${i}/resources/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}add(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/sessions/${n}/resources?beta=true`,{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}class Zr extends R{list(n,s,t){let{session_id:i,betas:c,workspace_id:l,...d}=s;return this._client.getAPIList(m`/v1/sessions/${i}/threads/${n}/events?beta=true`,T,{query:d,...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}stream(n,s,t){let{session_id:i,betas:c,workspace_id:l,...d}=s;return this._client.get(m`/v1/sessions/${i}/threads/${n}/stream?beta=true`,{query:d,...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),stream:!0})}}var zs=(()=>{class n extends R{constructor(){super(...arguments);this.events=new Zr(this._client)}retrieve(s,t,i){let{session_id:c,betas:l,workspace_id:d}=t;return this._client.get(m`/v1/sessions/${c}/threads/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},i?.headers])})}list(s,t={},i){let{betas:c,workspace_id:l,...d}=t??{};return this._client.getAPIList(m`/v1/sessions/${s}/threads?beta=true`,T,{query:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(s,t,i){let{session_id:c,betas:l,workspace_id:d}=t;return this._client.post(m`/v1/sessions/${c}/threads/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...l??[],"managed-agents-2026-04-01"].toString(),...d!=null?{"anthropic-workspace-id":d}:void 0},i?.headers])})}}return n.Events=Zr,n})();var Ks=(()=>{class n extends R{constructor(){super(...arguments);this.events=new qs(this._client),this.resources=new Qr(this._client),this.threads=new zs(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/sessions?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/sessions/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/sessions/${s}?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/sessions?beta=true",Ii,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/sessions/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/sessions/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Events=qs,n.Resources=Qr,n.Threads=zs,n})();class tn extends R{create(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/skills/${n}/versions?beta=true`,Ee({body:l,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])},this._client,!1))}retrieve(n,s,t){let{skill_id:i,betas:c,workspace_id:l}=s;return this._client.get(m`/v1/skills/${i}/versions/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/skills/${n}/versions?beta=true`,T,{query:l,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,s,t){let{skill_id:i,betas:c,workspace_id:l}=s;return this._client.delete(m`/v1/skills/${i}/versions/${n}?beta=true`,{...t,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}download(n,s,t){let{skill_id:i,betas:c,workspace_id:l}=s;return this._client.get(m`/v1/skills/${i}/versions/${n}/content?beta=true`,{...t,headers:p([{Accept:"application/binary",...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers]),__binaryResponse:!0})}}var Vs=(()=>{class n extends R{constructor(){super(...arguments);this.versions=new tn(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/skills?beta=true",Ee({body:l,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])},this._client,!1))}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/skills/${s}?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/skills?beta=true",T,{query:l,...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/skills/${s}?beta=true`,{...i,headers:p([{...c?.toString()!=null?{"anthropic-beta":c?.toString()}:void 0,...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Versions=tn,n})();class rn extends R{create(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/tunnels/${n}/certificates?beta=true`,{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,s,t){let{tunnel_id:i,betas:c,workspace_id:l}=s;return this._client.get(m`/v1/tunnels/${i}/certificates/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/tunnels/${n}/certificates?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(n,s,t){let{tunnel_id:i,betas:c,workspace_id:l}=s;return this._client.post(m`/v1/tunnels/${i}/certificates/${n}/archive?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var Js=(()=>{class n extends R{constructor(){super(...arguments);this.certificates=new rn(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/tunnels?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/tunnels/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/tunnels?beta=true",T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/tunnels/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}revealToken(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/tunnels/${s}/reveal_token?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}rotateToken(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/tunnels/${s}/rotate_token?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"mcp-tunnels-2026-06-22"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Certificates=rn,n})();class nn extends R{create(n,s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post(m`/v1/vaults/${n}/credentials?beta=true`,{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(n,s,t){let{vault_id:i,betas:c,workspace_id:l}=s;return this._client.get(m`/v1/vaults/${i}/credentials/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}update(n,s,t){let{vault_id:i,betas:c,workspace_id:l,...d}=s;return this._client.post(m`/v1/vaults/${i}/credentials/${n}?beta=true`,{body:d,...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}list(n,s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList(m`/v1/vaults/${n}/credentials?beta=true`,T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(n,s,t){let{vault_id:i,betas:c,workspace_id:l}=s;return this._client.delete(m`/v1/vaults/${i}/credentials/${n}?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}archive(n,s,t){let{vault_id:i,betas:c,workspace_id:l}=s;return this._client.post(m`/v1/vaults/${i}/credentials/${n}/archive?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}mcpOAuthValidate(n,s,t){let{vault_id:i,betas:c,workspace_id:l}=s;return this._client.post(m`/v1/vaults/${i}/credentials/${n}/mcp_oauth_validate?beta=true`,{...t,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},t?.headers])})}}var Gs=(()=>{class n extends R{constructor(){super(...arguments);this.credentials=new nn(this._client)}create(s,t){let{betas:i,workspace_id:c,...l}=s;return this._client.post("/v1/vaults?beta=true",{body:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}retrieve(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.get(m`/v1/vaults/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}update(s,t,i){let{betas:c,workspace_id:l,...d}=t;return this._client.post(m`/v1/vaults/${s}?beta=true`,{body:d,...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}list(s={},t){let{betas:i,workspace_id:c,...l}=s??{};return this._client.getAPIList("/v1/vaults?beta=true",T,{query:l,...t,headers:p([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}delete(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.delete(m`/v1/vaults/${s}?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}archive(s,t={},i){let{betas:c,workspace_id:l}=t??{};return this._client.post(m`/v1/vaults/${s}/archive?beta=true`,{...i,headers:p([{"anthropic-beta":[...c??[],"managed-agents-2026-04-01"].toString(),...l!=null?{"anthropic-workspace-id":l}:void 0},i?.headers])})}}return n.Credentials=nn,n})();var sn=(()=>{class n extends R{constructor(){super(...arguments);this.models=new nr(this._client),this.messages=new Hs(this._client),this.agents=new es(this._client),this.environments=new ys(this._client),this.sessions=new Ks(this._client),this.deployments=new Zt(this._client),this.deploymentRuns=new Qt(this._client),this.vaults=new Gs(this._client),this.memoryStores=new bs(this._client),this.files=new rr(this._client),this.skills=new Vs(this._client),this.webhooks=new ur(this._client),this.userProfiles=new ir(this._client),this.dreams=new er(this._client),this.tunnels=new Js(this._client),this.organization=new js(this._client)}}return n.Models=nr,n.Messages=Hs,n.Agents=es,n.Environments=ys,n.Sessions=Ks,n.Deployments=Zt,n.DeploymentRuns=Qt,n.Vaults=Gs,n.MemoryStores=bs,n.Files=rr,n.Skills=Vs,n.Webhooks=ur,n.UserProfiles=ir,n.Dreams=er,n.Tunnels=Js,n.Organization=js,n})();class Dt extends R{create(n,s){let{betas:t,workspace_id:i,...c}=n;return this._client.post("/v1/complete",{body:c,timeout:this._client._options.timeout??600000,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers]),stream:n.stream??!1})}}class Bt extends R{list(n={},s){let{workspace_id:t,...i}=n??{};return this._client.getAPIList("/v1/files",T,{query:i,...s,headers:p([{...t!=null?{"anthropic-workspace-id":t}:void 0},s?.headers])})}delete(n,s={},t){let{workspace_id:i}=s??{};return this._client.delete(m`/v1/files/${n}`,{...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}download(n,s={},t){let{workspace_id:i}=s??{};return this._client.get(m`/v1/files/${n}/content`,{...t,headers:p([{Accept:"application/binary",...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers]),__binaryResponse:!0})}retrieveMetadata(n,s={},t){let{workspace_id:i}=s??{};return this._client.get(m`/v1/files/${n}`,{...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}upload(n,s){let{workspace_id:t,...i}=n;return this._client.post("/v1/files",Ee({body:i,...s,headers:p([{...t!=null?{"anthropic-workspace-id":t}:void 0},Xn(i.file),s?.headers])},this._client))}}function pc(n){return n?.output_config?.format}function oo(n,s,t){let i=pc(s);if(!s||!("parse"in(i??{})))return{...n,content:n.content.map((c)=>{if(c.type==="text")return Object.defineProperty({...c},"parsed_output",{value:null,enumerable:!1});return c}),parsed_output:null};return ao(n,s,t)}function ao(n,s,t){let i=null,c=n.content.map((l)=>{if(l.type==="text"){let d=zu(s,l.text);if(i===null)i=d;return Object.defineProperty({...l},"parsed_output",{value:d,enumerable:!1})}return l});return{...n,content:c,parsed_output:i}}function zu(n,s){let t=pc(n);if(t?.type!=="json_schema")return null;try{if("parse"in t)return t.parse(s);return JSON.parse(s)}catch(i){throw new u(`Failed to parse structured output: ${i}`)}}var Pe,rt,Wt,on,Ys,an,cn,Xs,ln,je,un,Qs,Zs,pt,ei,ti,ri,dn,co,mc,lo,uo,ho,fo,_c;function po(n){return n.type==="tool_use"||n.type==="server_tool_use"}var gc=(()=>{class n{constructor(s,t){Pe.add(this),this.messages=[],this.receivedMessages=[],rt.set(this,void 0),Wt.set(this,null),this.controller=new AbortController,on.set(this,void 0),Ys.set(this,()=>{}),an.set(this,()=>{}),cn.set(this,void 0),Xs.set(this,()=>{}),ln.set(this,()=>{}),je.set(this,{}),un.set(this,!1),Qs.set(this,!1),Zs.set(this,!1),pt.set(this,!1),ei.set(this,void 0),ti.set(this,void 0),ri.set(this,void 0),dn.set(this,void 0),lo.set(this,(i)=>{if(o(this,Qs,!0,"f"),Me(i))i=new oe;if(i instanceof oe)return o(this,Zs,!0,"f"),this._emit("abort",i);if(i instanceof u)return this._emit("error",i);if(i instanceof Error){let c=new u(i.message);return c.cause=i,this._emit("error",c)}return this._emit("error",new u(String(i)))}),o(this,on,new Promise((i,c)=>{o(this,Ys,i,"f"),o(this,an,c,"f")}),"f"),o(this,cn,new Promise((i,c)=>{o(this,Xs,i,"f"),o(this,ln,c,"f")}),"f"),e(this,on,"f").catch(()=>{}),e(this,cn,"f").catch(()=>{}),o(this,Wt,s,"f"),o(this,dn,t?.logger??console,"f")}get response(){return e(this,ei,"f")}get request_id(){return e(this,ti,"f")}get workspace_id(){return e(this,ri,"f")}async withResponse(){o(this,pt,!0,"f");let s=await e(this,on,"f");if(!s)throw Error("Could not resolve a `Response` object");return{data:this,response:s,request_id:s.headers.get("request-id"),workspace_id:s.headers.get("anthropic-workspace-id")}}static fromReadableStream(s){let t=new n(null);return t._run(()=>t._fromReadableStream(s)),t}static createMessage(s,t,i,{logger:c}={}){let l=new n(t,{logger:c});for(let d of t.messages)l._addMessageParam(d);return o(l,Wt,{...t,stream:!0},"f"),l._run(()=>l._createMessage(s,{...t,stream:!0},{...i,headers:{...i?.headers,[wt]:"stream"}})),l}_run(s){s().then(()=>{this._emitFinal(),this._emit("end")},e(this,lo,"f"))}_addMessageParam(s){this.messages.push(s)}_addMessage(s,t=!0){if(this.receivedMessages.push(s),t)this._emit("message",s)}async _createMessage(s,t,i){let c=i?.signal,l;if(c){if(c.aborted)this.controller.abort();l=this.controller.abort.bind(this.controller),c.addEventListener("abort",l)}try{e(this,Pe,"m",uo).call(this);let{response:d,data:h}=await s.create({...t,stream:!0},{...i,signal:this.controller.signal}).withResponse();this._connected(d);for await(let f of h)e(this,Pe,"m",ho).call(this,f);if(h.controller.signal?.aborted)throw new oe;e(this,Pe,"m",fo).call(this)}finally{if(c&&l)c.removeEventListener("abort",l)}}_connected(s){if(this.ended)return;o(this,ei,s,"f"),o(this,ti,s?.headers.get("request-id"),"f"),o(this,ri,s?.headers.get("anthropic-workspace-id"),"f"),e(this,Ys,"f").call(this,s),this._emit("connect")}get ended(){return e(this,un,"f")}get errored(){return e(this,Qs,"f")}get aborted(){return e(this,Zs,"f")}abort(){this.controller.abort()}on(s,t){return(e(this,je,"f")[s]||(e(this,je,"f")[s]=[])).push({listener:t}),this}off(s,t){let i=e(this,je,"f")[s];if(!i)return this;let c=i.findIndex((l)=>l.listener===t);if(c>=0)i.splice(c,1);return this}once(s,t){return(e(this,je,"f")[s]||(e(this,je,"f")[s]=[])).push({listener:t,once:!0}),this}emitted(s){return new Promise((t,i)=>{if(o(this,pt,!0,"f"),s!=="error")this.once("error",i);this.once(s,t)})}async done(){o(this,pt,!0,"f"),await e(this,cn,"f")}get currentMessage(){return e(this,rt,"f")}async finalMessage(){return await this.done(),e(this,Pe,"m",co).call(this)}async finalText(){return await this.done(),e(this,Pe,"m",mc).call(this)}_emit(s,...t){if(e(this,un,"f"))return;if(s==="end")o(this,un,!0,"f"),e(this,Xs,"f").call(this);let i=e(this,je,"f")[s];if(i)e(this,je,"f")[s]=i.filter((c)=>!c.once),i.forEach(({listener:c})=>c(...t));if(s==="abort"){let c=t[0];if(!e(this,pt,"f")&&!i?.length)Promise.reject(c);e(this,an,"f").call(this,c),e(this,ln,"f").call(this,c),this._emit("end");return}if(s==="error"){let c=t[0];if(!e(this,pt,"f")&&!i?.length)Promise.reject(c);e(this,an,"f").call(this,c),e(this,ln,"f").call(this,c),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",e(this,Pe,"m",co).call(this))}async _fromReadableStream(s,t){let i=t?.signal,c;if(i){if(i.aborted)this.controller.abort();c=this.controller.abort.bind(this.controller),i.addEventListener("abort",c)}try{e(this,Pe,"m",uo).call(this),this._connected(null);let l=He.fromReadableStream(s,this.controller);for await(let d of l)e(this,Pe,"m",ho).call(this,d);if(l.controller.signal?.aborted)throw new oe;e(this,Pe,"m",fo).call(this)}finally{if(i&&c)i.removeEventListener("abort",c)}}[(rt=new WeakMap,Wt=new WeakMap,on=new WeakMap,Ys=new WeakMap,an=new WeakMap,cn=new WeakMap,Xs=new WeakMap,ln=new WeakMap,je=new WeakMap,un=new WeakMap,Qs=new WeakMap,Zs=new WeakMap,pt=new WeakMap,ei=new WeakMap,ti=new WeakMap,ri=new WeakMap,dn=new WeakMap,lo=new WeakMap,Pe=new WeakSet,co=function(){if(this.receivedMessages.length===0)throw new u("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},mc=function(){if(this.receivedMessages.length===0)throw new u("stream ended without producing a Message with role=assistant");let t=this.receivedMessages.at(-1).content.filter((i)=>i.type==="text").map((i)=>i.text);if(t.length===0)throw new u("stream ended without producing a content block with type=text");return t.join(" ")},uo=function(){if(this.ended)return;o(this,rt,void 0,"f")},ho=function(t){if(this.ended)return;let i=e(this,Pe,"m",_c).call(this,t);switch(this._emit("streamEvent",t,i),t.type){case"content_block_delta":{let c=i.content.at(-1);switch(t.delta.type){case"text_delta":{if(c.type==="text")this._emit("text",t.delta.text,c.text||"");break}case"citations_delta":{if(c.type==="text")this._emit("citation",t.delta.citation,c.citations??[]);break}case"input_json_delta":{if(po(c)&&e(this,je,"f").inputJson?.length)this._emit("inputJson",t.delta.partial_json,c.input);break}case"thinking_delta":{if(c.type==="thinking")this._emit("thinking",t.delta.thinking,c.thinking);break}case"signature_delta":{if(c.type==="thinking")this._emit("signature",c.signature);break}default:Ve(t.delta)}break}case"message_stop":{this._addMessageParam(i),this._addMessage(oo(i,e(this,Wt,"f"),{logger:e(this,dn,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",i.content.at(-1));break}case"message_start":{o(this,rt,i,"f");break}case"content_block_start":case"message_delta":break}},fo=function(){if(this.ended)throw new u("stream has ended, this shouldn't happen");let t=e(this,rt,"f");if(!t)throw new u("request ended without sending any chunks");return o(this,rt,void 0,"f"),oo(t,e(this,Wt,"f"),{logger:e(this,dn,"f")})},_c=function(t){let i=e(this,rt,"f");if(t.type==="message_start"){if(i)throw new u(`Unexpected event order, got ${t.type} before receiving "message_stop"`);return t.message}if(!i)throw new u(`Unexpected event order, got ${t.type} before "message_start"`);switch(t.type){case"message_stop":return i;case"message_delta":if(i.stop_reason=t.delta.stop_reason,i.stop_sequence=t.delta.stop_sequence,i.stop_details=t.delta.stop_details,i.usage.output_tokens=t.usage.output_tokens,t.delta.container!=null)i.container=t.delta.container;if(t.usage.input_tokens!=null)i.usage.input_tokens=t.usage.input_tokens;if(t.usage.cache_creation_input_tokens!=null)i.usage.cache_creation_input_tokens=t.usage.cache_creation_input_tokens;if(t.usage.cache_read_input_tokens!=null)i.usage.cache_read_input_tokens=t.usage.cache_read_input_tokens;if(t.usage.server_tool_use!=null)i.usage.server_tool_use=t.usage.server_tool_use;if(t.usage.output_tokens_details!=null)i.usage.output_tokens_details=t.usage.output_tokens_details;return i;case"content_block_start":return i.content.push({...t.content_block}),i;case"content_block_delta":{let c=i.content.at(t.index);switch(t.delta.type){case"text_delta":{if(c?.type==="text")i.content[t.index]={...c,text:(c.text||"")+t.delta.text};break}case"citations_delta":{if(c?.type==="text")i.content[t.index]={...c,citations:[...c.citations??[],t.delta.citation]};break}case"input_json_delta":{if(c&&po(c)){let l=(c[Qe]||"")+t.delta.partial_json;i.content[t.index]=xs(c,l)}break}case"thinking_delta":{if(c?.type==="thinking")i.content[t.index]={...c,thinking:c.thinking+t.delta.thinking};break}case"signature_delta":{if(c?.type==="thinking")i.content[t.index]={...c,signature:t.delta.signature};break}default:Ve(t.delta)}return i}case"content_block_stop":{let c=i.content.at(t.index);if(c&&po(c)&&Qe in c)Object.defineProperty(c,"input",{value:c.input,enumerable:!0,configurable:!0,writable:!0});return i}}},Symbol.asyncIterator)](){let s=[],t=[],i=!1;return this.on("streamEvent",(c)=>{let l=t.shift();if(l)l.resolve(c);else s.push(c)}),this.on("end",()=>{i=!0;for(let c of t)c.resolve(void 0);t.length=0}),this.on("abort",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),this.on("error",(c)=>{i=!0;for(let l of t)l.reject(c);t.length=0}),{next:async()=>{if(!s.length){if(i)return{value:void 0,done:!0};return new Promise((l,d)=>t.push({resolve:l,reject:d})).then((l)=>l?{value:l,done:!1}:{value:void 0,done:!0})}return{value:s.shift(),done:!1}},return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new He(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}return n})();class hn extends R{create(n,s){let{user_profile_id:t,workspace_id:i,...c}=n;return this._client.post("/v1/messages/batches",{body:c,...s,headers:p([{...t!=null?{"anthropic-user-profile-id":t}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}retrieve(n,s={},t){let{workspace_id:i}=s??{};return this._client.get(m`/v1/messages/batches/${n}`,{...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}list(n={},s){let{workspace_id:t,...i}=n??{};return this._client.getAPIList("/v1/messages/batches",re,{query:i,...s,headers:p([{...t!=null?{"anthropic-workspace-id":t}:void 0},s?.headers])})}delete(n,s={},t){let{workspace_id:i}=s??{};return this._client.delete(m`/v1/messages/batches/${n}`,{...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}cancel(n,s={},t){let{workspace_id:i}=s??{};return this._client.post(m`/v1/messages/batches/${n}/cancel`,{...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}async results(n,s={},t){let i=await this.retrieve(n,s,t);if(!i.results_url)throw new u(`No batch \`results_url\`; Has it finished processing? ${i.processing_status} - ${i.id}`);let{workspace_id:c}=s??{};return this._client.get(i.results_url,{...t,headers:p([{Accept:"application/binary",...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((l,d)=>ks.fromResponse(d.response,d.controller))}}var fn=(()=>{class n extends R{constructor(){super(...arguments);this.batches=new hn(this._client)}create(s,t){let{user_profile_id:i,workspace_id:c,...l}=s;if(l.model in wc)console.warn(`The model '${l.model}' is deprecated and will reach end-of-life on ${wc[l.model]}
12
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(Vu.includes(l.model)&&l.thinking&&l.thinking.type==="enabled")console.warn(`Using Claude with ${l.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let d=t?.timeout??this._client._options.timeout;if(!l.stream&&d==null){let f=Ss[l.model]??void 0;d=this._client.calculateNonstreamingTimeout(l.max_tokens,f)}let h=Yn(l.tools,l.messages);return this._client.post("/v1/messages",{body:l,timeout:d??600000,...t,headers:p([{...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},h,t?.headers]),stream:s.stream??!1})}parse(s,t){return this.create(s,t).then((i)=>ao(i,s,{logger:this._client.logger??console}))}stream(s,t){return gc.createMessage(this,s,t,{logger:this._client.logger??console})}countTokens(s,t){let{user_profile_id:i,workspace_id:c,...l}=s;return this._client.post("/v1/messages/count_tokens",{body:l,...t,headers:p([{...i!=null?{"anthropic-user-profile-id":i}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}return n.Batches=hn,n})(),wc={},Vu=["claude-mythos-preview","claude-opus-4-6"];class Ut extends R{retrieve(n,s={},t){let{betas:i,workspace_id:c}=s??{};return this._client.get(m`/v1/models/${n}`,{...t,headers:p([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n={},s){let{betas:t,workspace_id:i,...c}=n??{};return this._client.getAPIList("/v1/models",re,{query:c,...s,headers:p([{...t?.toString()!=null?{"anthropic-beta":t?.toString()}:void 0,...i!=null?{"anthropic-workspace-id":i}:void 0},s?.headers])})}}class pn extends R{create(n,s,t){let{workspace_id:i,...c}=s;return this._client.post(m`/v1/skills/${n}/versions`,Ee({body:c,...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])},this._client,!1))}retrieve(n,s,t){let{skill_id:i,workspace_id:c}=s;return this._client.get(m`/v1/skills/${i}/versions/${n}`,{...t,headers:p([{...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}list(n,s={},t){let{workspace_id:i,...c}=s??{};return this._client.getAPIList(m`/v1/skills/${n}/versions`,T,{query:c,...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}delete(n,s,t){let{skill_id:i,workspace_id:c}=s;return this._client.delete(m`/v1/skills/${i}/versions/${n}`,{...t,headers:p([{...c!=null?{"anthropic-workspace-id":c}:void 0},t?.headers])})}}var mn=(()=>{class n extends R{constructor(){super(...arguments);this.versions=new pn(this._client)}create(s,t){let{workspace_id:i,...c}=s;return this._client.post("/v1/skills",Ee({body:c,...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])},this._client,!1))}retrieve(s,t={},i){let{workspace_id:c}=t??{};return this._client.get(m`/v1/skills/${s}`,{...i,headers:p([{...c!=null?{"anthropic-workspace-id":c}:void 0},i?.headers])})}list(s={},t){let{workspace_id:i,...c}=s??{};return this._client.getAPIList("/v1/skills",T,{query:c,...t,headers:p([{...i!=null?{"anthropic-workspace-id":i}:void 0},t?.headers])})}delete(s,t={},i){let{workspace_id:c}=t??{};return this._client.delete(m`/v1/skills/${s}`,{...i,headers:p([{...c!=null?{"anthropic-workspace-id":c}:void 0},i?.headers])})}}return n.Versions=pn,n})();var mo,_o,ni,yc,Yu="\\n\\nHuman:",Xu="\\n\\nAssistant:",Qu=(()=>{class n{get credentials(){return this._authState.provider}constructor({baseURL:s=N("ANTHROPIC_BASE_URL"),apiKey:t,authToken:i,webhookKey:c=N("ANTHROPIC_WEBHOOK_SIGNING_KEY")??null,...l}={}){if(mo.add(this),this._requestAuthFlags=new WeakMap,ni.set(this,void 0),t===void 0)t=l.profile!=null?null:N("ANTHROPIC_API_KEY")??null;if(i===void 0)i=l.profile!=null?null:N("ANTHROPIC_AUTH_TOKEN")??null;if(l.profile!=null&&(l.credentials!=null||l.config!=null))throw TypeError("Pass at most one of `profile`, `credentials`, or `config`.");let d={apiKey:t,authToken:i,webhookKey:c,...l,baseURL:s||"https://api.anthropic.com"};if(!d.dangerouslyAllowBrowser&&Ao())throw new u(`It looks like you're running in a browser-like environment.
13
-
14
- This is disabled by default, as it risks exposing your secret API credentials to attackers.
15
- If you understand the risks and have appropriate mitigations in place,
16
- you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
17
-
18
- new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
19
- `);this.baseURL=d.baseURL,this._baseURLIsExplicit=l.__baseURLIsExplicit??!!s,this.timeout=d.timeout??_o.DEFAULT_TIMEOUT,this.logger=d.logger??console,this.logLevel=Kt,this.logLevel=Bn(d.logLevel,"ClientOptions.logLevel",L(this))??Bn(N("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",L(this))??Kt,this.fetchOptions=d.fetchOptions,this.maxRetries=Tn("maxRetries",d.maxRetries??2),this.fetch=d.fetch??Mo(),o(this,ni,Oo,"f"),this.middleware=[...d.middleware??[]];let h=N("ANTHROPIC_CUSTOM_HEADERS");if(h){let g={};for(let v of h.split(`
20
- `)){let _=v.indexOf(":");if(_>=0)g[v.substring(0,_).trim()]=v.substring(_+1).trim()}d.defaultHeaders={...g,...d.defaultHeaders}}let f=l.__auth;if(delete d.__auth,delete d.__baseURLIsExplicit,this._options=d,this.apiKey=typeof t==="string"?t:null,this.authToken=i,this.webhookKey=c,f){if(this._authState=f,!this._baseURLIsExplicit&&f.baseURL)this.baseURL=f.baseURL}else if(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},this.apiKey==null&&this.authToken==null){let g=d.credentials??null;if(g)this._authState.provider=g,this._authState.tokenCache=this._makeTokenCache(g);else if(d.config!=null){let v=Ri(d.config,this._credentialResolverOptions());this._authState.provider=v.provider,this._authState.tokenCache=this._makeTokenCache(v.provider),this._authState.extraHeaders=v.extraHeaders,this._applyCredentialBaseURL(v.baseURL)}else if(d.profile!=null)this._authState.resolution=this._resolveDefaultCredentials(d.profile);else if(this._shouldResolveDefaultCredentials())this._authState.resolution=this._resolveDefaultCredentials()}}_shouldResolveDefaultCredentials(){return!0}_applyCredentialBaseURL(s){if(!s)return;let t=s.replace(/\/+$/,"");if(this._authState.baseURL=t,!this._baseURLIsExplicit)this.baseURL=t}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:(s)=>{L(this).debug("credential cache write failed (best-effort)",s)},onSafetyWarning:(s)=>{L(this).warn(s)}}}_credentialsFetch(){return Ai(this.fetch,this.middleware,void 0,this)}_makeTokenCache(s){return new bi(s,(t)=>{L(this).debug("advisory token refresh failed; serving cached token",t)})}withOptions(s){let t="credentials"in s||"config"in s||"profile"in s,i="apiKey"in s||"authToken"in s||t,c={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey,authToken:this.authToken,webhookKey:this.webhookKey,credentials:this.credentials,...t?{credentials:void 0,config:void 0,profile:void 0}:{},...s,__auth:i?void 0:this._authState,__baseURLIsExplicit:"baseURL"in s?!0:this._baseURLIsExplicit};return new this.constructor(c)}async _resolveDefaultCredentials(s){try{let t=await da(this._credentialResolverOptions(),s);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(s!=null)throw new u(`Profile "${s}" could not be resolved (no <config_dir>/configs/${s}.json found).`)}catch(t){this._authState.error=t}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:s,nulls:t}){if(s.get("x-api-key")||s.get("authorization"))return;if(this._authState.error)throw this._authState.error;if(this._authState.tokenCache||this._authState.resolution)return;if(this.apiKey&&s.get("x-api-key"))return;if(t.has("x-api-key"))return;if(this.authToken&&s.get("authorization"))return;if(t.has("authorization"))return;throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}_authFlags(s){let t=this._requestAuthFlags.get(s);if(!t)t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(s,t);return t}async authHeaders(s){if(this._authState.resolution)await this._authState.resolution;if(this._authState.error)return;if(this._authState.tokenCache&&this.apiKey==null){let t=await this._authState.tokenCache.getToken();return this._authFlags(s).usedTokenCache=!0,p([{Authorization:`Bearer ${t}`}])}return p([await this.apiKeyAuth(s),await this.bearerAuth(s)])}async apiKeyAuth(s){if(this.apiKey==null)return;return p([{"X-Api-Key":this.apiKey}])}async bearerAuth(s){if(this.authToken==null)return;return p([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(s){return qo(s)}getUserAgent(){return`Anthropic/JS ${Re}`}makeStatusError(s,t,i,c){return K.generate(s,t,i,c)}buildURL(s,t,i){let c=!e(this,mo,"m",yc).call(this)&&i||this.baseURL,l=So(s)?new URL(s):new URL(c+(c.endsWith("/")&&s.startsWith("/")?s.slice(1):s)),d=this.defaultQuery(),h=Object.fromEntries(l.searchParams);if(!ui(d)||!ui(h))t={...h,...d,...t};if(typeof t==="object"&&t&&!Array.isArray(t))l.search=this.stringifyQuery(t);return l.toString()}_calculateNonstreamingTimeout(s){if(3600*s/128000>600)throw new u("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions(s){}async prepareRequest(s,{url:t,options:i}){if(this._authState.tokenCache&&this.apiKey==null){let c=s.headers instanceof Headers?s.headers:new Headers(s.headers);for(let[d,h]of Object.entries(this._authState.extraHeaders))if(!c.has(d))c.set(d,h);let l=c.get("anthropic-beta")?.split(",").map((d)=>d.trim());if(!l?.includes(it))c.set("anthropic-beta",[...l??[],it].join(","));s.headers=c}}backendMiddleware(){return[]}get(s,t){return this.methodRequest("get",s,t)}post(s,t){return this.methodRequest("post",s,t)}patch(s,t){return this.methodRequest("patch",s,t)}put(s,t){return this.methodRequest("put",s,t)}delete(s,t){return this.methodRequest("delete",s,t)}methodRequest(s,t,i){return this.request(Promise.resolve(i).then((c)=>({method:s,path:t,...c})))}request(s,t=null){return new zn(this,this.makeRequest(s,t,void 0))}async makeRequest(s,t,i){let c=await s,l=Tn("maxRetries",c.maxRetries??this.maxRetries);if(this.isStreamBody(c.body))l=0;if(t==null)t=l,this._requestAuthFlags.delete(c);await this.prepareOptions(c);let{req:d,url:h,timeout:f}=await this.buildRequest(c,{retryCount:l-t}),g="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),v=i===void 0?"":`, retryOf: ${i}`,_=Date.now();if(c.signal?.aborted)throw new oe;let k=new AbortController,y=await this.fetchWithTimeout(h,d,f,k,c,{requestLogID:g,retryOfRequestLogID:i}).catch(st),x=Date.now();if(y instanceof globalThis.Error){$e(k);let E=`retrying, ${t} attempts remaining`;if(c.signal?.aborted)throw new oe;let b=Me(y)||/timed? ?out/i.test(String(y)+("cause"in y?String(y.cause):"")),M=this.middleware.length>0||!!c.middleware?.length||this.backendMiddleware().length>0;if(M&&!b&&!_a(y))throw L(this).info(`[${g}] middleware error (not retryable)`),Fe(L(this),`[${g}] middleware error (not retryable)`,{retryOfRequestLogID:i,url:h,durationMs:x-_,message:y.message}),y;if(t)return L(this).info(`[${g}] connection ${b?"timed out":"failed"} - ${E}`),Fe(L(this),`[${g}] connection ${b?"timed out":"failed"} (${E})`,{retryOfRequestLogID:i,url:h,durationMs:x-_,message:y.message}),this.retryRequest(c,t,i??g);if(L(this).info(`[${g}] connection ${b?"timed out":"failed"} - error; no more retries left`),Fe(L(this),`[${g}] connection ${b?"timed out":"failed"} (error; no more retries left)`,{retryOfRequestLogID:i,url:h,durationMs:x-_,message:y.message}),b)throw new yn;if(M&&!Ei(y))throw y;throw new Ke({cause:y})}let P=[...y.headers.entries()].filter(([E])=>E==="request-id"||E==="anthropic-workspace-id").map(([E,b])=>", "+E+": "+JSON.stringify(b)).join(""),S=`[${g}${v}${P}] ${d.method} ${h} ${y.ok?"succeeded":"failed"} with status ${y.status} in ${x-_}ms`;if(!y.ok){let E=await this.shouldRetry(y,c);if(t&&E){let F=`retrying, ${t} attempts remaining`;return await Co(y.body),$e(k),L(this).info(`${S} - ${F}`),Fe(L(this),`[${g}] response error (${F})`,{retryOfRequestLogID:i,url:y.url,status:y.status,headers:y.headers,durationMs:x-_}),this.retryRequest(c,t,i??g,y.headers)}let b=E?"error; no more retries left":"error; not retryable";L(this).info(`${S} - ${b}`);let M=await y.text().catch((F)=>st(F).message),C=In(M),O=C?void 0:M;throw Fe(L(this),`[${g}] response error (${b})`,{retryOfRequestLogID:i,url:y.url,status:y.status,headers:y.headers,message:O,durationMs:Date.now()-_}),$e(k),this.makeStatusError(y.status,C,O,y.headers)}return L(this).info(S),Fe(L(this),`[${g}] response start`,{retryOfRequestLogID:i,url:y.url,status:y.status,headers:y.headers,durationMs:x-_}),Po(y.body??y,k),{response:y,options:c,controller:k,requestLogID:g,retryOfRequestLogID:i,startTime:_}}getAPIList(s,t,i){return this.requestAPIList(t,i&&"then"in i?i.then((c)=>({method:"get",path:s,...c})):{method:"get",path:s,...i})}requestAPIList(s,t){let i=this.makeRequest(t,null,void 0);return new ga(this,i,s)}async fetchWithTimeout(s,t,i,c,l,d){let{signal:h,method:f,...g}=t||{},v=this._makeAbort(c);if(h)h.addEventListener("abort",v,{once:!0}),Io(c,h,v);let _=globalThis.ReadableStream&&g.body instanceof globalThis.ReadableStream||typeof g.body==="object"&&g.body!==null&&Symbol.asyncIterator in g.body,k={signal:c.signal,..._?{duplex:"half"}:{},method:"GET",...g};if(f)k.method=f.toUpperCase();let y=this.fetch,x=async(M,C)=>{let O=setTimeout(v,i);try{return await y.call(void 0,M,C)}finally{clearTimeout(O)}},P=l===void 0?x:async(M,C={})=>{let O=typeof M==="string"?M:M instanceof URL?M.href:M.url;if(C.headers=C.headers instanceof Headers?C.headers:new Headers(C.headers),await this.prepareRequest(C,{url:O,options:l}),d)Fe(L(this),`[${d.requestLogID}] sending request`,{retryOfRequestLogID:d.retryOfRequestLogID,method:C.method,url:O,options:l,headers:C.headers});return x(M,C)},S=l?.middleware,E=this.backendMiddleware(),b=S?.length||E.length?[...this.middleware,...S??[],...E]:this.middleware;return await Ai(P,b,l,this)(s,k)}async shouldRetry(s,t){let i=this._authFlags(t);if(s.status===401&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let c=s.headers.get("x-should-retry");if(c==="true")return!0;if(c==="false")return!1;if(s.status===408)return!0;if(s.status===409)return!0;if(s.status===429)return!0;if(s.status>=500)return!0;return!1}async retryRequest(s,t,i,c){let l,d=c?.get("retry-after-ms");if(d){let f=parseFloat(d);if(!Number.isNaN(f))l=f}let h=c?.get("retry-after");if(h&&!l){let f=parseFloat(h);if(!Number.isNaN(f))l=f*1000;else l=Date.parse(h)-Date.now()}if(l===void 0||!(l>0&&l<=2147483647)){let f=s.maxRetries??this.maxRetries;l=this.calculateDefaultRetryTimeoutMillis(t,f)}return await Ce(l,s.signal??void 0),this.makeRequest(s,t-1,i)}calculateDefaultRetryTimeoutMillis(s,t){let l=t-s,d=Math.min(0.5*Math.pow(2,l),8),h=1-Math.random()*0.25;return d*h*1000}calculateNonstreamingTimeout(s,t){if(3600000*s/128000>600000||t!=null&&s>t)throw new u("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest(s,{retryCount:t=0}={}){let i={...s},{method:c,path:l,query:d,defaultBaseURL:h}=i;if(this._authState.resolution)await this._authState.resolution;if(!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL)this.baseURL=this._authState.baseURL;let f=this.buildURL(l,d,h);if("timeout"in i)Tn("timeout",i.timeout);i.timeout=i.timeout??this.timeout;let{bodyHeaders:g,body:v}=this.buildBody({options:i}),_=await this.buildHeaders({options:s,method:c,bodyHeaders:g,retryCount:t,timeout:i.timeout});return{req:{method:c,headers:_,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&v instanceof globalThis.ReadableStream&&{duplex:"half"},...v&&{body:v},...this.fetchOptions??{},...i.fetchOptions??{}},url:f,timeout:i.timeout}}async buildHeaders({options:s,method:t,bodyHeaders:i,retryCount:c,timeout:l}){let d=p([{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(c),"X-Stainless-Timeout":String(Math.trunc(l/1000)),...qt(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders(s),this._options.defaultHeaders,i,s.headers]);return this.validateHeaders(d),d.values}_makeAbort(s){return()=>s.abort()}buildBody({options:{body:s,headers:t}}){if(!s)return{bodyHeaders:void 0,body:void 0};let i=p([t]);if(ArrayBuffer.isView(s)||s instanceof ArrayBuffer||s instanceof DataView||typeof s==="string"&&i.values.has("content-type")||globalThis.Blob&&s instanceof globalThis.Blob||s instanceof FormData||s instanceof URLSearchParams||globalThis.ReadableStream&&s instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:s};else if(this.isStreamBody(s))return{bodyHeaders:void 0,body:Mn(s)};else if(typeof s==="object"&&i.values.get("content-type")==="application/x-www-form-urlencoded")return{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(s)};else return e(this,ni,"f").call(this,{body:s,headers:i})}isStreamBody(s){if(globalThis.ReadableStream&&s instanceof globalThis.ReadableStream)return!0;return typeof s==="object"&&s!==null&&((Symbol.asyncIterator in s)||(Symbol.iterator in s)&&("next"in s)&&typeof s.next==="function")}}return _o=n,ni=new WeakMap,mo=new WeakSet,yc=function(){return this.baseURL!=="https://api.anthropic.com"},n.Anthropic=_o,n.DEFAULT_TIMEOUT=600000,n.AnthropicError=u,n.APIError=K,n.APIConnectionError=Ke,n.APIConnectionTimeoutError=yn,n.APIUserAbortError=oe,n.NotFoundError=xn,n.ConflictError=vn,n.RateLimitError=En,n.BadRequestError=bn,n.AuthenticationError=kn,n.InternalServerError=An,n.PermissionDeniedError=Sn,n.UnprocessableEntityError=Rn,n.toFile=Ni,n.HUMAN_PROMPT=Yu,n.AI_PROMPT=Xu,n})(),si=(()=>{class n extends Qu{constructor(){super(...arguments);this.completions=new Dt(this),this.messages=new fn(this),this.models=new Ut(this),this.files=new Bt(this),this.skills=new mn(this),this.beta=new sn(this)}}return n.Completions=Dt,n.Messages=fn,n.Models=Ut,n.Files=Bt,n.Skills=mn,n.Beta=sn,n})();function bc(n,s){if(n)return n;if(A("PI_CACHE_RETENTION",s)==="long")return"long";return"short"}function Zu(n,s,t){let i=bc(s,t);if(i==="none")return{retention:i};let c=i==="long"&&gn(n).supportsLongCacheRetention?"1h":void 0;return{retention:i,cacheControl:{type:"ephemeral",...c&&{ttl:c}}}}var ed="2.1.280",td=["Read","Write","Edit","Bash","Grep","Glob","AskUserQuestion","EnterPlanMode","ExitPlanMode","KillShell","NotebookEdit","Skill","Task","TaskOutput","TodoWrite","WebFetch","WebSearch"],rd=new Map(td.map((n)=>[n.toLowerCase(),n])),bo=(n)=>rd.get(n.toLowerCase())??n,nd=(n,s)=>{if(s&&s.length>0){let t=n.toLowerCase(),i=s.find((c)=>c.name.toLowerCase()===t);if(i)return i.name}return n};function sd(n){if(!n.some((c)=>c.type==="image"))return w(n.map((c)=>c.text).join(`
21
- `));let t=n.map((c)=>{if(c.type==="text")return{type:"text",text:w(c.text)};return{type:"image",source:{type:"base64",media_type:c.mimeType,data:c.data}}});if(!t.some((c)=>c.type==="text"))t.unshift({type:"text",text:"(see attached image)"});return t}var id="fine-grained-tool-streaming-2025-05-14",od="interleaved-thinking-2025-05-14",ad="server-side-fallback-2026-07-01",cd="mid-conversation-output-config-2026-07-01",ld="thinking-binding-controls-2026-08-01",ud="inline-tools-2026-09-15",dd={name:"__pi_deferred_placeholder__",description:"Reserved placeholder. Never available. Never call this.",input_schema:{type:"object",properties:{},required:[]},defer_loading:!0};function hd(n){return(n.compat?.allowedFallbackModels?.length??0)>0}function gn(n){let s=n.provider==="openrouter"||n.baseUrl.includes("openrouter.ai");return{supportsEagerToolInputStreaming:n.compat?.supportsEagerToolInputStreaming??!0,supportsLongCacheRetention:n.compat?.supportsLongCacheRetention??!0,sendSessionAffinityHeaders:n.compat?.sendSessionAffinityHeaders??s,sessionAffinityFormat:n.compat?.sessionAffinityFormat??(s?"openrouter":void 0),supportsCacheControlOnTools:n.compat?.supportsCacheControlOnTools??!0,supportsTemperature:n.compat?.supportsTemperature??!0,allowEmptySignature:n.compat?.allowEmptySignature??!1,supportsStrictTools:n.compat?.supportsStrictTools??!1,supportsMidConvoSystemMessages:n.compat?.supportsMidConvoSystemMessages??!1,supportsMidConvoToolChanges:n.compat?.supportsMidConvoToolChanges??!1}}function fd(...n){let s={};for(let t of n)if(t)Object.assign(s,t);return s}function go(...n){return fd({"User-Agent":se()},...n)}function wo(n,s){if(!n)return!1;let t=s.toLowerCase();for(let[i,c]of Object.entries(n))if(i.toLowerCase()===t&&c!==null&&c.trim().length>0)return!0;return!1}function kc(n,s){return!!n||wo(s,"authorization")||wo(s,"x-api-key")||wo(s,"cf-aig-authorization")}function Sc(n,s,t){if(!kc(s,t))throw Error(`No API key for provider: ${n}`)}class _n extends si{_shouldResolveDefaultCredentials(){return!1}}function xc(n,s,t,i){if(n.provider!=="anthropic"||kc(s,t))return;let c=A(Gr,i),l=A(zr,i),d=A(Vr,i);if(!c||!l||!d)return;return{organization_id:l,workspace_id:A(Kr,i),authentication:{type:"oidc_federation",federation_rule_id:c,service_account_id:A(jr,i),identity_token:{source:"file",path:d}}}}var ii,pd=new Set(["message_start","message_delta","message_stop","content_block_start","content_block_delta","content_block_stop"]);function vc(n){if(!n.event&&n.data.length===0)return null;let s={event:n.event,data:n.data.join(`
22
- `),raw:[...n.raw]};return n.event=null,n.data=[],n.raw=[],s}function yo(n,s){if(n==="")return vc(s);if(s.raw.push(n),n.startsWith(":"))return null;let t=n.indexOf(":"),i=t===-1?n:n.slice(0,t),c=t===-1?"":n.slice(t+1);if(c.startsWith(" "))c=c.slice(1);if(i==="event")s.event=c;else if(i==="data")s.data.push(c);return null}function md(n){let s=n.indexOf("\r"),t=n.indexOf(`
23
- `);if(s===-1)return t;if(t===-1)return s;return Math.min(s,t)}function oi(n){let s=md(n);if(s===-1)return null;let t=s+1;if(n[s]==="\r"&&n[t]===`
24
- `)t+=1;return{line:n.slice(0,s),rest:n.slice(t)}}async function*_d(n,s){let t=n.getReader(),i=new TextDecoder,c={event:null,data:[],raw:[]},l="";try{while(!0){if(s?.aborted)throw Error("Request was aborted");let{value:f,done:g}=await t.read();if(g)break;l+=i.decode(f,{stream:!0});let v=oi(l);while(v){l=v.rest;let _=yo(v.line,c);if(_)yield _;v=oi(l)}}l+=i.decode();let d=oi(l);while(d){l=d.rest;let f=yo(d.line,c);if(f)yield f;d=oi(l)}if(l.length>0){let f=yo(l,c);if(f)yield f}let h=vc(c);if(h)yield h}finally{t.releaseLock()}}async function*gd(n,s){if(!n.body)throw Error("Attempted to iterate over an Anthropic response with no body");let t=!1,i=!1;for await(let c of _d(n.body,s)){if(c.event==="error")throw Error(c.data);if(!pd.has(c.event??""))continue;try{let l=wn(c.data);if(l.type==="message_start")t=!0;else if(l.type==="message_stop")i=!0;yield l}catch(l){let d=l instanceof Error?l.message:String(l);throw Error(`Could not parse Anthropic SSE event ${c.event}: ${d}; data=${c.data}; raw=${c.raw.join("\\n")}`)}}if(t&&!i)throw Error("Anthropic stream ended before message_stop")}var lr=(n,s,t)=>{let i=new B,c=ae(s,gn(n).supportsMidConvoSystemMessages),l=ce(c.messages);return(async()=>{let d=n.compat?.supportsMidConvoEffort?t?.effort??"high":void 0,h={role:"assistant",content:[],api:n.api,provider:n.provider,model:n.id,...d===void 0?{}:{providerThinkingLevel:d},usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let f,g,v=n,_;if(t?.client)f=t.client,g=!1;else{let S=t?.apiKey,E=xc(n,S,t?.headers,t?.env);if(!E)Sc(n.provider,S,t?.headers);let b;if(n.provider==="github-copilot"){let V=Tt(c.messages);b=Pt({messages:c.messages,hasImages:V})}let C=bc(t?.cacheRetention,t?.env)==="none"?void 0:t?.sessionId,O=bd(n,S,t?.headers,t?.fetch,b,C,E);f=O.client,g=O.isOAuthToken}let k={...t?.signal?{signal:t.signal}:{},...t?.timeoutMs!==void 0?{timeout:t.timeoutMs}:{},maxRetries:0},y=!1,x;for(;;){t?.signal?.throwIfAborted();let S=Sd(n,c,g,t,y),E=S.params,b=await t?.onPayload?.(E,n);if(b!==void 0)E={...b,stream:!0};try{x=await pe(()=>f.beta.messages.create(E,k).asResponse(),{maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,signal:t?.signal});break}catch(M){if(t?.signal?.aborted||y||!S.hasPreferredStrictTools||!(M instanceof si.APIError)||M.status!==400||M.type!=="invalid_request_error"||!["The compiled grammar is too large","Too many strict tools (","Schemas contains too many parameters with union types ("].some((C)=>M.message.includes(C)))throw M;y=!0,Ie(h,{type:"anthropic_strict_tools_fallback",timestamp:Date.now(),error:{message:M.message},details:{reason:"strict_tool_limits_exceeded"}})}}await t?.onResponse?.({status:x.status,headers:Q(x.headers)},n),i.push({type:"start",partial:h});let P=h.content;for await(let S of gd(x,t?.signal))if(await t?.onProviderStreamEvent?.(S,n),S.type==="message_start"){h.responseId=S.message.id;let E=S.message.input_transformations;if(Array.isArray(E))_=E;let b=S.message.model;if(b!==n.id)h.responseModel=b;let M=b===n.id?void 0:n.compat?.allowedFallbackModels?.find((C)=>C.provider===n.provider&&C.model===b)?.cost;v=M?{...n,id:b,cost:M}:n,h.usage.input=S.message.usage.input_tokens||0,h.usage.output=S.message.usage.output_tokens||0,h.usage.cacheRead=S.message.usage.cache_read_input_tokens||0,h.usage.cacheWrite=S.message.usage.cache_creation_input_tokens||0,h.usage.cacheWrite1h=S.message.usage.cache_creation?.ephemeral_1h_input_tokens||0,h.usage.totalTokens=h.usage.input+h.usage.output+h.usage.cacheRead+h.usage.cacheWrite,Z(v,h.usage)}else if(S.type==="content_block_start"){if(S.content_block.type==="fallback"){if(h.content.length>0)throw Error("Anthropic performed an unsupported mid-output model fallback");continue}if(S.content_block.type==="text"){let E={type:"text",text:S.content_block.text??"",index:S.index};h.content.push(E),i.push({type:"text_start",contentIndex:h.content.length-1,partial:h})}else if(S.content_block.type==="thinking"){let E={type:"thinking",thinking:S.content_block.thinking??"",thinkingSignature:S.content_block.signature??"",index:S.index};h.content.push(E),i.push({type:"thinking_start",contentIndex:h.content.length-1,partial:h})}else if(S.content_block.type==="redacted_thinking"){let E={type:"thinking",thinking:"[Reasoning redacted]",thinkingSignature:S.content_block.data,redacted:!0,index:S.index};h.content.push(E),i.push({type:"thinking_start",contentIndex:h.content.length-1,partial:h})}else if(S.content_block.type==="tool_use"){let E={type:"toolCall",id:S.content_block.id,name:g?nd(S.content_block.name,l):S.content_block.name,arguments:S.content_block.input??{},partialJson:"",index:S.index};h.content.push(E),i.push({type:"toolcall_start",contentIndex:h.content.length-1,partial:h})}}else if(S.type==="content_block_delta"){if(S.delta.type==="text_delta"){let E=P.findIndex((M)=>M.index===S.index),b=P[E];if(b&&b.type==="text")b.text+=S.delta.text,i.push({type:"text_delta",contentIndex:E,delta:S.delta.text,partial:h})}else if(S.delta.type==="thinking_delta"){let E=P.findIndex((M)=>M.index===S.index),b=P[E];if(b&&b.type==="thinking")b.thinking+=S.delta.thinking,i.push({type:"thinking_delta",contentIndex:E,delta:S.delta.thinking,partial:h})}else if(S.delta.type==="input_json_delta"){let E=P.findIndex((M)=>M.index===S.index),b=P[E];if(b&&b.type==="toolCall")b.partialJson+=S.delta.partial_json,b.arguments=z(b.partialJson),i.push({type:"toolcall_delta",contentIndex:E,delta:S.delta.partial_json,partial:h})}else if(S.delta.type==="signature_delta"){let E=P.findIndex((M)=>M.index===S.index),b=P[E];if(b&&b.type==="thinking")b.thinkingSignature=b.thinkingSignature||"",b.thinkingSignature+=S.delta.signature}}else if(S.type==="content_block_stop"){let E=P.findIndex((M)=>M.index===S.index),b=P[E];if(b){if(delete b.index,b.type==="text")i.push({type:"text_end",contentIndex:E,content:b.text,partial:h});else if(b.type==="thinking")i.push({type:"thinking_end",contentIndex:E,content:b.thinking,partial:h});else if(b.type==="toolCall")b.arguments=z(b.partialJson),delete b.partialJson,i.push({type:"toolcall_end",contentIndex:E,toolCall:b,partial:h})}}else if(S.type==="message_delta"){let E=S.input_transformations;if(Array.isArray(E))_=E;if(S.delta.stop_reason){h.rawStopReason=S.delta.stop_reason;let b=Od(S.delta.stop_reason,S.delta.stop_details);if(h.stopReason=b.stopReason,b.errorMessage)h.errorMessage=b.errorMessage}if(S.usage){if(S.usage.input_tokens!=null)h.usage.input=S.usage.input_tokens;if(S.usage.output_tokens!=null)h.usage.output=S.usage.output_tokens;if(S.usage.cache_read_input_tokens!=null)h.usage.cacheRead=S.usage.cache_read_input_tokens;if(S.usage.cache_creation_input_tokens!=null)h.usage.cacheWrite=S.usage.cache_creation_input_tokens;let b=S.usage.cache_creation;if(b?.ephemeral_1h_input_tokens!=null)h.usage.cacheWrite1h=b.ephemeral_1h_input_tokens;let M=S.usage.output_tokens_details?.thinking_tokens;if(M!=null)h.usage.reasoning=M}h.usage.totalTokens=h.usage.input+h.usage.output+h.usage.cacheRead+h.usage.cacheWrite,Z(v,h.usage)}if(t?.signal?.aborted)throw Error("Request was aborted");if(h.stopReason==="pending")throw Error("Anthropic stream ended without a stop reason");if(h.stopReason==="aborted"||h.stopReason==="error")throw Error(h.errorMessage||"An unknown error occurred");if(_&&_.length>0)Ie(h,{type:"anthropic_input_transformations",timestamp:Date.now(),details:{transformations:_.map((S)=>({type:S.type??void 0,path:S.path??void 0,reason:S.reason??void 0}))}});i.push({type:"done",reason:h.stopReason,message:h}),i.end()}catch(f){for(let g of h.content)delete g.index,delete g.partialJson;h.stopReason=t?.signal?.aborted?"aborted":"error",h.errorMessage=f instanceof Error?f.message:JSON.stringify(f),i.push({type:"error",reason:h.stopReason,error:h}),i.end()}})(),i};function wd(n,s){let t=s?n.thinkingLevelMap?.[s]:void 0;if(typeof t==="string")return t;switch(s){case"minimal":case"low":return"low";case"medium":return"medium";case"high":return"high";default:return"high"}}var Bo=(n,s,t)=>{if(!xc(n,t?.apiKey,t?.headers,t?.env))Sc(n.provider,t?.apiKey,t?.headers);let i={...J(n,s,t,t?.apiKey),toolChoice:t?.toolChoice};if(!t?.reasoning)return lr(n,s,{...i,thinkingEnabled:!1});if(n.compat?.forceAdaptiveThinking===!0){let d=wd(n,t.reasoning);return lr(n,s,{...i,thinkingEnabled:!0,effort:d})}let c=en(i.maxTokens,n.maxTokens,t.reasoning,t.thinkingBudgets),l=dr(n,s,c.maxTokens);return lr(n,s,{...i,maxTokens:l,thinkingEnabled:!0,thinkingBudgetTokens:Math.min(c.thinkingBudget,Math.max(0,l-1024))})};function yd(n){return n.includes("sk-ant-oat")}function bd(n,s,t,i,c,l,d){if(n.provider==="github-copilot")return{client:new _n({apiKey:null,authToken:s??null,baseURL:n.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:go({accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},n.headers,c,t)}),isOAuthToken:!1};if(s&&yd(s))return{client:new _n({apiKey:null,authToken:s,baseURL:n.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:go({accept:"application/json","anthropic-dangerous-direct-browser-access":"true","user-agent":`claude-cli/${ed}`,"x-app":"cli"},n.headers,t)}),isOAuthToken:!0};let h=gn(n),f={};if(l&&h.sendSessionAffinityHeaders){let _=h.sessionAffinityFormat==="openrouter"?"x-session-id":"x-session-affinity";f[_]=l}let g=go({accept:"application/json","anthropic-dangerous-direct-browser-access":"true"},f,n.headers,t);if(d){let _=JSON.stringify([n.baseUrl,d]);if(ii?.key!==_||ii.fetch!==i){let k=new _n({apiKey:null,authToken:null,config:d,baseURL:n.baseUrl,dangerouslyAllowBrowser:!0,fetch:i});ii={key:_,fetch:i,client:k}}return{client:ii.client.withOptions({defaultHeaders:g}),isOAuthToken:!1}}return{client:new _n({apiKey:s??null,authToken:null,baseURL:n.baseUrl,dangerouslyAllowBrowser:!0,fetch:i,defaultHeaders:g}),isOAuthToken:!1}}function kd(n,s,t,i,c){let l;for(let h of[n.headers,c?.headers])for(let[f,g]of Object.entries(h??{}))if(f.toLowerCase()==="anthropic-beta")l=g;if(l===null)return[];if(l!==void 0)return[...new Set(l.split(",").map((h)=>h.trim()).filter((h)=>h.length>0))];let d=[];if(t)d.push("claude-code-20250219","oauth-2025-04-20");if(Td(n,s))d.push(id);if(n.reasoning&&c?.thinkingEnabled===!0&&(c.interleavedThinking??!0)&&n.compat?.forceAdaptiveThinking!==!0)d.push(od);if(hd(n))d.push(ad);if(n.compat?.supportsMidConvoEffort===!0)d.push(cd,ld);if(i)d.push(ud);return[...new Set(d)]}function Sd(n,s,t,i,c=!1){let{cacheControl:l}=Zu(n,i?.cacheRetention,i?.env),d=gn(n),h=fe(s.messages),f=h?H(h):"",g=we(s.messages,n,xd),v=h?g.slice(1):g,_=!1,k=(O,V)=>{let F=Cd(O,t,d.supportsEagerToolInputStreaming,d.supportsStrictTools,V,c);if(F.some((G,W)=>{let U=O[W].constrainedSampling;return G.strict===!0&&U&&U.type==="json_schema"&&U.strict==="prefer"}))_=!0;return F},y=h?.toolsAdded??[],x=d.supportsMidConvoSystemMessages&&d.supportsMidConvoToolChanges&&y.length>0,P=Rd(v,t,l,d.allowEmptySignature,n.compat?.supportsMidConvoEffort===!0?n.provider:void 0,x?k:void 0),S=i?.effort??"high",E=kd(n,s,t,x,i),b={model:n.id,messages:n.compat?.supportsMidConvoEffort===!0?Ad(P,S):P.messages,max_tokens:i?.maxTokens??n.maxTokens,stream:!0,...E.length>0?{betas:E}:{}};if(t){if(b.system=[{type:"text",text:"You are Claude Code, Anthropic's official CLI for Claude.",...l?{cache_control:l}:{}}],f)b.system.push({type:"text",text:w(f),...l?{cache_control:l}:{}})}else if(f)b.system=[{type:"text",text:w(f),...l?{cache_control:l}:{}}];if(i?.temperature!==void 0&&!i?.thinkingEnabled&&n.compat?.supportsMidConvoEffort!==!0&&d.supportsTemperature)b.temperature=i.temperature;let M=d.supportsCacheControlOnTools?l:void 0;if(x)b.tools=[...k(y,M),dd];else{let O=ce(s.messages);if(O.length>0)b.tools=k(O,M)}if(n.compat?.supportsMidConvoEffort===!0)b.thinking={type:"adaptive",display:i?.thinkingDisplay??"summarized",block_binding:{prefix_mismatch_behavior:"drop_block"}},b.output_config={effort:"high"};else if(n.reasoning){if(i?.thinkingEnabled){let O=i.thinkingDisplay??"summarized";if(n.compat?.forceAdaptiveThinking===!0){if(b.thinking={type:"adaptive",display:O},i.effort)b.output_config={effort:i.effort}}else b.thinking={type:"enabled",budget_tokens:i.thinkingBudgetTokens||1024,display:O}}else if(i?.thinkingEnabled===!1&&n.thinkingLevelMap?.off!==null)b.thinking={type:"disabled"}}if(i?.metadata){let O=i.metadata.user_id;if(typeof O==="string")b.metadata={user_id:O}}if(i?.toolChoice)if(typeof i.toolChoice==="string")b.tool_choice={type:i.toolChoice};else b.tool_choice=i.toolChoice;let C=n.compat?.allowedFallbackModels;if(C&&C.length>0)b.fallbacks=C.map((O)=>({model:O.model}));return{params:b,hasPreferredStrictTools:_}}function xd(n){return n.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,64)}function vd(n){return{type:"tool_result",tool_use_id:n.toolCallId,content:sd(n.content),is_error:n.isError}}function Rd(n,s,t,i=!1,c,l){let d=[],h=new Map,f=[],g=()=>{d.push(...f),f.length=0};for(let v=0;v<n.length;v++){let _=n[v];if(_.role==="system"){let k=Ue(_),y=[];if(k.length>0)y.push({type:"text",text:w(k)});if(l){let x=_.toolsAdded??[],P=new Set(x.map((S)=>S.name));for(let S of _.toolsRemoved??[]){if(P.has(S.name))continue;y.push({type:"tool_removal",tool:{type:"tool_reference",name:s?bo(S.name):S.name}})}for(let S of l(x))y.push({type:"tool_addition",tool:{type:"tool_definition",definition:S}})}if(y.length>0)f.push({role:"system",content:y})}else if(_.role==="user")if(typeof _.content==="string"){if(_.content.trim().length>0)d.push({role:"user",content:w(_.content)})}else{let y=_.content.map((x)=>{if(x.type==="text")return{type:"text",text:w(x.text)};else return{type:"image",source:{type:"base64",media_type:x.mimeType,data:x.data}}}).filter((x)=>{if(x.type==="text")return x.text.trim().length>0;return!0});if(y.length===0)continue;d.push({role:"user",content:y})}else if(_.role==="assistant"){g();let k=[];for(let x of _.content)if(x.type==="text"){if(x.text.trim().length===0)continue;k.push({type:"text",text:w(x.text)})}else if(x.type==="thinking"){if(x.redacted){k.push({type:"redacted_thinking",data:x.thinkingSignature});continue}let P=x.thinkingSignature,S=!!P&&P.trim().length>0;if(x.thinking.trim().length===0&&!S)continue;if(!S)k.push(i?{type:"thinking",thinking:w(x.thinking),signature:""}:{type:"text",text:w(x.thinking)});else k.push({type:"thinking",thinking:w(x.thinking),signature:P})}else if(x.type==="toolCall")k.push({type:"tool_use",id:x.id,name:s?bo(x.name):x.name,input:x.arguments??{}});if(k.length===0)continue;let y=d.length;if(d.push({role:"assistant",content:k}),c!==void 0&&_.api==="anthropic-messages"&&_.provider===c&&Ed(_.providerThinkingLevel))h.set(y,_.providerThinkingLevel)}else if(_.role==="toolResult"){let k=[],y=v;while(y<n.length&&n[y].role==="toolResult")k.push(vd(n[y])),y++;v=y-1,d.push({role:"user",content:k})}}if(g(),t&&d.length>0){let v=d[d.length-1];if(v.role==="user"||v.role==="system"){if(Array.isArray(v.content)){let _=v.content[v.content.length-1];if(_&&(_.type==="text"||_.type==="image"||_.type==="tool_result"||_.type==="tool_addition"||_.type==="tool_removal"))_.cache_control=t}else if(typeof v.content==="string")v.content=[{type:"text",text:v.content,cache_control:t}]}}return{messages:d,assistantLevels:h}}function Ed(n){return n==="low"||n==="medium"||n==="high"||n==="xhigh"||n==="max"}function Ad(n,s){let t=[];for(let i=0;i<n.messages.length;i++){let c=n.assistantLevels.get(i);if(c!==void 0)t.push({role:"system",content:[],output_config:{effort:c}});t.push(n.messages[i])}return t.push({role:"system",content:[],output_config:{effort:s}}),t}function Td(n,s){return ce(s.messages).length>0&&!gn(n).supportsEagerToolInputStreaming}var Id=new Set(["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","maxItems","uniqueItems","minContains","maxContains","minProperties","maxProperties"]),Pd=new Set(["date-time","time","date","duration","email","hostname","uri","ipv4","ipv6","uuid"]),Md=(n,s)=>{if(Id.has(n))return!0;if(n==="minItems")return s!==0&&s!==1;if(n==="format")return typeof s!=="string"||!Pd.has(s);return!1};function Cd(n,s,t,i,c,l=!1){if(!n)return[];return n.map((d,h)=>{let f=d.constrainedSampling,g=l&&f&&f.type==="json_schema"&&f.strict==="prefer"?void 0:he(d,i,Md),v=Se(d,g),_=v,k={type:"object",properties:_.properties??{},required:_.required??[]},y=g===!0?{...v,...k}:k;return{name:s?bo(d.name):d.name,description:d.description,...t?{eager_input_streaming:!0}:{},...g===!0?{strict:!0}:{},input_schema:y,...c&&h===n.length-1?{cache_control:c}:{}}})}function Od(n,s){switch(n){case"end_turn":return{stopReason:"stop"};case"max_tokens":return{stopReason:"length"};case"tool_use":return{stopReason:"toolUse"};case"refusal":return{stopReason:"error",errorMessage:s?.explanation||"The model refused to complete the request"};case"pause_turn":return{stopReason:"stop"};case"stop_sequence":return{stopReason:"stop"};case"sensitive":return{stopReason:"error",errorMessage:"Provider stopped with: sensitive"};default:throw Error(`Unhandled stop reason: ${n}`)}}
25
- export{o,e,u,sr,Ft,L,be,I,Uo,Un,ar,lr,Bo};
package/chunk-81yk0kj2.js DELETED
@@ -1,3 +0,0 @@
1
- // @bun
2
- import{F,n,l,Y,x,i,s,g,at}from"./chunk-gpympx0t.js";var Vn=100,fr=1e4,a=60000,m=200,t=()=>s(),o=()=>n(x({minimum:1,maximum:fr})),e=()=>n(s({minLength:1,maxLength:128})),r=g([l({click:g([t(),l({selector:t()})])}),l({type:l({label:t(),text:t()})}),l({waitText:t(),timeoutMs:o()}),l({expectText:t(),within:n(t())}),l({waitSelector:t(),timeoutMs:o()}),l({expectCount:l({selector:t(),n:x({minimum:0})})}),l({snapshot:l({selector:t(),depth:n(x({minimum:0,maximum:m}))})}),l({expectCalls:l({onOpen:n(F(t())),onClose:n(x({minimum:0}))})}),l({expectValue:l({label:t(),value:t()})})]),c=l({status:x({minimum:100,maximum:599}),body:Y(),delayMs:n(x({minimum:0,maximum:fr}))}),p=g([i("paths"),i("request"),i("verify"),i("ui_test"),i("list"),i("docs"),i("check"),i("load"),i("reload"),i("enable"),i("disable")]),O=g([i("page"),i("tab"),i("card"),i("sidebar")]),Oi=l({action:p,path:n(s({minLength:1,maxLength:4096})),method:n(t()),body:n(at(t(),Y())),importTimeoutMs:n(x({minimum:1,maximum:fr})),timeoutMs:n(x({minimum:1,maximum:a})),sessionID:e(),scope:n(g([i("user"),i("all")])),id:e(),slot:e(),view:e(),codeBlock:e(),kind:n(O),props:n(at(t(),Y())),context:n(at(t(),Y())),steps:n(F(r,{maxItems:Vn})),mockRoutes:n(at(t(),c)),topic:n(s({maxLength:100})),grep:n(s({minLength:1,maxLength:200}))});
3
- export{Vn,fr,Oi};