codeplane-darwin-x64-baseline 29.0.19 → 29.0.20
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/bin/codeplane +0 -0
- package/bin/runtime/tui/{_baseUniq-CKZsAae7-amy2zxzj.js → _baseUniq-CIdKO3dq-saxa3280.js} +1 -1
- package/bin/runtime/tui/{ar-DWS3OItw-dt0zkv78.js → ar-BmGaE6dF-q6t3706d.js} +1 -1
- package/bin/runtime/tui/{ar-BZWjfbwB-qtqfb7fg.js → ar-DWiV1g-n-1af1nyxy.js} +1 -1
- package/bin/runtime/tui/{arc-DMMoS4Sa-03vsc6n3.js → arc-DqLXbJ-l-1yzq3v1g.js} +1 -1
- package/bin/runtime/tui/{architectureDiagram-Q4EWVU46-By5q-GjB-1yar27d6.js → architectureDiagram-Q4EWVU46-9rt-8b6E-wk53k0jh.js} +1 -1
- package/bin/runtime/tui/{blockDiagram-DXYQGD6D-COiddImv-pv135sbv.js → blockDiagram-DXYQGD6D-Wi5D5jIb-83qd40vp.js} +1 -1
- package/bin/runtime/tui/{br-CYRyU94d-sdhx3xkp.js → br-C0Yr4nSr-bs9cbqgb.js} +1 -1
- package/bin/runtime/tui/{br-DkTIl03T-n4zbcp2r.js → br-CJxfXkhA-h51k61qx.js} +1 -1
- package/bin/runtime/tui/{bs-IyM3ti4T-ykpjn53f.js → bs-CEFL9l5a-k8vrktf8.js} +1 -1
- package/bin/runtime/tui/{bs-BoIQtU4H-yv99fc6q.js → bs-CaCKWAeY-xew7v80s.js} +1 -1
- package/bin/runtime/tui/{c4Diagram-AHTNJAMY-CuWIN9yJ-rkrgtknt.js → c4Diagram-AHTNJAMY-Cnx6lSY6-hfk7ydjz.js} +1 -1
- package/bin/runtime/tui/channel-CRd61DfB-a84z4rad.js +1 -0
- package/bin/runtime/tui/{chunk-4BX2VUAB-D2vOyEOF-m6f9p1ek.js → chunk-4BX2VUAB-DdU5eMNC-r5g39pnj.js} +1 -1
- package/bin/runtime/tui/{chunk-4TB4RGXK-QDNaQXp8-aqnrpxkh.js → chunk-4TB4RGXK-DkOtUh9r-1g0b4dt8.js} +1 -1
- package/bin/runtime/tui/{chunk-55IACEB6-CKSwUx1G-tvns5bk7.js → chunk-55IACEB6-CU9uIPGP-rh65kk9d.js} +1 -1
- package/bin/runtime/tui/{chunk-EDXVE4YY-NnNsBfoC-wm46mzn6.js → chunk-EDXVE4YY-DqmH469b-5ymhdtxk.js} +1 -1
- package/bin/runtime/tui/{chunk-FMBD7UC4-DEcg0ekQ-wat1s63x.js → chunk-FMBD7UC4-BMB1F1VO-vy5p5w7r.js} +1 -1
- package/bin/runtime/tui/{chunk-OYMX7WX6-BkbRIi1Q-zm4wak80.js → chunk-OYMX7WX6-mS1fhc79-0fg9mpxa.js} +1 -1
- package/bin/runtime/tui/{chunk-QZHKN3VN-Bb-kvwI_-pgpf90wx.js → chunk-QZHKN3VN-B_uJ2Sul-q596hvme.js} +1 -1
- package/bin/runtime/tui/{chunk-YZCP3GAM-D5Jrc8Wg-2t7drtfm.js → chunk-YZCP3GAM-X3zoXePk-wt6cc28k.js} +1 -1
- package/bin/runtime/tui/classDiagram-6PBFFD2Q-B2auL2tY-ve962fat.js +1 -0
- package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-B2auL2tY-ve962fat.js +1 -0
- package/bin/runtime/tui/clone-BzwFlJAo-xaa46y8s.js +1 -0
- package/bin/runtime/tui/{cose-bilkent-S5V4N54A-Be0H7JB8-anyaen8e.js → cose-bilkent-S5V4N54A-COxeQzun-09sz9bh5.js} +1 -1
- package/bin/runtime/tui/{da-BEIVgvZZ-d2k49mqp.js → da-CLGt8t51-fzwrsjwy.js} +1 -1
- package/bin/runtime/tui/{da-D9qz0rjo-kjc2r6bx.js → da-DYi2YCQi-k85nfe73.js} +1 -1
- package/bin/runtime/tui/{dagre-KV5264BT-BTpulNI0-001q0wcg.js → dagre-KV5264BT-BgAj3J6z-q3rxwrwn.js} +1 -1
- package/bin/runtime/tui/{de-DwHk2dT7-60bw2v0d.js → de-27e6V80Y-9dnj28p9.js} +1 -1
- package/bin/runtime/tui/{de-BvGtd_2t-dt9neae0.js → de-BDLaTYvp-wvmhyndj.js} +1 -1
- package/bin/runtime/tui/{diagram-5BDNPKRD-3AKY6Uzn-csrvjcvc.js → diagram-5BDNPKRD-B595d8w6-sdjnp45b.js} +1 -1
- package/bin/runtime/tui/{diagram-G4DWMVQ6-Cu0J7ePJ-fgm0m496.js → diagram-G4DWMVQ6-GH5GGsQB-13f0w3x6.js} +1 -1
- package/bin/runtime/tui/{diagram-MMDJMWI5-_lAEwwhe-vba3das7.js → diagram-MMDJMWI5-iFQuIw9r-sz4jv8vy.js} +1 -1
- package/bin/runtime/tui/{diagram-TYMM5635-DZ7Gjcd4-g32kra4a.js → diagram-TYMM5635-t1HmZT7K-ys2esat3.js} +1 -1
- package/bin/runtime/tui/{dialog-connect-provider-DmusNzFo-6p95j26n.js → dialog-connect-provider-CbBxytwI-q3p86cwv.js} +2 -2
- package/bin/runtime/tui/{dialog-edit-project-p56AjST6-pssnmvd1.js → dialog-edit-project-CX76A6rc-58d95507.js} +1 -1
- package/bin/runtime/tui/{dialog-fork-DWmHX3bN-n38stabf.js → dialog-fork-CG-wOlV3-xsxbpcme.js} +1 -1
- package/bin/runtime/tui/{dialog-manage-models-l5oINHkE-6580qjkv.js → dialog-manage-models-BFS05VVX-wg4qb1qy.js} +1 -1
- package/bin/runtime/tui/{dialog-quick-switcher-CBfhHLhX-8y791cz7.js → dialog-quick-switcher-Bvm8ie5S-x84spk50.js} +1 -1
- package/bin/runtime/tui/{dialog-select-directory-Cv7O9BIN-gf2c3y12.js → dialog-select-directory-BgyTQJRP-8f8rm1ms.js} +1 -1
- package/bin/runtime/tui/{dialog-select-file-DBC_hrA3-kt14p0jy.js → dialog-select-file-B1bCyEnR-w76wavza.js} +1 -1
- package/bin/runtime/tui/{dialog-select-mcp-NJhjvEbx-mwc2hsjg.js → dialog-select-mcp-DWrPE3wB-6jw1gxs7.js} +1 -1
- package/bin/runtime/tui/{dialog-select-model-unpaid-DgDw-CXo-hsatq0gd.js → dialog-select-model-unpaid-DxRiJHnB-1e51xzvn.js} +2 -2
- package/bin/runtime/tui/{dialog-select-provider-B92vIz_h-zqk042wr.js → dialog-select-provider-C-JEreLC-a3hzzr95.js} +1 -1
- package/bin/runtime/tui/{dialog-select-server-dfebswC4-7q9hjg2d.js → dialog-select-server-DGTNSgKw-hkzncy6h.js} +1 -1
- package/bin/runtime/tui/{erDiagram-SMLLAGMA-DP5cAA3n-bagy0xnn.js → erDiagram-SMLLAGMA-Dkutm0UC-mr8b5cr2.js} +1 -1
- package/bin/runtime/tui/{es-DBeXBNfl-bfw45c04.js → es--JMv8T7K-4n7x3j2t.js} +1 -1
- package/bin/runtime/tui/{es-DLzj3tOR-bv7qbg0d.js → es-KW_Zclw5-sm6qt3en.js} +1 -1
- package/bin/runtime/tui/{file-icon-WDJkIQUb-e6bydd82.js → file-icon-hzEOBp5u-wzb45m8v.js} +1 -1
- package/bin/runtime/tui/{flowDiagram-DWJPFMVM-DQuJBuvD-sy6zm4y8.js → flowDiagram-DWJPFMVM-Dxq5CqUW-55cxb8yg.js} +1 -1
- package/bin/runtime/tui/{fr-DlY6ywao-jv4c74mw.js → fr-BKYYu4_6-q6bgdt7z.js} +1 -1
- package/bin/runtime/tui/{fr-CT5dh1GO-kczghwcx.js → fr-EPg9myXQ-scb4s2xb.js} +1 -1
- package/bin/runtime/tui/{ganttDiagram-T4ZO3ILL-DQN0SBG4-y4ba06b4.js → ganttDiagram-T4ZO3ILL-BMFQ_DA_-wv9dzvbt.js} +1 -1
- package/bin/runtime/tui/{ghostty-web-BsEg925m-x58q6dx0.js → ghostty-web-DF5QFCvM-vyezzh2f.js} +1 -1
- package/bin/runtime/tui/{gitGraphDiagram-UUTBAWPF-_wDXoco0-bhmdgg7v.js → gitGraphDiagram-UUTBAWPF-CXFHqzP_-t4byf1er.js} +1 -1
- package/bin/runtime/tui/{graph-B5741XBm-gsp5acb1.js → graph-CdxUj6yb-scg0vj1a.js} +1 -1
- package/bin/runtime/tui/{home-DmQx2UFO-n4f6az0b.js → home-BxUuIoXQ-ppzcm720.js} +1 -1
- package/bin/runtime/tui/{index-CPokXzBk-mtscz30j.js → index-CaPWFEmi-2z8vnrgq.js} +6 -6
- package/bin/runtime/tui/{index-e6kmsrda.html → index-fanx7c5q.html} +1 -1
- package/bin/runtime/tui/{infoDiagram-42DDH7IO-C_a3CFEZ-z08bkk68.js → infoDiagram-42DDH7IO-gNmXJmyB-s5qv9bvz.js} +1 -1
- package/bin/runtime/tui/{ishikawaDiagram-UXIWVN3A-bKIAb2Qr-bdy3prj1.js → ishikawaDiagram-UXIWVN3A-DB4uZHja-e8hkd3zx.js} +1 -1
- package/bin/runtime/tui/{ja-BvuREAZm-gk37bjmy.js → ja-BflM-d8c-t7h818p0.js} +1 -1
- package/bin/runtime/tui/{ja-J2rvy9Sm-vgn550cs.js → ja-CJTo4KkK-zz1pfe3t.js} +1 -1
- package/bin/runtime/tui/{journeyDiagram-VCZTEJTY-BfBXXSNc-843bw9m4.js → journeyDiagram-VCZTEJTY-C2cCx7a9-n6nfmvss.js} +1 -1
- package/bin/runtime/tui/{kanban-definition-6JOO6SKY-2VedazDB-g1z2s2x0.js → kanban-definition-6JOO6SKY-CNIEkQb7-tejfkajm.js} +1 -1
- package/bin/runtime/tui/{ko-C4ctDXLT-t5qa1fzr.js → ko-1AesI1gp-7w8kmsd8.js} +1 -1
- package/bin/runtime/tui/{ko-3NJR9qON-j403fgwv.js → ko-wnATYZhS-e8rh7bnb.js} +1 -1
- package/bin/runtime/tui/{layout-resSDDfp-szpqjrwd.js → layout-CsyKM6QG-7fdxg3x9.js} +1 -1
- package/bin/runtime/tui/{linear-C4n34Dvy-xx9267bv.js → linear-B97-2TdH-311hnq70.js} +1 -1
- package/bin/runtime/tui/{list-B-BljgiC-zjyn8pzq.js → list-BiQMzfJm-c8sbm1ws.js} +1 -1
- package/bin/runtime/tui/{mermaid.core-BYfeCraQ-wvjh9cwb.js → mermaid.core-B1DAMRyG-23wemngf.js} +5 -5
- package/bin/runtime/tui/{min-BGmgVSVZ-2gk8fzng.js → min-BxM1U1Fg-21yb3amj.js} +1 -1
- package/bin/runtime/tui/{mindmap-definition-QFDTVHPH-DrNpZjMx-x4p4scna.js → mindmap-definition-QFDTVHPH-CcS-c13S-b9v8r98c.js} +1 -1
- package/bin/runtime/tui/{no-DKoerABz-khva2d4e.js → no-bayaWMMG-fkj8cwdj.js} +1 -1
- package/bin/runtime/tui/{no-D0QS5gIq-bgbqx72c.js → no-zt964wOK-kasce13c.js} +1 -1
- package/bin/runtime/tui/node-main.js +40 -40
- package/bin/runtime/tui/{notifications-yiDqvVWb-mg5jjzqq.js → notifications-Can6MxXX-aw5q9fhj.js} +1 -1
- package/bin/runtime/tui/{pieDiagram-DEJITSTG-D13bv9Xl-pegjjyb0.js → pieDiagram-DEJITSTG-Doif1hoz-3b07tqbh.js} +1 -1
- package/bin/runtime/tui/{pl-fQsf_cNV-e5he2t1p.js → pl-4fUPofNs-237e1s4t.js} +1 -1
- package/bin/runtime/tui/{pl-C6Uj0x5G-jwefyv8g.js → pl-DP31XAiJ-tn04m90e.js} +1 -1
- package/bin/runtime/tui/{provider-icon-7kFt_4lz-fp5dsjgn.js → provider-icon-mQ6o_ygz-ygz739x5.js} +1 -1
- package/bin/runtime/tui/{quadrantDiagram-34T5L4WZ-zX5wMAeQ-5frczs12.js → quadrantDiagram-34T5L4WZ-DzCsn8oz-66jhgzt4.js} +1 -1
- package/bin/runtime/tui/{requirementDiagram-MS252O5E-t7b6HUfP-ymfqvzkn.js → requirementDiagram-MS252O5E-3SSg0glz-j59wp495.js} +1 -1
- package/bin/runtime/tui/{ru-BA0rrWOy-1hhhsnck.js → ru-DaitQUn1-hagr69y5.js} +1 -1
- package/bin/runtime/tui/{ru-CaqP6-Hd-dvf7kd6h.js → ru-DjsUX_Mx-m7ckn8dk.js} +1 -1
- package/bin/runtime/tui/{sankeyDiagram-XADWPNL6-9EFqtb_N-9dcd7jys.js → sankeyDiagram-XADWPNL6-mWMx9G9E-4f71xj48.js} +1 -1
- package/bin/runtime/tui/{sequenceDiagram-FGHM5R23-oiFZnj1o-xbyqyx7r.js → sequenceDiagram-FGHM5R23-0Ri6_7zP-k17t9yk8.js} +1 -1
- package/bin/runtime/tui/{session-BmQ21D29-x4hy8ayr.js → session-BV0LX606-j11ppydf.js} +6 -6
- package/bin/runtime/tui/{settings-Bdh9G_Vp-0rvn4ep5.js → settings-CaQrQUx2-jhes3jwj.js} +1 -1
- package/bin/runtime/tui/{stateDiagram-FHFEXIEX-CRUp1geZ-43rkr1eb.js → stateDiagram-FHFEXIEX-fwQ5rVuv-ecabdwkx.js} +1 -1
- package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-Dwy86PJv-fgm1z51m.js +1 -0
- package/bin/runtime/tui/{th-X36C4Enc-6ydpve98.js → th-BS1uSHlN-gaxxaqr8.js} +1 -1
- package/bin/runtime/tui/{th-DtVRtACI-kqj0dgr9.js → th-DjONqhgk-72te62ev.js} +1 -1
- package/bin/runtime/tui/{timeline-definition-GMOUNBTQ-DfOMe5W2-99dkaa7m.js → timeline-definition-GMOUNBTQ-D_Neh8bS-f9qz8qj3.js} +1 -1
- package/bin/runtime/tui/{tr-Dz0LfA8h-y50k3ws9.js → tr-D7JUDkNG-trybtksg.js} +1 -1
- package/bin/runtime/tui/{tr-Bz5jwN7v-dgeqqq5m.js → tr-DHKVC_SD-t7crfnsr.js} +1 -1
- package/bin/runtime/tui/{vennDiagram-DHZGUBPP-BA-4dB5--nx8ybcnr.js → vennDiagram-DHZGUBPP-fIOdUHTG-bm8beekk.js} +1 -1
- package/bin/runtime/tui/{wardley-RL74JXVD-CXrPLuRI-ttzthp46.js → wardley-RL74JXVD-mp486ivj-s1bcrv2m.js} +1 -1
- package/bin/runtime/tui/{wardleyDiagram-NUSXRM2D-BwzCJvO--jp7fvn8w.js → wardleyDiagram-NUSXRM2D-CbulH8KL-9vtmgc00.js} +1 -1
- package/bin/runtime/tui/{xychartDiagram-5P7HB3ND-Czb-iER0-z9ypyv26.js → xychartDiagram-5P7HB3ND-5c4vGFpm-4ajepfh1.js} +1 -1
- package/bin/runtime/tui/{zh-6RMNNK9t-3qhrp0e6.js → zh--EusBuW5-v3jgdrns.js} +1 -1
- package/bin/runtime/tui/{zh-zNhqkXA3-sv32qvvj.js → zh-BdQ5rFUE-gq6r6pg6.js} +1 -1
- package/bin/runtime/tui/{zht-C8fAvl_9-nzzhmvsc.js → zht-C2Bj8Y3u-j4mn0ty9.js} +1 -1
- package/bin/runtime/tui/{zht-SA4HMWzQ-9a7e372p.js → zht-uBUhPDWj-tabqnar8.js} +1 -1
- package/package.json +1 -1
- package/bin/runtime/tui/channel-CBN6o8Mh-6mc5pb57.js +0 -1
- package/bin/runtime/tui/classDiagram-6PBFFD2Q-DCY7sQQa-jfnazp9n.js +0 -1
- package/bin/runtime/tui/classDiagram-v2-HSJHXN6E-DCY7sQQa-jfnazp9n.js +0 -1
- package/bin/runtime/tui/clone-DFOVzhNw-9jnxj7cm.js +0 -1
- package/bin/runtime/tui/stateDiagram-v2-QKLJ7IA2-DW1b1IPu-0wqkajks.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as n,y as k,Q as je,aF as vt,f as N,aG as bt,C as re,aH as it,aI as xt,e as Fe,b as Y,E as he,J as Ne,j as L,m as r,q as F,N as Q,O as H,aJ as be,a3 as q,p as A,B as M,T as R,aK as wt,aL as kt,aM as $t,aN as yt,aO as _t,aP as Ct,X as Le,z as T,aQ as St,aR as Dt,aS as Et,aT as Pt,t as le,v as ve,aU as zt,al as jt,h as pe,o as Ft,L as Z,V as It,aV as Lt,aE as Mt,ao as Ot,I as X,R as ne,a7 as st,aa as Ee,a8 as ie,i as te,aq as ae,u as lt,w as qe,aW as at,aj as Pe,aX as ot,c as ct,a4 as Rt,k as Ut,aY as Tt,aZ as At,a_ as Kt,a$ as Nt,b0 as qt}from"./index-CPokXzBk.js";import{f as Wt}from"./list-B-BljgiC.js";import{P as ye}from"./provider-icon-7kFt_4lz.js";import{D as Vt}from"./dialog-connect-provider-DmusNzFo.js";import{a as Bt,D as Gt}from"./dialog-select-provider-B92vIz_h.js";function ze(e){return e.granted||e.restartRequired===!0}function se(e){return!ze(e)||e.restartRequired?!1:e.active!==!1}function Ce(e){return ze(e)&&!se(e)}var Ht=k('<div class="bg-surface-base px-4 rounded-lg">');const oe=e=>(()=>{var t=Ht();return n(t,()=>e.children),t})();var Jt=k("<div data-action=settings-auto-accept-permissions>"),Qt=k("<div data-action=settings-codeplane-coauthor>"),Xt=k("<div data-action=settings-feed-reasoning-summaries>"),Yt=k("<div data-action=settings-feed-shell-tool-parts-expanded>"),Zt=k("<div data-action=settings-feed-edit-tool-parts-expanded>"),er=k("<div data-action=settings-show-session-progress-bar>"),tr=k("<div data-action=settings-browser-use>"),rr=k("<div data-action=settings-computer-use>"),nr=k("<div data-action=settings-debug-logging>"),ir=k('<div class="flex flex-col gap-1">'),sr=k('<span class="mt-1.5 inline-flex items-center gap-2 align-middle"><button type=button class="text-11-medium text-text-weak hover:text-text-strong underline-offset-2 hover:underline cursor-pointer"data-action=settings-computer-use-manage>'),lr=k("<div data-action=settings-show-file-tree>"),ar=k("<div data-action=settings-show-navigation>"),or=k("<div data-action=settings-show-search>"),cr=k("<div data-action=settings-show-terminal>"),dr=k("<div data-action=settings-show-status>"),$e=k('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Me=k('<div class="w-full sm:w-[220px]">'),ur=k("<div data-action=settings-notifications-agent>"),gr=k("<div data-action=settings-notifications-permissions>"),mr=k("<div data-action=settings-notifications-errors>"),pr=k('<div data-action=settings-check-update class="flex gap-2 items-center">'),fr=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">'),hr=k('<div><div class="flex flex-col gap-8 w-full">'),vr=k('<div class="flex w-full flex-col gap-5 px-5 pb-5"><p class="text-14-regular text-text-base leading-relaxed"></p><div class="flex items-center justify-between gap-3"><span></span></div><div class="flex flex-col gap-3"></div><div class="flex items-start gap-2 rounded-lg border border-border-warning-base bg-surface-warning-weak/40 px-3 py-2.5"><p class="text-12-regular text-text-base leading-relaxed"></p></div><div class="flex flex-col-reverse gap-2 border-t border-border-weak-base pt-3 sm:flex-row sm:items-center sm:justify-between"><div class="flex flex-col-reverse gap-2 sm:flex-row sm:items-center">'),br=k('<div class="sm:shrink-0 sm:pt-0.5">'),xr=k('<div><div class="flex min-w-0 flex-1 flex-col gap-1.5"><div class="flex items-center gap-2"><span class="text-14-medium text-text-strong"></span><span></span></div><span class="text-12-regular text-text-weak leading-relaxed">'),wr=k('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let me={cleanup:void 0,timeout:void 0,run:0};const dt=()=>{me.run+=1,me.cleanup&&me.cleanup(),clearTimeout(me.timeout),me.cleanup=void 0},Ge=e=>{if(dt(),!e)return;const t=++me.run;me.timeout=setTimeout(()=>{zt(e).then(i=>{if(me.run!==t){i?.();return}me.cleanup=i})},100)},kr=e=>{const t=vt(),i=N(),u=bt(),l=re(),a=it(),p=xt(),o=Fe(),d=Y(),[f,b]=he(!1),m=async()=>{b(!0);try{return await p.recheck(!1)}finally{b(!1)}},S=()=>p.status();Ne(()=>{m(),(l.data.config.tools?.browser===void 0||l.data.config.tools?.computer===void 0)&&l.updateConfig({tools:{...l.data.config.tools,browser:l.data.config.tools?.browser??a.general.browserUse(),computer:l.data.config.tools?.computer??a.general.computerUse()}})});const x=L(()=>u.isGlobalAutoAccept()),w=P=>u.setGlobalAutoAccept(P),h=L(()=>l.data.config.commit?.coauthor===!0),s=P=>l.updateConfig({commit:{coauthor:P}}),g=L(()=>l.data.config.tools?.browser??a.general.browserUse()),c=L(()=>l.data.config.tools?.computer??a.general.computerUse()),C=L(()=>{const P=o.serverManager;if(!P)return;const D=P.currentKey??P.defaultKey??P.instances[0]?.key;return P.instances.find(_=>_.key===D)}),[y,$]=he(!1),v=P=>{d.show(()=>r(He,{tool:P}))},z=(P,D)=>{if(P==="browser"){a.general.setBrowserUse(D),l.updateConfig({tools:{browser:D}});return}if(!D){a.general.setComputerUse(!1),l.updateConfig({tools:{computer:!1}});return}(async()=>{if(!o.systemPermissions){a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}});return}if((await o.systemPermissions.check()).permissions.filter(G=>!se(G)).length===0){a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}});return}d.show(()=>r(He,{tool:"computer",onConfirmEnable:()=>{a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}})}}))})()},j=()=>{const P=C();!P?.local||!o.serverManager||($(!0),o.serverManager.openLogDir(P.id).then(D=>{if(!D)throw new Error(i.t("settings.general.row.instanceLogs.unavailable"))}).catch(D=>{T({variant:"error",title:i.t("common.requestFailed"),description:D instanceof Error?D.message:String(D)})}).finally(()=>$(!1)))},E=L(()=>[{value:"system",label:i.t("theme.scheme.system")},{value:"light",label:i.t("theme.scheme.light")},{value:"dark",label:i.t("theme.scheme.dark")}]),I=L(()=>i.locales.map(P=>({value:P,label:i.label(P)}))),V=L(()=>[{value:"queue",label:i.t("settings.general.row.followup.option.queue")},{value:"steer",label:i.t("settings.general.row.followup.option.steer")}]),W=L(()=>[{value:"short",label:"Short"},{value:"full",label:"Full"},{value:"off",label:"Off"}]),J={id:"none",label:"sound.option.none"},O=[J,...Pt],ce=()=>Dt(a.appearance.font()),B=()=>St(a.appearance.uiFont()),de=()=>Et(a.appearance.terminalFont()),ue=()=>e.layout==="page",ge=(P,D,_,U)=>({options:O,current:P()?O.find(G=>G.id===D())??J:J,value:G=>G.id,label:G=>i.t(G.label),onHighlight:G=>{G&&Ge(G.id==="none"?void 0:G.id)},onSelect:G=>{if(G){if(G.id==="none"){_(!1),dt();return}_(!0),U(G.id),Ge(G.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),we=()=>(()=>{var P=ir();return n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.language.title")},get description(){return i.t("settings.general.row.language.description")},get children(){return r(be,{"data-action":"settings-language",get options(){return I()},get current(){return I().find(D=>D.value===i.locale())},value:D=>D.value,label:D=>D.label,onSelect:D=>D&&i.setLocale(D.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(K,{get title(){return i.t("command.permissions.autoaccept.enable")},get description(){return i.t("toast.permissions.autoaccept.on.description")},get children(){var D=Jt();return n(D,r(q,{get checked(){return x()},onChange:w})),D}}),r(K,{get title(){return i.t("settings.general.row.followup.title")},get description(){return i.t("settings.general.row.followup.description")},get children(){return r(be,{"data-action":"settings-followup-behavior",get options(){return V()},get current(){return V().find(D=>D.value===a.general.followup())},value:D=>D.value,label:D=>D.label,onSelect:D=>D&&a.general.setFollowup(D.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(K,{get title(){return i.t("settings.general.row.codeplaneCoauthor.title")},get description(){return i.t("settings.general.row.codeplaneCoauthor.description")},get children(){var D=Qt();return n(D,r(q,{get checked(){return h()},onChange:_=>void s(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.reasoningSummaries.title")},get description(){return i.t("settings.general.row.reasoningSummaries.description")},get children(){var D=Xt();return n(D,r(be,{get options(){return W()},get current(){return W().find(_=>_.value===a.general.reasoningDisplay())},value:_=>_.value,label:_=>_.label,onSelect:_=>_&&a.general.setReasoningDisplay(_.value),variant:"secondary",size:"small",triggerVariant:"settings"})),D}}),r(K,{get title(){return i.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return i.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var D=Yt();return n(D,r(q,{get checked(){return a.general.shellToolPartsExpanded()},onChange:_=>a.general.setShellToolPartsExpanded(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.editToolPartsExpanded.title")},get description(){return i.t("settings.general.row.editToolPartsExpanded.description")},get children(){var D=Zt();return n(D,r(q,{get checked(){return a.general.editToolPartsExpanded()},onChange:_=>a.general.setEditToolPartsExpanded(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.showSessionProgressBar.title")},get description(){return i.t("settings.general.row.showSessionProgressBar.description")},get children(){var D=er();return n(D,r(q,{get checked(){return a.general.showSessionProgressBar()},onChange:_=>a.general.setShowSessionProgressBar(_)})),D}}),r(F,{get when(){return p.hasDesktopBridge()},get children(){return[r(K,{get title(){return i.t("settings.general.row.browserUse.title")},get description(){return i.t("settings.general.row.browserUse.description")},get children(){var D=tr();return n(D,r(q,{get checked(){return g()},onChange:_=>z("browser",_)})),D}}),r(K,{get title(){return i.t("settings.general.row.computerUse.title")},get description(){return[A(()=>i.t("settings.general.row.computerUse.description")),r(F,{get when(){return o.systemPermissions},get children(){var D=sr(),_=D.firstChild;return _.$$click=U=>{U.preventDefault(),v("computer")},n(_,()=>i.t("settings.general.row.computerUse.manage")),D}})]},get children(){var D=rr();return n(D,r(q,{get checked(){return c()},onChange:_=>z("computer",_)})),D}}),r(K,{get title(){return i.t("settings.general.row.debugLogging.title")},get description(){return i.t("settings.general.row.debugLogging.description")},get children(){var D=nr();return n(D,r(q,{get checked(){return a.general.debugLogging()},onChange:_=>a.general.setDebugLogging(_)})),D}}),r(F,{get when(){return C()?.local},get children(){return r(K,{get title(){return i.t("settings.general.row.instanceLogs.title")},get description(){return i.t("settings.general.row.instanceLogs.description")},get children(){return r(M,{type:"button",size:"small",variant:"secondary",icon:"folder","data-action":"settings-open-instance-logs",onClick:D=>{D.preventDefault(),j()},get disabled(){return y()},get children(){return A(()=>!!y())()?i.t("settings.general.row.instanceLogs.action.opening"):i.t("settings.general.row.instanceLogs.action.open")}})}})}})]}})]}})),P})(),ee=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.advanced")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.showFileTree.title")},get description(){return i.t("settings.general.row.showFileTree.description")},get children(){var _=lr();return n(_,r(q,{get checked(){return a.general.showFileTree()},onChange:U=>a.general.setShowFileTree(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showNavigation.title")},get description(){return i.t("settings.general.row.showNavigation.description")},get children(){var _=ar();return n(_,r(q,{get checked(){return a.general.showNavigation()},onChange:U=>a.general.setShowNavigation(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showSearch.title")},get description(){return i.t("settings.general.row.showSearch.description")},get children(){var _=or();return n(_,r(q,{get checked(){return a.general.showSearch()},onChange:U=>a.general.setShowSearch(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showTerminal.title")},get description(){return i.t("settings.general.row.showTerminal.description")},get children(){var _=cr();return n(_,r(q,{get checked(){return a.general.showTerminal()},onChange:U=>a.general.setShowTerminal(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showStatus.title")},get description(){return i.t("settings.general.row.showStatus.description")},get children(){var _=dr();return n(_,r(q,{get checked(){return a.general.showStatus()},onChange:U=>a.general.setShowStatus(U)})),_}})]}}),null),P})(),ke=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.appearance")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.colorScheme.title")},get description(){return i.t("settings.general.row.colorScheme.description")},get children(){return r(be,{"data-action":"settings-color-scheme",get options(){return E()},get current(){return E().find(_=>_.value===t.colorScheme())},value:_=>_.value,label:_=>_.label,onSelect:_=>_&&t.setColorScheme(_.value),onHighlight:_=>{if(_)return t.previewColorScheme(_.value),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),r(K,{get title(){return i.t("settings.general.row.uiFont.title")},get description(){return i.t("settings.general.row.uiFont.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-ui-font",get label(){return i.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return B()},onChange:U=>a.appearance.setUIFont(U),placeholder:wt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":kt(a.appearance.uiFont())}}})),_}}),r(K,{get title(){return i.t("settings.general.row.font.title")},get description(){return i.t("settings.general.row.font.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-code-font",get label(){return i.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return ce()},onChange:U=>a.appearance.setFont(U),placeholder:$t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":yt(a.appearance.font())}}})),_}}),r(K,{get title(){return i.t("settings.general.row.terminalFont.title")},get description(){return i.t("settings.general.row.terminalFont.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-terminal-font",get label(){return i.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return de()},onChange:U=>a.appearance.setTerminalFont(U),placeholder:_t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ct(a.appearance.terminalFont())}}})),_}})]}}),null),P})(),Ie=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.notifications")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.notifications.agent.title")},get description(){return i.t("settings.general.notifications.agent.description")},get children(){var _=ur();return n(_,r(q,{get checked(){return a.notifications.agent()},onChange:U=>a.notifications.setAgent(U)})),_}}),r(K,{get title(){return i.t("settings.general.notifications.permissions.title")},get description(){return i.t("settings.general.notifications.permissions.description")},get children(){var _=gr();return n(_,r(q,{get checked(){return a.notifications.permissions()},onChange:U=>a.notifications.setPermissions(U)})),_}}),r(K,{get title(){return i.t("settings.general.notifications.errors.title")},get description(){return i.t("settings.general.notifications.errors.description")},get children(){var _=mr();return n(_,r(q,{get checked(){return a.notifications.errors()},onChange:U=>a.notifications.setErrors(U)})),_}})]}}),null),P})(),mt=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.sounds")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.sounds.agent.title")},get description(){return i.t("settings.general.sounds.agent.description")},get children(){return r(be,Le({"data-action":"settings-sounds-agent"},()=>ge(()=>a.sounds.agentEnabled(),()=>a.sounds.agent(),_=>a.sounds.setAgentEnabled(_),_=>a.sounds.setAgent(_))))}}),r(K,{get title(){return i.t("settings.general.sounds.permissions.title")},get description(){return i.t("settings.general.sounds.permissions.description")},get children(){return r(be,Le({"data-action":"settings-sounds-permissions"},()=>ge(()=>a.sounds.permissionsEnabled(),()=>a.sounds.permissions(),_=>a.sounds.setPermissionsEnabled(_),_=>a.sounds.setPermissions(_))))}}),r(K,{get title(){return i.t("settings.general.sounds.errors.title")},get description(){return i.t("settings.general.sounds.errors.description")},get children(){return r(be,Le({"data-action":"settings-sounds-errors"},()=>ge(()=>a.sounds.errorsEnabled(),()=>a.sounds.errors(),_=>a.sounds.setErrorsEnabled(_),_=>a.sounds.setErrors(_))))}})]}}),null),P})(),pt=()=>{const P=S();if(!P&&f()||!P)return i.t("settings.general.row.version.descriptionLoading");const D=P.current==="local"||P.current==="dev"?i.t("settings.general.row.version.developmentBuild"):P.current;return P.method==="desktop"&&!p.hasDesktopBridge()?i.t("settings.general.row.version.descriptionDesktopManaged",{current:D}):P.method==="managed-local"?i.t("settings.general.row.version.descriptionManagedLocal",{current:D}):P.method==="unknown"?i.t("settings.general.row.version.descriptionUnknownMethod",{current:D}):P.hasUpdate&&P.latest?i.t("settings.general.row.version.descriptionHasUpdate",{current:D,latest:P.latest}):i.t("settings.general.row.version.descriptionUpToDate",{current:D})},ft=()=>{const P=S();return!(!P?.hasUpdate||!P.latest||P.method==="unknown"||P.method==="managed-local"||P.method==="desktop"&&!p.hasDesktopBridge())},ht=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.updates")),n(P,r(oe,{get children(){return r(K,{get title(){return i.t("settings.general.row.version.title")},get description(){return pt()},get children(){var _=pr();return n(_,r(F,{get when(){return A(()=>!!S()?.current)()&&/^\d+\.\d+\.\d+/.test(S().current)},get children(){return r(M,{type:"button",size:"small",variant:"ghost",onClick:U=>{U.preventDefault(),p.openWhatsNew(S()?.current)},get disabled(){return p.isUpgrading()},get children(){return i.t("settings.general.row.version.action.whatsNew")}})}}),null),n(_,r(F,{get when(){return ft()},get fallback(){return r(M,{type:"button",size:"small",variant:"secondary",onClick:U=>{U.preventDefault(),m()},get disabled(){return f()||p.isUpgrading()},get children(){return A(()=>!!f())()?i.t("settings.general.row.version.action.checking"):i.t("settings.general.row.version.action.check")}})},get children(){return r(M,{type:"button",size:"small",variant:"primary",icon:"download",onClick:async U=>{U.preventDefault(),await p.startUpgrade(S()?.latest??void 0),await m()},get disabled(){return p.isUpgrading()},get children(){return A(()=>!!p.isUpgrading())()?i.t("settings.general.row.version.action.updating"):i.t("settings.general.row.version.action.update")}})}}),null),_}})}}),null),P})();return(()=>{var P=hr(),D=P.firstChild;return n(P,r(F,{get when(){return!ue()},get children(){var _=fr(),U=_.firstChild,G=U.firstChild;return n(G,()=>i.t("settings.tab.general")),_}}),D),n(D,r(we,{}),null),n(D,r(ke,{}),null),n(D,r(Ie,{}),null),n(D,r(mt,{}),null),n(D,r(ht,{}),null),n(D,r(F,{get when(){return!1},get children(){return r(ee,{})}}),null),Q(_=>H(P,{"flex flex-col":!0,"w-full":ue(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!ue()},_)),P})()};function $r(e){switch(e){case"accessibility":return"settings.general.row.computerUse.permissionDescription.accessibility";case"screen-recording":return"settings.general.row.computerUse.permissionDescription.screenRecording";default:return"settings.general.row.computerUse.permissionDescription.generic"}}function He(e){const t=N(),i=Fe(),u=Y(),[l,a]=he(null),[p,o]=he(!1),[d,f]=he([]),[b,m]=he(!1),S=async()=>{const $=await i.systemPermissions?.check();$&&f($.permissions)};Ne(()=>{S();const $=setInterval(()=>void S(),2e3),v=()=>void S();return window.addEventListener("focus",v),()=>{clearInterval($),window.removeEventListener("focus",v)}});const x=()=>{e.onClose?.(),u.close()},w=async $=>{a($);try{await i.systemPermissions?.request($)}finally{a(null)}},h=async()=>{o(!0);try{await S()}finally{setTimeout(()=>o(!1),250)}},s=async()=>{m(!0);try{(await i.relaunchShell?.()??!1)||T({variant:"default",title:t.t("settings.general.row.computerUse.relaunchUnavailable.title"),description:t.t("settings.general.row.computerUse.relaunchUnavailable.description")})}finally{m(!1)}},g=()=>e.tool==="browser"?t.t("settings.general.row.browserUse.title"):t.t("settings.general.row.computerUse.title"),c=L(()=>d().length>0&&d().every(se)),C=L(()=>d().some(Ce)),y=L(()=>d().filter(se).length);return r(ve,{get title(){return t.t("settings.general.row.computerUse.permissionsTitle",{tool:g()})},fit:!0,class:"w-[calc(100vw-2rem)] max-w-[40rem]",transition:!0,get children(){var $=vr(),v=$.firstChild,z=v.nextSibling,j=z.firstChild,E=z.nextSibling,I=E.nextSibling,V=I.firstChild,W=I.nextSibling,J=W.firstChild;return n(v,()=>t.t("settings.general.row.computerUse.permissionsBody",{tool:g(),count:String(d().length)})),n(j,r(le,{get name(){return A(()=>!!c())()?"circle-check":C()?"reset":"circle-ban-sign"},class:"h-3.5 w-3.5"}),null),n(j,(()=>{var O=A(()=>!!c());return()=>O()?t.t("settings.general.row.computerUse.statusAllGranted"):A(()=>!!C())()?t.t("settings.general.row.computerUse.statusRelaunchRequired"):t.t("settings.general.row.computerUse.statusActivePartial",{active:String(y()),total:String(d().length)})})(),null),n(z,r(M,{size:"small",variant:"ghost",get disabled(){return p()},onClick:O=>{O.preventDefault(),h()},get children(){return A(()=>!!p())()?t.t("settings.general.row.computerUse.recheckLoading"):t.t("settings.general.row.computerUse.recheck")}}),null),n(E,()=>d().map(O=>(()=>{var ce=xr(),B=ce.firstChild,de=B.firstChild,ue=de.firstChild,ge=ue.nextSibling,we=de.nextSibling;return n(de,r(le,{get name(){return A(()=>!!se(O))()?"circle-check":Ce(O)?"reset":"circle-ban-sign"},get classList(){return{"h-4 w-4 shrink-0":!0,"text-text-on-success-strong":se(O),"text-text-on-warning-strong":!se(O)}}}),ue),n(ue,()=>O.label),n(ge,(()=>{var ee=A(()=>!!se(O));return()=>ee()?t.t("settings.general.row.computerUse.permissionGranted"):A(()=>!!Ce(O))()?t.t("settings.general.row.computerUse.permissionRelaunchRequired"):t.t("settings.general.row.computerUse.permissionMissing")})()),n(we,()=>t.t($r(O.key))),n(ce,r(F,{get when(){return!ze(O)},get children(){var ee=br();return n(ee,r(M,{size:"small",variant:"secondary",get disabled(){return l()===O.key},onClick:ke=>{ke.preventDefault(),w(O.key)},get children(){return A(()=>l()===O.key)()?t.t("settings.general.row.computerUse.permissionOpening"):t.t("settings.general.row.computerUse.permissionOpenSettings")}})),ee}}),null),Q(ee=>{var ke={"flex flex-col gap-3 rounded-lg border px-4 py-4 sm:flex-row sm:items-start sm:justify-between":!0,"border-border-success-base bg-surface-success-weak/40":se(O),"border-border-warning-base bg-surface-warning-weak/40":Ce(O),"border-border-weak-base":!ze(O)},Ie={"rounded-full px-1.5 py-0.5 text-11-medium":!0,"bg-surface-success-weak text-text-on-success-strong":se(O),"bg-surface-warning-weak text-text-on-warning-strong":!se(O)};return ee.e=H(ce,ke,ee.e),ee.t=H(ge,Ie,ee.t),ee},{e:void 0,t:void 0}),ce})())),n(I,r(le,{name:"circle-ban-sign",class:"h-4 w-4 shrink-0 text-text-on-warning-strong mt-0.5"}),V),n(V,()=>t.t(C()?"settings.general.row.computerUse.permissionsRelaunchFooter":"settings.general.row.computerUse.permissionsFooter")),n(W,r(M,{variant:"ghost",size:"normal",onClick:x,get children(){return t.t("settings.general.row.computerUse.permissionDone")}}),J),n(J,r(F,{get when(){return A(()=>!!e.onConfirmEnable)()&&!c()},get children(){return r(M,{variant:"ghost",size:"normal",onClick:O=>{O.preventDefault(),e.onConfirmEnable?.(),x()},get children(){return t.t("settings.general.row.computerUse.enableAnyway")}})}}),null),n(J,r(F,{get when(){return A(()=>!!i.relaunchShell)()&&!c()},get children(){return r(M,{get variant(){return e.onConfirmEnable?"ghost":"primary"},size:"normal",get disabled(){return b()},onClick:O=>{O.preventDefault(),s()},get children(){return A(()=>!!b())()?t.t("settings.general.row.computerUse.relaunchPending"):t.t("settings.general.row.computerUse.relaunch")}})}}),null),n(J,r(F,{get when(){return A(()=>!!c())()&&e.onConfirmEnable},get children(){return r(M,{variant:"primary",size:"normal",onClick:O=>{O.preventDefault(),e.onConfirmEnable?.(),x()},get children(){return t.t("settings.general.row.computerUse.enableNow")}})}}),null),Q(O=>H(j,{"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-12-medium":!0,"bg-surface-success-weak text-text-on-success-strong":c(),"bg-surface-warning-weak text-text-on-warning-strong":!c()},O)),$}})}const K=e=>(()=>{var t=wr(),i=t.firstChild,u=i.firstChild,l=u.nextSibling,a=i.nextSibling;return n(u,()=>e.title),n(l,()=>e.description),n(a,()=>e.children),t})();je(["click"]);var yr=k('<h2 class="text-16-medium text-text-strong">'),_r=k('<div class="flex flex-col gap-4 max-w-[720px]"><div></div><div class="flex h-10 items-center gap-2 rounded-lg bg-surface-base px-3">'),Cr=k('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Sr=k('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Dr=k('<div><div class="flex flex-col gap-8 max-w-[720px]">'),Er=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="pt-6 pb-6">'),Pr=k('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),zr=k('<div class="flex items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><span class="text-14-regular text-text-strong"></span><button type=button>');const Oe=typeof navigator=="object"&&/(Mac|iPod|iPhone|iPad)/.test(navigator.platform),xe="command.palette",jr="mod+shift+p",_e=["General","Session","Navigation","Model and agent","Terminal","Prompt"],Fr={General:"settings.shortcuts.group.general",Session:"settings.shortcuts.group.session",Navigation:"settings.shortcuts.group.navigation","Model and agent":"settings.shortcuts.group.modelAndAgent",Terminal:"settings.shortcuts.group.terminal",Prompt:"settings.shortcuts.group.prompt"};function Re(e){return e===xe?"General":e.startsWith("terminal.")?"Terminal":e.startsWith("model.")||e.startsWith("agent.")||e.startsWith("mcp.")?"Model and agent":e.startsWith("file.")||e.startsWith("fileTree.")?"Navigation":e.startsWith("prompt.")?"Prompt":e.startsWith("session.")||e.startsWith("message.")||e.startsWith("permissions.")||e.startsWith("steps.")||e.startsWith("review.")?"Session":"General"}function Ir(e){return e==="Shift"||e==="Control"||e==="Alt"||e==="Meta"}function Lr(e){return e===","?"comma":e==="+"?"plus":e===" "?"space":e.toLowerCase()}function Mr(e){if(Ir(e.key))return;const t=[];(Oe?e.metaKey:e.ctrlKey)&&t.push("mod"),Oe&&e.ctrlKey&&t.push("ctrl"),!Oe&&e.metaKey&&t.push("meta"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift");const u=Lr(e.key);if(u)return t.push(u),t.join("+")}function Ke(e){if(!e)return[];const t=[];for(const i of Lt(e)){const u=[];i.ctrl&&u.push("ctrl"),i.alt&&u.push("alt"),i.shift&&u.push("shift"),i.meta&&u.push("meta"),i.key&&u.push(i.key),u.length!==0&&t.push(u.join("+"))}return t}function Or(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Rr(e,t,i){const u=new Map;u.set(xe,{title:i,group:"General"});for(const l of e.catalog)l.id.startsWith("suggested.")||u.set(l.id,{title:l.title,group:Re(l.id)});for(const l of e.options)l.id.startsWith("suggested.")||u.set(l.id,{title:l.title,group:Re(l.id)});for(const[l,a]of Object.entries(t))typeof a=="string"&&(u.has(l)||u.set(l,{title:l,group:Re(l)}));return u}function Ur(e){const t=new Map;for(const i of _e)t.set(i,[]);for(const[i,u]of e){const l=t.get(u.group);l&&l.push(i)}for(const i of _e){const u=t.get(i);u&&u.sort((l,a)=>(e.get(l)?.title??"").localeCompare(e.get(a)?.title??""))}return t}function Tr(e,t,i,u){const l=e.toLowerCase().trim();if(!l)return i;const a=new Map;for(const d of _e)a.set(d,[]);const p=Array.from(t.entries()).map(([d,f])=>({id:d,title:f.title,group:f.group,keybind:u(d)})),o=Wt.go(l,p,{keys:["title","keybind"],threshold:-1e4});for(const d of o){const f=a.get(d.obj.group);f&&f.push(d.obj.id)}return a}function Ar(e){Ne(()=>{Mt(document,"keydown",i=>{const u=e.active();if(!u)return;if(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),i.key==="Escape"){e.stop();return}if((i.key==="Backspace"||i.key==="Delete")&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&!i.shiftKey){e.set(u,"none"),e.stop();return}const a=Mr(i);if(!a)return;const p=new Map;for(const o of Ke(a))for(const d of e.used().get(o)??[])d.id!==u&&p.set(d.id,d.title);if(p.size>0){T({title:e.language.t("settings.shortcuts.conflict.title"),description:e.language.t("settings.shortcuts.conflict.description",{keybind:Ot(a,e.language.t),titles:[...p.values()].join(", ")})});return}e.set(u,a),e.stop()},{capture:!0})})}const Kr=e=>{const t=jt(),i=N(),u=it(),[l,a]=pe({active:null,filter:""}),p=()=>{l.active&&(a("active",null),t.keybinds(!0))},o=y=>{if(l.active===y){p();return}l.active&&p(),a("active",y),t.keybinds(!1)},d=L(()=>Or(u.current.keybinds)),f=L(()=>Object.values(d()).some(y=>typeof y=="string")),b=()=>{p(),u.keybinds.resetAll(),T({title:i.t("settings.shortcuts.reset.toast.title"),description:i.t("settings.shortcuts.reset.toast.description")})},m=L(()=>(i.locale(),Rr(t,d(),i.t("command.palette")))),S=y=>m().get(y)?.title??"",x=L(()=>Ur(m())),w=L(()=>Tr(l.filter,m(),x(),y=>t.keybind(y)||"")),h=L(()=>{for(const y of _e)if((w().get(y)??[]).length>0)return!0;return!1}),s=L(()=>{const y=new Map,$=(j,E)=>{const I=y.get(j);if(!I){y.set(j,[E]);return}I.push(E)},v=u.keybinds.get(xe)??jr;for(const j of Ke(v))$(j,{id:xe,title:S(xe)});const z=j=>{const E=u.keybinds.get(j);if(typeof E=="string")return E;const I=t.options.find(W=>W.id===j);return I?.keybind?I.keybind:t.catalog.find(W=>W.id===j)?.keybind};for(const j of m().keys())if(j!==xe)for(const E of Ke(z(j)))$(E,{id:j,title:S(j)});return y}),g=(y,$)=>u.keybinds.set(y,$),c=()=>e.layout==="page";Ar({active:()=>l.active,stop:p,set:g,used:s,language:i}),Ft(()=>{l.active&&t.keybinds(!0)});const C=()=>(()=>{var y=_r(),$=y.firstChild,v=$.nextSibling;return n($,r(F,{get when(){return!c()},get children(){var z=yr();return n(z,()=>i.t("settings.shortcuts.title")),z}}),null),n($,r(M,{size:"small",variant:"secondary",onClick:b,get disabled(){return!f()},get children(){return i.t("settings.shortcuts.reset.button")}}),null),n(v,r(le,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),n(v,r(R,{variant:"ghost",type:"text",get value(){return l.filter},onChange:z=>a("filter",z),get placeholder(){return i.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),n(v,r(F,{get when(){return l.filter},get children(){return r(X,{icon:"circle-x",variant:"ghost",onClick:()=>a("filter","")})}}),null),Q(z=>H($,{"flex items-center gap-4":!0,"justify-end":c(),"justify-between":!c()},z)),y})();return(()=>{var y=Dr(),$=y.firstChild;return n(y,r(F,{get when(){return c()},get fallback(){return(()=>{var v=Er(),z=v.firstChild;return n(z,r(C,{})),v})()},get children(){return r(C,{})}}),$),n($,r(Z,{each:_e,children:v=>r(F,{get when(){return(w().get(v)??[]).length>0},get children(){var z=Pr(),j=z.firstChild;return n(j,()=>i.t(Fr[v])),n(z,r(oe,{get children(){return r(Z,{get each(){return w().get(v)??[]},children:E=>(()=>{var I=zr(),V=I.firstChild,W=V.nextSibling;return n(V,()=>S(E)),W.$$click=()=>o(E),It(W,"data-keybind-id",E),n(W,r(F,{get when(){return l.active===E},get fallback(){return t.keybind(E)||i.t("settings.shortcuts.unassigned")},get children(){return i.t("settings.shortcuts.pressKeys")}})),Q(J=>H(W,{"h-8 px-3 rounded-md text-12-regular":!0,"bg-surface-base text-text-subtle hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active":l.active!==E,"border border-border-weak-base bg-surface-inset-base text-text-weak":l.active===E},J)),I})()})}}),null),z}})}),null),n($,r(F,{get when(){return A(()=>!!l.filter)()&&!h()},get children(){var v=Sr(),z=v.firstChild;return n(z,()=>i.t("settings.shortcuts.search.empty")),n(v,r(F,{get when(){return l.filter},get children(){var j=Cr(),E=j.firstChild,I=E.nextSibling;return I.nextSibling,n(j,()=>l.filter,I),j}}),null),v}}),null),Q(v=>H(y,{"flex flex-col":!0,"w-full gap-6":c(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!c()},v)),y})()};je(["click"]);function We(e){if(e.catalog&&Object.keys(e.catalog.models).length>0)return{models:e.catalog.models,providerCatalog:!0};const t=new Map(Object.values(e.provider.models).map(i=>[i.id,i]));return e.catalogs?.forEach(i=>{Object.values(i.models).forEach(u=>{t.has(u.id)||t.set(u.id,u)})}),{models:Object.fromEntries(t),providerCatalog:!1}}function Nr(e){const t=We(e),i=Object.keys(t.models),u=new Set(i);return e.config?.whitelist?.length?new Set(e.config.whitelist.filter(l=>u.has(l))):e.config?.blacklist?.length?new Set(i.filter(l=>!e.config?.blacklist?.includes(l))):t.providerCatalog?new Set(i):new Set(Object.keys(e.provider.models).filter(l=>u.has(l)))}function qr(e){const t=We(e),i=Nr(e);return Object.values(t.models).map(u=>({id:u.id,model:u,selected:i.has(u.id)})).sort((u,l)=>u.model.name.localeCompare(l.model.name)||u.id.localeCompare(l.id))}function Wr(e,t){const i=t.trim().toLowerCase();return i?e.filter(u=>u.id.toLowerCase().includes(i)||u.model.name.toLowerCase().includes(i)):e}function Vr(e){const t=e.limit.context&&e.limit.output?{limit:{context:e.limit.context,output:e.limit.output,...e.limit.input!==void 0?{input:e.limit.input}:{}}}:{};return{name:e.name,temperature:e.capabilities.temperature,reasoning:e.capabilities.reasoning,attachment:e.capabilities.attachment,tool_call:e.capabilities.toolcall,...e.family?{family:e.family}:{},...e.release_date?{release_date:e.release_date}:{},...t}}function Br(e,t,i=[],u={}){const l=new Set(u.includeModelIDs??[]),a=u.includeModels||l.size>0?Object.fromEntries(t.map(o=>{if(!u.includeModels&&!l.has(o))return;const d=i.find(f=>f.id===o);if(d)return[o,Vr(d.model)]}).filter(o=>!!o)):void 0,p=a?{...a,...e?.models??{}}:e?.models;return{...e??{},whitelist:t.slice().sort((o,d)=>o.localeCompare(d)),blacklist:[],...p?{models:p}:{}}}var Gr=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong">'),Hr=k('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Jr=k('<div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Qr=k('<div class="py-4 text-14-regular text-text-weak">'),Xr=k('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate"></span></div><div class="flex shrink-0 items-center gap-2">'),Yr=k('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Zr=k('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),en=k('<span class="text-12-regular text-text-weak pl-8">'),tn=k('<div class="pt-2 text-12-regular text-text-danger-base">'),rn=k('<div class="flex flex-col gap-5 px-2.5 pb-3 overflow-y-auto max-h-[70vh]"><div class="px-2.5 flex items-center justify-between gap-4"><div class="flex items-center gap-3 min-w-0"><div class=min-w-0><div class="text-16-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak"></div></div></div><div class="flex shrink-0 items-center gap-2"></div></div><div class=mx-2.5></div><form class="mx-2.5 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-2"></form><div class=px-2.5></div><div class="flex justify-end gap-2 px-2.5">'),nn=k('<div class="px-4 py-10 text-center text-12-regular text-text-weak">'),sn=k('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span><span class="text-12-regular text-text-weak truncate block">');const ln=[{match:e=>e==="codeplane",key:"dialog.provider.codeplane.note"},{match:e=>e==="anthropic",key:"dialog.provider.anthropic.note"},{match:e=>e.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:e=>e==="openai",key:"dialog.provider.openai.note"},{match:e=>e==="google",key:"dialog.provider.google.note"},{match:e=>e==="openrouter",key:"dialog.provider.openrouter.note"},{match:e=>e==="vercel",key:"dialog.provider.vercel.note"}],an=e=>{const t=Y(),i=N(),u=ne(),l=re(),a=st(),p=L(()=>a.connected().filter(s=>s.id!=="codeplane"||Object.values(s.models).find(g=>g.cost?.input))),o=L(()=>{const s=new Set(p().map(c=>c.id)),g=a.popular().filter(c=>!s.has(c.id)).slice();return g.sort((c,C)=>Ee.indexOf(c.id)-Ee.indexOf(C.id)),g}),d=s=>{if(!("source"in s))return;const g=s.source;if(g==="env"||g==="api"||g==="config"||g==="custom")return g},f=s=>{const g=d(s);return g==="env"?i.t("settings.providers.tag.environment"):g==="api"?i.t("provider.connect.method.apiKey"):g==="config"?S(s.id)?i.t("settings.providers.tag.custom"):i.t("settings.providers.tag.config"):g==="custom"?i.t("settings.providers.tag.custom"):i.t("settings.providers.tag.other")},b=s=>d(s)!=="env",m=s=>ln.find(g=>g.match(s))?.key,S=s=>{const g=l.data.config.provider?.[s];return!(!g||g.npm!=="@ai-sdk/openai-compatible"||!g.models||Object.keys(g.models).length===0)},x=()=>e.layout==="page",w=async(s,g)=>{const c=l.data.config.disabled_providers??[],C=c.includes(s)?c:[...c,s];l.set("config","disabled_providers",C),await l.updateConfig({disabled_providers:C}).then(()=>{T({variant:"success",icon:"circle-check",title:i.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:i.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(y=>{l.set("config","disabled_providers",c);const $=y instanceof Error?y.message:String(y);T({title:i.t("common.requestFailed"),description:$})})},h=async(s,g)=>{if(S(s)){await u.client.auth.remove({providerID:s}).catch(()=>{}),await w(s,g);return}await u.client.auth.remove({providerID:s}).then(async()=>{await u.client.global.dispose(),T({variant:"success",icon:"circle-check",title:i.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:i.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(c=>{const C=c instanceof Error?c.message:String(c);T({title:i.t("common.requestFailed"),description:C})})};return(()=>{var s=Jr(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=c.nextSibling,$=y.firstChild;return n(s,r(F,{get when(){return!x()},get children(){var v=Gr(),z=v.firstChild,j=z.firstChild;return n(j,()=>i.t("settings.providers.title")),v}}),g),n(C,()=>i.t("settings.providers.section.connected")),n(c,r(oe,{get children(){return r(F,{get when(){return p().length>0},get fallback(){return(()=>{var v=Qr();return n(v,()=>i.t("settings.providers.connected.empty")),v})()},get children(){return r(Z,{get each(){return p()},children:v=>(()=>{var z=Xr(),j=z.firstChild,E=j.firstChild,I=j.nextSibling;return n(j,r(ye,{get id(){return v.id},class:"size-5 shrink-0 icon-strong-base"}),E),n(E,()=>v.name),n(j,r(ie,{get children(){return f(v)}}),null),n(I,r(M,{size:"large",variant:"ghost",icon:"edit",onClick:()=>t.show(()=>r(on,{provider:v})),get children(){return i.t("settings.providers.models.edit")}}),null),n(I,r(F,{get when(){return b(v)},get fallback(){return(()=>{var V=Yr();return n(V,()=>i.t("settings.providers.connected.environmentDescription")),V})()},get children(){return r(M,{size:"large",variant:"ghost",onClick:()=>void h(v.id,v.name),get children(){return i.t("common.disconnect")}})}}),null),z})()})}})}}),null),n($,()=>i.t("settings.providers.section.popular")),n(y,r(oe,{get children(){return[r(Z,{get each(){return o()},children:v=>(()=>{var z=Zr(),j=z.firstChild,E=j.firstChild,I=E.firstChild;return n(E,r(ye,{get id(){return v.id},class:"size-5 shrink-0 icon-strong-base"}),I),n(I,()=>v.name),n(E,r(F,{get when(){return v.id==="codeplane"},get children(){return r(ie,{get children(){return i.t("dialog.provider.tag.recommended")}})}}),null),n(j,r(F,{get when(){return m(v.id)},keyed:!0,children:V=>(()=>{var W=en();return n(W,()=>i.t(V)),W})()}),null),n(z,r(M,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(Vt,{get provider(){return v.id}}))},get children(){return i.t("common.connect")}}),null),z})()}),(()=>{var v=Hr(),z=v.firstChild,j=z.firstChild,E=j.firstChild,I=j.nextSibling;return n(j,r(ye,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),E),n(E,()=>i.t("provider.custom.title")),n(j,r(ie,{get children(){return i.t("settings.providers.tag.custom")}}),null),n(I,()=>i.t("settings.providers.custom.description")),n(v,r(M,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(Bt,{back:"close"}))},get children(){return i.t("common.connect")}}),null),v})()]}}),null),n(y,r(M,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>{t.show(()=>r(Gt,{}))},get children(){return i.t("dialog.provider.viewAll")}}),null),Q(v=>H(s,{"flex flex-col":!0,"w-full":x(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!x()},v)),s})()};function on(e){const t=Y(),i=ne(),u=re(),l=N(),a=L(()=>u.data.provider.catalog.find($=>$.id===e.provider.id)),p=L(()=>We({provider:e.provider,catalog:a(),catalogs:u.data.provider.catalog})),o=L(()=>u.data.config.provider?.[e.provider.id]),d=L(()=>qr({provider:e.provider,catalog:a(),catalogs:u.data.provider.catalog,config:o()})),[f,b]=pe({selected:Object.fromEntries(d().map($=>[$.id,$.selected])),added:{},addModelID:"",addModelName:"",search:"",addError:"",error:""}),m=L(()=>Object.values(f.added).map($=>({id:$.id,model:$,selected:!!f.selected[$.id]}))),S=L(()=>{const $=new Set(d().map(v=>v.id));return[...d(),...m().filter(v=>$.has(v.id)?!1:($.add(v.id),!0))].sort((v,z)=>v.model.name.localeCompare(z.model.name)||v.id.localeCompare(z.id))}),x=L(()=>Wr(S(),f.search)),w=L(()=>S().filter($=>f.selected[$.id]).map($=>$.id)),h=$=>{b("selected",Object.fromEntries(S().map(v=>[v.id,$]))),b("error","")},s=($,v)=>{b("selected",$,v),b("error","")},g=$=>{for(const v of u.data.provider.catalog){const z=v.models[$];if(z)return z}},c=($,v)=>g($)??{id:$,providerID:e.provider.id,api:{id:$,url:Object.values(e.provider.models)[0]?.api.url??"",npm:Object.values(e.provider.models)[0]?.api.npm??"@ai-sdk/openai-compatible"},name:v,capabilities:{temperature:!0,reasoning:!1,attachment:!1,toolcall:!0,input:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:0,output:0},status:"active",options:{},headers:{},release_date:""},C=$=>{$.preventDefault();const v=f.addModelID.trim();if(!v){b("addError",l.t("settings.providers.models.add.error.id"));return}if(S().find(E=>E.id===v)){b("selected",v,!0),b("addModelID",""),b("addModelName",""),b("addError","");return}const j=c(v,f.addModelName.trim()||v);b("added",v,j),b("selected",v,!0),b("addModelID",""),b("addModelName",""),b("addError",""),b("error","")},y=te(()=>({mutationFn:async()=>{const $=w();if($.length===0){b("error",l.t("settings.providers.models.error.required"));return}await u.updateConfig({provider:{[e.provider.id]:Br(o(),$,S(),{includeModels:!p().providerCatalog,includeModelIDs:Object.keys(f.added)})}}),await i.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:l.t("settings.providers.models.toast.updated",{provider:e.provider.name})}),t.close()},onError:$=>{T({variant:"error",title:l.t("common.requestFailed"),description:$ instanceof Error?$.message:String($)})}}));return r(ve,{get title(){return l.t("settings.providers.models.title",{provider:e.provider.name})},transition:!0,get children(){var $=rn(),v=$.firstChild,z=v.firstChild,j=z.firstChild,E=j.firstChild,I=E.nextSibling,V=z.nextSibling,W=v.nextSibling,J=W.nextSibling,O=J.nextSibling,ce=O.nextSibling;return n(z,r(ye,{get id(){return e.provider.id},class:"size-5 shrink-0 icon-strong-base"}),j),n(E,()=>e.provider.name),n(I,()=>l.t("settings.providers.models.count",{selected:w().length,total:S().length})),n(V,r(M,{type:"button",size:"small",variant:"ghost",onClick:()=>h(!0),get children(){return l.t("settings.providers.models.selectAll")}}),null),n(V,r(M,{type:"button",size:"small",variant:"ghost",onClick:()=>h(!1),get children(){return l.t("settings.providers.models.clear")}}),null),n(W,r(R,{variant:"normal",type:"search",get value(){return f.search},onChange:B=>b("search",B),get placeholder(){return l.t("common.search.placeholder")},get label(){return l.t("common.search.placeholder")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"})),J.addEventListener("submit",C),n(J,r(R,{variant:"normal",type:"text",get value(){return f.addModelID},onChange:B=>{b("addModelID",B),b("addError","")},get placeholder(){return l.t("settings.providers.models.add.id")},get label(){return l.t("settings.providers.models.add.id")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get error(){return f.addError},get validationState(){return f.addError?"invalid":void 0}}),null),n(J,r(R,{variant:"normal",type:"text",get value(){return f.addModelName},onChange:B=>b("addModelName",B),get placeholder(){return l.t("settings.providers.models.add.name")},get label(){return l.t("settings.providers.models.add.name")},hideLabel:!0}),null),n(J,r(M,{type:"submit",size:"large",variant:"secondary",icon:"plus-small",get children(){return l.t("settings.providers.models.add.submit")}}),null),n(O,r(oe,{get children(){return r(F,{get when(){return x().length>0},get fallback(){return(()=>{var B=nn();return n(B,()=>l.t("settings.providers.models.empty")),B})()},get children(){return r(Z,{get each(){return x()},children:B=>(()=>{var de=sn(),ue=de.firstChild,ge=ue.firstChild,we=ge.nextSibling;return n(ge,()=>B.model.name),n(we,()=>B.id),n(de,r(q,{get checked(){return!!f.selected[B.id]},onChange:ee=>s(B.id,ee),hideLabel:!0,get children(){return B.model.name}}),null),de})()})}})}}),null),n(O,r(F,{get when(){return f.error},get children(){var B=tn();return n(B,()=>f.error),B}}),null),n(ce,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>t.close(),get children(){return l.t("common.cancel")}}),null),n(ce,r(M,{type:"button",variant:"primary",size:"large",get disabled(){return y.isPending},onClick:()=>y.mutate(),get children(){return A(()=>!!y.isPending)()?l.t("common.saving"):l.t("common.save")}}),null),$}})}var cn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),dn=k("<div>"),un=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),gn=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),mn=k('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),pn=k('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),fn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),hn=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-3 gap-3"></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">');const Je=e=>!!e&&typeof e=="object"&&!Array.isArray(e),vn=e=>e?{name:e.name,description:e.config.description??"",model:e.config.model??"",prompt:e.config.prompt??"",temperature:e.config.temperature!==void 0?String(e.config.temperature):"",topP:e.config.top_p!==void 0?String(e.config.top_p):"",steps:e.config.steps!==void 0?String(e.config.steps):"",hidden:!!e.config.hidden,disable:!!e.config.disable,errors:{}}:{name:"",description:"",model:"",prompt:"",temperature:"",topP:"",steps:"",hidden:!1,disable:!1,errors:{}};function bn(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=()=>e.layout==="page",p=L(()=>{const m=i.data.config.mode??{},S=new Set(Object.keys(m));return[...Object.entries(m).filter(x=>Je(x[1])).map(([x,w])=>({name:x,config:w,source:"mode"})),...Object.entries(i.data.config.agent??{}).filter(x=>Je(x[1])).filter(([x,w])=>!S.has(x)&&(w.mode??"primary")!=="subagent").map(([x,w])=>({name:x,config:w,source:"agent"}))].sort((x,w)=>x.name.localeCompare(w.name))}),o=L(()=>p().filter(m=>m.config.disable!==!0).length),d=(m,S)=>m==="mode"?i.updateConfig({mode:S}):i.updateConfig({agent:S}),f=te(()=>({mutationFn:async m=>{const S={...m.mode.source==="mode"?i.data.config.mode:i.data.config.agent};S[m.mode.name]={...S[m.mode.name]??{},disable:!m.enabled},await d(m.mode.source,S),await u.client.global.dispose().catch(()=>{})},onError:m=>{T({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),b=m=>{l.show(()=>r(wn,{entry:m}))};return[(()=>{var m=dn();return n(m,r(F,{get when(){return!a()},get children(){var S=cn(),x=S.firstChild,w=x.nextSibling;return n(x,()=>t.t("modes.page.title")),n(w,()=>t.t("modes.page.subtitle",{enabled:o(),total:p().length})),S}}),null),n(m,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>b(),get children(){return t.t("modes.page.add")}}),null),Q(S=>H(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()},S)),m})(),r(F,{get when(){return p().length>0},get fallback(){return(()=>{var m=gn();return n(m,()=>t.t("modes.page.empty")),m})()},get children(){var m=un();return n(m,r(Z,{get each(){return p()},children:S=>r(xn,{mode:S,toggling:()=>f.isPending&&f.variables?.mode.name===S.name,onToggle:x=>f.mutate({mode:S,enabled:x}),onEdit:()=>b(S)})})),m}})]}function xn(e){const t=N(),i=()=>e.mode.config.disable!==!0,u=()=>e.mode.config.model,l=()=>e.mode.source==="mode"?"primary":e.mode.config.mode==="all"?"all":"primary";return(()=>{var a=fn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=o.nextSibling;return n(d,r(le,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.mode.name),n(d,r(ie,{get children(){return t.t(`modes.kind.${l()}`)}}),null),n(d,r(F,{get when(){return e.mode.source==="mode"},get children(){return r(ie,{get children(){return t.t("modes.source.legacy")}})}}),null),n(d,r(F,{get when(){return e.mode.config.hidden},get children(){return r(ie,{get children(){return t.t("modes.tag.hidden")}})}}),null),n(d,r(F,{get when(){return!i()},get children(){return r(ie,{get children(){return t.t("modes.tag.disabled")}})}}),null),n(o,r(F,{get when(){return e.mode.config.description},get children(){var m=mn();return n(m,()=>e.mode.config.description),m}}),null),n(o,r(F,{get when(){return u()},get children(){var m=pn();return n(m,u),m}}),null),n(b,r(q,{get checked(){return i()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),a})()}function wn(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,[p,o]=pe(vn(e.entry)),d=()=>{const x={},w=p.name.trim();return w||(x.name=t.t("modes.editor.error.name")),!a&&(i.data.config.mode&&w in i.data.config.mode||i.data.config.agent&&w in i.data.config.agent)&&(x.name=t.t("modes.editor.error.duplicate")),o("errors",x),Object.keys(x).length===0},f=x=>{const w=x.trim();if(!w)return;const h=Number(w);if(!Number.isNaN(h))return h},b=()=>({mode:"primary",hidden:p.hidden,disable:p.disable,...p.description.trim()?{description:p.description.trim()}:{},...p.model.trim()?{model:p.model.trim()}:{},...p.prompt.trim()?{prompt:p.prompt}:{},...f(p.temperature)!==void 0?{temperature:f(p.temperature)}:{},...f(p.topP)!==void 0?{top_p:f(p.topP)}:{},...f(p.steps)!==void 0?{steps:f(p.steps)}:{}}),m=te(()=>({mutationFn:async()=>{if(!d())return;const x=e.entry?.source??"agent",w={...x==="mode"?i.data.config.mode:i.data.config.agent};w[p.name.trim()]=b(),x==="mode"?await i.updateConfig({mode:w}):await i.updateConfig({agent:w}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("modes.toast.updated"):t.t("modes.toast.added")}),l.close()},onError:x=>{T({variant:"error",title:t.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}})),S=x=>{x.preventDefault(),!m.isPending&&m.mutate()};return r(ve,{get title(){return a?t.t("modes.editor.title.edit"):t.t("modes.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var x=hn(),w=x.firstChild,h=w.firstChild,s=h.nextSibling,g=s.firstChild,c=g.firstChild,C=c.nextSibling,y=s.nextSibling,$=y.firstChild,v=$.firstChild,z=v.nextSibling,j=w.nextSibling;return x.addEventListener("submit",S),n(w,r(R,{autofocus:!0,get label(){return t.t("modes.editor.name")},placeholder:"review",get value(){return p.name},onChange:E=>ae(()=>{o("name",E),o("errors","name",void 0)}),get error(){return p.errors.name},disabled:a,spellcheck:!1,class:"font-mono text-xs"}),h),n(w,r(R,{get label(){return t.t("modes.editor.description")},get placeholder(){return t.t("modes.editor.description.placeholder")},get value(){return p.description},onChange:E=>o("description",E)}),h),n(w,r(R,{get label(){return t.t("modes.editor.model")},get description(){return t.t("modes.editor.model.description")},placeholder:"anthropic/claude-sonnet-4-5",get value(){return p.model},onChange:E=>o("model",E),spellcheck:!1,class:"font-mono text-xs"}),h),n(w,r(R,{multiline:!0,get label(){return t.t("modes.editor.prompt")},get description(){return t.t("modes.editor.prompt.description")},get placeholder(){return t.t("modes.editor.prompt.placeholder")},get value(){return p.prompt},onChange:E=>o("prompt",E),spellcheck:!1,class:"max-h-40 w-full overflow-y-auto font-mono text-xs"}),h),n(h,r(R,{get label(){return t.t("modes.editor.temperature")},placeholder:"0.7",get value(){return p.temperature},onChange:E=>o("temperature",E.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),n(h,r(R,{get label(){return t.t("modes.editor.topP")},placeholder:"1",get value(){return p.topP},onChange:E=>o("topP",E.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),n(h,r(R,{get label(){return t.t("modes.editor.steps")},placeholder:"50",get value(){return p.steps},onChange:E=>o("steps",E.replace(/[^0-9]/g,"")),inputmode:"numeric"}),null),n(c,()=>t.t("modes.editor.hidden")),n(C,()=>t.t("modes.editor.hidden.description")),n(s,r(q,{get checked(){return p.hidden},onChange:E=>o("hidden",E),hideLabel:!0,get children(){return t.t("modes.editor.hidden")}}),null),n(v,()=>t.t("modes.editor.disable")),n(z,()=>t.t("modes.editor.disable.description")),n(y,r(q,{get checked(){return p.disable},onChange:E=>o("disable",E),hideLabel:!0,get children(){return t.t("modes.editor.disable")}}),null),n(j,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(j,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),x}})}var kn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),$n=k('<div><div class="flex items-center gap-2">'),yn=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),_n=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Cn=k('<span class="text-11-regular text-text-weak">'),Sn=k('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),Dn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),En=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">'),Pn=k("<button type=button>"),zn=k('<span class="text-11-regular text-text-weaker">'),jn=k('<div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span></div><div class="flex flex-col gap-1.5">'),Fn=k('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const fe=()=>({key:"",value:""}),In={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled",needs_client_registration:"mcp.status.needs_auth"};function Ln(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=lt(),p=()=>e.layout==="page",[o,d]=qe(async()=>(await u.client.mcp.status().catch(()=>null))?.data??{}),f=L(()=>{const w=i.data.config.mcp??{},h=o()??{},s=[];for(const[g,c]of Object.entries(w))!c||typeof c!="object"||"type"in c&&s.push({name:g,config:c,status:h[g]});return s.sort((g,c)=>g.name.localeCompare(c.name))}),b=L(()=>f().filter(w=>w.config.enabled!==!1).length),m=te(()=>({mutationFn:async({name:w,enabled:h})=>{const s=i.data.config.mcp??{},g=s[w];if(!g||!("type"in g))throw new Error("not found");const c={...s,[w]:{...g,enabled:h}};await i.updateConfig({mcp:c}),h?await u.client.mcp.connect({name:w}).catch(()=>{}):await u.client.mcp.disconnect({name:w}).catch(()=>{}),d.refetch()},onError:w=>{T({variant:"error",title:t.t("common.requestFailed"),description:w instanceof Error?w.message:String(w)})}})),S=te(()=>({mutationFn:async w=>{const h={...i.data.config.mcp??{}};delete h[w],await i.updateConfig({mcp:h}),d.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("mcp.toast.removed")})},onError:w=>{T({variant:"error",title:t.t("common.requestFailed"),description:w instanceof Error?w.message:String(w)})}})),x=w=>{l.show(()=>r(On,{entry:w}))};return[(()=>{var w=$n(),h=w.firstChild;return n(w,r(F,{get when(){return!p()},get children(){var s=kn(),g=s.firstChild,c=g.nextSibling;return n(g,()=>t.t("mcp.page.title")),n(c,()=>t.t("mcp.page.subtitle",{enabled:b(),total:f().length})),s}}),h),n(h,r(M,{variant:"secondary",size:"large",icon:"shield",onClick:()=>a("/settings/secrets"),get children(){return t.t("secrets.page.title")}}),null),n(h,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>x(),get children(){return t.t("mcp.page.add")}}),null),Q(s=>H(w,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!p(),"justify-end":p()},s)),w})(),r(F,{get when(){return f().length>0},get fallback(){return(()=>{var w=_n();return n(w,()=>t.t("mcp.page.empty")),w})()},get children(){var w=yn();return n(w,r(Z,{get each(){return f()},children:h=>r(Mn,{server:h,toggling:()=>m.isPending&&m.variables?.name===h.name,onToggle:s=>m.mutate({name:h.name,enabled:s}),onEdit:()=>x(h),onRemove:()=>{window.confirm(t.t("mcp.page.confirm.remove",{name:h.name}))&&S.mutate(h.name)}})})),w}})]}function Mn(e){const t=N(),i=()=>{const a=e.server.config.enabled===!1?"disabled":e.server.status?.status;if(!a)return;const p=In[a];return p?t.t(p):a},u=()=>e.server.config.enabled!==!1,l=()=>e.server.config.type==="remote"?e.server.config.url:e.server.config.type==="local"&&Array.isArray(e.server.config.command)?e.server.config.command.join(" "):"";return(()=>{var a=Dn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=o.nextSibling;return n(d,r(le,{name:"mcp",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.server.name),n(d,r(ie,{get children(){return e.server.config.type}}),null),n(d,r(F,{get when(){return i()},get children(){var m=Cn();return n(m,i),m}}),null),n(o,r(F,{get when(){return l()},get children(){var m=Sn();return n(m,l),m}}),null),n(b,r(q,{get checked(){return u()},get disabled(){return e.toggling()},onChange:m=>e.onToggle(m),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(b,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),a})()}function On(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,p=()=>{const s=e.entry;if(!s)return{name:"",kind:"local",enabled:!0,command:"",url:"",timeout:"",environment:[fe()],headers:[fe()],errors:{}};const g=s.config;return g.type==="local"?{name:s.name,kind:"local",enabled:g.enabled!==!1,command:Array.isArray(g.command)?g.command.join(" "):"",url:"",timeout:g.timeout?String(g.timeout):"",environment:Object.entries(g.environment??{}).map(([c,C])=>({key:c,value:C}))||[fe()],headers:[fe()],errors:{}}:{name:s.name,kind:"remote",enabled:g.enabled!==!1,command:"",url:g.url,timeout:g.timeout?String(g.timeout):"",environment:[fe()],headers:Object.entries(g.headers??{}).map(([c,C])=>({key:c,value:C}))||[fe()],errors:{}}},[o,d]=pe(p()),f=()=>{const s={};if(o.name.trim()||(s.name=t.t("mcp.editor.error.name")),!a&&i.data.config.mcp&&o.name.trim()in i.data.config.mcp&&(s.name=t.t("mcp.editor.error.duplicate")),o.kind==="local"&&!o.command.trim()&&(s.command=t.t("mcp.editor.error.command")),o.kind==="remote"){const g=o.url.trim();g?/^https?:\/\//i.test(g)||(s.url=t.t("mcp.editor.error.urlInvalid")):s.url=t.t("mcp.editor.error.url")}return d("errors",s),Object.keys(s).length===0},b=()=>{const s=o.timeout.trim()?Number(o.timeout.trim()):void 0;if(o.kind==="local"){const c={};for(const C of o.environment){const y=C.key.trim();y&&(c[y]=C.value)}return{type:"local",command:o.command.trim().split(/\s+/).filter(C=>C.length>0),enabled:o.enabled,...Object.keys(c).length>0?{environment:c}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}}const g={};for(const c of o.headers){const C=c.key.trim();C&&(g[C]=c.value)}return{type:"remote",url:o.url.trim(),enabled:o.enabled,...Object.keys(g).length>0?{headers:g}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}},m=te(()=>({mutationFn:async()=>{if(!f())return;const s=b(),g=o.name.trim(),c={...i.data.config.mcp??{}},C=a&&e.entry?e.entry.name:void 0;C&&C!==g&&delete c[C],c[g]=s,await i.updateConfig({mcp:c}),C&&await u.client.mcp.disconnect({name:C}).catch(()=>{}),o.enabled?await u.client.mcp.add({name:g,config:s}).catch(()=>u.client.mcp.connect({name:g}).catch(()=>{})):await u.client.mcp.disconnect({name:g}).catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("mcp.toast.updated"):t.t("mcp.toast.added")}),l.close()},onError:s=>{T({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),S=s=>{s.preventDefault(),!m.isPending&&m.mutate()},x=(s,g,c,C)=>{d(s,g,c,C)},w=s=>{d(s,Pe(g=>g.push(fe())))},h=(s,g)=>{d(s,Pe(c=>{c.splice(g,1),c.length===0&&c.push(fe())}))};return r(ve,{get title(){return a?t.t("mcp.editor.title.edit"):t.t("mcp.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=En(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=C.nextSibling,$=c.nextSibling,v=$.firstChild,z=v.firstChild,j=z.nextSibling,E=g.nextSibling;return s.addEventListener("submit",S),n(g,r(R,{autofocus:!0,get label(){return t.t("mcp.editor.name")},placeholder:"my-server",get value(){return o.name},onChange:I=>ae(()=>{d("name",I),d("errors","name",void 0)}),get error(){return o.errors.name},disabled:a}),c),n(C,()=>t.t("mcp.editor.type")),n(y,r(Qe,{get active(){return o.kind==="local"},get label(){return t.t("mcp.editor.type.local")},onClick:()=>d("kind","local")}),null),n(y,r(Qe,{get active(){return o.kind==="remote"},get label(){return t.t("mcp.editor.type.remote")},onClick:()=>d("kind","remote")}),null),n(g,r(F,{get when(){return o.kind==="local"},get children(){return[r(R,{get label(){return t.t("mcp.editor.command")},get description(){return t.t("mcp.editor.command.description")},placeholder:"npx -y my-mcp-server",get value(){return o.command},onChange:I=>ae(()=>{d("command",I),d("errors","command",void 0)}),get error(){return o.errors.command},spellcheck:!1,class:"font-mono text-xs"}),r(Xe,{get title(){return t.t("mcp.editor.environment")},get description(){return t.t("mcp.editor.environment.description")},get rows(){return o.environment},secret:!0,onChange:(I,V,W)=>x("environment",I,V,W),onAdd:()=>w("environment"),onRemove:I=>h("environment",I)})]}}),$),n(g,r(F,{get when(){return o.kind==="remote"},get children(){return[r(R,{get label(){return t.t("mcp.editor.url")},placeholder:"https://example.com/mcp",get value(){return o.url},onChange:I=>ae(()=>{d("url",I),d("errors","url",void 0)}),get error(){return o.errors.url},spellcheck:!1}),r(Xe,{get title(){return t.t("mcp.editor.headers")},get description(){return t.t("mcp.editor.headers.description")},get rows(){return o.headers},secret:!0,onChange:(I,V,W)=>x("headers",I,V,W),onAdd:()=>w("headers"),onRemove:I=>h("headers",I)})]}}),$),n(g,r(R,{get label(){return t.t("mcp.editor.timeout")},get description(){return t.t("mcp.editor.timeout.description")},placeholder:"5000",get value(){return o.timeout},onChange:I=>d("timeout",I.replace(/[^0-9]/g,"")),inputmode:"numeric"}),$),n(z,()=>t.t("mcp.editor.enabled")),n(j,()=>t.t("mcp.editor.enabled.description")),n($,r(q,{get checked(){return o.enabled},onChange:I=>d("enabled",I),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(E,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(E,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function Qe(e){return(()=>{var t=Pn();return at(t,"click",e.onClick,!0),n(t,()=>e.label),Q(i=>H(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},i)),t})()}function Xe(e){const t=N();return(()=>{var i=jn(),u=i.firstChild,l=u.firstChild,a=u.nextSibling;return n(l,()=>e.title),n(u,r(F,{get when(){return e.description},get children(){var p=zn();return n(p,()=>e.description),p}}),null),n(a,r(Z,{get each(){return e.rows},children:(p,o)=>r(Rn,{row:p,get secret(){return e.secret},onKeyChange:d=>e.onChange(o(),"key",d),onValueChange:d=>e.onChange(o(),"value",d),onRemove:()=>e.onRemove(o())})})),n(i,r(M,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",get onClick(){return e.onAdd},get children(){return t.t("mcp.editor.row.add")}}),null),i})()}function Rn(e){const t=N(),[i,u]=he(!1);let l;const a=()=>e.secret&&!i()?"password":"text",p=()=>{l&&clearTimeout(l),u(!0),l=setTimeout(()=>u(!1),1500)},o=d=>{e.secret&&d.key==="Enter"&&(d.preventDefault(),p())};return(()=>{var d=Fn(),f=d.firstChild,b=f.nextSibling;return n(f,r(R,{variant:"ghost",get placeholder(){return t.t("mcp.editor.row.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),n(b,r(R,{variant:"ghost",get type(){return a()},get placeholder(){return t.t("mcp.editor.row.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:o,spellcheck:!1,class:"font-mono text-xs"})),n(d,r(F,{get when(){return e.secret},get children(){return r(X,{type:"button",variant:"ghost",size:"normal",get icon(){return i()?"eye":"shield"},get"aria-label"(){return t.t(i()?"mcp.editor.row.hide":"mcp.editor.row.reveal")},onPointerDown:()=>{l&&clearTimeout(l),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),n(d,r(X,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),d})()}je(["click"]);var Un=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Tn=k('<div><div></div><div class="flex flex-col gap-8">'),An=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Kn=k('<li class="border-b border-border-weak-base last:border-b-0">'),Nn=k('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong"></span></div><ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),qn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Wn=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-3 gap-3"></div><div class="flex flex-col gap-2"><span class="text-12-medium text-text-weak"></span><div class="grid grid-cols-2 gap-2"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Vn=k('<div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><span class="text-13-medium text-text-strong">');const Bn=40,Ue=e=>e===void 0||e===0?"":String(e),Te=e=>{const t=e.trim();if(!t)return;const i=Number(t);if(!Number.isNaN(i))return i},Ae=e=>e.replace(/[^0-9]/g,""),Gn=(e,t)=>e?.models?.[t],Hn=(e,t)=>{const i=Ee.indexOf(e.id),u=Ee.indexOf(t.id),l=i>=0,a=u>=0;return l&&!a?-1:!l&&a?1:l&&a?i-u:e.name.localeCompare(t.name)},Jn=e=>e?{providerID:e.provider.id,modelID:e.model.id,apiModelID:e.config?.id??e.model.api.id,name:e.config?.name??e.model.name,family:e.config?.family??e.model.family??"",releaseDate:e.config?.release_date??e.model.release_date??"",context:Ue(e.config?.limit?.context??e.model.limit.context),input:Ue(e.config?.limit?.input??e.model.limit.input),output:Ue(e.config?.limit?.output??e.model.limit.output),temperature:e.config?.temperature??e.model.capabilities.temperature,reasoning:e.config?.reasoning??e.model.capabilities.reasoning,attachment:e.config?.attachment??e.model.capabilities.attachment,toolCall:e.config?.tool_call??e.model.capabilities.toolcall,errors:{}}:{providerID:"",modelID:"",apiModelID:"",name:"",family:"",releaseDate:"",context:"",input:"",output:"",temperature:!0,reasoning:!1,attachment:!1,toolCall:!0,errors:{}};function Qn(e={}){const t=N(),i=re(),u=ot(),l=Y(),a=()=>e.layout==="page",p=()=>e.layout==="dialog",[o,d]=pe({expanded:{}}),f=L(()=>u.list().map(h=>{const s=Gn(i.data.config.provider?.[h.provider.id],h.id);return{provider:h.provider,model:h,config:s,custom:h.provider.source==="config"||h.provider.source==="custom"||!!s}}).sort((h,s)=>{const g=Hn(h.provider,s.provider);return g!==0?g:h.model.name.localeCompare(s.model.name)})),b=L(()=>f().reduce((h,s)=>{const g=h.find(c=>c.provider.id===s.provider.id);return g?(g.entries.push(s),h):(h.push({provider:s.provider,entries:[s]}),h)},[])),m=L(()=>f().filter(h=>u.visible({providerID:h.provider.id,modelID:h.model.id})).length),S=h=>{l.show(()=>r(Yn,{entry:h}))},x=h=>u.visible({providerID:h.provider.id,modelID:h.model.id}),w=h=>{if(o.expanded[h.provider.id])return h.entries;const s=[];for(const g of h.entries)if(x(g)&&(s.push(g),s.length>=Bn))return s;return s};return(()=>{var h=Tn(),s=h.firstChild,g=s.nextSibling;return n(s,r(F,{get when(){return!a()},get children(){var c=Un(),C=c.firstChild,y=C.nextSibling;return n(C,()=>t.t("models.page.title")),n(y,()=>t.t("models.page.subtitle",{shown:m(),total:f().length})),c}}),null),n(s,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>S(),get children(){return t.t("models.page.add")}}),null),n(g,r(F,{get when(){return b().length>0},get fallback(){return(()=>{var c=An();return n(c,()=>t.t("models.page.empty")),c})()},get children(){return r(Z,{get each(){return b()},children:c=>{const C=L(()=>w(c)),y=L(()=>c.entries.length-C().length);return(()=>{var $=Nn(),v=$.firstChild,z=v.firstChild,j=v.nextSibling;return n(v,r(ye,{get id(){return c.provider.id},class:"size-5 shrink-0 icon-strong-base"}),z),n(z,()=>c.provider.name),n(j,r(Z,{get each(){return C()},children:E=>r(Xn,{entry:E,onEdit:()=>S(E)})}),null),n(j,r(F,{get when(){return y()>0},get children(){var E=Kn();return n(E,r(M,{variant:"ghost",size:"normal",class:"w-full justify-start px-4 py-3 text-13-medium text-text-interactive-base hover:bg-surface-base-hover active:bg-surface-base-active",onClick:()=>d("expanded",c.provider.id,!0),get children(){return[A(()=>t.t("common.loadMore")),A(()=>t.t("common.moreCountSuffix",{count:y()}))]}})),E}}),null),$})()}})}})),Q(c=>{var C={"flex flex-col gap-6":!0,"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":p()},y={"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()};return c.e=H(h,C,c.e),c.t=H(s,y,c.t),c},{e:void 0,t:void 0}),h})()}function Xn(e){const t=N(),i=ot(),u=()=>({providerID:e.entry.provider.id,modelID:e.entry.model.id}),l=()=>i.visible(u());return(()=>{var a=qn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=d.nextSibling,m=o.nextSibling;return n(d,r(le,{name:"models",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.entry.model.name),n(b,()=>e.entry.model.id),n(m,r(q,{get checked(){return l()},onChange:S=>i.setVisibility(u(),S),hideLabel:!0,get children(){return t.t("models.row.shown")}}),null),n(m,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),a})()}function Yn(e){const t=N(),i=re(),u=ne(),l=st(),a=Y(),p=!!e.entry,[o,d]=pe(Jn(e.entry)),f=()=>{const x={},w=o.providerID.trim(),h=o.modelID.trim();return w||(x.providerID=t.t("models.editor.error.provider")),h||(x.modelID=t.t("models.editor.error.model")),o.name.trim()||(x.name=t.t("models.editor.error.name")),!p&&l.all().some(s=>s.id===w&&!!s.models[h])&&(x.modelID=t.t("models.editor.error.duplicate")),d("errors",x),Object.keys(x).length===0},b=()=>{const x=o.modelID.trim(),w=o.apiModelID.trim(),h=Te(o.context),s=Te(o.input),g=Te(o.output),c=h!==void 0&&g!==void 0?{context:h,output:g,...s!==void 0?{input:s}:{}}:void 0;return{...w&&w!==x?{id:w}:{},name:o.name.trim(),temperature:o.temperature,reasoning:o.reasoning,attachment:o.attachment,tool_call:o.toolCall,...o.family.trim()?{family:o.family.trim()}:{},...o.releaseDate.trim()?{release_date:o.releaseDate.trim()}:{},...c?{limit:c}:{}}},m=te(()=>({mutationFn:async()=>{if(!f())return;const x=o.providerID.trim(),w=o.modelID.trim(),h=i.data.config.provider?.[x]??{};await i.updateConfig({provider:{[x]:{...h,models:{...h.models??{},[w]:b()}}}}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:p?t.t("models.toast.updated"):t.t("models.toast.added")}),a.close()},onError:x=>{T({variant:"error",title:t.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}})),S=x=>{x.preventDefault(),!m.isPending&&m.mutate()};return r(ve,{get title(){return p?t.t("models.editor.title.edit"):t.t("models.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var x=Wn(),w=x.firstChild,h=w.firstChild,s=h.nextSibling,g=s.nextSibling,c=g.nextSibling,C=c.firstChild,y=C.nextSibling,$=w.nextSibling;return x.addEventListener("submit",S),n(h,r(R,{autofocus:!0,get label(){return t.t("models.editor.provider")},placeholder:"anthropic",get value(){return o.providerID},onChange:v=>ae(()=>{d("providerID",v),d("errors","providerID",void 0)}),get error(){return o.errors.providerID},disabled:p,spellcheck:!1,class:"font-mono text-xs"}),null),n(h,r(R,{get label(){return t.t("models.editor.model")},placeholder:"claude-sonnet-4-5",get value(){return o.modelID},onChange:v=>ae(()=>{d("modelID",v),d("errors","modelID",void 0)}),get error(){return o.errors.modelID},disabled:p,spellcheck:!1,class:"font-mono text-xs"}),null),n(w,r(R,{get label(){return t.t("models.editor.name")},placeholder:"Claude Sonnet 4.5",get value(){return o.name},onChange:v=>ae(()=>{d("name",v),d("errors","name",void 0)}),get error(){return o.errors.name}}),s),n(w,r(R,{get label(){return t.t("models.editor.apiModel")},get description(){return t.t("models.editor.apiModel.description")},get placeholder(){return o.modelID||"provider-model-id"},get value(){return o.apiModelID},onChange:v=>d("apiModelID",v),spellcheck:!1,class:"font-mono text-xs"}),s),n(s,r(R,{get label(){return t.t("models.editor.family")},placeholder:"claude",get value(){return o.family},onChange:v=>d("family",v)}),null),n(s,r(R,{get label(){return t.t("models.editor.releaseDate")},placeholder:"2026-01-01",get value(){return o.releaseDate},onChange:v=>d("releaseDate",v),spellcheck:!1}),null),n(g,r(R,{get label(){return t.t("models.editor.context")},placeholder:"200000",get value(){return o.context},onChange:v=>d("context",Ae(v)),inputmode:"numeric"}),null),n(g,r(R,{get label(){return t.t("models.editor.input")},placeholder:"200000",get value(){return o.input},onChange:v=>d("input",Ae(v)),inputmode:"numeric"}),null),n(g,r(R,{get label(){return t.t("models.editor.output")},placeholder:"8192",get value(){return o.output},onChange:v=>d("output",Ae(v)),inputmode:"numeric"}),null),n(C,()=>t.t("models.editor.capabilities")),n(y,r(Se,{get label(){return t.t("models.editor.temperature")},get checked(){return o.temperature},onChange:v=>d("temperature",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.reasoning")},get checked(){return o.reasoning},onChange:v=>d("reasoning",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.attachment")},get checked(){return o.attachment},onChange:v=>d("attachment",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.toolCall")},get checked(){return o.toolCall},onChange:v=>d("toolCall",v)}),null),n($,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),n($,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),x}})}function Se(e){return(()=>{var t=Vn(),i=t.firstChild;return n(i,()=>e.label),n(t,r(q,{get checked(){return e.checked},get onChange(){return e.onChange},hideLabel:!0,get children(){return e.label}}),null),t})()}var Zn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),ei=k("<div>"),ti=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),ri=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),ni=k('<span class="text-11-regular text-text-weak">'),ii=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),si=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span><span class="text-11-regular text-text-weaker"></span></div><div class="flex flex-col gap-1.5"></div></div></div><div class="flex justify-end gap-2 pt-1">'),li=k('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const ai=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("file://"),oi=e=>/^https?:\/\//.test(e),ci=e=>/(token|secret|password|apikey|api[_-]?key|auth)/i.test(e),De=()=>({key:"",value:""}),di=e=>{if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}},ui=e=>{const t=e.trim();if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;if(/^-?\d+(\.\d+)?$/.test(t)){const i=Number(t);if(!Number.isNaN(i))return i}if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")||t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{}return e};function gi(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=()=>e.layout==="page",p=L(()=>(i.data.config.plugin??[]).map((b,m)=>Array.isArray(b)?{index:m,spec:b,specifier:b[0],options:b[1]}:{index:m,spec:b,specifier:b,options:{}})),o=te(()=>({mutationFn:async f=>{const b=(i.data.config.plugin??[]).slice();b.splice(f,1),await i.updateConfig({plugin:b}),await u.client.global.dispose().catch(()=>{})},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("plugins.toast.removed")})},onError:f=>{T({variant:"error",title:t.t("common.requestFailed"),description:f instanceof Error?f.message:String(f)})}})),d=f=>{l.show(()=>r(pi,{entry:f}))};return[(()=>{var f=ei();return n(f,r(F,{get when(){return!a()},get children(){var b=Zn(),m=b.firstChild,S=m.nextSibling;return n(m,()=>t.t("plugins.page.title")),n(S,()=>t.t("plugins.page.subtitle",{count:p().length})),b}}),null),n(f,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>d(),get children(){return t.t("plugins.page.add")}}),null),Q(b=>H(f,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()},b)),f})(),r(F,{get when(){return p().length>0},get fallback(){return(()=>{var f=ri();return n(f,()=>t.t("plugins.page.empty")),f})()},get children(){var f=ti();return n(f,r(Z,{get each(){return p()},children:b=>r(mi,{plugin:b,onEdit:()=>d(b),onRemove:()=>{window.confirm(t.t("plugins.page.confirm.remove",{name:b.specifier}))&&o.mutate(b.index)}})})),f}})]}function mi(e){const t=N(),i=()=>ai(e.plugin.specifier)?t.t("plugins.kind.local"):oi(e.plugin.specifier)?t.t("plugins.kind.remote"):t.t("plugins.kind.package"),u=()=>Object.keys(e.plugin.options).length;return(()=>{var l=ii(),a=l.firstChild,p=a.firstChild,o=p.firstChild,d=o.firstChild,f=p.nextSibling;return n(o,r(le,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),d),n(d,()=>e.plugin.specifier),n(o,r(ie,{get children(){return i()}}),null),n(o,r(F,{get when(){return u()>0},get children(){var b=ni();return n(b,()=>t.t("plugins.row.optionCount",{count:u()})),b}}),null),n(f,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(f,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),l})()}function pi(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,p=()=>{const s=e.entry;if(!s)return{specifier:"",options:[De()],errors:{}};const g=Object.entries(s.options).map(([c,C])=>({key:c,value:di(C)}));return{specifier:s.specifier,options:g.length>0?g:[De()],errors:{}}},[o,d]=pe(p()),f=()=>{const s={};return o.specifier.trim()||(s.specifier=t.t("plugins.editor.error.specifier")),d("errors",s),Object.keys(s).length===0},b=()=>{const s=o.specifier.trim(),g={};for(const c of o.options){const C=c.key.trim();C&&(g[C]=ui(c.value))}return Object.keys(g).length===0?s:[s,g]},m=te(()=>({mutationFn:async()=>{if(!f())return;const s=b(),g=(i.data.config.plugin??[]).slice();a&&e.entry?g[e.entry.index]=s:g.push(s),await i.updateConfig({plugin:g}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("plugins.toast.updated"):t.t("plugins.toast.added")}),l.close()},onError:s=>{T({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),S=s=>{s.preventDefault(),!m.isPending&&m.mutate()},x=(s,g,c)=>{d("options",s,g,c)},w=()=>{d("options",Pe(s=>s.push(De())))},h=s=>{d("options",Pe(g=>{g.splice(s,1),g.length===0&&g.push(De())}))};return r(ve,{get title(){return a?t.t("plugins.editor.title.edit"):t.t("plugins.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=si(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=C.firstChild,$=y.nextSibling,v=C.nextSibling,z=g.nextSibling;return s.addEventListener("submit",S),n(g,r(R,{autofocus:!0,get label(){return t.t("plugins.editor.specifier")},get description(){return t.t("plugins.editor.specifier.description")},placeholder:"@my-org/my-plugin",get value(){return o.specifier},onChange:j=>ae(()=>{d("specifier",j),d("errors","specifier",void 0)}),get error(){return o.errors.specifier},spellcheck:!1,class:"font-mono text-xs"}),c),n(y,()=>t.t("plugins.editor.options")),n($,()=>t.t("plugins.editor.options.description")),n(v,r(Z,{get each(){return o.options},children:(j,E)=>r(fi,{row:j,onKeyChange:I=>x(E(),"key",I),onValueChange:I=>x(E(),"value",I),onRemove:()=>h(E())})})),n(c,r(M,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",onClick:w,get children(){return t.t("plugins.editor.option.add")}}),null),n(z,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(z,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function fi(e){const t=N(),[i,u]=he(!1);let l;const a=L(()=>ci(e.row.key)),p=()=>a()&&!i()?"password":"text",o=()=>{l&&clearTimeout(l),u(!0),l=setTimeout(()=>u(!1),1500)},d=f=>{a()&&f.key==="Enter"&&(f.preventDefault(),o())};return(()=>{var f=li(),b=f.firstChild,m=b.nextSibling;return n(b,r(R,{variant:"ghost",get placeholder(){return t.t("plugins.editor.option.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),n(m,r(R,{variant:"ghost",get type(){return p()},get placeholder(){return t.t("plugins.editor.option.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:d,spellcheck:!1,class:"font-mono text-xs"})),n(f,r(F,{get when(){return a()},get children(){return r(X,{type:"button",variant:"ghost",size:"normal",get icon(){return i()?"eye":"shield"},get"aria-label"(){return t.t(i()?"plugins.editor.option.hide":"plugins.editor.option.reveal")},onPointerDown:()=>{l&&clearTimeout(l),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),n(f,r(X,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),f})()}var hi=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),vi=k("<div>"),bi=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),xi=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),wi=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div><div class="mt-1 text-11-regular text-text-weaker"></div></div><div class="flex shrink-0 items-center gap-2">'),ki=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"></div><div class="flex justify-end gap-2 pt-1">');function $i(e={}){const t=N(),i=ne(),u=Y(),l=()=>e.layout==="page",[a,p]=qe(async()=>(await i.client.global.secrets.list().catch(()=>null))?.data??[]),o=L(()=>(a()??[]).slice().sort((m,S)=>m.name.localeCompare(S.name))),d=te(()=>({mutationFn:async m=>{await i.client.global.secrets.remove({name:m}),await p.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("secrets.toast.removed")})},onError:m=>{T({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),f=m=>{u.show(()=>r(yi,{entry:m,onSaved:()=>void p.refetch()}))},b=m=>new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(m));return[(()=>{var m=vi();return n(m,r(F,{get when(){return!l()},get children(){var S=hi(),x=S.firstChild,w=x.nextSibling;return n(x,()=>t.t("secrets.page.title")),n(w,()=>t.t("secrets.page.note")),S}}),null),n(m,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>f(),get children(){return t.t("secrets.page.add")}}),null),Q(S=>H(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!l(),"justify-end":l()},S)),m})(),r(F,{get when(){return o().length>0},get fallback(){return(()=>{var m=xi();return n(m,()=>t.t("secrets.page.empty")),m})()},get children(){var m=bi();return n(m,r(Z,{get each(){return o()},children:S=>(()=>{var x=wi(),w=x.firstChild,h=w.firstChild,s=h.firstChild,g=s.firstChild,c=s.nextSibling,C=c.nextSibling,y=h.nextSibling;return n(s,r(le,{name:"shield",size:"small",class:"icon-strong-base shrink-0"}),g),n(g,()=>S.name),n(c,()=>S.placeholder),n(C,()=>b(S.updated_at)),n(y,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},onClick:()=>f(S)}),null),n(y,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},onClick:()=>{window.confirm(t.t("secrets.page.confirm.remove",{name:S.name}))&&d.mutate(S.name)}}),null),x})()})),m}})]}function yi(e){const t=N(),i=ne(),u=Y(),l=!!e.entry,[a,p]=pe({name:e.entry?.name??"",value:"",errors:{}}),o=()=>{const b={};return a.name.trim()||(b.name=t.t("secrets.editor.name.error")),a.value.trim()||(b.value=t.t("secrets.editor.value.error")),p("errors",b),Object.keys(b).length===0},d=te(()=>({mutationFn:async()=>{o()&&(await i.client.global.secrets.set({name:a.name.trim(),value:a.value}),e.onSaved?.(),u.close())},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("secrets.toast.saved")})},onError:b=>{T({variant:"error",title:t.t("common.requestFailed"),description:b instanceof Error?b.message:String(b)})}})),f=b=>{b.preventDefault(),!d.isPending&&d.mutate()};return r(ve,{get title(){return t.t(l?"secrets.editor.title.edit":"secrets.editor.title.add")},class:"w-full max-w-[520px] mx-auto",fit:!0,get children(){var b=ki(),m=b.firstChild,S=m.nextSibling;return b.addEventListener("submit",f),n(m,r(R,{autofocus:!l,get label(){return t.t("secrets.editor.name")},placeholder:"github",get value(){return a.name},onChange:x=>ae(()=>{p("name",x),p("errors","name",void 0)}),get error(){return a.errors.name},disabled:l,spellcheck:!1,class:"font-mono text-xs"}),null),n(m,r(R,{autofocus:l,type:"password",get label(){return t.t("secrets.editor.value")},get value(){return a.value},onChange:x=>ae(()=>{p("value",x),p("errors","value",void 0)}),get error(){return a.errors.value},spellcheck:!1,class:"font-mono text-xs"}),null),n(S,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>u.close(),get children(){return t.t("common.cancel")}}),null),n(S,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return d.isPending},get children(){return A(()=>!!d.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),b}})}var _i=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Ci=k("<div>"),Ye=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Ze=k('<div class="flex flex-col gap-3"><div class="text-12-medium text-text-weak">'),Si=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-6 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),et=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Di=k('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),Ei=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Pi=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),zi=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-end gap-2"><div class="min-w-0 flex-1"></div></div></div><div class="flex justify-end gap-2 pt-1">'),ji=k("<button type=button>");const Ve=e=>e==="allow"||e==="ask"||e==="deny",ut=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(Ve),Be=e=>e?typeof e=="string"?{"*":e}:{...e}:{},tt=(e,t)=>new RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(t),Fi=e=>Object.entries(Be(e)).flatMap(([t,i])=>Ve(i)?[{permission:t,pattern:"*",action:i}]:ut(i)?Object.entries(i).map(([u,l])=>({permission:t,pattern:u,action:l})):[]),rt=(e,t)=>Fi(e).slice().reverse().find(i=>tt(i.permission,"skill")&&tt(i.pattern,t))?.action??"allow",Ii=e=>{const t=Be(e).skill;return Ve(t)?{"*":t}:ut(t)?{...t}:{}},gt=e=>({paths:e.paths,urls:e.urls});function Li(e={}){const t=N(),i=re(),u=ne(),l=Fe(),a=ct(),p=Y(),o=()=>e.layout==="page",[d,f]=qe(()=>u.client.app.skills().then(c=>c.data??[]).catch(()=>[])),b=L(()=>{const c=d();return Array.isArray(c)?c.slice().sort((C,y)=>C.name.localeCompare(y.name)):[]}),m=L(()=>[...(i.data.config.skills?.paths??[]).map((c,C)=>({kind:"path",index:C,value:c})),...(i.data.config.skills?.urls??[]).map((c,C)=>({kind:"url",index:C,value:c}))]),S=L(()=>b().filter(c=>rt(i.data.config.permission,c.name)!=="deny").length),x=L(()=>!!a.isLocal()&&!!l.openPath),w=te(()=>({mutationFn:async c=>{const C=Be(i.data.config.permission),y=Ii(C);delete y[c.name],y[c.name]=c.enabled?"allow":"deny",delete C.skill,C.skill=y,await i.updateConfig({permission:C}),await u.client.global.dispose().catch(()=>{}),f.refetch()},onError:c=>{T({variant:"error",title:t.t("common.requestFailed"),description:c instanceof Error?c.message:String(c)})}})),h=te(()=>({mutationFn:async c=>{const C=(i.data.config.skills?.paths??[]).slice(),y=(i.data.config.skills?.urls??[]).slice();c.kind==="path"&&C.splice(c.index,1),c.kind==="url"&&y.splice(c.index,1),await i.updateConfig({skills:gt({paths:C,urls:y})}),await u.client.global.dispose().catch(()=>{}),f.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("skills.toast.sourceRemoved")})},onError:c=>{T({variant:"error",title:t.t("common.requestFailed"),description:c instanceof Error?c.message:String(c)})}})),s=c=>{p.show(()=>r(Ri,{entry:c,onSaved:()=>void f.refetch()}))},g=c=>{!l.openPath||!x()||l.openPath(c.location)};return[(()=>{var c=Ci();return n(c,r(F,{get when(){return!o()},get children(){var C=_i(),y=C.firstChild,$=y.nextSibling;return n(y,()=>t.t("skills.page.title")),n($,()=>t.t("skills.page.subtitle",{enabled:S(),total:b().length,sources:m().length})),C}}),null),n(c,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>s(),get children(){return t.t("skills.page.addSource")}}),null),Q(C=>H(c,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},C)),c})(),(()=>{var c=Ze(),C=c.firstChild;return n(C,()=>t.t("skills.section.sources")),n(c,r(F,{get when(){return m().length>0},get fallback(){return(()=>{var y=Si();return n(y,()=>t.t("skills.sources.empty")),y})()},get children(){var y=Ye();return n(y,r(Z,{get each(){return m()},children:$=>r(Oi,{source:$,onEdit:()=>s($),onRemove:()=>{window.confirm(t.t("skills.sources.confirm.remove",{source:$.value}))&&h.mutate($)}})})),y}}),null),c})(),(()=>{var c=Ze(),C=c.firstChild;return n(C,()=>t.t("skills.section.available")),n(c,r(F,{get when(){return!d.loading},get fallback(){return(()=>{var y=et();return n(y,()=>t.t("common.loading")),y})()},get children(){return r(F,{get when(){return b().length>0},get fallback(){return(()=>{var y=et();return n(y,()=>t.t("skills.page.empty")),y})()},get children(){var y=Ye();return n(y,r(Z,{get each(){return b()},children:$=>r(Mi,{skill:$,enabled:()=>rt(i.data.config.permission,$.name)!=="deny",toggling:()=>w.isPending&&w.variables?.name===$.name,canOpen:x,onToggle:v=>w.mutate({name:$.name,enabled:v}),onOpen:()=>g($)})})),y}})}}),null),c})()]}function Mi(e){const t=N(),i=()=>e.skill.location.replace(/\\/g,"/"),u=()=>{const l=i();return l.includes("/.claude/skills/")?t.t("skills.kind.claude"):l.includes("/.agents/skills/")?t.t("skills.kind.agents"):l.includes("/.codeplane/")?t.t("skills.kind.codeplane"):t.t("skills.kind.local")};return(()=>{var l=Ei(),a=l.firstChild,p=a.firstChild,o=p.firstChild,d=o.firstChild,f=o.nextSibling,b=p.nextSibling;return n(o,r(le,{name:"checklist",size:"small",class:"icon-strong-base shrink-0"}),d),n(d,()=>e.skill.name),n(o,r(ie,{get children(){return u()}}),null),n(o,r(F,{get when(){return!e.enabled()},get children(){return r(ie,{get children(){return t.t("skills.tag.disabled")}})}}),null),n(p,r(F,{get when(){return e.skill.description},get children(){var m=Di();return n(m,()=>e.skill.description),m}}),f),n(f,()=>e.skill.location),n(b,r(q,{get checked(){return e.enabled()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("skills.row.openFile")},get disabled(){return!e.canOpen()},get onClick(){return e.onOpen}}),null),l})()}function Oi(e){const t=N(),i=()=>e.source.kind==="path"?t.t("skills.source.path"):t.t("skills.source.url");return(()=>{var u=Pi(),l=u.firstChild,a=l.firstChild,p=a.firstChild,o=p.firstChild,d=a.nextSibling;return n(p,r(le,{get name(){return e.source.kind==="path"?"folder":"link"},size:"small",class:"icon-strong-base shrink-0"}),o),n(o,()=>e.source.value),n(p,r(ie,{get children(){return i()}}),null),n(d,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(d,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),u})()}function Ri(e){const t=N(),i=re(),u=ne(),l=Fe(),a=ct(),p=Y(),o=!!e.entry,[d,f]=pe({kind:e.entry?.kind??"path",value:e.entry?.value??"",errors:{}}),b=()=>d.kind==="path"&&!!l.openDirectoryPickerDialog&&a.isLocal(),m=()=>{const h=d.value.trim(),s={};return h||(s.value=t.t("skills.editor.error.value")),d.kind==="url"&&h&&!/^https?:\/\//i.test(h)&&(s.value=t.t("skills.editor.error.url")),f("errors",s),Object.keys(s).length===0},S=te(()=>({mutationFn:async()=>{if(!m())return;const h=(i.data.config.skills?.paths??[]).slice(),s=(i.data.config.skills?.urls??[]).slice();e.entry?.kind==="path"&&h.splice(e.entry.index,1),e.entry?.kind==="url"&&s.splice(e.entry.index,1);const g=d.kind==="path"?h:s;if(g.includes(d.value.trim())){f("errors","value",t.t("skills.editor.error.duplicate"));return}e.entry&&e.entry.kind===d.kind?g.splice(e.entry.index,0,d.value.trim()):g.push(d.value.trim()),await i.updateConfig({skills:gt({paths:h,urls:s})}),await u.client.global.dispose().catch(()=>{}),e.onSaved(),T({variant:"success",icon:"circle-check",title:o?t.t("skills.toast.sourceUpdated"):t.t("skills.toast.sourceAdded")}),p.close()},onError:h=>{T({variant:"error",title:t.t("common.requestFailed"),description:h instanceof Error?h.message:String(h)})}})),x=()=>{!b()||!l.openDirectoryPickerDialog||l.openDirectoryPickerDialog({title:t.t("skills.editor.browse.title")}).then(h=>{h&&f("value",Array.isArray(h)?h[0]??"":h)})},w=h=>{h.preventDefault(),!S.isPending&&S.mutate()};return r(ve,{get title(){return o?t.t("skills.editor.title.edit"):t.t("skills.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var h=zi(),s=h.firstChild,g=s.firstChild,c=g.firstChild,C=c.nextSibling,y=g.nextSibling,$=y.firstChild,v=s.nextSibling;return h.addEventListener("submit",w),n(c,()=>t.t("skills.editor.type")),n(C,r(nt,{get active(){return d.kind==="path"},get label(){return t.t("skills.source.path")},onClick:()=>f("kind","path")}),null),n(C,r(nt,{get active(){return d.kind==="url"},get label(){return t.t("skills.source.url")},onClick:()=>f("kind","url")}),null),n($,r(R,{autofocus:!0,get label(){return A(()=>d.kind==="path")()?t.t("skills.editor.path"):t.t("skills.editor.url")},get description(){return A(()=>d.kind==="path")()?t.t("skills.editor.path.description"):t.t("skills.editor.url.description")},get placeholder(){return d.kind==="path"?"~/.codeplane/skills":"https://example.com/.well-known/skills/"},get value(){return d.value},onChange:z=>ae(()=>{f("value",z),f("errors","value",void 0)}),get error(){return d.errors.value},spellcheck:!1,class:"font-mono text-xs"})),n(y,r(F,{get when(){return b()},get children(){return r(M,{type:"button",variant:"secondary",size:"large",icon:"folder",onClick:x,get children(){return t.t("skills.editor.browse")}})}}),null),n(v,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>p.close(),get children(){return t.t("common.cancel")}}),null),n(v,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return S.isPending},get children(){return A(()=>!!S.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),h}})}function nt(e){return(()=>{var t=ji();return at(t,"click",e.onClick,!0),n(t,()=>e.label),Q(i=>H(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},i)),t})()}je(["click"]);var Ui=k('<div class=size-full><div><div class="shrink-0 flex items-center justify-between gap-4 border-b border-border-weak-base pb-4"><div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Ti=k('<div class="h-full min-h-[240px]">');const Ai={general:{component:kr},shortcuts:{component:Kr},providers:{component:an},modes:{component:bn},models:{component:Qn},mcp:{component:Ln},secrets:{component:$i},plugins:{component:gi},skills:{component:Li}};function Bi(){const e=N(),t=Rt(),i=lt(),u=L(()=>At(t.tab)),l=L(()=>Kt(u())),a=L(()=>Ai[u()]),p=L(()=>a().component);return Ut(()=>{t.tab&&t.tab!==u()&&i(Tt(u()),{replace:!0})}),(()=>{var o=Ui(),d=o.firstChild,f=d.firstChild,b=f.firstChild,m=b.firstChild,S=m.nextSibling;return n(m,()=>e.t(l().titleKey)),n(S,()=>e.t(l().descriptionKey)),n(d,r(qt,{get fallback(){return Ti()},get children(){return r(Nt,{get component(){return p()},layout:"page"})}}),null),Q(x=>{var w=!!a().contentScroll,h=!a().contentScroll,s={"mx-auto flex w-full max-w-3xl flex-col gap-6 px-6 py-8":!0,"h-full min-h-0":a().contentScroll,"min-h-full":!a().contentScroll};return w!==x.e&&o.classList.toggle("overflow-hidden",x.e=w),h!==x.t&&o.classList.toggle("overflow-y-auto",x.t=h),x.a=H(d,s,x.a),x},{e:void 0,t:void 0,a:void 0}),o})()}export{Bi as default};
|
|
1
|
+
import{l as n,y as k,Q as je,aF as vt,f as N,aG as bt,C as re,aH as it,aI as xt,e as Fe,b as Y,E as he,J as Ne,j as L,m as r,q as F,N as Q,O as H,aJ as be,a3 as q,p as A,B as M,T as R,aK as wt,aL as kt,aM as $t,aN as yt,aO as _t,aP as Ct,X as Le,z as T,aQ as St,aR as Dt,aS as Et,aT as Pt,t as le,v as ve,aU as zt,al as jt,h as pe,o as Ft,L as Z,V as It,aV as Lt,aE as Mt,ao as Ot,I as X,R as ne,a7 as st,aa as Ee,a8 as ie,i as te,aq as ae,u as lt,w as qe,aW as at,aj as Pe,aX as ot,c as ct,a4 as Rt,k as Ut,aY as Tt,aZ as At,a_ as Kt,a$ as Nt,b0 as qt}from"./index-CaPWFEmi.js";import{f as Wt}from"./list-BiQMzfJm.js";import{P as ye}from"./provider-icon-mQ6o_ygz.js";import{D as Vt}from"./dialog-connect-provider-CbBxytwI.js";import{a as Bt,D as Gt}from"./dialog-select-provider-C-JEreLC.js";function ze(e){return e.granted||e.restartRequired===!0}function se(e){return!ze(e)||e.restartRequired?!1:e.active!==!1}function Ce(e){return ze(e)&&!se(e)}var Ht=k('<div class="bg-surface-base px-4 rounded-lg">');const oe=e=>(()=>{var t=Ht();return n(t,()=>e.children),t})();var Jt=k("<div data-action=settings-auto-accept-permissions>"),Qt=k("<div data-action=settings-codeplane-coauthor>"),Xt=k("<div data-action=settings-feed-reasoning-summaries>"),Yt=k("<div data-action=settings-feed-shell-tool-parts-expanded>"),Zt=k("<div data-action=settings-feed-edit-tool-parts-expanded>"),er=k("<div data-action=settings-show-session-progress-bar>"),tr=k("<div data-action=settings-browser-use>"),rr=k("<div data-action=settings-computer-use>"),nr=k("<div data-action=settings-debug-logging>"),ir=k('<div class="flex flex-col gap-1">'),sr=k('<span class="mt-1.5 inline-flex items-center gap-2 align-middle"><button type=button class="text-11-medium text-text-weak hover:text-text-strong underline-offset-2 hover:underline cursor-pointer"data-action=settings-computer-use-manage>'),lr=k("<div data-action=settings-show-file-tree>"),ar=k("<div data-action=settings-show-navigation>"),or=k("<div data-action=settings-show-search>"),cr=k("<div data-action=settings-show-terminal>"),dr=k("<div data-action=settings-show-status>"),$e=k('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Me=k('<div class="w-full sm:w-[220px]">'),ur=k("<div data-action=settings-notifications-agent>"),gr=k("<div data-action=settings-notifications-permissions>"),mr=k("<div data-action=settings-notifications-errors>"),pr=k('<div data-action=settings-check-update class="flex gap-2 items-center">'),fr=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8"><h2 class="text-16-medium text-text-strong">'),hr=k('<div><div class="flex flex-col gap-8 w-full">'),vr=k('<div class="flex w-full flex-col gap-5 px-5 pb-5"><p class="text-14-regular text-text-base leading-relaxed"></p><div class="flex items-center justify-between gap-3"><span></span></div><div class="flex flex-col gap-3"></div><div class="flex items-start gap-2 rounded-lg border border-border-warning-base bg-surface-warning-weak/40 px-3 py-2.5"><p class="text-12-regular text-text-base leading-relaxed"></p></div><div class="flex flex-col-reverse gap-2 border-t border-border-weak-base pt-3 sm:flex-row sm:items-center sm:justify-between"><div class="flex flex-col-reverse gap-2 sm:flex-row sm:items-center">'),br=k('<div class="sm:shrink-0 sm:pt-0.5">'),xr=k('<div><div class="flex min-w-0 flex-1 flex-col gap-1.5"><div class="flex items-center gap-2"><span class="text-14-medium text-text-strong"></span><span></span></div><span class="text-12-regular text-text-weak leading-relaxed">'),wr=k('<div class="flex flex-wrap items-center gap-4 py-3 border-b border-border-weak-base last:border-none sm:flex-nowrap"><div class="flex min-w-0 flex-1 flex-col gap-0.5"><span class="text-14-medium text-text-strong"></span><span class="text-12-regular text-text-weak"></span></div><div class="flex w-full justify-end sm:w-auto sm:shrink-0">');let me={cleanup:void 0,timeout:void 0,run:0};const dt=()=>{me.run+=1,me.cleanup&&me.cleanup(),clearTimeout(me.timeout),me.cleanup=void 0},Ge=e=>{if(dt(),!e)return;const t=++me.run;me.timeout=setTimeout(()=>{zt(e).then(i=>{if(me.run!==t){i?.();return}me.cleanup=i})},100)},kr=e=>{const t=vt(),i=N(),u=bt(),l=re(),a=it(),p=xt(),o=Fe(),d=Y(),[f,b]=he(!1),m=async()=>{b(!0);try{return await p.recheck(!1)}finally{b(!1)}},S=()=>p.status();Ne(()=>{m(),(l.data.config.tools?.browser===void 0||l.data.config.tools?.computer===void 0)&&l.updateConfig({tools:{...l.data.config.tools,browser:l.data.config.tools?.browser??a.general.browserUse(),computer:l.data.config.tools?.computer??a.general.computerUse()}})});const x=L(()=>u.isGlobalAutoAccept()),w=P=>u.setGlobalAutoAccept(P),h=L(()=>l.data.config.commit?.coauthor===!0),s=P=>l.updateConfig({commit:{coauthor:P}}),g=L(()=>l.data.config.tools?.browser??a.general.browserUse()),c=L(()=>l.data.config.tools?.computer??a.general.computerUse()),C=L(()=>{const P=o.serverManager;if(!P)return;const D=P.currentKey??P.defaultKey??P.instances[0]?.key;return P.instances.find(_=>_.key===D)}),[y,$]=he(!1),v=P=>{d.show(()=>r(He,{tool:P}))},z=(P,D)=>{if(P==="browser"){a.general.setBrowserUse(D),l.updateConfig({tools:{browser:D}});return}if(!D){a.general.setComputerUse(!1),l.updateConfig({tools:{computer:!1}});return}(async()=>{if(!o.systemPermissions){a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}});return}if((await o.systemPermissions.check()).permissions.filter(G=>!se(G)).length===0){a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}});return}d.show(()=>r(He,{tool:"computer",onConfirmEnable:()=>{a.general.setComputerUse(!0),l.updateConfig({tools:{computer:!0}})}}))})()},j=()=>{const P=C();!P?.local||!o.serverManager||($(!0),o.serverManager.openLogDir(P.id).then(D=>{if(!D)throw new Error(i.t("settings.general.row.instanceLogs.unavailable"))}).catch(D=>{T({variant:"error",title:i.t("common.requestFailed"),description:D instanceof Error?D.message:String(D)})}).finally(()=>$(!1)))},E=L(()=>[{value:"system",label:i.t("theme.scheme.system")},{value:"light",label:i.t("theme.scheme.light")},{value:"dark",label:i.t("theme.scheme.dark")}]),I=L(()=>i.locales.map(P=>({value:P,label:i.label(P)}))),V=L(()=>[{value:"queue",label:i.t("settings.general.row.followup.option.queue")},{value:"steer",label:i.t("settings.general.row.followup.option.steer")}]),W=L(()=>[{value:"short",label:"Short"},{value:"full",label:"Full"},{value:"off",label:"Off"}]),J={id:"none",label:"sound.option.none"},O=[J,...Pt],ce=()=>Dt(a.appearance.font()),B=()=>St(a.appearance.uiFont()),de=()=>Et(a.appearance.terminalFont()),ue=()=>e.layout==="page",ge=(P,D,_,U)=>({options:O,current:P()?O.find(G=>G.id===D())??J:J,value:G=>G.id,label:G=>i.t(G.label),onHighlight:G=>{G&&Ge(G.id==="none"?void 0:G.id)},onSelect:G=>{if(G){if(G.id==="none"){_(!1),dt();return}_(!0),U(G.id),Ge(G.id)}},variant:"secondary",size:"small",triggerVariant:"settings"}),we=()=>(()=>{var P=ir();return n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.language.title")},get description(){return i.t("settings.general.row.language.description")},get children(){return r(be,{"data-action":"settings-language",get options(){return I()},get current(){return I().find(D=>D.value===i.locale())},value:D=>D.value,label:D=>D.label,onSelect:D=>D&&i.setLocale(D.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(K,{get title(){return i.t("command.permissions.autoaccept.enable")},get description(){return i.t("toast.permissions.autoaccept.on.description")},get children(){var D=Jt();return n(D,r(q,{get checked(){return x()},onChange:w})),D}}),r(K,{get title(){return i.t("settings.general.row.followup.title")},get description(){return i.t("settings.general.row.followup.description")},get children(){return r(be,{"data-action":"settings-followup-behavior",get options(){return V()},get current(){return V().find(D=>D.value===a.general.followup())},value:D=>D.value,label:D=>D.label,onSelect:D=>D&&a.general.setFollowup(D.value),variant:"secondary",size:"small",triggerVariant:"settings"})}}),r(K,{get title(){return i.t("settings.general.row.codeplaneCoauthor.title")},get description(){return i.t("settings.general.row.codeplaneCoauthor.description")},get children(){var D=Qt();return n(D,r(q,{get checked(){return h()},onChange:_=>void s(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.reasoningSummaries.title")},get description(){return i.t("settings.general.row.reasoningSummaries.description")},get children(){var D=Xt();return n(D,r(be,{get options(){return W()},get current(){return W().find(_=>_.value===a.general.reasoningDisplay())},value:_=>_.value,label:_=>_.label,onSelect:_=>_&&a.general.setReasoningDisplay(_.value),variant:"secondary",size:"small",triggerVariant:"settings"})),D}}),r(K,{get title(){return i.t("settings.general.row.shellToolPartsExpanded.title")},get description(){return i.t("settings.general.row.shellToolPartsExpanded.description")},get children(){var D=Yt();return n(D,r(q,{get checked(){return a.general.shellToolPartsExpanded()},onChange:_=>a.general.setShellToolPartsExpanded(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.editToolPartsExpanded.title")},get description(){return i.t("settings.general.row.editToolPartsExpanded.description")},get children(){var D=Zt();return n(D,r(q,{get checked(){return a.general.editToolPartsExpanded()},onChange:_=>a.general.setEditToolPartsExpanded(_)})),D}}),r(K,{get title(){return i.t("settings.general.row.showSessionProgressBar.title")},get description(){return i.t("settings.general.row.showSessionProgressBar.description")},get children(){var D=er();return n(D,r(q,{get checked(){return a.general.showSessionProgressBar()},onChange:_=>a.general.setShowSessionProgressBar(_)})),D}}),r(F,{get when(){return p.hasDesktopBridge()},get children(){return[r(K,{get title(){return i.t("settings.general.row.browserUse.title")},get description(){return i.t("settings.general.row.browserUse.description")},get children(){var D=tr();return n(D,r(q,{get checked(){return g()},onChange:_=>z("browser",_)})),D}}),r(K,{get title(){return i.t("settings.general.row.computerUse.title")},get description(){return[A(()=>i.t("settings.general.row.computerUse.description")),r(F,{get when(){return o.systemPermissions},get children(){var D=sr(),_=D.firstChild;return _.$$click=U=>{U.preventDefault(),v("computer")},n(_,()=>i.t("settings.general.row.computerUse.manage")),D}})]},get children(){var D=rr();return n(D,r(q,{get checked(){return c()},onChange:_=>z("computer",_)})),D}}),r(K,{get title(){return i.t("settings.general.row.debugLogging.title")},get description(){return i.t("settings.general.row.debugLogging.description")},get children(){var D=nr();return n(D,r(q,{get checked(){return a.general.debugLogging()},onChange:_=>a.general.setDebugLogging(_)})),D}}),r(F,{get when(){return C()?.local},get children(){return r(K,{get title(){return i.t("settings.general.row.instanceLogs.title")},get description(){return i.t("settings.general.row.instanceLogs.description")},get children(){return r(M,{type:"button",size:"small",variant:"secondary",icon:"folder","data-action":"settings-open-instance-logs",onClick:D=>{D.preventDefault(),j()},get disabled(){return y()},get children(){return A(()=>!!y())()?i.t("settings.general.row.instanceLogs.action.opening"):i.t("settings.general.row.instanceLogs.action.open")}})}})}})]}})]}})),P})(),ee=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.advanced")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.showFileTree.title")},get description(){return i.t("settings.general.row.showFileTree.description")},get children(){var _=lr();return n(_,r(q,{get checked(){return a.general.showFileTree()},onChange:U=>a.general.setShowFileTree(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showNavigation.title")},get description(){return i.t("settings.general.row.showNavigation.description")},get children(){var _=ar();return n(_,r(q,{get checked(){return a.general.showNavigation()},onChange:U=>a.general.setShowNavigation(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showSearch.title")},get description(){return i.t("settings.general.row.showSearch.description")},get children(){var _=or();return n(_,r(q,{get checked(){return a.general.showSearch()},onChange:U=>a.general.setShowSearch(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showTerminal.title")},get description(){return i.t("settings.general.row.showTerminal.description")},get children(){var _=cr();return n(_,r(q,{get checked(){return a.general.showTerminal()},onChange:U=>a.general.setShowTerminal(U)})),_}}),r(K,{get title(){return i.t("settings.general.row.showStatus.title")},get description(){return i.t("settings.general.row.showStatus.description")},get children(){var _=dr();return n(_,r(q,{get checked(){return a.general.showStatus()},onChange:U=>a.general.setShowStatus(U)})),_}})]}}),null),P})(),ke=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.appearance")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.row.colorScheme.title")},get description(){return i.t("settings.general.row.colorScheme.description")},get children(){return r(be,{"data-action":"settings-color-scheme",get options(){return E()},get current(){return E().find(_=>_.value===t.colorScheme())},value:_=>_.value,label:_=>_.label,onSelect:_=>_&&t.setColorScheme(_.value),onHighlight:_=>{if(_)return t.previewColorScheme(_.value),()=>t.cancelPreview()},variant:"secondary",size:"small",triggerVariant:"settings",triggerStyle:{"min-width":"220px"}})}}),r(K,{get title(){return i.t("settings.general.row.uiFont.title")},get description(){return i.t("settings.general.row.uiFont.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-ui-font",get label(){return i.t("settings.general.row.uiFont.title")},hideLabel:!0,type:"text",get value(){return B()},onChange:U=>a.appearance.setUIFont(U),placeholder:wt,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":kt(a.appearance.uiFont())}}})),_}}),r(K,{get title(){return i.t("settings.general.row.font.title")},get description(){return i.t("settings.general.row.font.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-code-font",get label(){return i.t("settings.general.row.font.title")},hideLabel:!0,type:"text",get value(){return ce()},onChange:U=>a.appearance.setFont(U),placeholder:$t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":yt(a.appearance.font())}}})),_}}),r(K,{get title(){return i.t("settings.general.row.terminalFont.title")},get description(){return i.t("settings.general.row.terminalFont.description")},get children(){var _=Me();return n(_,r(R,{"data-action":"settings-terminal-font",get label(){return i.t("settings.general.row.terminalFont.title")},hideLabel:!0,type:"text",get value(){return de()},onChange:U=>a.appearance.setTerminalFont(U),placeholder:_t,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"text-12-regular",get style(){return{"font-family":Ct(a.appearance.terminalFont())}}})),_}})]}}),null),P})(),Ie=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.notifications")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.notifications.agent.title")},get description(){return i.t("settings.general.notifications.agent.description")},get children(){var _=ur();return n(_,r(q,{get checked(){return a.notifications.agent()},onChange:U=>a.notifications.setAgent(U)})),_}}),r(K,{get title(){return i.t("settings.general.notifications.permissions.title")},get description(){return i.t("settings.general.notifications.permissions.description")},get children(){var _=gr();return n(_,r(q,{get checked(){return a.notifications.permissions()},onChange:U=>a.notifications.setPermissions(U)})),_}}),r(K,{get title(){return i.t("settings.general.notifications.errors.title")},get description(){return i.t("settings.general.notifications.errors.description")},get children(){var _=mr();return n(_,r(q,{get checked(){return a.notifications.errors()},onChange:U=>a.notifications.setErrors(U)})),_}})]}}),null),P})(),mt=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.sounds")),n(P,r(oe,{get children(){return[r(K,{get title(){return i.t("settings.general.sounds.agent.title")},get description(){return i.t("settings.general.sounds.agent.description")},get children(){return r(be,Le({"data-action":"settings-sounds-agent"},()=>ge(()=>a.sounds.agentEnabled(),()=>a.sounds.agent(),_=>a.sounds.setAgentEnabled(_),_=>a.sounds.setAgent(_))))}}),r(K,{get title(){return i.t("settings.general.sounds.permissions.title")},get description(){return i.t("settings.general.sounds.permissions.description")},get children(){return r(be,Le({"data-action":"settings-sounds-permissions"},()=>ge(()=>a.sounds.permissionsEnabled(),()=>a.sounds.permissions(),_=>a.sounds.setPermissionsEnabled(_),_=>a.sounds.setPermissions(_))))}}),r(K,{get title(){return i.t("settings.general.sounds.errors.title")},get description(){return i.t("settings.general.sounds.errors.description")},get children(){return r(be,Le({"data-action":"settings-sounds-errors"},()=>ge(()=>a.sounds.errorsEnabled(),()=>a.sounds.errors(),_=>a.sounds.setErrorsEnabled(_),_=>a.sounds.setErrors(_))))}})]}}),null),P})(),pt=()=>{const P=S();if(!P&&f()||!P)return i.t("settings.general.row.version.descriptionLoading");const D=P.current==="local"||P.current==="dev"?i.t("settings.general.row.version.developmentBuild"):P.current;return P.method==="desktop"&&!p.hasDesktopBridge()?i.t("settings.general.row.version.descriptionDesktopManaged",{current:D}):P.method==="managed-local"?i.t("settings.general.row.version.descriptionManagedLocal",{current:D}):P.method==="unknown"?i.t("settings.general.row.version.descriptionUnknownMethod",{current:D}):P.hasUpdate&&P.latest?i.t("settings.general.row.version.descriptionHasUpdate",{current:D,latest:P.latest}):i.t("settings.general.row.version.descriptionUpToDate",{current:D})},ft=()=>{const P=S();return!(!P?.hasUpdate||!P.latest||P.method==="unknown"||P.method==="managed-local"||P.method==="desktop"&&!p.hasDesktopBridge())},ht=()=>(()=>{var P=$e(),D=P.firstChild;return n(D,()=>i.t("settings.general.section.updates")),n(P,r(oe,{get children(){return r(K,{get title(){return i.t("settings.general.row.version.title")},get description(){return pt()},get children(){var _=pr();return n(_,r(F,{get when(){return A(()=>!!S()?.current)()&&/^\d+\.\d+\.\d+/.test(S().current)},get children(){return r(M,{type:"button",size:"small",variant:"ghost",onClick:U=>{U.preventDefault(),p.openWhatsNew(S()?.current)},get disabled(){return p.isUpgrading()},get children(){return i.t("settings.general.row.version.action.whatsNew")}})}}),null),n(_,r(F,{get when(){return ft()},get fallback(){return r(M,{type:"button",size:"small",variant:"secondary",onClick:U=>{U.preventDefault(),m()},get disabled(){return f()||p.isUpgrading()},get children(){return A(()=>!!f())()?i.t("settings.general.row.version.action.checking"):i.t("settings.general.row.version.action.check")}})},get children(){return r(M,{type:"button",size:"small",variant:"primary",icon:"download",onClick:async U=>{U.preventDefault(),await p.startUpgrade(S()?.latest??void 0),await m()},get disabled(){return p.isUpgrading()},get children(){return A(()=>!!p.isUpgrading())()?i.t("settings.general.row.version.action.updating"):i.t("settings.general.row.version.action.update")}})}}),null),_}})}}),null),P})();return(()=>{var P=hr(),D=P.firstChild;return n(P,r(F,{get when(){return!ue()},get children(){var _=fr(),U=_.firstChild,G=U.firstChild;return n(G,()=>i.t("settings.tab.general")),_}}),D),n(D,r(we,{}),null),n(D,r(ke,{}),null),n(D,r(Ie,{}),null),n(D,r(mt,{}),null),n(D,r(ht,{}),null),n(D,r(F,{get when(){return!1},get children(){return r(ee,{})}}),null),Q(_=>H(P,{"flex flex-col":!0,"w-full":ue(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!ue()},_)),P})()};function $r(e){switch(e){case"accessibility":return"settings.general.row.computerUse.permissionDescription.accessibility";case"screen-recording":return"settings.general.row.computerUse.permissionDescription.screenRecording";default:return"settings.general.row.computerUse.permissionDescription.generic"}}function He(e){const t=N(),i=Fe(),u=Y(),[l,a]=he(null),[p,o]=he(!1),[d,f]=he([]),[b,m]=he(!1),S=async()=>{const $=await i.systemPermissions?.check();$&&f($.permissions)};Ne(()=>{S();const $=setInterval(()=>void S(),2e3),v=()=>void S();return window.addEventListener("focus",v),()=>{clearInterval($),window.removeEventListener("focus",v)}});const x=()=>{e.onClose?.(),u.close()},w=async $=>{a($);try{await i.systemPermissions?.request($)}finally{a(null)}},h=async()=>{o(!0);try{await S()}finally{setTimeout(()=>o(!1),250)}},s=async()=>{m(!0);try{(await i.relaunchShell?.()??!1)||T({variant:"default",title:t.t("settings.general.row.computerUse.relaunchUnavailable.title"),description:t.t("settings.general.row.computerUse.relaunchUnavailable.description")})}finally{m(!1)}},g=()=>e.tool==="browser"?t.t("settings.general.row.browserUse.title"):t.t("settings.general.row.computerUse.title"),c=L(()=>d().length>0&&d().every(se)),C=L(()=>d().some(Ce)),y=L(()=>d().filter(se).length);return r(ve,{get title(){return t.t("settings.general.row.computerUse.permissionsTitle",{tool:g()})},fit:!0,class:"w-[calc(100vw-2rem)] max-w-[40rem]",transition:!0,get children(){var $=vr(),v=$.firstChild,z=v.nextSibling,j=z.firstChild,E=z.nextSibling,I=E.nextSibling,V=I.firstChild,W=I.nextSibling,J=W.firstChild;return n(v,()=>t.t("settings.general.row.computerUse.permissionsBody",{tool:g(),count:String(d().length)})),n(j,r(le,{get name(){return A(()=>!!c())()?"circle-check":C()?"reset":"circle-ban-sign"},class:"h-3.5 w-3.5"}),null),n(j,(()=>{var O=A(()=>!!c());return()=>O()?t.t("settings.general.row.computerUse.statusAllGranted"):A(()=>!!C())()?t.t("settings.general.row.computerUse.statusRelaunchRequired"):t.t("settings.general.row.computerUse.statusActivePartial",{active:String(y()),total:String(d().length)})})(),null),n(z,r(M,{size:"small",variant:"ghost",get disabled(){return p()},onClick:O=>{O.preventDefault(),h()},get children(){return A(()=>!!p())()?t.t("settings.general.row.computerUse.recheckLoading"):t.t("settings.general.row.computerUse.recheck")}}),null),n(E,()=>d().map(O=>(()=>{var ce=xr(),B=ce.firstChild,de=B.firstChild,ue=de.firstChild,ge=ue.nextSibling,we=de.nextSibling;return n(de,r(le,{get name(){return A(()=>!!se(O))()?"circle-check":Ce(O)?"reset":"circle-ban-sign"},get classList(){return{"h-4 w-4 shrink-0":!0,"text-text-on-success-strong":se(O),"text-text-on-warning-strong":!se(O)}}}),ue),n(ue,()=>O.label),n(ge,(()=>{var ee=A(()=>!!se(O));return()=>ee()?t.t("settings.general.row.computerUse.permissionGranted"):A(()=>!!Ce(O))()?t.t("settings.general.row.computerUse.permissionRelaunchRequired"):t.t("settings.general.row.computerUse.permissionMissing")})()),n(we,()=>t.t($r(O.key))),n(ce,r(F,{get when(){return!ze(O)},get children(){var ee=br();return n(ee,r(M,{size:"small",variant:"secondary",get disabled(){return l()===O.key},onClick:ke=>{ke.preventDefault(),w(O.key)},get children(){return A(()=>l()===O.key)()?t.t("settings.general.row.computerUse.permissionOpening"):t.t("settings.general.row.computerUse.permissionOpenSettings")}})),ee}}),null),Q(ee=>{var ke={"flex flex-col gap-3 rounded-lg border px-4 py-4 sm:flex-row sm:items-start sm:justify-between":!0,"border-border-success-base bg-surface-success-weak/40":se(O),"border-border-warning-base bg-surface-warning-weak/40":Ce(O),"border-border-weak-base":!ze(O)},Ie={"rounded-full px-1.5 py-0.5 text-11-medium":!0,"bg-surface-success-weak text-text-on-success-strong":se(O),"bg-surface-warning-weak text-text-on-warning-strong":!se(O)};return ee.e=H(ce,ke,ee.e),ee.t=H(ge,Ie,ee.t),ee},{e:void 0,t:void 0}),ce})())),n(I,r(le,{name:"circle-ban-sign",class:"h-4 w-4 shrink-0 text-text-on-warning-strong mt-0.5"}),V),n(V,()=>t.t(C()?"settings.general.row.computerUse.permissionsRelaunchFooter":"settings.general.row.computerUse.permissionsFooter")),n(W,r(M,{variant:"ghost",size:"normal",onClick:x,get children(){return t.t("settings.general.row.computerUse.permissionDone")}}),J),n(J,r(F,{get when(){return A(()=>!!e.onConfirmEnable)()&&!c()},get children(){return r(M,{variant:"ghost",size:"normal",onClick:O=>{O.preventDefault(),e.onConfirmEnable?.(),x()},get children(){return t.t("settings.general.row.computerUse.enableAnyway")}})}}),null),n(J,r(F,{get when(){return A(()=>!!i.relaunchShell)()&&!c()},get children(){return r(M,{get variant(){return e.onConfirmEnable?"ghost":"primary"},size:"normal",get disabled(){return b()},onClick:O=>{O.preventDefault(),s()},get children(){return A(()=>!!b())()?t.t("settings.general.row.computerUse.relaunchPending"):t.t("settings.general.row.computerUse.relaunch")}})}}),null),n(J,r(F,{get when(){return A(()=>!!c())()&&e.onConfirmEnable},get children(){return r(M,{variant:"primary",size:"normal",onClick:O=>{O.preventDefault(),e.onConfirmEnable?.(),x()},get children(){return t.t("settings.general.row.computerUse.enableNow")}})}}),null),Q(O=>H(j,{"inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-12-medium":!0,"bg-surface-success-weak text-text-on-success-strong":c(),"bg-surface-warning-weak text-text-on-warning-strong":!c()},O)),$}})}const K=e=>(()=>{var t=wr(),i=t.firstChild,u=i.firstChild,l=u.nextSibling,a=i.nextSibling;return n(u,()=>e.title),n(l,()=>e.description),n(a,()=>e.children),t})();je(["click"]);var yr=k('<h2 class="text-16-medium text-text-strong">'),_r=k('<div class="flex flex-col gap-4 max-w-[720px]"><div></div><div class="flex h-10 items-center gap-2 rounded-lg bg-surface-base px-3">'),Cr=k('<span class="text-14-regular text-text-strong mt-1">"<!>"'),Sr=k('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="text-14-regular text-text-weak">'),Dr=k('<div><div class="flex flex-col gap-8 max-w-[720px]">'),Er=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="pt-6 pb-6">'),Pr=k('<div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),zr=k('<div class="flex items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><span class="text-14-regular text-text-strong"></span><button type=button>');const Oe=typeof navigator=="object"&&/(Mac|iPod|iPhone|iPad)/.test(navigator.platform),xe="command.palette",jr="mod+shift+p",_e=["General","Session","Navigation","Model and agent","Terminal","Prompt"],Fr={General:"settings.shortcuts.group.general",Session:"settings.shortcuts.group.session",Navigation:"settings.shortcuts.group.navigation","Model and agent":"settings.shortcuts.group.modelAndAgent",Terminal:"settings.shortcuts.group.terminal",Prompt:"settings.shortcuts.group.prompt"};function Re(e){return e===xe?"General":e.startsWith("terminal.")?"Terminal":e.startsWith("model.")||e.startsWith("agent.")||e.startsWith("mcp.")?"Model and agent":e.startsWith("file.")||e.startsWith("fileTree.")?"Navigation":e.startsWith("prompt.")?"Prompt":e.startsWith("session.")||e.startsWith("message.")||e.startsWith("permissions.")||e.startsWith("steps.")||e.startsWith("review.")?"Session":"General"}function Ir(e){return e==="Shift"||e==="Control"||e==="Alt"||e==="Meta"}function Lr(e){return e===","?"comma":e==="+"?"plus":e===" "?"space":e.toLowerCase()}function Mr(e){if(Ir(e.key))return;const t=[];(Oe?e.metaKey:e.ctrlKey)&&t.push("mod"),Oe&&e.ctrlKey&&t.push("ctrl"),!Oe&&e.metaKey&&t.push("meta"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift");const u=Lr(e.key);if(u)return t.push(u),t.join("+")}function Ke(e){if(!e)return[];const t=[];for(const i of Lt(e)){const u=[];i.ctrl&&u.push("ctrl"),i.alt&&u.push("alt"),i.shift&&u.push("shift"),i.meta&&u.push("meta"),i.key&&u.push(i.key),u.length!==0&&t.push(u.join("+"))}return t}function Or(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function Rr(e,t,i){const u=new Map;u.set(xe,{title:i,group:"General"});for(const l of e.catalog)l.id.startsWith("suggested.")||u.set(l.id,{title:l.title,group:Re(l.id)});for(const l of e.options)l.id.startsWith("suggested.")||u.set(l.id,{title:l.title,group:Re(l.id)});for(const[l,a]of Object.entries(t))typeof a=="string"&&(u.has(l)||u.set(l,{title:l,group:Re(l)}));return u}function Ur(e){const t=new Map;for(const i of _e)t.set(i,[]);for(const[i,u]of e){const l=t.get(u.group);l&&l.push(i)}for(const i of _e){const u=t.get(i);u&&u.sort((l,a)=>(e.get(l)?.title??"").localeCompare(e.get(a)?.title??""))}return t}function Tr(e,t,i,u){const l=e.toLowerCase().trim();if(!l)return i;const a=new Map;for(const d of _e)a.set(d,[]);const p=Array.from(t.entries()).map(([d,f])=>({id:d,title:f.title,group:f.group,keybind:u(d)})),o=Wt.go(l,p,{keys:["title","keybind"],threshold:-1e4});for(const d of o){const f=a.get(d.obj.group);f&&f.push(d.obj.id)}return a}function Ar(e){Ne(()=>{Mt(document,"keydown",i=>{const u=e.active();if(!u)return;if(i.preventDefault(),i.stopPropagation(),i.stopImmediatePropagation(),i.key==="Escape"){e.stop();return}if((i.key==="Backspace"||i.key==="Delete")&&!i.ctrlKey&&!i.metaKey&&!i.altKey&&!i.shiftKey){e.set(u,"none"),e.stop();return}const a=Mr(i);if(!a)return;const p=new Map;for(const o of Ke(a))for(const d of e.used().get(o)??[])d.id!==u&&p.set(d.id,d.title);if(p.size>0){T({title:e.language.t("settings.shortcuts.conflict.title"),description:e.language.t("settings.shortcuts.conflict.description",{keybind:Ot(a,e.language.t),titles:[...p.values()].join(", ")})});return}e.set(u,a),e.stop()},{capture:!0})})}const Kr=e=>{const t=jt(),i=N(),u=it(),[l,a]=pe({active:null,filter:""}),p=()=>{l.active&&(a("active",null),t.keybinds(!0))},o=y=>{if(l.active===y){p();return}l.active&&p(),a("active",y),t.keybinds(!1)},d=L(()=>Or(u.current.keybinds)),f=L(()=>Object.values(d()).some(y=>typeof y=="string")),b=()=>{p(),u.keybinds.resetAll(),T({title:i.t("settings.shortcuts.reset.toast.title"),description:i.t("settings.shortcuts.reset.toast.description")})},m=L(()=>(i.locale(),Rr(t,d(),i.t("command.palette")))),S=y=>m().get(y)?.title??"",x=L(()=>Ur(m())),w=L(()=>Tr(l.filter,m(),x(),y=>t.keybind(y)||"")),h=L(()=>{for(const y of _e)if((w().get(y)??[]).length>0)return!0;return!1}),s=L(()=>{const y=new Map,$=(j,E)=>{const I=y.get(j);if(!I){y.set(j,[E]);return}I.push(E)},v=u.keybinds.get(xe)??jr;for(const j of Ke(v))$(j,{id:xe,title:S(xe)});const z=j=>{const E=u.keybinds.get(j);if(typeof E=="string")return E;const I=t.options.find(W=>W.id===j);return I?.keybind?I.keybind:t.catalog.find(W=>W.id===j)?.keybind};for(const j of m().keys())if(j!==xe)for(const E of Ke(z(j)))$(E,{id:j,title:S(j)});return y}),g=(y,$)=>u.keybinds.set(y,$),c=()=>e.layout==="page";Ar({active:()=>l.active,stop:p,set:g,used:s,language:i}),Ft(()=>{l.active&&t.keybinds(!0)});const C=()=>(()=>{var y=_r(),$=y.firstChild,v=$.nextSibling;return n($,r(F,{get when(){return!c()},get children(){var z=yr();return n(z,()=>i.t("settings.shortcuts.title")),z}}),null),n($,r(M,{size:"small",variant:"secondary",onClick:b,get disabled(){return!f()},get children(){return i.t("settings.shortcuts.reset.button")}}),null),n(v,r(le,{name:"magnifying-glass",class:"text-icon-weak-base flex-shrink-0"}),null),n(v,r(R,{variant:"ghost",type:"text",get value(){return l.filter},onChange:z=>a("filter",z),get placeholder(){return i.t("settings.shortcuts.search.placeholder")},spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",class:"flex-1"}),null),n(v,r(F,{get when(){return l.filter},get children(){return r(X,{icon:"circle-x",variant:"ghost",onClick:()=>a("filter","")})}}),null),Q(z=>H($,{"flex items-center gap-4":!0,"justify-end":c(),"justify-between":!c()},z)),y})();return(()=>{var y=Dr(),$=y.firstChild;return n(y,r(F,{get when(){return c()},get fallback(){return(()=>{var v=Er(),z=v.firstChild;return n(z,r(C,{})),v})()},get children(){return r(C,{})}}),$),n($,r(Z,{each:_e,children:v=>r(F,{get when(){return(w().get(v)??[]).length>0},get children(){var z=Pr(),j=z.firstChild;return n(j,()=>i.t(Fr[v])),n(z,r(oe,{get children(){return r(Z,{get each(){return w().get(v)??[]},children:E=>(()=>{var I=zr(),V=I.firstChild,W=V.nextSibling;return n(V,()=>S(E)),W.$$click=()=>o(E),It(W,"data-keybind-id",E),n(W,r(F,{get when(){return l.active===E},get fallback(){return t.keybind(E)||i.t("settings.shortcuts.unassigned")},get children(){return i.t("settings.shortcuts.pressKeys")}})),Q(J=>H(W,{"h-8 px-3 rounded-md text-12-regular":!0,"bg-surface-base text-text-subtle hover:bg-surface-raised-base-hover active:bg-surface-raised-base-active":l.active!==E,"border border-border-weak-base bg-surface-inset-base text-text-weak":l.active===E},J)),I})()})}}),null),z}})}),null),n($,r(F,{get when(){return A(()=>!!l.filter)()&&!h()},get children(){var v=Sr(),z=v.firstChild;return n(z,()=>i.t("settings.shortcuts.search.empty")),n(v,r(F,{get when(){return l.filter},get children(){var j=Cr(),E=j.firstChild,I=E.nextSibling;return I.nextSibling,n(j,()=>l.filter,I),j}}),null),v}}),null),Q(v=>H(y,{"flex flex-col":!0,"w-full gap-6":c(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!c()},v)),y})()};je(["click"]);function We(e){if(e.catalog&&Object.keys(e.catalog.models).length>0)return{models:e.catalog.models,providerCatalog:!0};const t=new Map(Object.values(e.provider.models).map(i=>[i.id,i]));return e.catalogs?.forEach(i=>{Object.values(i.models).forEach(u=>{t.has(u.id)||t.set(u.id,u)})}),{models:Object.fromEntries(t),providerCatalog:!1}}function Nr(e){const t=We(e),i=Object.keys(t.models),u=new Set(i);return e.config?.whitelist?.length?new Set(e.config.whitelist.filter(l=>u.has(l))):e.config?.blacklist?.length?new Set(i.filter(l=>!e.config?.blacklist?.includes(l))):t.providerCatalog?new Set(i):new Set(Object.keys(e.provider.models).filter(l=>u.has(l)))}function qr(e){const t=We(e),i=Nr(e);return Object.values(t.models).map(u=>({id:u.id,model:u,selected:i.has(u.id)})).sort((u,l)=>u.model.name.localeCompare(l.model.name)||u.id.localeCompare(l.id))}function Wr(e,t){const i=t.trim().toLowerCase();return i?e.filter(u=>u.id.toLowerCase().includes(i)||u.model.name.toLowerCase().includes(i)):e}function Vr(e){const t=e.limit.context&&e.limit.output?{limit:{context:e.limit.context,output:e.limit.output,...e.limit.input!==void 0?{input:e.limit.input}:{}}}:{};return{name:e.name,temperature:e.capabilities.temperature,reasoning:e.capabilities.reasoning,attachment:e.capabilities.attachment,tool_call:e.capabilities.toolcall,...e.family?{family:e.family}:{},...e.release_date?{release_date:e.release_date}:{},...t}}function Br(e,t,i=[],u={}){const l=new Set(u.includeModelIDs??[]),a=u.includeModels||l.size>0?Object.fromEntries(t.map(o=>{if(!u.includeModels&&!l.has(o))return;const d=i.find(f=>f.id===o);if(d)return[o,Vr(d.model)]}).filter(o=>!!o)):void 0,p=a?{...a,...e?.models??{}}:e?.models;return{...e??{},whitelist:t.slice().sort((o,d)=>o.localeCompare(d)),blacklist:[],...p?{models:p}:{}}}var Gr=k('<div class="sticky top-0 z-10 bg-[linear-gradient(to_bottom,var(--surface-stronger-non-alpha)_calc(100%_-_24px),transparent)]"><div class="flex flex-col gap-1 pt-6 pb-8 max-w-[720px]"><h2 class="text-16-medium text-text-strong">'),Hr=k('<div class="flex items-center justify-between gap-4 min-h-16 border-b border-border-weak-base last:border-none flex-wrap py-3"data-component=custom-provider-section><div class="flex flex-col min-w-0"><div class="flex flex-wrap items-center gap-x-3 gap-y-1"><span class="text-14-medium text-text-strong"></span></div><span class="text-12-regular text-text-weak pl-8">'),Jr=k('<div><div class="flex flex-col gap-8 max-w-[720px]"><div class="flex flex-col gap-1"data-component=connected-providers-section><h3 class="text-14-medium text-text-strong pb-2"></h3></div><div class="flex flex-col gap-1"><h3 class="text-14-medium text-text-strong pb-2">'),Qr=k('<div class="py-4 text-14-regular text-text-weak">'),Xr=k('<div class="group flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex items-center gap-3 min-w-0"><span class="text-14-medium text-text-strong truncate"></span></div><div class="flex shrink-0 items-center gap-2">'),Yr=k('<span class="text-14-regular text-text-base opacity-0 group-hover:opacity-100 transition-opacity duration-200 pr-3 cursor-default">'),Zr=k('<div class="flex flex-wrap items-center justify-between gap-4 min-h-16 py-3 border-b border-border-weak-base last:border-none"><div class="flex flex-col min-w-0"><div class="flex items-center gap-x-3"><span class="text-14-medium text-text-strong">'),en=k('<span class="text-12-regular text-text-weak pl-8">'),tn=k('<div class="pt-2 text-12-regular text-text-danger-base">'),rn=k('<div class="flex flex-col gap-5 px-2.5 pb-3 overflow-y-auto max-h-[70vh]"><div class="px-2.5 flex items-center justify-between gap-4"><div class="flex items-center gap-3 min-w-0"><div class=min-w-0><div class="text-16-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak"></div></div></div><div class="flex shrink-0 items-center gap-2"></div></div><div class=mx-2.5></div><form class="mx-2.5 grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-2"></form><div class=px-2.5></div><div class="flex justify-end gap-2 px-2.5">'),nn=k('<div class="px-4 py-10 text-center text-12-regular text-text-weak">'),sn=k('<div class="flex flex-wrap items-center justify-between gap-4 py-3 border-b border-border-weak-base last:border-none"><div class=min-w-0><span class="text-14-regular text-text-strong truncate block"></span><span class="text-12-regular text-text-weak truncate block">');const ln=[{match:e=>e==="codeplane",key:"dialog.provider.codeplane.note"},{match:e=>e==="anthropic",key:"dialog.provider.anthropic.note"},{match:e=>e.startsWith("github-copilot"),key:"dialog.provider.copilot.note"},{match:e=>e==="openai",key:"dialog.provider.openai.note"},{match:e=>e==="google",key:"dialog.provider.google.note"},{match:e=>e==="openrouter",key:"dialog.provider.openrouter.note"},{match:e=>e==="vercel",key:"dialog.provider.vercel.note"}],an=e=>{const t=Y(),i=N(),u=ne(),l=re(),a=st(),p=L(()=>a.connected().filter(s=>s.id!=="codeplane"||Object.values(s.models).find(g=>g.cost?.input))),o=L(()=>{const s=new Set(p().map(c=>c.id)),g=a.popular().filter(c=>!s.has(c.id)).slice();return g.sort((c,C)=>Ee.indexOf(c.id)-Ee.indexOf(C.id)),g}),d=s=>{if(!("source"in s))return;const g=s.source;if(g==="env"||g==="api"||g==="config"||g==="custom")return g},f=s=>{const g=d(s);return g==="env"?i.t("settings.providers.tag.environment"):g==="api"?i.t("provider.connect.method.apiKey"):g==="config"?S(s.id)?i.t("settings.providers.tag.custom"):i.t("settings.providers.tag.config"):g==="custom"?i.t("settings.providers.tag.custom"):i.t("settings.providers.tag.other")},b=s=>d(s)!=="env",m=s=>ln.find(g=>g.match(s))?.key,S=s=>{const g=l.data.config.provider?.[s];return!(!g||g.npm!=="@ai-sdk/openai-compatible"||!g.models||Object.keys(g.models).length===0)},x=()=>e.layout==="page",w=async(s,g)=>{const c=l.data.config.disabled_providers??[],C=c.includes(s)?c:[...c,s];l.set("config","disabled_providers",C),await l.updateConfig({disabled_providers:C}).then(()=>{T({variant:"success",icon:"circle-check",title:i.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:i.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(y=>{l.set("config","disabled_providers",c);const $=y instanceof Error?y.message:String(y);T({title:i.t("common.requestFailed"),description:$})})},h=async(s,g)=>{if(S(s)){await u.client.auth.remove({providerID:s}).catch(()=>{}),await w(s,g);return}await u.client.auth.remove({providerID:s}).then(async()=>{await u.client.global.dispose(),T({variant:"success",icon:"circle-check",title:i.t("provider.disconnect.toast.disconnected.title",{provider:g}),description:i.t("provider.disconnect.toast.disconnected.description",{provider:g})})}).catch(c=>{const C=c instanceof Error?c.message:String(c);T({title:i.t("common.requestFailed"),description:C})})};return(()=>{var s=Jr(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=c.nextSibling,$=y.firstChild;return n(s,r(F,{get when(){return!x()},get children(){var v=Gr(),z=v.firstChild,j=z.firstChild;return n(j,()=>i.t("settings.providers.title")),v}}),g),n(C,()=>i.t("settings.providers.section.connected")),n(c,r(oe,{get children(){return r(F,{get when(){return p().length>0},get fallback(){return(()=>{var v=Qr();return n(v,()=>i.t("settings.providers.connected.empty")),v})()},get children(){return r(Z,{get each(){return p()},children:v=>(()=>{var z=Xr(),j=z.firstChild,E=j.firstChild,I=j.nextSibling;return n(j,r(ye,{get id(){return v.id},class:"size-5 shrink-0 icon-strong-base"}),E),n(E,()=>v.name),n(j,r(ie,{get children(){return f(v)}}),null),n(I,r(M,{size:"large",variant:"ghost",icon:"edit",onClick:()=>t.show(()=>r(on,{provider:v})),get children(){return i.t("settings.providers.models.edit")}}),null),n(I,r(F,{get when(){return b(v)},get fallback(){return(()=>{var V=Yr();return n(V,()=>i.t("settings.providers.connected.environmentDescription")),V})()},get children(){return r(M,{size:"large",variant:"ghost",onClick:()=>void h(v.id,v.name),get children(){return i.t("common.disconnect")}})}}),null),z})()})}})}}),null),n($,()=>i.t("settings.providers.section.popular")),n(y,r(oe,{get children(){return[r(Z,{get each(){return o()},children:v=>(()=>{var z=Zr(),j=z.firstChild,E=j.firstChild,I=E.firstChild;return n(E,r(ye,{get id(){return v.id},class:"size-5 shrink-0 icon-strong-base"}),I),n(I,()=>v.name),n(E,r(F,{get when(){return v.id==="codeplane"},get children(){return r(ie,{get children(){return i.t("dialog.provider.tag.recommended")}})}}),null),n(j,r(F,{get when(){return m(v.id)},keyed:!0,children:V=>(()=>{var W=en();return n(W,()=>i.t(V)),W})()}),null),n(z,r(M,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(Vt,{get provider(){return v.id}}))},get children(){return i.t("common.connect")}}),null),z})()}),(()=>{var v=Hr(),z=v.firstChild,j=z.firstChild,E=j.firstChild,I=j.nextSibling;return n(j,r(ye,{id:"synthetic",class:"size-5 shrink-0 icon-strong-base"}),E),n(E,()=>i.t("provider.custom.title")),n(j,r(ie,{get children(){return i.t("settings.providers.tag.custom")}}),null),n(I,()=>i.t("settings.providers.custom.description")),n(v,r(M,{size:"large",variant:"secondary",icon:"plus-small",onClick:()=>{t.show(()=>r(Bt,{back:"close"}))},get children(){return i.t("common.connect")}}),null),v})()]}}),null),n(y,r(M,{variant:"ghost",class:"px-0 py-0 mt-5 text-14-medium text-text-interactive-base text-left justify-start hover:bg-transparent active:bg-transparent",onClick:()=>{t.show(()=>r(Gt,{}))},get children(){return i.t("dialog.provider.viewAll")}}),null),Q(v=>H(s,{"flex flex-col":!0,"w-full":x(),"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":!x()},v)),s})()};function on(e){const t=Y(),i=ne(),u=re(),l=N(),a=L(()=>u.data.provider.catalog.find($=>$.id===e.provider.id)),p=L(()=>We({provider:e.provider,catalog:a(),catalogs:u.data.provider.catalog})),o=L(()=>u.data.config.provider?.[e.provider.id]),d=L(()=>qr({provider:e.provider,catalog:a(),catalogs:u.data.provider.catalog,config:o()})),[f,b]=pe({selected:Object.fromEntries(d().map($=>[$.id,$.selected])),added:{},addModelID:"",addModelName:"",search:"",addError:"",error:""}),m=L(()=>Object.values(f.added).map($=>({id:$.id,model:$,selected:!!f.selected[$.id]}))),S=L(()=>{const $=new Set(d().map(v=>v.id));return[...d(),...m().filter(v=>$.has(v.id)?!1:($.add(v.id),!0))].sort((v,z)=>v.model.name.localeCompare(z.model.name)||v.id.localeCompare(z.id))}),x=L(()=>Wr(S(),f.search)),w=L(()=>S().filter($=>f.selected[$.id]).map($=>$.id)),h=$=>{b("selected",Object.fromEntries(S().map(v=>[v.id,$]))),b("error","")},s=($,v)=>{b("selected",$,v),b("error","")},g=$=>{for(const v of u.data.provider.catalog){const z=v.models[$];if(z)return z}},c=($,v)=>g($)??{id:$,providerID:e.provider.id,api:{id:$,url:Object.values(e.provider.models)[0]?.api.url??"",npm:Object.values(e.provider.models)[0]?.api.npm??"@ai-sdk/openai-compatible"},name:v,capabilities:{temperature:!0,reasoning:!1,attachment:!1,toolcall:!0,input:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},output:{text:!0,audio:!1,image:!1,video:!1,pdf:!1},interleaved:!1},cost:{input:0,output:0,cache:{read:0,write:0}},limit:{context:0,output:0},status:"active",options:{},headers:{},release_date:""},C=$=>{$.preventDefault();const v=f.addModelID.trim();if(!v){b("addError",l.t("settings.providers.models.add.error.id"));return}if(S().find(E=>E.id===v)){b("selected",v,!0),b("addModelID",""),b("addModelName",""),b("addError","");return}const j=c(v,f.addModelName.trim()||v);b("added",v,j),b("selected",v,!0),b("addModelID",""),b("addModelName",""),b("addError",""),b("error","")},y=te(()=>({mutationFn:async()=>{const $=w();if($.length===0){b("error",l.t("settings.providers.models.error.required"));return}await u.updateConfig({provider:{[e.provider.id]:Br(o(),$,S(),{includeModels:!p().providerCatalog,includeModelIDs:Object.keys(f.added)})}}),await i.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:l.t("settings.providers.models.toast.updated",{provider:e.provider.name})}),t.close()},onError:$=>{T({variant:"error",title:l.t("common.requestFailed"),description:$ instanceof Error?$.message:String($)})}}));return r(ve,{get title(){return l.t("settings.providers.models.title",{provider:e.provider.name})},transition:!0,get children(){var $=rn(),v=$.firstChild,z=v.firstChild,j=z.firstChild,E=j.firstChild,I=E.nextSibling,V=z.nextSibling,W=v.nextSibling,J=W.nextSibling,O=J.nextSibling,ce=O.nextSibling;return n(z,r(ye,{get id(){return e.provider.id},class:"size-5 shrink-0 icon-strong-base"}),j),n(E,()=>e.provider.name),n(I,()=>l.t("settings.providers.models.count",{selected:w().length,total:S().length})),n(V,r(M,{type:"button",size:"small",variant:"ghost",onClick:()=>h(!0),get children(){return l.t("settings.providers.models.selectAll")}}),null),n(V,r(M,{type:"button",size:"small",variant:"ghost",onClick:()=>h(!1),get children(){return l.t("settings.providers.models.clear")}}),null),n(W,r(R,{variant:"normal",type:"search",get value(){return f.search},onChange:B=>b("search",B),get placeholder(){return l.t("common.search.placeholder")},get label(){return l.t("common.search.placeholder")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off"})),J.addEventListener("submit",C),n(J,r(R,{variant:"normal",type:"text",get value(){return f.addModelID},onChange:B=>{b("addModelID",B),b("addError","")},get placeholder(){return l.t("settings.providers.models.add.id")},get label(){return l.t("settings.providers.models.add.id")},hideLabel:!0,spellcheck:!1,autocorrect:"off",autocomplete:"off",autocapitalize:"off",get error(){return f.addError},get validationState(){return f.addError?"invalid":void 0}}),null),n(J,r(R,{variant:"normal",type:"text",get value(){return f.addModelName},onChange:B=>b("addModelName",B),get placeholder(){return l.t("settings.providers.models.add.name")},get label(){return l.t("settings.providers.models.add.name")},hideLabel:!0}),null),n(J,r(M,{type:"submit",size:"large",variant:"secondary",icon:"plus-small",get children(){return l.t("settings.providers.models.add.submit")}}),null),n(O,r(oe,{get children(){return r(F,{get when(){return x().length>0},get fallback(){return(()=>{var B=nn();return n(B,()=>l.t("settings.providers.models.empty")),B})()},get children(){return r(Z,{get each(){return x()},children:B=>(()=>{var de=sn(),ue=de.firstChild,ge=ue.firstChild,we=ge.nextSibling;return n(ge,()=>B.model.name),n(we,()=>B.id),n(de,r(q,{get checked(){return!!f.selected[B.id]},onChange:ee=>s(B.id,ee),hideLabel:!0,get children(){return B.model.name}}),null),de})()})}})}}),null),n(O,r(F,{get when(){return f.error},get children(){var B=tn();return n(B,()=>f.error),B}}),null),n(ce,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>t.close(),get children(){return l.t("common.cancel")}}),null),n(ce,r(M,{type:"button",variant:"primary",size:"large",get disabled(){return y.isPending},onClick:()=>y.mutate(),get children(){return A(()=>!!y.isPending)()?l.t("common.saving"):l.t("common.save")}}),null),$}})}var cn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),dn=k("<div>"),un=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),gn=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),mn=k('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),pn=k('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),fn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),hn=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-3 gap-3"></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">');const Je=e=>!!e&&typeof e=="object"&&!Array.isArray(e),vn=e=>e?{name:e.name,description:e.config.description??"",model:e.config.model??"",prompt:e.config.prompt??"",temperature:e.config.temperature!==void 0?String(e.config.temperature):"",topP:e.config.top_p!==void 0?String(e.config.top_p):"",steps:e.config.steps!==void 0?String(e.config.steps):"",hidden:!!e.config.hidden,disable:!!e.config.disable,errors:{}}:{name:"",description:"",model:"",prompt:"",temperature:"",topP:"",steps:"",hidden:!1,disable:!1,errors:{}};function bn(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=()=>e.layout==="page",p=L(()=>{const m=i.data.config.mode??{},S=new Set(Object.keys(m));return[...Object.entries(m).filter(x=>Je(x[1])).map(([x,w])=>({name:x,config:w,source:"mode"})),...Object.entries(i.data.config.agent??{}).filter(x=>Je(x[1])).filter(([x,w])=>!S.has(x)&&(w.mode??"primary")!=="subagent").map(([x,w])=>({name:x,config:w,source:"agent"}))].sort((x,w)=>x.name.localeCompare(w.name))}),o=L(()=>p().filter(m=>m.config.disable!==!0).length),d=(m,S)=>m==="mode"?i.updateConfig({mode:S}):i.updateConfig({agent:S}),f=te(()=>({mutationFn:async m=>{const S={...m.mode.source==="mode"?i.data.config.mode:i.data.config.agent};S[m.mode.name]={...S[m.mode.name]??{},disable:!m.enabled},await d(m.mode.source,S),await u.client.global.dispose().catch(()=>{})},onError:m=>{T({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),b=m=>{l.show(()=>r(wn,{entry:m}))};return[(()=>{var m=dn();return n(m,r(F,{get when(){return!a()},get children(){var S=cn(),x=S.firstChild,w=x.nextSibling;return n(x,()=>t.t("modes.page.title")),n(w,()=>t.t("modes.page.subtitle",{enabled:o(),total:p().length})),S}}),null),n(m,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>b(),get children(){return t.t("modes.page.add")}}),null),Q(S=>H(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()},S)),m})(),r(F,{get when(){return p().length>0},get fallback(){return(()=>{var m=gn();return n(m,()=>t.t("modes.page.empty")),m})()},get children(){var m=un();return n(m,r(Z,{get each(){return p()},children:S=>r(xn,{mode:S,toggling:()=>f.isPending&&f.variables?.mode.name===S.name,onToggle:x=>f.mutate({mode:S,enabled:x}),onEdit:()=>b(S)})})),m}})]}function xn(e){const t=N(),i=()=>e.mode.config.disable!==!0,u=()=>e.mode.config.model,l=()=>e.mode.source==="mode"?"primary":e.mode.config.mode==="all"?"all":"primary";return(()=>{var a=fn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=o.nextSibling;return n(d,r(le,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.mode.name),n(d,r(ie,{get children(){return t.t(`modes.kind.${l()}`)}}),null),n(d,r(F,{get when(){return e.mode.source==="mode"},get children(){return r(ie,{get children(){return t.t("modes.source.legacy")}})}}),null),n(d,r(F,{get when(){return e.mode.config.hidden},get children(){return r(ie,{get children(){return t.t("modes.tag.hidden")}})}}),null),n(d,r(F,{get when(){return!i()},get children(){return r(ie,{get children(){return t.t("modes.tag.disabled")}})}}),null),n(o,r(F,{get when(){return e.mode.config.description},get children(){var m=mn();return n(m,()=>e.mode.config.description),m}}),null),n(o,r(F,{get when(){return u()},get children(){var m=pn();return n(m,u),m}}),null),n(b,r(q,{get checked(){return i()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),a})()}function wn(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,[p,o]=pe(vn(e.entry)),d=()=>{const x={},w=p.name.trim();return w||(x.name=t.t("modes.editor.error.name")),!a&&(i.data.config.mode&&w in i.data.config.mode||i.data.config.agent&&w in i.data.config.agent)&&(x.name=t.t("modes.editor.error.duplicate")),o("errors",x),Object.keys(x).length===0},f=x=>{const w=x.trim();if(!w)return;const h=Number(w);if(!Number.isNaN(h))return h},b=()=>({mode:"primary",hidden:p.hidden,disable:p.disable,...p.description.trim()?{description:p.description.trim()}:{},...p.model.trim()?{model:p.model.trim()}:{},...p.prompt.trim()?{prompt:p.prompt}:{},...f(p.temperature)!==void 0?{temperature:f(p.temperature)}:{},...f(p.topP)!==void 0?{top_p:f(p.topP)}:{},...f(p.steps)!==void 0?{steps:f(p.steps)}:{}}),m=te(()=>({mutationFn:async()=>{if(!d())return;const x=e.entry?.source??"agent",w={...x==="mode"?i.data.config.mode:i.data.config.agent};w[p.name.trim()]=b(),x==="mode"?await i.updateConfig({mode:w}):await i.updateConfig({agent:w}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("modes.toast.updated"):t.t("modes.toast.added")}),l.close()},onError:x=>{T({variant:"error",title:t.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}})),S=x=>{x.preventDefault(),!m.isPending&&m.mutate()};return r(ve,{get title(){return a?t.t("modes.editor.title.edit"):t.t("modes.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var x=hn(),w=x.firstChild,h=w.firstChild,s=h.nextSibling,g=s.firstChild,c=g.firstChild,C=c.nextSibling,y=s.nextSibling,$=y.firstChild,v=$.firstChild,z=v.nextSibling,j=w.nextSibling;return x.addEventListener("submit",S),n(w,r(R,{autofocus:!0,get label(){return t.t("modes.editor.name")},placeholder:"review",get value(){return p.name},onChange:E=>ae(()=>{o("name",E),o("errors","name",void 0)}),get error(){return p.errors.name},disabled:a,spellcheck:!1,class:"font-mono text-xs"}),h),n(w,r(R,{get label(){return t.t("modes.editor.description")},get placeholder(){return t.t("modes.editor.description.placeholder")},get value(){return p.description},onChange:E=>o("description",E)}),h),n(w,r(R,{get label(){return t.t("modes.editor.model")},get description(){return t.t("modes.editor.model.description")},placeholder:"anthropic/claude-sonnet-4-5",get value(){return p.model},onChange:E=>o("model",E),spellcheck:!1,class:"font-mono text-xs"}),h),n(w,r(R,{multiline:!0,get label(){return t.t("modes.editor.prompt")},get description(){return t.t("modes.editor.prompt.description")},get placeholder(){return t.t("modes.editor.prompt.placeholder")},get value(){return p.prompt},onChange:E=>o("prompt",E),spellcheck:!1,class:"max-h-40 w-full overflow-y-auto font-mono text-xs"}),h),n(h,r(R,{get label(){return t.t("modes.editor.temperature")},placeholder:"0.7",get value(){return p.temperature},onChange:E=>o("temperature",E.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),n(h,r(R,{get label(){return t.t("modes.editor.topP")},placeholder:"1",get value(){return p.topP},onChange:E=>o("topP",E.replace(/[^0-9.]/g,"")),inputmode:"decimal"}),null),n(h,r(R,{get label(){return t.t("modes.editor.steps")},placeholder:"50",get value(){return p.steps},onChange:E=>o("steps",E.replace(/[^0-9]/g,"")),inputmode:"numeric"}),null),n(c,()=>t.t("modes.editor.hidden")),n(C,()=>t.t("modes.editor.hidden.description")),n(s,r(q,{get checked(){return p.hidden},onChange:E=>o("hidden",E),hideLabel:!0,get children(){return t.t("modes.editor.hidden")}}),null),n(v,()=>t.t("modes.editor.disable")),n(z,()=>t.t("modes.editor.disable.description")),n(y,r(q,{get checked(){return p.disable},onChange:E=>o("disable",E),hideLabel:!0,get children(){return t.t("modes.editor.disable")}}),null),n(j,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(j,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),x}})}var kn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),$n=k('<div><div class="flex items-center gap-2">'),yn=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),_n=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Cn=k('<span class="text-11-regular text-text-weak">'),Sn=k('<div class="mt-0.5 truncate font-mono text-11-regular text-text-weak">'),Dn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),En=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><div class="flex flex-col"><span class="text-14-medium text-text-strong"></span><span class="text-11-regular text-text-weak"></span></div></div></div><div class="flex justify-end gap-2 pt-1">'),Pn=k("<button type=button>"),zn=k('<span class="text-11-regular text-text-weaker">'),jn=k('<div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span></div><div class="flex flex-col gap-1.5">'),Fn=k('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const fe=()=>({key:"",value:""}),In={connected:"mcp.status.connected",failed:"mcp.status.failed",needs_auth:"mcp.status.needs_auth",disabled:"mcp.status.disabled",needs_client_registration:"mcp.status.needs_auth"};function Ln(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=lt(),p=()=>e.layout==="page",[o,d]=qe(async()=>(await u.client.mcp.status().catch(()=>null))?.data??{}),f=L(()=>{const w=i.data.config.mcp??{},h=o()??{},s=[];for(const[g,c]of Object.entries(w))!c||typeof c!="object"||"type"in c&&s.push({name:g,config:c,status:h[g]});return s.sort((g,c)=>g.name.localeCompare(c.name))}),b=L(()=>f().filter(w=>w.config.enabled!==!1).length),m=te(()=>({mutationFn:async({name:w,enabled:h})=>{const s=i.data.config.mcp??{},g=s[w];if(!g||!("type"in g))throw new Error("not found");const c={...s,[w]:{...g,enabled:h}};await i.updateConfig({mcp:c}),h?await u.client.mcp.connect({name:w}).catch(()=>{}):await u.client.mcp.disconnect({name:w}).catch(()=>{}),d.refetch()},onError:w=>{T({variant:"error",title:t.t("common.requestFailed"),description:w instanceof Error?w.message:String(w)})}})),S=te(()=>({mutationFn:async w=>{const h={...i.data.config.mcp??{}};delete h[w],await i.updateConfig({mcp:h}),d.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("mcp.toast.removed")})},onError:w=>{T({variant:"error",title:t.t("common.requestFailed"),description:w instanceof Error?w.message:String(w)})}})),x=w=>{l.show(()=>r(On,{entry:w}))};return[(()=>{var w=$n(),h=w.firstChild;return n(w,r(F,{get when(){return!p()},get children(){var s=kn(),g=s.firstChild,c=g.nextSibling;return n(g,()=>t.t("mcp.page.title")),n(c,()=>t.t("mcp.page.subtitle",{enabled:b(),total:f().length})),s}}),h),n(h,r(M,{variant:"secondary",size:"large",icon:"shield",onClick:()=>a("/settings/secrets"),get children(){return t.t("secrets.page.title")}}),null),n(h,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>x(),get children(){return t.t("mcp.page.add")}}),null),Q(s=>H(w,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!p(),"justify-end":p()},s)),w})(),r(F,{get when(){return f().length>0},get fallback(){return(()=>{var w=_n();return n(w,()=>t.t("mcp.page.empty")),w})()},get children(){var w=yn();return n(w,r(Z,{get each(){return f()},children:h=>r(Mn,{server:h,toggling:()=>m.isPending&&m.variables?.name===h.name,onToggle:s=>m.mutate({name:h.name,enabled:s}),onEdit:()=>x(h),onRemove:()=>{window.confirm(t.t("mcp.page.confirm.remove",{name:h.name}))&&S.mutate(h.name)}})})),w}})]}function Mn(e){const t=N(),i=()=>{const a=e.server.config.enabled===!1?"disabled":e.server.status?.status;if(!a)return;const p=In[a];return p?t.t(p):a},u=()=>e.server.config.enabled!==!1,l=()=>e.server.config.type==="remote"?e.server.config.url:e.server.config.type==="local"&&Array.isArray(e.server.config.command)?e.server.config.command.join(" "):"";return(()=>{var a=Dn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=o.nextSibling;return n(d,r(le,{name:"mcp",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.server.name),n(d,r(ie,{get children(){return e.server.config.type}}),null),n(d,r(F,{get when(){return i()},get children(){var m=Cn();return n(m,i),m}}),null),n(o,r(F,{get when(){return l()},get children(){var m=Sn();return n(m,l),m}}),null),n(b,r(q,{get checked(){return u()},get disabled(){return e.toggling()},onChange:m=>e.onToggle(m),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(b,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),a})()}function On(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,p=()=>{const s=e.entry;if(!s)return{name:"",kind:"local",enabled:!0,command:"",url:"",timeout:"",environment:[fe()],headers:[fe()],errors:{}};const g=s.config;return g.type==="local"?{name:s.name,kind:"local",enabled:g.enabled!==!1,command:Array.isArray(g.command)?g.command.join(" "):"",url:"",timeout:g.timeout?String(g.timeout):"",environment:Object.entries(g.environment??{}).map(([c,C])=>({key:c,value:C}))||[fe()],headers:[fe()],errors:{}}:{name:s.name,kind:"remote",enabled:g.enabled!==!1,command:"",url:g.url,timeout:g.timeout?String(g.timeout):"",environment:[fe()],headers:Object.entries(g.headers??{}).map(([c,C])=>({key:c,value:C}))||[fe()],errors:{}}},[o,d]=pe(p()),f=()=>{const s={};if(o.name.trim()||(s.name=t.t("mcp.editor.error.name")),!a&&i.data.config.mcp&&o.name.trim()in i.data.config.mcp&&(s.name=t.t("mcp.editor.error.duplicate")),o.kind==="local"&&!o.command.trim()&&(s.command=t.t("mcp.editor.error.command")),o.kind==="remote"){const g=o.url.trim();g?/^https?:\/\//i.test(g)||(s.url=t.t("mcp.editor.error.urlInvalid")):s.url=t.t("mcp.editor.error.url")}return d("errors",s),Object.keys(s).length===0},b=()=>{const s=o.timeout.trim()?Number(o.timeout.trim()):void 0;if(o.kind==="local"){const c={};for(const C of o.environment){const y=C.key.trim();y&&(c[y]=C.value)}return{type:"local",command:o.command.trim().split(/\s+/).filter(C=>C.length>0),enabled:o.enabled,...Object.keys(c).length>0?{environment:c}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}}const g={};for(const c of o.headers){const C=c.key.trim();C&&(g[C]=c.value)}return{type:"remote",url:o.url.trim(),enabled:o.enabled,...Object.keys(g).length>0?{headers:g}:{},...typeof s=="number"&&!Number.isNaN(s)?{timeout:s}:{}}},m=te(()=>({mutationFn:async()=>{if(!f())return;const s=b(),g=o.name.trim(),c={...i.data.config.mcp??{}},C=a&&e.entry?e.entry.name:void 0;C&&C!==g&&delete c[C],c[g]=s,await i.updateConfig({mcp:c}),C&&await u.client.mcp.disconnect({name:C}).catch(()=>{}),o.enabled?await u.client.mcp.add({name:g,config:s}).catch(()=>u.client.mcp.connect({name:g}).catch(()=>{})):await u.client.mcp.disconnect({name:g}).catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("mcp.toast.updated"):t.t("mcp.toast.added")}),l.close()},onError:s=>{T({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),S=s=>{s.preventDefault(),!m.isPending&&m.mutate()},x=(s,g,c,C)=>{d(s,g,c,C)},w=s=>{d(s,Pe(g=>g.push(fe())))},h=(s,g)=>{d(s,Pe(c=>{c.splice(g,1),c.length===0&&c.push(fe())}))};return r(ve,{get title(){return a?t.t("mcp.editor.title.edit"):t.t("mcp.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=En(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=C.nextSibling,$=c.nextSibling,v=$.firstChild,z=v.firstChild,j=z.nextSibling,E=g.nextSibling;return s.addEventListener("submit",S),n(g,r(R,{autofocus:!0,get label(){return t.t("mcp.editor.name")},placeholder:"my-server",get value(){return o.name},onChange:I=>ae(()=>{d("name",I),d("errors","name",void 0)}),get error(){return o.errors.name},disabled:a}),c),n(C,()=>t.t("mcp.editor.type")),n(y,r(Qe,{get active(){return o.kind==="local"},get label(){return t.t("mcp.editor.type.local")},onClick:()=>d("kind","local")}),null),n(y,r(Qe,{get active(){return o.kind==="remote"},get label(){return t.t("mcp.editor.type.remote")},onClick:()=>d("kind","remote")}),null),n(g,r(F,{get when(){return o.kind==="local"},get children(){return[r(R,{get label(){return t.t("mcp.editor.command")},get description(){return t.t("mcp.editor.command.description")},placeholder:"npx -y my-mcp-server",get value(){return o.command},onChange:I=>ae(()=>{d("command",I),d("errors","command",void 0)}),get error(){return o.errors.command},spellcheck:!1,class:"font-mono text-xs"}),r(Xe,{get title(){return t.t("mcp.editor.environment")},get description(){return t.t("mcp.editor.environment.description")},get rows(){return o.environment},secret:!0,onChange:(I,V,W)=>x("environment",I,V,W),onAdd:()=>w("environment"),onRemove:I=>h("environment",I)})]}}),$),n(g,r(F,{get when(){return o.kind==="remote"},get children(){return[r(R,{get label(){return t.t("mcp.editor.url")},placeholder:"https://example.com/mcp",get value(){return o.url},onChange:I=>ae(()=>{d("url",I),d("errors","url",void 0)}),get error(){return o.errors.url},spellcheck:!1}),r(Xe,{get title(){return t.t("mcp.editor.headers")},get description(){return t.t("mcp.editor.headers.description")},get rows(){return o.headers},secret:!0,onChange:(I,V,W)=>x("headers",I,V,W),onAdd:()=>w("headers"),onRemove:I=>h("headers",I)})]}}),$),n(g,r(R,{get label(){return t.t("mcp.editor.timeout")},get description(){return t.t("mcp.editor.timeout.description")},placeholder:"5000",get value(){return o.timeout},onChange:I=>d("timeout",I.replace(/[^0-9]/g,"")),inputmode:"numeric"}),$),n(z,()=>t.t("mcp.editor.enabled")),n(j,()=>t.t("mcp.editor.enabled.description")),n($,r(q,{get checked(){return o.enabled},onChange:I=>d("enabled",I),hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(E,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(E,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function Qe(e){return(()=>{var t=Pn();return at(t,"click",e.onClick,!0),n(t,()=>e.label),Q(i=>H(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},i)),t})()}function Xe(e){const t=N();return(()=>{var i=jn(),u=i.firstChild,l=u.firstChild,a=u.nextSibling;return n(l,()=>e.title),n(u,r(F,{get when(){return e.description},get children(){var p=zn();return n(p,()=>e.description),p}}),null),n(a,r(Z,{get each(){return e.rows},children:(p,o)=>r(Rn,{row:p,get secret(){return e.secret},onKeyChange:d=>e.onChange(o(),"key",d),onValueChange:d=>e.onChange(o(),"value",d),onRemove:()=>e.onRemove(o())})})),n(i,r(M,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",get onClick(){return e.onAdd},get children(){return t.t("mcp.editor.row.add")}}),null),i})()}function Rn(e){const t=N(),[i,u]=he(!1);let l;const a=()=>e.secret&&!i()?"password":"text",p=()=>{l&&clearTimeout(l),u(!0),l=setTimeout(()=>u(!1),1500)},o=d=>{e.secret&&d.key==="Enter"&&(d.preventDefault(),p())};return(()=>{var d=Fn(),f=d.firstChild,b=f.nextSibling;return n(f,r(R,{variant:"ghost",get placeholder(){return t.t("mcp.editor.row.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),n(b,r(R,{variant:"ghost",get type(){return a()},get placeholder(){return t.t("mcp.editor.row.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:o,spellcheck:!1,class:"font-mono text-xs"})),n(d,r(F,{get when(){return e.secret},get children(){return r(X,{type:"button",variant:"ghost",size:"normal",get icon(){return i()?"eye":"shield"},get"aria-label"(){return t.t(i()?"mcp.editor.row.hide":"mcp.editor.row.reveal")},onPointerDown:()=>{l&&clearTimeout(l),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),n(d,r(X,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),d})()}je(["click"]);var Un=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Tn=k('<div><div></div><div class="flex flex-col gap-8">'),An=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Kn=k('<li class="border-b border-border-weak-base last:border-b-0">'),Nn=k('<div class="flex flex-col gap-1"><div class="flex items-center gap-2 pb-2"><span class="text-14-medium text-text-strong"></span></div><ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),qn=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Wn=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-2 gap-3"></div><div class="grid grid-cols-3 gap-3"></div><div class="flex flex-col gap-2"><span class="text-12-medium text-text-weak"></span><div class="grid grid-cols-2 gap-2"></div></div></div><div class="flex justify-end gap-2 pt-1">'),Vn=k('<div class="flex items-center justify-between gap-3 rounded-md border border-border-weak-base px-3 py-2.5"><span class="text-13-medium text-text-strong">');const Bn=40,Ue=e=>e===void 0||e===0?"":String(e),Te=e=>{const t=e.trim();if(!t)return;const i=Number(t);if(!Number.isNaN(i))return i},Ae=e=>e.replace(/[^0-9]/g,""),Gn=(e,t)=>e?.models?.[t],Hn=(e,t)=>{const i=Ee.indexOf(e.id),u=Ee.indexOf(t.id),l=i>=0,a=u>=0;return l&&!a?-1:!l&&a?1:l&&a?i-u:e.name.localeCompare(t.name)},Jn=e=>e?{providerID:e.provider.id,modelID:e.model.id,apiModelID:e.config?.id??e.model.api.id,name:e.config?.name??e.model.name,family:e.config?.family??e.model.family??"",releaseDate:e.config?.release_date??e.model.release_date??"",context:Ue(e.config?.limit?.context??e.model.limit.context),input:Ue(e.config?.limit?.input??e.model.limit.input),output:Ue(e.config?.limit?.output??e.model.limit.output),temperature:e.config?.temperature??e.model.capabilities.temperature,reasoning:e.config?.reasoning??e.model.capabilities.reasoning,attachment:e.config?.attachment??e.model.capabilities.attachment,toolCall:e.config?.tool_call??e.model.capabilities.toolcall,errors:{}}:{providerID:"",modelID:"",apiModelID:"",name:"",family:"",releaseDate:"",context:"",input:"",output:"",temperature:!0,reasoning:!1,attachment:!1,toolCall:!0,errors:{}};function Qn(e={}){const t=N(),i=re(),u=ot(),l=Y(),a=()=>e.layout==="page",p=()=>e.layout==="dialog",[o,d]=pe({expanded:{}}),f=L(()=>u.list().map(h=>{const s=Gn(i.data.config.provider?.[h.provider.id],h.id);return{provider:h.provider,model:h,config:s,custom:h.provider.source==="config"||h.provider.source==="custom"||!!s}}).sort((h,s)=>{const g=Hn(h.provider,s.provider);return g!==0?g:h.model.name.localeCompare(s.model.name)})),b=L(()=>f().reduce((h,s)=>{const g=h.find(c=>c.provider.id===s.provider.id);return g?(g.entries.push(s),h):(h.push({provider:s.provider,entries:[s]}),h)},[])),m=L(()=>f().filter(h=>u.visible({providerID:h.provider.id,modelID:h.model.id})).length),S=h=>{l.show(()=>r(Yn,{entry:h}))},x=h=>u.visible({providerID:h.provider.id,modelID:h.model.id}),w=h=>{if(o.expanded[h.provider.id])return h.entries;const s=[];for(const g of h.entries)if(x(g)&&(s.push(g),s.length>=Bn))return s;return s};return(()=>{var h=Tn(),s=h.firstChild,g=s.nextSibling;return n(s,r(F,{get when(){return!a()},get children(){var c=Un(),C=c.firstChild,y=C.nextSibling;return n(C,()=>t.t("models.page.title")),n(y,()=>t.t("models.page.subtitle",{shown:m(),total:f().length})),c}}),null),n(s,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>S(),get children(){return t.t("models.page.add")}}),null),n(g,r(F,{get when(){return b().length>0},get fallback(){return(()=>{var c=An();return n(c,()=>t.t("models.page.empty")),c})()},get children(){return r(Z,{get each(){return b()},children:c=>{const C=L(()=>w(c)),y=L(()=>c.entries.length-C().length);return(()=>{var $=Nn(),v=$.firstChild,z=v.firstChild,j=v.nextSibling;return n(v,r(ye,{get id(){return c.provider.id},class:"size-5 shrink-0 icon-strong-base"}),z),n(z,()=>c.provider.name),n(j,r(Z,{get each(){return C()},children:E=>r(Xn,{entry:E,onEdit:()=>S(E)})}),null),n(j,r(F,{get when(){return y()>0},get children(){var E=Kn();return n(E,r(M,{variant:"ghost",size:"normal",class:"w-full justify-start px-4 py-3 text-13-medium text-text-interactive-base hover:bg-surface-base-hover active:bg-surface-base-active",onClick:()=>d("expanded",c.provider.id,!0),get children(){return[A(()=>t.t("common.loadMore")),A(()=>t.t("common.moreCountSuffix",{count:y()}))]}})),E}}),null),$})()}})}})),Q(c=>{var C={"flex flex-col gap-6":!0,"h-full overflow-y-auto no-scrollbar px-4 pb-10 sm:px-10 sm:pb-10":p()},y={"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()};return c.e=H(h,C,c.e),c.t=H(s,y,c.t),c},{e:void 0,t:void 0}),h})()}function Xn(e){const t=N(),i=ot(),u=()=>({providerID:e.entry.provider.id,modelID:e.entry.model.id}),l=()=>i.visible(u());return(()=>{var a=qn(),p=a.firstChild,o=p.firstChild,d=o.firstChild,f=d.firstChild,b=d.nextSibling,m=o.nextSibling;return n(d,r(le,{name:"models",size:"small",class:"icon-strong-base shrink-0"}),f),n(f,()=>e.entry.model.name),n(b,()=>e.entry.model.id),n(m,r(q,{get checked(){return l()},onChange:S=>i.setVisibility(u(),S),hideLabel:!0,get children(){return t.t("models.row.shown")}}),null),n(m,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),a})()}function Yn(e){const t=N(),i=re(),u=ne(),l=st(),a=Y(),p=!!e.entry,[o,d]=pe(Jn(e.entry)),f=()=>{const x={},w=o.providerID.trim(),h=o.modelID.trim();return w||(x.providerID=t.t("models.editor.error.provider")),h||(x.modelID=t.t("models.editor.error.model")),o.name.trim()||(x.name=t.t("models.editor.error.name")),!p&&l.all().some(s=>s.id===w&&!!s.models[h])&&(x.modelID=t.t("models.editor.error.duplicate")),d("errors",x),Object.keys(x).length===0},b=()=>{const x=o.modelID.trim(),w=o.apiModelID.trim(),h=Te(o.context),s=Te(o.input),g=Te(o.output),c=h!==void 0&&g!==void 0?{context:h,output:g,...s!==void 0?{input:s}:{}}:void 0;return{...w&&w!==x?{id:w}:{},name:o.name.trim(),temperature:o.temperature,reasoning:o.reasoning,attachment:o.attachment,tool_call:o.toolCall,...o.family.trim()?{family:o.family.trim()}:{},...o.releaseDate.trim()?{release_date:o.releaseDate.trim()}:{},...c?{limit:c}:{}}},m=te(()=>({mutationFn:async()=>{if(!f())return;const x=o.providerID.trim(),w=o.modelID.trim(),h=i.data.config.provider?.[x]??{};await i.updateConfig({provider:{[x]:{...h,models:{...h.models??{},[w]:b()}}}}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:p?t.t("models.toast.updated"):t.t("models.toast.added")}),a.close()},onError:x=>{T({variant:"error",title:t.t("common.requestFailed"),description:x instanceof Error?x.message:String(x)})}})),S=x=>{x.preventDefault(),!m.isPending&&m.mutate()};return r(ve,{get title(){return p?t.t("models.editor.title.edit"):t.t("models.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var x=Wn(),w=x.firstChild,h=w.firstChild,s=h.nextSibling,g=s.nextSibling,c=g.nextSibling,C=c.firstChild,y=C.nextSibling,$=w.nextSibling;return x.addEventListener("submit",S),n(h,r(R,{autofocus:!0,get label(){return t.t("models.editor.provider")},placeholder:"anthropic",get value(){return o.providerID},onChange:v=>ae(()=>{d("providerID",v),d("errors","providerID",void 0)}),get error(){return o.errors.providerID},disabled:p,spellcheck:!1,class:"font-mono text-xs"}),null),n(h,r(R,{get label(){return t.t("models.editor.model")},placeholder:"claude-sonnet-4-5",get value(){return o.modelID},onChange:v=>ae(()=>{d("modelID",v),d("errors","modelID",void 0)}),get error(){return o.errors.modelID},disabled:p,spellcheck:!1,class:"font-mono text-xs"}),null),n(w,r(R,{get label(){return t.t("models.editor.name")},placeholder:"Claude Sonnet 4.5",get value(){return o.name},onChange:v=>ae(()=>{d("name",v),d("errors","name",void 0)}),get error(){return o.errors.name}}),s),n(w,r(R,{get label(){return t.t("models.editor.apiModel")},get description(){return t.t("models.editor.apiModel.description")},get placeholder(){return o.modelID||"provider-model-id"},get value(){return o.apiModelID},onChange:v=>d("apiModelID",v),spellcheck:!1,class:"font-mono text-xs"}),s),n(s,r(R,{get label(){return t.t("models.editor.family")},placeholder:"claude",get value(){return o.family},onChange:v=>d("family",v)}),null),n(s,r(R,{get label(){return t.t("models.editor.releaseDate")},placeholder:"2026-01-01",get value(){return o.releaseDate},onChange:v=>d("releaseDate",v),spellcheck:!1}),null),n(g,r(R,{get label(){return t.t("models.editor.context")},placeholder:"200000",get value(){return o.context},onChange:v=>d("context",Ae(v)),inputmode:"numeric"}),null),n(g,r(R,{get label(){return t.t("models.editor.input")},placeholder:"200000",get value(){return o.input},onChange:v=>d("input",Ae(v)),inputmode:"numeric"}),null),n(g,r(R,{get label(){return t.t("models.editor.output")},placeholder:"8192",get value(){return o.output},onChange:v=>d("output",Ae(v)),inputmode:"numeric"}),null),n(C,()=>t.t("models.editor.capabilities")),n(y,r(Se,{get label(){return t.t("models.editor.temperature")},get checked(){return o.temperature},onChange:v=>d("temperature",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.reasoning")},get checked(){return o.reasoning},onChange:v=>d("reasoning",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.attachment")},get checked(){return o.attachment},onChange:v=>d("attachment",v)}),null),n(y,r(Se,{get label(){return t.t("models.editor.toolCall")},get checked(){return o.toolCall},onChange:v=>d("toolCall",v)}),null),n($,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>a.close(),get children(){return t.t("common.cancel")}}),null),n($,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),x}})}function Se(e){return(()=>{var t=Vn(),i=t.firstChild;return n(i,()=>e.label),n(t,r(q,{get checked(){return e.checked},get onChange(){return e.onChange},hideLabel:!0,get children(){return e.label}}),null),t})()}var Zn=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),ei=k("<div>"),ti=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),ri=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),ni=k('<span class="text-11-regular text-text-weak">'),ii=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),si=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><div class="flex flex-col"><span class="text-12-medium text-text-weak"></span><span class="text-11-regular text-text-weaker"></span></div><div class="flex flex-col gap-1.5"></div></div></div><div class="flex justify-end gap-2 pt-1">'),li=k('<div class="flex items-start gap-1.5"><div class="flex-1 min-w-0"></div><div class="flex-1 min-w-0">');const ai=e=>e.startsWith("./")||e.startsWith("../")||e.startsWith("/")||e.startsWith("file://"),oi=e=>/^https?:\/\//.test(e),ci=e=>/(token|secret|password|apikey|api[_-]?key|auth)/i.test(e),De=()=>({key:"",value:""}),di=e=>{if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}},ui=e=>{const t=e.trim();if(t==="")return"";if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;if(/^-?\d+(\.\d+)?$/.test(t)){const i=Number(t);if(!Number.isNaN(i))return i}if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]")||t.startsWith('"')&&t.endsWith('"'))try{return JSON.parse(t)}catch{}return e};function gi(e={}){const t=N(),i=re(),u=ne(),l=Y(),a=()=>e.layout==="page",p=L(()=>(i.data.config.plugin??[]).map((b,m)=>Array.isArray(b)?{index:m,spec:b,specifier:b[0],options:b[1]}:{index:m,spec:b,specifier:b,options:{}})),o=te(()=>({mutationFn:async f=>{const b=(i.data.config.plugin??[]).slice();b.splice(f,1),await i.updateConfig({plugin:b}),await u.client.global.dispose().catch(()=>{})},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("plugins.toast.removed")})},onError:f=>{T({variant:"error",title:t.t("common.requestFailed"),description:f instanceof Error?f.message:String(f)})}})),d=f=>{l.show(()=>r(pi,{entry:f}))};return[(()=>{var f=ei();return n(f,r(F,{get when(){return!a()},get children(){var b=Zn(),m=b.firstChild,S=m.nextSibling;return n(m,()=>t.t("plugins.page.title")),n(S,()=>t.t("plugins.page.subtitle",{count:p().length})),b}}),null),n(f,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>d(),get children(){return t.t("plugins.page.add")}}),null),Q(b=>H(f,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!a(),"justify-end":a()},b)),f})(),r(F,{get when(){return p().length>0},get fallback(){return(()=>{var f=ri();return n(f,()=>t.t("plugins.page.empty")),f})()},get children(){var f=ti();return n(f,r(Z,{get each(){return p()},children:b=>r(mi,{plugin:b,onEdit:()=>d(b),onRemove:()=>{window.confirm(t.t("plugins.page.confirm.remove",{name:b.specifier}))&&o.mutate(b.index)}})})),f}})]}function mi(e){const t=N(),i=()=>ai(e.plugin.specifier)?t.t("plugins.kind.local"):oi(e.plugin.specifier)?t.t("plugins.kind.remote"):t.t("plugins.kind.package"),u=()=>Object.keys(e.plugin.options).length;return(()=>{var l=ii(),a=l.firstChild,p=a.firstChild,o=p.firstChild,d=o.firstChild,f=p.nextSibling;return n(o,r(le,{name:"brain",size:"small",class:"icon-strong-base shrink-0"}),d),n(d,()=>e.plugin.specifier),n(o,r(ie,{get children(){return i()}}),null),n(o,r(F,{get when(){return u()>0},get children(){var b=ni();return n(b,()=>t.t("plugins.row.optionCount",{count:u()})),b}}),null),n(f,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(f,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),l})()}function pi(e){const t=N(),i=re(),u=ne(),l=Y(),a=!!e.entry,p=()=>{const s=e.entry;if(!s)return{specifier:"",options:[De()],errors:{}};const g=Object.entries(s.options).map(([c,C])=>({key:c,value:di(C)}));return{specifier:s.specifier,options:g.length>0?g:[De()],errors:{}}},[o,d]=pe(p()),f=()=>{const s={};return o.specifier.trim()||(s.specifier=t.t("plugins.editor.error.specifier")),d("errors",s),Object.keys(s).length===0},b=()=>{const s=o.specifier.trim(),g={};for(const c of o.options){const C=c.key.trim();C&&(g[C]=ui(c.value))}return Object.keys(g).length===0?s:[s,g]},m=te(()=>({mutationFn:async()=>{if(!f())return;const s=b(),g=(i.data.config.plugin??[]).slice();a&&e.entry?g[e.entry.index]=s:g.push(s),await i.updateConfig({plugin:g}),await u.client.global.dispose().catch(()=>{}),T({variant:"success",icon:"circle-check",title:a?t.t("plugins.toast.updated"):t.t("plugins.toast.added")}),l.close()},onError:s=>{T({variant:"error",title:t.t("common.requestFailed"),description:s instanceof Error?s.message:String(s)})}})),S=s=>{s.preventDefault(),!m.isPending&&m.mutate()},x=(s,g,c)=>{d("options",s,g,c)},w=()=>{d("options",Pe(s=>s.push(De())))},h=s=>{d("options",Pe(g=>{g.splice(s,1),g.length===0&&g.push(De())}))};return r(ve,{get title(){return a?t.t("plugins.editor.title.edit"):t.t("plugins.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var s=si(),g=s.firstChild,c=g.firstChild,C=c.firstChild,y=C.firstChild,$=y.nextSibling,v=C.nextSibling,z=g.nextSibling;return s.addEventListener("submit",S),n(g,r(R,{autofocus:!0,get label(){return t.t("plugins.editor.specifier")},get description(){return t.t("plugins.editor.specifier.description")},placeholder:"@my-org/my-plugin",get value(){return o.specifier},onChange:j=>ae(()=>{d("specifier",j),d("errors","specifier",void 0)}),get error(){return o.errors.specifier},spellcheck:!1,class:"font-mono text-xs"}),c),n(y,()=>t.t("plugins.editor.options")),n($,()=>t.t("plugins.editor.options.description")),n(v,r(Z,{get each(){return o.options},children:(j,E)=>r(fi,{row:j,onKeyChange:I=>x(E(),"key",I),onValueChange:I=>x(E(),"value",I),onRemove:()=>h(E())})})),n(c,r(M,{type:"button",variant:"ghost",size:"normal",icon:"plus-small",class:"self-start px-0",onClick:w,get children(){return t.t("plugins.editor.option.add")}}),null),n(z,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>l.close(),get children(){return t.t("common.cancel")}}),null),n(z,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return m.isPending},get children(){return A(()=>!!m.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),s}})}function fi(e){const t=N(),[i,u]=he(!1);let l;const a=L(()=>ci(e.row.key)),p=()=>a()&&!i()?"password":"text",o=()=>{l&&clearTimeout(l),u(!0),l=setTimeout(()=>u(!1),1500)},d=f=>{a()&&f.key==="Enter"&&(f.preventDefault(),o())};return(()=>{var f=li(),b=f.firstChild,m=b.nextSibling;return n(b,r(R,{variant:"ghost",get placeholder(){return t.t("plugins.editor.option.key")},get value(){return e.row.key},get onChange(){return e.onKeyChange},spellcheck:!1,class:"font-mono text-xs"})),n(m,r(R,{variant:"ghost",get type(){return p()},get placeholder(){return t.t("plugins.editor.option.value")},get value(){return e.row.value},get onChange(){return e.onValueChange},onKeyDown:d,spellcheck:!1,class:"font-mono text-xs"})),n(f,r(F,{get when(){return a()},get children(){return r(X,{type:"button",variant:"ghost",size:"normal",get icon(){return i()?"eye":"shield"},get"aria-label"(){return t.t(i()?"plugins.editor.option.hide":"plugins.editor.option.reveal")},onPointerDown:()=>{l&&clearTimeout(l),u(!0)},onPointerUp:()=>u(!1),onPointerLeave:()=>u(!1)})}}),null),n(f,r(X,{type:"button",variant:"ghost",size:"normal",icon:"close-small",get"aria-label"(){return t.t("common.remove")},get onClick(){return e.onRemove}}),null),f})()}var hi=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),vi=k("<div>"),bi=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),xi=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),wi=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div><div class="mt-1 text-11-regular text-text-weaker"></div></div><div class="flex shrink-0 items-center gap-2">'),ki=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"></div><div class="flex justify-end gap-2 pt-1">');function $i(e={}){const t=N(),i=ne(),u=Y(),l=()=>e.layout==="page",[a,p]=qe(async()=>(await i.client.global.secrets.list().catch(()=>null))?.data??[]),o=L(()=>(a()??[]).slice().sort((m,S)=>m.name.localeCompare(S.name))),d=te(()=>({mutationFn:async m=>{await i.client.global.secrets.remove({name:m}),await p.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("secrets.toast.removed")})},onError:m=>{T({variant:"error",title:t.t("common.requestFailed"),description:m instanceof Error?m.message:String(m)})}})),f=m=>{u.show(()=>r(yi,{entry:m,onSaved:()=>void p.refetch()}))},b=m=>new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(new Date(m));return[(()=>{var m=vi();return n(m,r(F,{get when(){return!l()},get children(){var S=hi(),x=S.firstChild,w=x.nextSibling;return n(x,()=>t.t("secrets.page.title")),n(w,()=>t.t("secrets.page.note")),S}}),null),n(m,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>f(),get children(){return t.t("secrets.page.add")}}),null),Q(S=>H(m,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!l(),"justify-end":l()},S)),m})(),r(F,{get when(){return o().length>0},get fallback(){return(()=>{var m=xi();return n(m,()=>t.t("secrets.page.empty")),m})()},get children(){var m=bi();return n(m,r(Z,{get each(){return o()},children:S=>(()=>{var x=wi(),w=x.firstChild,h=w.firstChild,s=h.firstChild,g=s.firstChild,c=s.nextSibling,C=c.nextSibling,y=h.nextSibling;return n(s,r(le,{name:"shield",size:"small",class:"icon-strong-base shrink-0"}),g),n(g,()=>S.name),n(c,()=>S.placeholder),n(C,()=>b(S.updated_at)),n(y,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},onClick:()=>f(S)}),null),n(y,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},onClick:()=>{window.confirm(t.t("secrets.page.confirm.remove",{name:S.name}))&&d.mutate(S.name)}}),null),x})()})),m}})]}function yi(e){const t=N(),i=ne(),u=Y(),l=!!e.entry,[a,p]=pe({name:e.entry?.name??"",value:"",errors:{}}),o=()=>{const b={};return a.name.trim()||(b.name=t.t("secrets.editor.name.error")),a.value.trim()||(b.value=t.t("secrets.editor.value.error")),p("errors",b),Object.keys(b).length===0},d=te(()=>({mutationFn:async()=>{o()&&(await i.client.global.secrets.set({name:a.name.trim(),value:a.value}),e.onSaved?.(),u.close())},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("secrets.toast.saved")})},onError:b=>{T({variant:"error",title:t.t("common.requestFailed"),description:b instanceof Error?b.message:String(b)})}})),f=b=>{b.preventDefault(),!d.isPending&&d.mutate()};return r(ve,{get title(){return t.t(l?"secrets.editor.title.edit":"secrets.editor.title.add")},class:"w-full max-w-[520px] mx-auto",fit:!0,get children(){var b=ki(),m=b.firstChild,S=m.nextSibling;return b.addEventListener("submit",f),n(m,r(R,{autofocus:!l,get label(){return t.t("secrets.editor.name")},placeholder:"github",get value(){return a.name},onChange:x=>ae(()=>{p("name",x),p("errors","name",void 0)}),get error(){return a.errors.name},disabled:l,spellcheck:!1,class:"font-mono text-xs"}),null),n(m,r(R,{autofocus:l,type:"password",get label(){return t.t("secrets.editor.value")},get value(){return a.value},onChange:x=>ae(()=>{p("value",x),p("errors","value",void 0)}),get error(){return a.errors.value},spellcheck:!1,class:"font-mono text-xs"}),null),n(S,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>u.close(),get children(){return t.t("common.cancel")}}),null),n(S,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return d.isPending},get children(){return A(()=>!!d.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),b}})}var _i=k('<div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Ci=k("<div>"),Ye=k('<ul class="overflow-hidden rounded-lg border border-border-weaker-base bg-background-base shadow-[var(--shadow-xs)]">'),Ze=k('<div class="flex flex-col gap-3"><div class="text-12-medium text-text-weak">'),Si=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-6 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),et=k('<div class="rounded-lg border border-border-weaker-base bg-background-base px-4 py-12 text-center text-12-regular text-text-weak shadow-[var(--shadow-xs)]">'),Di=k('<div class="mt-0.5 truncate text-12-regular text-text-weak">'),Ei=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate text-14-medium text-text-strong"></span></div><div class="mt-0.5 truncate font-mono text-11-regular text-text-weak"></div></div><div class="flex shrink-0 items-center gap-2">'),Pi=k('<li class="border-b border-border-weak-base last:border-b-0"><div class="group flex w-full min-w-0 items-center gap-3 px-4 py-3"><div class="min-w-0 flex-1"><div class="flex flex-wrap items-center gap-2"><span class="truncate font-mono text-13-medium text-text-strong"></span></div></div><div class="flex shrink-0 items-center gap-2">'),zi=k('<form class="flex flex-col gap-5 px-6 pt-0 pb-5"><div class="flex flex-col gap-4"><div class="flex flex-col gap-2"><label class="text-12-medium text-text-weak"></label><div class="flex gap-1.5"></div></div><div class="flex items-end gap-2"><div class="min-w-0 flex-1"></div></div></div><div class="flex justify-end gap-2 pt-1">'),ji=k("<button type=button>");const Ve=e=>e==="allow"||e==="ask"||e==="deny",ut=e=>!!e&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(Ve),Be=e=>e?typeof e=="string"?{"*":e}:{...e}:{},tt=(e,t)=>new RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(t),Fi=e=>Object.entries(Be(e)).flatMap(([t,i])=>Ve(i)?[{permission:t,pattern:"*",action:i}]:ut(i)?Object.entries(i).map(([u,l])=>({permission:t,pattern:u,action:l})):[]),rt=(e,t)=>Fi(e).slice().reverse().find(i=>tt(i.permission,"skill")&&tt(i.pattern,t))?.action??"allow",Ii=e=>{const t=Be(e).skill;return Ve(t)?{"*":t}:ut(t)?{...t}:{}},gt=e=>({paths:e.paths,urls:e.urls});function Li(e={}){const t=N(),i=re(),u=ne(),l=Fe(),a=ct(),p=Y(),o=()=>e.layout==="page",[d,f]=qe(()=>u.client.app.skills().then(c=>c.data??[]).catch(()=>[])),b=L(()=>{const c=d();return Array.isArray(c)?c.slice().sort((C,y)=>C.name.localeCompare(y.name)):[]}),m=L(()=>[...(i.data.config.skills?.paths??[]).map((c,C)=>({kind:"path",index:C,value:c})),...(i.data.config.skills?.urls??[]).map((c,C)=>({kind:"url",index:C,value:c}))]),S=L(()=>b().filter(c=>rt(i.data.config.permission,c.name)!=="deny").length),x=L(()=>!!a.isLocal()&&!!l.openPath),w=te(()=>({mutationFn:async c=>{const C=Be(i.data.config.permission),y=Ii(C);delete y[c.name],y[c.name]=c.enabled?"allow":"deny",delete C.skill,C.skill=y,await i.updateConfig({permission:C}),await u.client.global.dispose().catch(()=>{}),f.refetch()},onError:c=>{T({variant:"error",title:t.t("common.requestFailed"),description:c instanceof Error?c.message:String(c)})}})),h=te(()=>({mutationFn:async c=>{const C=(i.data.config.skills?.paths??[]).slice(),y=(i.data.config.skills?.urls??[]).slice();c.kind==="path"&&C.splice(c.index,1),c.kind==="url"&&y.splice(c.index,1),await i.updateConfig({skills:gt({paths:C,urls:y})}),await u.client.global.dispose().catch(()=>{}),f.refetch()},onSuccess:()=>{T({variant:"success",icon:"circle-check",title:t.t("skills.toast.sourceRemoved")})},onError:c=>{T({variant:"error",title:t.t("common.requestFailed"),description:c instanceof Error?c.message:String(c)})}})),s=c=>{p.show(()=>r(Ri,{entry:c,onSaved:()=>void f.refetch()}))},g=c=>{!l.openPath||!x()||l.openPath(c.location)};return[(()=>{var c=Ci();return n(c,r(F,{get when(){return!o()},get children(){var C=_i(),y=C.firstChild,$=y.nextSibling;return n(y,()=>t.t("skills.page.title")),n($,()=>t.t("skills.page.subtitle",{enabled:S(),total:b().length,sources:m().length})),C}}),null),n(c,r(M,{variant:"primary",size:"large",icon:"plus-small",onClick:()=>s(),get children(){return t.t("skills.page.addSource")}}),null),Q(C=>H(c,{"shrink-0 flex items-center gap-4":!0,"justify-between border-b border-border-weak-base pb-4":!o(),"justify-end":o()},C)),c})(),(()=>{var c=Ze(),C=c.firstChild;return n(C,()=>t.t("skills.section.sources")),n(c,r(F,{get when(){return m().length>0},get fallback(){return(()=>{var y=Si();return n(y,()=>t.t("skills.sources.empty")),y})()},get children(){var y=Ye();return n(y,r(Z,{get each(){return m()},children:$=>r(Oi,{source:$,onEdit:()=>s($),onRemove:()=>{window.confirm(t.t("skills.sources.confirm.remove",{source:$.value}))&&h.mutate($)}})})),y}}),null),c})(),(()=>{var c=Ze(),C=c.firstChild;return n(C,()=>t.t("skills.section.available")),n(c,r(F,{get when(){return!d.loading},get fallback(){return(()=>{var y=et();return n(y,()=>t.t("common.loading")),y})()},get children(){return r(F,{get when(){return b().length>0},get fallback(){return(()=>{var y=et();return n(y,()=>t.t("skills.page.empty")),y})()},get children(){var y=Ye();return n(y,r(Z,{get each(){return b()},children:$=>r(Mi,{skill:$,enabled:()=>rt(i.data.config.permission,$.name)!=="deny",toggling:()=>w.isPending&&w.variables?.name===$.name,canOpen:x,onToggle:v=>w.mutate({name:$.name,enabled:v}),onOpen:()=>g($)})})),y}})}}),null),c})()]}function Mi(e){const t=N(),i=()=>e.skill.location.replace(/\\/g,"/"),u=()=>{const l=i();return l.includes("/.claude/skills/")?t.t("skills.kind.claude"):l.includes("/.agents/skills/")?t.t("skills.kind.agents"):l.includes("/.codeplane/")?t.t("skills.kind.codeplane"):t.t("skills.kind.local")};return(()=>{var l=Ei(),a=l.firstChild,p=a.firstChild,o=p.firstChild,d=o.firstChild,f=o.nextSibling,b=p.nextSibling;return n(o,r(le,{name:"checklist",size:"small",class:"icon-strong-base shrink-0"}),d),n(d,()=>e.skill.name),n(o,r(ie,{get children(){return u()}}),null),n(o,r(F,{get when(){return!e.enabled()},get children(){return r(ie,{get children(){return t.t("skills.tag.disabled")}})}}),null),n(p,r(F,{get when(){return e.skill.description},get children(){var m=Di();return n(m,()=>e.skill.description),m}}),f),n(f,()=>e.skill.location),n(b,r(q,{get checked(){return e.enabled()},get disabled(){return e.toggling()},get onChange(){return e.onToggle},hideLabel:!0,get children(){return t.t("common.enabled")}}),null),n(b,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("skills.row.openFile")},get disabled(){return!e.canOpen()},get onClick(){return e.onOpen}}),null),l})()}function Oi(e){const t=N(),i=()=>e.source.kind==="path"?t.t("skills.source.path"):t.t("skills.source.url");return(()=>{var u=Pi(),l=u.firstChild,a=l.firstChild,p=a.firstChild,o=p.firstChild,d=a.nextSibling;return n(p,r(le,{get name(){return e.source.kind==="path"?"folder":"link"},size:"small",class:"icon-strong-base shrink-0"}),o),n(o,()=>e.source.value),n(p,r(ie,{get children(){return i()}}),null),n(d,r(X,{icon:"edit",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.edit")},get onClick(){return e.onEdit}}),null),n(d,r(X,{icon:"trash",variant:"ghost",size:"normal",get"aria-label"(){return t.t("common.delete")},get onClick(){return e.onRemove}}),null),u})()}function Ri(e){const t=N(),i=re(),u=ne(),l=Fe(),a=ct(),p=Y(),o=!!e.entry,[d,f]=pe({kind:e.entry?.kind??"path",value:e.entry?.value??"",errors:{}}),b=()=>d.kind==="path"&&!!l.openDirectoryPickerDialog&&a.isLocal(),m=()=>{const h=d.value.trim(),s={};return h||(s.value=t.t("skills.editor.error.value")),d.kind==="url"&&h&&!/^https?:\/\//i.test(h)&&(s.value=t.t("skills.editor.error.url")),f("errors",s),Object.keys(s).length===0},S=te(()=>({mutationFn:async()=>{if(!m())return;const h=(i.data.config.skills?.paths??[]).slice(),s=(i.data.config.skills?.urls??[]).slice();e.entry?.kind==="path"&&h.splice(e.entry.index,1),e.entry?.kind==="url"&&s.splice(e.entry.index,1);const g=d.kind==="path"?h:s;if(g.includes(d.value.trim())){f("errors","value",t.t("skills.editor.error.duplicate"));return}e.entry&&e.entry.kind===d.kind?g.splice(e.entry.index,0,d.value.trim()):g.push(d.value.trim()),await i.updateConfig({skills:gt({paths:h,urls:s})}),await u.client.global.dispose().catch(()=>{}),e.onSaved(),T({variant:"success",icon:"circle-check",title:o?t.t("skills.toast.sourceUpdated"):t.t("skills.toast.sourceAdded")}),p.close()},onError:h=>{T({variant:"error",title:t.t("common.requestFailed"),description:h instanceof Error?h.message:String(h)})}})),x=()=>{!b()||!l.openDirectoryPickerDialog||l.openDirectoryPickerDialog({title:t.t("skills.editor.browse.title")}).then(h=>{h&&f("value",Array.isArray(h)?h[0]??"":h)})},w=h=>{h.preventDefault(),!S.isPending&&S.mutate()};return r(ve,{get title(){return o?t.t("skills.editor.title.edit"):t.t("skills.editor.title.add")},class:"w-full max-w-[560px] mx-auto",fit:!0,get children(){var h=zi(),s=h.firstChild,g=s.firstChild,c=g.firstChild,C=c.nextSibling,y=g.nextSibling,$=y.firstChild,v=s.nextSibling;return h.addEventListener("submit",w),n(c,()=>t.t("skills.editor.type")),n(C,r(nt,{get active(){return d.kind==="path"},get label(){return t.t("skills.source.path")},onClick:()=>f("kind","path")}),null),n(C,r(nt,{get active(){return d.kind==="url"},get label(){return t.t("skills.source.url")},onClick:()=>f("kind","url")}),null),n($,r(R,{autofocus:!0,get label(){return A(()=>d.kind==="path")()?t.t("skills.editor.path"):t.t("skills.editor.url")},get description(){return A(()=>d.kind==="path")()?t.t("skills.editor.path.description"):t.t("skills.editor.url.description")},get placeholder(){return d.kind==="path"?"~/.codeplane/skills":"https://example.com/.well-known/skills/"},get value(){return d.value},onChange:z=>ae(()=>{f("value",z),f("errors","value",void 0)}),get error(){return d.errors.value},spellcheck:!1,class:"font-mono text-xs"})),n(y,r(F,{get when(){return b()},get children(){return r(M,{type:"button",variant:"secondary",size:"large",icon:"folder",onClick:x,get children(){return t.t("skills.editor.browse")}})}}),null),n(v,r(M,{type:"button",variant:"ghost",size:"large",onClick:()=>p.close(),get children(){return t.t("common.cancel")}}),null),n(v,r(M,{type:"submit",variant:"primary",size:"large",get disabled(){return S.isPending},get children(){return A(()=>!!S.isPending)()?t.t("common.saving"):t.t("common.save")}}),null),h}})}function nt(e){return(()=>{var t=ji();return at(t,"click",e.onClick,!0),n(t,()=>e.label),Q(i=>H(t,{"px-3 py-1.5 rounded-md text-12-medium transition-colors cursor-default border":!0,"border-icon-strong-base bg-surface-base-hover text-text-strong":e.active,"border-border-weak-base text-text-base hover:bg-surface-base-hover":!e.active},i)),t})()}je(["click"]);var Ui=k('<div class=size-full><div><div class="shrink-0 flex items-center justify-between gap-4 border-b border-border-weak-base pb-4"><div class=min-w-0><div class="text-20-medium text-text-strong truncate"></div><div class="text-12-regular text-text-weak">'),Ti=k('<div class="h-full min-h-[240px]">');const Ai={general:{component:kr},shortcuts:{component:Kr},providers:{component:an},modes:{component:bn},models:{component:Qn},mcp:{component:Ln},secrets:{component:$i},plugins:{component:gi},skills:{component:Li}};function Bi(){const e=N(),t=Rt(),i=lt(),u=L(()=>At(t.tab)),l=L(()=>Kt(u())),a=L(()=>Ai[u()]),p=L(()=>a().component);return Ut(()=>{t.tab&&t.tab!==u()&&i(Tt(u()),{replace:!0})}),(()=>{var o=Ui(),d=o.firstChild,f=d.firstChild,b=f.firstChild,m=b.firstChild,S=m.nextSibling;return n(m,()=>e.t(l().titleKey)),n(S,()=>e.t(l().descriptionKey)),n(d,r(qt,{get fallback(){return Ti()},get children(){return r(Nt,{get component(){return p()},layout:"page"})}}),null),Q(x=>{var w=!!a().contentScroll,h=!a().contentScroll,s={"mx-auto flex w-full max-w-3xl flex-col gap-6 px-6 py-8":!0,"h-full min-h-0":a().contentScroll,"min-h-full":!a().contentScroll};return w!==x.e&&o.classList.toggle("overflow-hidden",x.e=w),h!==x.t&&o.classList.toggle("overflow-y-auto",x.t=h),x.a=H(d,s,x.a),x},{e:void 0,t:void 0,a:void 0}),o})()}export{Bi as default};
|