@qitqode/qitqode-android-arm64 0.2.0 → 0.2.2
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/bun +0 -0
- package/bundle/{chunk-cx7p4ezk.js → chunk-03mbn7nj.js} +2 -2
- package/bundle/{chunk-rrd0jf5m.js → chunk-07s30fpb.js} +1 -1
- package/bundle/{chunk-yacccwf6.js → chunk-087tnr8a.js} +1 -1
- package/bundle/chunk-0cdtq1r3.js +2 -0
- package/bundle/{chunk-kx2dp8ch.js → chunk-0f3ft9dh.js} +1 -1
- package/bundle/{chunk-rgxy4ngt.js → chunk-0gab4v98.js} +1 -1
- package/bundle/chunk-0ych0f5w.js +2 -0
- package/bundle/{chunk-w8d9srv7.js → chunk-0yjdatm6.js} +2 -2
- package/bundle/chunk-0ykeedfm.js +2 -0
- 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-2517cev8.js +2 -0
- package/bundle/chunk-28g1ndpx.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-fyz7fngd.js → chunk-2faah8w1.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-d9x9kqvy.js → chunk-3888asr7.js} +1 -1
- package/bundle/chunk-3c3xzz0g.js +3 -0
- package/bundle/{chunk-zfcfyagt.js → chunk-3h49k2ck.js} +1 -1
- package/bundle/{chunk-r0g5yyhf.js → chunk-3jms025t.js} +1 -1
- package/bundle/{chunk-52b1v7mn.js → chunk-3qfpw8f6.js} +1 -1
- package/bundle/{chunk-v3x5nrc4.js → chunk-3tmq81kq.js} +2 -2
- package/bundle/{chunk-neqy8j4n.js → chunk-42r7z6sq.js} +1 -1
- package/bundle/chunk-42wdfks8.js +2 -0
- package/bundle/{chunk-kp8nkm3m.js → chunk-44y6dffe.js} +1 -1
- package/bundle/{chunk-j5kyf7vt.js → chunk-45fyv9f1.js} +2 -2
- 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-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-qq2rcxv2.js → chunk-543pt030.js} +2 -2
- package/bundle/{chunk-rexdr63q.js → chunk-5az84brc.js} +2 -2
- package/bundle/{chunk-pnpre7ys.js → chunk-5js6a6gf.js} +1 -1
- 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-n0trgp1c.js → chunk-6dfjtzqb.js} +2 -2
- package/bundle/{chunk-dz3s882k.js → chunk-6f8qqbac.js} +189 -189
- 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-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-s2xdf6qh.js → chunk-7ab3yw9j.js} +2 -2
- package/bundle/{chunk-8tp4whyw.js → chunk-7my2231h.js} +1 -1
- 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-7q003wdd.js +4 -0
- package/bundle/chunk-7x88b2n2.js +2 -0
- package/bundle/{chunk-6r8pg6ma.js → chunk-7z884mz2.js} +1 -1
- package/bundle/{chunk-17pxm5d3.js → chunk-7zc04q43.js} +2 -2
- package/bundle/{chunk-v7q3d3n6.js → chunk-85xh72hk.js} +2 -2
- package/bundle/{chunk-jgz1a29w.js → chunk-86jsqc7d.js} +3 -3
- package/bundle/{chunk-zbqzm65q.js → chunk-86yk21g4.js} +1 -1
- package/bundle/{chunk-aj3y2e86.js → chunk-8apeexas.js} +1 -1
- package/bundle/{chunk-xjhezxft.js → chunk-8d6e4jg7.js} +3 -3
- 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-qyjt0qnq.js → chunk-8v6x712g.js} +2 -2
- package/bundle/chunk-8wdara3b.js +2 -0
- package/bundle/chunk-8xhzpnph.js +2 -0
- package/bundle/{chunk-z0tfsdb9.js → chunk-91z7azf7.js} +1 -1
- package/bundle/{chunk-kqhh2pm9.js → chunk-94qhpkfx.js} +1 -1
- package/bundle/{chunk-g8cfzzrs.js → chunk-96sqbyvf.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-nhwhkx62.js → chunk-9bm9z52r.js} +1 -1
- package/bundle/{chunk-tdmn21z0.js → chunk-9ea1n338.js} +2 -2
- 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-9pnpmtb2.js +2 -0
- package/bundle/{chunk-pxx2hz0g.js → chunk-9rxyq6f9.js} +2 -2
- package/bundle/chunk-9s785py4.js +28 -0
- package/bundle/{chunk-9fkmhmh6.js → chunk-9y15zjxa.js} +1 -1
- package/bundle/{chunk-mdzzcrf9.js → chunk-a2dz9nqh.js} +2 -2
- package/bundle/{chunk-rtdym35y.js → chunk-a550vst5.js} +149 -141
- package/bundle/{chunk-46ztrjw0.js → chunk-a5pbvp1f.js} +1 -1
- 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-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-c1bw1q75.js +2 -0
- package/bundle/{chunk-7fawtcnn.js → chunk-c1g8n10t.js} +1 -1
- package/bundle/chunk-c2k556rk.js +2 -0
- package/bundle/chunk-c47vp7ne.js +2 -0
- package/bundle/{chunk-w03fdrxe.js → chunk-cbf1y12x.js} +1 -1
- package/bundle/chunk-cbhgf058.js +2 -0
- 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-ws3p9cya.js → chunk-dbztxdea.js} +2 -2
- package/bundle/chunk-dp7cww4v.js +2 -0
- package/bundle/{chunk-yeq7b87a.js → chunk-drwqag0f.js} +1 -1
- package/bundle/chunk-dy31mchw.js +3 -0
- package/bundle/{chunk-5myxjxae.js → chunk-e374shb8.js} +2 -2
- package/bundle/{chunk-qdcf1ay5.js → chunk-e586sjb0.js} +2 -2
- package/bundle/{chunk-pr1ysgr3.js → chunk-e5rda9mx.js} +1 -1
- package/bundle/{chunk-qs4wef8c.js → chunk-e6wp96vm.js} +1 -1
- package/bundle/chunk-e999xtfj.js +2 -0
- package/bundle/{chunk-n7d9eemn.js → chunk-ehfxypks.js} +216 -218
- package/bundle/{chunk-gnt982jr.js → chunk-epa576pa.js} +3 -3
- package/bundle/{chunk-m0xsvzyd.js → chunk-et5dnymk.js} +2 -2
- package/bundle/chunk-eyr0vf92.js +2 -0
- package/bundle/{chunk-02xcb52z.js → chunk-ezfzb8qc.js} +2 -2
- package/bundle/{chunk-4sazy0nq.js → chunk-f83wv08n.js} +1 -1
- package/bundle/{chunk-3dr4469n.js → chunk-fbm6qczy.js} +1 -1
- package/bundle/{chunk-0g25z230.js → chunk-fd7fmvyw.js} +1 -1
- package/bundle/{chunk-0z33en1a.js → chunk-fgn83bs7.js} +1 -1
- package/bundle/{chunk-dshnn54c.js → chunk-fpm2vgz6.js} +1 -1
- package/bundle/{chunk-px8vtbmr.js → chunk-frsd6e1h.js} +2 -2
- package/bundle/{chunk-w5940jxm.js → chunk-fvy24yhq.js} +1 -1
- package/bundle/{chunk-dt899wbf.js → chunk-g3kd4957.js} +2 -2
- package/bundle/chunk-g7k6ecb2.js +11 -0
- 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-m6zxr0j8.js → chunk-h10wjk96.js} +2 -2
- package/bundle/{chunk-cxtxvt43.js → chunk-h2bmss2m.js} +1 -1
- package/bundle/chunk-h4f582d6.js +2 -0
- package/bundle/chunk-h57c6ne3.js +2 -0
- package/bundle/chunk-hk8vvc10.js +2 -0
- package/bundle/{chunk-x42w8ewc.js → chunk-hnrqhcgq.js} +1 -1
- 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-hy86wfad.js +2 -0
- package/bundle/{chunk-aw8af3ky.js → chunk-j17421hz.js} +1 -1
- 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-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-5kmfnkzv.js → chunk-kdcnder5.js} +1 -1
- package/bundle/chunk-kghwk0yh.js +2 -0
- package/bundle/chunk-kh8de8re.js +2 -0
- package/bundle/{chunk-r6ndvzd0.js → chunk-km1n4ttr.js} +1 -1
- package/bundle/{chunk-tzrbb0e8.js → chunk-kmwy6c9g.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-mce8aa9y.js +2 -0
- package/bundle/chunk-me1ja46g.js +2 -0
- package/bundle/chunk-mgadsp7r.js +2 -0
- package/bundle/{chunk-hb9mc5f9.js → chunk-mpe8zxc0.js} +1 -1
- package/bundle/{chunk-eb8nsk7e.js → chunk-mrn44msr.js} +2 -2
- package/bundle/{chunk-yykjvt7f.js → chunk-mswx4k75.js} +2 -2
- 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-s8mghr5a.js → chunk-ngvp6zc2.js} +2 -2
- package/bundle/{chunk-mcc5ynma.js → chunk-p4ewy9xh.js} +3 -3
- 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-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-q2q3dmg3.js +2 -0
- package/bundle/chunk-q46pzk9z.js +8 -0
- package/bundle/{chunk-4fa390yr.js → chunk-q4fn41ex.js} +2 -2
- package/bundle/{chunk-zrmx397j.js → chunk-q5abwn50.js} +1 -1
- package/bundle/{chunk-7vftsy04.js → chunk-qaz100ht.js} +1 -1
- package/bundle/{chunk-pnq1h5az.js → chunk-qhnpq5gb.js} +2 -2
- package/bundle/chunk-qvzvxsjw.js +2 -0
- package/bundle/{chunk-yzwgvjzd.js → chunk-r0s28gnb.js} +1 -1
- package/bundle/chunk-racrb1b3.js +2 -0
- 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-xhbb8b5g.js → chunk-rp8asmq7.js} +1 -1
- package/bundle/{chunk-z1rshv6g.js → chunk-rpfhgncs.js} +1 -1
- package/bundle/{chunk-gt6tgm42.js → chunk-s0c0t6qr.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-kb6v5hhm.js → chunk-s77qktcn.js} +2 -2
- package/bundle/{chunk-sxy4hyyy.js → chunk-sghy9s7m.js} +1 -1
- package/bundle/{chunk-k7n1csxv.js → chunk-sjreby6e.js} +1 -1
- package/bundle/chunk-skpkjnyy.js +2 -0
- package/bundle/{chunk-8r3410c2.js → chunk-skv9ww0s.js} +1 -1
- package/bundle/chunk-skxhg212.js +2 -0
- package/bundle/chunk-snt4kwab.js +2 -0
- package/bundle/chunk-sq47t8f1.js +2 -0
- package/bundle/chunk-sqhgnvvs.js +2 -0
- package/bundle/{chunk-ztnepaqc.js → chunk-ssdw9zre.js} +1 -1
- package/bundle/chunk-t114r59h.js +2 -0
- package/bundle/{chunk-909fp6pm.js → chunk-t1475j9f.js} +1 -1
- 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-fn8191ps.js → chunk-tczbhj0e.js} +1 -1
- package/bundle/{chunk-h1kg35mn.js → chunk-tge53d52.js} +1 -1
- package/bundle/{chunk-2pzvcpv4.js → chunk-tj3rem3q.js} +2 -2
- 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-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-ceefd2nj.js → chunk-vk88jj60.js} +1 -1
- 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-vrv67tt0.js +2 -0
- package/bundle/chunk-vtw0wwch.js +17 -0
- package/bundle/{chunk-z7vv0ngm.js → chunk-vyh300ac.js} +2 -2
- package/bundle/{chunk-qpzspr9z.js → chunk-w30b563s.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-wcx7hc2p.js +635 -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-wv8qx8sa.js +2 -0
- package/bundle/{chunk-acyj91wq.js → chunk-x2cavpa9.js} +1 -1
- package/bundle/{chunk-qb35hqm4.js → chunk-x4pdpka8.js} +1 -1
- package/bundle/{chunk-vm58fkrv.js → chunk-xd3xc1vv.js} +1 -1
- package/bundle/{chunk-v0yxkq99.js → chunk-xmjntwjc.js} +2 -2
- package/bundle/{chunk-64s7vfj7.js → chunk-xny5ecn0.js} +2 -2
- package/bundle/chunk-xxrtr6sd.js +2 -0
- package/bundle/chunk-y287zwkr.js +10 -0
- package/bundle/{chunk-ypk3t1eh.js → chunk-y2ptjam9.js} +1 -1
- package/bundle/{chunk-ezrskm25.js → chunk-y3dfk6n5.js} +1 -1
- package/bundle/{chunk-t01bhw5h.js → chunk-y4e7e42x.js} +3 -3
- package/bundle/{chunk-98effz12.js → chunk-y6h35v4a.js} +1 -1
- package/bundle/chunk-y72p79v2.js +2 -0
- package/bundle/chunk-y8eggnrr.js +2 -0
- package/bundle/chunk-y9q0f9qz.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-yhsnmpzv.js +2 -0
- package/bundle/{chunk-y1b2h15z.js → chunk-ypcc3cnb.js} +1 -1
- 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-871f8x99.js → chunk-ywdtp534.js} +2 -2
- package/bundle/{chunk-zfnbk5gy.js → chunk-ywkvq7zb.js} +1 -1
- package/bundle/{chunk-p3rp99na.js → chunk-yx1h0b5v.js} +1 -1
- package/bundle/{chunk-mzbr0m2v.js → chunk-yz0pwv2m.js} +1 -1
- package/bundle/{chunk-q81m4m9z.js → chunk-z2h1gxyx.js} +1 -1
- package/bundle/chunk-zcp0wx4j.js +5 -0
- 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/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-kmtfdky8.js +0 -4
- 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-sv1s1qxd.js +0 -619
- 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-twhavv1m.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,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
export{gr as
|
|
2
|
+
import{NO as fr}from"./chunk-f83wv08n.js";var gr="0.2.2",xr="latest",yr="6b5ffd944b657a59173e2994e863cb0fe1d87a7a",hr=!1;var u={done:!1,hasNext:!1};function l(r,...a){let o=r,t=a.map((i)=>("lazy"in i)?v(i):void 0),s=0;for(;s<a.length;){if(t[s]===void 0||!S(o)){let n=a[s];o=n(o),s+=1;continue}let i=[];for(let n=s;n<a.length;n++){let f=t[n];if(f===void 0||(i.push(f),f.isSingle))break}let e=[];for(let n of o)if(j(n,e,i))break;let{isSingle:p}=i.at(-1);o=p?e[0]:e,s+=i.length}return o}function j(r,a,o){if(o.length===0)return a.push(r),!1;let t=r,s=u,i=!1;for(let[e,p]of o.entries()){let{index:n,items:f}=p;if(f.push(t),s=p(t,n,f),p.index+=1,s.hasNext){if(s.hasMany??!1){for(let g of s.next)if(j(g,a,o.slice(e+1)))return!0;return i}t=s.next}if(!s.hasNext)break;s.done&&(i=!0)}return s.hasNext&&a.push(t),i}function v(r){let{lazy:a,lazyArgs:o}=r,t=a(...o);return Object.assign(t,{isSingle:a.single??!1,index:0,items:[]})}function S(r){return typeof r=="string"||typeof r=="object"&&r!==null&&Symbol.iterator in r}function x(r,a){let o=a.length-r.length;if(o===1){let[t,...s]=a;return l(t,{lazy:r,lazyArgs:s})}if(o===0){let t={lazy:r,lazyArgs:a};return Object.assign((s)=>l(s,t),t)}throw Error("Wrong number of arguments")}function B(...r){return x(_,r)}function _(){let r=new Set;return(a)=>r.has(a)?u:(r.add(a),{done:!1,hasNext:!0,next:a})}function N(r,a,o){let t=(s)=>r(s,...a);return o===void 0?t:Object.assign(t,{lazy:o,lazyArgs:a})}function m(r,a,o){let t=r.length-a.length;if(t===0)return r(...a);if(t===1)return N(r,a,o);throw Error("Wrong number of arguments")}function C(...r){return m(Object.values,r)}var D={asc:(r,a)=>r>a,desc:(r,a)=>r<a};function y(r,a){let[o,...t]=a;if(!P(o)){let i=b(...t);return r(o,i)}let s=b(o,...t);return(i)=>r(i,s)}function b(r,a,...o){let t=typeof r=="function"?r:r[0],s=typeof r=="function"?"asc":r[1],{[s]:i}=D,e=a===void 0?void 0:b(a,...o);return(p,n)=>{let f=t(p),g=t(n);return i(f,g)?1:i(g,f)?-1:e?.(p,n)??0}}function P(r){if(Q(r))return!0;if(typeof r!="object"||!Array.isArray(r))return!1;let[a,o,...t]=r;return Q(a)&&typeof o=="string"&&o in D&&t.length===0}var Q=(r)=>typeof r=="function"&&r.length===1;function h(...r){return y(z,r)}var z=(r,a)=>[...r].sort(a);function I(r){if(typeof r!="object"||r===null)return!1;let a=Object.getPrototypeOf(r);return a===null||a===Object.prototype}function A(...r){return m(T,r)}function T(r,a){let o={...r,...a};for(let t in a){if(!(t in r))continue;let{[t]:s}=r;if(!I(s))continue;let{[t]:i}=a;I(i)&&(o[t]=T(s,i))}return o}function L(...r){return m(R,r,W)}var R=(r,a)=>r.map(a),W=(r)=>(a,o,t)=>({done:!1,hasNext:!0,next:r(a,o,t)});function k(...r){return x(M,r)}function M(r){let a=r,o=new Set;return(t,s,i)=>{let e=a(t,s,i);return o.has(e)?u:(o.add(e),{done:!1,hasNext:!0,next:t})}}function w(...r){return m(U,r)}function U(r,a){let o={};for(let[t,s]of Object.entries(r))a(s,t,r)&&(o[t]=s);return o}function c(...r){return m(V,r)}var V=(r,a)=>r.length>=a;function F(...r){return m(q,r)}function q(r,a){if(!c(a,1))return{...r};if(!c(a,2)){let{[a[0]]:t,...s}=r;return s}let o={...r};for(let t of a)delete o[t];return o}function H(...r){return m(K,r)}function K(r,a){let o={};for(let[t,s]of Object.entries(r)){let i=a(s,t,r);o[t]=i}return o}function G(...r){return m(J,r)}var J=(r,a)=>{let o=Object.create(null);for(let t=0;t<r.length;t++){let s=r[t],i=a(s,t,r);if(i!==void 0){let e=o[i];e===void 0?o[i]=[s]:e.push(s)}}return Object.setPrototypeOf(o,Object.prototype),o};function X(...r){return m(d,r)}function d(r,a){if(r===a||Object.is(r,a))return!0;if(typeof r!="object"||typeof a!="object"||r===null||a===null||Object.getPrototypeOf(r)!==Object.getPrototypeOf(a))return!1;if(Array.isArray(r))return Y(r,a);if(r instanceof Map)return Z(r,a);if(r instanceof Set)return $(r,a);if(r instanceof Date)return r.getTime()===a.getTime();if(r instanceof RegExp)return r.toString()===a.toString();if(Object.keys(r).length!==Object.keys(a).length)return!1;for(let[o,t]of Object.entries(r))if(!(o in a)||!d(t,a[o]))return!1;return!0}function Y(r,a){if(r.length!==a.length)return!1;for(let[o,t]of r.entries())if(!d(t,a[o]))return!1;return!0}function Z(r,a){if(r.size!==a.size)return!1;for(let[o,t]of r.entries())if(!a.has(o)||!d(t,a.get(o)))return!1;return!0}function $(r,a){if(r.size!==a.size)return!1;let o=[...a];for(let t of r){let s=!1;for(let[i,e]of o.entries())if(d(t,e)){s=!0,o.splice(i,1);break}if(!s)return!1}return!0}function rr(...r){return y(ar,r)}function ar(r,a){if(!c(r,2))return r[0];let[o]=r,[,...t]=r;for(let s of t)a(s,o)<0&&(o=s);return o}function or(...r){return m(tr,r,sr)}var tr=(r,a)=>r.flatMap(a),sr=(r)=>(a,o,t)=>{let s=r(a,o,t);return Array.isArray(s)?{done:!1,hasNext:!0,hasMany:!0,next:s}:{done:!1,hasNext:!0,next:s}};function ir(...r){return m(Object.entries,r)}function mr(...r){return m(er,r,nr)}var er=(r,a)=>r.filter(a),nr=(r)=>(a,o,t)=>r(a,o,t)?{done:!1,hasNext:!0,next:a}:u;var lr={};fr(lr,{match:()=>O,allStructured:()=>ur,all:()=>pr});function O(r,a){if(r)r=r.replaceAll("\\","/");if(a)a=a.replaceAll("\\","/");let o=a.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");if(o.endsWith(" .*"))o=o.slice(0,-3)+"( .*)?";let t=process.platform==="win32"?"si":"s";return new RegExp("^"+o+"$",t).test(r)}function pr(r,a){let o=l(a,Object.entries,h([([s])=>s.length,"asc"],[([s])=>s,"asc"])),t=void 0;for(let[s,i]of o)if(O(r,s)){t=i;continue}return t}function ur(r,a){let o=l(a,Object.entries,h([([s])=>s.length,"asc"],[([s])=>s,"asc"])),t=void 0;for(let[s,i]of o){let e=s.split(/\s+/);if(!O(r.head,e[0]))continue;if(e.length===1||E(r.tail,e.slice(1))){t=i;continue}}return t}function E(r,a){if(a.length===0)return!0;let[o,...t]=a;if(o==="*")return E(r,t);for(let s=0;s<r.length;s++)if(O(r[s],o)&&E(r.slice(s+1),t))return!0;return!1}var Jm="QITQODE_RUN_ID",Xm="QITQODE_PROCESS_ROLE";function cr(){return process.env.QITQODE_RUN_ID??=crypto.randomUUID()}function dr(r){return process.env.QITQODE_PROCESS_ROLE??=r}function Ym(r){return{runID:cr(),processRole:dr(r)}}function Zm(r){let a=Object.fromEntries(Object.entries(process.env).filter((o)=>o[1]!==void 0));return r?Object.assign(a,r):a}
|
|
3
|
+
export{gr as us,xr as vs,yr as ws,hr as xs,l as ys,B as zs,k as As,C as Bs,h as Cs,w as Ds,A as Es,F as Fs,H as Gs,L as Hs,G as Is,X as Js,rr as Ks,or as Ls,ir as Ms,mr as Ns,O as Os,lr as Ps,Jm as Qs,Xm as Rs,cr as Ss,Ym as Ts,Zm as Us};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Cp as V,Ep as f,Ip as hZ,Kp as R,Pp as l,Qp as U,Rp as B,Sp as fZ,Tp as x,Xp as gZ,Yo as O,cp as u,rp as yZ,sp as y,wp as h,zp as L}from"./chunk-my3cswnp.js";import{_p as v}from"./chunk-4mvg7jt1.js";import{qq as Q0,rq as U0,sq as L0}from"./chunk-mswx4k75.js";import{au as Z}from"./chunk-9ea1n338.js";import{LO as g,MO as c,PO as r}from"./chunk-f83wv08n.js";var m=c((E$,o)=>{var{defineProperty:_,getOwnPropertyDescriptor:aZ,getOwnPropertyNames:oZ}=Object,rZ=Object.prototype.hasOwnProperty,eZ=($,W)=>{for(var Q in W)_($,Q,{get:W[Q],enumerable:!0})},Z0=($,W,Q,X)=>{if(W&&typeof W==="object"||typeof W==="function"){for(let Y of oZ(W))if(!rZ.call($,Y)&&Y!==Q)_($,Y,{get:()=>W[Y],enumerable:!(X=aZ(W,Y))||X.enumerable})}return $},$0=($)=>Z0(_({},"__esModule",{value:!0}),$),t={};eZ(t,{SYMBOL_FOR_REQ_CONTEXT:()=>a,getContext:()=>W0});o.exports=$0(t);var a=Symbol.for("@vercel/request-context");function W0(){return globalThis[a]?.get?.()??{}}});var $Z=c((H$,ZZ)=>{var{defineProperty:i,getOwnPropertyDescriptor:X0,getOwnPropertyNames:Y0}=Object,j0=Object.prototype.hasOwnProperty,D0=($,W)=>{for(var Q in W)i($,Q,{get:W[Q],enumerable:!0})},K0=($,W,Q,X)=>{if(W&&typeof W==="object"||typeof W==="function"){for(let Y of Y0(W))if(!j0.call($,Y)&&Y!==Q)i($,Y,{get:()=>W[Y],enumerable:!(X=X0(W,Y))||X.enumerable})}return $},J0=($)=>K0(i({},"__esModule",{value:!0}),$),e={};D0(e,{getVercelOidcToken:()=>N0,getVercelOidcTokenSync:()=>p});ZZ.exports=J0(e);var A0=m(),F0=Q0();async function N0($){let W="",Q;try{W=p()}catch(X){Q=X}try{let[{getTokenPayload:X,isExpired:Y},{refreshToken:D}]=await Promise.all([await import("./chunk-basjzwqp.js").then((m)=>g(m.default)),await import("./chunk-bbbh69ys.js").then((m)=>g(m.default))]);if(!W||Y(X(W),$?.expirationBufferMs))await D($),W=p()}catch(X){let Y=Q instanceof Error?Q.message:"";if(X instanceof Error)Y=`${Y}
|
|
3
3
|
${X.message}`;if(Y)throw new F0.VercelOidcTokenError(Y);throw X}return W}function p(){let $=(0,A0.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!$)throw Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return $}});var n=c((M$,YZ)=>{var{defineProperty:d,getOwnPropertyDescriptor:V0,getOwnPropertyNames:q0}=Object,T0=Object.prototype.hasOwnProperty,B0=($,W)=>{for(var Q in W)d($,Q,{get:W[Q],enumerable:!0})},G0=($,W,Q,X)=>{if(W&&typeof W==="object"||typeof W==="function"){for(let Y of q0(W))if(!T0.call($,Y)&&Y!==Q)d($,Y,{get:()=>W[Y],enumerable:!(X=V0(W,Y))||X.enumerable})}return $},x0=($)=>G0(d({},"__esModule",{value:!0}),$),XZ={};B0(XZ,{AccessTokenMissingError:()=>QZ.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>QZ.RefreshAccessTokenFailedError,getContext:()=>z0.getContext,getVercelOidcToken:()=>WZ.getVercelOidcToken,getVercelOidcTokenSync:()=>WZ.getVercelOidcTokenSync,getVercelToken:()=>E0.getVercelToken});YZ.exports=x0(XZ);var WZ=$Z(),z0=m(),QZ=U0(),E0=L0()});var sZ=g(n(),1),tZ=g(n(),1);var H0="vercel.ai.gateway.error",s=Symbol.for(H0),jZ,DZ,z=class $ extends(DZ=Error,jZ=s,DZ){constructor({message:W,statusCode:Q=500,cause:X,generationId:Y}){super(Y?`${W} [${Y}]`:W);this[jZ]=!0,this.statusCode=Q,this.cause=X,this.generationId=Y}static isInstance(W){return $.hasMarker(W)}static hasMarker(W){return typeof W==="object"&&W!==null&&s in W&&W[s]===!0}},uZ="GatewayAuthenticationError",M0=`vercel.ai.gateway.error.${uZ}`,KZ=Symbol.for(M0),JZ,AZ,lZ=class $ extends(AZ=z,JZ=KZ,AZ){constructor({message:W="Authentication failed",statusCode:Q=401,cause:X,generationId:Y}={}){super({message:W,statusCode:Q,cause:X,generationId:Y});this[JZ]=!0,this.name=uZ,this.type="authentication_error"}static isInstance(W){return z.hasMarker(W)&&KZ in W}static createContextualError({apiKeyProvided:W,oidcTokenProvided:Q,message:X="Authentication failed",statusCode:Y=401,cause:D,generationId:N}){let j;if(W)j=`AI Gateway authentication failed: Invalid API key.
|
|
4
4
|
|
|
5
5
|
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
@@ -17,4 +17,4 @@ Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
|
17
17
|
Option 2 - OIDC token:
|
|
18
18
|
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`;return new $({message:j,statusCode:Y,cause:D,generationId:N})}},cZ="GatewayInvalidRequestError",O0=`vercel.ai.gateway.error.${cZ}`,FZ=Symbol.for(O0),NZ,UZ,R0=class extends(UZ=z,NZ=FZ,UZ){constructor({message:$="Invalid request",statusCode:W=400,cause:Q,generationId:X}={}){super({message:$,statusCode:W,cause:Q,generationId:X});this[NZ]=!0,this.name=cZ,this.type="invalid_request_error"}static isInstance($){return z.hasMarker($)&&FZ in $}},_Z="GatewayRateLimitError",C0=`vercel.ai.gateway.error.${_Z}`,LZ=Symbol.for(C0),VZ,qZ,S0=class extends(qZ=z,VZ=LZ,qZ){constructor({message:$="Rate limit exceeded",statusCode:W=429,cause:Q,generationId:X}={}){super({message:$,statusCode:W,cause:Q,generationId:X});this[VZ]=!0,this.name=_Z,this.type="rate_limit_exceeded"}static isInstance($){return z.hasMarker($)&&LZ in $}},mZ="GatewayModelNotFoundError",w0=`vercel.ai.gateway.error.${mZ}`,TZ=Symbol.for(w0),P0=L(()=>V(Z.object({modelId:Z.string()}))),BZ,GZ,b0=class extends(GZ=z,BZ=TZ,GZ){constructor({message:$="Model not found",statusCode:W=404,modelId:Q,cause:X,generationId:Y}={}){super({message:$,statusCode:W,cause:X,generationId:Y});this[BZ]=!0,this.name=mZ,this.type="model_not_found",this.modelId=Q}static isInstance($){return z.hasMarker($)&&TZ in $}},pZ="GatewayInternalServerError",I0=`vercel.ai.gateway.error.${pZ}`,xZ=Symbol.for(I0),zZ,EZ,HZ=class extends(EZ=z,zZ=xZ,EZ){constructor({message:$="Internal server error",statusCode:W=500,cause:Q,generationId:X}={}){super({message:$,statusCode:W,cause:Q,generationId:X});this[zZ]=!0,this.name=pZ,this.type="internal_server_error"}static isInstance($){return z.hasMarker($)&&xZ in $}},iZ="GatewayResponseError",k0=`vercel.ai.gateway.error.${iZ}`,MZ=Symbol.for(k0),OZ,RZ,v0=class extends(RZ=z,OZ=MZ,RZ){constructor({message:$="Invalid response from Gateway",statusCode:W=502,response:Q,validationError:X,cause:Y,generationId:D}={}){super({message:$,statusCode:W,cause:Y,generationId:D});this[OZ]=!0,this.name=iZ,this.type="response_error",this.response=Q,this.validationError=X}static isInstance($){return z.hasMarker($)&&MZ in $}};async function CZ({response:$,statusCode:W,defaultMessage:Q="Gateway request failed",cause:X,authMethod:Y}){var D;let N=await f({value:$,schema:y0});if(!N.success){let E=typeof $==="object"&&$!==null&&"generationId"in $?$.generationId:void 0;return new v0({message:`Invalid error response format: ${Q}`,statusCode:W,response:$,validationError:N.error,cause:X,generationId:E})}let j=N.value,K=j.error.type,F=j.error.message,q=(D=j.generationId)!=null?D:void 0;switch(K){case"authentication_error":return lZ.createContextualError({apiKeyProvided:Y==="api-key",oidcTokenProvided:Y==="oidc",statusCode:W,cause:X,generationId:q});case"invalid_request_error":return new R0({message:F,statusCode:W,cause:X,generationId:q});case"rate_limit_exceeded":return new S0({message:F,statusCode:W,cause:X,generationId:q});case"model_not_found":{let E=await f({value:j.error.param,schema:P0});return new b0({message:F,statusCode:W,modelId:E.success?E.value.modelId:void 0,cause:X,generationId:q})}case"internal_server_error":return new HZ({message:F,statusCode:W,cause:X,generationId:q});default:return new HZ({message:F,statusCode:W,cause:X,generationId:q})}}var y0=L(()=>V(Z.object({error:Z.object({message:Z.string(),type:Z.string().nullish(),param:Z.unknown().nullish(),code:Z.union([Z.string(),Z.number()]).nullish()}),generationId:Z.string().nullish()}))),dZ="GatewayTimeoutError",h0=`vercel.ai.gateway.error.${dZ}`,SZ=Symbol.for(h0),wZ,PZ,bZ=class $ extends(PZ=z,wZ=SZ,PZ){constructor({message:W="Request timed out",statusCode:Q=408,cause:X,generationId:Y}={}){super({message:W,statusCode:Q,cause:X,generationId:Y});this[wZ]=!0,this.name=dZ,this.type="timeout_error"}static isInstance(W){return z.hasMarker(W)&&SZ in W}static createTimeoutError({originalMessage:W,statusCode:Q=408,cause:X,generationId:Y}){let D=`Gateway request timed out: ${W}
|
|
19
19
|
|
|
20
|
-
This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;return new $({message:D,statusCode:Q,cause:X,generationId:Y})}};function IZ($){if(!($ instanceof Error))return!1;let W=$.code;if(typeof W==="string")return["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(W);return!1}async function H($,W){var Q;if(z.isInstance($))return $;if(IZ($))return bZ.createTimeoutError({originalMessage:$ instanceof Error?$.message:"Unknown error",cause:$});if(v.isInstance($)){if($.cause&&IZ($.cause))return bZ.createTimeoutError({originalMessage:$.message,cause:$});return await CZ({response:f0($),statusCode:(Q=$.statusCode)!=null?Q:500,defaultMessage:"Gateway request failed",cause:$,authMethod:W})}return await CZ({response:{},statusCode:500,defaultMessage:$ instanceof Error?`Gateway request failed: ${$.message}`:"Unknown Gateway error",cause:$,authMethod:W})}function f0($){if($.data!==void 0)return $.data;if($.responseBody!=null)try{return JSON.parse($.responseBody)}catch(W){return $.responseBody}return{}}var nZ="ai-gateway-auth-method";async function w($){let W=await f({value:$[nZ],schema:g0});return W.success?W.value:void 0}var g0=L(()=>V(Z.union([Z.literal("api-key"),Z.literal("oidc")]))),u0=["embedding","image","language","reranking","video"],kZ=class{constructor($){this.config=$}async getAvailableModels(){try{let{value:$}=await y({url:`${this.config.baseURL}/config`,headers:await U(this.config.headers()),successfulResponseHandler:x(l0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(W)=>W}),fetch:this.config.fetch});return $}catch($){throw await H($)}}async getCredits(){try{let $=new URL(this.config.baseURL),{value:W}=await y({url:`${$.origin}/v1/credits`,headers:await U(this.config.headers()),successfulResponseHandler:x(c0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(Q)=>Q}),fetch:this.config.fetch});return W}catch($){throw await H($)}}},l0=L(()=>V(Z.object({models:Z.array(Z.object({id:Z.string(),name:Z.string(),description:Z.string().nullish(),pricing:Z.object({input:Z.string(),output:Z.string(),input_cache_read:Z.string().nullish(),input_cache_write:Z.string().nullish()}).transform(({input:$,output:W,input_cache_read:Q,input_cache_write:X})=>({input:$,output:W,...Q?{cachedInputTokens:Q}:{},...X?{cacheCreationInputTokens:X}:{}})).nullish(),specification:Z.object({specificationVersion:Z.literal("v3"),provider:Z.string(),modelId:Z.string()}),modelType:Z.string().nullish()})).transform(($)=>$.filter((W)=>W.modelType==null||u0.includes(W.modelType)))}))),c0=L(()=>V(Z.object({balance:Z.string(),total_used:Z.string()}).transform(({balance:$,total_used:W})=>({balance:$,totalUsed:W})))),_0=class{constructor($){this.config=$}async getSpendReport($){try{let W=new URL(this.config.baseURL),Q=new URLSearchParams;if(Q.set("start_date",$.startDate),Q.set("end_date",$.endDate),$.groupBy)Q.set("group_by",$.groupBy);if($.datePart)Q.set("date_part",$.datePart);if($.userId)Q.set("user_id",$.userId);if($.model)Q.set("model",$.model);if($.provider)Q.set("provider",$.provider);if($.credentialType)Q.set("credential_type",$.credentialType);if($.tags&&$.tags.length>0)Q.set("tags",$.tags.join(","));let{value:X}=await y({url:`${W.origin}/v1/report?${Q.toString()}`,headers:await U(this.config.headers()),successfulResponseHandler:x(m0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(Y)=>Y}),fetch:this.config.fetch});return X}catch(W){throw await H(W)}}},m0=L(()=>V(Z.object({results:Z.array(Z.object({day:Z.string().optional(),hour:Z.string().optional(),user:Z.string().optional(),model:Z.string().optional(),tag:Z.string().optional(),provider:Z.string().optional(),credential_type:Z.enum(["byok","system"]).optional(),total_cost:Z.number(),market_cost:Z.number().optional(),input_tokens:Z.number().optional(),output_tokens:Z.number().optional(),cached_input_tokens:Z.number().optional(),cache_creation_input_tokens:Z.number().optional(),reasoning_tokens:Z.number().optional(),request_count:Z.number().optional()}).transform(({credential_type:$,total_cost:W,market_cost:Q,input_tokens:X,output_tokens:Y,cached_input_tokens:D,cache_creation_input_tokens:N,reasoning_tokens:j,request_count:K,...F})=>({...F,...$!==void 0?{credentialType:$}:{},totalCost:W,...Q!==void 0?{marketCost:Q}:{},...X!==void 0?{inputTokens:X}:{},...Y!==void 0?{outputTokens:Y}:{},...D!==void 0?{cachedInputTokens:D}:{},...N!==void 0?{cacheCreationInputTokens:N}:{},...j!==void 0?{reasoningTokens:j}:{},...K!==void 0?{requestCount:K}:{}})))}))),p0=class{constructor($){this.config=$}async getGenerationInfo($){try{let W=new URL(this.config.baseURL),{value:Q}=await y({url:`${W.origin}/v1/generation?id=${encodeURIComponent($.id)}`,headers:await U(this.config.headers()),successfulResponseHandler:x(i0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(X)=>X}),fetch:this.config.fetch});return Q}catch(W){throw await H(W)}}},i0=L(()=>V(Z.object({data:Z.object({id:Z.string(),total_cost:Z.number(),upstream_inference_cost:Z.number(),usage:Z.number(),created_at:Z.string(),model:Z.string(),is_byok:Z.boolean(),provider_name:Z.string(),streamed:Z.boolean(),finish_reason:Z.string(),latency:Z.number(),generation_time:Z.number(),native_tokens_prompt:Z.number(),native_tokens_completion:Z.number(),native_tokens_reasoning:Z.number(),native_tokens_cached:Z.number(),native_tokens_cache_creation:Z.number(),billable_web_search_calls:Z.number()}).transform(({total_cost:$,upstream_inference_cost:W,created_at:Q,is_byok:X,provider_name:Y,finish_reason:D,generation_time:N,native_tokens_prompt:j,native_tokens_completion:K,native_tokens_reasoning:F,native_tokens_cached:q,native_tokens_cache_creation:E,billable_web_search_calls:P,...C})=>({...C,totalCost:$,upstreamInferenceCost:W,createdAt:Q,isByok:X,providerName:Y,finishReason:D,generationTime:N,promptTokens:j,completionTokens:K,reasoningTokens:F,cachedTokens:q,cacheCreationTokens:E,billableWebSearchCalls:P}))}).transform(({data:$})=>$))),d0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs($){let{abortSignal:W,...Q}=$;return{args:this.maybeEncodeFileParts(Q),warnings:[]}}async doGenerate($){let{args:W,warnings:Q}=await this.getArgs($),{abortSignal:X}=$,Y=await U(this.config.headers());try{let{responseHeaders:D,value:N,rawValue:j}=await R({url:this.getUrl(),headers:O(Y,$.headers,this.getModelConfigHeaders(this.modelId,!1),await U(this.config.o11yHeaders)),body:W,successfulResponseHandler:x(Z.any()),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(K)=>K}),...X&&{abortSignal:X},fetch:this.config.fetch});return{...N,request:{body:W},response:{headers:D,body:j},warnings:Q}}catch(D){throw await H(D,await w(Y))}}async doStream($){let{args:W,warnings:Q}=await this.getArgs($),{abortSignal:X}=$,Y=await U(this.config.headers());try{let{value:D,responseHeaders:N}=await R({url:this.getUrl(),headers:O(Y,$.headers,this.getModelConfigHeaders(this.modelId,!0),await U(this.config.o11yHeaders)),body:W,successfulResponseHandler:fZ(Z.any()),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(j)=>j}),...X&&{abortSignal:X},fetch:this.config.fetch});return{stream:D.pipeThrough(new TransformStream({start(j){if(Q.length>0)j.enqueue({type:"stream-start",warnings:Q})},transform(j,K){if(j.success){let F=j.value;if(F.type==="raw"&&!$.includeRawChunks)return;if(F.type==="response-metadata"&&F.timestamp&&typeof F.timestamp==="string")F.timestamp=new Date(F.timestamp);K.enqueue(F)}else K.error(j.error)}})),request:{body:W},response:{headers:N}}}catch(D){throw await H(D,await w(Y))}}isFilePart($){return $&&typeof $==="object"&&"type"in $&&$.type==="file"}maybeEncodeFileParts($){for(let W of $.prompt)for(let Q of W.content)if(this.isFilePart(Q)){let X=Q;if(X.data instanceof Uint8Array){let Y=Uint8Array.from(X.data),D=Buffer.from(Y).toString("base64");X.data=new URL(`data:${X.mediaType||"application/octet-stream"};base64,${D}`)}}return $}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders($,W){return{"ai-language-model-specification-version":"3","ai-language-model-id":$,"ai-language-model-streaming":String(W)}}},n0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:$,headers:W,abortSignal:Q,providerOptions:X}){var Y;let D=await U(this.config.headers());try{let{responseHeaders:N,value:j,rawValue:K}=await R({url:this.getUrl(),headers:O(D,W!=null?W:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{values:$,...X?{providerOptions:X}:{}},successfulResponseHandler:x(s0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(F)=>F}),...Q&&{abortSignal:Q},fetch:this.config.fetch});return{embeddings:j.embeddings,usage:(Y=j.usage)!=null?Y:void 0,providerMetadata:j.providerMetadata,response:{headers:N,body:K},warnings:[]}}catch(N){throw await H(N,await w(D))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},s0=L(()=>V(Z.object({embeddings:Z.array(Z.array(Z.number())),usage:Z.object({tokens:Z.number()}).nullish(),providerMetadata:Z.record(Z.string(),Z.record(Z.string(),Z.unknown())).optional()}))),t0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:W,size:Q,aspectRatio:X,seed:Y,files:D,mask:N,providerOptions:j,headers:K,abortSignal:F}){var q,E,P,C;let b=await U(this.config.headers());try{let{responseHeaders:J,value:G,rawValue:I}=await R({url:this.getUrl(),headers:O(b,K!=null?K:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{prompt:$,n:W,...Q&&{size:Q},...X&&{aspectRatio:X},...Y&&{seed:Y},...j&&{providerOptions:j},...D&&{files:D.map((A)=>vZ(A))},...N&&{mask:vZ(N)}},successfulResponseHandler:x(e0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(A)=>A}),...F&&{abortSignal:F},fetch:this.config.fetch});return{images:G.images,warnings:(q=G.warnings)!=null?q:[],providerMetadata:G.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:J},...G.usage!=null&&{usage:{inputTokens:(E=G.usage.inputTokens)!=null?E:void 0,outputTokens:(P=G.usage.outputTokens)!=null?P:void 0,totalTokens:(C=G.usage.totalTokens)!=null?C:void 0}}}}catch(J){throw await H(J,await w(b))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function vZ($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:u($.data)};return $}var a0=Z.object({images:Z.array(Z.unknown()).optional()}).catchall(Z.unknown()),o0=Z.discriminatedUnion("type",[Z.object({type:Z.literal("unsupported"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("compatibility"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("other"),message:Z.string()})]),r0=Z.object({inputTokens:Z.number().nullish(),outputTokens:Z.number().nullish(),totalTokens:Z.number().nullish()}),e0=Z.object({images:Z.array(Z.string()),warnings:Z.array(o0).optional(),providerMetadata:Z.record(Z.string(),a0).optional(),usage:r0.optional()}),Z$=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:W,aspectRatio:Q,resolution:X,duration:Y,fps:D,seed:N,image:j,providerOptions:K,headers:F,abortSignal:q}){var E;let P=await U(this.config.headers());try{let{responseHeaders:C,value:b}=await R({url:this.getUrl(),headers:O(P,F!=null?F:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:$,n:W,...Q&&{aspectRatio:Q},...X&&{resolution:X},...Y&&{duration:Y},...D&&{fps:D},...N&&{seed:N},...K&&{providerOptions:K},...j&&{image:$$(j)}},successfulResponseHandler:async({response:J,url:G,requestBodyValues:I})=>{if(J.body==null)throw new v({message:"SSE response body is empty",url:G,requestBodyValues:I,statusCode:J.status});let M=hZ({stream:J.body,schema:Y$}).getReader(),{done:k,value:S}=await M.read();if(M.releaseLock(),k||!S)throw new v({message:"SSE stream ended without a data event",url:G,requestBodyValues:I,statusCode:J.status});if(!S.success)throw new v({message:"Failed to parse video SSE event",cause:S.error,url:G,requestBodyValues:I,statusCode:J.status});let T=S.value;if(T.type==="error")throw new v({message:T.message,statusCode:T.statusCode,url:G,requestBodyValues:I,responseHeaders:Object.fromEntries([...J.headers]),responseBody:JSON.stringify(T),data:{error:{message:T.message,type:T.errorType,param:T.param}}});return{value:{videos:T.videos,warnings:T.warnings,providerMetadata:T.providerMetadata},responseHeaders:Object.fromEntries([...J.headers])}},failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(J)=>J}),...q&&{abortSignal:q},fetch:this.config.fetch});return{videos:b.videos,warnings:(E=b.warnings)!=null?E:[],providerMetadata:b.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:C}}}catch(C){throw await H(C,await w(P))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}};function $$($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:u($.data)};return $}var W$=Z.object({videos:Z.array(Z.unknown()).optional()}).catchall(Z.unknown()),Q$=Z.union([Z.object({type:Z.literal("url"),url:Z.string(),mediaType:Z.string()}),Z.object({type:Z.literal("base64"),data:Z.string(),mediaType:Z.string()})]),X$=Z.discriminatedUnion("type",[Z.object({type:Z.literal("unsupported"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("compatibility"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("other"),message:Z.string()})]),Y$=Z.discriminatedUnion("type",[Z.object({type:Z.literal("result"),videos:Z.array(Q$),warnings:Z.array(X$).optional(),providerMetadata:Z.record(Z.string(),W$).optional()}),Z.object({type:Z.literal("error"),message:Z.string(),errorType:Z.string(),statusCode:Z.number(),param:Z.unknown().nullable()})]),j$=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3"}get provider(){return this.config.provider}async doRerank({documents:$,query:W,topN:Q,headers:X,abortSignal:Y,providerOptions:D}){let N=await U(this.config.headers());try{let{responseHeaders:j,value:K,rawValue:F}=await R({url:this.getUrl(),headers:O(N,X!=null?X:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{documents:$,query:W,...Q!=null?{topN:Q}:{},...D?{providerOptions:D}:{}},successfulResponseHandler:x(D$),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(q)=>q}),...Y&&{abortSignal:Y},fetch:this.config.fetch});return{ranking:K.ranking,providerMetadata:K.providerMetadata,response:{headers:j,body:F},warnings:[]}}catch(j){throw await H(j,await w(N))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":"3","ai-model-id":this.modelId}}},D$=L(()=>V(Z.object({ranking:Z.array(Z.object({index:Z.number(),relevanceScore:Z.number()})),providerMetadata:Z.record(Z.string(),Z.record(Z.string(),Z.unknown())).optional()}))),K$=L(()=>V(Z.object({objective:Z.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:Z.array(Z.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:Z.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:Z.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:Z.object({include_domains:Z.array(Z.string()).optional().describe("List of domains to include in search results."),exclude_domains:Z.array(Z.string()).optional().describe("List of domains to exclude from search results."),after_date:Z.string().optional().describe("Only include results published after this date (ISO 8601 format).")}).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:Z.object({max_chars_per_result:Z.number().optional().describe("Maximum characters per result."),max_chars_total:Z.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:Z.object({max_age_seconds:Z.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),J$=L(()=>V(Z.union([Z.object({searchId:Z.string(),results:Z.array(Z.object({url:Z.string(),title:Z.string(),excerpt:Z.string(),publishDate:Z.string().nullable().optional(),relevanceScore:Z.number().optional()}))}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),A$=l({id:"gateway.parallel_search",inputSchema:K$,outputSchema:J$}),F$=($={})=>A$($),N$=L(()=>V(Z.object({query:Z.union([Z.string(),Z.array(Z.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:Z.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:Z.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:Z.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:Z.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:Z.array(Z.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:Z.array(Z.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:Z.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:Z.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:Z.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:Z.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:Z.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),U$=L(()=>V(Z.union([Z.object({results:Z.array(Z.object({title:Z.string(),url:Z.string(),snippet:Z.string(),date:Z.string().optional(),lastUpdated:Z.string().optional()})),id:Z.string()}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),L$=l({id:"gateway.perplexity_search",inputSchema:N$,outputSchema:U$}),V$=($={})=>L$($),q$={parallelSearch:F$,perplexitySearch:V$};async function T$(){var $;return($=sZ.getContext().headers)==null?void 0:$["x-vercel-id"]}var B$="3.0.104",G$="0.0.1";function x$($={}){var W,Q;let X=null,Y=null,D=(W=$.metadataCacheRefreshMillis)!=null?W:300000,N=0,j=(Q=gZ($.baseURL))!=null?Q:"https://ai-gateway.vercel.sh/v3/ai",K=async()=>{try{let A=await z$($);return yZ({Authorization:`Bearer ${A.token}`,"ai-gateway-protocol-version":G$,[nZ]:A.authMethod,...$.headers},`ai-sdk/gateway/${B$}`)}catch(A){throw lZ.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:A})}},F=()=>{let A=h({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),M=h({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),k=h({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),S=h({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let T=await T$();return{...A&&{"ai-o11y-deployment-id":A},...M&&{"ai-o11y-environment":M},...k&&{"ai-o11y-region":k},...T&&{"ai-o11y-request-id":T},...S&&{"ai-o11y-project-id":S}}}},q=(A)=>{return new d0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})},E=async()=>{var A,M,k;let S=(k=(M=(A=$._internal)==null?void 0:A.currentDate)==null?void 0:M.call(A).getTime())!=null?k:Date.now();if(!X||S-N>D)N=S,X=new kZ({baseURL:j,headers:K,fetch:$.fetch}).getAvailableModels().then((T)=>{return Y=T,T}).catch(async(T)=>{throw await H(T,await w(await K()))});return Y?Promise.resolve(Y):X},P=async()=>{return new kZ({baseURL:j,headers:K,fetch:$.fetch}).getCredits().catch(async(A)=>{throw await H(A,await w(await K()))})},C=async(A)=>{return new _0({baseURL:j,headers:K,fetch:$.fetch}).getSpendReport(A).catch(async(M)=>{throw await H(M,await w(await K()))})},b=async(A)=>{return new p0({baseURL:j,headers:K,fetch:$.fetch}).getGenerationInfo(A).catch(async(M)=>{throw await H(M,await w(await K()))})},J=function(A){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return q(A)};J.specificationVersion="v3",J.getAvailableModels=E,J.getCredits=P,J.getSpendReport=C,J.getGenerationInfo=b,J.imageModel=(A)=>{return new t0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})},J.languageModel=q;let G=(A)=>{return new n0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};J.embeddingModel=G,J.textEmbeddingModel=G,J.videoModel=(A)=>{return new Z$(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};let I=(A)=>{return new j$(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};return J.rerankingModel=I,J.reranking=I,J.chat=J.languageModel,J.embedding=J.embeddingModel,J.image=J.imageModel,J.video=J.videoModel,J.tools=q$,J}var $W=x$();async function z$($){let W=h({settingValue:$.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(W)return{token:W,authMethod:"api-key"};return{token:await tZ.getVercelOidcToken(),authMethod:"oidc"}}export{z as Dp,lZ as Ep,R0 as Fp,S0 as Gp,b0 as Hp,HZ as Ip,v0 as Jp,x$ as Kp,$W as Lp};
|
|
20
|
+
This is a client-side timeout. To resolve this, increase your timeout configuration: https://vercel.com/docs/ai-gateway/capabilities/video-generation#extending-timeouts-for-node.js`;return new $({message:D,statusCode:Q,cause:X,generationId:Y})}};function IZ($){if(!($ instanceof Error))return!1;let W=$.code;if(typeof W==="string")return["UND_ERR_HEADERS_TIMEOUT","UND_ERR_BODY_TIMEOUT","UND_ERR_CONNECT_TIMEOUT"].includes(W);return!1}async function H($,W){var Q;if(z.isInstance($))return $;if(IZ($))return bZ.createTimeoutError({originalMessage:$ instanceof Error?$.message:"Unknown error",cause:$});if(v.isInstance($)){if($.cause&&IZ($.cause))return bZ.createTimeoutError({originalMessage:$.message,cause:$});return await CZ({response:f0($),statusCode:(Q=$.statusCode)!=null?Q:500,defaultMessage:"Gateway request failed",cause:$,authMethod:W})}return await CZ({response:{},statusCode:500,defaultMessage:$ instanceof Error?`Gateway request failed: ${$.message}`:"Unknown Gateway error",cause:$,authMethod:W})}function f0($){if($.data!==void 0)return $.data;if($.responseBody!=null)try{return JSON.parse($.responseBody)}catch(W){return $.responseBody}return{}}var nZ="ai-gateway-auth-method";async function w($){let W=await f({value:$[nZ],schema:g0});return W.success?W.value:void 0}var g0=L(()=>V(Z.union([Z.literal("api-key"),Z.literal("oidc")]))),u0=["embedding","image","language","reranking","video"],kZ=class{constructor($){this.config=$}async getAvailableModels(){try{let{value:$}=await y({url:`${this.config.baseURL}/config`,headers:await U(this.config.headers()),successfulResponseHandler:x(l0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(W)=>W}),fetch:this.config.fetch});return $}catch($){throw await H($)}}async getCredits(){try{let $=new URL(this.config.baseURL),{value:W}=await y({url:`${$.origin}/v1/credits`,headers:await U(this.config.headers()),successfulResponseHandler:x(c0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(Q)=>Q}),fetch:this.config.fetch});return W}catch($){throw await H($)}}},l0=L(()=>V(Z.object({models:Z.array(Z.object({id:Z.string(),name:Z.string(),description:Z.string().nullish(),pricing:Z.object({input:Z.string(),output:Z.string(),input_cache_read:Z.string().nullish(),input_cache_write:Z.string().nullish()}).transform(({input:$,output:W,input_cache_read:Q,input_cache_write:X})=>({input:$,output:W,...Q?{cachedInputTokens:Q}:{},...X?{cacheCreationInputTokens:X}:{}})).nullish(),specification:Z.object({specificationVersion:Z.literal("v3"),provider:Z.string(),modelId:Z.string()}),modelType:Z.string().nullish()})).transform(($)=>$.filter((W)=>W.modelType==null||u0.includes(W.modelType)))}))),c0=L(()=>V(Z.object({balance:Z.string(),total_used:Z.string()}).transform(({balance:$,total_used:W})=>({balance:$,totalUsed:W})))),_0=class{constructor($){this.config=$}async getSpendReport($){try{let W=new URL(this.config.baseURL),Q=new URLSearchParams;if(Q.set("start_date",$.startDate),Q.set("end_date",$.endDate),$.groupBy)Q.set("group_by",$.groupBy);if($.datePart)Q.set("date_part",$.datePart);if($.userId)Q.set("user_id",$.userId);if($.model)Q.set("model",$.model);if($.provider)Q.set("provider",$.provider);if($.credentialType)Q.set("credential_type",$.credentialType);if($.tags&&$.tags.length>0)Q.set("tags",$.tags.join(","));let{value:X}=await y({url:`${W.origin}/v1/report?${Q.toString()}`,headers:await U(this.config.headers()),successfulResponseHandler:x(m0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(Y)=>Y}),fetch:this.config.fetch});return X}catch(W){throw await H(W)}}},m0=L(()=>V(Z.object({results:Z.array(Z.object({day:Z.string().optional(),hour:Z.string().optional(),user:Z.string().optional(),model:Z.string().optional(),tag:Z.string().optional(),provider:Z.string().optional(),credential_type:Z.enum(["byok","system"]).optional(),total_cost:Z.number(),market_cost:Z.number().optional(),input_tokens:Z.number().optional(),output_tokens:Z.number().optional(),cached_input_tokens:Z.number().optional(),cache_creation_input_tokens:Z.number().optional(),reasoning_tokens:Z.number().optional(),request_count:Z.number().optional()}).transform(({credential_type:$,total_cost:W,market_cost:Q,input_tokens:X,output_tokens:Y,cached_input_tokens:D,cache_creation_input_tokens:N,reasoning_tokens:j,request_count:K,...F})=>({...F,...$!==void 0?{credentialType:$}:{},totalCost:W,...Q!==void 0?{marketCost:Q}:{},...X!==void 0?{inputTokens:X}:{},...Y!==void 0?{outputTokens:Y}:{},...D!==void 0?{cachedInputTokens:D}:{},...N!==void 0?{cacheCreationInputTokens:N}:{},...j!==void 0?{reasoningTokens:j}:{},...K!==void 0?{requestCount:K}:{}})))}))),p0=class{constructor($){this.config=$}async getGenerationInfo($){try{let W=new URL(this.config.baseURL),{value:Q}=await y({url:`${W.origin}/v1/generation?id=${encodeURIComponent($.id)}`,headers:await U(this.config.headers()),successfulResponseHandler:x(i0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(X)=>X}),fetch:this.config.fetch});return Q}catch(W){throw await H(W)}}},i0=L(()=>V(Z.object({data:Z.object({id:Z.string(),total_cost:Z.number(),upstream_inference_cost:Z.number(),usage:Z.number(),created_at:Z.string(),model:Z.string(),is_byok:Z.boolean(),provider_name:Z.string(),streamed:Z.boolean(),finish_reason:Z.string(),latency:Z.number(),generation_time:Z.number(),native_tokens_prompt:Z.number(),native_tokens_completion:Z.number(),native_tokens_reasoning:Z.number(),native_tokens_cached:Z.number(),native_tokens_cache_creation:Z.number(),billable_web_search_calls:Z.number()}).transform(({total_cost:$,upstream_inference_cost:W,created_at:Q,is_byok:X,provider_name:Y,finish_reason:D,generation_time:N,native_tokens_prompt:j,native_tokens_completion:K,native_tokens_reasoning:F,native_tokens_cached:q,native_tokens_cache_creation:E,billable_web_search_calls:P,...C})=>({...C,totalCost:$,upstreamInferenceCost:W,createdAt:Q,isByok:X,providerName:Y,finishReason:D,generationTime:N,promptTokens:j,completionTokens:K,reasoningTokens:F,cachedTokens:q,cacheCreationTokens:E,billableWebSearchCalls:P}))}).transform(({data:$})=>$))),d0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs($){let{abortSignal:W,...Q}=$;return{args:this.maybeEncodeFileParts(Q),warnings:[]}}async doGenerate($){let{args:W,warnings:Q}=await this.getArgs($),{abortSignal:X}=$,Y=await U(this.config.headers());try{let{responseHeaders:D,value:N,rawValue:j}=await R({url:this.getUrl(),headers:O(Y,$.headers,this.getModelConfigHeaders(this.modelId,!1),await U(this.config.o11yHeaders)),body:W,successfulResponseHandler:x(Z.any()),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(K)=>K}),...X&&{abortSignal:X},fetch:this.config.fetch});return{...N,request:{body:W},response:{headers:D,body:j},warnings:Q}}catch(D){throw await H(D,await w(Y))}}async doStream($){let{args:W,warnings:Q}=await this.getArgs($),{abortSignal:X}=$,Y=await U(this.config.headers());try{let{value:D,responseHeaders:N}=await R({url:this.getUrl(),headers:O(Y,$.headers,this.getModelConfigHeaders(this.modelId,!0),await U(this.config.o11yHeaders)),body:W,successfulResponseHandler:fZ(Z.any()),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(j)=>j}),...X&&{abortSignal:X},fetch:this.config.fetch});return{stream:D.pipeThrough(new TransformStream({start(j){if(Q.length>0)j.enqueue({type:"stream-start",warnings:Q})},transform(j,K){if(j.success){let F=j.value;if(F.type==="raw"&&!$.includeRawChunks)return;if(F.type==="response-metadata"&&F.timestamp&&typeof F.timestamp==="string")F.timestamp=new Date(F.timestamp);K.enqueue(F)}else K.error(j.error)}})),request:{body:W},response:{headers:N}}}catch(D){throw await H(D,await w(Y))}}isFilePart($){return $&&typeof $==="object"&&"type"in $&&$.type==="file"}maybeEncodeFileParts($){for(let W of $.prompt)for(let Q of W.content)if(this.isFilePart(Q)){let X=Q;if(X.data instanceof Uint8Array){let Y=Uint8Array.from(X.data),D=Buffer.from(Y).toString("base64");X.data=new URL(`data:${X.mediaType||"application/octet-stream"};base64,${D}`)}}return $}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders($,W){return{"ai-language-model-specification-version":"3","ai-language-model-id":$,"ai-language-model-streaming":String(W)}}},n0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:$,headers:W,abortSignal:Q,providerOptions:X}){var Y;let D=await U(this.config.headers());try{let{responseHeaders:N,value:j,rawValue:K}=await R({url:this.getUrl(),headers:O(D,W!=null?W:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{values:$,...X?{providerOptions:X}:{}},successfulResponseHandler:x(s0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(F)=>F}),...Q&&{abortSignal:Q},fetch:this.config.fetch});return{embeddings:j.embeddings,usage:(Y=j.usage)!=null?Y:void 0,providerMetadata:j.providerMetadata,response:{headers:N,body:K},warnings:[]}}catch(N){throw await H(N,await w(D))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"3","ai-model-id":this.modelId}}},s0=L(()=>V(Z.object({embeddings:Z.array(Z.array(Z.number())),usage:Z.object({tokens:Z.number()}).nullish(),providerMetadata:Z.record(Z.string(),Z.record(Z.string(),Z.unknown())).optional()}))),t0=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxImagesPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:W,size:Q,aspectRatio:X,seed:Y,files:D,mask:N,providerOptions:j,headers:K,abortSignal:F}){var q,E,P,C;let b=await U(this.config.headers());try{let{responseHeaders:J,value:G,rawValue:I}=await R({url:this.getUrl(),headers:O(b,K!=null?K:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{prompt:$,n:W,...Q&&{size:Q},...X&&{aspectRatio:X},...Y&&{seed:Y},...j&&{providerOptions:j},...D&&{files:D.map((A)=>vZ(A))},...N&&{mask:vZ(N)}},successfulResponseHandler:x(e0),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(A)=>A}),...F&&{abortSignal:F},fetch:this.config.fetch});return{images:G.images,warnings:(q=G.warnings)!=null?q:[],providerMetadata:G.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:J},...G.usage!=null&&{usage:{inputTokens:(E=G.usage.inputTokens)!=null?E:void 0,outputTokens:(P=G.usage.outputTokens)!=null?P:void 0,totalTokens:(C=G.usage.totalTokens)!=null?C:void 0}}}}catch(J){throw await H(J,await w(b))}}getUrl(){return`${this.config.baseURL}/image-model`}getModelConfigHeaders(){return{"ai-image-model-specification-version":"3","ai-model-id":this.modelId}}};function vZ($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:u($.data)};return $}var a0=Z.object({images:Z.array(Z.unknown()).optional()}).catchall(Z.unknown()),o0=Z.discriminatedUnion("type",[Z.object({type:Z.literal("unsupported"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("compatibility"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("other"),message:Z.string()})]),r0=Z.object({inputTokens:Z.number().nullish(),outputTokens:Z.number().nullish(),totalTokens:Z.number().nullish()}),e0=Z.object({images:Z.array(Z.string()),warnings:Z.array(o0).optional(),providerMetadata:Z.record(Z.string(),a0).optional(),usage:r0.optional()}),Z$=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3",this.maxVideosPerCall=Number.MAX_SAFE_INTEGER}get provider(){return this.config.provider}async doGenerate({prompt:$,n:W,aspectRatio:Q,resolution:X,duration:Y,fps:D,seed:N,image:j,providerOptions:K,headers:F,abortSignal:q}){var E;let P=await U(this.config.headers());try{let{responseHeaders:C,value:b}=await R({url:this.getUrl(),headers:O(P,F!=null?F:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders),{accept:"text/event-stream"}),body:{prompt:$,n:W,...Q&&{aspectRatio:Q},...X&&{resolution:X},...Y&&{duration:Y},...D&&{fps:D},...N&&{seed:N},...K&&{providerOptions:K},...j&&{image:$$(j)}},successfulResponseHandler:async({response:J,url:G,requestBodyValues:I})=>{if(J.body==null)throw new v({message:"SSE response body is empty",url:G,requestBodyValues:I,statusCode:J.status});let M=hZ({stream:J.body,schema:Y$}).getReader(),{done:k,value:S}=await M.read();if(M.releaseLock(),k||!S)throw new v({message:"SSE stream ended without a data event",url:G,requestBodyValues:I,statusCode:J.status});if(!S.success)throw new v({message:"Failed to parse video SSE event",cause:S.error,url:G,requestBodyValues:I,statusCode:J.status});let T=S.value;if(T.type==="error")throw new v({message:T.message,statusCode:T.statusCode,url:G,requestBodyValues:I,responseHeaders:Object.fromEntries([...J.headers]),responseBody:JSON.stringify(T),data:{error:{message:T.message,type:T.errorType,param:T.param}}});return{value:{videos:T.videos,warnings:T.warnings,providerMetadata:T.providerMetadata},responseHeaders:Object.fromEntries([...J.headers])}},failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(J)=>J}),...q&&{abortSignal:q},fetch:this.config.fetch});return{videos:b.videos,warnings:(E=b.warnings)!=null?E:[],providerMetadata:b.providerMetadata,response:{timestamp:new Date,modelId:this.modelId,headers:C}}}catch(C){throw await H(C,await w(P))}}getUrl(){return`${this.config.baseURL}/video-model`}getModelConfigHeaders(){return{"ai-video-model-specification-version":"3","ai-model-id":this.modelId}}};function $$($){if($.type==="file"&&$.data instanceof Uint8Array)return{...$,data:u($.data)};return $}var W$=Z.object({videos:Z.array(Z.unknown()).optional()}).catchall(Z.unknown()),Q$=Z.union([Z.object({type:Z.literal("url"),url:Z.string(),mediaType:Z.string()}),Z.object({type:Z.literal("base64"),data:Z.string(),mediaType:Z.string()})]),X$=Z.discriminatedUnion("type",[Z.object({type:Z.literal("unsupported"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("compatibility"),feature:Z.string(),details:Z.string().optional()}),Z.object({type:Z.literal("other"),message:Z.string()})]),Y$=Z.discriminatedUnion("type",[Z.object({type:Z.literal("result"),videos:Z.array(Q$),warnings:Z.array(X$).optional(),providerMetadata:Z.record(Z.string(),W$).optional()}),Z.object({type:Z.literal("error"),message:Z.string(),errorType:Z.string(),statusCode:Z.number(),param:Z.unknown().nullable()})]),j$=class{constructor($,W){this.modelId=$,this.config=W,this.specificationVersion="v3"}get provider(){return this.config.provider}async doRerank({documents:$,query:W,topN:Q,headers:X,abortSignal:Y,providerOptions:D}){let N=await U(this.config.headers());try{let{responseHeaders:j,value:K,rawValue:F}=await R({url:this.getUrl(),headers:O(N,X!=null?X:{},this.getModelConfigHeaders(),await U(this.config.o11yHeaders)),body:{documents:$,query:W,...Q!=null?{topN:Q}:{},...D?{providerOptions:D}:{}},successfulResponseHandler:x(D$),failedResponseHandler:B({errorSchema:Z.any(),errorToMessage:(q)=>q}),...Y&&{abortSignal:Y},fetch:this.config.fetch});return{ranking:K.ranking,providerMetadata:K.providerMetadata,response:{headers:j,body:F},warnings:[]}}catch(j){throw await H(j,await w(N))}}getUrl(){return`${this.config.baseURL}/reranking-model`}getModelConfigHeaders(){return{"ai-reranking-model-specification-version":"3","ai-model-id":this.modelId}}},D$=L(()=>V(Z.object({ranking:Z.array(Z.object({index:Z.number(),relevanceScore:Z.number()})),providerMetadata:Z.record(Z.string(),Z.record(Z.string(),Z.unknown())).optional()}))),K$=L(()=>V(Z.object({objective:Z.string().describe("Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."),search_queries:Z.array(Z.string()).optional().describe("Optional search queries to supplement the objective. Maximum 200 characters per query."),mode:Z.enum(["one-shot","agentic"]).optional().describe('Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'),max_results:Z.number().optional().describe("Maximum number of results to return (1-20). Defaults to 10 if not specified."),source_policy:Z.object({include_domains:Z.array(Z.string()).optional().describe("List of domains to include in search results."),exclude_domains:Z.array(Z.string()).optional().describe("List of domains to exclude from search results."),after_date:Z.string().optional().describe("Only include results published after this date (ISO 8601 format).")}).optional().describe("Source policy for controlling which domains to include/exclude and freshness."),excerpts:Z.object({max_chars_per_result:Z.number().optional().describe("Maximum characters per result."),max_chars_total:Z.number().optional().describe("Maximum total characters across all results.")}).optional().describe("Excerpt configuration for controlling result length."),fetch_policy:Z.object({max_age_seconds:Z.number().optional().describe("Maximum age in seconds for cached content. Set to 0 to always fetch fresh content.")}).optional().describe("Fetch policy for controlling content freshness.")}))),J$=L(()=>V(Z.union([Z.object({searchId:Z.string(),results:Z.array(Z.object({url:Z.string(),title:Z.string(),excerpt:Z.string(),publishDate:Z.string().nullable().optional(),relevanceScore:Z.number().optional()}))}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","configuration_error","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),A$=l({id:"gateway.parallel_search",inputSchema:K$,outputSchema:J$}),F$=($={})=>A$($),N$=L(()=>V(Z.object({query:Z.union([Z.string(),Z.array(Z.string())]).describe("Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."),max_results:Z.number().optional().describe("Maximum number of search results to return (1-20, default: 10)"),max_tokens_per_page:Z.number().optional().describe("Maximum number of tokens to extract per search result page (256-2048, default: 2048)"),max_tokens:Z.number().optional().describe("Maximum total tokens across all search results (default: 25000, max: 1000000)"),country:Z.string().optional().describe("Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"),search_domain_filter:Z.array(Z.string()).optional().describe("List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"),search_language_filter:Z.array(Z.string()).optional().describe("List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"),search_after_date:Z.string().optional().describe("Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),search_before_date:Z.string().optional().describe("Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),last_updated_after_filter:Z.string().optional().describe("Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."),last_updated_before_filter:Z.string().optional().describe("Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."),search_recency_filter:Z.enum(["day","week","month","year"]).optional().describe("Filter results by relative time period. Cannot be used with search_after_date or search_before_date.")}))),U$=L(()=>V(Z.union([Z.object({results:Z.array(Z.object({title:Z.string(),url:Z.string(),snippet:Z.string(),date:Z.string().optional(),lastUpdated:Z.string().optional()})),id:Z.string()}),Z.object({error:Z.enum(["api_error","rate_limit","timeout","invalid_input","unknown"]),statusCode:Z.number().optional(),message:Z.string()})]))),L$=l({id:"gateway.perplexity_search",inputSchema:N$,outputSchema:U$}),V$=($={})=>L$($),q$={parallelSearch:F$,perplexitySearch:V$};async function T$(){var $;return($=sZ.getContext().headers)==null?void 0:$["x-vercel-id"]}var B$="3.0.104",G$="0.0.1";function x$($={}){var W,Q;let X=null,Y=null,D=(W=$.metadataCacheRefreshMillis)!=null?W:300000,N=0,j=(Q=gZ($.baseURL))!=null?Q:"https://ai-gateway.vercel.sh/v3/ai",K=async()=>{try{let A=await z$($);return yZ({Authorization:`Bearer ${A.token}`,"ai-gateway-protocol-version":G$,[nZ]:A.authMethod,...$.headers},`ai-sdk/gateway/${B$}`)}catch(A){throw lZ.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401,cause:A})}},F=()=>{let A=h({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),M=h({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),k=h({settingValue:void 0,environmentVariableName:"VERCEL_REGION"}),S=h({settingValue:void 0,environmentVariableName:"VERCEL_PROJECT_ID"});return async()=>{let T=await T$();return{...A&&{"ai-o11y-deployment-id":A},...M&&{"ai-o11y-environment":M},...k&&{"ai-o11y-region":k},...T&&{"ai-o11y-request-id":T},...S&&{"ai-o11y-project-id":S}}}},q=(A)=>{return new d0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})},E=async()=>{var A,M,k;let S=(k=(M=(A=$._internal)==null?void 0:A.currentDate)==null?void 0:M.call(A).getTime())!=null?k:Date.now();if(!X||S-N>D)N=S,X=new kZ({baseURL:j,headers:K,fetch:$.fetch}).getAvailableModels().then((T)=>{return Y=T,T}).catch(async(T)=>{throw await H(T,await w(await K()))});return Y?Promise.resolve(Y):X},P=async()=>{return new kZ({baseURL:j,headers:K,fetch:$.fetch}).getCredits().catch(async(A)=>{throw await H(A,await w(await K()))})},C=async(A)=>{return new _0({baseURL:j,headers:K,fetch:$.fetch}).getSpendReport(A).catch(async(M)=>{throw await H(M,await w(await K()))})},b=async(A)=>{return new p0({baseURL:j,headers:K,fetch:$.fetch}).getGenerationInfo(A).catch(async(M)=>{throw await H(M,await w(await K()))})},J=function(A){if(new.target)throw Error("The Gateway Provider model function cannot be called with the new keyword.");return q(A)};J.specificationVersion="v3",J.getAvailableModels=E,J.getCredits=P,J.getSpendReport=C,J.getGenerationInfo=b,J.imageModel=(A)=>{return new t0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})},J.languageModel=q;let G=(A)=>{return new n0(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};J.embeddingModel=G,J.textEmbeddingModel=G,J.videoModel=(A)=>{return new Z$(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};let I=(A)=>{return new j$(A,{provider:"gateway",baseURL:j,headers:K,fetch:$.fetch,o11yHeaders:F()})};return J.rerankingModel=I,J.reranking=I,J.chat=J.languageModel,J.embedding=J.embeddingModel,J.image=J.imageModel,J.video=J.videoModel,J.tools=q$,J}var $W=x$();async function z$($){let W=h({settingValue:$.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(W)return{token:W,authMethod:"api-key"};return{token:await tZ.getVercelOidcToken(),authMethod:"oidc"}}export{z as go,lZ as ho,R0 as io,S0 as jo,b0 as ko,HZ as lo,v0 as mo,x$ as no,$W as oo};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var J=Symbol.for("drizzle:entityKind");function D(X,Y){if(!X||typeof X!=="object")return!1;if(X instanceof Y)return!0;if(!Object.prototype.hasOwnProperty.call(Y,J))throw Error(`Class "${Y.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let Z=Object.getPrototypeOf(X)?.constructor;if(Z)while(Z){if(J in Z&&Z[J]===Y[J])return!0;Z=Object.getPrototypeOf(Z)}return!1}var T1=Symbol.for("drizzle:OriginalColumn");var N=class{static[J]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;length;isLengthExact;isAlias;config;table;onInit(){}constructor(X,Y){this.config=Y,this.onInit(),this.table=X,this.name=Y.name,this.isAlias=!1,this.keyAsName=Y.keyAsName,this.notNull=Y.notNull,this.default=Y.default,this.defaultFn=Y.defaultFn,this.onUpdateFn=Y.onUpdateFn,this.hasDefault=Y.hasDefault,this.primary=Y.primaryKey,this.isUnique=Y.isUnique,this.uniqueName=Y.uniqueName,this.uniqueType=Y.uniqueType,this.dataType=Y.dataType,this.columnType=Y.columnType,this.generated=Y.generated,this.generatedIdentity=Y.generatedIdentity,this.length=Y.length,this.isLengthExact=Y.isLengthExact}mapFromDriverValue(X){return X}mapToDriverValue(X){return X}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}[T1](){return this}};var r=Symbol.for("drizzle:Name");var G1=Symbol.for("drizzle:Schema"),n=Symbol.for("drizzle:Columns"),GY=Symbol.for("drizzle:ExtraConfigColumns"),U1=Symbol.for("drizzle:OriginalName"),QX=Symbol.for("drizzle:BaseName"),_1=Symbol.for("drizzle:IsAlias"),WY=Symbol.for("drizzle:ExtraConfigBuilder"),X0=Symbol.for("drizzle:IsDrizzleTable"),A=class{static[J]="Table";static Symbol={Name:r,Schema:G1,OriginalName:U1,Columns:n,ExtraConfigColumns:GY,BaseName:QX,IsAlias:_1,ExtraConfigBuilder:WY};[r];[U1];[G1];[n];[GY];[QX];[_1]=!1;[X0]=!0;[WY]=void 0;constructor(X,Y,Z){this[r]=this[U1]=X,this[G1]=Y,this[QX]=Z}};function z1(X){return X[r]}function A1(X){return`${X[G1]??"public"}.${X[r]}`}var T=class{static[J]="Subquery";constructor(X,Y,Z,$=!1,G=[]){this._={brand:"Subquery",sql:X,selectedFields:Y,alias:Z,isWith:$,usedTables:G}}},WX=class extends T{static[J]="WithSubquery"};function JY(X,...Y){return X(...Y)}var HY={startActiveSpan(X,Y){return Y()}};var Q=Symbol.for("drizzle:ViewBaseConfig");var Y0=class{static[J]="FakePrimitiveParam"};function E1(X){return X!==null&&X!==void 0&&typeof X.getSQL==="function"}function Z0(X){let Y={sql:"",params:[]};for(let Z of X)if(Y.sql+=Z.sql,Y.params.push(...Z.params),Z.typings?.length){if(!Y.typings)Y.typings=[];Y.typings.push(...Z.typings)}return Y}var h=class{static[J]="StringChunk";value;constructor(X){this.value=Array.isArray(X)?X:[X]}getSQL(){return new x([this])}},x=class X{static[J]="SQL";decoder=C1;shouldInlineParams=!1;usedTables=[];constructor(Y){this.queryChunks=Y;for(let Z of Y)if(D(Z,A)){let $=Z[A.Symbol.Schema];this.usedTables.push($===void 0?Z[A.Symbol.Name]:$+"."+Z[A.Symbol.Name])}}append(Y){return this.queryChunks.push(...Y.queryChunks),this}toQuery(Y){return HY.startActiveSpan("drizzle.buildSQL",(Z)=>{let $=this.buildQueryFromSourceParams(this.queryChunks,Y);return Z?.setAttributes({"drizzle.query.text":$.sql,"drizzle.query.params":JSON.stringify($.params)}),$})}buildQueryFromSourceParams(Y,Z){let $=Object.assign({},Z,{inlineParams:Z.inlineParams||this.shouldInlineParams,paramStartIndex:Z.paramStartIndex||{value:0}}),{casing:G,escapeName:H,escapeParam:_,prepareTyping:z,inlineParams:O,paramStartIndex:E,invokeSource:U}=$;return Z0(Y.map((F)=>{if(D(F,h))return{sql:F.value.join(""),params:[]};if(D(F,S1))return{sql:H(F.value),params:[]};if(F===void 0)return{sql:"",params:[]};if(Array.isArray(F)){let M=[new h("(")];for(let[I,L]of F.entries())if(M.push(L),I<F.length-1)M.push(new h(", "));return M.push(new h(")")),this.buildQueryFromSourceParams(M,$)}if(D(F,X))return this.buildQueryFromSourceParams(F.queryChunks,{...$,inlineParams:O||F.shouldInlineParams});if(D(F,A)){let M=F[A.Symbol.Schema],I=F[A.Symbol.Name];if(U==="mssql-view-with-schemabinding")return{sql:(M===void 0?H("dbo"):H(M))+"."+H(I),params:[]};return{sql:M===void 0||F[_1]?H(I):H(M)+"."+H(I),params:[]}}if(D(F,N)){let M=G.getColumnCasing(F);if(Z.invokeSource==="indexes")return{sql:H(M),params:[]};let I=U==="mssql-check"?void 0:F.table[A.Symbol.Schema];return{sql:F.isAlias?H(F.name):F.table[_1]||I===void 0?H(F.table[A.Symbol.Name])+"."+H(M):H(I)+"."+H(F.table[A.Symbol.Name])+"."+H(M),params:[]}}if(D(F,y)){let M=F[Q].schema,I=F[Q].name;return{sql:M===void 0||F[Q].isAlias?H(I):H(M)+"."+H(I),params:[]}}if(D(F,g)){if(D(F.value,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};let M=F.value===null?null:F.encoder.mapToDriverValue(F.value);if(D(M,X))return this.buildQueryFromSourceParams([M],$);if(O)return{sql:this.mapInlineParam(M,$),params:[]};let I=["none"];if(z)I=[z(F.encoder)];return{sql:_(E.value++,M),params:[M],typings:I}}if(D(F,l))return{sql:_(E.value++,F),params:[F],typings:["none"]};if(D(F,X.Aliased)&&F.fieldAlias!==void 0)return{sql:(F.origin!==void 0?H(F.origin)+".":"")+H(F.fieldAlias),params:[]};if(D(F,T)){if(F._.isWith)return{sql:H(F._.alias),params:[]};return this.buildQueryFromSourceParams([new h("("),F._.sql,new h(") "),new S1(F._.alias)],$)}if(typeof F==="function"&&"enumName"in F){if("schema"in F&&F.schema)return{sql:H(F.schema)+"."+H(F.enumName),params:[]};return{sql:H(F.enumName),params:[]}}if(E1(F)){if(F.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([F.getSQL()],$);return this.buildQueryFromSourceParams([new h("("),F.getSQL(),new h(")")],$)}if(O)return{sql:this.mapInlineParam(F,$),params:[]};return{sql:_(E.value++,F),params:[F],typings:["none"]}}))}mapInlineParam(Y,{escapeString:Z}){if(Y===null)return"null";if(typeof Y==="number"||typeof Y==="boolean"||typeof Y==="bigint")return Y.toString();if(typeof Y==="string")return Z(Y);if(typeof Y==="object"){let $=Y.toString();if($==="[object Object]")return Z(JSON.stringify(Y));return Z($)}throw Error("Unexpected param value: "+Y)}getSQL(){return this}as(Y){if(Y===void 0)return this;return new X.Aliased(this,Y)}mapWith(Y){return this.decoder=typeof Y==="function"?{mapFromDriverValue:Y}:Y,this}inlineParams(){return this.shouldInlineParams=!0,this}if(Y){return Y?this:void 0}},S1=class{static[J]="Name";brand;constructor(X){this.value=X}getSQL(){return new x([this])}};function $0(X){return new S1(X)}function PX(X){return typeof X==="object"&&X!==null&&"mapToDriverValue"in X&&typeof X.mapToDriverValue==="function"}var C1={mapFromDriverValue:(X)=>X},LX={mapToDriverValue:(X)=>X},G0={...C1,...LX},g=class{static[J]="Param";brand;constructor(X,Y=LX){this.value=X,this.encoder=Y}getSQL(){return new x([this])}};function W0(X,Y){return new g(X,Y)}function W(X,...Y){let Z=[];if(Y.length>0||X.length>0&&X[0]!=="")Z.push(new h(X[0]));for(let[$,G]of Y.entries())Z.push(G,new h(X[$+1]));return new x(Z)}(function(X){function Y(){return new x([])}X.empty=Y;function Z(O){return new x(O)}X.fromList=Z;function $(O){return new x([new h(O)])}X.raw=$;function G(O,E){let U=[];for(let[F,M]of O.entries()){if(F>0&&E!==void 0)U.push(E);U.push(M)}return new x(U)}X.join=G;function H(O){return new S1(O)}X.identifier=H;function _(O){return new l(O)}X.placeholder=_;function z(O,E){return new g(O,E)}X.param=z})(W||(W={}));(function(X){class Y{static[J]="SQL.Aliased";isSelectionField=!1;origin;constructor(Z,$){this.sql=Z,this.fieldAlias=$}getSQL(){return this.sql}clone(){return new Y(this.sql,this.fieldAlias)}}X.Aliased=Y})(x||(x={}));var l=class{static[J]="Placeholder";constructor(X){this.name=X}getSQL(){return new x([this])}};function J0(X){return new l(X)}function D1(X,Y){return X.map((Z)=>{if(D(Z,l)){if(!(Z.name in Y))throw Error(`No value for placeholder "${Z.name}" was provided`);return Y[Z.name]}if(D(Z,g)&&D(Z.value,l)){if(!(Z.value.name in Y))throw Error(`No value for placeholder "${Z.value.name}" was provided`);return Z.encoder.mapToDriverValue(Y[Z.value.name])}return Z})}var _Y=Symbol.for("drizzle:IsDrizzleView"),y=class{static[J]="View";[Q];[_Y]=!0;get[r](){return this[Q].name}get[G1](){return this[Q].schema}get[_1](){return this[Q].isAlias}get[U1](){return this[Q].originalName}get[n](){return this[Q].selectedFields}constructor({name:X,schema:Y,selectedFields:Z,query:$}){this[Q]={name:X,originalName:X,schema:Y,selectedFields:Z,query:$,isExisting:!$,isAlias:!1}}};function H0(X){return typeof X==="object"&&X!==null&&_Y in X}function _0(X){return X[Q].name}N.prototype.getSQL=function(){return new x([this])};T.prototype.getSQL=function(){return new x([this])};function BX(X,Y,Z){let $={},G=X.reduce((H,{path:_,field:z},O)=>{let E;if(D(z,N))E=z;else if(D(z,x))E=z.decoder;else if(D(z,T))E=z._.sql.decoder;else E=z.sql.decoder;let U=H;for(let[F,M]of _.entries())if(F<_.length-1){if(!(M in U))U[M]={};U=U[M]}else{let I=Y[O],L=U[M]=I===null?null:E.mapFromDriverValue(I);if(Z&&D(z,N)&&_.length===2){let P=_[0];if(!(P in $))$[P]=L===null?z1(z.table):!1;else if(typeof $[P]==="string"&&$[P]!==z1(z.table))$[P]=!1}}return H},{});if(Z&&Object.keys($).length>0){for(let[H,_]of Object.entries($))if(typeof _==="string"&&!Z[_])G[H]=null}return G}function i(X,Y){return Object.entries(X).reduce((Z,[$,G])=>{if(typeof $!=="string")return Z;let H=Y?[...Y,$]:[$];if(D(G,N)||D(G,x)||D(G,x.Aliased)||D(G,T))Z.push({path:H,field:G});else if(D(G,A))Z.push(...i(G[A.Symbol.Columns],H));else Z.push(...i(G,H));return Z},[])}function q1(X,Y){let Z=Object.keys(X),$=Object.keys(Y);if(Z.length!==$.length)return!1;for(let[G,H]of Z.entries())if(H!==$[G])return!1;return!0}function JX(X,Y){let Z=Object.entries(Y).filter(([,$])=>$!==void 0).map(([$,G])=>{if(D(G,x)||D(G,N))return[$,G];else return[$,new g(G,X[A.Symbol.Columns][$])]});if(Z.length===0)throw Error("No values to set");return Object.fromEntries(Z)}function zY(X,Y){for(let Z of Y)for(let $ of Object.getOwnPropertyNames(Z.prototype)){if($==="constructor")continue;Object.defineProperty(X.prototype,$,Object.getOwnPropertyDescriptor(Z.prototype,$)||Object.create(null))}}function EY(X){return X[A.Symbol.Columns]}function v1(X){return D(X,T)?X._.alias:D(X,y)?X[Q].name:D(X,x)?void 0:X[A.Symbol.IsAlias]?X[A.Symbol.Name]:X[A.Symbol.BaseName]}function k(X,Y){return{name:typeof X==="string"&&X.length>0?X:"",config:typeof X==="object"?X:Y}}var jX=typeof TextDecoder>"u"?null:new TextDecoder;var D3={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:16777215,INT32_MIN:-2147483648,INT32_MAX:2147483647,INT32_UNSIGNED_MAX:4294967295,INT48_MIN:-140737488355328,INT48_MAX:140737488355327,INT48_UNSIGNED_MAX:281474976710655,INT64_MIN:-9223372036854775808n,INT64_MAX:9223372036854775807n,INT64_UNSIGNED_MAX:18446744073709551615n};var z0=class{static[J]="ConsoleLogWriter";write(X){console.log(X)}},DY=class{static[J]="DefaultLogger";writer;constructor(X){this.writer=X?.writer??new z0}logQuery(X,Y){let Z=Y.map((G)=>{try{return JSON.stringify(G)}catch{return String(G)}}),$=Z.length?` -- params: [${Z.join(", ")}]`:"";this.writer.write(`Query: ${X}${$}`)}},OY=class{static[J]="NoopLogger";logQuery(){}};var FY=class{static[J]="ColumnBuilder";config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}};var HX=class{static[J]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X,this}onDelete(X){return this._onDelete=X,this}build(X){return new UY(X,this)}},UY=class{static[J]="SQLiteForeignKey";reference;onUpdate;onDelete;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[r],...$,Z[0].table[r],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};function E0(X){function Y(){if(typeof X==="function"){let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignColumns:G}}return X}return new HX(Y)}var f=class extends FY{static[J]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,actions:Y}),this}unique(X){return this.config.isUnique=!0,this.config.uniqueName=X,this}generatedAlwaysAs(X,Y){return this.config.generated={as:X,type:"always",mode:Y?.mode??"virtual"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,actions:$})=>{return((G,H)=>{let _=new HX(()=>{let z=G();return{columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)})(Z,$)})}},S=class extends N{static[J]="SQLiteColumn";table;constructor(X,Y){super(X,Y);this.table=X}};var _X=class extends f{static[J]="SQLiteBaseIntegerBuilder";constructor(X,Y,Z){super(X,Y,Z);this.config.autoIncrement=!1}primaryKey(X){if(X?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}},zX=class extends S{static[J]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}},AY=class extends _X{static[J]="SQLiteIntegerBuilder";constructor(X){super(X,"number int53","SQLiteInteger")}build(X){return new VY(X,this.config)}},VY=class extends zX{static[J]="SQLiteInteger"},IY=class extends _X{static[J]="SQLiteTimestampBuilder";constructor(X,Y){super(X,"object date","SQLiteTimestamp");this.config.mode=Y}defaultNow(){return this.default(W`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(X){return new MY(X,this.config)}},MY=class extends zX{static[J]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(X){if(typeof X==="string")return new Date(X.replaceAll('"',""));if(this.config.mode==="timestamp")return new Date(X*1000);return new Date(X)}mapToDriverValue(X){if(typeof X==="number")return X;let Y=X.getTime();if(this.config.mode==="timestamp")return Math.floor(Y/1000);return Y}},xY=class extends _X{static[J]="SQLiteBooleanBuilder";constructor(X,Y){super(X,"boolean","SQLiteBoolean");this.config.mode=Y}build(X){return new KY(X,this.config)}},KY=class extends zX{static[J]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(X){return Number(X)===1}mapToDriverValue(X){return X?1:0}};function TX(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="timestamp"||$?.mode==="timestamp_ms")return new IY(Z,$.mode);if($?.mode==="boolean")return new xY(Z,$.mode);return new AY(Z)}var kY=class extends f{static[J]="SQLiteTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","SQLiteText");this.config.enumValues=Y.enum,this.config.length=Y.length}build(X){return new NY(X,this.config)}},NY=class extends S{static[J]="SQLiteText";enumValues=this.config.enumValues;constructor(X,Y){super(X,Y)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}},RY=class extends f{static[J]="SQLiteTextJsonBuilder";constructor(X){super(X,"object json","SQLiteTextJson")}build(X){return new wY(X,this.config)}},wY=class extends S{static[J]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(X){return JSON.parse(X)}mapToDriverValue(X){return JSON.stringify(X)}};function SX(X,Y={}){let{name:Z,config:$}=k(X,Y);if($.mode==="json")return new RY(Z);return new kY(Z,$)}var QY=class{static[J]="SQLiteIndexBuilderOn";constructor(X,Y){this.name=X,this.unique=Y}on(...X){return new PY(this.name,X,this.unique)}},PY=class{static[J]="SQLiteIndexBuilder";config;constructor(X,Y,Z){this.config={name:X,columns:Y,unique:Z,where:void 0}}where(X){return this.config.where=X,this}build(X){return new LY(this.config,X)}},LY=class{static[J]="SQLiteIndex";config;isNameExplicit;constructor(X,Y){this.config={...X,table:Y},this.isNameExplicit=!!X.name}};function D0(X){return new QY(X,!1)}function BY(X){let Y="";for(let Z=0;Z<X.length;Z+=2){let $=X.slice(Z,Z+2),G=Number.parseInt($,16);Y+=String.fromCodePoint(G)}return Y}var O0=class extends f{static[J]="SQLiteBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteBigInt")}build(X){return new F0(X,this.config)}},F0=class extends S{static[J]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return BigInt(BY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return BigInt(Y.toString("utf8"))}return BigInt(jX.decode(X))}mapToDriverValue(X){return Buffer.from(X.toString())}},U0=class extends f{static[J]="SQLiteBlobJsonBuilder";constructor(X){super(X,"object json","SQLiteBlobJson")}build(X){return new A0(X,this.config)}},A0=class extends S{static[J]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(X){if(typeof X==="string")return JSON.parse(BY(X));if(typeof Buffer<"u"&&Buffer.from){let Y=Buffer.isBuffer(X)?X:X instanceof ArrayBuffer?Buffer.from(X):X.buffer?Buffer.from(X.buffer,X.byteOffset,X.byteLength):Buffer.from(X);return JSON.parse(Y.toString("utf8"))}return JSON.parse(jX.decode(X))}mapToDriverValue(X){return Buffer.from(JSON.stringify(X))}},V0=class extends f{static[J]="SQLiteBlobBufferBuilder";constructor(X){super(X,"object buffer","SQLiteBlobBuffer")}build(X){return new I0(X,this.config)}},I0=class extends S{static[J]="SQLiteBlobBuffer";mapFromDriverValue(X){if(Buffer.isBuffer(X))return X;if(typeof X==="string")return Buffer.from(X,"hex");return Buffer.from(X)}getSQLType(){return"blob"}};function jY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="json")return new U0(Z);if($?.mode==="bigint")return new O0(Z);return new V0(Z)}var M0=class extends f{static[J]="SQLiteCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","SQLiteCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new x0(X,this.config)}},x0=class extends S{static[J]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y);let Z=this.getSQLType().toLowerCase(),$=Z.indexOf("(");switch($+1?Z.slice(0,$):Z){case"numeric":case"decimal":case"bigint":return Y`cast(${X} as text)`;case"blob":return Y`hex(${X})`;default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function TY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new M0($,G,X)}}var K0=class extends f{static[J]="SQLiteNumericBuilder";constructor(X){super(X,"string numeric","SQLiteNumeric")}build(X){return new k0(X,this.config)}},k0=class extends S{static[J]="SQLiteNumeric";mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){return"numeric"}},N0=class extends f{static[J]="SQLiteNumericNumberBuilder";constructor(X){super(X,"number","SQLiteNumericNumber")}build(X){return new R0(X,this.config)}},R0=class extends S{static[J]="SQLiteNumericNumber";mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue=String;getSQLType(){return"numeric"}},w0=class extends f{static[J]="SQLiteNumericBigIntBuilder";constructor(X){super(X,"bigint int64","SQLiteNumericBigInt")}build(X){return new Q0(X,this.config)}},Q0=class extends S{static[J]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}};function SY(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new N0(Z):G==="bigint"?new w0(Z):new K0(Z)}var P0=class extends f{static[J]="SQLiteRealBuilder";constructor(X){super(X,"number double","SQLiteReal")}build(X){return new L0(X,this.config)}},L0=class extends S{static[J]="SQLiteReal";getSQLType(){return"real"}};function CY(X){return new P0(X??"")}function qY(){return{blob:jY,customType:TY,integer:TX,numeric:SY,real:CY,text:SX}}var EX=Symbol.for("drizzle:SQLiteInlineForeignKeys"),v=class extends A{static[J]="SQLiteTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:EX});[A.Symbol.Columns];[EX]=[];[A.Symbol.ExtraConfigBuilder]=void 0};function B0(X,Y,Z,$,G=X){let H=new v(X,$,G),_=typeof Y==="function"?Y(qY()):Y,z=Object.fromEntries(Object.entries(_).map(([E,U])=>{let F=U;F.setName(E);let M=F.build(H);return H[EX].push(...F.buildForeignKeys(M,H)),[E,M]})),O=Object.assign(H,z);if(O[A.Symbol.Columns]=z,O[A.Symbol.ExtraConfigColumns]=z,Z)O[v.Symbol.ExtraConfigBuilder]=Z;return O}var j0=(X,Y,Z)=>{return B0(X,Y,Z)};function T0(...X){if(X[0].columns)return new CX(X[0].columns,X[0].name);return new CX(X)}var CX=class{static[J]="SQLitePrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new vY(X,this.columns,this.name)}},vY=class{static[J]="SQLitePrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[v.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};function q(X,Y){if(PX(Y)&&!E1(X)&&!D(X,g)&&!D(X,l)&&!D(X,N)&&!D(X,A)&&!D(X,y))return new g(X,Y);return X}var a=(X,Y)=>{return W`${X} = ${q(Y,X)}`},h1=(X,Y)=>{return W`${X} <> ${q(Y,X)}`};function m(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new h("("),W.join(Y,new h(" and ")),new h(")")])}function V1(...X){let Y=X.filter((Z)=>Z!==void 0);if(Y.length===0)return;if(Y.length===1)return new x(Y);return new x([new h("("),W.join(Y,new h(" or ")),new h(")")])}function I1(X){return W`not ${X}`}var p1=(X,Y)=>{return W`${X} > ${q(Y,X)}`},y1=(X,Y)=>{return W`${X} >= ${q(Y,X)}`},f1=(X,Y)=>{return W`${X} < ${q(Y,X)}`},b1=(X,Y)=>{return W`${X} <= ${q(Y,X)}`};function d1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`false`;return W`${X} in ${Y.map((Z)=>q(Z,X))}`}return W`${X} in ${q(Y,X)}`}function g1(X,Y){if(Array.isArray(Y)){if(Y.length===0)return W`true`;return W`${X} not in ${Y.map((Z)=>q(Z,X))}`}return W`${X} not in ${q(Y,X)}`}function m1(X){return W`(${X} is null)`}function c1(X){return W`(${X} is not null)`}function k1(X){return W`exists ${X}`}function N1(X){return W`not exists ${X}`}function u1(X,Y,Z){return W`${X} between ${q(Y,X)} and ${q(Z,X)}`}function r1(X,Y,Z){return W`${X} not between ${q(Y,X)} and ${q(Z,X)}`}function o1(X,Y){return W`${X} like ${Y}`}function s1(X,Y){return W`${X} not like ${Y}`}function t1(X,Y){return W`${X} ilike ${Y}`}function n1(X,Y){return W`${X} not ilike ${Y}`}function qX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContains requires at least one value");let Z=q(Y,X);return W`${X} @> ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} @> ${q(Y,X)}`}function vX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayContained requires at least one value");let Z=q(Y,X);return W`${X} <@ ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} <@ ${q(Y,X)}`}function hX(X,Y){if(Array.isArray(Y)){if(Y.length===0)throw Error("arrayOverlaps requires at least one value");let Z=q(Y,X);return W`${X} && ${W`${Array.isArray(Z)?new g(Z):Z}`}`}return W`${X} && ${q(Y,X)}`}function M1(X){return W`${X} asc`}function i1(X){return W`${X} desc`}function hY(X,Y,Z){for(let $=Y;$<X.length;$++){let G=X[$];if(G==="\\"){$++;continue}if(G==='"')return[X.slice(Y,$).replace(/\\/g,""),$+1];if(Z)continue;if(G===","||G==="}")return[X.slice(Y,$).replace(/\\/g,""),$]}return[X.slice(Y).replace(/\\/g,""),X.length]}function pY(X,Y=0){let Z=[],$=Y,G=!1;while($<X.length){let H=X[$];if(H===","){if(G||$===Y)Z.push("");G=!0,$++;continue}if(G=!1,H==="\\"){$+=2;continue}if(H==='"'){let[O,E]=hY(X,$+1,!0);Z.push(O),$=E;continue}if(H==="}")return[Z,$+1];if(H==="{"){let[O,E]=pY(X,$+1);Z.push(O),$=E;continue}let[_,z]=hY(X,$,!1);Z.push(_),$=z}return[Z,$]}function DX(X){let[Y]=pY(X,1);return Y}function pX(X){return`{${X.map((Y)=>{if(Array.isArray(Y))return pX(Y);if(typeof Y==="string")return`"${Y.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`;return`${Y}`}).join(",")}}`}var yY=class{static[J]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(X,Y){if(this.reference=()=>{let{name:Z,columns:$,foreignColumns:G}=X();return{name:Z,columns:$,foreignTable:G[0].table,foreignColumns:G}},Y)this._onUpdate=Y.onUpdate,this._onDelete=Y.onDelete}onUpdate(X){return this._onUpdate=X===void 0?"no action":X,this}onDelete(X){return this._onDelete=X===void 0?"no action":X,this}build(X){return new S0(X,this)}},S0=class{static[J]="PgForeignKey";reference;onUpdate;onDelete;name;constructor(X,Y){this.table=X,this.reference=Y.reference,this.onUpdate=Y._onUpdate,this.onDelete=Y._onDelete}getName(){let{name:X,columns:Y,foreignColumns:Z}=this.reference(),$=Y.map((_)=>_.name),G=Z.map((_)=>_.name),H=[this.table[r],...$,Z[0].table[r],...G];return X??`${H.join("_")}_fk`}isNameExplicit(){return!!this.reference().name}};var K=class{static[J]="PgColumnBuilder";foreignKeyConfigs=[];config;constructor(X,Y,Z){this.config={name:X,keyAsName:X==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:Y,columnType:Z,generated:void 0,defaultFn:void 0,onUpdateFn:void 0,generatedIdentity:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(X){return this.config.default=X,this.config.hasDefault=!0,this}$defaultFn(X){return this.config.defaultFn=X,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(X){return this.config.onUpdateFn=X,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(X){if(this.config.name!=="")return;this.config.name=X}array(X){let Y=X??"[]";return this.config.dimensions=Y.length/2,this}references(X,Y={}){return this.foreignKeyConfigs.push({ref:X,config:Y}),this}unique(X,Y){return this.config.isUnique=!0,this.config.uniqueName=X,this.config.uniqueType=Y?.nulls,this}generatedAlwaysAs(X){return this.config.generated={as:X,type:"always",mode:"stored"},this}buildForeignKeys(X,Y){return this.foreignKeyConfigs.map(({ref:Z,config:$})=>{return JY((G,H)=>{let _=new yY(()=>{let z=G();return{name:H.name,columns:[X],foreignColumns:[z]}});if(H.onUpdate)_.onUpdate(H.onUpdate);if(H.onDelete)_.onDelete(H.onDelete);return _.build(Y)},Z,$)})}buildExtraConfigColumn(X){return new C0(X,{...this.config,dimensions:this.config.dimensions??0})}},V=class extends N{static[J]="PgColumn";table;dimensions;constructor(X,Y){super(X,Y);if(this.table=X,this.dimensions=Y.dimensions??0,this.dimensions){let Z=this.mapFromDriverValue.bind(this),$=this.mapToDriverValue.bind(this);this.mapFromDriverValue=(G)=>{if(G===null)return G;let H=typeof G==="string"?DX(G):G;return this.mapArrayElements(H,Z,this.dimensions)},this.mapToDriverValue=(G)=>{if(G===null)return G;return pX(this.mapArrayElements(G,$,this.dimensions))}}}mapArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapArrayElements($,Y,Z-1));return Y(X)}},C0=class extends V{static[J]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(X){return this.indexConfig.opClass=X,this}};var O1=class extends K{static[J]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"always",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(X){if(X){let{name:Y,...Z}=X;this.config.generatedIdentity={type:"byDefault",sequenceName:Y,sequenceOptions:Z}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}};var q0=class extends O1{static[J]="PgBigInt53Builder";constructor(X){super(X,"number int53","PgBigInt53")}build(X){return new v0(X,this.config)}},v0=class extends V{static[J]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},h0=class extends O1{static[J]="PgBigInt64Builder";constructor(X){super(X,"bigint int64","PgBigInt64")}build(X){return new p0(X,this.config)}},p0=class extends V{static[J]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(X){return BigInt(X)}},y0=class extends O1{static[J]="PgBigIntStringBuilder";constructor(X){super(X,"string int64","PgBigIntString")}build(X){return new f0(X,this.config)}},f0=class extends V{static[J]="PgBigIntString";getSQLType(){return"bigint"}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}};function fY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new q0(Z);if($.mode==="string")return new y0(Z);return new h0(Z)}var b0=class extends K{static[J]="PgBigSerial53Builder";constructor(X){super(X,"number int53","PgBigSerial53");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new d0(X,this.config)}},d0=class extends V{static[J]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}},g0=class extends K{static[J]="PgBigSerial64Builder";constructor(X){super(X,"bigint int64","PgBigSerial64");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new m0(X,this.config)}},m0=class extends V{static[J]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(X){return BigInt(X)}};function bY(X,Y){let{name:Z,config:$}=k(X,Y);if($.mode==="number")return new b0(Z);return new g0(Z)}var c0=class extends K{static[J]="PgBooleanBuilder";constructor(X){super(X,"boolean","PgBoolean")}build(X){return new u0(X,this.config)}},u0=class extends V{static[J]="PgBoolean";getSQLType(){return"boolean"}};function dY(X){return new c0(X??"")}var r0=class extends K{static[J]="PgCharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgChar");this.config.length=Y.length??1,this.config.setLength=Y.length!==void 0,this.config.enumValues=Y.enum}build(X){return new o0(X,this.config)}},o0=class extends V{static[J]="PgChar";enumValues;setLength;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues,this.setLength=Y.setLength}getSQLType(){return this.setLength?`char(${this.length})`:"char"}};function gY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new r0(Z,$)}var s0=class extends K{static[J]="PgCidrBuilder";constructor(X){super(X,"string cidr","PgCidr")}build(X){return new t0(X,this.config)}},t0=class extends V{static[J]="PgCidr";getSQLType(){return"cidr"}};function mY(X){return new s0(X??"")}var n0=class extends K{static[J]="PgCustomColumnBuilder";constructor(X,Y,Z){super(X,"custom","PgCustomColumn");this.config.fieldConfig=Y,this.config.customTypeParams=Z}build(X){return new i0(X,this.config)}},i0=class extends V{static[J]="PgCustomColumn";sqlName;mapTo;mapFrom;mapJson;forJsonSelect;constructor(X,Y){super(X,Y);if(this.sqlName=Y.customTypeParams.dataType(Y.fieldConfig),this.mapTo=Y.customTypeParams.toDriver,this.mapFrom=Y.customTypeParams.fromDriver,this.mapJson=Y.customTypeParams.fromJson,this.forJsonSelect=Y.customTypeParams.forJsonSelect,this.dimensions){let Z=($)=>{if(typeof this.mapJson==="function")return this.mapJson($);if(typeof this.mapFrom==="function")return this.mapFrom($);return $};this.mapFromJsonValue=($)=>{if($===null)return $;let G=typeof $==="string"?DX($):$;return this.mapJsonArrayElements(G,Z,this.dimensions)}}}mapJsonArrayElements(X,Y,Z){if(Z>0&&Array.isArray(X))return X.map(($)=>$===null?null:this.mapJsonArrayElements($,Y,Z-1));return Y(X)}getSQLType(){return this.sqlName}mapFromDriverValue(X){return typeof this.mapFrom==="function"?this.mapFrom(X):X}mapFromJsonValue(X){return typeof this.mapJson==="function"?this.mapJson(X):this.mapFromDriverValue(X)}jsonSelectIdentifier(X,Y,Z){if(typeof this.forJsonSelect==="function")return this.forJsonSelect(X,Y,Z);let $=this.getSQLType().toLowerCase(),G=$.indexOf("(");switch(G+1?$.slice(0,G):$){case"bytea":case"geometry":case"timestamp":case"numeric":case"bigint":{let H="[]".repeat(Z??0);return Y`${X}::text${Y.raw(H).if(Z)}`}default:return X}}mapToDriverValue(X){return typeof this.mapTo==="function"?this.mapTo(X):X}};function cY(X){return(Y,Z)=>{let{name:$,config:G}=k(Y,Z);return new n0($,G,X)}}var F1=class extends K{static[J]="PgDateColumnBaseBuilder";defaultNow(){return this.default(W`now()`)}};var l0=class extends F1{static[J]="PgDateBuilder";constructor(X){super(X,"object date","PgDate")}build(X){return new a0(X,this.config)}},a0=class extends V{static[J]="PgDate";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return new Date(X);return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},e0=class extends F1{static[J]="PgDateStringBuilder";constructor(X){super(X,"string date","PgDateString")}build(X){return new X8(X,this.config)}},X8=class extends V{static[J]="PgDateString";getSQLType(){return"date"}mapFromDriverValue(X){if(typeof X==="string")return X;return X.toISOString().slice(0,-14)}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function uY(X,Y){let{name:Z,config:$}=k(X,Y);if($?.mode==="date")return new l0(Z);return new e0(Z)}var Y8=class extends K{static[J]="PgDoublePrecisionBuilder";constructor(X){super(X,"number double","PgDoublePrecision")}build(X){return new Z8(X,this.config)}},Z8=class extends V{static[J]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function rY(X){return new Y8(X??"")}var $8=class extends K{static[J]="PgInetBuilder";constructor(X){super(X,"string inet","PgInet")}build(X){return new G8(X,this.config)}},G8=class extends V{static[J]="PgInet";getSQLType(){return"inet"}};function oY(X){return new $8(X??"")}var W8=class extends O1{static[J]="PgIntegerBuilder";constructor(X){super(X,"number int32","PgInteger")}build(X){return new J8(X,this.config)}},J8=class extends V{static[J]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseInt(X);return X}};function sY(X){return new W8(X??"")}var H8=class extends K{static[J]="PgIntervalBuilder";constructor(X,Y){super(X,"string interval","PgInterval");this.config.intervalConfig=Y}build(X){return new _8(X,this.config)}},_8=class extends V{static[J]="PgInterval";fields;precision;constructor(X,Y){super(X,Y);this.fields=Y.intervalConfig.fields,this.precision=Y.intervalConfig.precision}getSQLType(){return`interval${this.fields?` ${this.fields}`:""}${this.precision?`(${this.precision})`:""}`}};function tY(X,Y={}){let{name:Z,config:$}=k(X,Y);return new H8(Z,$)}var z8=class extends K{static[J]="PgJsonBuilder";constructor(X){super(X,"object json","PgJson")}build(X){return new E8(X,this.config)}},E8=class extends V{static[J]="PgJson";constructor(X,Y){super(X,Y)}getSQLType(){return"json"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function nY(X){return new z8(X??"")}var D8=class extends K{static[J]="PgJsonbBuilder";constructor(X){super(X,"object json","PgJsonb")}build(X){return new O8(X,this.config)}},O8=class extends V{static[J]="PgJsonb";constructor(X,Y){super(X,Y)}getSQLType(){return"jsonb"}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){if(typeof X==="string")try{return JSON.parse(X)}catch{return X}return X}};function iY(X){return new D8(X??"")}var F8=class extends K{static[J]="PgLineBuilder";constructor(X){super(X,"array line","PgLine")}build(X){return new U8(X,this.config)}},U8=class extends V{static[J]="PgLine";mode="tuple";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z),Number.parseFloat($)]}mapToDriverValue(X){return`{${X[0]},${X[1]},${X[2]}}`}},A8=class extends K{static[J]="PgLineABCBuilder";constructor(X){super(X,"object line","PgLineABC")}build(X){return new V8(X,this.config)}},V8=class extends V{static[J]="PgLineABC";mode="abc";getSQLType(){return"line"}mapFromDriverValue(X){let[Y,Z,$]=X.slice(1,-1).split(",");return{a:Number.parseFloat(Y),b:Number.parseFloat(Z),c:Number.parseFloat($)}}mapToDriverValue(X){return`{${X.a},${X.b},${X.c}}`}};function lY(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new F8(Z);return new A8(Z)}var I8=class extends K{static[J]="PgMacaddrBuilder";constructor(X){super(X,"string macaddr","PgMacaddr")}build(X){return new M8(X,this.config)}},M8=class extends V{static[J]="PgMacaddr";getSQLType(){return"macaddr"}};function aY(X){return new I8(X??"")}var x8=class extends K{static[J]="PgMacaddr8Builder";constructor(X){super(X,"string macaddr8","PgMacaddr8")}build(X){return new K8(X,this.config)}},K8=class extends V{static[J]="PgMacaddr8";getSQLType(){return"macaddr8"}};function eY(X){return new x8(X??"")}var k8=class extends K{static[J]="PgNumericBuilder";constructor(X,Y,Z){super(X,"string numeric","PgNumeric");this.config.precision=Y,this.config.scale=Z}build(X){return new N8(X,this.config)}},N8=class extends V{static[J]="PgNumeric";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="string")return X;return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},R8=class extends K{static[J]="PgNumericNumberBuilder";constructor(X,Y,Z){super(X,"number","PgNumericNumber");this.config.precision=Y,this.config.scale=Z}build(X){return new w8(X,this.config)}},w8=class extends V{static[J]="PgNumericNumber";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){if(typeof X==="number")return X;return Number(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}},Q8=class extends K{static[J]="PgNumericBigIntBuilder";constructor(X,Y,Z){super(X,"bigint int64","PgNumericBigInt");this.config.precision=Y,this.config.scale=Z}build(X){return new P8(X,this.config)}},P8=class extends V{static[J]="PgNumericBigInt";precision;scale;constructor(X,Y){super(X,Y);this.precision=Y.precision,this.scale=Y.scale}mapFromDriverValue(X){return BigInt(X)}mapToDriverValue(X){return String(X)}getSQLType(){if(this.precision!==void 0&&this.scale!==void 0)return`numeric(${this.precision}, ${this.scale})`;else if(this.precision===void 0)return"numeric";else return`numeric(${this.precision})`}};function XZ(X,Y){let{name:Z,config:$}=k(X,Y),G=$?.mode;return G==="number"?new R8(Z,$?.precision,$?.scale):G==="bigint"?new Q8(Z,$?.precision,$?.scale):new k8(Z,$?.precision,$?.scale)}var L8=class extends K{static[J]="PgPointTupleBuilder";constructor(X){super(X,"array point","PgPointTuple")}build(X){return new B8(X,this.config)}},B8=class extends V{static[J]="PgPointTuple";mode="tuple";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return[Number.parseFloat(Y),Number.parseFloat(Z)]}return[X.x,X.y]}mapToDriverValue(X){return`(${X[0]},${X[1]})`}},j8=class extends K{static[J]="PgPointObjectBuilder";constructor(X){super(X,"object point","PgPointObject")}build(X){return new T8(X,this.config)}},T8=class extends V{static[J]="PgPointObject";mode="xy";getSQLType(){return"point"}mapFromDriverValue(X){if(typeof X==="string"){let[Y,Z]=X.slice(1,-1).split(",");return{x:Number.parseFloat(Y),y:Number.parseFloat(Z)}}return X}mapToDriverValue(X){return`(${X.x},${X.y})`}};function YZ(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new L8(Z);return new j8(Z)}function S8(X){let Y=[];for(let Z=0;Z<X.length;Z+=2)Y.push(Number.parseInt(X.slice(Z,Z+2),16));return new Uint8Array(Y)}function ZZ(X,Y){let $=new DataView(new ArrayBuffer(8));for(let G=0;G<8;G++)$.setUint8(G,X[Y+G]);return $.getFloat64(0,!0)}function yX(X){let Y=S8(X),Z=0,$=Y[Z];Z+=1;let G=new DataView(Y.buffer),H=G.getUint32(Z,$===1);Z+=4;let _;if(H&536870912)_=G.getUint32(Z,$===1),Z+=4;if((H&65535)===1){let z=ZZ(Y,Z);Z+=8;let O=ZZ(Y,Z);return Z+=8,{srid:_,point:[z,O]}}throw Error("Unsupported geometry type")}var C8=class extends K{static[J]="PgGeometryBuilder";constructor(X,Y){super(X,"array geometry","PgGeometry");this.config.srid=Y}build(X){return new q8(X,this.config)}},q8=class extends V{static[J]="PgGeometry";srid=this.config.srid;mode="tuple";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){if(typeof X!=="string")return X;return yX(X).point}mapToDriverValue(X){return`point(${X[0]} ${X[1]})`}},v8=class extends K{static[J]="PgGeometryObjectBuilder";constructor(X,Y){super(X,"object geometry","PgGeometryObject");this.config.srid=Y}build(X){return new h8(X,this.config)}},h8=class extends V{static[J]="PgGeometryObject";srid=this.config.srid;mode="object";getSQLType(){return`geometry(point${this.srid===void 0?"":`,${this.srid}`})`}mapFromDriverValue(X){let Y=yX(X);return{x:Y.point[0],y:Y.point[1]}}mapToDriverValue(X){return`point(${X.x} ${X.y})`}};function $Z(X,Y){let{name:Z,config:$}=k(X,Y);if(!$?.mode||$.mode==="tuple")return new C8(Z,$?.srid);return new v8(Z,$?.srid)}var p8=class extends K{static[J]="PgRealBuilder";constructor(X,Y){super(X,"number float","PgReal");this.config.length=Y}build(X){return new y8(X,this.config)}},y8=class extends V{static[J]="PgReal";constructor(X,Y){super(X,Y)}getSQLType(){return"real"}mapFromDriverValue(X){if(typeof X==="string")return Number.parseFloat(X);return X}};function GZ(X){return new p8(X??"")}var f8=class extends K{static[J]="PgSerialBuilder";constructor(X){super(X,"number int32","PgSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new b8(X,this.config)}},b8=class extends V{static[J]="PgSerial";getSQLType(){return"serial"}};function WZ(X){return new f8(X??"")}var d8=class extends O1{static[J]="PgSmallIntBuilder";constructor(X){super(X,"number int16","PgSmallInt")}build(X){return new g8(X,this.config)}},g8=class extends V{static[J]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue(X){if(typeof X==="string")return Number(X);return X}};function JZ(X){return new d8(X??"")}var m8=class extends K{static[J]="PgSmallSerialBuilder";constructor(X){super(X,"number int16","PgSmallSerial");this.config.hasDefault=!0,this.config.notNull=!0}build(X){return new c8(X,this.config)}},c8=class extends V{static[J]="PgSmallSerial";getSQLType(){return"smallserial"}};function HZ(X){return new m8(X??"")}var u8=class extends K{static[J]="PgTextBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgText");this.config.enumValues=Y.enum}build(X){return new r8(X,this.config,this.config.enumValues)}},r8=class extends V{static[J]="PgText";enumValues;constructor(X,Y,Z){super(X,Y);this.enumValues=Z}getSQLType(){return"text"}};function _Z(X,Y={}){let{name:Z,config:$}=k(X,Y);return new u8(Z,$)}var o8=class extends F1{static[J]="PgTimeBuilder";constructor(X,Y,Z){super(X,"string time","PgTime");this.withTimezone=Y,this.precision=Z,this.config.withTimezone=Y,this.config.precision=Z}build(X){return new s8(X,this.config)}},s8=class extends V{static[J]="PgTime";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`time${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}};function zZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new o8(Z,$.withTimezone??!1,$.precision)}var t8=class extends F1{static[J]="PgTimestampBuilder";constructor(X,Y,Z){super(X,"object date","PgTimestamp");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new n8(X,this.config)}},n8=class extends V{static[J]="PgTimestamp";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":` (${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return new Date(this.withTimezone?X:X+"+0000");return X}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}},i8=class extends F1{static[J]="PgTimestampStringBuilder";constructor(X,Y,Z){super(X,"string timestamp","PgTimestampString");this.config.withTimezone=Y,this.config.precision=Z}build(X){return new l8(X,this.config)}},l8=class extends V{static[J]="PgTimestampString";withTimezone;precision;constructor(X,Y){super(X,Y);this.withTimezone=Y.withTimezone,this.precision=Y.precision}getSQLType(){return`timestamp${this.precision===void 0?"":`(${this.precision})`}${this.withTimezone?" with time zone":""}`}mapFromDriverValue(X){if(typeof X==="string")return X;let Y=X.toISOString().slice(0,-1).replace("T"," ");if(this.withTimezone)return`${Y}+00`;return Y}mapToDriverValue(X){if(typeof X==="string")return X;return X.toISOString()}};function EZ(X,Y={}){let{name:Z,config:$}=k(X,Y);if($?.mode==="string")return new i8(Z,$.withTimezone??!1,$.precision);return new t8(Z,$?.withTimezone??!1,$?.precision)}var a8=class extends K{static[J]="PgUUIDBuilder";constructor(X){super(X,"string uuid","PgUUID")}defaultRandom(){return this.default(W`gen_random_uuid()`)}build(X){return new e8(X,this.config)}},e8=class extends V{static[J]="PgUUID";getSQLType(){return"uuid"}};function DZ(X){return new a8(X??"")}var X2=class extends K{static[J]="PgVarcharBuilder";constructor(X,Y){super(X,Y.enum?.length?"string enum":"string","PgVarchar");this.config.length=Y.length,this.config.enumValues=Y.enum}build(X){return new Y2(X,this.config)}},Y2=class extends V{static[J]="PgVarchar";enumValues;constructor(X,Y){super(X,Y);this.enumValues=Y.enumValues}getSQLType(){return this.length===void 0?"varchar":`varchar(${this.length})`}};function OZ(X,Y={}){let{name:Z,config:$}=k(X,Y);return new X2(Z,$)}var Z2=class extends K{static[J]="PgBinaryVectorBuilder";constructor(X,Y){super(X,"string binary","PgBinaryVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new $2(X,this.config)}},$2=class extends V{static[J]="PgBinaryVector";getSQLType(){return`bit(${this.length})`}};function FZ(X,Y){let{name:Z,config:$}=k(X,Y);return new Z2(Z,$)}var G2=class extends K{static[J]="PgHalfVectorBuilder";constructor(X,Y){super(X,"array halfvector","PgHalfVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new W2(X,this.config)}},W2=class extends V{static[J]="PgHalfVector";getSQLType(){return`halfvec(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function UZ(X,Y){let{name:Z,config:$}=k(X,Y);return new G2(Z,$)}var J2=class extends K{static[J]="PgSparseVectorBuilder";constructor(X,Y){super(X,"string sparsevec","PgSparseVector");this.config.vectorDimensions=Y.dimensions}build(X){return new H2(X,this.config)}},H2=class extends V{static[J]="PgSparseVector";vectorDimensions=this.config.vectorDimensions;getSQLType(){return`sparsevec(${this.vectorDimensions})`}};function AZ(X,Y){let{name:Z,config:$}=k(X,Y);return new J2(Z,$)}var _2=class extends K{static[J]="PgVectorBuilder";constructor(X,Y){super(X,"array vector","PgVector");this.config.length=Y.dimensions,this.config.isLengthExact=!0}build(X){return new z2(X,this.config)}},z2=class extends V{static[J]="PgVector";getSQLType(){return`vector(${this.length})`}mapToDriverValue(X){return JSON.stringify(X)}mapFromDriverValue(X){return X.slice(1,-1).split(",").map((Y)=>Number.parseFloat(Y))}};function VZ(X,Y){let{name:Z,config:$}=k(X,Y);return new _2(Z,$)}function IZ(){return{bigint:fY,bigserial:bY,boolean:dY,char:gY,cidr:mY,customType:cY,date:uY,doublePrecision:rY,inet:oY,integer:sY,interval:tY,json:nY,jsonb:iY,line:lY,macaddr:aY,macaddr8:eY,numeric:XZ,point:YZ,geometry:$Z,real:GZ,serial:WZ,smallint:JZ,smallserial:HZ,text:_Z,time:zZ,timestamp:EZ,uuid:DZ,varchar:OZ,bit:FZ,halfvec:UZ,sparsevec:AZ,vector:VZ}}var fX=Symbol.for("drizzle:PgInlineForeignKeys"),bX=Symbol.for("drizzle:EnableRLS"),l1=class extends A{static[J]="PgTable";static Symbol=Object.assign({},A.Symbol,{InlineForeignKeys:fX,EnableRLS:bX});[fX]=[];[bX]=!1;[A.Symbol.ExtraConfigBuilder]=void 0;[A.Symbol.ExtraConfigColumns]={}};function MZ(X,Y,Z,$,G=X){let H=new l1(X,$,G),_=typeof Y==="function"?Y(IZ()):Y,z=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;M.setName(U);let I=M.build(H);return H[fX].push(...M.buildForeignKeys(I,H)),[U,I]})),O=Object.fromEntries(Object.entries(_).map(([U,F])=>{let M=F;return M.setName(U),[U,M.buildExtraConfigColumn(H)]})),E=Object.assign(H,z);if(E[A.Symbol.Columns]=z,E[A.Symbol.ExtraConfigColumns]=O,Z)E[l1.Symbol.ExtraConfigBuilder]=Z;return Object.assign(E,{enableRLS:()=>{return E[l1.Symbol.EnableRLS]=!0,E}})}var E2=(X,Y,Z)=>{return MZ(X,Y,Z,void 0)},D2=(X,Y,Z)=>{let $=MZ(X,Y,Z,void 0);return $[bX]=!0,$},GG=Object.assign(E2,{withRLS:D2});var xZ=class{static[J]="PgPrimaryKeyBuilder";columns;name;constructor(X,Y){this.columns=X,this.name=Y}build(X){return new O2(X,this.columns,this.name)}},O2=class{static[J]="PgPrimaryKey";columns;name;isNameExplicit;constructor(X,Y,Z){this.table=X,this.columns=Y,this.name=Z,this.isNameExplicit=!!Z}getName(){return this.name??`${this.table[l1.Symbol.Name]}_${this.columns.map((X)=>X.name).join("_")}_pk`}};var KZ=class{static[J]="Relation";referencedTableName;fieldName;constructor(X,Y,Z){this.sourceTable=X,this.referencedTable=Y,this.relationName=Z,this.referencedTableName=Y[A.Symbol.Name]}},F2=class{static[J]="Relations";constructor(X,Y){this.table=X,this.config=Y}},R1=class X extends KZ{static[J]="One";constructor(Y,Z,$,G){super(Y,Z,$?.relationName);this.config=$,this.isNullable=G}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config,this.isNullable);return Z.fieldName=Y,Z}},dX=class X extends KZ{static[J]="Many";constructor(Y,Z,$){super(Y,Z,$?.relationName);this.config=$}withFieldName(Y){let Z=new X(this.sourceTable,this.referencedTable,this.config);return Z.fieldName=Y,Z}};function kZ(){return{and:m,between:u1,eq:a,exists:k1,gt:p1,gte:y1,ilike:t1,inArray:d1,isNull:m1,isNotNull:c1,like:o1,lt:f1,lte:b1,ne:h1,not:I1,notBetween:r1,notExists:N1,notLike:s1,notIlike:n1,notInArray:g1,or:V1,sql:W}}function NZ(){return{sql:W,asc:M1,desc:i1}}function RZ(X,Y){if(Object.keys(X).length===1&&"default"in X&&!D(X.default,A))X=X.default;let Z={},$={},G={};for(let[H,_]of Object.entries(X))if(D(_,A)){let z=A1(_),O=$[z];Z[z]=H,G[H]={tsName:H,dbName:_[A.Symbol.Name],schema:_[A.Symbol.Schema],columns:_[A.Symbol.Columns],relations:O?.relations??{},primaryKey:O?.primaryKey??[]};for(let U of Object.values(_[A.Symbol.Columns]))if(U.primary)G[H].primaryKey.push(U);let E=_[A.Symbol.ExtraConfigBuilder]?.(_[A.Symbol.ExtraConfigColumns]);if(E){for(let U of Object.values(E))if(D(U,xZ))G[H].primaryKey.push(...U.columns)}}else if(D(_,F2)){let z=A1(_.table),O=Z[z],E=_.config(Y(_.table));for(let[U,F]of Object.entries(E))if(O){let M=G[O];M.relations[U]=F}else{if(!(z in $))$[z]={relations:{}};$[z].relations[U]=F}}return{tables:G,tableNamesMap:Z}}function U2(X){return function(Z,$){return new R1(X,Z,$,$?.fields.reduce((G,H)=>G&&H.notNull,!0)??!1)}}function A2(X){return function(Z,$){return new dX(X,Z,$)}}function wZ(X,Y,Z){if(D(Z,R1)&&Z.config)return{fields:Z.config.fields,references:Z.config.references};let $=Y[A1(Z.referencedTable)];if(!$)throw Error(`Table "${Z.referencedTable[A.Symbol.Name]}" not found in schema`);let G=X[$];if(!G)throw Error(`Table "${$}" not found in schema`);let H=Z.sourceTable,_=Y[A1(H)];if(!_)throw Error(`Table "${H[A.Symbol.Name]}" not found in schema`);let z=[];for(let O of Object.values(G.relations))if(Z.relationName&&Z!==O&&O.relationName===Z.relationName||!Z.relationName&&O.referencedTable===Z.sourceTable)z.push(O);if(z.length>1)throw Z.relationName?Error(`There are multiple relations with name "${Z.relationName}" in table "${$}"`):Error(`There are multiple relations between "${$}" and "${Z.sourceTable[A.Symbol.Name]}". Please specify relation name`);if(z[0]&&D(z[0],R1)&&z[0].config)return{fields:z[0].config.references,references:z[0].config.fields};throw Error(`There is not enough information to infer relation "${_}.${Z.fieldName}"`)}function QZ(X){return{one:U2(X),many:A2(X)}}function OX(X,Y,Z,$,G=(H)=>H){let H={};for(let[_,z]of $.entries())if(z.isJson){let O=Y.relations[z.tsKey],E=Z[_],U=typeof E==="string"?JSON.parse(E):E;H[z.tsKey]=D(O,R1)?U&&OX(X,X[z.relationTableTsKey],U,z.selection,G):U.map((F)=>OX(X,X[z.relationTableTsKey],F,z.selection,G))}else{let O=G(Z[_]),E=z.field,U;if(D(E,N))U=E;else if(D(E,x))U=E.decoder;else U=E.sql.decoder;H[z.tsKey]=O===null?null:U.mapFromDriverValue(O)}return H}var c=class{static[J]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(X){return this.then(void 0,X)}finally(X){return this.then((Y)=>{return X?.(),Y},(Y)=>{throw X?.(),Y})}then(X,Y){return this.execute().then(X,Y)}};var LZ=class{static[J]="SQLiteAsyncRelationalQueryBuilder";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.fullSchema=Y,this.schema=Z,this.tableNamesMap=$,this.table=G,this.tableConfig=H,this.dialect=_,this.session=z}findMany(X){return this.mode==="sync"?new PZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many"):new mX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?X:{},"many")}findFirst(X){return this.mode==="sync"?new PZ(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first"):new mX(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,X?{...X,limit:1}:{limit:1},"first")}},mX=class extends c{static[J]="SQLiteAsyncRelationalQuery";mode;constructor(X,Y,Z,$,G,H,_,z,O){super();this.fullSchema=X,this.schema=Y,this.tableNamesMap=Z,this.table=$,this.tableConfig=G,this.dialect=H,this.session=_,this.config=z,this.mode=O}getSQL(){return this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(X=!1){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeQuery":"prepareQuery"](Z,void 0,this.mode==="first"?"get":"all",!0,($,G)=>{let H=$.map((_)=>OX(this.schema,this.tableConfig,_,Y.selection,G));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_toSQL(){let X=this.dialect._buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName});return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare(!1).get();return this._prepare(!1).all()}async execute(){return this.executeRaw()}},PZ=class extends mX{static[J]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}};var BZ=class X extends x{sql;static[J]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(Y,Z){return W`(select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z})`}static buildCount(Y,Z){return W`select count(*) from ${Y}${W.raw(" where ").if(Z)}${Z}`}constructor(Y){super(X.buildEmbeddedCount(Y.source,Y.filters).queryChunks);this.params=Y,this.session=Y.session,this.sql=X.buildCount(Y.source,Y.filters)}then(Y,Z){return Promise.resolve(this.session.count(this.sql)).then(Y,Z)}catch(Y){return this.then(void 0,Y)}finally(Y){return this.then((Z)=>{return Y?.(),Z},(Z)=>{throw Y?.(),Z})}};var w1=class{static[J]="ColumnTableAliasProxyHandler";constructor(X,Y){this.table=X,this.ignoreColumnAlias=Y}get(X,Y){if(Y==="table")return this.table;if(Y==="isAlias"&&this.ignoreColumnAlias)return!1;return X[Y]}},jZ=class{static[J]="ViewSelectionAliasProxyHandler";constructor(X,Y,Z){this.view=X,this.selection=Y,this.ignoreColumnAlias=Z}get(X,Y){let Z=X[Y];if(D(Z,N))return new Proxy(Z,new w1(this.view,this.ignoreColumnAlias));if(D(Z,T)||D(Z,x)||D(Z,x.Aliased)||E1(Z)||typeof Z!=="object"||Z===null)return Z;return new Proxy(Z,this)}},FX=class{static[J]="TableAliasProxyHandler";constructor(X,Y,Z){this.alias=X,this.replaceOriginalName=Y,this.ignoreColumnAlias=Z}get(X,Y){if(Y===A.Symbol.IsAlias)return!0;if(Y===A.Symbol.Name)return this.alias;if(this.replaceOriginalName&&Y===A.Symbol.OriginalName)return this.alias;if(Y===Q)return{...X[Q],name:this.alias,isAlias:!0,selectedFields:new Proxy(X[Q].selectedFields,new jZ(new Proxy(X,this),X[Q].selectedFields,this.ignoreColumnAlias))};if(Y===A.Symbol.Columns){let $=X[A.Symbol.Columns];if(!$)return $;if(D(X,y))return new Proxy(X[A.Symbol.Columns],new jZ(new Proxy(X,this),X[A.Symbol.Columns],this.ignoreColumnAlias));let G={};return Object.keys($).map((H)=>{G[H]=new Proxy($[H],new w1(new Proxy(X,this),this.ignoreColumnAlias))}),G}let Z=X[Y];if(D(Z,N))return new Proxy(Z,new w1(new Proxy(X,this),this.ignoreColumnAlias));return Z}},V2=class{static[J]="ColumnAliasProxyHandler";constructor(X){this.alias=X}get(X,Y){if(Y==="isAlias")return!0;if(Y==="name")return this.alias;if(Y==="keyAsName")return!1;if(Y===T1)return()=>X;return X[Y]}};function Y1(X,Y){return new Proxy(X,new FX(Y,!1,!1))}function I2(X,Y){return new Proxy(X,new V2(Y))}function Z1(X,Y){return new Proxy(X,new w1(new Proxy(X.table,new FX(Y,!1,!1)),!1))}function cX(X,Y){return new x.Aliased(a1(X.sql,Y),X.fieldAlias)}function a1(X,Y){return W.join(X.queryChunks.map((Z)=>{if(D(Z,N))return Z1(Z,Y);if(D(Z,x))return a1(Z,Y);if(D(Z,x.Aliased))return cX(Z,Y);return Z}))}N.prototype.as=function(X){return I2(this,X)};function e1(X){return X[T1]()}var W1=class extends Error{static[J]="DrizzleError";constructor({message:X,cause:Y}){super(X);this.name="DrizzleError",this.cause=Y}},x1=class X extends Error{static[J]="DrizzleQueryError";constructor(Y,Z,$){super(`Failed query: ${Y}
|
|
3
|
+
params: ${Z}`);if(this.query=Y,this.params=Z,this.cause=$,Error.captureStackTrace(this,X),$)this.cause=$}},TZ=class extends W1{static[J]="TransactionRollbackError";constructor(){super({message:"Rollback"})}};var M2=class{static[J]="RelationV2";fieldName;sourceColumns;targetColumns;alias;where;sourceTable;targetTable;through;throughTable;isReversed;sourceColumnTableNames=[];targetColumnTableNames=[];constructor(X,Y){this.targetTableName=Y,this.targetTable=X}},SZ=class extends M2{static[J]="OneV2";relationType="one";optional;constructor(X,Y,Z,$){super(Y,Z);if(this.alias=$?.alias,this.where=$?.where,$?.from)this.sourceColumns=(Array.isArray($.from)?$.from:[$.from]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.sourceColumnTableNames.push(G._.tableName),G._.column});if($?.to)this.targetColumns=(Array.isArray($.to)?$.to:[$.to]).map((G)=>{return this.throughTable??=G._.through?X[G._.through._.tableName]:void 0,this.targetColumnTableNames.push(G._.tableName),G._.column});if(this.throughTable)this.through={source:(Array.isArray($?.from)?$.from:($?.from)?[$.from]:[]).map((G)=>G._.through),target:(Array.isArray($?.to)?$.to:($?.to)?[$.to]:[]).map((G)=>G._.through)};this.optional=$?.optional??!0}};var Q1={and:m,between:u1,eq:a,exists:k1,gt:p1,gte:y1,ilike:t1,inArray:d1,arrayContains:qX,arrayContained:vX,arrayOverlaps:hX,isNull:m1,isNotNull:c1,like:o1,lt:f1,lte:b1,ne:h1,not:I1,notBetween:r1,notExists:N1,notLike:s1,notIlike:n1,notInArray:g1,or:V1,sql:W},x2={sql:W,asc:M1,desc:i1};function AX(X,Y,Z=(_)=>_,$=!1,G=!1,H){for(let _ of Y){if(_.selection){let U=`${H?`${H}.`:""}${_.key}`;if(X[_.key]===null)continue;if($){if(X[_.key]=JSON.parse(X[_.key]),X[_.key]===null)continue}if(G&&typeof X[_.key]==="string")X[_.key]=JSON.parse(X[_.key]);if(_.isArray){for(let F of X[_.key])AX(F,_.selection,Z,!1,G,U);continue}AX(X[_.key],_.selection,Z,!1,G,U);continue}let z=_.field,O=Z(X[_.key]);if(O===null)continue;let E;if(D(z,N))E=z;else if(D(z,x))E=z.decoder;else if(D(z,x.Aliased))E=z.sql.decoder;else if(D(z,A)||D(z,y))E=C1;else E=z.getSQL().decoder;X[_.key]="mapFromJsonValue"in E?E.mapFromJsonValue(O):E.mapFromDriverValue(O)}return X}function CZ(X,Y){let Z=X[n][Y];return Z?D(Z,N)?Z:D(Z,x.Aliased)?W`${X}.${W.identifier(Z.fieldAlias)}`:W`${X}.${W.identifier(Y)}`:W`${X}.${W.identifier(Y)}`}function UX(X,Y){if(typeof Y!=="object"||D(Y,l))return a(X,Y);let Z=Object.entries(Y);if(!Z.length)return;let $=[];for(let[G,H]of Z){if(H===void 0)continue;switch(G){case"NOT":{let _=UX(X,H);if(!_)continue;$.push(I1(_));continue}case"OR":if(!H.length)continue;$.push(V1(...H.map((_)=>UX(X,_))));continue;case"AND":if(!H.length)continue;$.push(m(...H.map((_)=>UX(X,_))));continue;case"isNotNull":case"isNull":if(!H)continue;$.push(Q1[G](X));continue;case"in":$.push(Q1.inArray(X,H));continue;case"notIn":$.push(Q1.notInArray(X,H));continue;default:$.push(Q1[G](X,H));continue}}if(!$.length)return;return m(...$)}function J1(X,Y,Z={},$={},G,H=0){let _=Object.entries(Y);if(!_.length)return;let z=[];for(let[O,E]of _){if(E===void 0)continue;switch(O){case"RAW":{let U=typeof E==="function"?E(X,Q1):E.getSQL();z.push(U);continue}case"OR":if(!E?.length)continue;z.push(V1(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"AND":if(!E?.length)continue;z.push(m(...E.map((U)=>J1(X,U,Z,$,G,H))));continue;case"NOT":{if(E===void 0)continue;let U=J1(X,E,Z,$,G,H);if(!U)continue;z.push(I1(U));continue}default:{if(X[n][O]){let R=UX(CZ(X,O),E);if(R)z.push(R);continue}let U=Z[O];if(!U)throw new W1({message:`Unknown relational filter field: "${O}"`});let F=Y1(U.targetTable,`f${H}`),M=U.throughTable?Y1(U.throughTable,`ft${H}`):void 0,I=$[U.targetTableName],{filter:L,joinCondition:P}=uX(G,U,X,F,M),B=m(L,typeof E==="boolean"?void 0:J1(F,E,I.relations,$,G,H+1)),d=M?W`(select * from ${P1(F)} inner join ${P1(M)} on ${P}${W` where ${B}`.if(B)} limit 1)`:W`(select * from ${P1(F)}${W` where ${B}`.if(B)} limit 1)`;if(B)z.push((E?k1:N1)(d))}}}return m(...z)}function qZ(X,Y){if(typeof Y==="function"){let $=Y(X,x2);return D($,x)?$:Array.isArray($)?$.length?W.join($.map((G)=>D(G,x)?G:M1(G)),W`, `):void 0:D($,N)?M1($):void 0}let Z=Object.entries(Y).filter(([$,G])=>G);if(!Z.length)return;return W.join(Z.map(([$,G])=>(G==="asc"?M1:i1)(CZ(X,$))),W`, `)}function vZ(X,Y){let Z=[],$=[];for(let[G,H]of Object.entries(Y)){if(!H)continue;let _=typeof H==="function"?H(X,{sql:Q1.sql}):H,z=W`(${_.getSQL()}) as ${W.identifier(G)}`;z.decoder=_.getSQL().decoder,Z.push(z),$.push({key:G,field:z})}return{sql:Z.length?W.join(Z,W`, `):void 0,selection:$}}function uX(X,Y,Z,$,G){if(Y.through){let H=Y.sourceColumns.map((z,O)=>{let E=Y.through.source[O];return a(W`${Z}.${W.identifier(X.getColumnCasing(z))}`,W`${G}.${W.identifier(D(E._.column,N)?X.getColumnCasing(E._.column):E._.key)}`)}),_=Y.targetColumns.map((z,O)=>{let E=Y.through.target[O];return a(W`${G}.${W.identifier(D(E._.column,N)?X.getColumnCasing(E._.column):E._.key)}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)});return{filter:m(Y.where?J1(Y.isReversed?Z:$,Y.where):void 0,...H),joinCondition:m(..._)}}return{filter:m(...Y.sourceColumns.map((H,_)=>{let z=Y.targetColumns[_];return a(W`${Z}.${W.identifier(X.getColumnCasing(H))}`,W`${$}.${W.identifier(X.getColumnCasing(z))}`)}),Y.where?J1(Y.isReversed?Z:$,Y.where):void 0)}}function P1(X){return W`${X[_1]?W`${W`${W.identifier(X[G1]??"")}.`.if(X[G1])}${W.identifier(X[U1])} as ${X}`:X}`}var pZ=class{static[J]="SQLiteAsyncRelationalQueryBuilderV2";constructor(X,Y,Z,$,G,H,_,z){this.mode=X,this.schema=Y,this.table=Z,this.tableConfig=$,this.dialect=G,this.session=H,this.rowMode=_,this.forbidJsonb=z}findMany(X){return this.mode==="sync"?new hZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb):new rX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"many",this.rowMode,this.forbidJsonb)}findFirst(X){return this.mode==="sync"?new hZ(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb):new rX(this.schema,this.table,this.tableConfig,this.dialect,this.session,X??!0,"first",this.rowMode,this.forbidJsonb)}},rX=class extends c{static[J]="SQLiteAsyncRelationalQueryV2";mode;table;constructor(X,Y,Z,$,G,H,_,z,O){super();this.schema=X,this.tableConfig=Z,this.dialect=$,this.session=G,this.config=H,this.rowMode=z,this.forbidJsonb=O,this.mode=_,this.table=Y}getSQL(){return this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,jsonb:this.forbidJsonb?W`json`:W`jsonb`}).sql}_prepare(X=!0){let{query:Y,builtQuery:Z}=this._toSQL();return this.session[X?"prepareOneTimeRelationalQuery":"prepareRelationalQuery"](Z,void 0,this.mode==="first"?"get":"all",($,G)=>{let H=$.map((_)=>AX(_,Y.selection,G,!this.rowMode));if(this.mode==="first")return H[0];return H})}prepare(){return this._prepare(!1)}_getQuery(){let X=this.forbidJsonb?W`json`:W`jsonb`,Y=this.dialect.buildRelationalQuery({schema:this.schema,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,mode:this.mode,isNested:this.rowMode,jsonb:X});if(this.rowMode)Y.sql=W`select json_object(${W.join(Y.selection.map((Z)=>{return W`${W.raw(this.dialect.escapeString(Z.key))}, ${Z.selection?W`${X}(${W.identifier(Z.key)})`:W.identifier(Z.key)}`}),W`, `)}) as ${W.identifier("r")} from (${Y.sql}) as ${W.identifier("t")}`;return Y}_toSQL(){let X=this._getQuery();return{query:X,builtQuery:this.dialect.sqlToQuery(X.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){if(this.mode==="first")return this._prepare().get();return this._prepare().all()}async execute(){return this.executeRaw()}},hZ=class extends rX{static[J]="SQLiteSyncRelationalQueryV2";sync(){return this.executeRaw()}};var XX=class extends c{static[J]="SQLiteRaw";config;constructor(X,Y,Z,$,G){super();this.execute=X,this.getSQL=Y,this.dialect=$,this.mapBatchResult=G,this.config={action:Z}}getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(X,Y){return Y?this.mapBatchResult(X):X}_prepare(){return this}isResponseInArrayMode(){return!1}};var b=class X{static[J]="SelectionProxyHandler";config;constructor(Y){this.config={...Y}}get(Y,Z){if(Z==="_")return{...Y._,selectedFields:new Proxy(Y._.selectedFields,this)};if(Z===Q)return{...Y[Q],selectedFields:new Proxy(Y[Q].selectedFields,this)};if(typeof Z==="symbol")return Y[Z];let $=(D(Y,T)?Y._.selectedFields:D(Y,y)?Y[Q].selectedFields:Y)[Z];if(D($,x.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!$.isSelectionField)return $.sql;let G=$.clone();return G.isSelectionField=!0,G.origin=this.config.alias,G}if(D($,x)){if(this.config.sqlBehavior==="sql")return $;throw Error(`You tried to reference "${Z}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(D($,N)){if(this.config.alias)return new Proxy($,new w1(new Proxy($.table,new FX(this.config.alias,this.config.replaceOriginalName??!1,!0)),!0));return $}if(typeof $!=="object"||$===null)return $;return new Proxy($,new X(this.config))}};function e(X){if(D(X,v))return[`${X[A.Symbol.BaseName]}`];if(D(X,T))return X._.usedTables??[];if(D(X,x))return X.usedTables??[];return[]}var VX=class extends c{static[J]="SQLiteDelete";config;constructor(X,Y,Z,$){super();this.table=X,this.session=Y,this.dialect=Z,this.config={table:X,withList:$}}where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.table[v.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(X){return this._prepare().execute(X)}$dynamic(){return this}};var L1=class extends y{static[J]="SQLiteViewBase"};var yZ=class{static[J]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}};var X1=class{static[J]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(X){this.fields=X.fields,this.session=X.session,this.dialect=X.dialect,this.withList=X.withList,this.distinct=X.distinct}from(X){let Y=!!this.fields,Z;if(this.fields)Z=this.fields;else if(D(X,T))Z=Object.fromEntries(Object.keys(X._.selectedFields).map(($)=>[$,X[$]]));else if(D(X,L1))Z=X[Q].selectedFields;else if(D(X,x))Z={};else Z=EY(X);return new oX({table:X,fields:Z,isPartialSelect:Y,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}},fZ=class extends yZ{static[J]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:X,fields:Y,isPartialSelect:Z,session:$,dialect:G,withList:H,distinct:_}){super();this.config={withList:H,table:X,fields:{...Y},distinct:_,setOperators:[]},this.isPartialSelect=Z,this.session=$,this.dialect=G,this._={selectedFields:Y,config:this.config},this.tableName=v1(X),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let z of e(X))this.usedTables.add(z)}getUsedTables(){return[...this.usedTables]}createJoin(X){return(Y,Z)=>{let $=this.tableName,G=v1(Y);for(let H of e(Y))this.usedTables.add(H);if(typeof G==="string"&&this.config.joins?.some((H)=>H.alias===G))throw Error(`Alias "${G}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof $==="string")this.config.fields={[$]:this.config.fields};if(typeof G==="string"&&!D(Y,x)){let H=D(Y,T)?Y._.selectedFields:D(Y,y)?Y[Q].selectedFields:Y[A.Symbol.Columns];this.config.fields[G]=H}}if(typeof Z==="function")Z=Z(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:Z,table:Y,joinType:X,alias:G}),typeof G==="string")switch(X){case"left":this.joinsNotNullableMap[G]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[G]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([H])=>[H,!1])),this.joinsNotNullableMap[G]=!1;break}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(X,Y){return(Z)=>{let $=typeof Z==="function"?Z(K2()):Z;if(!q1(this.getSelectedFields(),$.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:X,isAll:Y,rightSelect:$}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(X){return this.config.setOperators.push(...X),this}where(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=X,this}having(X){if(typeof X==="function")X=X(new Proxy(this.config.fields,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=X,this}groupBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(Y)?Y:[Y]}else this.config.groupBy=X;return this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.fields,new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Z;else this.config.orderBy=Z}else{let Y=X;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=Y;else this.config.orderBy=Y}return this}limit(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=X;else this.config.limit=X;return this}offset(X){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=X;else this.config.offset=X;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}as(X){let Y=[];if(Y.push(...e(this.config.table)),this.config.joins)for(let Z of this.config.joins)Y.push(...e(Z.table));return new Proxy(new T(this.getSQL(),this.config.fields,X,!1,[...new Set(Y)]),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new b({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}},oX=class extends fZ{static[J]="SQLiteSelect";_prepare(X=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let Y=i(this.config.fields),Z=this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),Y,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return Z.joinsNotNullableMap=this.joinsNotNullableMap,Z}$withCache(X){return this.cacheConfig=X===void 0?{config:{},enabled:!0,autoInvalidate:!0}:X===!1?{enabled:!1}:{enabled:!0,autoInvalidate:!0,...X},this}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.all()}};zY(oX,[c]);function IX(X,Y){return(Z,$,...G)=>{let H=[$,...G].map((_)=>({type:X,isAll:Y,rightSelect:_}));for(let _ of H)if(!q1(Z.getSelectedFields(),_.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return Z.addSetOperators(H)}}var K2=()=>({union:bZ,unionAll:dZ,intersect:gZ,except:mZ}),bZ=IX("union",!1),dZ=IX("union",!0),gZ=IX("intersect",!1),mZ=IX("except",!1);function _J(X){let Y=parseInt(X.slice(0,4),10),Z=parseInt(X.slice(4,6),10)-1,$=parseInt(X.slice(6,8),10),G=parseInt(X.slice(8,10),10),H=parseInt(X.slice(10,12),10),_=parseInt(X.slice(12,14),10);return Date.UTC(Y,Z,$,G,H,_)}function cZ(X){let{localMigrations:Y,dbMigrations:Z}=X,$=new Set(Z.map((G)=>G.name).filter((G)=>G!==null));return Y.filter((G)=>!G.name||!$.has(G.name))}var uZ=1;function k2(X){if(X.includes("name"))return 1;return 0}function sX(X,Y,Z=()=>[]){let $=X.all(Y);if($.length===0)return[];if(Array.isArray($[0]))return $.map((G)=>Z(G));return $}function rZ(X,Y,Z){if(sX(Y,W`SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ${X}`,(G)=>({"1":G[0]})).length===0)return{newDb:!0};let $=k2(sX(Y,W`SELECT name as column_name FROM pragma_table_info(${X})`,(G)=>({column_name:G[0]})).map((G)=>G.column_name));for(let G=$;G<uZ;G++){let H=N2[G];if(!H)throw Error(`No upgrade path from migration table version ${G} to ${G+1}`);H(X,Y,Z)}return{prevVersion:$,currentVersion:uZ}}var N2={0:(X,Y,Z)=>{let $=W`${W.identifier(X)}`,G=sX(Y,W`SELECT id, hash, created_at FROM ${$} ORDER BY id ASC`,(E)=>({id:E[0],hash:E[1],created_at:E[2]}));Z.sort((E,U)=>E.folderMillis!==U.folderMillis?E.folderMillis-U.folderMillis:(E.name??"").localeCompare(U.name??""));let H=new Map,_=new Map;for(let E of Z){if(!H.has(E.folderMillis))H.set(E.folderMillis,[]);H.get(E.folderMillis).push(E),_.set(E.hash,E)}let z=[],O=[];for(let E of G){let U=String(E.created_at),F=Number(U.substring(0,U.length-3)+"000"),M=H.get(F),I,L=null;if(M&&M.length===1)I=M[0],L="millis";else if(M&&M.length>1){if(I=M.find((P)=>P.hash&&E.hash&&P.hash===E.hash),I)L="hash"}else if(I=_.get(E.hash),I)L="hash";if(I)z.push({id:E.id,name:I.name,hash:E.hash,created_at:U,matchedBy:E.id?"id":L});else O.push(E)}if(O.length>0)throw Error(`While upgrading your database migrations table we found ${O.length} (${O.map((E)=>`[id: ${E.id}, created_at: ${E.created_at}]`).join(", ")}) migrations in the database that do not match any local migration. This means that some migrations were applied to the database but are missing from the local environment`);Y.transaction((E)=>{E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("name")} text`),E.run(W`ALTER TABLE ${$} ADD COLUMN ${W.identifier("applied_at")} TEXT`);for(let U of z){let F=W`UPDATE ${$} SET ${W.identifier("name")} = ${U.name}, ${W.identifier("applied_at")} = NULL WHERE`;if(U.id)F.append(W` ${W.identifier("id")} = ${U.id}`);else if(U.matchedBy==="millis")F.append(W` ${W.identifier("created_at")} = ${U.created_at}`);else F.append(W` ${W.identifier("hash")} = ${U.hash}`);E.run(F)}})}};function R2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map((Y)=>Y.toLowerCase()).join("_")}function w2(X){return(X.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((Y,Z,$)=>{return Y+($===0?Z.toLowerCase():`${Z[0].toUpperCase()}${Z.slice(1)}`)},"")}function Q2(X){return X}var oZ=class{static[J]="CasingCache";cache={};cachedTables={};convert;constructor(X){this.convert=X==="snake_case"?R2:X==="camelCase"?w2:Q2}getColumnCasing(X){if(!X.keyAsName)return X.name;let Y=`${X.table[A.Symbol.Schema]??"public"}.${X.table[A.Symbol.OriginalName]}.${X.name}`;if(!this.cache[Y])this.cacheTable(X.table);return this.cache[Y]}cacheTable(X){let Y=`${X[A.Symbol.Schema]??"public"}.${X[A.Symbol.OriginalName]}`;if(!this.cachedTables[Y]){for(let Z of Object.values(X[A.Symbol.Columns])){if(!D(Z,N))continue;let $=`${Y}.${Z.name}`;this.cache[$]=this.convert(Z.name)}this.cachedTables[Y]=!0}}clearCache(){this.cache={},this.cachedTables={}}};var MX=class{static[J]="SQLiteDialect";casing;constructor(X){this.casing=new oZ(X?.casing)}escapeName(X){return`"${X}"`}escapeParam(X){return"?"}escapeString(X){return`'${X.replace(/'/g,"''")}'`}buildWithCTE(X){if(!X?.length)return;let Y=[W`with `];for(let[Z,$]of X.entries())if(Y.push(W`${W.identifier($._.alias)} as (${$._.sql})`),Z<X.length-1)Y.push(W`, `);return Y.push(W` `),W.join(Y)}buildDeleteQuery({table:X,where:Y,returning:Z,withList:$,limit:G,orderBy:H}){let _=this.buildWithCTE($),z=Z?W` returning ${this.buildSelection(Z,{isSingleTable:!0})}`:void 0;return W`${_}delete from ${X}${Y?W` where ${Y}`:void 0}${z}${this.buildOrderBy(H)}${this.buildLimit(G)}`}buildUpdateSet(X,Y){let Z=X[A.Symbol.Columns],$=Object.keys(Z).filter((H)=>Y[H]!==void 0||Z[H]?.onUpdateFn!==void 0),G=$.length;return W.join($.flatMap((H,_)=>{let z=Z[H],O=z.onUpdateFn?.(),E=Y[H]??(D(O,x)?O:W.param(O,z)),U=W`${W.identifier(this.casing.getColumnCasing(z))} = ${E}`;if(_<G-1)return[U,W.raw(", ")];return[U]}))}buildUpdateQuery({table:X,set:Y,where:Z,returning:$,withList:G,joins:H,from:_,limit:z,orderBy:O}){let E=this.buildWithCTE(G),U=this.buildUpdateSet(X,Y),F=_&&W.join([W.raw(" from "),this.buildFromTable(_)]),M=this.buildJoins(H),I=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${E}update ${X} set ${U}${F}${M}${Z?W` where ${Z}`:void 0}${I}${this.buildOrderBy(O)}${this.buildLimit(z)}`}buildSelection(X,{isSingleTable:Y=!1}={}){let Z=X.length,$=X.flatMap(({field:G},H)=>{let _=[];if(D(G,x.Aliased)&&G.isSelectionField){if(!Y&&G.origin!==void 0)_.push(W.identifier(G.origin),W.raw("."));_.push(W.identifier(G.fieldAlias))}else if(D(G,x.Aliased)||D(G,x)){let z=D(G,x.Aliased)?G.sql:G;if(Y){let O=new x(z.queryChunks.map((E)=>{if(D(E,N))return W.identifier(this.casing.getColumnCasing(E));return E}));_.push(z.shouldInlineParams?O.inlineParams():O)}else _.push(z);if(D(G,x.Aliased))_.push(W` as ${W.identifier(G.fieldAlias)}`)}else if(D(G,N))if(G.columnType==="SQLiteNumericBigInt")if(Y)_.push(G.isAlias?W`cast(${W.identifier(this.casing.getColumnCasing(e1(G)))} as text) as ${G}`:W`cast(${W.identifier(this.casing.getColumnCasing(G))} as text)`);else _.push(G.isAlias?W`cast(${e1(G)} as text) as ${G}`:W`cast(${G} as text)`);else if(Y)_.push(G.isAlias?W`${W.identifier(this.casing.getColumnCasing(e1(G)))} as ${G}`:W.identifier(this.casing.getColumnCasing(G)));else _.push(G.isAlias?W`${e1(G)} as ${G}`:G);else if(D(G,T)){let z=Object.entries(G._.selectedFields);if(z.length===1){let O=z[0][1],E=D(O,x)?O.decoder:D(O,N)?{mapFromDriverValue:(U)=>O.mapFromDriverValue(U)}:O.sql.decoder;if(E)G._.sql.decoder=E}_.push(G)}if(H<Z-1)_.push(W`, `);return _});return W.join($)}buildJoins(X){if(!X||X.length===0)return;let Y=[];if(X)for(let[Z,$]of X.entries()){if(Z===0)Y.push(W` `);let G=$.table,H=$.on?W` on ${$.on}`:void 0;if(D(G,v)){let _=G[v.Symbol.Name],z=G[v.Symbol.Schema],O=G[v.Symbol.OriginalName],E=_===O?void 0:$.alias;Y.push(W`${W.raw($.joinType)} join ${z?W`${W.identifier(z)}.`:void 0}${W.identifier(O)}${E&&W` ${W.identifier(E)}`}${H}`)}else Y.push(W`${W.raw($.joinType)} join ${G}${H}`);if(Z<X.length-1)Y.push(W` `)}return W.join(Y)}buildLimit(X){return typeof X==="object"||typeof X==="number"&&X>=0?W` limit ${X}`:void 0}buildOrderBy(X){let Y=[];if(X){for(let[Z,$]of X.entries())if(Y.push($),Z<X.length-1)Y.push(W`, `)}return Y.length>0?W` order by ${W.join(Y)}`:void 0}buildFromTable(X){if(D(X,A)&&X[A.Symbol.IsAlias])return W`${W`${W.identifier(X[A.Symbol.Schema]??"")}.`.if(X[A.Symbol.Schema])}${W.identifier(X[A.Symbol.OriginalName])} ${W.identifier(X[A.Symbol.Name])}`;if(D(X,y)&&X[Q].isAlias){let Y=W`${W.identifier(X[Q].originalName)}`;if(X[Q].schema)Y=W`${W.identifier(X[Q].schema)}.${Y}`;return W`${Y} ${W.identifier(X[Q].name)}`}return X}buildSelectQuery({withList:X,fields:Y,fieldsFlat:Z,where:$,having:G,table:H,joins:_,orderBy:z,groupBy:O,limit:E,offset:U,distinct:F,setOperators:M}){let I=Z??i(Y);for(let C of I)if(D(C.field,N)&&z1(C.field.table)!==(D(H,T)?H._.alias:D(H,L1)?H[Q].name:D(H,x)?void 0:z1(H))&&!((u)=>_?.some(({alias:t})=>t===(u[A.Symbol.IsAlias]?z1(u):u[A.Symbol.BaseName])))(C.field.table)){let u=z1(C.field.table);throw Error(`Your "${C.path.join("->")}" field references a column "${u}"."${C.field.name}", but the table "${u}" is not part of the query! Did you forget to join it?`)}let L=!_||_.length===0,P=this.buildWithCTE(X),B=F?W` distinct`:void 0,d=this.buildSelection(I,{isSingleTable:L}),R=this.buildFromTable(H),s=this.buildJoins(_),o=$?W` where ${$}`:void 0,p=G?W` having ${G}`:void 0,w=[];if(O){for(let[C,u]of O.entries())if(w.push(u),C<O.length-1)w.push(W`, `)}let j=W`${P}select${B} ${d} from ${R}${s}${o}${w.length>0?W` group by ${W.join(w)}`:void 0}${p}${this.buildOrderBy(z)}${this.buildLimit(E)}${U?W` offset ${U}`:void 0}`;if(M.length>0)return this.buildSetOperations(j,M);return j}buildSetOperations(X,Y){let[Z,...$]=Y;if(!Z)throw Error("Cannot pass undefined values to any set operator");if($.length===0)return this.buildSetOperationQuery({leftSelect:X,setOperator:Z});return this.buildSetOperations(this.buildSetOperationQuery({leftSelect:X,setOperator:Z}),$)}buildSetOperationQuery({leftSelect:X,setOperator:{type:Y,isAll:Z,rightSelect:$,limit:G,orderBy:H,offset:_}}){let z=W`${X.getSQL()} `,O=W`${$.getSQL()}`,E;if(H&&H.length>0){let I=[];for(let L of H)if(D(L,S))I.push(W.identifier(L.name));else if(D(L,x)){for(let P=0;P<L.queryChunks.length;P++){let B=L.queryChunks[P];if(D(B,S))L.queryChunks[P]=W.identifier(this.casing.getColumnCasing(B))}I.push(W`${L}`)}else I.push(W`${L}`);E=W` order by ${W.join(I,W`, `)}`}let U=typeof G==="object"||typeof G==="number"&&G>=0?W` limit ${G}`:void 0,F=W.raw(`${Y} ${Z?"all ":""}`),M=_?W` offset ${_}`:void 0;return W`${z}${F}${O}${E}${U}${M}`}buildInsertQuery({table:X,values:Y,onConflict:Z,returning:$,withList:G,select:H}){let _=[],z=X[A.Symbol.Columns],O=Object.entries(z).filter(([I,L])=>!L.shouldDisableInsert()),E=O.map(([,I])=>W.identifier(this.casing.getColumnCasing(I)));if(H){let I=Y;if(D(I,x))_.push(I);else _.push(I.getSQL())}else{let I=Y;_.push(W.raw("values "));for(let[L,P]of I.entries()){let B=[];for(let[d,R]of O){let s=P[d];if(s===void 0||D(s,g)&&s.value===void 0){let o;if(R.default!==null&&R.default!==void 0)o=D(R.default,x)?R.default:W.param(R.default,R);else if(R.defaultFn!==void 0){let p=R.defaultFn();o=D(p,x)?p:W.param(p,R)}else if(!R.default&&R.onUpdateFn!==void 0){let p=R.onUpdateFn();o=D(p,x)?p:W.param(p,R)}else o=W`null`;B.push(o)}else B.push(s)}if(_.push(B),L<I.length-1)_.push(W`, `)}}let U=this.buildWithCTE(G),F=W.join(_),M=$?W` returning ${this.buildSelection($,{isSingleTable:!0})}`:void 0;return W`${U}insert into ${X} ${E} ${F}${Z?.length?W.join(Z):void 0}${M}`}sqlToQuery(X,Y){return X.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:Y})}_buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:$,tableConfig:G,queryConfig:H,tableAlias:_,nestedQueryRelation:z,joinOn:O}){let E=[],U,F,M=[],I,L=[];if(H===!0)E=Object.entries(G.columns).map(([B,d])=>({dbKey:d.name,tsKey:B,field:Z1(d,_),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let B=Object.fromEntries(Object.entries(G.columns).map(([w,j])=>[w,Z1(j,_)]));if(H.where){let w=typeof H.where==="function"?H.where(B,kZ()):H.where;I=w&&a1(w,_)}let d=[],R=[];if(H.columns){let w=!1;for(let[j,C]of Object.entries(H.columns)){if(C===void 0)continue;if(j in G.columns){if(!w&&C===!0)w=!0;R.push(j)}}if(R.length>0)R=w?R.filter((j)=>H.columns?.[j]===!0):Object.keys(G.columns).filter((j)=>!R.includes(j))}else R=Object.keys(G.columns);for(let w of R){let j=G.columns[w];d.push({tsKey:w,value:j})}let s=[];if(H.with)s=Object.entries(H.with).filter((w)=>!!w[1]).map(([w,j])=>({tsKey:w,queryConfig:j,relation:G.relations[w]}));let o;if(H.extras){o=typeof H.extras==="function"?H.extras(B,{sql:W}):H.extras;for(let[w,j]of Object.entries(o))d.push({tsKey:w,value:cX(j,_)})}for(let{tsKey:w,value:j}of d)E.push({dbKey:D(j,x.Aliased)?j.fieldAlias:G.columns[w].name,tsKey:w,field:D(j,N)?Z1(j,_):j,relationTableTsKey:void 0,isJson:!1,selection:[]});let p=typeof H.orderBy==="function"?H.orderBy(B,NZ()):H.orderBy??[];if(!Array.isArray(p))p=[p];M=p.map((w)=>{if(D(w,N))return Z1(w,_);return a1(w,_)}),U=H.limit,F=H.offset;for(let{tsKey:w,queryConfig:j,relation:C}of s){let u=wZ(Y,Z,C),t=Z[A1(C.referencedTable)],H1=`${_}_${w}`,$1=m(...u.fields.map((j1,wX)=>a(Z1(u.references[wX],H1),Z1(j1,_)))),K1=this._buildRelationalQuery({fullSchema:X,schema:Y,tableNamesMap:Z,table:X[t],tableConfig:Y[t],queryConfig:D(C,R1)?j===!0?{limit:1}:{...j,limit:1}:j,tableAlias:H1,joinOn:$1,nestedQueryRelation:C}),B1=W`(${K1.sql})`.as(w);E.push({dbKey:w,tsKey:w,field:B1,relationTableTsKey:t,isJson:!0,selection:K1.selection})}}if(E.length===0)throw new W1({message:`No fields selected for table "${G.tsName}" ("${_}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let P;if(I=m(O,I),z){let B=W`json_array(${W.join(E.map(({field:R})=>D(R,S)?W.identifier(this.casing.getColumnCasing(R)):D(R,x.Aliased)?R.sql:R),W`, `)})`;if(D(z,dX))B=W`coalesce(json_group_array(${B}), json_array())`;let d=[{dbKey:"data",tsKey:"data",field:B.as("data"),isJson:!0,relationTableTsKey:G.tsName,selection:E}];if(U!==void 0||F!==void 0||M.length>0)P=this.buildSelectQuery({table:Y1($,_),fields:{},fieldsFlat:[{path:[],field:W.raw("*")}],where:I,limit:U,offset:F,orderBy:M,setOperators:[]}),I=void 0,U=void 0,F=void 0,M=void 0;else P=Y1($,_);P=this.buildSelectQuery({table:D(P,v)?P:new T(P,{},_),fields:{},fieldsFlat:d.map(({field:R})=>({path:[],field:D(R,N)?Z1(R,_):R})),joins:L,where:I,limit:U,offset:F,orderBy:M,setOperators:[]})}else P=this.buildSelectQuery({table:Y1($,_),fields:{},fieldsFlat:E.map(({field:B})=>({path:[],field:D(B,N)?Z1(B,_):B})),joins:L,where:I,limit:U,offset:F,orderBy:M,setOperators:[]});return{tableTsKey:G.tsName,sql:P,selection:E}}nestedSelectionerror(){throw new W1({message:"Views with nested selections are not supported by the relational query builder"})}buildRqbColumn(X,Y,Z){if(D(Y,N)){let $=W`${X}.${W.identifier(this.casing.getColumnCasing(Y))}`;switch(Y.columnType){case"SQLiteBigInt":case"SQLiteBlobJson":case"SQLiteBlobBuffer":return W`hex(${$}) as ${W.identifier(Z)}`;case"SQLiteNumeric":case"SQLiteNumericNumber":case"SQLiteNumericBigInt":return W`cast(${$} as text) as ${W.identifier(Z)}`;case"SQLiteCustomColumn":return W`${Y.jsonSelectIdentifier($,W)} as ${W.identifier(Z)}`;default:return W`${$} as ${W.identifier(Z)}`}}return W`${X}.${D(Y,x.Aliased)?W.identifier(Y.fieldAlias):E1(Y)?W.identifier(Z):this.nestedSelectionerror()} as ${W.identifier(Z)}`}unwrapAllColumns=(X,Y)=>{return W.join(Object.entries(X[n]).map(([Z,$])=>{return Y.push({key:Z,field:$}),this.buildRqbColumn(X,$,Z)}),W`, `)};getSelectedTableColumns=(X,Y)=>{let Z=[],$=X[n],G=Object.entries(Y),H;for(let[_,z]of G){if(z===void 0)continue;if(H=H||z,z){let O=$[_];Z.push({column:O,tsName:_})}}if(H===!1)for(let[_,z]of Object.entries($)){if(Y[_]===!1)continue;Z.push({column:z,tsName:_})}return Z};buildColumns=(X,Y,Z)=>Z?.columns?(()=>{let $=[],G=this.getSelectedTableColumns(X,Z?.columns);for(let{column:H,tsName:_}of G)$.push(this.buildRqbColumn(X,H,_)),Y.push({key:_,field:H});return $.length?W.join($,W`, `):void 0})():this.unwrapAllColumns(X,Y);buildRelationalQuery({schema:X,table:Y,tableConfig:Z,queryConfig:$,relationWhere:G,mode:H,isNested:_,errorPath:z,depth:O,throughJoin:E,jsonb:U}){let F=[],M=H==="first",I=$===!0?void 0:$,L=z??"",P=O??0;if(!P)Y=Y1(Y,`d${P}`);let B=M?1:I?.limit,d=I?.offset,R=this.buildColumns(Y,F,I),s=I?.where&&G?m(J1(Y,I.where,Z.relations,X,this.casing),G):I?.where?J1(Y,I.where,Z.relations,X,this.casing):G,o=I?.orderBy?qZ(Y,I.orderBy):void 0,p=I?.extras?vZ(Y,I.extras):void 0;if(p)F.push(...p.selection);let w=I?(()=>{let{with:C}=I;if(!C)return;let u=Object.entries(C).filter(([t,H1])=>H1);if(!u.length)return;return W.join(u.map(([t,H1])=>{let $1=Z.relations[t],K1=D($1,SZ),B1=Y1($1.targetTable,`d${P+1}`),j1=$1.throughTable?Y1($1.throughTable,`tr${P}`):void 0,{filter:wX,joinCondition:aZ}=uX(this.casing,$1,Y,B1,j1),eZ=j1?W` inner join ${P1(j1)} on ${aZ}`:void 0,$X=this.buildRelationalQuery({table:B1,mode:K1?"first":"many",schema:X,queryConfig:H1,tableConfig:X[$1.targetTableName],relationWhere:wX,isNested:!0,errorPath:`${L.length?`${L}.`:""}${t}`,depth:P+1,throughJoin:eZ,jsonb:U});F.push({field:B1,key:t,selection:$X.selection,isArray:!K1,isOptional:($1.optional??!1)||H1!==!0&&!!H1.where});let ZY=W.join($X.selection.map((GX)=>{return W`${W.raw(this.escapeString(GX.key))}, ${GX.selection?W`${U}(${W.identifier(GX.key)})`:W.identifier(GX.key)}`}),W`, `),$Y=_?U:W`json`;return K1?W`(select ${$Y}_object(${ZY}) as ${W.identifier("r")} from (${$X.sql}) as ${W.identifier("t")}) as ${W.identifier(t)}`:W`coalesce((select ${$Y}_group_array(json_object(${ZY})) as ${W.identifier("r")} from (${$X.sql}) as ${W.identifier("t")}), ${U}_array()) as ${W.identifier(t)}`}),W`, `)})():void 0,j=[R,p?.sql,w].filter((C)=>C!==void 0);if(!j.length)throw new W1({message:`No fields selected for table "${Z.name}"${L?` ("${L}")`:""}`});return{sql:W`select ${W.join(j,W`, `)} from ${P1(Y)}${E}${W` where ${s}`.if(s)}${W` order by ${o}`.if(o)}${W` limit ${B}`.if(B!==void 0)}${W` offset ${d}`.if(d!==void 0)}`,selection:F}}},xX=class extends MX{static[J]="SQLiteSyncDialect";migrate(X,Y,Z){let $=Z===void 0?"__drizzle_migrations":typeof Z==="string"?"__drizzle_migrations":Z.migrationsTable??"__drizzle_migrations",{newDb:G}=rZ($,Y,X);if(G){let z=W`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS ${W.identifier($)} (
|
|
5
|
+
id INTEGER PRIMARY KEY,
|
|
6
|
+
hash text NOT NULL,
|
|
7
|
+
created_at numeric,
|
|
8
|
+
name text,
|
|
9
|
+
applied_at TEXT
|
|
10
|
+
)`;Y.run(z)}let H=Y.all(W`SELECT id, hash, created_at, name FROM ${W.identifier($)}`);if(typeof Z==="object"&&Z.init){if(H.length)return{exitCode:"databaseMigrations"};if(X.length>1)return{exitCode:"localMigrations"};let[z]=X;if(!z)return;Y.run(W`insert into ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`);return}let _=cZ({localMigrations:X,dbMigrations:H});Y.run(W`BEGIN`);try{for(let z of _){for(let O of z.sql)Y.run(W.raw(O));Y.run(W`INSERT INTO ${W.identifier($)} ("hash", "created_at", "name", "applied_at") values(${z.hash}, ${z.folderMillis}, ${z.name}, ${new Date().toISOString()})`)}Y.run(W`COMMIT`)}catch(z){throw Y.run(W`ROLLBACK`),z}}};var YX=class{static[J]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(X){this.dialect=D(X,MX)?X:void 0,this.dialectConfig=D(X,MX)?void 0:X}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(Z);return new Proxy(new WX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};with(...X){let Y=this;function Z(G){return new X1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X})}function $(G){return new X1({fields:G??void 0,session:void 0,dialect:Y.getDialect(),withList:X,distinct:!0})}return{select:Z,selectDistinct:$}}select(X){return new X1({fields:X??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(X){return new X1({fields:X??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){if(!this.dialect)this.dialect=new xX(this.dialectConfig);return this.dialect}};var KX=class{static[J]="SQLiteInsertBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}values(X){if(X=Array.isArray(X)?X:[X],X.length===0)throw Error("values() must be called with at least one value");let Y=X.map((Z)=>{let $={},G=this.table[A.Symbol.Columns];for(let H of Object.keys(Z)){let _=Z[H];$[H]=D(_,x)?_:new g(_,G[H])}return $});return new tX(this.table,Y,this.session,this.dialect,this.withList)}select(X){let Y=typeof X==="function"?X(new YX):X;if(!D(Y,x)&&!q1(this.table[n],Y._.selectedFields))throw Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new tX(this.table,Y,this.session,this.dialect,this.withList,!0)}},tX=class extends c{static[J]="SQLiteInsert";config;constructor(X,Y,Z,$,G,H){super();this.session=Z,this.dialect=$,this.config={table:X,values:Y,withList:G,select:H}}returning(X=this.config.table[v.Symbol.Columns]){return this.config.returning=i(X),this}onConflictDoNothing(X={}){if(!this.config.onConflict)this.config.onConflict=[];if(X.target===void 0)this.config.onConflict.push(W` on conflict do nothing`);else{let Y=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,Z=X.where?W` where ${X.where}`:W``;this.config.onConflict.push(W` on conflict ${Y} do nothing${Z}`)}return this}onConflictDoUpdate(X){if(X.where&&(X.targetWhere||X.setWhere))throw Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');if(!this.config.onConflict)this.config.onConflict=[];let Y=X.where?W` where ${X.where}`:void 0,Z=X.targetWhere?W` where ${X.targetWhere}`:void 0,$=X.setWhere?W` where ${X.setWhere}`:void 0,G=Array.isArray(X.target)?W`${X.target}`:W`${[X.target]}`,H=this.dialect.buildUpdateSet(this.config.table,JX(this.config.table,X.set));return this.config.onConflict.push(W` on conflict ${G}${Z} do update set ${H}${Y}${$}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var kX=class{static[J]="SQLiteUpdateBuilder";constructor(X,Y,Z,$){this.table=X,this.session=Y,this.dialect=Z,this.withList=$}set(X){return new sZ(this.table,JX(this.table,X),this.session,this.dialect,this.withList)}},sZ=class extends c{static[J]="SQLiteUpdate";config;constructor(X,Y,Z,$,G){super();this.session=Z,this.dialect=$,this.config={set:Y,table:X,withList:G,joins:[]}}from(X){return this.config.from=X,this}createJoin(X){return(Y,Z)=>{let $=v1(Y);if(typeof $==="string"&&this.config.joins.some((G)=>G.alias===$))throw Error(`Alias "${$}" is already used in this query`);if(typeof Z==="function"){let G=this.config.from?D(Y,v)?Y[A.Symbol.Columns]:D(Y,T)?Y._.selectedFields:D(Y,L1)?Y[Q].selectedFields:void 0:void 0;Z=Z(new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),G&&new Proxy(G,new b({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:Z,table:Y,joinType:X,alias:$}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(X){return this.config.where=X,this}orderBy(...X){if(typeof X[0]==="function"){let Y=X[0](new Proxy(this.config.table[A.Symbol.Columns],new b({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),Z=Array.isArray(Y)?Y:[Y];this.config.orderBy=Z}else{let Y=X;this.config.orderBy=Y}return this}limit(X){return this.config.limit=X,this}returning(X=this.config.table[v.Symbol.Columns]){return this.config.returning=i(X),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:X,...Y}=this.dialect.sqlToQuery(this.getSQL());return Y}_prepare(X=!0){return this.session[X?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:e(this.config.table)})}prepare(){return this._prepare(!1)}run=(X)=>{return this._prepare().run(X)};all=(X)=>{return this._prepare().all(X)};get=(X)=>{return this._prepare().get(X)};values=(X)=>{return this._prepare().values(X)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}};var NX=class{static[J]="BaseSQLiteDatabase";_query;query;constructor(X,Y,Z,$,G,H,_){this.resultKind=X,this.dialect=Y,this.session=Z,this.rowModeRQB=H,this.forbidJsonb=_,this._=G?{schema:G.schema,fullSchema:G.fullSchema,tableNamesMap:G.tableNamesMap,relations:$}:{schema:void 0,fullSchema:{},tableNamesMap:{},relations:$},this._query={};let z=this._query;if(this._.schema)for(let[O,E]of Object.entries(this._.schema))z[O]=new LZ(X,G.fullSchema,this._.schema,this._.tableNamesMap,G.fullSchema[O],E,Y,Z);this.query={};for(let[O,E]of Object.entries($))this.query[O]=new pZ(X,$,$[E.name].table,E,Y,Z,H,_);this.$cache={invalidate:async(O)=>{}}}$with=(X,Y)=>{let Z=this;return{as:(G)=>{if(typeof G==="function")G=G(new YX(Z.dialect));return new Proxy(new WX(G.getSQL(),Y??("getSelectedFields"in G?G.getSelectedFields()??{}:{}),X,!0),new b({alias:X,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}}};$count(X,Y){return new BZ({source:X,filters:Y,session:this.session})}with(...X){let Y=this;function Z(z){return new X1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X})}function $(z){return new X1({fields:z??void 0,session:Y.session,dialect:Y.dialect,withList:X,distinct:!0})}function G(z){return new kX(z,Y.session,Y.dialect,X)}function H(z){return new KX(z,Y.session,Y.dialect,X)}function _(z){return new VX(z,Y.session,Y.dialect,X)}return{select:Z,selectDistinct:$,update:G,insert:H,delete:_}}select(X){return new X1({fields:X??void 0,session:this.session,dialect:this.dialect})}selectDistinct(X){return new X1({fields:X??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(X){return new kX(X,this.session,this.dialect)}$cache;insert(X){return new KX(X,this.session,this.dialect)}delete(X){return new VX(X,this.session,this.dialect)}run(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.run(Y),()=>Y,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session));return this.session.run(Y)}all(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.all(Y),()=>Y,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session));return this.session.all(Y)}get(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.get(Y),()=>Y,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session));return this.session.get(Y)}values(X){let Y=typeof X==="string"?W.raw(X):X.getSQL();if(this.resultKind==="async")return new XX(async()=>this.session.values(Y),()=>Y,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session));return this.session.values(Y)}transaction(X,Y){return this.session.transaction(X,Y)}};var P2=class{static[J]="Cache"},tZ=class extends P2{static[J]="NoopCache";strategy(){return"all"}async get(X){}async put(X,Y,Z,$){}async onMutate(X){}};async function nX(X,Y){let Z=`${X}-${JSON.stringify(Y,(H,_)=>typeof _==="bigint"?`${_}n`:_)}`,$=new TextEncoder().encode(Z),G=await crypto.subtle.digest("SHA-256",$);return[...new Uint8Array(G)].map((H)=>H.toString(16).padStart(2,"0")).join("")}var nZ=class extends c{static[J]="ExecuteResultSync";constructor(X){super();this.resultCb=X}async execute(){return this.resultCb()}sync(){return this.resultCb()}},iX=class{static[J]="PreparedQuery";joinsNotNullableMap;constructor(X,Y,Z,$,G,H){if(this.mode=X,this.executeMethod=Y,this.query=Z,this.cache=$,this.queryMetadata=G,this.cacheConfig=H,$&&$.strategy()==="all"&&H===void 0)this.cacheConfig={enabled:!0,autoInvalidate:!0};if(!this.cacheConfig?.enabled)this.cacheConfig=void 0}async queryWithCache(X,Y,Z){if(this.cache===void 0||D(this.cache,tZ)||this.queryMetadata===void 0)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.cacheConfig&&!this.cacheConfig.enabled)try{return await Z()}catch($){throw new x1(X,Y,$)}if((this.queryMetadata.type==="insert"||this.queryMetadata.type==="update"||this.queryMetadata.type==="delete")&&this.queryMetadata.tables.length>0)try{let[$]=await Promise.all([Z(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return $}catch($){throw new x1(X,Y,$)}if(!this.cacheConfig)try{return await Z()}catch($){throw new x1(X,Y,$)}if(this.queryMetadata.type==="select"){let $=await this.cache.get(this.cacheConfig.tag??await nX(X,Y),this.queryMetadata.tables,this.cacheConfig.tag!==void 0,this.cacheConfig.autoInvalidate);if($===void 0){let G;try{G=await Z()}catch(H){throw new x1(X,Y,H)}return await this.cache.put(this.cacheConfig.tag??await nX(X,Y),G,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],this.cacheConfig.tag!==void 0,this.cacheConfig.config),G}return $}try{return await Z()}catch($){throw new x1(X,Y,$)}}getQuery(){return this.query}mapRunResult(X,Y){return X}mapAllResult(X,Y){throw Error("Not implemented")}mapGetResult(X,Y){throw Error("Not implemented")}execute(X){if(this.mode==="async")return this[this.executeMethod](X);return new nZ(()=>this[this.executeMethod](X))}mapResult(X,Y){switch(this.executeMethod){case"run":return this.mapRunResult(X,Y);case"all":return this.mapAllResult(X,Y);case"get":return this.mapGetResult(X,Y)}}},lX=class{static[J]="SQLiteSession";constructor(X){this.dialect=X}prepareOneTimeQuery(X,Y,Z,$,G,H,_){return this.prepareQuery(X,Y,Z,$,G,H,_)}prepareOneTimeRelationalQuery(X,Y,Z,$){return this.prepareRelationalQuery(X,Y,Z,$)}run(X){let Y=this.dialect.sqlToQuery(X);try{return this.prepareOneTimeQuery(Y,void 0,"run",!1).run()}catch(Z){throw new W1({cause:Z,message:`Failed to run the query '${Y.sql}'`})}}extractRawRunValueFromBatchResult(X){return X}all(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(X){throw Error("Not implemented")}get(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(X){throw Error("Not implemented")}values(X){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(X),void 0,"run",!1).values()}async count(X){return(await this.values(X))[0][0]}extractRawValuesValueFromBatchResult(X){throw Error("Not implemented")}},aX=class extends NX{static[J]="SQLiteTransaction";constructor(X,Y,Z,$,G,H=0,_,z){super(X,Y,Z,$,G,_,z);this.relations=$,this.schema=G,this.nestedIndex=H}rollback(){throw new TZ}};var XY=class extends lX{static[J]="SQLiteBunSession";logger;constructor(X,Y,Z,$,G={}){super(Y);this.client=X,this.relations=Z,this.schema=$,this.logger=G.logger??new OY}exec(X){this.client.exec(X)}prepareQuery(X,Y,Z,$,G){return new eX(this.client.prepare(X.sql),X,this.logger,Y,Z,$,G)}prepareRelationalQuery(X,Y,Z,$){return new eX(this.client.prepare(X.sql),X,this.logger,Y,Z,!1,$,!0)}transaction(X,Y={}){let Z=new iZ("sync",this.dialect,this,this.relations,this.schema),$;return this.client.transaction(()=>{$=X(Z)})[Y.behavior??"deferred"](),$}},iZ=class X extends aX{static[J]="SQLiteBunTransaction";transaction(Y){let Z=`sp${this.nestedIndex}`,$=new X("sync",this.dialect,this.session,this.relations,this.schema,this.nestedIndex+1);this.session.run(W.raw(`savepoint ${Z}`));try{let G=Y($);return this.session.run(W.raw(`release savepoint ${Z}`)),G}catch(G){throw this.session.run(W.raw(`rollback to savepoint ${Z}`)),G}}},eX=class extends iX{static[J]="SQLiteBunPreparedQuery";constructor(X,Y,Z,$,G,H,_,z){super("sync",G,Y);this.stmt=X,this.logger=Z,this.fields=$,this._isResponseInArrayMode=H,this.customResultMapper=_,this.isRqbV2Query=z}run(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.run(...Y)}all(X){if(this.isRqbV2Query)return this.allRqbV2(X);let{fields:Y,query:Z,logger:$,joinsNotNullableMap:G,stmt:H,customResultMapper:_}=this;if(!Y&&!_){let O=D1(Z.params,X??{});return $.logQuery(Z.sql,O),H.all(...O)}let z=this.values(X);if(_)return _(z);return z.map((O)=>BX(Y,O,G))}get(X){if(this.isRqbV2Query)return this.getRqbV2(X);let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{fields:Z,joinsNotNullableMap:$,customResultMapper:G}=this;if(!Z&&!G){let _=this.stmt.get(...Y);if(!_)return;return _}let H=this.stmt.values(...Y)[0];if(!H)return;if(G)return G([H]);return BX(Z,H,$)}allRqbV2(X){let{query:Y,logger:Z,stmt:$,customResultMapper:G}=this,H=D1(Y.params,X??{});return Z.logQuery(Y.sql,H),G($.all(...H))}getRqbV2(X){let Y=D1(this.query.params,X??{});this.logger.logQuery(this.query.sql,Y);let{stmt:Z,customResultMapper:$}=this,G=Z.get(...Y);if(!G)return;return $([G])}values(X){let Y=D1(this.query.params,X??{});return this.logger.logQuery(this.query.sql,Y),this.stmt.values(...Y)}isResponseInArrayMode(){return this._isResponseInArrayMode}};import{Database as RX}from"bun:sqlite";var lZ=class extends NX{static[J]="SQLiteBunDatabase"};function ZX(X,Y={}){let Z=new xX({casing:Y.casing}),$;if(Y.logger===!0)$=new DY;else if(Y.logger!==!1)$=Y.logger;let G;if(Y.schema){let z=RZ(Y.schema,QZ);G={fullSchema:Y.schema,schema:z.tables,tableNamesMap:z.tableNamesMap}}let H=Y.relations??{},_=new lZ("sync",Z,new XY(X,Z,H,G,{logger:$}),H,G);return _.$client=X,_}function YY(...X){if(X[0]===void 0||typeof X[0]==="string")return ZX(X[0]===void 0?new RX:new RX(X[0]),X[1]);let{connection:Y,client:Z,...$}=X[0];if(Z)return ZX(Z,$);if(typeof Y==="object"){let{source:G,...H}=Y;return ZX(new RX(G,Object.values(H).filter((_)=>_!==void 0).length?H:void 0),$)}return ZX(new RX(Y),$)}(function(X){function Y(Z){return ZX({},Z)}X.mock=Y})(YY||(YY={}));export{D as pm,N as qm,E0 as rm,Y0 as sm,E1 as tm,h as um,x as vm,S1 as wm,$0 as xm,PX as ym,C1 as zm,LX as Am,G0 as Bm,g as Cm,W0 as Dm,W as Em,l as Fm,J0 as Gm,D1 as Hm,y as Im,H0 as Jm,_0 as Km,TX as Lm,SX as Mm,D0 as Nm,j0 as Om,T0 as Pm,q as Qm,a as Rm,h1 as Sm,m as Tm,V1 as Um,I1 as Vm,p1 as Wm,y1 as Xm,f1 as Ym,b1 as Zm,d1 as _m,g1 as $m,m1 as an,c1 as bn,k1 as cn,N1 as dn,u1 as en,r1 as fn,o1 as gn,s1 as hn,t1 as in,n1 as jn,qX as kn,vX as ln,hX as mn,M1 as nn,i1 as on,_J as pn,XY as qn,iZ as rn,eX as sn,lZ as tn,YY as un};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ed as p}from"./chunk-0yjdatm6.js";import{Fd as x,Gd as b,Id as w,Jd as v,Kd as c}from"./chunk-p9mj4zyk.js";import"./chunk-ta7mfkms.js";import{Rd as g}from"./chunk-yajd975f.js";import{Uf as r}from"./chunk-t1jgx17a.js";import{Zg as m}from"./chunk-wcx7hc2p.js";import"./chunk-ehfxypks.js";import"./chunk-9rxyq6f9.js";import"./chunk-5az84brc.js";import"./chunk-94qhpkfx.js";import"./chunk-c1g8n10t.js";import"./chunk-a2dz9nqh.js";import"./chunk-vhe92p7a.js";import{bk as y,tl as f}from"./chunk-a550vst5.js";import"./chunk-e374shb8.js";import"./chunk-zcp0wx4j.js";import"./chunk-epa576pa.js";import"./chunk-y287zwkr.js";import"./chunk-7zc04q43.js";import"./chunk-vtw0wwch.js";import"./chunk-rk2bk4s7.js";import"./chunk-e586sjb0.js";import"./chunk-b50t4jc5.js";import"./chunk-zdzxsyxs.js";import"./chunk-xny5ecn0.js";import"./chunk-8d6e4jg7.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-1sfcxdbw.js";import"./chunk-bgng3rdj.js";import"./chunk-s77qktcn.js";import"./chunk-8v6x712g.js";import"./chunk-pfkm3j8g.js";import"./chunk-h2bmss2m.js";import"./chunk-ywdtp534.js";import"./chunk-03mbn7nj.js";import"./chunk-gr4bctqj.js";import"./chunk-732yr6qq.js";import"./chunk-73fz0cf4.js";import"./chunk-0cdtq1r3.js";import"./chunk-xmjntwjc.js";import"./chunk-tj3rem3q.js";import"./chunk-7q003wdd.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-a92hh67a.js";import"./chunk-qhnpq5gb.js";import"./chunk-f83wv08n.js";import{EOL as S}from"os";function s(e,t,i){return i.trim()?`[redacted:${e}:${t}]`:i}function o(e,t,i){if(!i)return i;return Object.keys(i).length?{redacted:`${e}:${t}`}:i}function a(e,t){return{...t,value:s("file-text",e,t.value)}}function l(e,t){return t?.map((i,u)=>({...i,file:s(`${e}-file`,String(u),i.file),patch:s(`${e}-patch`,String(u),i.patch)}))}function I(e){if(!e.source)return e.source;if(e.source.type==="symbol")return{...e.source,path:s("file-path",e.id,e.source.path),name:s("file-symbol",e.id,e.source.name),text:a(e.id,e.source.text)};if(e.source.type==="resource")return{...e.source,clientName:s("file-client",e.id,e.source.clientName),uri:s("file-uri",e.id,e.source.uri),text:a(e.id,e.source.text)};return{...e.source,path:s("file-path",e.id,e.source.path),text:a(e.id,e.source.text)}}function h(e){return{...e,url:s("file-url",e.id,e.url),filename:e.filename===void 0?void 0:s("file-name",e.id,e.filename),source:I(e)}}function $(e){switch(e.type){case"text":return{...e,text:s("text",e.id,e.text),metadata:o("text-metadata",e.id,e.metadata)};case"reasoning":return{...e,text:s("reasoning",e.id,e.text),metadata:o("reasoning-metadata",e.id,e.metadata)};case"file":return h(e);case"subtask":return{...e,prompt:s("subtask-prompt",e.id,e.prompt),description:s("subtask-description",e.id,e.description),command:e.command===void 0?void 0:s("subtask-command",e.id,e.command)};case"tool":return{...e,metadata:o("tool-metadata",e.id,e.metadata),state:e.state.status==="pending"?{...e.state,input:o("tool-input",e.id,e.state.input)??e.state.input,raw:s("tool-raw",e.id,e.state.raw)}:e.state.status==="running"?{...e.state,input:o("tool-input",e.id,e.state.input)??e.state.input,title:e.state.title===void 0?void 0:s("tool-title",e.id,e.state.title),metadata:o("tool-state-metadata",e.id,e.state.metadata)}:e.state.status==="completed"?{...e.state,input:o("tool-input",e.id,e.state.input)??e.state.input,output:s("tool-output",e.id,e.state.output),title:s("tool-title",e.id,e.state.title),metadata:o("tool-state-metadata",e.id,e.state.metadata)??e.state.metadata,attachments:e.state.attachments?.map(h)}:{...e.state,input:o("tool-input",e.id,e.state.input)??e.state.input,metadata:o("tool-state-metadata",e.id,e.state.metadata)}};case"patch":return{...e,hash:s("patch",e.id,e.hash),files:e.files.map((t,i)=>s("patch-file",`${e.id}-${i}`,t))};case"snapshot":return{...e,snapshot:s("snapshot",e.id,e.snapshot)};case"step-start":return{...e,snapshot:e.snapshot===void 0?void 0:s("snapshot",e.id,e.snapshot)};case"step-finish":return{...e,snapshot:e.snapshot===void 0?void 0:s("snapshot",e.id,e.snapshot)};case"agent":return{...e,source:!e.source?e.source:{...e.source,value:s("agent-source",e.id,e.source.value)}};default:return e}}var D=$;function P(e){return{info:{...e.info,title:s("session-title",e.info.id,e.info.title),directory:s("session-directory",e.info.id,e.info.directory),summary:!e.info.summary?e.info.summary:{...e.info.summary,diffs:l("session-diff",e.info.summary.diffs)},revert:!e.info.revert?e.info.revert:{...e.info.revert,snapshot:e.info.revert.snapshot===void 0?void 0:s("revert-snapshot",e.info.id,e.info.revert.snapshot),diff:e.info.revert.diff===void 0?void 0:s("revert-diff",e.info.id,e.info.revert.diff)}},messages:e.messages.map((t)=>({info:t.info.role==="user"?{...t.info,system:t.info.system===void 0?void 0:s("system",t.info.id,t.info.system),summary:!t.info.summary?t.info.summary:{...t.info.summary,title:t.info.summary.title===void 0?void 0:s("summary-title",t.info.id,t.info.summary.title),body:t.info.summary.body===void 0?void 0:s("summary-body",t.info.id,t.info.summary.body),diffs:l("message-diff",t.info.summary.diffs)}}:{...t.info,path:{cwd:s("cwd",t.info.id,t.info.path.cwd),root:s("root",t.info.id,t.info.path.root)}},parts:t.parts.map(D)}))}}var A=g({command:"export [sessionID]",describe:"export session data as JSON",builder:(e)=>{return e.positional("sessionID",{describe:"session id to export",type:"string"}).option("sanitize",{describe:"redact sensitive transcript and file data",type:"boolean"})},handler:async(e)=>{await p(process.cwd(),async()=>{let t=e.sessionID?y.make(e.sessionID):void 0;if(process.stderr.write(`Exporting session: ${t??"latest"}
|
|
3
3
|
`),!t){r.empty(),v("Export session",{output:process.stderr});let i=[];for await(let n of f.list())i.push(n);if(i.length===0){w.error("No sessions found",{output:process.stderr}),c("Done",{output:process.stderr});return}i.sort((n,d)=>d.time.updated-n.time.updated);let u=await b({message:"Select session to export",maxItems:10,options:i.map((n)=>({label:n.title,value:n.id,hint:`${new Date(n.time.updated).toLocaleString()} \u2022 ${n.id.slice(-8)}`})),output:process.stderr});if(x(u))throw new r.CancelledError;t=u,c("Exporting session...",{output:process.stderr})}try{let i=await m.runPromise(f.Service.use((d)=>d.get(t))),u=await m.runPromise(f.Service.use((d)=>d.messages({sessionID:i.id,agentID:"*"}))),n={info:i,messages:u};process.stdout.write(JSON.stringify(e.sanitize?P(n):n,null,2)),process.stdout.write(S)}catch{r.error(`Session not found: ${t}`),process.exit(1)}})}});export{A as ExportCommand};
|