@qitqode/qitqode-android-arm64 0.2.13 → 0.2.15
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 +2 -2
- package/bundle/{chunk-9c0f79mt.js → chunk-00ft63qn.js} +1 -1
- package/bundle/{chunk-vr7525pa.js → chunk-02tmc2st.js} +1 -1
- package/bundle/{chunk-ewde5bss.js → chunk-06tgmvh6.js} +2 -2
- package/bundle/{chunk-wqm1vawg.js → chunk-0ejx0yqx.js} +1 -1
- package/bundle/{chunk-2md5fz4f.js → chunk-0m4gvjcv.js} +2 -2
- package/bundle/{chunk-jf4zyy7r.js → chunk-0mztgsxp.js} +1 -1
- package/bundle/{chunk-7bvh48s2.js → chunk-10kj86va.js} +1 -1
- package/bundle/{chunk-b46t2315.js → chunk-10q04xh5.js} +1 -1
- package/bundle/{chunk-dwjv3m5s.js → chunk-175720ws.js} +2 -2
- package/bundle/{chunk-xgphhnpk.js → chunk-19rs84t8.js} +1 -1
- package/bundle/{chunk-hsmtjb4d.js → chunk-1bq15kf0.js} +2 -2
- package/bundle/{chunk-1sejtx9a.js → chunk-1e75j4m1.js} +2 -2
- package/bundle/{chunk-dmgdwvn1.js → chunk-1pft3sar.js} +1 -1
- package/bundle/chunk-1r7anzk5.js +2 -0
- package/bundle/{chunk-rr94dpe9.js → chunk-1ypzf18e.js} +1 -1
- package/bundle/{chunk-q7wc3frq.js → chunk-2d61z24r.js} +1 -1
- package/bundle/{chunk-r9hsd9pw.js → chunk-2fged9vy.js} +1 -1
- package/bundle/chunk-2jzay8a9.js +2 -0
- package/bundle/{chunk-5828bcp8.js → chunk-2k2szpze.js} +1 -1
- package/bundle/{chunk-2p1qaqv3.js → chunk-2pw56zpj.js} +2 -2
- package/bundle/{chunk-yzxcjr6y.js → chunk-2tkgtasa.js} +2 -2
- package/bundle/{chunk-jrh028na.js → chunk-2w3n0q9m.js} +2 -2
- package/bundle/chunk-30rghawe.js +2 -0
- package/bundle/{chunk-jt94rhev.js → chunk-3152y1q9.js} +1 -1
- package/bundle/{chunk-1851skhm.js → chunk-31a47ptm.js} +1 -1
- package/bundle/chunk-33mzqyyb.js +3 -0
- package/bundle/{chunk-fqzfytjk.js → chunk-3c73rngn.js} +1 -1
- package/bundle/{chunk-wspm2k19.js → chunk-3cs1qf8x.js} +1 -1
- package/bundle/chunk-3dajnr1w.js +2 -0
- package/bundle/chunk-3ege6krg.js +2 -0
- package/bundle/chunk-43vpxggb.js +2 -0
- package/bundle/{chunk-hcd0k14e.js → chunk-48rg4yhk.js} +2 -2
- package/bundle/chunk-49y7zg15.js +2 -0
- package/bundle/{chunk-etvwxwn3.js → chunk-4b56k59w.js} +1 -1
- package/bundle/{chunk-aq75kv5f.js → chunk-4gzggzc0.js} +3 -3
- package/bundle/{chunk-rqdfmbns.js → chunk-4jfnhghx.js} +2 -2
- package/bundle/{chunk-g6ffx794.js → chunk-4ppw719f.js} +1 -1
- package/bundle/{chunk-g0x6q2ks.js → chunk-4r7fbkcm.js} +1 -1
- package/bundle/{chunk-5fbzvy6q.js → chunk-4s1n38ds.js} +2 -2
- package/bundle/{chunk-z6qb4gt5.js → chunk-4v29ayke.js} +1 -1
- package/bundle/{chunk-qa38xchd.js → chunk-4xcwnwd6.js} +1 -1
- package/bundle/{chunk-gvc1mqrs.js → chunk-4xqwt6dr.js} +2 -2
- package/bundle/{chunk-1bhcg889.js → chunk-4ycg2c6f.js} +2 -2
- package/bundle/{chunk-3be70hxy.js → chunk-4yd2vvh6.js} +1 -1
- package/bundle/{chunk-pzn7cade.js → chunk-5341jv20.js} +1 -1
- package/bundle/{chunk-z4gczap3.js → chunk-5asf8f41.js} +72 -72
- package/bundle/{chunk-z6f54x4k.js → chunk-5cwy8y78.js} +2 -2
- package/bundle/{chunk-6g3bzap8.js → chunk-5dvy83ms.js} +2 -2
- package/bundle/{chunk-ff031crt.js → chunk-5h1s0akp.js} +1 -1
- package/bundle/{chunk-tn0sfsks.js → chunk-5mf4qrye.js} +2 -2
- package/bundle/{chunk-0mdmqtfr.js → chunk-5q98z8ck.js} +2 -2
- package/bundle/chunk-5qhsfjzq.js +3 -0
- package/bundle/chunk-5re7995e.js +2 -0
- package/bundle/{chunk-y9kjt2jj.js → chunk-5rvvfgfy.js} +2 -2
- package/bundle/chunk-5xxn06g0.js +2 -0
- package/bundle/{chunk-2d0vympj.js → chunk-61b81z2h.js} +1 -1
- package/bundle/{chunk-4enhsmq1.js → chunk-62gefpwn.js} +2 -2
- package/bundle/{chunk-2h8b0csf.js → chunk-674pexjx.js} +2 -2
- package/bundle/{chunk-4ar8hey8.js → chunk-69htq8kq.js} +1 -1
- package/bundle/{chunk-h1p3xcfp.js → chunk-69k7cdtv.js} +2 -2
- package/bundle/{chunk-53n3tfwn.js → chunk-6cztstry.js} +2 -2
- package/bundle/{chunk-vqxyk6as.js → chunk-6dd2dx69.js} +2 -2
- package/bundle/{chunk-eftk07r3.js → chunk-6j53vtzd.js} +1 -1
- package/bundle/chunk-6k0y2332.js +2 -0
- package/bundle/{chunk-sn15skh8.js → chunk-6pt6nqwk.js} +1 -1
- package/bundle/{chunk-6wt8g6mc.js → chunk-6qwnty59.js} +2 -2
- package/bundle/{chunk-vvmvryh1.js → chunk-6yshpz0z.js} +2 -2
- package/bundle/{chunk-cv3xdp8q.js → chunk-6zdzbmzs.js} +394 -323
- package/bundle/{chunk-2ts2s8b4.js → chunk-71jmhvef.js} +2 -2
- package/bundle/{chunk-9xbc558j.js → chunk-73a7ts8r.js} +1 -1
- package/bundle/{chunk-sv27ep93.js → chunk-76wm7tw8.js} +2 -2
- package/bundle/chunk-7cp30q0t.js +2 -0
- package/bundle/chunk-7t63wz2f.js +2 -0
- package/bundle/{chunk-v30fmrz0.js → chunk-7w571q26.js} +1 -1
- package/bundle/{chunk-fbd971t7.js → chunk-83n11xym.js} +3 -3
- package/bundle/{chunk-m18pxkdg.js → chunk-840mmmzz.js} +4 -4
- package/bundle/{chunk-jcn8bg31.js → chunk-86reb44c.js} +1 -1
- package/bundle/{chunk-hnbtfpb7.js → chunk-86sfzgnf.js} +1 -1
- package/bundle/{chunk-4krmja97.js → chunk-878sb0es.js} +2 -2
- package/bundle/{chunk-v9yxkbz7.js → chunk-8a9sj8gp.js} +1 -1
- package/bundle/{chunk-0cjp9088.js → chunk-8gkz5550.js} +1 -1
- package/bundle/chunk-8gz8fk6r.js +2 -0
- package/bundle/chunk-8ht7cq3h.js +2 -0
- package/bundle/{chunk-msbe5rb7.js → chunk-8mqcar7f.js} +1 -1
- package/bundle/{chunk-3rcfy8te.js → chunk-8qpfphdz.js} +1 -1
- package/bundle/chunk-8qv0119d.js +2 -0
- package/bundle/{chunk-t1hw67x4.js → chunk-8zpsgfb6.js} +1 -1
- package/bundle/{chunk-c99npyz9.js → chunk-96sra8g8.js} +1 -1
- package/bundle/{chunk-nn2hbew8.js → chunk-99df6wvm.js} +1 -1
- package/bundle/{chunk-5wjwzbk8.js → chunk-9amnqaeq.js} +1 -1
- package/bundle/{chunk-hk8m8vax.js → chunk-9kc2th5c.js} +2 -2
- package/bundle/chunk-9m0eawt5.js +2 -0
- package/bundle/{chunk-fj87htwn.js → chunk-9mabvb06.js} +1 -1
- package/bundle/{chunk-xn6mwsc9.js → chunk-9ttebtcf.js} +1 -1
- package/bundle/{chunk-mfg4stzn.js → chunk-a1mbach4.js} +1 -1
- package/bundle/chunk-a32y70fe.js +2 -0
- package/bundle/{chunk-hgcnzsd5.js → chunk-a3g8de96.js} +1 -1
- package/bundle/{chunk-bydaqb08.js → chunk-a8askx4y.js} +1 -1
- package/bundle/{chunk-gcpwm7b5.js → chunk-adws0hhk.js} +2 -2
- package/bundle/{chunk-08mgb5tt.js → chunk-ae1b15bd.js} +12 -10
- package/bundle/{chunk-y5m9c5ek.js → chunk-ahgb3r1c.js} +2 -2
- package/bundle/chunk-apneazwv.js +2 -0
- package/bundle/{chunk-6p848y99.js → chunk-art8gejd.js} +1 -1
- package/bundle/{chunk-eh73j82b.js → chunk-avksqxan.js} +1 -1
- package/bundle/chunk-aw5yv01t.js +2 -0
- package/bundle/chunk-az12tp53.js +2 -0
- package/bundle/{chunk-gjmxrz0v.js → chunk-b350g18y.js} +2 -2
- package/bundle/chunk-b5dpzcc7.js +2 -0
- package/bundle/{chunk-c1srcpfk.js → chunk-b6m5tr80.js} +1 -1
- package/bundle/chunk-baq0wk3q.js +2 -0
- package/bundle/chunk-bcgtqx3g.js +2 -0
- package/bundle/{chunk-0w77vhg4.js → chunk-bdcd2mcb.js} +2 -2
- package/bundle/chunk-bde5d507.js +2 -0
- package/bundle/{chunk-139qfnsq.js → chunk-bemyyen3.js} +1 -1
- package/bundle/{chunk-1bbx1da7.js → chunk-bmdqb48f.js} +1 -1
- package/bundle/{chunk-bpv378bm.js → chunk-bq6cvf16.js} +2 -2
- package/bundle/{chunk-t66gerft.js → chunk-bxnsrggq.js} +1 -1
- package/bundle/{chunk-2b80n6nx.js → chunk-bzh71a92.js} +1 -1
- package/bundle/chunk-bzzggc3s.js +2 -0
- package/bundle/{chunk-2bfq0mtx.js → chunk-c1wc4b5q.js} +1 -1
- package/bundle/{chunk-78rfz0ex.js → chunk-c5cyt23k.js} +2 -2
- package/bundle/chunk-c8qx439t.js +2 -0
- package/bundle/{chunk-t1e52h0k.js → chunk-ch7s512a.js} +1 -1
- package/bundle/chunk-ckw51fn6.js +2 -0
- package/bundle/{chunk-1rafe6f5.js → chunk-crqycrs4.js} +2 -2
- package/bundle/{chunk-bd4krah7.js → chunk-csy1v12x.js} +1 -1
- package/bundle/{chunk-z2cnd2cp.js → chunk-d10qre1b.js} +1 -1
- package/bundle/{chunk-v6djkm35.js → chunk-d385e2qt.js} +1 -1
- package/bundle/{chunk-paqy0c2v.js → chunk-d4faz5xa.js} +1 -1
- package/bundle/{chunk-8xbd0ra5.js → chunk-d7h1dp0h.js} +1 -1
- package/bundle/chunk-denp0wrq.js +2 -0
- package/bundle/chunk-depxzjer.js +2 -0
- package/bundle/chunk-dhvqpcf3.js +2 -0
- package/bundle/{chunk-gdawpkxs.js → chunk-djdfpezf.js} +1 -1
- package/bundle/chunk-dkqqswbv.js +2 -0
- package/bundle/{chunk-e4658j15.js → chunk-dmb0ez0m.js} +3 -3
- package/bundle/chunk-dpbm03yh.js +2 -0
- package/bundle/{chunk-es6vbsjg.js → chunk-dvp0r93q.js} +1 -1
- package/bundle/{chunk-374js0y6.js → chunk-e18hshcg.js} +1 -1
- package/bundle/{chunk-5rtsnnjk.js → chunk-e37gd3p2.js} +1 -1
- package/bundle/chunk-e5t7jsxa.js +2 -0
- package/bundle/{chunk-wac35a6p.js → chunk-e611m0p4.js} +1 -1
- package/bundle/chunk-eb811dt2.js +2 -0
- package/bundle/{chunk-95ga21eq.js → chunk-edvfqxfr.js} +1 -1
- package/bundle/{chunk-yhe5qz48.js → chunk-ej0yzstw.js} +2 -2
- package/bundle/{chunk-7p8f8xav.js → chunk-ep4drmt9.js} +1 -1
- package/bundle/{chunk-xaewye8w.js → chunk-eqsank84.js} +1 -1
- package/bundle/{chunk-84712kbe.js → chunk-estc7tzt.js} +2 -2
- package/bundle/{chunk-s7ypkpg2.js → chunk-et3tgx7t.js} +1 -1
- package/bundle/{chunk-trg0zg0q.js → chunk-f0dp1tf9.js} +1 -1
- package/bundle/{chunk-z1psybn1.js → chunk-f0x3q5dj.js} +2 -2
- package/bundle/chunk-fbz2xv2w.js +2 -0
- package/bundle/{chunk-mbma071k.js → chunk-fdmz0502.js} +2 -2
- package/bundle/{chunk-mrh5q4s6.js → chunk-ffx0cr44.js} +2 -2
- package/bundle/{chunk-e6s8ep9m.js → chunk-ffyj5nsg.js} +2 -2
- package/bundle/chunk-ffynh19k.js +2 -0
- package/bundle/chunk-fgr9xshx.js +2 -0
- package/bundle/{chunk-9a9qcvtz.js → chunk-fkq0v5qv.js} +2 -2
- package/bundle/{chunk-mp5m0acf.js → chunk-fmcg649e.js} +1 -1
- package/bundle/{chunk-g3y5kvg6.js → chunk-fp2xgnjn.js} +2 -2
- package/bundle/{chunk-rwt0rwvn.js → chunk-fswt9qc0.js} +2 -2
- package/bundle/{chunk-1exjy880.js → chunk-g77kddrs.js} +2 -2
- package/bundle/chunk-gbvcb4k1.js +2 -0
- package/bundle/{chunk-mgff8bcx.js → chunk-gd0j16gn.js} +1 -1
- package/bundle/chunk-gdtnqzbp.js +2 -0
- package/bundle/{chunk-hrfdrz36.js → chunk-gfvq78gy.js} +1 -1
- package/bundle/chunk-gkfvhh28.js +2 -0
- package/bundle/chunk-gvx5hmhk.js +2 -0
- package/bundle/chunk-gww6abk3.js +2 -0
- package/bundle/{chunk-1f9qcrn6.js → chunk-h036zy9e.js} +2 -2
- package/bundle/{chunk-71naz1qp.js → chunk-h6b5966p.js} +1 -1
- package/bundle/{chunk-zhddj91f.js → chunk-hf39qx6t.js} +2 -2
- package/bundle/chunk-hham7r33.js +2 -0
- package/bundle/chunk-hmm0gj34.js +3 -0
- package/bundle/{chunk-404ew3d3.js → chunk-hmmn62jg.js} +1 -1
- package/bundle/{chunk-map852em.js → chunk-hrcqbadm.js} +1 -1
- package/bundle/chunk-hsjbe5zy.js +2 -0
- package/bundle/{chunk-04x4b2yy.js → chunk-j15wejz0.js} +1 -1
- package/bundle/{chunk-5es19n1m.js → chunk-j2snkw45.js} +2 -2
- package/bundle/{chunk-z66xdxkg.js → chunk-j3agzs13.js} +2 -2
- package/bundle/{chunk-4wzv2v36.js → chunk-j45p2v4a.js} +3 -3
- package/bundle/{chunk-094m66q5.js → chunk-j46bxb1b.js} +1 -1
- package/bundle/chunk-j89sv999.js +2 -0
- package/bundle/{chunk-1gt6ppza.js → chunk-k0chq88p.js} +1 -1
- package/bundle/{chunk-81mwbcy3.js → chunk-k4wfq9cn.js} +2 -2
- package/bundle/{chunk-8t17w67q.js → chunk-k769v1ds.js} +1 -1
- package/bundle/{chunk-rf9pjbg3.js → chunk-k8dbc1p5.js} +1 -1
- package/bundle/chunk-k9b4005p.js +2 -0
- package/bundle/{chunk-xgdst5n5.js → chunk-kegvr7wt.js} +2 -2
- package/bundle/chunk-kht2kwam.js +2 -0
- package/bundle/{chunk-h2vtypa5.js → chunk-knqpyc7s.js} +1 -1
- package/bundle/{chunk-8hrt4d0v.js → chunk-ky3fhz9z.js} +1 -1
- package/bundle/chunk-kzkb4648.js +2 -0
- package/bundle/chunk-m2540waa.js +2 -0
- package/bundle/{chunk-hp9q7vvq.js → chunk-m6967jtv.js} +2 -2
- package/bundle/{chunk-7h0regqs.js → chunk-m8kjtp60.js} +1 -1
- package/bundle/{chunk-q65qzc9w.js → chunk-mbmaeq0a.js} +1 -1
- package/bundle/chunk-mdxtt9wv.js +8 -0
- package/bundle/{chunk-anm5g0m4.js → chunk-meehnnv9.js} +2 -2
- package/bundle/{chunk-k3x6z5q1.js → chunk-mjkwd1sz.js} +1 -1
- package/bundle/{chunk-dpm5x19e.js → chunk-mnjz8nqs.js} +2 -2
- package/bundle/{chunk-e0w082wt.js → chunk-mq3w4z8k.js} +184 -184
- package/bundle/chunk-mreacz8r.js +2 -0
- package/bundle/chunk-mscvm1rm.js +2 -0
- package/bundle/chunk-mw3hh526.js +2 -0
- package/bundle/chunk-n3nsrk5n.js +2 -0
- package/bundle/chunk-n4qbnecw.js +35 -0
- package/bundle/{chunk-wrkt670m.js → chunk-n7zd97hy.js} +2 -2
- package/bundle/chunk-n9nmc4q4.js +2 -0
- package/bundle/{chunk-p3tcw42f.js → chunk-nb4xtk1n.js} +1 -1
- package/bundle/chunk-nj4as8vy.js +2 -0
- package/bundle/chunk-nxm6gpyv.js +2 -0
- package/bundle/{chunk-5gv6r7v8.js → chunk-nyxn7npc.js} +1 -1
- package/bundle/{chunk-mhn0a828.js → chunk-nzz7gzg2.js} +1 -1
- package/bundle/{chunk-y9mxwwz7.js → chunk-p0852vfn.js} +2 -2
- package/bundle/{chunk-xrb46v1e.js → chunk-p4xqfkbh.js} +1 -1
- package/bundle/{chunk-7nh8vjx4.js → chunk-pdcxmr6x.js} +1 -1
- package/bundle/chunk-pqzx9ha6.js +2 -0
- package/bundle/{chunk-w264gs2c.js → chunk-prz2fkn9.js} +1 -1
- package/bundle/{chunk-d2049chz.js → chunk-psmwrvqs.js} +2 -2
- package/bundle/{chunk-4d9s7cgr.js → chunk-pwq2f75j.js} +1 -1
- package/bundle/{chunk-5psekq9f.js → chunk-pwrwb7mn.js} +1 -1
- package/bundle/{chunk-1wy8wmah.js → chunk-px69995t.js} +1 -1
- package/bundle/{chunk-pfen4ekj.js → chunk-q1dmxn63.js} +2 -2
- package/bundle/{chunk-ycth54ja.js → chunk-q896qkhe.js} +1 -1
- package/bundle/chunk-qbjqkezn.js +2 -0
- package/bundle/chunk-qhtp1xvx.js +2 -0
- package/bundle/{chunk-hd6sd912.js → chunk-qk6jh32z.js} +1 -1
- package/bundle/chunk-qkztgpay.js +2 -0
- package/bundle/{chunk-x0wy15q9.js → chunk-qn1fhqyw.js} +2 -2
- package/bundle/{chunk-n73ckwr7.js → chunk-qpk7jp6t.js} +1 -1
- package/bundle/{chunk-7k1q26yn.js → chunk-qrztx1b4.js} +2 -2
- package/bundle/{chunk-dzy3ezht.js → chunk-rd08wx37.js} +2 -2
- package/bundle/{chunk-ba2hn77m.js → chunk-rk4c0zat.js} +1 -1
- package/bundle/{chunk-mqtj38j9.js → chunk-rn3je2hv.js} +1 -1
- package/bundle/chunk-rnf3dy0y.js +2 -0
- package/bundle/{chunk-72qx43fq.js → chunk-rqap90xh.js} +2 -2
- package/bundle/chunk-rry4kq85.js +2 -0
- package/bundle/{chunk-47pxz6cb.js → chunk-rt49c6js.js} +2 -2
- package/bundle/{chunk-5a4zt1b7.js → chunk-rws2tsdv.js} +1 -1
- package/bundle/{chunk-r65zw08x.js → chunk-rx9eh3db.js} +3 -3
- package/bundle/{chunk-tzw56029.js → chunk-rxt6gktt.js} +1 -1
- package/bundle/chunk-ryfj80q6.js +2 -0
- package/bundle/{chunk-ec1bwa7f.js → chunk-s0gmxpxm.js} +2 -2
- package/bundle/{chunk-8psfgg8y.js → chunk-s9epttpy.js} +1 -1
- package/bundle/{chunk-gtmtvjwc.js → chunk-sb3cgb4v.js} +1 -1
- package/bundle/{chunk-p863r97y.js → chunk-set1f1wr.js} +1 -1
- package/bundle/{chunk-zgj7jx8k.js → chunk-sg9enzsp.js} +2 -2
- package/bundle/{chunk-0xf12tf3.js → chunk-sh03ka27.js} +1 -1
- package/bundle/chunk-snx49w8h.js +2 -0
- package/bundle/{chunk-610mqqqa.js → chunk-spcdwmy4.js} +1 -1
- package/bundle/{chunk-ydz7387e.js → chunk-sy76e7nr.js} +1 -1
- package/bundle/{chunk-csbndz33.js → chunk-szfqmkj6.js} +1 -1
- package/bundle/chunk-t21mdqbb.js +2 -0
- package/bundle/{chunk-t7gp6mjm.js → chunk-tcyzj3rz.js} +1 -1
- package/bundle/chunk-tkbjcznz.js +2 -0
- package/bundle/chunk-tn2yyqeb.js +2 -0
- package/bundle/chunk-ttebf3nt.js +2 -0
- package/bundle/chunk-twpfh0mx.js +2 -0
- package/bundle/{chunk-a4242cn4.js → chunk-tz1bzrnh.js} +1 -1
- package/bundle/chunk-tzf6d5qy.js +2 -0
- package/bundle/{chunk-hzzvmr41.js → chunk-v1axkp21.js} +2 -2
- package/bundle/chunk-v2mq09wx.js +2 -0
- package/bundle/chunk-v59a02aj.js +2 -0
- package/bundle/{chunk-8rbbt1s8.js → chunk-v5me0cj9.js} +1 -1
- package/bundle/{chunk-gw2fz5ry.js → chunk-v7v0krrj.js} +1 -1
- package/bundle/{chunk-9r6wk75s.js → chunk-veptx3fk.js} +1 -1
- package/bundle/{chunk-d4ys15w3.js → chunk-vgmgg994.js} +1 -1
- package/bundle/{chunk-vvcyvdnk.js → chunk-vr13f6b5.js} +2 -2
- package/bundle/{chunk-jmrqp50k.js → chunk-vsv4p060.js} +1 -1
- package/bundle/chunk-vxr4rzt0.js +2 -0
- package/bundle/chunk-w0h9rczg.js +2 -0
- package/bundle/{chunk-fmvmp278.js → chunk-w0t1ajhg.js} +1 -1
- package/bundle/{chunk-6jb4mnvq.js → chunk-w136zswr.js} +3 -3
- package/bundle/chunk-w8344et5.js +2 -0
- package/bundle/{chunk-b274mb6v.js → chunk-w8nj5ph5.js} +1 -1
- package/bundle/chunk-weyg78et.js +2 -0
- package/bundle/{chunk-6kpk6pr3.js → chunk-wf0n1cs9.js} +1 -1
- package/bundle/{chunk-00krzh3y.js → chunk-wfpnv00c.js} +2 -2
- package/bundle/{chunk-mchf2bcc.js → chunk-wne3v1fk.js} +2 -2
- package/bundle/{chunk-wwtyrgga.js → chunk-wrzn87w0.js} +1 -1
- package/bundle/{chunk-npryn3en.js → chunk-ws720v4j.js} +1 -1
- package/bundle/chunk-wyavgt96.js +2 -0
- package/bundle/{chunk-t4kma6mq.js → chunk-x0de4z05.js} +2 -2
- package/bundle/{chunk-qqftaqza.js → chunk-x3dzzq0t.js} +1 -1
- package/bundle/{chunk-45dtsre6.js → chunk-x4jnyj09.js} +1 -1
- package/bundle/chunk-xchj8gna.js +2 -0
- package/bundle/{chunk-s81ck6bw.js → chunk-xdcwx384.js} +1 -1
- package/bundle/{chunk-yqvqzg7b.js → chunk-xmf59618.js} +1 -1
- package/bundle/{chunk-1rw4srd1.js → chunk-xxck1man.js} +1 -1
- package/bundle/{chunk-yg5azmxb.js → chunk-y4cz5s3h.js} +2 -2
- package/bundle/{chunk-vzj91hg8.js → chunk-yg9n2a2d.js} +1 -1
- package/bundle/{chunk-eefzbdbk.js → chunk-yhpwceqg.js} +2 -2
- package/bundle/{chunk-h9tcpbr7.js → chunk-yms3bsm7.js} +1 -1
- package/bundle/{chunk-9h2fms7x.js → chunk-ytfq6rn9.js} +1 -1
- package/bundle/chunk-yvjecrjy.js +2 -0
- package/bundle/{chunk-xpz5mnwz.js → chunk-yvtkx4x4.js} +1 -1
- package/bundle/chunk-yw2x6by6.js +2 -0
- package/bundle/{chunk-0ware2sh.js → chunk-ywj77e0m.js} +2 -2
- package/bundle/{chunk-962hspr0.js → chunk-z0dj15g9.js} +1 -1
- package/bundle/chunk-z0r4syk8.js +2 -0
- package/bundle/{chunk-1q5h95hc.js → chunk-z6qyx227.js} +1 -1
- package/bundle/chunk-z7c00g63.js +2 -0
- package/bundle/chunk-z93n3cbm.js +2 -0
- package/bundle/{chunk-3fx3eghq.js → chunk-zbt53cb5.js} +1 -1
- package/bundle/{chunk-tks3qzsw.js → chunk-zgwasq3p.js} +1 -1
- package/bundle/{chunk-6dmk2eyt.js → chunk-zh7e6kqs.js} +1 -1
- package/bundle/{chunk-4s9d2zte.js → chunk-zhhcfqhh.js} +1 -1
- package/bundle/{chunk-4q14whpc.js → chunk-zjyaze0d.js} +1 -1
- package/bundle/chunk-znr0saas.js +2 -0
- package/bundle/chunk-zqqt7v17.js +2 -0
- package/bundle/chunk-zwrgh1hc.js +2 -0
- package/bundle/chunk-zwxp07yc.js +2 -0
- package/bundle/{chunk-821zkh5v.js → chunk-zx63mepv.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-0nves64y.js +0 -2
- package/bundle/chunk-0v7knkt5.js +0 -2
- package/bundle/chunk-1h5jdsgx.js +0 -2
- package/bundle/chunk-1r5e1jsb.js +0 -2
- package/bundle/chunk-1wyy3c48.js +0 -2
- package/bundle/chunk-1z299xq6.js +0 -2
- package/bundle/chunk-21aqt31s.js +0 -2
- package/bundle/chunk-22aq9ymg.js +0 -2
- package/bundle/chunk-26a17c9z.js +0 -2
- package/bundle/chunk-2a154mr0.js +0 -2
- package/bundle/chunk-2nbce486.js +0 -2
- package/bundle/chunk-2npxatq9.js +0 -2
- package/bundle/chunk-3gryj9r9.js +0 -2
- package/bundle/chunk-3jnanbjr.js +0 -2
- package/bundle/chunk-3meh1cbc.js +0 -2
- package/bundle/chunk-3t71xfr6.js +0 -2
- package/bundle/chunk-4045jzv5.js +0 -2
- package/bundle/chunk-4b2vv484.js +0 -2
- package/bundle/chunk-4ene1ymj.js +0 -2
- package/bundle/chunk-58r5etg8.js +0 -2
- package/bundle/chunk-5c2zw4h0.js +0 -2
- package/bundle/chunk-5e0vejcb.js +0 -8
- package/bundle/chunk-608f83n0.js +0 -2
- package/bundle/chunk-671r50ry.js +0 -2
- package/bundle/chunk-6bfnhr3d.js +0 -2
- package/bundle/chunk-6cv6d8rw.js +0 -2
- package/bundle/chunk-6qm6f88j.js +0 -2
- package/bundle/chunk-78bfwwmc.js +0 -2
- package/bundle/chunk-7wwtgxxf.js +0 -2
- package/bundle/chunk-98sb49dz.js +0 -2
- package/bundle/chunk-9kbtpq9m.js +0 -2
- package/bundle/chunk-9szp9b4m.js +0 -2
- package/bundle/chunk-9xqszq0c.js +0 -2
- package/bundle/chunk-a32kjs9e.js +0 -2
- package/bundle/chunk-ajykvcas.js +0 -2
- package/bundle/chunk-apym02ct.js +0 -2
- package/bundle/chunk-armv2rv5.js +0 -2
- package/bundle/chunk-as215v64.js +0 -2
- package/bundle/chunk-bnmpgpyf.js +0 -2
- package/bundle/chunk-bq3zt1x1.js +0 -2
- package/bundle/chunk-bx8fgjam.js +0 -2
- package/bundle/chunk-ckcnb59t.js +0 -2
- package/bundle/chunk-d79xaj6s.js +0 -3
- package/bundle/chunk-dah2d37s.js +0 -2
- package/bundle/chunk-dhgjv1n2.js +0 -2
- package/bundle/chunk-dk9k8ff5.js +0 -2
- package/bundle/chunk-dymysn4h.js +0 -2
- package/bundle/chunk-ev4gw5k6.js +0 -2
- package/bundle/chunk-ew2dxm43.js +0 -2
- package/bundle/chunk-ffp4wg27.js +0 -2
- package/bundle/chunk-hjy90gt2.js +0 -2
- package/bundle/chunk-hmden934.js +0 -2
- package/bundle/chunk-hsm8fbb1.js +0 -2
- package/bundle/chunk-hz1xfedb.js +0 -2
- package/bundle/chunk-ja9y478k.js +0 -2
- package/bundle/chunk-jam7xyjf.js +0 -2
- package/bundle/chunk-k51qphrk.js +0 -2
- package/bundle/chunk-kee7xpe3.js +0 -2
- package/bundle/chunk-p13eeqe4.js +0 -2
- package/bundle/chunk-p45f2nyb.js +0 -2
- package/bundle/chunk-qvwx32p9.js +0 -35
- package/bundle/chunk-qw9whsy2.js +0 -2
- package/bundle/chunk-r77kpzdv.js +0 -2
- package/bundle/chunk-rc95tp19.js +0 -2
- package/bundle/chunk-rmh2fhqy.js +0 -2
- package/bundle/chunk-rrn86a8w.js +0 -2
- package/bundle/chunk-s8v0h63x.js +0 -2
- package/bundle/chunk-sh4mngre.js +0 -2
- package/bundle/chunk-shqqngm8.js +0 -2
- package/bundle/chunk-sjfcwykr.js +0 -2
- package/bundle/chunk-sv01v0n0.js +0 -2
- package/bundle/chunk-tn8hsd2c.js +0 -2
- package/bundle/chunk-tqsx7w8z.js +0 -2
- package/bundle/chunk-tyt1negg.js +0 -2
- package/bundle/chunk-v580zwpf.js +0 -3
- package/bundle/chunk-vdv6cyh0.js +0 -2
- package/bundle/chunk-vsk8yfxp.js +0 -2
- package/bundle/chunk-vvgmkjym.js +0 -2
- package/bundle/chunk-vzf04vad.js +0 -2
- package/bundle/chunk-w0zyex7f.js +0 -2
- package/bundle/chunk-w623r5kb.js +0 -3
- package/bundle/chunk-wkxt9v7s.js +0 -2
- package/bundle/chunk-wwf6zacw.js +0 -2
- package/bundle/chunk-x9c8eddk.js +0 -2
- package/bundle/chunk-xjed8t2h.js +0 -2
- package/bundle/chunk-xxhta1tm.js +0 -2
- package/bundle/chunk-yhj6858v.js +0 -2
- package/bundle/chunk-yq3byrpv.js +0 -2
- package/bundle/chunk-ys8ajwys.js +0 -2
- package/bundle/chunk-yzt7p956.js +0 -2
- package/bundle/chunk-z56cb3fs.js +0 -2
- package/bundle/chunk-zhypknyg.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-0xf12tf3.js";function K(Q,Z,H){return typeof Q.default==="function"?Q.default(Z,H):Q.default}function J(Q,Z){if(Q)return Q.push(Z),Q;return[Z]}var q=/[.*+?^${}()|[\]\\]/g;function X(Q){return Q.replace(q,"\\$&")}function T(Q,Z){switch(Z?.errorMode){case"ignore":break;case"warn":console.warn(Q);break;default:throw Error(Q)}}function V(Q){return typeof Q==="boolean"||typeof Q==="number"&&Number.isFinite(Q)||typeof Q==="string"}function w(Q){return Q.every(V)}function x(Q,Z,H){if(H?.ignoreActions?.includes(Z.type))return Q;let Y;switch(Z.type){case"base64":Q.contentEncoding="base64";break;case"bic":case"cuid2":case"decimal":case"digits":case"domain":case"emoji":case"hash":case"hexadecimal":case"hex_color":case"isrc":case"iso_time_second":case"iso_week":case"mac":case"mac48":case"mac64":case"nanoid":case"octal":case"slug":case"ulid":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"description":Q.description=Z.description;break;case"email":case"rfc_email":Q.format="email";break;case"ends_with":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=`${X(Z.requirement)}$`;break;case"empty":if(Q.type==="array")Q.maxItems=0;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.maxLength=0}break;case"entries":Q.minProperties=Z.requirement,Q.maxProperties=Z.requirement;break;case"examples":if(Array.isArray(Q.examples))Q.examples=[...Q.examples,...Z.examples];else Q.examples=Z.examples;break;case"gt_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "gt_value" action is not supported on type "${Q.type}".`);if(H?.target==="openapi-3.0"){Y=J(Y,'The "gt_value" action is not supported for OpenAPI 3.0.');break}Q.exclusiveMinimum=Z.requirement;break;case"includes":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=X(Z.requirement);break;case"integer":Q.type="integer";break;case"ipv4":Q.format="ipv4";break;case"ipv6":Q.format="ipv6";break;case"iso_date":Q.format="date";break;case"iso_date_time":case"iso_timestamp":Q.format="date-time";break;case"iso_time":Q.format="time";break;case"jws_compact":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"length":if(Q.type==="array")Q.minItems=Z.requirement,Q.maxItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=Z.requirement,Q.maxLength=Z.requirement}break;case"lt_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "lt_value" action is not supported on type "${Q.type}".`);if(H?.target==="openapi-3.0"){Y=J(Y,'The "lt_value" action is not supported for OpenAPI 3.0.');break}Q.exclusiveMaximum=Z.requirement;break;case"max_entries":Q.maxProperties=Z.requirement;break;case"max_length":if(Q.type==="array")Q.maxItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.maxLength=Z.requirement}break;case"max_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "max_value" action is not supported on type "${Q.type}".`);Q.maximum=Z.requirement;break;case"metadata":if(typeof Z.metadata.title==="string")Q.title=Z.metadata.title;if(typeof Z.metadata.description==="string")Q.description=Z.metadata.description;if(Array.isArray(Z.metadata.examples))if(Array.isArray(Q.examples))Q.examples=[...Q.examples,...Z.metadata.examples];else Q.examples=Z.metadata.examples;break;case"min_entries":Q.minProperties=Z.requirement;break;case"min_length":if(Q.type==="array")Q.minItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=Z.requirement}break;case"min_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "min_value" action is not supported on type "${Q.type}".`);Q.minimum=Z.requirement;break;case"multiple_of":Q.multipleOf=Z.requirement;break;case"non_empty":if(Q.type==="array")Q.minItems=1;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=1}break;case"not_value":if(!V(Z.requirement)){Y=J(Y,'The requirement of the "not_value" action is not JSON compatible.');break}if(H?.target==="openapi-3.0")Q.not={enum:[Z.requirement]};else Q.not={const:Z.requirement};break;case"not_values":if(!w(Z.requirement)){Y=J(Y,'A requirement of the "not_values" action is not JSON compatible.');break}Q.not={enum:Z.requirement};break;case"regex":if(Z.requirement.flags)Y=J(Y,"RegExp flags are not supported by JSON Schema.");if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"safe_integer":if(Q.type="integer",typeof Q.minimum!=="number"||Q.minimum<Number.MIN_SAFE_INTEGER)Q.minimum=Number.MIN_SAFE_INTEGER;if(typeof Q.maximum!=="number"||Q.maximum>Number.MAX_SAFE_INTEGER)Q.maximum=Number.MAX_SAFE_INTEGER;break;case"starts_with":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=`^${X(Z.requirement)}`;break;case"title":Q.title=Z.title;break;case"url":Q.format="uri";break;case"uuid":Q.format="uuid";break;case"value":if(!V(Z.requirement)){Y=J(Y,'The requirement of the "value" action is not JSON compatible.');break}if(H?.target==="openapi-3.0")Q.enum=[Z.requirement];else Q.const=Z.requirement;break;case"values":if(!w(Z.requirement)){Y=J(Y,'A requirement of the "values" action is not JSON compatible.');break}Q.enum=Z.requirement;break;default:Y=J(Y,`The "${Z.type}" action cannot be converted to JSON Schema.`)}if(H?.overrideAction){let F=H.overrideAction({valibotAction:Z,jsonSchema:Q,errors:Y});if(F)return{...F}}if(Y)for(let F of Y)T(F,H);return Q}function R(Q){return Q.flatMap((Z)=>("pipe"in Z)?R(Z.pipe):Z)}var A=0;function B(Q,Z,H,Y,F=!1){if(!F){let U=Y.referenceMap.get(Z);if(U){if(Q.$ref=`#/$defs/${U}`,H?.overrideRef){let z=H.overrideRef({...Y,referenceId:U,valibotSchema:Z,jsonSchema:Q});if(z)Q.$ref=z}return Q}}if("pipe"in Z){let U=R(Z.pipe),z=0,M=U.length-1;if(H?.typeMode==="input"){let L=U.slice(1).findIndex((W)=>W.kind==="schema"||W.kind==="transformation"&&(W.type==="find_item"||W.type==="parse_json"||W.type==="raw_transform"||W.type==="reduce_items"||W.type==="stringify_json"||W.type==="to_bigint"||W.type==="to_boolean"||W.type==="to_date"||W.type==="to_number"||W.type==="to_string"||W.type==="transform"));if(L!==-1)M=L}else if(H?.typeMode==="output"){let L=U.findLastIndex((W)=>W.kind==="schema");if(L!==-1)z=L}for(let L=z;L<=M;L++){let W=U[L];if(W.kind==="schema"){if(L>z)T('Set the "typeMode" config to "input" or "output" to convert pipelines with multiple schemas.',H);Q=B(Q,W,H,Y,!0)}else Q=x(Q,W,H)}return Q}let N;switch(Z.type){case"boolean":Q.type="boolean";break;case"null":if(H?.target==="openapi-3.0")Q.enum=[null];else Q.type="null";break;case"number":Q.type="number";break;case"string":Q.type="string";break;case"array":Q.type="array",Q.items=B({},Z.item,H,Y);break;case"tuple":case"tuple_with_rest":case"loose_tuple":case"strict_tuple":if(Q.type="array",H?.target==="openapi-3.0"){Q.items={anyOf:[]},Q.minItems=Z.items.length;for(let U of Z.items)Q.items.anyOf.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.items.anyOf.push(B({},Z.rest,H,Y));else if(Z.type==="strict_tuple"||Z.type==="tuple")Q.maxItems=Z.items.length}else if(H?.target==="draft-2020-12"){Q.prefixItems=[],Q.minItems=Z.items.length;for(let U of Z.items)Q.prefixItems.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.items=B({},Z.rest,H,Y);else if(Z.type==="strict_tuple")Q.items=!1}else{Q.items=[],Q.minItems=Z.items.length;for(let U of Z.items)Q.items.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.additionalItems=B({},Z.rest,H,Y);else if(Z.type==="strict_tuple")Q.additionalItems=!1}break;case"object":case"object_with_rest":case"loose_object":case"strict_object":Q.type="object",Q.properties={},Q.required=[];for(let U in Z.entries){let z=Z.entries[U];if(Q.properties[U]=B({},z,H,Y),z.type!=="exact_optional"&&z.type!=="nullish"&&z.type!=="optional")Q.required.push(U)}if(Z.type==="object_with_rest")Q.additionalProperties=B({},Z.rest,H,Y);else if(Z.type==="strict_object")Q.additionalProperties=!1;break;case"record":if(H?.target==="openapi-3.0"&&"pipe"in Z.key)N=J(N,'The "record" schema with a schema for the key that contains a "pipe" cannot be converted to JSON Schema.');if(Z.key.type!=="string")N=J(N,`The "record" schema with the "${Z.key.type}" schema for the key cannot be converted to JSON Schema.`);if(Q.type="object",H?.target!=="openapi-3.0")Q.propertyNames=B({},Z.key,H,Y);Q.additionalProperties=B({},Z.value,H,Y);break;case"any":case"unknown":break;case"never":Q.not={};break;case"nullable":case"nullish":if(H?.target==="openapi-3.0"){let U=B({},Z.wrapped,H,Y);Object.assign(Q,U),Q.nullable=!0}else Q.anyOf=[B({},Z.wrapped,H,Y),{type:"null"}];if(Z.default!==void 0)Q.default=K(Z);break;case"exact_optional":case"optional":case"undefinedable":if(Q=B(Q,Z.wrapped,H,Y),Z.default!==void 0)Q.default=K(Z);break;case"literal":if(typeof Z.literal!=="boolean"&&typeof Z.literal!=="number"&&typeof Z.literal!=="string")N=J(N,'The value of the "literal" schema is not JSON compatible.');if(H?.target==="openapi-3.0")Q.enum=[Z.literal];else Q.const=Z.literal;break;case"enum":if(Q.enum=Z.options,Z.options.every((U)=>typeof U==="string"))Q.type="string";else if(Z.options.every((U)=>typeof U==="number"))Q.type="number";else if(H?.target!=="openapi-3.0")Q.type=["string","number"];break;case"picklist":{let U=Z.options.some((z)=>typeof z!=="number"&&typeof z!=="string");if(U)N=J(N,'An option of the "picklist" schema is not JSON compatible.');if(Q.enum=Z.options,Z.options.every((z)=>typeof z==="string"))Q.type="string";else if(Z.options.every((z)=>typeof z==="number"))Q.type="number";else if(!U&&H?.target!=="openapi-3.0")Q.type=["string","number"];break}case"union":Q.anyOf=Z.options.map((U)=>B({},U,H,Y));break;case"variant":Q.oneOf=Z.options.map((U)=>B({},U,H,Y));break;case"intersect":Q.allOf=Z.options.map((U)=>B({},U,H,Y));break;case"lazy":{let U=Y.getterMap.get(Z.getter);if(!U)U=Z.getter(void 0),Y.getterMap.set(Z.getter,U);let z=Y.referenceMap.get(U);if(!z)z=`${A++}`,Y.referenceMap.set(U,z),Y.definitions[z]=B({},U,H,Y,!0);if(Q.$ref=`#/$defs/${z}`,H?.overrideRef){let M=H.overrideRef({...Y,referenceId:z,valibotSchema:U,jsonSchema:Q});if(M)Q.$ref=M}break}default:N=J(N,`The "${Z.type}" schema cannot be converted to JSON Schema.`)}if(H?.overrideSchema){let U=H.overrideSchema({...Y,referenceId:Y.referenceMap.get(Z),valibotSchema:Z,jsonSchema:Q,errors:N});if(U)return{...U}}if(N)for(let U of N)T(U,H);return Q}var O;function b(Q){O={...O??{},...Q}}function E(){return O}function G(Q,Z){let H={definitions:{},referenceMap:new Map,getterMap:new Map},Y=Z?.definitions??E();if(Y){for(let U in Y)H.referenceMap.set(Y[U],U);for(let U in Y)H.definitions[U]=B({},Y[U],Z,H,!0)}let F=B({},Q,Z,H),N=Z?.target??"draft-07";if(N==="draft-2020-12")F.$schema="https://json-schema.org/draft/2020-12/schema";else if(N==="draft-07")F.$schema="http://json-schema.org/draft-07/schema#";if(H.referenceMap.size)F.$defs=H.definitions;return F}function I(Q,Z){let H={definitions:{},referenceMap:new Map,getterMap:new Map};for(let Y in Q)H.referenceMap.set(Q[Y],Y);for(let Y in Q)H.definitions[Y]=B({},Q[Y],Z,H,!0);return H.definitions}var C=["draft-07","draft-2020-12","openapi-3.0"];function j(Q){return{"~standard":{...Q["~standard"],jsonSchema:{input(Z){if(C.includes(Z.target))return G(Q,{typeMode:"input",target:Z.target,...Z.libraryOptions});throw Error(`Unsupported target: ${Z.target}`)},output(Z){if(C.includes(Z.target))return G(Q,{typeMode:"output",target:Z.target,...Z.libraryOptions});throw Error(`Unsupported target: ${Z.target}`)}}}}}export{j as toStandardJsonSchema,I as toJsonSchemaDefs,G as toJsonSchema,E as getGlobalDefs,b as addGlobalDefs};
|
|
2
|
+
import"./chunk-sh03ka27.js";function K(Q,Z,H){return typeof Q.default==="function"?Q.default(Z,H):Q.default}function J(Q,Z){if(Q)return Q.push(Z),Q;return[Z]}var q=/[.*+?^${}()|[\]\\]/g;function X(Q){return Q.replace(q,"\\$&")}function T(Q,Z){switch(Z?.errorMode){case"ignore":break;case"warn":console.warn(Q);break;default:throw Error(Q)}}function V(Q){return typeof Q==="boolean"||typeof Q==="number"&&Number.isFinite(Q)||typeof Q==="string"}function w(Q){return Q.every(V)}function x(Q,Z,H){if(H?.ignoreActions?.includes(Z.type))return Q;let Y;switch(Z.type){case"base64":Q.contentEncoding="base64";break;case"bic":case"cuid2":case"decimal":case"digits":case"domain":case"emoji":case"hash":case"hexadecimal":case"hex_color":case"isrc":case"iso_time_second":case"iso_week":case"mac":case"mac48":case"mac64":case"nanoid":case"octal":case"slug":case"ulid":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"description":Q.description=Z.description;break;case"email":case"rfc_email":Q.format="email";break;case"ends_with":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=`${X(Z.requirement)}$`;break;case"empty":if(Q.type==="array")Q.maxItems=0;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.maxLength=0}break;case"entries":Q.minProperties=Z.requirement,Q.maxProperties=Z.requirement;break;case"examples":if(Array.isArray(Q.examples))Q.examples=[...Q.examples,...Z.examples];else Q.examples=Z.examples;break;case"gt_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "gt_value" action is not supported on type "${Q.type}".`);if(H?.target==="openapi-3.0"){Y=J(Y,'The "gt_value" action is not supported for OpenAPI 3.0.');break}Q.exclusiveMinimum=Z.requirement;break;case"includes":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=X(Z.requirement);break;case"integer":Q.type="integer";break;case"ipv4":Q.format="ipv4";break;case"ipv6":Q.format="ipv6";break;case"iso_date":Q.format="date";break;case"iso_date_time":case"iso_timestamp":Q.format="date-time";break;case"iso_time":Q.format="time";break;case"jws_compact":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"length":if(Q.type==="array")Q.minItems=Z.requirement,Q.maxItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=Z.requirement,Q.maxLength=Z.requirement}break;case"lt_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "lt_value" action is not supported on type "${Q.type}".`);if(H?.target==="openapi-3.0"){Y=J(Y,'The "lt_value" action is not supported for OpenAPI 3.0.');break}Q.exclusiveMaximum=Z.requirement;break;case"max_entries":Q.maxProperties=Z.requirement;break;case"max_length":if(Q.type==="array")Q.maxItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.maxLength=Z.requirement}break;case"max_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "max_value" action is not supported on type "${Q.type}".`);Q.maximum=Z.requirement;break;case"metadata":if(typeof Z.metadata.title==="string")Q.title=Z.metadata.title;if(typeof Z.metadata.description==="string")Q.description=Z.metadata.description;if(Array.isArray(Z.metadata.examples))if(Array.isArray(Q.examples))Q.examples=[...Q.examples,...Z.metadata.examples];else Q.examples=Z.metadata.examples;break;case"min_entries":Q.minProperties=Z.requirement;break;case"min_length":if(Q.type==="array")Q.minItems=Z.requirement;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=Z.requirement}break;case"min_value":if(Q.type!=="number"&&Q.type!=="integer")Y=J(Y,`The "min_value" action is not supported on type "${Q.type}".`);Q.minimum=Z.requirement;break;case"multiple_of":Q.multipleOf=Z.requirement;break;case"non_empty":if(Q.type==="array")Q.minItems=1;else{if(Q.type!=="string")Y=J(Y,`The "${Z.type}" action is not supported on type "${Q.type}".`);Q.minLength=1}break;case"not_value":if(!V(Z.requirement)){Y=J(Y,'The requirement of the "not_value" action is not JSON compatible.');break}if(H?.target==="openapi-3.0")Q.not={enum:[Z.requirement]};else Q.not={const:Z.requirement};break;case"not_values":if(!w(Z.requirement)){Y=J(Y,'A requirement of the "not_values" action is not JSON compatible.');break}Q.not={enum:Z.requirement};break;case"regex":if(Z.requirement.flags)Y=J(Y,"RegExp flags are not supported by JSON Schema.");if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=Z.requirement.source;break;case"safe_integer":if(Q.type="integer",typeof Q.minimum!=="number"||Q.minimum<Number.MIN_SAFE_INTEGER)Q.minimum=Number.MIN_SAFE_INTEGER;if(typeof Q.maximum!=="number"||Q.maximum>Number.MAX_SAFE_INTEGER)Q.maximum=Number.MAX_SAFE_INTEGER;break;case"starts_with":if(Q.pattern)Y=J(Y,`The "${Z.type}" action is not supported in combination with another regex action.`);else Q.pattern=`^${X(Z.requirement)}`;break;case"title":Q.title=Z.title;break;case"url":Q.format="uri";break;case"uuid":Q.format="uuid";break;case"value":if(!V(Z.requirement)){Y=J(Y,'The requirement of the "value" action is not JSON compatible.');break}if(H?.target==="openapi-3.0")Q.enum=[Z.requirement];else Q.const=Z.requirement;break;case"values":if(!w(Z.requirement)){Y=J(Y,'A requirement of the "values" action is not JSON compatible.');break}Q.enum=Z.requirement;break;default:Y=J(Y,`The "${Z.type}" action cannot be converted to JSON Schema.`)}if(H?.overrideAction){let F=H.overrideAction({valibotAction:Z,jsonSchema:Q,errors:Y});if(F)return{...F}}if(Y)for(let F of Y)T(F,H);return Q}function R(Q){return Q.flatMap((Z)=>("pipe"in Z)?R(Z.pipe):Z)}var A=0;function B(Q,Z,H,Y,F=!1){if(!F){let U=Y.referenceMap.get(Z);if(U){if(Q.$ref=`#/$defs/${U}`,H?.overrideRef){let z=H.overrideRef({...Y,referenceId:U,valibotSchema:Z,jsonSchema:Q});if(z)Q.$ref=z}return Q}}if("pipe"in Z){let U=R(Z.pipe),z=0,M=U.length-1;if(H?.typeMode==="input"){let L=U.slice(1).findIndex((W)=>W.kind==="schema"||W.kind==="transformation"&&(W.type==="find_item"||W.type==="parse_json"||W.type==="raw_transform"||W.type==="reduce_items"||W.type==="stringify_json"||W.type==="to_bigint"||W.type==="to_boolean"||W.type==="to_date"||W.type==="to_number"||W.type==="to_string"||W.type==="transform"));if(L!==-1)M=L}else if(H?.typeMode==="output"){let L=U.findLastIndex((W)=>W.kind==="schema");if(L!==-1)z=L}for(let L=z;L<=M;L++){let W=U[L];if(W.kind==="schema"){if(L>z)T('Set the "typeMode" config to "input" or "output" to convert pipelines with multiple schemas.',H);Q=B(Q,W,H,Y,!0)}else Q=x(Q,W,H)}return Q}let N;switch(Z.type){case"boolean":Q.type="boolean";break;case"null":if(H?.target==="openapi-3.0")Q.enum=[null];else Q.type="null";break;case"number":Q.type="number";break;case"string":Q.type="string";break;case"array":Q.type="array",Q.items=B({},Z.item,H,Y);break;case"tuple":case"tuple_with_rest":case"loose_tuple":case"strict_tuple":if(Q.type="array",H?.target==="openapi-3.0"){Q.items={anyOf:[]},Q.minItems=Z.items.length;for(let U of Z.items)Q.items.anyOf.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.items.anyOf.push(B({},Z.rest,H,Y));else if(Z.type==="strict_tuple"||Z.type==="tuple")Q.maxItems=Z.items.length}else if(H?.target==="draft-2020-12"){Q.prefixItems=[],Q.minItems=Z.items.length;for(let U of Z.items)Q.prefixItems.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.items=B({},Z.rest,H,Y);else if(Z.type==="strict_tuple")Q.items=!1}else{Q.items=[],Q.minItems=Z.items.length;for(let U of Z.items)Q.items.push(B({},U,H,Y));if(Z.type==="tuple_with_rest")Q.additionalItems=B({},Z.rest,H,Y);else if(Z.type==="strict_tuple")Q.additionalItems=!1}break;case"object":case"object_with_rest":case"loose_object":case"strict_object":Q.type="object",Q.properties={},Q.required=[];for(let U in Z.entries){let z=Z.entries[U];if(Q.properties[U]=B({},z,H,Y),z.type!=="exact_optional"&&z.type!=="nullish"&&z.type!=="optional")Q.required.push(U)}if(Z.type==="object_with_rest")Q.additionalProperties=B({},Z.rest,H,Y);else if(Z.type==="strict_object")Q.additionalProperties=!1;break;case"record":if(H?.target==="openapi-3.0"&&"pipe"in Z.key)N=J(N,'The "record" schema with a schema for the key that contains a "pipe" cannot be converted to JSON Schema.');if(Z.key.type!=="string")N=J(N,`The "record" schema with the "${Z.key.type}" schema for the key cannot be converted to JSON Schema.`);if(Q.type="object",H?.target!=="openapi-3.0")Q.propertyNames=B({},Z.key,H,Y);Q.additionalProperties=B({},Z.value,H,Y);break;case"any":case"unknown":break;case"never":Q.not={};break;case"nullable":case"nullish":if(H?.target==="openapi-3.0"){let U=B({},Z.wrapped,H,Y);Object.assign(Q,U),Q.nullable=!0}else Q.anyOf=[B({},Z.wrapped,H,Y),{type:"null"}];if(Z.default!==void 0)Q.default=K(Z);break;case"exact_optional":case"optional":case"undefinedable":if(Q=B(Q,Z.wrapped,H,Y),Z.default!==void 0)Q.default=K(Z);break;case"literal":if(typeof Z.literal!=="boolean"&&typeof Z.literal!=="number"&&typeof Z.literal!=="string")N=J(N,'The value of the "literal" schema is not JSON compatible.');if(H?.target==="openapi-3.0")Q.enum=[Z.literal];else Q.const=Z.literal;break;case"enum":if(Q.enum=Z.options,Z.options.every((U)=>typeof U==="string"))Q.type="string";else if(Z.options.every((U)=>typeof U==="number"))Q.type="number";else if(H?.target!=="openapi-3.0")Q.type=["string","number"];break;case"picklist":{let U=Z.options.some((z)=>typeof z!=="number"&&typeof z!=="string");if(U)N=J(N,'An option of the "picklist" schema is not JSON compatible.');if(Q.enum=Z.options,Z.options.every((z)=>typeof z==="string"))Q.type="string";else if(Z.options.every((z)=>typeof z==="number"))Q.type="number";else if(!U&&H?.target!=="openapi-3.0")Q.type=["string","number"];break}case"union":Q.anyOf=Z.options.map((U)=>B({},U,H,Y));break;case"variant":Q.oneOf=Z.options.map((U)=>B({},U,H,Y));break;case"intersect":Q.allOf=Z.options.map((U)=>B({},U,H,Y));break;case"lazy":{let U=Y.getterMap.get(Z.getter);if(!U)U=Z.getter(void 0),Y.getterMap.set(Z.getter,U);let z=Y.referenceMap.get(U);if(!z)z=`${A++}`,Y.referenceMap.set(U,z),Y.definitions[z]=B({},U,H,Y,!0);if(Q.$ref=`#/$defs/${z}`,H?.overrideRef){let M=H.overrideRef({...Y,referenceId:z,valibotSchema:U,jsonSchema:Q});if(M)Q.$ref=M}break}default:N=J(N,`The "${Z.type}" schema cannot be converted to JSON Schema.`)}if(H?.overrideSchema){let U=H.overrideSchema({...Y,referenceId:Y.referenceMap.get(Z),valibotSchema:Z,jsonSchema:Q,errors:N});if(U)return{...U}}if(N)for(let U of N)T(U,H);return Q}var O;function b(Q){O={...O??{},...Q}}function E(){return O}function G(Q,Z){let H={definitions:{},referenceMap:new Map,getterMap:new Map},Y=Z?.definitions??E();if(Y){for(let U in Y)H.referenceMap.set(Y[U],U);for(let U in Y)H.definitions[U]=B({},Y[U],Z,H,!0)}let F=B({},Q,Z,H),N=Z?.target??"draft-07";if(N==="draft-2020-12")F.$schema="https://json-schema.org/draft/2020-12/schema";else if(N==="draft-07")F.$schema="http://json-schema.org/draft-07/schema#";if(H.referenceMap.size)F.$defs=H.definitions;return F}function I(Q,Z){let H={definitions:{},referenceMap:new Map,getterMap:new Map};for(let Y in Q)H.referenceMap.set(Q[Y],Y);for(let Y in Q)H.definitions[Y]=B({},Q[Y],Z,H,!0);return H.definitions}var C=["draft-07","draft-2020-12","openapi-3.0"];function j(Q){return{"~standard":{...Q["~standard"],jsonSchema:{input(Z){if(C.includes(Z.target))return G(Q,{typeMode:"input",target:Z.target,...Z.libraryOptions});throw Error(`Unsupported target: ${Z.target}`)},output(Z){if(C.includes(Z.target))return G(Q,{typeMode:"output",target:Z.target,...Z.libraryOptions});throw Error(`Unsupported target: ${Z.target}`)}}}}}export{j as toStandardJsonSchema,I as toJsonSchemaDefs,G as toJsonSchema,E as getGlobalDefs,b as addGlobalDefs};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var R;(function($){$.assertEqual=(W)=>{};function q(W){}$.assertIs=q;function _(W){throw Error()}$.assertNever=_,$.arrayToEnum=(W)=>{let H={};for(let J of W)H[J]=J;return H},$.getValidEnumValues=(W)=>{let H=$.objectKeys(W).filter((Y)=>typeof W[W[Y]]!=="number"),J={};for(let Y of H)J[Y]=W[Y];return $.objectValues(J)},$.objectValues=(W)=>{return $.objectKeys(W).map(function(H){return W[H]})},$.objectKeys=typeof Object.keys==="function"?(W)=>Object.keys(W):(W)=>{let H=[];for(let J in W)if(Object.prototype.hasOwnProperty.call(W,J))H.push(J);return H},$.find=(W,H)=>{for(let J of W)if(H(J))return J;return},$.isInteger=typeof Number.isInteger==="function"?(W)=>Number.isInteger(W):(W)=>typeof W==="number"&&Number.isFinite(W)&&Math.floor(W)===W;function G(W,H=" | "){return W.map((J)=>typeof J==="string"?`'${J}'`:J).join(H)}$.joinValues=G,$.jsonStringifyReplacer=(W,H)=>{if(typeof H==="bigint")return H.toString();return H}})(R||(R={}));var U$;(function($){$.mergeShapes=(q,_)=>{return{...q,..._}}})(U$||(U$={}));var Q=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),F=($)=>{switch(typeof $){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN($)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":if(Array.isArray($))return Q.array;if($===null)return Q.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return Q.promise;if(typeof Map<"u"&&$ instanceof Map)return Q.map;if(typeof Set<"u"&&$ instanceof Set)return Q.set;if(typeof Date<"u"&&$ instanceof Date)return Q.date;return Q.object;default:return Q.unknown}};var X=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class A extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(_)=>{this.issues=[...this.issues,_]},this.addIssues=(_=[])=>{this.issues=[...this.issues,..._]};let q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,q);else this.__proto__=q;this.name="ZodError",this.issues=$}format($){let q=$||function(W){return W.message},_={_errors:[]},G=(W)=>{for(let H of W.issues)if(H.code==="invalid_union")H.unionErrors.map(G);else if(H.code==="invalid_return_type")G(H.returnTypeError);else if(H.code==="invalid_arguments")G(H.argumentsError);else if(H.path.length===0)_._errors.push(q(H));else{let J=_,Y=0;while(Y<H.path.length){let M=H.path[Y];if(Y!==H.path.length-1)J[M]=J[M]||{_errors:[]};else J[M]=J[M]||{_errors:[]},J[M]._errors.push(q(H));J=J[M],Y++}}};return G(this),_}static assert($){if(!($ instanceof A))throw Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(q)=>q.message){let q={},_=[];for(let G of this.issues)if(G.path.length>0){let W=G.path[0];q[W]=q[W]||[],q[W].push($(G))}else _.push($(G));return{formErrors:_,fieldErrors:q}}get formErrors(){return this.flatten()}}A.create=($)=>{return new A($)};var D$=($,q)=>{let _;switch($.code){case X.invalid_type:if($.received===Q.undefined)_="Required";else _=`Expected ${$.expected}, received ${$.received}`;break;case X.invalid_literal:_=`Invalid literal value, expected ${JSON.stringify($.expected,R.jsonStringifyReplacer)}`;break;case X.unrecognized_keys:_=`Unrecognized key(s) in object: ${R.joinValues($.keys,", ")}`;break;case X.invalid_union:_="Invalid input";break;case X.invalid_union_discriminator:_=`Invalid discriminator value. Expected ${R.joinValues($.options)}`;break;case X.invalid_enum_value:_=`Invalid enum value. Expected ${R.joinValues($.options)}, received '${$.received}'`;break;case X.invalid_arguments:_="Invalid function arguments";break;case X.invalid_return_type:_="Invalid function return type";break;case X.invalid_date:_="Invalid date";break;case X.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(_=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")_=`${_} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)_=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)_=`Invalid input: must end with "${$.validation.endsWith}"`;else R.assertNever($.validation);else if($.validation!=="regex")_=`Invalid ${$.validation}`;else _="Invalid";break;case X.too_small:if($.type==="array")_=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")_=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")_=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")_=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")_=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else _="Invalid input";break;case X.too_big:if($.type==="array")_=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")_=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")_=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")_=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")_=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else _="Invalid input";break;case X.custom:_="Invalid input";break;case X.invalid_intersection_types:_="Intersection results could not be merged";break;case X.not_multiple_of:_=`Number must be a multiple of ${$.multipleOf}`;break;case X.not_finite:_="Number must be finite";break;default:_=q.defaultError,R.assertNever($)}return{message:_}},I=D$;var f$=I;function u(){return f$}var w;(function($){$.errToObj=(q)=>typeof q==="string"?{message:q}:q||{},$.toString=(q)=>typeof q==="string"?q:q?.message})(w||(w={}));var G$=($)=>{let{data:q,path:_,errorMaps:G,issueData:W}=$,H=[..._,...W.path||[]],J={...W,path:H};if(W.message!==void 0)return{...W,path:H,message:W.message};let Y="",M=G.filter((S)=>!!S).slice().reverse();for(let S of M)Y=S(J,{data:q,defaultError:Y}).message;return{...W,path:H,message:Y}};function B($,q){let _=u(),G=G$({issueData:q,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,_,_===I?void 0:I].filter((W)=>!!W)});$.common.issues.push(G)}class V{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,q){let _=[];for(let G of q){if(G.status==="aborted")return z;if(G.status==="dirty")$.dirty();_.push(G.value)}return{status:$.value,value:_}}static async mergeObjectAsync($,q){let _=[];for(let G of q){let W=await G.key,H=await G.value;_.push({key:W,value:H})}return V.mergeObjectSync($,_)}static mergeObjectSync($,q){let _={};for(let G of q){let{key:W,value:H}=G;if(W.status==="aborted")return z;if(H.status==="aborted")return z;if(W.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(W.value!=="__proto__"&&(typeof H.value<"u"||G.alwaysSet))_[W.value]=H.value}return{status:$.value,value:_}}}var z=Object.freeze({status:"aborted"}),x=($)=>({status:"dirty",value:$}),U=($)=>({status:"valid",value:$}),j$=($)=>$.status==="aborted",b$=($)=>$.status==="dirty",h=($)=>$.status==="valid",p=($)=>typeof Promise<"u"&&$ instanceof Promise;class L{constructor($,q,_,G){this._cachedPath=[],this.parent=$,this.data=q,this._path=_,this._key=G}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var A$=($,q)=>{if(h(q))return{success:!0,data:q.value};else{if(!$.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let _=new A($.common.issues);return this._error=_,this._error}}}};function b($){if(!$)return{};let{errorMap:q,invalid_type_error:_,required_error:G,description:W}=$;if(q&&(_||G))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(q)return{errorMap:q,description:W};return{errorMap:(J,Y)=>{let{message:M}=$;if(J.code==="invalid_enum_value")return{message:M??Y.defaultError};if(typeof Y.data>"u")return{message:M??G??Y.defaultError};if(J.code!=="invalid_type")return{message:Y.defaultError};return{message:M??_??Y.defaultError}},description:W}}class O{get description(){return this._def.description}_getType($){return F($.data)}_getOrReturnCtx($,q){return q||{common:$.parent.common,data:$.data,parsedType:F($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new V,ctx:{common:$.parent.common,data:$.data,parsedType:F($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let q=this._parse($);if(p(q))throw Error("Synchronous parse encountered promise.");return q}_parseAsync($){let q=this._parse($);return Promise.resolve(q)}parse($,q){let _=this.safeParse($,q);if(_.success)return _.data;throw _.error}safeParse($,q){let _={common:{issues:[],async:q?.async??!1,contextualErrorMap:q?.errorMap},path:q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:F($)},G=this._parseSync({data:$,path:_.path,parent:_});return A$(_,G)}"~validate"($){let q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:F($)};if(!this["~standard"].async)try{let _=this._parseSync({data:$,path:[],parent:q});return h(_)?{value:_.value}:{issues:q.common.issues}}catch(_){if(_?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;q.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:q}).then((_)=>h(_)?{value:_.value}:{issues:q.common.issues})}async parseAsync($,q){let _=await this.safeParseAsync($,q);if(_.success)return _.data;throw _.error}async safeParseAsync($,q){let _={common:{issues:[],contextualErrorMap:q?.errorMap,async:!0},path:q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:F($)},G=this._parse({data:$,path:_.path,parent:_}),W=await(p(G)?G:Promise.resolve(G));return A$(_,W)}refine($,q){let _=(G)=>{if(typeof q==="string"||typeof q>"u")return{message:q};else if(typeof q==="function")return q(G);else return q};return this._refinement((G,W)=>{let H=$(G),J=()=>W.addIssue({code:X.custom,..._(G)});if(typeof Promise<"u"&&H instanceof Promise)return H.then((Y)=>{if(!Y)return J(),!1;else return!0});if(!H)return J(),!1;else return!0})}refinement($,q){return this._refinement((_,G)=>{if(!$(_))return G.addIssue(typeof q==="function"?q(_,G):q),!1;else return!0})}_refinement($){return new f({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(q)=>this["~validate"](q)}}optional(){return D.create(this,this._def)}nullable(){return P.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return c.create(this,this._def)}or($){return a.create([this,$],this._def)}and($){return s.create(this,$,this._def)}transform($){return new f({...b(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:$}})}default($){let q=typeof $==="function"?$:()=>$;return new q$({...b(this._def),innerType:this,defaultValue:q,typeName:j.ZodDefault})}brand(){return new E$({typeName:j.ZodBranded,type:this,...b(this._def)})}catch($){let q=typeof $==="function"?$:()=>$;return new _$({...b(this._def),innerType:this,catchValue:q,typeName:j.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return w$.create(this,$)}readonly(){return W$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var F$=/^c[^\s-]{8,}$/i,K$=/^[0-9a-z]+$/,k$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C$=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,g$=/^[a-z0-9_-]{21}$/i,I$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,P$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,h$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",S$,l$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,x$=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,m$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,y$=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Z$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,n$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,v$="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",c$=new RegExp(`^${v$}$`);function L$($){let q="[0-5]\\d";if($.precision)q=`${q}\\.\\d{${$.precision}}`;else if($.precision==null)q=`${q}(\\.\\d+)?`;let _=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${q})${_}`}function u$($){return new RegExp(`^${L$($)}$`)}function p$($){let q=`${v$}T${L$($)}`,_=[];if(_.push($.local?"Z?":"Z"),$.offset)_.push("([+-]\\d{2}:?\\d{2})");return q=`${q}(${_.join("|")})`,new RegExp(`^${q}$`)}function i$($,q){if((q==="v4"||!q)&&l$.test($))return!0;if((q==="v6"||!q)&&m$.test($))return!0;return!1}function r$($,q){if(!I$.test($))return!1;try{let[_]=$.split(".");if(!_)return!1;let G=_.replace(/-/g,"+").replace(/_/g,"/").padEnd(_.length+(4-_.length%4)%4,"="),W=JSON.parse(atob(G));if(typeof W!=="object"||W===null)return!1;if("typ"in W&&W?.typ!=="JWT")return!1;if(!W.alg)return!1;if(q&&W.alg!==q)return!1;return!0}catch{return!1}}function o$($,q){if((q==="v4"||!q)&&x$.test($))return!0;if((q==="v6"||!q)&&y$.test($))return!0;return!1}class k extends O{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==Q.string){let W=this._getOrReturnCtx($);return B(W,{code:X.invalid_type,expected:Q.string,received:W.parsedType}),z}let _=new V,G=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.length<W.value)G=this._getOrReturnCtx($,G),B(G,{code:X.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),_.dirty()}else if(W.kind==="max"){if($.data.length>W.value)G=this._getOrReturnCtx($,G),B(G,{code:X.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),_.dirty()}else if(W.kind==="length"){let H=$.data.length>W.value,J=$.data.length<W.value;if(H||J){if(G=this._getOrReturnCtx($,G),H)B(G,{code:X.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});else if(J)B(G,{code:X.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});_.dirty()}}else if(W.kind==="email"){if(!h$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"email",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="emoji"){if(!S$)S$=new RegExp(T$,"u");if(!S$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"emoji",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="uuid"){if(!C$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"uuid",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="nanoid"){if(!g$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"nanoid",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="cuid"){if(!F$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"cuid",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="cuid2"){if(!K$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"cuid2",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="ulid"){if(!k$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"ulid",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="url")try{new URL($.data)}catch{G=this._getOrReturnCtx($,G),B(G,{validation:"url",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="regex"){if(W.regex.lastIndex=0,!W.regex.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"regex",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="trim")$.data=$.data.trim();else if(W.kind==="includes"){if(!$.data.includes(W.value,W.position))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:{includes:W.value,position:W.position},message:W.message}),_.dirty()}else if(W.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(W.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(W.kind==="startsWith"){if(!$.data.startsWith(W.value))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:{startsWith:W.value},message:W.message}),_.dirty()}else if(W.kind==="endsWith"){if(!$.data.endsWith(W.value))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:{endsWith:W.value},message:W.message}),_.dirty()}else if(W.kind==="datetime"){if(!p$(W).test($.data))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:"datetime",message:W.message}),_.dirty()}else if(W.kind==="date"){if(!c$.test($.data))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:"date",message:W.message}),_.dirty()}else if(W.kind==="time"){if(!u$(W).test($.data))G=this._getOrReturnCtx($,G),B(G,{code:X.invalid_string,validation:"time",message:W.message}),_.dirty()}else if(W.kind==="duration"){if(!P$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"duration",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="ip"){if(!i$($.data,W.version))G=this._getOrReturnCtx($,G),B(G,{validation:"ip",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="jwt"){if(!r$($.data,W.alg))G=this._getOrReturnCtx($,G),B(G,{validation:"jwt",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="cidr"){if(!o$($.data,W.version))G=this._getOrReturnCtx($,G),B(G,{validation:"cidr",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="base64"){if(!Z$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"base64",code:X.invalid_string,message:W.message}),_.dirty()}else if(W.kind==="base64url"){if(!n$.test($.data))G=this._getOrReturnCtx($,G),B(G,{validation:"base64url",code:X.invalid_string,message:W.message}),_.dirty()}else R.assertNever(W);return{status:_.value,value:$.data}}_regex($,q,_){return this.refinement((G)=>$.test(G),{validation:q,code:X.invalid_string,...w.errToObj(_)})}_addCheck($){return new k({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...w.errToObj($)})}url($){return this._addCheck({kind:"url",...w.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...w.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...w.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...w.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...w.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...w.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...w.errToObj($)})}base64($){return this._addCheck({kind:"base64",...w.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...w.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...w.errToObj($)})}ip($){return this._addCheck({kind:"ip",...w.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...w.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision>"u"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...w.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision>"u"?null:$?.precision,...w.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...w.errToObj($)})}regex($,q){return this._addCheck({kind:"regex",regex:$,...w.errToObj(q)})}includes($,q){return this._addCheck({kind:"includes",value:$,position:q?.position,...w.errToObj(q?.message)})}startsWith($,q){return this._addCheck({kind:"startsWith",value:$,...w.errToObj(q)})}endsWith($,q){return this._addCheck({kind:"endsWith",value:$,...w.errToObj(q)})}min($,q){return this._addCheck({kind:"min",value:$,...w.errToObj(q)})}max($,q){return this._addCheck({kind:"max",value:$,...w.errToObj(q)})}length($,q){return this._addCheck({kind:"length",value:$,...w.errToObj(q)})}nonempty($){return this.min(1,w.errToObj($))}trim(){return new k({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new k({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new k({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let q of this._def.checks)if(q.kind==="min"){if($===null||q.value>$)$=q.value}return $}get maxLength(){let $=null;for(let q of this._def.checks)if(q.kind==="max"){if($===null||q.value<$)$=q.value}return $}}k.create=($)=>{return new k({checks:[],typeName:j.ZodString,coerce:$?.coerce??!1,...b($)})};function d$($,q){let _=($.toString().split(".")[1]||"").length,G=(q.toString().split(".")[1]||"").length,W=_>G?_:G,H=Number.parseInt($.toFixed(W).replace(".","")),J=Number.parseInt(q.toFixed(W).replace(".",""));return H%J/10**W}class y extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==Q.number){let W=this._getOrReturnCtx($);return B(W,{code:X.invalid_type,expected:Q.number,received:W.parsedType}),z}let _=void 0,G=new V;for(let W of this._def.checks)if(W.kind==="int"){if(!R.isInteger($.data))_=this._getOrReturnCtx($,_),B(_,{code:X.invalid_type,expected:"integer",received:"float",message:W.message}),G.dirty()}else if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)_=this._getOrReturnCtx($,_),B(_,{code:X.too_small,minimum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),G.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)_=this._getOrReturnCtx($,_),B(_,{code:X.too_big,maximum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),G.dirty()}else if(W.kind==="multipleOf"){if(d$($.data,W.value)!==0)_=this._getOrReturnCtx($,_),B(_,{code:X.not_multiple_of,multipleOf:W.value,message:W.message}),G.dirty()}else if(W.kind==="finite"){if(!Number.isFinite($.data))_=this._getOrReturnCtx($,_),B(_,{code:X.not_finite,message:W.message}),G.dirty()}else R.assertNever(W);return{status:G.value,value:$.data}}gte($,q){return this.setLimit("min",$,!0,w.toString(q))}gt($,q){return this.setLimit("min",$,!1,w.toString(q))}lte($,q){return this.setLimit("max",$,!0,w.toString(q))}lt($,q){return this.setLimit("max",$,!1,w.toString(q))}setLimit($,q,_,G){return new y({...this._def,checks:[...this._def.checks,{kind:$,value:q,inclusive:_,message:w.toString(G)}]})}_addCheck($){return new y({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:w.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString($)})}multipleOf($,q){return this._addCheck({kind:"multipleOf",value:$,message:w.toString(q)})}finite($){return this._addCheck({kind:"finite",message:w.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString($)})}get minValue(){let $=null;for(let q of this._def.checks)if(q.kind==="min"){if($===null||q.value>$)$=q.value}return $}get maxValue(){let $=null;for(let q of this._def.checks)if(q.kind==="max"){if($===null||q.value<$)$=q.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&R.isInteger($.value))}get isFinite(){let $=null,q=null;for(let _ of this._def.checks)if(_.kind==="finite"||_.kind==="int"||_.kind==="multipleOf")return!0;else if(_.kind==="min"){if(q===null||_.value>q)q=_.value}else if(_.kind==="max"){if($===null||_.value<$)$=_.value}return Number.isFinite(q)&&Number.isFinite($)}}y.create=($)=>{return new y({checks:[],typeName:j.ZodNumber,coerce:$?.coerce||!1,...b($)})};class Z extends O{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==Q.bigint)return this._getInvalidInput($);let _=void 0,G=new V;for(let W of this._def.checks)if(W.kind==="min"){if(W.inclusive?$.data<W.value:$.data<=W.value)_=this._getOrReturnCtx($,_),B(_,{code:X.too_small,type:"bigint",minimum:W.value,inclusive:W.inclusive,message:W.message}),G.dirty()}else if(W.kind==="max"){if(W.inclusive?$.data>W.value:$.data>=W.value)_=this._getOrReturnCtx($,_),B(_,{code:X.too_big,type:"bigint",maximum:W.value,inclusive:W.inclusive,message:W.message}),G.dirty()}else if(W.kind==="multipleOf"){if($.data%W.value!==BigInt(0))_=this._getOrReturnCtx($,_),B(_,{code:X.not_multiple_of,multipleOf:W.value,message:W.message}),G.dirty()}else R.assertNever(W);return{status:G.value,value:$.data}}_getInvalidInput($){let q=this._getOrReturnCtx($);return B(q,{code:X.invalid_type,expected:Q.bigint,received:q.parsedType}),z}gte($,q){return this.setLimit("min",$,!0,w.toString(q))}gt($,q){return this.setLimit("min",$,!1,w.toString(q))}lte($,q){return this.setLimit("max",$,!0,w.toString(q))}lt($,q){return this.setLimit("max",$,!1,w.toString(q))}setLimit($,q,_,G){return new Z({...this._def,checks:[...this._def.checks,{kind:$,value:q,inclusive:_,message:w.toString(G)}]})}_addCheck($){return new Z({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString($)})}multipleOf($,q){return this._addCheck({kind:"multipleOf",value:$,message:w.toString(q)})}get minValue(){let $=null;for(let q of this._def.checks)if(q.kind==="min"){if($===null||q.value>$)$=q.value}return $}get maxValue(){let $=null;for(let q of this._def.checks)if(q.kind==="max"){if($===null||q.value<$)$=q.value}return $}}Z.create=($)=>{return new Z({checks:[],typeName:j.ZodBigInt,coerce:$?.coerce??!1,...b($)})};class H$ extends O{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==Q.boolean){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.boolean,received:_.parsedType}),z}return U($.data)}}H$.create=($)=>{return new H$({typeName:j.ZodBoolean,coerce:$?.coerce||!1,...b($)})};class r extends O{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==Q.date){let W=this._getOrReturnCtx($);return B(W,{code:X.invalid_type,expected:Q.date,received:W.parsedType}),z}if(Number.isNaN($.data.getTime())){let W=this._getOrReturnCtx($);return B(W,{code:X.invalid_date}),z}let _=new V,G=void 0;for(let W of this._def.checks)if(W.kind==="min"){if($.data.getTime()<W.value)G=this._getOrReturnCtx($,G),B(G,{code:X.too_small,message:W.message,inclusive:!0,exact:!1,minimum:W.value,type:"date"}),_.dirty()}else if(W.kind==="max"){if($.data.getTime()>W.value)G=this._getOrReturnCtx($,G),B(G,{code:X.too_big,message:W.message,inclusive:!0,exact:!1,maximum:W.value,type:"date"}),_.dirty()}else R.assertNever(W);return{status:_.value,value:new Date($.data.getTime())}}_addCheck($){return new r({...this._def,checks:[...this._def.checks,$]})}min($,q){return this._addCheck({kind:"min",value:$.getTime(),message:w.toString(q)})}max($,q){return this._addCheck({kind:"max",value:$.getTime(),message:w.toString(q)})}get minDate(){let $=null;for(let q of this._def.checks)if(q.kind==="min"){if($===null||q.value>$)$=q.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let q of this._def.checks)if(q.kind==="max"){if($===null||q.value<$)$=q.value}return $!=null?new Date($):null}}r.create=($)=>{return new r({checks:[],coerce:$?.coerce||!1,typeName:j.ZodDate,...b($)})};class J$ extends O{_parse($){if(this._getType($)!==Q.symbol){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.symbol,received:_.parsedType}),z}return U($.data)}}J$.create=($)=>{return new J$({typeName:j.ZodSymbol,...b($)})};class o extends O{_parse($){if(this._getType($)!==Q.undefined){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.undefined,received:_.parsedType}),z}return U($.data)}}o.create=($)=>{return new o({typeName:j.ZodUndefined,...b($)})};class d extends O{_parse($){if(this._getType($)!==Q.null){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.null,received:_.parsedType}),z}return U($.data)}}d.create=($)=>{return new d({typeName:j.ZodNull,...b($)})};class X$ extends O{constructor(){super(...arguments);this._any=!0}_parse($){return U($.data)}}X$.create=($)=>{return new X$({typeName:j.ZodAny,...b($)})};class T extends O{constructor(){super(...arguments);this._unknown=!0}_parse($){return U($.data)}}T.create=($)=>{return new T({typeName:j.ZodUnknown,...b($)})};class C extends O{_parse($){let q=this._getOrReturnCtx($);return B(q,{code:X.invalid_type,expected:Q.never,received:q.parsedType}),z}}C.create=($)=>{return new C({typeName:j.ZodNever,...b($)})};class Q$ extends O{_parse($){if(this._getType($)!==Q.undefined){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.void,received:_.parsedType}),z}return U($.data)}}Q$.create=($)=>{return new Q$({typeName:j.ZodVoid,...b($)})};class N extends O{_parse($){let{ctx:q,status:_}=this._processInputParams($),G=this._def;if(q.parsedType!==Q.array)return B(q,{code:X.invalid_type,expected:Q.array,received:q.parsedType}),z;if(G.exactLength!==null){let H=q.data.length>G.exactLength.value,J=q.data.length<G.exactLength.value;if(H||J)B(q,{code:H?X.too_big:X.too_small,minimum:J?G.exactLength.value:void 0,maximum:H?G.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:G.exactLength.message}),_.dirty()}if(G.minLength!==null){if(q.data.length<G.minLength.value)B(q,{code:X.too_small,minimum:G.minLength.value,type:"array",inclusive:!0,exact:!1,message:G.minLength.message}),_.dirty()}if(G.maxLength!==null){if(q.data.length>G.maxLength.value)B(q,{code:X.too_big,maximum:G.maxLength.value,type:"array",inclusive:!0,exact:!1,message:G.maxLength.message}),_.dirty()}if(q.common.async)return Promise.all([...q.data].map((H,J)=>{return G.type._parseAsync(new L(q,H,q.path,J))})).then((H)=>{return V.mergeArray(_,H)});let W=[...q.data].map((H,J)=>{return G.type._parseSync(new L(q,H,q.path,J))});return V.mergeArray(_,W)}get element(){return this._def.type}min($,q){return new N({...this._def,minLength:{value:$,message:w.toString(q)}})}max($,q){return new N({...this._def,maxLength:{value:$,message:w.toString(q)}})}length($,q){return new N({...this._def,exactLength:{value:$,message:w.toString(q)}})}nonempty($){return this.min(1,$)}}N.create=($,q)=>{return new N({type:$,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...b(q)})};function m($){if($ instanceof E){let q={};for(let _ in $.shape){let G=$.shape[_];q[_]=D.create(m(G))}return new E({...$._def,shape:()=>q})}else if($ instanceof N)return new N({...$._def,type:m($.element)});else if($ instanceof D)return D.create(m($.unwrap()));else if($ instanceof P)return P.create(m($.unwrap()));else if($ instanceof g)return g.create($.items.map((q)=>m(q)));else return $}class E extends O{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),q=R.objectKeys($);return this._cached={shape:$,keys:q},this._cached}_parse($){if(this._getType($)!==Q.object){let M=this._getOrReturnCtx($);return B(M,{code:X.invalid_type,expected:Q.object,received:M.parsedType}),z}let{status:_,ctx:G}=this._processInputParams($),{shape:W,keys:H}=this._getCached(),J=[];if(!(this._def.catchall instanceof C&&this._def.unknownKeys==="strip")){for(let M in G.data)if(!H.includes(M))J.push(M)}let Y=[];for(let M of H){let S=W[M],v=G.data[M];Y.push({key:{status:"valid",value:M},value:S._parse(new L(G,v,G.path,M)),alwaysSet:M in G.data})}if(this._def.catchall instanceof C){let M=this._def.unknownKeys;if(M==="passthrough")for(let S of J)Y.push({key:{status:"valid",value:S},value:{status:"valid",value:G.data[S]}});else if(M==="strict"){if(J.length>0)B(G,{code:X.unrecognized_keys,keys:J}),_.dirty()}else if(M==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let M=this._def.catchall;for(let S of J){let v=G.data[S];Y.push({key:{status:"valid",value:S},value:M._parse(new L(G,v,G.path,S)),alwaysSet:S in G.data})}}if(G.common.async)return Promise.resolve().then(async()=>{let M=[];for(let S of Y){let v=await S.key,V$=await S.value;M.push({key:v,value:V$,alwaysSet:S.alwaysSet})}return M}).then((M)=>{return V.mergeObjectSync(_,M)});else return V.mergeObjectSync(_,Y)}get shape(){return this._def.shape()}strict($){return w.errToObj,new E({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(q,_)=>{let G=this._def.errorMap?.(q,_).message??_.defaultError;if(q.code==="unrecognized_keys")return{message:w.errToObj($).message??G};return{message:G}}}:{}})}strip(){return new E({...this._def,unknownKeys:"strip"})}passthrough(){return new E({...this._def,unknownKeys:"passthrough"})}extend($){return new E({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new E({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:j.ZodObject})}setKey($,q){return this.augment({[$]:q})}catchall($){return new E({...this._def,catchall:$})}pick($){let q={};for(let _ of R.objectKeys($))if($[_]&&this.shape[_])q[_]=this.shape[_];return new E({...this._def,shape:()=>q})}omit($){let q={};for(let _ of R.objectKeys(this.shape))if(!$[_])q[_]=this.shape[_];return new E({...this._def,shape:()=>q})}deepPartial(){return m(this)}partial($){let q={};for(let _ of R.objectKeys(this.shape)){let G=this.shape[_];if($&&!$[_])q[_]=G;else q[_]=G.optional()}return new E({...this._def,shape:()=>q})}required($){let q={};for(let _ of R.objectKeys(this.shape))if($&&!$[_])q[_]=this.shape[_];else{let W=this.shape[_];while(W instanceof D)W=W._def.innerType;q[_]=W}return new E({...this._def,shape:()=>q})}keyof(){return N$(R.objectKeys(this.shape))}}E.create=($,q)=>{return new E({shape:()=>$,unknownKeys:"strip",catchall:C.create(),typeName:j.ZodObject,...b(q)})};E.strictCreate=($,q)=>{return new E({shape:()=>$,unknownKeys:"strict",catchall:C.create(),typeName:j.ZodObject,...b(q)})};E.lazycreate=($,q)=>{return new E({shape:$,unknownKeys:"strip",catchall:C.create(),typeName:j.ZodObject,...b(q)})};class a extends O{_parse($){let{ctx:q}=this._processInputParams($),_=this._def.options;function G(W){for(let J of W)if(J.result.status==="valid")return J.result;for(let J of W)if(J.result.status==="dirty")return q.common.issues.push(...J.ctx.common.issues),J.result;let H=W.map((J)=>new A(J.ctx.common.issues));return B(q,{code:X.invalid_union,unionErrors:H}),z}if(q.common.async)return Promise.all(_.map(async(W)=>{let H={...q,common:{...q.common,issues:[]},parent:null};return{result:await W._parseAsync({data:q.data,path:q.path,parent:H}),ctx:H}})).then(G);else{let W=void 0,H=[];for(let Y of _){let M={...q,common:{...q.common,issues:[]},parent:null},S=Y._parseSync({data:q.data,path:q.path,parent:M});if(S.status==="valid")return S;else if(S.status==="dirty"&&!W)W={result:S,ctx:M};if(M.common.issues.length)H.push(M.common.issues)}if(W)return q.common.issues.push(...W.ctx.common.issues),W.result;let J=H.map((Y)=>new A(Y));return B(q,{code:X.invalid_union,unionErrors:J}),z}}get options(){return this._def.options}}a.create=($,q)=>{return new a({options:$,typeName:j.ZodUnion,...b(q)})};var K=($)=>{if($ instanceof t)return K($.schema);else if($ instanceof f)return K($.innerType());else if($ instanceof e)return[$.value];else if($ instanceof l)return $.options;else if($ instanceof $$)return R.objectValues($.enum);else if($ instanceof q$)return K($._def.innerType);else if($ instanceof o)return[void 0];else if($ instanceof d)return[null];else if($ instanceof D)return[void 0,...K($.unwrap())];else if($ instanceof P)return[null,...K($.unwrap())];else if($ instanceof E$)return K($.unwrap());else if($ instanceof W$)return K($.unwrap());else if($ instanceof _$)return K($._def.innerType);else return[]};class R$ extends O{_parse($){let{ctx:q}=this._processInputParams($);if(q.parsedType!==Q.object)return B(q,{code:X.invalid_type,expected:Q.object,received:q.parsedType}),z;let _=this.discriminator,G=q.data[_],W=this.optionsMap.get(G);if(!W)return B(q,{code:X.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[_]}),z;if(q.common.async)return W._parseAsync({data:q.data,path:q.path,parent:q});else return W._parseSync({data:q.data,path:q.path,parent:q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,q,_){let G=new Map;for(let W of q){let H=K(W.shape[$]);if(!H.length)throw Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let J of H){if(G.has(J))throw Error(`Discriminator property ${String($)} has duplicate value ${String(J)}`);G.set(J,W)}}return new R$({typeName:j.ZodDiscriminatedUnion,discriminator:$,options:q,optionsMap:G,...b(_)})}}function O$($,q){let _=F($),G=F(q);if($===q)return{valid:!0,data:$};else if(_===Q.object&&G===Q.object){let W=R.objectKeys(q),H=R.objectKeys($).filter((Y)=>W.indexOf(Y)!==-1),J={...$,...q};for(let Y of H){let M=O$($[Y],q[Y]);if(!M.valid)return{valid:!1};J[Y]=M.data}return{valid:!0,data:J}}else if(_===Q.array&&G===Q.array){if($.length!==q.length)return{valid:!1};let W=[];for(let H=0;H<$.length;H++){let J=$[H],Y=q[H],M=O$(J,Y);if(!M.valid)return{valid:!1};W.push(M.data)}return{valid:!0,data:W}}else if(_===Q.date&&G===Q.date&&+$===+q)return{valid:!0,data:$};else return{valid:!1}}class s extends O{_parse($){let{status:q,ctx:_}=this._processInputParams($),G=(W,H)=>{if(j$(W)||j$(H))return z;let J=O$(W.value,H.value);if(!J.valid)return B(_,{code:X.invalid_intersection_types}),z;if(b$(W)||b$(H))q.dirty();return{status:q.value,value:J.data}};if(_.common.async)return Promise.all([this._def.left._parseAsync({data:_.data,path:_.path,parent:_}),this._def.right._parseAsync({data:_.data,path:_.path,parent:_})]).then(([W,H])=>G(W,H));else return G(this._def.left._parseSync({data:_.data,path:_.path,parent:_}),this._def.right._parseSync({data:_.data,path:_.path,parent:_}))}}s.create=($,q,_)=>{return new s({left:$,right:q,typeName:j.ZodIntersection,...b(_)})};class g extends O{_parse($){let{status:q,ctx:_}=this._processInputParams($);if(_.parsedType!==Q.array)return B(_,{code:X.invalid_type,expected:Q.array,received:_.parsedType}),z;if(_.data.length<this._def.items.length)return B(_,{code:X.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),z;if(!this._def.rest&&_.data.length>this._def.items.length)B(_,{code:X.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q.dirty();let W=[..._.data].map((H,J)=>{let Y=this._def.items[J]||this._def.rest;if(!Y)return null;return Y._parse(new L(_,H,_.path,J))}).filter((H)=>!!H);if(_.common.async)return Promise.all(W).then((H)=>{return V.mergeArray(q,H)});else return V.mergeArray(q,W)}get items(){return this._def.items}rest($){return new g({...this._def,rest:$})}}g.create=($,q)=>{if(!Array.isArray($))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new g({items:$,typeName:j.ZodTuple,rest:null,...b(q)})};class Y$ extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:q,ctx:_}=this._processInputParams($);if(_.parsedType!==Q.object)return B(_,{code:X.invalid_type,expected:Q.object,received:_.parsedType}),z;let G=[],W=this._def.keyType,H=this._def.valueType;for(let J in _.data)G.push({key:W._parse(new L(_,J,_.path,J)),value:H._parse(new L(_,_.data[J],_.path,J)),alwaysSet:J in _.data});if(_.common.async)return V.mergeObjectAsync(q,G);else return V.mergeObjectSync(q,G)}get element(){return this._def.valueType}static create($,q,_){if(q instanceof O)return new Y$({keyType:$,valueType:q,typeName:j.ZodRecord,...b(_)});return new Y$({keyType:k.create(),valueType:$,typeName:j.ZodRecord,...b(q)})}}class M$ extends O{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:q,ctx:_}=this._processInputParams($);if(_.parsedType!==Q.map)return B(_,{code:X.invalid_type,expected:Q.map,received:_.parsedType}),z;let G=this._def.keyType,W=this._def.valueType,H=[..._.data.entries()].map(([J,Y],M)=>{return{key:G._parse(new L(_,J,_.path,[M,"key"])),value:W._parse(new L(_,Y,_.path,[M,"value"]))}});if(_.common.async){let J=new Map;return Promise.resolve().then(async()=>{for(let Y of H){let M=await Y.key,S=await Y.value;if(M.status==="aborted"||S.status==="aborted")return z;if(M.status==="dirty"||S.status==="dirty")q.dirty();J.set(M.value,S.value)}return{status:q.value,value:J}})}else{let J=new Map;for(let Y of H){let{key:M,value:S}=Y;if(M.status==="aborted"||S.status==="aborted")return z;if(M.status==="dirty"||S.status==="dirty")q.dirty();J.set(M.value,S.value)}return{status:q.value,value:J}}}}M$.create=($,q,_)=>{return new M$({valueType:q,keyType:$,typeName:j.ZodMap,...b(_)})};class n extends O{_parse($){let{status:q,ctx:_}=this._processInputParams($);if(_.parsedType!==Q.set)return B(_,{code:X.invalid_type,expected:Q.set,received:_.parsedType}),z;let G=this._def;if(G.minSize!==null){if(_.data.size<G.minSize.value)B(_,{code:X.too_small,minimum:G.minSize.value,type:"set",inclusive:!0,exact:!1,message:G.minSize.message}),q.dirty()}if(G.maxSize!==null){if(_.data.size>G.maxSize.value)B(_,{code:X.too_big,maximum:G.maxSize.value,type:"set",inclusive:!0,exact:!1,message:G.maxSize.message}),q.dirty()}let W=this._def.valueType;function H(Y){let M=new Set;for(let S of Y){if(S.status==="aborted")return z;if(S.status==="dirty")q.dirty();M.add(S.value)}return{status:q.value,value:M}}let J=[..._.data.values()].map((Y,M)=>W._parse(new L(_,Y,_.path,M)));if(_.common.async)return Promise.all(J).then((Y)=>H(Y));else return H(J)}min($,q){return new n({...this._def,minSize:{value:$,message:w.toString(q)}})}max($,q){return new n({...this._def,maxSize:{value:$,message:w.toString(q)}})}size($,q){return this.min($,q).max($,q)}nonempty($){return this.min(1,$)}}n.create=($,q)=>{return new n({valueType:$,minSize:null,maxSize:null,typeName:j.ZodSet,...b(q)})};class i extends O{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:q}=this._processInputParams($);if(q.parsedType!==Q.function)return B(q,{code:X.invalid_type,expected:Q.function,received:q.parsedType}),z;function _(J,Y){return G$({data:J,path:q.path,errorMaps:[q.common.contextualErrorMap,q.schemaErrorMap,u(),I].filter((M)=>!!M),issueData:{code:X.invalid_arguments,argumentsError:Y}})}function G(J,Y){return G$({data:J,path:q.path,errorMaps:[q.common.contextualErrorMap,q.schemaErrorMap,u(),I].filter((M)=>!!M),issueData:{code:X.invalid_return_type,returnTypeError:Y}})}let W={errorMap:q.common.contextualErrorMap},H=q.data;if(this._def.returns instanceof c){let J=this;return U(async function(...Y){let M=new A([]),S=await J._def.args.parseAsync(Y,W).catch((z$)=>{throw M.addIssue(_(Y,z$)),M}),v=await Reflect.apply(H,this,S);return await J._def.returns._def.type.parseAsync(v,W).catch((z$)=>{throw M.addIssue(G(v,z$)),M})})}else{let J=this;return U(function(...Y){let M=J._def.args.safeParse(Y,W);if(!M.success)throw new A([_(Y,M.error)]);let S=Reflect.apply(H,this,M.data),v=J._def.returns.safeParse(S,W);if(!v.success)throw new A([G(S,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new i({...this._def,args:g.create($).rest(T.create())})}returns($){return new i({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,q,_){return new i({args:$?$:g.create([]).rest(T.create()),returns:q||T.create(),typeName:j.ZodFunction,...b(_)})}}class t extends O{get schema(){return this._def.getter()}_parse($){let{ctx:q}=this._processInputParams($);return this._def.getter()._parse({data:q.data,path:q.path,parent:q})}}t.create=($,q)=>{return new t({getter:$,typeName:j.ZodLazy,...b(q)})};class e extends O{_parse($){if($.data!==this._def.value){let q=this._getOrReturnCtx($);return B(q,{received:q.data,code:X.invalid_literal,expected:this._def.value}),z}return{status:"valid",value:$.data}}get value(){return this._def.value}}e.create=($,q)=>{return new e({value:$,typeName:j.ZodLiteral,...b(q)})};function N$($,q){return new l({values:$,typeName:j.ZodEnum,...b(q)})}class l extends O{_parse($){if(typeof $.data!=="string"){let q=this._getOrReturnCtx($),_=this._def.values;return B(q,{expected:R.joinValues(_),received:q.parsedType,code:X.invalid_type}),z}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let q=this._getOrReturnCtx($),_=this._def.values;return B(q,{received:q.data,code:X.invalid_enum_value,options:_}),z}return U($.data)}get options(){return this._def.values}get enum(){let $={};for(let q of this._def.values)$[q]=q;return $}get Values(){let $={};for(let q of this._def.values)$[q]=q;return $}get Enum(){let $={};for(let q of this._def.values)$[q]=q;return $}extract($,q=this._def){return l.create($,{...this._def,...q})}exclude($,q=this._def){return l.create(this.options.filter((_)=>!$.includes(_)),{...this._def,...q})}}l.create=N$;class $$ extends O{_parse($){let q=R.getValidEnumValues(this._def.values),_=this._getOrReturnCtx($);if(_.parsedType!==Q.string&&_.parsedType!==Q.number){let G=R.objectValues(q);return B(_,{expected:R.joinValues(G),received:_.parsedType,code:X.invalid_type}),z}if(!this._cache)this._cache=new Set(R.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let G=R.objectValues(q);return B(_,{received:_.data,code:X.invalid_enum_value,options:G}),z}return U($.data)}get enum(){return this._def.values}}$$.create=($,q)=>{return new $$({values:$,typeName:j.ZodNativeEnum,...b(q)})};class c extends O{unwrap(){return this._def.type}_parse($){let{ctx:q}=this._processInputParams($);if(q.parsedType!==Q.promise&&q.common.async===!1)return B(q,{code:X.invalid_type,expected:Q.promise,received:q.parsedType}),z;let _=q.parsedType===Q.promise?q.data:Promise.resolve(q.data);return U(_.then((G)=>{return this._def.type.parseAsync(G,{path:q.path,errorMap:q.common.contextualErrorMap})}))}}c.create=($,q)=>{return new c({type:$,typeName:j.ZodPromise,...b(q)})};class f extends O{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:q,ctx:_}=this._processInputParams($),G=this._def.effect||null,W={addIssue:(H)=>{if(B(_,H),H.fatal)q.abort();else q.dirty()},get path(){return _.path}};if(W.addIssue=W.addIssue.bind(W),G.type==="preprocess"){let H=G.transform(_.data,W);if(_.common.async)return Promise.resolve(H).then(async(J)=>{if(q.value==="aborted")return z;let Y=await this._def.schema._parseAsync({data:J,path:_.path,parent:_});if(Y.status==="aborted")return z;if(Y.status==="dirty")return x(Y.value);if(q.value==="dirty")return x(Y.value);return Y});else{if(q.value==="aborted")return z;let J=this._def.schema._parseSync({data:H,path:_.path,parent:_});if(J.status==="aborted")return z;if(J.status==="dirty")return x(J.value);if(q.value==="dirty")return x(J.value);return J}}if(G.type==="refinement"){let H=(J)=>{let Y=G.refinement(J,W);if(_.common.async)return Promise.resolve(Y);if(Y instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return J};if(_.common.async===!1){let J=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});if(J.status==="aborted")return z;if(J.status==="dirty")q.dirty();return H(J.value),{status:q.value,value:J.value}}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then((J)=>{if(J.status==="aborted")return z;if(J.status==="dirty")q.dirty();return H(J.value).then(()=>{return{status:q.value,value:J.value}})})}if(G.type==="transform")if(_.common.async===!1){let H=this._def.schema._parseSync({data:_.data,path:_.path,parent:_});if(!h(H))return z;let J=G.transform(H.value,W);if(J instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:q.value,value:J}}else return this._def.schema._parseAsync({data:_.data,path:_.path,parent:_}).then((H)=>{if(!h(H))return z;return Promise.resolve(G.transform(H.value,W)).then((J)=>({status:q.value,value:J}))});R.assertNever(G)}}f.create=($,q,_)=>{return new f({schema:$,typeName:j.ZodEffects,effect:q,...b(_)})};f.createWithPreprocess=($,q,_)=>{return new f({schema:q,effect:{type:"preprocess",transform:$},typeName:j.ZodEffects,...b(_)})};class D extends O{_parse($){if(this._getType($)===Q.undefined)return U(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}D.create=($,q)=>{return new D({innerType:$,typeName:j.ZodOptional,...b(q)})};class P extends O{_parse($){if(this._getType($)===Q.null)return U(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}P.create=($,q)=>{return new P({innerType:$,typeName:j.ZodNullable,...b(q)})};class q$ extends O{_parse($){let{ctx:q}=this._processInputParams($),_=q.data;if(q.parsedType===Q.undefined)_=this._def.defaultValue();return this._def.innerType._parse({data:_,path:q.path,parent:q})}removeDefault(){return this._def.innerType}}q$.create=($,q)=>{return new q$({innerType:$,typeName:j.ZodDefault,defaultValue:typeof q.default==="function"?q.default:()=>q.default,...b(q)})};class _$ extends O{_parse($){let{ctx:q}=this._processInputParams($),_={...q,common:{...q.common,issues:[]}},G=this._def.innerType._parse({data:_.data,path:_.path,parent:{..._}});if(p(G))return G.then((W)=>{return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new A(_.common.issues)},input:_.data})}});else return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new A(_.common.issues)},input:_.data})}}removeCatch(){return this._def.innerType}}_$.create=($,q)=>{return new _$({innerType:$,typeName:j.ZodCatch,catchValue:typeof q.catch==="function"?q.catch:()=>q.catch,...b(q)})};class B$ extends O{_parse($){if(this._getType($)!==Q.nan){let _=this._getOrReturnCtx($);return B(_,{code:X.invalid_type,expected:Q.nan,received:_.parsedType}),z}return{status:"valid",value:$.data}}}B$.create=($)=>{return new B$({typeName:j.ZodNaN,...b($)})};var zq=Symbol("zod_brand");class E$ extends O{_parse($){let{ctx:q}=this._processInputParams($),_=q.data;return this._def.type._parse({data:_,path:q.path,parent:q})}unwrap(){return this._def.type}}class w$ extends O{_parse($){let{status:q,ctx:_}=this._processInputParams($);if(_.common.async)return(async()=>{let W=await this._def.in._parseAsync({data:_.data,path:_.path,parent:_});if(W.status==="aborted")return z;if(W.status==="dirty")return q.dirty(),x(W.value);else return this._def.out._parseAsync({data:W.value,path:_.path,parent:_})})();else{let G=this._def.in._parseSync({data:_.data,path:_.path,parent:_});if(G.status==="aborted")return z;if(G.status==="dirty")return q.dirty(),{status:"dirty",value:G.value};else return this._def.out._parseSync({data:G.value,path:_.path,parent:_})}}static create($,q){return new w$({in:$,out:q,typeName:j.ZodPipeline})}}class W$ extends O{_parse($){let q=this._def.innerType._parse($),_=(G)=>{if(h(G))G.value=Object.freeze(G.value);return G};return p(q)?q.then((G)=>_(G)):_(q)}unwrap(){return this._def.innerType}}W$.create=($,q)=>{return new W$({innerType:$,typeName:j.ZodReadonly,...b(q)})};var jq={object:E.lazycreate},j;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(j||(j={}));var bq=k.create,Sq=y.create,Oq=B$.create,Rq=Z.create,Eq=H$.create,Vq=r.create,Uq=J$.create,Aq=o.create,vq=d.create,Lq=X$.create,Nq=T.create,Dq=C.create,fq=Q$.create,Fq=N.create,Kq=E.create,kq=E.strictCreate,Cq=a.create,gq=R$.create,Iq=s.create,Pq=g.create,hq=Y$.create,Tq=M$.create,lq=n.create,xq=i.create,mq=t.create,yq=e.create,Zq=l.create,nq=$$.create,cq=c.create,uq=f.create,pq=D.create,iq=P.create,rq=f.createWithPreprocess,oq=w$.create;
|
|
3
|
-
export{j as
|
|
3
|
+
export{j as ar};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ue as P,Ye as C,af as h,bf as g,cf as u,ef as m,mf as d,nf as S,rf as c,sf as i,tf as M,vf as p}from"./chunk-1bhcg889.js";import{Rq as T,Sq as v,Uq as w}from"./chunk-7nh8vjx4.js";import"./chunk-cqtkxwd8.js";import"./chunk-mfg4stzn.js";import{Iu as j}from"./chunk-zgj7jx8k.js";import"./chunk-0mdmqtfr.js";import"./chunk-0xf12tf3.js";function y(B){if(B==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let{prompt_tokens:Q,completion_tokens:X}=B;return{inputTokens:{total:Q,noCache:Q,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:X,text:X,reasoning:void 0},raw:B}}function R({data:B,mediaType:Q}){return B instanceof URL?B.toString():`data:${Q};base64,${C(B)}`}function n(B){var Q;let X=[];for(let D=0;D<B.length;D++){let{role:K,content:$}=B[D],N=D===B.length-1;switch(K){case"system":{X.push({role:"system",content:$});break}case"user":{X.push({role:"user",content:$.map((G)=>{switch(G.type){case"text":return{type:"text",text:G.text};case"file":if(G.mediaType.startsWith("image/")){let Z=G.mediaType==="image/*"?"image/jpeg":G.mediaType;return{type:"image_url",image_url:R({data:G.data,mediaType:Z})}}else if(G.mediaType==="application/pdf")return{type:"document_url",document_url:R({data:G.data,mediaType:"application/pdf"})};else throw new w({functionality:"Only images and PDF file parts are supported"})}})});break}case"assistant":{let G="",Z=[];for(let Y of $)switch(Y.type){case"text":{G+=Y.text;break}case"tool-call":{Z.push({id:Y.toolCallId,type:"function",function:{name:Y.toolName,arguments:JSON.stringify(Y.input)}});break}case"reasoning":{G+=Y.text;break}default:throw Error(`Unsupported content type in assistant message: ${Y.type}`)}X.push({role:"assistant",content:G,prefix:N?!0:void 0,tool_calls:Z.length>0?Z:void 0});break}case"tool":{for(let G of $){if(G.type==="tool-approval-response")continue;let Z=G.output,Y;switch(Z.type){case"text":case"error-text":Y=Z.value;break;case"execution-denied":Y=(Q=Z.reason)!=null?Q:"Tool execution denied.";break;case"content":case"json":case"error-json":Y=JSON.stringify(Z.value);break}X.push({role:"tool",name:G.toolName,tool_call_id:G.toolCallId,content:Y})}break}default:throw Error(`Unsupported role: ${K}`)}}return X}function k({id:B,model:Q,created:X}){return{id:B!=null?B:void 0,modelId:Q!=null?Q:void 0,timestamp:X!=null?new Date(X*1000):void 0}}function x(B){switch(B){case"stop":return"stop";case"length":case"model_length":return"length";case"tool_calls":return"tool-calls";default:return"other"}}var t=j.object({safePrompt:j.boolean().optional(),documentImageLimit:j.number().optional(),documentPageLimit:j.number().optional(),structuredOutputs:j.boolean().optional(),strictJsonSchema:j.boolean().optional(),parallelToolCalls:j.boolean().optional(),reasoningEffort:j.enum(["high","none"]).optional()}),e=j.object({object:j.literal("error"),message:j.string(),type:j.string(),param:j.string().nullable(),code:j.string().nullable()}),b=c({errorSchema:e,errorToMessage:(B)=>B.message});function o({tools:B,toolChoice:Q}){B=(B==null?void 0:B.length)?B:void 0;let X=[];if(B==null)return{tools:void 0,toolChoice:void 0,toolWarnings:X};let D=[];for(let $ of B)if($.type==="provider")X.push({type:"unsupported",feature:`provider-defined tool ${$.id}`});else D.push({type:"function",function:{name:$.name,description:$.description,parameters:$.inputSchema,...$.strict!=null?{strict:$.strict}:{}}});if(Q==null)return{tools:D,toolChoice:void 0,toolWarnings:X};let K=Q.type;switch(K){case"auto":case"none":return{tools:D,toolChoice:K,toolWarnings:X};case"required":return{tools:D,toolChoice:"any",toolWarnings:X};case"tool":return{tools:D.filter(($)=>$.function.name===Q.toolName),toolChoice:"any",toolWarnings:X};default:throw new w({functionality:`tool choice type: ${K}`})}}var jj=class{constructor(B,Q){this.specificationVersion="v3",this.supportedUrls={"application/pdf":[/^https:\/\/.*$/]};var X;this.modelId=B,this.config=Q,this.generateId=(X=Q.generateId)!=null?X:h}get provider(){return this.config.provider}async getArgs({prompt:B,maxOutputTokens:Q,temperature:X,topP:D,topK:K,frequencyPenalty:$,presencePenalty:N,stopSequences:G,responseFormat:Z,seed:Y,providerOptions:J,tools:f,toolChoice:L}){var U,O,V,q;let E=[],A=(U=await d({provider:"mistral",providerOptions:J,schema:t}))!=null?U:{};if(K!=null)E.push({type:"unsupported",feature:"topK"});if($!=null)E.push({type:"unsupported",feature:"frequencyPenalty"});if(N!=null)E.push({type:"unsupported",feature:"presencePenalty"});if(G!=null)E.push({type:"unsupported",feature:"stopSequences"});let H=(O=A.structuredOutputs)!=null?O:!0,z=(V=A.strictJsonSchema)!=null?V:!1;if((Z==null?void 0:Z.type)==="json"&&!(Z==null?void 0:Z.schema))B=u({messages:B,schema:Z.schema});let W={model:this.modelId,safe_prompt:A.safePrompt,max_tokens:Q,temperature:X,top_p:D,random_seed:Y,reasoning_effort:A.reasoningEffort,response_format:(Z==null?void 0:Z.type)==="json"?H&&(Z==null?void 0:Z.schema)!=null?{type:"json_schema",json_schema:{schema:Z.schema,strict:z,name:(q=Z.name)!=null?q:"response",description:Z.description}}:{type:"json_object"}:void 0,document_image_limit:A.documentImageLimit,document_page_limit:A.documentPageLimit,messages:n(B)},{tools:_,toolChoice:s,toolWarnings:r}=o({tools:f,toolChoice:L});return{args:{...W,tools:_,tool_choice:s,..._!=null&&A.parallelToolCalls!==void 0?{parallel_tool_calls:A.parallelToolCalls}:{}},warnings:[...E,...r]}}async doGenerate(B){var Q;let{args:X,warnings:D}=await this.getArgs(B),{responseHeaders:K,value:$,rawValue:N}=await S({url:`${this.config.baseURL}/chat/completions`,headers:P(this.config.headers(),B.headers),body:X,failedResponseHandler:b,successfulResponseHandler:M(Bj),abortSignal:B.abortSignal,fetch:this.config.fetch}),G=$.choices[0],Z=[];if(G.message.content!=null&&Array.isArray(G.message.content)){for(let Y of G.message.content)if(Y.type==="thinking"){let J=F(Y.thinking);if(J.length>0)Z.push({type:"reasoning",text:J})}else if(Y.type==="text"){if(Y.text.length>0)Z.push({type:"text",text:Y.text})}}else{let Y=I(G.message.content);if(Y!=null&&Y.length>0)Z.push({type:"text",text:Y})}if(G.message.tool_calls!=null)for(let Y of G.message.tool_calls)Z.push({type:"tool-call",toolCallId:Y.id,toolName:Y.function.name,input:Y.function.arguments});return{content:Z,finishReason:{unified:x(G.finish_reason),raw:(Q=G.finish_reason)!=null?Q:void 0},usage:y($.usage),request:{body:X},response:{...k($),headers:K,body:N},warnings:D}}async doStream(B){let{args:Q,warnings:X}=await this.getArgs(B),D={...Q,stream:!0},{responseHeaders:K,value:$}=await S({url:`${this.config.baseURL}/chat/completions`,headers:P(this.config.headers(),B.headers),body:D,failedResponseHandler:b,successfulResponseHandler:i(Gj),abortSignal:B.abortSignal,fetch:this.config.fetch}),N={unified:"other",raw:void 0},G=void 0,Z=!0,Y=!1,J=null,f=this.generateId;return{stream:$.pipeThrough(new TransformStream({start(L){L.enqueue({type:"stream-start",warnings:X})},transform(L,U){if(B.includeRawChunks)U.enqueue({type:"raw",rawValue:L.rawValue});if(!L.success){U.enqueue({type:"error",error:L.error});return}let O=L.value;if(Z)Z=!1,U.enqueue({type:"response-metadata",...k(O)});if(O.usage!=null)G=O.usage;let V=O.choices[0],q=V.delta,E=I(q.content);if(q.content!=null&&Array.isArray(q.content)){for(let A of q.content)if(A.type==="thinking"){let H=F(A.thinking);if(H.length>0){if(J==null){if(Y)U.enqueue({type:"text-end",id:"0"}),Y=!1;J=f(),U.enqueue({type:"reasoning-start",id:J})}U.enqueue({type:"reasoning-delta",id:J,delta:H})}}}if(E!=null&&E.length>0){if(!Y){if(J!=null)U.enqueue({type:"reasoning-end",id:J}),J=null;U.enqueue({type:"text-start",id:"0"}),Y=!0}U.enqueue({type:"text-delta",id:"0",delta:E})}if((q==null?void 0:q.tool_calls)!=null)for(let A of q.tool_calls){let H=A.id,z=A.function.name,W=A.function.arguments;U.enqueue({type:"tool-input-start",id:H,toolName:z}),U.enqueue({type:"tool-input-delta",id:H,delta:W}),U.enqueue({type:"tool-input-end",id:H}),U.enqueue({type:"tool-call",toolCallId:H,toolName:z,input:W})}if(V.finish_reason!=null)N={unified:x(V.finish_reason),raw:V.finish_reason}},flush(L){if(J!=null)L.enqueue({type:"reasoning-end",id:J});if(Y)L.enqueue({type:"text-end",id:"0"});L.enqueue({type:"finish",finishReason:N,usage:y(G)})}})),request:{body:D},response:{headers:K}}}};function F(B){return B.filter((Q)=>Q.type==="text").map((Q)=>Q.text).join("")}function I(B){if(typeof B==="string")return B;if(B==null)return;let Q=[];for(let X of B){let{type:D}=X;switch(D){case"text":Q.push(X.text);break;case"thinking":case"image_url":case"reference":break;default:throw Error(`Unsupported type: ${D}`)}}return Q.length?Q.join(""):void 0}var l=j.union([j.string(),j.array(j.discriminatedUnion("type",[j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("image_url"),image_url:j.union([j.string(),j.object({url:j.string(),detail:j.string().nullable()})])}),j.object({type:j.literal("reference"),reference_ids:j.array(j.union([j.string(),j.number()]))}),j.object({type:j.literal("thinking"),thinking:j.array(j.object({type:j.literal("text"),text:j.string()}))})]))]).nullish(),a=j.object({prompt_tokens:j.number(),completion_tokens:j.number(),total_tokens:j.number()}),Bj=j.object({id:j.string().nullish(),created:j.number().nullish(),model:j.string().nullish(),choices:j.array(j.object({message:j.object({role:j.literal("assistant"),content:l,tool_calls:j.array(j.object({id:j.string(),function:j.object({name:j.string(),arguments:j.string()})})).nullish()}),index:j.number(),finish_reason:j.string().nullish()})),object:j.literal("chat.completion"),usage:a}),Gj=j.object({id:j.string().nullish(),created:j.number().nullish(),model:j.string().nullish(),choices:j.array(j.object({delta:j.object({role:j.enum(["assistant"]).optional(),content:l,tool_calls:j.array(j.object({id:j.string(),function:j.object({name:j.string(),arguments:j.string()})})).nullish()}),finish_reason:j.string().nullish(),index:j.number()})),usage:a.nullish()}),Qj=class{constructor(B,Q){this.specificationVersion="v3",this.maxEmbeddingsPerCall=32,this.supportsParallelCalls=!1,this.modelId=B,this.config=Q}get provider(){return this.config.provider}async doEmbed({values:B,abortSignal:Q,headers:X}){if(B.length>this.maxEmbeddingsPerCall)throw new v({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:B});let{responseHeaders:D,value:K,rawValue:$}=await S({url:`${this.config.baseURL}/embeddings`,headers:P(this.config.headers(),X),body:{model:this.modelId,input:B,encoding_format:"float"},failedResponseHandler:b,successfulResponseHandler:M(Xj),abortSignal:Q,fetch:this.config.fetch});return{warnings:[],embeddings:K.data.map((N)=>N.embedding),usage:K.usage?{tokens:K.usage.prompt_tokens}:void 0,response:{headers:D,body:$}}}},Xj=j.object({data:j.array(j.object({embedding:j.array(j.number())})),usage:j.object({prompt_tokens:j.number()}).nullish()}),Yj="3.0.27";function Zj(B={}){var Q;let X=(Q=p(B.baseURL))!=null?Q:"https://api.mistral.ai/v1",D=()=>g({Authorization:`Bearer ${m({apiKey:B.apiKey,environmentVariableName:"MISTRAL_API_KEY",description:"Mistral"})}`,...B.headers},`ai-sdk/mistral/${Yj}`),K=(G)=>new jj(G,{provider:"mistral.chat",baseURL:X,headers:D,fetch:B.fetch,generateId:B.generateId}),$=(G)=>new Qj(G,{provider:"mistral.embedding",baseURL:X,headers:D,fetch:B.fetch}),N=function(G){if(new.target)throw Error("The Mistral model function cannot be called with the new keyword.");return K(G)};return N.specificationVersion="v3",N.languageModel=K,N.chat=K,N.embedding=$,N.embeddingModel=$,N.textEmbedding=$,N.textEmbeddingModel=$,N.imageModel=(G)=>{throw new T({modelId:G,modelType:"imageModel"})},N}var Pj=Zj();export{Pj as mistral,Zj as createMistral,Yj as VERSION};
|
|
2
|
+
import{We as P,_e as C,cf as h,df as g,ef as u,gf as m,of as d,pf as S,tf as c,uf as i,vf as M,xf as p}from"./chunk-4ycg2c6f.js";import{Uq as T,Vq as v,Xq as w}from"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import{Lu as j}from"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-sh03ka27.js";function y(B){if(B==null)return{inputTokens:{total:void 0,noCache:void 0,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:void 0,text:void 0,reasoning:void 0},raw:void 0};let{prompt_tokens:Q,completion_tokens:X}=B;return{inputTokens:{total:Q,noCache:Q,cacheRead:void 0,cacheWrite:void 0},outputTokens:{total:X,text:X,reasoning:void 0},raw:B}}function R({data:B,mediaType:Q}){return B instanceof URL?B.toString():`data:${Q};base64,${C(B)}`}function n(B){var Q;let X=[];for(let D=0;D<B.length;D++){let{role:K,content:$}=B[D],N=D===B.length-1;switch(K){case"system":{X.push({role:"system",content:$});break}case"user":{X.push({role:"user",content:$.map((G)=>{switch(G.type){case"text":return{type:"text",text:G.text};case"file":if(G.mediaType.startsWith("image/")){let Z=G.mediaType==="image/*"?"image/jpeg":G.mediaType;return{type:"image_url",image_url:R({data:G.data,mediaType:Z})}}else if(G.mediaType==="application/pdf")return{type:"document_url",document_url:R({data:G.data,mediaType:"application/pdf"})};else throw new w({functionality:"Only images and PDF file parts are supported"})}})});break}case"assistant":{let G="",Z=[];for(let Y of $)switch(Y.type){case"text":{G+=Y.text;break}case"tool-call":{Z.push({id:Y.toolCallId,type:"function",function:{name:Y.toolName,arguments:JSON.stringify(Y.input)}});break}case"reasoning":{G+=Y.text;break}default:throw Error(`Unsupported content type in assistant message: ${Y.type}`)}X.push({role:"assistant",content:G,prefix:N?!0:void 0,tool_calls:Z.length>0?Z:void 0});break}case"tool":{for(let G of $){if(G.type==="tool-approval-response")continue;let Z=G.output,Y;switch(Z.type){case"text":case"error-text":Y=Z.value;break;case"execution-denied":Y=(Q=Z.reason)!=null?Q:"Tool execution denied.";break;case"content":case"json":case"error-json":Y=JSON.stringify(Z.value);break}X.push({role:"tool",name:G.toolName,tool_call_id:G.toolCallId,content:Y})}break}default:throw Error(`Unsupported role: ${K}`)}}return X}function k({id:B,model:Q,created:X}){return{id:B!=null?B:void 0,modelId:Q!=null?Q:void 0,timestamp:X!=null?new Date(X*1000):void 0}}function x(B){switch(B){case"stop":return"stop";case"length":case"model_length":return"length";case"tool_calls":return"tool-calls";default:return"other"}}var t=j.object({safePrompt:j.boolean().optional(),documentImageLimit:j.number().optional(),documentPageLimit:j.number().optional(),structuredOutputs:j.boolean().optional(),strictJsonSchema:j.boolean().optional(),parallelToolCalls:j.boolean().optional(),reasoningEffort:j.enum(["high","none"]).optional()}),e=j.object({object:j.literal("error"),message:j.string(),type:j.string(),param:j.string().nullable(),code:j.string().nullable()}),b=c({errorSchema:e,errorToMessage:(B)=>B.message});function o({tools:B,toolChoice:Q}){B=(B==null?void 0:B.length)?B:void 0;let X=[];if(B==null)return{tools:void 0,toolChoice:void 0,toolWarnings:X};let D=[];for(let $ of B)if($.type==="provider")X.push({type:"unsupported",feature:`provider-defined tool ${$.id}`});else D.push({type:"function",function:{name:$.name,description:$.description,parameters:$.inputSchema,...$.strict!=null?{strict:$.strict}:{}}});if(Q==null)return{tools:D,toolChoice:void 0,toolWarnings:X};let K=Q.type;switch(K){case"auto":case"none":return{tools:D,toolChoice:K,toolWarnings:X};case"required":return{tools:D,toolChoice:"any",toolWarnings:X};case"tool":return{tools:D.filter(($)=>$.function.name===Q.toolName),toolChoice:"any",toolWarnings:X};default:throw new w({functionality:`tool choice type: ${K}`})}}var jj=class{constructor(B,Q){this.specificationVersion="v3",this.supportedUrls={"application/pdf":[/^https:\/\/.*$/]};var X;this.modelId=B,this.config=Q,this.generateId=(X=Q.generateId)!=null?X:h}get provider(){return this.config.provider}async getArgs({prompt:B,maxOutputTokens:Q,temperature:X,topP:D,topK:K,frequencyPenalty:$,presencePenalty:N,stopSequences:G,responseFormat:Z,seed:Y,providerOptions:J,tools:f,toolChoice:L}){var U,O,V,q;let E=[],A=(U=await d({provider:"mistral",providerOptions:J,schema:t}))!=null?U:{};if(K!=null)E.push({type:"unsupported",feature:"topK"});if($!=null)E.push({type:"unsupported",feature:"frequencyPenalty"});if(N!=null)E.push({type:"unsupported",feature:"presencePenalty"});if(G!=null)E.push({type:"unsupported",feature:"stopSequences"});let H=(O=A.structuredOutputs)!=null?O:!0,z=(V=A.strictJsonSchema)!=null?V:!1;if((Z==null?void 0:Z.type)==="json"&&!(Z==null?void 0:Z.schema))B=u({messages:B,schema:Z.schema});let W={model:this.modelId,safe_prompt:A.safePrompt,max_tokens:Q,temperature:X,top_p:D,random_seed:Y,reasoning_effort:A.reasoningEffort,response_format:(Z==null?void 0:Z.type)==="json"?H&&(Z==null?void 0:Z.schema)!=null?{type:"json_schema",json_schema:{schema:Z.schema,strict:z,name:(q=Z.name)!=null?q:"response",description:Z.description}}:{type:"json_object"}:void 0,document_image_limit:A.documentImageLimit,document_page_limit:A.documentPageLimit,messages:n(B)},{tools:_,toolChoice:s,toolWarnings:r}=o({tools:f,toolChoice:L});return{args:{...W,tools:_,tool_choice:s,..._!=null&&A.parallelToolCalls!==void 0?{parallel_tool_calls:A.parallelToolCalls}:{}},warnings:[...E,...r]}}async doGenerate(B){var Q;let{args:X,warnings:D}=await this.getArgs(B),{responseHeaders:K,value:$,rawValue:N}=await S({url:`${this.config.baseURL}/chat/completions`,headers:P(this.config.headers(),B.headers),body:X,failedResponseHandler:b,successfulResponseHandler:M(Bj),abortSignal:B.abortSignal,fetch:this.config.fetch}),G=$.choices[0],Z=[];if(G.message.content!=null&&Array.isArray(G.message.content)){for(let Y of G.message.content)if(Y.type==="thinking"){let J=F(Y.thinking);if(J.length>0)Z.push({type:"reasoning",text:J})}else if(Y.type==="text"){if(Y.text.length>0)Z.push({type:"text",text:Y.text})}}else{let Y=I(G.message.content);if(Y!=null&&Y.length>0)Z.push({type:"text",text:Y})}if(G.message.tool_calls!=null)for(let Y of G.message.tool_calls)Z.push({type:"tool-call",toolCallId:Y.id,toolName:Y.function.name,input:Y.function.arguments});return{content:Z,finishReason:{unified:x(G.finish_reason),raw:(Q=G.finish_reason)!=null?Q:void 0},usage:y($.usage),request:{body:X},response:{...k($),headers:K,body:N},warnings:D}}async doStream(B){let{args:Q,warnings:X}=await this.getArgs(B),D={...Q,stream:!0},{responseHeaders:K,value:$}=await S({url:`${this.config.baseURL}/chat/completions`,headers:P(this.config.headers(),B.headers),body:D,failedResponseHandler:b,successfulResponseHandler:i(Gj),abortSignal:B.abortSignal,fetch:this.config.fetch}),N={unified:"other",raw:void 0},G=void 0,Z=!0,Y=!1,J=null,f=this.generateId;return{stream:$.pipeThrough(new TransformStream({start(L){L.enqueue({type:"stream-start",warnings:X})},transform(L,U){if(B.includeRawChunks)U.enqueue({type:"raw",rawValue:L.rawValue});if(!L.success){U.enqueue({type:"error",error:L.error});return}let O=L.value;if(Z)Z=!1,U.enqueue({type:"response-metadata",...k(O)});if(O.usage!=null)G=O.usage;let V=O.choices[0],q=V.delta,E=I(q.content);if(q.content!=null&&Array.isArray(q.content)){for(let A of q.content)if(A.type==="thinking"){let H=F(A.thinking);if(H.length>0){if(J==null){if(Y)U.enqueue({type:"text-end",id:"0"}),Y=!1;J=f(),U.enqueue({type:"reasoning-start",id:J})}U.enqueue({type:"reasoning-delta",id:J,delta:H})}}}if(E!=null&&E.length>0){if(!Y){if(J!=null)U.enqueue({type:"reasoning-end",id:J}),J=null;U.enqueue({type:"text-start",id:"0"}),Y=!0}U.enqueue({type:"text-delta",id:"0",delta:E})}if((q==null?void 0:q.tool_calls)!=null)for(let A of q.tool_calls){let H=A.id,z=A.function.name,W=A.function.arguments;U.enqueue({type:"tool-input-start",id:H,toolName:z}),U.enqueue({type:"tool-input-delta",id:H,delta:W}),U.enqueue({type:"tool-input-end",id:H}),U.enqueue({type:"tool-call",toolCallId:H,toolName:z,input:W})}if(V.finish_reason!=null)N={unified:x(V.finish_reason),raw:V.finish_reason}},flush(L){if(J!=null)L.enqueue({type:"reasoning-end",id:J});if(Y)L.enqueue({type:"text-end",id:"0"});L.enqueue({type:"finish",finishReason:N,usage:y(G)})}})),request:{body:D},response:{headers:K}}}};function F(B){return B.filter((Q)=>Q.type==="text").map((Q)=>Q.text).join("")}function I(B){if(typeof B==="string")return B;if(B==null)return;let Q=[];for(let X of B){let{type:D}=X;switch(D){case"text":Q.push(X.text);break;case"thinking":case"image_url":case"reference":break;default:throw Error(`Unsupported type: ${D}`)}}return Q.length?Q.join(""):void 0}var l=j.union([j.string(),j.array(j.discriminatedUnion("type",[j.object({type:j.literal("text"),text:j.string()}),j.object({type:j.literal("image_url"),image_url:j.union([j.string(),j.object({url:j.string(),detail:j.string().nullable()})])}),j.object({type:j.literal("reference"),reference_ids:j.array(j.union([j.string(),j.number()]))}),j.object({type:j.literal("thinking"),thinking:j.array(j.object({type:j.literal("text"),text:j.string()}))})]))]).nullish(),a=j.object({prompt_tokens:j.number(),completion_tokens:j.number(),total_tokens:j.number()}),Bj=j.object({id:j.string().nullish(),created:j.number().nullish(),model:j.string().nullish(),choices:j.array(j.object({message:j.object({role:j.literal("assistant"),content:l,tool_calls:j.array(j.object({id:j.string(),function:j.object({name:j.string(),arguments:j.string()})})).nullish()}),index:j.number(),finish_reason:j.string().nullish()})),object:j.literal("chat.completion"),usage:a}),Gj=j.object({id:j.string().nullish(),created:j.number().nullish(),model:j.string().nullish(),choices:j.array(j.object({delta:j.object({role:j.enum(["assistant"]).optional(),content:l,tool_calls:j.array(j.object({id:j.string(),function:j.object({name:j.string(),arguments:j.string()})})).nullish()}),finish_reason:j.string().nullish(),index:j.number()})),usage:a.nullish()}),Qj=class{constructor(B,Q){this.specificationVersion="v3",this.maxEmbeddingsPerCall=32,this.supportsParallelCalls=!1,this.modelId=B,this.config=Q}get provider(){return this.config.provider}async doEmbed({values:B,abortSignal:Q,headers:X}){if(B.length>this.maxEmbeddingsPerCall)throw new v({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:B});let{responseHeaders:D,value:K,rawValue:$}=await S({url:`${this.config.baseURL}/embeddings`,headers:P(this.config.headers(),X),body:{model:this.modelId,input:B,encoding_format:"float"},failedResponseHandler:b,successfulResponseHandler:M(Xj),abortSignal:Q,fetch:this.config.fetch});return{warnings:[],embeddings:K.data.map((N)=>N.embedding),usage:K.usage?{tokens:K.usage.prompt_tokens}:void 0,response:{headers:D,body:$}}}},Xj=j.object({data:j.array(j.object({embedding:j.array(j.number())})),usage:j.object({prompt_tokens:j.number()}).nullish()}),Yj="3.0.27";function Zj(B={}){var Q;let X=(Q=p(B.baseURL))!=null?Q:"https://api.mistral.ai/v1",D=()=>g({Authorization:`Bearer ${m({apiKey:B.apiKey,environmentVariableName:"MISTRAL_API_KEY",description:"Mistral"})}`,...B.headers},`ai-sdk/mistral/${Yj}`),K=(G)=>new jj(G,{provider:"mistral.chat",baseURL:X,headers:D,fetch:B.fetch,generateId:B.generateId}),$=(G)=>new Qj(G,{provider:"mistral.embedding",baseURL:X,headers:D,fetch:B.fetch}),N=function(G){if(new.target)throw Error("The Mistral model function cannot be called with the new keyword.");return K(G)};return N.specificationVersion="v3",N.languageModel=K,N.chat=K,N.embedding=$,N.embeddingModel=$,N.textEmbedding=$,N.textEmbeddingModel=$,N.imageModel=(G)=>{throw new T({modelId:G,modelType:"imageModel"})},N}var Pj=Zj();export{Pj as mistral,Zj as createMistral,Yj as VERSION};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ad as
|
|
2
|
+
import{Ad as c,Bd as d,Cd as e,Dd as f,Ed as g,Fd as h,Gd as i,Hd as j,Id as k,Jd as l,yd as a,zd as b}from"./chunk-840mmmzz.js";import"./chunk-sh03ka27.js";export{i as setRendererCapabilities,a as pasteBytes,f as createTestRenderer,h as createTerminalCapabilities,j as createSpy,e as createMockMouse,c as createMockKeys,l as TestRecorder,d as MouseButtons,g as MockTreeSitterClient,k as ManualClock,b as KeyCodes};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Oe as M}from"./chunk-69k7cdtv.js";import{Re as D}from"./chunk-w136zswr.js";import{Se as B}from"./chunk-s0gmxpxm.js";import{Gf as d,If as w}from"./chunk-48rg4yhk.js";import{uP as n}from"./chunk-sh03ka27.js";var R=n(D(),1),i=n(d(),1),A=n(M(),1);import N from"fs/promises";var S=n(d(),1);var _="169.254.170.2",p="169.254.170.23",u="[fd00:ec2::23]",g=(e,c)=>{if(e.protocol==="https:")return;if(e.hostname===_||e.hostname===p||e.hostname===u)return;if(e.hostname.includes("[")){if(e.hostname==="[::1]"||e.hostname==="[0000:0000:0000:0000:0000:0000:0000:0001]")return}else{if(e.hostname==="localhost")return;let a=e.hostname.split("."),r=(t)=>{let s=parseInt(t,10);return 0<=s&&s<=255};if(a[0]==="127"&&r(a[1])&&r(a[2])&&r(a[3])&&a.length===4)return}throw new S.CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
|
|
3
3
|
- loopback CIDR 127.0.0.0/8 or [::1/128]
|
|
4
4
|
- ECS container host 169.254.170.2
|
|
5
5
|
- EKS container host 169.254.170.23 or [fd00:ec2::23]`,{logger:c})};var f=n(d(),1),I=n(B(),1),P=n(w(),1),K=n(w(),1);function x(e){return new I.HttpRequest({protocol:e.protocol,hostname:e.hostname,port:Number(e.port),path:e.pathname,query:Array.from(e.searchParams.entries()).reduce((c,[a,r])=>{return c[a]=r,c},{}),fragment:e.hash})}async function E(e,c){let r=await K.sdkStreamMixin(e.body).transformToString();if(e.statusCode===200){let t=JSON.parse(r);if(typeof t.AccessKeyId!=="string"||typeof t.SecretAccessKey!=="string"||typeof t.Token!=="string"||typeof t.Expiration!=="string")throw new f.CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }",{logger:c});return{accessKeyId:t.AccessKeyId,secretAccessKey:t.SecretAccessKey,sessionToken:t.Token,expiration:P.parseRfc3339DateTime(t.Expiration)}}if(e.statusCode>=400&&e.statusCode<500){let t={};try{t=JSON.parse(r)}catch(s){}throw Object.assign(new f.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:c}),{Code:t.Code,Message:t.Message})}throw new f.CredentialsProviderError(`Server responded with status: ${e.statusCode}`,{logger:c})}var T=(e,c,a)=>{return async()=>{for(let r=0;r<c;++r)try{return await e()}catch(t){await new Promise((s)=>setTimeout(s,a))}return await e()}};var j="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",J="http://169.254.170.2",$="AWS_CONTAINER_CREDENTIALS_FULL_URI",G="AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE",H="AWS_CONTAINER_AUTHORIZATION_TOKEN",k=(e={})=>{e.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");let c,a=e.awsContainerCredentialsRelativeUri??process.env[j],r=e.awsContainerCredentialsFullUri??process.env[$],t=e.awsContainerAuthorizationToken??process.env[H],s=e.awsContainerAuthorizationTokenFile??process.env[G],m=e.logger?.constructor?.name==="NoOpLogger"||!e.logger?.warn?console.warn:e.logger.warn.bind(e.logger);if(a&&r)m("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri."),m("awsContainerCredentialsFullUri will take precedence.");if(t&&s)m("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile."),m("awsContainerAuthorizationToken will take precedence.");if(r)c=r;else if(a)c=`${J}${a}`;else throw new i.CredentialsProviderError(`No HTTP credential provider host provided.
|
|
6
|
-
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:e.logger});let y=new URL(c);g(y,e.logger);let C=A.NodeHttpHandler.create({connectionTimeout:e.timeout??1000}),O=e.timeout??1000,b=T(async()=>{let o=x(y);if(t)o.headers.Authorization=t;else if(s)o.headers.Authorization=(await N.readFile(s)).toString();try{let h=await C.handle(o,{requestTimeout:O});return E(h.response).then((v)=>R.setCredentialFeature(v,"CREDENTIALS_HTTP","z"))}catch(h){throw new i.CredentialsProviderError(String(h),{logger:e.logger})}},e.maxRetries??3,e.timeout??1000);return async()=>{try{return await b()}finally{C.destroy?.()}}};export{k as
|
|
6
|
+
Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`,{logger:e.logger});let y=new URL(c);g(y,e.logger);let C=A.NodeHttpHandler.create({connectionTimeout:e.timeout??1000}),O=e.timeout??1000,b=T(async()=>{let o=x(y);if(t)o.headers.Authorization=t;else if(s)o.headers.Authorization=(await N.readFile(s)).toString();try{let h=await C.handle(o,{requestTimeout:O});return E(h.response).then((v)=>R.setCredentialFeature(v,"CREDENTIALS_HTTP","z"))}catch(h){throw new i.CredentialsProviderError(String(h),{logger:e.logger})}},e.maxRetries??3,e.timeout??1000);return async()=>{try{return await b()}finally{C.destroy?.()}}};export{k as pe};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Wo as MJ,_o as $J,qp as kJ}from"./chunk-6wt8g6mc.js";import{Fp as qJ}from"./chunk-1rafe6f5.js";import{bt as F}from"./chunk-ajykvcas.js";import{Ft as LJ}from"./chunk-vvmvryh1.js";import{Mt as e,Ut as SJ}from"./chunk-6g3bzap8.js";import{gu as OJ,ju as QJ}from"./chunk-mrh5q4s6.js";var cJ=0.9,mJ=256,VJ="[Earlier tool result removed to fit the request size limit]",c;function h(J){return Buffer.byteLength(JSON.stringify(J),"utf8")}function NJ(){return e.QITQODE_QLEX_MAX_REQUEST_BYTES??c}function JJ(J){let K=e.QITQODE_QLEX_MAX_REQUEST_BYTES;if(K!==void 0)return K;let Z=Math.max(1,Math.min(Math.floor(J*cJ),Math.floor(J)-1));return c=c===void 0?Z:Math.min(c,Z),c}function m(J,K){return!!J&&typeof J==="object"&&J.role===K}function DJ(J){let K=[],Z=0;while(Z<J.length){let $=Z,z=J[Z];if(Z++,m(z,"assistant")&&Array.isArray(z?.tool_calls)&&z.tool_calls.length>0)while(Z<J.length&&m(J[Z],"tool"))Z++;K.push({start:$,end:Z})}return K}function WJ(J,K){if(K.length===0)return[];let Z=-1;for(let $=K.length-1;$>=0;$--){let z=K[$],X=!1;for(let Y=z.start;Y<z.end;Y++)if(m(J[Y],"user"))X=!0;if(X){Z=$;break}}return K.filter(($,z)=>{if(z===K.length-1)return!1;if(z===Z)return!1;if($.start===0&&m(J[0],"system"))return!1;return!0})}function KJ(J,K){let Z=h(J),$={toolResultsElided:0,unitsDropped:0},z=()=>({body:J,bytes:Z,originalBytes:Z,reduced:!1,actions:$});if(!J||typeof J!=="object")return z();let X=J.messages;if(!Array.isArray(X))return z();let Y=X.map((j)=>j&&typeof j==="object"?{...j}:j),H=()=>({...J,messages:Y}),V=()=>h(H())<=K;{let j=Y;for(let N of WJ(j,DJ(j))){let L=!1;for(let O=N.start;O<N.end;O++){let k=j[O];if(!m(k,"tool"))continue;let w=k?.content;if(typeof w!=="string"||w.length<mJ)continue;if(w===VJ)continue;j[O]={...k,content:VJ},$.toolResultsElided++,L=!0}if(L&&V())break}}if(!V())for(;;){let j=Y,L=WJ(j,DJ(j))[0];if(!L)break;if(Y=[...j.slice(0,L.start),...j.slice(L.end)],$.unitsDropped++,V())break}let U=H(),P=h(U);return{body:U,bytes:P,originalBytes:Z,reduced:P<Z&&P<=K,actions:$}}import y from"fs/promises";import EJ from"path";import{randomUUID as lJ}from"crypto";var E=SJ({service:"provider.qlex"}),dJ=F.streamUrl(),iJ=F.omniqueryBaseUrl()+"/runOrchestrated",rJ=new Set(["rate_limited","transient","stream_truncated","stream_failed"]);function l(J,K){return K!==!1&&rJ.has(J)}function a(J){return typeof J==="string"&&/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(J)?J:void 0}function x(J,K){let Z=J;if(K.status!==void 0)Z.status=K.status;if(K.upstreamCode!==void 0)Z.upstreamCode=K.upstreamCode;let $=a(K.requestId);if($!==void 0)Z.requestId=$;if(Z.category=K.category,Z.retryable=l(K.category,K.retryable),K.outputBudgetRecoveryAvailable!==void 0)Z.outputBudgetRecoveryAvailable=K.outputBudgetRecoveryAvailable;if(K.outputBudgetRecoveryTokens!==void 0)Z.outputBudgetRecoveryTokens=K.outputBudgetRecoveryTokens}function b(J,K){return{...J,...K}}class wJ extends Error{name="QlexNotLoggedInError";constructor(J){super(F.copy().notLoggedIn);x(this,b({category:"invalid_credentials",retryable:!1},J))}}class RJ extends Error{name="QlexInsufficientBalanceError";constructor(J,K){super(F.copy().insufficientBalance(J));x(this,b({status:402,category:"billing",retryable:!1},K))}}class CJ extends Error{name="QlexRateLimitError";constructor(J){super(F.copy().rateLimit);x(this,b({status:429,category:"rate_limited",retryable:!0},J))}}class AJ extends Error{name="QlexInvalidCredentialsError";constructor(J,K){super(F.copy().invalidCredentials(J));x(this,b({status:401,category:"invalid_credentials",retryable:!1},K))}}class TJ extends Error{name="QlexRequestRejectedError";constructor(J,K,Z){super(F.copy().requestRejected(J,K));x(this,b({status:400,category:"request_rejected",retryable:!1},Z))}}class t extends Error{name="QlexRequestTooLargeError";stage;constructor(J="irreducible",K,Z){super(J==="after-reduction"?F.copy().requestTooLargeAfterReduction(K):F.copy().requestTooLargeIrreducible(K));this.stage=J,x(this,b({status:413,category:"request_too_large",retryable:!1},Z))}}class BJ extends Error{name="QlexRequestNotSentError";constructor(J,K){super(F.copy().requestNotSent(J));x(this,b({category:"request_rejected",retryable:!1},K))}}class u extends Error{name="QlexGatewayError";constructor(J,K){super(F.copy().gatewayUnavailable(J));x(this,b({category:"gateway_routing",retryable:!1},K))}}var oJ=60000,sJ=320000;function sK(J){return F.sanitizeUpstreamError(J)}class v extends Error{name="QlexStreamError";constructor(J,K,Z){let $=b({category:"unknown",retryable:!1},K);super($.category==="output_budget_exhausted"?F.copy().outputBudgetExhausted():$.category==="empty_output"?F.copy().emptyOutput():$.category==="stream_truncated"?F.copy().streamCutOff(Z):$.category==="stream_failed"?F.copy().streamFailedAfterRetries(Z):F.copy().streamFailed(J));x(this,$),LJ(this)}}var aJ=[{match:/\b(unauthori[sz]ed|forbidden|invalid[ _-]?(api[ _-]?key|token|credential)|expired[ _-]?token|authentication[ _-]?(failed|error)|401|403)\b/i,category:"invalid_credentials",retryable:!1},{match:/(output (?:token )?budget|maximum output tokens|max_tokens|finish[_ -]?reason.{0,20}(length|budget)|reasoning.{0,20}(budget|tokens))/i,category:"output_budget_exhausted",retryable:!1},{match:/\b(no visible output|empty output|produced no (?:visible )?(?:text|output)|nothing to display)\b/i,category:"empty_output",retryable:!1},{match:/\b(insufficient[ _-]?(credits?|qredits?|balance|funds)|payment[ _-]?required|quota[ _-]?exceeded|out[ _-]?of[ _-]?(credits?|qredits?)|402)\b/i,category:"billing",retryable:!1},{match:/\b(rate[ _-]?limit(ed|s)?|too[ _-]?many[ _-]?requests|429)\b/i,category:"rate_limited",retryable:!0},{match:/(unexpected end of (json|input|stream|data)|premature (close|end)|socket hang ?up|socket connection was closed unexpectedly|incomplete (response|output|json|message)|truncated|stream (ended|closed|terminated) (early|unexpectedly|prematurely)|\bECONNRESET\b|\bEPIPE\b)/i,category:"stream_truncated",retryable:!0},{match:/\b(overloaded|at capacity|service[ _-]?unavailable|temporarily[ _-]?unavailable|bad[ _-]?gateway|gateway[ _-]?time(d[ _-]?out|out)|timed[ _-]?out|502|503|504)\b/i,category:"transient",retryable:!0}],tJ={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},eJ=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,JK=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function GJ(J){let K=J??"",Z=eJ.exec(K),$=Z?K.slice(Z[0].length):K,z=IJ($),X=Z?.[1]?.toUpperCase()??z.upstreamCode,Y=z.requestId??a(JK.exec(K)?.[1]),H=z.retryable;if(X!==void 0){let V=tJ[X];if(V!==void 0)return{...V,upstreamCode:X,retryable:l(V.category,H??V.retryable),...Y?{requestId:Y}:{}}}for(let V of aJ)if(V.match.test($))return{category:V.category,retryable:l(V.category,H??V.retryable),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}};return{category:"unknown",retryable:l("unknown",H),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}}}function KK(J){return MJ(J)}function IJ(J){try{let K=JSON.parse(J);if(!K||typeof K!=="object"||Array.isArray(K))return{};let Z=K,$=Z.error&&typeof Z.error==="object"&&!Array.isArray(Z.error)?Z.error:void 0,z=Z.details&&typeof Z.details==="object"&&!Array.isArray(Z.details)?Z.details:void 0,X=[Z.requestId,$?.requestId,z?.requestId].map(a).find((V)=>V!==void 0),Y=Z.retryable===!1||$?.retryable===!1?!1:Z.retryable===!0||$?.retryable===!0?!0:void 0,H=$?.code??Z.code;return{...X!==void 0?{requestId:X}:{},...Y!==void 0?{retryable:Y}:{},...typeof H==="string"&&/^[A-Z][A-Z0-9_]{0,63}$/i.test(H)?{upstreamCode:H.toUpperCase()}:{}}}catch{return{}}}function xJ(J,K){let Z,$,z,X=!1;try{let N=JSON.parse(K);if(N&&typeof N==="object"){let L=N.error&&typeof N.error==="object"?N.error:void 0;if(typeof L?.code==="string")Z=L.code;else if(typeof N.code==="string")Z=N.code;if(typeof L?.message==="string")$=L.message;else if(typeof N.message==="string")$=N.message;if(typeof N.details?.field==="string")z=N.details.field}}catch(N){X=/^\s*[\[{]/.test(K)&&(ZK(K)||/unexpected end|end of json|unterminated string/i.test(String(N)))}let Y=Z?.toUpperCase()??"",{requestId:H,retryable:V}=IJ(K),U=(()=>{if(X)return"stream_truncated";if(J===402)return"billing";if(J===413)return"request_too_large";if(J===429)return"rate_limited";if(J===401||J===403)return Y==="ERR_GATEWAY_REQUIRED"||KK(K)?"gateway_routing":"invalid_credentials";if(Y.includes("CONFIG"))return"configuration";if(J>=500)return"transient";if(J>=400)return"request_rejected";return"unknown"})(),P=l(U,V),j={status:J,category:U,retryable:P};if(Z!==void 0)j.upstreamCode=Z;if($!==void 0)j.upstreamMessage=$;if(z!==void 0)j.field=z;if(H!==void 0)j.requestId=H;return j}function ZK(J){let K=0,Z=!1,$=!1;for(let z of J){if(Z){if($)$=!1;else if(z==="\\")$=!0;else if(z==='"')Z=!1;continue}if(z==='"')Z=!0;else if(z==="{"||z==="[")K++;else if(z==="}"||z==="]")K--;if(K<0)return!1}return Z||K>0}function $K(J){let K=F.tierBudgetFacts(J.tier),Z=J.advisory,$=Z?.tierOutputLimit??K?.output;if(J.requestedTotal!==void 0)return{total:$===void 0?J.requestedTotal:Math.min(J.requestedTotal,$)};if(!Z&&!K)return{};let z=Z?.reasoningReserveTokens??K?.reasoningReserve??0,X=Z?.visibleOutputFloorTokens??K?.visibleOutputFloor??0,Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??K?.recommendedTotal??K?.recommendedStep??$,H=Z?.viableTotalFloorTokens??K?.viableTotalFloor??z+X,V=Y===void 0?H:Math.max(Y,H),U=Z?.reasoningReported??K?.reasoning;return{total:$===void 0?V:Math.min(V,$),reasoningBudget:U&&z>0?Math.min(z,V):void 0}}var zK=new Set(["coding","agent","research","review","chat"]);function XK(J){if(J===void 0)return;if(typeof J==="string"&&zK.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function YK(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((Z)=>typeof Z==="string"&&/^[^/\s]+\/[^/\s]+$/.test(Z)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function s(J){if(typeof J==="string")return J;if(Array.isArray(J))return J.map((K)=>{if(typeof K==="string")return K;if(K&&typeof K==="object"){let Z=K;if(typeof Z.text==="string")return Z.text;if(typeof Z.content==="string")return Z.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}var HK="[Tool call]",VK="[Tool returned no output]";function bJ(J){if(!Array.isArray(J))return{messages:J,dropped:[]};let K=[];return{messages:J.flatMap(($,z)=>{if(!$||typeof $!=="object")return K.push({index:z,role:typeof $,reason:"not-an-object"}),[];let X=$,Y=s(X.content);if(Y.trim().length>0)return[{...X,content:Y}];if(X.role==="assistant"&&Array.isArray(X.tool_calls)&&X.tool_calls.length>0)return[{...X,content:HK}];if(X.role==="tool"&&typeof X.tool_call_id==="string"&&X.tool_call_id.trim().length>0)return[{...X,content:VK}];return K.push({index:z,role:typeof X.role==="string"?X.role:"unknown",reason:"empty-content"}),[]}),dropped:K}}function DK(J){return bJ(J).messages}function WK(J){if(!Array.isArray(J))return!1;return J.some((K)=>!!K&&typeof K==="object"&&K.role==="user")}function NK(J){if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;if(Z.role!=="user")return!1;return s(Z.content).trim().length>0})}function GK(J){if(!Array.isArray(J))return J;let K=(X)=>!!X&&typeof X==="object"&&X.role==="system",Z=0;while(Z<J.length&&K(J[Z]))Z++;if(Z<=1)return J;let $=J.slice(0,Z),z=$.map((X)=>typeof X.content==="string"?X.content:String(X.content??"")).filter((X)=>X.length>0).join(`
|
|
2
|
+
import{Zo as MJ,bp as $J,tp as kJ}from"./chunk-6qwnty59.js";import{Ip as qJ}from"./chunk-crqycrs4.js";import{et as F}from"./chunk-5re7995e.js";import{It as LJ}from"./chunk-6yshpz0z.js";import{Pt as e,Xt as SJ}from"./chunk-5dvy83ms.js";import{ju as OJ,mu as QJ}from"./chunk-ffx0cr44.js";var cJ=0.9,mJ=256,VJ="[Earlier tool result removed to fit the request size limit]",c;function h(J){return Buffer.byteLength(JSON.stringify(J),"utf8")}function NJ(){return e.QITQODE_QLEX_MAX_REQUEST_BYTES??c}function JJ(J){let K=e.QITQODE_QLEX_MAX_REQUEST_BYTES;if(K!==void 0)return K;let Z=Math.max(1,Math.min(Math.floor(J*cJ),Math.floor(J)-1));return c=c===void 0?Z:Math.min(c,Z),c}function m(J,K){return!!J&&typeof J==="object"&&J.role===K}function DJ(J){let K=[],Z=0;while(Z<J.length){let $=Z,z=J[Z];if(Z++,m(z,"assistant")&&Array.isArray(z?.tool_calls)&&z.tool_calls.length>0)while(Z<J.length&&m(J[Z],"tool"))Z++;K.push({start:$,end:Z})}return K}function WJ(J,K){if(K.length===0)return[];let Z=-1;for(let $=K.length-1;$>=0;$--){let z=K[$],X=!1;for(let Y=z.start;Y<z.end;Y++)if(m(J[Y],"user"))X=!0;if(X){Z=$;break}}return K.filter(($,z)=>{if(z===K.length-1)return!1;if(z===Z)return!1;if($.start===0&&m(J[0],"system"))return!1;return!0})}function KJ(J,K){let Z=h(J),$={toolResultsElided:0,unitsDropped:0},z=()=>({body:J,bytes:Z,originalBytes:Z,reduced:!1,actions:$});if(!J||typeof J!=="object")return z();let X=J.messages;if(!Array.isArray(X))return z();let Y=X.map((j)=>j&&typeof j==="object"?{...j}:j),H=()=>({...J,messages:Y}),V=()=>h(H())<=K;{let j=Y;for(let N of WJ(j,DJ(j))){let L=!1;for(let O=N.start;O<N.end;O++){let k=j[O];if(!m(k,"tool"))continue;let w=k?.content;if(typeof w!=="string"||w.length<mJ)continue;if(w===VJ)continue;j[O]={...k,content:VJ},$.toolResultsElided++,L=!0}if(L&&V())break}}if(!V())for(;;){let j=Y,L=WJ(j,DJ(j))[0];if(!L)break;if(Y=[...j.slice(0,L.start),...j.slice(L.end)],$.unitsDropped++,V())break}let U=H(),P=h(U);return{body:U,bytes:P,originalBytes:Z,reduced:P<Z&&P<=K,actions:$}}import y from"fs/promises";import EJ from"path";import{randomUUID as dJ}from"crypto";var E=SJ({service:"provider.qlex"}),iJ=F.streamUrl(),lJ=F.omniqueryBaseUrl()+"/runOrchestrated",rJ=new Set(["rate_limited","transient","stream_truncated","stream_failed"]);function d(J,K){return K!==!1&&rJ.has(J)}function a(J){return typeof J==="string"&&/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/.test(J)?J:void 0}function x(J,K){let Z=J;if(K.status!==void 0)Z.status=K.status;if(K.upstreamCode!==void 0)Z.upstreamCode=K.upstreamCode;let $=a(K.requestId);if($!==void 0)Z.requestId=$;if(Z.category=K.category,Z.retryable=d(K.category,K.retryable),K.outputBudgetRecoveryAvailable!==void 0)Z.outputBudgetRecoveryAvailable=K.outputBudgetRecoveryAvailable;if(K.outputBudgetRecoveryTokens!==void 0)Z.outputBudgetRecoveryTokens=K.outputBudgetRecoveryTokens}function b(J,K){return{...J,...K}}class wJ extends Error{name="QlexNotLoggedInError";constructor(J){super(F.copy().notLoggedIn);x(this,b({category:"invalid_credentials",retryable:!1},J))}}class RJ extends Error{name="QlexInsufficientBalanceError";constructor(J,K){super(F.copy().insufficientBalance(J));x(this,b({status:402,category:"billing",retryable:!1},K))}}class CJ extends Error{name="QlexRateLimitError";constructor(J){super(F.copy().rateLimit);x(this,b({status:429,category:"rate_limited",retryable:!0},J))}}class AJ extends Error{name="QlexInvalidCredentialsError";constructor(J,K){super(F.copy().invalidCredentials(J));x(this,b({status:401,category:"invalid_credentials",retryable:!1},K))}}class TJ extends Error{name="QlexRequestRejectedError";constructor(J,K,Z){super(F.copy().requestRejected(J,K));x(this,b({status:400,category:"request_rejected",retryable:!1},Z))}}class t extends Error{name="QlexRequestTooLargeError";stage;constructor(J="irreducible",K,Z){super(J==="after-reduction"?F.copy().requestTooLargeAfterReduction(K):F.copy().requestTooLargeIrreducible(K));this.stage=J,x(this,b({status:413,category:"request_too_large",retryable:!1},Z))}}class BJ extends Error{name="QlexRequestNotSentError";constructor(J,K){super(F.copy().requestNotSent(J));x(this,b({category:"request_rejected",retryable:!1},K))}}class u extends Error{name="QlexGatewayError";constructor(J,K){super(F.copy().gatewayUnavailable(J));x(this,b({category:"gateway_routing",retryable:!1},K))}}var oJ=60000,sJ=320000;function aK(J){return F.sanitizeUpstreamError(J)}class v extends Error{name="QlexStreamError";constructor(J,K,Z){let $=b({category:"unknown",retryable:!1},K);super($.category==="output_budget_exhausted"?F.copy().outputBudgetExhausted():$.category==="empty_output"?F.copy().emptyOutput():$.category==="stream_truncated"?F.copy().streamCutOff(Z):$.category==="stream_failed"?F.copy().streamFailedAfterRetries(Z):F.copy().streamFailed(J));x(this,$),LJ(this)}}var aJ=[{match:/\b(unauthori[sz]ed|forbidden|invalid[ _-]?(api[ _-]?key|token|credential)|expired[ _-]?token|authentication[ _-]?(failed|error)|401|403)\b/i,category:"invalid_credentials",retryable:!1},{match:/(output (?:token )?budget|maximum output tokens|max_tokens|finish[_ -]?reason.{0,20}(length|budget)|reasoning.{0,20}(budget|tokens))/i,category:"output_budget_exhausted",retryable:!1},{match:/\b(no visible output|empty output|produced no (?:visible )?(?:text|output)|nothing to display)\b/i,category:"empty_output",retryable:!1},{match:/\b(insufficient[ _-]?(credits?|qredits?|balance|funds)|payment[ _-]?required|quota[ _-]?exceeded|out[ _-]?of[ _-]?(credits?|qredits?)|402)\b/i,category:"billing",retryable:!1},{match:/\b(rate[ _-]?limit(ed|s)?|too[ _-]?many[ _-]?requests|429)\b/i,category:"rate_limited",retryable:!0},{match:/(unexpected end of (json|input|stream|data)|premature (close|end)|socket hang ?up|socket connection was closed unexpectedly|incomplete (response|output|json|message)|truncated|stream (ended|closed|terminated) (early|unexpectedly|prematurely)|\bECONNRESET\b|\bEPIPE\b)/i,category:"stream_truncated",retryable:!0},{match:/\b(overloaded|at capacity|service[ _-]?unavailable|temporarily[ _-]?unavailable|bad[ _-]?gateway|gateway[ _-]?time(d[ _-]?out|out)|timed[ _-]?out|502|503|504)\b/i,category:"transient",retryable:!0}],tJ={ERR_EMPTY_RESULT:{category:"empty_output",retryable:!1},ERR_TRUNCATED_OUTPUT:{category:"stream_truncated",retryable:!0},ERR_STREAM:{category:"stream_failed",retryable:!0}},eJ=/^\s*(ERR_[A-Z0-9_]+)\b(?:\s*(?:[\u2014\u2013:-]\s*)?)?/i,JK=/\b(req_[A-Za-z0-9][A-Za-z0-9_-]*)\b/;function GJ(J){let K=J??"",Z=eJ.exec(K),$=Z?K.slice(Z[0].length):K,z=IJ($),X=Z?.[1]?.toUpperCase()??z.upstreamCode,Y=z.requestId??a(JK.exec(K)?.[1]),H=z.retryable;if(X!==void 0){let V=tJ[X];if(V!==void 0)return{...V,upstreamCode:X,retryable:d(V.category,H??V.retryable),...Y?{requestId:Y}:{}}}for(let V of aJ)if(V.match.test($))return{category:V.category,retryable:d(V.category,H??V.retryable),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}};return{category:"unknown",retryable:d("unknown",H),...X?{upstreamCode:X}:{},...Y?{requestId:Y}:{}}}function KK(J){return MJ(J)}function IJ(J){try{let K=JSON.parse(J);if(!K||typeof K!=="object"||Array.isArray(K))return{};let Z=K,$=Z.error&&typeof Z.error==="object"&&!Array.isArray(Z.error)?Z.error:void 0,z=Z.details&&typeof Z.details==="object"&&!Array.isArray(Z.details)?Z.details:void 0,X=[Z.requestId,$?.requestId,z?.requestId].map(a).find((V)=>V!==void 0),Y=Z.retryable===!1||$?.retryable===!1?!1:Z.retryable===!0||$?.retryable===!0?!0:void 0,H=$?.code??Z.code;return{...X!==void 0?{requestId:X}:{},...Y!==void 0?{retryable:Y}:{},...typeof H==="string"&&/^[A-Z][A-Z0-9_]{0,63}$/i.test(H)?{upstreamCode:H.toUpperCase()}:{}}}catch{return{}}}function xJ(J,K){let Z,$,z,X=!1;try{let N=JSON.parse(K);if(N&&typeof N==="object"){let L=N.error&&typeof N.error==="object"?N.error:void 0;if(typeof L?.code==="string")Z=L.code;else if(typeof N.code==="string")Z=N.code;if(typeof L?.message==="string")$=L.message;else if(typeof N.message==="string")$=N.message;if(typeof N.details?.field==="string")z=N.details.field}}catch(N){X=/^\s*[\[{]/.test(K)&&(ZK(K)||/unexpected end|end of json|unterminated string/i.test(String(N)))}let Y=Z?.toUpperCase()??"",{requestId:H,retryable:V}=IJ(K),U=(()=>{if(X)return"stream_truncated";if(J===402)return"billing";if(J===413)return"request_too_large";if(J===429)return"rate_limited";if(J===401||J===403)return Y==="ERR_GATEWAY_REQUIRED"||KK(K)?"gateway_routing":"invalid_credentials";if(Y.includes("CONFIG"))return"configuration";if(J>=500)return"transient";if(J>=400)return"request_rejected";return"unknown"})(),P=d(U,V),j={status:J,category:U,retryable:P};if(Z!==void 0)j.upstreamCode=Z;if($!==void 0)j.upstreamMessage=$;if(z!==void 0)j.field=z;if(H!==void 0)j.requestId=H;return j}function ZK(J){let K=0,Z=!1,$=!1;for(let z of J){if(Z){if($)$=!1;else if(z==="\\")$=!0;else if(z==='"')Z=!1;continue}if(z==='"')Z=!0;else if(z==="{"||z==="[")K++;else if(z==="}"||z==="]")K--;if(K<0)return!1}return Z||K>0}function $K(J){let K=F.tierBudgetFacts(J.tier),Z=J.advisory,$=Z?.tierOutputLimit??K?.output;if(J.requestedTotal!==void 0)return{total:$===void 0?J.requestedTotal:Math.min(J.requestedTotal,$)};if(!Z&&!K)return{};let z=Z?.reasoningReserveTokens??K?.reasoningReserve??0,X=Z?.visibleOutputFloorTokens??K?.visibleOutputFloor??0,Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??K?.recommendedTotal??K?.recommendedStep??$,H=Z?.viableTotalFloorTokens??K?.viableTotalFloor??z+X,V=Y===void 0?H:Math.max(Y,H),U=Z?.reasoningReported??K?.reasoning;return{total:$===void 0?V:Math.min(V,$),reasoningBudget:U&&z>0?Math.min(z,V):void 0}}var zK=new Set(["coding","agent","research","review","chat"]);function XK(J){if(J===void 0)return;if(typeof J==="string"&&zK.has(J))return J;throw Error(`invalid Qortex posture: ${String(J)}`)}function YK(J){if(J===void 0)return;let K=Array.isArray(J)?J:[J];if(K.every((Z)=>typeof Z==="string"&&/^[^/\s]+\/[^/\s]+$/.test(Z)))return Array.isArray(J)?K:J;throw Error(`invalid Qortex directive registry key: ${String(J)}`)}function s(J){if(typeof J==="string")return J;if(Array.isArray(J))return J.map((K)=>{if(typeof K==="string")return K;if(K&&typeof K==="object"){let Z=K;if(typeof Z.text==="string")return Z.text;if(typeof Z.content==="string")return Z.content}return""}).join("");if(J===void 0||J===null)return"";return String(J)}var HK="[Tool call]",VK="[Tool returned no output]";function bJ(J){if(!Array.isArray(J))return{messages:J,dropped:[]};let K=[];return{messages:J.flatMap(($,z)=>{if(!$||typeof $!=="object")return K.push({index:z,role:typeof $,reason:"not-an-object"}),[];let X=$,Y=s(X.content);if(Y.trim().length>0)return[{...X,content:Y}];if(X.role==="assistant"&&Array.isArray(X.tool_calls)&&X.tool_calls.length>0)return[{...X,content:HK}];if(X.role==="tool"&&typeof X.tool_call_id==="string"&&X.tool_call_id.trim().length>0)return[{...X,content:VK}];return K.push({index:z,role:typeof X.role==="string"?X.role:"unknown",reason:"empty-content"}),[]}),dropped:K}}function DK(J){return bJ(J).messages}function WK(J){if(!Array.isArray(J))return!1;return J.some((K)=>!!K&&typeof K==="object"&&K.role==="user")}function NK(J){if(!Array.isArray(J))return!1;return J.some((K)=>{if(!K||typeof K!=="object")return!1;let Z=K;if(Z.role!=="user")return!1;return s(Z.content).trim().length>0})}function GK(J){if(!Array.isArray(J))return J;let K=(X)=>!!X&&typeof X==="object"&&X.role==="system",Z=0;while(Z<J.length&&K(J[Z]))Z++;if(Z<=1)return J;let $=J.slice(0,Z),z=$.map((X)=>typeof X.content==="string"?X.content:String(X.content??"")).filter((X)=>X.length>0).join(`
|
|
3
3
|
|
|
4
4
|
`);return[{...$[0],role:"system",content:z},...J.slice(Z)]}var n="<tool_call>",r="</tool_call>";function jK(J){if(!Array.isArray(J)||J.length===0)return;let K=J.map((Z)=>{try{return JSON.stringify(Z)}catch{return}}).filter((Z)=>Z!==void 0);if(K.length===0)return;return["# Tools","","You may call one or more functions to assist with the user query.","","You are provided with function signatures within <tools></tools> XML tags:","<tools>",...K,"</tools>","","For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:","<tool_call>",'{"name": <function-name>, "arguments": <args-json-object>}',"</tool_call>","","Function results will be provided within <tool_response></tool_response> XML tags. Do not write <tool_response> blocks yourself.","Only use the functions declared above. Never invent function names, and never write out a function-call-like block in any other format."].join(`
|
|
5
5
|
`)}var UK=3;function XJ(J){let K=J;for(let Z=0;Z<UK;Z++){if(K!==null&&typeof K==="object")return K;if(typeof K!=="string")return;try{K=JSON.parse(K)}catch{return}}return}function PK(J){let K=J?.tool_calls;if(!Array.isArray(K))return;for(let Z of K){let $=Z?.function;if(!$)continue;E.debug("tool call ingress",{tool:typeof $.name==="string"?$.name:"?",source:"native",args:YJ($.arguments)})}}function YJ(J,K=300){let Z;try{Z=typeof J==="string"?J:JSON.stringify(J)??String(J)}catch{Z="<unrenderable>"}return Z.length<=K?Z:`${Z.slice(0,K)}\u2026 (${Z.length} chars total)`}function _K(J){let K=J.function??{},Z=typeof K.name==="string"?K.name:"",$=K.arguments===void 0?{}:XJ(K.arguments);if($===void 0)E.warn("dropping unrecoverable tool-call arguments while re-encoding history",{tool:Z,raw:YJ(K.arguments)});return`${n}
|
|
@@ -8,22 +8,24 @@ ${r}`}function hJ(J,K){if(!Array.isArray(J))return J;let Z=J.map((z)=>{if(!z||ty
|
|
|
8
8
|
`),H=s(X.content),{tool_calls:V,...U}=X;return{...U,content:H.length>0?`${H}
|
|
9
9
|
${Y}`:Y}}if(X.role==="tool"){let{tool_call_id:Y,name:H,...V}=X;return{...V,role:"user",content:`<tool_response>
|
|
10
10
|
${s(X.content)}
|
|
11
|
-
</tool_response>`}}return z}),$=jK(K);if($){let z=0;while(z<Z.length&&!!Z[z]&&typeof Z[z]==="object"&&Z[z].role==="system")z++;Z.splice(z,0,{role:"system",content:$})}return Z}function FK(){return process.env.QITQODE_TOOL_PROTOCOL==="text"?"text":"native"}function OK(J){if(Array.isArray(J.tools)&&J.tools.length>0)return!0;let K=J.messages;if(!Array.isArray(K))return!1;return K.some((Z)=>{if(!Z||typeof Z!=="object")return!1;let $=Z;return $.role==="tool"||$.role==="assistant"&&Array.isArray($.tool_calls)})}function jJ(J,K){let Z=K?.toolMode??"native",$=J.model??"adaptive",z={stream:J.stream??!0};if(J.temperature!==void 0)z.temperature=J.temperature;if(J.max_tokens!==void 0)z.max_tokens=J.max_tokens;let X=$K({tier:$,advisory:K?.outputAdvisory,requestedTotal:z.max_tokens});if(X.total!==void 0)z.max_tokens=X.total;if(X.reasoningBudget!==void 0)z.thinking={budget_tokens:X.reasoningBudget};if(K?.outputBudgetRecoveryTokens!==void 0){let P=typeof z.max_tokens==="number"?z.max_tokens:0,j=K.outputAdvisory?.tierOutputLimit??F.tierBudgetFacts($)?.output,N=Math.min(K.outputBudgetRecoveryTokens,j??K.outputBudgetRecoveryTokens);if(N>P)z.max_tokens=N}if(J.tools!==void 0)z.tools=J.tools;if(J.tool_choice!==void 0)z.tool_choice=J.tool_choice;if(J.stream_options!==void 0)z.stream_options=J.stream_options;let Y=Z==="text"?hJ(J.messages,J.tools):J.messages,H={},V=XK(J.posture);if(V!==void 0)H.posture=V;let U=YK(J.directive);if(U!==void 0)H.directive=U;if(J.modelPersona!==void 0)H.modelPersona=J.modelPersona;return{tier:$,messages:GK(DK(Y)),opts:z,...H}}var
|
|
11
|
+
</tool_response>`}}return z}),$=jK(K);if($){let z=0;while(z<Z.length&&!!Z[z]&&typeof Z[z]==="object"&&Z[z].role==="system")z++;Z.splice(z,0,{role:"system",content:$})}return Z}function FK(){return process.env.QITQODE_TOOL_PROTOCOL==="text"?"text":"native"}function OK(J){if(Array.isArray(J.tools)&&J.tools.length>0)return!0;let K=J.messages;if(!Array.isArray(K))return!1;return K.some((Z)=>{if(!Z||typeof Z!=="object")return!1;let $=Z;return $.role==="tool"||$.role==="assistant"&&Array.isArray($.tool_calls)})}function jJ(J,K){let Z=K?.toolMode??"native",$=J.model??"adaptive",z={stream:J.stream??!0};if(J.temperature!==void 0)z.temperature=J.temperature;if(J.max_tokens!==void 0)z.max_tokens=J.max_tokens;let X=$K({tier:$,advisory:K?.outputAdvisory,requestedTotal:z.max_tokens});if(X.total!==void 0)z.max_tokens=X.total;if(X.reasoningBudget!==void 0)z.thinking={budget_tokens:X.reasoningBudget};if(K?.outputBudgetRecoveryTokens!==void 0){let P=typeof z.max_tokens==="number"?z.max_tokens:0,j=K.outputAdvisory?.tierOutputLimit??F.tierBudgetFacts($)?.output,N=Math.min(K.outputBudgetRecoveryTokens,j??K.outputBudgetRecoveryTokens);if(N>P)z.max_tokens=N}if(J.tools!==void 0)z.tools=J.tools;if(J.tool_choice!==void 0)z.tool_choice=J.tool_choice;if(J.stream_options!==void 0)z.stream_options=J.stream_options;let Y=Z==="text"?hJ(J.messages,J.tools):J.messages,H={},V=XK(J.posture);if(V!==void 0)H.posture=V;let U=YK(J.directive);if(U!==void 0)H.directive=U;if(J.modelPersona!==void 0)H.modelPersona=J.modelPersona;return{tier:$,messages:GK(DK(Y)),opts:z,...H}}var i=new Map,p=EJ.join(QJ.Path.data,"qlex-tier-advisories.json"),QK="qlex-tier-advisories",SK=2592000000,UJ=!1,LK;function fJ(J,K){if(!J||typeof J!=="object")return;let Z=J;if(typeof Z.capturedAt!=="number"||K-Z.capturedAt>SK)return;if(!Z.advisory)return;return{advisory:Z.advisory,capturedAt:Z.capturedAt}}async function MK(){if(UJ)return;try{let J=JSON.parse(await y.readFile(p,"utf8")),K=Date.now();for(let[Z,$]of Object.entries(J)){let z=fJ($,K);if(z)vJ(Z,z.advisory,z.capturedAt)}}catch{}UJ=!0}function kK(){return LK??=MK()}function vJ(J,K,Z=Date.now()){i.set(J,{advisory:K,capturedAt:Z})}async function qK(J){await OJ.withLock(QK,async()=>{let K={};try{let $=JSON.parse(await y.readFile(p,"utf8")),z=Date.now();for(let[X,Y]of Object.entries($)){let H=fJ(Y,z);if(H)K[X]=H}}catch{}for(let[$,z]of J){let X=K[$];if(!X||X.capturedAt<=z.capturedAt)K[$]=z}await y.mkdir(EJ.dirname(p),{recursive:!0});let Z=`${p}.${process.pid}.${dJ()}.tmp`;try{await y.writeFile(Z,JSON.stringify(K)),await y.rename(Z,p)}catch($){throw await y.rm(Z,{force:!0}).catch(()=>{}),$}})}function EK(){if(l)return;l=!0,zJ=zJ.then(()=>{return l=!1,qK([...i].map(([J,K])=>[J,K]))}).catch((J)=>{l=!1,E.warn("failed to persist tier output advisories",{file:p,error:J instanceof Error?J.message:String(J)})})}function f(J){return typeof J==="number"&&Number.isFinite(J)&&J>0?J:void 0}function wK(J,K){let Z={},$=f(K.tierOutputLimit),z=f(K.tierRecommendedStepTokens),X=f(K.reasoningReserveTokens),Y=f(K.visibleOutputFloorTokens),H=f(K.recommendedTotalTokens),V=f(K.viableTotalFloorTokens),U=f(K.budgetPolicyVersion);if($!==void 0)Z.tierOutputLimit=$;if(z!==void 0)Z.tierRecommendedStepTokens=z;if(X!==void 0)Z.reasoningReserveTokens=X;if(Y!==void 0)Z.visibleOutputFloorTokens=Y;if(H!==void 0)Z.recommendedTotalTokens=H;if(V!==void 0)Z.viableTotalFloorTokens=V;if(typeof K.reasoningReported==="boolean")Z.reasoningReported=K.reasoningReported;if(U!==void 0)Z.budgetPolicyVersion=U;if(Object.keys(Z).length===0)return;vJ(J,Z),EK()}function RK(J){return i.get(J)?.advisory}function tK(){i.clear()}function eK(){return zJ}function CK(J){let K=(Z)=>typeof Z==="string"&&(Z.startsWith("qlex")||Z.startsWith("qortex"));return K(J.id)||K(J.object)}function AK(J){return J.id==="qortex-routing"&&J.object==="qortex.routing.status"&&J.status==="free-fallback"}function JZ(J){if(!J||typeof J!=="object")return!1;let K=J,Z=K.qortex_routing;return K.id==="qlex-stream"&&K.object==="chat.completion.chunk"&&Array.isArray(K.choices)&&!!Z&&typeof Z==="object"&&Z.status==="free-fallback"}function TK(J){let K=[],Z=J.indexOf(`
|
|
12
12
|
`)===-1?[J]:J.split(`
|
|
13
13
|
`);for(let Y of Z){let H=Y.endsWith("\r")?Y.slice(0,-1):Y;if(!H.startsWith("data:"))continue;let V=H.slice(5);if(V.startsWith(" "))V=V.slice(1);K.push(V)}if(K.length===0)return{kind:"skip"};let $=K.length===1?K[0]:K.join(`
|
|
14
|
-
`);if($==="")return{kind:"skip"};if($==="[DONE]")return{kind:"done"};if($.startsWith("[ERROR]"))return{kind:"error",message:$.slice(7).trim()||"qlex stream error"};let z=$.charCodeAt(0),X=z===123||z===91||z===32||z===9||z===10||z===13;try{if(!X)return{kind:"token",content:$};let Y=JSON.parse($);if(Y&&typeof Y==="object"){let H=Y.id;if(H==="qlex-cost"||H==="qortex-cost")return{kind:"cost",cost:Y};if(H==="qlex-stream"&&Y.usage&&typeof Y.usage==="object"){let P=Y.choices,j;if(Array.isArray(P)&&P[0]&&typeof P[0]==="object"){let N=P[0].finish_reason;if(typeof N==="string")j=N}return{kind:"usage",usage:Y.usage,finishReason:j}}if(Array.isArray(Y.choices))return{kind:"passthrough",chunk:Y};let V=Y,U=typeof V.content==="string"?V.content:typeof V.text==="string"?V.text:typeof V.delta==="string"?V.delta:void 0;if(U!==void 0)return{kind:"token",content:U};if(CK(Y)){let P=Y.object;return{kind:"control",control:typeof P==="string"&&P.endsWith(".tier.outputLimits")?"tier-output-limits":"unknown",chunk:Y}}}}catch{}return{kind:"token",content:$}}function
|
|
14
|
+
`);if($==="")return{kind:"skip"};if($==="[DONE]")return{kind:"done"};if($.startsWith("[ERROR]"))return{kind:"error",message:$.slice(7).trim()||"qlex stream error"};let z=$.charCodeAt(0),X=z===123||z===91||z===32||z===9||z===10||z===13;try{if(!X)return{kind:"token",content:$};let Y=JSON.parse($);if(Y&&typeof Y==="object"){let H=Y.id;if(H==="qlex-cost"||H==="qortex-cost")return{kind:"cost",cost:Y};if(H==="qlex-stream"&&Y.usage&&typeof Y.usage==="object"){let P=Y.choices,j;if(Array.isArray(P)&&P[0]&&typeof P[0]==="object"){let N=P[0].finish_reason;if(typeof N==="string")j=N}return{kind:"usage",usage:Y.usage,finishReason:j}}if(AK(Y))return{kind:"control",control:"free-tier-fallback",chunk:Y};if(Array.isArray(Y.choices))return{kind:"passthrough",chunk:Y};let V=Y,U=typeof V.content==="string"?V.content:typeof V.text==="string"?V.text:typeof V.delta==="string"?V.delta:void 0;if(U!==void 0)return{kind:"token",content:U};if(CK(Y)){let P=Y.object;return{kind:"control",control:typeof P==="string"&&P.endsWith(".tier.outputLimits")?"tier-output-limits":"unknown",chunk:Y}}}}catch{}return{kind:"token",content:$}}function BK(J,K){let Z=Math.min(J.length,K.length-1);for(let $=Z;$>=1;$--)if(K.startsWith(J.slice(J.length-$)))return $;return 0}function IK(J){if(typeof J==="string"){try{let Z=JSON.parse(J);if(Z!==null&&typeof Z==="object")return J}catch{}let K=XJ(J);return JSON.stringify(K??J)}return JSON.stringify(J??{})}class gJ{onText;onToolCall;pending="";inBlock=!1;constructor(J,K){this.onText=J;this.onToolCall=K}feed(J){this.pending+=J,this.drain(!1)}flush(){if(this.drain(!0),this.inBlock)this.emitBlock(this.pending,!0),this.inBlock=!1;else if(this.pending.length>0)this.onText(this.pending);this.pending=""}drain(J){while(!0)if(!this.inBlock){let K=this.pending.indexOf(n);if(K===-1){let Z=J?0:BK(this.pending,n),$=this.pending.length-Z;if($>0)this.onText(this.pending.slice(0,$)),this.pending=Z>0?this.pending.slice($):"";return}if(K>0)this.onText(this.pending.slice(0,K));this.pending=this.pending.slice(K+n.length),this.inBlock=!0}else{let K=this.pending.indexOf(r);if(K===-1)return;if(this.emitBlock(this.pending.slice(0,K),!1),this.pending=this.pending.slice(K+r.length),this.pending.startsWith(`\r
|
|
15
15
|
`))this.pending=this.pending.slice(2);else if(this.pending.startsWith(`
|
|
16
|
-
`))this.pending=this.pending.slice(1);this.inBlock=!1}}emitBlock(J,K){try{let Z=JSON.parse(J.trim());if(Z&&typeof Z==="object"&&typeof Z.name==="string"){this.onToolCall({name:Z.name,arguments:
|
|
16
|
+
`))this.pending=this.pending.slice(1);this.inBlock=!1}}emitBlock(J,K){try{let Z=JSON.parse(J.trim());if(Z&&typeof Z==="object"&&typeof Z.name==="string"){this.onToolCall({name:Z.name,arguments:IK(Z.arguments)});return}}catch{}this.onText(`${n}${J}${K?"":r}`)}}function ZJ(J,K,Z){let $={id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[{index:0,delta:J,finish_reason:K}]};if(Z)$.usage=Z;return`data: ${JSON.stringify($)}
|
|
17
17
|
|
|
18
|
-
`}function
|
|
18
|
+
`}function xK(J,K){let Z=K?.toolProtocolEnabled===!0,$=K?.tier,z=K?.requestedOutputBudget,X=K?.idleTimeoutMs??sJ,Y=J.getReader(),H=new TextDecoder,V=new TextEncoder,U="",P=!1,j=!1,N,L,O,k,w=!1,I=!1,g=0,T=0;return new ReadableStream({async start(q){let B=(G)=>{if(G.length>0)w=!0;T+=G.length;let D=P?{content:G}:{role:"assistant",content:G};P=!0,q.enqueue(V.encode(ZJ(D,null)))},S=0,A=Z?new gJ(B,(G)=>{E.debug("tool call ingress",{tool:G.name,source:"text-shim",args:YJ(G.arguments),objectShaped:XJ(G.arguments)!==void 0});let D={...P?{}:{role:"assistant"},tool_calls:[{index:S,id:`qlexcall_${Date.now().toString(36)}_${S}`,type:"function",function:{name:G.name,arguments:G.arguments}}]};P=!0,I=!0,S++,q.enqueue(V.encode(ZJ(D,null)))}):void 0,HJ=(G)=>A?A.feed(G):B(G),Q=()=>{A?.flush();let D=N||L!==void 0||O!==void 0?{prompt_tokens:N?.tokens.prompt??O?.prompt??0,completion_tokens:N?.tokens.completion??O?.completion??0,total_tokens:N?.tokens.total??(N?.tokens.prompt??O?.prompt??0)+(N?.tokens.completion??O?.completion??0),cost_usd:N?.cost_usd,cost_credits:N?.cost_credits??N?.cost_qredits,context_window:L}:void 0;if(D&&(D.cost_usd??0)>0&&D.prompt_tokens===0)E.warn("qlex billed turn reported zero prompt tokens",{tier:$,completionTokens:D.completion_tokens,costUsd:D.cost_usd,source:N?"cost.summary":"usage frame"});let W=S>0?"tool_calls":k??"stop";if(W==="length"||W==="max_tokens"){let _=o($??"adaptive",z),C=_!==void 0;E.debug("qlex output budget exhausted",{tier:$,contentStreamed:w,outputBudgetRecoveryAvailable:C}),q.error(new v("output budget exhausted",{category:"output_budget_exhausted",retryable:!1,outputBudgetRecoveryAvailable:C,outputBudgetRecoveryTokens:_})),j=!0;return}if(!w&&!I&&k!=="tool_calls"){let _=o($??"adaptive",z),C=_!==void 0;E.debug("qlex completed without visible output",{tier:$,outputBudgetRecoveryAvailable:C}),q.error(new v("empty output",{category:"empty_output",retryable:!1,outputBudgetRecoveryAvailable:C,outputBudgetRecoveryTokens:_})),j=!0;return}if(q.enqueue(V.encode(ZJ({},W,D))),q.enqueue(V.encode(`data: [DONE]
|
|
19
19
|
|
|
20
|
-
`)),!N&&$!==void 0)E.info("qlex cost frame absent on stream finish",{tier:$});q.close(),j=!0},M=(G)=>{let D=
|
|
20
|
+
`)),!N&&$!==void 0)E.info("qlex cost frame absent on stream finish",{tier:$});q.close(),j=!0},M=(G)=>{let D=TK(G);switch(g++,D.kind){case"skip":return!1;case"token":return HJ(D.content),!1;case"passthrough":{let W=D.chunk.choices;if(Array.isArray(W)&&W[0]&&typeof W[0]==="object"){let _=W[0].finish_reason;if(typeof _==="string")k=_;let C=W[0].delta;if(typeof C?.content==="string"&&C.content.length>0)w=!0;if(Array.isArray(C?.tool_calls))I=!0;PK(W[0].delta)}P=!0;{let _=D.chunk.choices?.[0]?.delta?.content;if(typeof _==="string")T+=_.length}return q.enqueue(V.encode(`data: ${JSON.stringify(D.chunk)}
|
|
21
21
|
|
|
22
|
-
`)),!1}case"cost":if(D.cost.final)N=D.cost;return!1;case"usage":if(D.usage.context_window!==void 0)L=D.usage.context_window;if(D.usage.prompt_tokens!==void 0&&D.usage.completion_tokens!==void 0)O={prompt:D.usage.prompt_tokens,completion:D.usage.completion_tokens};if(D.finishReason!==void 0)k=D.finishReason;return!1;case"control":{if(D.control==="tier-output-limits"){let W=D.chunk;if($!==void 0)wK($,W);E.debug("qlex tier output limits",{tierOutputLimit:W.tierOutputLimit,tierRecommendedStepTokens:W.tierRecommendedStepTokens,tierStepGuidance:W.tierStepGuidance,reasoningReserveTokens:W.reasoningReserveTokens,visibleOutputFloorTokens:W.visibleOutputFloorTokens,recommendedTotalTokens:W.recommendedTotalTokens,viableTotalFloorTokens:W.viableTotalFloorTokens,reasoningReported:W.reasoningReported,budgetPolicyVersion:W.budgetPolicyVersion})}else
|
|
22
|
+
`)),!1}case"cost":if(D.cost.final)N=D.cost;return!1;case"usage":if(D.usage.context_window!==void 0)L=D.usage.context_window;if(D.usage.prompt_tokens!==void 0&&D.usage.completion_tokens!==void 0)O={prompt:D.usage.prompt_tokens,completion:D.usage.completion_tokens};if(D.finishReason!==void 0)k=D.finishReason;return!1;case"control":{if(D.control==="tier-output-limits"){let W=D.chunk;if($!==void 0)wK($,W);E.debug("qlex tier output limits",{tierOutputLimit:W.tierOutputLimit,tierRecommendedStepTokens:W.tierRecommendedStepTokens,tierStepGuidance:W.tierStepGuidance,reasoningReserveTokens:W.reasoningReserveTokens,visibleOutputFloorTokens:W.visibleOutputFloorTokens,recommendedTotalTokens:W.recommendedTotalTokens,viableTotalFloorTokens:W.viableTotalFloorTokens,reasoningReported:W.reasoningReported,budgetPolicyVersion:W.budgetPolicyVersion})}else if(D.control==="free-tier-fallback")q.enqueue(V.encode(`data: ${JSON.stringify({id:"qlex-stream",object:"chat.completion.chunk",created:Math.floor(Date.now()/1000),model:"qlex",choices:[],qortex_routing:{status:"free-fallback"}})}
|
|
23
23
|
|
|
24
|
-
`))
|
|
24
|
+
`));else E.debug("qlex control frame dropped",{id:D.chunk.id,object:D.chunk.object});return!1}case"done":return Q(),!0;case"error":{let W=GJ(D.message);E.warn("qlex stream error frame",{tier:$,raw:D.message,frameIndex:g,streamedContentChars:T,contentStreamed:P,upstreamCode:W.upstreamCode,requestId:W.requestId,category:W.category,retryable:W.retryable});let _=W.category==="output_budget_exhausted"||W.category==="empty_output"?o($??"adaptive",z):void 0;if(W.retryable===!1&&_!==void 0)W.outputBudgetRecoveryAvailable=!0,W.outputBudgetRecoveryTokens=_;return q.error(new v(D.message,W,{textKept:w})),j=!0,!0}}},R=async()=>{if(!(X>0))return Y.read();let G;try{return await Promise.race([Y.read(),new Promise((D,W)=>{G=setTimeout(()=>{let _=Math.round(X/1000);E.warn("qlex stream idle timeout",{tier:$,idleTimeoutMs:X,frameIndex:g,streamedContentChars:T,contentStreamed:P}),W(new v(`the gateway sent nothing for ${_}s`,{category:"transient",retryable:!0})),Y.cancel(Error(`qlex stream idle for ${_}s`)).catch(()=>{})},X)})])}finally{if(G!==void 0)clearTimeout(G)}};try{while(!0){let{done:D,value:W}=await R();if(D)break;U+=H.decode(W,{stream:!0});let _;while((_=U.indexOf(`
|
|
25
|
+
|
|
26
|
+
`))!==-1){let C=U.slice(0,_);if(U=U.slice(_+2),M(C))return}}U+=H.decode();let G=U.replace(/\r?\n$/,"");if(G.length>0&&M(G))return;if(!j)Q()}catch(G){if(j)return;if(G instanceof v){q.error(G);return}let D=G instanceof Error?G.message:String(G);q.error(new v(D,GJ(D),{textKept:w}))}finally{Y.releaseLock()}},cancel(q){Y.cancel(q).catch(()=>{})}})}function yJ(J){return{content:typeof J.content==="string"?J.content:J.choices?.[0]?.message?.content??"",finishReason:J.choices?.[0]?.finish_reason??"stop"}}function bK(J){let K=J??{},{content:Z,finishReason:$}=yJ(K),z=K.usage??{},X=z.prompt_tokens??0,Y=z.completion_tokens??0,H="orch-"+Date.now().toString(36),V=Math.floor(Date.now()/1000),U=(O,k,w)=>{let I={id:H,object:"chat.completion.chunk",created:V,model:"orchestrated",choices:[{index:0,delta:O,finish_reason:k}]};if(w)I.usage=w;return`data: ${JSON.stringify(I)}
|
|
25
27
|
|
|
26
28
|
`},P={prompt_tokens:X,completion_tokens:Y,total_tokens:z.total_tokens??X+Y};if(typeof z.cost_usd==="number")P.cost_usd=z.cost_usd;if(typeof z.cost_credits==="number")P.cost_credits=z.cost_credits;if(typeof z.context_window==="number")P.context_window=z.context_window;let j=[U({role:"assistant",content:""},null),U({content:Z},null),U({},$,P),`data: [DONE]
|
|
27
29
|
|
|
28
|
-
`],N=new TextEncoder,L=new ReadableStream({start(O){for(let k of j)O.enqueue(N.encode(k));O.close()}});return new Response(L,{status:200,headers:{"content-type":"text/event-stream"}})}function
|
|
29
|
-
export{
|
|
30
|
+
`],N=new TextEncoder,L=new ReadableStream({start(O){for(let k of j)O.enqueue(N.encode(k));O.close()}});return new Response(L,{status:200,headers:{"content-type":"text/event-stream"}})}function KZ(J){let K=J??{},{content:Z,finishReason:$}=yJ(K),z=K.usage??{},X=z.prompt_tokens??0,Y=z.completion_tokens??0,H={id:"orch-"+Date.now(),object:"chat.completion",created:Math.floor(Date.now()/1000),model:"orchestrated",choices:[{index:0,message:{role:"assistant",content:Z},finish_reason:$}],usage:{prompt_tokens:X,completion_tokens:Y,total_tokens:z.total_tokens??X+Y,...typeof z.cost_usd==="number"?{cost_usd:z.cost_usd}:{},...typeof z.context_window==="number"?{context_window:z.context_window}:{}}};return new Response(JSON.stringify(H),{status:200,headers:{"content-type":"application/json"}})}async function hK(J,K,Z){let $=xJ(J,K);if(!$.requestId)$.requestId=a(Z.requestId);let z=K?`HTTP ${J}: ${K}`:`HTTP ${J}`;switch(E.error("gateway rejected request",{tier:Z.tier,status:J,category:$.category,upstreamCode:$.upstreamCode,field:$.field,retryable:$.retryable}),$.category){case"billing":return new RJ(K||void 0,$);case"rate_limited":return new CJ($);case"gateway_routing":return new u(`HTTP ${J}`,$);case"invalid_credentials":return await Z.onInvalidCredentials?.().catch(()=>{}),new AJ(z,$);case"request_too_large":return new t("irreducible",$.upstreamMessage??K??void 0,$);case"request_rejected":case"tool_protocol":return new TJ($.upstreamMessage??K??void 0,$.field,$);case"configuration":case"transient":case"unknown":default:return new u(z,$)}}function PJ(J){let K=NJ();if(K===void 0)return J;let Z=h(J);if(Z<=K)return J;let $=KJ(J,K);return E.warn("request over known size ceiling, reducing before send",{tier:J.tier,bytes:Z,ceiling:K,reducedBytes:$.bytes,fits:$.reduced,...$.actions}),$.bytes<Z?$.body:J}function _J(J){let K=h(J),Z=JJ(K),$=KJ(J,Z);if(!$.reduced)throw E.error("request too large and cannot be reduced further",{tier:J.tier,rejectedBytes:K,ceiling:Z,reducedBytes:$.bytes,...$.actions}),new t("irreducible");return E.warn("request too large, retrying once with reduced history",{tier:J.tier,rejectedBytes:K,ceiling:Z,reducedBytes:$.bytes,...$.actions,notice:F.copy().requestTooLargeRecovering()}),$.body}function FJ(J){let K=h(J);throw JJ(K),E.error("reduced request still too large",{tier:J.tier,rejectedBytes:K}),new t("after-reduction")}function fK(J,K=globalThis.fetch,Z,$){let z=$?.responseTimeoutMs??oJ;return async(X,Y)=>{if(Y?.method==="POST"&&typeof Y?.body==="string"){let H;try{H=JSON.parse(Y.body)}catch{return K(X,Y)}let U=(typeof H.model==="string"?H.model:void 0)?.split("/").at(-1);if(U&&F.isDecisionTier(U))F.assertChatTierSupported(U);let P=FK();await kK();let j=RK(H.model??"adaptive"),N=jJ(H,{toolMode:P,outputAdvisory:j});if(WK(H.messages)&&!NK(N.messages)){let{dropped:Q}=bJ(P==="text"?hJ(H.messages,H.tools):H.messages);throw E.error("refusing to send: user message lost in normalization",{tier:N.tier,toolMode:P,inputRoles:Array.isArray(H.messages)?H.messages.map((M)=>M&&typeof M==="object"?String(M.role):"?"):"not-an-array",droppedCount:Q.length,dropped:Q}),new BJ("your message could not be turned into sendable content")}let L=await J(),O=typeof L==="string"?{key:L,method:"sso"}:L;if(!O?.key)throw new wJ;let k=new Headers(Y.headers),w=()=>{if(O.method==="api-key")k.delete("Authorization"),k.set("x-api-key",O.key);else k.delete("x-api-key"),k.set("Authorization",`Bearer ${O.key}`)};w(),k.set("Content-Type","application/json");let I=!1,g=async(Q,M,R)=>{let G=xJ(Q,M),D=async()=>({retry:!1,error:await hK(Q,M,{onInvalidCredentials:Z,tier:N.tier,requestId:R?.get("x-request-id")??R?.get("request-id")??R?.get("x-qlex-request-id")??void 0})});if(G.category!=="invalid_credentials"||I)return D();I=!0;let W=$J(O),_=await kJ(O);if(_.kind==="recovered"&&$J(_.credential)!==W)return O=_.credential,w(),{retry:!0};if(_.kind==="inconclusive")return{retry:!1,error:new u(`HTTP ${Q}: ${_.reason}`,G)};return D()};if(N.tier==="orchestrated"){let Q=Y.signal,M=async(D)=>{let W=new AbortController,_=()=>W.abort(Q?.reason);if(Q)if(Q.aborted)W.abort(Q.reason);else Q.addEventListener("abort",_,{once:!0});let C=!1,pJ=setTimeout(()=>{C=!0,W.abort()},z);try{return await K(lJ,{method:"POST",headers:k,body:JSON.stringify(D),signal:W.signal})}catch(uJ){if(C)throw new u(`no response within ${Math.round(z/1000)}s`);throw uJ}finally{clearTimeout(pJ),Q?.removeEventListener("abort",_)}},R=PJ(N),G=await M(R);if(G.status===413){if(await G.body?.cancel().catch(()=>{}),R=_J(R),G=await M(R),G.status===413)await G.body?.cancel().catch(()=>{}),FJ(R)}while(!G.ok){let D=await G.text().catch(()=>""),W=await g(G.status,D,G.headers);if(!W.retry)throw W.error;G=await M(R)}return bK(await G.json())}let T=Y.signal,q=async(Q)=>{let M=new AbortController,R=()=>M.abort(T?.reason);if(T)if(T.aborted)M.abort(T.reason);else T.addEventListener("abort",R,{once:!0});let G=()=>T?.removeEventListener("abort",R),D=!1,W=setTimeout(()=>{D=!0,M.abort()},z);try{return{res:await K(iJ,{method:"POST",headers:k,body:JSON.stringify(Q),signal:M.signal}),detach:G}}catch(_){if(G(),D)throw new u(`no response within ${Math.round(z/1000)}s`);throw _}finally{clearTimeout(W)}},B=PJ(N),{res:S,detach:A}=await q(B);if(S.status===400&&P==="native"&&OK(H))A(),await S.body?.cancel().catch(()=>{}),B=jJ(H,{toolMode:"text",outputAdvisory:j}),{res:S,detach:A}=await q(B);if(S.status===413){if(A(),await S.body?.cancel().catch(()=>{}),B=_J(B),{res:S,detach:A}=await q(B),S.status===413)A(),await S.body?.cancel().catch(()=>{}),FJ(B)}try{while(!S.ok){let Q=await S.text().catch(()=>""),M=await g(S.status,Q,S.headers);if(A(),!M.retry)throw M.error;({res:S,detach:A}=await q(B))}}catch(Q){throw A(),Q}if(H.stream!==!1&&S.body){let Q=Array.isArray(H.tools)&&H.tools.length>0;return new Response(xK(S.body,{toolProtocolEnabled:Q,tier:N.tier,requestedOutputBudget:N.opts.max_tokens}),{status:S.status,statusText:S.statusText,headers:{"content-type":"text/event-stream"}})}return S}return K(X,Y)}}function ZZ(J){let K=J.getToken??(async()=>J.bearerToken),Z=fK(K,globalThis.fetch,J.onInvalidCredentials);return qJ({name:J.name??"qlex",baseURL:F.streamBaseUrl(),fetch:Z})}function $Z(J,K){return o(J,K)!==void 0}var vK=2;function o(J,K){let Z=i.get(J)?.advisory,$=F.tierBudgetFacts(J),z=Z?.tierOutputLimit??$?.output;if(!z)return;let X=K??Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??$?.recommendedTotal??$?.recommendedStep;if(!X||X>=z)return;let Y=Z?.recommendedTotalTokens??Z?.tierRecommendedStepTokens??$?.recommendedTotal??$?.recommendedStep??X,H=Math.min(z,Math.max(X+1,X*vK,Y));return H>X?H:void 0}var l=!1,zJ=Promise.resolve();
|
|
31
|
+
export{iJ as Zn,lJ as _n,d as $n,a as ao,wJ as bo,RJ as co,CJ as do,AJ as eo,TJ as fo,t as go,BJ as ho,u as io,oJ as jo,sJ as ko,aK as lo,v as mo,GJ as no,KK as oo,IJ as po,xJ as qo,$K as ro,s as so,bJ as to,DK as uo,WK as vo,NK as wo,GK as xo,n as yo,r as zo,jK as Ao,XJ as Bo,hJ as Co,FK as Do,OK as Eo,jJ as Fo,wK as Go,RK as Ho,tK as Io,eK as Jo,JZ as Ko,TK as Lo,BK as Mo,IK as No,gJ as Oo,xK as Po,bK as Qo,KZ as Ro,fK as So,ZZ as To,$Z as Uo,o as Vo};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
3
|
-
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let N=c.originalExpiration??c.expiration;return{...c,...N?{originalExpiration:N}:{},expiration:T}};var k=(c,I={})=>{let x=I?.logger||console,T;return async()=>{let N;try{if(N=await c(),N.expiration&&N.expiration.getTime()<Date.now())N=L(N,x)}catch(O){if(T)x.warn("Credential renew failed: ",O),N=L(T,x);else throw O}return T=N,N}};var p="/latest/meta-data/iam/security-credentials/",Ic="/latest/api/token",B="AWS_EC2_METADATA_V1_DISABLED",R="ec2_metadata_v1_disabled",M="x-aws-ec2-metadata-token",pc=(c={})=>k(Tc(c),{logger:c.logger}),Tc=(c={})=>{let I=!1,{logger:x,profile:T}=c,{timeout:N,maxRetries:O}=Z(c),$=async(y,j)=>{if(I||j.headers?.[M]==null){let w=!1,h=!1,n=await G.loadConfig({environmentVariableSelector:(Y)=>{let u=Y[B];if(h=!!u&&u!=="false",u===void 0)throw new G.CredentialsProviderError(`${B} not set in env, checking config file next.`,{logger:c.logger});return h},configFileSelector:(Y)=>{let u=Y[R];return w=!!u&&u!=="false",w},default:!1},{profile:T})();if(c.ec2MetadataV1Disabled||n){let Y=[];if(c.ec2MetadataV1Disabled)Y.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(w)Y.push(`config file profile (${R})`);if(h)Y.push(`process environment variable (${B})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${Y.join(", ")}].`)}}let C=(await m(async()=>{let w;try{w=await xc(j)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)).trim();return m(async()=>{let w;try{w=await Oc(C,j,c)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)};return async()=>{let y=await H();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),$(O,{...y,timeout:N});else{let j;try{j=(await Nc({...y,timeout:N})).toString()}catch(E){if(E?.statusCode===400)throw Object.assign(E,{message:"EC2 Metadata token request returned error"});else if(E.message==="TimeoutError"||[403,404,405].includes(E.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),$(O,{...y,timeout:N})}return $(O,{...y,headers:{[M]:j},timeout:N})}}},Nc=async(c)=>S({...c,path:Ic,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),xc=async(c)=>(await S({...c,path:p})).toString(),Oc=async(c,I,x)=>{let T=JSON.parse((await S({...I,path:p+c})).toString());if(!Q(T))throw new G.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:x.logger});return X(T)};export{wc as
|
|
2
|
+
import{Se as e}from"./chunk-s0gmxpxm.js";import{Gf as K}from"./chunk-48rg4yhk.js";import{uP as A}from"./chunk-sh03ka27.js";var J=A(K(),1);var Q=(c)=>Boolean(c)&&typeof c==="object"&&typeof c.AccessKeyId==="string"&&typeof c.SecretAccessKey==="string"&&typeof c.Token==="string"&&typeof c.Expiration==="string",X=(c)=>({accessKeyId:c.AccessKeyId,secretAccessKey:c.SecretAccessKey,sessionToken:c.Token,expiration:new Date(c.Expiration),...c.AccountId&&{accountId:c.AccountId}});var wc=1000,hc=0,Z=({maxRetries:c=0,timeout:I=1000})=>({maxRetries:c,timeout:I});var _=A(K(),1);import q from"http";function S(c){return new Promise((I,x)=>{let T=q.request({method:"GET",...c,hostname:c.hostname?.replace(/^\[(.+)\]$/,"$1")});T.on("error",(N)=>{x(Object.assign(new _.ProviderError("Unable to connect to instance metadata service"),N)),T.destroy()}),T.on("timeout",()=>{x(new _.ProviderError("TimeoutError from instance metadata service")),T.destroy()}),T.on("response",(N)=>{let{statusCode:O=400}=N;if(O<200||300<=O)x(Object.assign(new _.ProviderError("Error response received from instance metadata service"),{statusCode:O})),T.destroy();let $=[];N.on("data",(y)=>{$.push(y)}),N.on("end",()=>{I(Buffer.concat($)),T.destroy()})}),T.end()})}var m=(c,I)=>{let x=c();for(let T=0;T<I;T++)x=x.catch(c);return x};var v="AWS_CONTAINER_CREDENTIALS_FULL_URI",W="AWS_CONTAINER_CREDENTIALS_RELATIVE_URI",t="AWS_CONTAINER_AUTHORIZATION_TOKEN",Kc=(c={})=>{let{timeout:I,maxRetries:x}=Z(c);return()=>m(async()=>{let T=await l({logger:c.logger}),N=JSON.parse(await a(I,T));if(!Q(N))throw new J.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:c.logger});return X(N)},x)},a=async(c,I)=>{if(process.env[t])I.headers={...I.headers,Authorization:process.env[t]};return(await S({...I,timeout:c})).toString()},o="169.254.170.2",s=new Set(["localhost","127.0.0.1"]),g=new Set(["http:","https:"]),l=async({logger:c})=>{if(process.env[W])return{hostname:o,path:process.env[W]};if(process.env[v]){let I;try{I=new URL(process.env[v])}catch{throw new J.CredentialsProviderError(`${process.env[v]} is not a valid container metadata service URL`,{tryNextLink:!1,logger:c})}if(!I.hostname||!s.has(I.hostname))throw new J.CredentialsProviderError(`${I.hostname} is not a valid container metadata service hostname`,{tryNextLink:!1,logger:c});if(!I.protocol||!g.has(I.protocol))throw new J.CredentialsProviderError(`${I.protocol} is not a valid container metadata service protocol`,{tryNextLink:!1,logger:c});return{protocol:I.protocol,hostname:I.hostname,path:I.pathname+I.search,port:I.port?parseInt(I.port,10):void 0}}throw new J.CredentialsProviderError(`The container metadata credential provider cannot be used unless the ${W} or ${v} environment variable is set`,{tryNextLink:!1,logger:c})};var G=A(K(),1);var U=A(K(),1);class D extends U.CredentialsProviderError{tryNextLink;name="InstanceMetadataV1FallbackError";constructor(c,I=!0){super(c,I);this.tryNextLink=I,Object.setPrototypeOf(this,D.prototype)}}var b=A(K(),1),V=A(e(),1);var z;(function(c){c.IPv4="http://169.254.169.254",c.IPv6="http://[fd00:ec2::254]"})(z||(z={}));var F={environmentVariableSelector:(c)=>c.AWS_EC2_METADATA_SERVICE_ENDPOINT,configFileSelector:(c)=>c.ec2_metadata_service_endpoint,default:void 0};var f;(function(c){c.IPv4="IPv4",c.IPv6="IPv6"})(f||(f={}));var r="AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE",d="ec2_metadata_service_endpoint_mode",P={environmentVariableSelector:(c)=>c[r],configFileSelector:(c)=>c[d],default:f.IPv4};var H=async()=>V.parseUrl(await i()||await cc()),i=async()=>b.loadConfig(F)(),cc=async()=>{let c=await b.loadConfig(P)();switch(c){case f.IPv4:return z.IPv4;case f.IPv6:return z.IPv6;default:throw Error(`Unsupported endpoint mode: ${c}. Select from ${Object.values(f)}`)}};var L=(c,I)=>{let x=300+Math.floor(Math.random()*300),T=new Date(Date.now()+x*1000);I.warn(`Attempting credential expiration extension due to a credential service availability issue. A refresh of these credentials will be attempted after ${new Date(T)}.
|
|
3
|
+
For more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html`);let N=c.originalExpiration??c.expiration;return{...c,...N?{originalExpiration:N}:{},expiration:T}};var k=(c,I={})=>{let x=I?.logger||console,T;return async()=>{let N;try{if(N=await c(),N.expiration&&N.expiration.getTime()<Date.now())N=L(N,x)}catch(O){if(T)x.warn("Credential renew failed: ",O),N=L(T,x);else throw O}return T=N,N}};var p="/latest/meta-data/iam/security-credentials/",Ic="/latest/api/token",B="AWS_EC2_METADATA_V1_DISABLED",R="ec2_metadata_v1_disabled",M="x-aws-ec2-metadata-token",pc=(c={})=>k(Tc(c),{logger:c.logger}),Tc=(c={})=>{let I=!1,{logger:x,profile:T}=c,{timeout:N,maxRetries:O}=Z(c),$=async(y,j)=>{if(I||j.headers?.[M]==null){let w=!1,h=!1,n=await G.loadConfig({environmentVariableSelector:(Y)=>{let u=Y[B];if(h=!!u&&u!=="false",u===void 0)throw new G.CredentialsProviderError(`${B} not set in env, checking config file next.`,{logger:c.logger});return h},configFileSelector:(Y)=>{let u=Y[R];return w=!!u&&u!=="false",w},default:!1},{profile:T})();if(c.ec2MetadataV1Disabled||n){let Y=[];if(c.ec2MetadataV1Disabled)Y.push("credential provider initialization (runtime option ec2MetadataV1Disabled)");if(w)Y.push(`config file profile (${R})`);if(h)Y.push(`process environment variable (${B})`);throw new D(`AWS EC2 Metadata v1 fallback has been blocked by AWS SDK configuration in the following: [${Y.join(", ")}].`)}}let C=(await m(async()=>{let w;try{w=await xc(j)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)).trim();return m(async()=>{let w;try{w=await Oc(C,j,c)}catch(h){if(h.statusCode===401)I=!1;throw h}return w},y)};return async()=>{let y=await H();if(I)return x?.debug("AWS SDK Instance Metadata","using v1 fallback (no token fetch)"),$(O,{...y,timeout:N});else{let j;try{j=(await Nc({...y,timeout:N})).toString()}catch(E){if(E?.statusCode===400)throw Object.assign(E,{message:"EC2 Metadata token request returned error"});else if(E.message==="TimeoutError"||[403,404,405].includes(E.statusCode))I=!0;return x?.debug("AWS SDK Instance Metadata","using v1 fallback (initial)"),$(O,{...y,timeout:N})}return $(O,{...y,headers:{[M]:j},timeout:N})}}},Nc=async(c)=>S({...c,path:Ic,method:"PUT",headers:{"x-aws-ec2-metadata-token-ttl-seconds":"21600"}}),xc=async(c)=>(await S({...c,path:p})).toString(),Oc=async(c,I,x)=>{let T=JSON.parse((await S({...I,path:p+c})).toString());if(!Q(T))throw new G.CredentialsProviderError("Invalid response received from instance metadata service.",{logger:x.logger});return X(T)};export{wc as qe,hc as re,Z as se,S as te,v as ue,W as ve,t as we,Kc as xe,z as ye,H as ze,pc as Ae};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{fl as a,gl as b,hl as c,il as d,jl as e,kl as f,ll as g,ml as h,nl as i}from"./chunk-2pw56zpj.js";import"./chunk-4gzggzc0.js";import"./chunk-h036zy9e.js";import"./chunk-3152y1q9.js";import"./chunk-6cztstry.js";import"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-sh03ka27.js";export{i as stopRefresh,h as startRefresh,g as refresh,d as readModelCatalogResponse,f as get,c as Provider,b as Model,a as MODEL_CATALOG_MAX_BYTES,e as Data};
|