@bkm016/basalt 0.1.31 → 0.1.33
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-3j26jsy0.js +51 -0
- package/chunk-5ggyf53b.js +50 -0
- package/chunk-9vth0w8q.js +2 -0
- package/chunk-fb2ydc2s.js +8 -0
- package/chunk-jqtdf0ym.js +63 -0
- package/chunk-n3hfhbe4.js +498 -0
- package/chunk-nkmvqcge.js +4073 -0
- package/chunk-p23eqet9.js +2 -0
- package/chunk-qqs9fqsy.js +4 -0
- package/chunk-x83syrhw.js +44 -0
- package/compiled.js +1 -1
- package/package.json +1 -1
- package/ui-test-worker.js +1 -1
- package/web/chunk-07kt1zpn.js +1 -0
- package/web/chunk-07kt1zpn.js.br +0 -0
- package/web/chunk-07kt1zpn.js.gz +0 -0
- package/web/chunk-0d068bmj.js +1 -0
- package/web/chunk-0d068bmj.js.br +0 -0
- package/web/chunk-0d068bmj.js.gz +0 -0
- package/web/chunk-0m15ghn0.js +2 -0
- package/web/chunk-0m15ghn0.js.br +0 -0
- package/web/chunk-0m15ghn0.js.gz +0 -0
- package/web/chunk-0swykhgr.js +2 -0
- package/web/chunk-0swykhgr.js.br +0 -0
- package/web/chunk-0swykhgr.js.gz +0 -0
- package/web/chunk-100a4th6.js +4 -0
- package/web/chunk-100a4th6.js.br +0 -0
- package/web/chunk-100a4th6.js.gz +0 -0
- package/web/chunk-1mdvm20t.js +140 -0
- package/web/chunk-1mdvm20t.js.br +0 -0
- package/web/chunk-1mdvm20t.js.gz +0 -0
- package/web/chunk-1mkzfr1m.js +2 -0
- package/web/chunk-1mkzfr1m.js.br +0 -0
- package/web/chunk-1mkzfr1m.js.gz +0 -0
- package/web/chunk-1p7wa1rq.js +1 -0
- package/web/chunk-1p7wa1rq.js.br +0 -0
- package/web/chunk-1p7wa1rq.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-2grspw9t.js +1 -0
- package/web/chunk-2grspw9t.js.br +0 -0
- package/web/chunk-2grspw9t.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-2zz8t49r.js +1 -0
- package/web/chunk-2zz8t49r.js.br +0 -0
- package/web/chunk-2zz8t49r.js.gz +0 -0
- package/web/chunk-34g2xrgq.js +120 -0
- package/web/chunk-34g2xrgq.js.br +0 -0
- package/web/chunk-34g2xrgq.js.gz +0 -0
- package/web/chunk-34q3az4b.js +1 -0
- package/web/chunk-34q3az4b.js.br +0 -0
- package/web/chunk-34q3az4b.js.gz +0 -0
- package/web/chunk-39jqdq4r.js +1 -0
- package/web/chunk-39jqdq4r.js.br +0 -0
- package/web/chunk-39jqdq4r.js.gz +0 -0
- package/web/chunk-3d2fm4qc.js +1 -0
- package/web/chunk-3d2fm4qc.js.br +0 -0
- package/web/chunk-3d2fm4qc.js.gz +0 -0
- package/web/chunk-3s16fbrf.js +40 -0
- package/web/chunk-3s16fbrf.js.br +0 -0
- package/web/chunk-3s16fbrf.js.gz +0 -0
- package/web/chunk-3vsey6mw.js +1 -0
- package/web/chunk-3vsey6mw.js.br +0 -0
- package/web/chunk-3vsey6mw.js.gz +0 -0
- package/web/chunk-3y29sc9c.js +7 -0
- package/web/chunk-3y29sc9c.js.br +0 -0
- package/web/chunk-3y29sc9c.js.gz +0 -0
- package/web/chunk-40f59ze9.js +39 -0
- package/web/chunk-40f59ze9.js.br +0 -0
- package/web/chunk-40f59ze9.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-495sjpc6.js +2 -0
- package/web/chunk-495sjpc6.js.br +0 -0
- package/web/chunk-495sjpc6.js.gz +0 -0
- package/web/chunk-4ab1dv3g.js +142 -0
- package/web/chunk-4ab1dv3g.js.br +0 -0
- package/web/chunk-4ab1dv3g.js.gz +0 -0
- package/web/chunk-545zx869.js +2 -0
- package/web/chunk-545zx869.js.br +0 -0
- package/web/chunk-545zx869.js.gz +0 -0
- package/web/chunk-55mx05jg.js +2 -0
- package/web/chunk-55mx05jg.js.br +0 -0
- package/web/chunk-55mx05jg.js.gz +0 -0
- package/web/chunk-58xhn7ry.js +2 -0
- package/web/chunk-58xhn7ry.js.br +0 -0
- package/web/chunk-58xhn7ry.js.gz +0 -0
- package/web/chunk-67pa4950.js +1 -0
- package/web/chunk-67pa4950.js.br +0 -0
- package/web/chunk-67pa4950.js.gz +0 -0
- package/web/chunk-690qxds4.js +1 -0
- package/web/chunk-690qxds4.js.br +0 -0
- package/web/chunk-690qxds4.js.gz +0 -0
- package/web/chunk-6ana63fs.js +21 -0
- package/web/chunk-6ana63fs.js.br +0 -0
- package/web/chunk-6ana63fs.js.gz +0 -0
- package/web/chunk-6ew54553.js +2 -0
- package/web/chunk-6ew54553.js.br +0 -0
- package/web/chunk-6ew54553.js.gz +0 -0
- package/web/chunk-6f1q0tjv.js +1142 -0
- package/web/chunk-6f1q0tjv.js.br +0 -0
- package/web/chunk-6f1q0tjv.js.gz +0 -0
- package/web/chunk-6gpzz5wm.js +1 -0
- package/web/chunk-6gpzz5wm.js.br +0 -0
- package/web/chunk-6gpzz5wm.js.gz +0 -0
- package/web/chunk-71g6vrx9.js +62 -0
- package/web/chunk-71g6vrx9.js.br +0 -0
- package/web/chunk-71g6vrx9.js.gz +0 -0
- package/web/chunk-77dnqrb6.js +2 -0
- package/web/chunk-77dnqrb6.js.br +0 -0
- package/web/chunk-77dnqrb6.js.gz +0 -0
- package/web/chunk-7fdrwy21.js +1 -0
- package/web/chunk-7fdrwy21.js.br +0 -0
- package/web/chunk-7fdrwy21.js.gz +0 -0
- package/web/chunk-84s7821x.js +2 -0
- package/web/chunk-84s7821x.js.br +0 -0
- package/web/chunk-84s7821x.js.gz +0 -0
- package/web/chunk-8e5qd73v.js +7 -0
- package/web/chunk-8e5qd73v.js.br +0 -0
- package/web/chunk-8e5qd73v.js.gz +0 -0
- package/web/chunk-8kyj945c.js +2 -0
- package/web/chunk-8kyj945c.js.br +0 -0
- package/web/chunk-8kyj945c.js.gz +0 -0
- package/web/chunk-9b0evht1.js +292 -0
- package/web/chunk-9b0evht1.js.br +0 -0
- package/web/chunk-9b0evht1.js.gz +0 -0
- package/web/chunk-9jb5xwya.js +36 -0
- package/web/chunk-9jb5xwya.js.br +0 -0
- package/web/chunk-9jb5xwya.js.gz +0 -0
- package/web/chunk-9kf8arqg.js +1 -0
- package/web/chunk-9kf8arqg.js.br +0 -0
- package/web/chunk-9kf8arqg.js.gz +0 -0
- package/web/chunk-9msmea44.js +70 -0
- package/web/chunk-9msmea44.js.br +0 -0
- package/web/chunk-9msmea44.js.gz +0 -0
- package/web/chunk-a7q85665.js +3 -0
- package/web/chunk-a7q85665.js.br +0 -0
- package/web/chunk-a7q85665.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-b9cjgxr1.js +98 -0
- package/web/chunk-b9cjgxr1.js.br +0 -0
- package/web/chunk-b9cjgxr1.js.gz +0 -0
- package/web/chunk-baaattjv.js +2 -0
- package/web/chunk-baaattjv.js.br +0 -0
- package/web/chunk-baaattjv.js.gz +0 -0
- package/web/chunk-bj9m08f9.js +1 -0
- package/web/chunk-bj9m08f9.js.br +0 -0
- package/web/chunk-bj9m08f9.js.gz +0 -0
- package/web/chunk-bm4fvq6q.js +89 -0
- package/web/chunk-bm4fvq6q.js.br +0 -0
- package/web/chunk-bm4fvq6q.js.gz +0 -0
- package/web/chunk-c4g2k9wp.js +1 -0
- package/web/chunk-c4g2k9wp.js.br +0 -0
- package/web/chunk-c4g2k9wp.js.gz +0 -0
- package/web/chunk-cnptxet3.js +2 -0
- package/web/chunk-cnptxet3.js.br +0 -0
- package/web/chunk-cnptxet3.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-db2jge7w.js +291 -0
- package/web/chunk-db2jge7w.js.br +0 -0
- package/web/chunk-db2jge7w.js.gz +0 -0
- package/web/chunk-dfv95z6w.js +1 -0
- package/web/chunk-dfv95z6w.js.br +0 -0
- package/web/chunk-dfv95z6w.js.gz +0 -0
- package/web/chunk-dsxjv5an.js +1 -0
- package/web/chunk-dsxjv5an.js.br +0 -0
- package/web/chunk-dsxjv5an.js.gz +0 -0
- package/web/chunk-e362x35y.js +1 -0
- package/web/chunk-e362x35y.js.br +0 -0
- package/web/chunk-e362x35y.js.gz +0 -0
- package/web/chunk-e6jfnajp.js +55 -0
- package/web/chunk-e6jfnajp.js.br +0 -0
- package/web/chunk-e6jfnajp.js.gz +0 -0
- package/web/chunk-ex34kdxk.js +217 -0
- package/web/chunk-ex34kdxk.js.br +0 -0
- package/web/chunk-ex34kdxk.js.gz +0 -0
- package/web/chunk-exa2z1b4.js +1 -0
- package/web/chunk-exa2z1b4.js.br +0 -0
- package/web/chunk-exa2z1b4.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-fjvd2dx2.js +2 -0
- package/web/chunk-fjvd2dx2.js.br +0 -0
- package/web/chunk-fjvd2dx2.js.gz +0 -0
- package/web/chunk-fs39pqet.js +2 -0
- package/web/chunk-fs39pqet.js.br +0 -0
- package/web/chunk-fs39pqet.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-h3618s7t.js +4 -0
- package/web/chunk-h3618s7t.js.br +0 -0
- package/web/chunk-h3618s7t.js.gz +0 -0
- package/web/chunk-hks91ztk.js +8 -0
- package/web/chunk-hks91ztk.js.br +0 -0
- package/web/chunk-hks91ztk.js.gz +0 -0
- package/web/chunk-hqd97ez8.js +200 -0
- package/web/chunk-hqd97ez8.js.br +0 -0
- package/web/chunk-hqd97ez8.js.gz +0 -0
- package/web/chunk-hta68vm8.js +2 -0
- package/web/chunk-hta68vm8.js.br +0 -0
- package/web/chunk-hta68vm8.js.gz +0 -0
- package/web/chunk-jcbvhp3h.js +1 -0
- package/web/chunk-jcbvhp3h.js.br +0 -0
- package/web/chunk-jcbvhp3h.js.gz +0 -0
- package/web/chunk-jw6e38cy.js +1 -0
- package/web/chunk-jw6e38cy.js.br +0 -0
- package/web/chunk-jw6e38cy.js.gz +0 -0
- package/web/chunk-jzp1qd92.js +1 -0
- package/web/chunk-jzp1qd92.js.br +0 -0
- package/web/chunk-jzp1qd92.js.gz +0 -0
- package/web/chunk-kg39a24q.js +16 -0
- package/web/chunk-kg39a24q.js.br +0 -0
- package/web/chunk-kg39a24q.js.gz +0 -0
- package/web/chunk-kj75rme3.js +1 -0
- package/web/chunk-kj75rme3.js.br +0 -0
- package/web/chunk-kj75rme3.js.gz +0 -0
- package/web/chunk-kvxmwmen.js +1 -0
- package/web/chunk-kvxmwmen.js.br +0 -0
- package/web/chunk-kvxmwmen.js.gz +0 -0
- package/web/chunk-kzdmsaet.js +1 -0
- package/web/chunk-kzdmsaet.js.br +0 -0
- package/web/chunk-kzdmsaet.js.gz +0 -0
- package/web/chunk-m203pzza.js +89 -0
- package/web/chunk-m203pzza.js.br +0 -0
- package/web/chunk-m203pzza.js.gz +0 -0
- package/web/chunk-m3xw41vq.js +1 -0
- package/web/chunk-m3xw41vq.js.br +0 -0
- package/web/chunk-m3xw41vq.js.gz +0 -0
- package/web/chunk-m8jcx13t.js +30 -0
- package/web/chunk-m8jcx13t.js.br +0 -0
- package/web/chunk-m8jcx13t.js.gz +0 -0
- package/web/chunk-mpgz1bj6.js +1 -0
- package/web/chunk-mpgz1bj6.js.br +0 -0
- package/web/chunk-mpgz1bj6.js.gz +0 -0
- package/web/chunk-mzagmpq5.js +1 -0
- package/web/chunk-mzagmpq5.js.br +0 -0
- package/web/chunk-mzagmpq5.js.gz +0 -0
- package/web/chunk-n51q6d6e.js +1 -0
- package/web/chunk-n51q6d6e.js.br +0 -0
- package/web/chunk-n51q6d6e.js.gz +0 -0
- package/web/chunk-nbf2zaaj.js +1 -0
- package/web/chunk-nbf2zaaj.js.br +0 -0
- package/web/chunk-nbf2zaaj.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-nxd7dn08.js +1 -0
- package/web/chunk-nxd7dn08.js.br +0 -0
- package/web/chunk-nxd7dn08.js.gz +0 -0
- package/web/chunk-p44ezwgh.js +1 -0
- package/web/chunk-p44ezwgh.js.br +0 -0
- package/web/chunk-p44ezwgh.js.gz +0 -0
- package/web/chunk-pdg3bxc0.js +2 -0
- package/web/chunk-pdg3bxc0.js.br +0 -0
- package/web/chunk-pdg3bxc0.js.gz +0 -0
- package/web/chunk-pjbp0xwn.css +1 -0
- package/web/chunk-pjbp0xwn.css.br +0 -0
- package/web/chunk-pjbp0xwn.css.gz +0 -0
- package/web/chunk-pkbyh261.js +1 -0
- package/web/chunk-pkbyh261.js.br +0 -0
- package/web/chunk-pkbyh261.js.gz +0 -0
- package/web/chunk-q3q25jr9.js +324 -0
- package/web/chunk-q3q25jr9.js.br +0 -0
- package/web/chunk-q3q25jr9.js.gz +0 -0
- package/web/chunk-q5nr5wjn.js +169 -0
- package/web/chunk-q5nr5wjn.js.br +0 -0
- package/web/chunk-q5nr5wjn.js.gz +0 -0
- package/web/chunk-qd9y8r3g.js +84 -0
- package/web/chunk-qd9y8r3g.js.br +0 -0
- package/web/chunk-qd9y8r3g.js.gz +0 -0
- package/web/chunk-qm039dan.js +24 -0
- package/web/chunk-qm039dan.js.br +0 -0
- package/web/chunk-qm039dan.js.gz +0 -0
- package/web/chunk-qqp31fyy.js +1 -0
- package/web/chunk-qqp31fyy.js.br +0 -0
- package/web/chunk-qqp31fyy.js.gz +0 -0
- package/web/chunk-r7st369j.js +1 -0
- package/web/chunk-r7st369j.js.br +0 -0
- package/web/chunk-r7st369j.js.gz +0 -0
- package/web/chunk-rc3sv7v4.js +1 -0
- package/web/chunk-rc3sv7v4.js.br +0 -0
- package/web/chunk-rc3sv7v4.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-rtk95qme.js +1 -0
- package/web/chunk-rtk95qme.js.br +0 -0
- package/web/chunk-rtk95qme.js.gz +0 -0
- package/web/chunk-s4rfkyqn.js +12 -0
- package/web/chunk-s4rfkyqn.js.br +0 -0
- package/web/chunk-s4rfkyqn.js.gz +0 -0
- package/web/chunk-s6a0gfv3.js +34 -0
- package/web/chunk-s6a0gfv3.js.br +0 -0
- package/web/chunk-s6a0gfv3.js.gz +0 -0
- package/web/chunk-s7rwbxr5.js +2 -0
- package/web/chunk-s7rwbxr5.js.br +0 -0
- package/web/chunk-s7rwbxr5.js.gz +0 -0
- package/web/chunk-s8f6v2nn.js +1 -0
- package/web/chunk-s8f6v2nn.js.br +0 -0
- package/web/chunk-s8f6v2nn.js.gz +0 -0
- package/web/chunk-sawc81kc.js +303 -0
- package/web/chunk-sawc81kc.js.br +0 -0
- package/web/chunk-sawc81kc.js.gz +0 -0
- package/web/chunk-sex2gevj.js +2 -0
- package/web/chunk-sex2gevj.js.br +0 -0
- package/web/chunk-sex2gevj.js.gz +0 -0
- package/web/chunk-smmdqmcy.js +1 -0
- package/web/chunk-smmdqmcy.js.br +0 -0
- package/web/chunk-smmdqmcy.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-tpzyyc2z.js +2 -0
- package/web/chunk-tpzyyc2z.js.br +0 -0
- package/web/chunk-tpzyyc2z.js.gz +0 -0
- package/web/chunk-txhvq81f.js +106 -0
- package/web/chunk-txhvq81f.js.br +0 -0
- package/web/chunk-txhvq81f.js.gz +0 -0
- package/web/chunk-txtm71rz.js +41 -0
- package/web/chunk-txtm71rz.js.br +0 -0
- package/web/chunk-txtm71rz.js.gz +0 -0
- package/web/chunk-tykcqm6v.js +2 -0
- package/web/chunk-tykcqm6v.js.br +0 -0
- package/web/chunk-tykcqm6v.js.gz +0 -0
- package/web/chunk-tyrmd7j6.js +1 -0
- package/web/chunk-tyrmd7j6.js.br +0 -0
- package/web/chunk-tyrmd7j6.js.gz +0 -0
- package/web/chunk-v6ebn3sf.js +38 -0
- package/web/chunk-v6ebn3sf.js.br +0 -0
- package/web/chunk-v6ebn3sf.js.gz +0 -0
- package/web/chunk-vbx7t0h5.js +214 -0
- package/web/chunk-vbx7t0h5.js.br +0 -0
- package/web/chunk-vbx7t0h5.js.gz +0 -0
- package/web/chunk-vj3wz0a2.js +1 -0
- package/web/chunk-vj3wz0a2.js.br +0 -0
- package/web/chunk-vj3wz0a2.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-vqgkd7q8.js +1 -0
- package/web/chunk-vqgkd7q8.js.br +0 -0
- package/web/chunk-vqgkd7q8.js.gz +0 -0
- package/web/chunk-vvsfwjrg.js +1 -0
- package/web/chunk-vvsfwjrg.js.br +0 -0
- package/web/chunk-vvsfwjrg.js.gz +0 -0
- package/web/chunk-w0k63gap.js +2 -0
- package/web/chunk-w0k63gap.js.br +0 -0
- package/web/chunk-w0k63gap.js.gz +0 -0
- package/web/chunk-wafwgky9.js +1 -0
- package/web/chunk-wafwgky9.js.br +0 -0
- package/web/chunk-wafwgky9.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-wk89vrvf.js +78 -0
- package/web/chunk-wk89vrvf.js.br +0 -0
- package/web/chunk-wk89vrvf.js.gz +0 -0
- package/web/chunk-wqjn3yz1.js +370 -0
- package/web/chunk-wqjn3yz1.js.br +0 -0
- package/web/chunk-wqjn3yz1.js.gz +0 -0
- package/web/chunk-wrej9qt0.js +2 -0
- package/web/chunk-wrej9qt0.js.br +0 -0
- package/web/chunk-wrej9qt0.js.gz +0 -0
- package/web/chunk-xbjv549c.js +2 -0
- package/web/chunk-xbjv549c.js.br +0 -0
- package/web/chunk-xbjv549c.js.gz +0 -0
- package/web/chunk-xmp1ag6z.js +2 -0
- package/web/chunk-xmp1ag6z.js.br +0 -0
- package/web/chunk-xmp1ag6z.js.gz +0 -0
- package/web/chunk-xsqd38a2.js +332 -0
- package/web/chunk-xsqd38a2.js.br +0 -0
- package/web/chunk-xsqd38a2.js.gz +0 -0
- package/web/chunk-y2fbz356.js +1 -0
- package/web/chunk-y2fbz356.js.br +0 -0
- package/web/chunk-y2fbz356.js.gz +0 -0
- package/web/chunk-yebmbyrj.js +1 -0
- package/web/chunk-yebmbyrj.js.br +2 -0
- package/web/chunk-yebmbyrj.js.gz +0 -0
- package/web/chunk-ypytxmn6.js +24 -0
- package/web/chunk-ypytxmn6.js.br +0 -0
- package/web/chunk-ypytxmn6.js.gz +0 -0
- package/web/chunk-z6jy8edk.js +99 -0
- package/web/chunk-z6jy8edk.js.br +0 -0
- package/web/chunk-z6jy8edk.js.gz +0 -0
- package/web/chunk-zg5n1hx4.js +1 -0
- package/web/chunk-zg5n1hx4.js.br +0 -0
- package/web/chunk-zg5n1hx4.js.gz +0 -0
- package/web/chunk-zmrd0bnc.js +139 -0
- package/web/chunk-zmrd0bnc.js.br +0 -0
- package/web/chunk-zmrd0bnc.js.gz +0 -0
- package/web/chunk-zqm6n89p.js +7 -0
- package/web/chunk-zqm6n89p.js.br +0 -0
- package/web/chunk-zqm6n89p.js.gz +0 -0
- package/web/chunk-zvat895r.js +1 -0
- package/web/chunk-zvat895r.js.br +0 -0
- package/web/chunk-zvat895r.js.gz +0 -0
- package/web/chunk-zxt17pcp.js +1 -0
- package/web/chunk-zxt17pcp.js.br +0 -0
- package/web/chunk-zxt17pcp.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/chunk-0er07d2g.js +0 -51
- package/chunk-0ge4k9gq.js +0 -2
- package/chunk-1t0yzkg7.js +0 -4
- package/chunk-3gw871zb.js +0 -2
- package/chunk-6gzvp0f6.js +0 -50
- package/chunk-71pz02bd.js +0 -8
- package/chunk-khy3j5kp.js +0 -63
- package/chunk-vx4v71t4.js +0 -498
- package/chunk-wvn68m5f.js +0 -4058
- package/chunk-x2ry671h.js +0 -44
- package/web/chunk-01mrggts.js +0 -1
- package/web/chunk-01mrggts.js.br +0 -0
- package/web/chunk-01mrggts.js.gz +0 -0
- package/web/chunk-0b25tje3.js +0 -1
- package/web/chunk-0b25tje3.js.br +0 -0
- package/web/chunk-0b25tje3.js.gz +0 -0
- package/web/chunk-0g46ww9d.js +0 -1
- package/web/chunk-0g46ww9d.js.br +0 -0
- package/web/chunk-0g46ww9d.js.gz +0 -0
- package/web/chunk-0grg8w51.js +0 -200
- package/web/chunk-0grg8w51.js.br +0 -0
- package/web/chunk-0grg8w51.js.gz +0 -0
- package/web/chunk-0qf3m69c.js +0 -24
- package/web/chunk-0qf3m69c.js.br +0 -0
- package/web/chunk-0qf3m69c.js.gz +0 -0
- package/web/chunk-14yejkcn.js +0 -7
- package/web/chunk-14yejkcn.js.br +0 -0
- package/web/chunk-14yejkcn.js.gz +0 -0
- package/web/chunk-1ffzwm6m.js +0 -106
- package/web/chunk-1ffzwm6m.js.br +0 -0
- package/web/chunk-1ffzwm6m.js.gz +0 -0
- package/web/chunk-1ncaw3hk.js +0 -3
- package/web/chunk-1ncaw3hk.js.br +0 -0
- package/web/chunk-1ncaw3hk.js.gz +0 -0
- package/web/chunk-1pffd2va.js +0 -2
- package/web/chunk-1pffd2va.js.br +0 -0
- package/web/chunk-1pffd2va.js.gz +0 -0
- package/web/chunk-1x2kh4he.js +0 -1
- package/web/chunk-1x2kh4he.js.br +0 -0
- package/web/chunk-1x2kh4he.js.gz +0 -0
- package/web/chunk-23atmwvk.js +0 -2
- package/web/chunk-23atmwvk.js.br +0 -0
- package/web/chunk-23atmwvk.js.gz +0 -0
- package/web/chunk-2gfgrjy6.js +0 -142
- package/web/chunk-2gfgrjy6.js.br +0 -0
- package/web/chunk-2gfgrjy6.js.gz +0 -0
- package/web/chunk-2ttatv42.js +0 -2
- package/web/chunk-2ttatv42.js.br +0 -0
- package/web/chunk-2ttatv42.js.gz +0 -0
- package/web/chunk-2vqn82nw.js +0 -139
- package/web/chunk-2vqn82nw.js.br +0 -0
- package/web/chunk-2vqn82nw.js.gz +0 -0
- package/web/chunk-2wzvn2ne.js +0 -1
- package/web/chunk-2wzvn2ne.js.br +0 -0
- package/web/chunk-2wzvn2ne.js.gz +0 -0
- package/web/chunk-3at8qbcv.js +0 -89
- package/web/chunk-3at8qbcv.js.br +0 -0
- package/web/chunk-3at8qbcv.js.gz +0 -0
- package/web/chunk-3b97pd97.js +0 -120
- package/web/chunk-3b97pd97.js.br +0 -0
- package/web/chunk-3b97pd97.js.gz +0 -0
- package/web/chunk-3q5j14ah.js +0 -1
- package/web/chunk-3q5j14ah.js.br +0 -0
- package/web/chunk-3q5j14ah.js.gz +0 -0
- package/web/chunk-45xqp3dn.js +0 -1
- package/web/chunk-45xqp3dn.js.br +0 -0
- package/web/chunk-45xqp3dn.js.gz +0 -0
- package/web/chunk-4fdgpye3.js +0 -2
- package/web/chunk-4fdgpye3.js.br +0 -0
- package/web/chunk-4fdgpye3.js.gz +0 -0
- package/web/chunk-4wpvkw6b.js +0 -1141
- package/web/chunk-4wpvkw6b.js.br +0 -0
- package/web/chunk-4wpvkw6b.js.gz +0 -0
- package/web/chunk-51m79xhr.js +0 -2
- package/web/chunk-51m79xhr.js.br +0 -2
- package/web/chunk-51m79xhr.js.gz +0 -0
- package/web/chunk-5c6q7asc.js +0 -1
- package/web/chunk-5c6q7asc.js.br +0 -0
- package/web/chunk-5c6q7asc.js.gz +0 -0
- package/web/chunk-5vbnqhs0.js +0 -38
- package/web/chunk-5vbnqhs0.js.br +0 -0
- package/web/chunk-5vbnqhs0.js.gz +0 -0
- package/web/chunk-688a15p4.js +0 -2
- package/web/chunk-688a15p4.js.br +0 -0
- package/web/chunk-688a15p4.js.gz +0 -0
- package/web/chunk-6f9btq4p.js +0 -1
- package/web/chunk-6f9btq4p.js.br +0 -0
- package/web/chunk-6f9btq4p.js.gz +0 -0
- package/web/chunk-6geede02.js +0 -217
- package/web/chunk-6geede02.js.br +0 -0
- package/web/chunk-6geede02.js.gz +0 -0
- package/web/chunk-6j37ynfq.js +0 -1
- package/web/chunk-6j37ynfq.js.br +0 -0
- package/web/chunk-6j37ynfq.js.gz +0 -0
- package/web/chunk-7j7btfha.js +0 -292
- package/web/chunk-7j7btfha.js.br +0 -0
- package/web/chunk-7j7btfha.js.gz +0 -0
- package/web/chunk-8299qcyc.js +0 -1
- package/web/chunk-8299qcyc.js.br +0 -0
- package/web/chunk-8299qcyc.js.gz +0 -0
- package/web/chunk-8mncz9c6.js +0 -89
- package/web/chunk-8mncz9c6.js.br +0 -0
- package/web/chunk-8mncz9c6.js.gz +0 -0
- package/web/chunk-8pygn7wf.js +0 -1
- package/web/chunk-8pygn7wf.js.br +0 -0
- package/web/chunk-8pygn7wf.js.gz +0 -0
- package/web/chunk-8ye62j8m.js +0 -2
- package/web/chunk-8ye62j8m.js.br +0 -3
- package/web/chunk-8ye62j8m.js.gz +0 -0
- package/web/chunk-982457hh.js +0 -1
- package/web/chunk-982457hh.js.br +0 -2
- package/web/chunk-982457hh.js.gz +0 -0
- package/web/chunk-9f9pp12b.js +0 -1
- package/web/chunk-9f9pp12b.js.br +0 -0
- package/web/chunk-9f9pp12b.js.gz +0 -0
- package/web/chunk-9k6d95ab.js +0 -1
- package/web/chunk-9k6d95ab.js.br +0 -0
- package/web/chunk-9k6d95ab.js.gz +0 -0
- package/web/chunk-9z4tf6fd.js +0 -1
- package/web/chunk-9z4tf6fd.js.br +0 -0
- package/web/chunk-9z4tf6fd.js.gz +0 -0
- package/web/chunk-a11ev6ff.js +0 -1
- package/web/chunk-a11ev6ff.js.br +0 -0
- package/web/chunk-a11ev6ff.js.gz +0 -0
- package/web/chunk-ayamka39.js +0 -1
- package/web/chunk-ayamka39.js.br +0 -0
- package/web/chunk-ayamka39.js.gz +0 -0
- package/web/chunk-b6k80wbw.js +0 -1
- package/web/chunk-b6k80wbw.js.br +0 -0
- package/web/chunk-b6k80wbw.js.gz +0 -0
- package/web/chunk-b6w2gmw0.js +0 -2
- package/web/chunk-b6w2gmw0.js.br +0 -0
- package/web/chunk-b6w2gmw0.js.gz +0 -0
- package/web/chunk-ba22js10.js +0 -84
- package/web/chunk-ba22js10.js.br +0 -0
- package/web/chunk-ba22js10.js.gz +0 -0
- package/web/chunk-bq7y294e.js +0 -34
- package/web/chunk-bq7y294e.js.br +0 -0
- package/web/chunk-bq7y294e.js.gz +0 -0
- package/web/chunk-bw9crrb4.js +0 -1
- package/web/chunk-bw9crrb4.js.br +0 -0
- package/web/chunk-bw9crrb4.js.gz +0 -0
- package/web/chunk-c0vc50pd.js +0 -4
- package/web/chunk-c0vc50pd.js.br +0 -0
- package/web/chunk-c0vc50pd.js.gz +0 -0
- package/web/chunk-c2vtzhbs.js +0 -1
- package/web/chunk-c2vtzhbs.js.br +0 -0
- package/web/chunk-c2vtzhbs.js.gz +0 -0
- package/web/chunk-cf9886tj.js +0 -2
- package/web/chunk-cf9886tj.js.br +0 -0
- package/web/chunk-cf9886tj.js.gz +0 -0
- package/web/chunk-cqf4fzk6.js +0 -16
- package/web/chunk-cqf4fzk6.js.br +0 -0
- package/web/chunk-cqf4fzk6.js.gz +0 -0
- package/web/chunk-ct9sq4ka.js +0 -1
- package/web/chunk-ct9sq4ka.js.br +0 -0
- package/web/chunk-ct9sq4ka.js.gz +0 -0
- package/web/chunk-cy60hc6q.js +0 -2
- package/web/chunk-cy60hc6q.js.br +0 -0
- package/web/chunk-cy60hc6q.js.gz +0 -0
- package/web/chunk-cygtgz2r.js +0 -2
- package/web/chunk-cygtgz2r.js.br +0 -0
- package/web/chunk-cygtgz2r.js.gz +0 -0
- package/web/chunk-dgf0f0er.js +0 -214
- package/web/chunk-dgf0f0er.js.br +0 -0
- package/web/chunk-dgf0f0er.js.gz +0 -0
- package/web/chunk-dscn4mpq.js +0 -4
- package/web/chunk-dscn4mpq.js.br +0 -0
- package/web/chunk-dscn4mpq.js.gz +0 -0
- package/web/chunk-e7683p83.js +0 -1
- package/web/chunk-e7683p83.js.br +0 -0
- package/web/chunk-e7683p83.js.gz +0 -0
- package/web/chunk-eanfvatc.js +0 -1
- package/web/chunk-eanfvatc.js.br +0 -0
- package/web/chunk-eanfvatc.js.gz +0 -0
- package/web/chunk-egfn5522.js +0 -1
- package/web/chunk-egfn5522.js.br +0 -3
- package/web/chunk-egfn5522.js.gz +0 -0
- package/web/chunk-ejk5ec5n.js +0 -1
- package/web/chunk-ejk5ec5n.js.br +0 -0
- package/web/chunk-ejk5ec5n.js.gz +0 -0
- package/web/chunk-fzffxer1.js +0 -41
- package/web/chunk-fzffxer1.js.br +0 -0
- package/web/chunk-fzffxer1.js.gz +0 -0
- package/web/chunk-g19dt2gr.js +0 -55
- package/web/chunk-g19dt2gr.js.br +0 -0
- package/web/chunk-g19dt2gr.js.gz +0 -0
- package/web/chunk-g6cj4czr.js +0 -2
- package/web/chunk-g6cj4czr.js.br +0 -0
- package/web/chunk-g6cj4czr.js.gz +0 -0
- package/web/chunk-gbv8v3z7.js +0 -78
- package/web/chunk-gbv8v3z7.js.br +0 -0
- package/web/chunk-gbv8v3z7.js.gz +0 -0
- package/web/chunk-h1w081tm.js +0 -12
- package/web/chunk-h1w081tm.js.br +0 -0
- package/web/chunk-h1w081tm.js.gz +0 -0
- package/web/chunk-h47k4j7f.js +0 -1
- package/web/chunk-h47k4j7f.js.br +0 -0
- package/web/chunk-h47k4j7f.js.gz +0 -0
- package/web/chunk-h87t8gsr.js +0 -1
- package/web/chunk-h87t8gsr.js.br +0 -0
- package/web/chunk-h87t8gsr.js.gz +0 -0
- package/web/chunk-haewrbm7.js +0 -1
- package/web/chunk-haewrbm7.js.br +0 -0
- package/web/chunk-haewrbm7.js.gz +0 -0
- package/web/chunk-hahz28y7.js +0 -2
- package/web/chunk-hahz28y7.js.br +0 -0
- package/web/chunk-hahz28y7.js.gz +0 -0
- package/web/chunk-hqz75fkz.js +0 -1
- package/web/chunk-hqz75fkz.js.br +0 -0
- package/web/chunk-hqz75fkz.js.gz +0 -0
- package/web/chunk-hr4fa514.js +0 -2
- package/web/chunk-hr4fa514.js.br +0 -0
- package/web/chunk-hr4fa514.js.gz +0 -0
- package/web/chunk-j7vtqbbc.js +0 -1
- package/web/chunk-j7vtqbbc.js.br +0 -0
- package/web/chunk-j7vtqbbc.js.gz +0 -0
- package/web/chunk-jt33d37t.js +0 -1
- package/web/chunk-jt33d37t.js.br +0 -0
- package/web/chunk-jt33d37t.js.gz +0 -0
- package/web/chunk-k3qt0rx5.js +0 -2
- package/web/chunk-k3qt0rx5.js.br +0 -0
- package/web/chunk-k3qt0rx5.js.gz +0 -0
- package/web/chunk-kgmw7sh4.js +0 -1
- package/web/chunk-kgmw7sh4.js.br +0 -0
- package/web/chunk-kgmw7sh4.js.gz +0 -0
- package/web/chunk-kjvk8prw.js +0 -1
- package/web/chunk-kjvk8prw.js.br +0 -0
- package/web/chunk-kjvk8prw.js.gz +0 -0
- package/web/chunk-kq7snx3t.js +0 -1
- package/web/chunk-kq7snx3t.js.br +0 -0
- package/web/chunk-kq7snx3t.js.gz +0 -0
- package/web/chunk-kvteqhz2.js +0 -1
- package/web/chunk-kvteqhz2.js.br +0 -2
- package/web/chunk-kvteqhz2.js.gz +0 -0
- package/web/chunk-kypct03a.js +0 -169
- package/web/chunk-kypct03a.js.br +0 -0
- package/web/chunk-kypct03a.js.gz +0 -0
- package/web/chunk-m4hz4v80.js +0 -370
- package/web/chunk-m4hz4v80.js.br +0 -0
- package/web/chunk-m4hz4v80.js.gz +0 -0
- package/web/chunk-m5k8jhya.js +0 -40
- package/web/chunk-m5k8jhya.js.br +0 -0
- package/web/chunk-m5k8jhya.js.gz +0 -0
- package/web/chunk-mfsdyw6v.js +0 -2
- package/web/chunk-mfsdyw6v.js.br +0 -0
- package/web/chunk-mfsdyw6v.js.gz +0 -0
- package/web/chunk-mr38k717.js +0 -140
- package/web/chunk-mr38k717.js.br +0 -0
- package/web/chunk-mr38k717.js.gz +0 -0
- package/web/chunk-mtcet6gc.js +0 -2
- package/web/chunk-mtcet6gc.js.br +0 -0
- package/web/chunk-mtcet6gc.js.gz +0 -0
- package/web/chunk-mtfv8gjh.js +0 -291
- package/web/chunk-mtfv8gjh.js.br +0 -0
- package/web/chunk-mtfv8gjh.js.gz +0 -0
- package/web/chunk-nnyjx4ef.js +0 -1
- package/web/chunk-nnyjx4ef.js.br +0 -0
- package/web/chunk-nnyjx4ef.js.gz +0 -0
- package/web/chunk-npn3fk69.js +0 -1
- package/web/chunk-npn3fk69.js.br +0 -2
- package/web/chunk-npn3fk69.js.gz +0 -0
- package/web/chunk-p2gdfpjs.js +0 -2
- package/web/chunk-p2gdfpjs.js.br +0 -0
- package/web/chunk-p2gdfpjs.js.gz +0 -0
- package/web/chunk-q0by2m1w.js +0 -21
- package/web/chunk-q0by2m1w.js.br +0 -0
- package/web/chunk-q0by2m1w.js.gz +0 -0
- package/web/chunk-q5hj3y5k.js +0 -2
- package/web/chunk-q5hj3y5k.js.br +0 -0
- package/web/chunk-q5hj3y5k.js.gz +0 -0
- package/web/chunk-q6k872kv.js +0 -7
- package/web/chunk-q6k872kv.js.br +0 -0
- package/web/chunk-q6k872kv.js.gz +0 -0
- package/web/chunk-q7krdwy7.js +0 -332
- package/web/chunk-q7krdwy7.js.br +0 -0
- package/web/chunk-q7krdwy7.js.gz +0 -0
- package/web/chunk-q7wbksg4.js +0 -1
- package/web/chunk-q7wbksg4.js.br +0 -0
- package/web/chunk-q7wbksg4.js.gz +0 -0
- package/web/chunk-qdxa0c4c.js +0 -1
- package/web/chunk-qdxa0c4c.js.br +0 -0
- package/web/chunk-qdxa0c4c.js.gz +0 -0
- package/web/chunk-r9m8jh7x.js +0 -2
- package/web/chunk-r9m8jh7x.js.br +0 -0
- package/web/chunk-r9m8jh7x.js.gz +0 -0
- package/web/chunk-rnhbck1h.js +0 -99
- package/web/chunk-rnhbck1h.js.br +0 -0
- package/web/chunk-rnhbck1h.js.gz +0 -0
- package/web/chunk-rxtzde6n.js +0 -62
- package/web/chunk-rxtzde6n.js.br +0 -0
- package/web/chunk-rxtzde6n.js.gz +0 -0
- package/web/chunk-ryds6qnb.js +0 -2
- package/web/chunk-ryds6qnb.js.br +0 -0
- package/web/chunk-ryds6qnb.js.gz +0 -0
- package/web/chunk-shc8bv2k.js +0 -2
- package/web/chunk-shc8bv2k.js.br +0 -0
- package/web/chunk-shc8bv2k.js.gz +0 -0
- package/web/chunk-stnwzrqv.js +0 -98
- package/web/chunk-stnwzrqv.js.br +0 -0
- package/web/chunk-stnwzrqv.js.gz +0 -0
- package/web/chunk-sy28z9pe.js +0 -2
- package/web/chunk-sy28z9pe.js.br +0 -2
- package/web/chunk-sy28z9pe.js.gz +0 -0
- package/web/chunk-szwh742y.js +0 -2
- package/web/chunk-szwh742y.js.br +0 -0
- package/web/chunk-szwh742y.js.gz +0 -0
- package/web/chunk-t60hp0qs.js +0 -36
- package/web/chunk-t60hp0qs.js.br +0 -0
- package/web/chunk-t60hp0qs.js.gz +0 -0
- package/web/chunk-t9twwgfe.js +0 -1
- package/web/chunk-t9twwgfe.js.br +0 -0
- package/web/chunk-t9twwgfe.js.gz +0 -0
- package/web/chunk-tbgavq0t.js +0 -2
- package/web/chunk-tbgavq0t.js.br +0 -0
- package/web/chunk-tbgavq0t.js.gz +0 -0
- package/web/chunk-tjma3e4d.js +0 -7
- package/web/chunk-tjma3e4d.js.br +0 -0
- package/web/chunk-tjma3e4d.js.gz +0 -0
- package/web/chunk-tv9rz73h.js +0 -30
- package/web/chunk-tv9rz73h.js.br +0 -0
- package/web/chunk-tv9rz73h.js.gz +0 -0
- package/web/chunk-twgzayjk.js +0 -1
- package/web/chunk-twgzayjk.js.br +0 -0
- package/web/chunk-twgzayjk.js.gz +0 -0
- package/web/chunk-tz4w2nh2.js +0 -303
- package/web/chunk-tz4w2nh2.js.br +0 -0
- package/web/chunk-tz4w2nh2.js.gz +0 -0
- package/web/chunk-v0egh6d3.js +0 -1
- package/web/chunk-v0egh6d3.js.br +0 -0
- package/web/chunk-v0egh6d3.js.gz +0 -0
- package/web/chunk-vayamfxv.js +0 -1
- package/web/chunk-vayamfxv.js.br +0 -0
- package/web/chunk-vayamfxv.js.gz +0 -0
- package/web/chunk-vcawg8d2.js +0 -1
- package/web/chunk-vcawg8d2.js.br +0 -0
- package/web/chunk-vcawg8d2.js.gz +0 -0
- package/web/chunk-vh8s2rek.js +0 -1
- package/web/chunk-vh8s2rek.js.br +0 -2
- package/web/chunk-vh8s2rek.js.gz +0 -0
- package/web/chunk-vns6bpqm.js +0 -2
- package/web/chunk-vns6bpqm.js.br +0 -0
- package/web/chunk-vns6bpqm.js.gz +0 -0
- package/web/chunk-vvbte0a5.css +0 -1
- package/web/chunk-vvbte0a5.css.br +0 -0
- package/web/chunk-vvbte0a5.css.gz +0 -0
- package/web/chunk-vxzw2t1r.js +0 -1
- package/web/chunk-vxzw2t1r.js.br +0 -0
- package/web/chunk-vxzw2t1r.js.gz +0 -0
- package/web/chunk-w40atygt.js +0 -2
- package/web/chunk-w40atygt.js.br +0 -0
- package/web/chunk-w40atygt.js.gz +0 -0
- package/web/chunk-w4bxgcwm.js +0 -1
- package/web/chunk-w4bxgcwm.js.br +0 -0
- package/web/chunk-w4bxgcwm.js.gz +0 -0
- package/web/chunk-w5t00pns.js +0 -70
- package/web/chunk-w5t00pns.js.br +0 -0
- package/web/chunk-w5t00pns.js.gz +0 -0
- package/web/chunk-wpmzdqba.js +0 -324
- package/web/chunk-wpmzdqba.js.br +0 -0
- package/web/chunk-wpmzdqba.js.gz +0 -0
- package/web/chunk-x9mexzav.js +0 -2
- package/web/chunk-x9mexzav.js.br +0 -0
- package/web/chunk-x9mexzav.js.gz +0 -0
- package/web/chunk-xc74f1nj.js +0 -1
- package/web/chunk-xc74f1nj.js.br +0 -0
- package/web/chunk-xc74f1nj.js.gz +0 -0
- package/web/chunk-xk8637wb.js +0 -1
- package/web/chunk-xk8637wb.js.br +0 -0
- package/web/chunk-xk8637wb.js.gz +0 -0
- package/web/chunk-xs4cyb71.js +0 -1
- package/web/chunk-xs4cyb71.js.br +0 -0
- package/web/chunk-xs4cyb71.js.gz +0 -0
- package/web/chunk-xthg4efe.js +0 -1
- package/web/chunk-xthg4efe.js.br +0 -0
- package/web/chunk-xthg4efe.js.gz +0 -0
- package/web/chunk-yet0bbyh.js +0 -1
- package/web/chunk-yet0bbyh.js.br +0 -0
- package/web/chunk-yet0bbyh.js.gz +0 -0
- package/web/chunk-yzcxmqy3.js +0 -1
- package/web/chunk-yzcxmqy3.js.br +0 -0
- package/web/chunk-yzcxmqy3.js.gz +0 -0
- package/web/chunk-z2a9zwwx.js +0 -24
- package/web/chunk-z2a9zwwx.js.br +0 -0
- package/web/chunk-z2a9zwwx.js.gz +0 -0
- package/web/chunk-z8fgdsx5.js +0 -1
- package/web/chunk-z8fgdsx5.js.br +0 -0
- package/web/chunk-z8fgdsx5.js.gz +0 -0
- package/web/chunk-zeyw59b9.js +0 -2
- package/web/chunk-zeyw59b9.js.br +0 -0
- package/web/chunk-zeyw59b9.js.gz +0 -0
- package/web/chunk-zftk5ww7.js +0 -8
- package/web/chunk-zftk5ww7.js.br +0 -0
- package/web/chunk-zftk5ww7.js.gz +0 -0
- package/web/chunk-zmbp3phd.js +0 -2
- package/web/chunk-zmbp3phd.js.br +0 -0
- package/web/chunk-zmbp3phd.js.gz +0 -0
- package/web/chunk-zpxh70dj.js +0 -1
- package/web/chunk-zpxh70dj.js.br +0 -0
- package/web/chunk-zpxh70dj.js.gz +0 -0
- package/web/chunk-zqhdf12s.js +0 -39
- package/web/chunk-zqhdf12s.js.br +0 -0
- package/web/chunk-zqhdf12s.js.gz +0 -0
- package/web/chunk-zr2xst5w.js +0 -1
- package/web/chunk-zr2xst5w.js.br +0 -0
- package/web/chunk-zr2xst5w.js.gz +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{qr,mr,jn,ot,Et,Wn,Je,oi,Ze,Yr,ht,P,Sa,br,ui,ft,re,Jr}from"./chunk-n3hfhbe4.js";import{de,lt,t,d}from"./chunk-x83syrhw.js";import"./chunk-x055cas0.js";import"./chunk-jwk5a5tk.js";export{ft as ArchivedError,t as BadRequestError,re as BusyError,Wn as FileCredentialStore,ot as MAX_ATTACHMENTS,d as NotFoundError,ht as PluginCheckError,Sa as ProxyManager,Jr as Runtime,oi as answerShellApproval,lt as dataDir,P as definePlugin,Yr as detectImageMimeType,Ze as gateShellCommand,de as hostPaths,Je as modelID,br as providerProxyScope,ui as proxyTargets,qr as readSearchCursor,mr as search,jn as searchSuggestions,Et as validAttachment};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import"./chunk-x83syrhw.js";import"./chunk-jwk5a5tk.js";import"./chunk-n3hfhbe4.js";import"./chunk-x055cas0.js";import"./chunk-ykzm5g1b.js";import"./chunk-vnv3a6t2.js";import{Wt}from"./chunk-jqtdf0ym.js";async function u(o,n,s,t){let r=new Wt(o,{localPort:()=>t.port});try{if(n==="set"&&s){let e=t.token??process.env.BASALT_TUNNEL_TOKEN;if(t.team!==void 0&&t.aud===void 0)throw Error("Access \u6821\u9A8C\u9700\u8981 --aud\uFF1B--team \u53EF\u4EE5\u4E0D\u586B\uFF08\u4FDD\u5B58\u65F6\u4F1A\u81EA\u52A8\u63A2\u6D4B\u56E2\u961F\u57DF\u540D\uFF09");let a=await r.save({hostname:s,...e?{token:e}:{},...t.aud?{access:{...t.team?{teamDomain:t.team}:{},audience:t.aud}}:{}},{start:!1});return console.log(`\u5DF2\u4FDD\u5B58\uFF1A${a.publicURL}${a.access?"\uFF08\u5DF2\u542F\u7528 Access \u6821\u9A8C\uFF09":""}`),console.log(`Cloudflare \u91CC\u8BE5\u4E3B\u673A\u540D\u7684\u670D\u52A1\u8981\u6307\u5411 http://localhost:${t.port}`),console.log("\u4E0B\u6B21\u542F\u52A8 basalt \u65F6\u81EA\u52A8\u8FDE\u63A5\uFF1B\u5DF2\u5728\u8FD0\u884C\u7684 basalt \u8BF7\u5230 \u8BBE\u7F6E \u2192 \u670D\u52A1\u5668 \u2192 \u8FDC\u7A0B\u8BBF\u95EE \u91CC\u64CD\u4F5C\uFF0C\u6216\u52A0 --replace \u91CD\u542F\u3002"),0}if(n==="off")return await r.remove(),console.log("\u5DF2\u5220\u9664\u8FDC\u7A0B\u8BBF\u95EE\u914D\u7F6E"),0;if(n==="status"||n===void 0){let e=r.status();if(!e.configured)console.log("\u8FDC\u7A0B\u8BBF\u95EE\uFF1A\u672A\u914D\u7F6E\uFF08basalt tunnel set <\u4E3B\u673A\u540D> --token <\u4EE4\u724C>\uFF09");else console.log(`\u8FDC\u7A0B\u8BBF\u95EE\uFF1A${e.publicURL}
|
|
3
|
+
Access \u6821\u9A8C\uFF1A${e.access?e.access.teamDomain:"\u672A\u542F\u7528"}
|
|
4
|
+
\u4EE4\u724C\uFF1A\u5DF2\u4FDD\u5B58`);return 0}throw Error("\u7528\u6CD5\uFF1Abasalt tunnel set <\u4E3B\u673A\u540D> [--token <\u4EE4\u724C>] [--aud <Audience> [--team <\u56E2\u961F\u57DF\u540D>]] | off | status")}catch(e){return console.error(e instanceof Error?e.message:String(e)),1}}export{u as tunnelCommand};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{posix as fe,win32 as ge}from"path";import{execFile as F,spawn as j}from"child_process";import{existsSync as x,mkdirSync as G,writeFileSync as W}from"fs";import{mkdir as v,open as z,readdir as I,readFile as K,realpath as X,stat as V,writeFile as Y}from"fs/promises";import{constants as J,homedir as Z,tmpdir as Q}from"os";import{delimiter as _,dirname as w,join as g,matchesGlob as ee,relative as te}from"path";import{Readable as re}from"stream";var y;class T{info={platform:process.platform,arch:process.arch,env:process.env,home:Z(),tmpdir:Q(),pty:typeof Bun<"u",rg:C("rg"),get windowsBash(){if(process.platform!=="win32")return;if(y&&x(y))return y;if(y=ae(),y)ce(y);return y}};async stat(e){try{let r=await V(e);return{kind:r.isFile()?"file":r.isDirectory()?"directory":"other",size:r.size,mtimeMs:r.mtimeMs}}catch(r){if(E(r)==="ENOENT"||E(r)==="ENOTDIR")return;throw r}}realpath(e){return X(e)}async readdir(e){return(await I(e,{withFileTypes:!0})).map((r)=>({name:r.name,directory:r.isDirectory()}))}async readFile(e,r){if(!r)return K(e);let n=await z(e,"r");try{let s=Buffer.alloc(Math.max(0,r.end-r.start)),o=await n.read(s,0,s.length,r.start);return s.subarray(0,o.bytesRead)}finally{await n.close()}}async writeFile(e,r){await v(w(e),{recursive:!0}),await Y(e,r)}async mkdir(e){await v(e,{recursive:!0})}async glob(e,r){if(typeof Bun<"u")return(await Array.fromAsync(new Bun.Glob(e).scan({cwd:r,dot:!0}))).map((o)=>o.replaceAll("\\","/"));let n=(o)=>o.replace(/(^|\/)\./g,"$1\x00");return(await I(r,{recursive:!0,withFileTypes:!0})).filter((o)=>o.isFile()).map((o)=>te(r,g(o.parentPath,o.name)).replaceAll("\\","/")).filter((o)=>ee(n(o),n(e)))}spawn(e,r){let n=process.platform==="win32"&&e[0]==="bash"&&this.info.windowsBash?[this.info.windowsBash,...e.slice(1)]:e;return r.pty?oe(n,r,r.pty):ne(n,r)}close(){}}var q=new T;function ne(e,r){let n=process.platform==="win32",s=Date.now(),o=j(e[0]??"",e.slice(1),{cwd:r.cwd,env:k({...O(r.tmpdir),...r.env},r.inheritEnv),stdio:[r.stdin?"pipe":"ignore","pipe","pipe"],detached:Boolean(r.group)&&!n,windowsHide:!0}),i=Date.now(),a,c=new Promise((l,u)=>{o.once("error",u),o.once("exit",(p,m)=>l(m?128+(J.signals[m]??0):p??0))});c.catch(()=>{});let f=(l)=>{try{return re.toWeb(l)}catch{return new ReadableStream({start:(u)=>u.close()})}};return{stdout:f(o.stdout),stderr:f(o.stderr),exited:c,write:(l)=>new Promise((u,p)=>{if(!o.stdin)return p(Error("stdin is not open"));o.stdin.write(l,(m)=>m?p(m):u())}),end:()=>new Promise((l)=>o.stdin?o.stdin.end(l):l()),kill:async()=>{if(o.pid===void 0)return;let l=o.exitCode!==null||o.signalCode!==null;if(n){if(l){if(await new Promise((u)=>setTimeout(u,50)),o.stdout?.readableEnded&&o.stderr?.readableEnded)return}a??=ie(o.pid,s,i).catch((u)=>{throw a=void 0,u}),await a;return}if(!r.group&&l)return;se(o.pid,Boolean(r.group),()=>o.kill("SIGKILL"))},resize:()=>{}}}function oe(e,r,n){if(typeof Bun>"u")throw Error("PTY requires the host to run on Bun");let s=new TransformStream,o=s.writable.getWriter(),i=Bun.spawn(e,{cwd:r.cwd,env:k({...O(r.tmpdir),...r.env},r.inheritEnv),terminal:{cols:n.cols,rows:n.rows,name:"xterm-256color",data:(c,f)=>void o.write(f),exit:()=>void o.close().catch(()=>{})}}),a=i.exited.then((c)=>(setTimeout(()=>{i.terminal?.close(),o.close().catch(()=>{})},1000),c));return{stdout:s.readable,stderr:new ReadableStream({start:(c)=>c.close()}),exited:a,write:async(c)=>{i.terminal?.write(c)},end:async()=>{},kill:async()=>{if(i.exitCode===null)i.kill()},resize:(c,f)=>i.terminal?.resize(c,f)}}function se(e,r,n){try{if(r)process.kill(-e,"SIGKILL");else n()}catch(s){if(E(s)!=="ESRCH")throw s}}async function ie(e,r,n){let s=`
|
|
3
|
+
$ErrorActionPreference = 'Stop'
|
|
4
|
+
$floor = [DateTimeOffset]::FromUnixTimeMilliseconds(${r}).UtcDateTime
|
|
5
|
+
$all = @(Get-CimInstance Win32_Process)
|
|
6
|
+
$root = $all | Where-Object { $_.ProcessId -eq ${e} }
|
|
7
|
+
$ceiling = [DateTimeOffset]::FromUnixTimeMilliseconds(${n+1}).UtcDateTime
|
|
8
|
+
if ($root -and ($root.CreationDate.ToUniversalTime() -lt $floor -or $root.CreationDate.ToUniversalTime() -ge $ceiling)) { throw 'Process identity changed' }
|
|
9
|
+
$tree = @{}
|
|
10
|
+
$tree[${e}] = $floor
|
|
11
|
+
do {
|
|
12
|
+
$changed = $false
|
|
13
|
+
foreach ($p in $all) {
|
|
14
|
+
$id = [int]$p.ProcessId
|
|
15
|
+
$parent = [int]$p.ParentProcessId
|
|
16
|
+
if (!$p.CreationDate) { continue }
|
|
17
|
+
$created = $p.CreationDate.ToUniversalTime()
|
|
18
|
+
if (!$tree.ContainsKey($id) -and $tree.ContainsKey($parent) -and $created -ge $tree[$parent]) {
|
|
19
|
+
$tree[$id] = $created
|
|
20
|
+
$changed = $true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
} while ($changed)
|
|
24
|
+
foreach ($p in @($all | Where-Object { $tree.ContainsKey([int]$_.ProcessId) } | Sort-Object CreationDate -Descending)) {
|
|
25
|
+
$live = $null
|
|
26
|
+
try { $live = [System.Diagnostics.Process]::GetProcessById([int]$p.ProcessId) }
|
|
27
|
+
catch { continue }
|
|
28
|
+
try {
|
|
29
|
+
if ([Math]::Abs(($live.StartTime.ToUniversalTime() - $p.CreationDate.ToUniversalTime()).TotalMilliseconds) -ge 1) { throw 'Process identity changed' }
|
|
30
|
+
if (!$live.HasExited) {
|
|
31
|
+
& taskkill.exe /PID $live.Id /F | Out-Null
|
|
32
|
+
if ($LASTEXITCODE -ne 0 -and !$live.HasExited) { throw 'Process termination failed' }
|
|
33
|
+
}
|
|
34
|
+
if (!$live.WaitForExit(2000)) { throw 'Process did not exit' }
|
|
35
|
+
} finally { $live.Dispose() }
|
|
36
|
+
}
|
|
37
|
+
exit 0
|
|
38
|
+
`;await new Promise((o,i)=>{F("powershell.exe",["-NoProfile","-NonInteractive","-Command",s],{windowsHide:!0,timeout:1e4,maxBuffer:64000},(a)=>{if(a)i(Error(`\u65E0\u6CD5\u7EC8\u6B62 Windows \u8FDB\u7A0B\u6811 ${e}\uFF0C\u8BF7\u68C0\u67E5\u8FDB\u7A0B\u6743\u9650\u6216\u7CFB\u7EDF\u7BA1\u7406\u670D\u52A1`,{cause:a}));else o()})})}function O(e){if(!e)return{};try{G(e,{recursive:!0});let r=g(e,".gitignore");if(!x(r))W(r,`*
|
|
39
|
+
!.gitignore
|
|
40
|
+
`);return{TMPDIR:e,TEMP:e,TMP:e}}catch{return{}}}function k(e={},r){let s={...r===void 0?process.env:Object.fromEntries(Object.entries(process.env).filter(([o,i])=>r.includes(o)&&!i?.startsWith("()"))),...e};return Object.fromEntries(Object.entries(s).filter((o)=>o[1]!==void 0))}function E(e){return e instanceof Error&&"code"in e?e.code:void 0}function C(e){if(typeof Bun<"u")return Bun.which(e)??void 0;let r=process.platform==="win32"?(process.env.PATHEXT??".EXE").split(";"):[""];for(let n of(process.env.PATH??"").split(_).filter(Boolean))for(let s of r)if(x(g(n,e+s)))return g(n,e+s);return}function ae(){let e=(process.env.PATH??"").split(";").map((o)=>o.trim()).filter(Boolean),r=(o)=>{let i=o.replaceAll("\\","/").toLowerCase();return/\/windows\/(system32|sysnative|syswow64)\/bash\.exe$/.test(i)||i.includes("/windowsapps/")},n=process.env.LOCALAPPDATA;return[...e.map((o)=>g(o,"bash.exe")).filter((o)=>!r(o)),...e.filter((o)=>x(g(o,"git.exe"))).flatMap((o)=>[g(w(o),"bin","bash.exe"),g(w(o),"usr","bin","bash.exe")]),"C:\\Program Files\\Git\\bin\\bash.exe","C:\\Program Files\\Git\\usr\\bin\\bash.exe","C:\\Program Files (x86)\\Git\\bin\\bash.exe","C:\\Program Files (x86)\\Git\\usr\\bin\\bash.exe",...n?[g(n,"Programs","Git","bin","bash.exe"),g(n,"Programs","Git","usr","bin","bash.exe")]:[],"C:\\msys64\\usr\\bin\\bash.exe"].find((o)=>x(o))}function ce(e){if(C("git"))return;let r=g(e.replace(/[\\/](usr[\\/])?bin[\\/]bash\.exe$/i,""),"cmd");if(x(g(r,"git.exe")))process.env.PATH=`${r}${_}${process.env.PATH??""}`}import{join as pe}from"path";class Zr{channel;info;messages;nextID=0;calls=new Map;procs=new Map;closed;constructor(e,r,n){this.channel=e;this.info=r;this.messages=n;this.listen()}static async connect(e,r=30000){let n=le(e.readable)[Symbol.asyncIterator](),s;try{let o=await Promise.race([n.next(),new Promise((i,a)=>{s=setTimeout(()=>a(Error("host handshake timed out")),r)})]);if(o.done||o.value.t!=="hello")throw Error("host process exited before it was ready");return new Zr(e,o.value.info,n)}catch(o){throw e.close(),o}finally{clearTimeout(s)}}stat(e){return this.call("stat",e)}realpath(e){return this.call("realpath",e)}readdir(e){return this.call("readdir",e)}readFile(e,r){return this.call("readFile",e,r)}async writeFile(e,r){await this.call("writeFile",e,r)}async mkdir(e){await this.call("mkdir",e)}glob(e,r){return this.call("glob",e,r)}spawn(e,r){let n=this.nextID++,s=new D((o,...i)=>this.call(o,n,...i));if(this.closed)s.fail(this.closed);else{this.procs.set(n,s);let o=Object.entries(r.env??{}).filter(([,i])=>i===void 0).map(([i])=>i);this.send({t:"spawn",h:n,argv:e,options:r,unsetEnv:o})}return s}get connected(){return this.closed===void 0}close(){this.shutdown(Error("host connection closed"))}call(e,...r){if(this.closed)return Promise.reject(this.closed);let n=this.nextID++,s=Promise.withResolvers();return this.calls.set(n,s),this.send({t:"call",id:n,op:e,args:r.map(ue)}),s.promise}send(e){try{Promise.resolve(this.channel.write(`${JSON.stringify(e)}
|
|
41
|
+
`)).catch((r)=>{this.shutdown(r instanceof Error?r:Error(String(r)))})}catch(r){this.shutdown(r instanceof Error?r:Error(String(r)))}}async listen(){try{for(let e=await this.messages.next();!e.done;e=await this.messages.next()){let r=e.value;if(r.t==="info")Object.assign(this.info,r.info);if(r.t==="ret"||r.t==="err"){let o=this.calls.get(r.id);if(this.calls.delete(r.id),r.t==="ret")o?.resolve(M(r.value));else o?.reject(Object.assign(Error(r.message),{code:r.code}))}let n="h"in r?r.h:-1,s=this.procs.get(n);if(!s)continue;if(r.t==="out")s.push(r.s,M(r.d));if(r.t==="eof")s.eof(r.s);if(r.t==="exit"&&r.message!==void 0)s.fail(Object.assign(Error(r.message),{code:r.errorCode}));if(r.t==="exit"&&r.code!==void 0)s.exit(r.code);if(s.finished)this.procs.delete(n)}this.shutdown(Error("host process disconnected"))}catch(e){this.shutdown(e instanceof Error?e:Error(String(e)))}}shutdown(e){if(this.closed)return;this.closed=e;for(let r of this.calls.values())r.reject(e);this.calls.clear();for(let r of this.procs.values())r.fail(e);this.procs.clear(),this.channel.close()}}class D{control;stdout;stderr;sinks=[];done=Promise.withResolvers();exited=this.done.promise;constructor(e){this.control=e;this.stdout=new ReadableStream({start:(r)=>{this.sinks[1]=r}},{highWaterMark:8388608,size:(r)=>r?.byteLength??0}),this.stderr=new ReadableStream({start:(r)=>{this.sinks[2]=r}},{highWaterMark:8388608,size:(r)=>r?.byteLength??0}),this.exited.catch(()=>{})}async write(e){await this.control("write",e)}async end(){await this.control("end")}async kill(){await this.control("kill").catch((e)=>{if(!(e instanceof Error&&e.message==="process not found"))throw e})}resize(e,r){this.control("resize",e,r).catch(()=>{})}push(e,r){let n=this.sinks[e];if(n?.desiredSize!==null&&n?.desiredSize!==void 0&&r.byteLength>n.desiredSize){this.fail(Error("remote process output exceeded the 8 MiB unread buffer")),this.kill().catch(()=>{});return}try{n?.enqueue(r)}catch{}}open=2;ended=!1;get finished(){return this.ended&&this.open===0}eof(e){this.open--;try{this.sinks[e]?.close()}catch{}}exit(e){this.ended=!0,this.done.resolve(e)}fail(e){this.ended=!0,this.open=0;for(let r of this.sinks)try{r?.error(e)}catch{}this.done.reject(e)}}async function Kn(e,r=q.info.home){let n=q.spawn(e,{cwd:r,stdin:!0}),s=new Response(n.stderr).text();try{return await Zr.connect({readable:n.stdout,write:(o)=>n.write(o),close:()=>void n.kill().catch(()=>{})})}catch(o){await n.kill().catch(()=>{});let i=(await Promise.race([s,Bun.sleep(1000).then(()=>"")])).trim();throw Error(i?`${o.message}: ${i}`:o.message)}}async function*le(e){let r=new TextDecoder,n=[],s=100663296,o=0;for await(let i of e){let a=0;for(let c=i.indexOf(10);c!==-1;c=i.indexOf(10,a)){if(o+=c-a,o>100663296)throw Error("host protocol message exceeds 96 MiB");n.push(i.subarray(a,c));let f=r.decode(n.length===1?n[0]:Buffer.concat(n));if(n.length=0,o=0,a=c+1,f)yield JSON.parse(f)}if(a<i.length){if(o+=i.length-a,o>100663296)throw Error("host protocol message exceeds 96 MiB");n.push(i.subarray(a))}}}function ue(e){return e instanceof Uint8Array?{$b:Buffer.from(e).toString("base64")}:e}function M(e){return e&&typeof e==="object"&&"$b"in e&&typeof e.$b==="string"?new Uint8Array(Buffer.from(e.$b,"base64")):e}var P;function L(){return Promise.resolve('var P=require("node:child_process"),g=require("node:fs"),m=require("node:fs/promises"),x=require("node:os"),a=require("node:path"),S=require("node:stream"),y;class A{info={platform:process.platform,arch:process.arch,env:process.env,home:x.homedir(),tmpdir:x.tmpdir(),pty:typeof Bun<"u",rg:I("rg"),get windowsBash(){if(process.platform!=="win32")return;if(y&&g.existsSync(y))return y;if(y=j(),y)L(y);return y}};async stat(e){try{let r=await m.stat(e);return{kind:r.isFile()?"file":r.isDirectory()?"directory":"other",size:r.size,mtimeMs:r.mtimeMs}}catch(r){if(E(r)==="ENOENT"||E(r)==="ENOTDIR")return;throw r}}realpath(e){return m.realpath(e)}async readdir(e){return(await m.readdir(e,{withFileTypes:!0})).map((r)=>({name:r.name,directory:r.isDirectory()}))}async readFile(e,r){if(!r)return m.readFile(e);let n=await m.open(e,"r");try{let i=Buffer.alloc(Math.max(0,r.end-r.start)),t=await n.read(i,0,i.length,r.start);return i.subarray(0,t.bytesRead)}finally{await n.close()}}async writeFile(e,r){await m.mkdir(a.dirname(e),{recursive:!0}),await m.writeFile(e,r)}async mkdir(e){await m.mkdir(e,{recursive:!0})}async glob(e,r){if(typeof Bun<"u")return(await Array.fromAsync(new Bun.Glob(e).scan({cwd:r,dot:!0}))).map((t)=>t.replaceAll("\\\\","/"));let n=(t)=>t.replace(/(^|\\/)\\./g,"$1\\x00");return(await m.readdir(r,{recursive:!0,withFileTypes:!0})).filter((t)=>t.isFile()).map((t)=>a.relative(r,a.join(t.parentPath,t.name)).replaceAll("\\\\","/")).filter((t)=>a.matchesGlob(n(t),n(e)))}spawn(e,r){let n=process.platform==="win32"&&e[0]==="bash"&&this.info.windowsBash?[this.info.windowsBash,...e.slice(1)]:e;return r.pty?F(n,r,r.pty):R(n,r)}close(){}}var H=new A;function R(e,r){let n=process.platform==="win32",i=Date.now(),t=P.spawn(e[0]??"",e.slice(1),{cwd:r.cwd,env:C({...O(r.tmpdir),...r.env},r.inheritEnv),stdio:[r.stdin?"pipe":"ignore","pipe","pipe"],detached:Boolean(r.group)&&!n,windowsHide:!0}),o=Date.now(),l,d=new Promise((h,w)=>{t.once("error",w),t.once("exit",(b,s)=>h(s?128+(x.constants.signals[s]??0):b??0))});d.catch(()=>{});let p=(h)=>{try{return S.Readable.toWeb(h)}catch{return new ReadableStream({start:(w)=>w.close()})}};return{stdout:p(t.stdout),stderr:p(t.stderr),exited:d,write:(h)=>new Promise((w,b)=>{if(!t.stdin)return b(Error("stdin is not open"));t.stdin.write(h,(s)=>s?b(s):w())}),end:()=>new Promise((h)=>t.stdin?t.stdin.end(h):h()),kill:async()=>{if(t.pid===void 0)return;let h=t.exitCode!==null||t.signalCode!==null;if(n){if(h){if(await new Promise((w)=>setTimeout(w,50)),t.stdout?.readableEnded&&t.stderr?.readableEnded)return}l??=M(t.pid,i,o).catch((w)=>{throw l=void 0,w}),await l;return}if(!r.group&&h)return;D(t.pid,Boolean(r.group),()=>t.kill("SIGKILL"))},resize:()=>{}}}function F(e,r,n){if(typeof Bun>"u")throw Error("PTY requires the host to run on Bun");let i=new TransformStream,t=i.writable.getWriter(),o=Bun.spawn(e,{cwd:r.cwd,env:C({...O(r.tmpdir),...r.env},r.inheritEnv),terminal:{cols:n.cols,rows:n.rows,name:"xterm-256color",data:(d,p)=>void t.write(p),exit:()=>void t.close().catch(()=>{})}}),l=o.exited.then((d)=>(setTimeout(()=>{o.terminal?.close(),t.close().catch(()=>{})},1000),d));return{stdout:i.readable,stderr:new ReadableStream({start:(d)=>d.close()}),exited:l,write:async(d)=>{o.terminal?.write(d)},end:async()=>{},kill:async()=>{if(o.exitCode===null)o.kill()},resize:(d,p)=>o.terminal?.resize(d,p)}}function D(e,r,n){try{if(r)process.kill(-e,"SIGKILL");else n()}catch(i){if(E(i)!=="ESRCH")throw i}}async function M(e,r,n){let i=`\n$ErrorActionPreference = \'Stop\'\n$floor = [DateTimeOffset]::FromUnixTimeMilliseconds(${r}).UtcDateTime\n$all = @(Get-CimInstance Win32_Process)\n$root = $all | Where-Object { $_.ProcessId -eq ${e} }\n$ceiling = [DateTimeOffset]::FromUnixTimeMilliseconds(${n+1}).UtcDateTime\nif ($root -and ($root.CreationDate.ToUniversalTime() -lt $floor -or $root.CreationDate.ToUniversalTime() -ge $ceiling)) { throw \'Process identity changed\' }\n$tree = @{}\n$tree[${e}] = $floor\ndo {\n $changed = $false\n foreach ($p in $all) {\n $id = [int]$p.ProcessId\n $parent = [int]$p.ParentProcessId\n if (!$p.CreationDate) { continue }\n $created = $p.CreationDate.ToUniversalTime()\n if (!$tree.ContainsKey($id) -and $tree.ContainsKey($parent) -and $created -ge $tree[$parent]) {\n $tree[$id] = $created\n $changed = $true\n }\n }\n} while ($changed)\nforeach ($p in @($all | Where-Object { $tree.ContainsKey([int]$_.ProcessId) } | Sort-Object CreationDate -Descending)) {\n $live = $null\n try { $live = [System.Diagnostics.Process]::GetProcessById([int]$p.ProcessId) }\n catch { continue }\n try {\n if ([Math]::Abs(($live.StartTime.ToUniversalTime() - $p.CreationDate.ToUniversalTime()).TotalMilliseconds) -ge 1) { throw \'Process identity changed\' }\n if (!$live.HasExited) {\n & taskkill.exe /PID $live.Id /F | Out-Null\n if ($LASTEXITCODE -ne 0 -and !$live.HasExited) { throw \'Process termination failed\' }\n }\n if (!$live.WaitForExit(2000)) { throw \'Process did not exit\' }\n } finally { $live.Dispose() }\n}\nexit 0\n`;await new Promise((t,o)=>{P.execFile("powershell.exe",["-NoProfile","-NonInteractive","-Command",i],{windowsHide:!0,timeout:1e4,maxBuffer:64000},(l)=>{if(l)o(Error(`\u65E0\u6CD5\u7EC8\u6B62 Windows \u8FDB\u7A0B\u6811 ${e}\uFF0C\u8BF7\u68C0\u67E5\u8FDB\u7A0B\u6743\u9650\u6216\u7CFB\u7EDF\u7BA1\u7406\u670D\u52A1`,{cause:l}));else t()})})}function O(e){if(!e)return{};try{g.mkdirSync(e,{recursive:!0});let r=a.join(e,".gitignore");if(!g.existsSync(r))g.writeFileSync(r,`*\n!.gitignore\n`);return{TMPDIR:e,TEMP:e,TMP:e}}catch{return{}}}function C(e={},r){let i={...r===void 0?process.env:Object.fromEntries(Object.entries(process.env).filter(([t,o])=>r.includes(t)&&!o?.startsWith("()"))),...e};return Object.fromEntries(Object.entries(i).filter((t)=>t[1]!==void 0))}function E(e){return e instanceof Error&&"code"in e?e.code:void 0}function I(e){if(typeof Bun<"u")return Bun.which(e)??void 0;let r=process.platform==="win32"?(process.env.PATHEXT??".EXE").split(";"):[""];for(let n of(process.env.PATH??"").split(a.delimiter).filter(Boolean))for(let i of r)if(g.existsSync(a.join(n,e+i)))return a.join(n,e+i);return}function j(){let e=(process.env.PATH??"").split(";").map((t)=>t.trim()).filter(Boolean),r=(t)=>{let o=t.replaceAll("\\\\","/").toLowerCase();return/\\/windows\\/(system32|sysnative|syswow64)\\/bash\\.exe$/.test(o)||o.includes("/windowsapps/")},n=process.env.LOCALAPPDATA;return[...e.map((t)=>a.join(t,"bash.exe")).filter((t)=>!r(t)),...e.filter((t)=>g.existsSync(a.join(t,"git.exe"))).flatMap((t)=>[a.join(a.dirname(t),"bin","bash.exe"),a.join(a.dirname(t),"usr","bin","bash.exe")]),"C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe","C:\\\\Program Files\\\\Git\\\\usr\\\\bin\\\\bash.exe","C:\\\\Program Files (x86)\\\\Git\\\\bin\\\\bash.exe","C:\\\\Program Files (x86)\\\\Git\\\\usr\\\\bin\\\\bash.exe",...n?[a.join(n,"Programs","Git","bin","bash.exe"),a.join(n,"Programs","Git","usr","bin","bash.exe")]:[],"C:\\\\msys64\\\\usr\\\\bin\\\\bash.exe"].find((t)=>g.existsSync(t))}function L(e){if(I("git"))return;let r=a.join(e.replace(/[\\\\/](usr[\\\\/])?bin[\\\\/]bash\\.exe$/i,""),"cmd");if(g.existsSync(a.join(r,"git.exe")))process.env.PATH=`${r}${a.delimiter}${process.env.PATH??""}`}var z=["stat","realpath","readdir","readFile","writeFile","mkdir","glob"];async function U(e,r,n=H){let i=Promise.withResolvers(),t=async(s)=>{try{await r(`${JSON.stringify(s)}\n`)}catch(u){i.reject(u)}},o=new Map;i.promise.catch(()=>{});let l=()=>({...n.info,env:Object.fromEntries(Object.entries(n.info.env).filter(([s,u])=>["path","shell","lang"].includes(s.toLowerCase())&&!u?.startsWith("()")))}),d=l();await t({t:"hello",info:d});let p=()=>{let s=l();if(s.windowsBash===d.windowsBash)return;d=s,t({t:"info",info:s})},h=async(s,u)=>{if(z.includes(s))return n[s].apply(n,u);let c=o.get(u[0]);if(!c)throw Error("process not found");if(s==="write")return c.write(u[1]);if(s==="end")return c.end();if(s==="kill")return c.kill();if(s==="resize")return c.resize(u[1],u[2]);throw Error(`unknown op ${s}`)},w=async(s,u,c)=>{for await(let f of u)await t({t:"out",h:s,s:c,d:B(f)});await t({t:"eof",h:s,s:c})},b=(s,u,c)=>{try{let f=n.spawn(u,c);o.set(s,f);let v=Promise.all([w(s,f.stdout,1),w(s,f.stderr,2)]).catch(()=>{});f.exited.then((k)=>{t({t:"exit",h:s,code:k}),v.then(()=>o.delete(s))},(k)=>{o.delete(s),t({t:"exit",h:s,...T(k)})})}catch(f){t({t:"exit",h:s,...T(f)})}};try{let s=G(e)[Symbol.asyncIterator]();for(;;){let u=await Promise.race([s.next(),i.promise]);if(u.done)break;let c=u.value;if(c.t==="spawn"){let f={...c.options.env};for(let v of c.unsetEnv??[])f[v]=void 0;b(c.h,c.argv,{...c.options,env:f}),p()}if(c.t!=="call")continue;h(c.op,c.args.map(W)).then((f)=>t({t:"ret",id:c.id,value:B(f)}),(f)=>{let v=T(f);t({t:"err",id:c.id,message:v.message,code:v.errorCode})})}}finally{await Promise.all([...o.values()].map((s)=>s.kill().catch(()=>{})))}}async function*G(e){let r=new TextDecoder,n=[],i=100663296,t=0;for await(let o of e){let l=0;for(let d=o.indexOf(10);d!==-1;d=o.indexOf(10,l)){if(t+=d-l,t>100663296)throw Error("host protocol message exceeds 96 MiB");n.push(o.subarray(l,d));let p=r.decode(n.length===1?n[0]:Buffer.concat(n));if(n.length=0,t=0,l=d+1,p)yield JSON.parse(p)}if(l<o.length){if(t+=o.length-l,t>100663296)throw Error("host protocol message exceeds 96 MiB");n.push(o.subarray(l))}}}function B(e){return e instanceof Uint8Array?{$b:Buffer.from(e).toString("base64")}:e}function W(e){return e&&typeof e==="object"&&"$b"in e&&typeof e.$b==="string"?new Uint8Array(Buffer.from(e.$b,"base64")):e}function T(e){if(!(e instanceof Error))return{message:String(e)};return{message:e.message,errorCode:"code"in e&&typeof e.code==="string"?e.code:void 0}}U(process.stdin,(e)=>new Promise((r,n)=>{process.stdout.write(e,(i)=>i?n(i):r())})).then(()=>process.exit(0),(e)=>{console.error(e instanceof Error?e.message:String(e)),process.exit(1)});\n')}async function H(e,r="ssh"){if(!e.trim()||e.startsWith("-"))throw Error(`invalid ssh destination: ${e}`);let s=`import{createRequire}from"node:module";const require=createRequire(import.meta.url);eval(Buffer.from("${Buffer.from(await L()).toString("base64")}","base64").toString())`;return[r,"-T","-o","BatchMode=yes","-o","ForwardAgent=no","-o","ForwardX11=no","-o","ClearAllForwardings=yes","-o","ControlPath=none","-o","StrictHostKeyChecking=yes","-o","ConnectTimeout=15","-o","ServerAliveInterval=15","-o","ServerAliveCountMax=3",e,`sh -c '${'PATH="$HOME/.bun/bin:$PATH"; if command -v bun >/dev/null 2>&1; then exec bun -e "$0"; fi; if command -v node >/dev/null 2>&1; then exec node --input-type=module -e "$0"; fi; echo "basalt: bun or node is required on the remote host" >&2; exit 127'}' '${s}'`]}class at{destination;connect;connection;snapshot;disposed=!1;constructor(e,r=async(n)=>Kn(await H(n))){this.destination=e;this.connect=r}get info(){if(!this.snapshot)throw Error(`remote host ${this.destination} is not connected yet`);return this.snapshot}async ready(){return await this.remote(),this}async stat(e){return(await this.remote()).stat(e)}async realpath(e){return(await this.remote()).realpath(e)}async readdir(e){return(await this.remote()).readdir(e)}async readFile(e,r){return(await this.remote()).readFile(e,r)}async writeFile(e,r){return(await this.remote()).writeFile(e,r)}async mkdir(e){return(await this.remote()).mkdir(e)}async glob(e,r){return(await this.remote()).glob(e,r)}spawn(e,r){return me(this.remote(),(n)=>n.spawn(e,r))}close(){this.disposed=!0;let e=this.connection;this.connection=void 0,e?.then((r)=>r.close()).catch(()=>{})}remote(){if(this.disposed)return Promise.reject(Error(`remote host ${this.destination} is closed`));let e=this.connection;if(e)return e.then((r)=>r.connected?r:this.reconnect(e));return this.reconnect(void 0)}reconnect(e){if(this.connection!==e&&this.connection)return this.remote();let r=this.connect(this.destination).then((n)=>{if(this.disposed)throw n.close(),Error(`remote host ${this.destination} is closed`);return this.snapshot=n.info,n});return this.connection=r,r.catch(()=>{if(this.connection===r)this.connection=void 0}),r}}function me(e,r){let n=!1,s,o=Promise.withResolvers(),i=Promise.race([e.then((l)=>{if(n)throw Error("process cancelled before start");return s=r(l),s}),o.promise]),a=new TransformStream,c=new TransformStream;i.then((l)=>{l.stdout.pipeTo(a.writable).catch(()=>{}),l.stderr.pipeTo(c.writable).catch(()=>{})},(l)=>{a.writable.abort(l).catch(()=>{}),c.writable.abort(l).catch(()=>{})});let f=i.then((l)=>l.exited);return f.catch(()=>{}),{stdout:a.readable,stderr:c.readable,exited:f,write:async(l)=>(await i).write(l),end:async()=>(await i).end(),kill:async()=>{if(n=!0,s)await s.kill();else o.reject(Error("process cancelled before start"))},resize:(l,u)=>void i.then((p)=>p.resize(l,u)).catch(()=>{})}}function de(e){return e.info.platform==="win32"?ge:fe}var di="basalt.digest",mi="basalt.notice",Qn="shell-guard",xa=["done","error","aborted","interrupted","waiting_user"];class t extends Error{constructor(e){super(e);this.name="BadRequestError"}}class d extends Error{constructor(e){super(e);this.name="NotFoundError"}}var Dt="chatgpt:subscription";function N(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"")}function U(e){return new Set(e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean))}function he(e,r){if(e===r)return 0;let n=Array.from({length:r.length+1},(s,o)=>o);for(let s=1;s<=e.length;s++){let o=n[0]??0;n[0]=s;for(let i=1;i<=r.length;i++){let a=n[i]??0;n[i]=Math.min((n[i]??0)+1,(n[i-1]??0)+1,o+(e[s-1]===r[i-1]?0:1)),o=a}}return n[r.length]??0}function B(e,r){let n=N(e);if(!n)return[];let s=U(e),o=[];for(let i of r){let a=i.id.indexOf("/"),c=a>=0?i.id.slice(a+1):"",l=[i.id,i.name,c].filter(Boolean).map((p)=>({compact:N(p),tokens:U(p)})).filter((p)=>p.compact.length>0),u=Number.POSITIVE_INFINITY;for(let p of l)if(p.compact===n)u=Math.min(u,0);else if(p.compact.includes(n)||n.includes(p.compact)){let m=Math.abs(p.compact.length-n.length);u=Math.min(u,1+m/Math.max(p.compact.length,n.length))}else{let m=0;for(let h of s)if(p.tokens.has(h))m++;if(m>0){let h=m/Math.max(s.size,p.tokens.size);u=Math.min(u,10+(1-h)*10)}}if(!Number.isFinite(u)&&n.length>=4){let p=Math.max(2,Math.floor(n.length*0.34));for(let m of l){if(Math.abs(m.compact.length-n.length)>p)continue;let h=he(n,m.compact);if(h<=p)u=Math.min(u,100+h)}}if(Number.isFinite(u))o.push({model:i,score:u})}return o.sort((i,a)=>i.score-a.score||i.model.id.localeCompare(a.model.id))}function be(e,r,n=5){return B(e,r).slice(0,Math.max(1,n)).map((s)=>s.model)}function va(e,r){let n=B(e,r);if(n.length===0)return;let s=n.filter((i)=>i.score===0);if(s.length===1&&s[0])return s[0].model;if(s.length>1)return;let o=n.filter((i)=>i.score<10);if(o.length===1&&o[0])return o[0].model;return}function _a(e,r){let n=[...r].sort((a,c)=>a.id.localeCompare(c.id)),s=(a)=>a.name===a.id?a.id:`${a.id} (${a.name})`,o=be(e,n).map(s),i=n.map(s);return[`unknown model ${e}`,`closest matches: ${o.length>0?o.join(", "):"none"}`,`available models (${i.length}): ${i.length>0?i.join(", "):"none"}`,"Use one of the listed provider/model IDs."].join(`
|
|
42
|
+
`)}var Ea=["openai-completions","openai-responses","anthropic-messages"];function Yn(e){if(typeof e==="number")return Number.isFinite(e)&&e>0?Math.round(e):void 0;if(typeof e!=="string")return;let r=e.trim().toLowerCase();if(!r)return;let n=r.match(/^(\d+(?:\.\d+)?)\s*(k|m)?(?:i?b|tokens?)?$/);if(!n)return;let s=Number.parseFloat(n[1]??"");if(!Number.isFinite(s)||s<=0)return;let o=n[2];if(o==="k")return Math.round(s*1000);if(o==="m")return Math.round(s*1e6);return Math.round(s)}function R(e){if(e>=1e6&&e%1e5===0)return`${e/1e6}m`;if(e>=1000&&e%1000===0)return`${e/1000}k`;return String(e)}function ye(e){let r=e.trim();if(!r)return;let n,s,o=r,i=o.match(/\s*\[(.*?)\]\s*$/);if(i&&i.index!==void 0){o=o.slice(0,i.index).trim();let u=i[1]?.split(",").map((m)=>m.trim()).filter(Boolean)??[],p=0;for(let m of u){let h=m.indexOf("=");if(h>=0){let b=m.slice(0,h).trim().toLowerCase(),A=Yn(m.slice(h+1).trim());if(b==="context"||b==="ctx"||b==="window"||b==="contextwindow")n=A;else if(b==="max"||b==="output"||b==="maxtokens")s=A}else{let b=Yn(m);if(p===0)n=b;else if(p===1)s=b;p++}}}else{let u=o.match(/^(.*?=.*?):(\d+(?:\.\d+)?[kmKM]?|\d{5,})\s*$/);if(u?.[1]&&u[2])o=u[1].trim(),n=Yn(u[2])}let a=o.indexOf("="),c,f;if(a<0)c=o.trim(),f=c;else c=o.slice(0,a).trim(),f=o.slice(a+1).trim()||c;if(!c)return;let l={id:c,name:f};if(n!==void 0)l.contextWindow=n;if(s!==void 0)l.maxTokens=s;return l}function en(e){return e.split(/\r?\n/).map(ye).filter((r)=>r!==void 0)}function ys(e){return e.map((r)=>{let n=r.name===r.id?r.id:`${r.id}=${r.name}`,s=[];if(r.contextWindow!==void 0)s.push(R(r.contextWindow));if(r.maxTokens!==void 0)if(r.contextWindow!==void 0)s.push(R(r.maxTokens));else s.push(`max=${R(r.maxTokens)}`);return s.length>0?`${n} [${s.join(", ")}]`:n}).join(`
|
|
43
|
+
`)}var Aa=["react","react-dom","react/jsx-runtime","react/jsx-dev-runtime","@basalt/plugin/web","@basalt/ui"];var xe=["http","https"];var Ta="provider:",ka="oauth:openai",tn="update:registry";function bs(e){let r=e.trim();if(!r)throw Error("\u8BF7\u8F93\u5165\u4EE3\u7406\u4E3B\u673A\u6216\u5B8C\u6574\u5730\u5740");let n;try{n=new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(r)?r:`http://${r}`)}catch{throw Error("\u4EE3\u7406\u5730\u5740\u65E0\u6548")}if(!Se(n.protocol))throw Error("\u4EC5\u652F\u6301 http:// \u6216 https:// \u4EE3\u7406");if(n.username||n.password||n.pathname!=="/"||n.search||n.hash)throw Error("\u4EE3\u7406\u5730\u5740\u53EA\u80FD\u5305\u542B\u534F\u8BAE\u3001\u4E3B\u673A\u548C\u7AEF\u53E3\uFF1B\u8D26\u53F7\u5BC6\u7801\u8BF7\u5355\u72EC\u586B\u5199");return{protocol:n.protocol==="https:"?"https":"http",hostname:n.hostname.replace(/^\[|\]$/g,""),port:n.port?Number(n.port):n.protocol==="https:"?443:8080}}function Se(e){return xe.some((r)=>`${r}:`===e)}function Pa(e){return e.startsWith("provider:")&&e.length>9}var Xn=["user","assistant","thinking","tool_input","tool_output","error","attachment","notice","extension","title"],Ca=["text","regex"],Ra=["best","recent"],Ia=["session","none"];var vr=4,Ma="https://basalt.work",Oa=["https://basalt.work","https://www.basalt.work"],hi=7420;var ws=["auto","bash","powershell","cmd"];var Ss=["active","archived","all"],La="session.group";var fi=["pending","in_progress","completed"],xs="basalt-session",gi=["image","text","path"],Jn="@blob:";var Da=["defer","always"],Na=["global","tool","source"];function we(e,r){if(e.toLowerCase()!=="tool_call"||!r||typeof r!=="object")return{name:e,input:r};let n=r;if(typeof n.name!=="string"||!n.name.trim())return{name:e,input:r};if(n.arguments===void 0)return{name:n.name,input:{},source:{name:"tool_call",input:r}};if(!n.arguments||typeof n.arguments!=="object"||Array.isArray(n.arguments))return{name:e,input:r};return{name:n.name,input:n.arguments,source:{name:"tool_call",input:r}}}function Ua(e){return/eyJ[A-Za-z0-9+/=_-]{16,}/.exec(e)?.[0]}var vs="x-basalt-remote-authorization",yi="cf-access-token";import{homedir as Ee}from"os";import{join as S}from"path";function lt(e=process.env){if(e.BASALT_HOME)return e.BASALT_HOME;let r=Ee();if(process.platform==="win32")return S(e.LOCALAPPDATA??S(r,"AppData","Local"),"basalt");if(process.platform==="darwin")return S(r,"Library","Application Support","basalt");return S(e.XDG_DATA_HOME??S(r,".local","share"),"basalt")}function pi(e,r=q){return de(r).join(e,".basalt","tmp")}
|
|
44
|
+
export{q,Zr,Kn,at,de,lt,pi,di,mi,Qn,xa,t,d,Dt,va,_a,Ea,Yn,en,ys,Aa,Ta,ka,tn,bs,Pa,Xn,Ca,Ra,Ia,vr,Ma,Oa,hi,ws,Ss,La,fi,xs,gi,Jn,Da,Na,we,Ua,vs,yi};
|
package/compiled.js
CHANGED
|
@@ -93,4 +93,4 @@ import{Nn,Un,Vo}from"./chunk-5tdnvdmz.js";import{V}from"./chunk-x055cas0.js";imp
|
|
|
93
93
|
${r?`<div class="details">${r}</div>`:""}
|
|
94
94
|
</main>
|
|
95
95
|
</body>
|
|
96
|
-
</html>`}function Ot(e){return Kr({title:"Authentication successful",heading:"Authentication successful",message:e})}function P(e,t){return Kr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function q(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function F(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((g,h)=>{n=g,r=h});s.catch(()=>{return});let i=!1,d=!1,c,u=()=>l({error:Error("Login cancelled")}),l=(g)=>{if(d)return;if(d=!0,c)clearTimeout(c);if(o?.removeEventListener("abort",u),"error"in g)r(g.error);else n(g.value)},p=Md((g,h)=>{(async()=>{let I=new URL(g.url??"/","http://localhost");if(g.method!=="GET"||I.pathname!==e.path){q(h,404,P("Callback route not found."));return}if(e.state!==void 0&&I.searchParams.get("state")!==e.state){q(h,400,P("State mismatch."));return}if(i||d){q(h,409,P("This sign-in has already been handled."));return}let T=I.searchParams.get("error");if(T){let S=I.searchParams.get("error_description")??T;q(h,400,P(`${t} authorization failed.`,S)),l({error:Error(`${t} authorization failed: ${S}`)});return}let y=I.searchParams.get("code");if(!y){q(h,400,P("Missing authorization code."));return}i=!0;try{let S=await e.complete(y);q(h,200,Ot(`Signed in to ${t}. You may now close this page.`)),l({value:S})}catch(S){let U=S instanceof Error?S:Error(String(S));q(h,502,P(`${t} sign-in failed.`,U.message)),l({error:U})}})()});await new Promise((g,h)=>{p.once("error",h),p.listen(e.port,e.host,()=>{p.off("error",h),g()})});let C=p.address();if(!C||typeof C==="string")throw p.close(),Error("OAuth callback server did not bind to TCP");if(p.on("error",(g)=>l({error:g})),o?.addEventListener("abort",u,{once:!0}),e.timeoutMs!==void 0)c=setTimeout(()=>l({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let m=e.redirectHost??e.host;return{redirectUri:`http://${m.includes(":")?`[${m}]`:m}:${C.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)l({value:void 0})},close:()=>{l({error:Error("OAuth callback server closed")}),p.close()}}}async function ge(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let d=await s;if(r)throw r;return{type:"manual",input:d??""}}finally{n.abort()}}function jr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function N(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=jr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=jr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),Gt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Jr="https://claude.ai/oauth/authorize",Ce="https://platform.claude.com/v1/oauth/token",Bd=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Yr=53692,Qr="/callback",Dd=`http://localhost:${Yr}${Qr}`,zr="https://platform.claude.com/oauth/code/callback",Xr="browser",qr="copy_code",Zr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function es(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function De(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${De(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function ts(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function os(e,t,o,n,r){let s;try{s=await ts(Ce,{grant_type:"authorization_code",client_id:Gt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(d){throw Error(`Token exchange request failed. url=${Ce}; redirect_uri=${n}; response_type=authorization_code; details=${De(d)}`)}let i;try{i=JSON.parse(s)}catch(d){throw Error(`Token exchange returned invalid JSON. url=${Ce}; body=${s}; details=${De(d)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await N(),n=(i)=>F({providerName:"Anthropic",host:Bd,port:i,path:Qr,redirectHost:"localhost",state:t,complete:async(d)=>d,signal:e.signal}),r=await n(Yr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:s,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let d=await ge(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),c,u=t;if(d.type==="callback")c=d.value;else{let l=es(d.input);if(l.state&&l.state!==t)throw Error("OAuth state mismatch");c=l.code,u=l.state??t}if(!c)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(c,u,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await N(),n=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:zr,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=es(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(s.code,s.state??t,t,zr,e.signal)}async function Hd(e,t){let o;try{o=await ts(Ce,{grant_type:"refresh_token",client_id:Gt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${Ce}; details=${De(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${Ce}; body=${o}; details=${De(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var ns={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:Xr,label:"Browser login (default)"},{id:qr,label:"Copy code login (headless)"}]});if(t===qr)return Fd(e);if(t!==Xr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function bt(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function rs(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function b(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await rs(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await rs(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),as=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),uo={"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"},Vd="2026-06-01";function cs(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function lo(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function po(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function $e(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=$e(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((c)=>{let u=$e(c),l=u?.id;if(!u||typeof l!=="string")return[];let p=$e(u.capabilities);if($e(p?.supports)?.tool_calls===!1)return[];return[{id:l,pickerEnabled:u.model_picker_enabled===!0,policyState:$e(u.policy)?.state}]}),r=n.filter((c)=>c.pickerEnabled&&c.policyState!=="disabled").map((c)=>c.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((c)=>c.policyState==="enabled").map((c)=>c.id),d=n.filter((c)=>c.policyState==="unconfigured"&&Object.hasOwn(Mn,c.id)&&(c.pickerEnabled||s)).map((c)=>c.id);return{availableModelIds:i,policyModelIds:d}}async function ds(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let d=0;;d++){let c=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(c.status!==429||d===n.maxRetries)return c;let u=c.headers.get("retry-after"),l=500*2**d;if(u){let p=Number.parseFloat(u);if(l=Number.isNaN(p)?Date.parse(u)-Date.now():p*1000,!Number.isFinite(l))return c}if(l=Math.max(0,l),i!==void 0&&l>=i-Date.now())return c;await c.body?.cancel(),await bt(l,s)}}async function us(e,t,o,n){let r=po(e,t),s=r==="https://api.individual.githubcopilot.com",i=await ds(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...uo,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function _o(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=lo(e),n=await _o(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:as,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:d,expires_in:c}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||d!==void 0&&typeof d!=="number"||typeof c!=="number")throw Error("Invalid device code response fields");let u;try{u=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(u.protocol!=="https:"&&u.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:u.href,interval:d,expires_in:c}}async function Xd(e,t,o){let n=lo(e);return b({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await _o(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:as,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:d}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof d==="number"?d:void 0};let c=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${c}`}}return{status:"failed",message:"Invalid device token response"}}})}async function ls(e,t,o){let r=lo(t||"github.com"),s=await _o(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...uo},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:d}=s;if(typeof i!=="string"||typeof d!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:d*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await ls(e,t,o),{availableModelIds:r}=await us(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${po(e,o)}/models/${t}/policy`,i;try{i=await ds(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...uo,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(d){if(n.aborted)throw d;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=cs(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),d=await ls(i,n??void 0,e.signal),c=await us(d.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),u=[];if(c.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),u=await Yd(d.access,c.policyModelIds,n??void 0,e.signal);return{...d,availableModelIds:[...new Set([...c.availableModelIds,...u])]}}function is(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return cs(t)??void 0}var ps={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,is(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:po(e.access,is(e))}}};var ho="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,_s=3;function fs(){return(E("KIMI_CODE_OAUTH_HOST")||E("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function fo(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function mo(e){return new URLSearchParams(e).toString()}async function go(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function hs(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho}),signal:fo(t)});if(!o.ok){let l=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${l?`: ${l}`:""}`)}let n=await go(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,d=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof d!=="string"||!hs(d)||!hs(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let c=n?.interval,u=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:d,intervalSeconds:typeof c==="number"&&Number.isFinite(c)&&c>0?c:tu,expiresInSeconds:typeof u==="number"&&Number.isFinite(u)&&u>0?u:eu}}function ms(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return b({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:fo(o)});if(n.status>=500){let d=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${d?`: ${d}`:""}`}}let r=await go(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:ms(r,"poll")}}catch(d){return{status:"failed",message:d instanceof Error?d.message:String(d)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let d=r?.interval;return{status:"slow_down",intervalSeconds:typeof d==="number"&&d>0?d:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=_s;r++){if(r>0)await bt(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho,grant_type:"refresh_token",refresh_token:t}),signal:fo(o)})}catch(c){n=c instanceof Error?c:Error(String(c));continue}let i=await go(s);if(s.ok)return ms(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let c=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${c}`)}if(su(s)&&r<_s){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let d=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${d?`: ${d}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=fs(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var gs={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(fs(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var Cs="1031625952748946",Ss="https://auth.meta.com",cu=`${Ss}/oidc/device/authorization/`,du=`${Ss}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function Eo(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function vo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function Nt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function Co(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function So(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:Cs}).toString(),signal:Eo(e)}),o=await vo(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${Nt(o)}`);let n=o?.device_code,r=o?.user_code,s=Co(o?.verification_uri_complete)??Co(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:So(o?.interval),expiresInSeconds:So(o?.expires_in)}}async function hu(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:Cs}).toString(),signal:Eo(t)}),n=await vo(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:So(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${Nt(n)}`}}}})}async function Es(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:Eo(t)}),n=await vo(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${Nt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${Nt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=Co(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Es(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var vs={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Es(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",yo="https://api.openai.com/v1",Ru=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",xo=1455,Rs="/auth/callback",Se=`http://127.0.0.1:${xo}${Rs}`,Ro="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ro}`,xu=180000;function As(){return mu(32).toString("base64url")}function ys(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(Se);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${Se}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return ys(o,t)}function Fe(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((d,c)=>{n=d,r=c}),i=gu((d,c)=>{try{let u=new URL(d.url||"",Se);if(u.pathname!==Rs){Fe(c,404,P("Callback route not found."));return}let l=u.searchParams.get("error");if(l){Fe(c,400,P("ChatGPT was not connected.",`Error: ${l}`)),r(Error(`ChatGPT authorization failed: ${l}`));return}let p;try{p=ys(u,e)}catch(C){let m=C instanceof Error?C.message:"Invalid callback";Fe(c,400,P(m));return}Fe(c,200,Ot("ChatGPT authentication completed. You can close this window.")),n(p)}catch{Fe(c,500,P("Internal error while processing the callback."))}});i.once("error",o),i.listen(xo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function xs(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function Ao(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function Is(e,t,o){let n=Ao(e.access_token,"access_token"),r=Ao(e.refresh_token,"refresh_token"),s=Ao(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let d=s.trim().split(/\s+/).filter(Boolean);if(!d.includes(Ro))throw Error(`OpenAI OAuth grant did not include ${Ro}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:d}}async function wu(e,t,o,n){let r=await xs(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:Se,resource:yo}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return Is(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await xs(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:yo}),t);return Is(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await N(),s=As(),i=As(),d=await Tu(s).catch((p)=>{if(!(p instanceof Error&&("code"in p)&&p.code==="EADDRINUSE"))throw p;throw Error(`Port ${xo} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),c=new URL(vu);c.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:Se,resource:yo,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:c.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let u=new AbortController,l=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:Se,signal:AbortSignal.any([u.signal,e.signal])}).then((p)=>Iu(p,s));try{let p=await Promise.race([d.result,l]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(p.code,n,p.clientId,e.signal)}catch(p){if(e.signal.aborted)throw Error("Login cancelled");throw p}finally{u.abort(),d.server.close(),d.server.closeAllConnections()}}var Ts={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var Io=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{Io=e.randomBytes});var Lt="app_EMoamEEZ73f0CkXaXp7hrann",Ee="https://auth.openai.com",Gu=`${Ee}/oauth/authorize`,Os=`${Ee}/oauth/token`,To="http://localhost:1455/auth/callback",bu=`${Ee}/api/accounts/deviceauth/usercode`,Nu=`${Ee}/api/accounts/deviceauth/token`,Lu=`${Ee}/codex/device`,Mu=`${Ee}/deviceauth/callback`,Ps=900,ws="browser",ks="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!Io)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return Io(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function wo(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Gs(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await wo(Os,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Lt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Gs(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(Os,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Lt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Gs(o,"refresh")}async function Ku(e){let t=await wo(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Lt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:Ps,signal:t,poll:async()=>{let o=await wo(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await N(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Lt),r.searchParams.set("redirect_uri",To),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function bs(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Ns(e,t,o,n){return bs(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:Ps});let o=await ju(t,e.signal);return Ns(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await F({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await ge(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:To}),d;if(i.type==="callback")d=i.value;else{let c=Fu(i.input);if(c.state&&c.state!==n)throw Error("State mismatch");d=c.code}if(!d)throw Error("Missing authorization code");return await Ns(d,o,To,e.signal)}finally{s?.close()}}async function Yu(e,t){return bs(await Vu(e,t))}var Ls={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:ws,label:"Browser login (default)"},{id:ks,label:"Device code login (headless)"}]});if(o===ks)return qu(e);if(o!==ws)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ms(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,d={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let c=await i.json();if(c&&typeof c==="object"&&!Array.isArray(c))d=c}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(c){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw c}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let c=rl(d);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${c?`: ${c}`:""}`)}if(typeof d.key!=="string"||d.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:d.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await N(),n=await F({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ms(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await ge(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ms(i,t,e.signal)}finally{n.close()}}var Us={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var $s="127.0.0.1",Fs=1456,Hs="/oauth/callback",ko=`http://${$s}:${Fs}${Hs}`,il=60000,Bs="browser",Ds="device-code",He="pi-gateway",Ws="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class Oo extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Vs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new Oo(e.status,n,r,t)}async function Po(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Vs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await N(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:He,redirect_uri:ko,scope:Ws,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let d=await F({providerName:"Radius",host:$s,port:Fs,path:Hs,state:s,complete:(c)=>Po(e,new URLSearchParams({grant_type:"authorization_code",client_id:He,redirect_uri:ko,code:c,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${ko}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let c=await d.wait();if(!c)throw Error("OAuth callback did not complete.");return c}finally{d.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:He,scope:Ws}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Vs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),b({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await Po(e,new URLSearchParams({grant_type:al,client_id:He,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof Oo))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function Ks(e){let t=Nr(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Bs,label:"Sign in with browser (recommended)"},{id:Ds,label:"Sign in with device code (when signing in from another device)"}]});if(n===Ds)return ll(t,o);if(n===Bs){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await Po(t,new URLSearchParams({grant_type:"refresh_token",client_id:He,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Go="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",zs="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function Ve(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function Xs(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function js(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function bo(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function No(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?js(e.verification_uri_complete):void 0;return{deviceCode:Ve(e,"device_code"),userCode:Ve(e,"user_code"),verificationUri:js(Ve(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:Xs(e,"expires_in")}}function qs(e,t){let o=Ve(e,"access_token"),n=e.refresh_token===void 0&&t?t:Ve(e,"refresh_token"),r=e.expires_in===void 0?fl:Xs(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await bo(_l,{client_id:Go,scope:pl,referrer:"pi"},e);if(!t.ok)throw No("device authorization",t);return ml(t.body)}async function Cl(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await bo(zs,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Go,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:qs(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:No("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await bo(zs,{grant_type:"refresh_token",client_id:Go,refresh_token:e},t);if(!o.ok)throw No("token refresh",o);return qs(o.body,e)}var Js={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Ys(){sa({anthropic:()=>ns,openaiCodex:()=>Ls,openaiChatGPT:()=>Ts,githubCopilot:()=>ps,openrouter:()=>Us,kimiCoding:()=>gs,meta:()=>vs,xai:()=>Js,radius:Ks})}ra(Vr);Ys();await import("./chunk-6gzvp0f6.js");
|
|
96
|
+
</html>`}function Ot(e){return Kr({title:"Authentication successful",heading:"Authentication successful",message:e})}function P(e,t){return Kr({title:"Authentication failed",heading:"Authentication failed",message:e,details:t})}function q(e,t,o){e.writeHead(t,{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}),e.end(o)}async function F(e){let{providerName:t,signal:o}=e;if(o?.aborted)throw Error("Login cancelled");let n=()=>{},r=()=>{},s=new Promise((g,h)=>{n=g,r=h});s.catch(()=>{return});let i=!1,d=!1,c,u=()=>l({error:Error("Login cancelled")}),l=(g)=>{if(d)return;if(d=!0,c)clearTimeout(c);if(o?.removeEventListener("abort",u),"error"in g)r(g.error);else n(g.value)},p=Md((g,h)=>{(async()=>{let I=new URL(g.url??"/","http://localhost");if(g.method!=="GET"||I.pathname!==e.path){q(h,404,P("Callback route not found."));return}if(e.state!==void 0&&I.searchParams.get("state")!==e.state){q(h,400,P("State mismatch."));return}if(i||d){q(h,409,P("This sign-in has already been handled."));return}let T=I.searchParams.get("error");if(T){let S=I.searchParams.get("error_description")??T;q(h,400,P(`${t} authorization failed.`,S)),l({error:Error(`${t} authorization failed: ${S}`)});return}let y=I.searchParams.get("code");if(!y){q(h,400,P("Missing authorization code."));return}i=!0;try{let S=await e.complete(y);q(h,200,Ot(`Signed in to ${t}. You may now close this page.`)),l({value:S})}catch(S){let U=S instanceof Error?S:Error(String(S));q(h,502,P(`${t} sign-in failed.`,U.message)),l({error:U})}})()});await new Promise((g,h)=>{p.once("error",h),p.listen(e.port,e.host,()=>{p.off("error",h),g()})});let C=p.address();if(!C||typeof C==="string")throw p.close(),Error("OAuth callback server did not bind to TCP");if(p.on("error",(g)=>l({error:g})),o?.addEventListener("abort",u,{once:!0}),e.timeoutMs!==void 0)c=setTimeout(()=>l({error:Error(`${t} sign-in timed out`)}),e.timeoutMs);let m=e.redirectHost??e.host;return{redirectUri:`http://${m.includes(":")?`[${m}]`:m}:${C.port}${e.path}`,wait:()=>s,cancel:()=>{if(!i)l({value:void 0})},close:()=>{l({error:Error("OAuth callback server closed")}),p.close()}}}async function ge(e,t,o){let n=new AbortController,r,s=e.prompt({type:"manual_code",...o,signal:n.signal}).then((i)=>(t?.cancel(),i)).catch((i)=>{r=i instanceof Error?i:Error(String(i)),t?.cancel();return});try{let i=await t?.wait();if(r)throw r;if(i!==void 0)return{type:"callback",value:i};let d=await s;if(r)throw r;return{type:"manual",input:d??""}}finally{n.abort()}}function jr(e){let t="";for(let o of e)t+=String.fromCharCode(o);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}async function N(){let e=new Uint8Array(32);crypto.getRandomValues(e);let t=jr(e),n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),s=jr(new Uint8Array(r));return{verifier:t,challenge:s}}var Ud=(e)=>atob(e),Gt=Ud("OWQxYzI1MGEtZTYxYi00NGQ5LTg4ZWQtNTk0NGQxOTYyZjVl"),Jr="https://claude.ai/oauth/authorize",Ce="https://platform.claude.com/v1/oauth/token",Bd=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",Yr=53692,Qr="/callback",Dd=`http://localhost:${Yr}${Qr}`,zr="https://platform.claude.com/oauth/code/callback",Xr="browser",qr="copy_code",Zr="org:create_api_key user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";function es(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function De(e){if(e instanceof Error){let t=[`${e.name}: ${e.message}`],o=e;if(o.code)t.push(`code=${o.code}`);if(typeof o.errno<"u")t.push(`errno=${String(o.errno)}`);if(typeof e.cause<"u")t.push(`cause=${De(e.cause)}`);if(e.stack)t.push(`stack=${e.stack}`);return t.join("; ")}return String(e)}async function ts(e,t,o){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(t),signal:AbortSignal.any([o,AbortSignal.timeout(30000)])}),r=await n.text();if(!n.ok)throw Error(`HTTP request failed. status=${n.status}; url=${e}; body=${r}`);return r}async function os(e,t,o,n,r){let s;try{s=await ts(Ce,{grant_type:"authorization_code",client_id:Gt,code:e,state:t,redirect_uri:n,code_verifier:o},r)}catch(d){throw Error(`Token exchange request failed. url=${Ce}; redirect_uri=${n}; response_type=authorization_code; details=${De(d)}`)}let i;try{i=JSON.parse(s)}catch(d){throw Error(`Token exchange returned invalid JSON. url=${Ce}; body=${s}; details=${De(d)}`)}return{type:"oauth",refresh:i.refresh_token,access:i.access_token,expires:Date.now()+i.expires_in*1000-300000}}async function $d(e){let{verifier:t,challenge:o}=await N(),n=(i)=>F({providerName:"Anthropic",host:Bd,port:i,path:Qr,redirectHost:"localhost",state:t,complete:async(d)=>d,signal:e.signal}),r=await n(Yr).catch(()=>n(0)).catch(()=>{return}),s=r?.redirectUri??Dd;try{let i=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:s,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${i.toString()}`,instructions:"Complete login in your browser. If the browser is on another machine, paste the final redirect URL here."});let d=await ge(e,r,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:s}),c,u=t;if(d.type==="callback")c=d.value;else{let l=es(d.input);if(l.state&&l.state!==t)throw Error("OAuth state mismatch");c=l.code,u=l.state??t}if(!c)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(c,u,t,s,e.signal)}finally{r?.close()}}async function Fd(e){let{verifier:t,challenge:o}=await N(),n=new URLSearchParams({code:"true",client_id:Gt,response_type:"code",redirect_uri:zr,scope:Zr,code_challenge:o,code_challenge_method:"S256",state:t});e.notify({type:"auth_url",url:`${Jr}?${n.toString()}`,instructions:"Complete login in your browser, then copy the code Anthropic shows and paste it here."});let r=await e.prompt({type:"manual_code",message:"Paste the code Anthropic shows after you sign in:",placeholder:"code#state",signal:e.signal}),s=es(r);if(s.state&&s.state!==t)throw Error("OAuth state mismatch");if(!s.code)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await os(s.code,s.state??t,t,zr,e.signal)}async function Hd(e,t){let o;try{o=await ts(Ce,{grant_type:"refresh_token",client_id:Gt,refresh_token:e},t)}catch(r){throw Error(`Anthropic token refresh request failed. url=${Ce}; details=${De(r)}`)}let n;try{n=JSON.parse(o)}catch(r){throw Error(`Anthropic token refresh returned invalid JSON. url=${Ce}; body=${o}; details=${De(r)}`)}return{type:"oauth",refresh:n.refresh_token,access:n.access_token,expires:Date.now()+n.expires_in*1000-300000}}var ns={name:"Anthropic (Claude Pro/Max)",isSubscription:!0,async login(e){let t=await e.prompt({type:"select",message:"Select Anthropic login method:",options:[{id:Xr,label:"Browser login (default)"},{id:qr,label:"Copy code login (headless)"}]});if(t===qr)return Fd(e);if(t!==Xr)throw Error(`Unknown Anthropic login method: ${t}`);return $d(e)},refresh:(e,t)=>Hd(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function bt(e,t){return new Promise((o,n)=>{t.throwIfAborted();let r=()=>{clearTimeout(s),n(t.reason)},s=setTimeout(()=>{t.removeEventListener("abort",r),o()},e);t.addEventListener("abort",r,{once:!0})})}function rs(e,t,o){return new Promise((n,r)=>{if(t.aborted){r(Error(o));return}let s=()=>{clearTimeout(i),r(Error(o))},i=setTimeout(()=>{t.removeEventListener("abort",s),n()},e);t.addEventListener("abort",s,{once:!0})})}async function b(e){let t=typeof e.expiresInSeconds==="number"?Date.now()+e.expiresInSeconds*1000:Number.POSITIVE_INFINITY,o=Math.max(1000,Math.floor((e.intervalSeconds??5)*1000)),n=0;if(e.waitBeforeFirstPoll){let r=t-Date.now();if(r>0)await rs(Math.min(o,r),e.signal,"Login cancelled")}while(Date.now()<t){if(e.signal.aborted)throw Error("Login cancelled");let r=await e.poll();if(r.status==="complete")return r.value;if(r.status==="failed")throw Error(r.message);if(r.status==="slow_down")n+=1,o=typeof r.intervalSeconds==="number"&&Number.isFinite(r.intervalSeconds)&&r.intervalSeconds>0?Math.max(1000,Math.floor(r.intervalSeconds*1000)):Math.max(1000,o+5000);let s=t-Date.now();if(s<=0)break;await rs(Math.min(o,s),e.signal,"Login cancelled")}throw Error(n>0?"Device flow timed out after one or more slow_down responses. This is often caused by clock drift in WSL or VM environments. Please sync or restart the VM clock and try again.":"Device flow timed out")}var Wd=(e)=>atob(e),as=Wd("SXYxLmI1MDdhMDhjODdlY2ZlOTg="),uo={"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"},Vd="2026-06-01";function cs(e){let t=e.trim();if(!t)return null;try{return(t.includes("://")?new URL(t):new URL(`https://${t}`)).hostname}catch{return null}}function lo(e){return{deviceCodeUrl:`https://${e}/login/device/code`,accessTokenUrl:`https://${e}/login/oauth/access_token`,copilotTokenUrl:`https://api.${e}/copilot_internal/v2/token`}}function Kd(e){let t=e.match(/proxy-ep=([^;]+)/);if(!t)return null;return`https://${t[1].replace(/^proxy\./,"api.")}`}function po(e,t){if(e){let o=Kd(e);if(o)return o}if(t)return`https://copilot-api.${t}`;return"https://api.individual.githubcopilot.com"}function $e(e){return e&&typeof e==="object"?e:void 0}function jd(e,t){let o=$e(e)?.data;if(!Array.isArray(o))throw Error("Invalid Copilot models response");let n=o.flatMap((c)=>{let u=$e(c),l=u?.id;if(!u||typeof l!=="string")return[];let p=$e(u.capabilities);if($e(p?.supports)?.tool_calls===!1)return[];return[{id:l,pickerEnabled:u.model_picker_enabled===!0,policyState:$e(u.policy)?.state}]}),r=n.filter((c)=>c.pickerEnabled&&c.policyState!=="disabled").map((c)=>c.id),s=t&&r.length===0,i=r.length>0||!t?r:n.filter((c)=>c.policyState==="enabled").map((c)=>c.id),d=n.filter((c)=>c.policyState==="unconfigured"&&Object.hasOwn(Mn,c.id)&&(c.pickerEnabled||s)).map((c)=>c.id);return{availableModelIds:i,policyModelIds:d}}async function ds(e,t,o,n){let r=n.maxRetries>0&&n.maxElapsedMs>0?AbortSignal.timeout(n.maxElapsedMs):void 0,s=r?AbortSignal.any([o,r]):o,i=r?Date.now()+n.maxElapsedMs:void 0;for(let d=0;;d++){let c=await fetch(e,{...t,signal:AbortSignal.any([s,AbortSignal.timeout(5000)])});if(c.status!==429||d===n.maxRetries)return c;let u=c.headers.get("retry-after"),l=500*2**d;if(u){let p=Number.parseFloat(u);if(l=Number.isNaN(p)?Date.parse(u)-Date.now():p*1000,!Number.isFinite(l))return c}if(l=Math.max(0,l),i!==void 0&&l>=i-Date.now())return c;await c.body?.cancel(),await bt(l,s)}}async function us(e,t,o,n){let r=po(e,t),s=r==="https://api.individual.githubcopilot.com",i=await ds(`${r}/models`,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...uo,"X-GitHub-Api-Version":Vd}},o,n);if(!i.ok)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return jd(await i.json(),s)}async function _o(e,t){let o=await fetch(e,t);if(!o.ok){let n=await o.text();throw Error(`${o.status} ${o.statusText}: ${n}`)}return o.json()}async function zd(e,t){let o=lo(e),n=await _o(o.deviceCodeUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:as,scope:"read:user"}),signal:t});if(!n||typeof n!=="object")throw Error("Invalid device code response");let{device_code:r,user_code:s,verification_uri:i,interval:d,expires_in:c}=n;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||d!==void 0&&typeof d!=="number"||typeof c!=="number")throw Error("Invalid device code response fields");let u;try{u=new URL(i)}catch{throw Error("Untrusted verification_uri in device code response")}if(u.protocol!=="https:"&&u.protocol!=="http:")throw Error("Untrusted verification_uri in device code response");return{device_code:r,user_code:s,verification_uri:u.href,interval:d,expires_in:c}}async function Xd(e,t,o){let n=lo(e);return b({intervalSeconds:t.interval,expiresInSeconds:t.expires_in,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let r=await _o(n.accessTokenUrl,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded","User-Agent":"GitHubCopilotChat/0.35.0"},body:new URLSearchParams({client_id:as,device_code:t.device_code,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:o});if(r&&typeof r==="object"&&typeof r.access_token==="string")return{status:"complete",value:r.access_token};if(r&&typeof r==="object"&&typeof r.error==="string"){let{error:s,error_description:i,interval:d}=r;if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down")return{status:"slow_down",intervalSeconds:typeof d==="number"?d:void 0};let c=i?`: ${i}`:"";return{status:"failed",message:`Device flow failed: ${s}${c}`}}return{status:"failed",message:"Invalid device token response"}}})}async function ls(e,t,o){let r=lo(t||"github.com"),s=await _o(r.copilotTokenUrl,{headers:{Accept:"application/json",Authorization:`Bearer ${e}`,...uo},signal:o});if(!s||typeof s!=="object")throw Error("Invalid Copilot token response");let{token:i,expires_at:d}=s;if(typeof i!=="string"||typeof d!=="number")throw Error("Invalid Copilot token response fields");return{type:"oauth",refresh:e,access:i,expires:d*1000-300000,enterpriseUrl:t}}async function qd(e,t,o){let n=await ls(e,t,o),{availableModelIds:r}=await us(n.access,t,o,{maxRetries:0,maxElapsedMs:0});return{...n,availableModelIds:r}}async function Jd(e,t,o,n){let s=`${po(e,o)}/models/${t}/policy`,i;try{i=await ds(s,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`,...uo,"openai-intent":"chat-policy","x-interaction-type":"chat-policy"},body:JSON.stringify({state:"enabled"})},n,{maxRetries:2,maxElapsedMs:5000})}catch(d){if(n.aborted)throw d;return!1}if(i.status===429)throw Error(`${i.status} ${i.statusText}: ${await i.text()}`);return i.ok}async function Yd(e,t,o,n){let r=[];for(let s of t)try{if(await Jd(e,s,o,n))r.push(s)}catch(i){if(n.aborted)throw i;break}return r}async function Qd(e){let t=await e.prompt({type:"text",message:"GitHub Enterprise URL/domain (blank for github.com)",placeholder:"company.ghe.com"});if(e.signal.aborted)throw Error("Login cancelled");let o=t.trim(),n=cs(t);if(o&&!n)throw Error("Invalid GitHub Enterprise URL/domain");let r=n||"github.com",s=await zd(r,e.signal);e.notify({type:"device_code",userCode:s.user_code,verificationUri:s.verification_uri,intervalSeconds:s.interval,expiresInSeconds:s.expires_in});let i=await Xd(r,s,e.signal),d=await ls(i,n??void 0,e.signal),c=await us(d.access,n??void 0,e.signal,{maxRetries:2,maxElapsedMs:5000}),u=[];if(c.policyModelIds.length>0)e.notify({type:"progress",message:"Enabling models..."}),u=await Yd(d.access,c.policyModelIds,n??void 0,e.signal);return{...d,availableModelIds:[...new Set([...c.availableModelIds,...u])]}}function is(e){let t=e.enterpriseUrl;if(typeof t!=="string"||!t)return;return cs(t)??void 0}var ps={name:"GitHub Copilot",isSubscription:!0,login:Qd,refresh:(e,t)=>qd(e.refresh,is(e),t),async toAuth(e){return{apiKey:e.access,baseUrl:po(e.access,is(e))}}};var ho="17e5f671-d194-4dfb-9706-5516cb48c098",Zd="https://auth.kimi.com",eu=900,tu=5,ou=30000,_s=3;function fs(){return(E("KIMI_CODE_OAUTH_HOST")||E("KIMI_OAUTH_HOST")||Zd).replace(/\/+$/,"")}function fo(e){return AbortSignal.any([AbortSignal.timeout(ou),e])}function mo(e){return new URLSearchParams(e).toString()}async function go(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function hs(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}async function nu(e,t){let o=await fetch(`${e}/api/oauth/device_authorization`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho}),signal:fo(t)});if(!o.ok){let l=await o.text().catch(()=>"");throw Error(`Kimi Code device authorization failed with status ${o.status}${l?`: ${l}`:""}`)}let n=await go(o),r=n?.device_code,s=n?.user_code,i=n?.verification_uri,d=n?.verification_uri_complete;if(typeof r!=="string"||typeof s!=="string"||typeof i!=="string"||typeof d!=="string"||!hs(d)||!hs(i))throw Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(n)}`);let c=n?.interval,u=n?.expires_in;return{deviceCode:r,userCode:s,verificationUri:i,verificationUriComplete:d,intervalSeconds:typeof c==="number"&&Number.isFinite(c)&&c>0?c:tu,expiresInSeconds:typeof u==="number"&&Number.isFinite(u)&&u>0?u:eu}}function ms(e,t){let o=e?.access_token,n=e?.refresh_token,r=e?.expires_in;if(typeof o!=="string"||!o||typeof n!=="string"||!n||typeof r!=="number"||!Number.isFinite(r)||r<=0)throw Error(`Kimi Code token ${t} response missing fields: ${JSON.stringify(e)}`);return{access:o,refresh:n,expires:Date.now()+r*1000}}async function ru(e,t,o){return b({intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds,waitBeforeFirstPoll:!0,signal:o,poll:async()=>{let n=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho,device_code:t.deviceCode,grant_type:"urn:ietf:params:oauth:grant-type:device_code"}),signal:fo(o)});if(n.status>=500){let d=await n.text().catch(()=>"");return{status:"failed",message:`Kimi Code device token request failed with status ${n.status}${d?`: ${d}`:""}`}}let r=await go(n);if(n.ok&&typeof r?.access_token==="string")try{return{status:"complete",value:ms(r,"poll")}}catch(d){return{status:"failed",message:d instanceof Error?d.message:String(d)}}let s=r?.error,i=typeof r?.error_description==="string"?`: ${r.error_description}`:"";if(s==="authorization_pending")return{status:"pending"};if(s==="slow_down"){let d=r?.interval;return{status:"slow_down",intervalSeconds:typeof d==="number"&&d>0?d:void 0}}if(s==="expired_token")return{status:"failed",message:"Kimi Code device authorization expired. Please restart login."};if(s==="access_denied")return{status:"failed",message:"Kimi Code login was denied."};return{status:"failed",message:`Kimi Code device token request failed (status ${n.status})${typeof s==="string"?`: ${s}${i}`:""}`}}})}function su(e){return e.status===429||e.status>=500}async function iu(e,t,o){let n;for(let r=0;r<=_s;r++){if(r>0)await bt(1000*2**(r-1),o);if(o.aborted)throw Error("Kimi Code token refresh aborted");let s;try{s=await fetch(`${e}/api/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:mo({client_id:ho,grant_type:"refresh_token",refresh_token:t}),signal:fo(o)})}catch(c){n=c instanceof Error?c:Error(String(c));continue}let i=await go(s);if(s.ok)return ms(i,"refresh");if(s.status===401||s.status===403||i?.error==="invalid_grant"){let c=typeof i?.error_description==="string"?`: ${i.error_description}`:"";throw Error(`Kimi Code token refresh unauthorized (status ${s.status})${c}`)}if(su(s)&&r<_s){n=Error(`Kimi Code token refresh failed with status ${s.status}`);continue}let d=JSON.stringify(i);throw Error(`Kimi Code token refresh failed with status ${s.status}${d?`: ${d}`:""}`)}throw n??Error("Kimi Code token refresh failed")}async function au(e){let t=fs(),o=await nu(t,e.signal);e.notify({type:"device_code",userCode:o.userCode,verificationUri:o.verificationUriComplete,intervalSeconds:o.intervalSeconds,expiresInSeconds:o.expiresInSeconds});let n=await ru(t,o,e.signal);return{type:"oauth",access:n.access,refresh:n.refresh,expires:n.expires}}var gs={name:"Kimi Code (subscription)",isSubscription:!0,loginLabel:"Sign in with Kimi Code",login:au,refresh:async(e,t)=>{let o=await iu(fs(),e.refresh,t);return{type:"oauth",access:o.access,refresh:o.refresh,expires:o.expires}},async toAuth(e){return{headers:{Authorization:`Bearer ${e.access}`}}}};var Cs="1031625952748946",Ss="https://auth.meta.com",cu=`${Ss}/oidc/device/authorization/`,du=`${Ss}/oidc/device/token/`,uu="https://api.meta.ai/muse-code/key",lu=86400000,pu=30000;function Eo(e){return AbortSignal.any([AbortSignal.timeout(pu),e])}async function vo(e){try{let t=await e.json();return t&&typeof t==="object"?t:null}catch{return null}}function Nt(e){for(let t of["error_description","detail","message","error"]){let o=e?.[t];if(typeof o==="string"&&o.trim())return`: ${o.trim()}`}return""}function Co(e){if(typeof e!=="string"||!e)return null;try{let t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;return t.href}catch{return null}}function So(e){return typeof e==="number"&&Number.isFinite(e)&&e>0?e:void 0}async function _u(e){let t=await fetch(cu,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({client_id:Cs}).toString(),signal:Eo(e)}),o=await vo(t);if(!t.ok)throw Error(`Meta device authorization failed with status ${t.status}${Nt(o)}`);let n=o?.device_code,r=o?.user_code,s=Co(o?.verification_uri_complete)??Co(o?.verification_uri);if(typeof n!=="string"||!n||typeof r!=="string"||!r||!s)throw Error(`Invalid Meta device authorization response: ${JSON.stringify(o)}`);return{deviceCode:n,userCode:r,verificationUri:s,intervalSeconds:So(o?.interval),expiresInSeconds:So(o?.expires_in)}}async function hu(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await fetch(du,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:e.deviceCode,client_id:Cs}).toString(),signal:Eo(t)}),n=await vo(o);if(o.ok&&typeof n?.access_token==="string"&&n.access_token)return{status:"complete",value:n.access_token};switch(n?.error){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down",intervalSeconds:So(n?.interval)};case"access_denied":return{status:"failed",message:"Meta login was denied."};case"expired_token":return{status:"failed",message:"Meta device authorization expired. Please restart login."};default:return{status:"failed",message:`Meta device token request failed with status ${o.status}${Nt(n)}`}}}})}async function Es(e,t){let o=await fetch(uu,{method:"POST",headers:{Accept:"application/json",Authorization:`Bearer ${e}`,"Content-Type":"application/json","x-api-version":"1.0.0"},body:"{}",signal:Eo(t)}),n=await vo(o);if(o.status===401||o.status===403)throw Error(`Meta session expired (status ${o.status}). Run \`/login meta\` to sign in again.${Nt(n)}`);if(!o.ok)throw Error(`Meta API key mint failed with status ${o.status}${Nt(n)}`);let r=n?.api_key;if(typeof r!=="string"||!r){let s=Co(n?.action_url);throw Error(`Meta did not issue an API key.${s?` Complete setup at ${s}`:""}`)}return{type:"oauth",refresh:e,access:r,expires:Date.now()+lu}}async function fu(e){try{let t=await _u(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds});let o=await hu(t,e.signal);return e.notify({type:"progress",message:"Enabling Meta Model API access..."}),await Es(o,e.signal)}catch(t){if(e.signal.aborted)throw Error("Login cancelled");throw t}}var vs={name:"Meta (Muse subscription)",isSubscription:!0,loginLabel:"Sign in with Meta",login:fu,refresh:(e,t)=>Es(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};import{randomBytes as mu}from"crypto";import{createServer as gu}from"http";var Cu="dynamic_agent_client",Su="Pi",Eu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,vu="https://auth.openai.com/api/accounts/authorize",Au="https://auth.openai.com/api/accounts/oauth/token",yo="https://api.openai.com/v1",Ru=E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1",xo=1455,Rs="/auth/callback",Se=`http://127.0.0.1:${xo}${Rs}`,Ro="chatgpt.tokens.use.direct",yu=`openid profile email offline_access resource.invoke ${Ro}`,xu=180000;function As(){return mu(32).toString("base64url")}function ys(e,t){let o=e.searchParams.get("code");if(!o)throw Error("Missing authorization code");let n=e.searchParams.get("state");if(!n)throw Error("Missing OAuth state");if(n!==t)throw Error("OAuth state mismatch");let r=e.searchParams.get("client_id")?.trim();if(!r)throw Error("OpenAI OAuth registration callback did not contain an issued client ID");return{code:o,clientId:r}}function Iu(e,t){let o;try{o=new URL(e.trim())}catch{throw Error("Paste the full callback URL from the browser")}let n=new URL(Se);if(o.origin!==n.origin||o.pathname!==n.pathname)throw Error(`The pasted callback URL must start with ${Se}`);let r=o.searchParams.get("error");if(r)throw Error(`ChatGPT authorization failed: ${r}`);return ys(o,t)}function Fe(e,t,o){e.writeHead(t,{"Content-Type":"text/html; charset=utf-8"}),e.end(o)}function Tu(e){return new Promise((t,o)=>{let n,r,s=new Promise((d,c)=>{n=d,r=c}),i=gu((d,c)=>{try{let u=new URL(d.url||"",Se);if(u.pathname!==Rs){Fe(c,404,P("Callback route not found."));return}let l=u.searchParams.get("error");if(l){Fe(c,400,P("ChatGPT was not connected.",`Error: ${l}`)),r(Error(`ChatGPT authorization failed: ${l}`));return}let p;try{p=ys(u,e)}catch(C){let m=C instanceof Error?C.message:"Invalid callback";Fe(c,400,P(m));return}Fe(c,200,Ot("ChatGPT authentication completed. You can close this window.")),n(p)}catch{Fe(c,500,P("Internal error while processing the callback."))}});i.once("error",o),i.listen(xo,Ru,()=>{i.removeListener("error",o),i.on("error",r),t({server:i,result:s})})})}async function xs(e,t){let o=await fetch(Au,{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:e,signal:t});if(!o.ok){let r=await o.text().catch(()=>"");throw Error(`OpenAI OAuth token request failed (${o.status}): ${r||o.statusText}`)}let n=await o.json();if(typeof n!=="object"||n===null||Array.isArray(n))throw Error("OpenAI OAuth token response must be an object");return n}function Ao(e,t){if(typeof e!=="string"||e.trim().length===0)throw Error(`OpenAI OAuth token response has invalid ${t}`);return e}function Is(e,t,o){let n=Ao(e.access_token,"access_token"),r=Ao(e.refresh_token,"refresh_token"),s=Ao(e.scope,"scope"),i=typeof e.id_token==="string"?e.id_token:o?.idToken;if(typeof e.expires_in!=="number"||!Number.isFinite(e.expires_in)||e.expires_in<=0)throw Error("OpenAI OAuth token response has invalid expires_in");let d=s.trim().split(/\s+/).filter(Boolean);if(!d.includes(Ro))throw Error(`OpenAI OAuth grant did not include ${Ro}`);return{type:"oauth",...i?{idToken:i}:{},access:n,refresh:r,expires:Date.now()+e.expires_in*1000-xu,clientId:t,scopes:d}}async function wu(e,t,o,n){let r=await xs(new URLSearchParams({grant_type:"authorization_code",client_id:o,code:e,code_verifier:t,redirect_uri:Se,resource:yo}),n);if(typeof r.id_token!=="string"||r.id_token.trim().length===0)throw Error("OpenAI OAuth token response did not contain an ID token");return Is(r,o)}async function ku(e,t){let o=e.clientId;if(typeof o!=="string"||o.trim().length===0)throw Error("Stored OpenAI OAuth credential does not contain an issued client ID; reconnect ChatGPT");let n=await xs(new URLSearchParams({grant_type:"refresh_token",client_id:o,refresh_token:e.refresh,resource:yo}),t);return Is(n,o,e)}function Ou(e){if(!e||!Eu.test(e))throw Error("Sign in with ChatGPT requires a device ID (UUID) for this installation");return`urn:uuid:${e.toLowerCase()}`}async function Pu(e,t){let o=Ou(t?.getDeviceId?.()),{verifier:n,challenge:r}=await N(),s=As(),i=As(),d=await Tu(s).catch((p)=>{if(!(p instanceof Error&&("code"in p)&&p.code==="EADDRINUSE"))throw p;throw Error(`Port ${xo} is in use, probably by an unfinished login in another pi session or by the Codex CLI. Cancel that login and try again.`)}),c=new URL(vu);c.search=new URLSearchParams({client_id:Cu,agent_name_hint:t?.agentName??Su,ext_agent_host_id:o,response_type:"code",redirect_uri:Se,resource:yo,scope:yu,state:s,code_challenge:r,code_challenge_method:"S256",nonce:i}).toString(),e.notify({type:"auth_url",url:c.toString(),instructions:"Complete sign-in in your browser. If the callback does not complete, paste the final redirect URL here."});let u=new AbortController,l=e.prompt({type:"manual_code",message:"Complete login in your browser, or paste the final redirect URL here:",placeholder:Se,signal:AbortSignal.any([u.signal,e.signal])}).then((p)=>Iu(p,s));try{let p=await Promise.race([d.result,l]);return e.notify({type:"progress",message:"Exchanging authorization code for tokens..."}),await wu(p.code,n,p.clientId,e.signal)}catch(p){if(e.signal.aborted)throw Error("Login cancelled");throw p}finally{u.abort(),d.server.close(),d.server.closeAllConnections()}}var Ts={name:"OpenAI (ChatGPT subscription)",isSubscription:!0,loginLabel:"Sign in with ChatGPT",login:Pu,refresh:ku,async toAuth(e){return{apiKey:e.access}}};var Io=null;if(typeof process<"u"&&(process.versions?.node||process.versions?.bun))import("crypto").then((e)=>{Io=e.randomBytes});var Lt="app_EMoamEEZ73f0CkXaXp7hrann",Ee="https://auth.openai.com",Gu=`${Ee}/oauth/authorize`,Os=`${Ee}/oauth/token`,To="http://localhost:1455/auth/callback",bu=`${Ee}/api/accounts/deviceauth/usercode`,Nu=`${Ee}/api/accounts/deviceauth/token`,Lu=`${Ee}/codex/device`,Mu=`${Ee}/deviceauth/callback`,Ps=900,ws="browser",ks="device_code",Uu="openid profile email offline_access",Bu="https://api.openai.com/auth";function Du(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function $u(){if(!Io)throw Error("OpenAI Codex OAuth is only available in Node.js environments");return Io(16).toString("hex")}function Fu(e){let t=e.trim();if(!t)return{};try{let o=new URL(t);return{code:o.searchParams.get("code")??void 0,state:o.searchParams.get("state")??void 0}}catch{}if(t.includes("#")){let[o,n]=t.split("#",2);return{code:o,state:n}}if(t.includes("code=")){let o=new URLSearchParams(t);return{code:o.get("code")??void 0,state:o.get("state")??void 0}}return{code:t}}function Hu(e){try{let t=e.split(".");if(t.length!==3)return null;let o=t[1]??"",n=atob(o);return JSON.parse(n)}catch{return null}}async function wo(e,t){try{return await fetch(e,t)}catch(o){if(t.signal?.aborted)throw Error("Login cancelled");throw o}}async function Gs(e,t){if(!e.ok){let r=await e.text().catch(()=>"");throw Error(`OpenAI Codex token ${t} failed (${e.status}): ${r||e.statusText}`)}let n=await e.json();if(!n?.access_token||!n.refresh_token||typeof n.expires_in!=="number")throw Error(`OpenAI Codex token ${t} response missing fields: ${JSON.stringify(n)}`);return{access:n.access_token,refresh:n.refresh_token,expires:Date.now()+n.expires_in*1000}}async function Wu(e,t,o,n){let r=await wo(Os,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",client_id:Lt,code:e,code_verifier:t,redirect_uri:o}),signal:n});return Gs(r,"exchange")}async function Vu(e,t){let o;try{o=await fetch(Os,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"refresh_token",refresh_token:e,client_id:Lt}),signal:t})}catch(n){throw Error(`OpenAI Codex token refresh error: ${n instanceof Error?n.message:String(n)}`)}return Gs(o,"refresh")}async function Ku(e){let t=await wo(bu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Lt}),signal:e});if(!t.ok){if(t.status===404)throw Error("OpenAI Codex device code login is not enabled for this server. Use browser login or verify the server URL.");let s=await t.text().catch(()=>"");throw Error(`OpenAI Codex device code request failed with status ${t.status}${s?`: ${s}`:""}`)}let n=await t.json(),r=typeof n?.interval==="string"?Number(n.interval.trim()):n?.interval;if(!n?.device_auth_id||!n.user_code||typeof r!=="number"||!Number.isFinite(r)||r<0)throw Error(`Invalid OpenAI Codex device code response: ${JSON.stringify(n)}`);return{deviceAuthId:n.device_auth_id,userCode:n.user_code,intervalSeconds:r}}async function ju(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:Ps,signal:t,poll:async()=>{let o=await wo(Nu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_auth_id:e.deviceAuthId,user_code:e.userCode}),signal:t});if(o.ok){let i=await o.json();if(!i?.authorization_code||!i.code_verifier)return{status:"failed",message:`Invalid OpenAI Codex device auth token response: ${JSON.stringify(i)}`};return{status:"complete",value:{authorizationCode:i.authorization_code,codeVerifier:i.code_verifier}}}if(o.status===403||o.status===404)return{status:"pending"};let n=await o.text().catch(()=>""),r;try{let i=JSON.parse(n)?.error;r=typeof i==="object"?i?.code:i}catch{}if(r==="deviceauth_authorization_pending")return{status:"pending"};if(r==="slow_down")return{status:"slow_down"};return{status:"failed",message:`OpenAI Codex device auth failed with status ${o.status}${n?`: ${n}`:""}`}}})}async function zu(e="pi"){let{verifier:t,challenge:o}=await N(),n=$u(),r=new URL(Gu);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",Lt),r.searchParams.set("redirect_uri",To),r.searchParams.set("scope",Uu),r.searchParams.set("code_challenge",o),r.searchParams.set("code_challenge_method","S256"),r.searchParams.set("state",n),r.searchParams.set("id_token_add_organizations","true"),r.searchParams.set("codex_cli_simplified_flow","true"),r.searchParams.set("originator",e),{verifier:t,state:n,url:r.toString()}}function Xu(e){let n=Hu(e)?.[Bu]?.chatgpt_account_id;return typeof n==="string"&&n.length>0?n:null}function bs(e){let t=Xu(e.access);if(!t)throw Error("Failed to extract accountId from token");return{type:"oauth",access:e.access,refresh:e.refresh,expires:e.expires,accountId:t}}async function Ns(e,t,o,n){return bs(await Wu(e,t,o,n))}async function qu(e){let t=await Ku(e.signal);e.notify({type:"device_code",userCode:t.userCode,verificationUri:Lu,intervalSeconds:t.intervalSeconds,expiresInSeconds:Ps});let o=await ju(t,e.signal);return Ns(o.authorizationCode,o.codeVerifier,Mu,e.signal)}async function Ju(e,t){let{verifier:o,state:n,url:r}=await zu(t?.agentName),s=await F({providerName:"OpenAI",host:Du(),port:1455,path:"/auth/callback",state:n,complete:async(i)=>i,signal:e.signal}).catch(()=>{return});e.notify({type:"auth_url",url:r,instructions:"A browser window should open. Complete login to finish."});try{let i=await ge(e,s,{message:"Complete login in your browser, or paste the authorization code / redirect URL here:",placeholder:To}),d;if(i.type==="callback")d=i.value;else{let c=Fu(i.input);if(c.state&&c.state!==n)throw Error("State mismatch");d=c.code}if(!d)throw Error("Missing authorization code");return await Ns(d,o,To,e.signal)}finally{s?.close()}}async function Yu(e,t){return bs(await Vu(e,t))}var Ls={name:"OpenAI (ChatGPT Plus/Pro)",isSubscription:!0,async login(e,t){let o=await e.prompt({type:"select",message:"Select OpenAI Codex login method:",options:[{id:ws,label:"Browser login (default)"},{id:ks,label:"Device code login (headless)"}]});if(o===ks)return qu(e);if(o!==ws)throw Error(`Unknown OpenAI Codex login method: ${o}`);return Ju(e,t)},refresh:(e,t)=>Yu(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};var Qu="https://openrouter.ai/auth",Zu="https://openrouter.ai/api/v1/auth/keys",el=300000,tl=30000;function ol(){return E("PI_OAUTH_CALLBACK_HOST")||"127.0.0.1"}function nl(e){let t=e.trim();if(!t)return;try{return new URL(t).searchParams.get("code")??void 0}catch{}if(t.includes("code="))return new URLSearchParams(t).get("code")??void 0;return t}function rl(e){if(typeof e.error_description==="string")return e.error_description;if(typeof e.message==="string")return e.message;if(typeof e.error==="string")return e.error;if(e.error&&typeof e.error==="object"&&!Array.isArray(e.error)){let t=e.error.message;if(typeof t==="string")return t}return}async function Ms(e,t,o){if(o.aborted)throw Error("Login cancelled");let n=new AbortController,r=()=>n.abort(o.reason);o.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>n.abort(Error("OpenRouter OAuth token exchange timed out")),tl),i,d={};try{i=await fetch(Zu,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify({code:e,code_verifier:t,code_challenge_method:"S256"}),signal:n.signal});try{let c=await i.json();if(c&&typeof c==="object"&&!Array.isArray(c))d=c}catch{if(i.ok)throw Error("OpenRouter OAuth returned invalid JSON")}}catch(c){if(o.aborted)throw Error("Login cancelled");if(n.signal.aborted)throw Error("OpenRouter OAuth token exchange timed out");throw c}finally{clearTimeout(s),o.removeEventListener("abort",r)}if(!i.ok){let c=rl(d);throw Error(`OpenRouter OAuth key exchange failed (HTTP ${i.status})${c?`: ${c}`:""}`)}if(typeof d.key!=="string"||d.key.length===0)throw Error('OpenRouter OAuth response carries no "key"');return{type:"oauth",access:d.key,refresh:"",expires:Number.MAX_SAFE_INTEGER}}async function sl(e){let{verifier:t,challenge:o}=await N(),n=await F({providerName:"OpenRouter",host:ol(),port:0,path:`/oauth/callback/${crypto.randomUUID()}`,complete:(r)=>Ms(r,t,e.signal),signal:e.signal,timeoutMs:el});try{let r=new URL(Qu);r.search=new URLSearchParams({callback_url:n.redirectUri,code_challenge:o,code_challenge_method:"S256"}).toString(),e.notify({type:"progress",message:`Listening for OpenRouter OAuth callback on ${n.redirectUri}`}),e.notify({type:"auth_url",url:r.toString(),instructions:"Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."});let s=await ge(e,n,{message:"Complete sign-in in your browser, or paste the authorization code / redirect URL here:",placeholder:n.redirectUri});if(s.type==="callback")return s.value;let i=nl(s.input);if(!i)throw Error("Missing authorization code");return e.notify({type:"progress",message:"Exchanging authorization code for an API key..."}),await Ms(i,t,e.signal)}finally{n.close()}}var Us={name:"OpenRouter OAuth",loginLabel:"Sign in with OpenRouter",login:sl,async refresh(e,t){return e},async toAuth(e){return{apiKey:e.access}}};var $s="127.0.0.1",Fs=1456,Hs="/oauth/callback",ko=`http://${$s}:${Fs}${Hs}`,il=60000,Bs="browser",Ds="device-code",He="pi-gateway",Ws="gateway offline_access",al="urn:ietf:params:oauth:grant-type:device_code";async function cl(e,t){let o=await fetch(new URL("/v1/oauth",e),{headers:{accept:"application/json"},signal:t});if(!o.ok)throw Error(`Could not load Radius OAuth config from ${e}: ${o.status} ${await o.text()}`);let n=await o.json();if(typeof n.authorizationEndpoint!=="string")throw Error(`Invalid Radius OAuth config from ${e}`);return{authorizationEndpoint:n.authorizationEndpoint}}class Oo extends Error{status;oauthError;constructor(e,t,o,n){let r=t?o?`${t}: ${o}`:t:o||String(e);super(`${n}: ${r}`);this.status=e,this.oauthError=t}}async function Vs(e,t){let o=await e.text().catch(()=>""),n,r;if(o)try{let s=JSON.parse(o);n=typeof s.error==="string"?s.error:void 0,r=typeof s.error_description==="string"?s.error_description:void 0}catch{r=o}return new Oo(e.status,n,r,t)}async function Po(e,t,o){let n;try{n=await fetch(new URL("/v1/oauth/token",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:t,signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}if(!n.ok)throw await Vs(n,"Radius OAuth token request failed");let r=await n.json();return{type:"oauth",access:r.access_token,refresh:r.refresh_token,expires:Date.now()+r.expires_in*1000-il,scope:r.scope}}async function dl(e,t,o){let{verifier:n,challenge:r}=await N(),s=crypto.randomUUID(),i=new URL(t);i.search=new URLSearchParams({response_type:"code",client_id:He,redirect_uri:ko,scope:Ws,code_challenge:r,code_challenge_method:"S256",handoff:"url",state:s}).toString();let d=await F({providerName:"Radius",host:$s,port:Fs,path:Hs,state:s,complete:(c)=>Po(e,new URLSearchParams({grant_type:"authorization_code",client_id:He,redirect_uri:ko,code:c,code_verifier:n}),o.signal),signal:o.signal});o.notify({type:"progress",message:`Listening for OAuth callback on ${ko}`}),o.notify({type:"auth_url",url:i.toString(),instructions:"Continue in your browser."});try{let c=await d.wait();if(!c)throw Error("OAuth callback did not complete.");return c}finally{d.close()}}async function ul(e,t){let o;try{o=await fetch(new URL("/v1/oauth/device",e),{method:"POST",headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:He,scope:Ws}),signal:t})}catch(r){if(t.aborted)throw Error("Login cancelled");throw r}if(!o.ok)throw await Vs(o,"Radius OAuth device authorization failed");let n=await o.json();if(!n.device_code||!n.user_code||!n.verification_uri||!n.expires_in)throw Error("Radius OAuth device authorization response is missing required fields");return{device_code:n.device_code,user_code:n.user_code,verification_uri:n.verification_uri,expires_in:n.expires_in,interval:n.interval}}async function ll(e,t){let o=await ul(e,t.signal);return t.notify({type:"device_code",userCode:o.user_code,verificationUri:o.verification_uri,intervalSeconds:o.interval,expiresInSeconds:o.expires_in}),b({intervalSeconds:o.interval,expiresInSeconds:o.expires_in,signal:t.signal,poll:async()=>{try{return{status:"complete",value:await Po(e,new URLSearchParams({grant_type:al,client_id:He,device_code:o.device_code}),t.signal)}}catch(n){if(!(n instanceof Oo))throw n;switch(n.oauthError){case"authorization_pending":return{status:"pending"};case"slow_down":return{status:"slow_down"};case"expired_token":return{status:"failed",message:"Device authorization expired."};case"access_denied":return{status:"failed",message:"Device authorization was denied."};default:throw n}}}})}function Ks(e){let t=Nr(e.gateway);return{name:e.name,async login(o){let n=await o.prompt({type:"select",message:`Sign in to ${e.name}:`,options:[{id:Bs,label:"Sign in with browser (recommended)"},{id:Ds,label:"Sign in with device code (when signing in from another device)"}]});if(n===Ds)return ll(t,o);if(n===Bs){let r=await cl(t,o.signal);return dl(t,r.authorizationEndpoint,o)}throw Error(`Unknown ${e.name} sign-in method: ${n}`)},async refresh(o,n){return await Po(t,new URLSearchParams({grant_type:"refresh_token",client_id:He,refresh_token:o.refresh}),n)},async toAuth(o){return{apiKey:o.access}}}}var Go="b1a00492-073a-47ea-816f-4c329264a828",pl="openid profile email offline_access grok-cli:access api:access",_l="https://auth.x.ai/oauth2/device/code",zs="https://auth.x.ai/oauth2/token",hl=300000,fl=3600;function Ve(e,t){let o=e[t];if(typeof o!=="string"||o.length===0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function Xs(e,t){let o=e[t];if(typeof o!=="number"||!Number.isFinite(o)||o<=0)throw Error(`Invalid xAI OAuth response field: ${t}`);return o}function js(e){let t;try{t=new URL(e)}catch{throw Error("Untrusted verification URI in xAI OAuth response")}if(t.protocol!=="https:")throw Error("Untrusted verification URI in xAI OAuth response");return t.href}async function bo(e,t,o){let n;try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t),signal:o})}catch(s){if(o.aborted)throw Error("Login cancelled");throw s}let r;try{let s=await n.json();r=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{if(o.aborted)throw Error("Login cancelled");throw Error(`xAI OAuth returned invalid JSON (HTTP ${n.status})`)}return{ok:n.ok,status:n.status,body:r}}function No(e,t){let o=typeof t.body.error==="string"?t.body.error:void 0,n=typeof t.body.error_description==="string"?t.body.error_description:void 0,r=[o,n].filter(Boolean).join(": ");return Error(`xAI OAuth ${e} failed (HTTP ${t.status})${r?`: ${r}`:""}`)}function ml(e){let t=e.interval,o=typeof t==="number"&&Number.isFinite(t)&&t>0?t:void 0,n=typeof e.verification_uri_complete==="string"&&e.verification_uri_complete.length>0?js(e.verification_uri_complete):void 0;return{deviceCode:Ve(e,"device_code"),userCode:Ve(e,"user_code"),verificationUri:js(Ve(e,"verification_uri")),verificationUriComplete:n,intervalSeconds:o,expiresInSeconds:Xs(e,"expires_in")}}function qs(e,t){let o=Ve(e,"access_token"),n=e.refresh_token===void 0&&t?t:Ve(e,"refresh_token"),r=e.expires_in===void 0?fl:Xs(e,"expires_in");return{type:"oauth",access:o,refresh:n,expires:Date.now()+r*1000-hl}}async function gl(e){let t=await bo(_l,{client_id:Go,scope:pl,referrer:"pi"},e);if(!t.ok)throw No("device authorization",t);return ml(t.body)}async function Cl(e,t){return b({intervalSeconds:e.intervalSeconds,expiresInSeconds:e.expiresInSeconds,waitBeforeFirstPoll:!0,signal:t,poll:async()=>{let o=await bo(zs,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:Go,device_code:e.deviceCode},t);if(o.ok)return{status:"complete",value:qs(o.body)};let n=o.body.error;if(n==="authorization_pending")return{status:"pending"};if(n==="slow_down"){let r=o.body.interval;return{status:"slow_down",intervalSeconds:typeof r==="number"?r:void 0}}if(n==="access_denied"||n==="authorization_denied")return{status:"failed",message:"xAI device authorization was denied"};if(n==="expired_token")return{status:"failed",message:"xAI device code expired"};return{status:"failed",message:No("device token polling",o).message}}})}async function Sl(e){let t=await gl(e.signal);return e.notify({type:"device_code",userCode:t.userCode,verificationUri:t.verificationUriComplete??t.verificationUri,intervalSeconds:t.intervalSeconds,expiresInSeconds:t.expiresInSeconds}),Cl(t,e.signal)}async function El(e,t){let o=await bo(zs,{grant_type:"refresh_token",client_id:Go,refresh_token:e},t);if(!o.ok)throw No("token refresh",o);return qs(o.body,e)}var Js={name:"xAI (Grok/X subscription)",isSubscription:!0,loginLabel:"Sign in with SuperGrok or X Premium",login:Sl,refresh:(e,t)=>El(e.refresh,t),async toAuth(e){return{apiKey:e.access}}};function Ys(){sa({anthropic:()=>ns,openaiCodex:()=>Ls,openaiChatGPT:()=>Ts,githubCopilot:()=>ps,openrouter:()=>Us,kimiCoding:()=>gs,meta:()=>vs,xai:()=>Js,radius:Ks})}ra(Vr);Ys();await import("./chunk-5ggyf53b.js");
|