@bkm016/basalt 0.1.26 → 0.1.28
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/chunk-00jhevnt.js +3 -0
- package/chunk-04tx0etc.js +2 -0
- package/chunk-0r86p29p.js +7 -0
- package/chunk-10x1zefx.js +25 -0
- package/chunk-1amcz1cz.js +10 -0
- package/chunk-1pfdps04.js +2 -0
- package/chunk-206g40v9.js +59 -0
- package/chunk-2364s958.js +7 -0
- package/chunk-3fv2qcpg.js +12 -0
- package/chunk-3zz4a5tn.js +31 -0
- package/chunk-45wfmdts.js +44 -0
- package/chunk-4hkwjw05.js +2 -0
- package/chunk-4n4wn5cj.js +4014 -0
- package/chunk-4pq7ycp2.js +5 -0
- package/chunk-51f8zbj5.js +3 -0
- package/chunk-5e0qfdgx.js +5 -0
- package/chunk-78yngmvf.js +51 -0
- package/chunk-7hpf9qq2.js +3 -0
- package/chunk-82dkdvs9.js +2 -0
- package/chunk-8913dkey.js +3 -0
- package/chunk-8g1sbmwf.js +3 -0
- package/chunk-8hfch7d0.js +2 -0
- package/chunk-90arpvgz.js +2 -0
- package/chunk-912knnfg.js +11 -0
- package/chunk-97bazdk3.js +20 -0
- package/chunk-9akexjfn.js +2 -0
- package/chunk-9dgmbwcc.js +2 -0
- package/chunk-a454ntda.js +50 -0
- package/chunk-acd2cwza.js +3 -0
- package/chunk-ach16jbw.js +2 -0
- package/chunk-ax823t5v.js +3 -0
- package/chunk-b03hg30w.js +2 -0
- package/chunk-bh29df86.js +5 -0
- package/chunk-bhpg72c4.js +2 -0
- package/chunk-bwww6j2q.js +2 -0
- package/chunk-c126k8wc.js +2 -0
- package/chunk-cb3jgak9.js +3 -0
- package/chunk-cjeyy6da.js +3 -0
- package/chunk-cs4gb2hb.js +2 -0
- package/chunk-en5t6hwd.js +3 -0
- package/chunk-f4n1csz0.js +3 -0
- package/chunk-fqfjjhkj.js +3 -0
- package/chunk-h4bvkm6p.js +3 -0
- package/chunk-j01t6mnq.js +3 -0
- package/chunk-j16smb6d.js +2 -0
- package/chunk-j7eqp97m.js +2 -0
- package/chunk-jdrqn8m1.js +2 -0
- package/chunk-jp1gqkbp.js +4 -0
- package/chunk-jrcvxscb.js +9 -0
- package/chunk-k8zq95wr.js +2 -0
- package/chunk-ken7ras9.js +8 -0
- package/chunk-kqgpjmcf.js +2 -0
- package/chunk-krbdx24j.js +3 -0
- package/chunk-ky2ym708.js +8 -0
- package/chunk-kzfy666j.js +16 -0
- package/chunk-n0stnnxv.js +2 -0
- package/chunk-n9m2pagh.js +2 -0
- package/chunk-nedvy6yk.js +10 -0
- package/chunk-ng5g0fy3.js +3 -0
- package/chunk-nqeqasyt.js +7 -0
- package/chunk-nt30x5a7.js +3 -0
- package/chunk-pa7yh2q3.js +3 -0
- package/chunk-q1s5r204.js +3 -0
- package/chunk-qj0vfk01.js +2 -0
- package/chunk-qqfdg01g.js +3 -0
- package/chunk-rj6qknjx.js +12 -0
- package/chunk-rvrj0nrs.js +3 -0
- package/chunk-sbhj5h2q.js +2 -0
- package/chunk-t71zzafh.js +3 -0
- package/chunk-t7fwvzmh.js +3 -0
- package/chunk-tpv5hz99.js +5 -0
- package/chunk-tx2rrrtq.js +2 -0
- package/chunk-tyzzbhr5.js +3 -0
- package/chunk-tzbefwf0.js +286 -0
- package/chunk-v4p8807b.js +18 -0
- package/chunk-vnxjcym9.js +17 -0
- package/chunk-w35r8v6x.js +39 -0
- package/chunk-wbygknv2.js +3 -0
- package/chunk-wk63htqy.js +2 -0
- package/chunk-wwazj6mz.js +3 -0
- package/chunk-xpc75mkw.js +25 -0
- package/chunk-ypxn8bec.js +3 -0
- package/chunk-yztc2q9q.js +490 -0
- package/compiled.js +9 -9
- package/package.json +1 -1
- package/ui-test-worker.js +52 -52
- package/web/chunk-02z7yrhn.js +2 -0
- package/web/chunk-02z7yrhn.js.br +0 -0
- package/web/chunk-02z7yrhn.js.gz +0 -0
- package/web/chunk-0an1eqtf.js +1 -0
- package/web/chunk-0an1eqtf.js.br +0 -0
- package/web/chunk-0an1eqtf.js.gz +0 -0
- package/web/chunk-128zy60g.js +99 -0
- package/web/chunk-128zy60g.js.br +0 -0
- package/web/chunk-128zy60g.js.gz +0 -0
- package/web/chunk-1e2jy7m2.js +139 -0
- package/web/chunk-1e2jy7m2.js.br +0 -0
- package/web/chunk-1e2jy7m2.js.gz +0 -0
- package/web/chunk-1hmw1eaw.js +1 -0
- package/web/chunk-1hmw1eaw.js.br +0 -0
- package/web/chunk-1hmw1eaw.js.gz +0 -0
- package/web/chunk-1v3e001f.js +1 -0
- package/web/chunk-1v3e001f.js.br +0 -0
- package/web/chunk-1v3e001f.js.gz +0 -0
- package/web/chunk-20gcnbgn.js +2 -0
- package/web/chunk-20gcnbgn.js.br +0 -0
- package/web/chunk-20gcnbgn.js.gz +0 -0
- package/web/chunk-214p3rj6.js +41 -0
- package/web/chunk-214p3rj6.js.br +0 -0
- package/web/chunk-214p3rj6.js.gz +0 -0
- package/web/chunk-29byd5kf.js +89 -0
- package/web/chunk-29byd5kf.js.br +0 -0
- package/web/chunk-29byd5kf.js.gz +0 -0
- package/web/chunk-2nwvdqxm.js +1 -0
- package/web/chunk-2nwvdqxm.js.br +0 -0
- package/web/chunk-2nwvdqxm.js.gz +0 -0
- package/web/chunk-2wvgy7f4.js +1 -0
- package/web/chunk-2wvgy7f4.js.br +0 -0
- package/web/chunk-2wvgy7f4.js.gz +0 -0
- package/web/chunk-3fbh1wxk.js +62 -0
- package/web/chunk-3fbh1wxk.js.br +0 -0
- package/web/chunk-3fbh1wxk.js.gz +0 -0
- package/web/chunk-3fnrzj1h.js +98 -0
- package/web/chunk-3fnrzj1h.js.br +0 -0
- package/web/chunk-3fnrzj1h.js.gz +0 -0
- package/web/chunk-3g1095m7.js +78 -0
- package/web/chunk-3g1095m7.js.br +0 -0
- package/web/chunk-3g1095m7.js.gz +0 -0
- package/web/chunk-3nn7w4hw.js +2 -0
- package/web/chunk-3nn7w4hw.js.br +0 -0
- package/web/chunk-3nn7w4hw.js.gz +0 -0
- package/web/chunk-3qa8xcdr.js +1 -0
- package/web/chunk-3qa8xcdr.js.br +0 -0
- package/web/chunk-3qa8xcdr.js.gz +0 -0
- package/web/chunk-3x69jfmh.js +332 -0
- package/web/chunk-3x69jfmh.js.br +0 -0
- package/web/chunk-3x69jfmh.js.gz +0 -0
- package/web/chunk-414npx47.js +1 -0
- package/web/chunk-414npx47.js.br +0 -0
- package/web/chunk-414npx47.js.gz +0 -0
- package/web/chunk-4v6m77sv.css +1 -0
- package/web/chunk-4v6m77sv.css.br +0 -0
- package/web/chunk-4v6m77sv.css.gz +0 -0
- package/web/chunk-4vk6xma5.js +1 -0
- package/web/chunk-4vk6xma5.js.br +0 -0
- package/web/chunk-4vk6xma5.js.gz +0 -0
- package/web/chunk-50pdas2t.js +1 -0
- package/web/chunk-50pdas2t.js.br +0 -0
- package/web/chunk-50pdas2t.js.gz +0 -0
- package/web/chunk-56a6zytc.js +1139 -0
- package/web/chunk-56a6zytc.js.br +0 -0
- package/web/chunk-56a6zytc.js.gz +0 -0
- package/web/chunk-5ckj4zez.js +1 -0
- package/web/chunk-5ckj4zez.js.br +2 -0
- package/web/chunk-5ckj4zez.js.gz +0 -0
- package/web/chunk-5mr8z024.js +2 -0
- package/web/chunk-5mr8z024.js.br +0 -0
- package/web/chunk-5mr8z024.js.gz +0 -0
- package/web/chunk-5q4pemdh.js +1 -0
- package/web/chunk-5q4pemdh.js.br +0 -0
- package/web/chunk-5q4pemdh.js.gz +0 -0
- package/web/chunk-63ft76vs.js +1 -0
- package/web/chunk-63ft76vs.js.br +0 -0
- package/web/chunk-63ft76vs.js.gz +0 -0
- package/web/chunk-67ynxnvq.js +8 -0
- package/web/chunk-67ynxnvq.js.br +0 -0
- package/web/chunk-67ynxnvq.js.gz +0 -0
- package/web/chunk-6c2pv79h.js +1 -0
- package/web/chunk-6c2pv79h.js.br +0 -0
- package/web/chunk-6c2pv79h.js.gz +0 -0
- package/web/chunk-719tz8xw.js +1 -0
- package/web/chunk-719tz8xw.js.br +0 -0
- package/web/chunk-719tz8xw.js.gz +0 -0
- package/web/chunk-77nxgqqb.js +4 -0
- package/web/chunk-77nxgqqb.js.br +0 -0
- package/web/chunk-77nxgqqb.js.gz +0 -0
- package/web/chunk-7c59jb8d.js +2 -0
- package/web/chunk-7c59jb8d.js.br +0 -0
- package/web/chunk-7c59jb8d.js.gz +0 -0
- package/web/chunk-7ed5jf6e.js +36 -0
- package/web/chunk-7ed5jf6e.js.br +0 -0
- package/web/chunk-7ed5jf6e.js.gz +0 -0
- package/web/chunk-891bpx3c.js +70 -0
- package/web/chunk-891bpx3c.js.br +0 -0
- package/web/chunk-891bpx3c.js.gz +0 -0
- package/web/chunk-8h4dc48v.js +292 -0
- package/web/chunk-8h4dc48v.js.br +0 -0
- package/web/chunk-8h4dc48v.js.gz +0 -0
- package/web/chunk-96n00vam.js +1 -0
- package/web/chunk-96n00vam.js.br +0 -0
- package/web/chunk-96n00vam.js.gz +0 -0
- package/web/chunk-99c0h3v7.js +1 -0
- package/web/chunk-99c0h3v7.js.br +0 -0
- package/web/chunk-99c0h3v7.js.gz +0 -0
- package/web/chunk-9bs7khrr.js +24 -0
- package/web/chunk-9bs7khrr.js.br +0 -0
- package/web/chunk-9bs7khrr.js.gz +0 -0
- package/web/chunk-9ctyqr3n.js +169 -0
- package/web/chunk-9ctyqr3n.js.br +0 -0
- package/web/chunk-9ctyqr3n.js.gz +0 -0
- package/web/chunk-9qdx0ekk.js +142 -0
- package/web/chunk-9qdx0ekk.js.br +0 -0
- package/web/chunk-9qdx0ekk.js.gz +0 -0
- package/web/chunk-9r0rnt6d.js +214 -0
- package/web/chunk-9r0rnt6d.js.br +0 -0
- package/web/chunk-9r0rnt6d.js.gz +0 -0
- package/web/chunk-a11ev6ff.js +1 -0
- package/web/chunk-a11ev6ff.js.br +0 -0
- package/web/chunk-a11ev6ff.js.gz +0 -0
- package/web/chunk-aan5qk6x.js +1 -0
- package/web/chunk-aan5qk6x.js.br +0 -0
- package/web/chunk-aan5qk6x.js.gz +0 -0
- package/web/chunk-ac9g3w7v.js +1 -0
- package/web/chunk-ac9g3w7v.js.br +0 -0
- package/web/chunk-ac9g3w7v.js.gz +0 -0
- package/web/chunk-ackts7ph.js +24 -0
- package/web/chunk-ackts7ph.js.br +0 -0
- package/web/chunk-ackts7ph.js.gz +0 -0
- package/web/chunk-asyqrf38.js +1 -0
- package/web/chunk-asyqrf38.js.br +0 -0
- package/web/chunk-asyqrf38.js.gz +0 -0
- package/web/chunk-b13crsv9.js +1 -0
- package/web/chunk-b13crsv9.js.br +0 -0
- package/web/chunk-b13crsv9.js.gz +0 -0
- package/web/chunk-brg2zcv5.js +55 -0
- package/web/chunk-brg2zcv5.js.br +0 -0
- package/web/chunk-brg2zcv5.js.gz +0 -0
- package/web/chunk-bw9crrb4.js +1 -0
- package/web/chunk-bw9crrb4.js.br +0 -0
- package/web/chunk-bw9crrb4.js.gz +0 -0
- package/web/chunk-c3d08dw1.js +1 -0
- package/web/chunk-c3d08dw1.js.br +0 -0
- package/web/chunk-c3d08dw1.js.gz +0 -0
- package/web/chunk-cgwnzse1.js +16 -0
- package/web/chunk-cgwnzse1.js.br +0 -0
- package/web/chunk-cgwnzse1.js.gz +0 -0
- package/web/chunk-cm4fjb6j.js +2 -0
- package/web/chunk-cm4fjb6j.js.br +0 -0
- package/web/chunk-cm4fjb6j.js.gz +0 -0
- package/web/chunk-cys4n4sv.js +1 -0
- package/web/chunk-cys4n4sv.js.br +0 -0
- package/web/chunk-cys4n4sv.js.gz +0 -0
- package/web/chunk-d5n2yz4e.js +2 -0
- package/web/chunk-d5n2yz4e.js.br +0 -0
- package/web/chunk-d5n2yz4e.js.gz +0 -0
- package/web/chunk-djrvdzsb.js +89 -0
- package/web/chunk-djrvdzsb.js.br +0 -0
- package/web/chunk-djrvdzsb.js.gz +0 -0
- package/web/chunk-dsffzc1e.js +2 -0
- package/web/chunk-dsffzc1e.js.br +0 -0
- package/web/chunk-dsffzc1e.js.gz +0 -0
- package/web/chunk-e1wy8050.js +370 -0
- package/web/chunk-e1wy8050.js.br +0 -0
- package/web/chunk-e1wy8050.js.gz +0 -0
- package/web/chunk-e4cwyn1g.js +2 -0
- package/web/chunk-e4cwyn1g.js.br +0 -0
- package/web/chunk-e4cwyn1g.js.gz +0 -0
- package/web/chunk-ebknmxdp.js +2 -0
- package/web/chunk-ebknmxdp.js.br +0 -0
- package/web/chunk-ebknmxdp.js.gz +0 -0
- package/web/chunk-efjc9mga.js +2 -0
- package/web/chunk-efjc9mga.js.br +0 -0
- package/web/chunk-efjc9mga.js.gz +0 -0
- package/web/chunk-egjv760p.js +2 -0
- package/web/chunk-egjv760p.js.br +0 -0
- package/web/chunk-egjv760p.js.gz +0 -0
- package/web/chunk-etpd8y98.js +1 -0
- package/web/chunk-etpd8y98.js.br +0 -0
- package/web/chunk-etpd8y98.js.gz +0 -0
- package/web/chunk-f5kr9p2k.js +1 -0
- package/web/chunk-f5kr9p2k.js.br +2 -0
- package/web/chunk-f5kr9p2k.js.gz +0 -0
- package/web/chunk-f5wyg9zh.js +2 -0
- package/web/chunk-f5wyg9zh.js.br +0 -0
- package/web/chunk-f5wyg9zh.js.gz +0 -0
- package/web/chunk-fjhqg9ag.js +2 -0
- package/web/chunk-fjhqg9ag.js.br +0 -0
- package/web/chunk-fjhqg9ag.js.gz +0 -0
- package/web/chunk-ftdzs90e.js +1 -0
- package/web/chunk-ftdzs90e.js.br +0 -0
- package/web/chunk-ftdzs90e.js.gz +0 -0
- package/web/chunk-fyr6rm2p.js +2 -0
- package/web/chunk-fyr6rm2p.js.br +0 -0
- package/web/chunk-fyr6rm2p.js.gz +0 -0
- package/web/chunk-grjq1g15.js +1 -0
- package/web/chunk-grjq1g15.js.br +0 -0
- package/web/chunk-grjq1g15.js.gz +0 -0
- package/web/chunk-gvndjaan.js +2 -0
- package/web/chunk-gvndjaan.js.br +0 -0
- package/web/chunk-gvndjaan.js.gz +0 -0
- package/web/chunk-h4bzgvbg.js +303 -0
- package/web/chunk-h4bzgvbg.js.br +0 -0
- package/web/chunk-h4bzgvbg.js.gz +0 -0
- package/web/chunk-heen0v5d.js +12 -0
- package/web/chunk-heen0v5d.js.br +0 -0
- package/web/chunk-heen0v5d.js.gz +0 -0
- package/web/chunk-henez15c.js +4 -0
- package/web/chunk-henez15c.js.br +0 -0
- package/web/chunk-henez15c.js.gz +0 -0
- package/web/chunk-hpcvwdkg.js +1 -0
- package/web/chunk-hpcvwdkg.js.br +0 -0
- package/web/chunk-hpcvwdkg.js.gz +0 -0
- package/web/chunk-hpvyk6rz.js +324 -0
- package/web/chunk-hpvyk6rz.js.br +0 -0
- package/web/chunk-hpvyk6rz.js.gz +0 -0
- package/web/chunk-hzvff525.js +2 -0
- package/web/chunk-hzvff525.js.br +0 -0
- package/web/chunk-hzvff525.js.gz +0 -0
- package/web/chunk-j0dyf1g8.js +2 -0
- package/web/chunk-j0dyf1g8.js.br +3 -0
- package/web/chunk-j0dyf1g8.js.gz +0 -0
- package/web/chunk-jb89v31q.js +1 -0
- package/web/chunk-jb89v31q.js.br +0 -0
- package/web/chunk-jb89v31q.js.gz +0 -0
- package/web/chunk-jb949ewp.js +217 -0
- package/web/chunk-jb949ewp.js.br +0 -0
- package/web/chunk-jb949ewp.js.gz +0 -0
- package/web/chunk-je4bf95v.js +1 -0
- package/web/chunk-je4bf95v.js.br +0 -0
- package/web/chunk-je4bf95v.js.gz +0 -0
- package/web/chunk-js6c1973.js +1 -0
- package/web/chunk-js6c1973.js.br +0 -0
- package/web/chunk-js6c1973.js.gz +0 -0
- package/web/chunk-k140nr54.js +1 -0
- package/web/chunk-k140nr54.js.br +0 -0
- package/web/chunk-k140nr54.js.gz +0 -0
- package/web/chunk-k89686qj.js +2 -0
- package/web/chunk-k89686qj.js.br +0 -0
- package/web/chunk-k89686qj.js.gz +0 -0
- package/web/chunk-kknrn2wb.js +84 -0
- package/web/chunk-kknrn2wb.js.br +0 -0
- package/web/chunk-kknrn2wb.js.gz +0 -0
- package/web/chunk-mhtzdq9d.js +140 -0
- package/web/chunk-mhtzdq9d.js.br +0 -0
- package/web/chunk-mhtzdq9d.js.gz +0 -0
- package/web/chunk-mqdvg55y.js +2 -0
- package/web/chunk-mqdvg55y.js.br +0 -0
- package/web/chunk-mqdvg55y.js.gz +0 -0
- package/web/chunk-mrnj2k3v.js +2 -0
- package/web/chunk-mrnj2k3v.js.br +0 -0
- package/web/chunk-mrnj2k3v.js.gz +0 -0
- package/web/chunk-my0k5w7f.js +39 -0
- package/web/chunk-my0k5w7f.js.br +0 -0
- package/web/chunk-my0k5w7f.js.gz +0 -0
- package/web/chunk-n08727ym.js +34 -0
- package/web/chunk-n08727ym.js.br +0 -0
- package/web/chunk-n08727ym.js.gz +0 -0
- package/web/chunk-n5ghyxwk.js +38 -0
- package/web/chunk-n5ghyxwk.js.br +0 -0
- package/web/chunk-n5ghyxwk.js.gz +0 -0
- package/web/chunk-ngsv0xfb.js +1 -0
- package/web/chunk-ngsv0xfb.js.br +0 -0
- package/web/chunk-ngsv0xfb.js.gz +0 -0
- package/web/chunk-nt21rjrm.js +21 -0
- package/web/chunk-nt21rjrm.js.br +0 -0
- package/web/chunk-nt21rjrm.js.gz +0 -0
- package/web/chunk-nzgj9qx5.js +2 -0
- package/web/chunk-nzgj9qx5.js.br +0 -0
- package/web/chunk-nzgj9qx5.js.gz +0 -0
- package/web/chunk-p9wm0dv3.js +1 -0
- package/web/chunk-p9wm0dv3.js.br +0 -0
- package/web/chunk-p9wm0dv3.js.gz +0 -0
- package/web/chunk-pqh9yszs.js +106 -0
- package/web/chunk-pqh9yszs.js.br +0 -0
- package/web/chunk-pqh9yszs.js.gz +0 -0
- package/web/chunk-q0vsqq43.js +1 -0
- package/web/chunk-q0vsqq43.js.br +0 -0
- package/web/chunk-q0vsqq43.js.gz +0 -0
- package/web/chunk-qv5d69fn.js +2 -0
- package/web/chunk-qv5d69fn.js.br +0 -0
- package/web/chunk-qv5d69fn.js.gz +0 -0
- package/web/chunk-r7afv22v.js +2 -0
- package/web/chunk-r7afv22v.js.br +0 -0
- package/web/chunk-r7afv22v.js.gz +0 -0
- package/web/chunk-rc6at4k5.js +291 -0
- package/web/chunk-rc6at4k5.js.br +0 -0
- package/web/chunk-rc6at4k5.js.gz +0 -0
- package/web/chunk-rj1rp0tc.js +1 -0
- package/web/chunk-rj1rp0tc.js.br +0 -0
- package/web/chunk-rj1rp0tc.js.gz +0 -0
- package/web/chunk-rnsvrehz.js +30 -0
- package/web/chunk-rnsvrehz.js.br +0 -0
- package/web/chunk-rnsvrehz.js.gz +0 -0
- package/web/chunk-rsmhn1fq.js +1 -0
- package/web/chunk-rsmhn1fq.js.br +0 -0
- package/web/chunk-rsmhn1fq.js.gz +0 -0
- package/web/chunk-s00gxcxn.js +2 -0
- package/web/chunk-s00gxcxn.js.br +0 -0
- package/web/chunk-s00gxcxn.js.gz +0 -0
- package/web/chunk-s1p271av.js +1 -0
- package/web/chunk-s1p271av.js.br +0 -0
- package/web/chunk-s1p271av.js.gz +0 -0
- package/web/chunk-s6a13wxe.js +2 -0
- package/web/chunk-s6a13wxe.js.br +0 -0
- package/web/chunk-s6a13wxe.js.gz +0 -0
- package/web/chunk-sc4kwbnh.js +1 -0
- package/web/chunk-sc4kwbnh.js.br +2 -0
- package/web/chunk-sc4kwbnh.js.gz +0 -0
- package/web/chunk-scebh2ee.js +1 -0
- package/web/chunk-scebh2ee.js.br +0 -0
- package/web/chunk-scebh2ee.js.gz +0 -0
- package/web/chunk-shtkgxz6.js +2 -0
- package/web/chunk-shtkgxz6.js.br +0 -0
- package/web/chunk-shtkgxz6.js.gz +0 -0
- package/web/chunk-spmfwbhd.js +1 -0
- package/web/chunk-spmfwbhd.js.br +0 -0
- package/web/chunk-spmfwbhd.js.gz +0 -0
- package/web/chunk-svtenejf.js +1 -0
- package/web/chunk-svtenejf.js.br +0 -0
- package/web/chunk-svtenejf.js.gz +0 -0
- package/web/chunk-szwh742y.js +2 -0
- package/web/chunk-szwh742y.js.br +0 -0
- package/web/chunk-szwh742y.js.gz +0 -0
- package/web/chunk-t9z1bp8j.js +3 -0
- package/web/chunk-t9z1bp8j.js.br +0 -0
- package/web/chunk-t9z1bp8j.js.gz +0 -0
- package/web/chunk-tbgavq0t.js +2 -0
- package/web/chunk-tbgavq0t.js.br +0 -0
- package/web/chunk-tbgavq0t.js.gz +0 -0
- package/web/chunk-tnttdgsc.js +1 -0
- package/web/chunk-tnttdgsc.js.br +0 -0
- package/web/chunk-tnttdgsc.js.gz +0 -0
- package/web/chunk-tntwwpyh.js +2 -0
- package/web/chunk-tntwwpyh.js.br +0 -0
- package/web/chunk-tntwwpyh.js.gz +0 -0
- package/web/chunk-tp3fpa0t.js +1 -0
- package/web/chunk-tp3fpa0t.js.br +0 -0
- package/web/chunk-tp3fpa0t.js.gz +0 -0
- package/web/chunk-txdkp6yc.js +7 -0
- package/web/chunk-txdkp6yc.js.br +0 -0
- package/web/chunk-txdkp6yc.js.gz +0 -0
- package/web/chunk-v34mwgx8.js +1 -0
- package/web/chunk-v34mwgx8.js.br +0 -0
- package/web/chunk-v34mwgx8.js.gz +0 -0
- package/web/chunk-vayamfxv.js +1 -0
- package/web/chunk-vayamfxv.js.br +0 -0
- package/web/chunk-vayamfxv.js.gz +0 -0
- package/web/chunk-vndrjeyr.js +2 -0
- package/web/chunk-vndrjeyr.js.br +0 -0
- package/web/chunk-vndrjeyr.js.gz +0 -0
- package/web/chunk-vtp01n96.js +1 -0
- package/web/chunk-vtp01n96.js.br +0 -0
- package/web/chunk-vtp01n96.js.gz +0 -0
- package/web/chunk-vx1qmkbm.js +120 -0
- package/web/chunk-vx1qmkbm.js.br +0 -0
- package/web/chunk-vx1qmkbm.js.gz +0 -0
- package/web/chunk-vxx451tt.js +1 -0
- package/web/chunk-vxx451tt.js.br +0 -0
- package/web/chunk-vxx451tt.js.gz +0 -0
- package/web/chunk-w8epfc0c.js +1 -0
- package/web/chunk-w8epfc0c.js.br +0 -0
- package/web/chunk-w8epfc0c.js.gz +0 -0
- package/web/chunk-wdd9pasx.js +1 -0
- package/web/chunk-wdd9pasx.js.br +0 -0
- package/web/chunk-wdd9pasx.js.gz +0 -0
- package/web/chunk-whgh2r7d.js +200 -0
- package/web/chunk-whgh2r7d.js.br +0 -0
- package/web/chunk-whgh2r7d.js.gz +0 -0
- package/web/chunk-x0p1n5ws.js +1 -0
- package/web/chunk-x0p1n5ws.js.br +2 -0
- package/web/chunk-x0p1n5ws.js.gz +0 -0
- package/web/chunk-x2tk9zeq.js +1 -0
- package/web/chunk-x2tk9zeq.js.br +0 -0
- package/web/chunk-x2tk9zeq.js.gz +0 -0
- package/web/chunk-xbt045kt.js +1 -0
- package/web/chunk-xbt045kt.js.br +2 -0
- package/web/chunk-xbt045kt.js.gz +0 -0
- package/web/chunk-xh3agbvb.js +7 -0
- package/web/chunk-xh3agbvb.js.br +0 -0
- package/web/chunk-xh3agbvb.js.gz +0 -0
- package/web/chunk-xpw1spgj.js +40 -0
- package/web/chunk-xpw1spgj.js.br +0 -0
- package/web/chunk-xpw1spgj.js.gz +0 -0
- package/web/chunk-y2jkaf1e.js +2 -0
- package/web/chunk-y2jkaf1e.js.br +0 -0
- package/web/chunk-y2jkaf1e.js.gz +0 -0
- package/web/chunk-yp2jydfj.js +1 -0
- package/web/chunk-yp2jydfj.js.br +0 -0
- package/web/chunk-yp2jydfj.js.gz +0 -0
- package/web/chunk-yxp1es3b.js +1 -0
- package/web/chunk-yxp1es3b.js.br +0 -0
- package/web/chunk-yxp1es3b.js.gz +0 -0
- package/web/chunk-yzrww95m.js +7 -0
- package/web/chunk-yzrww95m.js.br +0 -0
- package/web/chunk-yzrww95m.js.gz +0 -0
- package/web/chunk-z502b5p0.js +1 -0
- package/web/chunk-z502b5p0.js.br +0 -0
- package/web/chunk-z502b5p0.js.gz +0 -0
- package/web/chunk-zny7cya7.js +1 -0
- package/web/chunk-zny7cya7.js.br +2 -0
- package/web/chunk-zny7cya7.js.gz +0 -0
- package/web/chunk-zq1qbaxb.js +2 -0
- package/web/chunk-zq1qbaxb.js.br +0 -0
- package/web/chunk-zq1qbaxb.js.gz +0 -0
- package/web/index.html +1 -1
- package/web/index.html.br +0 -0
- package/web/index.html.gz +0 -0
- package/worker.js +1 -1
- package/chunk-05bkyxh9.js +0 -3
- package/chunk-080kr9ct.js +0 -15
- package/chunk-1a4rrb2v.js +0 -10
- package/chunk-1s560041.js +0 -2
- package/chunk-2expw9m3.js +0 -3
- package/chunk-2fm6g0ga.js +0 -3
- package/chunk-2scbc5yh.js +0 -3
- package/chunk-33jk5rw1.js +0 -3
- package/chunk-377w9fhp.js +0 -3
- package/chunk-3wqncn58.js +0 -3
- package/chunk-43n3k72q.js +0 -2
- package/chunk-44pv8c0b.js +0 -5
- package/chunk-5gk93yp2.js +0 -3
- package/chunk-5z5sbry2.js +0 -7
- package/chunk-6qvg49rk.js +0 -51
- package/chunk-7d6fdzs3.js +0 -50
- package/chunk-7h6k7vac.js +0 -3
- package/chunk-7t5yqsgn.js +0 -5
- package/chunk-7th9y456.js +0 -2
- package/chunk-7v98r8ft.js +0 -2
- package/chunk-82bb3whz.js +0 -3
- package/chunk-8e061pr3.js +0 -2
- package/chunk-8n83nvpa.js +0 -7
- package/chunk-9nng543t.js +0 -3
- package/chunk-a0ex6znf.js +0 -18
- package/chunk-a25etmgf.js +0 -3
- package/chunk-awzaxv88.js +0 -2
- package/chunk-b2s9aksm.js +0 -2
- package/chunk-bfrpy5jd.js +0 -4
- package/chunk-br64f072.js +0 -2
- package/chunk-btza2hna.js +0 -5
- package/chunk-c9bjdydc.js +0 -3
- package/chunk-cww7drfr.js +0 -2
- package/chunk-d0az9pq0.js +0 -2
- package/chunk-d47bpkyz.js +0 -12
- package/chunk-dkfpqbcr.js +0 -3
- package/chunk-dsk3r1s8.js +0 -2
- package/chunk-dw8p4zcz.js +0 -2
- package/chunk-edz2cxtp.js +0 -5
- package/chunk-epqgd8d0.js +0 -3
- package/chunk-f7tn67ff.js +0 -2
- package/chunk-fevkmd0j.js +0 -3
- package/chunk-fzdvrsvn.js +0 -482
- package/chunk-ghat319t.js +0 -25
- package/chunk-h19mfxzq.js +0 -7
- package/chunk-h6sh9pkr.js +0 -2
- package/chunk-jdazqwft.js +0 -2
- package/chunk-je52rmxs.js +0 -9
- package/chunk-jj5pkfgm.js +0 -2
- package/chunk-jp7f2kak.js +0 -2
- package/chunk-jqpb4q7h.js +0 -3
- package/chunk-jzf3qp0g.js +0 -2
- package/chunk-k5qg9az8.js +0 -8
- package/chunk-m51tryxx.js +0 -3
- package/chunk-mna7mgdw.js +0 -3
- package/chunk-nfgg1ksw.js +0 -3
- package/chunk-npd8k692.js +0 -2
- package/chunk-nqzqm9ad.js +0 -3
- package/chunk-nsrdzz1p.js +0 -20
- package/chunk-qdwzmvcq.js +0 -3923
- package/chunk-qgyjffh0.js +0 -16
- package/chunk-qnq3xa4h.js +0 -286
- package/chunk-r0gyd40q.js +0 -2
- package/chunk-ra4kx253.js +0 -7
- package/chunk-rq2b2a6n.js +0 -11
- package/chunk-s1m4dt0z.js +0 -3
- package/chunk-s78m24h4.js +0 -2
- package/chunk-sd9r82h2.js +0 -3
- package/chunk-smygzsyr.js +0 -10
- package/chunk-t0zexn7n.js +0 -2
- package/chunk-t2s0yyw0.js +0 -3
- package/chunk-v9a2y9rn.js +0 -3
- package/chunk-vkn4bfyp.js +0 -2
- package/chunk-vpzs9trn.js +0 -3
- package/chunk-w3tzsrkw.js +0 -12
- package/chunk-x0t8h6vv.js +0 -5
- package/chunk-x23g9em9.js +0 -39
- package/chunk-x316ag7c.js +0 -25
- package/chunk-x5zgyewh.js +0 -2
- package/chunk-xr35av3b.js +0 -59
- package/chunk-yd190t0s.js +0 -31
- package/chunk-zhvw8efz.js +0 -3
- package/chunk-zyqsqwn7.js +0 -2
- package/web/chunk-08tgd17j.js +0 -12
- package/web/chunk-08tgd17j.js.br +0 -0
- package/web/chunk-08tgd17j.js.gz +0 -0
- package/web/chunk-0mqyt9m7.js +0 -1
- package/web/chunk-0mqyt9m7.js.br +0 -0
- package/web/chunk-0mqyt9m7.js.gz +0 -0
- package/web/chunk-0n99y9n5.js +0 -1
- package/web/chunk-0n99y9n5.js.br +0 -0
- package/web/chunk-0n99y9n5.js.gz +0 -0
- package/web/chunk-0qjj75v7.js +0 -1
- package/web/chunk-0qjj75v7.js.br +0 -0
- package/web/chunk-0qjj75v7.js.gz +0 -0
- package/web/chunk-0x3wtwhf.js +0 -291
- package/web/chunk-0x3wtwhf.js.br +0 -0
- package/web/chunk-0x3wtwhf.js.gz +0 -0
- package/web/chunk-0zd5g2yw.js +0 -1
- package/web/chunk-0zd5g2yw.js.br +0 -0
- package/web/chunk-0zd5g2yw.js.gz +0 -0
- package/web/chunk-146ww24y.js +0 -55
- package/web/chunk-146ww24y.js.br +0 -0
- package/web/chunk-146ww24y.js.gz +0 -0
- package/web/chunk-1d8r3aeh.js +0 -3
- package/web/chunk-1d8r3aeh.js.br +0 -0
- package/web/chunk-1d8r3aeh.js.gz +0 -0
- package/web/chunk-1qs4nh4c.js +0 -1
- package/web/chunk-1qs4nh4c.js.br +0 -0
- package/web/chunk-1qs4nh4c.js.gz +0 -0
- package/web/chunk-1v13225a.js +0 -1
- package/web/chunk-1v13225a.js.br +0 -2
- package/web/chunk-1v13225a.js.gz +0 -0
- package/web/chunk-22caavs1.js +0 -1
- package/web/chunk-22caavs1.js.br +0 -0
- package/web/chunk-22caavs1.js.gz +0 -0
- package/web/chunk-28e0vn8m.js +0 -1
- package/web/chunk-28e0vn8m.js.br +0 -0
- package/web/chunk-28e0vn8m.js.gz +0 -0
- package/web/chunk-28sta4gj.js +0 -142
- package/web/chunk-28sta4gj.js.br +0 -0
- package/web/chunk-28sta4gj.js.gz +0 -0
- package/web/chunk-33eqjx7d.js +0 -2
- package/web/chunk-33eqjx7d.js.br +0 -0
- package/web/chunk-33eqjx7d.js.gz +0 -0
- package/web/chunk-3781tgyt.js +0 -21
- package/web/chunk-3781tgyt.js.br +0 -0
- package/web/chunk-3781tgyt.js.gz +0 -0
- package/web/chunk-3gt60qmf.js +0 -370
- package/web/chunk-3gt60qmf.js.br +0 -0
- package/web/chunk-3gt60qmf.js.gz +0 -0
- package/web/chunk-3rg8d23d.js +0 -2
- package/web/chunk-3rg8d23d.js.br +0 -0
- package/web/chunk-3rg8d23d.js.gz +0 -0
- package/web/chunk-40wx2kxh.js +0 -1
- package/web/chunk-40wx2kxh.js.br +0 -0
- package/web/chunk-40wx2kxh.js.gz +0 -0
- package/web/chunk-44kgdrrk.js +0 -1
- package/web/chunk-44kgdrrk.js.br +0 -0
- package/web/chunk-44kgdrrk.js.gz +0 -0
- package/web/chunk-4vqmgjbf.js +0 -1
- package/web/chunk-4vqmgjbf.js.br +0 -0
- package/web/chunk-4vqmgjbf.js.gz +0 -0
- package/web/chunk-55h6ya95.js +0 -1
- package/web/chunk-55h6ya95.js.br +0 -2
- package/web/chunk-55h6ya95.js.gz +0 -0
- package/web/chunk-5a80hcah.js +0 -1
- package/web/chunk-5a80hcah.js.br +0 -0
- package/web/chunk-5a80hcah.js.gz +0 -0
- package/web/chunk-5fed8tt3.js +0 -1
- package/web/chunk-5fed8tt3.js.br +0 -0
- package/web/chunk-5fed8tt3.js.gz +0 -0
- package/web/chunk-5kcmtrrk.js +0 -2
- package/web/chunk-5kcmtrrk.js.br +0 -0
- package/web/chunk-5kcmtrrk.js.gz +0 -0
- package/web/chunk-5y1v9ycq.js +0 -2
- package/web/chunk-5y1v9ycq.js.br +0 -0
- package/web/chunk-5y1v9ycq.js.gz +0 -0
- package/web/chunk-61wasm9a.js +0 -1
- package/web/chunk-61wasm9a.js.br +0 -0
- package/web/chunk-61wasm9a.js.gz +0 -0
- package/web/chunk-66mcaz0p.js +0 -7
- package/web/chunk-66mcaz0p.js.br +0 -0
- package/web/chunk-66mcaz0p.js.gz +0 -0
- package/web/chunk-6ew2qvxb.js +0 -1
- package/web/chunk-6ew2qvxb.js.br +0 -0
- package/web/chunk-6ew2qvxb.js.gz +0 -0
- package/web/chunk-6hkgy8ej.js +0 -36
- package/web/chunk-6hkgy8ej.js.br +0 -0
- package/web/chunk-6hkgy8ej.js.gz +0 -0
- package/web/chunk-75v6mnzm.js +0 -40
- package/web/chunk-75v6mnzm.js.br +0 -0
- package/web/chunk-75v6mnzm.js.gz +0 -0
- package/web/chunk-7ddgm832.js +0 -41
- package/web/chunk-7ddgm832.js.br +0 -0
- package/web/chunk-7ddgm832.js.gz +0 -0
- package/web/chunk-80htbw45.js +0 -1
- package/web/chunk-80htbw45.js.br +0 -0
- package/web/chunk-80htbw45.js.gz +0 -0
- package/web/chunk-8304998z.js +0 -1
- package/web/chunk-8304998z.js.br +0 -0
- package/web/chunk-8304998z.js.gz +0 -0
- package/web/chunk-84wf0ej8.js +0 -2
- package/web/chunk-84wf0ej8.js.br +0 -0
- package/web/chunk-84wf0ej8.js.gz +0 -0
- package/web/chunk-859ry2p4.js +0 -1
- package/web/chunk-859ry2p4.js.br +0 -0
- package/web/chunk-859ry2p4.js.gz +0 -0
- package/web/chunk-883weqxg.js +0 -2
- package/web/chunk-883weqxg.js.br +0 -0
- package/web/chunk-883weqxg.js.gz +0 -0
- package/web/chunk-8a46b2ww.js +0 -303
- package/web/chunk-8a46b2ww.js.br +0 -0
- package/web/chunk-8a46b2ww.js.gz +0 -0
- package/web/chunk-8cajyrkw.js +0 -1
- package/web/chunk-8cajyrkw.js.br +0 -0
- package/web/chunk-8cajyrkw.js.gz +0 -0
- package/web/chunk-8ejwy8g3.js +0 -30
- package/web/chunk-8ejwy8g3.js.br +0 -0
- package/web/chunk-8ejwy8g3.js.gz +0 -0
- package/web/chunk-951dg5kq.js +0 -8
- package/web/chunk-951dg5kq.js.br +0 -1
- package/web/chunk-951dg5kq.js.gz +0 -0
- package/web/chunk-97ccteq4.js +0 -106
- package/web/chunk-97ccteq4.js.br +0 -0
- package/web/chunk-97ccteq4.js.gz +0 -0
- package/web/chunk-98kr0bw8.js +0 -98
- package/web/chunk-98kr0bw8.js.br +0 -0
- package/web/chunk-98kr0bw8.js.gz +0 -0
- package/web/chunk-9bq7xgjz.js +0 -1
- package/web/chunk-9bq7xgjz.js.br +0 -0
- package/web/chunk-9bq7xgjz.js.gz +0 -0
- package/web/chunk-9g5jgnfe.js +0 -2
- package/web/chunk-9g5jgnfe.js.br +0 -0
- package/web/chunk-9g5jgnfe.js.gz +0 -0
- package/web/chunk-9kx2s040.js +0 -1
- package/web/chunk-9kx2s040.js.br +0 -0
- package/web/chunk-9kx2s040.js.gz +0 -0
- package/web/chunk-9v1f6yc8.js +0 -1
- package/web/chunk-9v1f6yc8.js.br +0 -0
- package/web/chunk-9v1f6yc8.js.gz +0 -0
- package/web/chunk-an6adjgz.js +0 -24
- package/web/chunk-an6adjgz.js.br +0 -0
- package/web/chunk-an6adjgz.js.gz +0 -0
- package/web/chunk-arp4g43b.js +0 -1
- package/web/chunk-arp4g43b.js.br +0 -0
- package/web/chunk-arp4g43b.js.gz +0 -0
- package/web/chunk-b2ads9ra.js +0 -1
- package/web/chunk-b2ads9ra.js.br +0 -0
- package/web/chunk-b2ads9ra.js.gz +0 -0
- package/web/chunk-bd90pxqc.js +0 -169
- package/web/chunk-bd90pxqc.js.br +0 -0
- package/web/chunk-bd90pxqc.js.gz +0 -0
- package/web/chunk-bmtzds29.js +0 -1
- package/web/chunk-bmtzds29.js.br +0 -0
- package/web/chunk-bmtzds29.js.gz +0 -0
- package/web/chunk-brsvdef4.js +0 -1
- package/web/chunk-brsvdef4.js.br +0 -0
- package/web/chunk-brsvdef4.js.gz +0 -0
- package/web/chunk-bv0vs331.js +0 -332
- package/web/chunk-bv0vs331.js.br +0 -0
- package/web/chunk-bv0vs331.js.gz +0 -0
- package/web/chunk-bzvserky.js +0 -89
- package/web/chunk-bzvserky.js.br +0 -0
- package/web/chunk-bzvserky.js.gz +0 -0
- package/web/chunk-cd3hhgn9.js +0 -2
- package/web/chunk-cd3hhgn9.js.br +0 -0
- package/web/chunk-cd3hhgn9.js.gz +0 -0
- package/web/chunk-cdwn0hd1.js +0 -2
- package/web/chunk-cdwn0hd1.js.br +0 -0
- package/web/chunk-cdwn0hd1.js.gz +0 -0
- package/web/chunk-ckpx6ky8.js +0 -2
- package/web/chunk-ckpx6ky8.js.br +0 -0
- package/web/chunk-ckpx6ky8.js.gz +0 -0
- package/web/chunk-d11xvhrx.js +0 -140
- package/web/chunk-d11xvhrx.js.br +0 -0
- package/web/chunk-d11xvhrx.js.gz +0 -0
- package/web/chunk-d25jazap.js +0 -89
- package/web/chunk-d25jazap.js.br +0 -0
- package/web/chunk-d25jazap.js.gz +0 -0
- package/web/chunk-d5jk5ftp.js +0 -2
- package/web/chunk-d5jk5ftp.js.br +0 -0
- package/web/chunk-d5jk5ftp.js.gz +0 -0
- package/web/chunk-dkdedpn5.js +0 -1
- package/web/chunk-dkdedpn5.js.br +0 -0
- package/web/chunk-dkdedpn5.js.gz +0 -0
- package/web/chunk-drr7mqg2.js +0 -1
- package/web/chunk-drr7mqg2.js.br +0 -0
- package/web/chunk-drr7mqg2.js.gz +0 -0
- package/web/chunk-dxejr2wc.js +0 -7
- package/web/chunk-dxejr2wc.js.br +0 -0
- package/web/chunk-dxejr2wc.js.gz +0 -0
- package/web/chunk-dym50nnh.js +0 -292
- package/web/chunk-dym50nnh.js.br +0 -0
- package/web/chunk-dym50nnh.js.gz +0 -0
- package/web/chunk-e1fv9zdp.js +0 -1
- package/web/chunk-e1fv9zdp.js.br +0 -0
- package/web/chunk-e1fv9zdp.js.gz +0 -0
- package/web/chunk-e9ycc491.js +0 -120
- package/web/chunk-e9ycc491.js.br +0 -0
- package/web/chunk-e9ycc491.js.gz +0 -0
- package/web/chunk-eww9ygx5.js +0 -2
- package/web/chunk-eww9ygx5.js.br +0 -0
- package/web/chunk-eww9ygx5.js.gz +0 -0
- package/web/chunk-ey2fy3vm.js +0 -4
- package/web/chunk-ey2fy3vm.js.br +0 -0
- package/web/chunk-ey2fy3vm.js.gz +0 -0
- package/web/chunk-ez498328.js +0 -39
- package/web/chunk-ez498328.js.br +0 -0
- package/web/chunk-ez498328.js.gz +0 -0
- package/web/chunk-f0x62xvv.js +0 -84
- package/web/chunk-f0x62xvv.js.br +0 -0
- package/web/chunk-f0x62xvv.js.gz +0 -0
- package/web/chunk-f1z92c2d.js +0 -1
- package/web/chunk-f1z92c2d.js.br +0 -2
- package/web/chunk-f1z92c2d.js.gz +0 -0
- package/web/chunk-fwvar7a7.js +0 -1
- package/web/chunk-fwvar7a7.js.br +0 -0
- package/web/chunk-fwvar7a7.js.gz +0 -0
- package/web/chunk-g8bw60t3.js +0 -324
- package/web/chunk-g8bw60t3.js.br +0 -0
- package/web/chunk-g8bw60t3.js.gz +0 -0
- package/web/chunk-g8se5rtx.js +0 -2
- package/web/chunk-g8se5rtx.js.br +0 -0
- package/web/chunk-g8se5rtx.js.gz +0 -0
- package/web/chunk-gkwkbkr4.js +0 -217
- package/web/chunk-gkwkbkr4.js.br +0 -0
- package/web/chunk-gkwkbkr4.js.gz +0 -0
- package/web/chunk-h50zbzfg.js +0 -24
- package/web/chunk-h50zbzfg.js.br +0 -0
- package/web/chunk-h50zbzfg.js.gz +0 -0
- package/web/chunk-j3vqhfgg.js +0 -1
- package/web/chunk-j3vqhfgg.js.br +0 -0
- package/web/chunk-j3vqhfgg.js.gz +0 -0
- package/web/chunk-jk6j68wv.js +0 -1
- package/web/chunk-jk6j68wv.js.br +0 -0
- package/web/chunk-jk6j68wv.js.gz +0 -0
- package/web/chunk-jrdx4yfq.js +0 -2
- package/web/chunk-jrdx4yfq.js.br +0 -0
- package/web/chunk-jrdx4yfq.js.gz +0 -0
- package/web/chunk-k2by2sj0.css +0 -1
- package/web/chunk-k2by2sj0.css.br +0 -0
- package/web/chunk-k2by2sj0.css.gz +0 -0
- package/web/chunk-kc4ymfvv.js +0 -2
- package/web/chunk-kc4ymfvv.js.br +0 -1
- package/web/chunk-kc4ymfvv.js.gz +0 -0
- package/web/chunk-kh9d9x20.js +0 -1
- package/web/chunk-kh9d9x20.js.br +0 -0
- package/web/chunk-kh9d9x20.js.gz +0 -0
- package/web/chunk-kkv1h28t.js +0 -2
- package/web/chunk-kkv1h28t.js.br +0 -0
- package/web/chunk-kkv1h28t.js.gz +0 -0
- package/web/chunk-kzkjfngw.js +0 -7
- package/web/chunk-kzkjfngw.js.br +0 -0
- package/web/chunk-kzkjfngw.js.gz +0 -0
- package/web/chunk-mj8xb4z9.js +0 -2
- package/web/chunk-mj8xb4z9.js.br +0 -0
- package/web/chunk-mj8xb4z9.js.gz +0 -0
- package/web/chunk-msn8bpe6.js +0 -1
- package/web/chunk-msn8bpe6.js.br +0 -0
- package/web/chunk-msn8bpe6.js.gz +0 -0
- package/web/chunk-mv0pwdz6.js +0 -1
- package/web/chunk-mv0pwdz6.js.br +0 -0
- package/web/chunk-mv0pwdz6.js.gz +0 -0
- package/web/chunk-myhtb5ps.js +0 -2
- package/web/chunk-myhtb5ps.js.br +0 -0
- package/web/chunk-myhtb5ps.js.gz +0 -0
- package/web/chunk-n8qc0chz.js +0 -34
- package/web/chunk-n8qc0chz.js.br +0 -0
- package/web/chunk-n8qc0chz.js.gz +0 -0
- package/web/chunk-nf83ezt5.js +0 -1136
- package/web/chunk-nf83ezt5.js.br +0 -0
- package/web/chunk-nf83ezt5.js.gz +0 -0
- package/web/chunk-nh3m09b1.js +0 -1
- package/web/chunk-nh3m09b1.js.br +0 -0
- package/web/chunk-nh3m09b1.js.gz +0 -0
- package/web/chunk-nqvjw71s.js +0 -1
- package/web/chunk-nqvjw71s.js.br +0 -0
- package/web/chunk-nqvjw71s.js.gz +0 -0
- package/web/chunk-nyydkfyf.js +0 -1
- package/web/chunk-nyydkfyf.js.br +0 -0
- package/web/chunk-nyydkfyf.js.gz +0 -0
- package/web/chunk-p0zneef1.js +0 -2
- package/web/chunk-p0zneef1.js.br +0 -0
- package/web/chunk-p0zneef1.js.gz +0 -0
- package/web/chunk-pjd16rfv.js +0 -1
- package/web/chunk-pjd16rfv.js.br +0 -0
- package/web/chunk-pjd16rfv.js.gz +0 -0
- package/web/chunk-praang0j.js +0 -214
- package/web/chunk-praang0j.js.br +0 -0
- package/web/chunk-praang0j.js.gz +0 -0
- package/web/chunk-prynwp2t.js +0 -1
- package/web/chunk-prynwp2t.js.br +0 -0
- package/web/chunk-prynwp2t.js.gz +0 -0
- package/web/chunk-q0kx0wyj.js +0 -2
- package/web/chunk-q0kx0wyj.js.br +0 -0
- package/web/chunk-q0kx0wyj.js.gz +0 -0
- package/web/chunk-q6aqg79d.js +0 -2
- package/web/chunk-q6aqg79d.js.br +0 -0
- package/web/chunk-q6aqg79d.js.gz +0 -0
- package/web/chunk-qd3x1kbw.js +0 -1
- package/web/chunk-qd3x1kbw.js.br +0 -2
- package/web/chunk-qd3x1kbw.js.gz +0 -0
- package/web/chunk-qgqg2kr5.js +0 -1
- package/web/chunk-qgqg2kr5.js.br +0 -0
- package/web/chunk-qgqg2kr5.js.gz +0 -0
- package/web/chunk-qha5j25q.js +0 -2
- package/web/chunk-qha5j25q.js.br +0 -0
- package/web/chunk-qha5j25q.js.gz +0 -0
- package/web/chunk-qhf717ek.js +0 -2
- package/web/chunk-qhf717ek.js.br +0 -0
- package/web/chunk-qhf717ek.js.gz +0 -0
- package/web/chunk-qjswcwvm.js +0 -1
- package/web/chunk-qjswcwvm.js.br +0 -0
- package/web/chunk-qjswcwvm.js.gz +0 -0
- package/web/chunk-qt2ktkps.js +0 -1
- package/web/chunk-qt2ktkps.js.br +0 -0
- package/web/chunk-qt2ktkps.js.gz +0 -0
- package/web/chunk-rjvdk0s6.js +0 -1
- package/web/chunk-rjvdk0s6.js.br +0 -0
- package/web/chunk-rjvdk0s6.js.gz +0 -0
- package/web/chunk-scnew5q6.js +0 -1
- package/web/chunk-scnew5q6.js.br +0 -0
- package/web/chunk-scnew5q6.js.gz +0 -0
- package/web/chunk-scrrgk6n.js +0 -2
- package/web/chunk-scrrgk6n.js.br +0 -0
- package/web/chunk-scrrgk6n.js.gz +0 -0
- package/web/chunk-sy1ta5rp.js +0 -1
- package/web/chunk-sy1ta5rp.js.br +0 -0
- package/web/chunk-sy1ta5rp.js.gz +0 -0
- package/web/chunk-t092etr1.js +0 -2
- package/web/chunk-t092etr1.js.br +0 -0
- package/web/chunk-t092etr1.js.gz +0 -0
- package/web/chunk-t34g8qj4.js +0 -2
- package/web/chunk-t34g8qj4.js.br +0 -0
- package/web/chunk-t34g8qj4.js.gz +0 -0
- package/web/chunk-tfdwgjr1.js +0 -2
- package/web/chunk-tfdwgjr1.js.br +0 -0
- package/web/chunk-tfdwgjr1.js.gz +0 -0
- package/web/chunk-ty54ph0y.js +0 -1
- package/web/chunk-ty54ph0y.js.br +0 -2
- package/web/chunk-ty54ph0y.js.gz +0 -0
- package/web/chunk-v36p2ccs.js +0 -2
- package/web/chunk-v36p2ccs.js.br +0 -0
- package/web/chunk-v36p2ccs.js.gz +0 -0
- package/web/chunk-v7nv1ve8.js +0 -1
- package/web/chunk-v7nv1ve8.js.br +0 -0
- package/web/chunk-v7nv1ve8.js.gz +0 -0
- package/web/chunk-vchzf900.js +0 -2
- package/web/chunk-vchzf900.js.br +0 -0
- package/web/chunk-vchzf900.js.gz +0 -0
- package/web/chunk-vmpry714.js +0 -1
- package/web/chunk-vmpry714.js.br +0 -0
- package/web/chunk-vmpry714.js.gz +0 -0
- package/web/chunk-vtn7g6n0.js +0 -2
- package/web/chunk-vtn7g6n0.js.br +0 -0
- package/web/chunk-vtn7g6n0.js.gz +0 -0
- package/web/chunk-w1bp9wwx.js +0 -1
- package/web/chunk-w1bp9wwx.js.br +0 -0
- package/web/chunk-w1bp9wwx.js.gz +0 -0
- package/web/chunk-w4h1c0eb.js +0 -200
- package/web/chunk-w4h1c0eb.js.br +0 -0
- package/web/chunk-w4h1c0eb.js.gz +0 -0
- package/web/chunk-ww5c1dmz.js +0 -1
- package/web/chunk-ww5c1dmz.js.br +0 -0
- package/web/chunk-ww5c1dmz.js.gz +0 -0
- package/web/chunk-wx0jmdbq.js +0 -62
- package/web/chunk-wx0jmdbq.js.br +0 -0
- package/web/chunk-wx0jmdbq.js.gz +0 -0
- package/web/chunk-xdns99dp.js +0 -99
- package/web/chunk-xdns99dp.js.br +0 -0
- package/web/chunk-xdns99dp.js.gz +0 -0
- package/web/chunk-xnhzragz.js +0 -1
- package/web/chunk-xnhzragz.js.br +0 -0
- package/web/chunk-xnhzragz.js.gz +0 -0
- package/web/chunk-xq241z8c.js +0 -38
- package/web/chunk-xq241z8c.js.br +0 -0
- package/web/chunk-xq241z8c.js.gz +0 -0
- package/web/chunk-xve7x5x1.js +0 -2
- package/web/chunk-xve7x5x1.js.br +0 -0
- package/web/chunk-xve7x5x1.js.gz +0 -0
- package/web/chunk-xvn1wg8g.js +0 -2
- package/web/chunk-xvn1wg8g.js.br +0 -0
- package/web/chunk-xvn1wg8g.js.gz +0 -0
- package/web/chunk-xwy6m9v6.js +0 -1
- package/web/chunk-xwy6m9v6.js.br +0 -0
- package/web/chunk-xwy6m9v6.js.gz +0 -0
- package/web/chunk-y7zvyd6m.js +0 -1
- package/web/chunk-y7zvyd6m.js.br +0 -0
- package/web/chunk-y7zvyd6m.js.gz +0 -0
- package/web/chunk-yh07726r.js +0 -78
- package/web/chunk-yh07726r.js.br +0 -0
- package/web/chunk-yh07726r.js.gz +0 -0
- package/web/chunk-yr94dbhk.js +0 -1
- package/web/chunk-yr94dbhk.js.br +0 -0
- package/web/chunk-yr94dbhk.js.gz +0 -0
- package/web/chunk-ysqfkg2v.js +0 -70
- package/web/chunk-ysqfkg2v.js.br +0 -0
- package/web/chunk-ysqfkg2v.js.gz +0 -0
- package/web/chunk-yxax25q6.js +0 -4
- package/web/chunk-yxax25q6.js.br +0 -0
- package/web/chunk-yxax25q6.js.gz +0 -0
- package/web/chunk-z7024nm8.js +0 -16
- package/web/chunk-z7024nm8.js.br +0 -0
- package/web/chunk-z7024nm8.js.gz +0 -0
- package/web/chunk-z91sdj83.js +0 -139
- package/web/chunk-z91sdj83.js.br +0 -0
- package/web/chunk-z91sdj83.js.gz +0 -0
- package/web/chunk-za5j3w7x.js +0 -2
- package/web/chunk-za5j3w7x.js.br +0 -0
- package/web/chunk-za5j3w7x.js.gz +0 -0
- package/web/chunk-zw958xwq.js +0 -1
- package/web/chunk-zw958xwq.js.br +0 -0
- package/web/chunk-zw958xwq.js.gz +0 -0
package/chunk-080kr9ct.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{rt,wt,$o,b,fe,ur,mt,ee,Nn,qr,Ko}from"./chunk-fzdvrsvn.js";import{Pr,Mi}from"./chunk-ghat319t.js";import{We}from"./chunk-sd9r82h2.js";import{h,f,g,Gs}from"./chunk-vpzs9trn.js";import{t,m,It,na,Un,zr,ts,Bn,la,ca,ua,gr,os,ga}from"./chunk-5z5sbry2.js";import{se,Ge,d}from"./chunk-d47bpkyz.js";var _e=new TextEncoder,Ie=new TextDecoder,le=new TextDecoder("utf-8",{fatal:!0});function Yt(...e){let r=e.reduce((i,{length:s})=>i+s,0),n=new Uint8Array(r),o=0;for(let i of e)n.set(i,o),o+=i.length;return n}var Qn=/[^\x00-\x7f]/;function pe(e){if(typeof e=="string"&&e.length>=128){if(Qn.test(e))throw TypeError("non-ASCII string encountered in encode()");return _e.encode(e)}let r=new Uint8Array(e.length);for(let n=0;n<e.length;n++){let o=e.charCodeAt(n);if(o>127)throw TypeError("non-ASCII string encountered in encode()");r[n]=o}return r}function Zt(e,r=!1){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e,{alphabet:r?"base64url":"base64"});if(r){if(e.includes("+")||e.includes("/"))throw TypeError("Invalid base64url");e=e.replace(/-/g,"+").replace(/_/g,"/")}let n=atob(e),o=new Uint8Array(n.length);for(let i=0;i<n.length;i++)o[i]=n.charCodeAt(i);return o}class B extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(e,r){super(e,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}class re extends B{static code="ERR_JWT_CLAIM_VALIDATION_FAILED";code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}}class Le extends B{static code="ERR_JWT_EXPIRED";code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(e,r,n="unspecified",o="unspecified"){super(e,{cause:{claim:n,reason:o,payload:r}}),this.claim=n,this.reason=o,this.payload=r}}class ot extends B{static code="ERR_JOSE_ALG_NOT_ALLOWED";code="ERR_JOSE_ALG_NOT_ALLOWED"}class Y extends B{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}class H extends B{static code="ERR_JWS_INVALID";code="ERR_JWS_INVALID"}class J extends B{static code="ERR_JWT_INVALID";code="ERR_JWT_INVALID"}class we extends B{static code="ERR_JWKS_INVALID";code="ERR_JWKS_INVALID"}class ve extends B{static code="ERR_JWKS_NO_MATCHING_KEY";code="ERR_JWKS_NO_MATCHING_KEY";constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r)}}class it extends B{[Symbol.asyncIterator]=async function*(){};static code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r)}}class st extends B{static code="ERR_JWKS_TIMEOUT";code="ERR_JWKS_TIMEOUT";constructor(e="request timed out",r){super(e,r)}}class De extends B{static code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(e="signature verification failed",r){super(e,r)}}var Xn="The input to be decoded is not correctly encoded.";function ae(e){try{return Zt(typeof e=="string"?e:Ie.decode(e),!0)}catch(r){throw TypeError(Xn,{cause:r})}}function K(e){if(typeof e!="object"||e===null||Object.prototype.toString.call(e)!=="[object Object]")return!1;let r=Object.getPrototypeOf(e);return r===null||Object.getPrototypeOf(r)===null}function qe(e){return K(e)&&Array.isArray(e.keys)&&Array.from(e.keys).every(K)}function er(...e){let r=new Set;for(let n of e)if(n)for(let o of Object.keys(n)){if(r.has(o))return!1;r.add(o)}return!0}function at(e,r,n){try{return ae(e)}catch(o){throw new n(`Failed to base64url decode the ${r}`,{cause:o})}}function tr(e,r,n){try{return pe(e)}catch(o){throw new n(`The ${r} is not a valid base64url string`,{cause:o})}}function rr(e,r,n){let o;try{o=JSON.parse(le.decode(ae(e)))}catch(i){throw new r(n,{cause:i})}if(!K(o))throw new r(n);return o}var nr={__proto__:null,b64:!0};function or(e,r){if(r!==void 0&&(!Array.isArray(r)||r.some((n)=>typeof n!="string")))throw TypeError(`"${e}" option must be an array of strings`);return r===void 0?void 0:new Set(r)}function ir(e,r,n,o,i){if(i.crit!==void 0&&o?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||o.crit===void 0)return[];if(!Array.isArray(o.crit)||o.crit.length===0||o.crit.some((a)=>typeof a!="string"||a.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s=n===void 0?r:{__proto__:null,...n,...r};for(let a of o.crit){if(!(a in s))throw new Y(`Extension Header Parameter "${a}" is not recognized`);if(!Object.hasOwn(i,a)||i[a]===void 0)throw new e(`Extension Header Parameter "${a}" is missing`);if(s[a]&&(!Object.hasOwn(o,a)||o[a]===void 0))throw new e(`Extension Header Parameter "${a}" MUST be integrity protected`)}return o.crit}function sr(e,r){if(r.includes("b64")){let n=e.b64;if(typeof n!="boolean")throw new H('The "b64" (base64url-encode payload) Header Parameter must be a boolean');return n}return!0}var Yn=(e)=>e[Symbol.toStringTag],Zn=(e,r,n)=>{let{alg:o}=e;if(r.use!==void 0){let i=n==="sign"||n==="verify"?"sig":"enc";if(r.use!==i)throw TypeError(`Invalid key for this operation, its "use" must be "${i}" when present`)}if(r.alg!==void 0&&r.alg!==o)throw TypeError(`Invalid key for this operation, its "alg" must be "${o}" when present`);if(Array.isArray(r.key_ops)){let i=n==="encrypt"||n==="decrypt"?e.ops?.[n==="encrypt"?0:1]:n;if(i&&!r.key_ops.includes(i))throw TypeError(`Invalid key for this operation, its "key_ops" must include "${i}" when present`)}};async function cr(e,r,n){let{alg:o,secret:i}=e,s=n==="decrypt"||n==="sign";if(i&&r instanceof Uint8Array)return r;let a,c;if(K(r)){if(a=co(r),typeof a.kty!="string")throw ar(o,r,i);if(!(i?a.kty==="oct"&&typeof a.k=="string":a.kty!=="oct"&&(s?a.kty==="AKP"&&typeof a.priv=="string"||typeof a.d=="string":a.d===void 0&&a.priv===void 0)))throw TypeError(i?'JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present':`JSON Web Key for this operation must be a ${s?"private":"public"} JWK`);if(Zn(e,a,n),a.kty==="oct")return ae(a.k);if(!Object.isFrozen(r)){let{key_ops:p}=r;Array.isArray(p)&&Object.freeze(p),Object.freeze(r)}}else{if(!ro(r))throw ar(o,r,i);let p=i?"secret":s?"private":"public";if(r.type!==p&&(i||["secret","public","private"].includes(r.type)))throw TypeError(`${Yn(r)} instances must be of type "${p}" for the ${o} algorithm`);if(lr(r))return r;if(c=r,c.type==="secret")return c.export()}ct||=new WeakMap;let u=r,l=ct.get(u);if(l?.[o])return l[o];if(l||ct.set(u,l={}),c&&typeof c.toCryptoKey=="function"){let p=c.type==="public",w=eo[c.asymmetricKeyDetails?.namedCurve],S=e.resolve?.({crv:w,asymmetricKeyType:c.asymmetricKeyType})??e.subtle;return l[o]=c.toCryptoKey(S,p,e.usages[p?0:1])}return a??=c.export({format:"jwk"}),a.alg=o,l[o]=await lt(e,a)}var ct,eo={__proto__:null,prime256v1:"P-256",secp384r1:"P-384",secp521r1:"P-521"};var lr=(e)=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch{return!1}},to=(e)=>e?.[Symbol.toStringTag]==="KeyObject",ro=(e)=>lr(e)||to(e);function no(e,r,...n){if(n.length>2){let o=n.pop();e+=`one of type ${n.join(", ")}, or ${o}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return r==null?e+=` Received ${r}`:typeof r=="function"&&r.name?e+=` Received function ${r.name}`:typeof r=="object"&&r!=null&&r.constructor?.name&&(e+=` Received an instance of ${r.constructor.name}`),e}function ar(e,r,n){let o=["CryptoKey","KeyObject","JSON Web Key"];return n&&o.push("Uint8Array"),TypeError(no(`Key for the ${e} algorithm must be `,r,...o))}var Oe=(e,r="algorithm.name")=>TypeError(`CryptoKey does not support this operation, its ${r} must be ${e}`);function oo(e,r){if(r&&!e.usages.includes(r))throw TypeError(`CryptoKey does not support this operation, its usages must include ${r}.`)}function pr(e,r){let{modulusLength:n}=r.algorithm;if(typeof n!="number"||n<2048)throw TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}function io(e,r,n){let o=e.algorithm;if(o.name!==r.name)throw Oe(r.name);if(r.hash&&o.hash?.name!==r.hash)throw Oe(r.hash,"algorithm.hash");if(r.namedCurve&&o.namedCurve!==r.namedCurve)throw Oe(r.namedCurve,"algorithm.namedCurve");if(r.length!==void 0&&o.length!==r.length)throw Oe(r.length,"algorithm.length");oo(e,n)}function ut(e){return{__proto__:null,...e}}function co(e){let r=ut(e);if(r.ext!==void 0&&typeof r.ext!="boolean")throw TypeError('"ext" (Extractable) Parameter must be a boolean');if(r.key_ops!==void 0){let n=r.key_ops,o=Array.isArray(n)?[...n]:void 0;if(!o||o.some((i)=>typeof i!="string")||new Set(o).size!==o.length)throw TypeError('"key_ops" (Key Operations) Parameter must be an array of unique strings');r.key_ops=o}return r}async function lt(e,r,n){if(!e.kty.includes(r.kty))throw new Y('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');let o=e.resolve?.({kty:r.kty,crv:r.crv})??e.subtle,i=!!(r.d||r.priv),s={...r,ext:n??r.ext};return s.kty!=="AKP"&&delete s.alg,delete s.use,crypto.subtle.importKey("jwk",s,o,s.ext??!i,r.key_ops??e.usages[i?1:0])}async function dr(e,r,n,o=!1){return e instanceof Uint8Array&&(e=await crypto.subtle.importKey("raw",e,r,o,[n])),io(e,r,n),e}function hr(e){let r={__proto__:null};for(let n in e)r[n]={...e[n],alg:n};return r}var be=[["verify"],["sign"]];function pt(e){let r={name:"HMAC",hash:`SHA-${e}`};return{kty:["oct"],secret:!0,subtle:r,signing:r,usages:be}}function de(e,r){let n={name:r?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:`SHA-${e}`};return{kty:["RSA"],subtle:n,signing:r?{...n,saltLength:r}:n,usages:be,minRsaBits:2048}}function dt(e,r){return{kty:["EC"],crv:e,subtle:{name:"ECDSA",namedCurve:e},signing:{name:"ECDSA",hash:`SHA-${r}`},usages:be}}function mr(){let e={name:"Ed25519"};return{kty:["OKP"],crv:"Ed25519",subtle:e,signing:e,usages:be}}function ht(e){let r={name:`ML-DSA-${e}`};return{kty:["AKP"],subtle:r,signing:r,usages:be}}var ft=hr({HS256:pt(256),HS384:pt(384),HS512:pt(512),RS256:de(256),RS384:de(384),RS512:de(512),PS256:de(256,32),PS384:de(384,48),PS512:de(512,64),ES256:dt("P-256",256),ES384:dt("P-384",384),ES512:dt("P-521",512),EdDSA:mr(),Ed25519:mr(),"ML-DSA-44":ht(44),"ML-DSA-65":ht(65),"ML-DSA-87":ht(87)});function fr(e){let r=typeof e=="string"?ft[e]:void 0;if(!r)throw new Y(`alg ${e} is not supported either by JOSE or your javascript runtime`);return r}function yr(e){return[e&&or("algorithms",e.algorithms),e?.crit]}function uo(e){return e===void 0?{}:rr(e,H,"JWS Protected Header is invalid")}function po(e){try{return pe(e)}catch(r){throw new H("JWS Compact Serialization payload must use only ASCII characters",{cause:r})}}async function ho(e,r,n,o,i){let{protected:s,header:a,payload:c}=e,u=i??uo(s);if(!er(u,a))throw new H("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let l={...u,...a},p=sr(u,ir(H,nr,r[1],u,l)),{alg:w}=l;if(typeof w!="string"||!w)throw new H('JWS "alg" (Algorithm) Header Parameter missing or invalid');if(r[0]&&!r[0].has(w))throw new ot('"alg" (Algorithm) Header Parameter value not allowed');if(p){if(typeof c!="string")throw new H("JWS Payload must be a string")}else if(typeof c!="string"&&!(c instanceof Uint8Array))throw new H("JWS Payload must be a string or an Uint8Array instance");let S=p||typeof c!="string"?c:o(c),A=!1;typeof n=="function"&&(n=await n(u,e),A=!0);let C=fr(w),D=Yt(s!==void 0?pe(s):new Uint8Array,pe("."),typeof S=="string"?r[2]??=tr(S,"payload",H):S),q=at(e.signature,"signature",H),W=await cr(C,n,"verify"),k=await dr(W,C.subtle,"verify");C.minRsaBits&&pr(C.alg,k);let M=!1;try{M=await crypto.subtle.verify(C.signing,k,q,D)}catch(F){throw new De(void 0,{cause:F})}if(!M)throw new De;let U={payload:typeof S=="string"?at(S,"payload",H):S};return s!==void 0&&(U.protectedHeader=u),a!==void 0&&(U.unprotectedHeader=a),A?[{...U,key:W},p]:[U,p]}async function wr(e,r,n){if(e instanceof Uint8Array&&(e=Ie.decode(e)),typeof e!="string")throw new H("Compact JWS must be a string or Uint8Array");let{0:o,1:i,2:s,length:a}=e.split(".");if(a!==3)throw new H("Invalid Compact JWS");return ho({payload:i,protected:o,signature:s},r,n,po)}var mo=(e)=>Math.floor(e.getTime()/1000),fo={s:1,m:60,h:3600,d:86400,w:604800,y:31557600},go=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,he="check_failed";function gt(){throw TypeError("Invalid time period format")}function vr(e){typeof e!="string"&>();let r=go.exec(e);(!r||r[4]&&r[1])&>();let n=parseFloat(r[2]),o=Math.round(n*fo[r[3][0].toLowerCase()]);return Number.isFinite(o)||gt(),r[1]==="-"||r[4]==="ago"?-o:o}function yt(e,r){if(!Number.isFinite(r))throw TypeError(`Invalid ${e} input`);return r}var br=(e)=>{let r=e.toLowerCase();return e.includes("/")?r:`application/${r}`},yo=(e,r)=>typeof e=="string"?r.includes(e):Array.isArray(e)?r.some((n)=>e.includes(n)):!1;function vt(e,r,n=!1){let o=e[r];if(!(o===void 0&&!n)){if(typeof o!="number")throw new re(`"${r}" claim must be a number`,e,r,"invalid");return o}}function bt(e,r){throw new re(`unexpected "${r}" claim value`,e,r,he)}function xr(e,r,n={}){let o;try{o=JSON.parse(le.decode(r))}catch(k){throw new J("JWT Claims Set must be a top-level JSON object",{cause:k})}if(!K(o))throw new J("JWT Claims Set must be a top-level JSON object");let{typ:i}=n;if(i!==void 0&&(typeof e.typ!="string"||br(e.typ)!==br(i)))throw new re('unexpected "typ" JWT header value',o,"typ",he);let{requiredClaims:s=[],issuer:a,subject:c,audience:u,maxTokenAge:l}=n,p=[...s];l!==void 0&&p.push("iat"),u!==void 0&&p.push("aud"),c!==void 0&&p.push("sub"),a!==void 0&&p.push("iss");for(let k of new Set(p.reverse()))if(!Object.hasOwn(o,k))throw new re(`missing required "${k}" claim`,o,k,"missing");a!==void 0&&!(Array.isArray(a)?a:[a]).includes(o.iss)&&bt(o,"iss"),c!==void 0&&o.sub!==c&&bt(o,"sub"),u!==void 0&&!yo(o.aud,typeof u=="string"?[u]:u)&&bt(o,"aud");let{clockTolerance:w}=n,S=0;if(typeof w=="string")S=vr(w);else if(w!==void 0){if(typeof w!="number")throw TypeError("Invalid clockTolerance option type");S=w}yt("clockTolerance option",S);let{currentDate:A}=n,C=yt("currentDate option",mo(A===void 0?new Date:A)),D=vt(o,"iat",l!==void 0),q=vt(o,"nbf");if(q!==void 0&&q>C+S)throw new re('"nbf" claim timestamp check failed',o,"nbf",he);let W=vt(o,"exp");if(W!==void 0&&W<=C-S)throw new Le('"exp" claim timestamp check failed',o,"exp",he);if(l!==void 0){let k=C-D,M=yt("maxTokenAge option",typeof l=="number"?l:vr(l));if(k-S>M)throw new Le('"iat" claim timestamp check failed (too far in the past)',o,"iat",he);if(k<-S)throw new re('"iat" claim timestamp check failed (it should be in the past)',o,"iat",he)}return o}async function xt(e,r,n){let[o,i]=await wr(e,yr(n),r);if(!i)throw new J("JWTs MUST NOT use unencoded payload");let s=xr(o.protectedHeader,o.payload,n);return{...o,payload:s}}function wo(e,r,n,o){let{kty:i,key_ops:s,ext:a,kid:c,alg:u,use:l,crv:p}=e;return(a===void 0||typeof a=="boolean")&&(s===void 0||Array.isArray(s)&&s.every((w,S)=>typeof w=="string"&&s.indexOf(w)===S)&&s.includes("verify"))&&r.kty.includes(i)&&(o===void 0||typeof o=="string"&&o===c)&&(u===void 0?i!=="AKP":n===u)&&(l===void 0||l==="sig")&&(!r.crv||p===r.crv)}async function Sr(e,r,n){let o=e.get(r)||e.set(r,{}).get(r),{alg:i}=n;if(o[i]===void 0){let s=lt(n,r,!0).then((a)=>{if(a.type!=="public")throw new we("JSON Web Key Set members must be public keys");return o[i]=a,a}).catch((a)=>{throw o[i]===s&&delete o[i],a});o[i]=s}return o[i]}function St(e){let r;try{r=structuredClone(e)}catch(i){throw new we("JSON Web Key Set malformed",{cause:i})}if(!qe(r))throw new we("JSON Web Key Set malformed");let n=r.keys.map((i)=>{let s=ut(i);return Array.isArray(s.key_ops)&&(s.key_ops=[...s.key_ops]),s}),o=new WeakMap;return Object.defineProperty(async(i,s)=>{let{alg:a,kid:c}={...i,...s?.header},u=typeof a=="string"?ft[a]:void 0;if(!u||u.secret)throw new Y('Unsupported "alg" value for a JSON Web Key Set');let l=r.keys.filter((S,A)=>wo(n[A],u,a,c)),{0:p,length:w}=l;if(!w)throw new ve;if(w!==1){let S=new it;throw S[Symbol.asyncIterator]=async function*(){for(let A of l)try{yield await Sr(o,A,u)}catch{}},S}return Sr(o,p,u)},"jwks",{value:()=>structuredClone(r)})}function vo(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var Rt;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(Rt="jose/v6.2.13");var Ar=Symbol();async function bo(e,r,n,o=fetch){let i=await o(e,{method:"GET",signal:n,redirect:"manual",headers:r}).catch((s)=>{throw s.name==="TimeoutError"?new st(void 0,{cause:s}):s});if(i.status!==200)throw new B("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await i.json()}catch(s){throw new B("Failed to parse the JSON Web Key Set HTTP response as JSON",{cause:s})}}var Tr=Symbol();function xe(e,r){return Number.isFinite(e)&&Date.now()<e+r}function Rr(e,r,n){if(Number.isNaN(e))throw TypeError(`"${n}" option must not be NaN`);return typeof e=="number"?e:r}function At(e,r){if(!(e instanceof URL))throw TypeError("url must be an instance of URL");let n=new URL(e.href).href,o=r??{},i=o.timeoutDuration;if(typeof i=="number"&&(!Number.isInteger(i)||i<0))throw TypeError('"timeoutDuration" option must be a non-negative integer');let s=typeof i=="number"?i:5000,a=Rr(o.cooldownDuration,30000,"cooldownDuration"),c=Rr(o.cacheMaxAge,600000,"cacheMaxAge"),u=new Headers(o.headers);Rt&&!u.has("User-Agent")&&u.set("User-Agent",Rt),u.has("accept")||u.set("accept","application/json, application/jwk-set+json");let l=o[Ar],p=o[Tr],w,S,A=0,C=0,D;if(p&&typeof p=="object"){let{uat:W,jwks:k}=p;xe(W,c)&&qe(k)&&(w=W,D=St(k))}let q=async()=>{if(S&&vo()&&(S=void 0),!S){let W=++A,k=S=bo(n,u,AbortSignal.timeout(s),l).then((M)=>{let U=St(M);if(W<=C)return;D=U;let F=Date.now();p&&(p.uat=F,p.jwks=M),w=F,C=W}).finally(()=>{S===k&&(S=void 0)})}await S};return Object.defineProperties(async(W,k)=>{(!D||!xe(w,c))&&await q();try{return await D(W,k)}catch(M){if(M instanceof ve&&!xe(w,a))return await q(),D(W,k);throw M}},{coolingDown:{get:()=>xe(w,a),enumerable:!0},fresh:{get:()=>xe(w,c),enumerable:!0},reload:{value:q,enumerable:!0},reloading:{get:()=>!!S,enumerable:!0},jwks:{value:()=>D?.jwks(),enumerable:!0}})}function Tt(e){if(typeof e!="string")throw new J("JWTs must use Compact JWS serialization, JWT must be a string");let{1:r,length:n}=e.split(".");if(n===5)throw new J("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new J("Invalid JWT");if(!r)throw new J("JWTs must contain a payload");let o;try{o=ae(r)}catch(s){throw new J("Failed to base64url decode the payload",{cause:s})}let i;try{i=JSON.parse(le.decode(o))}catch(s){throw new J("Failed to parse the decoded payload as JSON",{cause:s})}if(!K(i))throw new J("Invalid JWT Claims Set");return i}var xo=["cf-connecting-ip","cf-ray","x-forwarded-for","x-forwarded-host","forwarded","x-real-ip"],So="cf-access-jwt-assertion",Ro=/^https:\/\/([a-z0-9-]+\.cloudflareaccess\.com)\//;function Ao(e){return xo.some((r)=>e.headers.has(r))}async function kt(e,r={}){let n=r.fetch??globalThis.fetch;try{let o=await n(`https://${e}/`,{redirect:"manual",signal:AbortSignal.timeout(1e4)});await o.body?.cancel();let i=Ro.exec(o.headers.get("location")??"")?.[1];if(!i&&o.status>=400&&r.reportFailure)throw Error(`\u516C\u5171\u5730\u5740\u8FD4\u56DE HTTP ${o.status}`);return i}catch(o){if(r.reportFailure)throw o;return}}function Pt(e,r={}){let n=`https://${e.teamDomain}`,o=At(r.jwksURL??new URL(`${n}/cdn-cgi/access/certs`));return{async denies(i){if(!Ao(i))return!1;let s=i.headers.get(So);if(!s)return!0;try{return await xt(s,o,{issuer:n,audience:e.audience,algorithms:["RS256"],requiredClaims:["exp"]}),!1}catch{return!0}}}}import{timingSafeEqual as To}from"crypto";import{chmodSync as ko,existsSync as kr,readFileSync as Po,writeFileSync as Eo}from"fs";import{join as Co}from"path";var Mo=600000,_o=2592000000,Io=5,Lo=50,Er=1024,Do=3600000,Et="23456789ABCDEFGHJKMNPQRSTUVWXYZ";class Ne{dataDir;now;devices;revocations=new Set;code="";expires=0;failures=new Map;codeFailures=0;lastSavedAt=0;constructor(e,r=Date.now){this.dataDir=e;this.now=r;let n=this.path,o=kr(n)?JSON.parse(Po(n,"utf8")):[],i=this.now(),s=Array.isArray(o)?o.map((a)=>Oo(a,i)).filter((a)=>a!==void 0):[];this.devices=Wo(s);while(this.tokenCount()>Er)this.evictLeastRecentlyUsed();if(kr(n))this.save();this.lastSavedAt=this.now(),this.rotate()}get path(){return Co(this.dataDir,"devices.json")}pairingCode(){if(this.now()>=this.expires)this.rotate();return this.code}pairingExpires(){return this.expires}renewPairingCode(){return this.rotate(),this.code}pair(e,r,n="unknown"){if(this.now()>=this.expires)this.rotate();let o=this.failures.get(n);if(o&&o.blockedUntil>this.now())return;if(o)this.failures.delete(n);if(qo(e)!==this.code){let i=(o?.count??0)+1;if(this.failures.set(n,{count:i,blockedUntil:i>=Io?this.expires:0}),this.codeFailures++,this.codeFailures>=Lo)this.rotate();return}return this.rotate(),this.failures.delete(n),this.issue(r)}issue(e){let r=this.now();this.pruneExpired(r);let n=new Set;while(this.tokenCount()>=Er){let u=this.evictLeastRecentlyUsed();if(!u)break;n.add(u)}let o=Buffer.from(crypto.getRandomValues(new Uint8Array(32))).toString("base64url"),i={hash:Cr(o),created:r,lastSeen:r,expires:r+_o},s=e.slice(0,100)||"device",a={id:crypto.randomUUID(),name:s,created:r,lastSeen:r,expires:i.expires,tokens:[i]};this.devices.push(a);let c=a.id;this.save();for(let u of n)for(let l of this.revocations)l(u);return{deviceID:c,token:o}}verify(e){if(!e)return;let r=this.now(),n=Buffer.from(Cr(e),"hex");for(let o of this.devices){let i=o.tokens.findIndex((a)=>{if(a.expires<=r)return!1;let c=Buffer.from(a.hash,"hex");return c.length===n.length&&To(c,n)}),s=o.tokens[i];if(!s)continue;if(s.lastSeen=r,o.lastSeen=r,i>0)o.tokens.splice(i,1),o.tokens.unshift(s);if(r-this.lastSavedAt>=Do)this.save();return{id:o.id,name:o.name,created:o.created,lastSeen:o.lastSeen,expires:o.expires,token:s}}return}list(){return this.devices.filter((e)=>e.expires>this.now()).map((e)=>({id:e.id,name:e.name,created:e.created,lastSeen:e.lastSeen,expires:e.expires}))}onRevoke(e){return this.revocations.add(e),()=>{this.revocations.delete(e)}}revoke(e){let r=this.devices.length;if(this.devices=this.devices.filter((n)=>n.id!==e),this.devices.length===r)return!1;this.save();for(let n of this.revocations)n(e);return!0}pruneExpired(e){for(let r of this.devices)if(r.tokens=r.tokens.filter((n)=>n.expires>e),r.tokens.length>0)r.expires=Math.max(...r.tokens.map((n)=>n.expires));this.devices=this.devices.filter((r)=>r.tokens.length>0)}tokenCount(){return this.devices.reduce((e,r)=>e+r.tokens.length,0)}evictLeastRecentlyUsed(){let e,r;for(let o of this.devices)for(let i of o.tokens){let s=r&&(i.lastSeen<r.lastSeen||i.lastSeen===r.lastSeen&&i.created<=r.created);if(!r||s)e=o,r=i}if(!e||!r)return;let n=e.id;if(e.tokens=e.tokens.filter((o)=>o!==r),e.tokens.length===0)this.devices=this.devices.filter((o)=>o!==e);else e.expires=Math.max(...e.tokens.map((o)=>o.expires));return n}rotate(){let e=256-256%Et.length,r="";while(r.length<8)for(let n of crypto.getRandomValues(new Uint8Array(16))){if(n>=e||r.length>=8)continue;r+=Et[n%Et.length]}this.code=r,this.expires=this.now()+Mo,this.failures.clear(),this.codeFailures=0}save(){Eo(this.path,JSON.stringify(this.devices,null,2),{mode:384}),ko(this.path,384),this.lastSavedAt=this.now()}}function qo(e){return e.toUpperCase().replace(/[^0-9A-Z]/g,"")}function Cr(e){return new Bun.CryptoHasher("sha256").update(e).digest("hex")}function Wo(e){let r=[...e].sort((o,i)=>i.lastSeen-o.lastSeen||i.created-o.created),n=new Map;for(let o of r){let i=n.get(o.id);if(!i){n.set(o.id,{...o,tokens:o.tokens.map((s)=>({...s}))});continue}for(let s of o.tokens){let a=i.tokens.find((c)=>c.hash===s.hash);if(!a)i.tokens.push({...s});else a.created=Math.min(a.created,s.created),a.lastSeen=Math.max(a.lastSeen,s.lastSeen),a.expires=Math.max(a.expires,s.expires)}i.created=Math.min(i.created,o.created),i.lastSeen=Math.max(i.lastSeen,o.lastSeen),i.expires=Math.max(i.expires,o.expires)}for(let o of n.values())o.tokens.sort((i,s)=>s.lastSeen-i.lastSeen||s.created-i.created);return Array.from(n.values())}function Oo(e,r){if(typeof e!=="object"||e===null)return;let n=e;if(typeof n.id!=="string"||typeof n.name!=="string"||typeof n.created!=="number"||!Number.isFinite(n.created)||typeof n.lastSeen!=="number"||!Number.isFinite(n.lastSeen)||typeof n.expires!=="number"||!Number.isFinite(n.expires))return;let o=[];if(Array.isArray(n.tokens))for(let i of n.tokens){let s=No(i,r);if(s&&!o.some((a)=>a.hash===s.hash))o.push(s)}if(typeof n.tokenHash==="string"&&n.expires>r){let i=[n.tokenHash];if(Array.isArray(n.tokenHashes)){for(let s of n.tokenHashes)if(typeof s==="string"&&s.length>0&&!i.includes(s))i.push(s)}for(let s of i){if(s.length===0||o.some((a)=>a.hash===s))continue;o.push({hash:s,created:n.created,lastSeen:n.lastSeen,expires:n.expires})}}if(o.length===0)return;return{id:n.id,name:n.name,created:n.created,lastSeen:Math.max(n.lastSeen,...o.map((i)=>i.lastSeen)),expires:Math.max(...o.map((i)=>i.expires)),tokens:o}}function No(e,r){if(typeof e!=="object"||e===null)return;let n=e;if(typeof n.hash!=="string"||n.hash.length===0||typeof n.created!=="number"||!Number.isFinite(n.created)||typeof n.lastSeen!=="number"||!Number.isFinite(n.lastSeen)||typeof n.expires!=="number"||!Number.isFinite(n.expires)||n.expires<=r)return;return{hash:n.hash,created:n.created,lastSeen:n.lastSeen,expires:n.expires}}import{chmodSync as Mr,existsSync as Uo,mkdirSync as jo,readFileSync as Ho,renameSync as Bo,writeFileSync as Jo}from"fs";import{join as zo}from"path";var E=()=>se(()=>import("./chunk-h19mfxzq.js"));var Re=()=>se(()=>import("./chunk-9nng543t.js"));var Lr=300000,Dr=64000;class yn{dataDir;models;proxy;path;builtin=new Map;config={providers:[]};constructor(e,r,n){this.dataDir=e;this.models=r;this.proxy=n;this.path=zo(e,"models.json");for(let o of r.getProviders())this.builtin.set(o.id,o)}async load(){if(!Uo(this.path))return;let e=JSON.parse(Ho(this.path,"utf8")),r=Array.isArray(e.providers)?e.providers:[];this.config={providers:[]};for(let n of r){if(!Xo(n))continue;try{_r(n.id,n),this.config.providers.push(n),this.models.setProvider(this.createProvider(n))}catch{}}}list(){return this.config.providers.map(Ct)}async save(e,r){_r(e,r);let n=this.config.providers.find((c)=>c.id===e),o=r.apiKey?.trim()||n?.apiKey,s=zr(r.models).length?r.models:ts(await Ir(r.protocol,Mt(r.baseUrl),o,this.proxy?.createFetch(ur(e)))),a={id:e,name:r.name.trim(),protocol:r.protocol,baseUrl:Mt(r.baseUrl),apiKey:o,models:s,defaultContextWindow:r.defaultContextWindow,defaultMaxTokens:r.defaultMaxTokens};return this.models.setProvider(this.createProvider(a)),this.config.providers=[...this.config.providers.filter((c)=>c.id!==e),a],await this.persist(),Ct(a)}async discover(e){let r=this.config.providers.find((a)=>a.id===e);if(!r)throw new t("no such model provider");let n=zr(r.models),o=new Set(n.map((a)=>a.id)),s=(await Ir(r.protocol,r.baseUrl,r.apiKey,this.proxy?.createFetch(ur(e)))).filter((a)=>!o.has(a.id));return r.models=ts([...n,...s]),this.models.setProvider(this.createProvider(r)),await this.persist(),Ct(r)}async remove(e){if(!this.config.providers.some((o)=>o.id===e))return!1;let n=this.builtin.get(e);if(n)this.models.setProvider(n);else this.models.deleteProvider(e);return this.config.providers=this.config.providers.filter((o)=>o.id!==e),await this.persist(),!0}createProvider(e){let r=Go(e.protocol),n=e.defaultContextWindow??Lr,o=e.defaultMaxTokens??Dr,i=zr(e.models).map((s)=>({id:s.id,name:s.name,api:e.protocol,provider:e.id,baseUrl:e.baseUrl,input:["text","image"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:Boolean(s.reasoning),contextWindow:s.contextWindow??n,maxTokens:s.maxTokens??o,...e.protocol==="openai-completions"||e.protocol==="openai-responses"?{compat:{supportsDeveloperRole:!1}}:{}}));return d({id:e.id,name:e.name,baseUrl:e.baseUrl,auth:{apiKey:{name:`${e.name} API key`,resolve:async()=>({auth:{apiKey:e.apiKey,baseUrl:e.baseUrl},source:e.apiKey?"Basalt settings":"configured endpoint"})}},models:i,api:r})}async persist(){jo(this.dataDir,{recursive:!0});let e=`${this.path}.tmp-${process.pid}`;Jo(e,`${JSON.stringify(this.config,null,2)}
|
|
3
|
-
`,{mode:384}),Mr(e,384),Bo(e,this.path),Mr(this.path,384)}}function Go(e){if(e==="openai-completions")return E();if(e==="openai-responses")return Re();return{stream:Pr,streamSimple:Mi}}function _r(e,r){if(!/^[a-z0-9][a-z0-9._-]{0,63}$/i.test(e))throw new t("provider id must be 1-64 letters, numbers, ., _, or -");if(typeof r.name!=="string"||!r.name.trim())throw new t("provider name is required");if(!Wr(r.protocol))throw new t("unsupported model protocol");if(r.apiKey!==void 0&&typeof r.apiKey!=="string")throw new t("api key must be a string");if(typeof r.models!=="string")throw new t("models must be a string");if(r.defaultContextWindow!==void 0&&(typeof r.defaultContextWindow!=="number"||!Number.isFinite(r.defaultContextWindow)||r.defaultContextWindow<=0))throw new t("default context window must be a positive number");if(r.defaultMaxTokens!==void 0&&(typeof r.defaultMaxTokens!=="number"||!Number.isFinite(r.defaultMaxTokens)||r.defaultMaxTokens<=0))throw new t("default max tokens must be a positive number");Mt(r.baseUrl);let n=zr(r.models);if(n.length===0)return;let o=new Set;for(let i of n){if(!/^\S+$/.test(i.id)||o.has(i.id))throw new t("invalid model list");o.add(i.id)}}function Ct(e){let{defaultContextWindow:r,defaultMaxTokens:n}=e;return{id:e.id,name:e.name,protocol:e.protocol,baseUrl:e.baseUrl,apiKeyConfigured:Boolean(e.apiKey?.trim()),models:zr(e.models).map((o)=>({...o,contextWindow:o.contextWindow??r??Lr,maxTokens:o.maxTokens??n??Dr})),defaultContextWindow:r,defaultMaxTokens:n}}async function Ir(e,r,n,o=fetch){let i=new Headers({accept:"application/json"});if(n)if(e==="anthropic-messages")i.set("x-api-key",n),i.set("anthropic-version","2023-06-01");else i.set("authorization",`Bearer ${n}`);let s;try{s=await o(Fo(r),{headers:i,signal:AbortSignal.timeout(1e4)})}catch{throw new t("\u81EA\u52A8\u83B7\u53D6\u6A21\u578B\u5931\u8D25\uFF1A\u65E0\u6CD5\u8FDE\u63A5\u6A21\u578B\u670D\u52A1")}if(!s.ok)throw new t(`\u81EA\u52A8\u83B7\u53D6\u6A21\u578B\u5931\u8D25\uFF1A\u670D\u52A1\u8FD4\u56DE HTTP ${s.status}`);let a;try{a=await s.json()}catch{throw new t("\u81EA\u52A8\u83B7\u53D6\u6A21\u578B\u5931\u8D25\uFF1A\u670D\u52A1\u8FD4\u56DE\u7684\u4E0D\u662F JSON")}let c=Vo(a);if(c.length===0)throw new t("\u81EA\u52A8\u83B7\u53D6\u6A21\u578B\u5931\u8D25\uFF1A\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6A21\u578B");return c}function Fo(e){let r=e.replace(/\/$/,"");return r.endsWith("/v1")?`${r}/models`:`${r}/v1/models`}function Vo(e){if(!e||typeof e!=="object")return[];let r=e,n=Array.isArray(r.data)?r.data:Array.isArray(r.models)?r.models:[],o=new Set,i=[];for(let s of n){let a=typeof s==="string"?{id:s.trim(),name:s.trim()}:Qo(s);if(!a||!/^\S+$/.test(a.id)||o.has(a.id))continue;o.add(a.id),i.push(a)}return i}function Z(e){if(typeof e==="number"&&Number.isFinite(e)&&e>0)return Math.round(e);if(typeof e==="string"&&e.trim())return Un(e);return}function Qo(e){if(!e||typeof e!=="object")return;let r=e;if(typeof r.id!=="string"||!r.id.trim())return;let n=typeof r.display_name==="string"?r.display_name:typeof r.name==="string"?r.name:r.id,o=Z(r.context_window)??Z(r.context_length)??Z(r.max_context_length)??Z(r.context_window_tokens)??Z(r.top_provider?.context_length),i=Z(r.max_tokens)??Z(r.max_output_tokens)??Z(r.max_completion_tokens)??Z(r.top_provider?.max_completion_tokens),s={id:r.id.trim(),name:n.trim()||r.id.trim()};if(o!==void 0)s.contextWindow=o;if(i!==void 0)s.maxTokens=i;return s}function Mt(e){if(typeof e!=="string")throw new t("base URL is required");let r;try{r=new URL(e.trim())}catch{throw new t("base URL must be a valid http or https URL")}if(r.protocol!=="http:"&&r.protocol!=="https:")throw new t("base URL must use http or https");if(r.username||r.password||r.hash)throw new t("base URL cannot contain credentials or a fragment");return r.toString().replace(/\/$/,"")}function Wr(e){return typeof e==="string"&&na.includes(e)}function Xo(e){if(!e||typeof e!=="object")return!1;let r=e;return typeof r.id==="string"&&typeof r.name==="string"&&Wr(r.protocol)&&typeof r.baseUrl==="string"&&typeof r.models==="string"&&(r.apiKey===void 0||typeof r.apiKey==="string")&&(r.defaultContextWindow===void 0||typeof r.defaultContextWindow==="number")&&(r.defaultMaxTokens===void 0||typeof r.defaultMaxTokens==="number")}import{closeSync as Yo,existsSync as Zo,fsyncSync as ei,mkdirSync as ti,openSync as ri,readFileSync as ni,renameSync as oi,unlinkSync as ii,writeFileSync as si}from"fs";import{networkInterfaces as ai}from"os";import{join as ci}from"path";function Ca(e,r){if(r.host!==void 0){if(!We(r.host)&&!r.insecureHttp)throw Error("\u975E\u672C\u673A\u76D1\u542C\u5FC5\u987B\u663E\u5F0F\u4F20\u5165 --insecure-http\u3002");if(!We(r.host)&&!r.auth&&!r.allowRemoteNoAuth)throw Error("\u975E\u672C\u673A\u76D1\u542C\u4E0D\u80FD\u5173\u95ED\u8BA4\u8BC1\uFF0C\u9664\u975E\u663E\u5F0F\u4F20\u5165 --allow-remote-no-auth\u3002");return r.host}if(e.lanEnabled&&!r.auth)throw Error("\u5DF2\u5F00\u542F\u5C40\u57DF\u7F51\u8BBF\u95EE\uFF0C\u4E0D\u80FD\u4F7F\u7528 --no-auth\uFF1B\u8BF7\u542F\u7528\u8BA4\u8BC1\u6216\u7528 --host 127.0.0.1 \u4EC5\u76D1\u542C\u672C\u673A\u3002");return"127.0.0.1"}function Or(e){if(!e||typeof e!=="object"||Array.isArray(e)||!("lanEnabled"in e)||typeof e.lanEnabled!=="boolean"||Object.keys(e).some((r)=>r!=="lanEnabled"))throw new t("\u7F51\u7EDC\u8BBE\u7F6E\u5FC5\u987B\u53EA\u5305\u542B\u5E03\u5C14\u503C lanEnabled");return{lanEnabled:e.lanEnabled}}function ui(e){let r=e.split(".").map(Number);if(r.length!==4||r.some((n)=>!Number.isInteger(n)||n<0||n>255))return!1;return r[0]===10||r[0]===172&&(r[1]??0)>=16&&(r[1]??0)<=31||r[0]===192&&r[1]===168}function Se(e,r,n=ai()){let o=[],i=new Set;for(let[s,a]of Object.entries(n))for(let c of a??[]){if(c.internal||c.family!=="IPv4"||!ui(c.address)||i.has(c.address))continue;if(e!=="0.0.0.0"&&e!==c.address)continue;i.add(c.address),o.push({interface:s,address:c.address,url:`http://${c.address}:${r}`})}return o}class Cs{dataDir;current={lanEnabled:!1};path;constructor(e){this.dataDir=e;this.path=ci(e,"network.json")}load(){if(!Zo(this.path))return;try{this.current=Or(JSON.parse(ni(this.path,"utf8")))}catch(e){throw Error("\u8BFB\u53D6\u7F51\u7EDC\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u4FEE\u590D\u6570\u636E\u76EE\u5F55\u4E2D\u7684 network.json \u540E\u91CD\u8BD5",{cause:e})}}settings(){return{...this.current}}save(e,r){let n=Or(e);r(n);let o=`${this.path}.tmp-${crypto.randomUUID()}`,i=!1;try{try{ti(this.dataDir,{recursive:!0});let s=ri(o,"wx",384);i=!0;try{si(s,`${JSON.stringify(n,null,2)}
|
|
4
|
-
`),ei(s)}finally{Yo(s)}oi(o,this.path),i=!1}finally{if(i)ii(o)}}catch(s){try{r(this.current)}catch(a){throw Error("\u4FDD\u5B58\u7F51\u7EDC\u914D\u7F6E\u5931\u8D25\uFF0C\u4E14\u76D1\u542C\u72B6\u6001\u56DE\u6EDA\u5931\u8D25\uFF1B\u8BF7\u68C0\u67E5\u6570\u636E\u76EE\u5F55\u540E\u91CD\u542F\u670D\u52A1\u4EE5\u6062\u590D\u4E00\u81F4\u72B6\u6001",{cause:AggregateError([s,a])})}throw Error("\u4FDD\u5B58\u7F51\u7EDC\u914D\u7F6E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6570\u636E\u76EE\u5F55\u7684\u53EF\u7528\u7A7A\u95F4\u548C\u5199\u5165\u6743\u9650\u540E\u91CD\u8BD5",{cause:s})}this.current=n}configuration(e){let r;if(!e.auth)r="\u670D\u52A1\u5668\u4EE5 --no-auth \u542F\u52A8\uFF0C\u8BF7\u542F\u7528\u8BBE\u5907\u8BA4\u8BC1\u540E\u518D\u914D\u7F6E\u5C40\u57DF\u7F51\u8BBF\u95EE\u3002";else if(e.hostOverride!==void 0)r="\u76D1\u542C\u5730\u5740\u7531\u663E\u5F0F --host \u53C2\u6570\u7BA1\u7406\uFF1B\u79FB\u9664\u8BE5\u53C2\u6570\u540E\u53EF\u5728\u8FD9\u91CC\u914D\u7F6E\u3002";let n=e.hostOverride!==void 0;return{settings:this.settings(),current:{port:e.port,remote:n?!We(e.host):e.lanActive},editable:r===void 0,disabledReason:r,addresses:n?Se(e.host,e.port):e.addresses}}}var Nr=()=>({classify:async(e,r,n)=>(await import("./chunk-btza2hna.js")).classify(e,r,n)});var Ue={"openai-decisions":{"classifier:gpt-6-luna":{type:"classifier",id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-decisions",provider:"openai",baseUrl:"https://api.openai.com/v1",input:["text","image"],cost:{input:0.1,output:0,cacheRead:0,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:0.2,output:0,cacheRead:0,cacheWrite:0}]},contextWindow:922000}},"openai-responses":{"chat:gpt-4":{id:"gpt-4",name:"GPT-4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text"],cost:{input:30,output:60,cacheRead:0,cacheWrite:0},contextWindow:8192,maxTokens:8192,compat:{supportsStrictMode:!0},type:"chat"},"chat:gpt-4-turbo":{id:"gpt-4-turbo",name:"GPT-4 Turbo",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:10,output:30,cacheRead:0,cacheWrite:0},contextWindow:128000,maxTokens:4096,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2,output:8,cacheRead:0.5,cacheWrite:0},contextWindow:1047576,maxTokens:32768,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4.1-mini":{id:"gpt-4.1-mini",name:"GPT-4.1 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:0.4,output:1.6,cacheRead:0.1,cacheWrite:0},contextWindow:1047576,maxTokens:32768,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4.1-nano":{id:"gpt-4.1-nano",name:"GPT-4.1 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:0.1,output:0.4,cacheRead:0.025,cacheWrite:0},contextWindow:1047576,maxTokens:32768,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4o":{id:"gpt-4o",name:"GPT-4o",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128000,maxTokens:16384,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4o-2024-05-13":{id:"gpt-4o-2024-05-13",name:"GPT-4o (2024-05-13)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:5,output:15,cacheRead:0,cacheWrite:0},contextWindow:128000,maxTokens:4096,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4o-2024-08-06":{id:"gpt-4o-2024-08-06",name:"GPT-4o (2024-08-06)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128000,maxTokens:16384,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4o-2024-11-20":{id:"gpt-4o-2024-11-20",name:"GPT-4o (2024-11-20)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:2.5,output:10,cacheRead:1.25,cacheWrite:0},contextWindow:128000,maxTokens:16384,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-4o-mini":{id:"gpt-4o-mini",name:"GPT-4o mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:0.15,output:0.6,cacheRead:0.075,cacheWrite:0},contextWindow:128000,maxTokens:16384,compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5":{id:"gpt-5",name:"GPT-5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:0.125,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5-chat-latest":{id:"gpt-5-chat-latest",name:"GPT-5 Chat Latest",api:"openai-responses",baseUrl:"https://api.openai.com/v1",provider:"openai",reasoning:!1,input:["text","image"],cost:{input:1.25,output:10,cacheRead:0.125,cacheWrite:0},contextWindow:128000,maxTokens:16384,thinkingLevelMap:{off:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.25,output:2,cacheRead:0.025,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5-nano":{id:"gpt-5-nano",name:"GPT-5 Nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.05,output:0.4,cacheRead:0.005,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5-pro":{id:"gpt-5-pro",name:"GPT-5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:120,cacheRead:0,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:null,medium:null,high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.1":{id:"gpt-5.1",name:"GPT-5.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.25,output:10,cacheRead:0.125,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.2":{id:"gpt-5.2",name:"GPT-5.2",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.2-chat-latest":{id:"gpt-5.2-chat-latest",name:"GPT-5.2 Chat",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:128000,maxTokens:16384,thinkingLevelMap:{off:null,minimal:null,low:null,medium:"medium",high:null,xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.2-pro":{id:"gpt-5.2-pro",name:"GPT-5.2 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:21,output:168,cacheRead:0,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:null,medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-chat-latest":{id:"gpt-5.3-chat-latest",name:"GPT-5.3 Chat (latest)",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!1,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:128000,maxTokens:16384,thinkingLevelMap:{off:null,xhigh:"xhigh"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-codex-spark":{id:"gpt-5.3-codex-spark",name:"GPT-5.3 Codex Spark",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:128000,maxTokens:32000,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:0.25,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:5,output:22.5,cacheRead:0.5,cacheWrite:0}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.75,output:4.5,cacheRead:0.075,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.2,output:1.25,cacheRead:0.02,cacheWrite:0},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-pro":{id:"gpt-5.4-pro",name:"GPT-5.4 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:60,output:270,cacheRead:0,cacheWrite:0}]},contextWindow:1050000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:null,medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:0.5,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.5-pro":{id:"gpt-5.5-pro",name:"GPT-5.5 Pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:30,output:180,cacheRead:0,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:60,output:270,cacheRead:0,cacheWrite:0}]},contextWindow:1050000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:null,medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.2,output:1.2,cacheRead:0.02,cacheWrite:0.25,tiers:[{inputTokensAbove:272000,input:0.4,output:1.8,cacheRead:0.04,cacheWrite:0.5}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:0.4,cacheWrite:5,tiers:[{inputTokensAbove:272000,input:8,output:30,cacheRead:0.8,cacheWrite:10}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:0.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:18,cacheRead:0.4,cacheWrite:5}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272000,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:0.1,output:0.5,cacheRead:0.01,cacheWrite:0.125,tiers:[{inputTokensAbove:272000,input:0.2,output:0.75,cacheRead:0.02,cacheWrite:0.25}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:15,cacheRead:0.4,cacheWrite:5}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:15,cacheRead:0.2,cacheWrite:5}]},contextWindow:272000,maxTokens:128000,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsOpenAIGrammarTools:!0,supportsAdditionalTools:!0,supportsToolSearch:!0,supportsMidConvoSystemMessages:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-daybreak-blue-latest":{id:"gpt-daybreak-blue-latest",name:"Daybreak Blue",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:0.4,cacheWrite:5,tiers:[{inputTokensAbove:272000,input:8,output:30,cacheRead:0.8,cacheWrite:10}]},contextWindow:1050000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-daybreak-red-latest":{id:"gpt-daybreak-red-latest",name:"Daybreak Red",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:12.5,output:75,cacheRead:1.25,cacheWrite:15.625},contextWindow:400000,maxTokens:128000,thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsStrictMode:!0,supportsExplicitPromptCacheMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-realtime-2.1":{id:"gpt-realtime-2.1",name:"GPT-Realtime-2.1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:4,output:24,cacheRead:0.4,cacheWrite:0},contextWindow:128000,maxTokens:32000,thinkingLevelMap:{off:null,minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:o1":{id:"o1",name:"o1",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:15,output:60,cacheRead:7.5,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:o1-pro":{id:"o1-pro",name:"o1-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:150,output:600,cacheRead:0,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:o3":{id:"o3",name:"o3",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:2,output:8,cacheRead:0.5,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:o3-mini":{id:"o3-mini",name:"o3-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text"],cost:{input:1.1,output:4.4,cacheRead:0.55,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},type:"chat"},"chat:o3-pro":{id:"o3-pro",name:"o3-pro",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:20,output:80,cacheRead:0,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:o4-mini":{id:"o4-mini",name:"o4-mini",api:"openai-responses",provider:"openai",baseUrl:"https://api.openai.com/v1",reasoning:!0,input:["text","image"],cost:{input:1.1,output:4.4,cacheRead:0.275,cacheWrite:0},contextWindow:200000,maxTokens:1e5,thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsStrictMode:!0},inputLimits:{maxRequestBytes:536870912,images:{maxPerRequest:1500,resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};var Ur=h("openai",Ue),Va=f("openai",Ue),jr=g("openai",Ue);function so(){return d({id:"openai",name:"OpenAI",baseUrl:"https://api.openai.com/v1",auth:{apiKey:b("OpenAI API key",["OPENAI_API_KEY"]),oauth:fe({name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",load:Gs})},models:[...Object.values(Ur),...Object.values(jr)],filterAllModels:(e,r)=>r?.type==="oauth"?e.filter((n)=>!Ge(n,"classifier")):e,api:Re(),classifiers:{"openai-decisions":Nr()}})}var pi=2000,di=1e4,Hr="openai";function ao(){let e=so(),r=e.auth.oauth;if(!r)throw Error("OpenAI SDK \u672A\u63D0\u4F9B ChatGPT \u8BA2\u9605\u767B\u5F55\uFF0C\u8BF7\u68C0\u67E5\u4F9D\u8D56\u5B89\u88C5");return d({id:It,name:"ChatGPT \u8BA2\u9605",baseUrl:e.baseUrl,auth:{oauth:r},models:e.getModels().filter((n)=>n.api==="openai-responses").map((n)=>({...n,provider:It})),api:e})}function hi(e){if(typeof e!=="string")return;try{let r=Tt(e);for(let n of[r.name,r.preferred_username,r.email])if(typeof n==="string"&&n.trim())return n.trim()}catch{return}return}class bn{models;store;providerID;pending;transitions=Promise.resolve();closed=!1;lastError;constructor(e,r,n=It){this.models=e;this.store=r;this.providerID=n}async status(){let e=this.pending,r=e?{providerID:Hr,connected:!1,pending:!0,authorizeURL:e.state.authorizeURL,instructions:e.state.instructions,awaitingInput:e.state.awaitingInput,error:e.state.error}:{providerID:Hr,connected:!1,pending:!1,error:this.lastError};try{let n=await this.store.read(this.providerID),o=n?.type==="oauth",i=o?hi(n.idToken):void 0;return{...r,connected:o,...i?{displayName:i}:{}}}catch(n){throw Error("\u8BFB\u53D6\u767B\u5F55\u51ED\u636E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6570\u636E\u76EE\u5F55\u7684\u53EF\u7528\u7A7A\u95F4\u4E0E\u5199\u5165\u6743\u9650\u540E\u91CD\u8BD5",{cause:n})}}async start(e){let r=await this.transition(async()=>{if(this.closed)throw new t("\u767B\u5F55\u670D\u52A1\u6B63\u5728\u5173\u95ED");let o=this.models.getProvider(this.providerID);if(!o)throw new t("OpenAI provider is unavailable");let i=o.auth.oauth;if(!i)throw new t(`${o.name} does not support oauth login`);let s=this.pending;if(s)s.state.controller.abort(),await Br(s.done);let a=new AbortController,c=Promise.withResolvers(),u=Promise.withResolvers(),l={controller:a,signal:a.signal,awaitingInput:!1,closed:!1,authorizeReady:c.resolve},p={state:l,done:u.promise,ready:c.promise};this.pending=p,this.lastError=void 0;let w={signal:l.signal,prompt:(A)=>this.handlePrompt(l,A),notify:(A)=>this.handleEvent(l,A)};return(async()=>{let A=await i.login(w,{getDeviceId:()=>this.store.deviceId(),agentName:e});l.signal.throwIfAborted();try{await this.store.modify(this.providerID,async()=>A,{signal:l.signal})}catch(C){if(l.signal.aborted)throw C;throw Error("\u4FDD\u5B58\u767B\u5F55\u51ED\u636E\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u6570\u636E\u76EE\u5F55\u7684\u53EF\u7528\u7A7A\u95F4\u4E0E\u5199\u5165\u6743\u9650\u540E\u91CD\u8BD5",{cause:C})}})().catch((A)=>{if(!l.signal.aborted)l.error=A instanceof Error?A.message:String(A)}).finally(()=>{if(l.closed=!0,l.cancelPrompt?.(new DOMException("\u767B\u5F55\u6D41\u7A0B\u5DF2\u7ED3\u675F","AbortError")),l.authorizeURL=void 0,l.instructions=void 0,this.pending===p)this.lastError=l.error,this.pending=void 0;u.resolve()}),p});await mi(r);let n=await this.status();if(!n.pending&&n.error)throw new t(n.error);return n}transition(e){let r=this.transitions.then(e);return this.transitions=r.then(()=>{return},()=>{return}),r}async manualInput(e){let r=this.pending;if(!r)throw new t("\u6CA1\u6709\u8FDB\u884C\u4E2D\u7684\u767B\u5F55\u6D41\u7A0B");if(!r.state.awaitingInput||!r.state.resolvePrompt)throw new t("\u5F53\u524D\u767B\u5F55\u6D41\u7A0B\u4E0D\u63A5\u53D7\u624B\u52A8\u8F93\u5165");r.state.resolvePrompt(e)}abort(){let e=this.pending;if(!e)return;e.state.controller.abort()}logout(){return this.transition(async()=>{let e=this.pending;if(e)e.state.controller.abort(),await Br(e.done);await this.models.logout(this.providerID)})}async close(){this.closed=!0,await this.transitions;let e=this.pending;if(!e)return;e.state.controller.abort(),await e.done}handlePrompt(e,r){if(e.signal.aborted||e.closed)return Promise.reject(e.signal.reason??new DOMException("\u767B\u5F55\u6D41\u7A0B\u5DF2\u7ED3\u675F","AbortError"));if(r.signal?.aborted)return Promise.reject(r.signal.reason);if(r.type!=="manual_code"){let n=`\u767B\u5F55\u6D41\u7A0B\u8BF7\u6C42\u4E86\u4E0D\u652F\u6301\u7684\u4EA4\u4E92\u7C7B\u578B\uFF1A${r.type}`;return e.error=n,e.controller.abort(),Promise.reject(Error(n))}return e.awaitingInput=!0,e.instructions=r.message,new Promise((n,o)=>{let i=()=>{if(e.signal.removeEventListener("abort",a),r.signal?.removeEventListener("abort",c),e.resolvePrompt=void 0,e.cancelPrompt=void 0,e.awaitingInput=!1,e.instructions===r.message)e.instructions=void 0},s=(u)=>{i(),o(u)},a=()=>s(e.signal.reason),c=()=>s(r.signal?.reason);if(e.resolvePrompt=(u)=>{i(),n(u)},e.cancelPrompt=s,e.signal.addEventListener("abort",a,{once:!0}),r.signal?.addEventListener("abort",c,{once:!0}),e.signal.aborted)a();else if(r.signal?.aborted)c()})}handleEvent(e,r){if(e.signal.aborted||e.closed)return;if(r.type==="auth_url"){e.authorizeURL=r.url,e.instructions=r.instructions??e.instructions,e.authorizeReady();return}if(r.type==="progress"){e.instructions=r.message;return}if(r.type==="info")e.instructions=r.message}}async function Br(e){let r;try{await Promise.race([e,new Promise((n,o)=>{r=setTimeout(()=>o(new t("\u4E0A\u6B21\u767B\u5F55\u5C1A\u672A\u9000\u51FA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")),pi)})])}finally{clearTimeout(r)}}async function mi(e){let r;try{await Promise.race([e.done,e.ready,new Promise((n)=>{r=setTimeout(n,di)})])}finally{clearTimeout(r)}}function je(e,r,n,o,i){let s=!0,a=Promise.resolve(),c,u={id:crypto.randomUUID(),...r,sessions:n,subscriptions:n,send(l){if(!s)return;if(u.expires!==void 0&&Date.now()>=u.expires){u.close(4401,"authentication expired");return}o(l)},close(l,p){s=!1,e.connections.delete(u.id),i(l,p)},enqueue(l){let p=a.then(async()=>{if(!s)throw new m("connection closed");await l()});return a=p.catch(()=>{}),p},dispose(){if(c)return c;s=!1,e.connections.delete(u.id);for(let l of n){let p=e.get(l);if(p)e.plugins.notify("session.close",p,u)}return n.clear(),c=e.plugins.idle(),c}};return e.connections.set(u.id,u),u}async function Ae(e,r,n){if(!e.connections.has(r.id))throw new m("connection closed");if(typeof n.sessionID!=="string"||!n.sessionID)throw new t("sessionID is required");if(n.type==="subscribe"){let o=e.get(n.sessionID);if(!o)throw new m("no such session");let i=e.store.truncationEpoch(o.id),s=n.after??0;if(!Number.isSafeInteger(s)||s<0||n.truncationEpoch!==void 0&&(!Number.isSafeInteger(n.truncationEpoch)||n.truncationEpoch<0))throw new t("invalid subscription cursor");let a=!r.subscriptions.has(o.id);if(r.subscriptions.add(o.id),a)e.plugins.notify("session.open",o,r);await e.plugins.idle();let c=(n.truncationEpoch??0)!==i;if(c)r.send({type:"truncated",sessionID:o.id,after:0,truncationEpoch:i});let u=c?0:s,l=u===0&&n.tail&&Number.isSafeInteger(n.tail)&&n.tail>0?o.replayEntries(Math.min(n.tail,2000)):o.entries(u);for(let p of l)r.send({type:"entry",sessionID:o.id,entry:p});if(r.send({type:"session",session:o.info(),truncationEpoch:i}),o.draft)r.send({type:"draft",sessionID:o.id,parts:o.draft});return}if(n.type==="unsubscribe"&&r.subscriptions.delete(n.sessionID)){let o=e.get(n.sessionID);if(o)e.plugins.notify("session.close",o,r);await e.plugins.idle()}}var fi=["connection","upgrade","sec-websocket-key","sec-websocket-version","sec-websocket-extensions"];function $r(e){let r=new URL(e),n=Number(r.port)+1e4,o=(a,c)=>{let u=new Headers(a.headers);if(c.startsWith("/api/"))return u;let l=u.get("host");if(l)u.set("x-forwarded-host",l);if(u.set("host",r.host),u.has("origin"))u.set("origin",r.origin);return u},i={hostname:"127.0.0.1",idleTimeout:0,fetch(a,c){let u=new URL(a.url),l=o(a,u.pathname),p=`${r.origin}${u.pathname}${u.search}`;if(a.headers.get("upgrade")?.toLowerCase()==="websocket"){for(let S of fi)l.delete(S);let w={url:p.replace(/^http/,"ws"),headers:l,pending:[]};if(c.upgrade(a,{data:w}))return;return new Response("expected websocket",{status:400})}return fetch(p,{method:a.method,headers:l,body:a.body,redirect:"manual",decompress:!1})},websocket:{open(a){let c=new WebSocket(a.data.url,{headers:Object.fromEntries(a.data.headers)});c.binaryType="arraybuffer",a.data.upstream=c,c.onopen=()=>{for(let u of a.data.pending.splice(0))c.send(u)},c.onmessage=(u)=>{a.send(u.data)},c.onclose=(u)=>{a.close(u.code===1005||u.code===1006?1011:u.code,u.reason)}},message(a,c){let u=a.data.upstream;if(u?.readyState===WebSocket.OPEN)u.send(c);else a.data.pending.push(c)},close(a,c,u){if(c===1000||c>=3000&&c<=4999)a.data.upstream?.close(c,u);else a.data.upstream?.close()}}},s;try{s=Bun.serve({...i,port:n<=65535?n:0})}catch{s=Bun.serve({...i,port:0})}return{port:s.port,stop(){s.stop(!0)}}}var gi=["x-forwarded-for","x-forwarded-host","forwarded","cf-connecting-ip","x-real-ip"];function _t(e){let r=e.headers.get("host");if(!r)return!1;try{return We(new URL(`http://${r}`).hostname)}catch{return!1}}function ce(e,r){return Lt(e.requestIP(r))&&_t(r)&&!gi.some((n)=>r.headers.has(n))}function Lt(e){if(!e)return!1;return e==="127.0.0.1"||e==="::1"||e==="::ffff:127.0.0.1"}function x(e,r,n={}){return async(o)=>{let i=o.req.raw;if(await e.accessDenied?.(i))return new Response(null,{status:403});if(!e.allowed(i.headers.get("origin"),i))return R(o,"unauthorized","origin not allowed",403);if(!n.public&&e.authEnabled&&!e.internalRequest?.(i)&&!e.auth.verify(z(i)))return R(o,"unauthorized","missing or invalid token",401);try{return await r(o)}catch(s){if(s instanceof mt)return R(o,"archived",s.message,409);if(s instanceof ee)return R(o,"busy",s.message,409);if(s instanceof t)return R(o,"bad_request",s.message,400);if(s instanceof m)return R(o,"not_found",s.message,404);if(s instanceof SyntaxError)return R(o,"bad_request","invalid JSON",400);if(console.error(s),n.public)return R(o,"internal","internal server error",500);return R(o,"internal",s instanceof Error?s.message:String(s),500)}}}async function P(e){let r=await e.req.json();if(!r||typeof r!=="object"||Array.isArray(r))throw new t("expected a JSON object");return r}function L(e,r){let n=e.req.param(r);if(!n)throw new t(`${r} is required`);return n}function v(e,r,n=200){return Response.json(r,{status:n,headers:Te(e)})}function R(e,r,n,o){return v(e,{error:{code:r,message:n}},o)}function Jr(e,r){let n=e.req.raw;if(!r.allowed(n.headers.get("origin"),n))return new Response(null,{status:403});let o=Te(e);if(o.set("access-control-allow-methods","GET, POST, PUT, PATCH, DELETE, OPTIONS"),o.set("access-control-allow-headers",n.headers.get("access-control-request-headers")?.trim()||"authorization, content-type"),o.append("vary","access-control-request-headers"),o.set("access-control-max-age","600"),n.headers.get("access-control-request-private-network")==="true")o.set("access-control-allow-private-network","true");return new Response(null,{status:204,headers:o})}function z(e){return e.headers.get("authorization")?.replace(/^Bearer\s+/i,"")}function Te(e){let r=new Headers,n=e.req.raw.headers.get("origin");if(n)r.set("access-control-allow-origin",n),r.set("vary","origin");return r}var Kr=Symbol();var Gr=(e,r)=>new Response(e,{headers:{"Content-Type":r.replace(/^[^;]+/,(n)=>n.toLowerCase())}}).formData();var yi=1e4,He=(e)=>("headers"in e),Qr=async(e,r=Object.create(null))=>{let{all:n=!1,dot:o=!1}=r,i=(He(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();if(i==="multipart/form-data"||i==="application/x-www-form-urlencoded")return wi(e,{all:n,dot:o});return{}};async function wi(e,r){if(!He(e)&&e.bodyCache.formData)return Fr(await e.bodyCache.formData,r);let n=He(e)?e.headers:e.raw.headers,o=await e.arrayBuffer(),i=Gr(o,n.get("Content-Type")||"");if(!He(e))e.bodyCache.formData=i;let s=await i;if(s)return Fr(s,r);return{}}function Fr(e,r){let n=Object.create(null),o={count:0};if(e.forEach((i,s)=>{if(!(r.all||s.endsWith("[]")))n[s]=i;else vi(n,s,i)}),r.dot)Object.entries(n).forEach(([i,s])=>{if(i.includes("."))bi(n,i,s,o),delete n[i]});return n}var vi=(e,r,n)=>{if(e[r]!==void 0)if(Array.isArray(e[r]))e[r].push(n);else e[r]=[e[r],n];else if(!r.endsWith("[]"))e[r]=n;else e[r]=[n]},bi=(e,r,n,o)=>{if(/(?:^|\.)__proto__\./.test(r))return;let i=e,s=r.split(".",34);if(s.length>33)Vr();s.forEach((a,c)=>{if(c===s.length-1)i[a]=n;else{if(!i[a]||typeof i[a]!=="object"||Array.isArray(i[a])||i[a]instanceof File){if(o.count++>=yi)Vr();i[a]=Object.create(null)}i=i[a]}})},Vr=()=>{throw Error("Nesting limit exceeded")};var qt=(e)=>{let r=e.split("/");if(r[0]==="")r.shift();return r},Xr=(e)=>{let{groups:r,path:n}=xi(e),o=qt(n);return Si(o,r)},xi=(e)=>{let r=[];return e=e.replace(/\{[^}]+\}/g,(n,o)=>{let i=`@${o}`;return r.push([i,n]),i}),{groups:r,path:e}},Si=(e,r)=>{for(let n=r.length-1;n>=0;n--){let[o]=r[n];for(let i=e.length-1;i>=0;i--)if(e[i].includes(o)){e[i]=e[i].replace(o,r[n][1]);break}}return e},Be={},Yr=(e,r)=>{if(e==="*")return"*";let n=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(n){let o=`${e}#${r}`;if(!Be[o])if(n[2])Be[o]=r&&r[0]!==":"&&r[0]!=="*"?[o,n[1],new RegExp(`^${n[2]}(?=/${r})`)]:[e,n[1],new RegExp(`^${n[2]}$`)];else Be[o]=[e,n[1],!0];return Be[o]}return null},Zr=(e,r)=>{try{return r(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,(n)=>{try{return r(n)}catch{return n}})}},Ri=(e)=>Zr(e,decodeURI),Wt=(e)=>{let r=e.url,n=r.indexOf("/",r.indexOf(":")+4),o=n;for(;o<r.length;o++){let i=r.charCodeAt(o);if(i===37){let s=r.indexOf("?",o),a=r.indexOf("#",o),c=s===-1?a===-1?void 0:a:a===-1?s:Math.min(s,a),u=r.slice(n,c);return Ri(u.includes("%25")?u.replace(/%25/g,"%2525"):u)}else if(i===63||i===35)break}return r.slice(n,o)};var en=(e)=>{let r=Wt(e);return r.length>1&&r.at(-1)==="/"?r.slice(0,-1):r},ne=(e,r,...n)=>{if(n.length)r=ne(r,...n);return`${e?.[0]==="/"?"":"/"}${e}${r==="/"?"":`${e?.at(-1)==="/"?"":"/"}${r?.[0]==="/"?r.slice(1):r}`}`},$e=(e)=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let r=e.split("/"),n=[],o="";return r.forEach((i)=>{if(i!==""&&!/\:/.test(i))o+="/"+i;else if(/\:/.test(i))if(i.charCodeAt(i.length-1)===63){if(n.length===0&&o==="")n.push("/");else n.push(o);let s=i.slice(0,-1);o+="/"+s,n.push(o)}else o+="/"+i}),n.filter((i,s,a)=>a.indexOf(i)===s)},Je=(e)=>e.indexOf("%")!==-1?Zr(e,Ai):e,Dt=(e)=>{if(e.indexOf("+")!==-1)e=e.replace(/\+/g," ");return Je(e)},tn=(e,r,n)=>{let o=e.indexOf("#",8);if(o!==-1)e=e.slice(0,o);let i;if(!n&&r&&r.indexOf("%")===-1&&r.indexOf("+")===-1){let c=e.indexOf("?",8);if(c===-1)return;if(!e.startsWith(r,c+1))c=e.indexOf(`&${r}`,c+1);while(c!==-1){let u=e.charCodeAt(c+r.length+1);if(u===61){let l=c+r.length+2,p=e.indexOf("&",l);return Dt(e.slice(l,p===-1?void 0:p))}else if(u==38||isNaN(u))return"";c=e.indexOf(`&${r}`,c+1)}if(i=/[%+]/.test(e),!i)return}let s=Object.create(null);i??=/[%+]/.test(e);let a=e.indexOf("?",8);while(a!==-1){let c=e.indexOf("&",a+1),u=e.indexOf("=",a);if(u>c&&c!==-1)u=-1;let l=e.slice(a+1,u===-1?c===-1?void 0:c:u);if(i)l=Dt(l);if(a=c,l==="")continue;let p;if(u===-1)p="";else if(p=e.slice(u+1,c===-1?void 0:c),i)p=Dt(p);if(n){if(!(s[l]&&Array.isArray(s[l])))s[l]=[];s[l].push(p)}else s[l]??=p}return r?s[r]:s},rn=tn,nn=(e,r)=>tn(e,r,!0),Ai=decodeURIComponent;var on=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(e,r="/",n=[[]]){this.raw=e,this.path=r,this.#e=n}param(e){return e?this.#r(e):this.#i()}#r(e){let r=this.#e[0][this.routeIndex]?.[1][e],n=this.#n(r);return n&&Je(n)}#i(){let e={},r=Object.keys(this.#e[0][this.routeIndex]?.[1]??{});for(let n of r){let o=this.#n(this.#e[0][this.routeIndex][1][n]);if(o!==void 0)e[n]=Je(o)}return e}#n(e){return this.#e[1]?this.#e[1][e]:e}query(e){return rn(this.url,e)}queries(e){return nn(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let r=Object.create(null);return this.raw.headers.forEach((n,o)=>{r[o]=n}),r}async parseBody(e){return Qr(this,e)}#o=(e)=>{let{bodyCache:r,raw:n}=this,o=r[e];if(o)return o;for(let i in r)return r[i].then((s)=>{if(i==="json")s=JSON.stringify(s);let a=i==="formData"?void 0:n.headers.get("content-type");return new Response(s,{headers:a?{"Content-Type":a}:void 0})[e]()});return r[e]=n[e]()};json(){return this.#o("text").then((e)=>JSON.parse(e))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then((e)=>new Uint8Array(e))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(e,r){(this.#t??={})[e]=r}valid(e){return this.#t?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[Kr](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,e]])=>e)}get routePath(){return this.#e[0].map(([[,e]])=>e)[this.routeIndex].path}};var sn={Stringify:1,BeforeStream:2,Stream:3},Ti=(e,r)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=r,n};var Ot=async(e,r,n,o,i)=>{if(typeof e==="object"&&!(e instanceof String)){if(!(e instanceof Promise))e=e.toString();if(e instanceof Promise)e=await e}let s=e.callbacks;if(!s?.length)return Promise.resolve(e);if(i)i[0]+=e;else i=[e];let a=Promise.all(s.map((c)=>c({phase:r,buffer:i,context:o}))).then((c)=>Promise.all(c.filter(Boolean).map((u)=>Ot(u,r,!1,o,i))).then(()=>i[0]));if(n)return Ti(await a,s);else return a};var ki="text/plain; charset=UTF-8",Nt=(e,r)=>({"Content-Type":e,...r}),ke=(e,r)=>new Response(e,r),Ut=class{#t;#e;env={};#r;finalized=!1;error;#i;#n;#o;#l;#c;#u;#a;#p;#d;constructor(e,r){if(this.#t=e,r)this.#n=r.executionCtx,this.env=r.env,this.#u=r.notFoundHandler,this.#d=r.path,this.#p=r.matchResult}get req(){return this.#e??=new on(this.#t,this.#d,this.#p),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;else throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;else throw Error("This context has no ExecutionContext")}get res(){return this.#o||=ke(null,{headers:this.#a??=new Headers})}set res(e){if(this.#o&&e){e=ke(e.body,e);for(let[r,n]of this.#o.headers.entries()){if(r==="content-type")continue;if(r==="set-cookie"){let o=this.#o.headers.getSetCookie();e.headers.delete("set-cookie");for(let i of o)e.headers.append("set-cookie",i)}else e.headers.set(r,n)}}this.#o=e,this.finalized=!0}render=(...e)=>(this.#c??=(r)=>this.html(r),this.#c(...e));setLayout=(e)=>this.#l=e;getLayout=()=>this.#l;setRenderer=(e)=>{this.#c=e};header=(e,r,n)=>{if(this.finalized)this.#o=ke(this.#o.body,this.#o);let o=this.#o?this.#o.headers:this.#a??=new Headers;if(r===void 0)o.delete(e);else if(n?.append)o.append(e,r);else o.set(e,r)};status=(e)=>{this.#i=e};set=(e,r)=>{this.#r??=new Map,this.#r.set(e,r)};get=(e)=>this.#r?this.#r.get(e):void 0;get var(){if(!this.#r)return{};return Object.fromEntries(this.#r)}#s(e,r,n){let o=this.#o?new Headers(this.#o.headers):this.#a;if(typeof r==="object"&&r.headers){o??=new Headers;for(let[s,a]of new Headers(r.headers))if(s==="set-cookie")o.append(s,a);else o.set(s,a)}if(n){if(!o){let s=0;for(let a in n)if(++s>1||typeof n[a]!=="string"){o=new Headers;break}}if(o)for(let s in n){let a=n[s];if(typeof a==="string")o.set(s,a);else{o.delete(s);for(let c of a)o.append(s,c)}}}let i=typeof r==="number"?r:r?.status??this.#i;return ke(e,{status:i,headers:o??n})}newResponse=(...e)=>this.#s(...e);body=(e,r,n)=>this.#s(e,r,n);text=(e,r,n)=>!this.#a&&!this.#i&&!r&&!n&&!this.finalized?new Response(e):this.#s(e,r,Nt(ki,n));json=(e,r,n)=>this.#s(JSON.stringify(e),r,Nt("application/json",n));html=(e,r,n)=>{let o=(i)=>this.#s(i,r,Nt("text/html; charset=UTF-8",n));return typeof e==="object"?Ot(e,sn.Stringify,!1,{}).then(o):o(e)};redirect=(e,r)=>{let n=String(e);return this.header("Location",!/[^\x00-\xFF]/.test(n)?n:encodeURI(n)),this.newResponse(null,r??302)};notFound=()=>(this.#u??=()=>ke(),this.#u(this))};var jt=(e,r,n)=>(o,i)=>{let s=-1;return a(0);async function a(c){if(c<=s)throw Error("next() called multiple times");s=c;let u,l=!1,p;if(e[c])p=e[c][0][0],o.req.routeIndex=c;else p=c===e.length&&i||void 0;if(p)try{u=await p(o,()=>a(c+1))}catch(w){if(w instanceof Error&&r)o.error=w,u=await r(w,o),l=!0;else throw w}else if(o.finalized===!1&&n)u=await n(o);if(u&&(o.finalized===!1||l))o.res=u;return o}};var an=["get","post","put","delete","options","patch","query"],ze="Can not add a route since the matcher is already built.",Ke=class extends Error{};var cn="__COMPOSED_HANDLER";var Pi=(e)=>e.text("404 Not Found",404),un=(e,r)=>{if("getResponse"in e){let n=e.getResponse();return r.newResponse(n.body,n)}return console.error(e),r.text("Internal Server Error",500)},ln=class e{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(r={}){[...an,"all"].forEach((i)=>{this[i]=(s,...a)=>{let c=i.toUpperCase();if(typeof s==="string")this.#t=s;else this.#i(c,this.#t,s);return a.forEach((u)=>{this.#i(c,this.#t,u)}),this}}),this.on=(i,s,...a)=>{for(let c of[s].flat()){this.#t=c;for(let u of[i].flat()){let l=u.toUpperCase();for(let p of a)this.#i(l,this.#t,p)}}return this},this.use=(i,...s)=>{if(typeof i==="string")this.#t=i;else this.#t="*",s.unshift(i);return s.forEach((a)=>{this.#i("ALL",this.#t,a)}),this};let{strict:n,...o}=r;Object.assign(this,o),this.getPath=n??!0?r.getPath??Wt:en}#e(){let r=new e({router:this.router,getPath:this.getPath});return r.errorHandler=this.errorHandler,r.#r=this.#r,r.routes=this.routes,r}#r=Pi;errorHandler=un;route(r,n){let o=this.basePath(r);return n.routes.map((i)=>{let s;if(n.errorHandler===un)s=i.handler;else s=async(a,c)=>(await jt([],n.errorHandler)(a,()=>i.handler(a,c))).res,s[cn]=i.handler;o.#i(i.method,i.path,s,i.basePath)}),this}basePath(r){let n=this.#e();return n._basePath=ne(this._basePath,r),n}onError=(r)=>(this.errorHandler=r,this);notFound=(r)=>(this.#r=r,this);mount(r,n,o){let i,s;if(o)if(typeof o==="function")s=o;else if(s=o.optionHandler,o.replaceRequest===!1)i=(u)=>u;else i=o.replaceRequest;let a=s?(u)=>{let l=s(u);return Array.isArray(l)?l:[l]}:(u)=>{let l=void 0;try{l=u.executionCtx}catch{}return[u.env,l]};i||=(()=>{let u=ne(this._basePath,r),l=u==="/"?0:u.length;return(p)=>{let w=new URL(p.url);return w.pathname=this.getPath(p).slice(l)||"/",new Request(w,p)}})();let c=async(u,l)=>{let p=await n(i(u.req.raw),...a(u));if(p)return p;await l()};return this.#i("ALL",ne(r,"*"),c),this}#i(r,n,o,i){n=ne(this._basePath,n);let s={basePath:i!==void 0?ne(this._basePath,i):this._basePath,path:n,method:r,handler:o};this.router.add(r,n,[o,s]),this.routes.push(s)}#n(r,n){if(r instanceof Error)return this.errorHandler(r,n);throw r}#o(r,n,o,i){if(i==="HEAD")return(async()=>new Response(null,await this.#o(r,n,o,"GET")))();let s=this.getPath(r,{env:o}),a=this.router.match(i,s),c=new Ut(r,{path:s,matchResult:a,env:o,executionCtx:n,notFoundHandler:this.#r});if(a[0].length===1){let l;try{l=a[0][0][0][0](c,async()=>{c.res=await this.#r(c)})}catch(p){return this.#n(p,c)}return l instanceof Promise?l.then((p)=>p||(c.finalized?c.res:this.#r(c))).catch((p)=>this.#n(p,c)):l??this.#r(c)}let u=jt(a[0],this.errorHandler,this.#r);return(async()=>{try{let l=await u(c);if(!l.finalized)throw Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,c)}})()}fetch=(r,...n)=>this.#o(r,n[1],n[0],r.method);request=(r,n,o,i)=>{if(r instanceof Request)return this.fetch(n?new Request(r,n):r,o,i);return r=r.toString(),this.fetch(new Request(/^https?:\/\//.test(r)?r:`http://localhost${ne("/",r)}`,n),o,i)};fire=()=>{addEventListener("fetch",(r)=>{r.respondWith(this.#o(r.request,r,void 0,r.request.method))})}};var j=()=>Object.create(null);var Fe=[];function Ht(e,r){let n=this.buildAllMatchers(),o=(i,s)=>{let a=n[i]||n.ALL,c=a[2][s];if(c)return c;let u=s.match(a[0]);if(!u)return[[],Fe];let l=u.indexOf("",1);return[a[1][l],u]};return this.match=o,o(e,r)}var Bt="[^/]+";var $t="(?:|/.*)",oe=Symbol(),pn=new Set(".\\+*[^]$()");function Ei(e,r){if(e.length===1)return r.length===1?e<r?-1:1:-1;if(r.length===1)return 1;if(e===".*"||e==="(?:|/.*)")return r==="(?:|/.*)"?-1:1;else if(r===".*"||r==="(?:|/.*)")return-1;if(e==="[^/]+")return 1;else if(r==="[^/]+")return-1;return e.length===r.length?e<r?-1:1:r.length-e.length}var dn=class e{#t;#e;#r=j();insert(r,n,o,i,s){let a=this;for(let c=0,u=r.length;c<u;c++){let l=r[c],p=l.length===1?l==="*"?c===u-1?["","",".*"]:["","",Bt]:null:l==="/*"?["","",$t]:l.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),w;if(p){let S=p[1],A=p[2]||"[^/]+";if(S&&p[2]){if(A===".*")throw oe;if(A=A.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(A))throw oe;if(A.length===1&&pn.has(A))throw oe}if(w=a.#r[A],!w){if(A!==".*"&&A!=="(?:|/.*)"){for(let C in a.#r)if((A.length>1||C.length>1)&&C!==".*"&&C!=="(?:|/.*)")throw oe}w=a.#r[A]=new e}if(S!=="")w.#e??=i.varIndex++,o.push([S,w.#e])}else if(w=a.#r[l],!w){for(let S in a.#r)if(S.length>1&&S!==".*"&&S!=="(?:|/.*)")throw oe;w=a.#r[l]=new e}a=w}if(a.#t!==void 0)throw oe;a.#t=s?-1:n}buildRegExpStr(){let r=Object.keys(this.#r).sort(Ei).map((n)=>{let o=this.#r[n],i=o.buildRegExpStr();return i===""?"":(typeof o.#e==="number"?`(${n})@${o.#e}`:pn.has(n)?`\\${n}`:n)+i}).filter(Boolean);if(typeof this.#t==="number"&&this.#t!==-1)r.unshift(`#${this.#t}`);if(r.length===0)return"";if(r.length===1)return r[0];return"(?:"+r.join("|")+")"}};var Jt=class{#t={varIndex:0};#e=new dn;#r=0;paths=j();insert(e,r){if(r){this.#e.insert(e.split(""),0,[],this.#t,!0);return}let n=[],o=[],i=e;for(let a=0;;){let c=!1;if(i=i.replace(/\{[^}]+\}/g,(u)=>{let l=`@\\${a}`;return o[a]=[l,u],a++,c=!0,l}),!c)break}let s=i.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=o.length-1;a>=0;a--){let[c]=o[a];for(let u=s.length-1;u>=0;u--)if(s[u].indexOf(c)!==-1){s[u]=s[u].replace(c,o[a][1]);break}}this.#e.insert(s,this.#r,n,this.#t,!1),this.paths[e]=[this.#r++,n]}buildRegExp(){let e=this.#e.buildRegExpStr();if(e==="")return[/^$/,[],[]];let r=0,n=[],o=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(i,s,a)=>{if(s!==void 0)return n[++r]=Number(s),"$()";if(a!==void 0)return o[Number(a)]=++r,"";return""}),[new RegExp(`^${e}`),n,o]}};var hn=j();function mn(e){return hn[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(r,n)=>n?`\\${n}`:r==="/*"?$t:r==="*"?".*":`/:${Bt}`)}$`)}function Ve(e,r){for(let n of Object.keys(e).sort((o,i)=>i.length-o.length))if(mn(n).test(r))return[...e[n]]}var Qe=class{name="RegExpRouter";#t;#e;#r;constructor(){this.#t={["ALL"]:j()},this.#e={["ALL"]:j()},this.#r={["ALL"]:new Jt}}#i(e,r){try{this.#r[e].insert(r,!/\*|\/:/.test(r))}catch(n){throw n===oe?new Ke(r):n}}add(e,r,n){let o=this.#t,i=this.#e;if(!o)throw Error(ze);if(!o[e]){this.#r[e]=new Jt;for(let c of[o,i]){c[e]=j();for(let u in c.ALL)c[e][u]=[...c.ALL[u]],this.#i(e,u)}}if(r==="/*")r="*";let s=e==="ALL"?Object.keys(o):[e];if(/\*$/.test(r)){let c=mn(r);for(let u of s)if(!o[u][r])this.#i(u,r),o[u][r]=Ve(o[u],r)||Ve(o.ALL,r)||[];for(let u of[o,i])for(let l of s)for(let p in u[l])c.test(p)&&u[l][p].push([n,r]);return}let a=$e(r)||[r];for(let c of a)for(let u of s){if(!i[u][c])this.#i(u,c),i[u][c]=Ve(o[u],c)||Ve(o.ALL,c)||[];i[u][c].push([n,c])}}match=Ht;buildAllMatchers(){let e=j();for(let r of Object.keys(this.#e))e[r]=this.#n(r);return this.#t=this.#e=this.#r=void 0,hn=j(),e}#n(e){let r=this.#t[e],n=this.#e[e],o=this.#r[e],i=j(),s=[],[a,c,u]=o.buildRegExp();for(let l of[r,n])for(let p in l){let w=l[p],S=o.paths[p];if(!S){i[p]=[w.map(([A])=>[A,j()]),Fe];continue}s[S[0]]=w.map(([A,C])=>[A,o.paths[C][1].reduceRight((D,[q],W)=>(D[q]=u[S[1][W][1]],D),j())])}return[a,c.map((l)=>s[l]),i]}};var fn=class{name="SmartRouter";#t=[];#e=[];constructor(e){this.#t=e.routers}add(e,r,n){if(!this.#e)throw Error(ze);this.#e.push([e,r,n])}match(e,r){if(!this.#e)throw Error("Fatal error");let n=this.#t,o=this.#e,i=n.length,s=0,a;for(;s<i;s++){let c=n[s];try{for(let u=0,l=o.length;u<l;u++)c.add(...o[u]);a=c.match(e,r)}catch(u){if(u instanceof Ke)continue;throw u}this.match=c.match.bind(c),this.#t=[c],this.#e=void 0;break}if(s===i)throw Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw Error("No active router has been determined yet.");return this.#t[0]}};var zt=j(),Ci=0,gn=class e{#t=[];#e=j();#r=[];#i;#n=zt;insert(r,n,o){let i=this,s=Xr(n),a=new Set,c=0;for(let u of s){let l=s[++c],p=Yr(u,l)||(l===void 0&&u&&u.indexOf("*")===u.length-1?u:null),w=Array.isArray(p),S=w?p[0]:p||u,A=i.#e[S]||=new e;if(p&&!A.#i)A.#i=p,i.#r.push(A);if(i=A,w)a.add(p[1])}i.#t.push({[r]:{handler:o,possibleKeys:[...a],score:++Ci}})}#o(r,n,o,i,s){for(let a=0,c=n.#t.length;a<c;a++){let u=n.#t[a],l=u[o]||u.ALL;if(l){l.params=j(),r.push(l);for(let p=0,w=l.possibleKeys.length;p<w;p++){let S=l.possibleKeys[p];l.params[S]=s?.[S]&&!p?s[S]:i[S]??s?.[S]}}}}search(r,n){let o=[];this.#n=zt;let i=[this],s=qt(n),a=[],c=s.length,u=null;for(let l=0;l<c;l++){let p=s[l],w=l===c-1,S=[];for(let C=0,D=i.length;C<D;C++){let q=i[C],W=q.#e[p];if(W)if(W.#n=q.#n,w){if(W.#e["*"])this.#o(o,W.#e["*"],r,q.#n);this.#o(o,W,r,q.#n)}else S.push(W);for(let k of q.#r){let M=k.#i,U=q.#n===zt?{}:{...q.#n};if(typeof M==="string"){if(M==="*"||p.startsWith(M.slice(0,-1))){if(this.#o(o,k,r,q.#n),M==="*")k.#n=U,S.push(k)}continue}let[,F,te]=M;if(!p&&te===!0)continue;if(te!==!0){if(!u){u=[];let ge=n[0]==="/"?1:0;for(let V=0;V<c;V++)u[V]=ge,ge+=s[V].length+1}let me=n.slice(u[l]),ue=te.exec(me);if(ue){if(U[F]=ue[0],this.#o(o,k,r,q.#n,U),ue[0].length===me.length&&k.#e["*"])this.#o(o,k.#e["*"],r,q.#n,U);for(let ge in k.#e){k.#n=U;let V=ue[0].match(/\//g)?.length??0;(a[V]||=[]).push(k);break}continue}}if(te===!0||te.test(p))if(U[F]=p,w){if(this.#o(o,k,r,U,q.#n),k.#e["*"])this.#o(o,k.#e["*"],r,U,q.#n)}else k.#n=U,S.push(k)}}let A=a.shift();i=A?S.concat(A):S}if(o[1])o.sort((l,p)=>l.score-p.score);return[o.map(({handler:l,params:p})=>[l,p])]}};var Kt=class{name="TrieRouter";#t=new gn;add(e,r,n){for(let o of $e(r)||[r])this.#t.insert(e,o,n)}match(e,r){return this.#t.search(e,r)}};var I=class extends ln{constructor(e={}){super(e);this.router=e.router??new fn({routers:[new Qe,new Kt]})}};var vn=(e)=>e===32||e===9||e===10||e===13,Xe=(e,r)=>{while(r<e.length){if(!vn(e.charCodeAt(r)))break;r++}return r},Pe=(e,r)=>{while(r>0){if(!vn(e.charCodeAt(r-1)))break;r--}return r},wn=(e,r)=>{while(r<e.length){let n=e.charCodeAt(r);if(n===59)return[r+1,!0];if(n===44)return[r+1,!1];r++}return[r,!1]},_i=(e,r)=>{let n=r,o=!1;while(n<e.length){let i=e.charCodeAt(n);if(o&&i===92)n++;else if(i===34)o=!o;else if(!o&&i===44)return n+1;n++}return n},Ii=(e,r)=>{r=Xe(e,r);let n=r,o,i,s=!1;while(n<e.length){let u=e.charCodeAt(n);if(u===61){o=e.slice(r,Pe(e,n)),n++;break}if(u===59)return[n+1,void 0,void 0,!0];if(u===44)return[n+1,void 0,void 0,!1];n++}if(o===void 0)return[n,void 0,void 0,!1];if(n=Xe(e,n),e.charCodeAt(n)===61){let u=wn(e,n+1);return[u[0],o,void 0,u[1]]}let a=!1,c=n;while(n<e.length){let u=e.charCodeAt(n);if(a&&u===92)n++;else if(u===34){if(a){let l=Xe(e,n+1),p=e.charCodeAt(l);if(l<e.length&&!(p===59||p===44)){let w=wn(e,l);return[w[0],o,void 0,w[1]]}if(i=e.slice(c+1,n),i.includes("\\"))i=i.replace(/\\(.)/g,"$1");if(p===44)return[l+1,o,i,!1];if(p===59)s=!0,l++;n=l;break}a=!0}else if(!a&&(u===59||u===44)){if(i=e.slice(c,Pe(e,n)),u===59)s=!0;n++;break}n++}return[n,o,i??e.slice(c,Pe(e,n)),s]},Li=(e,r)=>{let n={type:"",params:Object.create(null),q:1};r=Xe(e,r);let o=r;while(o<e.length){let c=e.charCodeAt(o);if(c===59||c===44){if(n.type=e.slice(r,Pe(e,o)),o++,c===44)return[o,n.type?n:void 0];if(!n.type)return[_i(e,o),void 0];break}o++}if(!n.type)return n.type=e.slice(r,Pe(e,e.length)),[e.length,n.type?n:void 0];let i,s,a;while(o<e.length){if([o,i,s,a]=Ii(e,o),i&&s)n.params[i]=s;if(!a)break}return[o,n]},xn=(e)=>{if(!e)return[];let r=[],n=0,o,i=!1,s;while(n<e.length)if([n,o]=Li(e,n),o){if(o.q=Di(o.params.q??o.params.Q),r.push(o),s&&s.q<o.q)i=!0;s=o}if(i)r.sort((a,c)=>c.q-a.q);return r},Di=(e)=>{if(e===void 0)return 1;if(e==="")return 1;if(e==="NaN")return 0;let r=Number(e);if(Number.isNaN(r))return 1;if(r<0)return 0;if(r>1)return 1;return r};var Sn=/^\s*(?:text\/(?!event-stream(?:[;\s]|$))[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|msgpack|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|vnd\.msgpack|wasm|x-httpd-php|x-javascript|x-msgpack|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml|msgpack))(?:[;\s]|$)/i;var qi=["gzip","deflate"],Wi=/(?:^|,)\s*?no-transform\s*?(?:,|$)/i,Oi=(e,r)=>{if(e===void 0)return;let n=xn(e),o=n.find((s)=>s.type==="*")?.q,i;for(let s of r){let a=n.find((u)=>u.type.toLowerCase()===s),c=a?a.q:o??0;if(c===1)return s;else if(c>0&&(!i||c>i.q))i={encoding:s,q:c}}return i?.encoding},Ni=/(?:^|,)\s*accept-encoding\s*(?:,|$)/i,Rn=(e)=>{let r=e?.threshold??1024,n=e?.encoding?[e.encoding]:qi,o=e?.contentTypeFilter??Sn,i=typeof o==="function"?(s)=>{let a=s.headers.get("Content-Type");return a&&o(a)}:(s)=>{let a=s.headers.get("Content-Type");return a&&o.test(a)};return async function(a,c){await c();let u=a.res.headers.get("Content-Length");if(a.res.status===206||a.res.headers.has("Content-Encoding")||a.res.headers.has("Transfer-Encoding")||a.req.method==="HEAD"||u&&Number(u)<r||!i(a.res)||!Ui(a.res))return;let l=a.res.headers.get("Vary");if(l!=="*"&&!(l&&Ni.test(l)))a.header("Vary",l?`${l}, Accept-Encoding`:"Accept-Encoding");let p=a.req.header("Accept-Encoding"),w=Oi(p,n);if(!w||!a.res.body)return;let S=new CompressionStream(w);a.res=new Response(a.res.body.pipeThrough(S),a.res),a.res.headers.delete("Content-Length"),a.res.headers.set("Content-Encoding",w);let A=a.res.headers.get("ETag");if(A&&!A.startsWith("W/"))a.res.headers.set("ETag",`W/${A}`)}},Ui=(e)=>{let r=e.headers.get("Cache-Control");return!r||!Wi.test(r)};import{timingSafeEqual as An}from"crypto";function Tn(e){let r=new I,n=!1;return r.post("/pair",x(e,async(o)=>{let i=await P(o),s=o.req.raw,a=e.requestIP(s),c=Lt(a)&&e.tunnel?.running()?s.headers.get("cf-connecting-ip"):null,u=c?`tunnel:${c}`:a??"unknown",l=e.auth.pair(String(i.code??""),String(i.device??""),u);if(!l)return R(o,"unauthorized","invalid or expired pairing code",401);return v(o,l)},{public:!0})),r.post("/pair/approve",x(e,async(o)=>{let i=o.req.raw.headers.get("origin")??void 0;if(!i||!e.approveLocalPairing||!ce(e,o.req.raw)||!e.allowed(i,o.req.raw,{wildcard:!1}))return R(o,"unauthorized","local approval not available",403);if(n)throw new ee("local approval already in progress");let s=await P(o),a=String(s.device??"").trim()||"Browser";n=!0,e.disableTimeout?.(o.req.raw);try{if(!await e.approveLocalPairing({device:a,origin:i}))return R(o,"unauthorized","local approval rejected",403);if(o.req.raw.signal.aborted)return R(o,"unauthorized","local approval request was closed",403);return v(o,e.auth.issue(a))}finally{n=!1}},{public:!0})),r.post("/pair/code",x(e,(o)=>{let i=o.req.raw,s=e.cliSecret?Buffer.from(e.cliSecret):void 0,a=Buffer.from(z(i)??"");if(!s||i.headers.has("origin")||!ce(e,i)||s.length!==a.length||!An(s,a))return R(o,"unauthorized","pairing code is only available to the local CLI",403);if(!e.authEnabled)return R(o,"bad_request","authentication is disabled, no pairing needed",400);let c=e.auth.renewPairingCode();return v(o,{code:c,expires:e.auth.pairingExpires()})},{public:!0})),r.post("/server/shutdown",x(e,(o)=>{let i=o.req.raw,s=e.cliSecret?Buffer.from(e.cliSecret):void 0,a=Buffer.from(z(i)??"");if(!s||i.headers.has("origin")||!ce(e,i)||s.length!==a.length||!An(s,a))return R(o,"unauthorized","shutdown is only available to the local CLI",403);if(!e.shutdown)return R(o,"not_found","shutdown is unavailable",404);return e.shutdown(),v(o,{ok:!0})},{public:!0})),r.get("/pair/current",x(e,(o)=>{if(!e.authEnabled)return R(o,"bad_request","authentication is disabled, no pairing needed",400);let i=e.auth.pairingCode();return v(o,{code:i,expires:e.auth.pairingExpires()})})),r.post("/pair/current",x(e,(o)=>{if(!e.authEnabled)return R(o,"bad_request","authentication is disabled, no pairing needed",400);let i=e.auth.renewPairingCode();return v(o,{code:i,expires:e.auth.pairingExpires()})})),r.get("/devices",x(e,(o)=>{let i=e.auth.verify(z(o.req.raw))?.id;return v(o,e.auth.list().map((s)=>s.id===i?{...s,current:!0}:s))})),r.delete("/devices/:id",x(e,(o)=>e.auth.revoke(L(o,"id"))?v(o,{ok:!0}):R(o,"not_found","no such device",404))),r}import{constants as ji,createGzip as Hi}from"zlib";function kn(e){let r=new I,n=new Map;r.get("/events",x(e,async(o)=>{if(o.req.query("protocol")!==String(gr))return R(o,"protocol_mismatch",`server speaks protocol ${gr}`,400);let i=o.req.raw,s=e.authEnabled?e.auth.verify(z(i)):void 0,a=o.req.query("index")==="1";if(a)await e.runtime.initialize();let c=Bi(o.req.query("subscribe")),u=/\bgzip\b/i.test(i.headers.get("accept-encoding")??""),l,p,w,S=new ReadableStream({start(C){let D=$i(C,u),q=!1;w=(M=!1)=>{if(!q)q=!0,clearInterval(p),i.signal.removeEventListener("abort",k),n.delete(l.id),D.close(M);return l.dispose()};let W=()=>{w().catch((M)=>console.error("SSE cleanup failed",M))},k=()=>{w(!0).catch((M)=>console.error("SSE cleanup failed",M))};l=je(e.runtime,{deviceID:s?.id,expires:s?.token.expires},new Set,(M)=>D.write(`data: ${JSON.stringify(M)}
|
|
5
|
-
|
|
6
|
-
`),W),n.set(l.id,l),p=setInterval(()=>D.write(`: ping
|
|
7
|
-
|
|
8
|
-
`),e.heartbeatMs??15000),i.signal.addEventListener("abort",k,{once:!0}),l.send({type:"welcome",server:e.info,connectionID:l.id,subscribed:c.map((M)=>M.sessionID),...a&&{index:{sessions:e.runtime.list(!0,{archive:"all"}),projects:e.runtime.projects(),plugins:e.runtime.plugins.list()}}});for(let M of c)l.enqueue(()=>Ae(e.runtime,l,{...M,type:"subscribe"})).catch((U)=>{if(U instanceof m&&e.runtime.get(M.sessionID)===void 0)l.send({type:"removed",kind:"session",id:M.sessionID});else l.send({type:"error",code:"bad_request",message:U instanceof Error?U.message:String(U)})});if(i.signal.aborted)k()},cancel(){return w(!0)}});e.disableTimeout?.(i);let A=Te(o);if(A.set("content-type","text/event-stream"),A.set("cache-control","no-cache, no-transform"),A.set("x-accel-buffering","no"),u)A.set("content-encoding","gzip"),A.set("vary","accept-encoding");return new Response(S,{headers:A})}));for(let o of["subscribe","unsubscribe"])r.post(`/events/:connectionID/${o}`,x(e,async(i)=>{let s=n.get(L(i,"connectionID"));if(!s)return R(i,"not_found","no such connection",404);let a=e.authEnabled?e.auth.verify(z(i.req.raw)):void 0;if(s.deviceID!==a?.id)return R(i,"unauthorized","connection belongs to another device",403);return await s.enqueue(async()=>{let c=await P(i);await Ae(e.runtime,s,{...c,type:o})}),new Response(null,{status:204,headers:Te(i)})}));return r}function Bi(e){if(!e)return[];let r;try{r=JSON.parse(e)}catch{return[]}if(!Array.isArray(r))return[];return r.filter((n)=>typeof n?.sessionID==="string"&&n.sessionID!=="").slice(0,32)}function $i(e,r){let n=new TextEncoder;if(!r)return{write:(a)=>e.enqueue(n.encode(a)),close:(a)=>{if(!a)e.close()}};let o=Hi(),i=!0,s=!1;return o.on("data",(a)=>{if(!i)return;try{e.enqueue(new Uint8Array(a))}catch{i=!1,o.destroy()}}),{write(a){if(!i||o.writableEnded)return;if(o.write(a),s)return;s=!0,setImmediate(()=>{if(s=!1,i&&!o.writableEnded)o.flush(ji.Z_SYNC_FLUSH)})},close(a){if(a){i=!1,o.destroy();return}o.once("end",()=>{i=!1,e.close()}),o.end()}}}function Pn(e){let r=new I;return r.get("/folding/settings",x(e,(n)=>v(n,{digestModel:e.runtime.digestModel()}))),r.put("/folding/settings",x(e,async(n)=>{let o=await n.req.json();if(!o||typeof o!=="object"||!("digestModel"in o)||o.digestModel!==null&&typeof o.digestModel!=="string")return R(n,"bad_request","digestModel must be a model id or null",400);return v(n,{digestModel:e.runtime.setDigestModel(o.digestModel)})})),r}import{readdirSync as Ji,statSync as zi}from"fs";import{homedir as Ki}from"os";import{dirname as Gi,resolve as Ye}from"path";function En(e){let r=Ye(e?.trim()||process.cwd());try{if(!zi(r).isDirectory())throw Error("not a directory");let n=Gi(r),o=Ye(process.cwd()),i=[o,Ye(Ki())].filter((s,a,c)=>c.indexOf(s)===a).map((s)=>({name:s===o?"\u5DE5\u4F5C\u533A":"\u7528\u6237\u76EE\u5F55",path:s}));return{path:r,parent:n===r?null:n,entries:Ji(r,{withFileTypes:!0}).filter((s)=>s.isDirectory()).map((s)=>({name:s.name,path:Ye(r,s.name)})).sort((s,a)=>s.name.localeCompare(a.name,void 0,{numeric:!0,sensitivity:"base"})),shortcuts:i}}catch{throw new t(`${r} is not a readable directory on the server`)}}function Cn(e){let r=new I;return r.get("/info",x(e,(n)=>{e.info.shell=e.runtime.serverShell();let o=e.authEnabled&&e.approveLocalPairing!==void 0&&ce(e,n.req.raw);return v(n,o?{...e.info,localApproval:!0}:e.info)},{public:!0})),r.get("/health",x(e,async(n)=>{if(!ce(e,n.req.raw))return R(n,"unauthorized","loopback only",403);let{models:o}=await e.runtime.models(),i=o.filter((u)=>u.available===!0).length,s=e.runtime.list(!0),a=s.filter((u)=>u.status==="busy").length,c=0;for(let u of s)c+=e.runtime.get(u.id)?.runningTools??0;if(i===0)return v(n,{ready:!1,availableModels:i,busySessions:a,runningTools:c},503);return v(n,{ready:!0,availableModels:i,busySessions:a,runningTools:c})},{public:!0})),r.get("/server/autostart",x(e,(n)=>{if(!e.autostart)return R(n,"not_found","\u5F53\u524D\u670D\u52A1\u5165\u53E3\u4E0D\u652F\u6301\u767B\u5F55\u81EA\u542F",404);return v(n,e.autostart.status())})),r.put("/server/autostart",x(e,async(n)=>{if(!e.autostart)return R(n,"not_found","\u5F53\u524D\u670D\u52A1\u5165\u53E3\u4E0D\u652F\u6301\u767B\u5F55\u81EA\u542F",404);let o=await P(n);if(typeof o.enabled!=="boolean")return R(n,"bad_request","enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C",400);return v(n,e.autostart.set(o.enabled))})),r.post("/server/restart",x(e,(n)=>{if(!e.restart)return R(n,"not_found","\u5F53\u524D\u670D\u52A1\u5165\u53E3\u4E0D\u652F\u6301\u91CD\u542F",404);return e.restart(),v(n,{restarting:!0},202)})),r.patch("/server/shell",x(e,async(n)=>{let o=await P(n),i=e.runtime.setServerShell(o.shell);return e.info.shell=i,v(n,{shell:i})})),r.get("/models",x(e,async(n)=>v(n,await e.runtime.models()))),r.get("/directories",x(e,(n)=>v(n,En(n.req.query("path"))),{public:!1})),r.get("/storage",x(e,(n)=>v(n,e.runtime.storage(n.req.query("detailed")==="true")))),r.post("/storage/compact",x(e,async(n)=>{let o=await P(n);return v(n,await e.runtime.compactStorage({checkpoint:o.checkpoint===!0,vacuum:o.vacuum===!0}))})),r}function Mn(e){let r=new I,n=e.modelProviders;if(!n)return r;return r.get("/model-providers",x(e,(o)=>v(o,n.list()))),r.put("/model-providers/:id",x(e,async(o)=>{let i=await n.save(L(o,"id"),await P(o));return v(o,i)})),r.post("/model-providers/:id/discover",x(e,async(o)=>v(o,await n.discover(L(o,"id"))))),r.delete("/model-providers/:id",x(e,async(o)=>await n.remove(L(o,"id"))?v(o,{ok:!0}):R(o,"not_found","no such model provider",404))),r}function _n(e){let r=new I;return r.get("/server/network",x(e,(n)=>{if(!e.network)return R(n,"not_found","network settings unavailable",404);return v(n,e.network.manager.configuration(e.network.runtime()))})),r.put("/server/network",x(e,async(n)=>{if(!e.network)return R(n,"not_found","network settings unavailable",404);let o=e.network.manager.configuration(e.network.runtime());if(!o.editable)return R(n,"unauthorized",o.disabledReason??"network settings are read-only",403);let i=await P(n),s=n.req.raw;if(!e.internalRequest?.(s)&&!e.auth.verify(z(s)))return R(n,"unauthorized","authentication expired or revoked",403);return e.network.save(i),v(n,e.network.manager.configuration(e.network.runtime()))})),r}function In(e){let r=new I;return r.get("/plugins",x(e,async(n)=>(await e.runtime.initialize(),v(n,e.runtime.plugins.list())))),r.post("/plugins/load",x(e,async(n)=>{let o=await P(n);if(typeof o.path!=="string"||!o.path||o.path.length>4096)throw new t("path must be a non-empty plugin file path");return await e.runtime.initialize(),await e.runtime.plugins.load(o.path),v(n,e.runtime.plugins.list())})),r.post("/plugins/:id/reload",x(e,async(n)=>(await e.runtime.initialize(),await e.runtime.plugins.reload(L(n,"id")),v(n,e.runtime.plugins.list())))),r.patch("/plugins/:id",x(e,async(n)=>{let o=await P(n);if(typeof o.enabled!=="boolean")throw new t("enabled must be a boolean");return await e.runtime.initialize(),await e.runtime.plugins.setEnabled(L(n,"id"),o.enabled),v(n,e.runtime.plugins.list())})),r.post("/plugins/:id/commands/:command",x(e,async(n)=>{await e.runtime.initialize();let o=await P(n);if(!Array.isArray(o.args)||o.args.length>100||o.args.some((i)=>typeof i!=="string"||i.length>1e5))throw new t("args must be an array of strings");return v(n,await e.runtime.plugins.command(L(n,"id"),L(n,"command"),o.args))})),r.get("/plugins/:id/web.js",x(e,async(n)=>{await e.runtime.initialize();let o=await e.runtime.plugins.webBundle(L(n,"id"));if(!o)return v(n,{error:"Plugin web bundle not found"},404);return new Response(o,{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-cache"}})})),r.get("/plugins/:id/web.css",x(e,async(n)=>{await e.runtime.initialize();let o=await e.runtime.plugins.webCSS(L(n,"id"));if(o===void 0)return new Response(null,{status:204});return new Response(o,{headers:{"Content-Type":"text/css; charset=utf-8","Cache-Control":"no-cache"}})})),r}function Ln(e){let r=new I;return r.get("/projects",x(e,(n)=>v(n,e.runtime.projects()))),r.post("/projects",x(e,async(n)=>v(n,e.runtime.createProject(await P(n))))),r.put("/projects/order",x(e,async(n)=>(e.runtime.reorderProjects((await P(n)).ids),v(n,{ok:!0})))),r.get("/projects/:id",x(e,(n)=>{let o=e.runtime.project(L(n,"id"));return o?v(n,o):R(n,"not_found","no such project",404)})),r.patch("/projects/:id",x(e,async(n)=>v(n,e.runtime.updateProject(L(n,"id"),await P(n))))),r.delete("/projects/:id",x(e,async(n)=>(await e.runtime.deleteProject(L(n,"id")),v(n,{ok:!0})))),r}function Dn(e){let r=new I,n=e.providerAuth;if(!n)return r;return r.get("/provider-auth/openai",x(e,async(o)=>v(o,await n.status()))),r.post("/provider-auth/openai/login",x(e,async(o)=>{let i=await n.start("Basalt");return v(o,i)})),r.post("/provider-auth/openai/manual",x(e,async(o)=>{let i=await P(o);if(typeof i.url!=="string"||!i.url.trim())return R(o,"bad_request","url is required",400);return await n.manualInput(i.url),v(o,await n.status())})),r.post("/provider-auth/openai/logout",x(e,async(o)=>(await n.logout(),v(o,{ok:!0})))),r}function qn(e){let r=new I,n=e.proxy;if(!n)return r;let o=(i)=>{let s=e.proxyTargets?.()??[],a=new Set(s.map((c)=>c.id));for(let c of Object.keys(i.routes))if(!a.has(c))s.push({id:c,name:`\u672A\u542F\u7528\u7684\u7528\u9014\uFF1A${c}`});return{...i,targets:s}};return r.get("/proxy",x(e,(i)=>v(i,o(n.settings())))),r.put("/proxy",x(e,async(i)=>{let s=await P(i),a=i.req.raw;if(e.authEnabled&&!e.internalRequest?.(a)&&!e.auth.verify(z(a)))return R(i,"unauthorized","authentication expired or revoked",403);let c=n.save(s);return v(i,o(c))})),r}var Fi=new Set(Bn);function Vi(e){if(!e||typeof e!=="object"||Array.isArray(e))return!1;let r=e;if(typeof r.q!=="string"||r.q.length>4096)return!1;for(let n of["caseSensitive","wholeWord","deep"])if(r[n]!==void 0&&typeof r[n]!=="boolean")return!1;for(let[n,o]of[["mode",la],["sort",ca],["group",ua]])if(r[n]!==void 0&&!o.some((i)=>i===r[n]))return!1;if(r.limit!==void 0&&(typeof r.limit!=="number"||!Number.isInteger(r.limit)||r.limit<1||r.limit>200))return!1;if(r.cursor!==void 0&&(typeof r.cursor!=="string"||r.cursor.length>262144))return!1;if(r.filters!==void 0){if(!r.filters||typeof r.filters!=="object"||Array.isArray(r.filters))return!1;let n=r.filters;for(let o of["projectID","sessionID","fields","tools","model"]){let i=n[o];if(i!==void 0&&(!Array.isArray(i)||i.length>100||!i.every((s)=>typeof s==="string"&&s.length<=1024&&(o!=="fields"||Fi.has(s)))))return!1}for(let o of["isError","archived","compacted"])if(n[o]!==void 0&&typeof n[o]!=="boolean")return!1;for(let o of["after","before"])if(n[o]!==void 0&&(typeof n[o]!=="number"||!Number.isFinite(n[o])))return!1}return!0}function Wn(e){let r=new I,n=new Map,o=(i)=>{let s=Date.now(),a=e.requestConnection?.(i)??e.requestIP(i)??"local";for(let[u,l]of n)if(s-l.start>=1000)n.delete(u);let c=n.get(a)??{start:s,count:0};return c.count++,n.set(a,c),c.count>20};return r.get("/search/settings",x(e,(i)=>{let s=e.runtime.searchStatus();return v(i,{enabled:s.state!=="disabled",status:s})})),r.put("/search/settings",x(e,async(i)=>{let s=await i.req.json();if(!s||typeof s!=="object"||!("enabled"in s)||typeof s.enabled!=="boolean")return R(i,"bad_request","enabled must be a boolean",400);let a=await e.runtime.setSearchEnabled(s.enabled);return v(i,{enabled:a.state!=="disabled",status:a})})),r.post("/search/rebuild",x(e,async(i)=>{if(e.runtime.searchStatus().state==="disabled")return R(i,"bad_request","\u5386\u53F2\u641C\u7D22\u672A\u542F\u7528",409);return await e.runtime.search.rebuild(),v(i,e.runtime.searchStatus())})),r.get("/search/status",x(e,(i)=>v(i,e.runtime.searchStatus()))),r.get("/search/suggest",x(e,(i)=>{if(o(i.req.raw))return v(i,{error:{code:"rate_limited",message:"too many searches"}},429);let s=i.req.query("q");if(s===void 0||s.length>4096)return R(i,"bad_request","q is required (maximum 4096 characters)",400);return v(i,{terms:Ko(e.runtime.search,s)})})),r.post("/search",x(e,async(i)=>{if(o(i.req.raw))return v(i,{error:{code:"rate_limited",message:"too many searches"}},429);let s=await i.req.json();if(!Vi(s))return R(i,"bad_request","invalid search request",400);if(s.cursor)try{Nn(s,s.filters?.sessionID?.length===1?s.filters.sessionID[0]:void 0)}catch{return R(i,"bad_request","invalid search cursor",400)}let a=new AbortController,c=()=>a.abort(),u=i.req.raw.signal;if(u.addEventListener("abort",c,{once:!0}),u.aborted)a.abort();let l=new TextEncoder,p=!1,w=new ReadableStream({async start(A){if(a.signal.aborted){A.close(),u.removeEventListener("abort",c);return}let C=()=>{if(!p)A.close()};a.signal.addEventListener("abort",C,{once:!0});try{if(await qr(e.runtime,s,{signal:a.signal,sessionID:s.filters?.sessionID?.length===1?s.filters.sessionID[0]:void 0,onEvent(D){A.enqueue(l.encode(`${JSON.stringify(D)}
|
|
9
|
-
`))}}),!a.signal.aborted)A.close()}catch(D){if(!a.signal.aborted)A.error(D)}finally{a.signal.removeEventListener("abort",C),u.removeEventListener("abort",c)}},cancel(){p=!0,a.abort(),u.removeEventListener("abort",c)}}),S=new Headers(v(i,null).headers);return S.set("content-type","application/x-ndjson; charset=utf-8"),S.set("cache-control","no-store"),new Response(w,{headers:S})})),r}var Qi=150,Xi=(e)=>os.includes(e);function jn(e){let r=new I;return r.get("/sessions",x(e,(n)=>{let o=n.req.query("archive")??"active";if(!Xi(o))return R(n,"bad_request",`archive must be ${os.join(", ")}`,400);return v(n,e.runtime.list(n.req.query("includeChildren")==="true",{archive:o}))})),r.post("/sessions",x(e,async(n)=>{let o=await P(n),i=e.runtime.create({projectID:o.projectID,title:o.title,model:o.model,thinking:o.thinking});return await e.runtime.plugins.idle(),v(n,i.info())})),r.get("/sessions/:id",x(e,(n)=>{let o=e.runtime.get(L(n,"id"));return o?v(n,o.info()):R(n,"not_found","no such session",404)})),r.post("/sessions/:id/shell-approvals/:aid",x(e,async(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=await P(n);if(typeof i.approved!=="boolean")throw new t("approved must be a boolean");o.assertWritable();let s=$o(o,L(n,"aid"),i.approved);if(s==="unknown")return R(n,"not_found","\u6388\u6743\u8BF7\u6C42\u4E0D\u5B58\u5728\u6216\u5DF2\u5931\u6548",404);return v(n,{ok:!0,expired:s==="expired"})})),r.patch("/sessions/:id",x(e,async(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=await P(n);if("archived"in i){if(typeof i.archived!=="boolean"||Object.keys(i).length!==1)return R(n,"bad_request","archived must be a boolean and cannot be mixed with other fields",400);return v(n,e.runtime.setArchived(o.id,i.archived))}if(o.assertWritable(),i.title!==void 0&&typeof i.title!=="string")return R(n,"bad_request","title must be a string",400);if(i.model!==void 0)e.runtime.checkModel(i.model);if(i.thinking!==void 0&&i.thinking!==null&&typeof i.thinking!=="string")return R(n,"bad_request","thinking must be a string or null",400);if(i.title!==void 0)o.rename(i.title);if(i.model!==void 0)o.setModel(i.model);if(i.thinking!==void 0)o.setThinking(i.thinking);return v(n,o.info())})),r.delete("/sessions/:id",x(e,async(n)=>(await e.runtime.deleteSession(L(n,"id")),await e.runtime.plugins.idle(),v(n,{ok:!0})))),r.get("/sessions/:id/export",x(e,(n)=>{let o=L(n,"id"),i=e.runtime.exportSession(o),s=v(n,i);return s.headers.set("content-disposition",`attachment; filename="basalt-${o}.json"`),s})),r.post("/sessions/import",x(e,async(n)=>{let o=e.runtime.parseImport(await P(n)),i=e.runtime.importSession(o,{projectID:n.req.query("projectID")||void 0,model:n.req.query("model")||void 0});return await e.runtime.plugins.idle(),v(n,i.info())})),r.get("/sessions/:id/last-model-request",x(e,(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=o.lastModelRequest();return i?v(n,i):R(n,"not_found","\u8BE5\u4F1A\u8BDD\u5728\u672C\u8FDB\u7A0B\u5185\u8FD8\u6CA1\u6709\u53D1\u51FA\u8FC7\u6A21\u578B\u8BF7\u6C42\uFF08\u5FEB\u7167\u9A7B\u7559\u5185\u5B58\uFF0C\u91CD\u542F\u5373\u6E05\u7A7A\uFF09",404)})),r.get("/sessions/:id/last-model-response",x(e,(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=o.lastModelResponse();return i?v(n,i):R(n,"not_found","\u8BE5\u4F1A\u8BDD\u5728\u672C\u8FDB\u7A0B\u5185\u8FD8\u6CA1\u6709\u6536\u5230\u8FC7\u6A21\u578B\u54CD\u5E94\uFF08\u5FEB\u7167\u9A7B\u7559\u5185\u5B58\uFF0C\u91CD\u542F\u5373\u6E05\u7A7A\uFF09",404)})),r.get("/sessions/:id/entries",x(e,(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=(p)=>Number(n.req.query(p)??Qi),s=n.req.query("around");if(s!==void 0){let p=Number(s),w=i("before"),S=i("after");if(![p,w,S].every(Number.isSafeInteger)||p<1||w<0||S<0)return R(n,"bad_request","invalid around/before/after",400);return v(n,o.entriesAround(p,Math.min(w,2000),Math.min(S,2000)))}let a=n.req.query("from");if(a!==void 0){let p=Number(a),w=Number(n.req.query("limit")??300);if(!Number.isSafeInteger(p)||p<1||!Number.isSafeInteger(w)||w<1)return R(n,"bad_request","invalid from/limit",400);return v(n,o.entriesFrom(p,Math.min(w,2000)))}let c=n.req.query("tail");if(c!==void 0){let p=Number(c);if(!Number.isSafeInteger(p)||p<1)return R(n,"bad_request","invalid tail",400);let w=e.runtime.store.truncationEpoch(o.id),S={entries:o.replayEntries(Math.min(p,2000)),truncationEpoch:w};return v(n,S)}let u=n.req.query("before");if(u!==void 0){let p=Number(u),w=Number(n.req.query("limit")??300);if(!Number.isSafeInteger(p)||p<1||!Number.isSafeInteger(w)||w<1)return R(n,"bad_request","invalid before/limit",400);return v(n,o.entriesBefore(p,Math.min(w,2000)))}let l=Number(n.req.query("after")??0);return v(n,o.entries(l))})),r.post("/sessions/:id/prompt",On(e,!1)),r.post("/sessions/:id/steer",On(e,!0)),r.post("/sessions/:id/unsteer",x(e,async(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);let i=await P(n);if(!Number.isSafeInteger(i.seq)||i.seq<1)return R(n,"bad_request","invalid seq",400);if(!o.unsteer(i.seq))return R(n,"bad_request","\u5F15\u5BFC\u6D88\u606F\u5DF2\u9001\u8FBE\u6A21\u578B\u6216\u4E0D\u53EF\u64A4\u56DE",409);return v(n,{ok:!0})})),r.post("/sessions/:id/abort",x(e,(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);return o.abort(),v(n,{ok:!0})})),r}function On(e,r){return x(e,async(n)=>{let o=e.runtime.get(L(n,"id"));if(!o)return R(n,"not_found","no such session",404);o.assertWritable();let i=e.runtime.plugins.pin();try{let u=await i.invoke("session.input",{error:o.info().parentID?"Direct input to a managed session is unavailable":void 0},o);if(u.error)return R(n,"bad_request",u.error,400)}finally{await i.release()}let s=await P(n),a=typeof s.text==="string"?s.text:"";if(s.attachments!==void 0){if(!Array.isArray(s.attachments)||s.attachments.length>rt||!s.attachments.every(wt))return R(n,"bad_request","invalid attachments",400)}let c=s.attachments?.length?s.attachments:void 0;if(!a.trim()&&!c)return R(n,"bad_request","text is required",400);if(r||s.steer)o.steer(a,c);else o.prompt(a,c);return v(n,o.info())})}function Hn(e){let r=new I;return r.get("/tool-loading",x(e,async(n)=>{await e.runtime.initialize();let o=n.req.query("sessionID"),i=o?e.runtime.get(o):void 0;if(o&&!i)throw new m("no such session");let s=i?await i.toolLoadingInfo():e.runtime.toolLoading.partition(e.runtime.tools.list());return v(n,{settings:e.runtime.toolLoading.settings(),tools:s})})),r.patch("/tool-loading",x(e,async(n)=>{let o=await P(n);try{return v(n,e.runtime.toolLoading.update(o))}catch(i){throw new t(i instanceof Error?i.message:"Invalid tool loading settings")}})),r}function $n(e){let r=new I,n=e.tunnel;if(!n)return r;return r.get("/tunnel",x(e,(o)=>v(o,n.inspectStatus()))),r.put("/tunnel",x(e,async(o)=>{if(!e.authEnabled)throw new t("\u5DF2\u7528 --no-auth \u5173\u95ED\u8BA4\u8BC1\uFF0C\u4E0D\u80FD\u5F00\u542F\u8FDC\u7A0B\u8BBF\u95EE");return v(o,await n.save(await P(o)))})),r.post("/tunnel/login",x(e,(o)=>{if(!e.authEnabled)throw new t("\u5DF2\u7528 --no-auth \u5173\u95ED\u8BA4\u8BC1\uFF0C\u4E0D\u80FD\u5F00\u542F\u8FDC\u7A0B\u8BBF\u95EE");return v(o,n.startLogin())})),r.delete("/tunnel/login",x(e,(o)=>v(o,n.cancelLogin()))),r.post("/tunnel/provision",x(e,async(o)=>{if(!e.authEnabled)throw new t("\u5DF2\u7528 --no-auth \u5173\u95ED\u8BA4\u8BC1\uFF0C\u4E0D\u80FD\u5F00\u542F\u8FDC\u7A0B\u8BBF\u95EE");return v(o,await n.provision(await P(o)))})),r.put("/tunnel/access",x(e,async(o)=>{let i=await P(o);return v(o,await n.setAccess(i.access??null))})),r.delete("/tunnel",x(e,async(o)=>v(o,await n.remove()))),r}function Jn(e){let r=new I,n=e.updates;if(!n)return r;return r.get("/update",x(e,(o)=>v(o,n.status()))),r.post("/update/check",x(e,async(o)=>v(o,await n.check()))),r.post("/update/apply",x(e,async(o)=>{if(!n.status().canApply)return R(o,"bad_request","this installation cannot update itself",400);return v(o,await n.apply())})),r}function zn(e){let r=new WeakSet;e={...e,internalRequest:(i)=>r.has(i)};let n=new I;e.runtime.http={baseUrl:null,auth:e.authEnabled?"token":"none",async request(i){r.add(i);try{return await n.fetch(i)}finally{r.delete(i)}}};let o=Rn({contentTypeFilter:/^application\/json/});return n.use("/api/*",(i,s)=>r.has(i.req.raw)?s():o(i,s)),n.route("/api",Cn(e)),n.route("/api",kn(e)),n.route("/api",Hn(e)),n.route("/api",Mn(e)),n.route("/api",_n(e)),n.route("/api",Dn(e)),n.route("/api",qn(e)),n.route("/api",Jn(e)),n.route("/api",$n(e)),n.route("/api",Tn(e)),n.route("/api",Ln(e)),n.route("/api",jn(e)),n.route("/api",In(e)),n.route("/api",Wn(e)),n.route("/api",Pn(e)),n.all("/api/*",async(i)=>{if(i.req.method==="OPTIONS")return Jr(i,e);if(!e.runtime.plugins.hasRoute(i.req.raw)){if(await e.runtime.initialize(),!e.runtime.plugins.hasRoute(i.req.raw))return R(i,"not_found","not found",404)}let s=e.runtime.plugins.isPublicRoute(i.req.raw);return x(e,async(a)=>{await e.runtime.initialize();let c=await e.runtime.plugins.route(a.req.raw);if(!c)return R(a,"not_found","not found",404);let u=a.req.header("origin");if(u)c.headers.set("access-control-allow-origin",u),c.headers.set("vary","origin");let l=e.authEnabled&&!s?e.auth.verify(z(a.req.raw)):void 0;if(!l)return c;return Zi(e.auth,l,c)},{public:s})(i)}),n}var Yi=2147483647;function Zi(e,r,n){let o=n.body;if(!o)return n;let i=o.getReader(),s=!1,a,c=()=>{},u=()=>{s=!0,clearTimeout(a),c()},l=new ReadableStream({start(p){let w=()=>{if(s)return;u(),p.close(),i.cancel("authentication ended").catch((A)=>console.error("\u5173\u95ED\u63D2\u4EF6\u54CD\u5E94\u6D41\u5931\u8D25",A))},S=()=>{let A=r.token.expires-Date.now();if(A<=0){w();return}a=setTimeout(S,Math.min(A,Yi))};c=e.onRevoke((A)=>{if(A===r.id)w()}),S()},async pull(p){try{let{done:w,value:S}=await i.read();if(s)return;if(w){u(),p.close();return}p.enqueue(S)}catch(w){throw u(),w}},cancel(p){return u(),i.cancel(p)}});return new Response(l,{status:n.status,statusText:n.statusText,headers:n.headers})}var es=1e4,rs=5000;function lo(e){let{runtime:r}=e,n=new Ne(e.dataDir),o=e.network,i=new Set,s={name:"basalt",version:e.version,protocol:gr,auth:e.auth,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,shell:r.serverShell()},a=!e.auth&&We(e.host),c=(y,T,_={})=>{if(a&&!_t(T))return!1;let O=new URL(T.url).hostname.toLowerCase(),N=e.tunnel?.publicURL(),ie=N?new URL(N).hostname.toLowerCase():void 0,X=Se("0.0.0.0",e.port).map((nt)=>nt.address);if(!We(O)&&O!==e.host.toLowerCase()&&O!==ie&&!X.includes(O)&&!e.allowedHosts?.some((nt)=>nt.toLowerCase()===O))return!1;if(!y)return!0;let Me=new URL(T.url);if(y===Me.origin||ns(y,Me))return!0;if(e.tunnel?.publicURL()===y)return!0;return _.wildcard!==!1&&e.origins.includes("*")||e.origins.includes(y)},u,l=async(y)=>{let T=e.tunnel?.access();if(!T)return!1;let _=`${T.teamDomain}/${T.audience}`;if(u?.key!==_)u={key:_,value:Pt(T)};return u.value.denies(y)},p,w=!1,S=new Map,A=new WeakMap,C=zn({runtime:r,auth:n,authEnabled:e.auth,info:s,allowed:c,requestIP:(y)=>(A.get(y)??p)?.requestIP(y)?.address,requestConnection:(y)=>{let T=(A.get(y)??p)?.requestIP(y);return T?`${T.address}:${T.port}`:void 0},modelProviders:e.modelProviders,network:o?{manager:o,runtime:()=>({host:e.host,port:p?.port??e.port,auth:e.auth,lanActive:w,addresses:Se("0.0.0.0",p?.port??e.port).filter((y)=>S.has(y.address)),hostOverride:e.networkHostOverride}),save:(y)=>o.save(y,U)}:void 0,providerAuth:e.providerAuth,proxy:e.proxy,proxyTargets:e.proxyTargets,updates:e.updates,restart:e.restart,shutdown:e.shutdown,autostart:e.autostart,tunnel:e.tunnel,accessDenied:l,approveLocalPairing:e.approveLocalPairing,cliSecret:e.cliSecret,disableTimeout:(y)=>(A.get(y)??p)?.timeout(y,0),heartbeatMs:e.heartbeatMs}),D=(y,T)=>{y.send(JSON.stringify(T))},q=r.subscribe((y)=>{if(y.type==="aborted")return;let T=y,_=y.type==="entry"||y.type==="draft"||y.type==="truncated"||y.type==="entry_removed"?y.sessionID:void 0,O=y.type==="entry"&&y.entry.type==="run"&&y.entry.state==="end"?{type:"run_end",sessionID:y.sessionID,entry:y.entry}:void 0;for(let N of r.connections.values()){if(!_||N.sessions.has(_))N.send(T);if(O)N.send(O)}}),W=async(y,T)=>{if(A.set(y,T),await l(y))return new Response(null,{status:403});if(!c(y.headers.get("origin"),y))return new Response("origin not allowed",{status:403});let _=new URL(y.url).pathname,O=_==="/api/ws"?void 0:r.plugins.websocket(_);if(_!=="/api/ws"&&!O)return new Response("not found",{status:404});if(T.upgrade(y,{data:{authed:!1,subscriptions:new Set,pluginRoute:O}}))return;return new Response("expected websocket",{status:400})},k={hostname:e.host,...o&&e.networkHostOverride===void 0?{reusePort:!0}:{},...e.idleTimeout===void 0?{}:{idleTimeout:e.idleTimeout},development:e.development?{hmr:!0,console:!0}:!1,routes:{"/api/ws":W,"/api/*":(y,T)=>(A.set(y,T),y.headers.get("upgrade")?.toLowerCase()==="websocket"?W(y,T):C.fetch(y)),...e.webStatic,...e.web?{"/*":e.web}:{}},fetch(y,T){if(y.url.includes("/api/"))return A.set(y,T),C.fetch(y);return new Response("not found",{status:404})},websocket:{open(y){i.add(y),y.data.helloTimer=setTimeout(()=>{if(!y.data.authed)y.close(4401,"hello timeout")},es)},async close(y){clearTimeout(y.data.helloTimer),i.delete(y);try{await y.data.connection?.dispose()}finally{await y.data.pluginConnection?.close()}},async message(y,T){if(y.data.authed&&y.data.pluginConnection){if(y.data.expires!==void 0&&Date.now()>=y.data.expires){y.close(4401,"authentication expired");return}await y.data.pluginConnection.message(String(T));return}let _;try{if(_=JSON.parse(String(T)),!_||typeof _!=="object"||typeof _.type!=="string")throw Error("Invalid client message")}catch{D(y,{type:"error",code:"bad_request",message:"invalid JSON"});return}if(_.type==="hello"){if(_.protocol!==gr){D(y,{type:"error",code:"protocol_mismatch",message:`server speaks protocol ${gr}, client ${_.protocol}`}),y.close(4400,"protocol mismatch");return}let N=e.auth?n.verify(_.token):void 0;if(e.auth&&!N){D(y,{type:"error",code:"unauthorized",message:"missing or invalid token"}),y.close(4401,"unauthorized");return}if(y.data.authed){y.close(4400,"already authenticated");return}if(clearTimeout(y.data.helloTimer),y.data.authed=!0,y.data.deviceID=N?.id,y.data.expires=N?.token.expires,y.data.connection=je(r,{deviceID:N?.id,expires:N?.token.expires},y.data.subscriptions,(ie)=>D(y,ie),(ie,X)=>{y.data.authed=!1,y.close(ie,X)}),D(y,{type:"welcome",server:s}),y.data.pluginRoute){let ie={send(X){if(y.data.expires!==void 0&&Date.now()>=y.data.expires){y.close(4401,"authentication expired");return}if(y.data.authed&&i.has(y))y.send(X)},close(X,Me){y.close(X,Me)}};y.data.pluginConnection=y.data.pluginRoute.connect(ie);try{await y.data.pluginConnection.open()}catch(X){console.error("\u63D2\u4EF6 WebSocket \u8FDE\u63A5\u521D\u59CB\u5316\u5931\u8D25\uFF1A",X),y.close(1011,"plugin connection failed")}}return}if(!y.data.authed){y.close(4401,"hello first");return}if(y.data.expires!==void 0&&Date.now()>=y.data.expires){y.close(4401,"authentication expired");return}let O=y.data.connection;if(O&&(_.type==="subscribe"||_.type==="unsubscribe"))try{await O.enqueue(()=>Ae(r,O,_))}catch(N){if(!(N instanceof t)&&!(N instanceof m))throw N;O.send({type:"error",code:N instanceof m?"not_found":"bad_request",message:N.message})}}}};function M(){if(!w||!p)return;let y=p.port??e.port,T=Se("0.0.0.0",y),_=new Set(T.map((O)=>O.address));for(let[O,N]of S){if(_.has(O))continue;S.delete(O),Ee(N,!0)}for(let{address:O}of T){if(S.has(O))continue;let N=Bun.serve({...k,hostname:O,port:y});S.set(O,N)}}function U(y){if(!y.lanEnabled){let _=[...S.values()];if(w=!1,S.clear(),_.length===0)return;for(let N of _)Ee(N,!1);setTimeout(()=>{for(let N of _)Ee(N,!0)},300).unref?.();return}if(!p)throw Error("\u672C\u673A\u670D\u52A1\u5C1A\u672A\u542F\u52A8\uFF0C\u65E0\u6CD5\u5F00\u542F\u5C40\u57DF\u7F51\u8BBF\u95EE\u3002");let T=!w;w=!0;try{M()}catch(_){if(T){w=!1;for(let O of S.values())Ee(O,!0);S.clear()}throw Error("\u5F00\u542F\u5C40\u57DF\u7F51\u76D1\u542C\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7AEF\u53E3\u5360\u7528\u548C\u7CFB\u7EDF\u7F51\u7EDC\u6743\u9650\u540E\u91CD\u8BD5\u3002",{cause:_})}}let F=e.fallbackPort?100:1,te=e.port,me;for(let y=0;y<F;y++)try{p=Bun.serve({...k,port:te});break}catch(T){me=T;let _=T instanceof Error&&"code"in T&&T.code==="EADDRINUSE"||T instanceof Error&&T.message.includes("EADDRINUSE");if(e.fallbackPort&&_){te++;continue}throw T}if(!p)throw me??Error(`Could not bind to any port starting from ${e.port}`);if(o?.settings().lanEnabled&&e.networkHostOverride===void 0)U(o.settings());let ue=n.onRevoke((y)=>{for(let T of r.connections.values())if(T.deviceID===y)T.close(4401,"authentication revoked")}),ge=setInterval(()=>{for(let y of r.connections.values())if("expires"in y&&typeof y.expires==="number"&&Date.now()>=y.expires)y.close(4401,"authentication expired")},1000),V=setInterval(()=>{try{M()}catch(y){console.error("\u5237\u65B0\u5C40\u57DF\u7F51\u76D1\u542C\u5931\u8D25\uFF0C\u5C06\u5728\u4E0B\u4E00\u6B21\u5DE1\u68C0\u65F6\u91CD\u8BD5\uFF1A",y)}},rs);V.unref?.();let Q=e.host;if(Q==="0.0.0.0")Q="127.0.0.1";if(Q==="::")Q="::1";if(Q.includes(":")&&!Q.startsWith("["))Q=`[${Q}]`;let Xt=`http://${Q}:${p.port}`,et=r.http;if(et)et.baseUrl=Xt;let tt=e.development&&e.tunnel?$r(Xt):void 0,ye=new URL(p.url);if(ye.hostname==="0.0.0.0")ye.hostname="127.0.0.1";if(ye.hostname==="[::]")ye.hostname="[::1]";return{server:p,auth:n,url:ye.toString().replace(/\/$/,""),tunnelPort:tt?tt.port:p.port,async stop(){for(let y of S.values())Ee(y,!0);if(S.clear(),clearInterval(V),tt?.stop(),r.http===et)r.http=void 0;q(),ue(),clearInterval(ge);for(let y of i)clearTimeout(y.data.helloTimer);for(let y of r.connections.values())y.close(1001,"server stopping");p.stop(!0),await r.plugins.idle()}}}function Ee(e,r){e.stop(r).catch((n)=>console.error("\u505C\u6B62\u5C40\u57DF\u7F51\u76D1\u542C\u5931\u8D25\uFF1A",n))}function ns(e,r){try{let n=new URL(e);return n.protocol===r.protocol&&n.port===r.port&&We(n.hostname)&&We(r.hostname)}catch{return!1}}import{chmodSync as is,existsSync as Ce,mkdirSync as ss,readFileSync as Qt,rmSync as as,writeFileSync as Fn}from"fs";import{join as G}from"path";var cs=/https:\/\/dash\.cloudflare\.com\/argotunnel\S+/,us=/Created tunnel \S+ with id ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/,Kn=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,ls=/^[a-z0-9-]+\.cloudflareaccess\.com$/,ps=/^[A-Za-z0-9]{16,128}$/,ds=/^[A-Za-z0-9+/=_-]{20,4096}$/;class Ft{options;path;home;loginChild;loginState={state:"idle"};stored;process;accessAppsURLCache;state="off";error;connections=new Set;tail=[];startedAt=0;lastError;restartTimer;backoff;stopping=!1;metricsTimer;metricsAnswered=!1;accessInspection;constructor(e,r){this.options=r;this.path=G(e,"tunnel.json"),this.home=G(e,"cloudflared"),this.backoff=r.backoffMs?.min??2000,this.stored=hs(this.path)}access(){return this.stored?.access}publicURL(){return this.stored?`https://${this.stored.hostname}`:void 0}running(){return this.process!==void 0}status(){let e=this.accessAppsURL();return{configured:this.stored!==void 0,...this.stored?{hostname:this.stored.hostname,access:this.stored.access}:{},...e?{accessAppsURL:e}:{},hasToken:this.stored?.token!==void 0,...this.stored?{mode:this.stored.token===void 0?"local":"token"}:{},login:this.hasCert()?{state:"done"}:this.loginState,binary:this.binary()!==void 0,install:Vn(),state:this.stored?this.state:"off",...this.visibleError()?{error:this.visibleError()}:{},localPort:this.options.localPort(),...this.stored?{publicURL:this.publicURL()}:{}}}inspectStatus(){let e=this.status(),r=e.hostname;if(!r)return e;let n=this.accessInspection;if(!n||n.hostname!==r)n={hostname:r,checkedAt:0,pending:!1,state:"checking"},this.accessInspection=n;if(!n.pending&&Date.now()-n.checkedAt>=30000){n.pending=!0;let o=n;kt(r,{reportFailure:!0}).then((i)=>{o.team=i,o.state=i?"login":"no-login",o.checkedAt=Date.now(),o.pending=!1},()=>{o.team=void 0,o.state="error",o.checkedAt=Date.now(),o.pending=!1})}return{...e,cloudAccessState:n.state,...n.team?{cloudAccessTeam:n.team}:{}}}binary(){if(this.options.binary)return Ce(this.options.binary)?this.options.binary:void 0;let e=Bun.which("cloudflared");if(e)return e;if(process.platform!=="win32")return;let r=[process.env["ProgramFiles(x86)"],process.env.ProgramFiles].filter((n)=>n!==void 0).map((n)=>G(n,"cloudflared"));return Bun.which("cloudflared",{PATH:r.join(";")})??void 0}async save(e,r={}){let n=e.hostname?.trim().toLowerCase();if(!n||!Kn.test(n))throw new t("\u4E3B\u673A\u540D\u683C\u5F0F\u4E0D\u5BF9\uFF0C\u5E94\u5F62\u5982 basalt.example.com");let o=e.token?.trim(),i=o?ga(o):this.stored?.token;if(o&&!i)throw new t("\u6CA1\u627E\u5230\u96A7\u9053\u4EE4\u724C\uFF08\u4EE5 eyJ \u5F00\u5934\uFF09\uFF0C\u8BF7\u4ECE Cloudflare \u9875\u9762\u5B8C\u6574\u590D\u5236");if(!i)throw new t("\u9700\u8981\u586B\u5199\u96A7\u9053\u4EE4\u724C");if(!ds.test(i))throw new t("\u96A7\u9053\u4EE4\u724C\u683C\u5F0F\u4E0D\u5BF9\uFF0C\u8BF7\u5B8C\u6574\u590D\u5236 Cloudflare \u91CC\u7684\u4EE4\u724C");let s=e.access===void 0?this.stored?.access:await this.resolveAccess(e.access??void 0,n);if(await this.stop(),this.stored={hostname:n,token:i,...s?{access:s}:{}},Gt(this.path,this.stored),r.start??!0)this.start();return this.status()}async remove(){return this.cancelLogin(),await this.stop(),as(this.path,{force:!0}),this.stored=void 0,this.state="off",this.error=void 0,this.status()}hasCert(){return Ce(G(this.home,".cloudflared","cert.pem"))}accessAppsURL(){if(this.accessAppsURLCache)return this.accessAppsURLCache;try{let e=Qt(G(this.home,".cloudflared","cert.pem"),"utf8"),r=JSON.parse(Buffer.from(e.replace(/-----[A-Z ]+-----/g,"").replace(/\s+/g,""),"base64").toString("utf8"));if(r&&typeof r==="object"&&"accountID"in r&&typeof r.accountID==="string")this.accessAppsURLCache=`https://dash.cloudflare.com/${r.accountID}/one/access-controls/apps`}catch{}return this.accessAppsURLCache}localEnv(){return{...process.env,HOME:this.home,USERPROFILE:this.home}}writeConfig(e,r){let n=G(this.home,"config.yml");return Fn(n,[`tunnel: ${e}`,`credentials-file: ${G(this.home,".cloudflared",`${e}.json`)}`,"ingress:",` - hostname: ${r}`,` service: http://127.0.0.1:${this.options.localPort()}`," - service: http_status:404",""].join(`
|
|
10
|
-
`),{mode:384}),n}startLogin(){if(this.hasCert()||this.loginChild)return this.status();let e=this.binary();if(!e)throw new t(Ze());ss(G(this.home,".cloudflared"),{recursive:!0,mode:448});let r=Bun.spawn([e,"tunnel","login"],{env:this.localEnv(),stdin:"ignore",stdout:"pipe",stderr:"pipe",windowsHide:!0});this.loginChild=r,this.loginState={state:"waiting"};let n=[],o=async(i)=>{let s=new TextDecoder;try{for await(let a of i){let c=s.decode(a,{stream:!0});for(let l of c.split(`
|
|
11
|
-
`))if(l.trim())n.push(l.trim());let u=cs.exec(c)?.[0];if(u&&this.loginChild===r)this.loginState={state:"waiting",url:u}}}catch{}};return o(r.stdout),o(r.stderr),r.exited.then((i)=>{if(this.loginChild!==r)return;this.loginChild=void 0,this.loginState=i===0&&this.hasCert()?{state:"done"}:{state:"error",error:`\u6388\u6743\u6CA1\u6709\u5B8C\u6210\uFF1A${n.at(-1)??`cloudflared \u5DF2\u9000\u51FA\uFF08${i}\uFF09`}`}}),this.status()}cancelLogin(){let e=this.loginChild;return this.loginChild=void 0,this.loginState={state:"idle"},e?.kill(),this.status()}async provision(e){let r=e.hostname?.trim().toLowerCase();if(!r||!Kn.test(r))throw new t("\u4E3B\u673A\u540D\u683C\u5F0F\u4E0D\u5BF9\uFF0C\u5E94\u5F62\u5982 basalt.example.com");if(!this.hasCert())throw new t("\u8FD8\u6CA1\u6709\u8FDE\u63A5 Cloudflare\uFF0C\u8BF7\u5148\u5B8C\u6210\u6388\u6743");let n=await this.resolveAccess(e.access??void 0,r);await this.stop();let o=this.stored?.token===void 0&&this.stored?.hostname===r?this.stored.tunnelId:void 0;if(!o){let a=G(this.home,"config.yml");if(Ce(a)){let c=Qt(a,"utf8"),u=/^ {2}- hostname: (\S+)$/m.exec(c)?.[1],l=/^tunnel: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/m.exec(c)?.[1];if(u===r&&l&&Ce(G(this.home,".cloudflared",`${l}.json`)))o=l}}let i=o!==void 0;if(!o){let a=await this.run(["tunnel","create",`basalt-${crypto.randomUUID().slice(0,8)}`]);if(o=us.exec(a.text)?.[1],a.code!==0||!o)throw new t(`\u521B\u5EFA\u96A7\u9053\u5931\u8D25\uFF1A${Gn(a.text)}`)}let s=await this.run(["tunnel","route","dns",o,r]);if(s.code!==0){if(!i)await this.run(["tunnel","delete","-f",o]);throw new t(`\u7ED9 ${r} \u6DFB\u52A0\u57DF\u540D\u89E3\u6790\u5931\u8D25\uFF1A${Gn(s.text)}\uFF08\u8BF7\u786E\u8BA4\u5B83\u5C5E\u4E8E\u4F60\u521A\u624D\u6388\u6743\u7684\u57DF\u540D\uFF0C\u4E14\u8FD8\u6CA1\u6709\u540C\u540D\u7684 DNS \u8BB0\u5F55\uFF09`)}return this.stored={hostname:r,tunnelId:o,...n?{access:n}:{}},Gt(this.path,this.stored),this.start(),this.status()}async setAccess(e){if(!this.stored)throw new t("\u8FD8\u6CA1\u6709\u914D\u7F6E\u8FDC\u7A0B\u8BBF\u95EE");let r=await this.resolveAccess(e??void 0,this.stored.hostname);if(this.stored={...this.stored,access:r},!r)delete this.stored.access;return Gt(this.path,this.stored),this.status()}async resolveAccess(e,r){if(!e)return;let n=e.teamDomain?.trim().toLowerCase(),o=e.audience?.trim();if(!ps.test(o??""))throw new t("Audience \u6807\u7B7E\u683C\u5F0F\u4E0D\u5BF9\uFF0C\u8BF7\u5B8C\u6574\u590D\u5236");if(!n){let i=await kt(r);if(!i)throw new t(`\u6CA1\u68C0\u6D4B\u5230 ${r} \u4E0A\u7684 Access \u5E94\u7528\uFF0C\u8BF7\u5148\u5728 Cloudflare \u7ED9\u8BE5\u57DF\u540D\u5EFA\u597D\u5E94\u7528\uFF08\u6216\u624B\u52A8\u586B\u5199\u56E2\u961F\u57DF\u540D\uFF09`);return{teamDomain:i,audience:o}}if(!ls.test(n))throw new t("\u56E2\u961F\u57DF\u540D\u5E94\u5F62\u5982 myteam.cloudflareaccess.com");return{teamDomain:n,audience:o}}async run(e){let r=this.binary();if(!r)throw new t(Ze());let n=Bun.spawn([r,...e],{env:this.localEnv(),stdin:"ignore",stdout:"pipe",stderr:"pipe",windowsHide:!0}),o=setTimeout(()=>n.kill(),60000);try{let[i,s,a]=await Promise.all([new Response(n.stdout).text(),new Response(n.stderr).text(),n.exited]);return{code:a,text:`${i}
|
|
12
|
-
${s}`}}finally{clearTimeout(o)}}visibleError(){if(this.error)return this.error;if(this.state!=="starting"||!this.lastError)return;return Date.now()-this.startedAt>=(this.options.errorAfterMs??8000)?this.lastError:void 0}start(){if(!this.stored||this.process)return;this.stopping=!1,clearTimeout(this.restartTimer);let e=this.binary();if(!e){this.state="missing-binary",this.error=Ze();return}this.state="starting",this.error=void 0,this.connections.clear(),this.tail=[],this.startedAt=Date.now(),this.lastError=void 0;let{token:r,tunnelId:n,hostname:o}=this.stored,i=gs();this.metricsAnswered=!1;let s=["tunnel","--no-autoupdate","--metrics",`127.0.0.1:${i}`],a=r===void 0?this.localEnv():{...process.env,TUNNEL_TOKEN:r};if(r===void 0&&n)s.push("--config",this.writeConfig(n,o)),s.push("run",n);else s.push("run");let c;try{c=Bun.spawn([e,...s],{env:a,stdin:"ignore",stdout:"pipe",stderr:"pipe",windowsHide:!0})}catch(u){let l=u instanceof Error&&"code"in u&&u.code==="ENOENT";this.state=l?"missing-binary":"error",this.error=l?Ze():`\u65E0\u6CD5\u542F\u52A8 cloudflared\uFF1A${u instanceof Error?u.message:u}`;return}this.process=c,this.metricsTimer=setInterval(()=>void this.pollReady(i,c),this.options.readyPollMs??1000),this.pump(c.stdout,r),this.pump(c.stderr,r),c.exited.then((u)=>this.exited(c,u))}async stop(){this.stopping=!0,clearTimeout(this.restartTimer),clearInterval(this.metricsTimer);let e=this.process;if(!e)return;if(e.kill(),await Promise.race([e.exited,Bun.sleep(5000)]),this.process===e)e.kill("SIGKILL"),this.process=void 0;this.state="off",this.connections.clear()}exited(e,r){if(this.process!==e)return;if(clearInterval(this.metricsTimer),this.process=void 0,this.connections.clear(),this.stopping)return;this.state="error",this.error=ms(this.tail,r),this.restartTimer=setTimeout(()=>this.start(),this.backoff),this.backoff=Math.min(this.backoff*2,this.options.backoffMs?.max??30000)}async pollReady(e,r){try{let o=await(await fetch(`http://127.0.0.1:${e}/ready`,{signal:AbortSignal.timeout(800)})).json();if(this.process!==r||!o||typeof o!=="object"||!("readyConnections"in o))return;if(typeof o.readyConnections!=="number")return;if(this.metricsAnswered=!0,o.readyConnections>0)this.state="connected",this.error=void 0,this.lastError=void 0,this.backoff=this.options.backoffMs?.min??2000;else if(this.state==="connected")this.state="starting"}catch{}}async pump(e,r){let n=new TextDecoder,o="";try{for await(let i of e){o+=n.decode(i,{stream:!0});let s=o.split(`
|
|
13
|
-
`);o=s.pop()??"";for(let a of s)this.line(r?a.replaceAll(r,"***"):a)}}catch{}}line(e){let r=e.trim();if(!r)return;this.tail=[...this.tail,r].slice(-20);let n=fs(r);if(n)this.lastError=n;let o=/connIndex=(\d+)/.exec(r)?.[1];if(this.metricsAnswered)return;if(o!==void 0&&r.includes("Registered tunnel connection"))this.connections.add(o),this.state="connected",this.error=void 0,this.lastError=void 0,this.backoff=this.options.backoffMs?.min??2000;else if(o!==void 0&&/Unregistered tunnel connection|Connection terminated/.test(r)){if(this.connections.delete(o),this.connections.size===0&&this.state==="connected")this.state="starting"}}}function hs(e){if(!Ce(e))return;try{let r=JSON.parse(Qt(e,"utf8"));if(!r||typeof r!=="object")return;let{hostname:n,token:o,tunnelId:i,access:s}=r;if(typeof n!=="string")return;let a=s?.teamDomain&&s.audience?{access:s}:{};if(typeof o==="string")return{hostname:n,token:o,...a};if(typeof i==="string")return{hostname:n,tunnelId:i,...a};return}catch{return}}function Gt(e,r){Fn(e,JSON.stringify(r),{mode:384}),is(e,384)}function ms(e,r){let n=e.join(`
|
|
14
|
-
`);if(/Unauthorized|token is not valid/i.test(n))return"\u4EE4\u724C\u65E0\u6548\u6216\u5DF2\u88AB\u64A4\u9500\uFF0C\u8BF7\u5230 Cloudflare \u91CD\u65B0\u590D\u5236";let o=e.at(-1);return o?`cloudflared \u5DF2\u9000\u51FA\uFF08${r}\uFF09\uFF1A${o}`:`cloudflared \u5DF2\u9000\u51FA\uFF08${r}\uFF09`}var Vt="https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/";function Vn(){if(process.platform==="darwin")return{command:"brew install cloudflared",url:Vt};if(process.platform==="win32")return{command:"winget install --id Cloudflare.cloudflared",url:Vt};return{url:Vt}}function Ze(){let{command:e,url:r}=Vn();return e?`\u6CA1\u627E\u5230 cloudflared\uFF0C\u8BF7\u5148\u5B89\u88C5\uFF1A${e}`:`\u6CA1\u627E\u5230 cloudflared\uFF0C\u8BF7\u6309\u5B98\u65B9\u6587\u6863\u5B89\u88C5\uFF1A${r}`}function fs(e){let n=/\bERR\b\s+(.*)$/.exec(e)?.[1]?.replace(/\s+event=\d+$/,"").trim();if(!n)return;if(/^(Please try|\d\.\s|Run your|See GitHub|For example|https?:)/.test(n))return;return n.length>200?`${n.slice(0,200)}\u2026`:n}function gs(){let e=Bun.serve({port:0,hostname:"127.0.0.1",fetch:()=>new Response}),r=e.port;if(e.stop(!0),r===void 0)throw Error("no free port");return r}function Gn(e){return e.split(`
|
|
15
|
-
`).map((n)=>n.replace(/^\d{4}-\d\d-\d\dT\S+\s+(ERR|INF|WRN)\s+/,"").trim()).filter(Boolean).at(-1)??"\u6CA1\u6709\u8F93\u51FA"}export{E,Re,yn,Ca,Cs,so,ao,bn,lo,Ft};
|
package/chunk-1a4rrb2v.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import"./chunk-nqzqm9ad.js";import"./chunk-edz2cxtp.js";import{nn}from"./chunk-m51tryxx.js";import{Pt,yt,kt}from"./chunk-w3tzsrkw.js";import{ct}from"./chunk-a25etmgf.js";import{le}from"./chunk-nfgg1ksw.js";import{vn}from"./chunk-epqgd8d0.js";import{K,X}from"./chunk-dkfpqbcr.js";import{Ne,Z}from"./chunk-3wqncn58.js";import{J}from"./chunk-7h6k7vac.js";import{ei,Fn}from"./chunk-5gk93yp2.js";import{z,Ot,Se,ce,Ee,Te,Q}from"./chunk-d47bpkyz.js";import{W,ht,br,Fe}from"./chunk-82bb3whz.js";var _e="https://chatgpt.com/backend-api",ke="https://api.openai.com/auth",ve=0,ee=1000,Re=60000,Ce=15000,xe=3,ae=new Set(["openai","openai-codex","opencode"]),Oe=1009,Ae="websocket_connection_limit_reached",Me="previous_response_not_found",We=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function te(e){if(e.stopReason==="pending")throw Error("Codex stream ended without a stop reason");if(e.stopReason==="error"||e.stopReason==="aborted")throw Error(e.errorMessage||"An unknown error occurred")}function Le(e){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(e)}function De(e,r){if(e===429&&Le(r))return!1;if(e===429||e===500||e===502||e===503||e===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(r)}function qe(e){let r=e.get("retry-after-ms");if(r!==null){let s=Number(r);if(Number.isFinite(s))return Math.max(0,s)}let t=e.get("retry-after");if(!t)return;let n=Number(t);if(Number.isFinite(n))return Math.max(0,n*1000);let o=Date.parse(t);if(!Number.isNaN(o))return Math.max(0,o-Date.now());return}class j extends Error{}function Be(e,r){let t=r?.maxRetryDelayMs??Re;if(t>0&&e>t)throw new j(`Server requested ${Math.ceil(e/1000)}s retry delay (max: ${Math.ceil(t/1000)}s)`);return e}function re(e,r){return new Promise((t,n)=>{if(r?.aborted){n(Error("Request was aborted"));return}let o=setTimeout(t,e);r?.addEventListener("abort",()=>{clearTimeout(o),n(Error("Request was aborted"))})})}function ne(e){if(e===void 0)return;if(!Number.isFinite(e)||e<0)throw Error(`Invalid timeoutMs: ${String(e)}`);return Math.floor(e)}function Pe(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function Ie(e){let r=Pe();if(!r||typeof r.zstdCompressSync!=="function")return null;try{let t=r.zstdCompressSync(e,{params:{[r.constants.ZSTD_c_compressionLevel]:xe}});return new Uint8Array(t)}catch{return null}}var Ue=(e,r,t)=>{let n=new W,o=ce(r,e.compat?.supportsMidConvoSystemMessages);return(async()=>{let s={role:"assistant",content:[],api:"openai-codex-responses",provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"pending",timestamp:Date.now()};try{let i=t?.apiKey;if(!i)throw Error(`No API key for provider: ${e.provider}`);let u=gt(i),a=Ne(Ee(o.messages),e.compat?.supportsOpenAIGrammarTools??!1),d=t?.cacheRetention==="none"?void 0:t?.sessionId,p=ct(d),c=$e(e,o,t,p,a),l=await t?.onPayload?.(c,e);if(l!==void 0)c=l;let f=p||Fn(),m=St(e.headers,t?.headers,u,i,p),b=Et(e.headers,t?.headers,u,i,f),h=JSON.stringify(c),E=ne(t?.timeoutMs),w=ne(t?.websocketConnectTimeoutMs),v=t?.transport||"auto",T=!1,y=v!=="sse"&&me(d);if(y)se(d);if(v!=="sse"&&!y){let S=!1,k=!1,O=!1;while(!0){S=!1;try{if(await bt(Je(e.baseUrl),c,b,s,n,e,()=>{if(S=!0,!T)T=!0,n.push({type:"start",partial:s})},E,w,d,u,a,t),t?.signal?.aborted)throw Error("Request was aborted");te(s),n.push({type:"done",reason:s.stopReason,message:s}),n.end();return}catch(R){let N=t?.signal?.aborted,q=!S&&Ge(R),M=je(R);if(!N&&M&&!O){O=!0;continue}if(!N&&q&&!k){k=!0;continue}if(N||Ke(R)&&!q)throw R;if(Fe(s,br("provider_transport_failure",R,{configuredTransport:v,...S?{}:{fallbackTransport:"sse"},eventsEmitted:S,phase:S?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(h).byteLength})),rt(d,R),S)throw R;se(d);break}}}let x=Ie(h);if(x)m.set("content-encoding","zstd");let A=x??h,_,D,U=t?.maxRetries??ve;for(let S=0;S<=U;S++){if(t?.signal?.aborted)throw Error("Request was aborted");try{let k=E!==void 0&&E>0?AbortSignal.timeout(E):void 0,O=nn([t?.signal,k]);try{_=await(t?.fetch??globalThis.fetch)(de(e.baseUrl),{method:"POST",headers:m,body:A,signal:O.signal})}catch(M){if(k?.aborted&&!t?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${E}ms`);throw M}finally{O.cleanup()}if(await t?.onResponse?.({status:_.status,headers:J(_.headers)},e),_.ok)break;let R=await _.text();if(S<U&&De(_.status,R)){let M=qe(_.headers),ge=M===void 0?ee*2**S:Be(M,t);await re(ge,t?.signal);continue}let N=new Response(R,{status:_.status,statusText:_.statusText}),q=await wt(N);throw Error(q.friendlyMessage||q.message)}catch(k){if(k instanceof Error){if(k.name==="AbortError"||k.message==="Request was aborted")throw Error("Request was aborted")}if(D=k instanceof Error?k:Error(String(k)),S<U&&!(D instanceof j)&&!D.message.includes("usage limit")){let O=ee*2**S;await re(O,t?.signal);continue}throw D}}if(!_?.ok)throw D??Error("Failed after retries");if(!_.body)throw Error("No response body");if(!T)T=!0,n.push({type:"start",partial:s});if(await He(_,s,n,e,a,t),t?.signal?.aborted)throw Error("Request was aborted");te(s),n.push({type:"done",reason:s.stopReason,message:s}),n.end()}catch(i){for(let u of s.content)delete u.partialJson,delete u.customInput;s.stopReason=t?.signal?.aborted?"aborted":"error",s.errorMessage=X(K(i)),n.push({type:"error",reason:s.stopReason,error:s}),n.end()}})(),n},Ut=(e,r,t)=>{let n=t?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let o={...Z(e,r,t,n),toolChoice:t?.toolChoice},s=t?.reasoning?Q(e,t.reasoning):void 0;return Ue(e,r,{...o,reasoningEffort:s==="off"?void 0:s})};function $e(e,r,t,n,o=Ne(Ee(r.messages),e.compat?.supportsOpenAIGrammarTools??!1)){let s=e.compat?.supportsStrictMode??!0,i=e.compat?.supportsOpenAIGrammarTools??!1,u=e.compat?.supportsAdditionalTools??!1,a=e.compat?.supportsToolSearch??!1,d=Te(r.messages,u||a),p=Pt(e,r,ae,{includeSystemPrompt:!1,grammarToolInputProperties:o,supportsMidConvoSystemMessages:e.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:u,supportsToolSearch:a,toolOptions:{strict:null,supportsStrictMode:s,supportsOpenAIGrammarTools:i}}),c=Se(r.messages),l=c?z(c):"",f={model:e.id,store:!1,stream:!0,instructions:l||"You are a helpful assistant.",input:p,text:{verbosity:t?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:n,tool_choice:t?.toolChoice??"auto",parallel_tool_calls:!0};if(t?.temperature!==void 0)f.temperature=t.temperature;if(t?.serviceTier!==void 0)f.service_tier=t.serviceTier;if(d.requestTools.length>0)f.tools=yt(d.requestTools,{strict:null,supportsStrictMode:s,supportsOpenAIGrammarTools:i});if(t?.reasoningEffort!==void 0){let m=t.reasoningEffort==="none"?e.thinkingLevelMap?.off===void 0?"none":e.thinkingLevelMap.off:e.thinkingLevelMap?.[t.reasoningEffort]??t.reasoningEffort;if(m!==null)f.reasoning={effort:m,summary:t.reasoningSummary??"auto"}}else if(e.reasoning&&e.thinkingLevelMap?.off!==null)f.reasoning={effort:e.thinkingLevelMap?.off??"none"};return f}function ze(e,r){switch(r){case"flex":return 0.5;case"priority":return e.id==="gpt-5.5"?2.5:2;default:return 1}}function ue(e,r,t){let n=ze(t,r);if(n===1)return;e.cost.input*=n,e.cost.output*=n,e.cost.cacheRead*=n,e.cost.cacheWrite*=n,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite}function fe(e,r){if(e==="default"&&(r==="flex"||r==="priority"))return r;return e??r}function de(e){let t=(e&&e.trim().length>0?e:_e).replace(/\/+$/,"");if(t.endsWith("/codex/responses"))return t;if(t.endsWith("/codex"))return`${t}/responses`;return`${t}/codex/responses`}function Je(e){let r=new URL(de(e));if(r.protocol==="https:")r.protocol="wss:";if(r.protocol==="http:")r.protocol="ws:";return r.toString()}async function He(e,r,t,n,o,s){await kt(pe(Ye(e,s?.signal),r,n,s?.onProviderStreamEvent),r,t,n,{serviceTier:s?.serviceTier,grammarToolInputProperties:o,resolveServiceTier:fe,applyServiceTierPricing:(i,u)=>ue(i,u,n)})}class L extends Error{code;payload;constructor(e,r){super(e);this.name="CodexApiError",this.code=r?.code,this.payload=r?.payload,this.cause=r?.cause}}class F extends Error{payload;constructor(e,r){super(e);this.name="CodexProtocolError",this.payload=r?.payload,this.cause=r?.cause}}class V extends Error{constructor(e){super(ht(e));this.name="ProviderStreamEventCallbackError",this.cause=e}}function Ke(e){return e instanceof L||e instanceof F||e instanceof V}function Ge(e){return e instanceof L&&e.code===Ae}function je(e){return e instanceof L&&e.code===Me}function Ve(e){let r=e.error&&typeof e.error==="object"?e.error:void 0;return{code:typeof e.code==="string"?e.code:typeof r?.code==="string"?r.code:void 0,message:typeof e.message==="string"?e.message:typeof r?.message==="string"?r.message:void 0}}async function*pe(e,r,t,n){for await(let o of e){try{await n?.(o,t)}catch(i){throw new V(i)}let s=typeof o.type==="string"?o.type:void 0;if(!s)continue;if(s==="error"){let{code:i,message:u}=Ve(o);throw new L(`Codex error: ${u||i||JSON.stringify(o)}`,{code:i,payload:o})}if(s==="response.failed"){let i=o.response,u=i?.error?.code,a=i?.error?.message;throw new L(a||"Codex response failed",{code:u,payload:o})}if(s==="response.done"||s==="response.completed"||s==="response.incomplete"){let i=o.response;if(typeof i?.end_turn==="boolean")r.endTurn=i.end_turn;let u=i?{...i,status:Xe(i.status)}:i;yield{...o,type:"response.completed",response:u};return}yield o}}function Xe(e){if(typeof e!=="string")return;return We.has(e)?e:void 0}async function*Ye(e,r){if(!e.body)return;let t=e.body.getReader(),n=new TextDecoder,o="",s=()=>{t.cancel().catch(()=>{})};r?.addEventListener("abort",s,{once:!0});try{while(!0){if(r?.aborted)throw Error("Request was aborted");let{done:i,value:u}=await t.read();if(r?.aborted)throw Error("Request was aborted");if(o+=i?n.decode():n.decode(u,{stream:!0}),i&&o.trim())o+=`
|
|
3
|
-
|
|
4
|
-
`;let a=o.indexOf(`
|
|
5
|
-
|
|
6
|
-
`);while(a!==-1){let d=o.slice(0,a);o=o.slice(a+2);let p=d.split(`
|
|
7
|
-
`).filter((c)=>c.startsWith("data:")).map((c)=>c.slice(5).trim());if(p.length>0){let c=p.join(`
|
|
8
|
-
`).trim();if(c&&c!=="[DONE]")try{yield JSON.parse(c)}catch(l){throw new F(`Invalid Codex SSE JSON: ${ht(l)}`,{cause:l,payload:c})}}a=o.indexOf(`
|
|
9
|
-
|
|
10
|
-
`)}if(i)break}}finally{r?.removeEventListener("abort",s);try{await t.cancel()}catch{}try{t.releaseLock()}catch{}}}var Ze="responses_websockets=2026-02-06",Qe=300000,et=3300000,g=new Map,B=new Map,I=new Set;function Y(e){let r=B.get(e);if(!r)r={requests:0,connectionsCreated:0,connectionsReused:0,cachedContextRequests:0,storeTrueRequests:0,fullContextRequests:0,deltaRequests:0,lastInputItems:0,websocketFailures:0,sseFallbacks:0},B.set(e,r);return r}function $t(e){let r=B.get(e);return r?{...r}:void 0}function zt(e){if(e){B.delete(e),I.delete(e);return}B.clear(),I.clear()}function tt(e){let r=(t)=>{if(t.idleTimer)clearTimeout(t.idleTimer);C(t.socket,1000,"debug_close")};if(e){for(let t of g.get(e)?.values()??[])r(t);g.delete(e);return}for(let t of g.values())for(let n of t.values())r(n);g.clear()}ei(tt);function me(e){return e?I.has(e):!1}function se(e){if(!e)return;let r=Y(e);r.sseFallbacks++,r.websocketFallbackActive=me(e)}function rt(e,r){if(!e)return;I.add(e);let t=Y(e);t.websocketFailures++,t.lastWebSocketError=ht(r),t.websocketFallbackActive=!0}var H=null;async function nt(e){if(!e&&H)return H;if(typeof process<"u"&&process.versions?.bun){let t=class extends WebSocket{constructor(n,o){let s={};if(Array.isArray(o)||typeof o==="string")s={protocols:o};else s={...o};let i=vn(n.toString().replace(/^wss:/,"https:").replace(/^ws:/,"http:"),e);super(n,{...s,...i?{proxy:i.toString()}:{}})}};if(!e)H=t;return t}let r=globalThis.WebSocket;if(typeof r!=="function")return null;return r}class ye extends Error{code;reason;wasClean;constructor(e,r){super(e);this.name="WebSocketCloseError",this.code=r?.code,this.reason=r?.reason,this.wasClean=r?.wasClean}}function st(e){let r=e.readyState;return typeof r==="number"?r:void 0}function P(e){let r=st(e);return r===void 0||r===1}function ot(e){return Date.now()-e.createdAt>=et}function C(e,r=1000,t="done"){try{e.close(r,t)}catch{}}function oe(e,r,t){if(t.idleTimer)clearTimeout(t.idleTimer);t.idleTimer=setTimeout(()=>{if(t.busy)return;C(t.socket,1000,"idle_timeout");let n=g.get(e);if(n?.get(r)===t)n.delete(r);if(n?.size===0)g.delete(e)},Qe)}async function G(e,r,t,n=Ce,o){let s=await nt(o);if(!s)throw Error("WebSocket transport is not available in this runtime");let i=J(r);return delete i["OpenAI-Beta"],new Promise((u,a)=>{let d=!1,p,c;try{c=new s(e,{headers:i})}catch(w){a(w instanceof Error?w:Error(String(w)));return}let l=()=>{if(p)clearTimeout(p),p=void 0;c.removeEventListener("open",m),c.removeEventListener("error",b),c.removeEventListener("close",h),t?.removeEventListener("abort",E)},f=(w,v)=>{if(d)return;if(d=!0,l(),v)C(c,1000,v);a(w)},m=()=>{if(d)return;d=!0,l(),u(c)},b=(w)=>{f(be(w))},h=(w)=>{f(he(w))},E=()=>{f(Error("Request was aborted"),"aborted")};if(c.addEventListener("open",m),c.addEventListener("error",b),c.addEventListener("close",h),t?.addEventListener("abort",E),n>0)p=setTimeout(()=>{f(Error(`WebSocket connect timeout after ${n}ms`),"connect_timeout")},n);if(t?.aborted)E()})}async function it(e,r,t,n,o,s,i){if(!t){let c=await G(e,r,o,s,i);return{socket:c,reused:!1,release:()=>C(c)}}let u=g.get(t),a=u?.get(n);if(a){if(a.idleTimer)clearTimeout(a.idleTimer),a.idleTimer=void 0;if(!a.busy&&ot(a)){if(C(a.socket,1000,"connection_age_limit"),u?.delete(n),u?.size===0)g.delete(t)}else if(!a.busy&&P(a.socket))return a.busy=!0,{socket:a.socket,entry:a,reused:!0,release:({keep:c}={})=>{if(!c||!P(a.socket)){C(a.socket);let l=g.get(t);if(l?.get(n)===a)l.delete(n);if(l?.size===0)g.delete(t);return}a.busy=!1,oe(t,n,a)}};if(a.busy){let c=await G(e,r,o,s,i);return{socket:c,reused:!1,release:()=>{C(c)}}}if(!P(a.socket)){if(C(a.socket),u?.delete(n),u?.size===0)g.delete(t)}}let d=await G(e,r,o,s,i),p={socket:d,busy:!0,createdAt:Date.now()};if(u=g.get(t),!u)u=new Map,g.set(t,u);return u.set(n,p),{socket:d,entry:p,reused:!1,release:({keep:c}={})=>{if(!c||!P(p.socket)){if(C(p.socket),p.idleTimer)clearTimeout(p.idleTimer);let l=g.get(t);if(l?.get(n)===p)l.delete(n);if(l?.size===0)g.delete(t);return}p.busy=!1,oe(t,n,p)}}}function be(e){if(e&&typeof e==="object"){let r="message"in e?e.message:void 0;if(typeof r==="string"&&r.length>0)return Error(r);let t="error"in e?e.error:void 0;if(t instanceof Error&&t.message.length>0)return t;if(t&&typeof t==="object"&&"message"in t){let n=t.message;if(typeof n==="string"&&n.length>0)return Error(n)}}return Error("WebSocket error")}function he(e){if(e&&typeof e==="object"){let r="code"in e?e.code:void 0,t="reason"in e?e.reason:void 0,n="wasClean"in e?e.wasClean:void 0,o=typeof r==="number"?` ${r}`:"",s=typeof t==="string"&&t.length>0?` ${t}`:"";if(!s&&r===Oe)s=" message too big";return new ye(`WebSocket closed${o}${s}`.trim(),{code:typeof r==="number"?r:void 0,reason:typeof t==="string"&&t.length>0?t:void 0,wasClean:typeof n==="boolean"?n:void 0})}return Error("WebSocket closed")}async function at(e){if(typeof e==="string")return e;if(e instanceof ArrayBuffer)return new TextDecoder().decode(new Uint8Array(e));if(ArrayBuffer.isView(e)){let r=e;return new TextDecoder().decode(new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}if(e&&typeof e==="object"&&"arrayBuffer"in e){let t=await e.arrayBuffer();return new TextDecoder().decode(new Uint8Array(t))}return null}async function*ut(e,r,t){let n=[],o=null,s=!1,i=null,u=!1,a=()=>{if(!o)return;let f=o;o=null,f()},d=(f)=>{(async()=>{let m=null;try{if(!f||typeof f!=="object"||!("data"in f))return;if(m=await at(f.data),!m)return;let b=JSON.parse(m),h=typeof b.type==="string"?b.type:"";if(h==="response.completed"||h==="response.done"||h==="response.incomplete")u=!0,s=!0;n.push(b),a()}catch(b){i=new F(`Invalid Codex WebSocket JSON: ${ht(b)}`,{cause:b,payload:m}),s=!0,a()}})()},p=(f)=>{i=be(f),s=!0,a()},c=(f)=>{if(u){s=!0,a();return}if(!i)i=he(f);s=!0,a()},l=()=>{i=Error("Request was aborted"),s=!0,a()};e.addEventListener("message",d),e.addEventListener("error",p),e.addEventListener("close",c),r?.addEventListener("abort",l);try{while(!0){if(r?.aborted)throw Error("Request was aborted");if(n.length>0){yield n.shift();continue}if(s)break;let f;await new Promise((m,b)=>{if(o=m,t!==void 0&&t>0)f=setTimeout(()=>{let h=Error(`WebSocket idle timeout after ${t}ms`);i=h,s=!0,o=null,C(e,1000,"idle_timeout"),b(h)},t)}).finally(()=>{if(f)clearTimeout(f)})}if(i)throw i;if(!u)throw Error("WebSocket stream closed before response.completed")}finally{e.removeEventListener("message",d),e.removeEventListener("error",p),e.removeEventListener("close",c),r?.removeEventListener("abort",l)}}function ie(e){let{input:r,previous_response_id:t,...n}=e;return n}function ft(e,r){return JSON.stringify(e??[])===JSON.stringify(r??[])}function lt(e,r){return JSON.stringify(ie(e))===JSON.stringify(ie(r))}function dt(e,r){if(!lt(e,r.lastRequestBody))return;let t=e.input??[],n=[...r.lastRequestBody.input??[],...r.lastResponseItems];if(t.length<n.length)return;let o=t.slice(0,n.length);if(!ft(o,n))return;return t.slice(n.length)}function pt(e,r){let t=e.continuation;if(!t)return r;let n=dt(r,t);if(!n||!t.lastResponseId)return e.continuation=void 0,r;return{...r,previous_response_id:t.lastResponseId,input:n}}async function*mt(e,r){let t=!1;for await(let n of e){if(!t)t=!0,r();yield n}}async function bt(e,r,t,n,o,s,i,u,a,d,p,c,l){let{socket:f,entry:m,reused:b,release:h}=await it(e,t,d,p,l?.signal,a,l?.env),E=!0,w=l?.transport==="websocket-cached"||l?.transport==="auto",v=r,T=w&&m?pt(m,v):v,y=d?Y(d):void 0;if(y){if(y.requests++,b)y.connectionsReused++;else y.connectionsCreated++;if(w)y.cachedContextRequests++;if(T.store===!0)y.storeTrueRequests++;if(y.lastInputItems=T.input?.length??0,T.previous_response_id)y.deltaRequests++,y.lastDeltaInputItems=T.input?.length??0,y.lastPreviousResponseId=T.previous_response_id;else y.fullContextRequests++,y.lastDeltaInputItems=void 0,y.lastPreviousResponseId=void 0}try{if(f.send(JSON.stringify({type:"response.create",...T})),await kt(mt(pe(ut(f,l?.signal,u),n,s,l?.onProviderStreamEvent),i),n,o,s,{serviceTier:l?.serviceTier,grammarToolInputProperties:c,resolveServiceTier:fe,applyServiceTierPricing:(x,A)=>ue(x,A,s)}),l?.signal?.aborted)E=!1;else if(w&&m&&n.responseId){let x=Pt(s,Ot({messages:[n]}),ae,{includeSystemPrompt:!1,grammarToolInputProperties:c}).filter((A)=>A.type!=="function_call_output"&&A.type!=="custom_tool_call_output");m.continuation={lastRequestBody:v,lastResponseId:n.responseId,lastResponseItems:x}}}catch(x){if(m)m.continuation=void 0;throw E=!1,x}finally{h({keep:E})}}async function wt(e){let r=await e.text(),t=r||e.statusText||"Request failed",n;try{let s=JSON.parse(r)?.error;if(s){let i=s.code||s.type||"";if(/usage_limit_reached|usage_not_included|rate_limit_exceeded/i.test(i)||e.status===429){let u=s.plan_type?` (${s.plan_type.toLowerCase()} plan)`:"",a=s.resets_at?Math.max(0,Math.round((s.resets_at*1000-Date.now())/60000)):void 0,d=a!==void 0?` Try again in ~${a} min.`:"";n=`You have hit your ChatGPT usage limit${u}.${d}`.trim()}t=s.message||n||t}}catch{}return{message:t,friendlyMessage:n}}function gt(e){try{let r=e.split(".");if(r.length!==3)throw Error("Invalid token");let n=JSON.parse(atob(r[1]))?.[ke]?.chatgpt_account_id;if(!n)throw Error("No account ID in token");return n}catch{throw Error("Failed to extract accountId from token")}}function we(e,r,t,n){let o=new Headers({originator:"pi","User-Agent":le()});for(let[s,i]of Object.entries(e||{}))o.set(s,i);for(let[s,i]of Object.entries(r||{}))if(i===null)o.delete(s);else o.set(s,i);return o.set("Authorization",`Bearer ${n}`),o.set("chatgpt-account-id",t),o}function St(e,r,t,n,o){let s=we(e,r,t,n);if(s.set("OpenAI-Beta","responses=experimental"),s.set("accept","text/event-stream"),s.set("content-type","application/json"),o)s.set("session-id",o),s.set("x-client-request-id",o);return s}function Et(e,r,t,n,o){let s=we(e,r,t,n);return s.delete("accept"),s.delete("content-type"),s.delete("OpenAI-Beta"),s.delete("openai-beta"),s.set("OpenAI-Beta",Ze),s.set("x-client-request-id",o),s.set("session-id",o),s}export{tt as closeOpenAICodexWebSocketSessions,$t as getOpenAICodexWebSocketDebugStats,zt as resetOpenAICodexWebSocketDebugStats,Ue as stream,Ut as streamSimple};
|
package/chunk-1s560041.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{H}from"./chunk-rq2b2a6n.js";import{_,V}from"./chunk-a0ex6znf.js";import{a}from"./chunk-377w9fhp.js";var N=a(H()),p=a(_());var f=a(_()),A=a(V());import{createHash as L,createPrivateKey as O,createPublicKey as K,sign as v}from"crypto";import{promises as E}from"fs";import{homedir as B}from"os";import{dirname as q,join as P}from"path";class d{profileData;init;callerClientConfig;static REFRESH_THRESHOLD=300000;constructor(e,t,s){this.profileData=e,this.init=t,this.callerClientConfig=s}async loadCredentials(){let e=await this.loadToken();if(!e)throw new f.CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`,{tryNextLink:!1,logger:this.logger});let t=e.accessToken,s=Date.now();if(new Date(t.expiresAt).getTime()-s<=d.REFRESH_THRESHOLD)return this.refresh(e);return this.toCredentials(e.accessToken)}get logger(){return this.init?.logger}get loginSession(){return this.profileData.login_session}toCredentials(e){return{accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken,accountId:e.accountId,expiration:new Date(e.expiresAt)}}async refresh(e){let t=await this.loadToken().catch(()=>e),s=Date.now(),r=new Date(t.accessToken.expiresAt).getTime(),n=new Date(e.accessToken.expiresAt).getTime(),o=r<=s&&n>s?e:t;if(new Date(o.accessToken.expiresAt).getTime()-Date.now()>d.REFRESH_THRESHOLD)return this.toCredentials(o.accessToken);let{SigninClient:h,CreateOAuth2TokenCommand:y}=await import("./chunk-jj5pkfgm.js"),{logger:m,userAgentAppId:T}=this.callerClientConfig??{},x=((i)=>i?.metadata?.handlerProtocol==="h2")(this.callerClientConfig?.requestHandler)?void 0:this.callerClientConfig?.requestHandler,u=this.profileData.region??await this.callerClientConfig?.region?.()??process.env.AWS_REGION,k=new h({credentials:{accessKeyId:"",secretAccessKey:""},region:u,requestHandler:x,logger:m,userAgentAppId:T,...this.init?.clientConfig});this.createDPoPInterceptor(k.middlewareStack);let D={tokenInput:{clientId:o.clientId,refreshToken:o.refreshToken,grantType:"refresh_token"}};try{let i=await k.send(new y(D)),{accessKeyId:l,secretAccessKey:w,sessionToken:g}=i.tokenOutput?.accessToken??{},{refreshToken:C,expiresIn:R}=i.tokenOutput??{};if(!l||!w||!g||!C)throw new f.CredentialsProviderError("Token refresh response missing required fields",{logger:this.logger,tryNextLink:!1});let b=(R??900)*1000,F=new Date(Date.now()+b),I={...o,accessToken:{...o.accessToken,accessKeyId:l,secretAccessKey:w,sessionToken:g,expiresAt:F.toISOString()},refreshToken:C};return await this.saveToken(I),this.toCredentials(I.accessToken)}catch(i){if(i.name==="AccessDeniedException"){let w=i.error,g;switch(w){case"TOKEN_EXPIRED":g="Your session has expired. Please reauthenticate.";break;case"USER_CREDENTIALS_CHANGED":g="Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";break;case"INSUFFICIENT_PERMISSIONS":g="Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";break;default:g=`Failed to refresh token: ${String(i)}. Please re-authenticate using \`aws login\``}throw new f.CredentialsProviderError(g,{logger:this.logger,tryNextLink:!1})}if(new Date(o.accessToken.expiresAt).getTime()>Date.now())return this.logger?.warn?.(`Failed to refresh token: ${String(i)}. Using existing token until expiry.`),this.toCredentials(o.accessToken);throw new f.CredentialsProviderError(`Failed to refresh token: ${String(i)}. Please re-authenticate using aws login`,{logger:this.logger})}}async loadToken(){let e=this.getTokenFilePath();try{let t=await E.readFile(e,"utf8"),s=JSON.parse(t),r=["accessToken","clientId","refreshToken","dpopKey"].filter((n)=>!s[n]);if(!s.accessToken?.accountId)r.push("accountId");if(r.length>0)throw new f.CredentialsProviderError(`Token validation failed, missing fields: ${r.join(", ")}`,{logger:this.logger,tryNextLink:!1});return s}catch(t){throw new f.CredentialsProviderError(`Failed to load token from ${e}: ${String(t)}`,{logger:this.logger,tryNextLink:!1})}}async saveToken(e){let t=this.getTokenFilePath(),s=q(t);try{await E.mkdir(s,{recursive:!0})}catch(r){}await E.writeFile(t,JSON.stringify(e,null,2),"utf8")}getTokenFilePath(){let e=process.env.AWS_LOGIN_CACHE_DIRECTORY??P(B(),".aws","login","cache"),t=Buffer.from(this.loginSession,"utf8"),s=L("sha256").update(t).digest("hex");return P(e,`${s}.json`)}derToRawSignature(e){let t=2;if(e[t]!==2)throw Error("Invalid DER signature");t++;let s=e[t++],r=e.subarray(t,t+s);if(t+=s,e[t]!==2)throw Error("Invalid DER signature");t++;let n=e[t++],o=e.subarray(t,t+n);r=r[0]===0?r.subarray(1):r,o=o[0]===0?o.subarray(1):o;let c=Buffer.concat([Buffer.alloc(32-r.length),r]),h=Buffer.concat([Buffer.alloc(32-o.length),o]);return Buffer.concat([c,h])}createDPoPInterceptor(e){e.add((t)=>async(s)=>{if(A.HttpRequest.isInstance(s.request)){let r=s.request,n=`${r.protocol}//${r.hostname}${r.port?`:${r.port}`:""}${r.path}`,o=await this.generateDpop(r.method,n);r.headers={...r.headers,DPoP:o}}return t(s)},{step:"finalizeRequest",name:"dpopInterceptor",override:!0})}async generateDpop(e="POST",t){let s=await this.loadToken();try{let r=O({key:s.dpopKey,format:"pem",type:"sec1"}),o=K(r).export({format:"der",type:"spki"}),c=-1;for(let l=0;l<o.length;l++)if(o[l]===4){c=l;break}let h=o.slice(c+1,c+33),y=o.slice(c+33,c+65),m={alg:"ES256",typ:"dpop+jwt",jwk:{kty:"EC",crv:"P-256",x:h.toString("base64url"),y:y.toString("base64url")}},T={jti:crypto.randomUUID(),htm:e,htu:t,iat:Math.floor(Date.now()/1000)},S=Buffer.from(JSON.stringify(m)).toString("base64url"),x=Buffer.from(JSON.stringify(T)).toString("base64url"),u=`${S}.${x}`,k=v("sha256",Buffer.from(u),r),i=this.derToRawSignature(k).toString("base64url");return`${u}.${i}`}catch(r){throw new f.CredentialsProviderError(`Failed to generate Dpop proof: ${r instanceof Error?r.message:String(r)}`,{logger:this.logger,tryNextLink:!1})}}}var U=(e)=>async({callerClientConfig:t}={})=>{e?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");let s=await p.parseKnownFiles(e||{}),r=p.getProfileName({profile:e?.profile??t?.profile}),n=s[r];if(!n?.login_session)throw new p.CredentialsProviderError(`Profile ${r} does not contain login_session.`,{tryNextLink:!0,logger:e?.logger});let c=await new d(n,e,t).loadCredentials();return N.setCredentialFeature(c,"CREDENTIALS_LOGIN","AD")};export{U as fromLoginCredentials};
|
package/chunk-2expw9m3.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var A=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],I=["content-type","cache-control","allow"];function p(e){let r=e.path;if(!r?.startsWith("/api/")||/[\\\r\n#]/.test(r))throw Error("request path must start with /api/");let n=new URL(r,"http://basalt.internal");if(n.origin!=="http://basalt.internal"||!n.pathname.startsWith("/api/"))throw Error("request path must stay within /api/");let o=e.method??"GET";if(!A.includes(o))throw Error("Unsupported request method");if(e.body!==void 0&&(!e.body||typeof e.body!=="object"||Array.isArray(e.body)))throw Error("request body must be a JSON object");if(e.body!==void 0&&(o==="GET"||o==="HEAD"))throw Error("GET and HEAD requests cannot have a body");let s=e.timeoutMs??1e4;if(!Number.isSafeInteger(s)||s<1||s>60000)throw Error("timeoutMs must be an integer between 1 and 60000");return{url:n,method:o,timeoutMs:s}}function g(e){let r={};for(let n of I){let o=e.headers.get(n);if(o)r[n]=o.slice(0,500)}return r}async function M(e,r){let n=e.getReader();r(()=>n.cancel());let o=[],s=0,i=!1;while(!0){let t=await n.read();if(t.done)break;let d=20480-s;if(o.push(t.value.subarray(0,d)),s+=Math.min(t.value.length,d),t.value.length>d){i=!0,await n.cancel();break}}let u=new Uint8Array(s),c=0;for(let t of o)u.set(t,c),c+=t.length;return{text:new TextDecoder().decode(u,{stream:i}),truncated:i}}async function Er(e,r,n){let{url:o,method:s,timeoutMs:i}=p(r),u=e.http;if(!u)throw Error("HTTP API is not attached; start the Basalt server first");let c=new AbortController,t=n?AbortSignal.any([n,c.signal]):c.signal;t.throwIfAborted();let d,b=()=>{d?.().catch(()=>{})},E=async()=>{let h=r.body!==void 0,a=await u.request(new Request(o.toString(),{method:s,headers:h?{"content-type":"application/json"}:void 0,body:h?JSON.stringify(r.body):void 0,signal:t}));if(t.aborted)throw await a.body?.cancel(),Error("API request cancelled");let m=a.body?await M(a.body,(T)=>{d=T}):{text:"",truncated:!1};return{status:a.status,headers:g(a),body:m.text,truncated:m.truncated}},f,l,y=new Promise((h,a)=>{if(l=()=>{a(Error("API request cancelled")),b()},t.addEventListener("abort",l,{once:!0}),t.aborted)l()}),w=new Promise((h,a)=>{f=setTimeout(()=>{a(Error(`API request timed out after ${i}ms`)),c.abort(),b()},i)});try{return await Promise.race([E(),y,w])}finally{if(clearTimeout(f),l)t.removeEventListener("abort",l)}}
|
|
3
|
-
export{Er};
|
package/chunk-2fm6g0ga.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Er}from"./chunk-2expw9m3.js";var y=Promise.resolve(),M=60000,T=1e4,E=(r)=>r instanceof Error?r.message:String(r);function R(){return new Worker(new URL("./ui-test-worker.js",import.meta.url))}function I(r,e,t){if(!Number.isInteger(e)||e<1||e>t)throw Error(`${r} must be between 1 and ${t}`)}async function Kn(r,e,t={}){let l=t.timeoutMs??M,u=t.importTimeoutMs??T;I("timeoutMs",l,M),I("importTimeoutMs",u,T);let i=y,p=Promise.withResolvers();y=i.then(()=>p.promise);let o=new AbortController,n=t.signal?AbortSignal.any([t.signal,o.signal]):o.signal,g,b,f,w=new Map,c=Promise.withResolvers(),k=()=>c.reject(n.reason??Error("UI test cancelled"));n.addEventListener("abort",k,{once:!0});async function h(d,s){let m=new AbortController;w.set(s.id,m);try{if(!t.runtime)throw Error("API unavailable during module inspection");let a=await Er(t.runtime,s.input,AbortSignal.any([n,m.signal]));if(!n.aborted)d.postMessage({type:"response",id:s.id,response:a})}catch(a){if(!n.aborted)d.postMessage({type:"response",id:s.id,error:E(a)})}finally{w.delete(s.id)}}try{n.throwIfAborted(),f=setTimeout(()=>o.abort(Error(`UI execution timed out after ${l}ms`)),l),await Promise.race([i,c.promise]),n.throwIfAborted();let d=typeof r==="string"?{source:r,css:t.css}:await Promise.race([r(),c.promise.then(()=>{throw Error("Worker finished before startup")})]);n.throwIfAborted();let s=R();return g=s,s.onerror=(m)=>c.reject(Error(m.message)),s.onmessage=(m)=>{let a=m.data;switch(a.type){case"importing":b=setTimeout(()=>o.abort(Error(`UI import timed out after ${u}ms`)),u);break;case"imported":clearTimeout(b);break;case"done":c.resolve(a.result);break;case"error":c.reject(Error(a.error));break;case"cancel":w.get(a.id)?.abort();break;case"request":h(s,a);break}},s.postMessage({type:"start",...d,id:e,input:t.input}),await c.promise}finally{clearTimeout(f),clearTimeout(b),n.removeEventListener("abort",k),o.abort();for(let d of w.values())d.abort();g?.terminate(),p.resolve()}}async function Na(r,e,t){t?.throwIfAborted();let l=r.plugins.list().find((o)=>o.id===e.id);if(l?.status!=="enabled")throw Error("Load and enable the plugin before ui_test");if([e.slot,e.view,e.codeBlock].filter(Boolean).length!==1)throw Error("ui_test requires exactly one of slot, view or codeBlock");let u=e.view?l.web?.find((o)=>o.view===e.view):void 0;if(e.view&&u&&e.kind&&u.kind!==e.kind)throw Error(`View kind mismatch: expected ${u.kind}, got ${e.kind}`);let i=e.kind??u?.kind;if(i!==void 0&&i!=="page"&&i!=="tab"&&i!=="card"&&i!=="sidebar")throw Error(`Unsupported view kind: ${i}`);let p=await Kn(async()=>{let o=await r.plugins.webBundle(e.id);if(!o)throw Error("Plugin has no dynamic Web bundle");let n=await r.plugins.webCSS(e.id);return{source:o,css:n}},e.id,{input:{...e,kind:i},runtime:r,signal:t,timeoutMs:e.timeoutMs,importTimeoutMs:e.importTimeoutMs});if(!("steps"in p))throw Error("Worker returned an invalid UI report");return p}
|
|
3
|
-
export{Kn,Na};
|
package/chunk-2scbc5yh.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{h,f,g}from"./chunk-vpzs9trn.js";import{se}from"./chunk-d47bpkyz.js";var c=function(t,i){if(typeof t==="string"&&/^\.\.?\//.test(t))return t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,a,o,s,p){return a?i?".jsx":".js":o&&(!s||!p)?e:o+s+"."+p.toLowerCase()+"js"});return t},l=(t)=>{let i=import.meta.url.endsWith(".js")?t.replace(/\.ts$/,".js"):t;return import(c(i))},r;function Us(t){r=t}var Bs=()=>se(async()=>r??await l("./bedrock-converse-stream.ts"));var n={"anthropic-messages":{"chat:claude-fable-5":{id:"claude-fable-5",name:"Claude Fable 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-fable-5.1":{id:"claude-fable-5.1",name:"Claude Fable 5.1",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:0.25,cacheWrite:12.5},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0},thinkingLevelMap:{off:null,xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5 (latest)",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1,output:5,cacheRead:0.1,cacheWrite:1.25},contextWindow:200000,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsEagerToolInputStreaming:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-haiku-5.5":{id:"claude-haiku-5.5",name:"Claude Haiku 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.1,output:0.5,cacheRead:0.01,cacheWrite:0.125,tiers:[{inputTokensAbove:1e5,input:0.5,output:2.5,cacheRead:0.05,cacheWrite:0.625}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:0.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:32000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0,supportsTemperature:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-4.8":{id:"claude-opus-4.8",name:"Claude Opus 4.8",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:0.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5":{id:"claude-opus-5",name:"Claude Opus 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:25,cacheRead:0.5,cacheWrite:6.25},contextWindow:1e6,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max",minimal:"low"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-opus-5.5":{id:"claude-opus-5.5",name:"Claude Opus 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:0.2,cacheWrite:5},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:0.3,cacheWrite:3.75},contextWindow:1e6,maxTokens:32000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{max:"max",minimal:"low"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5":{id:"claude-sonnet-5",name:"Claude Sonnet 5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.2,cacheWrite:2.5},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{xhigh:"xhigh",max:"max"},compat:{forceAdaptiveThinking:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:claude-sonnet-5.5":{id:"claude-sonnet-5.5",name:"Claude Sonnet 5.5",api:"anthropic-messages",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.1,cacheWrite:2.5},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsMidConvoSystemMessages:!0,forceAdaptiveThinking:!0,supportsTemperature:!1},thinkingLevelMap:{xhigh:"xhigh",max:"max"},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-completions":{"chat:gemini-3.5-flash":{id:"gemini-3.5-flash",name:"Gemini 3.5 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.5,output:9,cacheRead:0.15,cacheWrite:0},contextWindow:200000,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.6-flash":{id:"gemini-3.6-flash",name:"Gemini 3.6 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.75,output:3.75,cacheRead:0.075,cacheWrite:0},contextWindow:1e6,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.7-flash":{id:"gemini-3.7-flash",name:"Gemini 3.7 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.75,output:3.75,cacheRead:0.075,cacheWrite:0},contextWindow:1e6,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gemini-3.8-flash":{id:"gemini-3.8-flash",name:"Gemini 3.8 Flash",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.75,output:3.75,cacheRead:0.075,cacheWrite:0},contextWindow:1e6,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k2.7-code":{id:"kimi-k2.7-code",name:"Kimi K2.7 Code",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.95,output:4,cacheRead:0.19,cacheWrite:0},contextWindow:256000,maxTokens:32000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:kimi-k3":{id:"kimi-k3",name:"Kimi K3",api:"openai-completions",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:3,output:15,cacheRead:0.3,cacheWrite:0},contextWindow:1048576,maxTokens:131072,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},compat:{supportsStrictMode:!0,supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:!1,supportsMidConvoSystemMessages:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"}},"openai-responses":{"chat:gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 Mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.25,output:2,cacheRead:0.025,cacheWrite:0},contextWindow:264000,maxTokens:64000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:null,max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.3-codex":{id:"gpt-5.3-codex",name:"GPT-5.3 Codex",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:1.75,output:14,cacheRead:0.175,cacheWrite:0},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2.5,output:15,cacheRead:0.25,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:5,output:22.5,cacheRead:0.5,cacheWrite:0}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-mini":{id:"gpt-5.4-mini",name:"GPT-5.4 mini",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.75,output:4.5,cacheRead:0.075,cacheWrite:0},contextWindow:400000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.4-nano":{id:"gpt-5.4-nano",name:"GPT-5.4 nano",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.2,output:1.25,cacheRead:0.02,cacheWrite:0},contextWindow:400000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",xhigh:"xhigh"},compat:{supportsOpenAIGrammarTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:5,output:30,cacheRead:0.5,cacheWrite:0,tiers:[{inputTokensAbove:272000,input:10,output:45,cacheRead:1,cacheWrite:0}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-luna":{id:"gpt-5.6-luna",name:"GPT-5.6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.2,output:1.2,cacheRead:0.02,cacheWrite:0.25,tiers:[{inputTokensAbove:200000,input:0.4,output:1.8,cacheRead:0.04,cacheWrite:0.5}]},contextWindow:1050000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-sol":{id:"gpt-5.6-sol",name:"GPT-5.6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:4,output:20,cacheRead:0.4,cacheWrite:5,tiers:[{inputTokensAbove:272000,input:8,output:30,cacheRead:0.8,cacheWrite:10}]},contextWindow:1050000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-5.6-terra":{id:"gpt-5.6-terra",name:"GPT-5.6 Terra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:12,cacheRead:0.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:18,cacheRead:0.4,cacheWrite:5}]},contextWindow:1050000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:"low",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-astra":{id:"gpt-6-astra",name:"GPT-6 Astra",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:10,output:50,cacheRead:1,cacheWrite:12.5,tiers:[{inputTokensAbove:272000,input:20,output:75,cacheRead:2,cacheWrite:25}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-luna":{id:"gpt-6-luna",name:"GPT-6 Luna",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.1,output:0.5,cacheRead:0.01,cacheWrite:0.125,tiers:[{inputTokensAbove:272000,input:0.2,output:0.75,cacheRead:0.02,cacheWrite:0.25}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6-sol":{id:"gpt-6-sol",name:"GPT-6 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.2,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:15,cacheRead:0.4,cacheWrite:5}]},contextWindow:1e6,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:"none",minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:gpt-6.1-sol":{id:"gpt-6.1-sol",name:"GPT-6.1 Sol",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:10,cacheRead:0.1,cacheWrite:2.5,tiers:[{inputTokensAbove:272000,input:4,output:15,cacheRead:0.2,cacheWrite:5}]},contextWindow:1050000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{supportsOpenAIGrammarTools:!0,supportsMidConvoSystemMessages:!0,supportsAdditionalTools:!0},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.5":{id:"grok-4.5",name:"Grok 4.5",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:0.5,cacheWrite:0,tiers:[{inputTokensAbove:200000,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:500000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.6":{id:"grok-4.6",name:"Grok 4.6",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:0.5,cacheWrite:0,tiers:[{inputTokensAbove:200000,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:500000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:grok-4.7":{id:"grok-4.7",name:"Grok 4.7",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:2,output:6,cacheRead:0.5,cacheWrite:0,tiers:[{inputTokensAbove:200000,input:4,output:12,cacheRead:1,cacheWrite:0}]},contextWindow:500000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:null},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"},"chat:mai-code-1-flash-picker":{id:"mai-code-1-flash-picker",name:"MAI-Code-1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text"],cost:{input:0.75,output:4.5,cacheRead:0.075,cacheWrite:0},contextWindow:256000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},type:"chat"},"chat:mai-code-1.1-flash":{id:"mai-code-1.1-flash",name:"MAI-Code-1.1-Flash",api:"openai-responses",provider:"github-copilot",baseUrl:"https://api.individual.githubcopilot.com",reasoning:!0,input:["text","image"],cost:{input:0.2,output:1.2,cacheRead:0.02,cacheWrite:0},contextWindow:256000,maxTokens:128000,headers:{"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},thinkingLevelMap:{off:null,minimal:null,low:"low",medium:"medium",high:"high",xhigh:null,max:null},inputLimits:{images:{resize:{maxWidth:2000,maxHeight:2000,maxBytes:4718592,jpegQuality:80}}},type:"chat"}}};var _n=h("github-copilot",n),T=f("github-copilot",n),w=g("github-copilot",n);var Wi="https://radius.pi.dev";function m(t){if(typeof t!=="object"||t===null||Array.isArray(t))return!1;let i=t;return typeof i.id==="string"&&typeof i.name==="string"&&typeof i.reasoning==="boolean"&&Array.isArray(i.input)&&typeof i.cost==="object"&&i.cost!==null&&!Array.isArray(i.cost)&&typeof i.contextWindow==="number"&&typeof i.maxTokens==="number"}function u(t){if(typeof t!=="object"||t===null||Array.isArray(t))return;let{baseUrl:i,models:e}=t;if(typeof i!=="string"||!Array.isArray(e))return;return{baseUrl:i,models:e.filter(m).map((a)=>({...a}))}}function kr(t){return(/^https?:\/\//iu.test(t)?t:`https://${t}`).replace(/\/+$/u,"")}function x(t){return u(t?.gatewayConfig)}function Hi(t,i){return i.models.map((e)=>({...e,api:"pi-messages",provider:t,baseUrl:i.baseUrl}))}function Fs(t,i){let e=x(i);return e?Hi(t,e):[]}function v(t){let i=t.trim();return i.length>512?`${i.slice(0,512)}\u2026`:i}async function $s(t,i,e){let a={accept:"application/json"};if(i)a.authorization=`Bearer ${i}`;let o=await fetch(new URL("/v1/config",t),{headers:a,signal:e});if(!o.ok)throw Error(`Could not load Radius config from ${t}: ${o.status}: ${v(await o.text())}`);let s=u(await o.json());if(!s)throw Error(`Invalid Radius config from ${t}`);return s}
|
|
3
|
-
export{Us,Bs,_n,Wi,kr,Hi,Fs,$s};
|