@bkm016/basalt 0.1.32 → 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-nzpzjbpp.js → chunk-3j26jsy0.js} +1 -1
- package/{chunk-54qzhq9t.js → chunk-5ggyf53b.js} +2 -2
- package/{chunk-scq1dz62.js → chunk-fb2ydc2s.js} +4 -4
- package/{chunk-3dtgkgam.js → chunk-nkmvqcge.js} +143 -134
- package/compiled.js +1 -1
- package/package.json +1 -1
- package/ui-test-worker.js +1 -1
- package/web/{chunk-v5q92q5d.js → chunk-07kt1zpn.js} +1 -1
- package/web/chunk-07kt1zpn.js.br +0 -0
- package/web/chunk-07kt1zpn.js.gz +0 -0
- package/web/{chunk-d9c65yrg.js → chunk-0d068bmj.js} +1 -1
- package/web/chunk-0d068bmj.js.br +0 -0
- package/web/chunk-0d068bmj.js.gz +0 -0
- package/web/{chunk-f0kc6vf9.js → chunk-0m15ghn0.js} +2 -2
- 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-3s4mqjna.js → chunk-100a4th6.js} +3 -3
- package/web/chunk-100a4th6.js.br +0 -0
- package/web/chunk-100a4th6.js.gz +0 -0
- package/web/{chunk-0n134mev.js → chunk-1mdvm20t.js} +3 -3
- package/web/chunk-1mdvm20t.js.br +0 -0
- package/web/chunk-1mdvm20t.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-we9q8a9q.js → chunk-20gcnbgn.js} +2 -2
- 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-pa0sqjjk.js → chunk-2zz8t49r.js} +1 -1
- package/web/chunk-2zz8t49r.js.br +0 -0
- package/web/chunk-2zz8t49r.js.gz +0 -0
- package/web/{chunk-tanv869p.js → chunk-34g2xrgq.js} +2 -2
- package/web/chunk-34g2xrgq.js.br +0 -0
- package/web/chunk-34g2xrgq.js.gz +0 -0
- package/web/{chunk-cjbqey5q.js → chunk-34q3az4b.js} +1 -1
- package/web/chunk-34q3az4b.js.br +0 -0
- package/web/chunk-34q3az4b.js.gz +0 -0
- package/web/{chunk-gw1d4wmd.js → chunk-39jqdq4r.js} +1 -1
- package/web/chunk-39jqdq4r.js.br +0 -0
- package/web/chunk-39jqdq4r.js.gz +0 -0
- package/web/{chunk-p01t2t8w.js → chunk-3d2fm4qc.js} +1 -1
- package/web/chunk-3d2fm4qc.js.br +0 -0
- package/web/chunk-3d2fm4qc.js.gz +0 -0
- package/web/{chunk-98zd6fb7.js → chunk-3s16fbrf.js} +1 -1
- package/web/chunk-3s16fbrf.js.br +0 -0
- package/web/chunk-3s16fbrf.js.gz +0 -0
- package/web/{chunk-hmc93mm5.js → chunk-3vsey6mw.js} +1 -1
- package/web/chunk-3vsey6mw.js.br +0 -0
- package/web/chunk-3vsey6mw.js.gz +0 -0
- package/web/{chunk-4rbzcphw.js → chunk-3y29sc9c.js} +5 -5
- package/web/chunk-3y29sc9c.js.br +0 -0
- package/web/chunk-3y29sc9c.js.gz +0 -0
- package/web/{chunk-8gvxttsz.js → chunk-40f59ze9.js} +1 -1
- 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-wjv2q7b1.js → chunk-495sjpc6.js} +1 -1
- package/web/chunk-495sjpc6.js.br +0 -0
- package/web/chunk-495sjpc6.js.gz +0 -0
- package/web/{chunk-wh028xj6.js → chunk-4ab1dv3g.js} +19 -19
- package/web/chunk-4ab1dv3g.js.br +0 -0
- package/web/chunk-4ab1dv3g.js.gz +0 -0
- package/web/{chunk-02v1btpv.js → chunk-545zx869.js} +2 -2
- package/web/chunk-545zx869.js.br +0 -0
- package/web/chunk-545zx869.js.gz +0 -0
- package/web/{chunk-cgbz97dr.js → chunk-55mx05jg.js} +2 -2
- package/web/chunk-55mx05jg.js.br +0 -0
- package/web/{chunk-cgbz97dr.js.gz → chunk-55mx05jg.js.gz} +0 -0
- package/web/{chunk-8qda1pw3.js → chunk-58xhn7ry.js} +1 -1
- 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-vrakntde.js → chunk-6ana63fs.js} +8 -8
- package/web/chunk-6ana63fs.js.br +0 -0
- package/web/chunk-6ana63fs.js.gz +0 -0
- package/web/{chunk-kvz46sd7.js → chunk-6ew54553.js} +2 -2
- package/web/chunk-6ew54553.js.br +0 -0
- package/web/chunk-6ew54553.js.gz +0 -0
- package/web/{chunk-ev6xj0qs.js → chunk-6f1q0tjv.js} +107 -107
- 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-qz8yct8b.js → chunk-71g6vrx9.js} +1 -1
- 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-02xgh26g.js → chunk-7fdrwy21.js} +1 -1
- package/web/{chunk-02xgh26g.js.br → chunk-7fdrwy21.js.br} +0 -0
- package/web/chunk-7fdrwy21.js.gz +0 -0
- package/web/{chunk-g5ngaf53.js → chunk-84s7821x.js} +2 -2
- package/web/chunk-84s7821x.js.br +0 -0
- package/web/chunk-84s7821x.js.gz +0 -0
- package/web/{chunk-pss11x84.js → chunk-8e5qd73v.js} +2 -2
- package/web/chunk-8e5qd73v.js.br +0 -0
- package/web/chunk-8e5qd73v.js.gz +0 -0
- package/web/{chunk-mtzj1zyw.js → chunk-8kyj945c.js} +2 -2
- package/web/chunk-8kyj945c.js.br +0 -0
- package/web/chunk-8kyj945c.js.gz +0 -0
- package/web/{chunk-a3qa5c8q.js → chunk-9b0evht1.js} +3 -3
- package/web/chunk-9b0evht1.js.br +0 -0
- package/web/chunk-9b0evht1.js.gz +0 -0
- package/web/{chunk-x0zvwdq6.js → chunk-9j7v0e4v.js} +2 -2
- package/web/chunk-9j7v0e4v.js.br +0 -0
- package/web/chunk-9j7v0e4v.js.gz +0 -0
- package/web/{chunk-magq6xms.js → chunk-9jb5xwya.js} +2 -2
- 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-ads3r60t.js → chunk-9msmea44.js} +1 -1
- package/web/chunk-9msmea44.js.br +0 -0
- package/web/chunk-9msmea44.js.gz +0 -0
- package/web/{chunk-n5hvbjdt.js → chunk-a7q85665.js} +3 -3
- 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-qxyanf4n.js → chunk-b9cjgxr1.js} +2 -2
- package/web/chunk-b9cjgxr1.js.br +0 -0
- package/web/chunk-b9cjgxr1.js.gz +0 -0
- package/web/{chunk-wgezeg5k.js → chunk-baaattjv.js} +1 -1
- package/web/chunk-baaattjv.js.br +0 -0
- package/web/chunk-baaattjv.js.gz +0 -0
- package/web/{chunk-psymen6a.js → chunk-bj9m08f9.js} +1 -1
- package/web/chunk-bj9m08f9.js.br +0 -0
- package/web/chunk-bj9m08f9.js.gz +0 -0
- package/web/{chunk-wydnkdtp.js → chunk-bm4fvq6q.js} +4 -4
- 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-batey85v.js → chunk-cnptxet3.js} +2 -2
- package/web/chunk-cnptxet3.js.br +0 -0
- package/web/chunk-cnptxet3.js.gz +0 -0
- package/web/{chunk-yjan9xfw.js → chunk-d5n2yz4e.js} +2 -2
- package/web/chunk-d5n2yz4e.js.br +0 -0
- package/web/chunk-d5n2yz4e.js.gz +0 -0
- package/web/{chunk-54cy79n2.js → chunk-db2jge7w.js} +2 -2
- package/web/chunk-db2jge7w.js.br +0 -0
- package/web/chunk-db2jge7w.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-qb820yv8.js → chunk-e362x35y.js} +1 -1
- package/web/chunk-e362x35y.js.br +0 -0
- package/web/chunk-e362x35y.js.gz +0 -0
- package/web/{chunk-cqce094e.js → chunk-e6jfnajp.js} +9 -9
- package/web/chunk-e6jfnajp.js.br +0 -0
- package/web/chunk-e6jfnajp.js.gz +0 -0
- package/web/{chunk-szfzt9ph.js → chunk-ex34kdxk.js} +2 -2
- 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-x9b1052x.js → chunk-f5wyg9zh.js} +2 -2
- package/web/chunk-f5wyg9zh.js.br +0 -0
- package/web/chunk-f5wyg9zh.js.gz +0 -0
- package/web/{chunk-gp3356tf.js → chunk-fjvd2dx2.js} +1 -1
- 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-2vh05ags.js → chunk-gvndjaan.js} +2 -2
- package/web/chunk-gvndjaan.js.br +0 -0
- package/web/{chunk-2vh05ags.js.gz → chunk-gvndjaan.js.gz} +0 -0
- package/web/{chunk-r992px5p.js → chunk-h3618s7t.js} +2 -2
- 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-pczbf6w0.js → chunk-hqd97ez8.js} +4 -4
- package/web/chunk-hqd97ez8.js.br +0 -0
- package/web/chunk-hqd97ez8.js.gz +0 -0
- package/web/{chunk-yqzsx086.js → chunk-hta68vm8.js} +2 -2
- 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-24syb9ar.js → chunk-jzp1qd92.js} +1 -1
- package/web/chunk-jzp1qd92.js.br +0 -0
- package/web/chunk-jzp1qd92.js.gz +0 -0
- package/web/{chunk-14t6ms50.js → chunk-kg39a24q.js} +1 -1
- package/web/chunk-kg39a24q.js.br +0 -0
- package/web/chunk-kg39a24q.js.gz +0 -0
- package/web/{chunk-ezx3f7hw.js → chunk-kj75rme3.js} +1 -1
- 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-faestmhg.js → chunk-m203pzza.js} +2 -2
- package/web/chunk-m203pzza.js.br +0 -0
- package/web/chunk-m203pzza.js.gz +0 -0
- package/web/{chunk-zcetrm2j.js → chunk-m3xw41vq.js} +1 -1
- package/web/chunk-m3xw41vq.js.br +0 -0
- package/web/chunk-m3xw41vq.js.gz +0 -0
- package/web/{chunk-qm88s0at.js → chunk-m8jcx13t.js} +2 -2
- package/web/chunk-m8jcx13t.js.br +0 -0
- package/web/chunk-m8jcx13t.js.gz +0 -0
- package/web/{chunk-qpmyxj27.js → chunk-mpgz1bj6.js} +1 -1
- package/web/chunk-mpgz1bj6.js.br +0 -0
- package/web/chunk-mpgz1bj6.js.gz +0 -0
- package/web/{chunk-7aqr59hm.js → chunk-mzagmpq5.js} +1 -1
- 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-ece0ex2b.js → chunk-pdg3bxc0.js} +2 -2
- 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-cm5cmpxr.js → chunk-pkbyh261.js} +1 -1
- package/web/chunk-pkbyh261.js.br +0 -0
- package/web/chunk-pkbyh261.js.gz +0 -0
- package/web/{chunk-67pmbk1h.js → chunk-q3q25jr9.js} +1 -1
- package/web/chunk-q3q25jr9.js.br +0 -0
- package/web/chunk-q3q25jr9.js.gz +0 -0
- package/web/{chunk-6ebp7qd7.js → chunk-q5nr5wjn.js} +6 -6
- package/web/chunk-q5nr5wjn.js.br +0 -0
- package/web/chunk-q5nr5wjn.js.gz +0 -0
- package/web/{chunk-n6wz1xv2.js → chunk-qd9y8r3g.js} +2 -2
- package/web/chunk-qd9y8r3g.js.br +0 -0
- package/web/chunk-qd9y8r3g.js.gz +0 -0
- package/web/{chunk-86f9x5fs.js → chunk-qm039dan.js} +1 -1
- 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-43h0rwsj.js → chunk-rtk95qme.js} +1 -1
- package/web/chunk-rtk95qme.js.br +0 -0
- package/web/chunk-rtk95qme.js.gz +0 -0
- package/web/{chunk-rxadtk6j.js → chunk-s4rfkyqn.js} +3 -3
- package/web/chunk-s4rfkyqn.js.br +0 -0
- package/web/{chunk-rxadtk6j.js.gz → chunk-s4rfkyqn.js.gz} +0 -0
- package/web/{chunk-29mff7z7.js → chunk-s6a0gfv3.js} +1 -1
- package/web/chunk-s6a0gfv3.js.br +0 -0
- package/web/chunk-s6a0gfv3.js.gz +0 -0
- package/web/{chunk-kqpj6dnm.js → chunk-s7rwbxr5.js} +2 -2
- package/web/chunk-s7rwbxr5.js.br +0 -0
- package/web/chunk-s7rwbxr5.js.gz +0 -0
- package/web/{chunk-qhwsegs1.js → chunk-s8f6v2nn.js} +1 -1
- package/web/chunk-s8f6v2nn.js.br +0 -0
- package/web/chunk-s8f6v2nn.js.gz +0 -0
- package/web/{chunk-9hkz2jgq.js → chunk-sawc81kc.js} +49 -49
- package/web/chunk-sawc81kc.js.br +0 -0
- package/web/chunk-sawc81kc.js.gz +0 -0
- package/web/{chunk-j94hffw3.js → chunk-sex2gevj.js} +2 -2
- package/web/chunk-sex2gevj.js.br +0 -0
- package/web/chunk-sex2gevj.js.gz +0 -0
- package/web/{chunk-nfz5qmem.js → chunk-smmdqmcy.js} +1 -1
- package/web/chunk-smmdqmcy.js.br +0 -0
- package/web/chunk-smmdqmcy.js.gz +0 -0
- package/web/{chunk-sk3ssmwp.js → chunk-tntwwpyh.js} +2 -2
- package/web/chunk-tntwwpyh.js.br +0 -0
- package/web/chunk-tntwwpyh.js.gz +0 -0
- package/web/{chunk-szwh742y.js → chunk-tpzyyc2z.js} +2 -2
- package/web/{chunk-szwh742y.js.br → chunk-tpzyyc2z.js.br} +0 -0
- package/web/{chunk-szwh742y.js.gz → chunk-tpzyyc2z.js.gz} +0 -0
- package/web/{chunk-jw830br8.js → chunk-txhvq81f.js} +3 -3
- package/web/chunk-txhvq81f.js.br +0 -0
- package/web/chunk-txhvq81f.js.gz +0 -0
- package/web/{chunk-3srybd24.js → chunk-txtm71rz.js} +1 -1
- 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-whprx2wg.js → chunk-tyrmd7j6.js} +1 -1
- package/web/chunk-tyrmd7j6.js.br +0 -0
- package/web/chunk-tyrmd7j6.js.gz +0 -0
- package/web/{chunk-ax4wvgv9.js → chunk-v6ebn3sf.js} +2 -2
- package/web/chunk-v6ebn3sf.js.br +0 -0
- package/web/chunk-v6ebn3sf.js.gz +0 -0
- package/web/{chunk-26y868vk.js → chunk-vbx7t0h5.js} +6 -6
- 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-1fv6rp41.js → chunk-vndrjeyr.js} +2 -2
- package/web/chunk-vndrjeyr.js.br +0 -0
- package/web/chunk-vndrjeyr.js.gz +0 -0
- package/web/{chunk-ggfwnr7a.js → chunk-vqgkd7q8.js} +1 -1
- 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-1fp0r6da.js → chunk-w0k63gap.js} +2 -2
- 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-qzeb7kj6.js → chunk-wk89vrvf.js} +1 -1
- package/web/chunk-wk89vrvf.js.br +0 -0
- package/web/chunk-wk89vrvf.js.gz +0 -0
- package/web/{chunk-jrh3s3f5.js → chunk-wqjn3yz1.js} +42 -42
- package/web/chunk-wqjn3yz1.js.br +0 -0
- package/web/chunk-wqjn3yz1.js.gz +0 -0
- package/web/{chunk-ccdww2gj.js → chunk-wrej9qt0.js} +1 -1
- package/web/chunk-wrej9qt0.js.br +0 -0
- package/web/chunk-wrej9qt0.js.gz +0 -0
- package/web/{chunk-xwyvptzt.js → chunk-xbjv549c.js} +2 -2
- package/web/chunk-xbjv549c.js.br +0 -0
- package/web/chunk-xbjv549c.js.gz +0 -0
- package/web/{chunk-2z5tpzd0.js → chunk-xmp1ag6z.js} +1 -1
- package/web/chunk-xmp1ag6z.js.br +0 -0
- package/web/chunk-xmp1ag6z.js.gz +0 -0
- package/web/{chunk-1c1jdx2r.js → chunk-xsqd38a2.js} +4 -4
- package/web/chunk-xsqd38a2.js.br +0 -0
- package/web/chunk-xsqd38a2.js.gz +0 -0
- package/web/{chunk-d0qb5kr7.js → chunk-y2fbz356.js} +1 -1
- package/web/chunk-y2fbz356.js.br +0 -0
- package/web/chunk-y2fbz356.js.gz +0 -0
- package/web/chunk-y48mj5d7.js +1 -0
- package/web/chunk-y48mj5d7.js.br +0 -0
- package/web/chunk-y48mj5d7.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-9b43td2b.js → chunk-ypytxmn6.js} +1 -1
- package/web/chunk-ypytxmn6.js.br +0 -0
- package/web/chunk-ypytxmn6.js.gz +0 -0
- package/web/{chunk-35zjz7ms.js → chunk-z6jy8edk.js} +5 -5
- package/web/chunk-z6jy8edk.js.br +0 -0
- package/web/chunk-z6jy8edk.js.gz +0 -0
- package/web/{chunk-7qnxv6xx.js → chunk-zg5n1hx4.js} +1 -1
- package/web/chunk-zg5n1hx4.js.br +0 -0
- package/web/chunk-zg5n1hx4.js.gz +0 -0
- package/web/{chunk-tpps3mfw.js → chunk-zmrd0bnc.js} +2 -2
- package/web/chunk-zmrd0bnc.js.br +0 -0
- package/web/chunk-zmrd0bnc.js.gz +0 -0
- package/web/{chunk-ct6hkz49.js → chunk-zqm6n89p.js} +1 -1
- 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/web/chunk-02v1btpv.js.br +0 -0
- package/web/chunk-02v1btpv.js.gz +0 -0
- package/web/chunk-02xgh26g.js.gz +0 -0
- package/web/chunk-0n134mev.js.br +0 -0
- package/web/chunk-0n134mev.js.gz +0 -0
- package/web/chunk-14t6ms50.js.br +0 -0
- package/web/chunk-14t6ms50.js.gz +0 -0
- package/web/chunk-17j1pnvx.js +0 -1
- package/web/chunk-17j1pnvx.js.br +0 -0
- package/web/chunk-17j1pnvx.js.gz +0 -0
- package/web/chunk-19qs8qhf.js +0 -2
- package/web/chunk-19qs8qhf.js.br +0 -0
- package/web/chunk-19qs8qhf.js.gz +0 -0
- package/web/chunk-1c1jdx2r.js.br +0 -0
- package/web/chunk-1c1jdx2r.js.gz +0 -0
- package/web/chunk-1fp0r6da.js.br +0 -0
- package/web/chunk-1fp0r6da.js.gz +0 -0
- package/web/chunk-1fv6rp41.js.br +0 -0
- package/web/chunk-1fv6rp41.js.gz +0 -0
- package/web/chunk-1r8npw1h.js +0 -1
- package/web/chunk-1r8npw1h.js.br +0 -0
- package/web/chunk-1r8npw1h.js.gz +0 -0
- package/web/chunk-215gszpx.js +0 -1
- package/web/chunk-215gszpx.js.br +0 -0
- package/web/chunk-215gszpx.js.gz +0 -0
- package/web/chunk-2372y9qw.css +0 -1
- package/web/chunk-2372y9qw.css.br +0 -0
- package/web/chunk-2372y9qw.css.gz +0 -0
- package/web/chunk-24syb9ar.js.br +0 -0
- package/web/chunk-24syb9ar.js.gz +0 -0
- package/web/chunk-26y868vk.js.br +0 -0
- package/web/chunk-26y868vk.js.gz +0 -0
- package/web/chunk-29mff7z7.js.br +0 -0
- package/web/chunk-29mff7z7.js.gz +0 -0
- package/web/chunk-2vh05ags.js.br +0 -0
- package/web/chunk-2z5tpzd0.js.br +0 -2
- package/web/chunk-2z5tpzd0.js.gz +0 -0
- package/web/chunk-35zjz7ms.js.br +0 -0
- package/web/chunk-35zjz7ms.js.gz +0 -0
- package/web/chunk-3q8tjjp1.js +0 -1
- package/web/chunk-3q8tjjp1.js.br +0 -2
- package/web/chunk-3q8tjjp1.js.gz +0 -0
- package/web/chunk-3s4mqjna.js.br +0 -0
- package/web/chunk-3s4mqjna.js.gz +0 -0
- package/web/chunk-3srybd24.js.br +0 -0
- package/web/chunk-3srybd24.js.gz +0 -0
- package/web/chunk-3zsfd0hv.js +0 -1
- package/web/chunk-3zsfd0hv.js.br +0 -0
- package/web/chunk-3zsfd0hv.js.gz +0 -0
- package/web/chunk-43h0rwsj.js.br +0 -0
- package/web/chunk-43h0rwsj.js.gz +0 -0
- package/web/chunk-4gehgwdn.js +0 -1
- package/web/chunk-4gehgwdn.js.br +0 -0
- package/web/chunk-4gehgwdn.js.gz +0 -0
- package/web/chunk-4q1j0ehq.js +0 -1
- package/web/chunk-4q1j0ehq.js.br +0 -2
- package/web/chunk-4q1j0ehq.js.gz +0 -0
- package/web/chunk-4rbzcphw.js.br +0 -0
- package/web/chunk-4rbzcphw.js.gz +0 -0
- package/web/chunk-4xvh57dr.js +0 -1
- package/web/chunk-4xvh57dr.js.br +0 -0
- package/web/chunk-4xvh57dr.js.gz +0 -0
- package/web/chunk-54cy79n2.js.br +0 -0
- package/web/chunk-54cy79n2.js.gz +0 -0
- package/web/chunk-5v7dyp6t.js +0 -2
- package/web/chunk-5v7dyp6t.js.br +0 -0
- package/web/chunk-5v7dyp6t.js.gz +0 -0
- package/web/chunk-5xm6c0r0.js +0 -1
- package/web/chunk-5xm6c0r0.js.br +0 -0
- package/web/chunk-5xm6c0r0.js.gz +0 -0
- package/web/chunk-67pmbk1h.js.br +0 -0
- package/web/chunk-67pmbk1h.js.gz +0 -0
- package/web/chunk-6ebp7qd7.js.br +0 -0
- package/web/chunk-6ebp7qd7.js.gz +0 -0
- package/web/chunk-6k8me9kr.js +0 -1
- package/web/chunk-6k8me9kr.js.br +0 -0
- package/web/chunk-6k8me9kr.js.gz +0 -0
- package/web/chunk-7aqr59hm.js.br +0 -0
- package/web/chunk-7aqr59hm.js.gz +0 -0
- package/web/chunk-7qnxv6xx.js.br +0 -0
- package/web/chunk-7qnxv6xx.js.gz +0 -0
- package/web/chunk-7yb2g5zs.js +0 -1
- package/web/chunk-7yb2g5zs.js.br +0 -0
- package/web/chunk-7yb2g5zs.js.gz +0 -0
- package/web/chunk-86f9x5fs.js.br +0 -0
- package/web/chunk-86f9x5fs.js.gz +0 -0
- package/web/chunk-8gvxttsz.js.br +0 -0
- package/web/chunk-8gvxttsz.js.gz +0 -0
- package/web/chunk-8kjx7nve.js +0 -1
- package/web/chunk-8kjx7nve.js.br +0 -0
- package/web/chunk-8kjx7nve.js.gz +0 -0
- package/web/chunk-8qda1pw3.js.br +0 -0
- package/web/chunk-8qda1pw3.js.gz +0 -0
- package/web/chunk-98zd6fb7.js.br +0 -0
- package/web/chunk-98zd6fb7.js.gz +0 -0
- package/web/chunk-9b43td2b.js.br +0 -0
- package/web/chunk-9b43td2b.js.gz +0 -0
- package/web/chunk-9hkz2jgq.js.br +0 -0
- package/web/chunk-9hkz2jgq.js.gz +0 -0
- package/web/chunk-a3qa5c8q.js.br +0 -0
- package/web/chunk-a3qa5c8q.js.gz +0 -0
- package/web/chunk-ads3r60t.js.br +0 -0
- package/web/chunk-ads3r60t.js.gz +0 -0
- package/web/chunk-ax4wvgv9.js.br +0 -0
- package/web/chunk-ax4wvgv9.js.gz +0 -0
- package/web/chunk-b9knvs0r.js +0 -1
- package/web/chunk-b9knvs0r.js.br +0 -0
- package/web/chunk-b9knvs0r.js.gz +0 -0
- package/web/chunk-batey85v.js.br +0 -0
- package/web/chunk-batey85v.js.gz +0 -0
- package/web/chunk-ccdww2gj.js.br +0 -0
- package/web/chunk-ccdww2gj.js.gz +0 -0
- package/web/chunk-cgbz97dr.js.br +0 -0
- package/web/chunk-cjbqey5q.js.br +0 -0
- package/web/chunk-cjbqey5q.js.gz +0 -0
- package/web/chunk-cm5cmpxr.js.br +0 -0
- package/web/chunk-cm5cmpxr.js.gz +0 -0
- package/web/chunk-cqce094e.js.br +0 -0
- package/web/chunk-cqce094e.js.gz +0 -0
- package/web/chunk-ct6hkz49.js.br +0 -0
- package/web/chunk-ct6hkz49.js.gz +0 -0
- package/web/chunk-d0qb5kr7.js.br +0 -0
- package/web/chunk-d0qb5kr7.js.gz +0 -0
- package/web/chunk-d9c65yrg.js.br +0 -0
- package/web/chunk-d9c65yrg.js.gz +0 -0
- package/web/chunk-ece0ex2b.js.br +0 -0
- package/web/chunk-ece0ex2b.js.gz +0 -0
- package/web/chunk-ejrsh0nz.js +0 -1
- package/web/chunk-ejrsh0nz.js.br +0 -2
- package/web/chunk-ejrsh0nz.js.gz +0 -0
- package/web/chunk-ekcnhcm0.js +0 -1
- package/web/chunk-ekcnhcm0.js.br +0 -0
- package/web/chunk-ekcnhcm0.js.gz +0 -0
- package/web/chunk-eq4skc30.js +0 -1
- package/web/chunk-eq4skc30.js.br +0 -0
- package/web/chunk-eq4skc30.js.gz +0 -0
- package/web/chunk-ev6xj0qs.js.br +0 -0
- package/web/chunk-ev6xj0qs.js.gz +0 -0
- package/web/chunk-ezx3f7hw.js.br +0 -0
- package/web/chunk-ezx3f7hw.js.gz +0 -0
- package/web/chunk-f0kc6vf9.js.br +0 -0
- package/web/chunk-f0kc6vf9.js.gz +0 -0
- package/web/chunk-fabemrkx.js +0 -1
- package/web/chunk-fabemrkx.js.br +0 -0
- package/web/chunk-fabemrkx.js.gz +0 -0
- package/web/chunk-faestmhg.js.br +0 -0
- package/web/chunk-faestmhg.js.gz +0 -0
- package/web/chunk-g5ngaf53.js.br +0 -0
- package/web/chunk-g5ngaf53.js.gz +0 -0
- package/web/chunk-gcyhcbej.js +0 -1
- package/web/chunk-gcyhcbej.js.br +0 -2
- package/web/chunk-gcyhcbej.js.gz +0 -0
- package/web/chunk-ggfwnr7a.js.br +0 -0
- package/web/chunk-ggfwnr7a.js.gz +0 -0
- package/web/chunk-gp3356tf.js.br +0 -0
- package/web/chunk-gp3356tf.js.gz +0 -0
- package/web/chunk-gw1d4wmd.js.br +0 -0
- package/web/chunk-gw1d4wmd.js.gz +0 -0
- package/web/chunk-hmc93mm5.js.br +0 -0
- package/web/chunk-hmc93mm5.js.gz +0 -0
- package/web/chunk-hn9rxtn8.js +0 -8
- package/web/chunk-hn9rxtn8.js.br +0 -0
- package/web/chunk-hn9rxtn8.js.gz +0 -0
- package/web/chunk-hrng3h6w.js +0 -1
- package/web/chunk-hrng3h6w.js.br +0 -2
- package/web/chunk-hrng3h6w.js.gz +0 -0
- package/web/chunk-hxyxfhhs.js +0 -1
- package/web/chunk-hxyxfhhs.js.br +0 -2
- package/web/chunk-hxyxfhhs.js.gz +0 -0
- package/web/chunk-j94hffw3.js.br +0 -0
- package/web/chunk-j94hffw3.js.gz +0 -0
- package/web/chunk-jrh3s3f5.js.br +0 -0
- package/web/chunk-jrh3s3f5.js.gz +0 -0
- package/web/chunk-jw830br8.js.br +0 -0
- package/web/chunk-jw830br8.js.gz +0 -0
- package/web/chunk-k3whmjng.js +0 -1
- package/web/chunk-k3whmjng.js.br +0 -0
- package/web/chunk-k3whmjng.js.gz +0 -0
- package/web/chunk-kgfzf3q8.js +0 -1
- package/web/chunk-kgfzf3q8.js.br +0 -0
- package/web/chunk-kgfzf3q8.js.gz +0 -0
- package/web/chunk-kqpj6dnm.js.br +0 -0
- package/web/chunk-kqpj6dnm.js.gz +0 -0
- package/web/chunk-kvz46sd7.js.br +0 -0
- package/web/chunk-kvz46sd7.js.gz +0 -0
- package/web/chunk-magq6xms.js.br +0 -0
- package/web/chunk-magq6xms.js.gz +0 -0
- package/web/chunk-mtzj1zyw.js.br +0 -0
- package/web/chunk-mtzj1zyw.js.gz +0 -0
- package/web/chunk-my778zsk.js +0 -1
- package/web/chunk-my778zsk.js.br +0 -0
- package/web/chunk-my778zsk.js.gz +0 -0
- package/web/chunk-mzevfdmp.js +0 -1
- package/web/chunk-mzevfdmp.js.br +0 -0
- package/web/chunk-mzevfdmp.js.gz +0 -0
- package/web/chunk-n5hvbjdt.js.br +0 -0
- package/web/chunk-n5hvbjdt.js.gz +0 -0
- package/web/chunk-n6wz1xv2.js.br +0 -0
- package/web/chunk-n6wz1xv2.js.gz +0 -0
- package/web/chunk-nfz5qmem.js.br +0 -0
- package/web/chunk-nfz5qmem.js.gz +0 -0
- package/web/chunk-p01t2t8w.js.br +0 -0
- package/web/chunk-p01t2t8w.js.gz +0 -0
- package/web/chunk-pa0sqjjk.js.br +0 -0
- package/web/chunk-pa0sqjjk.js.gz +0 -0
- package/web/chunk-pczbf6w0.js.br +0 -0
- package/web/chunk-pczbf6w0.js.gz +0 -0
- package/web/chunk-pss11x84.js.br +0 -0
- package/web/chunk-pss11x84.js.gz +0 -0
- package/web/chunk-psymen6a.js.br +0 -0
- package/web/chunk-psymen6a.js.gz +0 -0
- package/web/chunk-q5rd9d4z.js +0 -1
- package/web/chunk-q5rd9d4z.js.br +0 -0
- package/web/chunk-q5rd9d4z.js.gz +0 -0
- package/web/chunk-qb820yv8.js.br +0 -0
- package/web/chunk-qb820yv8.js.gz +0 -0
- package/web/chunk-qcacb7rs.js +0 -1
- package/web/chunk-qcacb7rs.js.br +0 -0
- package/web/chunk-qcacb7rs.js.gz +0 -0
- package/web/chunk-qhwsegs1.js.br +0 -0
- package/web/chunk-qhwsegs1.js.gz +0 -0
- package/web/chunk-qm88s0at.js.br +0 -0
- package/web/chunk-qm88s0at.js.gz +0 -0
- package/web/chunk-qpmyxj27.js.br +0 -0
- package/web/chunk-qpmyxj27.js.gz +0 -0
- package/web/chunk-qxyanf4n.js.br +0 -0
- package/web/chunk-qxyanf4n.js.gz +0 -0
- package/web/chunk-qz8yct8b.js.br +0 -0
- package/web/chunk-qz8yct8b.js.gz +0 -0
- package/web/chunk-qzeb7kj6.js.br +0 -0
- package/web/chunk-qzeb7kj6.js.gz +0 -0
- package/web/chunk-r827h2kc.js +0 -1
- package/web/chunk-r827h2kc.js.br +0 -2
- package/web/chunk-r827h2kc.js.gz +0 -0
- package/web/chunk-r992px5p.js.br +0 -0
- package/web/chunk-r992px5p.js.gz +0 -0
- package/web/chunk-rvgx4jhr.js +0 -1
- package/web/chunk-rvgx4jhr.js.br +0 -0
- package/web/chunk-rvgx4jhr.js.gz +0 -0
- package/web/chunk-rxadtk6j.js.br +0 -0
- package/web/chunk-sk3ssmwp.js.br +0 -0
- package/web/chunk-sk3ssmwp.js.gz +0 -0
- package/web/chunk-snvwfzxt.js +0 -2
- package/web/chunk-snvwfzxt.js.br +0 -0
- package/web/chunk-snvwfzxt.js.gz +0 -0
- package/web/chunk-szfzt9ph.js.br +0 -0
- package/web/chunk-szfzt9ph.js.gz +0 -0
- package/web/chunk-t9hnp1zd.js +0 -2
- package/web/chunk-t9hnp1zd.js.br +0 -3
- package/web/chunk-t9hnp1zd.js.gz +0 -0
- package/web/chunk-tanv869p.js.br +0 -0
- package/web/chunk-tanv869p.js.gz +0 -0
- package/web/chunk-tpps3mfw.js.br +0 -0
- package/web/chunk-tpps3mfw.js.gz +0 -0
- package/web/chunk-txb5yf8n.js +0 -1
- package/web/chunk-txb5yf8n.js.br +0 -0
- package/web/chunk-txb5yf8n.js.gz +0 -0
- package/web/chunk-v3vqv74s.js +0 -1
- package/web/chunk-v3vqv74s.js.br +0 -0
- package/web/chunk-v3vqv74s.js.gz +0 -0
- package/web/chunk-v5q92q5d.js.br +0 -0
- package/web/chunk-v5q92q5d.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-vrakntde.js.br +0 -0
- package/web/chunk-vrakntde.js.gz +0 -0
- package/web/chunk-we9q8a9q.js.br +0 -0
- package/web/chunk-we9q8a9q.js.gz +0 -0
- package/web/chunk-wgezeg5k.js.br +0 -0
- package/web/chunk-wgezeg5k.js.gz +0 -0
- package/web/chunk-wh028xj6.js.br +0 -0
- package/web/chunk-wh028xj6.js.gz +0 -0
- package/web/chunk-whprx2wg.js.br +0 -0
- package/web/chunk-whprx2wg.js.gz +0 -0
- package/web/chunk-wjv2q7b1.js.br +0 -0
- package/web/chunk-wjv2q7b1.js.gz +0 -0
- package/web/chunk-wydnkdtp.js.br +0 -0
- package/web/chunk-wydnkdtp.js.gz +0 -0
- package/web/chunk-x0zvwdq6.js.br +0 -0
- package/web/chunk-x0zvwdq6.js.gz +0 -0
- package/web/chunk-x9b1052x.js.br +0 -0
- package/web/chunk-x9b1052x.js.gz +0 -0
- package/web/chunk-xwyvptzt.js.br +0 -0
- package/web/chunk-xwyvptzt.js.gz +0 -0
- package/web/chunk-ya7gs2bv.js +0 -1
- package/web/chunk-ya7gs2bv.js.br +0 -0
- package/web/chunk-ya7gs2bv.js.gz +0 -0
- package/web/chunk-yjan9xfw.js.br +0 -0
- package/web/chunk-yjan9xfw.js.gz +0 -0
- package/web/chunk-yqzsx086.js.br +0 -0
- package/web/chunk-yqzsx086.js.gz +0 -0
- package/web/chunk-zcetrm2j.js.br +0 -3
- package/web/chunk-zcetrm2j.js.gz +0 -0
- package/web/chunk-zk1ddepw.js +0 -1
- package/web/chunk-zk1ddepw.js.br +0 -0
- package/web/chunk-zk1ddepw.js.gz +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{nt,v,s,ee,w,o,a,Oc,$c,Cr,Rt,Bc,sc,Bt,qn,le,it,va,li,Fc,zc,m,e,n,pe,U,u,l,Jt,pr,Gn,dr,zt,Ar,Tr,fr,an,st,ht,$e,xa,Wn,_a,wa,gt,be,Ht,ge,Oe,ut,vt,Ut,Yn,ka,xe,ce,je,on,ve,Re,bn,Te,Sa,Zr,ls,k,ps,p,qe,_,G,te,At,ie,yt,rt,Ee,Le,Se,Ve,ue,z,Pt,Jr,uc,qt,Ge,sn,ke,gr,We,ea,gi,bt,Aa,Yi,ne,Y,fs,Ye,Xi,hs,gs,ta,vs,yi,bi,tn,Ta,bs,xs,Wc,xi,Yc,_s,na,Ki}from"./chunk-ev6xj0qs.js";var Yt=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Qe=l("bell",Yt);var Xt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Xe=l("chevron-left",Xt);var Zt=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Ze=l("cloud",Zt);var en=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],et=l("hard-drive",en);var nn=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Pe=l("network",nn);var rn=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Me=l("save",rn);var ln=[{value:"system",label:"跟随系统",icon:e(Wn,{})},{value:"light",label:"浅色",icon:e(ka,{})},{value:"dark",label:"深色",icon:e(_a,{})}];function tt(){let t=k(),i=ps(),r=zc();return n(ne,{title:"外观",description:"仅保存在当前浏览器本地",children:[e(Y,{title:"主题模式",description:"切换浅色、深色或跟随系统外观",children:e(Ta,{value:t.preference,onChange:Zr,options:ln})}),e(Y,{title:"主题风格",description:"选择宿主默认或由已启用插件提供的视觉主题",children:e(tn,{value:t.themeID,onValueChange:ls,groups:[{options:i.map((d)=>({value:d.id,label:d.label,description:d.description}))}],className:"w-48"})}),r.canInstall&&e(Y,{title:"桌面应用",description:"将 Basalt 安装为独立窗口应用,可从桌面或任务栏直接启动",children:n(_,{size:"sm",onClick:()=>r.install().catch((d)=>z(d,"安装应用失败")),children:[e(fr,{className:"size-3.5"}),"安装应用"]})})]})}function at(){let t=le(va),[i,r]=a(li),[d,y]=a(!1),M=o(!1);s(()=>{M.current=!0;let h=()=>r(li());return window.addEventListener("focus",h),document.addEventListener("visibilitychange",h),()=>{M.current=!1,window.removeEventListener("focus",h),document.removeEventListener("visibilitychange",h)}},[]);let B=async(h)=>{y(!0);try{let g=await Fc(h);if(M.current)r(g)}catch(g){if(M.current)z(g,"无法更新系统通知")}finally{if(M.current)y(!1)}};return e(ne,{title:"系统通知",description:"页面保持打开时生效;开关仅保存在当前浏览器",children:e(Y,{title:"完成与错误提醒",description:i==="unsupported"?"当前浏览器或访问方式不支持系统通知,请使用支持通知的浏览器,并通过 HTTPS 或 localhost 访问":i==="denied"?"浏览器已阻止通知,请在网站设置中允许通知,回到此页后再开启":t&&i==="granted"?"模型工作完成或运行出错时发送;点击通知可回到对应会话":"开启后在模型工作完成或运行出错时发送;首次开启需要浏览器授权",children:e(Ye,{label:"模型工作完成或出错时发送系统通知",checked:t&&i==="granted",disabled:d||i==="unsupported",onCheckedChange:(h)=>void B(h)})})})}function ot(t){let i=le(t.conn.state),r=Ki[i.status];return e(ne,{title:"已保存的服务器连接",description:"保存在当前浏览器中的服务器地址与设备凭证",action:n(_,{size:"sm",onClick:t.onAddServer,children:[e(be,{className:"size-3.5"}),"添加服务器"]}),children:t.servers.map((d)=>{let y=d.id===t.server.id;return e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate",children:qn(d)}),y&&n("span",{className:"inline-flex items-center gap-1.5 font-normal text-xs text-dim",children:[e("span",{className:u("size-1.5 rounded-full",r.dot)}),r.label]})]}),description:e("span",{className:"font-mono",children:d.url}),children:y?n(_,{size:"sm",variant:"danger-ghost",onClick:t.onRemoveServer,children:[e(xe,{className:"size-3.5"}),"移除"]}):e(_,{size:"sm",onClick:()=>t.onServer(d.id),children:"切换"})},d.id)})})}function lt(){return n(m,{children:[n(ne,{title:"全局",description:"当前浏览器前端快捷键",children:[e(Y,{title:"搜索与命令面板",description:"快速跳转会话、项目或执行常用操作",children:e(qe,{children:"mod+k"})}),e(Y,{title:"收起 / 展开侧栏",description:"在完整侧栏与窄图标栏之间切换",children:e(qe,{children:"alt+1"})}),e(Y,{title:"新建聊天",description:"立即回到新会话输入页",children:e(qe,{children:"mod+shift+o"})})]}),n(ne,{title:"对话输入",children:[e(Y,{title:"发送消息",children:e(qe,{children:"Enter"})}),e(Y,{title:"换行",children:e(qe,{children:"Shift+Enter"})})]})]})}var dt=["B","KB","MB","GB","TB"];function K(t){let i=t,r=0;while(i>=1024&&r<dt.length-1)i/=1024,r++;let d=r===0?0:i>=100?0:i>=10?1:2;return`${i.toFixed(d)} ${dt[r]}`}function ct({conn:t,server:i}){k();let r=i?.id??t.server.id,d=le(on(r)),[y,M]=a(!1),[B,I]=a();s(()=>{let g=new AbortController;return t.request("/api/search/settings",{signal:g.signal}).then((c)=>{if(!g.signal.aborted)on(r).set(c.status)}).catch(()=>{if(!g.signal.aborted)I("无法读取历史搜索设置,请重新打开设置重试")}),()=>g.abort()},[t,r]);async function h(){if(y)return;M(!0),I(void 0);try{let g=await t.request("/api/search/rebuild",{method:"POST"});on(r).set(g)}catch(g){I(g instanceof Error?g.message:"无法重建历史搜索索引,请重试")}finally{M(!1)}}return n(ne,{title:"历史搜索",children:[e(Y,{title:"搜索索引",description:n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5",children:[e(xi,{status:d,showEnable:!1,className:"py-0 shrink-0"}),d&&n("span",{children:["体积 ",K(d.bytes)," / 预算 ",K(d.budget)]})]}),children:e(_,{disabled:y||!d||d.state==="rebuilding",loading:y,onClick:()=>{h().catch(()=>{return})},children:"重建索引"})}),d?.state==="rebuilding"&&e("div",{className:p("surface.subtle","space-y-3 border-line bg-raised/30 p-3.5"),children:n("div",{className:"flex items-center justify-between text-xs text-dim",children:[e("span",{children:"正在重建索引…"}),e("code",{className:p("markdown.inlineCode"),children:d.total>0?`${Math.round(d.indexed/d.total*100)}%`:"0%"})]})}),B&&e("p",{role:"alert",className:"p-4 text-sm text-danger",children:B})]})}var Ae=new WeakMap,dn={assistant:"bg-accent",tool:"bg-warning",user:"bg-success",run:"bg-ink/50",compaction:"bg-danger",notice:"bg-dim",notice_pending:"bg-faint"};function de(t){return e("span",{className:u("font-mono text-xs tabular-nums text-dim",t.className),children:t.children})}function mt(t){return e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{children:t.title}),t.subtitle&&e("span",{className:"font-mono text-2xs font-normal text-faint",children:t.subtitle})]}),description:e("span",{className:"font-mono break-all text-dim",children:t.path}),children:e(Pt,{text:t.path,label:"复制路径",size:"icon-sm"})})}function Ue(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:u("h-full rounded-full transition-all duration-300",t.colorClass??"bg-accent"),style:{width:`${Math.max(t.percent>0?1:0,t.percent)}%`}})})}function _e(t,i){if(i<=0||t<=0)return"0%";let r=t/i*100;if(r<0.1)return"<0.1%";let d=r>=10?1:2;return`${r.toFixed(d)}%`}function ft(t){if(!t)return"—";return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function pt(t){return t.database.size+t.database.walSize+t.database.shmSize}function cn(t){let{table:i,totalDbBytes:r}=t,d=i.bytes??0,y=r>0?Math.min(100,d/r*100):0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[e("code",{className:p("markdown.inlineCode"),children:i.name}),i.withoutRowid&&e("span",{className:p("control.badge","border border-line bg-raised/40 px-2 py-0.5 text-xs"),children:"WITHOUT ROWID"}),i.indexes!==void 0&&i.indexes>0&&n("span",{className:"rounded-md bg-raised/50 px-1.5 py-0.5 font-mono text-2xs text-faint",children:[i.indexes," 索引"]}),i.pages!==void 0&&n("span",{className:"font-mono text-2xs text-faint tabular-nums",children:[i.pages.toLocaleString()," 页"]})]}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums",children:[n("span",{className:"text-ink",children:[i.rows.toLocaleString()," 行"]}),i.bytes!==void 0&&n("span",{className:"text-dim",children:[K(d)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(d,r),")"]})]})]})]}),i.bytes!==void 0&&r>0&&e(Ue,{percent:y})]})}function xt(t){k();let[i,r]=a(()=>Ae.get(t.conn)),[d,y]=a(),[M,B]=a(!1),[I,h]=a(!0),[g,c]=a(!0),[D,C]=a(!1),E=v(async(F=!1)=>{B(!0);try{let j=await t.conn.storage(F);if(Ae.set(t.conn,j),r(j),j.search)on(t.server?.id??t.conn.server.id).set(j.search);y(void 0)}catch(j){y(je(j))}finally{B(!1)}},[t.conn,t.server?.id]);s(()=>{E()},[E]);async function O(){if(!i)return;let F=g?i.database.reclaimableBytes:0,j=I||g?i.database.walSize:0,X=F+j,Q=[];if(g)Q.push("VACUUM 数据库");if(I)Q.push("截断 WAL");if(!await Ge({title:"确认清理数据库?",description:`将${Q.join("并")},预计回收 ${K(X)}。不会删除会话、消息或设备。大库上 VACUUM 可能要几秒,期间写入会等待。`,action:"开始清理"}))return;C(!0);try{let ae=await t.conn.compactStorage({checkpoint:I,vacuum:g}),me=pt(ae.before),fe=pt(ae.after),he=Math.max(0,me-fe);Ae.set(t.conn,ae.after),r(ae.after);let Ce=he>0?"清理完成":"清理完成,没有可回收的空间";ue.success(Ce,{description:`数据库 ${K(me)} → ${K(fe)}`})}catch(ae){z(ae,"清理失败")}finally{C(!1)}}let L=n(_,{size:"sm",variant:"ghost",onClick:()=>void E(),loading:M,children:[e(ge,{className:"size-3.5"}),"刷新"]});if(!i)return e(ne,{title:"数据库",action:L,children:e(Y,{title:d?"无法读取数据库信息":"正在读取数据库信息…",description:d})});let{database:x,analytics:f}=i,W=x.size+x.walSize+x.shmSize,N=Math.max(0,x.size-x.reclaimableBytes),T=x.reclaimableBytes+x.walSize,A=x.pageCount>0?(x.pageCount-x.freelistCount)/x.pageCount*100:100,S=x.integrity?.toLowerCase()==="ok",P="neutral",H="未检查";if(x.integrity)P=S?"success":"danger",H=S?"正常 (OK)":"异常";let b=!I&&!g,V=[...i.tables].sort((F,j)=>(j.bytes??0)-(F.bytes??0)||j.rows-F.rows),R=(f?.totalBodyBytes??0)+(f?.totalRawBytes??0),J=(f?.mainSessionCount??0)+(f?.subSessionCount??0);return n(m,{children:[n(ne,{title:"存储总览",action:L,unboxed:!0,children:[n("div",{className:"auto-grid gap-3",children:[n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"数据库占用"}),e(Tr,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(W)}),n("div",{className:"mt-1 font-mono text-2xs text-dim",children:["主库 ",K(x.size)," · WAL ",K(x.walSize)]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"数据目录"}),e(et,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(i.dataBytes)}),n("div",{className:"mt-1 text-2xs text-dim",children:["共 ",i.entries.length," 项"]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"可回收空间"}),e(Gn,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(T)}),n("div",{className:"mt-1 font-mono text-2xs text-dim",children:["利用率 ",A.toFixed(1),"% · ",x.freelistCount," 空页"]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"完整性"}),e(Yn,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 flex items-center gap-2",children:e(rt,{tone:P,children:H})}),n("div",{className:"mt-1.5 font-mono text-2xs text-dim",children:["SQLite ",x.sqliteVersion??"3.x"," · v",x.schemaVersion]})]})]}),W>0&&n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"font-medium text-ink",children:"物理构成"}),n("span",{className:"font-mono text-faint tabular-nums",children:[x.pageCount.toLocaleString()," 页 × ",K(x.pageSize)]})]}),n("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-raised gap-0.5",children:[N>0&&e("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${N/W*100}%`},title:`数据页: ${K(N)}`}),x.reclaimableBytes>0&&e("div",{className:"h-full bg-warning transition-all duration-300",style:{width:`${x.reclaimableBytes/W*100}%`},title:`空闲页: ${K(x.reclaimableBytes)}`}),x.walSize>0&&e("div",{className:"h-full bg-ink/40 transition-all duration-300",style:{width:`${x.walSize/W*100}%`},title:`WAL: ${K(x.walSize)}`}),x.shmSize>0&&e("div",{className:"h-full bg-faint transition-all duration-300",style:{width:`${x.shmSize/W*100}%`},title:`SHM: ${K(x.shmSize)}`})]}),n("div",{className:"mt-2.5 flex flex-wrap items-center gap-x-5 gap-y-1.5 text-xs text-dim",children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"数据页 ",e(de,{children:K(N)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-warning"}),"空闲页 ",e(de,{children:K(x.reclaimableBytes)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-ink/40"}),"WAL ",e(de,{children:K(x.walSize)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-faint"}),"SHM ",e(de,{children:K(x.shmSize)})]})]})]})]}),e(ne,{title:"深度分析",children:e(Y,{title:"完整性检查与空间分布",description:d??"按需扫描数据库,获取表物理占用和日志类型分布;大库可能耗时数秒,期间其他请求可能等待。",children:e(_,{size:"sm",onClick:()=>void E(!0),loading:M,disabled:D,children:f?"重新分析":"开始分析"})})}),n(ne,{title:"存储路径",children:[e(mt,{title:"主数据库",subtitle:x.lastModified?bt(x.lastModified):void 0,path:i.databasePath}),e(mt,{title:"数据目录",path:i.dataDir})]}),e(ct,{conn:t.conn,server:t.server}),f&&n(ne,{title:"会话与日志",children:[e(Y,{title:"会话统计",description:`${f.projectCount} 个项目 · ${J.toLocaleString()} 个会话`,children:n("div",{className:"flex flex-wrap items-center gap-1.5 font-mono text-xs",children:[n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-ink",children:["主会话 ",f.mainSessionCount.toLocaleString()]}),n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["子代理 ",f.subSessionCount.toLocaleString()]}),f.forkedSessionCount>0&&n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["分叉 ",f.forkedSessionCount.toLocaleString()]}),f.automationSessionCount>0&&n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["自动化 ",f.automationSessionCount.toLocaleString()]})]})}),e(Y,{title:"日志载荷",children:e(de,{children:`body ${K(f.totalBodyBytes)} · raw ${K(f.totalRawBytes)}`})}),e(Y,{title:"日志记录",description:f.oldestEntryTime?`${ft(f.oldestEntryTime)} — ${ft(f.newestEntryTime)}`:void 0,children:e(de,{children:`${f.totalEntries.toLocaleString()} 条${f.compactionCount>0?` · ${f.compactionCount} 次压缩`:""}`})}),f.entryTypes.length>0&&n("div",{className:"p-4",children:[n("div",{className:"mb-3 flex items-center justify-between text-xs",children:[e("span",{className:"font-medium text-ink",children:"日志类型分布"}),e("span",{className:"font-mono text-faint",children:K(R)})]}),e("div",{className:"space-y-2.5",children:f.entryTypes.map((F)=>{let j=F.bodyBytes+F.rawBytes,X=dn[F.type]??"bg-dim",Q=R>0?Math.min(100,j/R*100):0,Z=F.count>0?Math.round(j/F.count):0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex items-center gap-2",children:[e("span",{className:u("size-2 rounded-full",X)}),e("span",{className:"font-mono font-medium text-ink",children:F.type}),n("span",{className:"font-mono text-2xs text-faint",children:[K(Z),"/条"]})]}),n("div",{className:"flex items-center gap-3 font-mono tabular-nums",children:[n("span",{className:"text-ink",children:[F.count.toLocaleString()," 条"]}),n("span",{className:"text-dim",children:[K(j)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(j,R),")"]})]})]})]}),e(Ue,{percent:Q,colorClass:X})]},F.type)})})]})]}),e(ne,{title:"数据表",children:e("div",{className:"p-4 space-y-2.5",children:V.map((F)=>e(cn,{table:F,totalDbBytes:x.size},F.name))})}),f&&f.pluginNamespaces.length>0&&e(ne,{title:"插件存储",children:e("div",{className:"grid grid-cols-1 gap-x-10 gap-y-2.5 p-4 md:grid-cols-2",children:f.pluginNamespaces.map((F)=>n("div",{className:"flex items-center justify-between gap-3 text-xs",children:[n("span",{className:"flex min-w-0 items-center gap-2",children:[e(pr,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"truncate font-mono font-medium text-ink",children:F.namespace}),F.migrationVersion!==void 0&&n("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-2xs font-normal text-faint",children:["v",F.migrationVersion]})]}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums text-xs",children:[n("span",{className:F.keys>0?"text-dim":"text-faint/50",children:[F.keys," 键"]}),e("span",{className:F.bytes>0?"font-medium text-ink":"text-faint/50",children:K(F.bytes)})]})]},F.namespace))})}),e(ne,{title:"引擎参数 (PRAGMA)",children:e("div",{className:"grid grid-cols-1 gap-x-10 gap-y-2.5 p-4 text-xs md:grid-cols-2",children:[{label:"内核版本",value:`SQLite ${x.sqliteVersion??"3.x"}`},{label:"忙锁超时",value:`${x.busyTimeout??5000}ms`},{label:"字符编码",value:x.encoding??"UTF-8"},{label:"单页大小",value:K(x.pageSize)},{label:"Schema 版本",value:`v${x.schemaVersion}`},{label:"总页数",value:`${x.pageCount.toLocaleString()} 页`},{label:"日志模式",value:x.journalMode.toUpperCase()},{label:"页缓存",value:x.cacheSizeBytes?K(x.cacheSizeBytes):"默认"},{label:"同步级别",value:x.synchronous??"FULL"},{label:"空闲页",value:`${x.freelistCount.toLocaleString()} 页 (${K(x.reclaimableBytes)})`},{label:"外键约束",value:x.foreignKeys!==!1?"ON":"OFF"},{label:"自动清理",value:x.autoVacuum??"NONE"}].map((F)=>n("div",{className:"flex items-center justify-between gap-3",children:[e("span",{className:"text-dim",children:F.label}),e(de,{className:"text-ink",children:F.value})]},F.label))})}),e(ne,{title:"数据目录明细",children:n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"mb-3 flex items-center justify-between text-xs",children:[e("span",{className:"font-mono text-dim break-all",children:i.dataDir}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono text-xs",children:[n("span",{className:"text-dim",children:["共 ",i.entries.length," 项"]}),e("span",{className:"font-medium text-ink",children:K(i.dataBytes)})]})]}),i.entries.map((F)=>{let j=i.dataBytes>0?F.bytes/i.dataBytes*100:0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[F.kind==="directory"?e(ht,{className:"size-3.5 shrink-0 text-accent"}):e(st,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"font-mono font-medium text-ink",children:F.name}),n("span",{className:"font-mono text-2xs text-faint",children:[F.kind==="directory"?`目录${F.files!==void 0?` · ${F.files.toLocaleString()} 个文件`:""}`:"文件",F.modified?` · ${bt(F.modified)}`:""]})]}),e("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums text-xs",children:n("span",{className:"text-dim",children:[K(F.bytes)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(F.bytes,i.dataBytes),")"]})]})})]}),i.dataBytes>0&&e(Ue,{percent:j})]},F.name)})]})}),n(ne,{title:"空间维护",children:[e(Y,{title:"VACUUM 整理",description:`可回收 ${K(x.reclaimableBytes)}`,children:e(Ye,{checked:g,onCheckedChange:c,label:"VACUUM 数据库",disabled:D})}),e(Y,{title:"截断 WAL",description:`当前 ${K(x.walSize)}`,children:e(Ye,{checked:I,onCheckedChange:h,label:"截断 WAL",disabled:D})}),e(Y,{title:"执行清理",description:b?"请至少开启一项":`预计释放 ${K((g?x.reclaimableBytes:0)+(I||g?x.walSize:0))}`,children:e(_,{variant:"primary",size:"sm",onClick:()=>void O(),loading:D,disabled:b,children:"清理…"})})]})]})}var un=2000;function St(t){let i=le(t.state),[r,d]=a(void 0),[y,M]=a(!1),[B,I]=a("idle"),[h,g]=a(void 0),[c,D]=a(""),C=o(!1),E=o(void 0),O=o(void 0),L=o(0),x=o(!1),f=v((S)=>{let P=C.current&&!S.pending;if(!C.current&&S.pending)D("");if(C.current=S.pending,d(S),S.error)g(S.error),I("error");else if(S.pending)I(S.awaitingInput?"awaiting_input":"authorizing");else if(P&&S.connected)I("success");else if(!S.connected)I("idle")},[]);s(()=>{if(i.status!=="open")return;let S=new AbortController,P=!1;return t.providerAuthStatus(S.signal).then((H)=>{if(!P)f(H)},()=>{}),()=>{P=!0,S.abort()}},[t,i.status,f]);let W=v(async()=>{M(!0),g(void 0),I("authorizing"),x.current=!1;try{let S=await t.startProviderAuth();if(f(S),S.authorizeURL)window.open(S.authorizeURL,"_blank","noopener,noreferrer")}catch(S){g(S instanceof Error?S.message:String(S)),I("error")}finally{M(!1)}},[t,f]);s(()=>{if(!r?.pending)return;let S=!1,P=()=>{if(x.current)return;E.current?.abort();let H=new AbortController;E.current=H,t.providerAuthStatus(H.signal).then((b)=>{if(S||H.signal.aborted)return;let V=C.current&&!b.pending;if(f(b),V&&b.connected)Jr(t).catch((R)=>z(R,"刷新模型列表失败"))},()=>{})};return O.current=setInterval(P,un),()=>{if(S=!0,O.current)clearInterval(O.current);E.current?.abort()}},[t,r?.pending,f]);let N=v(async()=>{if(!c.trim())return;M(!0),g(void 0),x.current=!0;let S=++L.current;E.current?.abort();try{let P=await t.completeProviderAuth({url:c.trim()});if(S!==L.current)return;f(P),D("")}catch(P){if(S!==L.current)return;g(P instanceof Error?P.message:String(P)),I("error")}finally{if(x.current=!1,S===L.current)M(!1)}},[t,c,f]),T=v(async()=>{M(!0),g(void 0);try{await t.logoutProvider(),f({providerID:"openai",connected:!1,pending:!1}),I("idle"),await Jr(t)}catch(S){g(S instanceof Error?S.message:String(S)),I("error")}finally{M(!1)}},[t,f]),A=v(()=>{I("idle"),g(void 0),D("")},[]);return{status:r,busy:y,phase:B,error:h,manualURL:c,setManualURL:D,start:W,submitManual:N,logout:T,reset:A}}function wt(t){let{phase:i,busy:r}=t;if(t.connected)return n("div",{className:"flex items-center justify-between gap-3",children:[n("span",{className:"inline-flex items-center gap-1.5 text-xs text-success",children:[e("span",{className:"size-1.5 rounded-full bg-success"}),"已连接"]}),e(_,{variant:"ghost",className:"text-faint hover:text-danger",disabled:r,onClick:t.onLogout,children:r?"正在断开…":"断开连接"})]});return n(U.div,{layout:!0,className:"flex flex-col gap-3",children:[(i==="idle"||i==="success"||i==="error")&&n("div",{className:"flex flex-wrap items-center gap-2",children:[e(_,{disabled:r,onClick:t.onStart,children:r?"正在启动…":"登录 ChatGPT"}),i==="error"&&e(_,{variant:"ghost",className:"text-faint",onClick:t.onRetry,children:"重试"})]}),i==="authorizing"&&n("p",{className:"text-xs text-faint",children:["请在浏览器中完成授权。",t.authorizeURL&&n(m,{children:["未自动打开?",e("a",{href:t.authorizeURL,target:"_blank",rel:"noopener noreferrer",className:"ml-1 text-accent hover:underline",children:"手动打开"})]})]}),i==="awaiting_input"&&n("form",{className:"flex flex-col gap-2",onSubmit:(d)=>{d.preventDefault(),t.onSubmitManual()},children:[e("label",{htmlFor:"provider-auth-callback",className:"text-xs text-faint",children:t.instructions??"粘贴浏览器完成授权后跳转的完整 URL"}),e("input",{id:"provider-auth-callback",type:"url",className:"h-9 rounded-lg border border-line bg-raised px-3 text-xs text-ink outline-none placeholder:text-faint focus:border-accent",placeholder:"http://localhost:1455/auth/callback?code=…",value:t.manualURL,onChange:(d)=>t.onManualURLChange(d.target.value)}),e(_,{type:"submit",disabled:r||!t.manualURL.trim(),children:r?"正在提交…":"完成登录"})]}),i==="error"&&t.error&&e(yt,{children:t.error})]})}function Nt(t){let i=St(t.conn),r=i.status?.connected??!1;return e(ne,{title:"ChatGPT 订阅",description:"使用 ChatGPT 账号登录,访问你的订阅所包含的模型。登录由服务端完成,凭据不会离开服务器。",children:e(U.div,{layout:!0,className:"flex flex-col gap-3",children:e(Y,{title:r?"ChatGPT 账号":"连接 ChatGPT",description:r?`你好,${i.status?.displayName??"ChatGPT 用户"}`:"支持 ChatGPT Plus / Pro 订阅账号",children:e(wt,{connected:r,phase:i.phase,busy:i.busy,error:i.error,authorizeURL:i.status?.authorizeURL,instructions:i.status?.instructions,manualURL:i.manualURL,onManualURLChange:i.setManualURL,onStart:()=>void i.start(),onSubmitManual:()=>void i.submitManual(),onLogout:()=>void i.logout(),onRetry:i.reset})})})})}var He="off";function kt({conn:t}){let[i,r]=a(),[d,y]=a({models:[]});s(()=>{let h=new AbortController;return Promise.all([t.request("/api/folding/settings",{signal:h.signal}),t.models()]).then(([g,c])=>{if(h.signal.aborted)return;r(g),y(c)}).catch((g)=>{if(!h.signal.aborted)z(g,"读取折叠设置失败")}),()=>h.abort()},[t]);async function M(h){let g=i;r({digestModel:h});try{r(await t.request("/api/folding/settings",{method:"PUT",body:JSON.stringify({digestModel:h})}))}catch(c){r(g),z(c,"保存折叠设置失败")}}let B=i?.digestModel??null,I={models:[{id:He,name:"不使用"},...d.models.filter((h)=>h.available===!0||h.id===B)]};return e(ne,{title:"上下文折叠",children:e(Y,{title:"折叠摘要模型",description:"每轮结束后提炼关键事实,折叠后保留。建议选快速模型。",children:e("div",{className:"w-56",children:e(ea,{variant:"field",trustedOnly:!0,models:I,value:B??He,onChange:(h)=>{if(i)M(h===He?null:h).catch(()=>{return})}})})})})}function Ct(t){k();let i=ee(),[r,d]=a(""),[y,M]=a(0),[B,I]=a(null),[h,g]=a({name:"",contextWindow:"",maxTokens:""}),[c,D]=a(!1),[C,E]=a(),O=(S)=>{I(S),g({name:S.name,contextWindow:S.contextWindow?Rt(S.contextWindow):"",maxTokens:S.maxTokens?Rt(S.maxTokens):""}),E(void 0)},L=async(S)=>{if(S?.preventDefault(),!B||c)return;E(void 0);let P=h.contextWindow.trim(),H=P?Cr(P):void 0;if(P&&H===void 0){E("上下文窗口格式无效(支持 128k、200k、1m 或正整数)");return}let b=h.maxTokens.trim(),V=b?Cr(b):void 0;if(b&&V===void 0){E("最大输出格式无效(支持 8k、16k、8192 或正整数)");return}D(!0);try{let R={...B,name:h.name.trim()||B.id,contextWindow:H,maxTokens:V};await t.onUpdateModel?.(B.id,R),I(null)}catch(R){E(R instanceof Error?R.message:String(R))}finally{D(!1)}},x=r.trim().toLowerCase(),f=uc(t.provider.models).filter((S)=>`${S.id} ${S.name}`.toLowerCase().includes(x)),W=6,N=Math.max(1,Math.ceil(f.length/W)),T=Math.min(y,N-1),A=f.slice(T*W,(T+1)*W);return n(Ee,{children:[n("div",{className:p("surface.card","flex min-w-0 items-center gap-1 pr-2 transition-colors hover:bg-raised/60"),children:[n(Le,{className:"group/collapsible flex min-h-14 min-w-0 flex-1 items-center gap-3 py-2.5 pl-4 text-left focus-visible:-outline-offset-2",children:[e(Ve,{className:"shrink-0 text-faint"}),n("span",{className:"min-w-0 flex-1",children:[n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate text-sm font-medium text-ink",title:t.provider.name,children:t.provider.name}),t.provider.untrusted&&n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-warning",title:"只能对话或委派给受信模型:不加载工具、技能与 MCP,不注入运行环境",children:[e(Ut,{"aria-hidden":!0,className:"size-3.5"}),"不受信"]}),!t.provider.apiKeyConfigured&&n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-warning",children:[e("span",{"aria-hidden":!0,className:"size-1.5 rounded-full bg-warning"}),"未设置 Key"]})]}),n("span",{className:"mt-0.5 block truncate text-xs text-dim",children:[t.provider.id!==t.provider.name&&n(m,{children:[t.provider.id," · "]}),t.provider.protocol," · ",t.provider.models.length," 个模型",t.provider.defaultContextWindow?` · 默认 ${Rt(t.provider.defaultContextWindow)}`:""]})]})]}),e("div",{className:"@md/panel:hidden",children:n(sn,{className:"min-w-44 [&_[role=menuitem]]:min-h-11",trigger:e(_,{size:"icon",variant:"ghost",className:"size-11","aria-label":`${t.provider.name} 提供方操作`,children:e(Jt,{className:"size-5"})}),children:[e(ke,{icon:e(gt,{}),onSelect:t.onEdit,children:"编辑配置"}),e(ke,{icon:e(ge,{className:t.refreshing?"animate-spin":void 0}),disabled:t.refreshing,onSelect:t.onDiscover,children:t.refreshing?"正在刷新模型":"刷新模型"}),e(gr,{}),e(ke,{icon:e(xe,{}),danger:!0,onSelect:t.onRemove,children:"移除提供方"})]})}),n("div",{className:"hidden shrink-0 items-center @md/panel:flex",children:[e(G,{label:"编辑",className:"size-10",onClick:t.onEdit,children:e(gt,{className:"size-4"})}),e(G,{label:"刷新模型",className:"size-10",disabled:t.refreshing,onClick:t.onDiscover,children:e(ge,{className:u("size-4",t.refreshing&&"animate-spin")})}),e(G,{label:"移除",className:"size-10 text-danger",onClick:t.onRemove,children:e(xe,{className:"size-4"})})]})]}),e("div",{children:e(Se,{children:n("div",{children:[n("div",{className:"relative my-3 min-w-0",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),e(te,{type:"search","aria-label":`搜索 ${t.provider.name} 的模型`,placeholder:"搜索模型",value:r,onChange:(S)=>{d(S.target.value),M(0)},className:"h-10 min-w-0 pl-9"})]}),n("div",{className:"overflow-hidden rounded-2xl border border-line bg-panel",children:[e("div",{className:"auto-grid animate-fade gap-x-2 p-2",children:A.map((S)=>{let P="";if(S.contextWindow){let H=S.contextWindow.toLocaleString(),b=S.maxTokens?` (最大输出: ${S.maxTokens.toLocaleString()})`:"";P=`上下文窗口: ${H} tokens${b}`}return n("button",{type:"button",onClick:()=>O(S),className:"group/model flex min-w-0 items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-raised/80 focus-visible:outline-accent",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(We,{modelID:`${t.provider.id}/${S.id}`}),n("div",{className:"min-w-0",children:[e("div",{title:S.name,className:"truncate text-sm font-medium text-ink transition-colors group-hover/model:text-accent",children:S.name}),e("div",{title:S.id,className:"truncate font-mono text-2xs text-faint",children:S.id})]})]}),n("div",{className:"flex shrink-0 items-center gap-1.5",children:[S.contextWindow?e("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-3xs text-dim transition-colors group-hover/model:bg-panel",title:P,children:Rt(S.contextWindow)}):null,e(gt,{className:"size-3 text-faint opacity-0 transition-opacity group-hover/model:opacity-100"})]})]},S.id)})},`${x}:${T}`),f.length===0&&e("p",{className:"py-4 text-center text-sm text-faint",children:"没有匹配的模型"}),n("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-4 py-1",children:[n("span",{"aria-live":"polite",className:"text-xs text-faint",children:[f.length," 个模型 · ",T+1," / ",N," 页"]}),n("div",{className:"flex gap-1",children:[e(_,{size:"sm",variant:"ghost",disabled:T===0,onClick:()=>M(T-1),children:"上一页"}),e(_,{size:"sm",variant:"ghost",disabled:T+1>=N,onClick:()=>M(T+1),children:"下一页"})]})]})]})]})})}),e(qt,{open:Boolean(B),onOpenChange:(S)=>{if(!c&&!S)I(null)},title:"配置模型参数",description:B?n("span",{className:"flex items-center gap-1.5 font-mono text-xs",children:[e("span",{children:t.provider.name}),e("span",{children:"/"}),e("span",{className:"font-semibold text-ink",children:B.id})]}):void 0,size:"md",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(_,{disabled:c,onClick:()=>I(null),children:"取消"}),e(_,{type:"submit",form:i,loading:c,variant:"primary",children:"保存参数"})]}),children:n(At,{id:i,onSubmit:L,children:[e(ie,{label:"显示名称",hint:"在模型选择器与对话界面中显示的名称",children:(S)=>e(te,{id:S,value:h.name,onChange:(P)=>g({...h,name:P.target.value}),placeholder:B?.id})}),e(ie,{label:"上下文窗口 (Context Window)",hint:"单次会话最大可用上下文;留空继承提供方默认",children:(S)=>{let P=t.provider.defaultContextWindow?`继承提供方默认 (${Rt(t.provider.defaultContextWindow)})`:"继承系统默认 (300k)";return n("div",{className:"space-y-1.5",children:[e(te,{id:S,value:h.contextWindow,onChange:(H)=>g({...h,contextWindow:H.target.value}),placeholder:P}),n("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[e("span",{className:"text-2xs text-faint",children:"常用:"}),["128k","200k","500k","1m","2m"].map((H)=>e("button",{type:"button",onClick:()=>g((b)=>({...b,contextWindow:H})),className:u("rounded px-1.5 py-0.5 font-mono text-2xs transition-colors",h.contextWindow.toLowerCase()===H?"bg-accent/20 font-medium text-accent":"bg-raised text-dim hover:bg-raised/80 hover:text-ink"),children:H},H)),h.contextWindow&&e("button",{type:"button",onClick:()=>g((H)=>({...H,contextWindow:""})),className:"ml-1 text-2xs text-faint transition-colors hover:text-ink",children:"清空(继承)"})]})]})}}),e(ie,{label:"最大输出 (Max Tokens)",hint:"单次响应最大生成的 Token 数量;留空继承提供方默认",children:(S)=>{let P=t.provider.defaultMaxTokens?`继承提供方默认 (${Rt(t.provider.defaultMaxTokens)})`:"继承系统默认 (64k)";return n("div",{className:"space-y-1.5",children:[e(te,{id:S,value:h.maxTokens,onChange:(H)=>g({...h,maxTokens:H.target.value}),placeholder:P}),n("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[e("span",{className:"text-2xs text-faint",children:"常用:"}),["16k","32k","64k","128k"].map((H)=>e("button",{type:"button",onClick:()=>g((b)=>({...b,maxTokens:H})),className:u("rounded px-1.5 py-0.5 font-mono text-2xs transition-colors",h.maxTokens.toLowerCase()===H?"bg-accent/20 font-medium text-accent":"bg-raised text-dim hover:bg-raised/80 hover:text-ink"),children:H},H)),h.maxTokens&&e("button",{type:"button",onClick:()=>g((H)=>({...H,maxTokens:""})),className:"ml-1 text-2xs text-faint transition-colors hover:text-ink",children:"清空(继承)"})]})]})}}),e(yt,{children:C})]})})]})}function Mt(t){return k(),n(m,{children:[e(Nt,{conn:t.conn}),e(mn,{...t}),e(kt,{conn:t.conn})]})}var ye=new WeakMap;function Tt(){return{id:"",name:"",protocol:"openai-completions",baseUrl:"https://api.openai.com/v1",apiKey:"",models:[],defaultContextWindow:"",defaultMaxTokens:"",untrusted:!1}}function mn(t){k();let i=le(t.conn.state),r=ee(),[d,y]=a(!1),[M,B]=a(()=>ye.get(t.conn)??null),[I,h]=a(),[g,c]=a(!1),[D,C]=a(),[E,O]=a(),[L,x]=a(Tt),f=_s(t.conn).kind==="form",W=()=>{y(!1),na(t.conn,"form",{kind:"provider"})};s(()=>()=>na(t.conn,"form",{kind:"provider"}),[t.conn]),s(()=>{let b=ye.get(t.conn);if(b)B(b);if(i.status!=="open")return;let V=!1;return t.conn.modelProviders().then((R)=>{if(ye.set(t.conn,R),!V)B(R)}).catch((R)=>{if(!V)h(R instanceof Error?R.message:String(R))}),()=>{V=!0}},[t.conn,i.status]);let N=async()=>{if(g)return;h(void 0);let b=L.defaultContextWindow.trim(),V=b?Cr(b):void 0;if(b&&V===void 0){h("默认上下文窗口格式无效(支持 128k、200k、1m 或正整数)");return}let R=L.defaultMaxTokens.trim(),J=R?Cr(R):void 0;if(R&&J===void 0){h("默认最大输出格式无效(支持 8k、16k、8192 或正整数)");return}c(!0);try{let F={name:L.name.trim()||L.id.trim(),protocol:L.protocol,baseUrl:L.baseUrl,apiKey:L.apiKey,models:sc(L.models),defaultContextWindow:V,defaultMaxTokens:J,untrusted:L.untrusted},j=await t.conn.saveModelProvider(L.id.trim(),F);B((X)=>{let Q=[...(X??[]).filter((Z)=>Z.id!==j.id),j];return ye.set(t.conn,Q),Q}),await Jr(t.conn),y(!1),na(t.conn,"form",{kind:"saved",providerID:j.id,models:j.models.length})}catch(F){h(F instanceof Error?F.message:String(F))}finally{c(!1)}},T=(b)=>{O(b.id),x({id:b.id,name:b.name,protocol:b.protocol,baseUrl:b.baseUrl,apiKey:"",defaultContextWindow:b.defaultContextWindow?Rt(b.defaultContextWindow):"",defaultMaxTokens:b.defaultMaxTokens?Rt(b.defaultMaxTokens):"",models:b.models,untrusted:b.untrusted}),h(void 0),y(!0)},A=()=>{O(void 0),x(Tt())},S=async(b)=>{h(void 0),C(b.id);try{let V=await t.conn.discoverModelProvider(b.id);B((R)=>R?.map((J)=>J.id===V.id?V:J)??[V]),await Jr(t.conn)}catch(V){h(V instanceof Error?V.message:String(V))}finally{C(void 0)}},P=async(b)=>{if(!await Ge({title:`移除提供方「${b.name}」?`,description:"服务端会删除保存的 API key,并恢复同名内置提供方(如果存在)。",action:"移除",danger:!0}))return;try{await t.conn.removeModelProvider(b.id),B((R)=>R?.filter((J)=>J.id!==b.id)??null),await Jr(t.conn)}catch(R){h(R instanceof Error?R.message:String(R))}},H=async(b,V,R)=>{let J=b.models.map((X)=>X.id===V?R:X),F={name:b.name,protocol:b.protocol,baseUrl:b.baseUrl,apiKey:"",defaultContextWindow:b.defaultContextWindow,defaultMaxTokens:b.defaultMaxTokens,untrusted:b.untrusted,models:sc(J)},j=await t.conn.saveModelProvider(b.id,F);B((X)=>{let Q=X?.map((Z)=>Z.id===j.id?j:Z)??[j];return ye.set(t.conn,Q),Q}),await Jr(t.conn)};return n(ne,{title:"模型提供方",description:"配置提供方与模型目录",unboxed:!0,action:e(G,{className:"size-10",label:"添加提供方","data-tour":"add-provider",disabled:i.status!=="open",onClick:()=>{A(),h(void 0),y(!0),na(t.conn,"provider",{kind:"form"})},children:e(be,{className:"size-4"})}),children:[e(pe,{initial:!1,children:(M??[]).map((b)=>e(U.div,{...Sa,className:"overflow-hidden","data-tour-provider":b.id,children:e(Ct,{provider:b,refreshing:D===b.id,onEdit:()=>T(b),onDiscover:()=>void S(b),onRemove:()=>void P(b),onUpdateModel:(V,R)=>H(b,V,R)})},b.id))}),M?.length===0&&e("div",{className:p("surface.emptyDashed","py-12"),children:e("p",{className:"text-sm text-dim",children:"暂无模型提供方,点击右上方按钮添加。"})}),!d&&I&&e("div",{className:"p-4",children:e(yt,{children:I})}),e(qt,{open:d,onOpenChange:(b)=>{if(!g)if(b)y(!0);else W()},title:E?`编辑提供方:${E}`:"添加模型提供方",size:"lg",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(_,{disabled:g,onClick:W,children:"取消"}),n(_,{type:"submit",form:r,loading:g,disabled:i.status!=="open","aria-label":g?"保存中":"保存提供方",children:[e(Me,{className:"size-3.5"}),"保存提供方"]})]}),children:n(At,{id:r,onSubmit:(b)=>{b.preventDefault(),N()},children:[f&&n("div",{className:"rounded-lg bg-accent/8 px-3 py-2.5 text-xs leading-5 text-dim ring-1 ring-accent/25",children:[e("span",{className:"mr-1.5 font-medium text-ink tabular-nums",children:"3 / 4"}),"Provider ID 起个好记的名字(如 deepseek),协议和 Base URL 按服务商文档填,再填上 API key。模型列表留空会自动获取,最后点「保存提供方」。"]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(ie,{label:"Provider ID",hint:"例如 openai、deepseek 或公司内部网关",children:(b)=>e(te,{id:b,value:L.id,disabled:Boolean(E),onChange:(V)=>x({...L,id:V.target.value}),placeholder:"openai"})}),e(ie,{label:"显示名称",hint:"不填就用 Provider ID",children:(b)=>e(te,{id:b,value:L.name,onChange:(V)=>x({...L,name:V.target.value}),placeholder:"OpenAI"})})]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(ie,{label:"协议",children:(b)=>e(tn,{id:b,value:L.protocol,onValueChange:(V)=>x({...L,protocol:V}),groups:[{options:Oc.map((V)=>({value:V,label:$c[V]}))}]})}),e(ie,{label:"Base URL",hint:"只填写协议端点,不要把 API key 放进 URL",children:(b)=>e(te,{id:b,type:"url",value:L.baseUrl,onChange:(V)=>x({...L,baseUrl:V.target.value}),placeholder:"https://api.example.com/v1"})})]}),e(ie,{label:"API key",hint:"留空表示保留已保存的 key;本地兼容服务可以留空",children:(b)=>e(te,{id:b,type:"password",value:L.apiKey,onChange:(V)=>x({...L,apiKey:V.target.value}),placeholder:"sk-…",autoComplete:"new-password"})}),n("div",{className:u("flex items-start justify-between gap-4 rounded-xl border border-line bg-bg/60 px-4 py-3",L.untrusted&&"border-warning/45 bg-warning/8"),children:[n("span",{className:"min-w-0",children:[e("span",{className:"block text-sm text-ink",children:"不受信的服务商"}),e("span",{className:"mt-0.5 block text-xs text-dim",children:"非官方或来源不明的服务商。开启后它的模型拿不到工具、技能、MCP、运行环境和项目信息,只能对话,或把需要动手的活委派给受信服务商的模型"})]}),e(Ye,{label:"不受信的服务商",checked:L.untrusted,onCheckedChange:(b)=>x({...L,untrusted:b}),className:"mt-0.5 shrink-0"})]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(ie,{label:"默认上下文窗口",hint:"模型未单独指定时生效,例如 128k、200k、1m 或正整数",children:(b)=>e(te,{id:b,value:L.defaultContextWindow,onChange:(V)=>x({...L,defaultContextWindow:V.target.value}),placeholder:"300k"})}),e(ie,{label:"默认最大输出",hint:"单次回复生成上限,例如 16k、32k、64k 或正整数",children:(b)=>e(te,{id:b,value:L.defaultMaxTokens,onChange:(V)=>x({...L,defaultMaxTokens:V.target.value}),placeholder:"64k"})})]}),e(ie,{label:"模型列表",hint:"留空保存将从 Base URL 自动获取;也可在此手动添加或删除模型",children:(b)=>e(fn,{inputId:b,providerID:L.id.trim(),models:L.models,onChange:(V)=>x({...L,models:V})})}),e(yt,{children:I})]})})]})}function fn(t){let[i,r]=a(""),[d,y]=a(""),M=(g=i)=>{let c=g.split(/[\r\n;]+|,(?![^[\]]*\])/).map((O)=>O.trim()).filter(Boolean).join(`
|
|
2
|
-
`),D=Bc(c);if(D.length===0)return;let C=new Set(t.models.map((O)=>O.id)),E=D.filter((O)=>{if(C.has(O.id))return!1;return C.add(O.id),!0});if(E.length>0)t.onChange([...t.models,...E]);r("")},B=(g)=>{t.onChange(t.models.filter((c)=>c.id!==g))},I=d.trim().toLowerCase(),h=I?t.models.filter((g)=>`${g.id} ${g.name}`.toLowerCase().includes(I)):t.models;return n("div",{className:"space-y-2",children:[n("div",{className:"flex gap-2",children:[e(te,{id:t.inputId,value:i,onChange:(g)=>r(g.target.value),onKeyDown:(g)=>{if(g.key==="Enter")g.preventDefault(),M()},onPaste:(g)=>{let c=g.clipboardData.getData("text");if(/[\r\n,;]/.test(c))g.preventDefault(),M(c)},placeholder:"输入模型 ID(回车添加,支持逗号或换行批量粘贴)",className:"min-w-0 flex-1"}),n(_,{type:"button",disabled:!i.trim(),onClick:()=>M(),children:[e(be,{className:"size-3.5"}),"添加"]})]}),t.models.length===0?e("div",{className:"rounded-xl border border-dashed border-line bg-bg/40 px-3 py-3 text-center text-xs text-dim",children:"暂无手动指定模型,保存后将从 Base URL 自动获取"}):n("div",{className:"overflow-hidden rounded-xl border border-line bg-bg/50",children:[n("div",{className:"flex items-center justify-between gap-2 border-b border-line px-3 py-1.5 text-xs text-dim",children:[n("span",{children:["共 ",t.models.length," 个模型"]}),e("button",{type:"button",onClick:()=>{t.onChange([]),y("")},className:"text-dim transition-colors hover:text-danger",children:"清空列表"})]}),t.models.length>5&&n("div",{className:"relative border-b border-line px-2 py-1.5",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3.5 left-4.5 size-3.5 text-faint"}),e(te,{type:"search",value:d,onChange:(g)=>y(g.target.value),placeholder:"筛选已添加的模型","aria-label":"筛选已添加的模型",className:"h-8 pl-8 text-xs"})]}),n("div",{className:"max-h-48 divide-y divide-line/60 overflow-y-auto",children:[h.map((g)=>{let c=[g.contextWindow?Rt(g.contextWindow):null,g.maxTokens?Rt(g.maxTokens):null].filter(Boolean).join(" / ");return n("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 text-sm hover:bg-raised/60",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(We,{modelID:t.providerID?`${t.providerID}/${g.id}`:g.id,className:"size-4 shrink-0"}),e("span",{className:"truncate font-mono text-xs text-ink",title:g.id,children:g.id}),g.name!==g.id&&e("span",{className:"truncate text-xs text-dim",title:g.name,children:g.name})]}),n("div",{className:"flex shrink-0 items-center gap-2",children:[c&&e("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-2xs text-dim",children:c}),e("button",{type:"button","aria-label":`移除模型 ${g.id}`,onClick:()=>B(g.id),className:"rounded p-1 text-faint transition-colors hover:bg-raised hover:text-danger",children:e(ce,{className:"size-3.5"})})]})]},g.id)}),h.length===0&&e("p",{className:"py-3 text-center text-xs text-faint",children:"没有匹配的模型"})]})]})]})}function pn(t){return!(t.web?.some((r)=>r.kind==="tab")??!1)&&bs(t.id,"settings")}function Dt(t){let i={tools:[],commands:[],pages:[],routes:[],hooks:[],others:[]},r=new Map((t.web??[]).map((d)=>[d.id,d]));for(let d of t.registrations)switch(d.kind){case"tool":{i.tools.push(d.name);break}case"command":{let y=r.get(d.id)?.commandTitle??r.get(d.id)?.title??d.id;i.commands.push(y);break}case"web":{let y=r.get(d.id);if(y?.kind==="sidebar")i.pages.push(`侧栏: ${y.title}`);else if(y?.kind!=="command")i.pages.push(y?.title??d.id);break}case"route":{i.routes.push({method:d.method,path:d.path});break}case"websocket":{i.routes.push({method:"WS",path:d.path});break}case"hook":{i.hooks.push(d.name);break}case"policy":{i.others.push(`策略 ${d.id}`);break}case"history-resolver":{i.others.push("历史解析");break}}return i}function Ke(t){let i=new Map(t.map((c)=>[c.id,c])),r=new Map,d=new Map;for(let c of t){let D=(c.deps??[]).filter((C)=>C!==c.id);r.set(c.id,D);for(let C of D){let E=d.get(C)??[];if(!E.includes(c.id))E.push(c.id),d.set(C,E)}}let y=new Set;for(let[c,D]of r.entries())if(D.length>0)y.add(c);for(let[c,D]of d.entries())if(D.length>0)y.add(c);let M=[];for(let c of t)if(!y.has(c.id))M.push(c);let B=[],I=new Set;for(let c of y){let D=r.get(c)??[],C=d.get(c)??[],E=i.get(c);if(!E)continue;if(D.length===0&&C.length>0)B.push(E)}for(let c of y){let D=i.get(c);if(!D)continue;if(!(r.get(c)??[]).some((O)=>i.has(O))&&!B.some((O)=>O.id===c))B.push(D)}function h(c,D,C){I.add(c.id);let E=[...C,c.id],O=d.get(c.id)??[],L=[];for(let x of O){if(E.includes(x))continue;let f=i.get(x);if(f)L.push(h(f,D+1,E))}return{plugin:c,depth:D,depPath:E,children:L}}let g=B.map((c)=>h(c,0,[]));for(let c of y)if(!I.has(c)){let D=i.get(c);if(D)g.push(h(D,0,[]))}return{trees:g,standalones:M,depsMap:r,dependentsMap:d}}var gn=2400;function vn(t){let{plugin:i,busy:r,pending:d,reloaded:y,deps:M,offDeps:B,pluginMetadata:I,onSelect:h,onToggle:g,onConfigure:c}=t,D=I.get(i.id),C=D?.icon??Ht,E=i.status==="error",O=i.status==="disabled",L=!O&&pn(i),x=D?.description??i.description??"",f=x;if(d)f=e("span",{className:"animate-pulse text-dim",children:O?"卸载中…":"装载中…"});else if(E)f=e("span",{className:"text-danger/85",children:i.error??"加载失败"});else if(y)f=e("span",{className:"text-success",children:"刚刚已重载"});else if(O&&B.length>0)f=`随 ${B.join("、")} 停用`;return e(Xi,{name:e("span",{className:u(E&&"text-danger"),children:i.id}),selectLabel:`查看插件 ${i.id}`,onSelect:()=>h(i),title:E?i.error:x,meta:`v${i.version}`,description:f,icon:e(C,{}),inactive:O,highlight:y,aside:M.length>0&&n("span",{className:"font-mono text-2xs text-faint",title:"依赖的插件",children:["← ",M.join(" ")]}),actions:L&&e(G,{label:`${i.id} 设置`,size:"icon-sm",onClick:()=>c(i),children:e(vt,{className:"size-3.5"})}),toggle:{checked:!O,label:`启用 ${i.id}`,disabled:r,onCheckedChange:()=>g(i)}})}function It(t){return n("li",{className:"flex h-8 items-center gap-2 bg-raised/30 px-4 font-mono text-2xs text-faint uppercase tracking-wider",children:[t.label,e("span",{className:"text-faint/60",children:t.count})]})}function Lt(t){let{plugins:i,busy:r,pending:d,query:y,pluginMetadata:M,onSelect:B,onToggle:I,onConfigure:h}=t,g=w(()=>Ke(i),[i]),c=y.trim().toLowerCase(),D=o(new Map),C=o(new Set),[E,O]=a(new Set);s(()=>{let A=[];for(let P of i){if(D.current.has(P.id)&&P.webRevision&&D.current.get(P.id)!==P.webRevision)A.push(P.id);D.current.set(P.id,P.webRevision)}if(A.length===0)return;O((P)=>new Set([...P,...A]));let S=setTimeout(()=>{C.current.delete(S),O((P)=>new Set([...P].filter((H)=>!A.includes(H))))},gn);C.current.add(S)},[i]),s(()=>{let A=C.current;return()=>{for(let S of A)clearTimeout(S)}},[]);let L=w(()=>[...!c?i:i.filter((S)=>S.id.toLowerCase().includes(c)||(S.description??"").toLowerCase().includes(c)||(M.get(S.id)?.description??"").toLowerCase().includes(c))].sort((S,P)=>S.id.localeCompare(P.id,"en")),[i,c,M]);if(L.length===0)return n("p",{className:"p-6 text-center text-dim text-sm",children:["没有匹配「",y.trim(),"」的插件"]});let x=new Map(i.map((A)=>[A.id,A.status])),f=L.filter((A)=>!A.builtin),W=L.filter((A)=>A.builtin),N=f.length>0&&W.length>0;function T(A){let S=g.depsMap.get(A.id)??[];return e("li",{children:e(vn,{plugin:A,busy:r,pending:d===A.id,reloaded:E.has(A.id),deps:S,offDeps:S.filter((P)=>x.get(P)==="disabled"),pluginMetadata:M,onSelect:B,onToggle:I,onConfigure:h})},A.id)}return n("ul",{className:"divide-y divide-line",children:[N&&e(It,{label:"用户",count:f.length}),f.map(T),N&&e(It,{label:"内置",count:W.length}),W.map(T)]})}function Et(){return new Map(Re().map((t)=>[t.id,t.metadata]))}var ze=Et();bn(()=>{ze=Et()});var xn={enabled:{label:"已启用",dot:"bg-success"},disabled:{label:"已禁用",dot:"bg-faint"},error:{label:"出错",dot:"bg-danger"}};function hn(t){return!(t.web?.some((r)=>r.kind==="tab")??!1)&&bs(t.id,"settings")}function yn(t){Te();let{plugin:i,depsMap:r,dependentsMap:d}=t,y=w(()=>Dt(i),[i]),M=i.status==="disabled",B=y.hooks.length>0||y.routes.length>0||y.others.length>0,I=y.pages.length>0||y.tools.length>0||y.commands.length>0,h=(r?.get(i.id)??i.deps??[]).filter((c)=>c!==i.id),g=d?.get(i.id)??[];return n("div",{className:"space-y-3 text-xs leading-5",children:[ve.errors.get(i.id)&&n("p",{role:"alert",className:"text-danger",children:["Web: ",ve.errors.get(i.id)]}),i.error&&n("div",{role:"alert",className:"rounded-xl bg-danger/8 p-3 text-xs leading-5 text-danger",children:[e("p",{className:"mb-1 font-medium font-sans",children:i.status==="enabled"?"重载失败,仍在运行上一版本":"插件加载异常"}),e("pre",{className:"whitespace-pre-wrap font-mono [overflow-wrap:anywhere]",children:i.error})]}),n(gs,{children:[h.length>0&&e(ta,{label:"依赖",children:h.map((c)=>{let C=(t.plugins??[]).find((E)=>E.id===c)?.status==="disabled";return e("button",{type:"button",onClick:()=>t.onSelectPlugin?.(c),className:u(yi,"cursor-pointer transition-colors hover:text-ink",C&&"text-warning"),title:C?"依赖插件已停用,可能影响功能":"点击查看该插件",children:C?`${c}(未启用)`:c},c)})}),g.length>0&&e(ta,{label:"被依赖",children:g.map((c)=>e("button",{type:"button",onClick:()=>t.onSelectPlugin?.(c),className:u(yi,"cursor-pointer transition-colors hover:text-ink"),title:"点击查看依赖此插件的下游插件",children:c},c))}),M?e("p",{className:"py-2.5 text-faint",children:"该插件当前处于停用状态,启用后接管对应功能与服务。"}):n(m,{children:[y.pages.length>0&&e(ta,{label:"界面",children:y.pages.map((c)=>e(bi,{children:c},c))}),y.tools.length>0&&e(ta,{label:"工具",children:y.tools.map((c)=>e(bi,{mono:!0,children:c},c))}),y.commands.length>0&&e(ta,{label:"命令",children:y.commands.map((c)=>e(bi,{children:c},c))}),B&&n(vs,{label:"接口",summary:[y.hooks.length>0&&`${y.hooks.length} 个钩子`,y.routes.length>0&&`${y.routes.length} 条路由`,y.others.length>0&&`${y.others.length} 项其他注册`].filter(Boolean).join(","),children:[y.hooks.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"生命周期事件钩子"}),e("div",{className:"flex flex-wrap gap-1.5",children:y.hooks.map((c)=>e("span",{className:u(yi,"font-mono text-2xs"),children:c},c))})]}),y.routes.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"HTTP / WebSocket 路由"}),e("div",{className:"space-y-0.5 font-mono text-2xs text-dim",children:y.routes.map((c)=>n("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] gap-2",children:[e("span",{className:"text-faint",children:c.method}),e("span",{className:"[overflow-wrap:anywhere]",children:c.path})]},`${c.method} ${c.path}`))})]}),y.others.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"其他注册"}),e("div",{className:"flex flex-wrap gap-1.5",children:y.others.map((c)=>e("span",{className:u(yi,"text-2xs"),children:c},c))})]})]}),!I&&!B&&!i.error&&e("p",{className:"py-2.5 text-faint",children:"该插件没有向外部暴露界面或工具能力"})]})]}),t.failed&&e("p",{role:"alert",className:"text-xs text-danger",children:t.failed})]})}function Sn(){return e("div",{role:"status","aria-label":"正在加载",className:"divide-y divide-line",children:[0,1,2,3,4].map((t)=>n("div",{className:"flex h-13 items-center gap-3 px-4",children:[e("div",{className:"size-7 shrink-0 animate-pulse rounded-md bg-raised"}),e("div",{className:"h-3 w-20 animate-pulse rounded bg-raised"}),e("div",{className:"h-3 w-1/3 animate-pulse rounded bg-raised"})]},t))})}function $t({conn:t}){k(),Te();let[i,r]=a(()=>{let R=t.state.get();return R.pluginsLoaded?R.plugins:void 0}),[d,y]=a(""),[M,B]=a(),[I,h]=a(),[g,c]=a(""),[D,C]=a(),[E,O]=a("details"),[L,x]=a(null),f=o(0),W=o(!1),N=o({}),T=v(()=>{if(W.current)return;let R=++f.current;y(""),t.plugins().then(()=>{if(R===f.current)r(t.state.get().plugins)},(J)=>{if(R===f.current)y(je(J))})},[t]);s(()=>{B(void 0);let R=t.state.get().plugins,J=t.state.subscribe((F)=>{if(F.plugins===R)return;R=F.plugins,r(F.plugins)});return T(),()=>{J(),f.current++,W.current=!1}},[T,t]);async function A(R,J){if(W.current)return;if(J){let Q=Date.now(),Z=N.current[R.id]??0;if(Q-Z<500)return;N.current[R.id]=Q}let F=++f.current;W.current=!0,B(R.id),h(void 0);let j=R.status==="disabled",X=R.id;try{if(J){if(await t.reloadPlugin(R.id),F===f.current)r(t.state.get().plugins);return}let Q=await t.plugins();if(F!==f.current)return;r(t.state.get().plugins);let Z=new Map(Q.map((q)=>[q.id,q])),ae=[],me=new Set,fe=new Set,he=(q)=>{if(fe.has(q))return;if(me.has(q))throw Error(`插件依赖存在循环:${q}`);let oe=Z.get(q);if(!oe)throw Error(`找不到插件依赖:${q}`);if(me.add(q),j){if(oe.status==="error")throw Error(`请先修复依赖插件 ${q} 的加载错误`);for(let se of oe.deps??[])he(se)}else for(let se of Q)if(se.status!=="disabled"&&se.deps?.includes(q))he(se.id);if(me.delete(q),fe.add(q),j?oe.status!=="enabled":oe.status!=="disabled")ae.push(oe)};he(R.id);let Ce=ae.filter((q)=>q.id!==R.id);if(Ce.length>0){let q=Ce.map((se)=>se.id).join("、");if(!await Ge({title:j?"同时启用依赖插件?":"同时禁用依赖此插件的插件?",description:j?`启用 ${R.id} 需要先启用:${q}。是否继续?`:`${q} 依赖 ${R.id},将先禁用这些插件,再禁用 ${R.id}。是否继续?`,action:j?"级联启用":"级联禁用",danger:!j}))return}for(let q of ae){if(F!==f.current)return;X=q.id,r((se)=>se?.map((Fe)=>Fe.id===q.id?{...Fe,status:j?"enabled":"disabled",error:void 0}:Fe));let oe=await t.enablePlugin(q.id,j);if(F!==f.current)return;if(r(t.state.get().plugins),oe.find((se)=>se.id===q.id)?.status!==(j?"enabled":"disabled"))throw Error(`插件 ${q.id} 未进入预期状态,请刷新后重试`)}}catch(Q){if(F!==f.current)return;let Z=J?"重载失败":`更新 ${X} 失败,后续操作已停止`;h({id:R.id,message:Z}),z(Q,Z);try{if(await t.plugins(),F===f.current)r(t.state.get().plugins)}catch(ae){if(F===f.current)y(`刷新插件状态失败:${je(ae)}`)}}finally{if(F===f.current)W.current=!1,B(void 0)}}let S=w(()=>Ke(i??[]),[i]),P=D?i?.find((R)=>R.id===D):void 0,H=o(void 0);if(P)H.current=P;let b=P??H.current,V=i?`内置 ${i.filter((R)=>R.builtin).length},用户 ${i.filter((R)=>!R.builtin).length}`:"";return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:"font-medium text-ui text-dim",children:"插件"}),e("p",{className:"mt-0.5 text-faint text-xs",children:V})]}),e(G,{label:"刷新",className:"size-10",disabled:M!==void 0,onClick:T,children:e(ge,{className:"size-4"})})]}),d&&n("div",{role:"alert",className:"mb-3 flex flex-wrap items-center gap-2 rounded-xl border border-line p-3",children:[n("p",{className:"min-w-0 flex-1 break-words text-danger text-sm",children:["无法读取插件:",d]}),e(_,{className:"h-10",onClick:T,children:"重试"})]}),n("div",{className:"relative mb-3 min-w-0",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),e(te,{type:"search","aria-label":"搜索插件",placeholder:"搜索插件",value:g,onChange:(R)=>c(R.target.value),className:"h-10 min-w-0 pl-9"})]}),e("div",{className:p("settings.groupBox"),children:!i?!d&&e(Sn,{}):e(Lt,{plugins:i,busy:M!==void 0,pending:M,query:g,pluginMetadata:ze,onSelect:(R)=>{C(R.id),O("details")},onToggle:(R)=>void A(R,!1),onConfigure:(R)=>{C(R.id),O("settings")}})})]}),e(qt,{open:Boolean(D),onOpenChange:(R)=>{if(!R)C(void 0),O("details")},size:"lg",title:b&&(E==="settings"?n("div",{className:"flex items-center gap-2",children:[n(_,{variant:"ghost",size:"sm",className:"h-7 px-1.5 text-xs text-dim hover:text-ink",onClick:()=>O("details"),children:[e(dr,{className:"mr-1 size-3.5"}),"返回详情"]}),n("span",{className:"font-semibold text-ink text-base",children:[b.id," 设置"]})]}):e(hs,{icon:(()=>{let R=ze.get(b.id)?.icon??Ht;return e(R,{})})(),name:b.id,meta:[b.builtin?"内置":"用户插件",`v${b.version}`,b.webBundle&&"Web"]})),description:b&&(E==="settings"?void 0:e("span",{className:"mt-2 block leading-5.5",children:ze.get(b.id)?.description??b.description})),footer:b&&(E==="settings"?e("div",{ref:x,className:"flex w-full flex-wrap items-center justify-end gap-2"}):n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:[&>*]:flex-none",children:[n("div",{className:"inline-flex items-center gap-2.5 text-ui text-dim",children:[e(Ye,{label:`启用 ${b.id}`,checked:b.status!=="disabled",disabled:M!==void 0,onCheckedChange:()=>void A(b,!1)}),e("span",{className:u(b.status==="error"&&"text-danger"),children:xn[b.status].label})]}),n("div",{className:"flex items-center gap-1.5",children:[e(G,{label:"重载插件",disabled:M!==void 0||b.status==="disabled",onClick:()=>void A(b,!0),children:e(ge,{className:u("size-4",M===b.id&&"animate-spin")})}),hn(b)&&b.status!=="disabled"&&n(_,{size:"sm",onClick:()=>O("settings"),children:[e(vt,{className:"size-3.5"}),e("span",{children:"设置"})]})]})]})),children:b&&(E==="settings"?e(Yi,{value:{footer:L},children:e("div",{className:"py-1",children:e(xs,{pluginID:b.id,viewID:"settings",connection:t,onClose:()=>{C(void 0),O("details")}})})}):e(yn,{plugin:b,busy:M===b.id,failed:I?.id===b.id?I.message:void 0,plugins:i??[],depsMap:S.depsMap,dependentsMap:S.dependentsMap,onSelectPlugin:(R)=>{C(R),O("details")}}))})]})}var we="__direct",Je="__inherit";function Ft({conn:t}){k();let i=le(t.state).status,[r,d]=a(),[y,M]=a(),[B,I]=a([]),[h,g]=a(),[c,D]=a(),C=o(void 0),E=v(async(N)=>{g("loading"),D(void 0);try{let T=await t.proxyConfiguration(N);if(N?.aborted)return;d(Ie(T)),M(Ie(T)),I(T.targets)}catch(T){if(!N?.aborted)D(T instanceof Error?T.message:String(T))}finally{if(!N?.aborted)g(void 0)}},[t]);s(()=>{let N=new AbortController;if(C.current=N,d(void 0),M(void 0),D(void 0),i==="open")E(N.signal);return()=>N.abort()},[i,E]);let O=(N)=>{d((T)=>T?N(T):T)},L=(N,T)=>{O((A)=>({...A,profiles:A.profiles.map((S)=>S.id===N?{...S,...T}:S)}))},x=async()=>{if(!r)return;let N=C.current;if(!N||N.signal.aborted)return;g("saving"),D(void 0);try{let T=await t.saveProxyConfiguration(r,N.signal);if(N.signal.aborted)return;d(Ie(T)),M(Ie(T)),I(T.targets)}catch(T){if(!N.signal.aborted)D(T instanceof Error?T.message:String(T))}finally{if(!N.signal.aborted)g(void 0)}},f=r&&y?JSON.stringify(r)!==JSON.stringify(y):!1,W=[{value:we,label:"直接连接"},...r?.profiles.map((N)=>({value:N.id,label:N.name}))??[]];if(i!=="open")return e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求。",children:e(Y,{title:"连接服务器后可配置代理",description:"代理设置保存在服务器上,连接后即可读取和保存。"})});if(!r)return e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求。",children:e(Y,{title:c?"无法读取代理设置":"正在读取代理设置…",description:c?e("span",{className:"text-danger",children:c}):void 0,children:c&&e(_,{loading:h==="loading",onClick:()=>void E(C.current?.signal),children:"重新加载"})})});return n(At,{className:"gap-6",noValidate:!0,onSubmit:(N)=>{N.preventDefault(),x()},children:[e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求;本机回环地址始终直连。",children:e(Y,{title:"默认线路",description:"没有单独分流的模型、订阅登录和程序更新使用这条线路。",children:e(tn,{ariaLabel:"默认代理线路",className:"w-56",value:r.defaultProfileID??we,disabled:h!==void 0,onValueChange:(N)=>O((T)=>({...T,defaultProfileID:N===we?void 0:N})),groups:[{options:W}]})})}),e(ne,{title:"代理服务器",description:"支持 HTTP / HTTPS 代理;地址中的账号密码请拆到独立字段。",unboxed:!0,action:n(_,{size:"sm",disabled:h!==void 0,onClick:()=>O((N)=>({...N,profiles:[...N.profiles,{id:Bt(),name:`代理 ${N.profiles.length+1}`,address:"http://127.0.0.1:8080",tls:"verify",noProxy:[]}]})),children:[e(be,{className:"size-3.5"}),"添加代理"]}),children:r.profiles.length===0?e("div",{className:p("surface.emptyDashed","py-10 text-sm text-dim"),children:"尚未添加代理,所有请求直接连接。"}):r.profiles.map((N)=>n("section",{className:p("surface.card","flex flex-col gap-4 p-4"),children:[n("div",{className:"flex items-center justify-between gap-3",children:[n("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium text-ink",children:[e(Pe,{className:"size-4 shrink-0 text-dim"}),e("span",{className:"truncate",children:N.name||"未命名代理"})]}),e(G,{label:`删除${N.name||"代理"}`,className:"text-danger",disabled:h!==void 0,onClick:()=>O((T)=>({...T,defaultProfileID:T.defaultProfileID===N.id?void 0:T.defaultProfileID,profiles:T.profiles.filter((A)=>A.id!==N.id),routes:Object.fromEntries(Object.entries(T.routes).filter(([,A])=>A!==N.id))})),children:e(xe,{className:"size-4"})})]}),n("div",{className:"grid gap-3 md:grid-cols-2",children:[e(ie,{label:"名称",children:(T)=>e(te,{id:T,value:N.name,onChange:(A)=>L(N.id,{name:A.target.value})})}),e(ie,{label:"代理地址",children:(T)=>e(te,{id:T,type:"url",value:N.address,placeholder:"http://proxy.example.com:8080",autoComplete:"off",spellCheck:!1,onChange:(A)=>L(N.id,{address:A.target.value})})}),e(ie,{label:"用户名(可选)",children:(T)=>e(te,{id:T,value:N.username??"",autoComplete:"off",onChange:(A)=>L(N.id,{username:A.target.value||void 0})})}),e(ie,{label:"密码(可选)",hint:"留空表示沿用已保存密码。",children:(T)=>e(te,{id:T,type:"password",value:N.password??"",autoComplete:"new-password",onChange:(A)=>L(N.id,{password:A.target.value||void 0})})}),e(ie,{label:"HTTPS 证书校验",children:(T)=>e(tn,{id:T,value:N.tls,onValueChange:(A)=>L(N.id,{tls:A==="insecure"?"insecure":"verify"}),groups:[{options:[{value:"verify",label:"校验证书(推荐)"},{value:"insecure",label:"跳过校验(仅调试)"}]}]})}),e(ie,{label:"额外直连主机",hint:"多个主机用逗号分隔;localhost 与回环地址无需填写。",children:(T)=>e(te,{id:T,value:N.noProxy?.join(", ")??"",placeholder:"internal.example.com",onChange:(A)=>L(N.id,{noProxy:A.target.value.split(",").map((S)=>S.trim()).filter(Boolean)})})})]})]},N.id))}),e(ne,{title:"分流规则",description:"可按模型提供方、ChatGPT 订阅登录或程序更新覆盖默认线路。",children:B.map((N)=>{let A=Object.hasOwn(r.routes,N.id)?r.routes[N.id]??we:Je;return e(Y,{title:N.name,description:e("span",{className:"font-mono",children:N.id}),children:e(tn,{ariaLabel:`${N.name}使用的代理线路`,className:"w-56",value:A,disabled:h!==void 0,onValueChange:(S)=>O((P)=>{let H={...P.routes};if(S===Je)delete H[N.id];else H[N.id]=S===we?null:S;return{...P,routes:H}}),groups:[{options:[{value:Je,label:"跟随默认线路"},...W]}]})},N.id)})}),e(yt,{children:c}),n(fs,{children:[e(_,{disabled:h!==void 0||!f,onClick:()=>y&&d(structuredClone(y)),children:"撤销更改"}),n(_,{type:"submit",variant:"primary",disabled:h!==void 0||!f,loading:h==="saving",children:[e(Me,{className:"size-3.5"}),"保存代理设置"]})]})]})}function Ie(t){return{version:1,defaultProfileID:t.defaultProfileID,routes:{...t.routes},profiles:t.profiles.map((i)=>({id:i.id,name:i.name,address:i.address,username:i.username,password:"",tls:i.tls,noProxy:[...i.noProxy??[]]}))}}function Wt({conn:t}){let[i,r]=a(0);return e(wn,{conn:t,onRetry:()=>r((d)=>d+1)},i)}function wn({conn:t,onRetry:i}){let r=le(t.state).status==="open",[d,y]=a(),[M,B]=a(),[I,h]=a(),g=o(void 0);s(()=>{let D=new AbortController;if(g.current=D,y(void 0),B(void 0),r)h("load"),t.networkSettings(D.signal).then((C)=>{if(D.signal.aborted)return;y(C),h(void 0)},(C)=>{if(D.signal.aborted)return;let E=C instanceof Error&&"status"in C&&C.status===404;B(E?"当前服务版本不支持局域网设置,请更新服务端。":Gt(C)),h(void 0)});return()=>D.abort()},[t,r]);async function c(D){let C=g.current;if(!C||C.signal.aborted||I)return;h("update"),B(void 0);try{let E=await t.saveNetworkSettings({lanEnabled:D},C.signal);if(C.signal.aborted)return;y(E)}catch(E){if(!C.signal.aborted)B(Gt(E))}finally{if(!C.signal.aborted)h(void 0)}}if(!r)return e(Y,{title:"开放局域网",description:"连接服务器后可查看网络设置。"});if(!d)return e(Y,{title:"开放局域网",description:M??"正在读取网络设置…",children:M&&e(_,{size:"sm",onClick:i,children:"重试"})});return n(m,{children:[e(Y,{title:"开放局域网",description:n("div",{className:"space-y-2",children:[e("p",{children:"设备需配对。HTTP 不加密,仅限可信网络。"}),d.disabledReason&&e("p",{children:d.disabledReason}),M&&e("p",{role:"alert",className:"text-danger",children:M})]}),children:e(Ye,{label:"开放局域网",checked:d.settings.lanEnabled,onCheckedChange:c,disabled:!d.editable||I!==void 0})}),d.current.remote&&e(Y,{title:"局域网连接地址",description:n("div",{className:"space-y-2",children:[e("p",{children:"其他设备使用配对码连接。"}),d.addresses.length===0&&e("p",{children:"未发现局域网 IPv4 地址,请检查网卡。"}),d.addresses.map((D)=>e(te,{"aria-label":`局域网地址 ${D.address}`,value:D.url,readOnly:!0,className:"font-mono",onFocus:(C)=>C.currentTarget.select()},D.address))]})})]})}function Gt(t){return t instanceof Error?t.message:"网络设置请求失败,请重试。"}var Nn=/^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,kn=2000,Ot=15000,Cn={off:"已关闭",starting:"连接中",connected:"已连接",error:"连接失败,重试中","missing-binary":"未安装 cloudflared"},Pn=["c07321b023e944ff818fec44d8203567","4755a26eedb94da69e1066d98aa820be","c8fed203ed3043cba015a93ad1616f1f","1e13c5124ca64b72b1969a67e8829049","bfe0d8686a584fa680f4c53b5eb0de6d"],De=new URL("https://dash.cloudflare.com/");De.searchParams.set("to","/:account/api-tokens");De.searchParams.set("name","Basalt remote access");De.searchParams.set("permissionGroupKeys",JSON.stringify(Pn.map((t)=>({key:t,type:"edit"}))));function Tn(t){let i=it(t.state,(I)=>I.status==="open"),[r,d]=a(),[y,M]=a(),B=r?.state==="connected"||r?.enabled===!1;return s(()=>{if(!i)return;let I=!1,h=()=>void t.tunnelStatus().then((c)=>{if(I)return;d(c),M(void 0)}).catch((c)=>{if(I)return;if(c instanceof Error&&"status"in c&&c.status===404){d(null);return}M(c instanceof Error?c.message:String(c))});h();let g=setInterval(h,B?Ot:kn);return()=>{I=!0,clearInterval(g)}},[t,i,B]),[r,d,y]}function Mn(t){let[i,r]=a(),d=i?.expires;return s(()=>{let y=!1,M=()=>void t.pairingCode().then((h)=>!y&&r(h)).catch(()=>!y&&r(null));M();let B=setInterval(M,Ot),I=d?setTimeout(M,Math.max(0,d-Date.now())+500):void 0;return()=>{y=!0,clearInterval(B),clearTimeout(I)}},[t,d]),[i,r]}function _t(t){k();let[i,r,d]=Tn(t.conn);return n(m,{children:[e(zn,{conn:t.conn}),e(ne,{title:"局域网访问",description:"通过可信局域网访问这台 Basalt。",children:e(Wt,{conn:t.conn})}),i!==null&&e(ne,{title:"Cloudflare",description:"用自己的域名从外网访问;新设备仍需 Basalt 配对。",children:i?e(Rn,{conn:t.conn,status:i,onChanged:r}):e(Y,{title:d?"状态读取失败":"正在读取状态…",description:d})})]})}function Rn(t){let{conn:i,status:r}=t,d=it(i.state,(P)=>P.server?.auth===!1),[y,M]=a(),[B,I]=a(),[h,g]=a(""),[c,D]=a(r.accessEmail??""),[C,E]=a(!1),[O,L]=a(),x=(y??r.hostname??"").trim().toLowerCase(),f=r.enabled??r.configured,W=r.managedAccess??!!(r.cloudAccessTeam||r.access),N=r.cloudflareConnected&&r.managedAccess===void 0;s(()=>{if(!r.cloudflareConnected||!r.configured)return;let P=!1;return i.refreshCloudflare().then((H)=>{if(!P)t.onChanged(H)},(H)=>{if(!P)L(H instanceof Error?H.message:"读取云端配置失败")}),()=>{P=!0}},[i,r.cloudflareConnected,r.configured,t.onChanged]);async function T(P,H=!1){if(C)return;E(!0),L(void 0);try{if(t.onChanged(await P()),H)g(""),I(void 0)}catch(b){L(b instanceof Error?b.message:String(b))}finally{E(!1)}}function A(){L(void 0),g(""),I("connect")}async function S(P){if(!r.cloudflareConnected){A();return}if(P){D(r.accessEmail??""),L(void 0),I("access");return}if(await Ge({title:"取消 Cloudflare 登录?",description:"所有人将可以打开 Basalt 连接页面,新设备仍必须配对。只修改当前域名,不影响隧道连接。",action:"取消额外登录"}))await T(()=>i.configureManagedAccess({enabled:!1}))}return n(m,{children:[n(Y,{title:"状态",description:r.publicURL?e("span",{className:"font-mono break-all",children:r.publicURL}):"尚未配置访问域名",children:[e("span",{className:u("text-ui",r.state==="connected"?"text-success":"text-faint"),children:Cn[r.state]}),r.publicURL&&e(Pt,{text:r.publicURL,label:"复制地址",size:"icon-sm"}),r.publicURL&&e(G,{asChild:!0,size:"icon-sm",label:"打开公共地址",children:e("a",{href:r.publicURL,target:"_blank",rel:"noreferrer noopener",children:e(an,{className:"size-3.5"})})}),e(_,{variant:"ghost",size:"sm",disabled:C||d,onClick:A,children:r.cloudflareConnected?"更换授权":"连接 Cloudflare"})]}),e(Y,{title:"隧道",description:"关闭仅断开连接,保留域名和配置。",children:e(Ye,{label:"隧道",checked:f,disabled:C||d||!r.binary&&!f,onCheckedChange:(P)=>{if(P&&!r.configured&&!r.cloudflareConnected){A();return}T(()=>i.configureManagedTunnel({enabled:P,hostname:x}))}})}),e(Y,{title:"域名",description:"填写 Cloudflare 托管域名下的子域名。",children:n("div",{className:"flex max-w-full flex-wrap items-center gap-2",children:[e(te,{"aria-label":"域名",placeholder:"basalt.example.com",value:y??r.hostname??"",className:"w-56 max-w-full",spellCheck:!1,autoCapitalize:"off",disabled:C||d,onChange:(P)=>M(P.target.value)}),e(_,{size:"sm",variant:"secondary",loading:C,disabled:C||d||!Nn.test(x)||x===r.hostname&&f,onClick:()=>{if(!r.cloudflareConnected){A();return}T(()=>i.configureManagedTunnel({enabled:!0,hostname:x}))},children:"保存并连接"})]})}),e(Y,{title:"Access 登录保护",description:N?"云端状态尚未确认,请重新检测;不会将未知状态视为关闭。":"仅允许指定邮箱通过 GitHub 登录。",children:N?e(_,{size:"sm",variant:"secondary",disabled:C,onClick:()=>void T(()=>i.refreshCloudflare()),children:"重新检测"}):e(Ye,{label:"Access 登录保护",checked:W,disabled:C||d||!r.configured,onCheckedChange:(P)=>void S(P)})}),(O||r.managementError||r.error||d||!r.binary)&&e("div",{className:"px-4 py-3",children:e(Aa,{tone:"danger",children:O||r.managementError||r.error||(d?"服务端已关闭认证,不能开启远程访问。":`请先安装 cloudflared:${r.install.command??r.install.url}`)})}),e(qt,{open:B==="connect",onOpenChange:(P)=>{if(!C&&!P)I(void 0),g(""),L(void 0)},title:"连接 Cloudflare",description:"创建令牌后,粘贴到下方即可连接。",children:n(At,{onSubmit:(P)=>{P.preventDefault(),T(()=>i.connectCloudflare(h.trim()),!0)},children:[n("div",{className:"space-y-2 text-ui text-dim",children:[e(_,{asChild:!0,variant:"secondary",children:n("a",{href:De.href,target:"_blank",rel:"noreferrer noopener",children:["创建令牌 ",e(an,{className:"size-3.5"})]})}),e("p",{className:"text-xs text-faint",children:"权限已预填,只需选择账号和域名。"})]}),e(ie,{label:"API Token",children:(P)=>e(te,{id:P,type:"password",placeholder:"粘贴令牌",autoComplete:"off",spellCheck:!1,value:h,disabled:C,onChange:(H)=>g(H.target.value)})}),e("p",{className:"text-xs text-faint",children:"令牌仅保存在本机,不发送给模型。"}),e(yt,{children:O}),e("div",{className:"flex justify-end",children:e(_,{type:"submit",loading:C,disabled:!h.trim(),children:"连接"})})]})}),e(qt,{open:B==="access",onOpenChange:(P)=>{if(!C&&!P)I(void 0),L(void 0)},title:"开启 Access 登录保护",description:"使用 GitHub 登录,并限定以下邮箱。",children:n(At,{onSubmit:(P)=>{P.preventDefault(),T(()=>i.configureManagedAccess({enabled:!0,email:c.trim()}),!0)},children:[e(ie,{label:"允许登录的邮箱",children:(P)=>e(te,{id:P,type:"email",autoComplete:"email",value:c,disabled:C,onChange:(H)=>D(H.target.value)})}),e(yt,{children:O}),e("div",{className:"flex justify-end",children:e(_,{type:"submit",loading:C,disabled:!c.trim(),children:"开启保护"})})]})})]})}function zn(t){let[i,r]=Mn(t.conn),[d,y]=a(!1);if(!i)return null;let M=`${i.code.slice(0,4)}-${i.code.slice(4)}`,B=new Date(i.expires).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});async function I(){y(!0);try{r(await t.conn.renewPairingCode())}catch(h){z(h,"更换配对码失败")}finally{y(!1)}}return e(ne,{title:"设备配对",description:"局域网与 Cloudflare 隧道连接共用此码。",children:n(Y,{title:"配对码",description:`${B} 前有效,用一次即失效`,children:[e("code",{className:"font-mono text-sm font-medium tracking-wider text-ink",children:M}),e(Pt,{text:M,label:"复制配对码",size:"icon-sm"}),e(G,{size:"icon-sm",label:"换一个配对码",className:"text-faint",disabled:d,onClick:()=>void I(),children:e(ge,{className:u("size-3.5",d&&"animate-spin")})})]})})}var In=[{value:"auto",label:"自动检测 (Auto)",description:"Windows 优先探测 bash,未找到则回退 powershell;Unix 走 bash"},{value:"bash",label:"Bash",description:"使用 bash -c 执行(Git Bash / WSL / MSYS2 / Linux / macOS)"},{value:"powershell",label:"PowerShell",description:"使用 powershell -NoProfile -Command 执行"},{value:"cmd",label:"CMD",description:"使用 cmd.exe /c 执行"}];function Dn(t){if(!t)return"—";return`v${t.version}(协议 v${t.protocol})`}function Bn(t){if(!t)return"—";return t.auth?"需设备配对令牌":"免认证(--no-auth)"}function Vt(t){let i=le(t.conn.state),r=Ki[i.status],d=i.server,[y,M]=a(!1),[B,I]=a(!1),[h,g]=a(),[c,D]=a(!1),C=d?.shell??"auto";s(()=>{if(g(void 0),i.status!=="open")return;let x=!1;return t.conn.serverAutostart().then((f)=>{if(!x)g(f)},(f)=>{if(!x)z(f)}),()=>{x=!0}},[t.conn,i.status]);async function E(x){let f=x;M(!0);try{await t.conn.setServerShell(f)}catch(W){z(W)}finally{M(!1)}}async function O(x){D(!0);try{g(await t.conn.setServerAutostart(x))}catch(f){z(f)}finally{D(!1)}}async function L(){I(!0);try{await t.conn.restartServer(),ue("已请求重启",{description:"所有对话空闲后服务会按原参数重启,稍后自动重新连接"})}catch(x){z(x)}finally{I(!1)}}return n(m,{children:[n(ne,{title:"当前远程服务器",description:`正在管理 ${qn(t.server)}(${t.server.url})`,children:[e(Y,{title:"连接状态",description:i.error??t.server.url,children:n("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-ink",children:[e("span",{className:u("size-2 rounded-full",r.dot)}),i.status==="open"&&d?e("span",{className:"font-mono",children:Dn(d)}):r.label]})}),e(Y,{title:"认证策略",description:"服务端是否要求配对设备令牌",children:n("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-ink",children:[d&&e("span",{className:u("size-2 rounded-full",d.auth?"bg-success":"bg-warning")}),Bn(d)]})})]}),n(ne,{title:"更新与启动",description:"服务端版本更新、重启与开机自启",children:[e(Yc,{conn:t.conn}),e(Y,{title:"服务重启",description:"按原参数重启,等所有对话空闲后执行,不会中断进行中的对话",children:e(_,{size:"sm",loading:B,disabled:i.status!=="open",onClick:L,children:"重启服务"})}),e(Y,{title:"开机自启",description:"当前用户登录系统后自动启动 Basalt;不影响正在运行的服务",children:e(Ye,{label:"开机自启",checked:h?.enabled??!1,disabled:!h||c||i.status!=="open",onCheckedChange:(x)=>void O(x)})})]}),n(ne,{title:"运行环境",description:"服务端执行命令与解释定时任务时使用的环境",children:[e(Y,{title:"执行 Shell",description:"服务端运行 bash 工具与后台长任务时调用的默认命令行解释器",children:e("div",{className:"w-56",children:e(tn,{value:C,disabled:y,onValueChange:E,groups:[{options:In.map((x)=>({value:x.value,label:x.label,description:x.description}))}]})})}),e(Y,{title:"服务器时区",description:"远程自动化定时任务(Cron)按此时区解释",children:e("span",{className:"font-mono text-xs text-dim",children:d?.timezone??"—"})})]})]})}function jt(t){let i=le(t.conn.state),r=t.devices;if(i.server?.auth===!1)return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"当前服务器未启用设备认证",description:"服务端以 --no-auth 启动,无需配对设备令牌"})});if(!r){let d=i.status==="open"?"正在读取已配对设备…":"连接服务器后可查看";return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"设备列表",description:d})})}if(r.length===0)return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"暂无已配对设备"})});return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:r.map((d)=>e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate",children:d.name}),(d.current||d.id===t.server.id)&&e("span",{className:"rounded-md bg-raised px-1.5 py-0.5 font-normal text-2xs text-dim",children:"当前设备"})]}),description:`最近活跃:${bt(d.lastSeen)} · 配对于 ${bt(d.created)}`,children:n(_,{size:"sm",variant:"danger-ghost",onClick:()=>t.onRevokeDevice(d),children:[e(xe,{className:"size-3.5"}),"吊销"]})},d.id))})}var Ne="浏览器设置(本地)",re="服务器设置(远程)",Kt=[{value:"appearance",group:Ne,label:"外观",icon:e(wa,{}),render:()=>e(tt,{})},{value:"notifications",group:Ne,label:"通知",icon:e(Qe,{}),render:()=>e(at,{})},{value:"connections",group:Ne,label:"连接列表",icon:e($e,{}),render:(t)=>e(ot,{...t})},{value:"shortcuts",group:Ne,label:"快捷键",icon:e(xa,{}),render:()=>e(lt,{})},{value:"models",group:re,label:"模型",icon:e(Ar,{}),render:(t)=>e(Mt,{...t})},{value:"plugins",group:re,label:"插件",icon:e(Ht,{}),render:(t)=>e($t,{conn:t.conn},t.server.id)},{value:"proxy",group:re,label:"代理",icon:e(Pe,{}),render:(t)=>e(Ft,{conn:t.conn},t.server.id)},{value:"database",group:re,label:"数据库",icon:e(Tr,{}),render:(t)=>e(xt,{conn:t.conn,server:t.server})},{value:"server",group:re,label:"服务器",icon:e(ut,{}),render:(t)=>e(Vt,{...t},t.server.id)},{value:"remote",group:re,label:"远程访问",icon:e(Ze,{}),render:(t)=>e(_t,{conn:t.conn},t.server.id)},{value:"devices",group:re,label:"已配对设备",icon:e(Yn,{}),render:(t)=>e(jt,{...t})}],Be=new WeakMap;function Qt(t){return t==="search"?"database":t??"appearance"}function lr(t){k();let[i,r]=a(()=>Qt(t.initialTab)),[d,y]=a(t.initialTab===void 0),M=o(null),B=o(!1);s(()=>{if(y(t.initialTab===void 0),t.initialTab===void 0)B.current=!1;if(M.current?.scrollTo({top:0}),t.initialTab)r(Qt(t.initialTab))},[t.initialTab]);let I=(f)=>{r(f),t.onTabChange?.(f)},h=le(t.conn.state),[g,c]=a(()=>Be.get(t.conn)??null),D=[];for(let f of h.plugins){if(f.status!=="enabled")continue;for(let W of f.web??[]){let N=W.view;if(W.kind!=="tab"||!N)continue;let T=W.id==="settings"?f.id:W.id;D.push({value:T,group:re,label:W.title,icon:Wc(W.icon),render:(A)=>e(xs,{pluginID:f.id,viewID:N,connection:A.conn},`${f.id}-${W.id}`)})}}let C=h.server?.localManagement===!0,E=[...Kt.slice(0,5),...D,...Kt.slice(5)].filter((f)=>C||f.value!=="remote"&&f.value!=="devices");s(()=>{let f=Be.get(t.conn)??null;if(c(f),!C||h.status!=="open"||h.server?.auth===!1)return;let W=!1;return t.conn.devices().then((N)=>{if(Be.set(t.conn,N),!W)c(N)}).catch(()=>{}),()=>{W=!0}},[t.conn,h.status,h.server?.auth,C]);let O=async(f)=>{if(!await Ge({title:`吊销设备「${f.name}」?`,description:"吊销后该设备的令牌立即失效,需重新配对才能连接此服务器。",action:"吊销",danger:!0}))return;try{await t.conn.revokeDevice(f.id),c((N)=>{let T=N?.filter((A)=>A.id!==f.id)??null;if(T)Be.set(t.conn,T);return T})}catch(N){z(N)}},L=E.find((f)=>f.value===i)??E[0],x={...t,devices:g,onRevokeDevice:(f)=>void O(f)};return e(gi,{className:"@container/settings",viewportClassName:"[scrollbar-gutter:stable]",viewportRef:M,children:n("div",{className:"mx-auto max-w-4xl animate-fade px-4 pt-3 pb-10 sm:px-6 md:pt-10 md:pb-16",children:[n("div",{className:"mb-6 flex min-h-10 items-center gap-1 md:mb-8",children:[!d&&e(G,{label:"返回设置分类",className:"-ml-2 size-10 rounded-full @min-[640px]/settings:hidden",onClick:()=>{if(B.current){B.current=!1,window.history.back();return}y(!0),t.onTabChange?.(void 0)},children:e(Xe,{className:"size-5"})}),n("h1",{className:"min-w-0 truncate text-xl font-semibold tracking-tight md:font-serif md:text-title md:font-normal",children:[e("span",{className:u(!d&&"@max-[640px]/settings:hidden"),children:"设置"}),!d&&e("span",{className:"@min-[640px]/settings:hidden",children:L?.label})]})]}),d&&e("nav",{"aria-label":"设置分类",className:"space-y-6 @min-[640px]/settings:hidden",children:[Ne,re].map((f)=>n("section",{children:[e("h2",{className:p("settings.groupTitle","mb-2.5 px-0.5"),children:f}),e("div",{className:p("settings.groupBox"),children:E.filter((W)=>W.group===f).map((W)=>n("button",{type:"button",onClick:()=>{r(W.value),y(!1),B.current=t.onTabChange!==void 0,t.onTabChange?.(W.value,!0)},className:"flex min-h-13 w-full items-center gap-3 px-4 text-left text-md text-ink transition-colors active:bg-raised [&_svg]:size-[18px] [&_svg]:shrink-0",children:[e("span",{className:"flex items-center text-dim",children:W.icon}),e("span",{className:"min-w-0 flex-1 truncate",children:W.label}),e(zt,{className:"text-faint"})]},W.value))})]},f))}),n("div",{className:u("flex items-start",d&&"@max-[640px]/settings:hidden"),children:[e("aside",{className:"settings-rail shrink-0",children:e("nav",{"aria-label":"设置分类",className:"flex w-48 flex-col gap-1",children:E.map((f,W)=>{let N=f.value===i,T=f.group&&(W===0||E[W-1]?.group!==f.group);return n(nt,{children:[T&&e("div",{className:u("px-2.5 pb-1 text-2xs font-medium tracking-wide text-faint",W>0&&"mt-3.5"),children:f.group}),n("button",{type:"button",onClick:()=>I(f.value),className:p("sidebar.navItem","px-2.5 text-ui",N?"bg-raised font-medium text-ink shadow-sheen":"text-dim hover:bg-raised/60 hover:text-ink"),children:[f.icon&&e("span",{className:u("relative flex items-center [&_svg]:size-4",N?"text-ink":"text-faint"),children:f.icon}),e("span",{className:"truncate",children:f.label})]})]},f.value)})})}),e("div",{className:"min-w-0 flex-1 animate-fade space-y-6 @container/panel",children:L?.render(x)},i)]})]})})}export{lr as Settings};
|
|
1
|
+
import{nt,v,s,ee,w,o,a,Bc,Fc,Cr,Rt,zc,lc,Bt,Gn,le,it,va,pi,Hc,Uc,m,e,n,pe,U,u,l,Jt,dr,Yn,fr,zt,Ar,Tr,Nn,an,st,ht,$e,_a,Xn,wa,ka,gt,be,Ht,ge,Oe,ut,vt,Ut,Kn,Ca,xe,ce,je,on,ve,Re,bn,Te,Aa,Zr,us,k,ds,p,qe,_,G,te,At,oe,yt,rt,Ee,Le,Se,Ve,ue,z,Pt,Jr,mc,qt,Ge,sn,ke,vr,We,ea,yi,bt,Ta,Xi,ne,Y,gs,Ye,Ki,vs,ys,ta,bs,bi,xi,tn,Ea,_s,ws,Xc,_i,Kc,ks,na,Zi}from"./chunk-6f1q0tjv.js";var Yt=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Qe=l("bell",Yt);var Xt=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Xe=l("chevron-left",Xt);var Zt=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Ze=l("cloud",Zt);var en=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],et=l("hard-drive",en);var nn=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Pe=l("network",nn);var rn=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Me=l("save",rn);var ln=[{value:"system",label:"跟随系统",icon:e(Xn,{})},{value:"light",label:"浅色",icon:e(Ca,{})},{value:"dark",label:"深色",icon:e(wa,{})}];function tt(){let t=k(),i=ds(),r=Uc();return n(ne,{title:"外观",description:"仅保存在当前浏览器本地",children:[e(Y,{title:"主题模式",description:"切换浅色、深色或跟随系统外观",children:e(Ea,{value:t.preference,onChange:Zr,options:ln})}),e(Y,{title:"主题风格",description:"选择宿主默认或由已启用插件提供的视觉主题",children:e(tn,{value:t.themeID,onValueChange:us,groups:[{options:i.map((d)=>({value:d.id,label:d.label,description:d.description}))}],className:"w-48"})}),r.canInstall&&e(Y,{title:"桌面应用",description:"将 Basalt 安装为独立窗口应用,可从桌面或任务栏直接启动",children:n(_,{size:"sm",onClick:()=>r.install().catch((d)=>z(d,"安装应用失败")),children:[e(Nn,{className:"size-3.5"}),"安装应用"]})})]})}function at(){let t=le(va),[i,r]=a(pi),[d,y]=a(!1),M=o(!1);s(()=>{M.current=!0;let h=()=>r(pi());return window.addEventListener("focus",h),document.addEventListener("visibilitychange",h),()=>{M.current=!1,window.removeEventListener("focus",h),document.removeEventListener("visibilitychange",h)}},[]);let B=async(h)=>{y(!0);try{let g=await Hc(h);if(M.current)r(g)}catch(g){if(M.current)z(g,"无法更新系统通知")}finally{if(M.current)y(!1)}};return e(ne,{title:"系统通知",description:"页面保持打开时生效;开关仅保存在当前浏览器",children:e(Y,{title:"完成与错误提醒",description:i==="unsupported"?"当前浏览器或访问方式不支持系统通知,请使用支持通知的浏览器,并通过 HTTPS 或 localhost 访问":i==="denied"?"浏览器已阻止通知,请在网站设置中允许通知,回到此页后再开启":t&&i==="granted"?"模型工作完成或运行出错时发送;点击通知可回到对应会话":"开启后在模型工作完成或运行出错时发送;首次开启需要浏览器授权",children:e(Ye,{label:"模型工作完成或出错时发送系统通知",checked:t&&i==="granted",disabled:d||i==="unsupported",onCheckedChange:(h)=>void B(h)})})})}function ot(t){let i=le(t.conn.state),r=Zi[i.status];return e(ne,{title:"已保存的服务器连接",description:"保存在当前浏览器中的服务器地址与设备凭证",action:n(_,{size:"sm",onClick:t.onAddServer,children:[e(be,{className:"size-3.5"}),"添加服务器"]}),children:t.servers.map((d)=>{let y=d.id===t.server.id;return e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate",children:Gn(d)}),y&&n("span",{className:"inline-flex items-center gap-1.5 font-normal text-xs text-dim",children:[e("span",{className:u("size-1.5 rounded-full",r.dot)}),r.label]})]}),description:e("span",{className:"font-mono",children:d.url}),children:y?n(_,{size:"sm",variant:"danger-ghost",onClick:t.onRemoveServer,children:[e(xe,{className:"size-3.5"}),"移除"]}):e(_,{size:"sm",onClick:()=>t.onServer(d.id),children:"切换"})},d.id)})})}function lt(){return n(m,{children:[n(ne,{title:"全局",description:"当前浏览器前端快捷键",children:[e(Y,{title:"搜索与命令面板",description:"快速跳转会话、项目或执行常用操作",children:e(qe,{children:"mod+k"})}),e(Y,{title:"收起 / 展开侧栏",description:"在完整侧栏与窄图标栏之间切换",children:e(qe,{children:"alt+1"})}),e(Y,{title:"新建聊天",description:"立即回到新会话输入页",children:e(qe,{children:"mod+shift+o"})})]}),n(ne,{title:"对话输入",children:[e(Y,{title:"发送消息",children:e(qe,{children:"Enter"})}),e(Y,{title:"换行",children:e(qe,{children:"Shift+Enter"})})]})]})}var dt=["B","KB","MB","GB","TB"];function K(t){let i=t,r=0;while(i>=1024&&r<dt.length-1)i/=1024,r++;let d=r===0?0:i>=100?0:i>=10?1:2;return`${i.toFixed(d)} ${dt[r]}`}function ct({conn:t,server:i}){k();let r=i?.id??t.server.id,d=le(on(r)),[y,M]=a(!1),[B,I]=a();s(()=>{let g=new AbortController;return t.request("/api/search/settings",{signal:g.signal}).then((c)=>{if(!g.signal.aborted)on(r).set(c.status)}).catch(()=>{if(!g.signal.aborted)I("无法读取历史搜索设置,请重新打开设置重试")}),()=>g.abort()},[t,r]);async function h(){if(y)return;M(!0),I(void 0);try{let g=await t.request("/api/search/rebuild",{method:"POST"});on(r).set(g)}catch(g){I(g instanceof Error?g.message:"无法重建历史搜索索引,请重试")}finally{M(!1)}}return n(ne,{title:"历史搜索",children:[e(Y,{title:"搜索索引",description:n("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5",children:[e(_i,{status:d,showEnable:!1,className:"py-0 shrink-0"}),d&&n("span",{children:["体积 ",K(d.bytes)," / 预算 ",K(d.budget)]})]}),children:e(_,{disabled:y||!d||d.state==="rebuilding",loading:y,onClick:()=>{h().catch(()=>{return})},children:"重建索引"})}),d?.state==="rebuilding"&&e("div",{className:p("surface.subtle","space-y-3 border-line bg-raised/30 p-3.5"),children:n("div",{className:"flex items-center justify-between text-xs text-dim",children:[e("span",{children:"正在重建索引…"}),e("code",{className:p("markdown.inlineCode"),children:d.total>0?`${Math.round(d.indexed/d.total*100)}%`:"0%"})]})}),B&&e("p",{role:"alert",className:"p-4 text-sm text-danger",children:B})]})}var Ae=new WeakMap,dn={assistant:"bg-accent",tool:"bg-warning",user:"bg-success",run:"bg-ink/50",compaction:"bg-danger",notice:"bg-dim",notice_pending:"bg-faint"};function de(t){return e("span",{className:u("font-mono text-xs tabular-nums text-dim",t.className),children:t.children})}function mt(t){return e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{children:t.title}),t.subtitle&&e("span",{className:"font-mono text-2xs font-normal text-faint",children:t.subtitle})]}),description:e("span",{className:"font-mono break-all text-dim",children:t.path}),children:e(Pt,{text:t.path,label:"复制路径",size:"icon-sm"})})}function Ue(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:u("h-full rounded-full transition-all duration-300",t.colorClass??"bg-accent"),style:{width:`${Math.max(t.percent>0?1:0,t.percent)}%`}})})}function _e(t,i){if(i<=0||t<=0)return"0%";let r=t/i*100;if(r<0.1)return"<0.1%";let d=r>=10?1:2;return`${r.toFixed(d)}%`}function ft(t){if(!t)return"—";return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function pt(t){return t.database.size+t.database.walSize+t.database.shmSize}function cn(t){let{table:i,totalDbBytes:r}=t,d=i.bytes??0,y=r>0?Math.min(100,d/r*100):0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[e("code",{className:p("markdown.inlineCode"),children:i.name}),i.withoutRowid&&e("span",{className:p("control.badge","border border-line bg-raised/40 px-2 py-0.5 text-xs"),children:"WITHOUT ROWID"}),i.indexes!==void 0&&i.indexes>0&&n("span",{className:"rounded-md bg-raised/50 px-1.5 py-0.5 font-mono text-2xs text-faint",children:[i.indexes," 索引"]}),i.pages!==void 0&&n("span",{className:"font-mono text-2xs text-faint tabular-nums",children:[i.pages.toLocaleString()," 页"]})]}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums",children:[n("span",{className:"text-ink",children:[i.rows.toLocaleString()," 行"]}),i.bytes!==void 0&&n("span",{className:"text-dim",children:[K(d)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(d,r),")"]})]})]})]}),i.bytes!==void 0&&r>0&&e(Ue,{percent:y})]})}function xt(t){k();let[i,r]=a(()=>Ae.get(t.conn)),[d,y]=a(),[M,B]=a(!1),[I,h]=a(!0),[g,c]=a(!0),[D,C]=a(!1),E=v(async(F=!1)=>{B(!0);try{let j=await t.conn.storage(F);if(Ae.set(t.conn,j),r(j),j.search)on(t.server?.id??t.conn.server.id).set(j.search);y(void 0)}catch(j){y(je(j))}finally{B(!1)}},[t.conn,t.server?.id]);s(()=>{E()},[E]);async function O(){if(!i)return;let F=g?i.database.reclaimableBytes:0,j=I||g?i.database.walSize:0,X=F+j,Q=[];if(g)Q.push("VACUUM 数据库");if(I)Q.push("截断 WAL");if(!await Ge({title:"确认清理数据库?",description:`将${Q.join("并")},预计回收 ${K(X)}。不会删除会话、消息或设备。大库上 VACUUM 可能要几秒,期间写入会等待。`,action:"开始清理"}))return;C(!0);try{let ae=await t.conn.compactStorage({checkpoint:I,vacuum:g}),me=pt(ae.before),fe=pt(ae.after),he=Math.max(0,me-fe);Ae.set(t.conn,ae.after),r(ae.after);let Ce=he>0?"清理完成":"清理完成,没有可回收的空间";ue.success(Ce,{description:`数据库 ${K(me)} → ${K(fe)}`})}catch(ae){z(ae,"清理失败")}finally{C(!1)}}let L=n(_,{size:"sm",variant:"ghost",onClick:()=>void E(),loading:M,children:[e(ge,{className:"size-3.5"}),"刷新"]});if(!i)return e(ne,{title:"数据库",action:L,children:e(Y,{title:d?"无法读取数据库信息":"正在读取数据库信息…",description:d})});let{database:x,analytics:f}=i,W=x.size+x.walSize+x.shmSize,N=Math.max(0,x.size-x.reclaimableBytes),T=x.reclaimableBytes+x.walSize,A=x.pageCount>0?(x.pageCount-x.freelistCount)/x.pageCount*100:100,S=x.integrity?.toLowerCase()==="ok",P="neutral",H="未检查";if(x.integrity)P=S?"success":"danger",H=S?"正常 (OK)":"异常";let b=!I&&!g,V=[...i.tables].sort((F,j)=>(j.bytes??0)-(F.bytes??0)||j.rows-F.rows),R=(f?.totalBodyBytes??0)+(f?.totalRawBytes??0),J=(f?.mainSessionCount??0)+(f?.subSessionCount??0);return n(m,{children:[n(ne,{title:"存储总览",action:L,unboxed:!0,children:[n("div",{className:"auto-grid gap-3",children:[n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"数据库占用"}),e(Tr,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(W)}),n("div",{className:"mt-1 font-mono text-2xs text-dim",children:["主库 ",K(x.size)," · WAL ",K(x.walSize)]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"数据目录"}),e(et,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(i.dataBytes)}),n("div",{className:"mt-1 text-2xs text-dim",children:["共 ",i.entries.length," 项"]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"可回收空间"}),e(Yn,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tabular-nums text-ink",children:K(T)}),n("div",{className:"mt-1 font-mono text-2xs text-dim",children:["利用率 ",A.toFixed(1),"% · ",x.freelistCount," 空页"]})]}),n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{className:"truncate",children:"完整性"}),e(Kn,{className:"size-3.5 shrink-0"})]}),e("div",{className:"mt-1.5 flex items-center gap-2",children:e(rt,{tone:P,children:H})}),n("div",{className:"mt-1.5 font-mono text-2xs text-dim",children:["SQLite ",x.sqliteVersion??"3.x"," · v",x.schemaVersion]})]})]}),W>0&&n("div",{className:"rounded-2xl border border-line bg-panel p-4",children:[n("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"font-medium text-ink",children:"物理构成"}),n("span",{className:"font-mono text-faint tabular-nums",children:[x.pageCount.toLocaleString()," 页 × ",K(x.pageSize)]})]}),n("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-raised gap-0.5",children:[N>0&&e("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${N/W*100}%`},title:`数据页: ${K(N)}`}),x.reclaimableBytes>0&&e("div",{className:"h-full bg-warning transition-all duration-300",style:{width:`${x.reclaimableBytes/W*100}%`},title:`空闲页: ${K(x.reclaimableBytes)}`}),x.walSize>0&&e("div",{className:"h-full bg-ink/40 transition-all duration-300",style:{width:`${x.walSize/W*100}%`},title:`WAL: ${K(x.walSize)}`}),x.shmSize>0&&e("div",{className:"h-full bg-faint transition-all duration-300",style:{width:`${x.shmSize/W*100}%`},title:`SHM: ${K(x.shmSize)}`})]}),n("div",{className:"mt-2.5 flex flex-wrap items-center gap-x-5 gap-y-1.5 text-xs text-dim",children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"数据页 ",e(de,{children:K(N)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-warning"}),"空闲页 ",e(de,{children:K(x.reclaimableBytes)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-ink/40"}),"WAL ",e(de,{children:K(x.walSize)})]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-faint"}),"SHM ",e(de,{children:K(x.shmSize)})]})]})]})]}),e(ne,{title:"深度分析",children:e(Y,{title:"完整性检查与空间分布",description:d??"按需扫描数据库,获取表物理占用和日志类型分布;大库可能耗时数秒,期间其他请求可能等待。",children:e(_,{size:"sm",onClick:()=>void E(!0),loading:M,disabled:D,children:f?"重新分析":"开始分析"})})}),n(ne,{title:"存储路径",children:[e(mt,{title:"主数据库",subtitle:x.lastModified?bt(x.lastModified):void 0,path:i.databasePath}),e(mt,{title:"数据目录",path:i.dataDir})]}),e(ct,{conn:t.conn,server:t.server}),f&&n(ne,{title:"会话与日志",children:[e(Y,{title:"会话统计",description:`${f.projectCount} 个项目 · ${J.toLocaleString()} 个会话`,children:n("div",{className:"flex flex-wrap items-center gap-1.5 font-mono text-xs",children:[n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-ink",children:["主会话 ",f.mainSessionCount.toLocaleString()]}),n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["子代理 ",f.subSessionCount.toLocaleString()]}),f.forkedSessionCount>0&&n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["分叉 ",f.forkedSessionCount.toLocaleString()]}),f.automationSessionCount>0&&n("span",{className:"rounded-md bg-raised px-2 py-0.5 text-dim",children:["自动化 ",f.automationSessionCount.toLocaleString()]})]})}),e(Y,{title:"日志载荷",children:e(de,{children:`body ${K(f.totalBodyBytes)} · raw ${K(f.totalRawBytes)}`})}),e(Y,{title:"日志记录",description:f.oldestEntryTime?`${ft(f.oldestEntryTime)} — ${ft(f.newestEntryTime)}`:void 0,children:e(de,{children:`${f.totalEntries.toLocaleString()} 条${f.compactionCount>0?` · ${f.compactionCount} 次压缩`:""}`})}),f.entryTypes.length>0&&n("div",{className:"p-4",children:[n("div",{className:"mb-3 flex items-center justify-between text-xs",children:[e("span",{className:"font-medium text-ink",children:"日志类型分布"}),e("span",{className:"font-mono text-faint",children:K(R)})]}),e("div",{className:"space-y-2.5",children:f.entryTypes.map((F)=>{let j=F.bodyBytes+F.rawBytes,X=dn[F.type]??"bg-dim",Q=R>0?Math.min(100,j/R*100):0,Z=F.count>0?Math.round(j/F.count):0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex items-center gap-2",children:[e("span",{className:u("size-2 rounded-full",X)}),e("span",{className:"font-mono font-medium text-ink",children:F.type}),n("span",{className:"font-mono text-2xs text-faint",children:[K(Z),"/条"]})]}),n("div",{className:"flex items-center gap-3 font-mono tabular-nums",children:[n("span",{className:"text-ink",children:[F.count.toLocaleString()," 条"]}),n("span",{className:"text-dim",children:[K(j)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(j,R),")"]})]})]})]}),e(Ue,{percent:Q,colorClass:X})]},F.type)})})]})]}),e(ne,{title:"数据表",children:e("div",{className:"p-4 space-y-2.5",children:V.map((F)=>e(cn,{table:F,totalDbBytes:x.size},F.name))})}),f&&f.pluginNamespaces.length>0&&e(ne,{title:"插件存储",children:e("div",{className:"grid grid-cols-1 gap-x-10 gap-y-2.5 p-4 md:grid-cols-2",children:f.pluginNamespaces.map((F)=>n("div",{className:"flex items-center justify-between gap-3 text-xs",children:[n("span",{className:"flex min-w-0 items-center gap-2",children:[e(dr,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"truncate font-mono font-medium text-ink",children:F.namespace}),F.migrationVersion!==void 0&&n("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-2xs font-normal text-faint",children:["v",F.migrationVersion]})]}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums text-xs",children:[n("span",{className:F.keys>0?"text-dim":"text-faint/50",children:[F.keys," 键"]}),e("span",{className:F.bytes>0?"font-medium text-ink":"text-faint/50",children:K(F.bytes)})]})]},F.namespace))})}),e(ne,{title:"引擎参数 (PRAGMA)",children:e("div",{className:"grid grid-cols-1 gap-x-10 gap-y-2.5 p-4 text-xs md:grid-cols-2",children:[{label:"内核版本",value:`SQLite ${x.sqliteVersion??"3.x"}`},{label:"忙锁超时",value:`${x.busyTimeout??5000}ms`},{label:"字符编码",value:x.encoding??"UTF-8"},{label:"单页大小",value:K(x.pageSize)},{label:"Schema 版本",value:`v${x.schemaVersion}`},{label:"总页数",value:`${x.pageCount.toLocaleString()} 页`},{label:"日志模式",value:x.journalMode.toUpperCase()},{label:"页缓存",value:x.cacheSizeBytes?K(x.cacheSizeBytes):"默认"},{label:"同步级别",value:x.synchronous??"FULL"},{label:"空闲页",value:`${x.freelistCount.toLocaleString()} 页 (${K(x.reclaimableBytes)})`},{label:"外键约束",value:x.foreignKeys!==!1?"ON":"OFF"},{label:"自动清理",value:x.autoVacuum??"NONE"}].map((F)=>n("div",{className:"flex items-center justify-between gap-3",children:[e("span",{className:"text-dim",children:F.label}),e(de,{className:"text-ink",children:F.value})]},F.label))})}),e(ne,{title:"数据目录明细",children:n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"mb-3 flex items-center justify-between text-xs",children:[e("span",{className:"font-mono text-dim break-all",children:i.dataDir}),n("div",{className:"flex shrink-0 items-center gap-3 font-mono text-xs",children:[n("span",{className:"text-dim",children:["共 ",i.entries.length," 项"]}),e("span",{className:"font-medium text-ink",children:K(i.dataBytes)})]})]}),i.entries.map((F)=>{let j=i.dataBytes>0?F.bytes/i.dataBytes*100:0;return n("div",{className:"space-y-1",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[F.kind==="directory"?e(ht,{className:"size-3.5 shrink-0 text-accent"}):e(st,{className:"size-3.5 shrink-0 text-faint"}),e("span",{className:"font-mono font-medium text-ink",children:F.name}),n("span",{className:"font-mono text-2xs text-faint",children:[F.kind==="directory"?`目录${F.files!==void 0?` · ${F.files.toLocaleString()} 个文件`:""}`:"文件",F.modified?` · ${bt(F.modified)}`:""]})]}),e("div",{className:"flex shrink-0 items-center gap-3 font-mono tabular-nums text-xs",children:n("span",{className:"text-dim",children:[K(F.bytes)," ",n("span",{className:"text-2xs text-faint",children:["(",_e(F.bytes,i.dataBytes),")"]})]})})]}),i.dataBytes>0&&e(Ue,{percent:j})]},F.name)})]})}),n(ne,{title:"空间维护",children:[e(Y,{title:"VACUUM 整理",description:`可回收 ${K(x.reclaimableBytes)}`,children:e(Ye,{checked:g,onCheckedChange:c,label:"VACUUM 数据库",disabled:D})}),e(Y,{title:"截断 WAL",description:`当前 ${K(x.walSize)}`,children:e(Ye,{checked:I,onCheckedChange:h,label:"截断 WAL",disabled:D})}),e(Y,{title:"执行清理",description:b?"请至少开启一项":`预计释放 ${K((g?x.reclaimableBytes:0)+(I||g?x.walSize:0))}`,children:e(_,{variant:"primary",size:"sm",onClick:()=>void O(),loading:D,disabled:b,children:"清理…"})})]})]})}var un=2000;function St(t){let i=le(t.state),[r,d]=a(void 0),[y,M]=a(!1),[B,I]=a("idle"),[h,g]=a(void 0),[c,D]=a(""),C=o(!1),E=o(void 0),O=o(void 0),L=o(0),x=o(!1),f=v((S)=>{let P=C.current&&!S.pending;if(!C.current&&S.pending)D("");if(C.current=S.pending,d(S),S.error)g(S.error),I("error");else if(S.pending)I(S.awaitingInput?"awaiting_input":"authorizing");else if(P&&S.connected)I("success");else if(!S.connected)I("idle")},[]);s(()=>{if(i.status!=="open")return;let S=new AbortController,P=!1;return t.providerAuthStatus(S.signal).then((H)=>{if(!P)f(H)},()=>{}),()=>{P=!0,S.abort()}},[t,i.status,f]);let W=v(async()=>{M(!0),g(void 0),I("authorizing"),x.current=!1;try{let S=await t.startProviderAuth();if(f(S),S.authorizeURL)window.open(S.authorizeURL,"_blank","noopener,noreferrer")}catch(S){g(S instanceof Error?S.message:String(S)),I("error")}finally{M(!1)}},[t,f]);s(()=>{if(!r?.pending)return;let S=!1,P=()=>{if(x.current)return;E.current?.abort();let H=new AbortController;E.current=H,t.providerAuthStatus(H.signal).then((b)=>{if(S||H.signal.aborted)return;let V=C.current&&!b.pending;if(f(b),V&&b.connected)Jr(t).catch((R)=>z(R,"刷新模型列表失败"))},()=>{})};return O.current=setInterval(P,un),()=>{if(S=!0,O.current)clearInterval(O.current);E.current?.abort()}},[t,r?.pending,f]);let N=v(async()=>{if(!c.trim())return;M(!0),g(void 0),x.current=!0;let S=++L.current;E.current?.abort();try{let P=await t.completeProviderAuth({url:c.trim()});if(S!==L.current)return;f(P),D("")}catch(P){if(S!==L.current)return;g(P instanceof Error?P.message:String(P)),I("error")}finally{if(x.current=!1,S===L.current)M(!1)}},[t,c,f]),T=v(async()=>{M(!0),g(void 0);try{await t.logoutProvider(),f({providerID:"openai",connected:!1,pending:!1}),I("idle"),await Jr(t)}catch(S){g(S instanceof Error?S.message:String(S)),I("error")}finally{M(!1)}},[t,f]),A=v(()=>{I("idle"),g(void 0),D("")},[]);return{status:r,busy:y,phase:B,error:h,manualURL:c,setManualURL:D,start:W,submitManual:N,logout:T,reset:A}}function wt(t){let{phase:i,busy:r}=t;if(t.connected)return n("div",{className:"flex items-center justify-between gap-3",children:[n("span",{className:"inline-flex items-center gap-1.5 text-xs text-success",children:[e("span",{className:"size-1.5 rounded-full bg-success"}),"已连接"]}),e(_,{variant:"ghost",className:"text-faint hover:text-danger",disabled:r,onClick:t.onLogout,children:r?"正在断开…":"断开连接"})]});return n(U.div,{layout:!0,className:"flex flex-col gap-3",children:[(i==="idle"||i==="success"||i==="error")&&n("div",{className:"flex flex-wrap items-center gap-2",children:[e(_,{disabled:r,onClick:t.onStart,children:r?"正在启动…":"登录 ChatGPT"}),i==="error"&&e(_,{variant:"ghost",className:"text-faint",onClick:t.onRetry,children:"重试"})]}),i==="authorizing"&&n("p",{className:"text-xs text-faint",children:["请在浏览器中完成授权。",t.authorizeURL&&n(m,{children:["未自动打开?",e("a",{href:t.authorizeURL,target:"_blank",rel:"noopener noreferrer",className:"ml-1 text-accent hover:underline",children:"手动打开"})]})]}),i==="awaiting_input"&&n("form",{className:"flex flex-col gap-2",onSubmit:(d)=>{d.preventDefault(),t.onSubmitManual()},children:[e("label",{htmlFor:"provider-auth-callback",className:"text-xs text-faint",children:t.instructions??"粘贴浏览器完成授权后跳转的完整 URL"}),e("input",{id:"provider-auth-callback",type:"url",className:"h-9 rounded-lg border border-line bg-raised px-3 text-xs text-ink outline-none placeholder:text-faint focus:border-accent",placeholder:"http://localhost:1455/auth/callback?code=…",value:t.manualURL,onChange:(d)=>t.onManualURLChange(d.target.value)}),e(_,{type:"submit",disabled:r||!t.manualURL.trim(),children:r?"正在提交…":"完成登录"})]}),i==="error"&&t.error&&e(yt,{children:t.error})]})}function Nt(t){let i=St(t.conn),r=i.status?.connected??!1;return e(ne,{title:"ChatGPT 订阅",description:"使用 ChatGPT 账号登录,访问你的订阅所包含的模型。登录由服务端完成,凭据不会离开服务器。",children:e(U.div,{layout:!0,className:"flex flex-col gap-3",children:e(Y,{title:r?"ChatGPT 账号":"连接 ChatGPT",description:r?`你好,${i.status?.displayName??"ChatGPT 用户"}`:"支持 ChatGPT Plus / Pro 订阅账号",children:e(wt,{connected:r,phase:i.phase,busy:i.busy,error:i.error,authorizeURL:i.status?.authorizeURL,instructions:i.status?.instructions,manualURL:i.manualURL,onManualURLChange:i.setManualURL,onStart:()=>void i.start(),onSubmitManual:()=>void i.submitManual(),onLogout:()=>void i.logout(),onRetry:i.reset})})})})}var He="off";function kt({conn:t}){let[i,r]=a(),[d,y]=a({models:[]});s(()=>{let h=new AbortController;return Promise.all([t.request("/api/folding/settings",{signal:h.signal}),t.models()]).then(([g,c])=>{if(h.signal.aborted)return;r(g),y(c)}).catch((g)=>{if(!h.signal.aborted)z(g,"读取折叠设置失败")}),()=>h.abort()},[t]);async function M(h){let g=i;r({digestModel:h});try{r(await t.request("/api/folding/settings",{method:"PUT",body:JSON.stringify({digestModel:h})}))}catch(c){r(g),z(c,"保存折叠设置失败")}}let B=i?.digestModel??null,I={models:[{id:He,name:"不使用"},...d.models.filter((h)=>h.available===!0||h.id===B)]};return e(ne,{title:"上下文折叠",children:e(Y,{title:"折叠摘要模型",description:"每轮结束后提炼关键事实,折叠后保留。建议选快速模型。",children:e("div",{className:"w-56",children:e(ea,{variant:"field",trustedOnly:!0,models:I,value:B??He,onChange:(h)=>{if(i)M(h===He?null:h).catch(()=>{return})}})})})})}function Ct(t){k();let i=ee(),[r,d]=a(""),[y,M]=a(0),[B,I]=a(null),[h,g]=a({name:"",contextWindow:"",maxTokens:""}),[c,D]=a(!1),[C,E]=a(),O=(S)=>{I(S),g({name:S.name,contextWindow:S.contextWindow?Rt(S.contextWindow):"",maxTokens:S.maxTokens?Rt(S.maxTokens):""}),E(void 0)},L=async(S)=>{if(S?.preventDefault(),!B||c)return;E(void 0);let P=h.contextWindow.trim(),H=P?Cr(P):void 0;if(P&&H===void 0){E("上下文窗口格式无效(支持 128k、200k、1m 或正整数)");return}let b=h.maxTokens.trim(),V=b?Cr(b):void 0;if(b&&V===void 0){E("最大输出格式无效(支持 8k、16k、8192 或正整数)");return}D(!0);try{let R={...B,name:h.name.trim()||B.id,contextWindow:H,maxTokens:V};await t.onUpdateModel?.(B.id,R),I(null)}catch(R){E(R instanceof Error?R.message:String(R))}finally{D(!1)}},x=r.trim().toLowerCase(),f=mc(t.provider.models).filter((S)=>`${S.id} ${S.name}`.toLowerCase().includes(x)),W=6,N=Math.max(1,Math.ceil(f.length/W)),T=Math.min(y,N-1),A=f.slice(T*W,(T+1)*W);return n(Ee,{children:[n("div",{className:p("surface.card","flex min-w-0 items-center gap-1 pr-2 transition-colors hover:bg-raised/60"),children:[n(Le,{className:"group/collapsible flex min-h-14 min-w-0 flex-1 items-center gap-3 py-2.5 pl-4 text-left focus-visible:-outline-offset-2",children:[e(Ve,{className:"shrink-0 text-faint"}),n("span",{className:"min-w-0 flex-1",children:[n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate text-sm font-medium text-ink",title:t.provider.name,children:t.provider.name}),t.provider.untrusted&&n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-warning",title:"只能对话或委派给受信模型:不加载工具、技能与 MCP,不注入运行环境",children:[e(Ut,{"aria-hidden":!0,className:"size-3.5"}),"不受信"]}),!t.provider.apiKeyConfigured&&n("span",{className:"inline-flex shrink-0 items-center gap-1.5 text-xs text-warning",children:[e("span",{"aria-hidden":!0,className:"size-1.5 rounded-full bg-warning"}),"未设置 Key"]})]}),n("span",{className:"mt-0.5 block truncate text-xs text-dim",children:[t.provider.id!==t.provider.name&&n(m,{children:[t.provider.id," · "]}),t.provider.protocol," · ",t.provider.models.length," 个模型",t.provider.defaultContextWindow?` · 默认 ${Rt(t.provider.defaultContextWindow)}`:""]})]})]}),e("div",{className:"@md/panel:hidden",children:n(sn,{className:"min-w-44 [&_[role=menuitem]]:min-h-11",trigger:e(_,{size:"icon",variant:"ghost",className:"size-11","aria-label":`${t.provider.name} 提供方操作`,children:e(Jt,{className:"size-5"})}),children:[e(ke,{icon:e(gt,{}),onSelect:t.onEdit,children:"编辑配置"}),e(ke,{icon:e(ge,{className:t.refreshing?"animate-spin":void 0}),disabled:t.refreshing,onSelect:t.onDiscover,children:t.refreshing?"正在刷新模型":"刷新模型"}),e(vr,{}),e(ke,{icon:e(xe,{}),danger:!0,onSelect:t.onRemove,children:"移除提供方"})]})}),n("div",{className:"hidden shrink-0 items-center @md/panel:flex",children:[e(G,{label:"编辑",className:"size-10",onClick:t.onEdit,children:e(gt,{className:"size-4"})}),e(G,{label:"刷新模型",className:"size-10",disabled:t.refreshing,onClick:t.onDiscover,children:e(ge,{className:u("size-4",t.refreshing&&"animate-spin")})}),e(G,{label:"移除",className:"size-10 text-danger",onClick:t.onRemove,children:e(xe,{className:"size-4"})})]})]}),e("div",{children:e(Se,{children:n("div",{children:[n("div",{className:"relative my-3 min-w-0",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),e(te,{type:"search","aria-label":`搜索 ${t.provider.name} 的模型`,placeholder:"搜索模型",value:r,onChange:(S)=>{d(S.target.value),M(0)},className:"h-10 min-w-0 pl-9"})]}),n("div",{className:"overflow-hidden rounded-2xl border border-line bg-panel",children:[e("div",{className:"auto-grid animate-fade gap-x-2 p-2",children:A.map((S)=>{let P="";if(S.contextWindow){let H=S.contextWindow.toLocaleString(),b=S.maxTokens?` (最大输出: ${S.maxTokens.toLocaleString()})`:"";P=`上下文窗口: ${H} tokens${b}`}return n("button",{type:"button",onClick:()=>O(S),className:"group/model flex min-w-0 items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-raised/80 focus-visible:outline-accent",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(We,{modelID:`${t.provider.id}/${S.id}`}),n("div",{className:"min-w-0",children:[e("div",{title:S.name,className:"truncate text-sm font-medium text-ink transition-colors group-hover/model:text-accent",children:S.name}),e("div",{title:S.id,className:"truncate font-mono text-2xs text-faint",children:S.id})]})]}),n("div",{className:"flex shrink-0 items-center gap-1.5",children:[S.contextWindow?e("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-3xs text-dim transition-colors group-hover/model:bg-panel",title:P,children:Rt(S.contextWindow)}):null,e(gt,{className:"size-3 text-faint opacity-0 transition-opacity group-hover/model:opacity-100"})]})]},S.id)})},`${x}:${T}`),f.length===0&&e("p",{className:"py-4 text-center text-sm text-faint",children:"没有匹配的模型"}),n("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line px-4 py-1",children:[n("span",{"aria-live":"polite",className:"text-xs text-faint",children:[f.length," 个模型 · ",T+1," / ",N," 页"]}),n("div",{className:"flex gap-1",children:[e(_,{size:"sm",variant:"ghost",disabled:T===0,onClick:()=>M(T-1),children:"上一页"}),e(_,{size:"sm",variant:"ghost",disabled:T+1>=N,onClick:()=>M(T+1),children:"下一页"})]})]})]})]})})}),e(qt,{open:Boolean(B),onOpenChange:(S)=>{if(!c&&!S)I(null)},title:"配置模型参数",description:B?n("span",{className:"flex items-center gap-1.5 font-mono text-xs",children:[e("span",{children:t.provider.name}),e("span",{children:"/"}),e("span",{className:"font-semibold text-ink",children:B.id})]}):void 0,size:"md",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(_,{disabled:c,onClick:()=>I(null),children:"取消"}),e(_,{type:"submit",form:i,loading:c,variant:"primary",children:"保存参数"})]}),children:n(At,{id:i,onSubmit:L,children:[e(oe,{label:"显示名称",hint:"在模型选择器与对话界面中显示的名称",children:(S)=>e(te,{id:S,value:h.name,onChange:(P)=>g({...h,name:P.target.value}),placeholder:B?.id})}),e(oe,{label:"上下文窗口 (Context Window)",hint:"单次会话最大可用上下文;留空继承提供方默认",children:(S)=>{let P=t.provider.defaultContextWindow?`继承提供方默认 (${Rt(t.provider.defaultContextWindow)})`:"继承系统默认 (300k)";return n("div",{className:"space-y-1.5",children:[e(te,{id:S,value:h.contextWindow,onChange:(H)=>g({...h,contextWindow:H.target.value}),placeholder:P}),n("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[e("span",{className:"text-2xs text-faint",children:"常用:"}),["128k","200k","500k","1m","2m"].map((H)=>e("button",{type:"button",onClick:()=>g((b)=>({...b,contextWindow:H})),className:u("rounded px-1.5 py-0.5 font-mono text-2xs transition-colors",h.contextWindow.toLowerCase()===H?"bg-accent/20 font-medium text-accent":"bg-raised text-dim hover:bg-raised/80 hover:text-ink"),children:H},H)),h.contextWindow&&e("button",{type:"button",onClick:()=>g((H)=>({...H,contextWindow:""})),className:"ml-1 text-2xs text-faint transition-colors hover:text-ink",children:"清空(继承)"})]})]})}}),e(oe,{label:"最大输出 (Max Tokens)",hint:"单次响应最大生成的 Token 数量;留空继承提供方默认",children:(S)=>{let P=t.provider.defaultMaxTokens?`继承提供方默认 (${Rt(t.provider.defaultMaxTokens)})`:"继承系统默认 (64k)";return n("div",{className:"space-y-1.5",children:[e(te,{id:S,value:h.maxTokens,onChange:(H)=>g({...h,maxTokens:H.target.value}),placeholder:P}),n("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[e("span",{className:"text-2xs text-faint",children:"常用:"}),["16k","32k","64k","128k"].map((H)=>e("button",{type:"button",onClick:()=>g((b)=>({...b,maxTokens:H})),className:u("rounded px-1.5 py-0.5 font-mono text-2xs transition-colors",h.maxTokens.toLowerCase()===H?"bg-accent/20 font-medium text-accent":"bg-raised text-dim hover:bg-raised/80 hover:text-ink"),children:H},H)),h.maxTokens&&e("button",{type:"button",onClick:()=>g((H)=>({...H,maxTokens:""})),className:"ml-1 text-2xs text-faint transition-colors hover:text-ink",children:"清空(继承)"})]})]})}}),e(yt,{children:C})]})})]})}function Mt(t){return k(),n(m,{children:[e(Nt,{conn:t.conn}),e(mn,{...t}),e(kt,{conn:t.conn})]})}var ye=new WeakMap;function Tt(){return{id:"",name:"",protocol:"openai-completions",baseUrl:"https://api.openai.com/v1",apiKey:"",models:[],defaultContextWindow:"",defaultMaxTokens:"",untrusted:!1}}function mn(t){k();let i=le(t.conn.state),r=ee(),[d,y]=a(!1),[M,B]=a(()=>ye.get(t.conn)??null),[I,h]=a(),[g,c]=a(!1),[D,C]=a(),[E,O]=a(),[L,x]=a(Tt),f=ks(t.conn).kind==="form",W=()=>{y(!1),na(t.conn,"form",{kind:"provider"})};s(()=>()=>na(t.conn,"form",{kind:"provider"}),[t.conn]),s(()=>{let b=ye.get(t.conn);if(b)B(b);if(i.status!=="open")return;let V=!1;return t.conn.modelProviders().then((R)=>{if(ye.set(t.conn,R),!V)B(R)}).catch((R)=>{if(!V)h(R instanceof Error?R.message:String(R))}),()=>{V=!0}},[t.conn,i.status]);let N=async()=>{if(g)return;h(void 0);let b=L.defaultContextWindow.trim(),V=b?Cr(b):void 0;if(b&&V===void 0){h("默认上下文窗口格式无效(支持 128k、200k、1m 或正整数)");return}let R=L.defaultMaxTokens.trim(),J=R?Cr(R):void 0;if(R&&J===void 0){h("默认最大输出格式无效(支持 8k、16k、8192 或正整数)");return}c(!0);try{let F={name:L.name.trim()||L.id.trim(),protocol:L.protocol,baseUrl:L.baseUrl,apiKey:L.apiKey,models:lc(L.models),defaultContextWindow:V,defaultMaxTokens:J,untrusted:L.untrusted},j=await t.conn.saveModelProvider(L.id.trim(),F);B((X)=>{let Q=[...(X??[]).filter((Z)=>Z.id!==j.id),j];return ye.set(t.conn,Q),Q}),await Jr(t.conn),y(!1),na(t.conn,"form",{kind:"saved",providerID:j.id,models:j.models.length})}catch(F){h(F instanceof Error?F.message:String(F))}finally{c(!1)}},T=(b)=>{O(b.id),x({id:b.id,name:b.name,protocol:b.protocol,baseUrl:b.baseUrl,apiKey:"",defaultContextWindow:b.defaultContextWindow?Rt(b.defaultContextWindow):"",defaultMaxTokens:b.defaultMaxTokens?Rt(b.defaultMaxTokens):"",models:b.models,untrusted:b.untrusted}),h(void 0),y(!0)},A=()=>{O(void 0),x(Tt())},S=async(b)=>{h(void 0),C(b.id);try{let V=await t.conn.discoverModelProvider(b.id);B((R)=>R?.map((J)=>J.id===V.id?V:J)??[V]),await Jr(t.conn)}catch(V){h(V instanceof Error?V.message:String(V))}finally{C(void 0)}},P=async(b)=>{if(!await Ge({title:`移除提供方「${b.name}」?`,description:"服务端会删除保存的 API key,并恢复同名内置提供方(如果存在)。",action:"移除",danger:!0}))return;try{await t.conn.removeModelProvider(b.id),B((R)=>R?.filter((J)=>J.id!==b.id)??null),await Jr(t.conn)}catch(R){h(R instanceof Error?R.message:String(R))}},H=async(b,V,R)=>{let J=b.models.map((X)=>X.id===V?R:X),F={name:b.name,protocol:b.protocol,baseUrl:b.baseUrl,apiKey:"",defaultContextWindow:b.defaultContextWindow,defaultMaxTokens:b.defaultMaxTokens,untrusted:b.untrusted,models:lc(J)},j=await t.conn.saveModelProvider(b.id,F);B((X)=>{let Q=X?.map((Z)=>Z.id===j.id?j:Z)??[j];return ye.set(t.conn,Q),Q}),await Jr(t.conn)};return n(ne,{title:"模型提供方",description:"配置提供方与模型目录",unboxed:!0,action:e(G,{className:"size-10",label:"添加提供方","data-tour":"add-provider",disabled:i.status!=="open",onClick:()=>{A(),h(void 0),y(!0),na(t.conn,"provider",{kind:"form"})},children:e(be,{className:"size-4"})}),children:[e(pe,{initial:!1,children:(M??[]).map((b)=>e(U.div,{...Aa,className:"overflow-hidden","data-tour-provider":b.id,children:e(Ct,{provider:b,refreshing:D===b.id,onEdit:()=>T(b),onDiscover:()=>void S(b),onRemove:()=>void P(b),onUpdateModel:(V,R)=>H(b,V,R)})},b.id))}),M?.length===0&&e("div",{className:p("surface.emptyDashed","py-12"),children:e("p",{className:"text-sm text-dim",children:"暂无模型提供方,点击右上方按钮添加。"})}),!d&&I&&e("div",{className:"p-4",children:e(yt,{children:I})}),e(qt,{open:d,onOpenChange:(b)=>{if(!g)if(b)y(!0);else W()},title:E?`编辑提供方:${E}`:"添加模型提供方",size:"lg",footer:n(m,{children:[e("div",{className:"flex-1 max-sm:hidden"}),e(_,{disabled:g,onClick:W,children:"取消"}),n(_,{type:"submit",form:r,loading:g,disabled:i.status!=="open","aria-label":g?"保存中":"保存提供方",children:[e(Me,{className:"size-3.5"}),"保存提供方"]})]}),children:n(At,{id:r,onSubmit:(b)=>{b.preventDefault(),N()},children:[f&&n("div",{className:"rounded-lg bg-accent/8 px-3 py-2.5 text-xs leading-5 text-dim ring-1 ring-accent/25",children:[e("span",{className:"mr-1.5 font-medium text-ink tabular-nums",children:"3 / 4"}),"Provider ID 起个好记的名字(如 deepseek),协议和 Base URL 按服务商文档填,再填上 API key。模型列表留空会自动获取,最后点「保存提供方」。"]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(oe,{label:"Provider ID",hint:"例如 openai、deepseek 或公司内部网关",children:(b)=>e(te,{id:b,value:L.id,disabled:Boolean(E),onChange:(V)=>x({...L,id:V.target.value}),placeholder:"openai"})}),e(oe,{label:"显示名称",hint:"不填就用 Provider ID",children:(b)=>e(te,{id:b,value:L.name,onChange:(V)=>x({...L,name:V.target.value}),placeholder:"OpenAI"})})]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(oe,{label:"协议",children:(b)=>e(tn,{id:b,value:L.protocol,onValueChange:(V)=>x({...L,protocol:V}),groups:[{options:Bc.map((V)=>({value:V,label:Fc[V]}))}]})}),e(oe,{label:"Base URL",hint:"只填写协议端点,不要把 API key 放进 URL",children:(b)=>e(te,{id:b,type:"url",value:L.baseUrl,onChange:(V)=>x({...L,baseUrl:V.target.value}),placeholder:"https://api.example.com/v1"})})]}),e(oe,{label:"API key",hint:"留空表示保留已保存的 key;本地兼容服务可以留空",children:(b)=>e(te,{id:b,type:"password",value:L.apiKey,onChange:(V)=>x({...L,apiKey:V.target.value}),placeholder:"sk-…",autoComplete:"new-password"})}),n("div",{className:u("flex items-start justify-between gap-4 rounded-xl border border-line bg-bg/60 px-4 py-3",L.untrusted&&"border-warning/45 bg-warning/8"),children:[n("span",{className:"min-w-0",children:[e("span",{className:"block text-sm text-ink",children:"不受信的服务商"}),e("span",{className:"mt-0.5 block text-xs text-dim",children:"非官方或来源不明的服务商。开启后它的模型拿不到工具、技能、MCP、运行环境和项目信息,只能对话,或把需要动手的活委派给受信服务商的模型"})]}),e(Ye,{label:"不受信的服务商",checked:L.untrusted,onCheckedChange:(b)=>x({...L,untrusted:b}),className:"mt-0.5 shrink-0"})]}),n("div",{className:"grid gap-4 sm:grid-cols-2",children:[e(oe,{label:"默认上下文窗口",hint:"模型未单独指定时生效,例如 128k、200k、1m 或正整数",children:(b)=>e(te,{id:b,value:L.defaultContextWindow,onChange:(V)=>x({...L,defaultContextWindow:V.target.value}),placeholder:"300k"})}),e(oe,{label:"默认最大输出",hint:"单次回复生成上限,例如 16k、32k、64k 或正整数",children:(b)=>e(te,{id:b,value:L.defaultMaxTokens,onChange:(V)=>x({...L,defaultMaxTokens:V.target.value}),placeholder:"64k"})})]}),e(oe,{label:"模型列表",hint:"留空保存将从 Base URL 自动获取;也可在此手动添加或删除模型",children:(b)=>e(fn,{inputId:b,providerID:L.id.trim(),models:L.models,onChange:(V)=>x({...L,models:V})})}),e(yt,{children:I})]})})]})}function fn(t){let[i,r]=a(""),[d,y]=a(""),M=(g=i)=>{let c=g.split(/[\r\n;]+|,(?![^[\]]*\])/).map((O)=>O.trim()).filter(Boolean).join(`
|
|
2
|
+
`),D=zc(c);if(D.length===0)return;let C=new Set(t.models.map((O)=>O.id)),E=D.filter((O)=>{if(C.has(O.id))return!1;return C.add(O.id),!0});if(E.length>0)t.onChange([...t.models,...E]);r("")},B=(g)=>{t.onChange(t.models.filter((c)=>c.id!==g))},I=d.trim().toLowerCase(),h=I?t.models.filter((g)=>`${g.id} ${g.name}`.toLowerCase().includes(I)):t.models;return n("div",{className:"space-y-2",children:[n("div",{className:"flex gap-2",children:[e(te,{id:t.inputId,value:i,onChange:(g)=>r(g.target.value),onKeyDown:(g)=>{if(g.key==="Enter")g.preventDefault(),M()},onPaste:(g)=>{let c=g.clipboardData.getData("text");if(/[\r\n,;]/.test(c))g.preventDefault(),M(c)},placeholder:"输入模型 ID(回车添加,支持逗号或换行批量粘贴)",className:"min-w-0 flex-1"}),n(_,{type:"button",disabled:!i.trim(),onClick:()=>M(),children:[e(be,{className:"size-3.5"}),"添加"]})]}),t.models.length===0?e("div",{className:"rounded-xl border border-dashed border-line bg-bg/40 px-3 py-3 text-center text-xs text-dim",children:"暂无手动指定模型,保存后将从 Base URL 自动获取"}):n("div",{className:"overflow-hidden rounded-xl border border-line bg-bg/50",children:[n("div",{className:"flex items-center justify-between gap-2 border-b border-line px-3 py-1.5 text-xs text-dim",children:[n("span",{children:["共 ",t.models.length," 个模型"]}),e("button",{type:"button",onClick:()=>{t.onChange([]),y("")},className:"text-dim transition-colors hover:text-danger",children:"清空列表"})]}),t.models.length>5&&n("div",{className:"relative border-b border-line px-2 py-1.5",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3.5 left-4.5 size-3.5 text-faint"}),e(te,{type:"search",value:d,onChange:(g)=>y(g.target.value),placeholder:"筛选已添加的模型","aria-label":"筛选已添加的模型",className:"h-8 pl-8 text-xs"})]}),n("div",{className:"max-h-48 divide-y divide-line/60 overflow-y-auto",children:[h.map((g)=>{let c=[g.contextWindow?Rt(g.contextWindow):null,g.maxTokens?Rt(g.maxTokens):null].filter(Boolean).join(" / ");return n("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 text-sm hover:bg-raised/60",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(We,{modelID:t.providerID?`${t.providerID}/${g.id}`:g.id,className:"size-4 shrink-0"}),e("span",{className:"truncate font-mono text-xs text-ink",title:g.id,children:g.id}),g.name!==g.id&&e("span",{className:"truncate text-xs text-dim",title:g.name,children:g.name})]}),n("div",{className:"flex shrink-0 items-center gap-2",children:[c&&e("span",{className:"rounded bg-raised px-1.5 py-0.5 font-mono text-2xs text-dim",children:c}),e("button",{type:"button","aria-label":`移除模型 ${g.id}`,onClick:()=>B(g.id),className:"rounded p-1 text-faint transition-colors hover:bg-raised hover:text-danger",children:e(ce,{className:"size-3.5"})})]})]},g.id)}),h.length===0&&e("p",{className:"py-3 text-center text-xs text-faint",children:"没有匹配的模型"})]})]})]})}function pn(t){return!(t.web?.some((r)=>r.kind==="tab")??!1)&&_s(t.id,"settings")}function Dt(t){let i={tools:[],commands:[],pages:[],routes:[],hooks:[],others:[]},r=new Map((t.web??[]).map((d)=>[d.id,d]));for(let d of t.registrations)switch(d.kind){case"tool":{i.tools.push(d.name);break}case"command":{let y=r.get(d.id)?.commandTitle??r.get(d.id)?.title??d.id;i.commands.push(y);break}case"web":{let y=r.get(d.id);if(y?.kind==="sidebar")i.pages.push(`侧栏: ${y.title}`);else if(y?.kind!=="command")i.pages.push(y?.title??d.id);break}case"route":{i.routes.push({method:d.method,path:d.path});break}case"websocket":{i.routes.push({method:"WS",path:d.path});break}case"hook":{i.hooks.push(d.name);break}case"policy":{i.others.push(`策略 ${d.id}`);break}case"history-resolver":{i.others.push("历史解析");break}}return i}function Ke(t){let i=new Map(t.map((c)=>[c.id,c])),r=new Map,d=new Map;for(let c of t){let D=(c.deps??[]).filter((C)=>C!==c.id);r.set(c.id,D);for(let C of D){let E=d.get(C)??[];if(!E.includes(c.id))E.push(c.id),d.set(C,E)}}let y=new Set;for(let[c,D]of r.entries())if(D.length>0)y.add(c);for(let[c,D]of d.entries())if(D.length>0)y.add(c);let M=[];for(let c of t)if(!y.has(c.id))M.push(c);let B=[],I=new Set;for(let c of y){let D=r.get(c)??[],C=d.get(c)??[],E=i.get(c);if(!E)continue;if(D.length===0&&C.length>0)B.push(E)}for(let c of y){let D=i.get(c);if(!D)continue;if(!(r.get(c)??[]).some((O)=>i.has(O))&&!B.some((O)=>O.id===c))B.push(D)}function h(c,D,C){I.add(c.id);let E=[...C,c.id],O=d.get(c.id)??[],L=[];for(let x of O){if(E.includes(x))continue;let f=i.get(x);if(f)L.push(h(f,D+1,E))}return{plugin:c,depth:D,depPath:E,children:L}}let g=B.map((c)=>h(c,0,[]));for(let c of y)if(!I.has(c)){let D=i.get(c);if(D)g.push(h(D,0,[]))}return{trees:g,standalones:M,depsMap:r,dependentsMap:d}}var gn=2400;function vn(t){let{plugin:i,busy:r,pending:d,reloaded:y,deps:M,offDeps:B,pluginMetadata:I,onSelect:h,onToggle:g,onConfigure:c}=t,D=I.get(i.id),C=D?.icon??Ht,E=i.status==="error",O=i.status==="disabled",L=!O&&pn(i),x=D?.description??i.description??"",f=x;if(d)f=e("span",{className:"animate-pulse text-dim",children:O?"卸载中…":"装载中…"});else if(E)f=e("span",{className:"text-danger/85",children:i.error??"加载失败"});else if(y)f=e("span",{className:"text-success",children:"刚刚已重载"});else if(O&&B.length>0)f=`随 ${B.join("、")} 停用`;return e(Ki,{name:e("span",{className:u(E&&"text-danger"),children:i.id}),selectLabel:`查看插件 ${i.id}`,onSelect:()=>h(i),title:E?i.error:x,meta:`v${i.version}`,description:f,icon:e(C,{}),inactive:O,highlight:y,aside:M.length>0&&n("span",{className:"font-mono text-2xs text-faint",title:"依赖的插件",children:["← ",M.join(" ")]}),actions:L&&e(G,{label:`${i.id} 设置`,size:"icon-sm",onClick:()=>c(i),children:e(vt,{className:"size-3.5"})}),toggle:{checked:!O,label:`启用 ${i.id}`,disabled:r,onCheckedChange:()=>g(i)}})}function It(t){return n("li",{className:"flex h-8 items-center gap-2 bg-raised/30 px-4 font-mono text-2xs text-faint uppercase tracking-wider",children:[t.label,e("span",{className:"text-faint/60",children:t.count})]})}function Lt(t){let{plugins:i,busy:r,pending:d,query:y,pluginMetadata:M,onSelect:B,onToggle:I,onConfigure:h}=t,g=w(()=>Ke(i),[i]),c=y.trim().toLowerCase(),D=o(new Map),C=o(new Set),[E,O]=a(new Set);s(()=>{let A=[];for(let P of i){if(D.current.has(P.id)&&P.webRevision&&D.current.get(P.id)!==P.webRevision)A.push(P.id);D.current.set(P.id,P.webRevision)}if(A.length===0)return;O((P)=>new Set([...P,...A]));let S=setTimeout(()=>{C.current.delete(S),O((P)=>new Set([...P].filter((H)=>!A.includes(H))))},gn);C.current.add(S)},[i]),s(()=>{let A=C.current;return()=>{for(let S of A)clearTimeout(S)}},[]);let L=w(()=>[...!c?i:i.filter((S)=>S.id.toLowerCase().includes(c)||(S.description??"").toLowerCase().includes(c)||(M.get(S.id)?.description??"").toLowerCase().includes(c))].sort((S,P)=>S.id.localeCompare(P.id,"en")),[i,c,M]);if(L.length===0)return n("p",{className:"p-6 text-center text-dim text-sm",children:["没有匹配「",y.trim(),"」的插件"]});let x=new Map(i.map((A)=>[A.id,A.status])),f=L.filter((A)=>!A.builtin),W=L.filter((A)=>A.builtin),N=f.length>0&&W.length>0;function T(A){let S=g.depsMap.get(A.id)??[];return e("li",{children:e(vn,{plugin:A,busy:r,pending:d===A.id,reloaded:E.has(A.id),deps:S,offDeps:S.filter((P)=>x.get(P)==="disabled"),pluginMetadata:M,onSelect:B,onToggle:I,onConfigure:h})},A.id)}return n("ul",{className:"divide-y divide-line",children:[N&&e(It,{label:"用户",count:f.length}),f.map(T),N&&e(It,{label:"内置",count:W.length}),W.map(T)]})}function Et(){return new Map(Re().map((t)=>[t.id,t.metadata]))}var ze=Et();bn(()=>{ze=Et()});var xn={enabled:{label:"已启用",dot:"bg-success"},disabled:{label:"已禁用",dot:"bg-faint"},error:{label:"出错",dot:"bg-danger"}};function hn(t){return!(t.web?.some((r)=>r.kind==="tab")??!1)&&_s(t.id,"settings")}function yn(t){Te();let{plugin:i,depsMap:r,dependentsMap:d}=t,y=w(()=>Dt(i),[i]),M=i.status==="disabled",B=y.hooks.length>0||y.routes.length>0||y.others.length>0,I=y.pages.length>0||y.tools.length>0||y.commands.length>0,h=(r?.get(i.id)??i.deps??[]).filter((c)=>c!==i.id),g=d?.get(i.id)??[];return n("div",{className:"space-y-3 text-xs leading-5",children:[ve.errors.get(i.id)&&n("p",{role:"alert",className:"text-danger",children:["Web: ",ve.errors.get(i.id)]}),i.error&&n("div",{role:"alert",className:"rounded-xl bg-danger/8 p-3 text-xs leading-5 text-danger",children:[e("p",{className:"mb-1 font-medium font-sans",children:i.status==="enabled"?"重载失败,仍在运行上一版本":"插件加载异常"}),e("pre",{className:"whitespace-pre-wrap font-mono [overflow-wrap:anywhere]",children:i.error})]}),n(ys,{children:[h.length>0&&e(ta,{label:"依赖",children:h.map((c)=>{let C=(t.plugins??[]).find((E)=>E.id===c)?.status==="disabled";return e("button",{type:"button",onClick:()=>t.onSelectPlugin?.(c),className:u(bi,"cursor-pointer transition-colors hover:text-ink",C&&"text-warning"),title:C?"依赖插件已停用,可能影响功能":"点击查看该插件",children:C?`${c}(未启用)`:c},c)})}),g.length>0&&e(ta,{label:"被依赖",children:g.map((c)=>e("button",{type:"button",onClick:()=>t.onSelectPlugin?.(c),className:u(bi,"cursor-pointer transition-colors hover:text-ink"),title:"点击查看依赖此插件的下游插件",children:c},c))}),M?e("p",{className:"py-2.5 text-faint",children:"该插件当前处于停用状态,启用后接管对应功能与服务。"}):n(m,{children:[y.pages.length>0&&e(ta,{label:"界面",children:y.pages.map((c)=>e(xi,{children:c},c))}),y.tools.length>0&&e(ta,{label:"工具",children:y.tools.map((c)=>e(xi,{mono:!0,children:c},c))}),y.commands.length>0&&e(ta,{label:"命令",children:y.commands.map((c)=>e(xi,{children:c},c))}),B&&n(bs,{label:"接口",summary:[y.hooks.length>0&&`${y.hooks.length} 个钩子`,y.routes.length>0&&`${y.routes.length} 条路由`,y.others.length>0&&`${y.others.length} 项其他注册`].filter(Boolean).join(","),children:[y.hooks.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"生命周期事件钩子"}),e("div",{className:"flex flex-wrap gap-1.5",children:y.hooks.map((c)=>e("span",{className:u(bi,"font-mono text-2xs"),children:c},c))})]}),y.routes.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"HTTP / WebSocket 路由"}),e("div",{className:"space-y-0.5 font-mono text-2xs text-dim",children:y.routes.map((c)=>n("div",{className:"grid grid-cols-[3rem_minmax(0,1fr)] gap-2",children:[e("span",{className:"text-faint",children:c.method}),e("span",{className:"[overflow-wrap:anywhere]",children:c.path})]},`${c.method} ${c.path}`))})]}),y.others.length>0&&n("div",{className:"space-y-1.5",children:[e("span",{className:"text-2xs text-faint",children:"其他注册"}),e("div",{className:"flex flex-wrap gap-1.5",children:y.others.map((c)=>e("span",{className:u(bi,"text-2xs"),children:c},c))})]})]}),!I&&!B&&!i.error&&e("p",{className:"py-2.5 text-faint",children:"该插件没有向外部暴露界面或工具能力"})]})]}),t.failed&&e("p",{role:"alert",className:"text-xs text-danger",children:t.failed})]})}function Sn(){return e("div",{role:"status","aria-label":"正在加载",className:"divide-y divide-line",children:[0,1,2,3,4].map((t)=>n("div",{className:"flex h-13 items-center gap-3 px-4",children:[e("div",{className:"size-7 shrink-0 animate-pulse rounded-md bg-raised"}),e("div",{className:"h-3 w-20 animate-pulse rounded bg-raised"}),e("div",{className:"h-3 w-1/3 animate-pulse rounded bg-raised"})]},t))})}function $t({conn:t}){k(),Te();let[i,r]=a(()=>{let R=t.state.get();return R.pluginsLoaded?R.plugins:void 0}),[d,y]=a(""),[M,B]=a(),[I,h]=a(),[g,c]=a(""),[D,C]=a(),[E,O]=a("details"),[L,x]=a(null),f=o(0),W=o(!1),N=o({}),T=v(()=>{if(W.current)return;let R=++f.current;y(""),t.plugins().then(()=>{if(R===f.current)r(t.state.get().plugins)},(J)=>{if(R===f.current)y(je(J))})},[t]);s(()=>{B(void 0);let R=t.state.get().plugins,J=t.state.subscribe((F)=>{if(F.plugins===R)return;R=F.plugins,r(F.plugins)});return T(),()=>{J(),f.current++,W.current=!1}},[T,t]);async function A(R,J){if(W.current)return;if(J){let Q=Date.now(),Z=N.current[R.id]??0;if(Q-Z<500)return;N.current[R.id]=Q}let F=++f.current;W.current=!0,B(R.id),h(void 0);let j=R.status==="disabled",X=R.id;try{if(J){if(await t.reloadPlugin(R.id),F===f.current)r(t.state.get().plugins);return}let Q=await t.plugins();if(F!==f.current)return;r(t.state.get().plugins);let Z=new Map(Q.map((q)=>[q.id,q])),ae=[],me=new Set,fe=new Set,he=(q)=>{if(fe.has(q))return;if(me.has(q))throw Error(`插件依赖存在循环:${q}`);let se=Z.get(q);if(!se)throw Error(`找不到插件依赖:${q}`);if(me.add(q),j){if(se.status==="error")throw Error(`请先修复依赖插件 ${q} 的加载错误`);for(let ie of se.deps??[])he(ie)}else for(let ie of Q)if(ie.status!=="disabled"&&ie.deps?.includes(q))he(ie.id);if(me.delete(q),fe.add(q),j?se.status!=="enabled":se.status!=="disabled")ae.push(se)};he(R.id);let Ce=ae.filter((q)=>q.id!==R.id);if(Ce.length>0){let q=Ce.map((ie)=>ie.id).join("、");if(!await Ge({title:j?"同时启用依赖插件?":"同时禁用依赖此插件的插件?",description:j?`启用 ${R.id} 需要先启用:${q}。是否继续?`:`${q} 依赖 ${R.id},将先禁用这些插件,再禁用 ${R.id}。是否继续?`,action:j?"级联启用":"级联禁用",danger:!j}))return}for(let q of ae){if(F!==f.current)return;X=q.id,r((ie)=>ie?.map((Fe)=>Fe.id===q.id?{...Fe,status:j?"enabled":"disabled",error:void 0}:Fe));let se=await t.enablePlugin(q.id,j);if(F!==f.current)return;if(r(t.state.get().plugins),se.find((ie)=>ie.id===q.id)?.status!==(j?"enabled":"disabled"))throw Error(`插件 ${q.id} 未进入预期状态,请刷新后重试`)}}catch(Q){if(F!==f.current)return;let Z=J?"重载失败":`更新 ${X} 失败,后续操作已停止`;h({id:R.id,message:Z}),z(Q,Z);try{if(await t.plugins(),F===f.current)r(t.state.get().plugins)}catch(ae){if(F===f.current)y(`刷新插件状态失败:${je(ae)}`)}}finally{if(F===f.current)W.current=!1,B(void 0)}}let S=w(()=>Ke(i??[]),[i]),P=D?i?.find((R)=>R.id===D):void 0,H=o(void 0);if(P)H.current=P;let b=P??H.current,V=i?`内置 ${i.filter((R)=>R.builtin).length},用户 ${i.filter((R)=>!R.builtin).length}`:"";return n("div",{className:"min-w-0 space-y-6",children:[n("section",{className:"min-w-0",children:[n("div",{className:"mb-2.5 flex flex-wrap items-end justify-between gap-3 px-0.5",children:[n("div",{className:"min-w-0 flex-1 basis-48",children:[e("h2",{className:"font-medium text-ui text-dim",children:"插件"}),e("p",{className:"mt-0.5 text-faint text-xs",children:V})]}),e(G,{label:"刷新",className:"size-10",disabled:M!==void 0,onClick:T,children:e(ge,{className:"size-4"})})]}),d&&n("div",{role:"alert",className:"mb-3 flex flex-wrap items-center gap-2 rounded-xl border border-line p-3",children:[n("p",{className:"min-w-0 flex-1 break-words text-danger text-sm",children:["无法读取插件:",d]}),e(_,{className:"h-10",onClick:T,children:"重试"})]}),n("div",{className:"relative mb-3 min-w-0",children:[e(Oe,{"aria-hidden":!0,className:"pointer-events-none absolute top-3 left-3 size-4 text-faint"}),e(te,{type:"search","aria-label":"搜索插件",placeholder:"搜索插件",value:g,onChange:(R)=>c(R.target.value),className:"h-10 min-w-0 pl-9"})]}),e("div",{className:p("settings.groupBox"),children:!i?!d&&e(Sn,{}):e(Lt,{plugins:i,busy:M!==void 0,pending:M,query:g,pluginMetadata:ze,onSelect:(R)=>{C(R.id),O("details")},onToggle:(R)=>void A(R,!1),onConfigure:(R)=>{C(R.id),O("settings")}})})]}),e(qt,{open:Boolean(D),onOpenChange:(R)=>{if(!R)C(void 0),O("details")},size:"lg",title:b&&(E==="settings"?n("div",{className:"flex items-center gap-2",children:[n(_,{variant:"ghost",size:"sm",className:"h-7 px-1.5 text-xs text-dim hover:text-ink",onClick:()=>O("details"),children:[e(fr,{className:"mr-1 size-3.5"}),"返回详情"]}),n("span",{className:"font-semibold text-ink text-base",children:[b.id," 设置"]})]}):e(vs,{icon:(()=>{let R=ze.get(b.id)?.icon??Ht;return e(R,{})})(),name:b.id,meta:[b.builtin?"内置":"用户插件",`v${b.version}`,b.webBundle&&"Web"]})),description:b&&(E==="settings"?void 0:e("span",{className:"mt-2 block leading-5.5",children:ze.get(b.id)?.description??b.description})),footer:b&&(E==="settings"?e("div",{ref:x,className:"flex w-full flex-wrap items-center justify-end gap-2"}):n("div",{className:"flex w-full items-center justify-between gap-2 max-sm:[&>*]:flex-none",children:[n("div",{className:"inline-flex items-center gap-2.5 text-ui text-dim",children:[e(Ye,{label:`启用 ${b.id}`,checked:b.status!=="disabled",disabled:M!==void 0,onCheckedChange:()=>void A(b,!1)}),e("span",{className:u(b.status==="error"&&"text-danger"),children:xn[b.status].label})]}),n("div",{className:"flex items-center gap-1.5",children:[e(G,{label:"重载插件",disabled:M!==void 0||b.status==="disabled",onClick:()=>void A(b,!0),children:e(ge,{className:u("size-4",M===b.id&&"animate-spin")})}),hn(b)&&b.status!=="disabled"&&n(_,{size:"sm",onClick:()=>O("settings"),children:[e(vt,{className:"size-3.5"}),e("span",{children:"设置"})]})]})]})),children:b&&(E==="settings"?e(Xi,{value:{footer:L},children:e("div",{className:"py-1",children:e(ws,{pluginID:b.id,viewID:"settings",connection:t,onClose:()=>{C(void 0),O("details")}})})}):e(yn,{plugin:b,busy:M===b.id,failed:I?.id===b.id?I.message:void 0,plugins:i??[],depsMap:S.depsMap,dependentsMap:S.dependentsMap,onSelectPlugin:(R)=>{C(R),O("details")}}))})]})}var we="__direct",Je="__inherit";function Ft({conn:t}){k();let i=le(t.state).status,[r,d]=a(),[y,M]=a(),[B,I]=a([]),[h,g]=a(),[c,D]=a(),C=o(void 0),E=v(async(N)=>{g("loading"),D(void 0);try{let T=await t.proxyConfiguration(N);if(N?.aborted)return;d(Ie(T)),M(Ie(T)),I(T.targets)}catch(T){if(!N?.aborted)D(T instanceof Error?T.message:String(T))}finally{if(!N?.aborted)g(void 0)}},[t]);s(()=>{let N=new AbortController;if(C.current=N,d(void 0),M(void 0),D(void 0),i==="open")E(N.signal);return()=>N.abort()},[i,E]);let O=(N)=>{d((T)=>T?N(T):T)},L=(N,T)=>{O((A)=>({...A,profiles:A.profiles.map((S)=>S.id===N?{...S,...T}:S)}))},x=async()=>{if(!r)return;let N=C.current;if(!N||N.signal.aborted)return;g("saving"),D(void 0);try{let T=await t.saveProxyConfiguration(r,N.signal);if(N.signal.aborted)return;d(Ie(T)),M(Ie(T)),I(T.targets)}catch(T){if(!N.signal.aborted)D(T instanceof Error?T.message:String(T))}finally{if(!N.signal.aborted)g(void 0)}},f=r&&y?JSON.stringify(r)!==JSON.stringify(y):!1,W=[{value:we,label:"直接连接"},...r?.profiles.map((N)=>({value:N.id,label:N.name}))??[]];if(i!=="open")return e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求。",children:e(Y,{title:"连接服务器后可配置代理",description:"代理设置保存在服务器上,连接后即可读取和保存。"})});if(!r)return e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求。",children:e(Y,{title:c?"无法读取代理设置":"正在读取代理设置…",description:c?e("span",{className:"text-danger",children:c}):void 0,children:c&&e(_,{loading:h==="loading",onClick:()=>void E(C.current?.signal),children:"重新加载"})})});return n(At,{className:"gap-6",noValidate:!0,onSubmit:(N)=>{N.preventDefault(),x()},children:[e(ne,{title:"代理",description:"控制当前服务器发起的外发 HTTP 请求;本机回环地址始终直连。",children:e(Y,{title:"默认线路",description:"没有单独分流的模型、订阅登录和程序更新使用这条线路。",children:e(tn,{ariaLabel:"默认代理线路",className:"w-56",value:r.defaultProfileID??we,disabled:h!==void 0,onValueChange:(N)=>O((T)=>({...T,defaultProfileID:N===we?void 0:N})),groups:[{options:W}]})})}),e(ne,{title:"代理服务器",description:"支持 HTTP / HTTPS 代理;地址中的账号密码请拆到独立字段。",unboxed:!0,action:n(_,{size:"sm",disabled:h!==void 0,onClick:()=>O((N)=>({...N,profiles:[...N.profiles,{id:Bt(),name:`代理 ${N.profiles.length+1}`,address:"http://127.0.0.1:8080",tls:"verify",noProxy:[]}]})),children:[e(be,{className:"size-3.5"}),"添加代理"]}),children:r.profiles.length===0?e("div",{className:p("surface.emptyDashed","py-10 text-sm text-dim"),children:"尚未添加代理,所有请求直接连接。"}):r.profiles.map((N)=>n("section",{className:p("surface.card","flex flex-col gap-4 p-4"),children:[n("div",{className:"flex items-center justify-between gap-3",children:[n("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium text-ink",children:[e(Pe,{className:"size-4 shrink-0 text-dim"}),e("span",{className:"truncate",children:N.name||"未命名代理"})]}),e(G,{label:`删除${N.name||"代理"}`,className:"text-danger",disabled:h!==void 0,onClick:()=>O((T)=>({...T,defaultProfileID:T.defaultProfileID===N.id?void 0:T.defaultProfileID,profiles:T.profiles.filter((A)=>A.id!==N.id),routes:Object.fromEntries(Object.entries(T.routes).filter(([,A])=>A!==N.id))})),children:e(xe,{className:"size-4"})})]}),n("div",{className:"grid gap-3 md:grid-cols-2",children:[e(oe,{label:"名称",children:(T)=>e(te,{id:T,value:N.name,onChange:(A)=>L(N.id,{name:A.target.value})})}),e(oe,{label:"代理地址",children:(T)=>e(te,{id:T,type:"url",value:N.address,placeholder:"http://proxy.example.com:8080",autoComplete:"off",spellCheck:!1,onChange:(A)=>L(N.id,{address:A.target.value})})}),e(oe,{label:"用户名(可选)",children:(T)=>e(te,{id:T,value:N.username??"",autoComplete:"off",onChange:(A)=>L(N.id,{username:A.target.value||void 0})})}),e(oe,{label:"密码(可选)",hint:"留空表示沿用已保存密码。",children:(T)=>e(te,{id:T,type:"password",value:N.password??"",autoComplete:"new-password",onChange:(A)=>L(N.id,{password:A.target.value||void 0})})}),e(oe,{label:"HTTPS 证书校验",children:(T)=>e(tn,{id:T,value:N.tls,onValueChange:(A)=>L(N.id,{tls:A==="insecure"?"insecure":"verify"}),groups:[{options:[{value:"verify",label:"校验证书(推荐)"},{value:"insecure",label:"跳过校验(仅调试)"}]}]})}),e(oe,{label:"额外直连主机",hint:"多个主机用逗号分隔;localhost 与回环地址无需填写。",children:(T)=>e(te,{id:T,value:N.noProxy?.join(", ")??"",placeholder:"internal.example.com",onChange:(A)=>L(N.id,{noProxy:A.target.value.split(",").map((S)=>S.trim()).filter(Boolean)})})})]})]},N.id))}),e(ne,{title:"分流规则",description:"可按模型提供方、ChatGPT 订阅登录或程序更新覆盖默认线路。",children:B.map((N)=>{let A=Object.hasOwn(r.routes,N.id)?r.routes[N.id]??we:Je;return e(Y,{title:N.name,description:e("span",{className:"font-mono",children:N.id}),children:e(tn,{ariaLabel:`${N.name}使用的代理线路`,className:"w-56",value:A,disabled:h!==void 0,onValueChange:(S)=>O((P)=>{let H={...P.routes};if(S===Je)delete H[N.id];else H[N.id]=S===we?null:S;return{...P,routes:H}}),groups:[{options:[{value:Je,label:"跟随默认线路"},...W]}]})},N.id)})}),e(yt,{children:c}),n(gs,{children:[e(_,{disabled:h!==void 0||!f,onClick:()=>y&&d(structuredClone(y)),children:"撤销更改"}),n(_,{type:"submit",variant:"primary",disabled:h!==void 0||!f,loading:h==="saving",children:[e(Me,{className:"size-3.5"}),"保存代理设置"]})]})]})}function Ie(t){return{version:1,defaultProfileID:t.defaultProfileID,routes:{...t.routes},profiles:t.profiles.map((i)=>({id:i.id,name:i.name,address:i.address,username:i.username,password:"",tls:i.tls,noProxy:[...i.noProxy??[]]}))}}function Wt({conn:t}){let[i,r]=a(0);return e(wn,{conn:t,onRetry:()=>r((d)=>d+1)},i)}function wn({conn:t,onRetry:i}){let r=le(t.state).status==="open",[d,y]=a(),[M,B]=a(),[I,h]=a(),g=o(void 0);s(()=>{let D=new AbortController;if(g.current=D,y(void 0),B(void 0),r)h("load"),t.networkSettings(D.signal).then((C)=>{if(D.signal.aborted)return;y(C),h(void 0)},(C)=>{if(D.signal.aborted)return;let E=C instanceof Error&&"status"in C&&C.status===404;B(E?"当前服务版本不支持局域网设置,请更新服务端。":Gt(C)),h(void 0)});return()=>D.abort()},[t,r]);async function c(D){let C=g.current;if(!C||C.signal.aborted||I)return;h("update"),B(void 0);try{let E=await t.saveNetworkSettings({lanEnabled:D},C.signal);if(C.signal.aborted)return;y(E)}catch(E){if(!C.signal.aborted)B(Gt(E))}finally{if(!C.signal.aborted)h(void 0)}}if(!r)return e(Y,{title:"开放局域网",description:"连接服务器后可查看网络设置。"});if(!d)return e(Y,{title:"开放局域网",description:M??"正在读取网络设置…",children:M&&e(_,{size:"sm",onClick:i,children:"重试"})});return n(m,{children:[e(Y,{title:"开放局域网",description:n("div",{className:"space-y-2",children:[e("p",{children:"设备需配对。HTTP 不加密,仅限可信网络。"}),d.disabledReason&&e("p",{children:d.disabledReason}),M&&e("p",{role:"alert",className:"text-danger",children:M})]}),children:e(Ye,{label:"开放局域网",checked:d.settings.lanEnabled,onCheckedChange:c,disabled:!d.editable||I!==void 0})}),d.current.remote&&e(Y,{title:"局域网连接地址",description:n("div",{className:"space-y-2",children:[e("p",{children:"其他设备使用配对码连接。"}),d.addresses.length===0&&e("p",{children:"未发现局域网 IPv4 地址,请检查网卡。"}),d.addresses.map((D)=>e(te,{"aria-label":`局域网地址 ${D.address}`,value:D.url,readOnly:!0,className:"font-mono",onFocus:(C)=>C.currentTarget.select()},D.address))]})})]})}function Gt(t){return t instanceof Error?t.message:"网络设置请求失败,请重试。"}var kn=/^([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/,Cn=2000,Ot=15000,Pn={off:"已关闭",starting:"连接中",connected:"已连接",error:"连接失败,重试中","missing-binary":"未安装 cloudflared"},Tn=["c07321b023e944ff818fec44d8203567","4755a26eedb94da69e1066d98aa820be","c8fed203ed3043cba015a93ad1616f1f","1e13c5124ca64b72b1969a67e8829049","bfe0d8686a584fa680f4c53b5eb0de6d"],De=new URL("https://dash.cloudflare.com/");De.searchParams.set("to","/:account/api-tokens");De.searchParams.set("name","Basalt remote access");De.searchParams.set("permissionGroupKeys",JSON.stringify(Tn.map((t)=>({key:t,type:"edit"}))));function Mn(t){let i=it(t.state,(I)=>I.status==="open"),[r,d]=a(),[y,M]=a(),B=r?.state==="connected"||r?.enabled===!1;return s(()=>{if(!i)return;let I=!1,h=()=>void t.tunnelStatus().then((c)=>{if(I)return;d(c),M(void 0)}).catch((c)=>{if(I)return;if(c instanceof Error&&"status"in c&&c.status===404){d(null);return}M(c instanceof Error?c.message:String(c))});h();let g=setInterval(h,B?Ot:Cn);return()=>{I=!0,clearInterval(g)}},[t,i,B]),[r,d,y]}function Rn(t){let[i,r]=a(),d=i?.expires;return s(()=>{let y=!1,M=()=>void t.pairingCode().then((h)=>!y&&r(h)).catch(()=>!y&&r(null));M();let B=setInterval(M,Ot),I=d?setTimeout(M,Math.max(0,d-Date.now())+500):void 0;return()=>{y=!0,clearInterval(B),clearTimeout(I)}},[t,d]),[i,r]}function _t(t){k();let[i,r,d]=Mn(t.conn);return n(m,{children:[e(In,{conn:t.conn}),e(ne,{title:"局域网访问",description:"通过可信局域网访问这台 Basalt。",children:e(Wt,{conn:t.conn})}),i!==null&&e(ne,{title:"Cloudflare",description:"用自己的域名从外网访问;新设备仍需 Basalt 配对。",children:i?e(zn,{conn:t.conn,status:i,onChanged:r}):e(Y,{title:d?"状态读取失败":"正在读取状态…",description:d})})]})}function zn(t){let{conn:i,status:r}=t,d=it(i.state,(P)=>P.server?.auth===!1),[y,M]=a(),[B,I]=a(),[h,g]=a(""),[c,D]=a(r.accessEmail??""),[C,E]=a(!1),[O,L]=a(),x=(y??r.hostname??"").trim().toLowerCase(),f=r.enabled??r.configured,W=r.managedAccess??!!(r.cloudAccessTeam||r.access),N=r.cloudflareConnected&&r.managedAccess===void 0;s(()=>{if(!r.cloudflareConnected||!r.configured)return;let P=!1;return i.refreshCloudflare().then((H)=>{if(!P)t.onChanged(H)},(H)=>{if(!P)L(H instanceof Error?H.message:"读取云端配置失败")}),()=>{P=!0}},[i,r.cloudflareConnected,r.configured,t.onChanged]);async function T(P,H=!1){if(C)return;E(!0),L(void 0);try{if(t.onChanged(await P()),H)g(""),I(void 0)}catch(b){L(b instanceof Error?b.message:String(b))}finally{E(!1)}}function A(){L(void 0),g(""),I("connect")}async function S(P){if(!r.cloudflareConnected){A();return}if(P){D(r.accessEmail??""),L(void 0),I("access");return}if(await Ge({title:"取消 Cloudflare 登录?",description:"所有人将可以打开 Basalt 连接页面,新设备仍必须配对。只修改当前域名,不影响隧道连接。",action:"取消额外登录"}))await T(()=>i.configureManagedAccess({enabled:!1}))}return n(m,{children:[n(Y,{title:"状态",description:r.publicURL?e("span",{className:"font-mono break-all",children:r.publicURL}):"尚未配置访问域名",children:[e("span",{className:u("text-ui",r.state==="connected"?"text-success":"text-faint"),children:Pn[r.state]}),r.publicURL&&e(Pt,{text:r.publicURL,label:"复制地址",size:"icon-sm"}),r.publicURL&&e(G,{asChild:!0,size:"icon-sm",label:"打开公共地址",children:e("a",{href:r.publicURL,target:"_blank",rel:"noreferrer noopener",children:e(an,{className:"size-3.5"})})}),e(_,{variant:"ghost",size:"sm",disabled:C||d,onClick:A,children:r.cloudflareConnected?"更换授权":"连接 Cloudflare"})]}),e(Y,{title:"隧道",description:"关闭仅断开连接,保留域名和配置。",children:e(Ye,{label:"隧道",checked:f,disabled:C||d||!r.binary&&!f,onCheckedChange:(P)=>{if(P&&!r.configured&&!r.cloudflareConnected){A();return}T(()=>i.configureManagedTunnel({enabled:P,hostname:x}))}})}),e(Y,{title:"域名",description:"填写 Cloudflare 托管域名下的子域名。",children:n("div",{className:"flex max-w-full flex-wrap items-center gap-2",children:[e(te,{"aria-label":"域名",placeholder:"basalt.example.com",value:y??r.hostname??"",className:"w-56 max-w-full",spellCheck:!1,autoCapitalize:"off",disabled:C||d,onChange:(P)=>M(P.target.value)}),e(_,{size:"sm",variant:"secondary",loading:C,disabled:C||d||!kn.test(x)||x===r.hostname&&f,onClick:()=>{if(!r.cloudflareConnected){A();return}T(()=>i.configureManagedTunnel({enabled:!0,hostname:x}))},children:"保存并连接"})]})}),e(Y,{title:"Access 登录保护",description:N?"云端状态尚未确认,请重新检测;不会将未知状态视为关闭。":"仅允许指定邮箱通过 GitHub 登录。",children:N?e(_,{size:"sm",variant:"secondary",disabled:C,onClick:()=>void T(()=>i.refreshCloudflare()),children:"重新检测"}):e(Ye,{label:"Access 登录保护",checked:W,disabled:C||d||!r.configured,onCheckedChange:(P)=>void S(P)})}),(O||r.managementError||r.error||d||!r.binary)&&e("div",{className:"px-4 py-3",children:e(Ta,{tone:"danger",children:O||r.managementError||r.error||(d?"服务端已关闭认证,不能开启远程访问。":`请先安装 cloudflared:${r.install.command??r.install.url}`)})}),e(qt,{open:B==="connect",onOpenChange:(P)=>{if(!C&&!P)I(void 0),g(""),L(void 0)},title:"连接 Cloudflare",description:"创建令牌后,粘贴到下方即可连接。",children:n(At,{onSubmit:(P)=>{P.preventDefault(),T(()=>i.connectCloudflare(h.trim()),!0)},children:[n("div",{className:"space-y-2 text-ui text-dim",children:[e(_,{asChild:!0,variant:"secondary",children:n("a",{href:De.href,target:"_blank",rel:"noreferrer noopener",children:["创建令牌 ",e(an,{className:"size-3.5"})]})}),e("p",{className:"text-xs text-faint",children:"权限已预填,只需选择账号和域名。"})]}),e(oe,{label:"API Token",children:(P)=>e(te,{id:P,type:"password",placeholder:"粘贴令牌",autoComplete:"off",spellCheck:!1,value:h,disabled:C,onChange:(H)=>g(H.target.value)})}),e("p",{className:"text-xs text-faint",children:"令牌仅保存在本机,不发送给模型。"}),e(yt,{children:O}),e("div",{className:"flex justify-end",children:e(_,{type:"submit",loading:C,disabled:!h.trim(),children:"连接"})})]})}),e(qt,{open:B==="access",onOpenChange:(P)=>{if(!C&&!P)I(void 0),L(void 0)},title:"开启 Access 登录保护",description:"使用 GitHub 登录,并限定以下邮箱。",children:n(At,{onSubmit:(P)=>{P.preventDefault(),T(()=>i.configureManagedAccess({enabled:!0,email:c.trim()}),!0)},children:[e(oe,{label:"允许登录的邮箱",children:(P)=>e(te,{id:P,type:"email",autoComplete:"email",value:c,disabled:C,onChange:(H)=>D(H.target.value)})}),e(yt,{children:O}),e("div",{className:"flex justify-end",children:e(_,{type:"submit",loading:C,disabled:!c.trim(),children:"开启保护"})})]})})]})}function In(t){let[i,r]=Rn(t.conn),[d,y]=a(!1);if(!i)return null;let M=`${i.code.slice(0,4)}-${i.code.slice(4)}`,B=new Date(i.expires).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});async function I(){y(!0);try{r(await t.conn.renewPairingCode())}catch(h){z(h,"更换配对码失败")}finally{y(!1)}}return e(ne,{title:"设备配对",description:"局域网与 Cloudflare 隧道连接共用此码。",children:n(Y,{title:"配对码",description:`${B} 前有效,用一次即失效`,children:[e("code",{className:"font-mono text-sm font-medium tracking-wider text-ink",children:M}),e(Pt,{text:M,label:"复制配对码",size:"icon-sm"}),e(G,{size:"icon-sm",label:"换一个配对码",className:"text-faint",disabled:d,onClick:()=>void I(),children:e(ge,{className:u("size-3.5",d&&"animate-spin")})})]})})}var Dn=[{value:"auto",label:"自动检测 (Auto)",description:"Windows 优先探测 bash,未找到则回退 powershell;Unix 走 bash"},{value:"bash",label:"Bash",description:"使用 bash -c 执行(Git Bash / WSL / MSYS2 / Linux / macOS)"},{value:"powershell",label:"PowerShell",description:"使用 powershell -NoProfile -Command 执行"},{value:"cmd",label:"CMD",description:"使用 cmd.exe /c 执行"}];function Bn(t){if(!t)return"—";return`v${t.version}(协议 v${t.protocol})`}function Ln(t){if(!t)return"—";return t.auth?"需设备配对令牌":"免认证(--no-auth)"}function Vt(t){let i=le(t.conn.state),r=Zi[i.status],d=i.server,[y,M]=a(!1),[B,I]=a(!1),[h,g]=a(),[c,D]=a(!1),C=d?.shell??"auto";s(()=>{if(g(void 0),i.status!=="open")return;let x=!1;return t.conn.serverAutostart().then((f)=>{if(!x)g(f)},(f)=>{if(!x)z(f)}),()=>{x=!0}},[t.conn,i.status]);async function E(x){let f=x;M(!0);try{await t.conn.setServerShell(f)}catch(W){z(W)}finally{M(!1)}}async function O(x){D(!0);try{g(await t.conn.setServerAutostart(x))}catch(f){z(f)}finally{D(!1)}}async function L(){I(!0);try{await t.conn.restartServer(),ue("已请求重启",{description:"所有对话空闲后服务会按原参数重启,稍后自动重新连接"})}catch(x){z(x)}finally{I(!1)}}return n(m,{children:[n(ne,{title:"当前远程服务器",description:`正在管理 ${Gn(t.server)}(${t.server.url})`,children:[e(Y,{title:"连接状态",description:i.error??t.server.url,children:n("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-ink",children:[e("span",{className:u("size-2 rounded-full",r.dot)}),i.status==="open"&&d?e("span",{className:"font-mono",children:Bn(d)}):r.label]})}),e(Y,{title:"认证策略",description:"服务端是否要求配对设备令牌",children:n("span",{className:"inline-flex items-center gap-2 text-xs font-medium text-ink",children:[d&&e("span",{className:u("size-2 rounded-full",d.auth?"bg-success":"bg-warning")}),Ln(d)]})})]}),n(ne,{title:"更新与启动",description:"服务端版本更新、重启与开机自启",children:[e(Kc,{conn:t.conn}),e(Y,{title:"服务重启",description:"按原参数重启,等所有对话空闲后执行,不会中断进行中的对话",children:e(_,{size:"sm",loading:B,disabled:i.status!=="open",onClick:L,children:"重启服务"})}),e(Y,{title:"开机自启",description:"当前用户登录系统后自动启动 Basalt;不影响正在运行的服务",children:e(Ye,{label:"开机自启",checked:h?.enabled??!1,disabled:!h||c||i.status!=="open",onCheckedChange:(x)=>void O(x)})})]}),n(ne,{title:"运行环境",description:"服务端执行命令与解释定时任务时使用的环境",children:[e(Y,{title:"执行 Shell",description:"服务端运行 bash 工具与后台长任务时调用的默认命令行解释器",children:e("div",{className:"w-56",children:e(tn,{value:C,disabled:y,onValueChange:E,groups:[{options:Dn.map((x)=>({value:x.value,label:x.label,description:x.description}))}]})})}),e(Y,{title:"服务器时区",description:"远程自动化定时任务(Cron)按此时区解释",children:e("span",{className:"font-mono text-xs text-dim",children:d?.timezone??"—"})})]})]})}function jt(t){let i=le(t.conn.state),r=t.devices;if(i.server?.auth===!1)return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"当前服务器未启用设备认证",description:"服务端以 --no-auth 启动,无需配对设备令牌"})});if(!r){let d=i.status==="open"?"正在读取已配对设备…":"连接服务器后可查看";return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"设备列表",description:d})})}if(r.length===0)return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:e(Y,{title:"暂无已配对设备"})});return e(ne,{title:"已配对设备",description:"已获授权访问此远程服务器的客户端设备,可随时远程吊销",children:r.map((d)=>e(Y,{title:n("span",{className:"flex items-center gap-2",children:[e("span",{className:"truncate",children:d.name}),(d.current||d.id===t.server.id)&&e("span",{className:"rounded-md bg-raised px-1.5 py-0.5 font-normal text-2xs text-dim",children:"当前设备"})]}),description:`最近活跃:${bt(d.lastSeen)} · 配对于 ${bt(d.created)}`,children:n(_,{size:"sm",variant:"danger-ghost",onClick:()=>t.onRevokeDevice(d),children:[e(xe,{className:"size-3.5"}),"吊销"]})},d.id))})}var Ne="浏览器设置(本地)",re="服务器设置(远程)",Kt=[{value:"appearance",group:Ne,label:"外观",icon:e(ka,{}),render:()=>e(tt,{})},{value:"notifications",group:Ne,label:"通知",icon:e(Qe,{}),render:()=>e(at,{})},{value:"connections",group:Ne,label:"连接列表",icon:e($e,{}),render:(t)=>e(ot,{...t})},{value:"shortcuts",group:Ne,label:"快捷键",icon:e(_a,{}),render:()=>e(lt,{})},{value:"models",group:re,label:"模型",icon:e(Ar,{}),render:(t)=>e(Mt,{...t})},{value:"plugins",group:re,label:"插件",icon:e(Ht,{}),render:(t)=>e($t,{conn:t.conn},t.server.id)},{value:"proxy",group:re,label:"代理",icon:e(Pe,{}),render:(t)=>e(Ft,{conn:t.conn},t.server.id)},{value:"database",group:re,label:"数据库",icon:e(Tr,{}),render:(t)=>e(xt,{conn:t.conn,server:t.server})},{value:"server",group:re,label:"服务器",icon:e(ut,{}),render:(t)=>e(Vt,{...t},t.server.id)},{value:"remote",group:re,label:"远程访问",icon:e(Ze,{}),render:(t)=>e(_t,{conn:t.conn},t.server.id)},{value:"devices",group:re,label:"已配对设备",icon:e(Kn,{}),render:(t)=>e(jt,{...t})}],Be=new WeakMap;function Qt(t){return t==="search"?"database":t??"appearance"}function cr(t){k();let[i,r]=a(()=>Qt(t.initialTab)),[d,y]=a(t.initialTab===void 0),M=o(null),B=o(!1);s(()=>{if(y(t.initialTab===void 0),t.initialTab===void 0)B.current=!1;if(M.current?.scrollTo({top:0}),t.initialTab)r(Qt(t.initialTab))},[t.initialTab]);let I=(f)=>{r(f),t.onTabChange?.(f)},h=le(t.conn.state),[g,c]=a(()=>Be.get(t.conn)??null),D=[];for(let f of h.plugins){if(f.status!=="enabled")continue;for(let W of f.web??[]){let N=W.view;if(W.kind!=="tab"||!N)continue;let T=W.id==="settings"?f.id:W.id;D.push({value:T,group:re,label:W.title,icon:Xc(W.icon),render:(A)=>e(ws,{pluginID:f.id,viewID:N,connection:A.conn},`${f.id}-${W.id}`)})}}let C=h.server?.localManagement===!0,E=[...Kt.slice(0,5),...D,...Kt.slice(5)].filter((f)=>C||f.value!=="remote"&&f.value!=="devices");s(()=>{let f=Be.get(t.conn)??null;if(c(f),!C||h.status!=="open"||h.server?.auth===!1)return;let W=!1;return t.conn.devices().then((N)=>{if(Be.set(t.conn,N),!W)c(N)}).catch(()=>{}),()=>{W=!0}},[t.conn,h.status,h.server?.auth,C]);let O=async(f)=>{if(!await Ge({title:`吊销设备「${f.name}」?`,description:"吊销后该设备的令牌立即失效,需重新配对才能连接此服务器。",action:"吊销",danger:!0}))return;try{await t.conn.revokeDevice(f.id),c((N)=>{let T=N?.filter((A)=>A.id!==f.id)??null;if(T)Be.set(t.conn,T);return T})}catch(N){z(N)}},L=E.find((f)=>f.value===i)??E[0],x={...t,devices:g,onRevokeDevice:(f)=>void O(f)};return e(yi,{className:"@container/settings",viewportClassName:"[scrollbar-gutter:stable]",viewportRef:M,children:n("div",{className:"mx-auto max-w-4xl animate-fade px-4 pt-3 pb-10 sm:px-6 md:pt-10 md:pb-16",children:[n("div",{className:"mb-6 flex min-h-10 items-center gap-1 md:mb-8",children:[!d&&e(G,{label:"返回设置分类",className:"-ml-2 size-10 rounded-full @min-[640px]/settings:hidden",onClick:()=>{if(B.current){B.current=!1,window.history.back();return}y(!0),t.onTabChange?.(void 0)},children:e(Xe,{className:"size-5"})}),n("h1",{className:"min-w-0 truncate text-xl font-semibold tracking-tight md:font-serif md:text-title md:font-normal",children:[e("span",{className:u(!d&&"@max-[640px]/settings:hidden"),children:"设置"}),!d&&e("span",{className:"@min-[640px]/settings:hidden",children:L?.label})]})]}),d&&e("nav",{"aria-label":"设置分类",className:"space-y-6 @min-[640px]/settings:hidden",children:[Ne,re].map((f)=>n("section",{children:[e("h2",{className:p("settings.groupTitle","mb-2.5 px-0.5"),children:f}),e("div",{className:p("settings.groupBox"),children:E.filter((W)=>W.group===f).map((W)=>n("button",{type:"button",onClick:()=>{r(W.value),y(!1),B.current=t.onTabChange!==void 0,t.onTabChange?.(W.value,!0)},className:"flex min-h-13 w-full items-center gap-3 px-4 text-left text-md text-ink transition-colors active:bg-raised [&_svg]:size-[18px] [&_svg]:shrink-0",children:[e("span",{className:"flex items-center text-dim",children:W.icon}),e("span",{className:"min-w-0 flex-1 truncate",children:W.label}),e(zt,{className:"text-faint"})]},W.value))})]},f))}),n("div",{className:u("flex items-start",d&&"@max-[640px]/settings:hidden"),children:[e("aside",{className:"settings-rail shrink-0",children:e("nav",{"aria-label":"设置分类",className:"flex w-48 flex-col gap-1",children:E.map((f,W)=>{let N=f.value===i,T=f.group&&(W===0||E[W-1]?.group!==f.group);return n(nt,{children:[T&&e("div",{className:u("px-2.5 pb-1 text-2xs font-medium tracking-wide text-faint",W>0&&"mt-3.5"),children:f.group}),n("button",{type:"button",onClick:()=>I(f.value),className:p("sidebar.navItem","px-2.5 text-ui",N?"bg-raised font-medium text-ink shadow-sheen":"text-dim hover:bg-raised/60 hover:text-ink"),children:[f.icon&&e("span",{className:u("relative flex items-center [&_svg]:size-4",N?"text-ink":"text-faint"),children:f.icon}),e("span",{className:"truncate",children:f.label})]})]},f.value)})})}),e("div",{className:"min-w-0 flex-1 animate-fade space-y-6 @container/panel",children:L?.render(x)},i)]})]})})}export{cr as Settings};
|
|
Binary file
|
|
Binary file
|