@qitqode/qitqode-android-arm64 0.2.0 → 0.2.1
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.
- package/bundle/{chunk-cx7p4ezk.js → chunk-03mbn7nj.js} +2 -2
- package/bundle/{chunk-aw8af3ky.js → chunk-073ydjmk.js} +1 -1
- package/bundle/{chunk-rrd0jf5m.js → chunk-07s30fpb.js} +1 -1
- package/bundle/{chunk-yacccwf6.js → chunk-087tnr8a.js} +1 -1
- package/bundle/{chunk-kx2dp8ch.js → chunk-0f3ft9dh.js} +1 -1
- package/bundle/{chunk-rgxy4ngt.js → chunk-0gab4v98.js} +1 -1
- package/bundle/chunk-0xrr0k94.js +2 -0
- package/bundle/chunk-0yagj4ss.js +2 -0
- package/bundle/chunk-0ych0f5w.js +2 -0
- package/bundle/{chunk-2pzvcpv4.js → chunk-0z1cxvk1.js} +2 -2
- package/bundle/{chunk-rph9zj24.js → chunk-0zxwjsvz.js} +1 -1
- package/bundle/{chunk-pqnbdygz.js → chunk-1p6jjrea.js} +2 -2
- package/bundle/{chunk-9cw4cnz0.js → chunk-1q1cddy4.js} +1 -1
- package/bundle/{chunk-w9pdvcf9.js → chunk-1sfcxdbw.js} +2 -2
- package/bundle/chunk-22hr3ndh.js +2 -0
- package/bundle/chunk-23tyxyyj.js +2 -0
- package/bundle/chunk-28g1ndpx.js +2 -0
- package/bundle/chunk-29v1v357.js +2 -0
- package/bundle/{chunk-txqc7543.js → chunk-29zm623f.js} +2 -2
- package/bundle/{chunk-wm77svwm.js → chunk-2a9rzgk6.js} +1 -1
- package/bundle/chunk-2avxtbv3.js +2 -0
- package/bundle/{chunk-eaqfnwdj.js → chunk-2bgqy6z7.js} +1 -1
- package/bundle/{chunk-9zre5e54.js → chunk-2hv2c8d5.js} +1 -1
- package/bundle/{chunk-swcgsrbj.js → chunk-2jpmxt4v.js} +1 -1
- package/bundle/chunk-2qk0k2eb.js +2 -0
- package/bundle/{chunk-nsjp44fp.js → chunk-2qwmrp16.js} +1 -1
- package/bundle/{chunk-dykqn0nj.js → chunk-2xqqkf86.js} +2 -2
- package/bundle/{chunk-r0g5yyhf.js → chunk-3aq70t26.js} +1 -1
- package/bundle/{chunk-zfcfyagt.js → chunk-3h49k2ck.js} +1 -1
- package/bundle/{chunk-sv1s1qxd.js → chunk-3kn57y8d.js} +5 -5
- package/bundle/chunk-3ktj87g4.js +2 -0
- package/bundle/{chunk-52b1v7mn.js → chunk-3qfpw8f6.js} +1 -1
- package/bundle/{chunk-v3x5nrc4.js → chunk-3tmq81kq.js} +2 -2
- package/bundle/chunk-3wxvpvg4.js +3 -0
- package/bundle/{chunk-neqy8j4n.js → chunk-42r7z6sq.js} +1 -1
- package/bundle/chunk-42wdfks8.js +2 -0
- package/bundle/chunk-4f19vqxf.js +2 -0
- package/bundle/{chunk-d93z6hrn.js → chunk-4fk46ngj.js} +1 -1
- package/bundle/{chunk-njkserae.js → chunk-4hd3v58j.js} +1 -1
- package/bundle/chunk-4jq25vbc.js +2 -0
- package/bundle/chunk-4m3k1atq.js +2 -0
- package/bundle/{chunk-1wpjmwnh.js → chunk-4mvg7jt1.js} +1 -1
- package/bundle/chunk-4n2ytddp.js +2 -0
- package/bundle/{chunk-zesbm9k1.js → chunk-4sxg9cgr.js} +1 -1
- package/bundle/{chunk-8fgamz4y.js → chunk-4v61ysex.js} +1 -1
- package/bundle/chunk-4yg42p6y.js +2 -0
- package/bundle/chunk-4zx3ze68.js +2 -0
- package/bundle/chunk-57xbwzdn.js +3 -0
- package/bundle/{chunk-rexdr63q.js → chunk-5az84brc.js} +2 -2
- package/bundle/{chunk-y0ydzdfc.js → chunk-5t0w9ecw.js} +1 -1
- package/bundle/{chunk-nq495be3.js → chunk-5wwd40t3.js} +1 -1
- package/bundle/chunk-637sjdzq.js +2 -0
- package/bundle/{chunk-snt1kefv.js → chunk-64c8q9zg.js} +3 -3
- package/bundle/{chunk-g794ey6w.js → chunk-6avjq7my.js} +1 -1
- package/bundle/chunk-6bghztra.js +2 -0
- package/bundle/{chunk-n0trgp1c.js → chunk-6dfjtzqb.js} +2 -2
- package/bundle/chunk-6h8f89tt.js +2 -0
- package/bundle/{chunk-b0jh0rby.js → chunk-6j339s7a.js} +2 -2
- package/bundle/{chunk-8q6z6emx.js → chunk-6kf4vw2g.js} +1 -1
- package/bundle/{chunk-hgsykghj.js → chunk-6pcmv8vs.js} +2 -2
- package/bundle/chunk-6sjj203r.js +2 -0
- package/bundle/{chunk-6r8pg6ma.js → chunk-6y4mwmn4.js} +1 -1
- package/bundle/{chunk-kt0ej3nq.js → chunk-6ypafpg8.js} +1 -1
- package/bundle/{chunk-p8kpqyxb.js → chunk-732yr6qq.js} +2 -2
- package/bundle/{chunk-3sz6gw10.js → chunk-73fz0cf4.js} +2 -2
- package/bundle/chunk-79aka9xe.js +2 -0
- package/bundle/{chunk-8tp4whyw.js → chunk-7my2231h.js} +1 -1
- package/bundle/{chunk-xjhezxft.js → chunk-7myg8076.js} +3 -3
- package/bundle/{chunk-vvzbfv2f.js → chunk-7njz51r4.js} +1 -1
- package/bundle/chunk-7nqdhe7x.js +2 -0
- package/bundle/{chunk-zaan8jk6.js → chunk-7ntw4rrn.js} +1 -1
- package/bundle/chunk-7rhry8nv.js +2 -0
- package/bundle/chunk-7x88b2n2.js +2 -0
- package/bundle/{chunk-46ztrjw0.js → chunk-7zvawpe1.js} +1 -1
- package/bundle/{chunk-jgz1a29w.js → chunk-86jsqc7d.js} +3 -3
- package/bundle/{chunk-zbqzm65q.js → chunk-86yk21g4.js} +1 -1
- package/bundle/{chunk-w3bmf3zz.js → chunk-8e6gx3gg.js} +1 -1
- package/bundle/chunk-8mthftwc.js +2 -0
- package/bundle/{chunk-73ckx171.js → chunk-8q5ns61h.js} +1 -1
- package/bundle/{chunk-549ptbaj.js → chunk-8rh0femq.js} +1 -1
- package/bundle/chunk-8wdara3b.js +2 -0
- package/bundle/chunk-8xhzpnph.js +2 -0
- package/bundle/{chunk-kqhh2pm9.js → chunk-94qhpkfx.js} +1 -1
- package/bundle/{chunk-gxmxx8jb.js → chunk-99148b1k.js} +1 -1
- package/bundle/chunk-9akz8w0d.js +2 -0
- package/bundle/{chunk-7gbytqkn.js → chunk-9b4aqcde.js} +2 -2
- package/bundle/{chunk-tdmn21z0.js → chunk-9ea1n338.js} +2 -2
- package/bundle/chunk-9eg2ytjd.js +17 -0
- package/bundle/chunk-9etpppyv.js +3 -0
- package/bundle/{chunk-vgaxv70x.js → chunk-9jrxrjzt.js} +2 -2
- package/bundle/{chunk-3bkdbqjj.js → chunk-9jsgs71h.js} +1 -1
- package/bundle/{chunk-twhavv1m.js → chunk-9nn4jpb7.js} +1 -1
- package/bundle/{chunk-pxx2hz0g.js → chunk-9rxyq6f9.js} +2 -2
- package/bundle/chunk-9tk4wsn4.js +2 -0
- package/bundle/{chunk-9fkmhmh6.js → chunk-9y15zjxa.js} +1 -1
- package/bundle/chunk-a0rjp24v.js +2 -0
- package/bundle/{chunk-mdzzcrf9.js → chunk-a2dz9nqh.js} +2 -2
- package/bundle/chunk-a7p0x4sw.js +2 -0
- package/bundle/{chunk-ev3a2sxv.js → chunk-a92hh67a.js} +2 -2
- package/bundle/chunk-ae0a496j.js +2 -0
- package/bundle/{chunk-px8vtbmr.js → chunk-ahyqfbmq.js} +2 -2
- package/bundle/chunk-aq1j9y18.js +2 -0
- package/bundle/chunk-aq8nz9hp.js +2 -0
- package/bundle/{chunk-zxddasg8.js → chunk-as845ya4.js} +1 -1
- package/bundle/chunk-b4zy78be.js +2 -0
- package/bundle/{chunk-45mjcxqk.js → chunk-b50t4jc5.js} +1 -1
- package/bundle/chunk-basjzwqp.js +2 -0
- package/bundle/{chunk-d1rn44wz.js → chunk-bbbh69ys.js} +1 -1
- package/bundle/{chunk-mw2hr4pd.js → chunk-bcx2vkv4.js} +1 -1
- package/bundle/{chunk-72zxassf.js → chunk-bggybm9k.js} +1 -1
- package/bundle/{chunk-4gs87ghj.js → chunk-bgng3rdj.js} +2 -2
- package/bundle/chunk-bhetpmgq.js +3 -0
- package/bundle/{chunk-bnz0mxak.js → chunk-bk3z400e.js} +1 -1
- package/bundle/chunk-bm7xpjh6.js +2 -0
- package/bundle/{chunk-nhwhkx62.js → chunk-bzs2ep7s.js} +1 -1
- package/bundle/{chunk-7fawtcnn.js → chunk-c1g8n10t.js} +1 -1
- package/bundle/chunk-c2k556rk.js +2 -0
- package/bundle/{chunk-w03fdrxe.js → chunk-cbf1y12x.js} +1 -1
- package/bundle/{chunk-vc4e6xc4.js → chunk-cbmwhvxw.js} +2 -2
- package/bundle/{chunk-5bate758.js → chunk-cp39f96a.js} +1 -1
- package/bundle/{chunk-9nk0ts0s.js → chunk-d307vb2d.js} +1 -1
- package/bundle/chunk-d41mg7at.js +2 -0
- package/bundle/chunk-d50kpss6.js +2 -0
- package/bundle/chunk-day0rb5p.js +2 -0
- package/bundle/{chunk-dz3s882k.js → chunk-dj3525nn.js} +4 -4
- package/bundle/{chunk-qq2rcxv2.js → chunk-dknemkw2.js} +2 -2
- package/bundle/chunk-dp7cww4v.js +2 -0
- package/bundle/{chunk-yeq7b87a.js → chunk-drwqag0f.js} +1 -1
- package/bundle/{chunk-qdcf1ay5.js → chunk-e586sjb0.js} +2 -2
- package/bundle/{chunk-qs4wef8c.js → chunk-e6wp96vm.js} +1 -1
- package/bundle/{chunk-g8cfzzrs.js → chunk-e89zjjmj.js} +1 -1
- package/bundle/chunk-egae7vvg.js +2 -0
- package/bundle/chunk-erdjd9w3.js +2 -0
- package/bundle/chunk-ex93y6dw.js +2 -0
- package/bundle/chunk-eyr0vf92.js +2 -0
- package/bundle/{chunk-02xcb52z.js → chunk-ezfzb8qc.js} +2 -2
- package/bundle/{chunk-kp8nkm3m.js → chunk-f1bcz9yz.js} +1 -1
- package/bundle/chunk-f4zfk5ye.js +2 -0
- package/bundle/{chunk-ceefd2nj.js → chunk-f7rj6fck.js} +1 -1
- package/bundle/{chunk-4sazy0nq.js → chunk-f83wv08n.js} +1 -1
- package/bundle/{chunk-eb8nsk7e.js → chunk-faa0zxey.js} +2 -2
- package/bundle/{chunk-3dr4469n.js → chunk-fbm6qczy.js} +1 -1
- package/bundle/{chunk-0g25z230.js → chunk-fd7fmvyw.js} +1 -1
- package/bundle/chunk-fghqr4x8.js +8 -0
- package/bundle/{chunk-0z33en1a.js → chunk-fgn83bs7.js} +1 -1
- package/bundle/{chunk-dshnn54c.js → chunk-fpm2vgz6.js} +1 -1
- package/bundle/chunk-fvkwcx35.js +2 -0
- package/bundle/{chunk-w5940jxm.js → chunk-fvy24yhq.js} +1 -1
- package/bundle/{chunk-gt6tgm42.js → chunk-fymt1rym.js} +1 -1
- package/bundle/{chunk-dt899wbf.js → chunk-g3kd4957.js} +2 -2
- package/bundle/{chunk-v7q3d3n6.js → chunk-g5cgpvef.js} +2 -2
- package/bundle/{chunk-909fp6pm.js → chunk-g9end129.js} +1 -1
- package/bundle/chunk-gbmmbhy4.js +2 -0
- package/bundle/chunk-gp877cq5.js +2 -0
- package/bundle/{chunk-tgd5ctnt.js → chunk-gr4bctqj.js} +2 -2
- package/bundle/{chunk-dvxk6mr6.js → chunk-grw4gg9j.js} +2 -2
- package/bundle/{chunk-mvnxwwe7.js → chunk-gtjn3yc4.js} +2 -2
- package/bundle/chunk-hk8vvc10.js +2 -0
- package/bundle/{chunk-cxtxvt43.js → chunk-hmznf0ax.js} +1 -1
- package/bundle/{chunk-gnt982jr.js → chunk-hpa7e9va.js} +3 -3
- package/bundle/{chunk-hcy77w6t.js → chunk-hq9bgnqb.js} +1 -1
- package/bundle/{chunk-gkj4a27z.js → chunk-hrw5rmj1.js} +1 -1
- package/bundle/{chunk-n2ygpy76.js → chunk-hs3vfhar.js} +1 -1
- package/bundle/chunk-hwavzxdm.js +2 -0
- package/bundle/chunk-hwnc2sa5.js +2 -0
- package/bundle/chunk-j2gvpa15.js +2 -0
- package/bundle/{chunk-te5tfq79.js → chunk-j3jqk62r.js} +1 -1
- package/bundle/{chunk-jqn27885.js → chunk-j5ymkhry.js} +1 -1
- package/bundle/chunk-j7n8khk7.js +2 -0
- package/bundle/{chunk-ws3p9cya.js → chunk-jgtcfw96.js} +2 -2
- package/bundle/{chunk-5myxjxae.js → chunk-jjjs8p0t.js} +2 -2
- package/bundle/chunk-jkh98wby.js +2 -0
- package/bundle/{chunk-h7w35n7w.js → chunk-jv4th87b.js} +1 -1
- package/bundle/{chunk-j63fkt6n.js → chunk-jvjq554f.js} +1 -1
- package/bundle/{chunk-00sr2gwz.js → chunk-jw114bbt.js} +2 -2
- package/bundle/{chunk-ax1y4699.js → chunk-jwph7tpc.js} +1 -1
- package/bundle/{chunk-xdacgfba.js → chunk-k1gddnkm.js} +1 -1
- package/bundle/chunk-k5a652s4.js +2 -0
- package/bundle/{chunk-1mcsf4yb.js → chunk-k6cbfrzc.js} +2 -2
- package/bundle/chunk-k6w32q2p.js +2 -0
- package/bundle/{chunk-rtdym35y.js → chunk-kc1xmcc9.js} +141 -135
- package/bundle/{chunk-5kmfnkzv.js → chunk-kdcnder5.js} +1 -1
- package/bundle/chunk-ke5rqv5b.js +2 -0
- package/bundle/chunk-kghwk0yh.js +2 -0
- package/bundle/{chunk-r6ndvzd0.js → chunk-km1n4ttr.js} +1 -1
- package/bundle/{chunk-m0xsvzyd.js → chunk-knh01n2r.js} +2 -2
- package/bundle/{chunk-ydc6ypjt.js → chunk-ks1cs80p.js} +2 -2
- package/bundle/{chunk-08q55ya0.js → chunk-kxjrrdj0.js} +1 -1
- package/bundle/{chunk-jts0dma5.js → chunk-kzvvvj79.js} +2 -2
- package/bundle/chunk-mgadsp7r.js +2 -0
- package/bundle/chunk-mk2s9py8.js +2 -0
- package/bundle/{chunk-hb9mc5f9.js → chunk-mpe8zxc0.js} +1 -1
- package/bundle/{chunk-yykjvt7f.js → chunk-mswx4k75.js} +2 -2
- package/bundle/{chunk-z0tfsdb9.js → chunk-mx3jd1p9.js} +1 -1
- package/bundle/{chunk-sxy4hyyy.js → chunk-mxf9p0p9.js} +1 -1
- package/bundle/{chunk-std2bgv7.js → chunk-mxhb5adq.js} +2 -2
- package/bundle/{chunk-gwfx7tx7.js → chunk-my3cswnp.js} +2 -2
- package/bundle/chunk-n0k0pp4k.js +2 -0
- package/bundle/chunk-n393nnh5.js +2 -0
- package/bundle/chunk-n5vyed7w.js +2 -0
- package/bundle/{chunk-jf6ry79j.js → chunk-n7kqdqkh.js} +4 -4
- package/bundle/{chunk-tdxbm1nd.js → chunk-n90eh3e7.js} +1 -1
- package/bundle/{chunk-n7d9eemn.js → chunk-nb86kh94.js} +211 -211
- package/bundle/{chunk-s8mghr5a.js → chunk-ngvp6zc2.js} +2 -2
- package/bundle/{chunk-98effz12.js → chunk-nh044sjn.js} +1 -1
- package/bundle/{chunk-ypk3t1eh.js → chunk-nm6wnne9.js} +1 -1
- package/bundle/{chunk-mcc5ynma.js → chunk-p4ewy9xh.js} +3 -3
- package/bundle/{chunk-d9x9kqvy.js → chunk-p5mes2sh.js} +1 -1
- package/bundle/{chunk-vgnddhdj.js → chunk-p635phfw.js} +1 -1
- package/bundle/{chunk-dgx4rq86.js → chunk-p887g1xj.js} +1 -1
- package/bundle/{chunk-7jhrxzjx.js → chunk-p9mj4zyk.js} +2 -2
- package/bundle/chunk-pasm65wq.js +2 -0
- package/bundle/chunk-pfh34atn.js +2 -0
- package/bundle/{chunk-xdjwapwy.js → chunk-pfkm3j8g.js} +2 -2
- package/bundle/chunk-phpmxjf8.js +2 -0
- package/bundle/{chunk-9dh9bc9d.js → chunk-pp9neaaz.js} +1 -1
- package/bundle/{chunk-c72jajx9.js → chunk-pzefsndd.js} +1 -1
- package/bundle/{chunk-dh1h513y.js → chunk-q128vfc6.js} +1 -1
- package/bundle/{chunk-z7vv0ngm.js → chunk-q148vndn.js} +2 -2
- package/bundle/{chunk-4fa390yr.js → chunk-q4fn41ex.js} +2 -2
- package/bundle/{chunk-zrmx397j.js → chunk-q5abwn50.js} +1 -1
- package/bundle/{chunk-s2xdf6qh.js → chunk-q9ft590w.js} +2 -2
- package/bundle/{chunk-7vftsy04.js → chunk-qaz100ht.js} +1 -1
- package/bundle/{chunk-17pxm5d3.js → chunk-qeg0jnxq.js} +2 -2
- package/bundle/{chunk-871f8x99.js → chunk-qf1dqzra.js} +2 -2
- package/bundle/{chunk-qyjt0qnq.js → chunk-qg9bt0kx.js} +2 -2
- package/bundle/{chunk-pnq1h5az.js → chunk-qhnpq5gb.js} +2 -2
- package/bundle/{chunk-kb6v5hhm.js → chunk-qkh8697x.js} +2 -2
- package/bundle/chunk-qvzvxsjw.js +2 -0
- package/bundle/chunk-qzszrd0s.js +2 -0
- package/bundle/{chunk-yzwgvjzd.js → chunk-r0s28gnb.js} +1 -1
- package/bundle/{chunk-k7n1csxv.js → chunk-r2qns6yc.js} +1 -1
- package/bundle/{chunk-yj6rbe9p.js → chunk-rcyzqa3g.js} +2 -2
- package/bundle/{chunk-70pb4kcm.js → chunk-rdwma0de.js} +2 -2
- package/bundle/{chunk-25bp7pcm.js → chunk-rk2bk4s7.js} +2 -2
- package/bundle/{chunk-x6rr6ss1.js → chunk-rm5ntsvn.js} +1 -1
- package/bundle/{chunk-fyz7fngd.js → chunk-rnq5ezrt.js} +1 -1
- package/bundle/{chunk-xhbb8b5g.js → chunk-rp8asmq7.js} +1 -1
- package/bundle/{chunk-z1rshv6g.js → chunk-rpfhgncs.js} +1 -1
- package/bundle/{chunk-cagk1sjd.js → chunk-s0ptrw0z.js} +1 -1
- package/bundle/{chunk-yw9pfqxt.js → chunk-s0ty36qg.js} +1 -1
- package/bundle/{chunk-pr1ysgr3.js → chunk-s7yza695.js} +1 -1
- package/bundle/chunk-s99cvvc9.js +2 -0
- package/bundle/{chunk-v0yxkq99.js → chunk-sh76e256.js} +2 -2
- package/bundle/chunk-skpkjnyy.js +2 -0
- package/bundle/{chunk-8r3410c2.js → chunk-skv9ww0s.js} +1 -1
- package/bundle/chunk-snt4kwab.js +2 -0
- package/bundle/chunk-sq47t8f1.js +2 -0
- package/bundle/chunk-sqhgnvvs.js +2 -0
- package/bundle/chunk-t114r59h.js +2 -0
- package/bundle/chunk-t1f56k0j.js +2 -0
- package/bundle/{chunk-9s4whpg1.js → chunk-t1jgx17a.js} +2 -2
- package/bundle/chunk-t69jx6fz.js +2 -0
- package/bundle/{chunk-srxx88nb.js → chunk-t9zbp2qw.js} +1 -1
- package/bundle/{chunk-jcjaw7tk.js → chunk-ta7mfkms.js} +2 -2
- package/bundle/{chunk-aj3y2e86.js → chunk-tce12v85.js} +1 -1
- package/bundle/{chunk-fn8191ps.js → chunk-tczbhj0e.js} +1 -1
- package/bundle/{chunk-h1kg35mn.js → chunk-tge53d52.js} +1 -1
- package/bundle/chunk-tq1dqhes.js +2 -0
- package/bundle/chunk-tsb3jsx4.js +2 -0
- package/bundle/chunk-ttpbpzbh.js +2 -0
- package/bundle/{chunk-2dkrfc1s.js → chunk-v5z6sx6j.js} +1 -1
- package/bundle/chunk-v667egp5.js +2 -0
- package/bundle/{chunk-w8d9srv7.js → chunk-v7mg632n.js} +2 -2
- package/bundle/{chunk-60qyqqxx.js → chunk-v9rg0a8g.js} +1 -1
- package/bundle/{chunk-jngchw38.js → chunk-ve3np791.js} +1 -1
- package/bundle/{chunk-wev34grp.js → chunk-vhe92p7a.js} +2 -2
- package/bundle/{chunk-qpzspr9z.js → chunk-vjx0064q.js} +2 -2
- package/bundle/{chunk-atpzz901.js → chunk-vm1ek7yf.js} +1 -1
- package/bundle/{chunk-3mepk08v.js → chunk-vqpfpmha.js} +2 -2
- package/bundle/{chunk-cdh26622.js → chunk-vqss3e48.js} +2 -2
- package/bundle/{chunk-ewpzqnj4.js → chunk-w79jzf8w.js} +1 -1
- package/bundle/{chunk-yha554nm.js → chunk-w7em72p8.js} +2 -2
- package/bundle/chunk-wcqfr8vr.js +3 -0
- package/bundle/{chunk-r58gzg6m.js → chunk-wdaf713t.js} +1 -1
- package/bundle/{chunk-ymtcm4xd.js → chunk-wf4x5cjc.js} +1 -1
- package/bundle/{chunk-vsys768k.js → chunk-wfggztm4.js} +1 -1
- package/bundle/{chunk-j5kyf7vt.js → chunk-wp3dpt6d.js} +2 -2
- package/bundle/{chunk-acyj91wq.js → chunk-x2cavpa9.js} +1 -1
- package/bundle/{chunk-kmtfdky8.js → chunk-x3afqfww.js} +2 -2
- package/bundle/{chunk-qb35hqm4.js → chunk-x4pdpka8.js} +1 -1
- package/bundle/{chunk-vm58fkrv.js → chunk-xd3xc1vv.js} +1 -1
- package/bundle/{chunk-m6zxr0j8.js → chunk-xjpvv3vp.js} +2 -2
- package/bundle/chunk-xnhvt98g.js +5 -0
- package/bundle/{chunk-64s7vfj7.js → chunk-xny5ecn0.js} +2 -2
- package/bundle/chunk-xwgc2pw7.js +28 -0
- package/bundle/chunk-xxrtr6sd.js +2 -0
- package/bundle/chunk-y287zwkr.js +10 -0
- package/bundle/{chunk-ezrskm25.js → chunk-y3dfk6n5.js} +1 -1
- package/bundle/{chunk-t01bhw5h.js → chunk-y4e7e42x.js} +3 -3
- package/bundle/chunk-y8eggnrr.js +2 -0
- package/bundle/{chunk-9xvctnjr.js → chunk-yajd975f.js} +1 -1
- package/bundle/chunk-yck5h49c.js +2 -0
- package/bundle/{chunk-8yr682pv.js → chunk-yd2emszh.js} +2 -2
- package/bundle/{chunk-p9zrk16q.js → chunk-yd8bzhv6.js} +1 -1
- package/bundle/{chunk-ztnepaqc.js → chunk-yerfyz4w.js} +1 -1
- package/bundle/{chunk-x42w8ewc.js → chunk-yg0pfngv.js} +1 -1
- package/bundle/{chunk-y1b2h15z.js → chunk-ypcc3cnb.js} +1 -1
- package/bundle/{chunk-tzrbb0e8.js → chunk-yqb6cfed.js} +2 -2
- package/bundle/{chunk-qy1a2tpc.js → chunk-yr35q7q1.js} +1 -1
- package/bundle/{chunk-rcyhqkv5.js → chunk-yrfq22a5.js} +1 -1
- package/bundle/{chunk-gg7bg3ek.js → chunk-yvjke593.js} +1 -1
- package/bundle/{chunk-zfnbk5gy.js → chunk-ywkvq7zb.js} +1 -1
- package/bundle/{chunk-p3rp99na.js → chunk-yx1h0b5v.js} +1 -1
- package/bundle/chunk-yxeja9kg.js +2 -0
- package/bundle/{chunk-mzbr0m2v.js → chunk-yz0pwv2m.js} +1 -1
- package/bundle/{chunk-q81m4m9z.js → chunk-z2h1gxyx.js} +1 -1
- package/bundle/{chunk-qqne79vp.js → chunk-zdzxsyxs.js} +2 -2
- package/bundle/{chunk-yzh4rmrt.js → chunk-zek5c15t.js} +1 -1
- package/bundle/{chunk-8dxdeksr.js → chunk-zfd70p01.js} +1 -1
- package/bundle/{chunk-pnpre7ys.js → chunk-zqkv8796.js} +1 -1
- package/bundle/chunk-ztn2jv26.js +11 -0
- package/bundle/index.js +3 -3
- package/bundle/parser.worker.js +2 -2
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-092bx2yw.js +0 -2
- package/bundle/chunk-0jrgk6vk.js +0 -2
- package/bundle/chunk-0ne5m1n3.js +0 -2
- package/bundle/chunk-0qn52zsd.js +0 -2
- package/bundle/chunk-10accb7b.js +0 -2
- package/bundle/chunk-13kpdfr7.js +0 -2
- package/bundle/chunk-15s8zwgf.js +0 -2
- package/bundle/chunk-1bx2sjn6.js +0 -11
- package/bundle/chunk-1kgyfja6.js +0 -2
- package/bundle/chunk-4dtkj9zg.js +0 -2
- package/bundle/chunk-4e9p3e0a.js +0 -2
- package/bundle/chunk-4tbqsrsn.js +0 -2
- package/bundle/chunk-53kns5wy.js +0 -2
- package/bundle/chunk-559ek1ym.js +0 -2
- package/bundle/chunk-55wxgsga.js +0 -2
- package/bundle/chunk-5ke0yqqz.js +0 -8
- package/bundle/chunk-5q1fz2az.js +0 -2
- package/bundle/chunk-5sgpjgss.js +0 -10
- package/bundle/chunk-88emsbaz.js +0 -2
- package/bundle/chunk-8yn64y27.js +0 -2
- package/bundle/chunk-8ywa7az5.js +0 -2
- package/bundle/chunk-8ywdddts.js +0 -2
- package/bundle/chunk-92zjark4.js +0 -2
- package/bundle/chunk-a6z0fhta.js +0 -2
- package/bundle/chunk-akpssv2d.js +0 -2
- package/bundle/chunk-aq28ejhv.js +0 -2
- package/bundle/chunk-b10px5g4.js +0 -2
- package/bundle/chunk-bha3sbsj.js +0 -2
- package/bundle/chunk-bs020a3x.js +0 -2
- package/bundle/chunk-bs61sezq.js +0 -2
- package/bundle/chunk-cmdjkx32.js +0 -2
- package/bundle/chunk-de2rfsaf.js +0 -2
- package/bundle/chunk-dncnyzaa.js +0 -2
- package/bundle/chunk-dp6zktka.js +0 -2
- package/bundle/chunk-dvqdtdza.js +0 -2
- package/bundle/chunk-ebabnv33.js +0 -3
- package/bundle/chunk-ebdpg3cn.js +0 -2
- package/bundle/chunk-eyc6tb5h.js +0 -2
- package/bundle/chunk-eze57bty.js +0 -2
- package/bundle/chunk-fa47vzfc.js +0 -2
- package/bundle/chunk-fe397ph0.js +0 -2
- package/bundle/chunk-fr75ytdr.js +0 -2
- package/bundle/chunk-fw2tnbt6.js +0 -2
- package/bundle/chunk-fwr2qgqb.js +0 -2
- package/bundle/chunk-g204pt98.js +0 -2
- package/bundle/chunk-gcgmwqhh.js +0 -2
- package/bundle/chunk-grdfpd57.js +0 -2
- package/bundle/chunk-gw36mrg4.js +0 -2
- package/bundle/chunk-h36qec67.js +0 -2
- package/bundle/chunk-h9gtymfm.js +0 -2
- package/bundle/chunk-h9qn35pn.js +0 -2
- package/bundle/chunk-hd8q4msp.js +0 -2
- package/bundle/chunk-hhjkezfz.js +0 -2
- package/bundle/chunk-hnz570f9.js +0 -3
- package/bundle/chunk-jfz8wwk9.js +0 -2
- package/bundle/chunk-js6hqmq7.js +0 -2
- package/bundle/chunk-k70x182t.js +0 -2
- package/bundle/chunk-kwzawx7r.js +0 -2
- package/bundle/chunk-m0mek3es.js +0 -2
- package/bundle/chunk-m31d2n6h.js +0 -2
- package/bundle/chunk-n14qktbg.js +0 -2
- package/bundle/chunk-n38h109k.js +0 -17
- package/bundle/chunk-nzzsj54n.js +0 -2
- package/bundle/chunk-p19qfw59.js +0 -2
- package/bundle/chunk-p2yxj9s4.js +0 -2
- package/bundle/chunk-ps9p14y6.js +0 -2
- package/bundle/chunk-qagc6v17.js +0 -2
- package/bundle/chunk-qc0zhbhm.js +0 -2
- package/bundle/chunk-r78kfhvz.js +0 -2
- package/bundle/chunk-rnd5mnsm.js +0 -2
- package/bundle/chunk-schtpyjs.js +0 -2
- package/bundle/chunk-sp8ek94w.js +0 -5
- package/bundle/chunk-sxwqrvmy.js +0 -28
- package/bundle/chunk-syc4b8rt.js +0 -2
- package/bundle/chunk-tcs6wgna.js +0 -3
- package/bundle/chunk-tf4xwqz7.js +0 -2
- package/bundle/chunk-tzg4z74d.js +0 -2
- package/bundle/chunk-v8vcwx23.js +0 -2
- package/bundle/chunk-vftqwdpg.js +0 -3
- package/bundle/chunk-w6rf2knb.js +0 -2
- package/bundle/chunk-wh7r96t3.js +0 -2
- package/bundle/chunk-wnjqaxze.js +0 -2
- package/bundle/chunk-xc9se3c8.js +0 -2
- package/bundle/chunk-xfz698bh.js +0 -2
- package/bundle/chunk-xxj3sgd5.js +0 -2
- package/bundle/chunk-xxvqq7kc.js +0 -2
- package/bundle/chunk-ye0mkqb4.js +0 -2
- package/bundle/chunk-yfp9y71y.js +0 -2
- package/bundle/chunk-yjjh339w.js +0 -2
- package/bundle/chunk-yt6vd7a5.js +0 -2
- package/bundle/chunk-yzn08nx1.js +0 -2
- package/bundle/chunk-yzq3c3dq.js +0 -2
- package/bundle/chunk-z1j25911.js +0 -2
- package/bundle/chunk-z210dtw1.js +0 -3
- package/bundle/chunk-z29ahthm.js +0 -2
- package/bundle/chunk-zgre4gc2.js +0 -2
- package/bundle/chunk-zthkjx33.js +0 -2
- package/bundle/chunk-zwvwbrsc.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$
|
|
2
|
+
import{$u as Z,$v as Za,$w as Yb,$x as Yc,Au as y,Av as ya,Aw as yb,Ax as xc,Ay as xd,Bu as z,Bv as za,Bw as zb,Bx as yc,By as yd,Cu as A,Cv as Aa,Cw as Ab,Cx as zc,Cy as zd,Du as B,Dv as Ba,Dw as Bb,Dx as Ac,Dy as Ad,Eu as C,Ev as Ca,Ew as Cb,Ex as Bc,Ey as Bd,Fu as D,Fv as Da,Fw as Db,Fx as Cc,Fy as Cd,Gu as E,Gv as Ea,Gx as Dc,Gy as Dd,Hu as F,Hv as Fa,Hw as Eb,Hx as Ec,Hy as Ed,Iu as G,Iv as Ga,Iw as Fb,Ix as Fc,Iy as Fd,Ju as H,Jv as Ha,Jw as Gb,Jx as Gc,Jy as Gd,Ku as I,Kv as Ia,Kw as Hb,Kx as Hc,Ky as Hd,Lu as J,Lv as Ja,Lw as Ib,Lx as Ic,Ly as Id,Mu as K,Mv as Ka,Mw as Jb,Mx as Jc,My as Jd,Nu as L,Nv as La,Nw as Kb,Nx as Kc,Ny as Kd,Ou as M,Ov as Ma,Ow as Lb,Ox as Lc,Oy as Ld,Pu as N,Pv as Na,Pw as Mb,Px as Mc,Py as Md,Qu as O,Qv as Oa,Qw as Nb,Qx as Nc,Qy as Nd,Ru as P,Rv as Pa,Rw as Ob,Rx as Oc,Ry as Od,Su as Q,Sv as Qa,Sw as Pb,Sx as Pc,Tu as R,Tv as Ra,Tw as Qb,Tx as Qc,Uu as S,Uv as Sa,Uw as Rb,Ux as Rc,Vu as T,Vv as Ta,Vw as Sb,Vx as Sc,Wu as U,Wv as Ua,Ww as Tb,Wx as Tc,Xu as V,Xv as Va,Xw as Ub,Xx as Uc,Yu as W,Yv as Wa,Yw as Vb,Yx as Vc,Zu as X,Zv as Xa,Zw as Wb,Zx as Wc,_u as Y,_v as Ya,_w as Xb,_x as Xc,av as _,aw as _a,ax as Zb,ay as Zc,bu as a,bv as $,bw as $a,bx as _b,by as _c,cu as b,cv as aa,cw as ab,cx as $b,cy as $c,du as c,dv as ba,dw as bb,dx as ac,dy as ad,eu as d,ev as ca,ew as cb,ex as bc,ey as bd,fu as e,fv as da,fw as db,fx as cc,fy as cd,gu as f,gv as ea,gw as eb,gx as dc,gy as dd,hu as g,hv as fa,hw as fb,hx as ec,hy as ed,iv as ga,iw as gb,ix as fc,iy as fd,ju as h,jv as ha,jw as hb,jx as gc,jy as gd,ku as i,kv as ia,kw as ib,kx as hc,ky as hd,lu as j,lv as ja,lw as jb,lx as ic,ly as id,mu as k,mv as ka,mw as kb,mx as jc,my as jd,nu as l,nv as la,nw as lb,nx as kc,ny as kd,ou as m,ov as ma,ow as mb,ox as lc,oy as ld,pu as n,pv as na,pw as nb,px as mc,py as md,qu as o,qv as oa,qw as ob,qx as nc,qy as nd,ru as p,rv as pa,rw as pb,rx as oc,ry as od,su as q,sv as qa,sw as qb,sx as pc,sy as pd,tu as r,tv as ra,tw as rb,tx as qc,ty as qd,uu as s,uv as sa,uw as sb,ux as rc,uy as rd,vu as t,vv as ta,vw as tb,vx as sc,vy as sd,wu as u,wv as ua,ww as ub,wx as tc,wy as td,xu as v,xv as va,xw as vb,xx as uc,xy as ud,yu as w,yv as wa,yw as wb,yx as vc,yy as vd,zu as x,zv as xa,zw as xb,zx as wc,zy as wd}from"./chunk-ngvp6zc2.js";import"./chunk-f83wv08n.js";export{ka as version,i as util,n as treeifyError,Nd as toJSONSchema,o as toDotPath,x as safeParseAsync,v as safeParse,L as safeEncodeAsync,H as safeEncode,N as safeDecodeAsync,J as safeDecode,Ib as registry,O as regexes,p as prettifyError,t as parseAsync,r as parse,Eb as locales,Ma as isValidJWT,Ja as isValidBase64URL,Ha as isValidBase64,Jb as globalRegistry,f as globalConfig,m as formatError,l as flattenError,D as encodeAsync,z as encode,F as decodeAsync,B as decode,g as config,h as clone,Yb as _xid,Ec as _void,Rb as _uuidv7,Qb as _uuidv6,Pb as _uuidv4,Ob as _uuid,Sb as _url,Zc as _uppercase,Cc as _unknown,jd as _union,zc as _undefined,Xb as _ulid,xc as _uint64,rc as _uint32,md as _tuple,fd as _trim,ud as _transform,hd as _toUpperCase,gd as _toLowerCase,Dd as _templateLiteral,yc as _symbol,Id as _superRefine,zd as _success,Kd as _stringbool,Ld as _stringFormat,Kb as _string,$c as _startsWith,Tc as _size,pd as _set,w as _safeParseAsync,u as _safeParse,K as _safeEncodeAsync,G as _safeEncode,M as _safeDecodeAsync,I as _safeDecode,Xc as _regex,Hd as _refine,nd as _record,Cd as _readonly,bd as _property,Fd as _promise,Mc as _positive,Bd as _pipe,s as _parseAsync,q as _parse,dd as _overwrite,vd as _optional,lc as _number,wd as _nullable,Ac as _null,ed as _normalize,Oc as _nonpositive,yd as _nonoptional,Pc as _nonnegative,Dc as _never,Nc as _negative,rd as _nativeEnum,Ub as _nanoid,Hc as _nan,Qc as _multipleOf,Sc as _minSize,Vc as _minLength,Lc as _min,cd as _mime,Rc as _maxSize,Uc as _maxLength,Jc as _max,od as _map,Jc as _lte,Ic as _lt,Yc as _lowercase,sd as _literal,Wc as _length,Ed as _lazy,Zb as _ksuid,fc as _jwt,jc as _isoTime,kc as _isoDuration,hc as _isoDateTime,ic as _isoDate,$b as _ipv6,_b as _ipv4,ld as _intersection,wc as _int64,qc as _int32,nc as _int,_c as _includes,Nb as _guid,Lc as _gte,Kc as _gt,pc as _float64,oc as _float32,td as _file,qd as _enum,ad as _endsWith,C as _encodeAsync,y as _encode,Tb as _emoji,Mb as _email,ec as _e164,kd as _discriminatedUnion,xd as _default,E as _decodeAsync,A as _decode,Fc as _date,Gd as _custom,Wb as _cuid2,Vb as _cuid,Lb as _coercedString,mc as _coercedNumber,Gc as _coercedDate,tc as _coercedBoolean,vc as _coercedBigint,bc as _cidrv6,ac as _cidrv4,Jd as _check,Ad as _catch,sc as _boolean,uc as _bigint,dc as _base64url,cc as _base64,id as _array,Bc as _any,gc as TimePrecision,a as NEVER,Md as JSONSchemaGenerator,Od as JSONSchema,ja as Doc,Fb as $output,Gb as $input,b as $constructor,c as $brand,xa as $ZodXID,_a as $ZodVoid,Ya as $ZodUnknown,db as $ZodUnion,Va as $ZodUndefined,pa as $ZodUUID,ra as $ZodURL,wa as $ZodULID,la as $ZodType,gb as $ZodTuple,nb as $ZodTransform,zb as $ZodTemplateLiteral,Ua as $ZodSymbol,tb as $ZodSuccess,na as $ZodStringFormat,ma as $ZodString,jb as $ZodSet,Hb as $ZodRegistry,hb as $ZodRecord,k as $ZodRealError,yb as $ZodReadonly,Bb as $ZodPromise,rb as $ZodPrefault,wb as $ZodPipe,ob as $ZodOptional,cb as $ZodObjectJIT,bb as $ZodObject,Qa as $ZodNumberFormat,Pa as $ZodNumber,pb as $ZodNullable,Wa as $ZodNull,sb as $ZodNonOptional,Za as $ZodNever,ta as $ZodNanoID,vb as $ZodNaN,ib as $ZodMap,lb as $ZodLiteral,Cb as $ZodLazy,ya as $ZodKSUID,Na as $ZodJWT,fb as $ZodIntersection,Ba as $ZodISOTime,Ca as $ZodISODuration,za as $ZodISODateTime,Aa as $ZodISODate,Ea as $ZodIPv6,Da as $ZodIPv4,oa as $ZodGUID,Ab as $ZodFunction,mb as $ZodFile,j as $ZodError,kb as $ZodEnum,e as $ZodEncodeError,sa as $ZodEmoji,qa as $ZodEmail,La as $ZodE164,eb as $ZodDiscriminatedUnion,qb as $ZodDefault,$a as $ZodDate,Oa as $ZodCustomStringFormat,Db as $ZodCustom,xb as $ZodCodec,ca as $ZodCheckUpperCase,$ as $ZodCheckStringFormat,ea as $ZodCheckStartsWith,X as $ZodCheckSizeEquals,aa as $ZodCheckRegex,ga as $ZodCheckProperty,ia as $ZodCheckOverwrite,T as $ZodCheckNumberFormat,S as $ZodCheckMultipleOf,W as $ZodCheckMinSize,Z as $ZodCheckMinLength,ha as $ZodCheckMimeType,V as $ZodCheckMaxSize,Y as $ZodCheckMaxLength,ba as $ZodCheckLowerCase,Q as $ZodCheckLessThan,_ as $ZodCheckLengthEquals,da as $ZodCheckIncludes,R as $ZodCheckGreaterThan,fa as $ZodCheckEndsWith,U as $ZodCheckBigIntFormat,P as $ZodCheck,ub as $ZodCatch,va as $ZodCUID2,ua as $ZodCUID,Ga as $ZodCIDRv6,Fa as $ZodCIDRv4,Ra as $ZodBoolean,Ta as $ZodBigIntFormat,Sa as $ZodBigInt,Ka as $ZodBase64URL,Ia as $ZodBase64,d as $ZodAsyncError,ab as $ZodArray,Xa as $ZodAny};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fs as S,gs as Vq}from"./chunk-4gs87ghj.js";import{KB as Xq,LB as d,MP as $B,NP as WB,OP as zB,PC as HB,QC as VB,RP as t,SC as CB,UH as AB,VC as EB,aD as N,aE as XB,cH as f,gD as T,hG as YB,kC as KB,kG as h,nF as LB,pH as MB,qG as DB,rF as jB,sF as PB,vE as NB,wE as wB,yE as FB,zH as ZB}from"./chunk-ydc6ypjt.js";import{fQ as y}from"./chunk-pnq1h5az.js";import{gQ as K,hQ as Z,kQ as G}from"./chunk-4sazy0nq.js";var l=Z(($q)=>{Object.defineProperty($q,"__esModule",{value:!0});$q._clearDefaultServiceNameCache=$q.defaultServiceName=void 0;var D;function hB(){if(D===void 0)try{let q=globalThis.process.argv0;D=q?`unknown_service:${q}`:"unknown_service"}catch{D="unknown_service"}return D}$q.defaultServiceName=hB;function IB(){D=void 0}$q._clearDefaultServiceNameCache=IB});var Kq=Z((zq)=>{Object.defineProperty(zq,"__esModule",{value:!0});zq.isPromiseLike=void 0;var SB=(q)=>{return q!==null&&typeof q==="object"&&typeof q.then==="function"};zq.isPromiseLike=SB});var i=Z((Cq)=>{Object.defineProperty(Cq,"__esModule",{value:!0});Cq.defaultResource=Cq.emptyResource=Cq.resourceFromDetectedResource=Cq.resourceFromAttributes=void 0;var A=y(),c=Vq(),C=S(),kB=l(),M=Kq();class U{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(q,B){let J=new U({},B);return J._rawAttributes=Hq(q),J._asyncAttributesPending=q.filter(([Q,Y])=>(0,M.isPromiseLike)(Y)).length>0,J}constructor(q,B){let J=q.attributes??{};this._rawAttributes=Object.entries(J).map(([Q,Y])=>{if((0,M.isPromiseLike)(Y))this._asyncAttributesPending=!0;return[Q,Y]}),this._rawAttributes=Hq(this._rawAttributes),this._schemaUrl=_B(B?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(!this.asyncAttributesPending)return;for(let q=0;q<this._rawAttributes.length;q++){let[B,J]=this._rawAttributes[q];this._rawAttributes[q]=[B,(0,M.isPromiseLike)(J)?await J:J]}this._asyncAttributesPending=!1}get attributes(){if(this.asyncAttributesPending)A.diag.error("Accessing resource attributes before async attributes settled");if(this._memoizedAttributes)return this._memoizedAttributes;let q={};for(let[B,J]of this._rawAttributes){if((0,M.isPromiseLike)(J)){A.diag.debug(`Unsettled resource attribute ${B} skipped`);continue}if(J!=null)q[B]??=J}if(!this._asyncAttributesPending)this._memoizedAttributes=q;return q}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(q){if(q==null)return this;let B=vB(this,q),J=B?{schemaUrl:B}:void 0;return U.FromAttributeList([...q.getRawAttributes(),...this.getRawAttributes()],J)}}function p(q,B){return U.FromAttributeList(Object.entries(q),B)}Cq.resourceFromAttributes=p;function bB(q,B){return new U(q,B)}Cq.resourceFromDetectedResource=bB;function fB(){return p({})}Cq.emptyResource=fB;function gB(){return p({[C.ATTR_SERVICE_NAME]:(0,kB.defaultServiceName)(),[C.ATTR_TELEMETRY_SDK_LANGUAGE]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_LANGUAGE],[C.ATTR_TELEMETRY_SDK_NAME]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_NAME],[C.ATTR_TELEMETRY_SDK_VERSION]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_VERSION]})}Cq.defaultResource=gB;function Hq(q){return q.map(([B,J])=>{if((0,M.isPromiseLike)(J))return[B,J.catch((Q)=>{A.diag.debug("promise rejection for resource attribute: %s - %s",B,Q);return})];return[B,J]})}function _B(q){if(typeof q==="string"||q===void 0)return q;A.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",q);return}function vB(q,B){let J=q?.schemaUrl,Q=B?.schemaUrl,Y=J===void 0||J==="",z=Q===void 0||Q==="";if(Y)return Q;if(z)return J;if(J===Q)return J;A.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',J,Q);return}});var Lq=Z((wq)=>{Object.defineProperty(wq,"__esModule",{value:!0});wq.detectResources=void 0;var Nq=y(),n=i(),uB=(q={})=>{return(q.detectors||[]).map((J)=>{try{let Q=(0,n.resourceFromDetectedResource)(J.detect(q));return Nq.diag.debug(`${J.constructor.name} found resource.`,Q),Q}catch(Q){return Nq.diag.debug(`${J.constructor.name} failed: ${Q.message}`),(0,n.emptyResource)()}}).reduce((J,Q)=>J.merge(Q),(0,n.emptyResource)())};wq.detectResources=uB});var Aq=Z((Dq)=>{Object.defineProperty(Dq,"__esModule",{value:!0});Dq.envDetector=void 0;var lB=y(),cB=S(),jq=Vq();class Pq{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(q){let B={},J=(0,jq.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),Q=(0,jq.getStringFromEnv)("OTEL_SERVICE_NAME");if(J)try{let Y=this._parseResourceAttributes(J);Object.assign(B,Y)}catch(Y){lB.diag.debug(`EnvDetector failed: ${Y instanceof Error?Y.message:Y}`)}if(Q)B[cB.ATTR_SERVICE_NAME]=Q;return{attributes:B}}_parseResourceAttributes(q){if(!q)return{};let B={},J=q.split(this._COMMA_SEPARATOR);for(let Q of J){let Y=Q.split(this._LABEL_KEY_VALUE_SPLITTER);if(Y.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${Q}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[z,w]=Y,F=z.trim(),RB=w.trim();if(F.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${Q}".`);let P,m;try{P=decodeURIComponent(F),m=decodeURIComponent(RB)}catch(u){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${Q}": ${u instanceof Error?u.message:u}`)}if(P.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${P}".`);if(m.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${P}".`);B[P]=m}return B}}Dq.envDetector=new Pq});var O=Z((Uq)=>{Object.defineProperty(Uq,"__esModule",{value:!0});Uq.ATTR_WEBENGINE_VERSION=Uq.ATTR_WEBENGINE_NAME=Uq.ATTR_WEBENGINE_DESCRIPTION=Uq.ATTR_SERVICE_NAMESPACE=Uq.ATTR_SERVICE_INSTANCE_ID=Uq.ATTR_PROCESS_RUNTIME_VERSION=Uq.ATTR_PROCESS_RUNTIME_NAME=Uq.ATTR_PROCESS_RUNTIME_DESCRIPTION=Uq.ATTR_PROCESS_PID=Uq.ATTR_PROCESS_OWNER=Uq.ATTR_PROCESS_EXECUTABLE_PATH=Uq.ATTR_PROCESS_EXECUTABLE_NAME=Uq.ATTR_PROCESS_COMMAND_ARGS=Uq.ATTR_PROCESS_COMMAND=Uq.ATTR_OS_VERSION=Uq.ATTR_OS_TYPE=Uq.ATTR_K8S_POD_NAME=Uq.ATTR_K8S_NAMESPACE_NAME=Uq.ATTR_K8S_DEPLOYMENT_NAME=Uq.ATTR_K8S_CLUSTER_NAME=Uq.ATTR_HOST_TYPE=Uq.ATTR_HOST_NAME=Uq.ATTR_HOST_IMAGE_VERSION=Uq.ATTR_HOST_IMAGE_NAME=Uq.ATTR_HOST_IMAGE_ID=Uq.ATTR_HOST_ID=Uq.ATTR_HOST_ARCH=Uq.ATTR_CONTAINER_NAME=Uq.ATTR_CONTAINER_IMAGE_TAGS=Uq.ATTR_CONTAINER_IMAGE_NAME=Uq.ATTR_CONTAINER_ID=Uq.ATTR_CLOUD_REGION=Uq.ATTR_CLOUD_PROVIDER=Uq.ATTR_CLOUD_AVAILABILITY_ZONE=Uq.ATTR_CLOUD_ACCOUNT_ID=void 0;Uq.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Uq.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Uq.ATTR_CLOUD_PROVIDER="cloud.provider";Uq.ATTR_CLOUD_REGION="cloud.region";Uq.ATTR_CONTAINER_ID="container.id";Uq.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Uq.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Uq.ATTR_CONTAINER_NAME="container.name";Uq.ATTR_HOST_ARCH="host.arch";Uq.ATTR_HOST_ID="host.id";Uq.ATTR_HOST_IMAGE_ID="host.image.id";Uq.ATTR_HOST_IMAGE_NAME="host.image.name";Uq.ATTR_HOST_IMAGE_VERSION="host.image.version";Uq.ATTR_HOST_NAME="host.name";Uq.ATTR_HOST_TYPE="host.type";Uq.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Uq.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Uq.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Uq.ATTR_K8S_POD_NAME="k8s.pod.name";Uq.ATTR_OS_TYPE="os.type";Uq.ATTR_OS_VERSION="os.version";Uq.ATTR_PROCESS_COMMAND="process.command";Uq.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Uq.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Uq.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Uq.ATTR_PROCESS_OWNER="process.owner";Uq.ATTR_PROCESS_PID="process.pid";Uq.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Uq.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Uq.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Uq.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Uq.ATTR_SERVICE_NAMESPACE="service.namespace";Uq.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Uq.ATTR_WEBENGINE_NAME="webengine.name";Uq.ATTR_WEBENGINE_VERSION="webengine.version"});var hq=Z((Oq)=>{Object.defineProperty(Oq,"__esModule",{value:!0});Oq.getMachineId=void 0;var UJ=G("process"),E;async function yJ(){if(!E)switch(UJ.platform){case"darwin":E=(await import("./chunk-mw2hr4pd.js").then((m)=>K(m.default))).getMachineId;break;case"linux":E=(await import("./chunk-9dh9bc9d.js").then((m)=>K(m.default))).getMachineId;break;case"freebsd":E=(await import("./chunk-jngchw38.js").then((m)=>K(m.default))).getMachineId;break;case"win32":E=(await import("./chunk-8fgamz4y.js").then((m)=>K(m.default))).getMachineId;break;default:E=(await import("./chunk-zaan8jk6.js").then((m)=>K(m.default))).getMachineId;break}return E()}Oq.getMachineId=yJ});var a=Z((Iq)=>{Object.defineProperty(Iq,"__esModule",{value:!0});Iq.normalizeType=Iq.normalizeArch=void 0;var OJ=(q)=>{switch(q){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return q}};Iq.normalizeArch=OJ;var RJ=(q)=>{switch(q){case"sunos":return"solaris";case"win32":return"windows";default:return q}};Iq.normalizeType=RJ});var gq=Z((bq)=>{Object.defineProperty(bq,"__esModule",{value:!0});bq.hostDetector=void 0;var r=O(),Sq=G("os"),IJ=hq(),TJ=a();class kq{detect(q){return{attributes:{[r.ATTR_HOST_NAME]:(0,Sq.hostname)(),[r.ATTR_HOST_ARCH]:(0,TJ.normalizeArch)((0,Sq.arch)()),[r.ATTR_HOST_ID]:(0,IJ.getMachineId)()}}}}bq.hostDetector=new kq});var uq=Z((xq)=>{Object.defineProperty(xq,"__esModule",{value:!0});xq.osDetector=void 0;var _q=O(),vq=G("os"),SJ=a();class dq{detect(q){return{attributes:{[_q.ATTR_OS_TYPE]:(0,SJ.normalizeType)((0,vq.platform)()),[_q.ATTR_OS_VERSION]:(0,vq.release)()}}}}xq.osDetector=new dq});var iq=Z((cq)=>{Object.defineProperty(cq,"__esModule",{value:!0});cq.processDetector=void 0;var kJ=y(),H=O(),bJ=G("os");class lq{detect(q){let B={[H.ATTR_PROCESS_PID]:process.pid,[H.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[H.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[H.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[H.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[H.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[H.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};if(process.argv.length>1)B[H.ATTR_PROCESS_COMMAND]=process.argv[1];try{let J=bJ.userInfo();B[H.ATTR_PROCESS_OWNER]=J.username}catch(J){kJ.diag.debug(`error obtaining process owner: ${J}`)}return{attributes:B}}}cq.processDetector=new lq});var sq=Z((aq)=>{Object.defineProperty(aq,"__esModule",{value:!0});aq.serviceInstanceIdDetector=void 0;var fJ=O(),gJ=G("crypto");class nq{detect(q){return{attributes:{[fJ.ATTR_SERVICE_INSTANCE_ID]:(0,gJ.randomUUID)()}}}}aq.serviceInstanceIdDetector=new nq});var oq=Z((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.serviceInstanceIdDetector=L.processDetector=L.osDetector=L.hostDetector=void 0;var _J=gq();Object.defineProperty(L,"hostDetector",{enumerable:!0,get:function(){return _J.hostDetector}});var vJ=uq();Object.defineProperty(L,"osDetector",{enumerable:!0,get:function(){return vJ.osDetector}});var dJ=iq();Object.defineProperty(L,"processDetector",{enumerable:!0,get:function(){return dJ.processDetector}});var xJ=sq();Object.defineProperty(L,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return xJ.serviceInstanceIdDetector}})});var tq=Z((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.serviceInstanceIdDetector=j.processDetector=j.osDetector=j.hostDetector=void 0;var k=oq();Object.defineProperty(j,"hostDetector",{enumerable:!0,get:function(){return k.hostDetector}});Object.defineProperty(j,"osDetector",{enumerable:!0,get:function(){return k.osDetector}});Object.defineProperty(j,"processDetector",{enumerable:!0,get:function(){return k.processDetector}});Object.defineProperty(j,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return k.serviceInstanceIdDetector}})});var BB=Z((eq)=>{Object.defineProperty(eq,"__esModule",{value:!0});eq.noopDetector=eq.NoopDetector=void 0;class s{detect(){return{attributes:{}}}}eq.NoopDetector=s;eq.noopDetector=new s});var JB=Z((V)=>{Object.defineProperty(V,"__esModule",{value:!0});V.noopDetector=V.serviceInstanceIdDetector=V.processDetector=V.osDetector=V.hostDetector=V.envDetector=void 0;var cJ=Aq();Object.defineProperty(V,"envDetector",{enumerable:!0,get:function(){return cJ.envDetector}});var b=tq();Object.defineProperty(V,"hostDetector",{enumerable:!0,get:function(){return b.hostDetector}});Object.defineProperty(V,"osDetector",{enumerable:!0,get:function(){return b.osDetector}});Object.defineProperty(V,"processDetector",{enumerable:!0,get:function(){return b.processDetector}});Object.defineProperty(V,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return b.serviceInstanceIdDetector}});var pJ=BB();Object.defineProperty(V,"noopDetector",{enumerable:!0,get:function(){return pJ.noopDetector}})});var QB=Z((W)=>{Object.defineProperty(W,"__esModule",{value:!0});W.defaultServiceName=W.emptyResource=W.defaultResource=W.resourceFromAttributes=W.serviceInstanceIdDetector=W.processDetector=W.osDetector=W.hostDetector=W.envDetector=W.detectResources=void 0;var nJ=Lq();Object.defineProperty(W,"detectResources",{enumerable:!0,get:function(){return nJ.detectResources}});var R=JB();Object.defineProperty(W,"envDetector",{enumerable:!0,get:function(){return R.envDetector}});Object.defineProperty(W,"hostDetector",{enumerable:!0,get:function(){return R.hostDetector}});Object.defineProperty(W,"osDetector",{enumerable:!0,get:function(){return R.osDetector}});Object.defineProperty(W,"processDetector",{enumerable:!0,get:function(){return R.processDetector}});Object.defineProperty(W,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return R.serviceInstanceIdDetector}});var o=i();Object.defineProperty(W,"resourceFromAttributes",{enumerable:!0,get:function(){return o.resourceFromAttributes}});Object.defineProperty(W,"defaultResource",{enumerable:!0,get:function(){return o.defaultResource}});Object.defineProperty(W,"emptyResource",{enumerable:!0,get:function(){return o.emptyResource}});var aJ=l();Object.defineProperty(W,"defaultServiceName",{enumerable:!0,get:function(){return aJ.defaultServiceName}})});var g=K(QB(),1),$=K(S(),1);class I extends N()("@effect/opentelemetry/Resource"){}var iQ=(q)=>{let B={...q.attributes??void 0,[$.ATTR_SERVICE_NAME]:q.serviceName,[$.ATTR_TELEMETRY_SDK_NAME]:"@effect/opentelemetry",[$.ATTR_TELEMETRY_SDK_LANGUAGE]:typeof globalThis.document>"u"?$.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:$.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS};if(q.serviceVersion)B[$.ATTR_SERVICE_VERSION]=q.serviceVersion;return B},nQ=(q)=>h(I,f(function*(){let B=yield*zB(t("OTEL_SERVICE_NAME")),J=yield*t("OTEL_RESOURCE_ATTRIBUTES").pipe(WB(""),$B((Q)=>{let Y=Q.split(",");return XB(Y,{},(z,w)=>{let F=w.split("=");if(F.length!==2)return z;return z[F[0].trim()]=F[1].trim(),z})}));if(B._tag==="Some")J[$.ATTR_SERVICE_NAME]=B.value;if(q)Object.assign(J,q);return g.resourceFromAttributes(J)}).pipe(ZB)),aQ=YB(I,g.emptyResource());var X=K(y(),1),x=K(S(),1);var GB=BigInt(1e9),_=(q)=>{return[Number(q/GB),Number(q%GB)]},v=(q)=>{let B={};for(let[J,Q]of Object.entries(q))B[J]=e(Q);return B},e=(q)=>{if(typeof q==="string"||typeof q==="number"||typeof q==="boolean")return q;else if(typeof q==="bigint")return q.toString();return KB(q)};class Yq extends N()("@effect/opentelemetry/Tracer"){}class UB extends N()("@effect/opentelemetry/Tracer/OtelTracerProvider"){}class Bq extends N()("@effect/opentelemetry/Tracer/OtelTraceFlags"){}class Jq extends N()("@effect/opentelemetry/Tracer/OtelTraceState"){}var eJ=MB(AB(Yq),(q)=>NB({span(B){return new Zq(X.context,X.trace,q,B)},context(B,J){let Q=J.currentSpan;if(Q===void 0)return B["~effect/Effect/evaluate"](J);return X.context.with(OB(X.context.active(),Q),()=>B["~effect/Effect/evaluate"](J))}}));var qQ=h(Yq,f(function*(){let q=yield*I;return(yield*UB).getTracer(q.attributes[x.ATTR_SERVICE_NAME],q.attributes[x.ATTR_SERVICE_VERSION])}));var BQ=h(FB,eJ),VX=BQ.pipe(DB(qQ));var qq="~@effect/opentelemetry/Tracer/OtelSpan",JQ={internal:X.SpanKind.INTERNAL,client:X.SpanKind.CLIENT,server:X.SpanKind.SERVER,producer:X.SpanKind.PRODUCER,consumer:X.SpanKind.CONSUMER};class Zq{[qq];_tag="Span";name;kind;annotations;links;span;spanId;traceId;attributes=new Map;sampled;parent;status;constructor(q,B,J,Q){this[qq]=qq,this.name=Q.name,this.annotations=Q.annotations,this.links=Q.links,this.kind=Q.kind;let Y=q.active();this.parent=Q.root!==!0?EB(Q.parent,()=>XQ(B,Y,Q.annotations)):Q.parent,this.span=J.startSpan(Q.name,{startTime:_(Q.startTime),links:Q.links.length>0?Q.links.map((w)=>({context:Qq(w.span),attributes:v(w.attributes)})):void 0,kind:JQ[this.kind]},CB(this.parent)?OB(Y,this.parent.value,Q.annotations):X.trace.deleteSpan(Y));let z=this.span.spanContext();this.spanId=z.spanId,this.traceId=z.traceId,this.status={_tag:"Started",startTime:Q.startTime},this.sampled=QQ(z.traceFlags)}attribute(q,B){this.span.setAttribute(q,e(B)),this.attributes.set(q,B)}addLinks(q){this.links.push(...q),this.span.addLinks(q.map((B)=>({context:Qq(B.span),attributes:v(B.attributes)})))}end(q,B){let J=_(q);if(this.status={_tag:"Ended",endTime:q,exit:B,startTime:this.status.startTime},B._tag==="Success")this.span.setStatus({code:X.SpanStatusCode.OK});else if(LB(B.cause))this.span.setStatus({code:X.SpanStatusCode.OK,message:PB(B.cause)}),this.span.setAttribute("span.label","\u26A0\uFE0E Interrupted"),this.span.setAttribute("status.interrupted",!0);else{let Q=jB(B.cause);if(Q.length>0){for(let Y of Q)this.span.recordException(Y,J);this.span.setStatus({code:X.SpanStatusCode.ERROR,message:Q[0].message})}else this.span.setStatus({code:X.SpanStatusCode.OK})}this.span.end(J)}event(q,B,J){this.span.addEvent(q,J?v(J):void 0,_(B))}}var QQ=(q)=>(q&X.TraceFlags.SAMPLED)===X.TraceFlags.SAMPLED,XQ=(q,B,J)=>{let Q=q.getSpan(B)?.spanContext();if(!Q)return HB();return VB(wB({spanId:Q.spanId,traceId:Q.traceId,sampled:(Q.traceFlags&1)===1,annotations:J}))},Qq=(q,B)=>{let J=YQ(q,B),Q=ZQ(q,B);return{spanId:q.spanId,traceId:q.traceId,isRemote:q._tag==="ExternalSpan",traceFlags:J,traceState:Q}},YQ=(q,B)=>{let J;if(d(B)){if(J=yB(q,B,Bq),Xq(J))J=T(q.annotations,Bq)}return J??X.TraceFlags.SAMPLED},ZQ=(q,B)=>{let J;if(d(B)){if(J=yB(q,B,Jq),Xq(J))J=T(q.annotations,Jq)}return J},yB=(q,B,J)=>{let Q=T(B,J);if(d(Q))return Q;return T(q.annotations,J)},OB=(q,B,J)=>B instanceof Zq?X.trace.setSpan(q,B.span):X.trace.setSpanContext(q,Qq(B,J));
|
|
3
|
-
export{QB as
|
|
2
|
+
import{Kq as S,Lq as Vq}from"./chunk-bgng3rdj.js";import{$C as wB,FB as N,FC as XB,HF as f,LB as T,ME as YB,PA as KB,PE as h,SD as LB,UF as MB,VE as DB,WD as jB,XD as PB,_C as NB,bD as FB,cG as ZB,nA as Xq,oA as d,pO as $B,qO as WB,rO as zB,sB as HB,tB as VB,uO as t,vB as CB,xG as AB,yB as EB}from"./chunk-ks1cs80p.js";import{KO as y}from"./chunk-qhnpq5gb.js";import{LO as K,MO as Z,PO as G}from"./chunk-f83wv08n.js";var l=Z(($q)=>{Object.defineProperty($q,"__esModule",{value:!0});$q._clearDefaultServiceNameCache=$q.defaultServiceName=void 0;var D;function hB(){if(D===void 0)try{let q=globalThis.process.argv0;D=q?`unknown_service:${q}`:"unknown_service"}catch{D="unknown_service"}return D}$q.defaultServiceName=hB;function IB(){D=void 0}$q._clearDefaultServiceNameCache=IB});var Kq=Z((zq)=>{Object.defineProperty(zq,"__esModule",{value:!0});zq.isPromiseLike=void 0;var SB=(q)=>{return q!==null&&typeof q==="object"&&typeof q.then==="function"};zq.isPromiseLike=SB});var i=Z((Cq)=>{Object.defineProperty(Cq,"__esModule",{value:!0});Cq.defaultResource=Cq.emptyResource=Cq.resourceFromDetectedResource=Cq.resourceFromAttributes=void 0;var A=y(),c=Vq(),C=S(),kB=l(),M=Kq();class U{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(q,B){let J=new U({},B);return J._rawAttributes=Hq(q),J._asyncAttributesPending=q.filter(([Q,Y])=>(0,M.isPromiseLike)(Y)).length>0,J}constructor(q,B){let J=q.attributes??{};this._rawAttributes=Object.entries(J).map(([Q,Y])=>{if((0,M.isPromiseLike)(Y))this._asyncAttributesPending=!0;return[Q,Y]}),this._rawAttributes=Hq(this._rawAttributes),this._schemaUrl=_B(B?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(!this.asyncAttributesPending)return;for(let q=0;q<this._rawAttributes.length;q++){let[B,J]=this._rawAttributes[q];this._rawAttributes[q]=[B,(0,M.isPromiseLike)(J)?await J:J]}this._asyncAttributesPending=!1}get attributes(){if(this.asyncAttributesPending)A.diag.error("Accessing resource attributes before async attributes settled");if(this._memoizedAttributes)return this._memoizedAttributes;let q={};for(let[B,J]of this._rawAttributes){if((0,M.isPromiseLike)(J)){A.diag.debug(`Unsettled resource attribute ${B} skipped`);continue}if(J!=null)q[B]??=J}if(!this._asyncAttributesPending)this._memoizedAttributes=q;return q}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(q){if(q==null)return this;let B=vB(this,q),J=B?{schemaUrl:B}:void 0;return U.FromAttributeList([...q.getRawAttributes(),...this.getRawAttributes()],J)}}function p(q,B){return U.FromAttributeList(Object.entries(q),B)}Cq.resourceFromAttributes=p;function bB(q,B){return new U(q,B)}Cq.resourceFromDetectedResource=bB;function fB(){return p({})}Cq.emptyResource=fB;function gB(){return p({[C.ATTR_SERVICE_NAME]:(0,kB.defaultServiceName)(),[C.ATTR_TELEMETRY_SDK_LANGUAGE]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_LANGUAGE],[C.ATTR_TELEMETRY_SDK_NAME]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_NAME],[C.ATTR_TELEMETRY_SDK_VERSION]:c.SDK_INFO[C.ATTR_TELEMETRY_SDK_VERSION]})}Cq.defaultResource=gB;function Hq(q){return q.map(([B,J])=>{if((0,M.isPromiseLike)(J))return[B,J.catch((Q)=>{A.diag.debug("promise rejection for resource attribute: %s - %s",B,Q);return})];return[B,J]})}function _B(q){if(typeof q==="string"||q===void 0)return q;A.diag.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",q);return}function vB(q,B){let J=q?.schemaUrl,Q=B?.schemaUrl,Y=J===void 0||J==="",z=Q===void 0||Q==="";if(Y)return Q;if(z)return J;if(J===Q)return J;A.diag.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',J,Q);return}});var Lq=Z((wq)=>{Object.defineProperty(wq,"__esModule",{value:!0});wq.detectResources=void 0;var Nq=y(),n=i(),uB=(q={})=>{return(q.detectors||[]).map((J)=>{try{let Q=(0,n.resourceFromDetectedResource)(J.detect(q));return Nq.diag.debug(`${J.constructor.name} found resource.`,Q),Q}catch(Q){return Nq.diag.debug(`${J.constructor.name} failed: ${Q.message}`),(0,n.emptyResource)()}}).reduce((J,Q)=>J.merge(Q),(0,n.emptyResource)())};wq.detectResources=uB});var Aq=Z((Dq)=>{Object.defineProperty(Dq,"__esModule",{value:!0});Dq.envDetector=void 0;var lB=y(),cB=S(),jq=Vq();class Pq{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(q){let B={},J=(0,jq.getStringFromEnv)("OTEL_RESOURCE_ATTRIBUTES"),Q=(0,jq.getStringFromEnv)("OTEL_SERVICE_NAME");if(J)try{let Y=this._parseResourceAttributes(J);Object.assign(B,Y)}catch(Y){lB.diag.debug(`EnvDetector failed: ${Y instanceof Error?Y.message:Y}`)}if(Q)B[cB.ATTR_SERVICE_NAME]=Q;return{attributes:B}}_parseResourceAttributes(q){if(!q)return{};let B={},J=q.split(this._COMMA_SEPARATOR);for(let Q of J){let Y=Q.split(this._LABEL_KEY_VALUE_SPLITTER);if(Y.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${Q}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[z,w]=Y,F=z.trim(),RB=w.trim();if(F.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${Q}".`);let P,m;try{P=decodeURIComponent(F),m=decodeURIComponent(RB)}catch(u){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${Q}": ${u instanceof Error?u.message:u}`)}if(P.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${P}".`);if(m.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${P}".`);B[P]=m}return B}}Dq.envDetector=new Pq});var O=Z((Uq)=>{Object.defineProperty(Uq,"__esModule",{value:!0});Uq.ATTR_WEBENGINE_VERSION=Uq.ATTR_WEBENGINE_NAME=Uq.ATTR_WEBENGINE_DESCRIPTION=Uq.ATTR_SERVICE_NAMESPACE=Uq.ATTR_SERVICE_INSTANCE_ID=Uq.ATTR_PROCESS_RUNTIME_VERSION=Uq.ATTR_PROCESS_RUNTIME_NAME=Uq.ATTR_PROCESS_RUNTIME_DESCRIPTION=Uq.ATTR_PROCESS_PID=Uq.ATTR_PROCESS_OWNER=Uq.ATTR_PROCESS_EXECUTABLE_PATH=Uq.ATTR_PROCESS_EXECUTABLE_NAME=Uq.ATTR_PROCESS_COMMAND_ARGS=Uq.ATTR_PROCESS_COMMAND=Uq.ATTR_OS_VERSION=Uq.ATTR_OS_TYPE=Uq.ATTR_K8S_POD_NAME=Uq.ATTR_K8S_NAMESPACE_NAME=Uq.ATTR_K8S_DEPLOYMENT_NAME=Uq.ATTR_K8S_CLUSTER_NAME=Uq.ATTR_HOST_TYPE=Uq.ATTR_HOST_NAME=Uq.ATTR_HOST_IMAGE_VERSION=Uq.ATTR_HOST_IMAGE_NAME=Uq.ATTR_HOST_IMAGE_ID=Uq.ATTR_HOST_ID=Uq.ATTR_HOST_ARCH=Uq.ATTR_CONTAINER_NAME=Uq.ATTR_CONTAINER_IMAGE_TAGS=Uq.ATTR_CONTAINER_IMAGE_NAME=Uq.ATTR_CONTAINER_ID=Uq.ATTR_CLOUD_REGION=Uq.ATTR_CLOUD_PROVIDER=Uq.ATTR_CLOUD_AVAILABILITY_ZONE=Uq.ATTR_CLOUD_ACCOUNT_ID=void 0;Uq.ATTR_CLOUD_ACCOUNT_ID="cloud.account.id";Uq.ATTR_CLOUD_AVAILABILITY_ZONE="cloud.availability_zone";Uq.ATTR_CLOUD_PROVIDER="cloud.provider";Uq.ATTR_CLOUD_REGION="cloud.region";Uq.ATTR_CONTAINER_ID="container.id";Uq.ATTR_CONTAINER_IMAGE_NAME="container.image.name";Uq.ATTR_CONTAINER_IMAGE_TAGS="container.image.tags";Uq.ATTR_CONTAINER_NAME="container.name";Uq.ATTR_HOST_ARCH="host.arch";Uq.ATTR_HOST_ID="host.id";Uq.ATTR_HOST_IMAGE_ID="host.image.id";Uq.ATTR_HOST_IMAGE_NAME="host.image.name";Uq.ATTR_HOST_IMAGE_VERSION="host.image.version";Uq.ATTR_HOST_NAME="host.name";Uq.ATTR_HOST_TYPE="host.type";Uq.ATTR_K8S_CLUSTER_NAME="k8s.cluster.name";Uq.ATTR_K8S_DEPLOYMENT_NAME="k8s.deployment.name";Uq.ATTR_K8S_NAMESPACE_NAME="k8s.namespace.name";Uq.ATTR_K8S_POD_NAME="k8s.pod.name";Uq.ATTR_OS_TYPE="os.type";Uq.ATTR_OS_VERSION="os.version";Uq.ATTR_PROCESS_COMMAND="process.command";Uq.ATTR_PROCESS_COMMAND_ARGS="process.command_args";Uq.ATTR_PROCESS_EXECUTABLE_NAME="process.executable.name";Uq.ATTR_PROCESS_EXECUTABLE_PATH="process.executable.path";Uq.ATTR_PROCESS_OWNER="process.owner";Uq.ATTR_PROCESS_PID="process.pid";Uq.ATTR_PROCESS_RUNTIME_DESCRIPTION="process.runtime.description";Uq.ATTR_PROCESS_RUNTIME_NAME="process.runtime.name";Uq.ATTR_PROCESS_RUNTIME_VERSION="process.runtime.version";Uq.ATTR_SERVICE_INSTANCE_ID="service.instance.id";Uq.ATTR_SERVICE_NAMESPACE="service.namespace";Uq.ATTR_WEBENGINE_DESCRIPTION="webengine.description";Uq.ATTR_WEBENGINE_NAME="webengine.name";Uq.ATTR_WEBENGINE_VERSION="webengine.version"});var hq=Z((Oq)=>{Object.defineProperty(Oq,"__esModule",{value:!0});Oq.getMachineId=void 0;var UJ=G("process"),E;async function yJ(){if(!E)switch(UJ.platform){case"darwin":E=(await import("./chunk-bcx2vkv4.js").then((m)=>K(m.default))).getMachineId;break;case"linux":E=(await import("./chunk-pp9neaaz.js").then((m)=>K(m.default))).getMachineId;break;case"freebsd":E=(await import("./chunk-ve3np791.js").then((m)=>K(m.default))).getMachineId;break;case"win32":E=(await import("./chunk-4v61ysex.js").then((m)=>K(m.default))).getMachineId;break;default:E=(await import("./chunk-7ntw4rrn.js").then((m)=>K(m.default))).getMachineId;break}return E()}Oq.getMachineId=yJ});var a=Z((Iq)=>{Object.defineProperty(Iq,"__esModule",{value:!0});Iq.normalizeType=Iq.normalizeArch=void 0;var OJ=(q)=>{switch(q){case"arm":return"arm32";case"ppc":return"ppc32";case"x64":return"amd64";default:return q}};Iq.normalizeArch=OJ;var RJ=(q)=>{switch(q){case"sunos":return"solaris";case"win32":return"windows";default:return q}};Iq.normalizeType=RJ});var gq=Z((bq)=>{Object.defineProperty(bq,"__esModule",{value:!0});bq.hostDetector=void 0;var r=O(),Sq=G("os"),IJ=hq(),TJ=a();class kq{detect(q){return{attributes:{[r.ATTR_HOST_NAME]:(0,Sq.hostname)(),[r.ATTR_HOST_ARCH]:(0,TJ.normalizeArch)((0,Sq.arch)()),[r.ATTR_HOST_ID]:(0,IJ.getMachineId)()}}}}bq.hostDetector=new kq});var uq=Z((xq)=>{Object.defineProperty(xq,"__esModule",{value:!0});xq.osDetector=void 0;var _q=O(),vq=G("os"),SJ=a();class dq{detect(q){return{attributes:{[_q.ATTR_OS_TYPE]:(0,SJ.normalizeType)((0,vq.platform)()),[_q.ATTR_OS_VERSION]:(0,vq.release)()}}}}xq.osDetector=new dq});var iq=Z((cq)=>{Object.defineProperty(cq,"__esModule",{value:!0});cq.processDetector=void 0;var kJ=y(),H=O(),bJ=G("os");class lq{detect(q){let B={[H.ATTR_PROCESS_PID]:process.pid,[H.ATTR_PROCESS_EXECUTABLE_NAME]:process.title,[H.ATTR_PROCESS_EXECUTABLE_PATH]:process.execPath,[H.ATTR_PROCESS_COMMAND_ARGS]:[process.argv[0],...process.execArgv,...process.argv.slice(1)],[H.ATTR_PROCESS_RUNTIME_VERSION]:process.versions.node,[H.ATTR_PROCESS_RUNTIME_NAME]:"nodejs",[H.ATTR_PROCESS_RUNTIME_DESCRIPTION]:"Node.js"};if(process.argv.length>1)B[H.ATTR_PROCESS_COMMAND]=process.argv[1];try{let J=bJ.userInfo();B[H.ATTR_PROCESS_OWNER]=J.username}catch(J){kJ.diag.debug(`error obtaining process owner: ${J}`)}return{attributes:B}}}cq.processDetector=new lq});var sq=Z((aq)=>{Object.defineProperty(aq,"__esModule",{value:!0});aq.serviceInstanceIdDetector=void 0;var fJ=O(),gJ=G("crypto");class nq{detect(q){return{attributes:{[fJ.ATTR_SERVICE_INSTANCE_ID]:(0,gJ.randomUUID)()}}}}aq.serviceInstanceIdDetector=new nq});var oq=Z((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.serviceInstanceIdDetector=L.processDetector=L.osDetector=L.hostDetector=void 0;var _J=gq();Object.defineProperty(L,"hostDetector",{enumerable:!0,get:function(){return _J.hostDetector}});var vJ=uq();Object.defineProperty(L,"osDetector",{enumerable:!0,get:function(){return vJ.osDetector}});var dJ=iq();Object.defineProperty(L,"processDetector",{enumerable:!0,get:function(){return dJ.processDetector}});var xJ=sq();Object.defineProperty(L,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return xJ.serviceInstanceIdDetector}})});var tq=Z((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.serviceInstanceIdDetector=j.processDetector=j.osDetector=j.hostDetector=void 0;var k=oq();Object.defineProperty(j,"hostDetector",{enumerable:!0,get:function(){return k.hostDetector}});Object.defineProperty(j,"osDetector",{enumerable:!0,get:function(){return k.osDetector}});Object.defineProperty(j,"processDetector",{enumerable:!0,get:function(){return k.processDetector}});Object.defineProperty(j,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return k.serviceInstanceIdDetector}})});var BB=Z((eq)=>{Object.defineProperty(eq,"__esModule",{value:!0});eq.noopDetector=eq.NoopDetector=void 0;class s{detect(){return{attributes:{}}}}eq.NoopDetector=s;eq.noopDetector=new s});var JB=Z((V)=>{Object.defineProperty(V,"__esModule",{value:!0});V.noopDetector=V.serviceInstanceIdDetector=V.processDetector=V.osDetector=V.hostDetector=V.envDetector=void 0;var cJ=Aq();Object.defineProperty(V,"envDetector",{enumerable:!0,get:function(){return cJ.envDetector}});var b=tq();Object.defineProperty(V,"hostDetector",{enumerable:!0,get:function(){return b.hostDetector}});Object.defineProperty(V,"osDetector",{enumerable:!0,get:function(){return b.osDetector}});Object.defineProperty(V,"processDetector",{enumerable:!0,get:function(){return b.processDetector}});Object.defineProperty(V,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return b.serviceInstanceIdDetector}});var pJ=BB();Object.defineProperty(V,"noopDetector",{enumerable:!0,get:function(){return pJ.noopDetector}})});var QB=Z((W)=>{Object.defineProperty(W,"__esModule",{value:!0});W.defaultServiceName=W.emptyResource=W.defaultResource=W.resourceFromAttributes=W.serviceInstanceIdDetector=W.processDetector=W.osDetector=W.hostDetector=W.envDetector=W.detectResources=void 0;var nJ=Lq();Object.defineProperty(W,"detectResources",{enumerable:!0,get:function(){return nJ.detectResources}});var R=JB();Object.defineProperty(W,"envDetector",{enumerable:!0,get:function(){return R.envDetector}});Object.defineProperty(W,"hostDetector",{enumerable:!0,get:function(){return R.hostDetector}});Object.defineProperty(W,"osDetector",{enumerable:!0,get:function(){return R.osDetector}});Object.defineProperty(W,"processDetector",{enumerable:!0,get:function(){return R.processDetector}});Object.defineProperty(W,"serviceInstanceIdDetector",{enumerable:!0,get:function(){return R.serviceInstanceIdDetector}});var o=i();Object.defineProperty(W,"resourceFromAttributes",{enumerable:!0,get:function(){return o.resourceFromAttributes}});Object.defineProperty(W,"defaultResource",{enumerable:!0,get:function(){return o.defaultResource}});Object.defineProperty(W,"emptyResource",{enumerable:!0,get:function(){return o.emptyResource}});var aJ=l();Object.defineProperty(W,"defaultServiceName",{enumerable:!0,get:function(){return aJ.defaultServiceName}})});var g=K(QB(),1),$=K(S(),1);class I extends N()("@effect/opentelemetry/Resource"){}var iQ=(q)=>{let B={...q.attributes??void 0,[$.ATTR_SERVICE_NAME]:q.serviceName,[$.ATTR_TELEMETRY_SDK_NAME]:"@effect/opentelemetry",[$.ATTR_TELEMETRY_SDK_LANGUAGE]:typeof globalThis.document>"u"?$.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS:$.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS};if(q.serviceVersion)B[$.ATTR_SERVICE_VERSION]=q.serviceVersion;return B},nQ=(q)=>h(I,f(function*(){let B=yield*zB(t("OTEL_SERVICE_NAME")),J=yield*t("OTEL_RESOURCE_ATTRIBUTES").pipe(WB(""),$B((Q)=>{let Y=Q.split(",");return XB(Y,{},(z,w)=>{let F=w.split("=");if(F.length!==2)return z;return z[F[0].trim()]=F[1].trim(),z})}));if(B._tag==="Some")J[$.ATTR_SERVICE_NAME]=B.value;if(q)Object.assign(J,q);return g.resourceFromAttributes(J)}).pipe(ZB)),aQ=YB(I,g.emptyResource());var X=K(y(),1),x=K(S(),1);var GB=BigInt(1e9),_=(q)=>{return[Number(q/GB),Number(q%GB)]},v=(q)=>{let B={};for(let[J,Q]of Object.entries(q))B[J]=e(Q);return B},e=(q)=>{if(typeof q==="string"||typeof q==="number"||typeof q==="boolean")return q;else if(typeof q==="bigint")return q.toString();return KB(q)};class Yq extends N()("@effect/opentelemetry/Tracer"){}class UB extends N()("@effect/opentelemetry/Tracer/OtelTracerProvider"){}class Bq extends N()("@effect/opentelemetry/Tracer/OtelTraceFlags"){}class Jq extends N()("@effect/opentelemetry/Tracer/OtelTraceState"){}var eJ=MB(AB(Yq),(q)=>NB({span(B){return new Zq(X.context,X.trace,q,B)},context(B,J){let Q=J.currentSpan;if(Q===void 0)return B["~effect/Effect/evaluate"](J);return X.context.with(OB(X.context.active(),Q),()=>B["~effect/Effect/evaluate"](J))}}));var qQ=h(Yq,f(function*(){let q=yield*I;return(yield*UB).getTracer(q.attributes[x.ATTR_SERVICE_NAME],q.attributes[x.ATTR_SERVICE_VERSION])}));var BQ=h(FB,eJ),VX=BQ.pipe(DB(qQ));var qq="~@effect/opentelemetry/Tracer/OtelSpan",JQ={internal:X.SpanKind.INTERNAL,client:X.SpanKind.CLIENT,server:X.SpanKind.SERVER,producer:X.SpanKind.PRODUCER,consumer:X.SpanKind.CONSUMER};class Zq{[qq];_tag="Span";name;kind;annotations;links;span;spanId;traceId;attributes=new Map;sampled;parent;status;constructor(q,B,J,Q){this[qq]=qq,this.name=Q.name,this.annotations=Q.annotations,this.links=Q.links,this.kind=Q.kind;let Y=q.active();this.parent=Q.root!==!0?EB(Q.parent,()=>XQ(B,Y,Q.annotations)):Q.parent,this.span=J.startSpan(Q.name,{startTime:_(Q.startTime),links:Q.links.length>0?Q.links.map((w)=>({context:Qq(w.span),attributes:v(w.attributes)})):void 0,kind:JQ[this.kind]},CB(this.parent)?OB(Y,this.parent.value,Q.annotations):X.trace.deleteSpan(Y));let z=this.span.spanContext();this.spanId=z.spanId,this.traceId=z.traceId,this.status={_tag:"Started",startTime:Q.startTime},this.sampled=QQ(z.traceFlags)}attribute(q,B){this.span.setAttribute(q,e(B)),this.attributes.set(q,B)}addLinks(q){this.links.push(...q),this.span.addLinks(q.map((B)=>({context:Qq(B.span),attributes:v(B.attributes)})))}end(q,B){let J=_(q);if(this.status={_tag:"Ended",endTime:q,exit:B,startTime:this.status.startTime},B._tag==="Success")this.span.setStatus({code:X.SpanStatusCode.OK});else if(LB(B.cause))this.span.setStatus({code:X.SpanStatusCode.OK,message:PB(B.cause)}),this.span.setAttribute("span.label","\u26A0\uFE0E Interrupted"),this.span.setAttribute("status.interrupted",!0);else{let Q=jB(B.cause);if(Q.length>0){for(let Y of Q)this.span.recordException(Y,J);this.span.setStatus({code:X.SpanStatusCode.ERROR,message:Q[0].message})}else this.span.setStatus({code:X.SpanStatusCode.OK})}this.span.end(J)}event(q,B,J){this.span.addEvent(q,J?v(J):void 0,_(B))}}var QQ=(q)=>(q&X.TraceFlags.SAMPLED)===X.TraceFlags.SAMPLED,XQ=(q,B,J)=>{let Q=q.getSpan(B)?.spanContext();if(!Q)return HB();return VB(wB({spanId:Q.spanId,traceId:Q.traceId,sampled:(Q.traceFlags&1)===1,annotations:J}))},Qq=(q,B)=>{let J=YQ(q,B),Q=ZQ(q,B);return{spanId:q.spanId,traceId:q.traceId,isRemote:q._tag==="ExternalSpan",traceFlags:J,traceState:Q}},YQ=(q,B)=>{let J;if(d(B)){if(J=yB(q,B,Bq),Xq(J))J=T(q.annotations,Bq)}return J??X.TraceFlags.SAMPLED},ZQ=(q,B)=>{let J;if(d(B)){if(J=yB(q,B,Jq),Xq(J))J=T(q.annotations,Jq)}return J},yB=(q,B,J)=>{let Q=T(B,J);if(d(Q))return Q;return T(q.annotations,J)},OB=(q,B,J)=>B instanceof Zq?X.trace.setSpan(q,B.span):X.trace.setSpanContext(q,Qq(B,J));
|
|
3
|
+
export{QB as Aq,_ as Bq,e as Cq,I as Dq,iQ as Eq,nQ as Fq,aQ as Gq,Yq as Hq,UB as Iq,VX as Jq};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{lg as a,mg as b,ng as c}from"./chunk-knh01n2r.js";import"./chunk-kc1xmcc9.js";import"./chunk-jjjs8p0t.js";import"./chunk-xnhvt98g.js";import"./chunk-hpa7e9va.js";import"./chunk-y287zwkr.js";import"./chunk-qeg0jnxq.js";import"./chunk-9eg2ytjd.js";import"./chunk-rk2bk4s7.js";import"./chunk-e586sjb0.js";import"./chunk-b50t4jc5.js";import"./chunk-zdzxsyxs.js";import"./chunk-xny5ecn0.js";import"./chunk-7myg8076.js";import"./chunk-my3cswnp.js";import"./chunk-4mvg7jt1.js";import"./chunk-cqtkxwd8.js";import"./chunk-wf4x5cjc.js";import"./chunk-mswx4k75.js";import"./chunk-vqpfpmha.js";import"./chunk-vm1ek7yf.js";import"./chunk-fd7fmvyw.js";import"./chunk-qkh8697x.js";import"./chunk-qg9bt0kx.js";import"./chunk-pfkm3j8g.js";import"./chunk-hmznf0ax.js";import"./chunk-qf1dqzra.js";import"./chunk-03mbn7nj.js";import"./chunk-gr4bctqj.js";import"./chunk-732yr6qq.js";import"./chunk-73fz0cf4.js";import"./chunk-9nn4jpb7.js";import"./chunk-sh76e256.js";import"./chunk-0z1cxvk1.js";import"./chunk-x3afqfww.js";import"./chunk-cbmwhvxw.js";import"./chunk-9etpppyv.js";import"./chunk-9ea1n338.js";import"./chunk-ngvp6zc2.js";import"./chunk-1p6jjrea.js";import"./chunk-ks1cs80p.js";import"./chunk-qhnpq5gb.js";import"./chunk-f83wv08n.js";export{b as run,a as encodeDir,c as ClaudeImport};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{MO as N,PO as k}from"./chunk-f83wv08n.js";var I=N((Aq,y)=>{var J=1000,U=J*60,M=U*60,Z=M*24,r=Z*7,m=Z*365.25;y.exports=function(q,w){w=w||{};var _=typeof q;if(_==="string"&&q.length>0)return t(q);else if(_==="number"&&isFinite(q))return w.long?a(q):s(q);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(q))};function t(q){if(q=String(q),q.length>100)return;var w=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(q);if(!w)return;var _=parseFloat(w[1]),F=(w[2]||"ms").toLowerCase();switch(F){case"years":case"year":case"yrs":case"yr":case"y":return _*m;case"weeks":case"week":case"w":return _*r;case"days":case"day":case"d":return _*Z;case"hours":case"hour":case"hrs":case"hr":case"h":return _*M;case"minutes":case"minute":case"mins":case"min":case"m":return _*U;case"seconds":case"second":case"secs":case"sec":case"s":return _*J;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return _;default:return}}function s(q){var w=Math.abs(q);if(w>=Z)return Math.round(q/Z)+"d";if(w>=M)return Math.round(q/M)+"h";if(w>=U)return Math.round(q/U)+"m";if(w>=J)return Math.round(q/J)+"s";return q+"ms"}function a(q){var w=Math.abs(q);if(w>=Z)return S(q,w,Z,"day");if(w>=M)return S(q,w,M,"hour");if(w>=U)return S(q,w,U,"minute");if(w>=J)return S(q,w,J,"second");return q+" ms"}function S(q,w,_,F){var R=w>=_*1.5;return Math.round(q/_)+" "+F+(R?"s":"")}});var C=N((fq,x)=>{function e(q){_.debug=_,_.default=_,_.coerce=p,_.disable=b,_.enable=R,_.enabled=u,_.humanize=I(),_.destroy=g,Object.keys(q).forEach((B)=>{_[B]=q[B]}),_.names=[],_.skips=[],_.formatters={};function w(B){let E=0;for(let G=0;G<B.length;G++)E=(E<<5)-E+B.charCodeAt(G),E|=0;return _.colors[Math.abs(E)%_.colors.length]}_.selectColor=w;function _(B){let E,G=null,H,z;function K(...Q){if(!K.enabled)return;let Y=K,W=Number(new Date),n=W-(E||W);if(Y.diff=n,Y.prev=E,Y.curr=W,E=W,Q[0]=_.coerce(Q[0]),typeof Q[0]!=="string")Q.unshift("%O");let L=0;Q[0]=Q[0].replace(/%([a-zA-Z%])/g,(T,c)=>{if(T==="%%")return"%";L++;let f=_.formatters[c];if(typeof f==="function"){let l=Q[L];T=f.call(Y,l),Q.splice(L,1),L--}return T}),_.formatArgs.call(Y,Q),(Y.log||_.log).apply(Y,Q)}if(K.namespace=B,K.useColors=_.useColors(),K.color=_.selectColor(B),K.extend=F,K.destroy=_.destroy,Object.defineProperty(K,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(G!==null)return G;if(H!==_.namespaces)H=_.namespaces,z=_.enabled(B);return z},set:(Q)=>{G=Q}}),typeof _.init==="function")_.init(K);return K}function F(B,E){let G=_(this.namespace+(typeof E>"u"?":":E)+B);return G.log=this.log,G}function R(B){_.save(B),_.namespaces=B,_.names=[],_.skips=[];let E=(typeof B==="string"?B:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let G of E)if(G[0]==="-")_.skips.push(G.slice(1));else _.names.push(G)}function V(B,E){let G=0,H=0,z=-1,K=0;while(G<B.length)if(H<E.length&&(E[H]===B[G]||E[H]==="*"))if(E[H]==="*")z=H,K=G,H++;else G++,H++;else if(z!==-1)H=z+1,K++,G=K;else return!1;while(H<E.length&&E[H]==="*")H++;return H===E.length}function b(){let B=[..._.names,..._.skips.map((E)=>"-"+E)].join(",");return _.enable(""),B}function u(B){for(let E of _.skips)if(V(B,E))return!1;for(let E of _.names)if(V(B,E))return!0;return!1}function p(B){if(B instanceof Error)return B.stack||B.message;return B}function g(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return _.enable(_.load()),_}x.exports=e});var h=N((D,j)=>{D.formatArgs=_q;D.save=wq;D.load=Bq;D.useColors=qq;D.storage=Eq();D.destroy=(()=>{let q=!1;return()=>{if(!q)q=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();D.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function qq(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let q;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(q=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(q[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function _q(q){if(q[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+q[0]+(this.useColors?"%c ":" ")+"+"+j.exports.humanize(this.diff),!this.useColors)return;let w="color: "+this.color;q.splice(1,0,w,"color: inherit");let _=0,F=0;q[0].replace(/%[a-zA-Z%]/g,(R)=>{if(R==="%%")return;if(_++,R==="%c")F=_}),q.splice(F,0,w)}D.log=console.debug||console.log||(()=>{});function wq(q){try{if(q)D.storage.setItem("debug",q);else D.storage.removeItem("debug")}catch(w){}}function Bq(){let q;try{q=D.storage.getItem("debug")||D.storage.getItem("DEBUG")}catch(w){}if(!q&&typeof process<"u"&&"env"in process)q=process.env.DEBUG;return q}function Eq(){try{return localStorage}catch(q){}}j.exports=C()(D);var{formatters:Fq}=j.exports;Fq.j=function(q){try{return JSON.stringify(q)}catch(w){return"[UnexpectedJSONParseError]: "+w.message}}});var d=N((i,O)=>{var Zq=k("tty"),X=k("util");i.init=Pq;i.log=Uq;i.formatArgs=zq;i.save=Mq;i.load=Nq;i.useColors=$q;i.destroy=X.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");i.colors=[6,2,3,4,5,1];try{let q=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(q&&(q.stderr||q).level>=2)i.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(q){}i.inspectOpts=Object.keys(process.env).filter((q)=>{return/^debug_/i.test(q)}).reduce((q,w)=>{let _=w.substring(6).toLowerCase().replace(/_([a-z])/g,(R,V)=>{return V.toUpperCase()}),F=process.env[w];if(/^(yes|on|true|enabled)$/i.test(F))F=!0;else if(/^(no|off|false|disabled)$/i.test(F))F=!1;else if(F==="null")F=null;else F=Number(F);return q[_]=F,q},{});function $q(){return"colors"in i.inspectOpts?Boolean(i.inspectOpts.colors):Zq.isatty(process.stderr.fd)}function zq(q){let{namespace:w,useColors:_}=this;if(_){let F=this.color,R="\x1B[3"+(F<8?F:"8;5;"+F),V=` ${R};1m${w} \x1B[0m`;q[0]=V+q[0].split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
`+V),q.push(R+"m+"+O.exports.humanize(this.diff)+"\x1B[0m")}else q[0]=Jq()+w+" "+q[0]}function Jq(){if(i.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function Uq(...q){return process.stderr.write(X.formatWithOptions(i.inspectOpts,...q)+`
|
|
5
5
|
`)}function Mq(q){if(q)process.env.DEBUG=q;else delete process.env.DEBUG}function Nq(){return process.env.DEBUG}function Pq(q){q.inspectOpts={};let w=Object.keys(i.inspectOpts);for(let _=0;_<w.length;_++)q.inspectOpts[w[_]]=i.inspectOpts[w[_]]}O.exports=C()(i);var{formatters:v}=O.exports;v.o=function(q){return this.inspectOpts.colors=this.useColors,X.inspect(q,this.inspectOpts).split(`
|
|
6
6
|
`).map((w)=>w.trim()).join(" ")};v.O=function(q){return this.inspectOpts.colors=this.useColors,X.inspect(q,this.inspectOpts)}});var Cq=N((xq,A)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)A.exports=h();else A.exports=d()});
|
|
7
|
-
export{Cq as
|
|
7
|
+
export{Cq as Hf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Fd as n,Id as p,Jd as e,Kd as i,Nd as m,Od as c}from"./chunk-p9mj4zyk.js";import{EB as s,xH as o}from"./chunk-ks1cs80p.js";var u=(t)=>o.sync(()=>e(t)),g=(t)=>o.sync(()=>i(t)),y={info:(t)=>o.sync(()=>p.info(t))},x=(t)=>o.tryPromise(()=>c(t)).pipe(o.map((r)=>{if(n(r))return s.none();return s.some(r)})),V=()=>{let t=m();return{start:(r)=>o.sync(()=>t.start(r)),stop:(r,a)=>o.sync(()=>t.stop(r,a))}};
|
|
3
3
|
export{u as i,g as j,y as k,x as l,V as m};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{De as F}from"./chunk-vqss3e48.js";import{Pe as z,Se as B,hf as D}from"./chunk-6j339s7a.js";import{hq as x}from"./chunk-4mvg7jt1.js";import"./chunk-cqtkxwd8.js";import"./chunk-wf4x5cjc.js";import{au as q}from"./chunk-9ea1n338.js";import"./chunk-ngvp6zc2.js";import"./chunk-f83wv08n.js";var N="2.0.41",P=q.object({message:q.string(),type:q.string(),param:q.string(),code:q.string()}),Q={errorSchema:P,errorToMessage:(k)=>k.message};function T(k={}){var y;let G=D((y=k.baseURL)!=null?y:"https://api.cerebras.ai/v1"),J=()=>z({Authorization:`Bearer ${B({apiKey:k.apiKey,environmentVariableName:"CEREBRAS_API_KEY",description:"Cerebras API key"})}`,...k.headers},`ai-sdk/cerebras/${N}`),w=(j)=>{return new F(j,{provider:"cerebras.chat",url:({path:K})=>`${G}${K}`,headers:J,fetch:k.fetch,errorStructure:Q,supportsStructuredOutputs:!0})},f=(j)=>w(j);return f.specificationVersion="v3",f.languageModel=w,f.chat=w,f.embeddingModel=(j)=>{throw new x({modelId:j,modelType:"embeddingModel"})},f.textEmbeddingModel=f.embeddingModel,f.imageModel=(j)=>{throw new x({modelId:j,modelType:"imageModel"})},f}var Z=T();export{T as createCerebras,Z as cerebras,N as VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Aq as QG,Bq as SG,Jq as $G,Oq as OG,Pq as XG,Sq as fG,Wq as v,Zq as k,_q as s,br as CG,er as p,fr as u,kr as _,mr as yG,nr as YG,or as d,pr as IG,qr as RG,sr as xG,tq as g,vq as FG,xq as NG,zq as wG}from"./chunk-gwfx7tx7.js";import{Er as BG,Hr as c,ur as l,vr as GG}from"./chunk-1wpjmwnh.js";import"./chunk-cqtkxwd8.js";import"./chunk-ymtcm4xd.js";import{xv as G}from"./chunk-tdmn21z0.js";import"./chunk-s8mghr5a.js";import"./chunk-4sazy0nq.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{Cp as k,Dp as s,Gp as CG,Jp as p,Kp as u,Pp as _,Rp as yG,Sp as YG,Tp as d,Up as IG,Vp as RG,Xp as xG,Yo as g,_o as FG,ap as NG,cp as wG,dp as QG,ep as SG,mp as $G,rp as OG,sp as XG,vp as fG,zp as v}from"./chunk-my3cswnp.js";import{Zp as l,_p as GG,hq as BG,kq as c}from"./chunk-4mvg7jt1.js";import"./chunk-cqtkxwd8.js";import"./chunk-wf4x5cjc.js";import{au as G}from"./chunk-9ea1n338.js";import"./chunk-ngvp6zc2.js";import"./chunk-f83wv08n.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};
|