@qitqode/qitqode-android-arm64 0.1.23 → 0.1.25

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 (430) hide show
  1. package/bundle/{chunk-hyr049cr.js → chunk-0304b7xg.js} +1 -1
  2. package/bundle/{chunk-ky840wjj.js → chunk-08ba67f4.js} +1 -1
  3. package/bundle/chunk-0eneddjj.js +2 -0
  4. package/bundle/{chunk-mj7rk4xs.js → chunk-0hsb4knd.js} +1 -1
  5. package/bundle/{chunk-k0arcqnt.js → chunk-0jaxgrq0.js} +2 -2
  6. package/bundle/chunk-0ke6x10y.js +5 -0
  7. package/bundle/{chunk-naq602da.js → chunk-0rmmg3g4.js} +1 -1
  8. package/bundle/chunk-0vqrakhw.js +3 -0
  9. package/bundle/{chunk-kn9skc0g.js → chunk-0x7dbj5e.js} +1 -1
  10. package/bundle/{chunk-vay29sqp.js → chunk-0xmx2zfg.js} +1 -1
  11. package/bundle/chunk-0yb4pxjv.js +2 -0
  12. package/bundle/chunk-129kq1w7.js +2 -0
  13. package/bundle/{chunk-2e9a9brg.js → chunk-14qvaxtp.js} +1 -1
  14. package/bundle/chunk-1a5hq7d5.js +2 -0
  15. package/bundle/{chunk-bkaprkf6.js → chunk-1ce5jpdc.js} +1 -1
  16. package/bundle/{chunk-gz8x3915.js → chunk-1e8mja6v.js} +1 -1
  17. package/bundle/{chunk-12cd1yj9.js → chunk-1n1dh6zj.js} +1 -1
  18. package/bundle/{chunk-q1nvfmrm.js → chunk-1txkz6dt.js} +1 -1
  19. package/bundle/chunk-1w3y1dkk.js +2 -0
  20. package/bundle/{chunk-mg03szpz.js → chunk-23f6rc7a.js} +1 -1
  21. package/bundle/chunk-26qt44f1.js +3 -0
  22. package/bundle/{chunk-101y7ce2.js → chunk-2armxd20.js} +1 -1
  23. package/bundle/{chunk-zx90w4mt.js → chunk-2je5tp0x.js} +1 -1
  24. package/bundle/{chunk-9jjjzmvn.js → chunk-2k2axg73.js} +1 -1
  25. package/bundle/chunk-2pkake0h.js +2 -0
  26. package/bundle/{chunk-576zfh1s.js → chunk-2rxt1s22.js} +2 -2
  27. package/bundle/{chunk-xjr0xy58.js → chunk-2s28fdbp.js} +1 -1
  28. package/bundle/{chunk-haw1jzwb.js → chunk-2sy1wx99.js} +1 -1
  29. package/bundle/{chunk-bwgnmy92.js → chunk-2z35ewwc.js} +1 -1
  30. package/bundle/{chunk-y62tnk9q.js → chunk-2zj3h3xj.js} +2 -2
  31. package/bundle/chunk-32188rww.js +2 -0
  32. package/bundle/chunk-334tc1rh.js +2 -0
  33. package/bundle/{chunk-dn1jryxz.js → chunk-3dvyfmgc.js} +1 -1
  34. package/bundle/{chunk-2qy760rf.js → chunk-3e8p4a3y.js} +1 -1
  35. package/bundle/chunk-3f054f69.js +800 -0
  36. package/bundle/chunk-3ff94m8r.js +2 -0
  37. package/bundle/{chunk-3wzpdvpg.js → chunk-3fy57jcy.js} +1 -1
  38. package/bundle/{chunk-hk1ha5fj.js → chunk-3h08jdq8.js} +2 -2
  39. package/bundle/{chunk-44amvtcs.js → chunk-3j7skhxg.js} +2 -2
  40. package/bundle/{chunk-qkn4039t.js → chunk-3jhx8g5d.js} +1 -1
  41. package/bundle/{chunk-rmmyjyr9.js → chunk-3nhth7c2.js} +1 -1
  42. package/bundle/{chunk-b8z4hgq0.js → chunk-3tnek022.js} +1 -1
  43. package/bundle/{chunk-m81z3zgm.js → chunk-3xna2rk5.js} +2 -2
  44. package/bundle/{chunk-an5sr6gw.js → chunk-42t25nkb.js} +1 -1
  45. package/bundle/{chunk-3w60y2x5.js → chunk-453wpzg6.js} +1 -1
  46. package/bundle/chunk-4aqd2bty.js +2 -0
  47. package/bundle/{chunk-y0qaz8db.js → chunk-4kb2efq3.js} +1 -1
  48. package/bundle/{chunk-cbfjjbfd.js → chunk-4pssh5d3.js} +2 -2
  49. package/bundle/{chunk-9yaw0hbp.js → chunk-4stgw33j.js} +1 -1
  50. package/bundle/{chunk-cz8nnm2a.js → chunk-4w5t515p.js} +1 -1
  51. package/bundle/chunk-4wa0gf8y.js +28 -0
  52. package/bundle/{chunk-z1hd38wp.js → chunk-4wgb80jm.js} +2 -2
  53. package/bundle/{chunk-c38ppnm8.js → chunk-4wyjapes.js} +2 -2
  54. package/bundle/chunk-4xg5ptk9.js +2 -0
  55. package/bundle/chunk-54pk7nna.js +3 -0
  56. package/bundle/chunk-58680z2j.js +3 -0
  57. package/bundle/{chunk-2qj66wf5.js → chunk-5mdsrv0a.js} +1 -1
  58. package/bundle/{chunk-2adsn1ca.js → chunk-5mp82az0.js} +1 -1
  59. package/bundle/chunk-5nm36wxa.js +2 -0
  60. package/bundle/{chunk-7bxe5s20.js → chunk-5zw7knvd.js} +1 -1
  61. package/bundle/{chunk-63pvqy8n.js → chunk-61ks7c71.js} +3 -3
  62. package/bundle/chunk-64jet8nc.js +2 -0
  63. package/bundle/chunk-6584d9m8.js +2 -0
  64. package/bundle/chunk-66hv9bbw.js +2 -0
  65. package/bundle/{chunk-qr2ave8f.js → chunk-692vn48b.js} +1 -1
  66. package/bundle/chunk-6a1g6jzn.js +2 -0
  67. package/bundle/chunk-6be8p915.js +2 -0
  68. package/bundle/{chunk-3xf7q4ww.js → chunk-6ddp36ar.js} +1 -1
  69. package/bundle/chunk-6f03158n.js +2 -0
  70. package/bundle/{chunk-yffkcska.js → chunk-6gbaw2pk.js} +1 -1
  71. package/bundle/{chunk-07szgr15.js → chunk-6rrmjrm2.js} +1 -1
  72. package/bundle/{chunk-y2r3zker.js → chunk-6s2f5sv4.js} +1 -1
  73. package/bundle/{chunk-799c17nk.js → chunk-754varfr.js} +2 -2
  74. package/bundle/{chunk-ecczet3b.js → chunk-78h5dd4t.js} +2 -2
  75. package/bundle/{chunk-ejy5404v.js → chunk-7d6jhzng.js} +1 -1
  76. package/bundle/{chunk-kpkbyek5.js → chunk-7fx6x8x9.js} +2 -2
  77. package/bundle/chunk-7jnjttqx.js +2 -0
  78. package/bundle/{chunk-t66hycva.js → chunk-7q5srx7q.js} +2 -2
  79. package/bundle/chunk-7q8pa6s8.js +2 -0
  80. package/bundle/{chunk-36c2avm4.js → chunk-7qvkyjjg.js} +1 -1
  81. package/bundle/{chunk-22tf95dw.js → chunk-7rjf9b8n.js} +2 -2
  82. package/bundle/{chunk-zzdbrxkh.js → chunk-7v4fzkbb.js} +1 -1
  83. package/bundle/chunk-7w84hfxs.js +3 -0
  84. package/bundle/{chunk-g8zrn0at.js → chunk-7ws3gdjq.js} +1 -1
  85. package/bundle/{chunk-my0kzcby.js → chunk-87x607rz.js} +310 -284
  86. package/bundle/{chunk-hnzs3ywg.js → chunk-8ahpk8td.js} +1 -1
  87. package/bundle/{chunk-62yja34m.js → chunk-8atry88r.js} +1 -1
  88. package/bundle/chunk-8casywce.js +2 -0
  89. package/bundle/chunk-8cty50g7.js +2 -0
  90. package/bundle/{chunk-5dpev64z.js → chunk-8gy99gfb.js} +2 -2
  91. package/bundle/chunk-8hxwxt5p.js +2 -0
  92. package/bundle/{chunk-px15ev1g.js → chunk-8jcx4tep.js} +2 -2
  93. package/bundle/chunk-8y8140dm.js +2 -0
  94. package/bundle/{chunk-fhjpfzjc.js → chunk-8za87zkr.js} +1 -1
  95. package/bundle/{chunk-m8njvpb8.js → chunk-99p5m2f1.js} +1 -1
  96. package/bundle/{chunk-c7dt464m.js → chunk-9dpn4792.js} +2 -2
  97. package/bundle/chunk-9dqcyt6x.js +2 -0
  98. package/bundle/{chunk-w6t1qmeg.js → chunk-9f6pqped.js} +1 -1
  99. package/bundle/chunk-9he248a8.js +2 -0
  100. package/bundle/{chunk-3ne6j2h5.js → chunk-9jncnqbj.js} +2 -2
  101. package/bundle/{chunk-mwjhyj53.js → chunk-9jvnc14g.js} +1 -1
  102. package/bundle/chunk-9qmmse2n.js +2 -0
  103. package/bundle/chunk-9r6bvkp4.js +8 -0
  104. package/bundle/chunk-9va5eh9s.js +3 -0
  105. package/bundle/chunk-9w5rx0fb.js +3 -0
  106. package/bundle/{chunk-g5g9r3v5.js → chunk-a27yjp71.js} +1 -1
  107. package/bundle/chunk-aabrsxrq.js +2 -0
  108. package/bundle/{chunk-shav33fq.js → chunk-ag9thqkv.js} +2 -2
  109. package/bundle/chunk-amx3x4kd.js +3 -0
  110. package/bundle/{chunk-863s0tqa.js → chunk-aqm597px.js} +2 -2
  111. package/bundle/chunk-atd0q4v8.js +3 -0
  112. package/bundle/{chunk-58w4dhb6.js → chunk-av290sja.js} +1 -1
  113. package/bundle/chunk-avaba4sr.js +2 -0
  114. package/bundle/{chunk-p33fchnf.js → chunk-aw0q4y3s.js} +1 -1
  115. package/bundle/{chunk-7pr4jxkn.js → chunk-b2xya6pq.js} +1 -1
  116. package/bundle/{chunk-hqv0s6sw.js → chunk-b50t4jc5.js} +1 -1
  117. package/bundle/chunk-bdy1etja.js +2 -0
  118. package/bundle/{chunk-bwvjft74.js → chunk-bnc4626b.js} +1 -1
  119. package/bundle/{chunk-k5294ajv.js → chunk-bpnpxdyv.js} +2 -2
  120. package/bundle/chunk-bqdvqmjc.js +2 -0
  121. package/bundle/chunk-bqs6a1ts.js +14 -0
  122. package/bundle/{chunk-n889mwgv.js → chunk-bsqcfqya.js} +1 -1
  123. package/bundle/{chunk-ntfh16rj.js → chunk-c1ypbbka.js} +2 -2
  124. package/bundle/{chunk-0136n3jt.js → chunk-c27rpvdz.js} +1 -1
  125. package/bundle/chunk-cdws8ggq.js +2 -0
  126. package/bundle/{chunk-5x19yah0.js → chunk-cjxp72dv.js} +2 -2
  127. package/bundle/chunk-cqs9a2cs.js +2 -0
  128. package/bundle/{chunk-b54t7ycj.js → chunk-crap29f6.js} +1 -1
  129. package/bundle/{chunk-b2k9yafd.js → chunk-d0m7nbbx.js} +2 -2
  130. package/bundle/chunk-d0rjst58.js +2 -0
  131. package/bundle/{chunk-y68fp4kt.js → chunk-d1bsxz2t.js} +1 -1
  132. package/bundle/{chunk-2e76kpa6.js → chunk-d5b0bqbr.js} +1 -1
  133. package/bundle/chunk-d833a2fj.js +2 -0
  134. package/bundle/{chunk-mwbcmvmh.js → chunk-dd11kryy.js} +2 -2
  135. package/bundle/chunk-dday4nm2.js +2 -0
  136. package/bundle/{chunk-05badzhy.js → chunk-ddxjc803.js} +2 -2
  137. package/bundle/{chunk-0vhsc0yh.js → chunk-dee1a3yk.js} +2 -2
  138. package/bundle/{chunk-kktcccep.js → chunk-dgggvses.js} +1 -1
  139. package/bundle/{chunk-2es79khv.js → chunk-dk3z4k46.js} +3 -3
  140. package/bundle/{chunk-24r5h0fx.js → chunk-e075v4e9.js} +2 -2
  141. package/bundle/{chunk-m34zrf70.js → chunk-e1pwnf0b.js} +2 -2
  142. package/bundle/chunk-e2sj30hk.js +2 -0
  143. package/bundle/{chunk-t86vj45b.js → chunk-eaatrmcg.js} +1 -1
  144. package/bundle/{chunk-g6gs7cc6.js → chunk-eg7drzzt.js} +1 -1
  145. package/bundle/chunk-enc0fykg.js +2 -0
  146. package/bundle/chunk-evan93av.js +2 -0
  147. package/bundle/{chunk-wk11xsdh.js → chunk-evmfntm3.js} +1 -1
  148. package/bundle/{chunk-jvkqvgae.js → chunk-ey4ktbyb.js} +1 -1
  149. package/bundle/{chunk-fnect0ny.js → chunk-f55txcsa.js} +1 -1
  150. package/bundle/chunk-f600dzsr.js +2 -0
  151. package/bundle/chunk-f6jzwydk.js +2 -0
  152. package/bundle/{chunk-f958hsha.js → chunk-f84cd0a1.js} +2 -2
  153. package/bundle/{chunk-5wr5gpaa.js → chunk-fgw420gb.js} +1 -1
  154. package/bundle/chunk-fv67ng8z.js +2 -0
  155. package/bundle/{chunk-g7g3zm4v.js → chunk-g3s2z5xa.js} +1 -1
  156. package/bundle/{chunk-wmmck56g.js → chunk-g4qwkcdv.js} +1 -1
  157. package/bundle/{chunk-yccm7cfm.js → chunk-g73drh98.js} +3 -3
  158. package/bundle/{chunk-8hh5ejmr.js → chunk-gaen9ya4.js} +2 -2
  159. package/bundle/{chunk-m3gsrb1x.js → chunk-gefh32jb.js} +1 -1
  160. package/bundle/chunk-gevazsx3.js +2 -0
  161. package/bundle/{chunk-tfpwfczs.js → chunk-gfmfrkxc.js} +1 -1
  162. package/bundle/{chunk-ac69b9tm.js → chunk-ggeena9t.js} +1 -1
  163. package/bundle/chunk-gh18pzkx.js +2 -0
  164. package/bundle/chunk-gnvvgr4y.js +2 -0
  165. package/bundle/chunk-grkkzrg1.js +5 -0
  166. package/bundle/chunk-gsbjs2ws.js +2 -0
  167. package/bundle/{chunk-1w8b88y5.js → chunk-gsz1wqy6.js} +1 -1
  168. package/bundle/{chunk-ar1by07g.js → chunk-gvtw9c44.js} +1 -1
  169. package/bundle/chunk-gw0j8hr9.js +3 -0
  170. package/bundle/{chunk-3j6nrrva.js → chunk-h19ty95q.js} +1 -1
  171. package/bundle/{chunk-381j1hqf.js → chunk-h2fh1g8g.js} +1 -1
  172. package/bundle/{chunk-n1m5qdf5.js → chunk-h56jxxvj.js} +1 -1
  173. package/bundle/{chunk-87pzwjjj.js → chunk-hmfefq0d.js} +4 -4
  174. package/bundle/{chunk-g7742sqm.js → chunk-hvpe07pt.js} +1 -1
  175. package/bundle/{chunk-yyarzhw3.js → chunk-hwbxehhf.js} +1 -1
  176. package/bundle/{chunk-agyxa9nj.js → chunk-hznsed5n.js} +2 -2
  177. package/bundle/{chunk-fvwys8ej.js → chunk-j5b5h08g.js} +1 -1
  178. package/bundle/chunk-j7pdz979.js +2 -0
  179. package/bundle/{chunk-9zg3y89v.js → chunk-j9s62g01.js} +2 -2
  180. package/bundle/chunk-jfe2qbv8.js +2 -0
  181. package/bundle/{chunk-1vx26nt2.js → chunk-jgs6ngte.js} +1 -1
  182. package/bundle/{chunk-dsny9dh8.js → chunk-jhq5bvhs.js} +2 -2
  183. package/bundle/{chunk-9n6f9n1c.js → chunk-jq81hb32.js} +2 -2
  184. package/bundle/{chunk-nb0gc3sx.js → chunk-jqzejny3.js} +1 -1
  185. package/bundle/{chunk-t42kh492.js → chunk-jtrcnpm7.js} +2 -2
  186. package/bundle/{chunk-vxc5q0wk.js → chunk-jv98gw88.js} +2 -2
  187. package/bundle/chunk-jvaffe5d.js +10 -0
  188. package/bundle/chunk-k6zvb8xm.js +2 -0
  189. package/bundle/{chunk-erh9y0sx.js → chunk-k8bp3jjv.js} +1 -1
  190. package/bundle/{chunk-q1472d56.js → chunk-kb14wxcs.js} +2 -2
  191. package/bundle/chunk-kcht9kvx.js +2 -0
  192. package/bundle/{chunk-jge74hh4.js → chunk-kdcspxvq.js} +1 -1
  193. package/bundle/{chunk-w6zgm4vn.js → chunk-kdct3e8s.js} +1 -1
  194. package/bundle/{chunk-m8tfv36b.js → chunk-kgsq240v.js} +2 -2
  195. package/bundle/chunk-knvsa1d4.js +2 -0
  196. package/bundle/chunk-kp6d68hd.js +2 -0
  197. package/bundle/{chunk-jq6y56m5.js → chunk-kwm87f18.js} +1 -1
  198. package/bundle/{chunk-29hmwttd.js → chunk-kyny0t2g.js} +2 -2
  199. package/bundle/{chunk-v1hvnq7y.js → chunk-m2ang7yb.js} +1 -1
  200. package/bundle/{chunk-r0sjwtfc.js → chunk-mbh1pdv9.js} +2 -2
  201. package/bundle/{chunk-g2ec45xj.js → chunk-mczw8e3s.js} +2 -2
  202. package/bundle/chunk-me78p9x4.js +2 -0
  203. package/bundle/{chunk-afpwjn78.js → chunk-meaybtcc.js} +3 -3
  204. package/bundle/{chunk-k0v37hc6.js → chunk-mkdyknbz.js} +1 -1
  205. package/bundle/{chunk-fp5mvrrx.js → chunk-mkyrg7gt.js} +2 -2
  206. package/bundle/{chunk-ax9yyznf.js → chunk-mr7agwgn.js} +1 -1
  207. package/bundle/{chunk-9y65kbcf.js → chunk-msm3r7ny.js} +2 -2
  208. package/bundle/chunk-mv1d7wyt.js +2 -0
  209. package/bundle/{chunk-gjsaw7wm.js → chunk-mybpgrjj.js} +2 -2
  210. package/bundle/{chunk-1eg8mr1q.js → chunk-n8dcmjph.js} +1 -1
  211. package/bundle/chunk-n8xmmxh5.js +2 -0
  212. package/bundle/chunk-n90219q9.js +2 -0
  213. package/bundle/chunk-nckg3ydx.js +2 -0
  214. package/bundle/{chunk-apv1v4tk.js → chunk-nf8gkxbk.js} +2 -2
  215. package/bundle/chunk-nhaenjw3.js +2 -0
  216. package/bundle/chunk-nhtrt5ec.js +2 -0
  217. package/bundle/{chunk-sgq94p3x.js → chunk-nhx2xp2x.js} +1 -1
  218. package/bundle/{chunk-mt8btwrv.js → chunk-nmnsf3fc.js} +1 -1
  219. package/bundle/{chunk-wf2mj6de.js → chunk-nqefvn28.js} +1 -1
  220. package/bundle/{chunk-kdr6nxmk.js → chunk-p409grvp.js} +2 -2
  221. package/bundle/chunk-p72n0tfq.js +2 -0
  222. package/bundle/{chunk-rwanncah.js → chunk-p80dc6kt.js} +2 -2
  223. package/bundle/{chunk-z65snfyw.js → chunk-p883sz67.js} +1 -1
  224. package/bundle/{chunk-eqed7tvt.js → chunk-p8enedkf.js} +1 -1
  225. package/bundle/chunk-pd33qvr0.js +2 -0
  226. package/bundle/chunk-pepn5jp4.js +3 -0
  227. package/bundle/chunk-pf7cj4jd.js +3 -0
  228. package/bundle/{chunk-q6x5bmc3.js → chunk-pfn1db1m.js} +2 -2
  229. package/bundle/{chunk-xtj5qqsw.js → chunk-pk0tytcm.js} +1 -1
  230. package/bundle/chunk-pq3622ae.js +2 -0
  231. package/bundle/{chunk-26m5yn5d.js → chunk-psveqqv2.js} +1 -1
  232. package/bundle/{chunk-w8r4gjea.js → chunk-pvee151a.js} +1 -1
  233. package/bundle/chunk-qatj4h6b.js +2 -0
  234. package/bundle/{chunk-cwkdc1cc.js → chunk-qdnxv55k.js} +1 -1
  235. package/bundle/{chunk-s75chpxq.js → chunk-qe0sfafy.js} +2 -2
  236. package/bundle/chunk-qfz0a58d.js +2 -0
  237. package/bundle/chunk-qjwfj51e.js +2 -0
  238. package/bundle/chunk-qkg73rs9.js +2 -0
  239. package/bundle/{chunk-7b69jj5g.js → chunk-qm9ezq93.js} +1 -1
  240. package/bundle/{chunk-hvcdemxe.js → chunk-qnqqrvvs.js} +2 -2
  241. package/bundle/{chunk-bqeyh2gx.js → chunk-qnv2v02g.js} +2 -2
  242. package/bundle/{chunk-kfdqfha0.js → chunk-qpm5afdz.js} +1 -1
  243. package/bundle/chunk-qvcfst7n.js +11 -0
  244. package/bundle/{chunk-xqzbcs8x.js → chunk-rgecc41f.js} +2 -2
  245. package/bundle/chunk-rjcptzem.js +8 -0
  246. package/bundle/{chunk-k1ht1sjr.js → chunk-rjf21v5c.js} +1 -1
  247. package/bundle/chunk-rmsqb6r4.js +10 -0
  248. package/bundle/{chunk-dq1wprmb.js → chunk-rq4hqwjy.js} +1 -1
  249. package/bundle/chunk-rqrpbcm6.js +2 -0
  250. package/bundle/{chunk-kbhby60s.js → chunk-rs1mm5ef.js} +1 -1
  251. package/bundle/{chunk-jj7wrfty.js → chunk-rze20q68.js} +1 -1
  252. package/bundle/chunk-s76hdgw6.js +2 -0
  253. package/bundle/chunk-s7vhjg9e.js +2 -0
  254. package/bundle/{chunk-88kt6qmd.js → chunk-se79ke63.js} +2 -2
  255. package/bundle/chunk-sec3a60m.js +2 -0
  256. package/bundle/chunk-sjnt5e6w.js +2 -0
  257. package/bundle/chunk-sntb757q.js +2 -0
  258. package/bundle/chunk-svscftd7.js +2 -0
  259. package/bundle/chunk-sx0cabcs.js +2 -0
  260. package/bundle/{chunk-6j07cgna.js → chunk-sx5m81em.js} +1 -1
  261. package/bundle/{chunk-yr4evt94.js → chunk-syhay5ye.js} +1 -1
  262. package/bundle/{chunk-5d18fd4p.js → chunk-t07a5431.js} +1 -1
  263. package/bundle/{chunk-hs8qwx4n.js → chunk-t0amhhsk.js} +1 -1
  264. package/bundle/{chunk-70gfpkxv.js → chunk-t2tsyazc.js} +1 -1
  265. package/bundle/{chunk-7m4camry.js → chunk-tdmaxc6n.js} +1 -1
  266. package/bundle/{chunk-y2h0adg5.js → chunk-tf1me2r4.js} +3 -3
  267. package/bundle/{chunk-cn7nnjsf.js → chunk-tfggzzqw.js} +1 -1
  268. package/bundle/chunk-tmdm6vm6.js +2 -0
  269. package/bundle/{chunk-qx9j6nz1.js → chunk-v4xgceeq.js} +1 -1
  270. package/bundle/chunk-v6g0ksks.js +2 -0
  271. package/bundle/chunk-v7ah9gg0.js +3 -0
  272. package/bundle/{chunk-g0vzdt58.js → chunk-vb4e7y4d.js} +1 -1
  273. package/bundle/chunk-vbf73c7z.js +2 -0
  274. package/bundle/chunk-vbf9jpas.js +2 -0
  275. package/bundle/{chunk-5vyper2h.js → chunk-veev25yg.js} +1 -1
  276. package/bundle/{chunk-sjqgmp12.js → chunk-vfj5nwab.js} +2 -2
  277. package/bundle/{chunk-a3te67a5.js → chunk-vmgknvxs.js} +2 -2
  278. package/bundle/{chunk-agx5m1ev.js → chunk-vq6bh2z9.js} +1 -1
  279. package/bundle/{chunk-7n994qss.js → chunk-vqq5vmh1.js} +222 -222
  280. package/bundle/chunk-vrcf5q4s.js +2 -0
  281. package/bundle/chunk-vxrsp6n7.js +2 -0
  282. package/bundle/chunk-w8ax3pvh.js +2 -0
  283. package/bundle/chunk-w98r39gd.js +9 -0
  284. package/bundle/chunk-wb69d52j.js +3 -0
  285. package/bundle/{chunk-39h565hz.js → chunk-wmrq9qqf.js} +1 -1
  286. package/bundle/{chunk-8k4mkrdw.js → chunk-wrgg270f.js} +1 -1
  287. package/bundle/{chunk-w32tj884.js → chunk-ww8ear80.js} +2 -2
  288. package/bundle/{chunk-zeh3mjgp.js → chunk-x36jhtex.js} +1 -1
  289. package/bundle/{chunk-7tthc48p.js → chunk-x6b99nt3.js} +1 -1
  290. package/bundle/{chunk-k3pvgwgc.js → chunk-xdde80rf.js} +2 -2
  291. package/bundle/{chunk-ypff4a5n.js → chunk-xjrt0dta.js} +1 -1
  292. package/bundle/chunk-xk2cmh49.js +2 -0
  293. package/bundle/{chunk-3w9k7yxx.js → chunk-xqa6qkx2.js} +1 -1
  294. package/bundle/{chunk-scb48j07.js → chunk-xw283h2r.js} +2 -2
  295. package/bundle/{chunk-qzd0q1jg.js → chunk-xy4t5qf8.js} +1 -1
  296. package/bundle/{chunk-8e2wwdgb.js → chunk-xyn3xxfs.js} +1 -1
  297. package/bundle/chunk-xzhkfctf.js +2 -0
  298. package/bundle/chunk-y0xt5a6g.js +2 -0
  299. package/bundle/{chunk-26mt118z.js → chunk-ybn8tb09.js} +1 -1
  300. package/bundle/chunk-ydmrvx7q.js +2 -0
  301. package/bundle/{chunk-9tq5yt3t.js → chunk-ydsen7w0.js} +1 -1
  302. package/bundle/{chunk-0svy8w30.js → chunk-yhqk8bzk.js} +2 -2
  303. package/bundle/{chunk-shxny9x9.js → chunk-ykfq8bem.js} +1 -1
  304. package/bundle/{chunk-22vvjp4g.js → chunk-ym4ydwrz.js} +2 -2
  305. package/bundle/{chunk-1gg4c0pq.js → chunk-yzchwmb4.js} +1 -1
  306. package/bundle/{chunk-3cpqdake.js → chunk-z015twaq.js} +2 -2
  307. package/bundle/chunk-z2rtcgad.js +3 -0
  308. package/bundle/{chunk-c546xxjk.js → chunk-z3zx6g09.js} +1 -1
  309. package/bundle/chunk-z9b3t2jm.js +2 -0
  310. package/bundle/{chunk-brrtcqrc.js → chunk-zbdbsagd.js} +2 -2
  311. package/bundle/{chunk-y3qf1kg9.js → chunk-zh808d4t.js} +1 -1
  312. package/bundle/{chunk-7tb9fjvq.js → chunk-zny2qaqa.js} +2 -2
  313. package/bundle/{chunk-gzse9pab.js → chunk-zsnbxsdx.js} +2 -2
  314. package/bundle/{chunk-w9vv1whr.js → chunk-zss93r48.js} +1 -1
  315. package/bundle/chunk-zzr8smtm.js +2 -0
  316. package/bundle/index.js +16 -16
  317. package/bundle/parser.worker.js +2 -2
  318. package/bundle/worker.js +1 -1
  319. package/package.json +1 -1
  320. package/bundle/chunk-1by6y9tm.js +0 -2
  321. package/bundle/chunk-1gjh45v5.js +0 -9
  322. package/bundle/chunk-1p7wqmxp.js +0 -2
  323. package/bundle/chunk-1v47v7vm.js +0 -3
  324. package/bundle/chunk-21hnx8rx.js +0 -24
  325. package/bundle/chunk-22pvftx8.js +0 -2
  326. package/bundle/chunk-2bce1njy.js +0 -2
  327. package/bundle/chunk-2wcwbp3t.js +0 -799
  328. package/bundle/chunk-338hbnza.js +0 -11
  329. package/bundle/chunk-3gsvbfqz.js +0 -2
  330. package/bundle/chunk-3sem578c.js +0 -3
  331. package/bundle/chunk-3vgnqaem.js +0 -2
  332. package/bundle/chunk-3xrhxyz9.js +0 -2
  333. package/bundle/chunk-3zdyrnvp.js +0 -2
  334. package/bundle/chunk-4nhbgva1.js +0 -2
  335. package/bundle/chunk-5ch23jj3.js +0 -2
  336. package/bundle/chunk-5hzkd9te.js +0 -2
  337. package/bundle/chunk-5vwhfa42.js +0 -2
  338. package/bundle/chunk-662x3gq6.js +0 -2
  339. package/bundle/chunk-6an0pk19.js +0 -2
  340. package/bundle/chunk-6ybqwnp7.js +0 -2
  341. package/bundle/chunk-7365jzj1.js +0 -2
  342. package/bundle/chunk-7amvpgng.js +0 -2
  343. package/bundle/chunk-7dcz5ytp.js +0 -2
  344. package/bundle/chunk-7h7bwjmm.js +0 -2
  345. package/bundle/chunk-7vk5fhhv.js +0 -2
  346. package/bundle/chunk-7vqw9wge.js +0 -2
  347. package/bundle/chunk-7vxk5t11.js +0 -2
  348. package/bundle/chunk-83fm5xcn.js +0 -2
  349. package/bundle/chunk-8b644ae2.js +0 -2
  350. package/bundle/chunk-av2q0ffj.js +0 -2
  351. package/bundle/chunk-avk3wfch.js +0 -7
  352. package/bundle/chunk-azna4wdf.js +0 -2
  353. package/bundle/chunk-b192q4m0.js +0 -2
  354. package/bundle/chunk-bh46627y.js +0 -2
  355. package/bundle/chunk-c267ggx2.js +0 -2
  356. package/bundle/chunk-c4x99ayd.js +0 -11
  357. package/bundle/chunk-c6kxegws.js +0 -2
  358. package/bundle/chunk-cek3cfz4.js +0 -2
  359. package/bundle/chunk-ete0y35c.js +0 -2
  360. package/bundle/chunk-f1mmzzsn.js +0 -2
  361. package/bundle/chunk-f66cvq2q.js +0 -2
  362. package/bundle/chunk-fd1vbz1f.js +0 -3
  363. package/bundle/chunk-febbrhev.js +0 -3
  364. package/bundle/chunk-fq4v97xn.js +0 -2
  365. package/bundle/chunk-fw1f6br4.js +0 -2
  366. package/bundle/chunk-fzzze6zd.js +0 -5
  367. package/bundle/chunk-g3pb8rad.js +0 -2
  368. package/bundle/chunk-g6tw5dvr.js +0 -14
  369. package/bundle/chunk-gc1yetqd.js +0 -2
  370. package/bundle/chunk-gtckkn15.js +0 -2
  371. package/bundle/chunk-gtzreftf.js +0 -2
  372. package/bundle/chunk-hg7kfd0t.js +0 -3
  373. package/bundle/chunk-j5vahbw1.js +0 -2
  374. package/bundle/chunk-jazpapb9.js +0 -3
  375. package/bundle/chunk-jek1cnfk.js +0 -3
  376. package/bundle/chunk-jevrajsx.js +0 -2
  377. package/bundle/chunk-jzdks7bv.js +0 -2
  378. package/bundle/chunk-k1e7w7w5.js +0 -2
  379. package/bundle/chunk-k33xx2z9.js +0 -2
  380. package/bundle/chunk-k6vf6vq6.js +0 -2
  381. package/bundle/chunk-kn391hb2.js +0 -2
  382. package/bundle/chunk-knmba0q6.js +0 -2
  383. package/bundle/chunk-knnemqfm.js +0 -3
  384. package/bundle/chunk-kx4b39v6.js +0 -2
  385. package/bundle/chunk-mah572rs.js +0 -2
  386. package/bundle/chunk-mg6nwfw3.js +0 -2
  387. package/bundle/chunk-pdgrang4.js +0 -2
  388. package/bundle/chunk-r3q82hz3.js +0 -2
  389. package/bundle/chunk-r4ygs0jv.js +0 -2
  390. package/bundle/chunk-r6xhxvjv.js +0 -2
  391. package/bundle/chunk-r79mz5kd.js +0 -5
  392. package/bundle/chunk-r99pnfra.js +0 -2
  393. package/bundle/chunk-rjjgnvdk.js +0 -2
  394. package/bundle/chunk-rq4xdyst.js +0 -2
  395. package/bundle/chunk-rsd3v7cg.js +0 -2
  396. package/bundle/chunk-rxsgbdv0.js +0 -2
  397. package/bundle/chunk-s4x1jhj3.js +0 -2
  398. package/bundle/chunk-s7sksztt.js +0 -3
  399. package/bundle/chunk-sx760d9d.js +0 -2
  400. package/bundle/chunk-tmjd3evp.js +0 -8
  401. package/bundle/chunk-tp1d856p.js +0 -2
  402. package/bundle/chunk-tpxs00p5.js +0 -2
  403. package/bundle/chunk-tqk12r89.js +0 -2
  404. package/bundle/chunk-tycgrqgq.js +0 -2
  405. package/bundle/chunk-tydvpy1s.js +0 -3
  406. package/bundle/chunk-tz8qhbk9.js +0 -3
  407. package/bundle/chunk-v1y3pbfv.js +0 -2
  408. package/bundle/chunk-v32cyrg2.js +0 -2
  409. package/bundle/chunk-v7pypmvk.js +0 -2
  410. package/bundle/chunk-vbqyddy8.js +0 -2
  411. package/bundle/chunk-vgx86f2r.js +0 -2
  412. package/bundle/chunk-w0jvqdez.js +0 -2
  413. package/bundle/chunk-w79yek40.js +0 -2
  414. package/bundle/chunk-w7nxsfbd.js +0 -3
  415. package/bundle/chunk-wcea06cr.js +0 -2
  416. package/bundle/chunk-wcx4bbvn.js +0 -2
  417. package/bundle/chunk-wdw183vh.js +0 -2
  418. package/bundle/chunk-wqd3svh6.js +0 -2
  419. package/bundle/chunk-wqe5spdq.js +0 -2
  420. package/bundle/chunk-wqww2byk.js +0 -2
  421. package/bundle/chunk-wybd806z.js +0 -2
  422. package/bundle/chunk-x1vb00hr.js +0 -2
  423. package/bundle/chunk-xafh07r3.js +0 -2
  424. package/bundle/chunk-xgzjcsad.js +0 -2
  425. package/bundle/chunk-xn0xhd0w.js +0 -3
  426. package/bundle/chunk-xnbfy5jy.js +0 -2
  427. package/bundle/chunk-xxed39zx.js +0 -3
  428. package/bundle/chunk-y6pzag4n.js +0 -2
  429. package/bundle/chunk-y7w6fjwt.js +0 -2
  430. package/bundle/chunk-z195gv71.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Aq as IG,Bq as RG,Dq as xG,Ep as g,Gp as FG,Ip as NG,Kp as wG,Lp as QG,Mp as SG,Up as $G,Zp as OG,_p as XG,bq as fG,fq as v,iq as k,jq as s,mq as CG,pq as p,qq as u,vq as _,xq as yG,yq as YG,zq as d}from"./chunk-fp5mvrrx.js";import{Fq as l,Gq as GG,Pq as BG,Sq as c}from"./chunk-zzdbrxkh.js";import"./chunk-cqtkxwd8.js";import"./chunk-xtj5qqsw.js";import{Eu as G}from"./chunk-22vvjp4g.js";import"./chunk-a3te67a5.js";import"./chunk-naq602da.js";function vG(J){var D;let L=[],q=[];for(let{role:K,content:z}of J)switch(K){case"system":{L.push({role:"system",content:z});break}case"user":{if(z.length===1&&z[0].type==="text"){L.push({role:"user",content:z[0].text});break}L.push({role:"user",content:z.map((A)=>{switch(A.type){case"text":return{type:"text",text:A.text};case"file":if(A.mediaType.startsWith("image/")){let Y=A.mediaType==="image/*"?"image/jpeg":A.mediaType;return{type:"image_url",image_url:{url:A.data instanceof URL?A.data.toString():`data:${Y};base64,${QG(A.data)}`}}}else throw new c({functionality:`file part media type ${A.mediaType}`})}})});break}case"assistant":{let A="",Y=[];for(let X of z)switch(X.type){case"text":{A+=X.text;break}case"tool-call":{Y.push({id:X.toolCallId,type:"function",function:{name:X.toolName,arguments:JSON.stringify(X.input)}});break}}L.push({role:"assistant",content:A,tool_calls:Y.length>0?Y:void 0});break}case"tool":{for(let A of z){if(A.type==="tool-approval-response")continue;let Y=A.output,X;switch(Y.type){case"text":case"error-text":X=Y.value;break;case"execution-denied":X=(D=Y.reason)!=null?D:"Tool execution denied.";break;case"content":case"json":case"error-json":X=JSON.stringify(Y.value);break}L.push({role:"tool",tool_call_id:A.toolCallId,content:X})}break}default:throw Error(`Unsupported role: ${K}`)}return{messages:L,warnings:q}}function EG(J){var D,L,q,K;let z=(L=(D=J.prompt_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.completion_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.prompt_tokens;return{inputTokens:{total:Y?J.prompt_tokens:J.prompt_tokens+z,noCache:Y?J.prompt_tokens-z:J.prompt_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.completion_tokens+A,text:J.completion_tokens,reasoning:A},raw:J}}function JG({id:J,model:D,created:L,created_at:q}){let K=L!=null?L:q;return{id:J!=null?J:void 0,modelId:D!=null?D:void 0,timestamp:K!=null?new Date(K*1000):void 0}}function WG(J){switch(J){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var kG=G.object({type:G.literal("web"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),allowedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),bG=G.object({type:G.literal("x"),excludedXHandles:G.array(G.string()).optional(),includedXHandles:G.array(G.string()).optional(),postFavoriteCount:G.number().int().optional(),postViewCount:G.number().int().optional(),xHandles:G.array(G.string()).optional()}),hG=G.object({type:G.literal("news"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),_G=G.object({type:G.literal("rss"),links:G.array(G.string().url()).max(1)}),mG=G.discriminatedUnion("type",[kG,bG,hG,_G]),gG=G.object({reasoningEffort:G.enum(["low","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),parallel_function_calling:G.boolean().optional(),searchParameters:G.object({mode:G.enum(["off","auto","on"]),returnCitations:G.boolean().optional(),fromDate:G.string().optional(),toDate:G.string().optional(),maxSearchResults:G.number().min(1).max(50).optional(),sources:G.array(mG).optional()}).optional()}),uG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),r=yG({errorSchema:uG,errorToMessage:(J)=>J.error.message});function dG({tools:J,toolChoice:D}){J=(J==null?void 0:J.length)?J:void 0;let L=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:L};let q=[];for(let z of J)if(z.type==="provider")L.push({type:"unsupported",feature:`provider-defined tool ${z.name}`});else q.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(D==null)return{tools:q,toolChoice:void 0,toolWarnings:L};let K=D.type;switch(K){case"auto":case"none":return{tools:q,toolChoice:K,toolWarnings:L};case"required":return{tools:q,toolChoice:"required",toolWarnings:L};case"tool":return{tools:q,toolChoice:{type:"function",function:{name:D.toolName}},toolWarnings:L};default:throw new c({functionality:`tool choice type: ${K}`})}}var cG=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,topK:K,frequencyPenalty:z,presencePenalty:A,stopSequences:Y,seed:X,responseFormat:Z,providerOptions:M,tools:E,toolChoice:F}){var B,R,N;let $=[],W=(B=await p({provider:"xai",providerOptions:M,schema:gG}))!=null?B:{};if(K!=null)$.push({type:"unsupported",feature:"topK"});if(z!=null)$.push({type:"unsupported",feature:"frequencyPenalty"});if(A!=null)$.push({type:"unsupported",feature:"presencePenalty"});if(Y!=null)$.push({type:"unsupported",feature:"stopSequences"});let{messages:H,warnings:O}=vG(J);$.push(...O);let{tools:C,toolChoice:w,toolWarnings:j}=dG({tools:E,toolChoice:F});return $.push(...j),{args:{model:this.modelId,logprobs:W.logprobs===!0||W.topLogprobs!=null?!0:void 0,top_logprobs:W.topLogprobs,max_completion_tokens:D,temperature:L,top_p:q,seed:X,reasoning_effort:W.reasoningEffort,parallel_function_calling:W.parallel_function_calling,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{name:(R=Z.name)!=null?R:"response",schema:Z.schema,strict:!0}}:{type:"json_object"}:void 0,search_parameters:W.searchParameters?{mode:W.searchParameters.mode,return_citations:W.searchParameters.returnCitations,from_date:W.searchParameters.fromDate,to_date:W.searchParameters.toDate,max_search_results:W.searchParameters.maxSearchResults,sources:(N=W.searchParameters.sources)==null?void 0:N.map((S)=>{var h;return{type:S.type,...S.type==="web"&&{country:S.country,excluded_websites:S.excludedWebsites,allowed_websites:S.allowedWebsites,safe_search:S.safeSearch},...S.type==="x"&&{excluded_x_handles:S.excludedXHandles,included_x_handles:(h=S.includedXHandles)!=null?h:S.xHandles,post_favorite_count:S.postFavoriteCount,post_view_count:S.postViewCount},...S.type==="news"&&{country:S.country,excluded_websites:S.excludedWebsites,safe_search:S.safeSearch},...S.type==="rss"&&{links:S.links}}})}:void 0,messages:H,tools:C,tool_choice:w},warnings:$}}async doGenerate(J){var D,L;let{args:q,warnings:K}=await this.getArgs(J),z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y,rawValue:X}=await u({url:z,headers:g(this.config.headers(),J.headers),body:q,failedResponseHandler:r,successfulResponseHandler:d(pG),abortSignal:J.abortSignal,fetch:this.config.fetch});if(Y.error!=null)throw new GG({message:Y.error,url:z,requestBodyValues:q,statusCode:200,responseHeaders:A,responseBody:JSON.stringify(X),isRetryable:Y.code==="The service is currently unavailable"});let Z=Y.choices[0],M=[];if(Z.message.content!=null&&Z.message.content.length>0){let E=Z.message.content,F=q.messages[q.messages.length-1];if((F==null?void 0:F.role)==="assistant"&&E===F.content)E="";if(E.length>0)M.push({type:"text",text:E})}if(Z.message.reasoning_content!=null&&Z.message.reasoning_content.length>0)M.push({type:"reasoning",text:Z.message.reasoning_content});if(Z.message.tool_calls!=null)for(let E of Z.message.tool_calls)M.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});if(Y.citations!=null)for(let E of Y.citations)M.push({type:"source",sourceType:"url",id:this.config.generateId(),url:E});return{content:M,finishReason:{unified:WG(Z.finish_reason),raw:(L=Z.finish_reason)!=null?L:void 0},usage:Y.usage?EG(Y.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:q},response:{...JG(Y),headers:A,body:X},warnings:K}}async doStream(J){var D;let{args:L,warnings:q}=await this.getArgs(J),K={...L,stream:!0,stream_options:{include_usage:!0}},z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y}=await u({url:z,headers:g(this.config.headers(),J.headers),body:K,failedResponseHandler:r,successfulResponseHandler:async({response:N})=>{let $=NG(N),W=N.headers.get("content-type");if(W==null?void 0:W.includes("application/json")){let H=await N.text(),O=await CG({text:H,schema:lG});if(O.success)throw new GG({message:O.value.error,url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H,isRetryable:O.value.code==="The service is currently unavailable"});throw new GG({message:"Invalid JSON response",url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H})}return YG(iG)({response:N,url:z,requestBodyValues:K})},abortSignal:J.abortSignal,fetch:this.config.fetch}),X={unified:"other",raw:void 0},Z=void 0,M=!0,E={},F={},B=void 0,R=this;return{stream:Y.pipeThrough(new TransformStream({start(N){N.enqueue({type:"stream-start",warnings:q})},transform(N,$){if(J.includeRawChunks)$.enqueue({type:"raw",rawValue:N.rawValue});if(!N.success){$.enqueue({type:"error",error:N.error});return}let W=N.value;if(M)$.enqueue({type:"response-metadata",...JG(W)}),M=!1;if(W.citations!=null)for(let w of W.citations)$.enqueue({type:"source",sourceType:"url",id:R.config.generateId(),url:w});if(W.usage!=null)Z=EG(W.usage);let H=W.choices[0];if((H==null?void 0:H.finish_reason)!=null)X={unified:WG(H.finish_reason),raw:H.finish_reason};if((H==null?void 0:H.delta)==null)return;let{delta:O,index:C}=H;if(O.content!=null&&O.content.length>0){let w=O.content;if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;let j=K.messages[K.messages.length-1];if((j==null?void 0:j.role)==="assistant"&&w===j.content)return;let y=`text-${W.id||C}`;if(E[y]==null)E[y]={type:"text",ended:!1},$.enqueue({type:"text-start",id:y});$.enqueue({type:"text-delta",id:y,delta:w})}if(O.reasoning_content!=null&&O.reasoning_content.length>0){let w=`reasoning-${W.id||C}`;if(F[w]===O.reasoning_content)return;if(F[w]=O.reasoning_content,E[w]==null)E[w]={type:"reasoning",ended:!1},B=w,$.enqueue({type:"reasoning-start",id:w});$.enqueue({type:"reasoning-delta",id:w,delta:O.reasoning_content})}if(O.tool_calls!=null){if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;for(let w of O.tool_calls){let j=w.id;$.enqueue({type:"tool-input-start",id:j,toolName:w.function.name}),$.enqueue({type:"tool-input-delta",id:j,delta:w.function.arguments}),$.enqueue({type:"tool-input-end",id:j}),$.enqueue({type:"tool-call",toolCallId:j,toolName:w.function.name,input:w.function.arguments})}}},flush(N){for(let[$,W]of Object.entries(E))if(!W.ended)N.enqueue({type:W.type==="text"?"text-end":"reasoning-end",id:$});N.enqueue({type:"finish",finishReason:X,usage:Z!=null?Z:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:K},response:{headers:A}}}},TG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({text_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),image_tokens:G.number().nullish(),cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}),pG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant"),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),index:G.number(),finish_reason:G.string().nullish()})).nullish(),object:G.literal("chat.completion").nullish(),usage:TG.nullish(),citations:G.array(G.string().url()).nullish(),code:G.string().nullish(),error:G.string().nullish()}),iG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).optional(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:TG.nullish(),citations:G.array(G.string().url()).nullish()}),lG=G.object({code:G.string(),error:G.string()}),rG=G.object({aspect_ratio:G.string().optional(),output_format:G.string().optional(),sync_mode:G.boolean().optional(),resolution:G.enum(["1k","2k"]).optional(),quality:G.enum(["low","medium","high"]).optional(),user:G.string().optional()}),aG=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxImagesPerCall=3}get provider(){return this.config.provider}async doGenerate({prompt:J,n:D,size:L,aspectRatio:q,seed:K,providerOptions:z,headers:A,abortSignal:Y,files:X,mask:Z}){var M,E,F,B,R;let N=[];if(L!=null)N.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(K!=null)N.push({type:"unsupported",feature:"seed"});if(Z!=null)N.push({type:"unsupported",feature:"mask"});let $=await p({provider:"xai",providerOptions:z,schema:rG}),W=X!=null&&X.length>0,H=W?X.map((I)=>SG(I)):[],O=W?"/images/edits":"/images/generations",C={model:this.modelId,prompt:J,n:D,response_format:"b64_json"};if(q!=null)C.aspect_ratio=q;if(($==null?void 0:$.output_format)!=null)C.output_format=$.output_format;if(($==null?void 0:$.sync_mode)!=null)C.sync_mode=$.sync_mode;if(($==null?void 0:$.aspect_ratio)!=null&&q==null)C.aspect_ratio=$.aspect_ratio;if(($==null?void 0:$.resolution)!=null)C.resolution=$.resolution;if(($==null?void 0:$.quality)!=null)C.quality=$.quality;if(($==null?void 0:$.user)!=null)C.user=$.user;if(H.length===1)C.image={url:H[0],type:"image_url"};else if(H.length>1)C.images=H.map((I)=>({url:I,type:"image_url"}));let w=(M=this.config.baseURL)!=null?M:"https://api.x.ai/v1",j=(B=(F=(E=this.config._internal)==null?void 0:E.currentDate)==null?void 0:F.call(E))!=null?B:new Date,{value:y,responseHeaders:S}=await u({url:`${w}${O}`,headers:g(this.config.headers(),A),body:C,failedResponseHandler:r,successfulResponseHandler:d(nG),abortSignal:Y,fetch:this.config.fetch});return{images:y.data.every((I)=>I.b64_json!=null)?y.data.map((I)=>I.b64_json):await Promise.all(y.data.map((I)=>this.downloadImage(I.url,Y))),warnings:N,response:{timestamp:j,modelId:this.modelId,headers:S},providerMetadata:{xai:{images:y.data.map((I)=>({...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{}})),...((R=y.usage)==null?void 0:R.cost_in_usd_ticks)!=null?{costInUsdTicks:y.usage.cost_in_usd_ticks}:{}}}}}async downloadImage(J,D){let{value:L}=await XG({url:J,abortSignal:D,failedResponseHandler:RG(),successfulResponseHandler:IG(),fetch:this.config.fetch});return L}},nG=G.object({data:G.array(G.object({url:G.string().nullish(),b64_json:G.string().nullish(),revised_prompt:G.string().nullish()})),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish()});async function sG({prompt:J}){var D,L,q,K,z;let A=[],Y=[];for(let X of J)switch(X.role){case"system":{A.push({role:"system",content:X.content});break}case"user":{let Z=[];for(let M of X.content)switch(M.type){case"text":{Z.push({type:"input_text",text:M.text});break}case"file":{if(M.mediaType.startsWith("image/")){let E=M.mediaType==="image/*"?"image/jpeg":M.mediaType,F=M.data instanceof URL?M.data.toString():`data:${E};base64,${QG(M.data)}`;Z.push({type:"input_image",image_url:F})}else throw new c({functionality:`file part media type ${M.mediaType}`});break}default:{let E=M;Y.push({type:"other",message:"xAI Responses API does not support this content type in user messages"})}}A.push({role:"user",content:Z});break}case"assistant":{for(let Z of X.content)switch(Z.type){case"text":{let M=typeof((L=(D=Z.providerOptions)==null?void 0:D.xai)==null?void 0:L.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({role:"assistant",content:Z.text,id:M});break}case"tool-call":{if(Z.providerExecuted)break;let M=typeof((K=(q=Z.providerOptions)==null?void 0:q.xai)==null?void 0:K.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({type:"function_call",id:M!=null?M:Z.toolCallId,call_id:Z.toolCallId,name:Z.toolName,arguments:JSON.stringify(Z.input),status:"completed"});break}case"tool-result":break;case"reasoning":case"file":{Y.push({type:"other",message:`xAI Responses API does not support ${Z.type} in assistant messages`});break}default:{let M=Z;Y.push({type:"other",message:"xAI Responses API does not support this content type in assistant messages"})}}break}case"tool":{for(let Z of X.content){if(Z.type==="tool-approval-response")continue;let M=Z.output,E;switch(M.type){case"text":case"error-text":E=M.value;break;case"execution-denied":E=(z=M.reason)!=null?z:"tool execution denied";break;case"json":case"error-json":E=JSON.stringify(M.value);break;case"content":E=M.value.map((F)=>{if(F.type==="text")return F.text;return""}).join("");break;default:{let F=M;E=""}}A.push({type:"function_call_output",call_id:Z.toolCallId,output:E})}break}default:{let Z=X;Y.push({type:"other",message:"unsupported message role"})}}return{input:A,inputWarnings:Y}}function ZG(J){var D,L,q,K;let z=(L=(D=J.input_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.output_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.input_tokens;return{inputTokens:{total:Y?J.input_tokens:J.input_tokens+z,noCache:Y?J.input_tokens-z:J.input_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.output_tokens,text:J.output_tokens-A,reasoning:A},raw:J}}function o(J){switch(J){case"stop":case"completed":return"stop";case"length":case"max_output_tokens":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var KG=G.union([G.object({type:G.literal("url_citation"),url:G.string(),title:G.string().optional()}),G.object({type:G.string()})]),AG=G.object({type:G.string(),text:G.string().optional(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),jG=G.object({type:G.string(),text:G.string()}),i=G.object({name:G.string().optional(),arguments:G.string().optional(),input:G.string().optional(),call_id:G.string().optional(),id:G.string(),status:G.string(),action:G.any().optional()}),tG=G.object({name:G.string().optional(),arguments:G.string().optional(),output:G.string().optional(),error:G.string().optional(),id:G.string(),status:G.string(),server_label:G.string().optional()}),DG=G.discriminatedUnion("type",[G.object({type:G.literal("web_search_call"),...i.shape}),G.object({type:G.literal("x_search_call"),...i.shape}),G.object({type:G.literal("code_interpreter_call"),...i.shape}),G.object({type:G.literal("code_execution_call"),...i.shape}),G.object({type:G.literal("view_image_call"),...i.shape}),G.object({type:G.literal("view_x_video_call"),...i.shape}),G.object({type:G.literal("file_search_call"),id:G.string(),status:G.string(),queries:G.array(G.string()).optional(),results:G.array(G.object({file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("custom_tool_call"),...i.shape}),G.object({type:G.literal("mcp_call"),...tG.shape}),G.object({type:G.literal("message"),role:G.string(),content:G.array(AG),id:G.string(),status:G.string()}),G.object({type:G.literal("function_call"),name:G.string(),arguments:G.string(),call_id:G.string(),id:G.string()}),G.object({type:G.literal("reasoning"),id:G.string(),summary:G.array(jG),status:G.string(),encrypted_content:G.string().nullish()})]),qG=G.object({input_tokens:G.number(),output_tokens:G.number(),total_tokens:G.number().optional(),input_tokens_details:G.object({cached_tokens:G.number().optional()}).optional(),output_tokens_details:G.object({reasoning_tokens:G.number().optional()}).optional(),num_sources_used:G.number().optional(),num_server_side_tools_used:G.number().optional()}),t=G.object({id:G.string().nullish(),created_at:G.number().nullish(),model:G.string().nullish(),object:G.literal("response"),output:G.array(DG),usage:qG.nullish(),status:G.string()}),eG=G.union([G.object({type:G.literal("response.created"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.in_progress"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.output_item.added"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.output_item.done"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.content_part.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.content_part.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string(),logprobs:G.array(G.any()).optional()}),G.object({type:G.literal("response.output_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),G.object({type:G.literal("response.output_text.annotation.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),annotation_index:G.number(),annotation:KG}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_text.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),text:G.string()}),G.object({type:G.literal("response.reasoning_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string()}),G.object({type:G.literal("response.web_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.interpreting"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.done"),item_id:G.string(),output_index:G.number(),input:G.string()}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.function_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string()}),G.object({type:G.literal("response.mcp_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.failed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string().optional()}),G.object({type:G.literal("response.mcp_call_output.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_output.done"),item_id:G.string(),output_index:G.number(),output:G.string().optional()}),G.object({type:G.literal("response.incomplete"),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("response.failed"),response:G.object({error:G.object({code:G.string().nullish(),message:G.string()}).nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("error"),code:G.string().nullish(),message:G.string(),param:G.string().nullish()}),G.object({type:G.literal("response.done"),response:t}),G.object({type:G.literal("response.completed"),response:t})]),oG=G.object({reasoningEffort:G.enum(["low","medium","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),store:G.boolean().optional(),previousResponseId:G.string().optional(),include:G.array(G.enum(["file_search_call.results"])).nullish()}),GJ=v(()=>k(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional()}))),JJ=v(()=>k(G.object({queries:G.array(G.string()),results:G.array(G.object({fileId:G.string(),filename:G.string(),score:G.number().min(0).max(1),text:G.string()})).nullable()}))),QJ=_({id:"xai.file_search",inputSchema:v(()=>k(G.object({}))),outputSchema:JJ}),XJ=(J)=>QJ(J),YJ=v(()=>k(G.object({serverUrl:G.string().describe("The URL of the MCP server"),serverLabel:G.string().optional().describe("A label for the MCP server"),serverDescription:G.string().optional().describe("Description of the MCP server"),allowedTools:G.array(G.string()).optional().describe("List of allowed tool names"),headers:G.record(G.string(),G.string()).optional().describe("Custom headers to send"),authorization:G.string().optional().describe("Authorization header value")}))),ZJ=v(()=>k(G.object({name:G.string(),arguments:G.string(),result:G.unknown()}))),$J=_({id:"xai.mcp",inputSchema:v(()=>k(G.object({}))),outputSchema:ZJ}),KJ=(J)=>$J(J),AJ=v(()=>k(G.object({allowedDomains:G.array(G.string()).max(5).optional(),excludedDomains:G.array(G.string()).max(5).optional(),enableImageUnderstanding:G.boolean().optional()}))),jJ=v(()=>k(G.object({query:G.string(),sources:G.array(G.object({title:G.string(),url:G.string(),snippet:G.string()}))}))),DJ=_({id:"xai.web_search",inputSchema:v(()=>k(G.object({}))),outputSchema:jJ}),qJ=(J={})=>DJ(J),zJ=v(()=>k(G.object({allowedXHandles:G.array(G.string()).max(10).optional(),excludedXHandles:G.array(G.string()).max(10).optional(),fromDate:G.string().optional(),toDate:G.string().optional(),enableImageUnderstanding:G.boolean().optional(),enableVideoUnderstanding:G.boolean().optional()}))),VJ=v(()=>k(G.object({query:G.string(),posts:G.array(G.object({author:G.string(),text:G.string(),url:G.string(),likes:G.number()}))}))),LJ=_({id:"xai.x_search",inputSchema:v(()=>k(G.object({}))),outputSchema:VJ}),UJ=(J={})=>LJ(J);async function HJ({tools:J,toolChoice:D}){let L=(J==null?void 0:J.length)?J:void 0,q=[];if(L==null)return{tools:void 0,toolChoice:void 0,toolWarnings:q};let K=[],z=new Map;for(let Y of L)if(z.set(Y.name,Y),Y.type==="provider")switch(Y.id){case"xai.web_search":{let X=await s({value:Y.args,schema:AJ});K.push({type:"web_search",allowed_domains:X.allowedDomains,excluded_domains:X.excludedDomains,enable_image_understanding:X.enableImageUnderstanding});break}case"xai.x_search":{let X=await s({value:Y.args,schema:zJ});K.push({type:"x_search",allowed_x_handles:X.allowedXHandles,excluded_x_handles:X.excludedXHandles,from_date:X.fromDate,to_date:X.toDate,enable_image_understanding:X.enableImageUnderstanding,enable_video_understanding:X.enableVideoUnderstanding});break}case"xai.code_execution":{K.push({type:"code_interpreter"});break}case"xai.view_image":{K.push({type:"view_image"});break}case"xai.view_x_video":{K.push({type:"view_x_video"});break}case"xai.file_search":{let X=await s({value:Y.args,schema:GJ});K.push({type:"file_search",vector_store_ids:X.vectorStoreIds,max_num_results:X.maxNumResults});break}case"xai.mcp":{let X=await s({value:Y.args,schema:YJ});K.push({type:"mcp",server_url:X.serverUrl,server_label:X.serverLabel,server_description:X.serverDescription,allowed_tools:X.allowedTools,headers:X.headers,authorization:X.authorization});break}default:{q.push({type:"unsupported",feature:`provider-defined tool ${Y.name}`});break}}else K.push({type:"function",name:Y.name,description:Y.description,parameters:Y.inputSchema,...Y.strict!=null?{strict:Y.strict}:{}});if(D==null)return{tools:K,toolChoice:void 0,toolWarnings:q};let A=D.type;switch(A){case"auto":case"none":return{tools:K,toolChoice:A,toolWarnings:q};case"required":return{tools:K,toolChoice:"required",toolWarnings:q};case"tool":{let Y=z.get(D.toolName);if(Y==null)return{tools:K,toolChoice:void 0,toolWarnings:q};if(Y.type==="provider")return q.push({type:"unsupported",feature:`toolChoice for server-side tool "${Y.name}"`}),{tools:K,toolChoice:void 0,toolWarnings:q};return{tools:K,toolChoice:{type:"function",name:Y.name},toolWarnings:q}}default:throw new c({functionality:`tool choice type: ${A}`})}}var MJ=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,stopSequences:K,seed:z,responseFormat:A,providerOptions:Y,tools:X,toolChoice:Z}){var M,E,F,B,R,N,$;let W=[],H=(M=await p({provider:"xai",providerOptions:Y,schema:oG}))!=null?M:{};if(K!=null)W.push({type:"unsupported",feature:"stopSequences"});let O=(E=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.web_search"))==null?void 0:E.name,C=(F=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.x_search"))==null?void 0:F.name,w=(B=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.code_execution"))==null?void 0:B.name,j=(R=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.mcp"))==null?void 0:R.name,y=(N=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.file_search"))==null?void 0:N.name,{input:S,inputWarnings:h}=await sG({prompt:J,store:!0});W.push(...h);let{tools:m,toolChoice:I,toolWarnings:P}=await HJ({tools:X,toolChoice:Z});W.push(...P);let f=H.include?[...H.include]:void 0;if(H.store===!1)if(f==null)f=["reasoning.encrypted_content"];else f=[...f,"reasoning.encrypted_content"];let U={model:this.modelId,input:S,logprobs:H.logprobs===!0||H.topLogprobs!=null?!0:void 0,top_logprobs:H.topLogprobs,max_output_tokens:D,temperature:L,top_p:q,seed:z,...(A==null?void 0:A.type)==="json"&&{text:{format:A.schema!=null?{type:"json_schema",strict:!0,name:($=A.name)!=null?$:"response",description:A.description,schema:A.schema}:{type:"json_object"}}},...H.reasoningEffort!=null&&{reasoning:{effort:H.reasoningEffort}},...H.store===!1&&{store:H.store},...f!=null&&{include:f},...H.previousResponseId!=null&&{previous_response_id:H.previousResponseId}};if(m&&m.length>0)U.tools=m;if(I!=null)U.tool_choice=I;return{args:U,warnings:W,webSearchToolName:O,xSearchToolName:C,codeExecutionToolName:w,mcpToolName:j,fileSearchToolName:y}}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M,E,F,B;let{args:R,warnings:N,webSearchToolName:$,xSearchToolName:W,codeExecutionToolName:H,mcpToolName:O,fileSearchToolName:C}=await this.getArgs(J),{responseHeaders:w,value:j,rawValue:y}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:R,failedResponseHandler:r,successfulResponseHandler:d(t),abortSignal:J.abortSignal,fetch:this.config.fetch}),S=[],h=!1,m=["web_search","web_search_with_snippets","browse_page"],I=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"];for(let P of j.output){if(P.type==="file_search_call"){let f=C!=null?C:"file_search";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:"",providerExecuted:!0}),S.push({type:"tool-result",toolCallId:P.id,toolName:f,result:{queries:(L=P.queries)!=null?L:[],results:(K=(q=P.results)==null?void 0:q.map((U)=>({fileId:U.file_id,filename:U.filename,score:U.score,text:U.text})))!=null?K:null}});continue}if(P.type==="web_search_call"||P.type==="x_search_call"||P.type==="code_interpreter_call"||P.type==="code_execution_call"||P.type==="view_image_call"||P.type==="view_x_video_call"||P.type==="custom_tool_call"||P.type==="mcp_call"){let f=(z=P.name)!=null?z:"";if(m.includes((A=P.name)!=null?A:"")||P.type==="web_search_call")f=$!=null?$:"web_search";else if(I.includes((Y=P.name)!=null?Y:"")||P.type==="x_search_call")f=W!=null?W:"x_search";else if(P.name==="code_execution"||P.type==="code_interpreter_call"||P.type==="code_execution_call")f=H!=null?H:"code_execution";else if(P.type==="mcp_call")f=(X=O!=null?O:P.name)!=null?X:"mcp";let U=P.type==="custom_tool_call"?(Z=P.input)!=null?Z:"":P.type==="mcp_call"?(M=P.arguments)!=null?M:"":(E=P.arguments)!=null?E:"";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:U,providerExecuted:!0});continue}switch(P.type){case"message":{for(let f of P.content){if(f.text)S.push({type:"text",text:f.text});if(f.annotations){for(let U of f.annotations)if(U.type==="url_citation"&&"url"in U)S.push({type:"source",sourceType:"url",id:this.config.generateId(),url:U.url,title:(F=U.title)!=null?F:U.url})}}break}case"function_call":{h=!0,S.push({type:"tool-call",toolCallId:P.call_id,toolName:P.name,input:P.arguments});break}case"reasoning":{let f=P.summary.map((U)=>U.text).filter((U)=>U&&U.length>0);if(f.length>0){let U=f.join("");if(P.encrypted_content||P.id)S.push({type:"reasoning",text:U,providerMetadata:{xai:{...P.encrypted_content&&{reasoningEncryptedContent:P.encrypted_content},...P.id&&{itemId:P.id}}}});else S.push({type:"reasoning",text:U})}break}default:break}}return{content:S,finishReason:{unified:h?"tool-calls":o(j.status),raw:(B=j.status)!=null?B:void 0},usage:j.usage?ZG(j.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:R},response:{...JG(j),headers:w,body:y},warnings:N}}async doStream(J){var D;let{args:L,warnings:q,webSearchToolName:K,xSearchToolName:z,codeExecutionToolName:A,mcpToolName:Y,fileSearchToolName:X}=await this.getArgs(J),Z={...L,stream:!0},{responseHeaders:M,value:E}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:Z,failedResponseHandler:r,successfulResponseHandler:YG(eG),abortSignal:J.abortSignal,fetch:this.config.fetch}),F={unified:"other",raw:void 0},B=!1,R=void 0,N=!0,$={},W=new Set,H={},O={},C=this;return{stream:E.pipeThrough(new TransformStream({start(w){w.enqueue({type:"stream-start",warnings:q})},transform(w,j){var y,S,h,m,I,P,f,U,x,zG,VG,LG,UG,HG,MG;if(J.includeRawChunks)j.enqueue({type:"raw",rawValue:w.rawValue});if(!w.success){j.enqueue({type:"error",error:w.error});return}let V=w.value;if(V.type==="response.created"||V.type==="response.in_progress"){if(N)j.enqueue({type:"response-metadata",...JG(V.response)}),N=!1;return}if(V.type==="response.reasoning_summary_part.added"){let Q=`reasoning-${V.item_id}`;O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}})}if(V.type==="response.reasoning_summary_text.delta"){let Q=`reasoning-${V.item_id}`;j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_summary_text.done")return;if(V.type==="response.reasoning_text.delta"){let Q=`reasoning-${V.item_id}`;if(O[V.item_id]==null)O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}});j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_text.done")return;if(V.type==="response.output_text.delta"){let Q=`text-${V.item_id}`;if($[Q]==null)$[Q]={type:"text"},j.enqueue({type:"text-start",id:Q});j.enqueue({type:"text-delta",id:Q,delta:V.delta});return}if(V.type==="response.output_text.done"){if(V.annotations){for(let Q of V.annotations)if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(y=Q.title)!=null?y:Q.url})}return}if(V.type==="response.output_text.annotation.added"){let Q=V.annotation;if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(S=Q.title)!=null?S:Q.url});return}if(V.type==="response.done"||V.type==="response.completed"||V.type==="response.incomplete"){let Q=V.response;if(Q.usage)R=ZG(Q.usage);if(V.type==="response.incomplete"){let T="incomplete_details"in Q?(h=Q.incomplete_details)==null?void 0:h.reason:void 0;F={unified:T?o(T):"other",raw:T!=null?T:"incomplete"}}else if("status"in Q&&Q.status)F={unified:B?"tool-calls":o(Q.status),raw:Q.status};return}if(V.type==="response.failed"){let Q=(m=V.response.incomplete_details)==null?void 0:m.reason;if(F={unified:Q?o(Q):"error",raw:Q!=null?Q:"error"},V.response.usage)R=ZG(V.response.usage);return}if(V.type==="error"){j.enqueue({type:"error",error:V});return}if(V.type==="response.custom_tool_call_input.delta"||V.type==="response.custom_tool_call_input.done")return;if(V.type==="response.function_call_arguments.delta"){let Q=H[V.output_index];if(Q!=null)j.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:V.delta});return}if(V.type==="response.function_call_arguments.done")return;if(V.type==="response.output_item.added"||V.type==="response.output_item.done"){let Q=V.item;if(Q.type==="reasoning"){if(V.type==="response.output_item.done"){let T=`reasoning-${Q.id}`;if(!(Q.id in O))O[Q.id]={},j.enqueue({type:"reasoning-start",id:T,providerMetadata:{xai:{...Q.id&&{itemId:Q.id}}}});j.enqueue({type:"reasoning-end",id:T,providerMetadata:{xai:{...Q.encrypted_content&&{reasoningEncryptedContent:Q.encrypted_content},...Q.id&&{itemId:Q.id}}}}),delete O[Q.id]}return}if(Q.type==="file_search_call"){let T=X!=null?X:"file_search";if(!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:T}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:""}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:T,input:"",providerExecuted:!0});if(V.type==="response.output_item.done")j.enqueue({type:"tool-result",toolCallId:Q.id,toolName:T,result:{queries:(I=Q.queries)!=null?I:[],results:(f=(P=Q.results)==null?void 0:P.map((b)=>({fileId:b.file_id,filename:b.filename,score:b.score,text:b.text})))!=null?f:null}});return}if(Q.type==="web_search_call"||Q.type==="x_search_call"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call"||Q.type==="view_image_call"||Q.type==="view_x_video_call"||Q.type==="custom_tool_call"||Q.type==="mcp_call"){let T=["web_search","web_search_with_snippets","browse_page"],b=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"],n=(U=Q.name)!=null?U:"";if(T.includes((x=Q.name)!=null?x:"")||Q.type==="web_search_call")n=K!=null?K:"web_search";else if(b.includes((zG=Q.name)!=null?zG:"")||Q.type==="x_search_call")n=z!=null?z:"x_search";else if(Q.name==="code_execution"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call")n=A!=null?A:"code_execution";else if(Q.type==="mcp_call")n=(VG=Y!=null?Y:Q.name)!=null?VG:"mcp";let PG=Q.type==="custom_tool_call"?(LG=Q.input)!=null?LG:"":Q.type==="mcp_call"?(UG=Q.arguments)!=null?UG:"":(HG=Q.arguments)!=null?HG:"";if((Q.type==="custom_tool_call"?V.type==="response.output_item.done":!W.has(Q.id))&&!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:n}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:PG}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:n,input:PG,providerExecuted:!0});return}if(Q.type==="message")for(let T of Q.content){if(T.text&&T.text.length>0){let b=`text-${Q.id}`;if($[b]==null)$[b]={type:"text"},j.enqueue({type:"text-start",id:b}),j.enqueue({type:"text-delta",id:b,delta:T.text})}if(T.annotations){for(let b of T.annotations)if(b.type==="url_citation"&&"url"in b)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:b.url,title:(MG=b.title)!=null?MG:b.url})}}else if(Q.type==="function_call"){if(V.type==="response.output_item.added")H[V.output_index]={toolName:Q.name,toolCallId:Q.call_id},j.enqueue({type:"tool-input-start",id:Q.call_id,toolName:Q.name});else if(V.type==="response.output_item.done")B=!0,H[V.output_index]=void 0,j.enqueue({type:"tool-input-end",id:Q.call_id}),j.enqueue({type:"tool-call",toolCallId:Q.call_id,toolName:Q.name,input:Q.arguments})}}},flush(w){for(let[j,y]of Object.entries($))if(y.type==="text")w.enqueue({type:"text-end",id:j});w.enqueue({type:"finish",finishReason:F,usage:R!=null?R:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:Z},response:{headers:M}}}},PJ=G.object({output:G.string().describe("the output of the code execution"),error:G.string().optional().describe("any error that occurred")}),EJ=_({id:"xai.code_execution",inputSchema:G.object({}).describe("no input parameters"),outputSchema:PJ}),WJ=(J={})=>EJ(J),BJ=G.object({description:G.string().describe("description of the image"),objects:G.array(G.string()).optional().describe("objects detected in the image")}),FJ=_({id:"xai.view_image",inputSchema:G.object({}).describe("no input parameters"),outputSchema:BJ}),NJ=(J={})=>FJ(J),wJ=G.object({transcript:G.string().optional().describe("transcript of the video"),description:G.string().describe("description of the video content"),duration:G.number().optional().describe("duration in seconds")}),SJ=_({id:"xai.view_x_video",inputSchema:G.object({}).describe("no input parameters"),outputSchema:wJ}),OJ=(J={})=>SJ(J),fJ={codeExecution:WJ,fileSearch:XJ,mcpServer:KJ,viewImage:NJ,viewXVideo:OJ,webSearch:qJ,xSearch:UJ},CJ="3.0.82",a=G.string().min(1),yJ=G.enum(["480p","720p"]),IJ=G.enum(["edit-video","extend-video","reference-to-video"]),e={pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),resolution:yJ.nullish()},RJ=G.object({...e,mode:G.literal("edit-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),xJ=G.object({...e,mode:G.literal("extend-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),TJ=G.object({...e,mode:G.literal("reference-to-video"),referenceImageUrls:G.array(a).min(1).max(7),videoUrl:G.undefined().optional()}),vJ=G.object({...e,mode:G.undefined().optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional()}),IQ=G.union([RJ,xJ,TJ,vJ]),kJ=G.object({mode:IJ.optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional(),...e}).passthrough(),bJ=v(()=>k(kJ)),hJ={"1280x720":"720p","854x480":"480p","640x480":"480p"};function _J(J){if((J==null?void 0:J.mode)!=null)return J.mode;if((J==null?void 0:J.videoUrl)!=null)return"edit-video";if((J==null?void 0:J.referenceImageUrls)!=null&&J.referenceImageUrls.length>0)return"reference-to-video";return}var mJ=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M;let E=(q=(L=(D=this.config._internal)==null?void 0:D.currentDate)==null?void 0:L.call(D))!=null?q:new Date,F=[],B=await p({provider:"xai",providerOptions:J.providerOptions,schema:bJ}),R=_J(B),N=R==="edit-video",$=R==="extend-video",W=R==="reference-to-video";if(J.fps!=null)F.push({type:"unsupported",feature:"fps",details:"xAI video models do not support custom FPS."});if(J.seed!=null)F.push({type:"unsupported",feature:"seed",details:"xAI video models do not support seed."});if(J.n!=null&&J.n>1)F.push({type:"unsupported",feature:"n",details:"xAI video models do not support generating multiple videos per call. Only 1 video will be generated."});if(N&&J.duration!=null)F.push({type:"unsupported",feature:"duration",details:"xAI video editing does not support custom duration."});if(N&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video editing does not support custom aspect ratio."});if(N&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video editing does not support custom resolution."});if($&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video extension does not support custom aspect ratio."});if($&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video extension does not support custom resolution."});let H={model:this.modelId,prompt:J.prompt},O=!N,C=!N&&!$,w=!N&&!$;if(O&&J.duration!=null)H.duration=J.duration;if(C&&J.aspectRatio!=null)H.aspect_ratio=J.aspectRatio;if(w&&(B==null?void 0:B.resolution)!=null)H.resolution=B.resolution;else if(w&&J.resolution!=null){let U=hJ[J.resolution];if(U!=null)H.resolution=U;else F.push({type:"unsupported",feature:"resolution",details:`Unrecognized resolution "${J.resolution}". Use providerOptions.xai.resolution with "480p" or "720p" instead.`})}if(N)H.video={url:B.videoUrl};if($)H.video={url:B.videoUrl};if(J.image!=null)if(J.image.type==="url")H.image={url:J.image.url};else{let U=typeof J.image.data==="string"?J.image.data:wG(J.image.data);H.image={url:`data:${J.image.mediaType};base64,${U}`}}if(W)H.reference_images=B.referenceImageUrls.map((U)=>({url:U}));if(B!=null){for(let[U,x]of Object.entries(B))if(!["mode","pollIntervalMs","pollTimeoutMs","resolution","videoUrl","referenceImageUrls"].includes(U))H[U]=x}let j=(K=this.config.baseURL)!=null?K:"https://api.x.ai/v1",y;if(N)y=`${j}/videos/edits`;else if($)y=`${j}/videos/extensions`;else y=`${j}/videos/generations`;let{value:S}=await u({url:y,headers:g(this.config.headers(),J.headers),body:H,failedResponseHandler:r,successfulResponseHandler:d(gJ),abortSignal:J.abortSignal,fetch:this.config.fetch}),h=S.request_id;if(!h)throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:`No request_id returned from xAI API. Response: ${JSON.stringify(S)}`});let m=(z=B==null?void 0:B.pollIntervalMs)!=null?z:5000,I=(A=B==null?void 0:B.pollTimeoutMs)!=null?A:600000,P=Date.now(),f;while(!0){if(await FG(m,{abortSignal:J.abortSignal}),Date.now()-P>I)throw new l({name:"XAI_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${I}ms`});let{value:U,responseHeaders:x}=await XG({url:`${j}/videos/${h}`,headers:g(this.config.headers(),J.headers),successfulResponseHandler:d(uJ),failedResponseHandler:r,abortSignal:J.abortSignal,fetch:this.config.fetch});if(f=x,U.status==="done"||U.status==null&&((Y=U.video)==null?void 0:Y.url)){if(((X=U.video)==null?void 0:X.respect_moderation)===!1)throw new l({name:"XAI_VIDEO_MODERATION_ERROR",message:"Video generation was blocked due to a content policy violation."});if(!((Z=U.video)==null?void 0:Z.url))throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:"Video generation completed but no video URL was returned."});return{videos:[{type:"url",url:U.video.url,mediaType:"video/mp4"}],warnings:F,response:{timestamp:E,modelId:this.modelId,headers:f},providerMetadata:{xai:{requestId:h,videoUrl:U.video.url,...U.video.duration!=null?{duration:U.video.duration}:{},...((M=U.usage)==null?void 0:M.cost_in_usd_ticks)!=null?{costInUsdTicks:U.usage.cost_in_usd_ticks}:{},...U.progress!=null?{progress:U.progress}:{}}}}}if(U.status==="expired")throw new l({name:"XAI_VIDEO_GENERATION_EXPIRED",message:"Video generation request expired."});if(U.status==="failed")throw new l({name:"XAI_VIDEO_GENERATION_FAILED",message:"Video generation failed."})}}},gJ=G.object({request_id:G.string().nullish()}),uJ=G.object({status:G.string().nullish(),video:G.object({url:G.string(),duration:G.number().nullish(),respect_moderation:G.boolean().nullish()}).nullish(),model:G.string().nullish(),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish(),progress:G.number().nullish(),error:G.object({code:G.string().nullish(),message:G.string().nullish()}).nullish()});function dJ(J={}){var D;let L=xG((D=J.baseURL)!=null?D:"https://api.x.ai/v1"),q=()=>OG({Authorization:`Bearer ${fG({apiKey:J.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...J.headers},`ai-sdk/xai/${CJ}`),K=(Z)=>{return new cG(Z,{provider:"xai.chat",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},z=(Z)=>{return new MJ(Z,{provider:"xai.responses",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},A=(Z)=>{return new aG(Z,{provider:"xai.image",baseURL:L,headers:q,fetch:J.fetch})},Y=(Z)=>{return new mJ(Z,{provider:"xai.video",baseURL:L,headers:q,fetch:J.fetch})},X=(Z)=>K(Z);return X.specificationVersion="v3",X.languageModel=K,X.chat=K,X.responses=z,X.embeddingModel=(Z)=>{throw new BG({modelId:Z,modelType:"embeddingModel"})},X.textEmbeddingModel=X.embeddingModel,X.imageModel=A,X.image=A,X.videoModel=Y,X.video=Y,X.tools=fJ,X}var RQ=dJ();export{fJ as xaiTools,RQ as xai,UJ as xSearch,qJ as webSearch,OJ as viewXVideo,NJ as viewImage,KJ as mcpServer,dJ as createXai,WJ as codeExecution,CJ as VERSION};
2
+ import{Ao as QG,Bo as SG,Jo as $G,Oo as OG,Po as XG,So as fG,Wo as v,Zo as k,_o as s,bp as CG,ep as p,fp as u,kp as _,mp as yG,np as YG,op as d,pp as IG,qp as RG,sp as xG,to as g,vo as FG,xo as NG,zo as wG}from"./chunk-mkyrg7gt.js";import{Ep as BG,Hp as c,up as l,vp as GG}from"./chunk-7v4fzkbb.js";import"./chunk-cqtkxwd8.js";import"./chunk-pk0tytcm.js";import{ut as G}from"./chunk-ym4ydwrz.js";import"./chunk-vmgknvxs.js";import"./chunk-0rmmg3g4.js";function vG(J){var D;let L=[],q=[];for(let{role:K,content:z}of J)switch(K){case"system":{L.push({role:"system",content:z});break}case"user":{if(z.length===1&&z[0].type==="text"){L.push({role:"user",content:z[0].text});break}L.push({role:"user",content:z.map((A)=>{switch(A.type){case"text":return{type:"text",text:A.text};case"file":if(A.mediaType.startsWith("image/")){let Y=A.mediaType==="image/*"?"image/jpeg":A.mediaType;return{type:"image_url",image_url:{url:A.data instanceof URL?A.data.toString():`data:${Y};base64,${QG(A.data)}`}}}else throw new c({functionality:`file part media type ${A.mediaType}`})}})});break}case"assistant":{let A="",Y=[];for(let X of z)switch(X.type){case"text":{A+=X.text;break}case"tool-call":{Y.push({id:X.toolCallId,type:"function",function:{name:X.toolName,arguments:JSON.stringify(X.input)}});break}}L.push({role:"assistant",content:A,tool_calls:Y.length>0?Y:void 0});break}case"tool":{for(let A of z){if(A.type==="tool-approval-response")continue;let Y=A.output,X;switch(Y.type){case"text":case"error-text":X=Y.value;break;case"execution-denied":X=(D=Y.reason)!=null?D:"Tool execution denied.";break;case"content":case"json":case"error-json":X=JSON.stringify(Y.value);break}L.push({role:"tool",tool_call_id:A.toolCallId,content:X})}break}default:throw Error(`Unsupported role: ${K}`)}return{messages:L,warnings:q}}function EG(J){var D,L,q,K;let z=(L=(D=J.prompt_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.completion_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.prompt_tokens;return{inputTokens:{total:Y?J.prompt_tokens:J.prompt_tokens+z,noCache:Y?J.prompt_tokens-z:J.prompt_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.completion_tokens+A,text:J.completion_tokens,reasoning:A},raw:J}}function JG({id:J,model:D,created:L,created_at:q}){let K=L!=null?L:q;return{id:J!=null?J:void 0,modelId:D!=null?D:void 0,timestamp:K!=null?new Date(K*1000):void 0}}function WG(J){switch(J){case"stop":return"stop";case"length":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var kG=G.object({type:G.literal("web"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),allowedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),bG=G.object({type:G.literal("x"),excludedXHandles:G.array(G.string()).optional(),includedXHandles:G.array(G.string()).optional(),postFavoriteCount:G.number().int().optional(),postViewCount:G.number().int().optional(),xHandles:G.array(G.string()).optional()}),hG=G.object({type:G.literal("news"),country:G.string().length(2).optional(),excludedWebsites:G.array(G.string()).max(5).optional(),safeSearch:G.boolean().optional()}),_G=G.object({type:G.literal("rss"),links:G.array(G.string().url()).max(1)}),mG=G.discriminatedUnion("type",[kG,bG,hG,_G]),gG=G.object({reasoningEffort:G.enum(["low","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),parallel_function_calling:G.boolean().optional(),searchParameters:G.object({mode:G.enum(["off","auto","on"]),returnCitations:G.boolean().optional(),fromDate:G.string().optional(),toDate:G.string().optional(),maxSearchResults:G.number().min(1).max(50).optional(),sources:G.array(mG).optional()}).optional()}),uG=G.object({error:G.object({message:G.string(),type:G.string().nullish(),param:G.any().nullish(),code:G.union([G.string(),G.number()]).nullish()})}),r=yG({errorSchema:uG,errorToMessage:(J)=>J.error.message});function dG({tools:J,toolChoice:D}){J=(J==null?void 0:J.length)?J:void 0;let L=[];if(J==null)return{tools:void 0,toolChoice:void 0,toolWarnings:L};let q=[];for(let z of J)if(z.type==="provider")L.push({type:"unsupported",feature:`provider-defined tool ${z.name}`});else q.push({type:"function",function:{name:z.name,description:z.description,parameters:z.inputSchema,...z.strict!=null?{strict:z.strict}:{}}});if(D==null)return{tools:q,toolChoice:void 0,toolWarnings:L};let K=D.type;switch(K){case"auto":case"none":return{tools:q,toolChoice:K,toolWarnings:L};case"required":return{tools:q,toolChoice:"required",toolWarnings:L};case"tool":return{tools:q,toolChoice:{type:"function",function:{name:D.toolName}},toolWarnings:L};default:throw new c({functionality:`tool choice type: ${K}`})}}var cG=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,topK:K,frequencyPenalty:z,presencePenalty:A,stopSequences:Y,seed:X,responseFormat:Z,providerOptions:M,tools:E,toolChoice:F}){var B,R,N;let $=[],W=(B=await p({provider:"xai",providerOptions:M,schema:gG}))!=null?B:{};if(K!=null)$.push({type:"unsupported",feature:"topK"});if(z!=null)$.push({type:"unsupported",feature:"frequencyPenalty"});if(A!=null)$.push({type:"unsupported",feature:"presencePenalty"});if(Y!=null)$.push({type:"unsupported",feature:"stopSequences"});let{messages:H,warnings:O}=vG(J);$.push(...O);let{tools:C,toolChoice:w,toolWarnings:j}=dG({tools:E,toolChoice:F});return $.push(...j),{args:{model:this.modelId,logprobs:W.logprobs===!0||W.topLogprobs!=null?!0:void 0,top_logprobs:W.topLogprobs,max_completion_tokens:D,temperature:L,top_p:q,seed:X,reasoning_effort:W.reasoningEffort,parallel_function_calling:W.parallel_function_calling,response_format:(Z==null?void 0:Z.type)==="json"?Z.schema!=null?{type:"json_schema",json_schema:{name:(R=Z.name)!=null?R:"response",schema:Z.schema,strict:!0}}:{type:"json_object"}:void 0,search_parameters:W.searchParameters?{mode:W.searchParameters.mode,return_citations:W.searchParameters.returnCitations,from_date:W.searchParameters.fromDate,to_date:W.searchParameters.toDate,max_search_results:W.searchParameters.maxSearchResults,sources:(N=W.searchParameters.sources)==null?void 0:N.map((S)=>{var h;return{type:S.type,...S.type==="web"&&{country:S.country,excluded_websites:S.excludedWebsites,allowed_websites:S.allowedWebsites,safe_search:S.safeSearch},...S.type==="x"&&{excluded_x_handles:S.excludedXHandles,included_x_handles:(h=S.includedXHandles)!=null?h:S.xHandles,post_favorite_count:S.postFavoriteCount,post_view_count:S.postViewCount},...S.type==="news"&&{country:S.country,excluded_websites:S.excludedWebsites,safe_search:S.safeSearch},...S.type==="rss"&&{links:S.links}}})}:void 0,messages:H,tools:C,tool_choice:w},warnings:$}}async doGenerate(J){var D,L;let{args:q,warnings:K}=await this.getArgs(J),z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y,rawValue:X}=await u({url:z,headers:g(this.config.headers(),J.headers),body:q,failedResponseHandler:r,successfulResponseHandler:d(pG),abortSignal:J.abortSignal,fetch:this.config.fetch});if(Y.error!=null)throw new GG({message:Y.error,url:z,requestBodyValues:q,statusCode:200,responseHeaders:A,responseBody:JSON.stringify(X),isRetryable:Y.code==="The service is currently unavailable"});let Z=Y.choices[0],M=[];if(Z.message.content!=null&&Z.message.content.length>0){let E=Z.message.content,F=q.messages[q.messages.length-1];if((F==null?void 0:F.role)==="assistant"&&E===F.content)E="";if(E.length>0)M.push({type:"text",text:E})}if(Z.message.reasoning_content!=null&&Z.message.reasoning_content.length>0)M.push({type:"reasoning",text:Z.message.reasoning_content});if(Z.message.tool_calls!=null)for(let E of Z.message.tool_calls)M.push({type:"tool-call",toolCallId:E.id,toolName:E.function.name,input:E.function.arguments});if(Y.citations!=null)for(let E of Y.citations)M.push({type:"source",sourceType:"url",id:this.config.generateId(),url:E});return{content:M,finishReason:{unified:WG(Z.finish_reason),raw:(L=Z.finish_reason)!=null?L:void 0},usage:Y.usage?EG(Y.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:q},response:{...JG(Y),headers:A,body:X},warnings:K}}async doStream(J){var D;let{args:L,warnings:q}=await this.getArgs(J),K={...L,stream:!0,stream_options:{include_usage:!0}},z=`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/chat/completions`,{responseHeaders:A,value:Y}=await u({url:z,headers:g(this.config.headers(),J.headers),body:K,failedResponseHandler:r,successfulResponseHandler:async({response:N})=>{let $=NG(N),W=N.headers.get("content-type");if(W==null?void 0:W.includes("application/json")){let H=await N.text(),O=await CG({text:H,schema:lG});if(O.success)throw new GG({message:O.value.error,url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H,isRetryable:O.value.code==="The service is currently unavailable"});throw new GG({message:"Invalid JSON response",url:z,requestBodyValues:K,statusCode:200,responseHeaders:$,responseBody:H})}return YG(iG)({response:N,url:z,requestBodyValues:K})},abortSignal:J.abortSignal,fetch:this.config.fetch}),X={unified:"other",raw:void 0},Z=void 0,M=!0,E={},F={},B=void 0,R=this;return{stream:Y.pipeThrough(new TransformStream({start(N){N.enqueue({type:"stream-start",warnings:q})},transform(N,$){if(J.includeRawChunks)$.enqueue({type:"raw",rawValue:N.rawValue});if(!N.success){$.enqueue({type:"error",error:N.error});return}let W=N.value;if(M)$.enqueue({type:"response-metadata",...JG(W)}),M=!1;if(W.citations!=null)for(let w of W.citations)$.enqueue({type:"source",sourceType:"url",id:R.config.generateId(),url:w});if(W.usage!=null)Z=EG(W.usage);let H=W.choices[0];if((H==null?void 0:H.finish_reason)!=null)X={unified:WG(H.finish_reason),raw:H.finish_reason};if((H==null?void 0:H.delta)==null)return;let{delta:O,index:C}=H;if(O.content!=null&&O.content.length>0){let w=O.content;if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;let j=K.messages[K.messages.length-1];if((j==null?void 0:j.role)==="assistant"&&w===j.content)return;let y=`text-${W.id||C}`;if(E[y]==null)E[y]={type:"text",ended:!1},$.enqueue({type:"text-start",id:y});$.enqueue({type:"text-delta",id:y,delta:w})}if(O.reasoning_content!=null&&O.reasoning_content.length>0){let w=`reasoning-${W.id||C}`;if(F[w]===O.reasoning_content)return;if(F[w]=O.reasoning_content,E[w]==null)E[w]={type:"reasoning",ended:!1},B=w,$.enqueue({type:"reasoning-start",id:w});$.enqueue({type:"reasoning-delta",id:w,delta:O.reasoning_content})}if(O.tool_calls!=null){if(B!=null&&!E[B].ended)$.enqueue({type:"reasoning-end",id:B}),E[B].ended=!0,B=void 0;for(let w of O.tool_calls){let j=w.id;$.enqueue({type:"tool-input-start",id:j,toolName:w.function.name}),$.enqueue({type:"tool-input-delta",id:j,delta:w.function.arguments}),$.enqueue({type:"tool-input-end",id:j}),$.enqueue({type:"tool-call",toolCallId:j,toolName:w.function.name,input:w.function.arguments})}}},flush(N){for(let[$,W]of Object.entries(E))if(!W.ended)N.enqueue({type:W.type==="text"?"text-end":"reasoning-end",id:$});N.enqueue({type:"finish",finishReason:X,usage:Z!=null?Z:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:K},response:{headers:A}}}},TG=G.object({prompt_tokens:G.number(),completion_tokens:G.number(),total_tokens:G.number(),prompt_tokens_details:G.object({text_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),image_tokens:G.number().nullish(),cached_tokens:G.number().nullish()}).nullish(),completion_tokens_details:G.object({reasoning_tokens:G.number().nullish(),audio_tokens:G.number().nullish(),accepted_prediction_tokens:G.number().nullish(),rejected_prediction_tokens:G.number().nullish()}).nullish()}),pG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({message:G.object({role:G.literal("assistant"),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),index:G.number(),finish_reason:G.string().nullish()})).nullish(),object:G.literal("chat.completion").nullish(),usage:TG.nullish(),citations:G.array(G.string().url()).nullish(),code:G.string().nullish(),error:G.string().nullish()}),iG=G.object({id:G.string().nullish(),created:G.number().nullish(),model:G.string().nullish(),choices:G.array(G.object({delta:G.object({role:G.enum(["assistant"]).optional(),content:G.string().nullish(),reasoning_content:G.string().nullish(),tool_calls:G.array(G.object({id:G.string(),type:G.literal("function"),function:G.object({name:G.string(),arguments:G.string()})})).nullish()}),finish_reason:G.string().nullish(),index:G.number()})),usage:TG.nullish(),citations:G.array(G.string().url()).nullish()}),lG=G.object({code:G.string(),error:G.string()}),rG=G.object({aspect_ratio:G.string().optional(),output_format:G.string().optional(),sync_mode:G.boolean().optional(),resolution:G.enum(["1k","2k"]).optional(),quality:G.enum(["low","medium","high"]).optional(),user:G.string().optional()}),aG=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxImagesPerCall=3}get provider(){return this.config.provider}async doGenerate({prompt:J,n:D,size:L,aspectRatio:q,seed:K,providerOptions:z,headers:A,abortSignal:Y,files:X,mask:Z}){var M,E,F,B,R;let N=[];if(L!=null)N.push({type:"unsupported",feature:"size",details:"This model does not support the `size` option. Use `aspectRatio` instead."});if(K!=null)N.push({type:"unsupported",feature:"seed"});if(Z!=null)N.push({type:"unsupported",feature:"mask"});let $=await p({provider:"xai",providerOptions:z,schema:rG}),W=X!=null&&X.length>0,H=W?X.map((I)=>SG(I)):[],O=W?"/images/edits":"/images/generations",C={model:this.modelId,prompt:J,n:D,response_format:"b64_json"};if(q!=null)C.aspect_ratio=q;if(($==null?void 0:$.output_format)!=null)C.output_format=$.output_format;if(($==null?void 0:$.sync_mode)!=null)C.sync_mode=$.sync_mode;if(($==null?void 0:$.aspect_ratio)!=null&&q==null)C.aspect_ratio=$.aspect_ratio;if(($==null?void 0:$.resolution)!=null)C.resolution=$.resolution;if(($==null?void 0:$.quality)!=null)C.quality=$.quality;if(($==null?void 0:$.user)!=null)C.user=$.user;if(H.length===1)C.image={url:H[0],type:"image_url"};else if(H.length>1)C.images=H.map((I)=>({url:I,type:"image_url"}));let w=(M=this.config.baseURL)!=null?M:"https://api.x.ai/v1",j=(B=(F=(E=this.config._internal)==null?void 0:E.currentDate)==null?void 0:F.call(E))!=null?B:new Date,{value:y,responseHeaders:S}=await u({url:`${w}${O}`,headers:g(this.config.headers(),A),body:C,failedResponseHandler:r,successfulResponseHandler:d(nG),abortSignal:Y,fetch:this.config.fetch});return{images:y.data.every((I)=>I.b64_json!=null)?y.data.map((I)=>I.b64_json):await Promise.all(y.data.map((I)=>this.downloadImage(I.url,Y))),warnings:N,response:{timestamp:j,modelId:this.modelId,headers:S},providerMetadata:{xai:{images:y.data.map((I)=>({...I.revised_prompt?{revisedPrompt:I.revised_prompt}:{}})),...((R=y.usage)==null?void 0:R.cost_in_usd_ticks)!=null?{costInUsdTicks:y.usage.cost_in_usd_ticks}:{}}}}}async downloadImage(J,D){let{value:L}=await XG({url:J,abortSignal:D,failedResponseHandler:RG(),successfulResponseHandler:IG(),fetch:this.config.fetch});return L}},nG=G.object({data:G.array(G.object({url:G.string().nullish(),b64_json:G.string().nullish(),revised_prompt:G.string().nullish()})),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish()});async function sG({prompt:J}){var D,L,q,K,z;let A=[],Y=[];for(let X of J)switch(X.role){case"system":{A.push({role:"system",content:X.content});break}case"user":{let Z=[];for(let M of X.content)switch(M.type){case"text":{Z.push({type:"input_text",text:M.text});break}case"file":{if(M.mediaType.startsWith("image/")){let E=M.mediaType==="image/*"?"image/jpeg":M.mediaType,F=M.data instanceof URL?M.data.toString():`data:${E};base64,${QG(M.data)}`;Z.push({type:"input_image",image_url:F})}else throw new c({functionality:`file part media type ${M.mediaType}`});break}default:{let E=M;Y.push({type:"other",message:"xAI Responses API does not support this content type in user messages"})}}A.push({role:"user",content:Z});break}case"assistant":{for(let Z of X.content)switch(Z.type){case"text":{let M=typeof((L=(D=Z.providerOptions)==null?void 0:D.xai)==null?void 0:L.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({role:"assistant",content:Z.text,id:M});break}case"tool-call":{if(Z.providerExecuted)break;let M=typeof((K=(q=Z.providerOptions)==null?void 0:q.xai)==null?void 0:K.itemId)==="string"?Z.providerOptions.xai.itemId:void 0;A.push({type:"function_call",id:M!=null?M:Z.toolCallId,call_id:Z.toolCallId,name:Z.toolName,arguments:JSON.stringify(Z.input),status:"completed"});break}case"tool-result":break;case"reasoning":case"file":{Y.push({type:"other",message:`xAI Responses API does not support ${Z.type} in assistant messages`});break}default:{let M=Z;Y.push({type:"other",message:"xAI Responses API does not support this content type in assistant messages"})}}break}case"tool":{for(let Z of X.content){if(Z.type==="tool-approval-response")continue;let M=Z.output,E;switch(M.type){case"text":case"error-text":E=M.value;break;case"execution-denied":E=(z=M.reason)!=null?z:"tool execution denied";break;case"json":case"error-json":E=JSON.stringify(M.value);break;case"content":E=M.value.map((F)=>{if(F.type==="text")return F.text;return""}).join("");break;default:{let F=M;E=""}}A.push({type:"function_call_output",call_id:Z.toolCallId,output:E})}break}default:{let Z=X;Y.push({type:"other",message:"unsupported message role"})}}return{input:A,inputWarnings:Y}}function ZG(J){var D,L,q,K;let z=(L=(D=J.input_tokens_details)==null?void 0:D.cached_tokens)!=null?L:0,A=(K=(q=J.output_tokens_details)==null?void 0:q.reasoning_tokens)!=null?K:0,Y=z<=J.input_tokens;return{inputTokens:{total:Y?J.input_tokens:J.input_tokens+z,noCache:Y?J.input_tokens-z:J.input_tokens,cacheRead:z,cacheWrite:void 0},outputTokens:{total:J.output_tokens,text:J.output_tokens-A,reasoning:A},raw:J}}function o(J){switch(J){case"stop":case"completed":return"stop";case"length":case"max_output_tokens":return"length";case"tool_calls":case"function_call":return"tool-calls";case"content_filter":return"content-filter";default:return"other"}}var KG=G.union([G.object({type:G.literal("url_citation"),url:G.string(),title:G.string().optional()}),G.object({type:G.string()})]),AG=G.object({type:G.string(),text:G.string().optional(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),jG=G.object({type:G.string(),text:G.string()}),i=G.object({name:G.string().optional(),arguments:G.string().optional(),input:G.string().optional(),call_id:G.string().optional(),id:G.string(),status:G.string(),action:G.any().optional()}),tG=G.object({name:G.string().optional(),arguments:G.string().optional(),output:G.string().optional(),error:G.string().optional(),id:G.string(),status:G.string(),server_label:G.string().optional()}),DG=G.discriminatedUnion("type",[G.object({type:G.literal("web_search_call"),...i.shape}),G.object({type:G.literal("x_search_call"),...i.shape}),G.object({type:G.literal("code_interpreter_call"),...i.shape}),G.object({type:G.literal("code_execution_call"),...i.shape}),G.object({type:G.literal("view_image_call"),...i.shape}),G.object({type:G.literal("view_x_video_call"),...i.shape}),G.object({type:G.literal("file_search_call"),id:G.string(),status:G.string(),queries:G.array(G.string()).optional(),results:G.array(G.object({file_id:G.string(),filename:G.string(),score:G.number(),text:G.string()})).nullish()}),G.object({type:G.literal("custom_tool_call"),...i.shape}),G.object({type:G.literal("mcp_call"),...tG.shape}),G.object({type:G.literal("message"),role:G.string(),content:G.array(AG),id:G.string(),status:G.string()}),G.object({type:G.literal("function_call"),name:G.string(),arguments:G.string(),call_id:G.string(),id:G.string()}),G.object({type:G.literal("reasoning"),id:G.string(),summary:G.array(jG),status:G.string(),encrypted_content:G.string().nullish()})]),qG=G.object({input_tokens:G.number(),output_tokens:G.number(),total_tokens:G.number().optional(),input_tokens_details:G.object({cached_tokens:G.number().optional()}).optional(),output_tokens_details:G.object({reasoning_tokens:G.number().optional()}).optional(),num_sources_used:G.number().optional(),num_server_side_tools_used:G.number().optional()}),t=G.object({id:G.string().nullish(),created_at:G.number().nullish(),model:G.string().nullish(),object:G.literal("response"),output:G.array(DG),usage:qG.nullish(),status:G.string()}),eG=G.union([G.object({type:G.literal("response.created"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.in_progress"),response:t.partial({usage:!0,status:!0})}),G.object({type:G.literal("response.output_item.added"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.output_item.done"),item:DG,output_index:G.number()}),G.object({type:G.literal("response.content_part.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.content_part.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),part:AG}),G.object({type:G.literal("response.output_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string(),logprobs:G.array(G.any()).optional()}),G.object({type:G.literal("response.output_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string(),logprobs:G.array(G.any()).optional(),annotations:G.array(KG).optional()}),G.object({type:G.literal("response.output_text.annotation.added"),item_id:G.string(),output_index:G.number(),content_index:G.number(),annotation_index:G.number(),annotation:KG}),G.object({type:G.literal("response.reasoning_summary_part.added"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_part.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),part:jG}),G.object({type:G.literal("response.reasoning_summary_text.delta"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_summary_text.done"),item_id:G.string(),output_index:G.number(),summary_index:G.number(),text:G.string()}),G.object({type:G.literal("response.reasoning_text.delta"),item_id:G.string(),output_index:G.number(),content_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.reasoning_text.done"),item_id:G.string(),output_index:G.number(),content_index:G.number(),text:G.string()}),G.object({type:G.literal("response.web_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.web_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.x_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.searching"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.file_search_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_execution_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.interpreting"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.code_interpreter_call_code.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.code_interpreter_call_code.done"),item_id:G.string(),output_index:G.number(),code:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.custom_tool_call_input.done"),item_id:G.string(),output_index:G.number(),input:G.string()}),G.object({type:G.literal("response.function_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.function_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string()}),G.object({type:G.literal("response.mcp_call.in_progress"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.executing"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.completed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call.failed"),item_id:G.string(),output_index:G.number()}),G.object({type:G.literal("response.mcp_call_arguments.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_arguments.done"),item_id:G.string(),output_index:G.number(),arguments:G.string().optional()}),G.object({type:G.literal("response.mcp_call_output.delta"),item_id:G.string(),output_index:G.number(),delta:G.string()}),G.object({type:G.literal("response.mcp_call_output.done"),item_id:G.string(),output_index:G.number(),output:G.string().optional()}),G.object({type:G.literal("response.incomplete"),response:G.object({incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("response.failed"),response:G.object({error:G.object({code:G.string().nullish(),message:G.string()}).nullish(),incomplete_details:G.object({reason:G.string()}).nullish(),usage:qG.nullish()})}),G.object({type:G.literal("error"),code:G.string().nullish(),message:G.string(),param:G.string().nullish()}),G.object({type:G.literal("response.done"),response:t}),G.object({type:G.literal("response.completed"),response:t})]),oG=G.object({reasoningEffort:G.enum(["low","medium","high"]).optional(),logprobs:G.boolean().optional(),topLogprobs:G.number().int().min(0).max(8).optional(),store:G.boolean().optional(),previousResponseId:G.string().optional(),include:G.array(G.enum(["file_search_call.results"])).nullish()}),GJ=v(()=>k(G.object({vectorStoreIds:G.array(G.string()),maxNumResults:G.number().optional()}))),JJ=v(()=>k(G.object({queries:G.array(G.string()),results:G.array(G.object({fileId:G.string(),filename:G.string(),score:G.number().min(0).max(1),text:G.string()})).nullable()}))),QJ=_({id:"xai.file_search",inputSchema:v(()=>k(G.object({}))),outputSchema:JJ}),XJ=(J)=>QJ(J),YJ=v(()=>k(G.object({serverUrl:G.string().describe("The URL of the MCP server"),serverLabel:G.string().optional().describe("A label for the MCP server"),serverDescription:G.string().optional().describe("Description of the MCP server"),allowedTools:G.array(G.string()).optional().describe("List of allowed tool names"),headers:G.record(G.string(),G.string()).optional().describe("Custom headers to send"),authorization:G.string().optional().describe("Authorization header value")}))),ZJ=v(()=>k(G.object({name:G.string(),arguments:G.string(),result:G.unknown()}))),$J=_({id:"xai.mcp",inputSchema:v(()=>k(G.object({}))),outputSchema:ZJ}),KJ=(J)=>$J(J),AJ=v(()=>k(G.object({allowedDomains:G.array(G.string()).max(5).optional(),excludedDomains:G.array(G.string()).max(5).optional(),enableImageUnderstanding:G.boolean().optional()}))),jJ=v(()=>k(G.object({query:G.string(),sources:G.array(G.object({title:G.string(),url:G.string(),snippet:G.string()}))}))),DJ=_({id:"xai.web_search",inputSchema:v(()=>k(G.object({}))),outputSchema:jJ}),qJ=(J={})=>DJ(J),zJ=v(()=>k(G.object({allowedXHandles:G.array(G.string()).max(10).optional(),excludedXHandles:G.array(G.string()).max(10).optional(),fromDate:G.string().optional(),toDate:G.string().optional(),enableImageUnderstanding:G.boolean().optional(),enableVideoUnderstanding:G.boolean().optional()}))),VJ=v(()=>k(G.object({query:G.string(),posts:G.array(G.object({author:G.string(),text:G.string(),url:G.string(),likes:G.number()}))}))),LJ=_({id:"xai.x_search",inputSchema:v(()=>k(G.object({}))),outputSchema:VJ}),UJ=(J={})=>LJ(J);async function HJ({tools:J,toolChoice:D}){let L=(J==null?void 0:J.length)?J:void 0,q=[];if(L==null)return{tools:void 0,toolChoice:void 0,toolWarnings:q};let K=[],z=new Map;for(let Y of L)if(z.set(Y.name,Y),Y.type==="provider")switch(Y.id){case"xai.web_search":{let X=await s({value:Y.args,schema:AJ});K.push({type:"web_search",allowed_domains:X.allowedDomains,excluded_domains:X.excludedDomains,enable_image_understanding:X.enableImageUnderstanding});break}case"xai.x_search":{let X=await s({value:Y.args,schema:zJ});K.push({type:"x_search",allowed_x_handles:X.allowedXHandles,excluded_x_handles:X.excludedXHandles,from_date:X.fromDate,to_date:X.toDate,enable_image_understanding:X.enableImageUnderstanding,enable_video_understanding:X.enableVideoUnderstanding});break}case"xai.code_execution":{K.push({type:"code_interpreter"});break}case"xai.view_image":{K.push({type:"view_image"});break}case"xai.view_x_video":{K.push({type:"view_x_video"});break}case"xai.file_search":{let X=await s({value:Y.args,schema:GJ});K.push({type:"file_search",vector_store_ids:X.vectorStoreIds,max_num_results:X.maxNumResults});break}case"xai.mcp":{let X=await s({value:Y.args,schema:YJ});K.push({type:"mcp",server_url:X.serverUrl,server_label:X.serverLabel,server_description:X.serverDescription,allowed_tools:X.allowedTools,headers:X.headers,authorization:X.authorization});break}default:{q.push({type:"unsupported",feature:`provider-defined tool ${Y.name}`});break}}else K.push({type:"function",name:Y.name,description:Y.description,parameters:Y.inputSchema,...Y.strict!=null?{strict:Y.strict}:{}});if(D==null)return{tools:K,toolChoice:void 0,toolWarnings:q};let A=D.type;switch(A){case"auto":case"none":return{tools:K,toolChoice:A,toolWarnings:q};case"required":return{tools:K,toolChoice:"required",toolWarnings:q};case"tool":{let Y=z.get(D.toolName);if(Y==null)return{tools:K,toolChoice:void 0,toolWarnings:q};if(Y.type==="provider")return q.push({type:"unsupported",feature:`toolChoice for server-side tool "${Y.name}"`}),{tools:K,toolChoice:void 0,toolWarnings:q};return{tools:K,toolChoice:{type:"function",name:Y.name},toolWarnings:q}}default:throw new c({functionality:`tool choice type: ${A}`})}}var MJ=class{constructor(J,D){this.specificationVersion="v3",this.supportedUrls={"image/*":[/^https?:\/\/.*$/]},this.modelId=J,this.config=D}get provider(){return this.config.provider}async getArgs({prompt:J,maxOutputTokens:D,temperature:L,topP:q,stopSequences:K,seed:z,responseFormat:A,providerOptions:Y,tools:X,toolChoice:Z}){var M,E,F,B,R,N,$;let W=[],H=(M=await p({provider:"xai",providerOptions:Y,schema:oG}))!=null?M:{};if(K!=null)W.push({type:"unsupported",feature:"stopSequences"});let O=(E=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.web_search"))==null?void 0:E.name,C=(F=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.x_search"))==null?void 0:F.name,w=(B=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.code_execution"))==null?void 0:B.name,j=(R=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.mcp"))==null?void 0:R.name,y=(N=X==null?void 0:X.find((x)=>x.type==="provider"&&x.id==="xai.file_search"))==null?void 0:N.name,{input:S,inputWarnings:h}=await sG({prompt:J,store:!0});W.push(...h);let{tools:m,toolChoice:I,toolWarnings:P}=await HJ({tools:X,toolChoice:Z});W.push(...P);let f=H.include?[...H.include]:void 0;if(H.store===!1)if(f==null)f=["reasoning.encrypted_content"];else f=[...f,"reasoning.encrypted_content"];let U={model:this.modelId,input:S,logprobs:H.logprobs===!0||H.topLogprobs!=null?!0:void 0,top_logprobs:H.topLogprobs,max_output_tokens:D,temperature:L,top_p:q,seed:z,...(A==null?void 0:A.type)==="json"&&{text:{format:A.schema!=null?{type:"json_schema",strict:!0,name:($=A.name)!=null?$:"response",description:A.description,schema:A.schema}:{type:"json_object"}}},...H.reasoningEffort!=null&&{reasoning:{effort:H.reasoningEffort}},...H.store===!1&&{store:H.store},...f!=null&&{include:f},...H.previousResponseId!=null&&{previous_response_id:H.previousResponseId}};if(m&&m.length>0)U.tools=m;if(I!=null)U.tool_choice=I;return{args:U,warnings:W,webSearchToolName:O,xSearchToolName:C,codeExecutionToolName:w,mcpToolName:j,fileSearchToolName:y}}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M,E,F,B;let{args:R,warnings:N,webSearchToolName:$,xSearchToolName:W,codeExecutionToolName:H,mcpToolName:O,fileSearchToolName:C}=await this.getArgs(J),{responseHeaders:w,value:j,rawValue:y}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:R,failedResponseHandler:r,successfulResponseHandler:d(t),abortSignal:J.abortSignal,fetch:this.config.fetch}),S=[],h=!1,m=["web_search","web_search_with_snippets","browse_page"],I=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"];for(let P of j.output){if(P.type==="file_search_call"){let f=C!=null?C:"file_search";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:"",providerExecuted:!0}),S.push({type:"tool-result",toolCallId:P.id,toolName:f,result:{queries:(L=P.queries)!=null?L:[],results:(K=(q=P.results)==null?void 0:q.map((U)=>({fileId:U.file_id,filename:U.filename,score:U.score,text:U.text})))!=null?K:null}});continue}if(P.type==="web_search_call"||P.type==="x_search_call"||P.type==="code_interpreter_call"||P.type==="code_execution_call"||P.type==="view_image_call"||P.type==="view_x_video_call"||P.type==="custom_tool_call"||P.type==="mcp_call"){let f=(z=P.name)!=null?z:"";if(m.includes((A=P.name)!=null?A:"")||P.type==="web_search_call")f=$!=null?$:"web_search";else if(I.includes((Y=P.name)!=null?Y:"")||P.type==="x_search_call")f=W!=null?W:"x_search";else if(P.name==="code_execution"||P.type==="code_interpreter_call"||P.type==="code_execution_call")f=H!=null?H:"code_execution";else if(P.type==="mcp_call")f=(X=O!=null?O:P.name)!=null?X:"mcp";let U=P.type==="custom_tool_call"?(Z=P.input)!=null?Z:"":P.type==="mcp_call"?(M=P.arguments)!=null?M:"":(E=P.arguments)!=null?E:"";S.push({type:"tool-call",toolCallId:P.id,toolName:f,input:U,providerExecuted:!0});continue}switch(P.type){case"message":{for(let f of P.content){if(f.text)S.push({type:"text",text:f.text});if(f.annotations){for(let U of f.annotations)if(U.type==="url_citation"&&"url"in U)S.push({type:"source",sourceType:"url",id:this.config.generateId(),url:U.url,title:(F=U.title)!=null?F:U.url})}}break}case"function_call":{h=!0,S.push({type:"tool-call",toolCallId:P.call_id,toolName:P.name,input:P.arguments});break}case"reasoning":{let f=P.summary.map((U)=>U.text).filter((U)=>U&&U.length>0);if(f.length>0){let U=f.join("");if(P.encrypted_content||P.id)S.push({type:"reasoning",text:U,providerMetadata:{xai:{...P.encrypted_content&&{reasoningEncryptedContent:P.encrypted_content},...P.id&&{itemId:P.id}}}});else S.push({type:"reasoning",text:U})}break}default:break}}return{content:S,finishReason:{unified:h?"tool-calls":o(j.status),raw:(B=j.status)!=null?B:void 0},usage:j.usage?ZG(j.usage):{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}},request:{body:R},response:{...JG(j),headers:w,body:y},warnings:N}}async doStream(J){var D;let{args:L,warnings:q,webSearchToolName:K,xSearchToolName:z,codeExecutionToolName:A,mcpToolName:Y,fileSearchToolName:X}=await this.getArgs(J),Z={...L,stream:!0},{responseHeaders:M,value:E}=await u({url:`${(D=this.config.baseURL)!=null?D:"https://api.x.ai/v1"}/responses`,headers:g(this.config.headers(),J.headers),body:Z,failedResponseHandler:r,successfulResponseHandler:YG(eG),abortSignal:J.abortSignal,fetch:this.config.fetch}),F={unified:"other",raw:void 0},B=!1,R=void 0,N=!0,$={},W=new Set,H={},O={},C=this;return{stream:E.pipeThrough(new TransformStream({start(w){w.enqueue({type:"stream-start",warnings:q})},transform(w,j){var y,S,h,m,I,P,f,U,x,zG,VG,LG,UG,HG,MG;if(J.includeRawChunks)j.enqueue({type:"raw",rawValue:w.rawValue});if(!w.success){j.enqueue({type:"error",error:w.error});return}let V=w.value;if(V.type==="response.created"||V.type==="response.in_progress"){if(N)j.enqueue({type:"response-metadata",...JG(V.response)}),N=!1;return}if(V.type==="response.reasoning_summary_part.added"){let Q=`reasoning-${V.item_id}`;O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}})}if(V.type==="response.reasoning_summary_text.delta"){let Q=`reasoning-${V.item_id}`;j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_summary_text.done")return;if(V.type==="response.reasoning_text.delta"){let Q=`reasoning-${V.item_id}`;if(O[V.item_id]==null)O[V.item_id]={},j.enqueue({type:"reasoning-start",id:Q,providerMetadata:{xai:{itemId:V.item_id}}});j.enqueue({type:"reasoning-delta",id:Q,delta:V.delta,providerMetadata:{xai:{itemId:V.item_id}}});return}if(V.type==="response.reasoning_text.done")return;if(V.type==="response.output_text.delta"){let Q=`text-${V.item_id}`;if($[Q]==null)$[Q]={type:"text"},j.enqueue({type:"text-start",id:Q});j.enqueue({type:"text-delta",id:Q,delta:V.delta});return}if(V.type==="response.output_text.done"){if(V.annotations){for(let Q of V.annotations)if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(y=Q.title)!=null?y:Q.url})}return}if(V.type==="response.output_text.annotation.added"){let Q=V.annotation;if(Q.type==="url_citation"&&"url"in Q)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:Q.url,title:(S=Q.title)!=null?S:Q.url});return}if(V.type==="response.done"||V.type==="response.completed"||V.type==="response.incomplete"){let Q=V.response;if(Q.usage)R=ZG(Q.usage);if(V.type==="response.incomplete"){let T="incomplete_details"in Q?(h=Q.incomplete_details)==null?void 0:h.reason:void 0;F={unified:T?o(T):"other",raw:T!=null?T:"incomplete"}}else if("status"in Q&&Q.status)F={unified:B?"tool-calls":o(Q.status),raw:Q.status};return}if(V.type==="response.failed"){let Q=(m=V.response.incomplete_details)==null?void 0:m.reason;if(F={unified:Q?o(Q):"error",raw:Q!=null?Q:"error"},V.response.usage)R=ZG(V.response.usage);return}if(V.type==="error"){j.enqueue({type:"error",error:V});return}if(V.type==="response.custom_tool_call_input.delta"||V.type==="response.custom_tool_call_input.done")return;if(V.type==="response.function_call_arguments.delta"){let Q=H[V.output_index];if(Q!=null)j.enqueue({type:"tool-input-delta",id:Q.toolCallId,delta:V.delta});return}if(V.type==="response.function_call_arguments.done")return;if(V.type==="response.output_item.added"||V.type==="response.output_item.done"){let Q=V.item;if(Q.type==="reasoning"){if(V.type==="response.output_item.done"){let T=`reasoning-${Q.id}`;if(!(Q.id in O))O[Q.id]={},j.enqueue({type:"reasoning-start",id:T,providerMetadata:{xai:{...Q.id&&{itemId:Q.id}}}});j.enqueue({type:"reasoning-end",id:T,providerMetadata:{xai:{...Q.encrypted_content&&{reasoningEncryptedContent:Q.encrypted_content},...Q.id&&{itemId:Q.id}}}}),delete O[Q.id]}return}if(Q.type==="file_search_call"){let T=X!=null?X:"file_search";if(!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:T}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:""}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:T,input:"",providerExecuted:!0});if(V.type==="response.output_item.done")j.enqueue({type:"tool-result",toolCallId:Q.id,toolName:T,result:{queries:(I=Q.queries)!=null?I:[],results:(f=(P=Q.results)==null?void 0:P.map((b)=>({fileId:b.file_id,filename:b.filename,score:b.score,text:b.text})))!=null?f:null}});return}if(Q.type==="web_search_call"||Q.type==="x_search_call"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call"||Q.type==="view_image_call"||Q.type==="view_x_video_call"||Q.type==="custom_tool_call"||Q.type==="mcp_call"){let T=["web_search","web_search_with_snippets","browse_page"],b=["x_user_search","x_keyword_search","x_semantic_search","x_thread_fetch"],n=(U=Q.name)!=null?U:"";if(T.includes((x=Q.name)!=null?x:"")||Q.type==="web_search_call")n=K!=null?K:"web_search";else if(b.includes((zG=Q.name)!=null?zG:"")||Q.type==="x_search_call")n=z!=null?z:"x_search";else if(Q.name==="code_execution"||Q.type==="code_interpreter_call"||Q.type==="code_execution_call")n=A!=null?A:"code_execution";else if(Q.type==="mcp_call")n=(VG=Y!=null?Y:Q.name)!=null?VG:"mcp";let PG=Q.type==="custom_tool_call"?(LG=Q.input)!=null?LG:"":Q.type==="mcp_call"?(UG=Q.arguments)!=null?UG:"":(HG=Q.arguments)!=null?HG:"";if((Q.type==="custom_tool_call"?V.type==="response.output_item.done":!W.has(Q.id))&&!W.has(Q.id))W.add(Q.id),j.enqueue({type:"tool-input-start",id:Q.id,toolName:n}),j.enqueue({type:"tool-input-delta",id:Q.id,delta:PG}),j.enqueue({type:"tool-input-end",id:Q.id}),j.enqueue({type:"tool-call",toolCallId:Q.id,toolName:n,input:PG,providerExecuted:!0});return}if(Q.type==="message")for(let T of Q.content){if(T.text&&T.text.length>0){let b=`text-${Q.id}`;if($[b]==null)$[b]={type:"text"},j.enqueue({type:"text-start",id:b}),j.enqueue({type:"text-delta",id:b,delta:T.text})}if(T.annotations){for(let b of T.annotations)if(b.type==="url_citation"&&"url"in b)j.enqueue({type:"source",sourceType:"url",id:C.config.generateId(),url:b.url,title:(MG=b.title)!=null?MG:b.url})}}else if(Q.type==="function_call"){if(V.type==="response.output_item.added")H[V.output_index]={toolName:Q.name,toolCallId:Q.call_id},j.enqueue({type:"tool-input-start",id:Q.call_id,toolName:Q.name});else if(V.type==="response.output_item.done")B=!0,H[V.output_index]=void 0,j.enqueue({type:"tool-input-end",id:Q.call_id}),j.enqueue({type:"tool-call",toolCallId:Q.call_id,toolName:Q.name,input:Q.arguments})}}},flush(w){for(let[j,y]of Object.entries($))if(y.type==="text")w.enqueue({type:"text-end",id:j});w.enqueue({type:"finish",finishReason:F,usage:R!=null?R:{inputTokens:{total:0,noCache:0,cacheRead:0,cacheWrite:0},outputTokens:{total:0,text:0,reasoning:0}}})}})),request:{body:Z},response:{headers:M}}}},PJ=G.object({output:G.string().describe("the output of the code execution"),error:G.string().optional().describe("any error that occurred")}),EJ=_({id:"xai.code_execution",inputSchema:G.object({}).describe("no input parameters"),outputSchema:PJ}),WJ=(J={})=>EJ(J),BJ=G.object({description:G.string().describe("description of the image"),objects:G.array(G.string()).optional().describe("objects detected in the image")}),FJ=_({id:"xai.view_image",inputSchema:G.object({}).describe("no input parameters"),outputSchema:BJ}),NJ=(J={})=>FJ(J),wJ=G.object({transcript:G.string().optional().describe("transcript of the video"),description:G.string().describe("description of the video content"),duration:G.number().optional().describe("duration in seconds")}),SJ=_({id:"xai.view_x_video",inputSchema:G.object({}).describe("no input parameters"),outputSchema:wJ}),OJ=(J={})=>SJ(J),fJ={codeExecution:WJ,fileSearch:XJ,mcpServer:KJ,viewImage:NJ,viewXVideo:OJ,webSearch:qJ,xSearch:UJ},CJ="3.0.82",a=G.string().min(1),yJ=G.enum(["480p","720p"]),IJ=G.enum(["edit-video","extend-video","reference-to-video"]),e={pollIntervalMs:G.number().positive().nullish(),pollTimeoutMs:G.number().positive().nullish(),resolution:yJ.nullish()},RJ=G.object({...e,mode:G.literal("edit-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),xJ=G.object({...e,mode:G.literal("extend-video"),videoUrl:a,referenceImageUrls:G.undefined().optional()}),TJ=G.object({...e,mode:G.literal("reference-to-video"),referenceImageUrls:G.array(a).min(1).max(7),videoUrl:G.undefined().optional()}),vJ=G.object({...e,mode:G.undefined().optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional()}),IQ=G.union([RJ,xJ,TJ,vJ]),kJ=G.object({mode:IJ.optional(),videoUrl:a.optional(),referenceImageUrls:G.array(a).min(1).max(7).optional(),...e}).passthrough(),bJ=v(()=>k(kJ)),hJ={"1280x720":"720p","854x480":"480p","640x480":"480p"};function _J(J){if((J==null?void 0:J.mode)!=null)return J.mode;if((J==null?void 0:J.videoUrl)!=null)return"edit-video";if((J==null?void 0:J.referenceImageUrls)!=null&&J.referenceImageUrls.length>0)return"reference-to-video";return}var mJ=class{constructor(J,D){this.modelId=J,this.config=D,this.specificationVersion="v3",this.maxVideosPerCall=1}get provider(){return this.config.provider}async doGenerate(J){var D,L,q,K,z,A,Y,X,Z,M;let E=(q=(L=(D=this.config._internal)==null?void 0:D.currentDate)==null?void 0:L.call(D))!=null?q:new Date,F=[],B=await p({provider:"xai",providerOptions:J.providerOptions,schema:bJ}),R=_J(B),N=R==="edit-video",$=R==="extend-video",W=R==="reference-to-video";if(J.fps!=null)F.push({type:"unsupported",feature:"fps",details:"xAI video models do not support custom FPS."});if(J.seed!=null)F.push({type:"unsupported",feature:"seed",details:"xAI video models do not support seed."});if(J.n!=null&&J.n>1)F.push({type:"unsupported",feature:"n",details:"xAI video models do not support generating multiple videos per call. Only 1 video will be generated."});if(N&&J.duration!=null)F.push({type:"unsupported",feature:"duration",details:"xAI video editing does not support custom duration."});if(N&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video editing does not support custom aspect ratio."});if(N&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video editing does not support custom resolution."});if($&&J.aspectRatio!=null)F.push({type:"unsupported",feature:"aspectRatio",details:"xAI video extension does not support custom aspect ratio."});if($&&((B==null?void 0:B.resolution)!=null||J.resolution!=null))F.push({type:"unsupported",feature:"resolution",details:"xAI video extension does not support custom resolution."});let H={model:this.modelId,prompt:J.prompt},O=!N,C=!N&&!$,w=!N&&!$;if(O&&J.duration!=null)H.duration=J.duration;if(C&&J.aspectRatio!=null)H.aspect_ratio=J.aspectRatio;if(w&&(B==null?void 0:B.resolution)!=null)H.resolution=B.resolution;else if(w&&J.resolution!=null){let U=hJ[J.resolution];if(U!=null)H.resolution=U;else F.push({type:"unsupported",feature:"resolution",details:`Unrecognized resolution "${J.resolution}". Use providerOptions.xai.resolution with "480p" or "720p" instead.`})}if(N)H.video={url:B.videoUrl};if($)H.video={url:B.videoUrl};if(J.image!=null)if(J.image.type==="url")H.image={url:J.image.url};else{let U=typeof J.image.data==="string"?J.image.data:wG(J.image.data);H.image={url:`data:${J.image.mediaType};base64,${U}`}}if(W)H.reference_images=B.referenceImageUrls.map((U)=>({url:U}));if(B!=null){for(let[U,x]of Object.entries(B))if(!["mode","pollIntervalMs","pollTimeoutMs","resolution","videoUrl","referenceImageUrls"].includes(U))H[U]=x}let j=(K=this.config.baseURL)!=null?K:"https://api.x.ai/v1",y;if(N)y=`${j}/videos/edits`;else if($)y=`${j}/videos/extensions`;else y=`${j}/videos/generations`;let{value:S}=await u({url:y,headers:g(this.config.headers(),J.headers),body:H,failedResponseHandler:r,successfulResponseHandler:d(gJ),abortSignal:J.abortSignal,fetch:this.config.fetch}),h=S.request_id;if(!h)throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:`No request_id returned from xAI API. Response: ${JSON.stringify(S)}`});let m=(z=B==null?void 0:B.pollIntervalMs)!=null?z:5000,I=(A=B==null?void 0:B.pollTimeoutMs)!=null?A:600000,P=Date.now(),f;while(!0){if(await FG(m,{abortSignal:J.abortSignal}),Date.now()-P>I)throw new l({name:"XAI_VIDEO_GENERATION_TIMEOUT",message:`Video generation timed out after ${I}ms`});let{value:U,responseHeaders:x}=await XG({url:`${j}/videos/${h}`,headers:g(this.config.headers(),J.headers),successfulResponseHandler:d(uJ),failedResponseHandler:r,abortSignal:J.abortSignal,fetch:this.config.fetch});if(f=x,U.status==="done"||U.status==null&&((Y=U.video)==null?void 0:Y.url)){if(((X=U.video)==null?void 0:X.respect_moderation)===!1)throw new l({name:"XAI_VIDEO_MODERATION_ERROR",message:"Video generation was blocked due to a content policy violation."});if(!((Z=U.video)==null?void 0:Z.url))throw new l({name:"XAI_VIDEO_GENERATION_ERROR",message:"Video generation completed but no video URL was returned."});return{videos:[{type:"url",url:U.video.url,mediaType:"video/mp4"}],warnings:F,response:{timestamp:E,modelId:this.modelId,headers:f},providerMetadata:{xai:{requestId:h,videoUrl:U.video.url,...U.video.duration!=null?{duration:U.video.duration}:{},...((M=U.usage)==null?void 0:M.cost_in_usd_ticks)!=null?{costInUsdTicks:U.usage.cost_in_usd_ticks}:{},...U.progress!=null?{progress:U.progress}:{}}}}}if(U.status==="expired")throw new l({name:"XAI_VIDEO_GENERATION_EXPIRED",message:"Video generation request expired."});if(U.status==="failed")throw new l({name:"XAI_VIDEO_GENERATION_FAILED",message:"Video generation failed."})}}},gJ=G.object({request_id:G.string().nullish()}),uJ=G.object({status:G.string().nullish(),video:G.object({url:G.string(),duration:G.number().nullish(),respect_moderation:G.boolean().nullish()}).nullish(),model:G.string().nullish(),usage:G.object({cost_in_usd_ticks:G.number().nullish()}).nullish(),progress:G.number().nullish(),error:G.object({code:G.string().nullish(),message:G.string().nullish()}).nullish()});function dJ(J={}){var D;let L=xG((D=J.baseURL)!=null?D:"https://api.x.ai/v1"),q=()=>OG({Authorization:`Bearer ${fG({apiKey:J.apiKey,environmentVariableName:"XAI_API_KEY",description:"xAI API key"})}`,...J.headers},`ai-sdk/xai/${CJ}`),K=(Z)=>{return new cG(Z,{provider:"xai.chat",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},z=(Z)=>{return new MJ(Z,{provider:"xai.responses",baseURL:L,headers:q,generateId:$G,fetch:J.fetch})},A=(Z)=>{return new aG(Z,{provider:"xai.image",baseURL:L,headers:q,fetch:J.fetch})},Y=(Z)=>{return new mJ(Z,{provider:"xai.video",baseURL:L,headers:q,fetch:J.fetch})},X=(Z)=>K(Z);return X.specificationVersion="v3",X.languageModel=K,X.chat=K,X.responses=z,X.embeddingModel=(Z)=>{throw new BG({modelId:Z,modelType:"embeddingModel"})},X.textEmbeddingModel=X.embeddingModel,X.imageModel=A,X.image=A,X.videoModel=Y,X.video=Y,X.tools=fJ,X}var RQ=dJ();export{fJ as xaiTools,RQ as xai,UJ as xSearch,qJ as webSearch,OJ as viewXVideo,NJ as viewImage,KJ as mcpServer,dJ as createXai,WJ as codeExecution,CJ as VERSION};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bf as a}from"./chunk-qfz0a58d.js";import"./chunk-tfggzzqw.js";import"./chunk-nfg7nt13.js";import"./chunk-aqm597px.js";import"./chunk-0rmmg3g4.js";export{a as default};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Js as L,Ws as Y}from"./chunk-d0m7nbbx.js";import{Ys as Hr}from"./chunk-7w84hfxs.js";import{MD as go,PN as k,TG as W,bC as rr,qE as ar}from"./chunk-ag9thqkv.js";import{fO as J,iO as ho,jO as vo}from"./chunk-0rmmg3g4.js";var Po={};J(Po,{validateArchiveMetadata:()=>Uo,validateArchiveEntries:()=>Ko,replaceDirectoryAtomically:()=>Xo,extractZip:()=>Pr,assertArchiveDestinationSafe:()=>no});import I from"path";import Q from"fs/promises";function Ko(o,r){let a=I.resolve(r);for(let m of o){let n=m.trim().replaceAll("\\","/");if(!n)continue;if(n.includes("\x00")||I.posix.isAbsolute(n)||/^[a-z]:\//i.test(n))throw Error(`Unsafe archive entry: ${m}`);if(n.split("/").includes(".."))throw Error(`Unsafe archive entry: ${m}`);let f=I.resolve(a,...n.split("/"));if(f!==a&&!f.startsWith(`${a}${I.sep}`))throw Error(`Unsafe archive entry: ${m}`)}}function Uo(o){for(let r of o.split(/\r?\n/))if(/^[bclps]/.test(r))throw Error("Archive contains an unsafe special entry")}async function Yo(o){let r=await Q.readdir(o,{withFileTypes:!0});await Promise.all(r.map(async(a)=>{let m=I.join(o,a.name);if(a.isSymbolicLink())throw Error(`Archive contains a symbolic link: ${a.name}`);if(a.isDirectory())await Yo(m)}))}async function qo(o){return Q.lstat(o).catch((r)=>{if(r.code==="ENOENT")return;throw r})}async function no(o){let r=I.resolve(o),a=I.parse(r),m=a.root;for(let n of r.slice(a.root.length).split(I.sep).filter(Boolean)){m=I.join(m,n);let f=await qo(m);if(!f)return;if(f.isSymbolicLink())throw Error(`Archive destination contains a symbolic link: ${m}`)}}async function Xo(o,r){let a=I.resolve(r);await no(a);let m=await qo(a);if(m&&!m.isDirectory())throw Error("Archive destination must be a directory");let n=I.join(I.dirname(a),`.qitqode-backup-${crypto.randomUUID()}`);if(m)await Q.rename(a,n);try{await Q.rename(o,a)}catch(f){if(m)await Q.rename(n,a);throw f}if(m)await Q.rm(n,{recursive:!0,force:!0})}async function Pr(o,r){let a=I.resolve(o),m=I.resolve(r),n=await L(process.platform==="win32"?["tar","-tf",a]:["unzip","-Z1",a]);Ko(n.stdout.toString().split(/\r?\n/),m);let f=await L(process.platform==="win32"?["tar","-tvf",a]:["unzip","-Z","-l",a]);Uo(f.stdout.toString()),await no(I.dirname(m)),await Q.mkdir(I.dirname(m),{recursive:!0}),await no(I.dirname(m));let s=await Q.mkdtemp(I.join(I.dirname(m),".qitqode-extract-"));try{if(process.platform==="win32"){let t=a.replace(/'/g,"''"),x=s.replace(/'/g,"''"),N=`$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -Path '${t}' -DestinationPath '${x}' -Force`;await L(["powershell","-NoProfile","-NonInteractive","-Command",N])}else await L(["unzip","-o","-q",a,"-d",s]);await Yo(s),await Xo(s,m)}finally{await Q.rm(s,{recursive:!0,force:!0})}}var Eo={};J(Eo,{isValidHex:()=>Ao,hexToRgb:()=>Zo,hexToAnsiBold:()=>Ar});function Ao(o){if(!o)return!1;return/^#[0-9a-fA-F]{6}$/.test(o)}function Zo(o){let r=parseInt(o.slice(1,3),16),a=parseInt(o.slice(3,5),16),m=parseInt(o.slice(5,7),16);return{r,g:a,b:m}}function Ar(o){if(!Ao(o))return;let{r,g:a,b:m}=Zo(o);return`\x1B[38;2;${r};${a};${m}m\x1B[1m`}var Lo={};J(Lo,{awaitDeferred:()=>Zr});function Zr(o,r){return W.ensuring(go.await(o),W.sync(r))}import V from"os";var z={};J(z,{Path:()=>H,Global:()=>z});import U from"fs/promises";import uo from"path";import aa from"os";import fo from"path";import dr from"os";import{randomBytes as gr,randomUUID as Lr}from"crypto";import{mkdir as so,readFile as er,rm as E,stat as Dr,utimes as hr,writeFile as eo}from"fs/promises";import{createHash as Er}from"crypto";var bo;((ym)=>{function o(r){return Er("sha1").update(r).digest("hex")}ym.fast=o})(bo||={});var to;((Do)=>{let o;function r(u){o=u}Do.setGlobal=r;let a=()=>{if(!o)throw Error("Flock global not set");return fo.join(o.state,"locks")},m={staleMs:60000,timeoutMs:300000,baseDelayMs:100,maxDelayMs:2000};function n(u){if(typeof u!=="object"||u===null||!("code"in u))return;let i=u.code;if(typeof i!=="string")return;return i}function f(u,i){return new Promise((c,M)=>{if(i?.aborted){M(i.reason??Error("Aborted"));return}let R,b=()=>{i?.removeEventListener("abort",j),c()},j=()=>{if(R)clearTimeout(R);i?.removeEventListener("abort",j),M(i?.reason??Error("Aborted"))};if(i?.addEventListener("abort",j,{once:!0}),R=setTimeout(b,u),i?.aborted)j()})}function s(u){let i=Math.floor(u*0.3),c=Math.floor(Math.random()*(2*i+1))-i;return Math.max(0,u+c)}function t(){return performance.now()}function x(){return performance.timeOrigin+t()}async function N(u){try{return await Dr(u)}catch(i){let c=n(i);if(c==="ENOENT"||c==="ENOTDIR")return;throw i}}async function T(u,i,c,M){let R=x(),b=await N(i);if(b)return R-b.mtimeMs>M;let j=await N(c);if(j)return R-j.mtimeMs>M;let C=await N(u);if(!C)return!1;return R-C.mtimeMs>M}async function P(u,i){let c=Lr?.()??gr(16).toString("hex"),M=fo.join(u,"meta.json"),R=fo.join(u,"heartbeat");try{await so(u,{mode:448})}catch(g){if(n(g)!=="EEXIST")throw g;if(!await T(u,R,M,i.staleMs))return{acquired:!1};let S=u+".breaker";try{await so(S,{mode:448})}catch(B){let Z=n(B);if(Z==="EEXIST"){let Fo=await N(S);if(Fo&&x()-Fo.mtimeMs>i.staleMs)await E(S,{recursive:!0,force:!0}).catch(()=>{return});return{acquired:!1}}if(Z==="ENOENT"||Z==="ENOTDIR")return{acquired:!1};throw B}try{if(!await T(u,R,M,i.staleMs))return{acquired:!1};await E(u,{recursive:!0,force:!0});try{await so(u,{mode:448})}catch(B){let Z=n(B);if(Z==="EEXIST"||Z==="ENOTEMPTY")return{acquired:!1};throw B}}finally{await E(S,{recursive:!0,force:!0}).catch(()=>{return})}}let b={token:c,pid:process.pid,hostname:dr.hostname(),createdAt:new Date().toISOString()};await eo(R,"",{flag:"wx"}).catch(async()=>{throw await E(u,{recursive:!0,force:!0}),Error("Lock acquired but heartbeat already existed (possible compromise).")}),await eo(M,JSON.stringify(b,null,2),{flag:"wx"}).catch(async()=>{throw await E(u,{recursive:!0,force:!0}),Error("Lock acquired but meta.json already existed (possible compromise).")});let j;return{acquired:!0,startHeartbeat:(g=Math.max(100,Math.floor(i.staleMs/3)))=>{if(j)return;j=setInterval(()=>{let S=new Date;hr(R,S,S).catch(()=>{return})},g),j.unref?.()},release:async()=>{if(j)clearInterval(j),j=void 0;if((await er(M,"utf8").then((S)=>{let B=JSON.parse(S);if(!B||typeof B!=="object")return{};return{token:"token"in B&&typeof B.token==="string"?B.token:void 0}}).catch((S)=>{let B=n(S);if(B==="ENOENT"||B==="ENOTDIR")throw Error("Refusing to release: lock is compromised (metadata missing).");if(S instanceof SyntaxError)throw Error("Refusing to release: lock is compromised (metadata invalid).");throw S})).token!==c)throw Error("Refusing to release: lock token mismatch (not the owner).");await E(u,{recursive:!0,force:!0})}}}async function mo(u,i,c){let M=t()+c.timeoutMs,R=0,b=0,j=c.baseDelayMs;while(!0){i.signal?.throwIfAborted();let C=await P(u,c);if(C.acquired)return C;if(t()>M)throw Error(`Timed out waiting for lock: ${i.key}`);R+=1;let A=s(j);await i.onWait?.({key:i.key,attempt:R,delay:A,waited:b}),await f(A,i.signal),b+=A,j=Math.min(c.maxDelayMs,Math.floor(j*1.7))}}async function qr(u,i={}){i.signal?.throwIfAborted();let c={staleMs:i.staleMs??m.staleMs,timeoutMs:i.timeoutMs??m.timeoutMs,baseDelayMs:i.baseDelayMs??m.baseDelayMs,maxDelayMs:i.maxDelayMs??m.maxDelayMs},M=i.dir??a();await so(M,{recursive:!0});let R=fo.join(M,bo.fast(u)+".lock"),b=await mo(R,{key:u,onWait:i.onWait,signal:i.signal},c);b.startHeartbeat();let j,C=()=>{return j??=b.release()};return{release:C,[Symbol.asyncDispose](){return C()}}}Do.acquire=qr;async function Cm(u,i,c={}){let R=[];try{const M=ho(R,await qr(u,c),1);c.signal?.throwIfAborted();return await i()}catch(b){var j=b,C=1}finally{var A=vo(R,j,C);A&&await A}}Do.withLock=Cm,Do.effect=W.fn("Flock.effect")(function*(u,i={}){return yield*W.acquireRelease(W.promise((c)=>to.acquire(u,{...i,signal:c})).pipe(W.withSpan("Flock.acquire",{attributes:{key:u}})),(c)=>W.promise(()=>c.release()).pipe(W.withSpan("Flock.release"))).pipe(W.asVoid)})})(to||={});import w from"path";import vr from"os";import po from"path";var G=vr.homedir(),{env:K}=process,e=K.XDG_DATA_HOME||(G?po.join(G,".local","share"):void 0),io=K.XDG_CONFIG_HOME||(G?po.join(G,".config"):void 0),lo=K.XDG_STATE_HOME||(G?po.join(G,".local","state"):void 0),ko=K.XDG_CACHE_HOME||(G?po.join(G,".cache"):void 0),gm=K.XDG_RUNTIME_DIR||void 0,lr=(K.XDG_DATA_DIRS||"/usr/local/share/:/usr/share/").split(":");if(e)lr.unshift(e);var kr=(K.XDG_CONFIG_DIRS||"/etc/xdg").split(":");if(io)kr.unshift(io);import oa from"os";var D="qitqode";function Bo(o=process.env){let r=o.QITQODE_HOME;if(r){if(!w.isAbsolute(r))throw Error(`QITQODE_HOME must be an absolute path, got: ${JSON.stringify(r)}`);return{mode:"qitqode_home",root:r,data:w.join(r,"data"),cache:w.join(r,"cache"),config:w.join(r,"config"),state:w.join(r,"state")}}return{mode:"xdg",data:w.join(e,D),cache:w.join(ko,D),config:w.join(io,D),state:w.join(lo,D)}}function So(o=process.env){let r=o.QITQODE_LOG_DIR;if(r){if(!w.isAbsolute(r))throw Error(`QITQODE_LOG_DIR must be an absolute path, got: ${JSON.stringify(r)}`);return r}return w.join(e,D,"log")}var ra;((or)=>{class o extends rr.Service()("@qitqode/Global"){}or.Service=o,or.layer=ar.effect(o,W.gen(function*(){let a=process.env.HOME||process.env.USERPROFILE||oa.homedir(),{data:m,cache:n,config:f,state:s}=yield*W.sync(()=>Bo()),t=w.join(n,"bin"),x=yield*W.sync(()=>So());return o.of({home:a,data:m,cache:n,config:f,state:s,bin:t,log:x})}))})(ra||={});var{data:ma,cache:mr,config:na,state:fr}=Bo(),H={get home(){return process.env.HOME||process.env.USERPROFILE||aa.homedir()},data:ma,bin:uo.join(mr,"bin"),log:So(),cache:mr,config:na,state:fr};to.setGlobal({state:fr});await Promise.all([U.mkdir(H.data,{recursive:!0}),U.mkdir(H.config,{recursive:!0}),U.mkdir(H.state,{recursive:!0}),U.mkdir(H.log,{recursive:!0}),U.mkdir(H.bin,{recursive:!0})]);var nr="21",fa=await Y.readText(uo.join(H.cache,"version")).catch(()=>"0");if(fa!==nr){try{let o=await U.readdir(H.cache);await Promise.all(o.map((r)=>U.rm(uo.join(H.cache,r),{recursive:!0,force:!0})))}catch{}await Y.write(uo.join(H.cache,"version"),nr)}var sr="0.1.25",tr="latest",fn="ce4b97b9ea2753ec7138dea390c6d85a8d602346",sn=!1;import sa from"path";var q;async function ir(){if(q)return q;let o=sa.join(z.Path.data,"installation_id"),r=await Y.readText(o).catch(()=>{return});if(r&&r.trim())return q=r.trim(),q;return q=crypto.randomUUID(),await Y.write(o,q),q}var pr="QITQODE_RUN_ID",ur="QITQODE_PROCESS_ROLE";function ta(){return process.env.QITQODE_RUN_ID??=crypto.randomUUID()}function ia(o){return process.env.QITQODE_PROCESS_ROLE??=o}function On(o){return{runID:ta(),processRole:ia(o)}}function Nn(o){let r=Object.fromEntries(Object.entries(process.env).filter((a)=>a[1]!==void 0));return o?Object.assign(r,o):r}function pa(){if(process.env.USER)return process.env.USER;if(process.env.USERNAME)return process.env.USERNAME;return V.userInfo().username}function ua(){return Intl.DateTimeFormat().resolvedOptions().locale}function xa(){return Intl.DateTimeFormat().resolvedOptions().timeZone}async function ca(){let o=V.cpus();return{os:{platform:V.platform(),arch:V.arch(),release:V.release(),hostname:V.hostname()},cpu:{model:o[0]?.model??"unknown",count:o.length},memory:{total_bytes:V.totalmem()},user:{username:pa(),homedir:V.homedir()},runtime:{bun_version:Bun.version,node_version:process.versions.node,pid:process.pid,timezone:xa(),locale:ua()},paths:{cwd:process.cwd(),data:z.Path.data,config:z.Path.config},qitqode:{version:sr,channel:tr,installation_id:await ir(),run_id:pr,process_role:ur}}}var Rr={};J(Rr,{toString:()=>Da,parse:()=>ha,match:()=>La,fromParsedKey:()=>ea});var y={done:!1,hasNext:!1};function X(o,...r){let a=o,m=r.map((f)=>("lazy"in f)?Oa(f):void 0),n=0;for(;n<r.length;){if(m[n]===void 0||!Na(a)){let x=r[n];a=x(a),n+=1;continue}let f=[];for(let x=n;x<r.length;x++){let N=m[x];if(N===void 0||(f.push(N),N.isSingle))break}let s=[];for(let x of a)if(xr(x,s,f))break;let{isSingle:t}=f.at(-1);a=t?s[0]:s,n+=f.length}return a}function xr(o,r,a){if(a.length===0)return r.push(o),!1;let m=o,n=y,f=!1;for(let[s,t]of a.entries()){let{index:x,items:N}=t;if(N.push(m),n=t(m,x,N),t.index+=1,n.hasNext){if(n.hasMany??!1){for(let T of n.next)if(xr(T,r,a.slice(s+1)))return!0;return f}m=n.next}if(!n.hasNext)break;n.done&&(f=!0)}return n.hasNext&&r.push(m),f}function Oa(o){let{lazy:r,lazyArgs:a}=o,m=r(...a);return Object.assign(m,{isSingle:r.single??!1,index:0,items:[]})}function Na(o){return typeof o=="string"||typeof o=="object"&&o!==null&&Symbol.iterator in o}function xo(o,r){let a=r.length-o.length;if(a===1){let[m,...n]=r;return X(m,{lazy:o,lazyArgs:n})}if(a===0){let m={lazy:o,lazyArgs:r};return Object.assign((n)=>X(n,m),m)}throw Error("Wrong number of arguments")}function ja(...o){return xo(Ra,o)}function Ra(){let o=new Set;return(r)=>o.has(r)?y:(o.add(r),{done:!1,hasNext:!0,next:r})}function Ta(...o){return xo(Ia,o)}function Ia(o){let r=o,a=new Set;return(m,n,f)=>{let s=r(m,n,f);return a.has(s)?y:(a.add(s),{done:!1,hasNext:!0,next:m})}}function cr(o,r,a){let m=(n)=>o(n,...r);return a===void 0?m:Object.assign(m,{lazy:a,lazyArgs:r})}function O(o,r,a){let m=o.length-r.length;if(m===0)return o(...r);if(m===1)return cr(o,r,a);throw Error("Wrong number of arguments")}function Ma(...o){return O(Object.values,o)}var Nr={asc:(o,r)=>o>r,desc:(o,r)=>o<r};function co(o,r){let[a,...m]=r;if(!Wa(a)){let f=Jo(...m);return o(a,f)}let n=Jo(a,...m);return(f)=>o(f,n)}function Jo(o,r,...a){let m=typeof o=="function"?o:o[0],n=typeof o=="function"?"asc":o[1],{[n]:f}=Nr,s=r===void 0?void 0:Jo(r,...a);return(t,x)=>{let N=m(t),T=m(x);return f(N,T)?1:f(T,N)?-1:s?.(t,x)??0}}function Wa(o){if(Or(o))return!0;if(typeof o!="object"||!Array.isArray(o))return!1;let[r,a,...m]=o;return Or(r)&&typeof a=="string"&&a in Nr&&m.length===0}var Or=(o)=>typeof o=="function"&&o.length===1;function Oo(...o){return co(ba,o)}var ba=(o,r)=>[...o].sort(r);function Ba(...o){return O(Sa,o)}function Sa(o,r){let a={};for(let[m,n]of Object.entries(o))r(n,m,o)&&(a[m]=n);return a}function wo(o){if(typeof o!="object"||o===null)return!1;let r=Object.getPrototypeOf(o);return r===null||r===Object.prototype}function Ja(...o){return O(jr,o)}function jr(o,r){let a={...o,...r};for(let m in r){if(!(m in o))continue;let{[m]:n}=o;if(!wo(n))continue;let{[m]:f}=r;wo(f)&&(a[m]=jr(n,f))}return a}function h(...o){return O(wa,o)}var wa=(o,r)=>o.length>=r;function za(...o){return O(_a,o)}function _a(o,r){if(!h(r,1))return{...o};if(!h(r,2)){let{[r[0]]:m,...n}=o;return n}let a={...o};for(let m of r)delete a[m];return a}function Ca(...o){return O(Ha,o)}function Ha(o,r){let a={};for(let[m,n]of Object.entries(o)){let f=r(n,m,o);a[m]=f}return a}function Qa(...o){return O($a,o,Ga)}var $a=(o,r)=>o.map(r),Ga=(o)=>(r,a,m)=>({done:!1,hasNext:!0,next:o(r,a,m)});function Va(...o){return O(ya,o)}var ya=(o,r)=>{let a=Object.create(null);for(let m=0;m<o.length;m++){let n=o[m],f=r(n,m,o);if(f!==void 0){let s=a[f];s===void 0?a[f]=[n]:s.push(n)}}return Object.setPrototypeOf(a,Object.prototype),a};function zo(...o){return O(v,o)}function v(o,r){if(o===r||Object.is(o,r))return!0;if(typeof o!="object"||typeof r!="object"||o===null||r===null||Object.getPrototypeOf(o)!==Object.getPrototypeOf(r))return!1;if(Array.isArray(o))return Fa(o,r);if(o instanceof Map)return Ka(o,r);if(o instanceof Set)return Ua(o,r);if(o instanceof Date)return o.getTime()===r.getTime();if(o instanceof RegExp)return o.toString()===r.toString();if(Object.keys(o).length!==Object.keys(r).length)return!1;for(let[a,m]of Object.entries(o))if(!(a in r)||!v(m,r[a]))return!1;return!0}function Fa(o,r){if(o.length!==r.length)return!1;for(let[a,m]of o.entries())if(!v(m,r[a]))return!1;return!0}function Ka(o,r){if(o.size!==r.size)return!1;for(let[a,m]of o.entries())if(!r.has(a)||!v(m,r.get(a)))return!1;return!0}function Ua(o,r){if(o.size!==r.size)return!1;let a=[...r];for(let m of o){let n=!1;for(let[f,s]of a.entries())if(v(m,s)){n=!0,a.splice(f,1);break}if(!n)return!1}return!0}function Ya(...o){return co(qa,o)}function qa(o,r){if(!h(o,2))return o[0];let[a]=o,[,...m]=o;for(let n of m)r(n,a)<0&&(a=n);return a}function Xa(...o){return O(Pa,o,Aa)}var Pa=(o,r)=>o.flatMap(r),Aa=(o)=>(r,a,m)=>{let n=o(r,a,m);return Array.isArray(n)?{done:!1,hasNext:!0,hasMany:!0,next:n}:{done:!1,hasNext:!0,next:n}};function Za(...o){return O(Object.entries,o)}function Ea(...o){return O(da,o,ga)}var da=(o,r)=>o.filter(r),ga=(o)=>(r,a,m)=>o(r,a,m)?{done:!1,hasNext:!0,next:r}:y;function La(o,r){if(!o)return!1;let a={...o,super:o.super??!1},m={...r,super:r.super??!1};return zo(a,m)}function ea(o,r=!1){return{name:o.name===" "?"space":o.name,ctrl:o.ctrl,meta:o.meta,shift:o.shift,super:o.super??!1,leader:r}}function Da(o){if(!o)return"";let r=[];if(o.ctrl)r.push("ctrl");if(o.meta)r.push("alt");if(o.super)r.push("super");if(o.shift)r.push("shift");if(o.name)if(o.name==="delete")r.push("del");else r.push(o.name);let a=r.join("+");if(o.leader)a=a?`<leader> ${a}`:"<leader>";return a}function ha(o){if(o==="none")return[];return o.split(",").map((r)=>{let m=r.replace(/<leader>/g,"leader+").toLowerCase().split("+"),n={ctrl:!1,meta:!1,shift:!1,leader:!1,name:""};for(let f of m)switch(f){case"ctrl":n.ctrl=!0;break;case"alt":case"meta":case"option":n.meta=!0;break;case"super":n.super=!0;break;case"shift":n.shift=!0;break;case"leader":n.leader=!0;break;case"esc":n.name="escape";break;default:n.name=f;break}return n})}var Tr={};J(Tr,{create:()=>la,NotFound:()=>_o});import{AsyncLocalStorage as va}from"async_hooks";class _o extends Error{name;constructor(o){super(`No context found for ${o}`);this.name=o}}function la(o){let r=new va;return{use(){let a=r.getStore();if(!a)throw new _o(o);return a},provide(a,m){return r.run(a,m)}}}var Mr={};J(Mr,{truncateMiddle:()=>nm,truncate:()=>mm,todayTimeOrDateTime:()=>om,titlecase:()=>ka,time:()=>Co,pluralize:()=>fm,number:()=>rm,duration:()=>am,datetime:()=>Ir});function ka(o){return o.replace(/\b\w/g,(r)=>r.toUpperCase())}function Co(o){return new Date(o).toLocaleTimeString(void 0,{timeStyle:"short"})}function Ir(o){let r=new Date(o),a=Co(o),m=r.toLocaleDateString();return`${a} \xB7 ${m}`}function om(o){let r=new Date(o),a=new Date;if(r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()&&r.getDate()===a.getDate())return Co(o);else return Ir(o)}function rm(o){if(o>=1e6)return(o/1e6).toFixed(1)+"M";else if(o>=1000)return(o/1000).toFixed(1)+"K";return o.toString()}function am(o){if(o<1000)return`${o}ms`;if(o<60000)return`${(o/1000).toFixed(1)}s`;if(o<3600000){let m=Math.floor(o/60000),n=Math.floor(o%60000/1000);return`${m}m ${n}s`}if(o<86400000){let m=Math.floor(o/3600000),n=Math.floor(o%3600000/60000);return`${m}h ${n}m`}let r=Math.floor(o%86400000/3600000);return`${Math.floor(o/86400000)}d ${r}h`}function mm(o,r){if(r<=0)return"";if(o.length<=r)return o;return o.slice(0,r-1)+"\u2026"}function nm(o,r=35){if(r<=0)return"";if(o.length<=r)return o;let a="\u2026",m=Math.ceil((r-a.length)/2),n=Math.floor((r-a.length)/2);return o.slice(0,m)+a+(n>0?o.slice(-n):"")}function fm(o,r,a){return(o===1?r:a).replace("{}",o.toString())}var Br={};J(Br,{write:()=>im,read:()=>tm});var l=new Map;function Wr(o){if(!l.has(o))l.set(o,{readers:0,writer:!1,waitingReaders:[],waitingWriters:[]});return l.get(o)}function sm(o){let r=l.get(o);if(!r||r.writer||r.readers>0)return;if(r.waitingWriters.length>0){r.waitingWriters.shift()();return}while(r.waitingReaders.length>0)r.waitingReaders.shift()();if(r.readers===0&&!r.writer&&r.waitingReaders.length===0&&r.waitingWriters.length===0)l.delete(o)}function br(o){return new Promise((r)=>{let a=()=>{o.acquire();let m=!1;r({[Symbol.dispose]:()=>{if(m)return;m=!0,o.release(),sm(o.key)}})};if(o.available())a();else o.waiting.push(a)})}async function tm(o){let r=Wr(o);return br({key:o,available:()=>!r.writer&&r.waitingWriters.length===0,acquire:()=>r.readers++,release:()=>r.readers--,waiting:r.waitingReaders})}async function im(o){let r=Wr(o);return br({key:o,available:()=>!r.writer&&r.readers===0,acquire:()=>{r.writer=!0},release:()=>{r.writer=!1},waiting:r.waitingWriters})}var yr={};J(yr,{redactValue:()=>Go,init:()=>Im,flush:()=>Mm,file:()=>Tm,enabled:()=>jm,create:()=>Vo,Level:()=>xm,Default:()=>Rm});import Io from"path";import F from"fs/promises";import{createWriteStream as Qr}from"fs";var lu="https://qlex.use-api.com/api/v1/qortex/streamTier",ku=new URL("https://qlex.use-api.com/api/v1/qortex/streamTier").origin,Sr="https://qlex.use-api.com/api/v1/qortex/streamTier".replace(/\/streamTier$/,""),ox={name:"QitQode",family:"qlex",npm:"@qitqode/qlex-provider",limit:{context:200000,output:16384},capabilities:{temperature:!0,reasoning:!1,attachment:!0,toolcall:!0,input:{text:!0,audio:!1,image:!0,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},release_date:"2025-07-06"};function No(o){return o.replace(/provider\s+'[^']*'\s*(?:stream\s+)?(?:failed|error)?\s*:?\s*/gi,"").replace(/\b(?:anthropic|openai|google|vertex\s*ai|bedrock|azure|x\.?ai|mistral|deepseek|cohere|groq|together(?:\.ai)?|openrouter|fireworks|perplexity|meta)\b/gi,"").replace(/\b(?:gpt|claude|gemini|grok|llama|qwen|sonnet|opus|haiku|o[0-9])[-\w.]*/gi,"").replace(/\s+/g," ").replace(/^[\s:;,.\-]+/,"").replace(/[\s.]+$/,"").trim()}var rx={notLoggedIn:"Not logged in to QitQode. Run `qitqode auth login` to sign in with your Forgewise account.",rateLimit:"Rate limit exceeded. Please wait a moment before sending more requests.",insufficientBalance:(o)=>{let r=o?No(o):"";return`Insufficient qredits${r?`: ${r}`:""}. Add qredits at qitqode.com to continue.`},invalidCredentials:(o)=>{let r=o?No(o):"";return`QitQode sign-in was rejected by the server${r?` (${r})`:""}. Please sign in again with your Forgewise account or a valid API key.`},gatewayUnavailable:(o)=>{let r=o?No(o):"";return`The QitQode model gateway is unavailable${r?` (${r})`:""}. Your sign-in is still valid \u2014 the model backend isn't reachable through its trusted gateway yet. This is a server-side configuration issue, not a login problem.`},streamFailed:(o)=>{let r=o?No(o):"";return`The QitQode model stream failed${r?`: ${r}`:""}.`},insufficientBalanceFallback:"Insufficient qredits.",insufficientBalanceCliSuffix:" Visit qitqode.com to add qredits.",invalidCredentialsFallback:"QitQode sign-in was rejected by the server. Please sign in again.",apiKeyPrompt:"Paste your Qortex API key:",apiKeyPlaceholder:"qortex-...",loginMenuForgewise:"Sign in with Forgewise account",loginMenuApiKey:"Paste a Qortex API key",waitingForgewise:"\u23F3 Waiting for Forgewise sign-in in your browser\u2026"};function p(o){let r=process.env[o]?.toLowerCase();return r==="true"||r==="1"}function Ho(o){let r=process.env[o]?.toLowerCase();return r==="false"||r==="0"}function $(o){let r=process.env[o];if(!r)return;let a=Number(r);return Number.isInteger(a)&&a>0?a:void 0}var d=p("QITQODE_EXPERIMENTAL"),jo=p("QITQODE_DISABLE_CLAUDE_CODE"),Ro=p("QITQODE_DISABLE_EXTERNAL_SKILLS"),pm=Ro||jo||p("QITQODE_DISABLE_CLAUDE_CODE_SKILLS"),um=process.env.QITQODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT,Jr={OTEL_EXPORTER_OTLP_ENDPOINT:process.env.OTEL_EXPORTER_OTLP_ENDPOINT,OTEL_EXPORTER_OTLP_HEADERS:process.env.OTEL_EXPORTER_OTLP_HEADERS,QITQODE_AUTO_SHARE:p("QITQODE_AUTO_SHARE"),QITQODE_AUTO_HEAP_SNAPSHOT:p("QITQODE_AUTO_HEAP_SNAPSHOT"),QITQODE_GIT_BASH_PATH:process.env.QITQODE_GIT_BASH_PATH,QITQODE_CONFIG:process.env.QITQODE_CONFIG,QITQODE_CONFIG_CONTENT:process.env.QITQODE_CONFIG_CONTENT,get QITQODE_BACKEND_URL(){return process.env.QITQODE_BACKEND_URL??Sr},QITQODE_DISABLE_AUTOUPDATE:p("QITQODE_DISABLE_AUTOUPDATE"),QITQODE_DISABLE_LOG_ROTATION:p("QITQODE_DISABLE_LOG_ROTATION"),QITQODE_ALWAYS_NOTIFY_UPDATE:p("QITQODE_ALWAYS_NOTIFY_UPDATE"),QITQODE_DISABLE_PRUNE:p("QITQODE_DISABLE_PRUNE"),QITQODE_DISABLE_TERMINAL_TITLE:p("QITQODE_DISABLE_TERMINAL_TITLE"),QITQODE_SHOW_TTFD:p("QITQODE_SHOW_TTFD"),QITQODE_PERMISSION:process.env.QITQODE_PERMISSION,QITQODE_DISABLE_DEFAULT_PLUGINS:p("QITQODE_DISABLE_DEFAULT_PLUGINS"),QITQODE_DISABLE_LSP_DOWNLOAD:!0,QITQODE_ENABLE_EXPERIMENTAL_MODELS:p("QITQODE_ENABLE_EXPERIMENTAL_MODELS"),QITQODE_DISABLE_AUTOCOMPACT:p("QITQODE_DISABLE_AUTOCOMPACT"),QITQODE_DISABLE_MODELS_FETCH:p("QITQODE_DISABLE_MODELS_FETCH"),QITQODE_DISABLE_MOUSE:p("QITQODE_DISABLE_MOUSE"),QITQODE_OUTPUT_LENGTH_CONTINUATION_LIMIT:$("QITQODE_OUTPUT_LENGTH_CONTINUATION_LIMIT")??3,QITQODE_INVALID_OUTPUT_CONTINUATION_LIMIT:$("QITQODE_INVALID_OUTPUT_CONTINUATION_LIMIT")??2,QITQODE_TEXT_NGRAM_N:$("QITQODE_TEXT_NGRAM_N")??6,QITQODE_TEXT_REPEAT_THRESHOLD:$("QITQODE_TEXT_REPEAT_THRESHOLD")??3,QITQODE_TEXT_WINDOW_TOKENS:$("QITQODE_TEXT_WINDOW_TOKENS")??500,QITQODE_MAX_PROMPT_IMAGES:$("QITQODE_MAX_PROMPT_IMAGES")??4,QITQODE_MAX_PROMPT_IMAGE_SIZE:$("QITQODE_MAX_PROMPT_IMAGE_SIZE")??393216,QITQODE_DISABLE_PROVIDER_ENV:p("QITQODE_DISABLE_PROVIDER_ENV"),QITQODE_DISABLE_CLAUDE_CODE:jo,get QITQODE_DISABLE_CLAUDE_CODE_MCP(){return jo||p("QITQODE_DISABLE_CLAUDE_CODE_MCP")},QITQODE_DISABLE_CLAUDE_CODE_PROMPT:jo||p("QITQODE_DISABLE_CLAUDE_CODE_PROMPT"),QITQODE_DISABLE_CLAUDE_CODE_COMMANDS:p("QITQODE_DISABLE_CLAUDE_CODE_COMMANDS"),QITQODE_DISABLE_CLAUDE_CODE_SKILLS:pm,QITQODE_DISABLE_EXTERNAL_SKILLS:Ro,QITQODE_DISABLE_CODEX_SKILLS:Ro||p("QITQODE_DISABLE_CODEX_SKILLS"),QITQODE_DISABLE_OPENCODE_SKILLS:Ro||p("QITQODE_DISABLE_OPENCODE_SKILLS"),QITQODE_FAKE_VCS:process.env.QITQODE_FAKE_VCS,QITQODE_DISABLE_GIT:p("QITQODE_DISABLE_GIT"),get QITQODE_SERVER_PASSWORD(){return process.env.QITQODE_SERVER_PASSWORD},get QITQODE_SERVER_USERNAME(){return process.env.QITQODE_SERVER_USERNAME},QITQODE_ENABLE_QUESTION_TOOL:p("QITQODE_ENABLE_QUESTION_TOOL"),QITQODE_EXPERIMENTAL:d,QITQODE_EXPERIMENTAL_FILEWATCHER:k.boolean("QITQODE_EXPERIMENTAL_FILEWATCHER").pipe(k.withDefault(!1)),QITQODE_EXPERIMENTAL_DISABLE_FILEWATCHER:k.boolean("QITQODE_EXPERIMENTAL_DISABLE_FILEWATCHER").pipe(k.withDefault(!1)),QITQODE_EXPERIMENTAL_ICON_DISCOVERY:d||p("QITQODE_EXPERIMENTAL_ICON_DISCOVERY"),QITQODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT:um===void 0?process.platform==="win32":p("QITQODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"),QITQODE_ENABLE_EXA:p("QITQODE_ENABLE_EXA")||d||p("QITQODE_EXPERIMENTAL_EXA"),QITQODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS:$("QITQODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS"),QITQODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX:$("QITQODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX"),QITQODE_EXPERIMENTAL_OXFMT:d||p("QITQODE_EXPERIMENTAL_OXFMT"),QITQODE_EXPERIMENTAL_LSP_TY:p("QITQODE_EXPERIMENTAL_LSP_TY"),QITQODE_EXPERIMENTAL_LSP_TOOL:d||p("QITQODE_EXPERIMENTAL_LSP_TOOL"),QITQODE_EXPERIMENTAL_WORKFLOW_TOOL:!Ho("QITQODE_EXPERIMENTAL_WORKFLOW_TOOL"),QITQODE_EXPERIMENTAL_MARKDOWN:!Ho("QITQODE_EXPERIMENTAL_MARKDOWN"),QITQODE_MODELS_URL:process.env.QITQODE_MODELS_URL,QITQODE_MODELS_PATH:process.env.QITQODE_MODELS_PATH,QITQODE_DB:process.env.QITQODE_DB,QITQODE_DISABLE_CHANNEL_DB:!Ho("QITQODE_DISABLE_CHANNEL_DB"),QITQODE_SKIP_MIGRATIONS:p("QITQODE_SKIP_MIGRATIONS"),QITQODE_STRICT_CONFIG_DEPS:p("QITQODE_STRICT_CONFIG_DEPS"),QITQODE_WORKSPACE_ID:process.env.QITQODE_WORKSPACE_ID,QITQODE_EXPERIMENTAL_HTTPAPI:p("QITQODE_EXPERIMENTAL_HTTPAPI"),QITQODE_EXPERIMENTAL_WORKSPACES:d||p("QITQODE_EXPERIMENTAL_WORKSPACES"),get QITQODE_DISABLE_COMPOSE_SKILLS(){return p("QITQODE_DISABLE_COMPOSE_SKILLS")},get QITQODE_DISABLE_BUILTIN_SKILLS(){return p("QITQODE_DISABLE_BUILTIN_SKILLS")},get QITQODE_DISABLE_PROJECT_CONFIG(){return p("QITQODE_DISABLE_PROJECT_CONFIG")},get QITQODE_TUI_CONFIG(){return process.env.QITQODE_TUI_CONFIG},get QITQODE_CONFIG_DIR(){return process.env.QITQODE_CONFIG_DIR},get QITQODE_HOME(){return process.env.QITQODE_HOME},get QITQODE_PURE(){return p("QITQODE_PURE")},get QITQODE_PLUGIN_META_FILE(){return process.env.QITQODE_PLUGIN_META_FILE},get QITQODE_CLIENT(){return process.env.QITQODE_CLIENT??"cli"}};var xm=Hr.enum(["DEBUG","INFO","WARN","ERROR"]).meta({ref:"LogLevel",description:"Log level"}),wr={DEBUG:0,INFO:1,WARN:2,ERROR:3},cm=10,Om=52428800,Nm=209715200,$r="INFO";function oo(o){return wr[o]>=wr[$r]}function jm(o){return oo(o)}var zr=new Map,Rm=Vo({service:"default"}),_="";function Tm(){return _}var ao,To=0,_r=!0,ro=(o)=>{return process.stderr.write(o),o.length};function Mo(){return new Date().toISOString().split(".")[0].replace(/:/g,"")}async function Im(o){if(o.level)$r=o.level;if(_r=o.rotate??!Jr.QITQODE_DISABLE_LOG_ROTATION,Gr(z.Path.log),o.print)return;if(_=Io.join(z.Path.log,o.dev?"dev.log":Mo()+".log"),o.dev){let r=await F.stat(_).catch(()=>null);if(r&&r.size>0)await F.rename(_,`${_}.${Mo()}`).catch(()=>{})}else await F.truncate(_).catch(()=>{});ao=Qr(_,{flags:"a"}),To=0,ro=(r)=>{return $o=$o.then(async()=>{if(To+=Buffer.byteLength(r),_r&&To>=Om)To=Buffer.byteLength(r),await Wm();await new Promise((a)=>{if(!ao){a();return}ao.write(r,()=>a())})}).catch(()=>{}),r.length}}var $o=Promise.resolve();async function Mm(){await $o}async function Wm(){let o=ao,r=`${_}.${Mo()}`;for(let a=2;await F.stat(r).then(()=>!0,()=>!1);a++)r=`${_}.${Mo()}.${a}`;if(await F.rename(_,r).catch(()=>{}),ao=Qr(_,{flags:"a"}),o)o.end();Gr(z.Path.log)}async function Gr(o){let r=await F.readdir(o).catch(()=>[]),m=(await Promise.all(r.filter((t)=>t.includes(".log")&&Io.join(o,t)!==_).map(async(t)=>{let x=await F.stat(Io.join(o,t)).catch(()=>null);return x?.isFile()?{name:t,size:x.size}:null}))).flatMap((t)=>t?[t]:[]).sort((t,x)=>t.name<x.name?-1:t.name>x.name?1:0),n=m.reduce((t,x)=>t+x.size,0),f=m.length,s=m.filter((t)=>{if(f<=cm&&n<=Nm)return!1;return n-=t.size,f-=1,!0});await Promise.all(s.map((t)=>F.unlink(Io.join(o,t.name)).catch(()=>{})))}var bm=/token|secret|password|passwd|credential|api[_-]?key|authorization|cookie|set-cookie/i;function Go(o,r){if(bm.test(o)&&r!==void 0&&r!==null)return"[REDACTED]";return r}var Qo=10240;function Bm(o){try{let r=JSON.stringify(o,function(a,m){return a?Go(a,m):m});if(typeof r==="string"&&r.length>Qo)return r.slice(0,Qo)+`\u2026[truncated ${r.length-Qo} chars]`;return r}catch{return"[unserializable]"}}function Vr(o,r=0){let a=o.message;return o.cause instanceof Error&&r<10?a+" Caused by: "+Vr(o.cause,r+1):a}var Cr=Date.now();function Vo(o){o=o||{};let r=o.service;if(r&&typeof r==="string"){let n=zr.get(r);if(n)return n}function a(n,f){let s=Object.entries({...o,...f}).filter(([N,T])=>T!==void 0&&T!==null).map(([N,T])=>{let P=`${N}=`;if(T instanceof Error)return P+Vr(T);let mo=Go(N,T);if(mo!==T)return P+mo;if(typeof T==="object"&&T!==null)return P+Bm(T);return P+T}).join(" "),t=new Date,x=t.getTime()-Cr;return Cr=t.getTime(),[t.toISOString().split(".")[0],"+"+x+"ms",s,n].filter(Boolean).join(" ")+`
3
+ `}let m={debug(n,f){if(oo("DEBUG"))ro("DEBUG "+a(n,f))},info(n,f){if(oo("INFO"))ro("INFO "+a(n,f))},error(n,f){if(oo("ERROR"))ro("ERROR "+a(n,f))},warn(n,f){if(oo("WARN"))ro("WARN "+a(n,f))},tag(n,f){if(o)o[n]=f;return m},clone(){return Vo({...o})},time(n,f){let s=Date.now();m.info(n,{status:"started",...f});function t(){m.info(n,{status:"completed",duration:Date.now()-s,...f})}return{stop:t,[Symbol.dispose](){t()}}}};if(r&&typeof r==="string")zr.set(r,m);return m}var Fr={};J(Fr,{listen:()=>Sm,emit:()=>Jm,client:()=>wm});function Sm(o){onmessage=async(r)=>{let a=JSON.parse(r.data);if(a.type==="rpc.request")try{let m=await o[a.method](a.input);postMessage(JSON.stringify({type:"rpc.result",result:m,id:a.id}))}catch(m){postMessage(JSON.stringify({type:"rpc.result",error:m instanceof Error?m.message:String(m),id:a.id}))}}}function Jm(o,r){postMessage(JSON.stringify({type:"rpc.event",event:o,data:r}))}function wm(o){let r=new Map,a=new Map,m=0;return o.onmessage=async(n)=>{let f=JSON.parse(n.data);if(f.type==="rpc.result"){let s=r.get(f.id);if(s)if(r.delete(f.id),"error"in f)s.reject(Error(typeof f.error==="string"?f.error:"RPC call failed"));else s.resolve(f.result)}if(f.type==="rpc.event"){let s=a.get(f.event);if(s)for(let t of s)t(f.data)}},{call(n,f){let s=m++;return new Promise((t,x)=>{r.set(s,{resolve:t,reject:x});try{o.postMessage(JSON.stringify({type:"rpc.request",method:n,input:f,id:s}))}catch(N){r.delete(s),x(N)}})},on(n,f){let s=a.get(n);if(!s)s=new Set,a.set(n,s);return s.add(f),()=>{s.delete(f)}}}}var Ur={};J(Ur,{estimate:()=>Kr});function Kr(o){return Math.max(0,Math.round((o||"").length/4))}var Yr={};J(Yr,{match:()=>Wo,allStructured:()=>_m,all:()=>zm});function Wo(o,r){if(o)o=o.replaceAll("\\","/");if(r)r=r.replaceAll("\\","/");let a=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");if(a.endsWith(" .*"))a=a.slice(0,-3)+"( .*)?";let m=process.platform==="win32"?"si":"s";return new RegExp("^"+a+"$",m).test(o)}function zm(o,r){let a=X(r,Object.entries,Oo([([n])=>n.length,"asc"],[([n])=>n,"asc"])),m=void 0;for(let[n,f]of a)if(Wo(o,n)){m=f;continue}return m}function _m(o,r){let a=X(r,Object.entries,Oo([([n])=>n.length,"asc"],[([n])=>n,"asc"])),m=void 0;for(let[n,f]of a){let s=n.split(/\s+/);if(!Wo(o.head,s[0]))continue;if(s.length===1||yo(o.tail,s.slice(1))){m=f;continue}}return m}function yo(o,r){if(r.length===0)return!0;let[a,...m]=r;if(a==="*")return yo(o,m);for(let n=0;n<o.length;n++)if(Wo(o[n],a)&&yo(o.slice(n+1),m))return!0;return!1}export{sr as xr,tr as yr,fn as zr,sn as Ar,X as Br,ja as Cr,Ta as Dr,Ma as Er,Oo as Fr,Ba as Gr,Ja as Hr,za as Ir,Ca as Jr,Qa as Kr,Va as Lr,zo as Mr,Ya as Nr,Xa as Or,Za as Pr,Ea as Qr,Wo as Rr,Yr as Sr,lu as Tr,ku as Ur,Sr as Vr,ox as Wr,No as Xr,rx as Yr,pr as Zr,ur as _r,ta as $r,On as as,Nn as bs,Po as cs,Eo as ds,Lo as es,ir as fs,ca as gs,Rr as hs,Tr as is,Mr as js,Br as ks,wm as ls,Fr as ms,Ur as ns,bo as os,to as ps,ra as qs,H as rs,z as ss,Jr as ts,xm as us,jm as vs,Rm as ws,Tm as xs,Im as ys,Mm as zs,Go as As,Vo as Bs,yr as Cs};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{qP as K}from"./chunk-naq602da.js";var H,$,z,k,Z;var J=K(()=>{H={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},$={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},z={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},k={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},Z={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}});class h{static getFirstMatch(B,d){let x=d.match(B);return x&&x.length>0&&x[1]||""}static getSecondMatch(B,d){let x=d.match(B);return x&&x.length>1&&x[2]||""}static matchAndReturnConst(B,d,x){if(B.test(d))return x;return}static getWindowsVersionName(B){switch(B){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(B){let d=B.split(".").splice(0,2).map((Q)=>parseInt(Q,10)||0);d.push(0);let x=d[0],W=d[1];if(x===10)switch(W){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(x){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(B){let d=B.split(".").splice(0,2).map((x)=>parseInt(x,10)||0);if(d.push(0),d[0]===1&&d[1]<5)return;if(d[0]===1&&d[1]<6)return"Cupcake";if(d[0]===1&&d[1]>=6)return"Donut";if(d[0]===2&&d[1]<2)return"Eclair";if(d[0]===2&&d[1]===2)return"Froyo";if(d[0]===2&&d[1]>2)return"Gingerbread";if(d[0]===3)return"Honeycomb";if(d[0]===4&&d[1]<1)return"Ice Cream Sandwich";if(d[0]===4&&d[1]<4)return"Jelly Bean";if(d[0]===4&&d[1]>=4)return"KitKat";if(d[0]===5)return"Lollipop";if(d[0]===6)return"Marshmallow";if(d[0]===7)return"Nougat";if(d[0]===8)return"Oreo";if(d[0]===9)return"Pie";return}static getVersionPrecision(B){return B.split(".").length}static compareVersions(B,d,x=!1){let W=h.getVersionPrecision(B),Q=h.getVersionPrecision(d),y=Math.max(W,Q),C=0,Y=h.map([B,d],(G)=>{let E=y-h.getVersionPrecision(G),_=G+Array(E+1).join(".0");return h.map(_.split("."),(S)=>Array(20-S.length).join("0")+S).reverse()});if(x)C=y-Math.min(W,Q);y-=1;while(y>=C){if(Y[0][y]>Y[1][y])return 1;if(Y[0][y]===Y[1][y]){if(y===C)return 0;y-=1}else if(Y[0][y]<Y[1][y])return-1}return}static map(B,d){let x=[],W;if(Array.prototype.map)return Array.prototype.map.call(B,d);for(W=0;W<B.length;W+=1)x.push(d(B[W]));return x}static find(B,d){let x,W;if(Array.prototype.find)return Array.prototype.find.call(B,d);for(x=0,W=B.length;x<W;x+=1){let Q=B[x];if(d(Q,x))return Q}return}static assign(B,...d){let x=B,W,Q;if(Object.assign)return Object.assign(B,...d);for(W=0,Q=d.length;W<Q;W+=1){let y=d[W];if(typeof y==="object"&&y!==null)Object.keys(y).forEach((Y)=>{x[Y]=y[Y]})}return B}static getBrowserAlias(B){return H[B]}static getBrowserTypeByAlias(B){return $[B]||""}}var X=K(()=>{J()});var q,L,c;var j=K(()=>{X();q=/version\/(\d+(\.?_?\d+)+)/i,L=[{test:[/gptbot/i],describe(B){let d={name:"GPTBot"},x=h.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/chatgpt-user/i],describe(B){let d={name:"ChatGPT-User"},x=h.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/oai-searchbot/i],describe(B){let d={name:"OAI-SearchBot"},x=h.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(B){let d={name:"ClaudeBot"},x=h.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/omgilibot/i,/webzio-extended/i],describe(B){let d={name:"Omgilibot"},x=h.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/diffbot/i],describe(B){let d={name:"Diffbot"},x=h.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/perplexitybot/i],describe(B){let d={name:"PerplexityBot"},x=h.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/perplexity-user/i],describe(B){let d={name:"Perplexity-User"},x=h.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/youbot/i],describe(B){let d={name:"YouBot"},x=h.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-webindexer/i],describe(B){let d={name:"Meta-WebIndexer"},x=h.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalads/i],describe(B){let d={name:"Meta-ExternalAds"},x=h.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalagent/i],describe(B){let d={name:"Meta-ExternalAgent"},x=h.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalfetcher/i],describe(B){let d={name:"Meta-ExternalFetcher"},x=h.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/googlebot/i],describe(B){let d={name:"Googlebot"},x=h.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/linespider/i],describe(B){let d={name:"Linespider"},x=h.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/amazonbot/i],describe(B){let d={name:"AmazonBot"},x=h.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/bingbot/i],describe(B){let d={name:"BingCrawler"},x=h.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/baiduspider/i],describe(B){let d={name:"BaiduSpider"},x=h.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/duckduckbot/i],describe(B){let d={name:"DuckDuckBot"},x=h.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/ia_archiver/i],describe(B){let d={name:"InternetArchiveCrawler"},x=h.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(B){let d={name:"SlackBot"},x=h.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(B){let d={name:"Opera"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/opr\/|opios/i],describe(B){let d={name:"Opera"},x=h.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/SamsungBrowser/i],describe(B){let d={name:"Samsung Internet for Android"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/Whale/i],describe(B){let d={name:"NAVER Whale Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/PaleMoon/i],describe(B){let d={name:"Pale Moon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/MZBrowser/i],describe(B){let d={name:"MZ Browser"},x=h.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/focus/i],describe(B){let d={name:"Focus"},x=h.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/swing/i],describe(B){let d={name:"Swing"},x=h.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/coast/i],describe(B){let d={name:"Opera Coast"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(B){let d={name:"Opera Touch"},x=h.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/yabrowser/i],describe(B){let d={name:"Yandex Browser"},x=h.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/ucbrowser/i],describe(B){let d={name:"UC Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/Maxthon|mxios/i],describe(B){let d={name:"Maxthon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/epiphany/i],describe(B){let d={name:"Epiphany"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/puffin/i],describe(B){let d={name:"Puffin"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sleipnir/i],describe(B){let d={name:"Sleipnir"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/k-meleon/i],describe(B){let d={name:"K-Meleon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/micromessenger/i],describe(B){let d={name:"WeChat"},x=h.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/qqbrowser/i],describe(B){let d={name:/qqbrowserlite/i.test(B)?"QQ Browser Lite":"QQ Browser"},x=h.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/msie|trident/i],describe(B){let d={name:"Internet Explorer"},x=h.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/\sedg\//i],describe(B){let d={name:"Microsoft Edge"},x=h.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/edg([ea]|ios)/i],describe(B){let d={name:"Microsoft Edge"},x=h.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/vivaldi/i],describe(B){let d={name:"Vivaldi"},x=h.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/seamonkey/i],describe(B){let d={name:"SeaMonkey"},x=h.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sailfish/i],describe(B){let d={name:"Sailfish"},x=h.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,B);if(x)d.version=x;return d}},{test:[/silk/i],describe(B){let d={name:"Amazon Silk"},x=h.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/phantom/i],describe(B){let d={name:"PhantomJS"},x=h.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/slimerjs/i],describe(B){let d={name:"SlimerJS"},x=h.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(B){let d={name:"BlackBerry"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/(web|hpw)[o0]s/i],describe(B){let d={name:"WebOS Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/bada/i],describe(B){let d={name:"Bada"},x=h.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/tizen/i],describe(B){let d={name:"Tizen"},x=h.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/qupzilla/i],describe(B){let d={name:"QupZilla"},x=h.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/librewolf/i],describe(B){let d={name:"LibreWolf"},x=h.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/firefox|iceweasel|fxios/i],describe(B){let d={name:"Firefox"},x=h.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/electron/i],describe(B){let d={name:"Electron"},x=h.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(B){let d={name:"Sogou Browser"},x=h.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,B),W=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,B),Q=h.getFirstMatch(/se ([\d.]+)x/i,B),y=x||W||Q;if(y)d.version=y;return d}},{test:[/MiuiBrowser/i],describe(B){let d={name:"Miui"},x=h.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){if(B.hasBrand("DuckDuckGo"))return!0;return B.test(/\sDdg\/[\d.]+$/i)},describe(B,d){let x={name:"DuckDuckGo"};if(d){let Q=d.getBrandVersion("DuckDuckGo");if(Q)return x.version=Q,x}let W=h.getFirstMatch(/\sDdg\/([\d.]+)$/i,B);if(W)x.version=W;return x}},{test(B){return B.hasBrand("Brave")},describe(B,d){let x={name:"Brave"};if(d){let W=d.getBrandVersion("Brave");if(W)return x.version=W,x}return x}},{test:[/chromium/i],describe(B){let d={name:"Chromium"},x=h.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/chrome|crios|crmo/i],describe(B){let d={name:"Chrome"},x=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/GSA/i],describe(B){let d={name:"Google Search"},x=h.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){let d=!B.test(/like android/i),x=B.test(/android/i);return d&&x},describe(B){let d={name:"Android Browser"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/playstation 4/i],describe(B){let d={name:"PlayStation 4"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/safari|applewebkit/i],describe(B){let d={name:"Safari"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/.*/i],describe(B){let d=/^(.*)\/(.*) /,x=/^(.*)\/(.*)[ \t]\((.*)/,Q=B.search("\\(")!==-1?x:d;return{name:h.getFirstMatch(Q,B),version:h.getSecondMatch(Q,B)}}}],c=L});var N;var F=K(()=>{X();J();N=[{test:[/Roku\/DVP/],describe(B){let d=h.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,B);return{name:k.Roku,version:d}}},{test:[/windows phone/i],describe(B){let d=h.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,B);return{name:k.WindowsPhone,version:d}}},{test:[/windows /i],describe(B){let d=h.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,B),x=h.getWindowsVersionName(d);return{name:k.Windows,version:d,versionName:x}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(B){let d={name:k.iOS},x=h.getSecondMatch(/(Version\/)(\d[\d.]+)/,B);if(x)d.version=x;return d}},{test:[/macintosh/i],describe(B){let d=h.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,B).replace(/[_\s]/g,"."),x=h.getMacOSVersionName(d),W={name:k.MacOS,version:d};if(x)W.versionName=x;return W}},{test:[/(ipod|iphone|ipad)/i],describe(B){let d=h.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,B).replace(/[_\s]/g,".");return{name:k.iOS,version:d}}},{test:[/OpenHarmony/i],describe(B){let d=h.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,B);return{name:k.HarmonyOS,version:d}}},{test(B){let d=!B.test(/like android/i),x=B.test(/android/i);return d&&x},describe(B){let d=h.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,B),x=h.getAndroidVersionName(d),W={name:k.Android,version:d};if(x)W.versionName=x;return W}},{test:[/(web|hpw)[o0]s/i],describe(B){let d=h.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,B),x={name:k.WebOS};if(d&&d.length)x.version=d;return x}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(B){let d=h.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,B)||h.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,B)||h.getFirstMatch(/\bbb(\d+)/i,B);return{name:k.BlackBerry,version:d}}},{test:[/bada/i],describe(B){let d=h.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,B);return{name:k.Bada,version:d}}},{test:[/tizen/i],describe(B){let d=h.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,B);return{name:k.Tizen,version:d}}},{test:[/linux/i],describe(){return{name:k.Linux}}},{test:[/CrOS/],describe(){return{name:k.ChromeOS}}},{test:[/PlayStation 4/],describe(B){let d=h.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,B);return{name:k.PlayStation4,version:d}}}]});var g;var O=K(()=>{X();J();g=[{test:[/googlebot/i],describe(){return{type:z.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:z.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:z.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:z.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:z.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:z.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:z.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:z.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:z.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:z.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:z.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:z.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:z.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:z.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:z.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:z.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:z.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(B){let d=h.getFirstMatch(/(can-l01)/i,B)&&"Nova",x={type:z.mobile,vendor:"Huawei"};if(d)x.model=d;return x}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:z.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:z.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:z.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:z.tablet}}},{test(B){let d=B.test(/ipod|iphone/i),x=B.test(/like (ipod|iphone)/i);return d&&!x},describe(B){let d=h.getFirstMatch(/(ipod|iphone)/i,B);return{type:z.mobile,vendor:"Apple",model:d}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:z.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(B){let d=h.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,B),x={type:z.mobile,vendor:"Nokia"};if(d)x.model=d;return x}},{test:[/[^-]mobi/i],describe(){return{type:z.mobile}}},{test(B){return B.getBrowserName(!0)==="blackberry"},describe(){return{type:z.mobile,vendor:"BlackBerry"}}},{test(B){return B.getBrowserName(!0)==="bada"},describe(){return{type:z.mobile}}},{test(B){return B.getBrowserName()==="windows phone"},describe(){return{type:z.mobile,vendor:"Microsoft"}}},{test(B){let d=Number(String(B.getOSVersion()).split(".")[0]);return B.getOSName(!0)==="android"&&d>=3},describe(){return{type:z.tablet}}},{test(B){return B.getOSName(!0)==="android"},describe(){return{type:z.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:z.tv}}},{test:[/netcast/i],describe(){return{type:z.tv}}},{test(B){return B.getOSName(!0)==="macos"},describe(){return{type:z.desktop,vendor:"Apple"}}},{test(B){return B.getOSName(!0)==="windows"},describe(){return{type:z.desktop}}},{test(B){return B.getOSName(!0)==="linux"},describe(){return{type:z.desktop}}},{test(B){return B.getOSName(!0)==="playstation 4"},describe(){return{type:z.tv}}},{test(B){return B.getOSName(!0)==="roku"},describe(){return{type:z.tv}}}]});var f;var I=K(()=>{X();J();f=[{test(B){return B.getBrowserName(!0)==="microsoft edge"},describe(B){if(/\sedg\//i.test(B))return{name:Z.Blink};let x=h.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,B);return{name:Z.EdgeHTML,version:x}}},{test:[/trident/i],describe(B){let d={name:Z.Trident},x=h.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){return B.test(/presto/i)},describe(B){let d={name:Z.Presto},x=h.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){let d=B.test(/gecko/i),x=B.test(/like gecko/i);return d&&!x},describe(B){let d={name:Z.Gecko},x=h.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Z.Blink}}},{test:[/(apple)?webkit/i],describe(B){let d={name:Z.WebKit},x=h.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}}]});class T{constructor(B,d=!1,x=null){if(B===void 0||B===null||B==="")throw Error("UserAgent parameter can't be empty");this._ua=B;let W=!1;if(typeof d==="boolean")W=d,this._hints=x;else if(d!=null&&typeof d==="object")this._hints=d;else this._hints=null;if(this.parsedResult={},W!==!0)this.parse()}getHints(){return this._hints}hasBrand(B){if(!this._hints||!Array.isArray(this._hints.brands))return!1;let d=B.toLowerCase();return this._hints.brands.some((x)=>x.brand&&x.brand.toLowerCase()===d)}getBrandVersion(B){if(!this._hints||!Array.isArray(this._hints.brands))return;let d=B.toLowerCase(),x=this._hints.brands.find((W)=>W.brand&&W.brand.toLowerCase()===d);return x?x.version:void 0}getUA(){return this._ua}test(B){return B.test(this._ua)}parseBrowser(){this.parsedResult.browser={};let B=h.find(c,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.browser=B.describe(this.getUA(),this);return this.parsedResult.browser}getBrowser(){if(this.parsedResult.browser)return this.parsedResult.browser;return this.parseBrowser()}getBrowserName(B){if(B)return String(this.getBrowser().name).toLowerCase()||"";return this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){if(this.parsedResult.os)return this.parsedResult.os;return this.parseOS()}parseOS(){this.parsedResult.os={};let B=h.find(N,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.os=B.describe(this.getUA());return this.parsedResult.os}getOSName(B){let{name:d}=this.getOS();if(B)return String(d).toLowerCase()||"";return d||""}getOSVersion(){return this.getOS().version}getPlatform(){if(this.parsedResult.platform)return this.parsedResult.platform;return this.parsePlatform()}getPlatformType(B=!1){let{type:d}=this.getPlatform();if(B)return String(d).toLowerCase()||"";return d||""}parsePlatform(){this.parsedResult.platform={};let B=h.find(g,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.platform=B.describe(this.getUA());return this.parsedResult.platform}getEngine(){if(this.parsedResult.engine)return this.parsedResult.engine;return this.parseEngine()}getEngineName(B){if(B)return String(this.getEngine().name).toLowerCase()||"";return this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};let B=h.find(f,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.engine=B.describe(this.getUA());return this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return h.assign({},this.parsedResult)}satisfies(B){let d={},x=0,W={},Q=0;if(Object.keys(B).forEach((C)=>{let Y=B[C];if(typeof Y==="string")W[C]=Y,Q+=1;else if(typeof Y==="object")d[C]=Y,x+=1}),x>0){let C=Object.keys(d),Y=h.find(C,(E)=>this.isOS(E));if(Y){let E=this.satisfies(d[Y]);if(E!==void 0)return E}let G=h.find(C,(E)=>this.isPlatform(E));if(G){let E=this.satisfies(d[G]);if(E!==void 0)return E}}if(Q>0){let C=Object.keys(W),Y=h.find(C,(G)=>this.isBrowser(G,!0));if(Y!==void 0)return this.compareVersion(W[Y])}return}isBrowser(B,d=!1){let x=this.getBrowserName().toLowerCase(),W=B.toLowerCase(),Q=h.getBrowserTypeByAlias(W);if(d&&Q)W=Q.toLowerCase();return W===x}compareVersion(B){let d=[0],x=B,W=!1,Q=this.getBrowserVersion();if(typeof Q!=="string")return;if(B[0]===">"||B[0]==="<"){if(x=B.substr(1),B[1]==="=")W=!0,x=B.substr(2);else d=[];if(B[0]===">")d.push(1);else d.push(-1)}else if(B[0]==="=")x=B.substr(1);else if(B[0]==="~")W=!0,x=B.substr(1);return d.indexOf(h.compareVersions(Q,x,W))>-1}isOS(B){return this.getOSName(!0)===String(B).toLowerCase()}isPlatform(B){return this.getPlatformType(!0)===String(B).toLowerCase()}isEngine(B){return this.getEngineName(!0)===String(B).toLowerCase()}is(B,d=!1){return this.isBrowser(B,d)||this.isOS(B)||this.isPlatform(B)}some(B=[]){return B.some((d)=>this.is(d))}}var D;var R=K(()=>{j();F();O();I();X();D=T});class V{static getParser(B,d=!1,x=null){if(typeof B!=="string")throw Error("UserAgent should be a string");return new D(B,d,x)}static parse(B,d=null){return new D(B,d).getResult()}static get BROWSER_MAP(){return $}static get ENGINE_MAP(){return Z}static get OS_MAP(){return k}static get PLATFORMS_MAP(){return z}}var Wd;var M=K(()=>{R();J();/*!
2
+ import{gO as K}from"./chunk-0rmmg3g4.js";var H,$,z,k,Z;var J=K(()=>{H={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},$={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},z={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},k={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},Z={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"}});class h{static getFirstMatch(B,d){let x=d.match(B);return x&&x.length>0&&x[1]||""}static getSecondMatch(B,d){let x=d.match(B);return x&&x.length>1&&x[2]||""}static matchAndReturnConst(B,d,x){if(B.test(d))return x;return}static getWindowsVersionName(B){switch(B){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(B){let d=B.split(".").splice(0,2).map((Q)=>parseInt(Q,10)||0);d.push(0);let x=d[0],W=d[1];if(x===10)switch(W){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(x){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(B){let d=B.split(".").splice(0,2).map((x)=>parseInt(x,10)||0);if(d.push(0),d[0]===1&&d[1]<5)return;if(d[0]===1&&d[1]<6)return"Cupcake";if(d[0]===1&&d[1]>=6)return"Donut";if(d[0]===2&&d[1]<2)return"Eclair";if(d[0]===2&&d[1]===2)return"Froyo";if(d[0]===2&&d[1]>2)return"Gingerbread";if(d[0]===3)return"Honeycomb";if(d[0]===4&&d[1]<1)return"Ice Cream Sandwich";if(d[0]===4&&d[1]<4)return"Jelly Bean";if(d[0]===4&&d[1]>=4)return"KitKat";if(d[0]===5)return"Lollipop";if(d[0]===6)return"Marshmallow";if(d[0]===7)return"Nougat";if(d[0]===8)return"Oreo";if(d[0]===9)return"Pie";return}static getVersionPrecision(B){return B.split(".").length}static compareVersions(B,d,x=!1){let W=h.getVersionPrecision(B),Q=h.getVersionPrecision(d),y=Math.max(W,Q),C=0,Y=h.map([B,d],(G)=>{let E=y-h.getVersionPrecision(G),_=G+Array(E+1).join(".0");return h.map(_.split("."),(S)=>Array(20-S.length).join("0")+S).reverse()});if(x)C=y-Math.min(W,Q);y-=1;while(y>=C){if(Y[0][y]>Y[1][y])return 1;if(Y[0][y]===Y[1][y]){if(y===C)return 0;y-=1}else if(Y[0][y]<Y[1][y])return-1}return}static map(B,d){let x=[],W;if(Array.prototype.map)return Array.prototype.map.call(B,d);for(W=0;W<B.length;W+=1)x.push(d(B[W]));return x}static find(B,d){let x,W;if(Array.prototype.find)return Array.prototype.find.call(B,d);for(x=0,W=B.length;x<W;x+=1){let Q=B[x];if(d(Q,x))return Q}return}static assign(B,...d){let x=B,W,Q;if(Object.assign)return Object.assign(B,...d);for(W=0,Q=d.length;W<Q;W+=1){let y=d[W];if(typeof y==="object"&&y!==null)Object.keys(y).forEach((Y)=>{x[Y]=y[Y]})}return B}static getBrowserAlias(B){return H[B]}static getBrowserTypeByAlias(B){return $[B]||""}}var X=K(()=>{J()});var q,L,c;var j=K(()=>{X();q=/version\/(\d+(\.?_?\d+)+)/i,L=[{test:[/gptbot/i],describe(B){let d={name:"GPTBot"},x=h.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/chatgpt-user/i],describe(B){let d={name:"ChatGPT-User"},x=h.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/oai-searchbot/i],describe(B){let d={name:"OAI-SearchBot"},x=h.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(B){let d={name:"ClaudeBot"},x=h.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/omgilibot/i,/webzio-extended/i],describe(B){let d={name:"Omgilibot"},x=h.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/diffbot/i],describe(B){let d={name:"Diffbot"},x=h.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/perplexitybot/i],describe(B){let d={name:"PerplexityBot"},x=h.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/perplexity-user/i],describe(B){let d={name:"Perplexity-User"},x=h.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/youbot/i],describe(B){let d={name:"YouBot"},x=h.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-webindexer/i],describe(B){let d={name:"Meta-WebIndexer"},x=h.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalads/i],describe(B){let d={name:"Meta-ExternalAds"},x=h.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalagent/i],describe(B){let d={name:"Meta-ExternalAgent"},x=h.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/meta-externalfetcher/i],describe(B){let d={name:"Meta-ExternalFetcher"},x=h.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/googlebot/i],describe(B){let d={name:"Googlebot"},x=h.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/linespider/i],describe(B){let d={name:"Linespider"},x=h.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/amazonbot/i],describe(B){let d={name:"AmazonBot"},x=h.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/bingbot/i],describe(B){let d={name:"BingCrawler"},x=h.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/baiduspider/i],describe(B){let d={name:"BaiduSpider"},x=h.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/duckduckbot/i],describe(B){let d={name:"DuckDuckBot"},x=h.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/ia_archiver/i],describe(B){let d={name:"InternetArchiveCrawler"},x=h.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(B){let d={name:"SlackBot"},x=h.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(B){let d={name:"Opera"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/opr\/|opios/i],describe(B){let d={name:"Opera"},x=h.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/SamsungBrowser/i],describe(B){let d={name:"Samsung Internet for Android"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/Whale/i],describe(B){let d={name:"NAVER Whale Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/PaleMoon/i],describe(B){let d={name:"Pale Moon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/MZBrowser/i],describe(B){let d={name:"MZ Browser"},x=h.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/focus/i],describe(B){let d={name:"Focus"},x=h.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/swing/i],describe(B){let d={name:"Swing"},x=h.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/coast/i],describe(B){let d={name:"Opera Coast"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(B){let d={name:"Opera Touch"},x=h.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/yabrowser/i],describe(B){let d={name:"Yandex Browser"},x=h.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/ucbrowser/i],describe(B){let d={name:"UC Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/Maxthon|mxios/i],describe(B){let d={name:"Maxthon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/epiphany/i],describe(B){let d={name:"Epiphany"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/puffin/i],describe(B){let d={name:"Puffin"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sleipnir/i],describe(B){let d={name:"Sleipnir"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/k-meleon/i],describe(B){let d={name:"K-Meleon"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/micromessenger/i],describe(B){let d={name:"WeChat"},x=h.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/qqbrowser/i],describe(B){let d={name:/qqbrowserlite/i.test(B)?"QQ Browser Lite":"QQ Browser"},x=h.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/msie|trident/i],describe(B){let d={name:"Internet Explorer"},x=h.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/\sedg\//i],describe(B){let d={name:"Microsoft Edge"},x=h.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/edg([ea]|ios)/i],describe(B){let d={name:"Microsoft Edge"},x=h.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/vivaldi/i],describe(B){let d={name:"Vivaldi"},x=h.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/seamonkey/i],describe(B){let d={name:"SeaMonkey"},x=h.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sailfish/i],describe(B){let d={name:"Sailfish"},x=h.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,B);if(x)d.version=x;return d}},{test:[/silk/i],describe(B){let d={name:"Amazon Silk"},x=h.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/phantom/i],describe(B){let d={name:"PhantomJS"},x=h.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/slimerjs/i],describe(B){let d={name:"SlimerJS"},x=h.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(B){let d={name:"BlackBerry"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/(web|hpw)[o0]s/i],describe(B){let d={name:"WebOS Browser"},x=h.getFirstMatch(q,B)||h.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/bada/i],describe(B){let d={name:"Bada"},x=h.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/tizen/i],describe(B){let d={name:"Tizen"},x=h.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/qupzilla/i],describe(B){let d={name:"QupZilla"},x=h.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/librewolf/i],describe(B){let d={name:"LibreWolf"},x=h.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/firefox|iceweasel|fxios/i],describe(B){let d={name:"Firefox"},x=h.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/electron/i],describe(B){let d={name:"Electron"},x=h.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(B){let d={name:"Sogou Browser"},x=h.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,B),W=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,B),Q=h.getFirstMatch(/se ([\d.]+)x/i,B),y=x||W||Q;if(y)d.version=y;return d}},{test:[/MiuiBrowser/i],describe(B){let d={name:"Miui"},x=h.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){if(B.hasBrand("DuckDuckGo"))return!0;return B.test(/\sDdg\/[\d.]+$/i)},describe(B,d){let x={name:"DuckDuckGo"};if(d){let Q=d.getBrandVersion("DuckDuckGo");if(Q)return x.version=Q,x}let W=h.getFirstMatch(/\sDdg\/([\d.]+)$/i,B);if(W)x.version=W;return x}},{test(B){return B.hasBrand("Brave")},describe(B,d){let x={name:"Brave"};if(d){let W=d.getBrandVersion("Brave");if(W)return x.version=W,x}return x}},{test:[/chromium/i],describe(B){let d={name:"Chromium"},x=h.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,B)||h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/chrome|crios|crmo/i],describe(B){let d={name:"Chrome"},x=h.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/GSA/i],describe(B){let d={name:"Google Search"},x=h.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){let d=!B.test(/like android/i),x=B.test(/android/i);return d&&x},describe(B){let d={name:"Android Browser"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/playstation 4/i],describe(B){let d={name:"PlayStation 4"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/safari|applewebkit/i],describe(B){let d={name:"Safari"},x=h.getFirstMatch(q,B);if(x)d.version=x;return d}},{test:[/.*/i],describe(B){let d=/^(.*)\/(.*) /,x=/^(.*)\/(.*)[ \t]\((.*)/,Q=B.search("\\(")!==-1?x:d;return{name:h.getFirstMatch(Q,B),version:h.getSecondMatch(Q,B)}}}],c=L});var N;var F=K(()=>{X();J();N=[{test:[/Roku\/DVP/],describe(B){let d=h.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,B);return{name:k.Roku,version:d}}},{test:[/windows phone/i],describe(B){let d=h.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,B);return{name:k.WindowsPhone,version:d}}},{test:[/windows /i],describe(B){let d=h.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,B),x=h.getWindowsVersionName(d);return{name:k.Windows,version:d,versionName:x}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(B){let d={name:k.iOS},x=h.getSecondMatch(/(Version\/)(\d[\d.]+)/,B);if(x)d.version=x;return d}},{test:[/macintosh/i],describe(B){let d=h.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,B).replace(/[_\s]/g,"."),x=h.getMacOSVersionName(d),W={name:k.MacOS,version:d};if(x)W.versionName=x;return W}},{test:[/(ipod|iphone|ipad)/i],describe(B){let d=h.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,B).replace(/[_\s]/g,".");return{name:k.iOS,version:d}}},{test:[/OpenHarmony/i],describe(B){let d=h.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,B);return{name:k.HarmonyOS,version:d}}},{test(B){let d=!B.test(/like android/i),x=B.test(/android/i);return d&&x},describe(B){let d=h.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,B),x=h.getAndroidVersionName(d),W={name:k.Android,version:d};if(x)W.versionName=x;return W}},{test:[/(web|hpw)[o0]s/i],describe(B){let d=h.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,B),x={name:k.WebOS};if(d&&d.length)x.version=d;return x}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(B){let d=h.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,B)||h.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,B)||h.getFirstMatch(/\bbb(\d+)/i,B);return{name:k.BlackBerry,version:d}}},{test:[/bada/i],describe(B){let d=h.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,B);return{name:k.Bada,version:d}}},{test:[/tizen/i],describe(B){let d=h.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,B);return{name:k.Tizen,version:d}}},{test:[/linux/i],describe(){return{name:k.Linux}}},{test:[/CrOS/],describe(){return{name:k.ChromeOS}}},{test:[/PlayStation 4/],describe(B){let d=h.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,B);return{name:k.PlayStation4,version:d}}}]});var g;var O=K(()=>{X();J();g=[{test:[/googlebot/i],describe(){return{type:z.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:z.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:z.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:z.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:z.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:z.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:z.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:z.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:z.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:z.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:z.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:z.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:z.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:z.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:z.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:z.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:z.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:z.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:z.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(B){let d=h.getFirstMatch(/(can-l01)/i,B)&&"Nova",x={type:z.mobile,vendor:"Huawei"};if(d)x.model=d;return x}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:z.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:z.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:z.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:z.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:z.tablet}}},{test(B){let d=B.test(/ipod|iphone/i),x=B.test(/like (ipod|iphone)/i);return d&&!x},describe(B){let d=h.getFirstMatch(/(ipod|iphone)/i,B);return{type:z.mobile,vendor:"Apple",model:d}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:z.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(B){let d=h.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,B),x={type:z.mobile,vendor:"Nokia"};if(d)x.model=d;return x}},{test:[/[^-]mobi/i],describe(){return{type:z.mobile}}},{test(B){return B.getBrowserName(!0)==="blackberry"},describe(){return{type:z.mobile,vendor:"BlackBerry"}}},{test(B){return B.getBrowserName(!0)==="bada"},describe(){return{type:z.mobile}}},{test(B){return B.getBrowserName()==="windows phone"},describe(){return{type:z.mobile,vendor:"Microsoft"}}},{test(B){let d=Number(String(B.getOSVersion()).split(".")[0]);return B.getOSName(!0)==="android"&&d>=3},describe(){return{type:z.tablet}}},{test(B){return B.getOSName(!0)==="android"},describe(){return{type:z.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:z.tv}}},{test:[/netcast/i],describe(){return{type:z.tv}}},{test(B){return B.getOSName(!0)==="macos"},describe(){return{type:z.desktop,vendor:"Apple"}}},{test(B){return B.getOSName(!0)==="windows"},describe(){return{type:z.desktop}}},{test(B){return B.getOSName(!0)==="linux"},describe(){return{type:z.desktop}}},{test(B){return B.getOSName(!0)==="playstation 4"},describe(){return{type:z.tv}}},{test(B){return B.getOSName(!0)==="roku"},describe(){return{type:z.tv}}}]});var f;var I=K(()=>{X();J();f=[{test(B){return B.getBrowserName(!0)==="microsoft edge"},describe(B){if(/\sedg\//i.test(B))return{name:Z.Blink};let x=h.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,B);return{name:Z.EdgeHTML,version:x}}},{test:[/trident/i],describe(B){let d={name:Z.Trident},x=h.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){return B.test(/presto/i)},describe(B){let d={name:Z.Presto},x=h.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test(B){let d=B.test(/gecko/i),x=B.test(/like gecko/i);return d&&!x},describe(B){let d={name:Z.Gecko},x=h.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:Z.Blink}}},{test:[/(apple)?webkit/i],describe(B){let d={name:Z.WebKit},x=h.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,B);if(x)d.version=x;return d}}]});class T{constructor(B,d=!1,x=null){if(B===void 0||B===null||B==="")throw Error("UserAgent parameter can't be empty");this._ua=B;let W=!1;if(typeof d==="boolean")W=d,this._hints=x;else if(d!=null&&typeof d==="object")this._hints=d;else this._hints=null;if(this.parsedResult={},W!==!0)this.parse()}getHints(){return this._hints}hasBrand(B){if(!this._hints||!Array.isArray(this._hints.brands))return!1;let d=B.toLowerCase();return this._hints.brands.some((x)=>x.brand&&x.brand.toLowerCase()===d)}getBrandVersion(B){if(!this._hints||!Array.isArray(this._hints.brands))return;let d=B.toLowerCase(),x=this._hints.brands.find((W)=>W.brand&&W.brand.toLowerCase()===d);return x?x.version:void 0}getUA(){return this._ua}test(B){return B.test(this._ua)}parseBrowser(){this.parsedResult.browser={};let B=h.find(c,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.browser=B.describe(this.getUA(),this);return this.parsedResult.browser}getBrowser(){if(this.parsedResult.browser)return this.parsedResult.browser;return this.parseBrowser()}getBrowserName(B){if(B)return String(this.getBrowser().name).toLowerCase()||"";return this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){if(this.parsedResult.os)return this.parsedResult.os;return this.parseOS()}parseOS(){this.parsedResult.os={};let B=h.find(N,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.os=B.describe(this.getUA());return this.parsedResult.os}getOSName(B){let{name:d}=this.getOS();if(B)return String(d).toLowerCase()||"";return d||""}getOSVersion(){return this.getOS().version}getPlatform(){if(this.parsedResult.platform)return this.parsedResult.platform;return this.parsePlatform()}getPlatformType(B=!1){let{type:d}=this.getPlatform();if(B)return String(d).toLowerCase()||"";return d||""}parsePlatform(){this.parsedResult.platform={};let B=h.find(g,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.platform=B.describe(this.getUA());return this.parsedResult.platform}getEngine(){if(this.parsedResult.engine)return this.parsedResult.engine;return this.parseEngine()}getEngineName(B){if(B)return String(this.getEngine().name).toLowerCase()||"";return this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};let B=h.find(f,(d)=>{if(typeof d.test==="function")return d.test(this);if(Array.isArray(d.test))return d.test.some((x)=>this.test(x));throw Error("Browser's test function is not valid")});if(B)this.parsedResult.engine=B.describe(this.getUA());return this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return h.assign({},this.parsedResult)}satisfies(B){let d={},x=0,W={},Q=0;if(Object.keys(B).forEach((C)=>{let Y=B[C];if(typeof Y==="string")W[C]=Y,Q+=1;else if(typeof Y==="object")d[C]=Y,x+=1}),x>0){let C=Object.keys(d),Y=h.find(C,(E)=>this.isOS(E));if(Y){let E=this.satisfies(d[Y]);if(E!==void 0)return E}let G=h.find(C,(E)=>this.isPlatform(E));if(G){let E=this.satisfies(d[G]);if(E!==void 0)return E}}if(Q>0){let C=Object.keys(W),Y=h.find(C,(G)=>this.isBrowser(G,!0));if(Y!==void 0)return this.compareVersion(W[Y])}return}isBrowser(B,d=!1){let x=this.getBrowserName().toLowerCase(),W=B.toLowerCase(),Q=h.getBrowserTypeByAlias(W);if(d&&Q)W=Q.toLowerCase();return W===x}compareVersion(B){let d=[0],x=B,W=!1,Q=this.getBrowserVersion();if(typeof Q!=="string")return;if(B[0]===">"||B[0]==="<"){if(x=B.substr(1),B[1]==="=")W=!0,x=B.substr(2);else d=[];if(B[0]===">")d.push(1);else d.push(-1)}else if(B[0]==="=")x=B.substr(1);else if(B[0]==="~")W=!0,x=B.substr(1);return d.indexOf(h.compareVersions(Q,x,W))>-1}isOS(B){return this.getOSName(!0)===String(B).toLowerCase()}isPlatform(B){return this.getPlatformType(!0)===String(B).toLowerCase()}isEngine(B){return this.getEngineName(!0)===String(B).toLowerCase()}is(B,d=!1){return this.isBrowser(B,d)||this.isOS(B)||this.isPlatform(B)}some(B=[]){return B.some((d)=>this.is(d))}}var D;var R=K(()=>{j();F();O();I();X();D=T});class V{static getParser(B,d=!1,x=null){if(typeof B!=="string")throw Error("UserAgent should be a string");return new D(B,d,x)}static parse(B,d=null){return new D(B,d).getResult()}static get BROWSER_MAP(){return $}static get ENGINE_MAP(){return Z}static get OS_MAP(){return k}static get PLATFORMS_MAP(){return z}}var Wd;var M=K(()=>{R();J();/*!
3
3
  * Bowser - a browser detector
4
4
  * https://github.com/bowser-js/bowser
5
5
  * MIT License | (c) Dustin Diaz 2012-2015
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{wd as a}from"./chunk-0304b7xg.js";import"./chunk-54pk7nna.js";import"./chunk-0rmmg3g4.js";export{a as dict};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-0rmmg3g4.js";var G="./tree-sitter-bash-hq5s6fxb.wasm";export{G as default};