@agentdocumentformat/cli 0.8.3 → 0.8.5
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/README.md +55 -4
- package/dist/adf.mjs +16 -13
- package/dist/chunks/{App-UHLJRFZJ.mjs → App-XOPHZTGN.mjs} +336 -296
- package/dist/chunks/{auth-manager-TBNKCJ45.mjs → auth-manager-2YHTYI3C.mjs} +2 -1
- package/dist/chunks/{build-QF5W473T.mjs → build-BFOCXM5S.mjs} +1 -1
- package/dist/chunks/{chunk-RHBGCOS3.mjs → chunk-22ZGZFOV.mjs} +5 -16
- package/dist/chunks/chunk-26RK7T5L.mjs +20 -0
- package/dist/chunks/{chunk-D7A77SNL.mjs → chunk-3FWPIWYM.mjs} +1 -1
- package/dist/chunks/chunk-4T745GJA.mjs +431 -0
- package/dist/chunks/{chunk-WPT3FAFX.mjs → chunk-7ADDKFT5.mjs} +3 -30
- package/dist/chunks/chunk-A53XYNJL.mjs +26 -0
- package/dist/chunks/{chunk-MZRXFWPQ.mjs → chunk-AN6USKYQ.mjs} +40 -8
- package/dist/chunks/{chunk-2Z7X3UUR.mjs → chunk-DHO5Z6HP.mjs} +14 -12
- package/dist/chunks/{chunk-F5ELW46V.mjs → chunk-GJYMGPH4.mjs} +1 -0
- package/dist/chunks/chunk-HONGRUAE.mjs +175 -0
- package/dist/chunks/{chunk-KCIRFUZH.mjs → chunk-IHARCBZH.mjs} +10 -3
- package/dist/chunks/{chunk-AEAJDCVK.mjs → chunk-IM5JKLXO.mjs} +1 -1
- package/dist/chunks/chunk-J2N63ZUD.mjs +12 -0
- package/dist/chunks/{chunk-FUQRYTGX.mjs → chunk-JK6K2BMV.mjs} +9 -35
- package/dist/chunks/{chunk-75DC5EWN.mjs → chunk-KBXC5EHK.mjs} +1 -0
- package/dist/chunks/chunk-NRTRTR7C.mjs +43 -0
- package/dist/chunks/{chunk-BS3USVEA.mjs → chunk-P4G5ZEBI.mjs} +1 -1
- package/dist/chunks/{chunk-E7LC6SHP.mjs → chunk-RIAB37IS.mjs} +4 -2
- package/dist/chunks/{chunk-LVF2DRBR.mjs → chunk-TBMQOM7Y.mjs} +247 -610
- package/dist/chunks/{chunk-SOSPQPEN.mjs → chunk-TDRQG5UO.mjs} +1 -162
- package/dist/chunks/{chunk-OHTB4UW4.mjs → chunk-TPA2ITKV.mjs} +32 -18
- package/dist/chunks/{chunk-BHY7QDCM.mjs → chunk-UBWWGUMU.mjs} +1 -0
- package/dist/chunks/{chunk-3AT7IIP7.mjs → chunk-WZ6S3SQP.mjs} +1 -1
- package/dist/chunks/chunk-X6R32YVE.mjs +43 -0
- package/dist/chunks/chunk-XJWGENZ5.mjs +5903 -0
- package/dist/chunks/{chunk-F3WSCAJD.mjs → chunk-XP4U4A2W.mjs} +1 -1
- package/dist/chunks/chunk-XS46KYYY.mjs +31 -0
- package/dist/chunks/{chunk-HBOFZRUS.mjs → chunk-XZQVDY3U.mjs} +9 -1
- package/dist/chunks/chunk-ZECGH3LT.mjs +88 -0
- package/dist/chunks/{claude-subscription-EB4LAAVV.mjs → claude-subscription-X5EVR3Q4.mjs} +4 -3
- package/dist/chunks/{cli-UVIJAGRZ.mjs → cli-JPRYEY4J.mjs} +22 -7
- package/dist/chunks/{commands-KOMPXJZS.mjs → commands-TZW2FSXG.mjs} +5 -2
- package/dist/chunks/context-AZOIJOUG.mjs +5933 -0
- package/dist/chunks/{daemon-YHD7PUQI.mjs → daemon-YRG2QUF4.mjs} +3362 -6724
- package/dist/chunks/{daemon-control-MKN7G5M3.mjs → daemon-control-U4OGCAAJ.mjs} +4 -4
- package/dist/chunks/{devtools-H7CI2ZVG.mjs → devtools-AUZWFIPL.mjs} +1 -1
- package/dist/chunks/firewall-service-7RGJN4LD.mjs +163 -0
- package/dist/chunks/{open-3OR6WT4T.mjs → open-T3VGLWGF.mjs} +6 -5
- package/dist/chunks/{pipeline-executor-DRYEEFDR.mjs → pipeline-executor-MHRI7ODL.mjs} +6 -3
- package/dist/chunks/{remote-access-cli-GLEEP7DI.mjs → remote-access-cli-EFVCXFOY.mjs} +22 -6
- package/dist/chunks/{store-D2WLXEY2.mjs → store-37YHXFJ6.mjs} +4 -3
- package/dist/chunks/{tui-ZEI2NAQV.mjs → tui-NJKGFAKU.mjs} +12 -11
- package/dist/chunks/web-F4XHDGUX.mjs +149 -0
- package/dist/chunks/{whatsapp-YJFFVN4Q.mjs → whatsapp-J7PX7TKT.mjs} +1 -1
- package/package.json +4 -3
- package/web/assets/EditorPanel-YXnanvaL.js +161 -0
- package/web/assets/MeshGraphView-BZV40eAE.css +1 -0
- package/web/assets/MeshGraphView-ChgwUT3O.js +23 -0
- package/web/assets/SettingsPage-BTu2-Yon.js +6 -0
- package/web/assets/agent-window-DlJbRHzy.js +3 -0
- package/web/assets/agent.store-CGzsE0VA.js +1 -0
- package/web/assets/app.store-hw-ZYpyz.js +1 -0
- package/web/assets/core-DVezgdzc.js +12 -0
- package/web/assets/css-Z72CF80r.js +1 -0
- package/web/assets/diff-D97Zzqfu.js +1 -0
- package/web/assets/document.store-BcN3UW-e.js +1 -0
- package/web/assets/edit-recovery-uWM2umPk.js +3 -0
- package/web/assets/engine-javascript-CuxHA8oH.js +141 -0
- package/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
- package/web/assets/github-light-DAi9KRSo.js +1 -0
- package/web/assets/go-C27-OAKa.js +1 -0
- package/web/assets/html-BlS82ilI.js +1 -0
- package/web/assets/index-B0BKR-7b.js +1 -0
- package/web/assets/index-Ba28S-D0.js +1 -0
- package/web/assets/index-BxmMf4oH.js +2 -0
- package/web/assets/index-BxrG4na5.js +1 -0
- package/web/assets/index-C0ujp8ua.js +1 -0
- package/web/assets/index-CBCcou8F.js +13 -0
- package/web/assets/index-CuTaWSEs.css +1 -0
- package/web/assets/index-Cuc6TCV0.js +1 -0
- package/web/assets/index-DlQ8IXY2.js +3 -0
- package/web/assets/index-Dms-d0wP.js +1 -0
- package/web/assets/index-LwIi-F1W.js +11 -0
- package/web/assets/index-mW7p_CTU.js +6 -0
- package/web/assets/inter-tight-cyrillic-ext-wght-italic-BJqtfpQe.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-ext-wght-normal-okcGN4Nq.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-wght-italic-HmhN1gQv.woff2 +0 -0
- package/web/assets/inter-tight-cyrillic-wght-normal-BS41q_Tv.woff2 +0 -0
- package/web/assets/inter-tight-greek-ext-wght-italic-B_3RbJza.woff2 +0 -0
- package/web/assets/inter-tight-greek-ext-wght-normal-DQgQPNk4.woff2 +0 -0
- package/web/assets/inter-tight-greek-wght-italic-Bb1BGCmL.woff2 +0 -0
- package/web/assets/inter-tight-greek-wght-normal-sS1B39LI.woff2 +0 -0
- package/web/assets/inter-tight-latin-ext-wght-italic-DYqsmiDd.woff2 +0 -0
- package/web/assets/inter-tight-latin-ext-wght-normal-B4u9PlvR.woff2 +0 -0
- package/web/assets/inter-tight-latin-wght-italic-DiXukCDG.woff2 +0 -0
- package/web/assets/inter-tight-latin-wght-normal-DX-nOvPD.woff2 +0 -0
- package/web/assets/inter-tight-vietnamese-wght-italic-CiVF0Juh.woff2 +0 -0
- package/web/assets/inter-tight-vietnamese-wght-normal-TKKdAiBA.woff2 +0 -0
- package/web/assets/javascript-wDzz0qaB.js +1 -0
- package/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/web/assets/json-Cp-IABpG.js +1 -0
- package/web/assets/jsx-g9-lgVsj.js +1 -0
- package/web/assets/main-CR7cfmOT.js +319 -0
- package/web/assets/main-Zf3qnQYd.css +1 -0
- package/web/assets/markdown-Cvjx9yec.js +1 -0
- package/web/assets/message-queue.store-BMjJTJTP.js +2 -0
- package/web/assets/module-RjUF93sV.js +716 -0
- package/web/assets/native-48B9X9Wg.js +1 -0
- package/web/assets/orbital-render.worker-BovOTauk.js +1 -0
- package/web/assets/python-B6aJPvgy.js +1 -0
- package/web/assets/react-wKFncLeZ.js +1 -0
- package/web/assets/rust-DPvrY3IQ.js +1 -0
- package/web/assets/shellscript-Yzrsuije.js +1 -0
- package/web/assets/sql-DkvoVjww.js +1 -0
- package/web/assets/stix-two-text-cyrillic-wght-italic-BzL1BdzR.woff2 +0 -0
- package/web/assets/stix-two-text-cyrillic-wght-normal-CcrOj1MU.woff2 +0 -0
- package/web/assets/stix-two-text-greek-wght-italic-glgrbyRu.woff2 +0 -0
- package/web/assets/stix-two-text-greek-wght-normal-DAdwyhkq.woff2 +0 -0
- package/web/assets/stix-two-text-latin-ext-wght-italic--XhV508b.woff2 +0 -0
- package/web/assets/stix-two-text-latin-ext-wght-normal-BUpo8gM0.woff2 +0 -0
- package/web/assets/stix-two-text-latin-wght-italic-BDl6bBME.woff2 +0 -0
- package/web/assets/stix-two-text-latin-wght-normal-BTZaHlTl.woff2 +0 -0
- package/web/assets/stix-two-text-vietnamese-wght-italic-B1jFRJrJ.woff2 +0 -0
- package/web/assets/stix-two-text-vietnamese-wght-normal-CfS0RdBA.woff2 +0 -0
- package/web/assets/tsx-COt5Ahok.js +1 -0
- package/web/assets/typescript-BPQ3VLAy.js +1 -0
- package/web/assets/window-kind-35FHmfEB.js +1 -0
- package/web/assets/with-selector-CBB0rjuB.js +1 -0
- package/web/assets/yaml-Buea-lGh.js +1 -0
- package/web/index.html +15 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as o,j as e,W as Mn,L as ra}from"./index-LwIi-F1W.js";import{y as We,z as ct,B as Ln,F as Ks,G as Jt,H as Xt,J as ea,K as ta,S as In,L as Dn,M as On,N as $n,O as Kn,P as nt,Q as Fn,U as Ya,V as gt,W as Bn,X as Ar,Y as Ia,Z as qn,T as qe,_ as zn,$ as Un,a0 as Hn,a1 as Vn,a2 as ja,a3 as na,a4 as Qa,a5 as ze,a6 as $,a7 as Zn,a8 as Wn,a9 as Da,aa as Gn,ab as Yn,ac as Qn,ad as Jn,ae as Xn,af as ei,ag as ti,ah as ai,ai as ps,aj as si,ak as Pt,al as Wt,am as ri,an as _r,ao as ms,ap as ni,aq as pt,w as Ft,ar as Nt,as as Se,at as ia,au as ii,av as fs,aw as oi,ax as Er,ay as oa,az as li,aA as ci,aB as Pr,aC as Bt,aD as Rr,aE as di,aF as ui,aG as hi,aH as Fs,aI as Bs,aJ as Tr,aK as pi,aL as qs,aM as mi,aN as fi,aO as xi,aP as gi,aQ as vi,aR as bi,aS as yi,aT as ji,aU as ki,aV as wi,aW as zs,aX as Ni,aY as Us,aZ as ba,a_ as Si,a$ as Ci,b0 as Oa,b1 as ht,b2 as Ai,b3 as _i,b4 as Ei,b5 as Pi,b6 as Hs,b7 as $a,b8 as Ri,b9 as Ti,ba as Mi,bb as Li}from"./main-CR7cfmOT.js";import{u as Ye,U as Ii,a as Di}from"./app.store-hw-ZYpyz.js";import{c as Oi}from"./react-wKFncLeZ.js";import{b as $i,c as Ki}from"./window-kind-35FHmfEB.js";import{a as Fi}from"./agent-window-DlJbRHzy.js";import"./document.store-BcN3UW-e.js";import"./agent.store-CGzsE0VA.js";import"./edit-recovery-uWM2umPk.js";import"./message-queue.store-BMjJTJTP.js";function Mt({value:a,options:t,onChange:s,ariaLabel:r,size:n="compact"}){const i=o.useRef([]),l=(d,h)=>{for(let f=1;f<=t.length;f+=1){const b=(d+h*f+t.length)%t.length;if(!t[b].disabled){s(t[b].value),i.current[b]?.focus();return}}},c=d=>{const h=t.map((b,C)=>C);d&&h.reverse();const f=h.find(b=>!t[b].disabled);f!==void 0&&(s(t[f].value),i.current[f]?.focus())};return e.jsx("div",{role:"radiogroup","aria-label":r,className:"inline-flex items-center gap-0.5 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] p-0.5",children:t.map((d,h)=>{const f=d.value===a;return e.jsx("button",{ref:b=>{i.current[h]=b},type:"button",role:"radio","aria-checked":f,tabIndex:f?0:-1,disabled:d.disabled,onClick:()=>s(d.value),onKeyDown:b=>{b.key==="ArrowRight"||b.key==="ArrowDown"?(b.preventDefault(),l(h,1)):b.key==="ArrowLeft"||b.key==="ArrowUp"?(b.preventDefault(),l(h,-1)):(b.key==="Home"||b.key==="End")&&(b.preventDefault(),c(b.key==="End"))},className:`min-w-14 rounded-[calc(var(--adf-ui-control-radius)-2px)] px-2.5 text-[12px] font-medium outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)] disabled:opacity-45 ${n==="compact"?"h-6":"h-7"} ${f?"bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)] shadow-[inset_0_0_0_1px_var(--adf-ui-focus)]":"text-[var(--adf-ui-text-muted)] hover:bg-[var(--adf-ui-surface-hover)] hover:text-[var(--adf-ui-text)]"}`,children:d.label},d.value)})})}function Re({title:a,description:t,children:s,className:r="",docs:n,hint:i}){return e.jsxs("section",{className:`overflow-hidden rounded-[var(--adf-ui-container-radius)] border border-hairline bg-[var(--adf-ui-surface)] ${r}`,children:[(a||t)&&e.jsxs("div",{className:"px-4 pt-3.5 pb-2.5",children:[a&&e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("h2",{className:"text-[13px] font-semibold text-[var(--adf-ui-text)]",children:[a,i&&e.jsx(We,{tip:i})]}),n&&e.jsx(ct,{href:n})]}),t&&e.jsx("p",{className:"mt-0.5 text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:t})]}),s]})}function ce({label:a,description:t,children:s,separator:r=!1,stacked:n=!1,disabled:i=!1,help:l,error:c,className:d=""}){return e.jsxs("div",{className:`${r?"border-t border-[var(--adf-ui-separator)]":""} px-4 py-3 ${i?"opacity-60":""} ${d}`,children:[e.jsxs("div",{className:n?"space-y-2":"flex flex-col gap-2 min-[900px]:flex-row min-[900px]:items-center min-[900px]:justify-between min-[900px]:gap-6",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:a}),t&&e.jsx("div",{className:"mt-0.5 text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:t})]}),s&&e.jsx("div",{className:n?"":"shrink-0",children:s})]}),l&&e.jsx("div",{className:"mt-1.5 text-[11px] text-[var(--adf-ui-text-subtle)]",children:l}),c&&e.jsx("div",{className:"mt-1.5 text-[11px] text-[var(--adf-ui-danger)]",children:c})]})}function rt({checked:a,onChange:t,label:s,disabled:r=!1,hideState:n=!1}){return e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":a,"aria-label":s,disabled:r,onClick:()=>t(!a),className:`relative inline-flex h-[18px] w-8 shrink-0 items-center rounded-full outline-none transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)] disabled:cursor-not-allowed disabled:opacity-50 ${a?"bg-[var(--adf-ui-accent)]":"bg-[var(--adf-ui-border)]"}`,children:e.jsx("span",{"aria-hidden":"true",className:`inline-block size-3.5 rounded-full bg-white shadow transition-transform duration-150 ${a?"translate-x-[16px]":"translate-x-[2px]"}`})}),!n&&e.jsx("span",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:a?"On":"Off"})]})}const Bi="#18BFFF",qi=o.forwardRef(function({title:t="Airtable",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Bi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M11.992 1.966c-.434 0-.87.086-1.28.257L1.779 5.917c-.503.208-.49.908.012 1.116l8.982 3.558a3.266 3.266 0 0 0 2.454 0l8.982-3.558c.503-.196.503-.908.012-1.116l-8.957-3.694a3.255 3.255 0 0 0-1.272-.257zM23.4 8.056a.589.589 0 0 0-.222.045l-10.012 3.877a.612.612 0 0 0-.38.564v8.896a.6.6 0 0 0 .821.552L23.62 18.1a.583.583 0 0 0 .38-.551V8.653a.6.6 0 0 0-.6-.596zM.676 8.095a.644.644 0 0 0-.48.19C.086 8.396 0 8.53 0 8.69v8.355c0 .442.515.737.908.54l6.27-3.006.307-.147 2.969-1.436c.466-.22.43-.908-.061-1.092L.883 8.138a.57.57 0 0 0-.207-.044z"})]})}),zi="#B31B1B",Ui=o.forwardRef(function({title:t="arXiv",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=zi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M3.8423 0a1.0037 1.0037 0 0 0-.922.6078c-.1536.3687-.0438.6275.2938 1.1113l6.9185 8.3597-1.0223 1.1058a1.0393 1.0393 0 0 0 .003 1.4229l1.2292 1.3135-5.4391 6.4444c-.2803.299-.4538.823-.2971 1.1986a1.0253 1.0253 0 0 0 .9585.635.9133.9133 0 0 0 .6891-.3405l5.783-6.126 7.4902 8.0051a.8527.8527 0 0 0 .6835.2597.9575.9575 0 0 0 .8777-.6138c.1577-.377-.017-.7502-.306-1.1407l-7.0518-8.3418 1.0632-1.13a.9626.9626 0 0 0 .0089-1.3165L4.6336.4639s-.3733-.4535-.768-.463zm0 .272h.0166c.2179.0052.4874.2715.5644.3639l.005.006.0052.0055 10.169 10.9905a.6915.6915 0 0 1-.0072.945l-1.0666 1.133-1.4982-1.7724-8.5994-10.39c-.3286-.472-.352-.6183-.2592-.841a.7307.7307 0 0 1 .6704-.4401Zm14.341 1.5701a.877.877 0 0 0-.6554.2418l-5.6962 6.1584 1.6944 1.8319 5.3089-6.5138c.3251-.4335.479-.6603.3247-1.0292a1.1205 1.1205 0 0 0-.9763-.689zm-7.6557 12.2823 1.3186 1.4135-5.7864 6.1295a.6494.6494 0 0 1-.4959.26.7516.7516 0 0 1-.706-.4669c-.1119-.2682.0359-.6864.2442-.9083l.0051-.0055.0047-.0055z"})]})}),Hi="#0052CC",Vi=o.forwardRef(function({title:t="Atlassian",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Hi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M7.12 11.084a.683.683 0 00-1.16.126L.075 22.974a.703.703 0 00.63 1.018h8.19a.678.678 0 00.63-.39c1.767-3.65.696-9.203-2.406-12.52zM11.434.386a15.515 15.515 0 00-.906 15.317l3.95 7.9a.703.703 0 00.628.388h8.19a.703.703 0 00.63-1.017L12.63.38a.664.664 0 00-1.196.006z"})]})}),Zi="#E87D0D",Wi=o.forwardRef(function({title:t="Blender",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Zi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12.51 13.214c.046-.8.438-1.506 1.03-2.006a3.424 3.424 0 0 1 2.212-.79c.85 0 1.631.3 2.211.79.592.5.983 1.206 1.028 2.005.045.823-.285 1.586-.865 2.153a3.389 3.389 0 0 1-2.374.938 3.393 3.393 0 0 1-2.376-.938c-.58-.567-.91-1.33-.865-2.152M7.35 14.831c.006.314.106.922.256 1.398a7.372 7.372 0 0 0 1.593 2.757 8.227 8.227 0 0 0 2.787 2.001 8.947 8.947 0 0 0 3.66.76 8.964 8.964 0 0 0 3.657-.772 8.285 8.285 0 0 0 2.785-2.01 7.428 7.428 0 0 0 1.592-2.762 6.964 6.964 0 0 0 .25-3.074 7.123 7.123 0 0 0-1.016-2.779 7.764 7.764 0 0 0-1.852-2.043h.002L13.566 2.55l-.02-.015c-.492-.378-1.319-.376-1.86.002-.547.382-.609 1.015-.123 1.415l-.001.001 3.126 2.543-9.53.01h-.013c-.788.001-1.545.518-1.695 1.172-.154.665.38 1.217 1.2 1.22V8.9l4.83-.01-8.62 6.617-.034.025c-.813.622-1.075 1.658-.563 2.313.52.667 1.625.668 2.447.004L7.414 14s-.069.52-.063.831zm12.09 1.741c-.97.988-2.326 1.548-3.795 1.55-1.47.004-2.827-.552-3.797-1.538a4.51 4.51 0 0 1-1.036-1.622 4.282 4.282 0 0 1 .282-3.519 4.702 4.702 0 0 1 1.153-1.371c.942-.768 2.141-1.183 3.396-1.185 1.256-.002 2.455.41 3.398 1.175.48.391.87.854 1.152 1.367a4.28 4.28 0 0 1 .522 1.706 4.236 4.236 0 0 1-.239 1.811 4.54 4.54 0 0 1-1.035 1.626"})]})}),Gi="#FB542B",Yi=o.forwardRef(function({title:t="Brave",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Gi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M15.68 0l2.096 2.38s1.84-.512 2.709.358c.868.87 1.584 1.638 1.584 1.638l-.562 1.381.715 2.047s-2.104 7.98-2.35 8.955c-.486 1.919-.818 2.66-2.198 3.633-1.38.972-3.884 2.66-4.293 2.916-.409.256-.92.692-1.38.692-.46 0-.97-.436-1.38-.692a185.796 185.796 0 01-4.293-2.916c-1.38-.973-1.712-1.714-2.197-3.633-.247-.975-2.351-8.955-2.351-8.955l.715-2.047-.562-1.381s.716-.768 1.585-1.638c.868-.87 2.708-.358 2.708-.358L8.321 0h7.36zm-3.679 14.936c-.14 0-1.038.317-1.758.69-.72.373-1.242.637-1.409.742-.167.104-.065.301.087.409.152.107 2.194 1.69 2.393 1.866.198.175.489.464.687.464.198 0 .49-.29.688-.464.198-.175 2.24-1.759 2.392-1.866.152-.108.254-.305.087-.41-.167-.104-.689-.368-1.41-.741-.72-.373-1.617-.69-1.757-.69zm0-11.278s-.409.001-1.022.206-1.278.46-1.584.46c-.307 0-2.581-.434-2.581-.434S4.119 7.152 4.119 7.849c0 .697.339.881.68 1.243l2.02 2.149c.192.203.59.511.356 1.066-.235.555-.58 1.26-.196 1.977.384.716 1.042 1.194 1.464 1.115.421-.08 1.412-.598 1.776-.834.364-.237 1.518-1.19 1.518-1.554 0-.365-1.193-1.02-1.413-1.168-.22-.15-1.226-.725-1.247-.95-.02-.227-.012-.293.284-.851.297-.559.831-1.304.742-1.8-.089-.495-.95-.753-1.565-.986-.615-.232-1.799-.671-1.947-.74-.148-.068-.11-.133.339-.175.448-.043 1.719-.212 2.292-.052.573.16 1.552.403 1.632.532.079.13.149.134.067.579-.081.445-.5 2.581-.541 2.96-.04.38-.12.63.288.724.409.094 1.097.256 1.333.256s.924-.162 1.333-.256c.408-.093.329-.344.288-.723-.04-.38-.46-2.516-.541-2.961-.082-.445-.012-.45.067-.579.08-.129 1.059-.372 1.632-.532.573-.16 1.845.009 2.292.052.449.042.487.107.339.175-.148.069-1.332.508-1.947.74-.615.233-1.476.49-1.565.986-.09.496.445 1.241.742 1.8.297.558.304.624.284.85-.02.226-1.026.802-1.247.95-.22.15-1.413.804-1.413 1.169 0 .364 1.154 1.317 1.518 1.554.364.236 1.355.755 1.776.834.422.079 1.08-.4 1.464-1.115.384-.716.039-1.422-.195-1.977-.235-.555.163-.863.355-1.066l2.02-2.149c.341-.362.68-.546.68-1.243 0-.697-2.695-3.96-2.695-3.96s-2.274.436-2.58.436c-.307 0-.972-.256-1.585-.461-.613-.205-1.022-.206-1.022-.206z"})]})}),Qi="#292929",Ji=o.forwardRef(function({title:t="Cal.com",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Qi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M2.408 14.488C1.035 14.488 0 13.4 0 12.058c0-1.346.982-2.443 2.408-2.443.758 0 1.282.233 1.691.765l-.66.55a1.343 1.343 0 0 0-1.03-.442c-.93 0-1.44.711-1.44 1.57 0 .86.559 1.557 1.44 1.557.413 0 .765-.147 1.043-.443l.651.573c-.391.51-.929.743-1.695.743zM6.948 10.913h.89v3.49h-.89v-.51c-.185.362-.493.604-1.083.604-.943 0-1.695-.82-1.695-1.826 0-1.007.752-1.825 1.695-1.825.585 0 .898.241 1.083.604zm.026 1.758c0-.546-.374-.998-.964-.998-.568 0-.938.457-.938.998 0 .528.37.998.938.998.586 0 .964-.456.964-.998zM8.467 9.503h.89v4.895h-.89zM9.752 13.937a.53.53 0 0 1 .542-.528c.313 0 .533.242.533.528a.527.527 0 0 1-.533.537.534.534 0 0 1-.542-.537zM14.23 13.839c-.33.403-.832.658-1.426.658a1.806 1.806 0 0 1-1.84-1.826c0-1.007.778-1.825 1.84-1.825.572 0 1.07.241 1.4.622l-.687.577c-.172-.215-.396-.376-.713-.376-.568 0-.938.456-.938.998 0 .541.37.997.938.997.343 0 .58-.179.757-.42zM14.305 12.671c0-1.007.78-1.825 1.84-1.825 1.061 0 1.84.818 1.84 1.825 0 1.007-.779 1.826-1.84 1.826-1.06-.005-1.84-.82-1.84-1.826zm2.778 0c0-.546-.37-.998-.938-.998-.568-.004-.937.452-.937.998 0 .542.37.998.937.998.568 0 .938-.456.938-.998zM24 12.269v2.13h-.89v-1.911c0-.604-.281-.864-.704-.864-.396 0-.678.197-.678.864v1.91h-.89v-1.91c0-.604-.285-.864-.704-.864-.396 0-.744.197-.744.864v1.91h-.89v-3.49h.89v.484c.185-.376.52-.564 1.035-.564.489 0 .898.241 1.123.649.224-.417.554-.65 1.153-.65.731.005 1.299.56 1.299 1.442z"})]})}),Xi="#FFCC01",eo=o.forwardRef(function({title:t="ClickHouse",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Xi),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M21.333 10H24v4h-2.667ZM16 1.335h2.667v21.33H16Zm-5.333 0h2.666v21.33h-2.666ZM0 22.665V1.335h2.667v21.33zm5.333-21.33H8v21.33H5.333Z"})]})}),to="#2496ED",ao=o.forwardRef(function({title:t="Docker",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=to),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M13.983 11.078h2.119a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.119a.185.185 0 00-.185.185v1.888c0 .102.083.185.185.185m-2.954-5.43h2.118a.186.186 0 00.186-.186V3.574a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m0 2.716h2.118a.187.187 0 00.186-.186V6.29a.186.186 0 00-.186-.185h-2.118a.185.185 0 00-.185.185v1.887c0 .102.082.185.185.186m-2.93 0h2.12a.186.186 0 00.184-.186V6.29a.185.185 0 00-.185-.185H8.1a.185.185 0 00-.185.185v1.887c0 .102.083.185.185.186m-2.964 0h2.119a.186.186 0 00.185-.186V6.29a.185.185 0 00-.185-.185H5.136a.186.186 0 00-.186.185v1.887c0 .102.084.185.186.186m5.893 2.715h2.118a.186.186 0 00.186-.185V9.006a.186.186 0 00-.186-.186h-2.118a.185.185 0 00-.185.185v1.888c0 .102.082.185.185.185m-2.93 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.083.185.185.185m-2.964 0h2.119a.185.185 0 00.185-.185V9.006a.185.185 0 00-.184-.186h-2.12a.186.186 0 00-.186.186v1.887c0 .102.084.185.186.185m-2.92 0h2.12a.185.185 0 00.184-.185V9.006a.185.185 0 00-.184-.186h-2.12a.185.185 0 00-.184.185v1.888c0 .102.082.185.185.185M23.763 9.89c-.065-.051-.672-.51-1.954-.51-.338.001-.676.03-1.01.087-.248-1.7-1.653-2.53-1.716-2.566l-.344-.199-.226.327c-.284.438-.49.922-.612 1.43-.23.97-.09 1.882.403 2.661-.595.332-1.55.413-1.744.42H.751a.751.751 0 00-.75.748 11.376 11.376 0 00.692 4.062c.545 1.428 1.355 2.48 2.41 3.124 1.18.723 3.1 1.137 5.275 1.137.983.003 1.963-.086 2.93-.266a12.248 12.248 0 003.823-1.389c.98-.567 1.86-1.288 2.61-2.136 1.252-1.418 1.998-2.997 2.553-4.4h.221c1.372 0 2.215-.549 2.68-1.009.309-.293.55-.65.707-1.046l.098-.288Z"})]})}),so="#FFF000",ro=o.forwardRef(function({title:t="DuckDB",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=so),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12 0C5.363 0 0 5.363 0 12s5.363 12 12 12 12-5.363 12-12S18.637 0 12 0zM9.502 7.03a4.974 4.974 0 0 1 4.97 4.97 4.974 4.974 0 0 1-4.97 4.97A4.974 4.974 0 0 1 4.532 12a4.974 4.974 0 0 1 4.97-4.97zm6.563 3.183h2.351c.98 0 1.787.782 1.787 1.762s-.807 1.789-1.787 1.789h-2.351v-3.551z"})]})}),no="#DE5833",io=o.forwardRef(function({title:t="DuckDuckGo",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=no),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12s5.37 12 12 12 12-5.37 12-12S18.63 0 12 0zm0 .984C18.083.984 23.016 5.916 23.016 12S18.084 23.016 12 23.016.984 18.084.984 12C.984 5.917 5.916.984 12 .984zm0 .938C6.434 1.922 1.922 6.434 1.922 12c0 4.437 2.867 8.205 6.85 9.55-.237-.82-.776-2.753-1.6-6.052-1.184-4.741-2.064-8.606 2.379-9.813.047-.011.064-.064.03-.093-.514-.467-1.382-.548-2.233-.38a.06.06 0 0 1-.07-.058c0-.011 0-.023.011-.035.205-.286.572-.507.822-.64a1.843 1.843 0 0 0-.607-.335c-.059-.022-.059-.12-.006-.144.006-.006.012-.012.024-.012 1.749-.233 3.586.292 4.49 1.448.011.011.023.017.035.023 2.968.635 3.509 4.837 3.328 5.998a9.607 9.607 0 0 0 2.346-.576c.746-.286 1.008-.222 1.101-.053.1.193-.018.513-.28.81-.496.567-1.393 1.01-2.974 1.137-.546.044-1.029.024-1.445.006-.789-.035-1.339-.059-1.633.39-.192.298-.041.998 1.487 1.22 1.09.157 2.078.047 2.798-.034.643-.07 1.073-.118 1.172.069.21.402-.996 1.207-3.066 1.224-.158 0-.315-.006-.467-.011-1.283-.065-2.227-.414-2.816-.735a.094.094 0 0 1-.035-.017c-.105-.059-.31.045-.188.267.07.134.444.478 1.004.776-.058.466.087 1.184.338 2l.088-.016c.041-.009.087-.019.134-.025.507-.082.775.012.926.175.717-.536 1.913-1.294 2.03-1.154.583.694.66 2.332.53 2.99-.004.012-.017.024-.04.035-.274.117-1.783-.296-1.783-.511-.059-1.075-.26-1.173-.493-1.225h-.156c.006.006.012.018.018.03l.052.12c.093.257.24 1.063.13 1.26-.112.199-.835.297-1.284.303-.443.006-.543-.158-.637-.408-.07-.204-.103-.675-.103-.95a.857.857 0 0 1 .012-.216c-.134.058-.333.193-.397.281-.017.262-.017.682.123 1.149.07.221-1.518 1.164-1.74.99-.227-.181-.634-1.952-.459-2.67-.187.017-.338.075-.42.191-.367.508.093 2.933.582 3.248.257.169 1.54-.553 2.176-1.095.105.145.305.158.553.158.326-.012.782-.06 1.103-.158.192.45.423.972.613 1.388 4.47-1.032 7.803-5.037 7.803-9.82 0-5.566-4.512-10.078-10.078-10.078zm1.791 5.646c-.42 0-.678.146-.795.332-.023.047.047.094.094.07.14-.075.357-.161.701-.156.328.006.516.09.67.159l.023.01c.041.017.088-.03.059-.065-.134-.18-.332-.35-.752-.35zm-5.078.198a1.24 1.24 0 0 0-.522.082c-.454.169-.67.526-.67.76 0 .051.112.057.141.011.081-.123.21-.31.617-.478.408-.17.73-.146.951-.094.047.012.083-.041.041-.07a.989.989 0 0 0-.558-.211zm5.434 1.423a.651.651 0 0 0-.655.647.652.652 0 0 0 1.307 0 .646.646 0 0 0-.652-.647zm.283.262h.008a.17.17 0 0 1 .17.17c0 .093-.077.17-.17.17a.17.17 0 0 1-.17-.17c0-.09.072-.165.162-.17zm-5.358.076a.752.752 0 0 0-.758.758c0 .42.338.758.758.758s.758-.337.758-.758a.756.756 0 0 0-.758-.758zm.328.303h.01c.112 0 .2.089.2.2 0 .11-.088.197-.2.197a.195.195 0 0 1-.197-.198c0-.107.082-.194.187-.199z"})]})}),oo="#000000",lo=o.forwardRef(function({title:t="ElevenLabs",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=oo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M4.6035 0v24h4.9317V0zm9.8613 0v24h4.9317V0z"})]})}),co="#181717",uo=o.forwardRef(function({title:t="GitHub",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=co),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]})}),ho="#FC6D26",po=o.forwardRef(function({title:t="GitLab",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=ho),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"m23.6004 9.5927-.0337-.0862L20.3.9814a.851.851 0 0 0-.3362-.405.8748.8748 0 0 0-.9997.0539.8748.8748 0 0 0-.29.4399l-2.2055 6.748H7.5375l-2.2057-6.748a.8573.8573 0 0 0-.29-.4412.8748.8748 0 0 0-.9997-.0537.8585.8585 0 0 0-.3362.4049L.4332 9.5015l-.0325.0862a6.0657 6.0657 0 0 0 2.0119 7.0105l.0113.0087.03.0213 4.976 3.7264 2.462 1.8633 1.4995 1.1321a1.0085 1.0085 0 0 0 1.2197 0l1.4995-1.1321 2.4619-1.8633 5.006-3.7489.0125-.01a6.0682 6.0682 0 0 0 2.0094-7.003z"})]})}),mo="#EA4335",fo=o.forwardRef(function({title:t="Gmail",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=mo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z"})]})}),xo="#4285F4",go=o.forwardRef(function({title:t="Google Calendar",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=xo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M18.316 5.684H24v12.632h-5.684V5.684zM5.684 24h12.632v-5.684H5.684V24zM18.316 5.684V0H1.895A1.894 1.894 0 0 0 0 1.895v16.421h5.684V5.684h12.632zm-7.207 6.25v-.065c.272-.144.5-.349.687-.617s.279-.595.279-.982c0-.379-.099-.72-.3-1.025a2.05 2.05 0 0 0-.832-.714 2.703 2.703 0 0 0-1.197-.257c-.6 0-1.094.156-1.481.467-.386.311-.65.671-.793 1.078l1.085.452c.086-.249.224-.461.413-.633.189-.172.445-.257.767-.257.33 0 .602.088.816.264a.86.86 0 0 1 .322.703c0 .33-.12.589-.36.778-.24.19-.535.284-.886.284h-.567v1.085h.633c.407 0 .748.109 1.02.327.272.218.407.499.407.843 0 .336-.129.614-.387.832s-.565.327-.924.327c-.351 0-.651-.103-.897-.311-.248-.208-.422-.502-.521-.881l-1.096.452c.178.616.505 1.082.977 1.401.472.319.984.478 1.538.477a2.84 2.84 0 0 0 1.293-.291c.382-.193.684-.458.902-.794.218-.336.327-.72.327-1.149 0-.429-.115-.797-.344-1.105a2.067 2.067 0 0 0-.881-.689zm2.093-1.931l.602.913L15 10.045v5.744h1.187V8.446h-.827l-2.158 1.557zM22.105 0h-3.289v5.184H24V1.895A1.894 1.894 0 0 0 22.105 0zm-3.289 23.5l4.684-4.684h-4.684V23.5zM0 22.105C0 23.152.848 24 1.895 24h3.289v-5.184H0v3.289z"})]})}),vo="#4285F4",bo=o.forwardRef(function({title:t="Google Chrome",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=vo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12 0C8.21 0 4.831 1.757 2.632 4.501l3.953 6.848A5.454 5.454 0 0 1 12 6.545h10.691A12 12 0 0 0 12 0zM1.931 5.47A11.943 11.943 0 0 0 0 12c0 6.012 4.42 10.991 10.189 11.864l3.953-6.847a5.45 5.45 0 0 1-6.865-2.29zm13.342 2.166a5.446 5.446 0 0 1 1.45 7.09l.002.001h-.002l-5.344 9.257c.206.01.413.016.621.016 6.627 0 12-5.373 12-12 0-1.54-.29-3.011-.818-4.364zM12 16.364a4.364 4.364 0 1 1 0-8.728 4.364 4.364 0 0 1 0 8.728Z"})]})}),yo="#4285F4",jo=o.forwardRef(function({title:t="Google Docs",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=yo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M14.727 6.727H14V0H4.91c-.905 0-1.637.732-1.637 1.636v20.728c0 .904.732 1.636 1.636 1.636h14.182c.904 0 1.636-.732 1.636-1.636V6.727h-6zm-.545 10.455H7.09v-1.364h7.09v1.364zm2.727-3.273H7.091v-1.364h9.818v1.364zm0-3.273H7.091V9.273h9.818v1.363zM14.727 6h6l-6-6v6z"})]})}),ko="#4285F4",wo=o.forwardRef(function({title:t="Google Drive",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=ko),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12.01 1.485c-2.082 0-3.754.02-3.743.047.01.02 1.708 3.001 3.774 6.62l3.76 6.574h3.76c2.081 0 3.753-.02 3.742-.047-.005-.02-1.708-3.001-3.775-6.62l-3.76-6.574zm-4.76 1.73a789.828 789.861 0 0 0-3.63 6.319L0 15.868l1.89 3.298 1.885 3.297 3.62-6.335 3.618-6.33-1.88-3.287C8.1 4.704 7.255 3.22 7.25 3.214zm2.259 12.653-.203.348c-.114.198-.96 1.672-1.88 3.287a423.93 423.948 0 0 1-1.698 2.97c-.01.026 3.24.042 7.222.042h7.244l1.796-3.157c.992-1.734 1.85-3.23 1.906-3.323l.104-.167h-7.249z"})]})}),No="#34A853",So=o.forwardRef(function({title:t="Google Sheets",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=No),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M11.318 12.545H7.91v-1.909h3.41v1.91zM14.728 0v6h6l-6-6zm1.363 10.636h-3.41v1.91h3.41v-1.91zm0 3.273h-3.41v1.91h3.41v-1.91zM20.727 6.5v15.864c0 .904-.732 1.636-1.636 1.636H4.909a1.636 1.636 0 0 1-1.636-1.636V1.636C3.273.732 4.005 0 4.909 0h9.318v6.5h6.5zm-3.273 2.773H6.545v7.909h10.91v-7.91zm-6.136 4.636H7.91v1.91h3.41v-1.91z"})]})}),Co="#F46800",Ao=o.forwardRef(function({title:t="Grafana",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Co),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M23.02 10.59a8.578 8.578 0 0 0-.862-3.034 8.911 8.911 0 0 0-1.789-2.445c.337-1.342-.413-2.505-.413-2.505-1.292-.08-2.113.4-2.416.62-.052-.02-.102-.044-.154-.064-.22-.089-.446-.172-.677-.247-.231-.073-.47-.14-.711-.197a9.867 9.867 0 0 0-.875-.161C14.557.753 12.94 0 12.94 0c-1.804 1.145-2.147 2.744-2.147 2.744l-.018.093c-.098.029-.2.057-.298.088-.138.042-.275.094-.413.143-.138.055-.275.107-.41.166a8.869 8.869 0 0 0-1.557.87l-.063-.029c-2.497-.955-4.716.195-4.716.195-.203 2.658.996 4.33 1.235 4.636a11.608 11.608 0 0 0-.607 2.635C1.636 12.677.953 15.014.953 15.014c1.926 2.214 4.171 2.351 4.171 2.351.003-.002.006-.002.006-.005.285.509.615.994.986 1.446.156.19.32.371.488.548-.704 2.009.099 3.68.099 3.68 2.144.08 3.553-.937 3.849-1.173a9.784 9.784 0 0 0 3.164.501h.08l.055-.003.107-.002.103-.005.003.002c1.01 1.44 2.788 1.646 2.788 1.646 1.264-1.332 1.337-2.653 1.337-2.94v-.058c0-.02-.003-.039-.003-.06.265-.187.52-.387.758-.6a7.875 7.875 0 0 0 1.415-1.7c1.43.083 2.437-.885 2.437-.885-.236-1.49-1.085-2.216-1.264-2.354l-.018-.013-.016-.013a.217.217 0 0 1-.031-.02c.008-.092.016-.18.02-.27.011-.162.016-.323.016-.48v-.253l-.005-.098-.008-.135a1.891 1.891 0 0 0-.01-.13c-.003-.042-.008-.083-.013-.125l-.016-.124-.018-.122a6.215 6.215 0 0 0-2.032-3.73 6.015 6.015 0 0 0-3.222-1.46 6.292 6.292 0 0 0-.85-.048l-.107.002h-.063l-.044.003-.104.008a4.777 4.777 0 0 0-3.335 1.695c-.332.4-.592.84-.768 1.297a4.594 4.594 0 0 0-.312 1.817l.003.091c.005.055.007.11.013.164a3.615 3.615 0 0 0 .698 1.82 3.53 3.53 0 0 0 1.827 1.282c.33.098.66.14.971.137.039 0 .078 0 .114-.002l.063-.003c.02 0 .041-.003.062-.003.034-.002.065-.007.099-.01.007 0 .018-.003.028-.003l.031-.005.06-.008a1.18 1.18 0 0 0 .112-.02c.036-.008.072-.013.109-.024a2.634 2.634 0 0 0 .914-.415c.028-.02.056-.041.085-.065a.248.248 0 0 0 .039-.35.244.244 0 0 0-.309-.06l-.078.042c-.09.044-.184.083-.283.116a2.476 2.476 0 0 1-.475.096c-.028.003-.054.006-.083.006l-.083.002c-.026 0-.054 0-.08-.002l-.102-.006h-.012l-.024.006c-.016-.003-.031-.003-.044-.006-.031-.002-.06-.007-.091-.01a2.59 2.59 0 0 1-.724-.213 2.557 2.557 0 0 1-.667-.438 2.52 2.52 0 0 1-.805-1.475 2.306 2.306 0 0 1-.029-.444l.006-.122v-.023l.002-.031c.003-.021.003-.04.005-.06a3.163 3.163 0 0 1 1.352-2.29 3.12 3.12 0 0 1 .937-.43 2.946 2.946 0 0 1 .776-.101h.06l.07.002.045.003h.026l.07.005a4.041 4.041 0 0 1 1.635.49 3.94 3.94 0 0 1 1.602 1.662 3.77 3.77 0 0 1 .397 1.414l.005.076.003.075c.002.026.002.05.002.075 0 .024.003.052 0 .07v.065l-.002.073-.008.174a6.195 6.195 0 0 1-.08.639 5.1 5.1 0 0 1-.267.927 5.31 5.31 0 0 1-.624 1.13 5.052 5.052 0 0 1-3.237 2.014 4.82 4.82 0 0 1-.649.066l-.039.003h-.287a6.607 6.607 0 0 1-1.716-.265 6.776 6.776 0 0 1-3.4-2.274 6.75 6.75 0 0 1-.746-1.15 6.616 6.616 0 0 1-.714-2.596l-.005-.083-.002-.02v-.056l-.003-.073v-.096l-.003-.104v-.07l.003-.163c.008-.22.026-.45.054-.678a8.707 8.707 0 0 1 .28-1.355c.128-.444.286-.872.473-1.277a7.04 7.04 0 0 1 1.456-2.1 5.925 5.925 0 0 1 .953-.763c.169-.111.343-.213.524-.306.089-.05.182-.091.273-.135.047-.02.093-.042.138-.062a7.177 7.177 0 0 1 .714-.267l.145-.045c.049-.015.098-.026.148-.041.098-.029.197-.052.296-.076.049-.013.1-.02.15-.033l.15-.032.151-.028.076-.013.075-.01.153-.024c.057-.01.114-.013.171-.023l.169-.021c.036-.003.073-.008.106-.01l.073-.008.036-.003.042-.002c.057-.003.114-.008.171-.01l.086-.006h.023l.037-.003.145-.007a7.999 7.999 0 0 1 1.708.125 7.917 7.917 0 0 1 2.048.68 8.253 8.253 0 0 1 1.672 1.09l.09.077.089.078c.06.052.114.107.171.159.057.052.112.106.166.16.052.055.107.107.159.164a8.671 8.671 0 0 1 1.41 1.978c.012.026.028.052.04.078l.04.078.075.156c.023.051.05.1.07.153l.065.15a8.848 8.848 0 0 1 .45 1.34.19.19 0 0 0 .201.142.186.186 0 0 0 .172-.184c.01-.246.002-.532-.024-.856z"})]})}),_o="#FF7A59",Eo=o.forwardRef(function({title:t="HubSpot",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=_o),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M18.164 7.93V5.084a2.198 2.198 0 001.267-1.978v-.067A2.2 2.2 0 0017.238.845h-.067a2.2 2.2 0 00-2.193 2.193v.067a2.196 2.196 0 001.252 1.973l.013.006v2.852a6.22 6.22 0 00-2.969 1.31l.012-.01-7.828-6.095A2.497 2.497 0 104.3 4.656l-.012.006 7.697 5.991a6.176 6.176 0 00-1.038 3.446c0 1.343.425 2.588 1.147 3.607l-.013-.02-2.342 2.343a1.968 1.968 0 00-.58-.095h-.002a2.033 2.033 0 102.033 2.033 1.978 1.978 0 00-.1-.595l.005.014 2.317-2.317a6.247 6.247 0 104.782-11.134l-.036-.005zm-.964 9.378a3.206 3.206 0 113.215-3.207v.002a3.206 3.206 0 01-3.207 3.207z"})]})}),Po="#FFB319",Ro=o.forwardRef(function({title:t="Kagi",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Po),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M14.4829 18.392h-5.109c-1.3827 0-1.6231-1.5076-1.3827-2.1106.1203-.3015.4208-.7236.6612-1.0251.9618.5427 2.1039.8442 3.306.8442 3.847 0 6.9126-3.1357 6.9126-6.9347 0-2.0502-.9016-3.8593-2.2843-5.186l.1805-.1808c.3605-.3618.9016-.603 1.4426-.5427l.8414.0603V0h-1.4425c-1.683 0-3.0656 1.0251-3.6667 2.4724-.6011-.181-1.2622-.3016-1.9234-.3016-3.847 0-6.9126 3.1357-6.9126 6.9347 0 1.5076.481 2.9548 1.3225 4.1005-.1203.1206-.3005.2412-.4208.3015l-.1803.181c-1.3826 1.3266-2.0436 3.015-1.6832 4.9448.1805 1.025 1.0821 2.1105 1.9838 2.7134.601.4222 1.3824.6031 2.1637.6031l5.7706-.2413c.6612 0 1.2623.3015 1.6228.9046L16.4065 24l3.5464-1.206-.6011-1.3268c-.9016-1.8692-2.765-3.0752-4.869-3.0752M12.0186 5.8493c1.8033 0 3.306 1.5075 3.306 3.3165s-1.5027 3.3166-3.306 3.3166-3.306-1.5075-3.306-3.3166c0-1.8693 1.4426-3.3166 3.306-3.3166"})]})}),To="#326CE5",Mo=o.forwardRef(function({title:t="Kubernetes",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=To),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})]})}),Lo="#5E6AD2",Io=o.forwardRef(function({title:t="Linear",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Lo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M2.886 4.18A11.982 11.982 0 0 1 11.99 0C18.624 0 24 5.376 24 12.009c0 3.64-1.62 6.903-4.18 9.105L2.887 4.18ZM1.817 5.626l16.556 16.556c-.524.33-1.075.62-1.65.866L.951 7.277c.247-.575.537-1.126.866-1.65ZM.322 9.163l14.515 14.515c-.71.172-1.443.282-2.195.322L0 11.358a12 12 0 0 1 .322-2.195Zm-.17 4.862 9.823 9.824a12.02 12.02 0 0 1-9.824-9.824Z"})]})}),Do="#FF3670",Oo=o.forwardRef(function({title:t="Mermaid",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Do),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M23.99 2.115A12.223 12.223 0 0 0 12 10.149 12.223 12.223 0 0 0 .01 2.115a12.23 12.23 0 0 0 5.32 10.604 6.562 6.562 0 0 1 2.845 5.423v3.754h7.65v-3.754a6.561 6.561 0 0 1 2.844-5.423 12.223 12.223 0 0 0 5.32-10.604Z"})]})}),$o="#47A248",Ko=o.forwardRef(function({title:t="MongoDB",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=$o),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M17.193 9.555c-1.264-5.58-4.252-7.414-4.573-8.115-.28-.394-.53-.954-.735-1.44-.036.495-.055.685-.523 1.184-.723.566-4.438 3.682-4.74 10.02-.282 5.912 4.27 9.435 4.888 9.884l.07.05A73.49 73.49 0 0111.91 24h.481c.114-1.032.284-2.056.51-3.07.417-.296.604-.463.85-.693a11.342 11.342 0 003.639-8.464c.01-.814-.103-1.662-.197-2.218zm-5.336 8.195s0-8.291.275-8.29c.213 0 .49 10.695.49 10.695-.381-.045-.765-1.76-.765-2.405z"})]})}),Fo="#4479A1",Bo=o.forwardRef(function({title:t="MySQL",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Fo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M16.405 5.501c-.115 0-.193.014-.274.033v.013h.014c.054.104.146.18.214.273.054.107.1.214.154.32l.014-.015c.094-.066.14-.172.14-.333-.04-.047-.046-.094-.08-.14-.04-.067-.126-.1-.18-.153zM5.77 18.695h-.927a50.854 50.854 0 00-.27-4.41h-.008l-1.41 4.41H2.45l-1.4-4.41h-.01a72.892 72.892 0 00-.195 4.41H0c.055-1.966.192-3.81.41-5.53h1.15l1.335 4.064h.008l1.347-4.064h1.095c.242 2.015.384 3.86.428 5.53zm4.017-4.08c-.378 2.045-.876 3.533-1.492 4.46-.482.716-1.01 1.073-1.583 1.073-.153 0-.34-.046-.566-.138v-.494c.11.017.24.026.386.026.268 0 .483-.075.647-.222.197-.18.295-.382.295-.605 0-.155-.077-.47-.23-.944L6.23 14.615h.91l.727 2.36c.164.536.233.91.205 1.123.4-1.064.678-2.227.835-3.483zm12.325 4.08h-2.63v-5.53h.885v4.85h1.745zm-3.32.135l-1.016-.5c.09-.076.177-.158.255-.25.433-.506.648-1.258.648-2.253 0-1.83-.718-2.746-2.155-2.746-.704 0-1.254.232-1.65.697-.43.508-.646 1.256-.646 2.245 0 .972.19 1.686.574 2.14.35.41.877.615 1.583.615.264 0 .506-.033.725-.098l1.325.772.36-.622zM15.5 17.588c-.225-.36-.337-.94-.337-1.736 0-1.393.424-2.09 1.27-2.09.443 0 .77.167.977.5.224.362.336.936.336 1.723 0 1.404-.424 2.108-1.27 2.108-.445 0-.77-.167-.978-.5zm-1.658-.425c0 .47-.172.856-.516 1.156-.344.3-.803.45-1.384.45-.543 0-1.064-.172-1.573-.515l.237-.476c.438.22.833.328 1.19.328.332 0 .593-.073.783-.22a.754.754 0 00.3-.615c0-.33-.23-.61-.648-.845-.388-.213-1.163-.657-1.163-.657-.422-.307-.632-.636-.632-1.177 0-.45.157-.81.47-1.085.315-.278.72-.415 1.22-.415.512 0 .98.136 1.4.41l-.213.476a2.726 2.726 0 00-1.064-.23c-.283 0-.502.068-.654.206a.685.685 0 00-.248.524c0 .328.234.61.666.85.393.215 1.187.67 1.187.67.433.305.648.63.648 1.168zm9.382-5.852c-.535-.014-.95.04-1.297.188-.1.04-.26.04-.274.167.055.053.063.14.11.214.08.134.218.313.346.407.14.11.28.216.427.31.26.16.555.255.81.416.145.094.293.213.44.313.073.05.12.14.214.172v-.02c-.046-.06-.06-.147-.105-.214-.067-.067-.134-.127-.2-.193a3.223 3.223 0 00-.695-.675c-.214-.146-.682-.35-.77-.595l-.013-.014c.146-.013.32-.066.46-.106.227-.06.435-.047.67-.106.106-.027.213-.06.32-.094v-.06c-.12-.12-.21-.283-.334-.395a8.867 8.867 0 00-1.104-.823c-.21-.134-.476-.22-.697-.334-.08-.04-.214-.06-.26-.127-.12-.146-.19-.34-.275-.514a17.69 17.69 0 01-.547-1.163c-.12-.262-.193-.523-.34-.763-.69-1.137-1.437-1.826-2.586-2.5-.247-.14-.543-.2-.856-.274-.167-.008-.334-.02-.5-.027-.11-.047-.216-.174-.31-.235-.38-.24-1.364-.76-1.644-.072-.18.434.267.862.422 1.082.115.153.26.328.34.5.047.116.06.235.107.356.106.294.207.622.347.897.073.14.153.287.247.413.054.073.146.107.167.227-.094.136-.1.334-.154.5-.24.757-.146 1.693.194 2.25.107.166.362.534.703.393.3-.12.234-.5.32-.835.02-.08.007-.133.048-.187v.015c.094.188.188.367.274.555.206.328.566.668.867.895.16.12.287.328.487.402v-.02h-.015c-.043-.058-.1-.086-.154-.133a3.445 3.445 0 01-.35-.4 8.76 8.76 0 01-.747-1.218c-.11-.21-.202-.436-.29-.643-.04-.08-.04-.2-.107-.24-.1.146-.247.273-.32.453-.127.288-.14.642-.188 1.01-.027.007-.014 0-.027.014-.214-.052-.287-.274-.367-.46-.2-.475-.233-1.238-.06-1.785.047-.14.247-.582.167-.716-.042-.127-.174-.2-.247-.303a2.478 2.478 0 01-.24-.427c-.16-.374-.24-.788-.414-1.162-.08-.173-.22-.354-.334-.513-.127-.18-.267-.307-.368-.52-.033-.073-.08-.194-.027-.274.014-.054.042-.075.094-.09.088-.072.335.022.422.062.247.1.455.194.662.334.094.066.195.193.315.226h.14c.214.047.455.014.655.073.355.114.675.28.962.46a5.953 5.953 0 012.085 2.286c.08.154.115.295.188.455.14.33.313.663.455.982.14.315.275.636.476.897.1.14.502.213.682.286.133.06.34.115.46.188.23.14.454.3.67.454.11.076.443.243.463.378z"})]})}),qo="#EA4B71",zo=o.forwardRef(function({title:t="n8n",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=qo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M21.4737 5.6842c-1.1772 0-2.1663.8051-2.4468 1.8947h-2.8955c-1.235 0-2.289.893-2.492 2.111l-.1038.623a1.263 1.263 0 0 1-1.246 1.0555H11.289c-.2805-1.0896-1.2696-1.8947-2.4468-1.8947s-2.1663.8051-2.4467 1.8947H4.973c-.2805-1.0896-1.2696-1.8947-2.4468-1.8947C1.1311 9.4737 0 10.6047 0 12s1.131 2.5263 2.5263 2.5263c1.1772 0 2.1663-.8051 2.4468-1.8947h1.4223c.2804 1.0896 1.2696 1.8947 2.4467 1.8947 1.1772 0 2.1663-.8051 2.4468-1.8947h1.0008a1.263 1.263 0 0 1 1.2459 1.0555l.1038.623c.203 1.218 1.257 2.111 2.492 2.111h.3692c.2804 1.0895 1.2696 1.8947 2.4468 1.8947 1.3952 0 2.5263-1.131 2.5263-2.5263s-1.131-2.5263-2.5263-2.5263c-1.1772 0-2.1664.805-2.4468 1.8947h-.3692a1.263 1.263 0 0 1-1.246-1.0555l-.1037-.623A2.52 2.52 0 0 0 13.9607 12a2.52 2.52 0 0 0 .821-1.4794l.1038-.623a1.263 1.263 0 0 1 1.2459-1.0555h2.8955c.2805 1.0896 1.2696 1.8947 2.4468 1.8947 1.3952 0 2.5263-1.131 2.5263-2.5263s-1.131-2.5263-2.5263-2.5263m0 1.2632a1.263 1.263 0 0 1 1.2631 1.2631 1.263 1.263 0 0 1-1.2631 1.2632 1.263 1.263 0 0 1-1.2632-1.2632 1.263 1.263 0 0 1 1.2632-1.2631M2.5263 10.7368A1.263 1.263 0 0 1 3.7895 12a1.263 1.263 0 0 1-1.2632 1.2632A1.263 1.263 0 0 1 1.2632 12a1.263 1.263 0 0 1 1.2631-1.2632m6.3158 0A1.263 1.263 0 0 1 10.1053 12a1.263 1.263 0 0 1-1.2632 1.2632A1.263 1.263 0 0 1 7.579 12a1.263 1.263 0 0 1 1.2632-1.2632m10.1053 3.7895a1.263 1.263 0 0 1 1.2631 1.2632 1.263 1.263 0 0 1-1.2631 1.2631 1.263 1.263 0 0 1-1.2632-1.2631 1.263 1.263 0 0 1 1.2632-1.2632"})]})}),Uo="#00C7B7",Ho=o.forwardRef(function({title:t="Netlify",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Uo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M6.49 19.04h-.23L5.13 17.9v-.23l1.73-1.71h1.2l.15.15v1.2L6.5 19.04ZM5.13 6.31V6.1l1.13-1.13h.23L8.2 6.68v1.2l-.15.15h-1.2L5.13 6.31Zm9.96 9.09h-1.65l-.14-.13v-3.83c0-.68-.27-1.2-1.1-1.23-.42 0-.9 0-1.43.02l-.07.08v4.96l-.14.14H8.9l-.13-.14V8.73l.13-.14h3.7a2.6 2.6 0 0 1 2.61 2.6v4.08l-.13.14Zm-8.37-2.44H.14L0 12.82v-1.64l.14-.14h6.58l.14.14v1.64l-.14.14Zm17.14 0h-6.58l-.14-.14v-1.64l.14-.14h6.58l.14.14v1.64l-.14.14ZM11.05 6.55V1.64l.14-.14h1.65l.14.14v4.9l-.14.14h-1.65l-.14-.13Zm0 15.81v-4.9l.14-.14h1.65l.14.13v4.91l-.14.14h-1.65l-.14-.14Z"})]})}),Vo="#000000",Zo=o.forwardRef(function({title:t="Notion",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Vo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"})]})}),Wo="#06AC38",Go=o.forwardRef(function({title:t="PagerDuty",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Wo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M16.965 1.18C15.085.164 13.769 0 10.683 0H3.73v14.55h6.926c2.743 0 4.8-.164 6.61-1.37 1.975-1.303 3.004-3.484 3.004-6.007 0-2.716-1.262-4.896-3.305-5.994zm-5.5 10.326h-4.21V3.113l3.977-.027c3.62-.028 5.43 1.234 5.43 4.128 0 3.113-2.248 4.292-5.197 4.292zM3.73 17.61h3.525V24H3.73Z"})]})}),Yo="#4093DA",Qo=o.forwardRef(function({title:t="Pandoc",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Yo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M4.259 0a.95.95 0 0 0-.925.837.74.74 0 0 0 .75.837h1.953L3.778 23.163a.74.74 0 0 0 .75.837.95.95 0 0 0 .924-.837l2.26-21.489h2.51Q9.095 12.419 7.964 23.163a.74.74 0 0 0 .75.837.95.95 0 0 0 .925-.837l.997-9.489h8.372a.95.95 0 0 0 .925-.837l.733-6.977a.76.76 0 0 0-.182-.591L15.988.245A.75.75 0 0 0 15.422 0Zm7.638 1.674H14.9l.06.068-.403 3.84a.494.494 0 0 0 .5.558h3.84l.06.067-.61 5.793h-7.534z"})]})}),Jo="#002991",Xo=o.forwardRef(function({title:t="PayPal",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Jo),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M15.607 4.653H8.941L6.645 19.251H1.82L4.862 0h7.995c3.754 0 6.375 2.294 6.473 5.513-.648-.478-2.105-.86-3.722-.86m6.57 5.546c0 3.41-3.01 6.853-6.958 6.853h-2.493L11.595 24H6.74l1.845-11.538h3.592c4.208 0 7.346-3.634 7.153-6.949a5.24 5.24 0 0 1 2.848 4.686M9.653 5.546h6.408c.907 0 1.942.222 2.363.541-.195 2.741-2.655 5.483-6.441 5.483H8.714Z"})]})}),el="#4169E1",tl=o.forwardRef(function({title:t="PostgreSQL",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=el),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M23.5594 14.7228a.5269.5269 0 0 0-.0563-.1191c-.139-.2632-.4768-.3418-1.0074-.2321-1.6533.3411-2.2935.1312-2.5256-.0191 1.342-2.0482 2.445-4.522 3.0411-6.8297.2714-1.0507.7982-3.5237.1222-4.7316a1.5641 1.5641 0 0 0-.1509-.235C21.6931.9086 19.8007.0248 17.5099.0005c-1.4947-.0158-2.7705.3461-3.1161.4794a9.449 9.449 0 0 0-.5159-.0816 8.044 8.044 0 0 0-1.3114-.1278c-1.1822-.0184-2.2038.2642-3.0498.8406-.8573-.3211-4.7888-1.645-7.2219.0788C.9359 2.1526.3086 3.8733.4302 6.3043c.0409.818.5069 3.334 1.2423 5.7436.4598 1.5065.9387 2.7019 1.4334 3.582.553.9942 1.1259 1.5933 1.7143 1.7895.4474.1491 1.1327.1441 1.8581-.7279.8012-.9635 1.5903-1.8258 1.9446-2.2069.4351.2355.9064.3625 1.39.3772a.0569.0569 0 0 0 .0004.0041 11.0312 11.0312 0 0 0-.2472.3054c-.3389.4302-.4094.5197-1.5002.7443-.3102.064-1.1344.2339-1.1464.8115-.0025.1224.0329.2309.0919.3268.2269.4231.9216.6097 1.015.6331 1.3345.3335 2.5044.092 3.3714-.6787-.017 2.231.0775 4.4174.3454 5.0874.2212.5529.7618 1.9045 2.4692 1.9043.2505 0 .5263-.0291.8296-.0941 1.7819-.3821 2.5557-1.1696 2.855-2.9059.1503-.8707.4016-2.8753.5388-4.1012.0169-.0703.0357-.1207.057-.1362.0007-.0005.0697-.0471.4272.0307a.3673.3673 0 0 0 .0443.0068l.2539.0223.0149.001c.8468.0384 1.9114-.1426 2.5312-.4308.6438-.2988 1.8057-1.0323 1.5951-1.6698zM2.371 11.8765c-.7435-2.4358-1.1779-4.8851-1.2123-5.5719-.1086-2.1714.4171-3.6829 1.5623-4.4927 1.8367-1.2986 4.8398-.5408 6.108-.13-.0032.0032-.0066.0061-.0098.0094-2.0238 2.044-1.9758 5.536-1.9708 5.7495-.0002.0823.0066.1989.0162.3593.0348.5873.0996 1.6804-.0735 2.9184-.1609 1.1504.1937 2.2764.9728 3.0892.0806.0841.1648.1631.2518.2374-.3468.3714-1.1004 1.1926-1.9025 2.1576-.5677.6825-.9597.5517-1.0886.5087-.3919-.1307-.813-.5871-1.2381-1.3223-.4796-.839-.9635-2.0317-1.4155-3.5126zm6.0072 5.0871c-.1711-.0428-.3271-.1132-.4322-.1772.0889-.0394.2374-.0902.4833-.1409 1.2833-.2641 1.4815-.4506 1.9143-1.0002.0992-.126.2116-.2687.3673-.4426a.3549.3549 0 0 0 .0737-.1298c.1708-.1513.2724-.1099.4369-.0417.156.0646.3078.26.3695.4752.0291.1016.0619.2945-.0452.4444-.9043 1.2658-2.2216 1.2494-3.1676 1.0128zm2.094-3.988-.0525.141c-.133.3566-.2567.6881-.3334 1.003-.6674-.0021-1.3168-.2872-1.8105-.8024-.6279-.6551-.9131-1.5664-.7825-2.5004.1828-1.3079.1153-2.4468.079-3.0586-.005-.0857-.0095-.1607-.0122-.2199.2957-.2621 1.6659-.9962 2.6429-.7724.4459.1022.7176.4057.8305.928.5846 2.7038.0774 3.8307-.3302 4.7363-.084.1866-.1633.3629-.2311.5454zm7.3637 4.5725c-.0169.1768-.0358.376-.0618.5959l-.146.4383a.3547.3547 0 0 0-.0182.1077c-.0059.4747-.054.6489-.115.8693-.0634.2292-.1353.4891-.1794 1.0575-.11 1.4143-.8782 2.2267-2.4172 2.5565-1.5155.3251-1.7843-.4968-2.0212-1.2217a6.5824 6.5824 0 0 0-.0769-.2266c-.2154-.5858-.1911-1.4119-.1574-2.5551.0165-.5612-.0249-1.9013-.3302-2.6462.0044-.2932.0106-.5909.019-.8918a.3529.3529 0 0 0-.0153-.1126 1.4927 1.4927 0 0 0-.0439-.208c-.1226-.4283-.4213-.7866-.7797-.9351-.1424-.059-.4038-.1672-.7178-.0869.067-.276.1831-.5875.309-.9249l.0529-.142c.0595-.16.134-.3257.213-.5012.4265-.9476 1.0106-2.2453.3766-5.1772-.2374-1.0981-1.0304-1.6343-2.2324-1.5098-.7207.0746-1.3799.3654-1.7088.5321a5.6716 5.6716 0 0 0-.1958.1041c.0918-1.1064.4386-3.1741 1.7357-4.4823a4.0306 4.0306 0 0 1 .3033-.276.3532.3532 0 0 0 .1447-.0644c.7524-.5706 1.6945-.8506 2.802-.8325.4091.0067.8017.0339 1.1742.081 1.939.3544 3.2439 1.4468 4.0359 2.3827.8143.9623 1.2552 1.9315 1.4312 2.4543-1.3232-.1346-2.2234.1268-2.6797.779-.9926 1.4189.543 4.1729 1.2811 5.4964.1353.2426.2522.4522.2889.5413.2403.5825.5515.9713.7787 1.2552.0696.087.1372.1714.1885.245-.4008.1155-1.1208.3825-1.0552 1.717-.0123.1563-.0423.4469-.0834.8148-.0461.2077-.0702.4603-.0994.7662zm.8905-1.6211c-.0405-.8316.2691-.9185.5967-1.0105a2.8566 2.8566 0 0 0 .135-.0406 1.202 1.202 0 0 0 .1342.103c.5703.3765 1.5823.4213 3.0068.1344-.2016.1769-.5189.3994-.9533.6011-.4098.1903-1.0957.333-1.7473.3636-.7197.0336-1.0859-.0807-1.1721-.151zm.5695-9.2712c-.0059.3508-.0542.6692-.1054 1.0017-.055.3576-.112.7274-.1264 1.1762-.0142.4368.0404.8909.0932 1.3301.1066.887.216 1.8003-.2075 2.7014a3.5272 3.5272 0 0 1-.1876-.3856c-.0527-.1276-.1669-.3326-.3251-.6162-.6156-1.1041-2.0574-3.6896-1.3193-4.7446.3795-.5427 1.3408-.5661 2.1781-.463zm.2284 7.0137a12.3762 12.3762 0 0 0-.0853-.1074l-.0355-.0444c.7262-1.1995.5842-2.3862.4578-3.4385-.0519-.4318-.1009-.8396-.0885-1.2226.0129-.4061.0666-.7543.1185-1.0911.0639-.415.1288-.8443.1109-1.3505.0134-.0531.0188-.1158.0118-.1902-.0457-.4855-.5999-1.938-1.7294-3.253-.6076-.7073-1.4896-1.4972-2.6889-2.0395.5251-.1066 1.2328-.2035 2.0244-.1859 2.0515.0456 3.6746.8135 4.8242 2.2824a.908.908 0 0 1 .0667.1002c.7231 1.3556-.2762 6.2751-2.9867 10.5405zm-8.8166-6.1162c-.025.1794-.3089.4225-.6211.4225a.5821.5821 0 0 1-.0809-.0056c-.1873-.026-.3765-.144-.5059-.3156-.0458-.0605-.1203-.178-.1055-.2844.0055-.0401.0261-.0985.0925-.1488.1182-.0894.3518-.1226.6096-.0867.3163.0441.6426.1938.6113.4186zm7.9305-.4114c.0111.0792-.049.201-.1531.3102-.0683.0717-.212.1961-.4079.2232a.5456.5456 0 0 1-.075.0052c-.2935 0-.5414-.2344-.5607-.3717-.024-.1765.2641-.3106.5611-.352.297-.0414.6111.0088.6356.1851z"})]})}),al="#E6522C",sl=o.forwardRef(function({title:t="Prometheus",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=al),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12s12-5.373 12-12c0-6.628-5.373-12-12-12zm0 22.46c-1.885 0-3.414-1.26-3.414-2.814h6.828c0 1.553-1.528 2.813-3.414 2.813zm5.64-3.745H6.36v-2.046h11.28v2.046zm-.04-3.098H6.391c-.037-.043-.075-.086-.111-.13-1.155-1.401-1.427-2.133-1.69-2.879-.005-.025 1.4.287 2.395.511 0 0 .513.119 1.262.255-.72-.843-1.147-1.915-1.147-3.01 0-2.406 1.845-4.508 1.18-6.207.648.053 1.34 1.367 1.387 3.422.689-.951.977-2.69.977-3.755 0-1.103.727-2.385 1.454-2.429-.648 1.069.168 1.984.894 4.256.272.854.237 2.29.447 3.201.07-1.892.395-4.652 1.595-5.605-.529 1.2.079 2.702.494 3.424.671 1.164 1.078 2.047 1.078 3.716a4.642 4.642 0 01-1.11 2.996c.792-.149 1.34-.283 1.34-.283l2.573-.502s-.374 1.538-1.81 3.019z"})]})}),rl="#DC244C",nl=o.forwardRef(function({title:t="Qdrant",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=rl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"m12 16.5 3.897-2.25v-4.5L12 7.5 8.103 9.75v4.5zM1.607 18 12 24l3.897-2.25v-4.5L12 19.5l-6.495-3.75v-7.5L12 4.5l6.495 3.75v15L22.393 21V6L12 0 1.607 6Z"})]})}),il="#FF4438",ol=o.forwardRef(function({title:t="Redis",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=il),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M22.71 13.145c-1.66 2.092-3.452 4.483-7.038 4.483-3.203 0-4.397-2.825-4.48-5.12.701 1.484 2.073 2.685 4.214 2.63 4.117-.133 6.94-3.852 6.94-7.239 0-4.05-3.022-6.972-8.268-6.972-3.752 0-8.4 1.428-11.455 3.685C2.59 6.937 3.885 9.958 4.35 9.626c2.648-1.904 4.748-3.13 6.784-3.744C8.12 9.244.886 17.05 0 18.425c.1 1.261 1.66 4.648 2.424 4.648.232 0 .431-.133.664-.365a100.49 100.49 0 0 0 5.54-6.765c.222 3.104 1.748 6.898 6.014 6.898 3.819 0 7.604-2.756 9.33-8.965.2-.764-.73-1.361-1.261-.73zm-4.349-5.013c0 1.959-1.926 2.922-3.685 2.922-.941 0-1.664-.247-2.235-.568 1.051-1.592 2.092-3.225 3.21-4.973 1.972.334 2.71 1.43 2.71 2.619z"})]})}),ll="#3050FF",cl=o.forwardRef(function({title:t="SearXNG",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=ll),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"m13.716 17.261 6.873 6.582L24 20.282l-6.824-6.536a9.11 9.11 0 0 0 1.143-4.43c0-5.055-4.105-9.159-9.16-9.159S0 4.261 0 9.316c0 5.055 4.104 9.159 9.159 9.159a9.11 9.11 0 0 0 4.557-1.214ZM9.159 2.773a6.546 6.546 0 0 1 6.543 6.543 6.545 6.545 0 0 1-6.543 6.542 6.545 6.545 0 0 1-6.542-6.542 6.545 6.545 0 0 1 6.542-6.543ZM7.26 5.713a4.065 4.065 0 0 1 4.744.747 4.064 4.064 0 0 1 .707 4.749l1.157.611a5.376 5.376 0 0 0-.935-6.282 5.377 5.377 0 0 0-6.274-.987l.601 1.162Z"})]})}),dl="#362D59",ul=o.forwardRef(function({title:t="Sentry",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=dl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M13.91 2.505c-.873-1.448-2.972-1.448-3.844 0L6.904 7.92a15.478 15.478 0 0 1 8.53 12.811h-2.221A13.301 13.301 0 0 0 5.784 9.814l-2.926 5.06a7.65 7.65 0 0 1 4.435 5.848H2.194a.365.365 0 0 1-.298-.534l1.413-2.402a5.16 5.16 0 0 0-1.614-.913L.296 19.275a2.182 2.182 0 0 0 .812 2.999 2.24 2.24 0 0 0 1.086.288h6.983a9.322 9.322 0 0 0-3.845-8.318l1.11-1.922a11.47 11.47 0 0 1 4.95 10.24h5.915a17.242 17.242 0 0 0-7.885-15.28l2.244-3.845a.37.37 0 0 1 .504-.13c.255.14 9.75 16.708 9.928 16.9a.365.365 0 0 1-.327.543h-2.287c.029.612.029 1.223 0 1.831h2.297a2.206 2.206 0 0 0 1.922-3.31z"})]})}),hl="#7AB55C",pl=o.forwardRef(function({title:t="Shopify",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=hl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M15.337 23.979l7.216-1.561s-2.604-17.613-2.625-17.73c-.018-.116-.114-.192-.211-.192s-1.929-.136-1.929-.136-1.275-1.274-1.439-1.411c-.045-.037-.075-.057-.121-.074l-.914 21.104h.023zM11.71 11.305s-.81-.424-1.774-.424c-1.447 0-1.504.906-1.504 1.141 0 1.232 3.24 1.715 3.24 4.629 0 2.295-1.44 3.76-3.406 3.76-2.354 0-3.54-1.465-3.54-1.465l.646-2.086s1.245 1.066 2.28 1.066c.675 0 .975-.545.975-.932 0-1.619-2.654-1.694-2.654-4.359-.034-2.237 1.571-4.416 4.827-4.416 1.257 0 1.875.361 1.875.361l-.945 2.715-.02.01zM11.17.83c.136 0 .271.038.405.135-.984.465-2.064 1.639-2.508 3.992-.656.213-1.293.405-1.889.578C7.697 3.75 8.951.84 11.17.84V.83zm1.235 2.949v.135c-.754.232-1.583.484-2.394.736.466-1.777 1.333-2.645 2.085-2.971.193.501.309 1.176.309 2.1zm.539-2.234c.694.074 1.141.867 1.429 1.755-.349.114-.735.231-1.158.366v-.252c0-.752-.096-1.371-.271-1.871v.002zm2.992 1.289c-.02 0-.06.021-.078.021s-.289.075-.714.21c-.423-1.233-1.176-2.37-2.508-2.37h-.115C12.135.209 11.669 0 11.265 0 8.159 0 6.675 3.877 6.21 5.846c-1.194.365-2.063.636-2.16.674-.675.213-.694.232-.772.87-.075.462-1.83 14.063-1.83 14.063L15.009 24l.927-21.166z"})]})}),ml="#003B57",fl=o.forwardRef(function({title:t="SQLite",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=ml),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M21.678.521c-1.032-.92-2.28-.55-3.513.544a8.71 8.71 0 0 0-.547.535c-2.109 2.237-4.066 6.38-4.674 9.544.237.48.422 1.093.544 1.561a13.044 13.044 0 0 1 .164.703s-.019-.071-.096-.296l-.05-.146a1.689 1.689 0 0 0-.033-.08c-.138-.32-.518-.995-.686-1.289-.143.423-.27.818-.376 1.176.484.884.778 2.4.778 2.4s-.025-.099-.147-.442c-.107-.303-.644-1.244-.772-1.464-.217.804-.304 1.346-.226 1.478.152.256.296.698.422 1.186.286 1.1.485 2.44.485 2.44l.017.224a22.41 22.41 0 0 0 .056 2.748c.095 1.146.273 2.13.5 2.657l.155-.084c-.334-1.038-.47-2.399-.41-3.967.09-2.398.642-5.29 1.661-8.304 1.723-4.55 4.113-8.201 6.3-9.945-1.993 1.8-4.692 7.63-5.5 9.788-.904 2.416-1.545 4.684-1.931 6.857.666-2.037 2.821-2.912 2.821-2.912s1.057-1.304 2.292-3.166c-.74.169-1.955.458-2.362.629-.6.251-.762.337-.762.337s1.945-1.184 3.613-1.72C21.695 7.9 24.195 2.767 21.678.521m-18.573.543A1.842 1.842 0 0 0 1.27 2.9v16.608a1.84 1.84 0 0 0 1.835 1.834h9.418a22.953 22.953 0 0 1-.052-2.707c-.006-.062-.011-.141-.016-.2a27.01 27.01 0 0 0-.473-2.378c-.121-.47-.275-.898-.369-1.057-.116-.197-.098-.31-.097-.432 0-.12.015-.245.037-.386a9.98 9.98 0 0 1 .234-1.045l.217-.028c-.017-.035-.014-.065-.031-.097l-.041-.381a32.8 32.8 0 0 1 .382-1.194l.2-.019c-.008-.016-.01-.038-.018-.053l-.043-.316c.63-3.28 2.587-7.443 4.8-9.791.066-.069.133-.128.198-.194Z"})]})}),xl="#635BFF",gl=o.forwardRef(function({title:t="Stripe",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=xl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"})]})}),vl="#3FCF8E",bl=o.forwardRef(function({title:t="Supabase",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=vl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"})]})}),yl="#E44332",jl=o.forwardRef(function({title:t="Todoist",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=yl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M21 0H3C1.35 0 0 1.35 0 3v3.858s3.854 2.24 4.098 2.38c.31.18.694.177 1.004 0 .26-.147 8.02-4.608 8.136-4.675.279-.161.58-.107.748-.01.164.097.606.348.84.48.232.134.221.502.013.622l-9.712 5.59c-.346.2-.69.204-1.048.002C3.478 10.907.998 9.463 0 8.882v2.02l4.098 2.38c.31.18.694.177 1.004 0 .26-.147 8.02-4.609 8.136-4.676.279-.16.58-.106.748-.008.164.096.606.347.84.48.232.133.221.5.013.62-.208.121-9.288 5.346-9.712 5.59-.346.2-.69.205-1.048.002C3.478 14.951.998 13.506 0 12.926v2.02l4.098 2.38c.31.18.694.177 1.004 0 .26-.147 8.02-4.609 8.136-4.676.279-.16.58-.106.748-.009.164.097.606.348.84.48.232.133.221.502.013.622l-9.712 5.59c-.346.199-.69.204-1.048.001C3.478 18.994.998 17.55 0 16.97V21c0 1.65 1.35 3 3 3h18c1.65 0 3-1.35 3-3V3c0-1.65-1.35-3-3-3z"})]})}),kl="#0052CC",wl=o.forwardRef(function({title:t="Trello",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=kl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M21.147 0H2.853A2.86 2.86 0 000 2.853v18.294A2.86 2.86 0 002.853 24h18.294A2.86 2.86 0 0024 21.147V2.853A2.86 2.86 0 0021.147 0zM10.34 17.287a.953.953 0 01-.953.953h-4a.954.954 0 01-.954-.953V5.38a.953.953 0 01.954-.953h4a.954.954 0 01.953.953zm9.233-5.467a.944.944 0 01-.953.947h-4a.947.947 0 01-.953-.947V5.38a.953.953 0 01.953-.953h4a.954.954 0 01.953.953z"})]})}),Nl="#FF4F00",Sl=o.forwardRef(function({title:t="Zapier",color:s="currentColor",size:r=24,...n},i){return s==="default"&&(s=Nl),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:r,fill:s,viewBox:"0 0 24 24",ref:i,...n,children:[e.jsx("title",{children:t}),e.jsx("path",{d:"M4.157 0A4.151 4.151 0 0 0 0 4.161v15.678A4.151 4.151 0 0 0 4.157 24h15.682A4.152 4.152 0 0 0 24 19.839V4.161A4.152 4.152 0 0 0 19.839 0H4.157Zm10.61 8.761h.03a.577.577 0 0 1 .23.038.585.585 0 0 1 .201.124.63.63 0 0 1 .162.431.612.612 0 0 1-.162.435.58.58 0 0 1-.201.128.58.58 0 0 1-.23.042.529.529 0 0 1-.235-.042.585.585 0 0 1-.332-.328.559.559 0 0 1-.038-.235.613.613 0 0 1 .17-.431.59.59 0 0 1 .405-.162Zm2.853 1.572c.03.004.061.004.095.004.325-.011.646.064.937.219.238.144.431.355.552.609.128.279.189.582.185.888v.193a2 2 0 0 1 0 .219h-2.498c.003.227.075.45.204.642a.78.78 0 0 0 .646.265.714.714 0 0 0 .484-.136.642.642 0 0 0 .23-.318l.915.257a1.398 1.398 0 0 1-.28.537c-.14.159-.321.284-.521.355a2.234 2.234 0 0 1-.836.136 1.923 1.923 0 0 1-1.001-.245 1.618 1.618 0 0 1-.665-.703 2.221 2.221 0 0 1-.227-1.036 1.95 1.95 0 0 1 .48-1.398 1.9 1.9 0 0 1 1.3-.488Zm-9.607.023c.162.004.325.026.48.079.207.065.4.174.563.314.26.302.393.692.366 1.088v2.276H8.53l-.109-.711h-.065c-.064.163-.155.31-.272.439a1.122 1.122 0 0 1-.374.264 1.023 1.023 0 0 1-.453.083 1.334 1.334 0 0 1-.866-.264.965.965 0 0 1-.329-.801.993.993 0 0 1 .076-.431 1.02 1.02 0 0 1 .242-.363 1.478 1.478 0 0 1 1.043-.303h.952v-.181a.696.696 0 0 0-.136-.454.553.553 0 0 0-.438-.154.695.695 0 0 0-.378.086.48.48 0 0 0-.193.254l-.99-.144a1.26 1.26 0 0 1 .257-.563c.14-.174.321-.302.533-.378.261-.091.54-.136.82-.129.053-.003.106-.007.163-.007Zm4.384.007c.174 0 .347.038.506.114.182.083.34.211.458.374.257.423.377.911.351 1.406a2.53 2.53 0 0 1-.355 1.448 1.148 1.148 0 0 1-1.009.517c-.204 0-.401-.045-.582-.136a1.052 1.052 0 0 1-.48-.457 1.298 1.298 0 0 1-.114-.234h-.045l.004 1.784h-1.059v-4.713h.904l.117.805h.057c.068-.208.177-.401.328-.56a1.129 1.129 0 0 1 .843-.344h.076v-.004Zm7.559.084h.903l.113.805h.053a1.37 1.37 0 0 1 .235-.484.813.813 0 0 1 .313-.242.82.82 0 0 1 .39-.076h.234v1.051h-.401a.662.662 0 0 0-.313.008.623.623 0 0 0-.272.155.663.663 0 0 0-.174.26.683.683 0 0 0-.027.314v1.875h-1.054v-3.666Zm-17.515.003h3.262v.896L3.73 13.104l.034.113h1.973l.042.9H2.4v-.9l1.931-1.754-.045-.117H2.441v-.896Zm11.815 0h1.055v3.659h-1.055V10.45Zm3.443.684.019.016a.69.69 0 0 0-.351.045.756.756 0 0 0-.287.204c-.11.155-.174.336-.189.522h1.545c-.034-.526-.257-.787-.74-.787h.003Zm-5.718.163c-.026 0-.057 0-.083.004a.78.78 0 0 0-.31.053.746.746 0 0 0-.257.189 1.016 1.016 0 0 0-.204.695v.064c-.015.257.057.507.204.711a.634.634 0 0 0 .253.196.638.638 0 0 0 .314.061.644.644 0 0 0 .578-.265c.14-.223.204-.48.189-.74a1.216 1.216 0 0 0-.181-.711.677.677 0 0 0-.503-.257Zm-4.509 1.266a.464.464 0 0 0-.268.102.373.373 0 0 0-.114.276c0 .053.008.106.027.155a.375.375 0 0 0 .087.132.576.576 0 0 0 .397.11v.004a.863.863 0 0 0 .563-.182.573.573 0 0 0 .211-.457v-.14h-.903Z"})]})});function Mr(a){return{providers:a.providers??[],defaultProviderId:a.defaultProviderId||void 0,mcpServers:a.mcpServers??[],adapters:a.adapters??[]}}function Lr(a,t,s){const r=Ln(a,t,s);return{providers:r.providers,defaultProviderId:r.defaultProviderId,mcpServers:Ks(a.mcpServers,t.mcpServers,s.mcpServers),adapters:Ks(a.adapters,t.adapters,s.adapters)}}async function Cl(a,t,s){try{return Lr(a,t,Mr(await s()))}catch{return t}}const Vs=new Map,Zs="mmmmmmmmmmlllllllllliiiiiiiiiiWWWWWWWWWW0123456789";function Ws(a){const t=a.trim().replace(/["']/g,"");if(!t)return!1;const s=Vs.get(t);if(s!==void 0)return s;let r=!1;try{const n=document.createElement("canvas").getContext("2d");if(n)for(const i of["monospace","serif"]){n.font=`72px ${i}`;const l=n.measureText(Zs).width;if(n.font=`72px '${t}', ${i}`,n.measureText(Zs).width!==l){r=!0;break}}}catch{}return Vs.set(t,r),r}const Ka="autoApplyPromptUpdates",Al="promptDefaultsApplied";function Ir(){return{globalSystemPrompt:ta,compactionPrompt:ea,toolPrompts:{...Xt,...Jt}}}function _l(){const a=JSON.stringify(Ir());let t=2166136261;for(let s=0;s<a.length;s++)t^=a.charCodeAt(s),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")+":"+a.length}const El="Curated registry of well-known MCP servers, maintained per docs/design/mcp-registry-expansion.md. Never map an entry to the name-squatted packages: PyPI mcp-gmail / telegram-mcp / mcp-server-milvus, npm mcp-filesystem-server / github-mcp-server — they squat well-known project names but are unrelated (or hostile) third parties.",Pl=1,Rl="2026-08-25",Tl=JSON.parse('[{"name":"filesystem","displayName":"Filesystem","npmPackage":"@modelcontextprotocol/server-filesystem","args":["{directory}"],"description":"Read, write, and manage local files and directories","category":"tools","requiredEnvKeys":[],"repo":"https://github.com/modelcontextprotocol/servers/blob/main/src/filesystem","runLocation":"host","verified":true},{"name":"playwright","displayName":"Playwright Browser","npmPackage":"@playwright/mcp","description":"Maintained browser automation that attaches to the agent\'s persistent visible Chromium session","category":"tools","requiredEnvKeys":[],"repo":"https://github.com/microsoft/playwright-mcp","verified":true},{"name":"sequential-thinking","displayName":"Sequential Thinking","npmPackage":"@modelcontextprotocol/server-sequential-thinking","description":"Dynamic, reflective problem-solving through thought sequences","category":"tools","requiredEnvKeys":[],"repo":"https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking","verified":true},{"name":"markitdown","displayName":"MarkItDown","pypiPackage":"markitdown-mcp","runtime":"python","description":"Convert documents (PDF, Office, images, audio) to Markdown","category":"tools","requiredEnvKeys":[],"repo":"https://github.com/microsoft/markitdown","runLocation":"host","verified":true},{"name":"pandoc","displayName":"Pandoc","iconKey":"pandoc","pypiPackage":"mcp-pandoc","runtime":"python","description":"Convert documents between Markdown, HTML, DOCX, PDF, EPUB, and more","category":"tools","requiredEnvKeys":[],"repo":"https://github.com/vivekVells/mcp-pandoc","runLocation":"host","verified":false,"prerequisite":"Needs the pandoc binary installed where the server runs (host run recommended; PDF output additionally needs TeX)."},{"name":"brave-search","displayName":"Brave Search","iconKey":"brave","npmPackage":"@brave/brave-search-mcp-server","description":"Search the web using Brave Search API","category":"search","requiredEnvKeys":["BRAVE_API_KEY"],"repo":"https://github.com/brave/brave-search-mcp-server","verified":true},{"name":"context7","displayName":"Context7","npmPackage":"@upstash/context7-mcp","description":"Up-to-date, version-specific library documentation and code examples","category":"search","requiredEnvKeys":[],"repo":"https://github.com/upstash/context7","verified":true},{"name":"tavily","displayName":"Tavily","npmPackage":"tavily-mcp","description":"AI-optimized web search, extract, map, and crawl via the Tavily API","category":"search","requiredEnvKeys":["TAVILY_API_KEY"],"repo":"https://github.com/tavily-ai/tavily-mcp","verified":true},{"name":"exa","displayName":"Exa","npmPackage":"exa-mcp-server","description":"Neural web search and content retrieval via the Exa API","category":"search","requiredEnvKeys":["EXA_API_KEY"],"repo":"https://github.com/exa-labs/exa-mcp-server","verified":true},{"name":"perplexity","displayName":"Perplexity","iconKey":"perplexity","npmPackage":"@perplexity-ai/mcp-server","description":"Web search, research, and reasoning via the Perplexity Sonar API","category":"search","requiredEnvKeys":["PERPLEXITY_API_KEY"],"repo":"https://github.com/perplexityai/modelcontextprotocol","verified":true},{"name":"kagi","displayName":"Kagi Search","iconKey":"kagi","pypiPackage":"kagimcp","runtime":"python","description":"Search the web using the Kagi Search API","category":"search","requiredEnvKeys":["KAGI_API_KEY"],"repo":"https://github.com/kagisearch/kagi-mcp","verified":true,"prerequisite":"Needs a Kagi account with Search API access; the server pins Python 3.12."},{"name":"aws-docs","displayName":"AWS Documentation","pypiPackage":"awslabs.aws-documentation-mcp-server","runtime":"python","description":"Search, read, and get recommendations from AWS documentation","category":"search","requiredEnvKeys":[],"repo":"https://github.com/awslabs/mcp","verified":true},{"name":"deepwiki","displayName":"DeepWiki","url":"https://mcp.deepwiki.com/mcp","description":"Ask questions about any public GitHub repository via DeepWiki","category":"search","requiredEnvKeys":[],"repo":"https://docs.devin.ai/work-with-devin/deepwiki-mcp","verified":true},{"name":"microsoft-learn","displayName":"Microsoft Learn","url":"https://learn.microsoft.com/api/mcp","description":"Search and fetch official Microsoft and Azure documentation and code samples","category":"search","requiredEnvKeys":[],"repo":"https://github.com/microsoftdocs/mcp","verified":true},{"name":"cloudflare-docs","displayName":"Cloudflare Docs","iconKey":"cloudflare","url":"https://docs.mcp.cloudflare.com/mcp","description":"Search Cloudflare developer documentation","category":"search","requiredEnvKeys":[],"repo":"https://github.com/cloudflare/mcp-server-cloudflare","verified":true},{"name":"duckduckgo","displayName":"DuckDuckGo","iconKey":"duckduckgo","pypiPackage":"duckduckgo-mcp-server","runtime":"python","description":"Zero-key web search via DuckDuckGo with built-in client-side rate limiting","category":"search","requiredEnvKeys":[],"repo":"https://github.com/nickclyde/duckduckgo-mcp-server","verified":false},{"name":"serper","displayName":"Serper","pypiPackage":"serper-mcp-server","runtime":"python","description":"Google results (web, images, news, maps, scholar) via the Serper.dev API","category":"search","requiredEnvKeys":["SERPER_API_KEY"],"repo":"https://github.com/garylab/serper-mcp-server","verified":false},{"name":"searxng","displayName":"SearXNG","iconKey":"searxng","npmPackage":"mcp-searxng","description":"Meta-search through a SearXNG instance, plus URL reading","category":"search","requiredEnvKeys":["SEARXNG_URL"],"optionalEnvKeys":["AUTH_USERNAME","AUTH_PASSWORD"],"repo":"https://github.com/ihor-sokoliuk/mcp-searxng","verified":false,"prerequisite":"Needs a reachable SearXNG instance with the JSON output format enabled."},{"name":"arxiv","displayName":"arXiv","iconKey":"arxiv","pypiPackage":"arxiv-mcp-server","runtime":"python","description":"Search, download, and read arXiv papers","category":"search","requiredEnvKeys":[],"repo":"https://github.com/blazickjp/arxiv-mcp-server","verified":false},{"name":"fetch","displayName":"Fetch","pypiPackage":"mcp-server-fetch","runtime":"python","description":"Fetch web pages and convert them to markdown for reading","category":"web","requiredEnvKeys":[],"repo":"https://github.com/modelcontextprotocol/servers/tree/main/src/fetch","verified":true,"prerequisite":"Can reach local and internal addresses (SSRF-capable) — the container run location is the safe default."},{"name":"firecrawl","displayName":"Firecrawl","npmPackage":"firecrawl-mcp","description":"Web scraping, crawling, and structured extraction via the Firecrawl API","category":"web","requiredEnvKeys":["FIRECRAWL_API_KEY"],"optionalEnvKeys":["FIRECRAWL_API_URL"],"repo":"https://github.com/firecrawl/firecrawl-mcp-server","verified":true},{"name":"apify","displayName":"Apify","npmPackage":"@apify/actors-mcp-server","description":"Run Apify Actors for web scraping and automation at scale","category":"web","requiredEnvKeys":["APIFY_TOKEN"],"repo":"https://github.com/apify/apify-mcp-server","verified":true},{"name":"oxylabs","displayName":"Oxylabs","pypiPackage":"oxylabs-mcp","runtime":"python","description":"Proxy-backed web scraping (universal, Google, Amazon) via Oxylabs","category":"web","requiredEnvKeys":["OXYLABS_USERNAME","OXYLABS_PASSWORD"],"repo":"https://github.com/oxylabs/oxylabs-mcp","verified":true,"prerequisite":"Needs a paid Oxylabs account with Web Scraper API access."},{"name":"youtube-transcript","displayName":"YouTube Transcript","npmPackage":"@kimtaeyoon83/mcp-server-youtube-transcript","description":"Fetch transcripts and captions for YouTube videos","category":"web","requiredEnvKeys":[],"repo":"https://github.com/kimtaeyoon83/mcp-server-youtube-transcript","verified":false,"prerequisite":"YouTube may block datacenter IPs — if transcript fetches fail from a container, run on host."},{"name":"github","displayName":"GitHub","iconKey":"github","url":"https://api.githubcopilot.com/mcp/","oauth":true,"bearerTokenEnvVar":"GITHUB_PERSONAL_ACCESS_TOKEN","description":"Official GitHub remote server — repositories, issues, pull requests, and actions","category":"dev","requiredEnvKeys":["GITHUB_PERSONAL_ACCESS_TOKEN"],"repo":"https://github.com/github/github-mcp-server","verified":true,"prerequisite":"Needs a GitHub personal access token (github.com/settings/tokens) scoped to the repositories it should reach."},{"name":"git","displayName":"Git","pypiPackage":"mcp-server-git","runtime":"python","description":"Inspect and operate on local Git repositories (repository path is passed per tool call)","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/modelcontextprotocol/servers/tree/main/src/git","runLocation":"host","verified":true},{"name":"sentry","displayName":"Sentry","iconKey":"sentry","npmPackage":"@sentry/mcp-server","description":"Query Sentry issues, events, and projects","category":"dev","requiredEnvKeys":["SENTRY_ACCESS_TOKEN"],"optionalEnvKeys":["SENTRY_HOST"],"repo":"https://github.com/getsentry/sentry-mcp","verified":true},{"name":"sentry-remote","displayName":"Sentry (remote)","iconKey":"sentry","url":"https://mcp.sentry.dev/mcp","oauth":true,"description":"Official Sentry remote server — issues, events, releases, and projects via browser OAuth","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/getsentry/sentry-mcp","verified":true,"prerequisite":"Sign in to Sentry in your browser on first connect — no token to paste."},{"name":"supabase-remote","displayName":"Supabase (remote)","iconKey":"supabase","url":"https://mcp.supabase.com/mcp","oauth":true,"description":"Official Supabase remote server — database, auth, storage, and edge functions via browser OAuth","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/supabase-community/supabase-mcp","verified":true,"prerequisite":"Sign in to Supabase in your browser on first connect — no token to paste."},{"name":"supabase","displayName":"Supabase","iconKey":"supabase","npmPackage":"@supabase/mcp-server-supabase","description":"Manage Supabase projects: database, auth, storage, and edge functions","category":"dev","requiredEnvKeys":["SUPABASE_ACCESS_TOKEN"],"repo":"https://github.com/supabase-community/supabase-mcp","verified":true},{"name":"semgrep","displayName":"Semgrep","pypiPackage":"semgrep-mcp","runtime":"python","description":"Static-analysis security scanning of code with Semgrep","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/semgrep/mcp","runLocation":"host","verified":true},{"name":"chrome-devtools","displayName":"Chrome DevTools","iconKey":"chrome","npmPackage":"chrome-devtools-mcp","description":"Drive and debug Chrome via the DevTools protocol — performance traces, network, console","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/ChromeDevTools/chrome-devtools-mcp","runLocation":"host","verified":true,"prerequisite":"Drives a local Chrome installation — run on host with Chrome installed."},{"name":"shopify-dev","displayName":"Shopify Dev","iconKey":"shopify","npmPackage":"@shopify/dev-mcp","description":"Shopify developer docs and API schema exploration (zero-config, docs only)","category":"dev","requiredEnvKeys":[],"repo":"https://github.com/Shopify/dev-mcp","verified":true},{"name":"gitlab","displayName":"GitLab","iconKey":"gitlab","npmPackage":"@zereight/mcp-gitlab","description":"GitLab projects, issues, merge requests, pipelines, and wikis","category":"dev","requiredEnvKeys":["GITLAB_API_URL","GITLAB_PERSONAL_ACCESS_TOKEN"],"optionalEnvKeys":["GITLAB_PERMISSION_MODE"],"repo":"https://github.com/zereight/gitlab-mcp","verified":false,"prerequisite":"Set GITLAB_API_URL to your instance API base (https://gitlab.com/api/v4 for gitlab.com) and use a personal access token."},{"name":"n8n","displayName":"n8n","iconKey":"n8n","npmPackage":"n8n-mcp","description":"n8n node documentation, workflow building, and optional workflow management","category":"dev","requiredEnvKeys":[],"optionalEnvKeys":["N8N_API_URL","N8N_API_KEY"],"repo":"https://github.com/czlonkowski/n8n-mcp","verified":false,"prerequisite":"Documentation tools work with no configuration; managing workflows needs your n8n instance URL and API key."},{"name":"memory","displayName":"Memory","npmPackage":"@modelcontextprotocol/server-memory","description":"Persistent knowledge graph memory for agents","category":"data","requiredEnvKeys":[],"repo":"https://github.com/modelcontextprotocol/servers/blob/main/src/memory","verified":true},{"name":"mongodb","displayName":"MongoDB","iconKey":"mongodb","npmPackage":"mongodb-mcp-server","description":"Query and manage MongoDB databases and Atlas clusters","category":"data","requiredEnvKeys":["MDB_MCP_CONNECTION_STRING"],"repo":"https://github.com/mongodb-js/mongodb-mcp-server","verified":true},{"name":"redis","displayName":"Redis","iconKey":"redis","pypiPackage":"redis-mcp-server","runtime":"python","description":"Query and manage Redis data structures","category":"data","requiredEnvKeys":["REDIS_URL"],"optionalEnvKeys":["REDIS_HOST","REDIS_PORT","REDIS_USERNAME","REDIS_PWD"],"repo":"https://github.com/redis/mcp-redis","verified":true},{"name":"clickhouse","displayName":"ClickHouse","iconKey":"clickhouse","pypiPackage":"mcp-clickhouse","runtime":"python","description":"Run queries against ClickHouse (writes gated off by default)","category":"data","requiredEnvKeys":["CLICKHOUSE_HOST","CLICKHOUSE_USER","CLICKHOUSE_PASSWORD"],"optionalEnvKeys":["CLICKHOUSE_PORT","CLICKHOUSE_SECURE","CLICKHOUSE_DATABASE"],"repo":"https://github.com/ClickHouse/mcp-clickhouse","verified":true},{"name":"duckdb","displayName":"DuckDB / MotherDuck","iconKey":"duckdb","pypiPackage":"mcp-server-motherduck","runtime":"python","args":["--db-path","{database-path}"],"description":"Query local DuckDB files or MotherDuck cloud databases (read-only by default)","category":"data","requiredEnvKeys":[],"optionalEnvKeys":["MOTHERDUCK_TOKEN"],"repo":"https://github.com/motherduckdb/mcp-server-motherduck","runLocation":"host","verified":true,"prerequisite":"Database path can be a local .duckdb file or :memory:; MOTHERDUCK_TOKEN is only needed for MotherDuck cloud."},{"name":"dbhub","displayName":"DBHub","npmPackage":"@bytebase/dbhub","description":"Universal database gateway: SQLite, PostgreSQL, MySQL, MariaDB, and SQL Server","category":"data","requiredEnvKeys":["DSN"],"repo":"https://github.com/bytebase/dbhub","verified":true,"prerequisite":"Set DSN to the database connection string (e.g. postgres://user:pass@host/db); requires Node 22.5+."},{"name":"chroma","displayName":"Chroma","pypiPackage":"chroma-mcp","runtime":"python","description":"Vector search and collections on Chroma (ephemeral mode is zero-config)","category":"data","requiredEnvKeys":[],"optionalEnvKeys":["CHROMA_CLIENT_TYPE","CHROMA_DATA_DIR","CHROMA_API_KEY","CHROMA_TENANT","CHROMA_DATABASE"],"repo":"https://github.com/chroma-core/chroma-mcp","verified":true},{"name":"qdrant","displayName":"Qdrant","iconKey":"qdrant","pypiPackage":"mcp-server-qdrant","runtime":"python","description":"Semantic memory on Qdrant with built-in local embeddings (fastembed)","category":"data","requiredEnvKeys":["QDRANT_URL","COLLECTION_NAME"],"optionalEnvKeys":["QDRANT_API_KEY"],"repo":"https://github.com/qdrant/mcp-server-qdrant","verified":true},{"name":"pinecone","displayName":"Pinecone","npmPackage":"@pinecone-database/mcp","description":"Search and manage Pinecone vector indexes","category":"data","requiredEnvKeys":["PINECONE_API_KEY"],"repo":"https://github.com/pinecone-io/pinecone-mcp","verified":true},{"name":"dbt","displayName":"dbt","pypiPackage":"dbt-mcp","runtime":"python","description":"dbt platform: semantic layer, discovery, and dbt CLI operations","category":"data","requiredEnvKeys":["DBT_HOST","DBT_TOKEN","DBT_PROD_ENV_ID"],"optionalEnvKeys":["DBT_ACCOUNT_ID","DBT_DEV_ENV_ID","DBT_USER_ID"],"repo":"https://github.com/dbt-labs/dbt-mcp","verified":true},{"name":"neon","displayName":"Neon","url":"https://mcp.neon.tech/mcp","oauth":true,"bearerTokenEnvVar":"NEON_API_KEY","description":"Manage Neon serverless Postgres projects, branches, and queries","category":"data","requiredEnvKeys":["NEON_API_KEY"],"repo":"https://github.com/neondatabase/mcp-server-neon","verified":true},{"name":"postgres","displayName":"PostgreSQL","iconKey":"postgresql","pypiPackage":"postgres-mcp","runtime":"python","description":"Postgres queries, schema intelligence, index tuning, and health checks","category":"data","requiredEnvKeys":["DATABASE_URI"],"repo":"https://github.com/crystaldba/postgres-mcp","verified":false},{"name":"mysql","displayName":"MySQL","iconKey":"mysql","npmPackage":"@benborla29/mcp-server-mysql","description":"Query MySQL databases (read-only by default, writes gated per-operation)","category":"data","requiredEnvKeys":["MYSQL_HOST","MYSQL_PORT","MYSQL_USER","MYSQL_PASS","MYSQL_DB"],"optionalEnvKeys":["ALLOW_INSERT_OPERATION","ALLOW_UPDATE_OPERATION","ALLOW_DELETE_OPERATION"],"repo":"https://github.com/benborla/mcp-server-mysql","verified":false},{"name":"sqlite","displayName":"SQLite","iconKey":"sqlite","npmPackage":"mcp-sqlite","args":["{database-path}"],"description":"Query and manage a local SQLite database file","category":"data","requiredEnvKeys":[],"repo":"https://github.com/jparkerweb/mcp-sqlite","runLocation":"host","verified":false},{"name":"airtable","displayName":"Airtable","iconKey":"airtable","npmPackage":"airtable-mcp-server","description":"Read and write Airtable bases, tables, and records","category":"data","requiredEnvKeys":["AIRTABLE_API_KEY"],"repo":"https://github.com/domdomegg/airtable-mcp-server","verified":false,"prerequisite":"AIRTABLE_API_KEY is an Airtable personal access token from airtable.com/create/tokens (schema + records scopes)."},{"name":"google-sheets","displayName":"Google Sheets","iconKey":"google-sheets","pypiPackage":"mcp-google-sheets","runtime":"python","description":"Read and write Google Sheets spreadsheets","category":"data","requiredEnvKeys":["SERVICE_ACCOUNT_PATH","DRIVE_FOLDER_ID"],"repo":"https://github.com/xing5/mcp-google-sheets","runLocation":"host","verified":false,"prerequisite":"Headless service-account mode: needs a Google Cloud service-account JSON key (Sheets + Drive APIs enabled) and a Drive folder shared with the service account\'s email. SERVICE_ACCOUNT_PATH points at the key file."},{"name":"excel","displayName":"Excel","pypiPackage":"excel-mcp-server","runtime":"python","args":["stdio"],"description":"Create, read, and edit Excel workbooks without Excel installed","category":"data","requiredEnvKeys":[],"repo":"https://github.com/haris-musa/excel-mcp-server","runLocation":"host","verified":false},{"name":"google-drive","displayName":"Google Drive","iconKey":"google-drive","npmPackage":"@piotr-agier/google-drive-mcp","description":"Read, search, and manage Google Drive, Docs, Sheets, and Slides","category":"data","requiredEnvKeys":[],"repo":"https://github.com/piotr-agier/google-drive-mcp","runLocation":"host","verified":false,"auth":true,"authArgs":["auth"],"credentialFiles":[{"path":"~/.config/google-drive-mcp/gcp-oauth.keys.json","required":true},{"path":"~/.config/google-drive-mcp/tokens.json"}],"prerequisite":"Needs a Google OAuth client JSON (Desktop app) from console.cloud.google.com with the Drive, Docs, Sheets, and Slides APIs enabled."},{"name":"resend","displayName":"Resend","npmPackage":"resend-mcp","description":"Send emails, manage contacts, and broadcasts via the Resend platform","category":"communication","requiredEnvKeys":["RESEND_API_KEY"],"optionalEnvKeys":["SENDER_EMAIL_ADDRESS","REPLY_TO_EMAIL_ADDRESSES"],"repo":"https://github.com/resend/resend-mcp","verified":true},{"name":"slack","displayName":"Slack","npmPackage":"@zencoderai/slack-mcp-server","description":"Interact with Slack workspaces via a bot token","category":"communication","requiredEnvKeys":["SLACK_BOT_TOKEN","SLACK_TEAM_ID"],"optionalEnvKeys":["SLACK_CHANNEL_IDS"],"repo":"https://github.com/zencoderai/slack-mcp-server","verified":false,"prerequisite":"Needs a Slack app (api.slack.com/apps) with bot scopes channels:history, channels:read, chat:write, reactions:write, users:read."},{"name":"email","displayName":"Email (IMAP/SMTP)","npmPackage":"@codefuturist/email-mcp","description":"Search, read, and send email over IMAP and SMTP","category":"communication","requiredEnvKeys":["MCP_EMAIL_ADDRESS","MCP_EMAIL_PASSWORD","MCP_EMAIL_IMAP_HOST","MCP_EMAIL_SMTP_HOST"],"optionalEnvKeys":["MCP_EMAIL_IMAP_PORT","MCP_EMAIL_SMTP_PORT","MCP_EMAIL_IMAP_TLS","MCP_EMAIL_SMTP_TLS","MCP_EMAIL_SMTP_STARTTLS"],"repo":"https://github.com/codefuturist/email-mcp","verified":false,"prerequisite":"Use an app password for providers with 2FA (e.g. Gmail); requires Node 22+."},{"name":"telegram","displayName":"Telegram","iconKey":"telegram","npmPackage":"@iqai/mcp-telegram","description":"Interact with Telegram via bot API for messaging and channel management","category":"communication","requiredEnvKeys":["TELEGRAM_BOT_TOKEN"],"repo":"https://github.com/IQAIcom/mcp-telegram","verified":false},{"name":"discord","displayName":"Discord","iconKey":"discord","npmPackage":"mcp-discord","description":"Discord bot integration for messages, channels, forums, and webhooks","category":"communication","requiredEnvKeys":["DISCORD_TOKEN"],"repo":"https://github.com/barryyip0625/mcp-discord","verified":false},{"name":"gmail","displayName":"Gmail","iconKey":"gmail","npmPackage":"@gongrzhe/server-gmail-autoauth-mcp","description":"Search, read, label, and send Gmail","category":"communication","requiredEnvKeys":[],"repo":"https://github.com/GongRzhe/Gmail-MCP-Server","runLocation":"host","verified":false,"auth":true,"authArgs":["auth"],"credentialFiles":[{"path":"~/.gmail-mcp/gcp-oauth.keys.json","required":true},{"path":"~/.gmail-mcp/credentials.json"}],"prerequisite":"Needs a Google OAuth client JSON (Desktop app) from console.cloud.google.com with the Gmail API enabled. Community server; upstream repository archived in March 2026. See the Gmail setup Knowledge Base article for credential handling and tool permissions."},{"name":"teams","displayName":"Microsoft Teams","npmPackage":"@floriscornel/teams-mcp","description":"Read and send Microsoft Teams channel and chat messages as the signed-in user","category":"communication","requiredEnvKeys":[],"repo":"https://github.com/floriscornel/teams-mcp","runLocation":"host","verified":false,"auth":true,"authArgs":["authenticate"],"credentialFiles":[{"path":"~/.teams-mcp-token-cache.json"},{"path":"~/.msgraph-mcp-auth.json"}],"prerequisite":"Signs into Microsoft 365 with a device code on first auth — no Azure app registration needed (some tenants require admin consent for the shared client)."},{"name":"notion","displayName":"Notion","iconKey":"notion","npmPackage":"@notionhq/notion-mcp-server","description":"Search, read, and write Notion pages and databases","category":"productivity","requiredEnvKeys":["NOTION_TOKEN"],"repo":"https://github.com/makenotion/notion-mcp-server","verified":true,"prerequisite":"Needs an internal integration token (notion.so/profile/integrations); share the target pages with the integration."},{"name":"notion-remote","displayName":"Notion (remote)","iconKey":"notion","url":"https://mcp.notion.com/mcp","oauth":true,"description":"Official Notion remote server — search, read, and write pages and databases via browser OAuth","category":"productivity","requiredEnvKeys":[],"repo":"https://developers.notion.com/docs/mcp","verified":true,"prerequisite":"Sign in to Notion in your browser on first connect — no integration token to paste."},{"name":"linear","displayName":"Linear","iconKey":"linear","url":"https://mcp.linear.app/mcp","oauth":true,"bearerTokenEnvVar":"LINEAR_API_KEY","description":"Official Linear remote server — issues, projects, and cycles","category":"productivity","requiredEnvKeys":["LINEAR_API_KEY"],"repo":"https://linear.app/docs/mcp","verified":true,"prerequisite":"Needs a Linear personal API key (Settings > Security & access > Personal API keys)."},{"name":"atlassian-cloud","displayName":"Atlassian Cloud","iconKey":"atlassian","url":"https://mcp.atlassian.com/v1/mcp","oauth":true,"bearerTokenEnvVar":"ATLASSIAN_API_KEY","description":"Official Atlassian remote server — Jira, Confluence, JSM, Bitbucket, and Compass","category":"productivity","requiredEnvKeys":["ATLASSIAN_API_KEY"],"repo":"https://github.com/atlassian/atlassian-mcp-server","verified":true,"prerequisite":"Needs a service-account API key, and an org admin must enable API-token access to the MCP server. Atlassian Cloud only."},{"name":"todoist","displayName":"Todoist","iconKey":"todoist","npmPackage":"@doist/todoist-mcp","description":"Manage Todoist tasks, projects, and labels","category":"productivity","requiredEnvKeys":["TODOIST_API_KEY"],"repo":"https://github.com/Doist/todoist-mcp","verified":true,"prerequisite":"API key from Todoist Settings > Integrations > Developer."},{"name":"todoist-remote","displayName":"Todoist (remote)","iconKey":"todoist","url":"https://ai.todoist.net/mcp","oauth":true,"description":"Official Doist hosted server — manage Todoist tasks, projects, and labels via browser OAuth","category":"productivity","requiredEnvKeys":[],"repo":"https://github.com/Doist/todoist-mcp","verified":true,"prerequisite":"Sign in to Todoist in your browser on first connect — no API key to paste."},{"name":"clickup","displayName":"ClickUp","url":"https://mcp.clickup.com/mcp","oauth":true,"description":"Official ClickUp remote server — tasks, lists, docs, and workspaces via browser OAuth","category":"productivity","requiredEnvKeys":[],"repo":"https://developer.clickup.com/docs/connect-an-ai-assistant-to-clickups-mcp-server","verified":true,"prerequisite":"Sign in to ClickUp in your browser on first connect (OAuth only — API keys are not accepted). Public beta; rate-limited."},{"name":"readwise","displayName":"Readwise","url":"https://mcp2.readwise.io/mcp","oauth":true,"description":"Official Readwise remote server — Highlights and Reader documents via browser OAuth","category":"productivity","requiredEnvKeys":[],"repo":"https://github.com/readwiseio/readwise-mcp","verified":true,"prerequisite":"Sign in to Readwise in your browser on first connect — no access token to paste."},{"name":"monday","displayName":"monday.com","npmPackage":"@mondaydotcomorg/monday-api-mcp","description":"Manage monday.com boards, items, and workflows","category":"productivity","requiredEnvKeys":["monday_token"],"repo":"https://github.com/mondaycom/monday-ai","verified":true},{"name":"cal-com","displayName":"Cal.com","iconKey":"cal-com","npmPackage":"@calcom/cal-mcp","description":"Manage Cal.com bookings and event types","category":"productivity","requiredEnvKeys":["CAL_API_KEY"],"repo":"https://github.com/calcom/cal-mcp","verified":true},{"name":"stripe","displayName":"Stripe","iconKey":"stripe","npmPackage":"@stripe/mcp","description":"Query and manage Stripe payments, customers, and subscriptions","category":"productivity","requiredEnvKeys":["STRIPE_SECRET_KEY"],"repo":"https://github.com/stripe/ai","verified":true,"prerequisite":"A restricted API key (dashboard.stripe.com/apikeys) scoped to just the resources the agent needs is strongly recommended."},{"name":"paypal","displayName":"PayPal","iconKey":"paypal","npmPackage":"@paypal/mcp","description":"Manage PayPal invoices, orders, and subscriptions","category":"productivity","requiredEnvKeys":["PAYPAL_ACCESS_TOKEN","PAYPAL_ENVIRONMENT"],"repo":"https://github.com/paypal/agent-toolkit","verified":true,"prerequisite":"Generate an access token from your PayPal developer client ID + secret; set PAYPAL_ENVIRONMENT to SANDBOX or PRODUCTION."},{"name":"hubspot","displayName":"HubSpot","iconKey":"hubspot","npmPackage":"@hubspot/mcp-server","description":"Query and manage HubSpot CRM objects and associations","category":"productivity","requiredEnvKeys":["PRIVATE_APP_ACCESS_TOKEN"],"repo":"https://developers.hubspot.com/mcp","verified":true,"prerequisite":"Needs a HubSpot private-app access token (Settings > Integrations > Private Apps). Beta."},{"name":"zapier","displayName":"Zapier","iconKey":"zapier","url":"https://mcp.zapier.com/api/v1/connect","bearerTokenEnvVar":"ZAPIER_MCP_TOKEN","description":"Run actions across 8000+ apps through your Zapier MCP server","category":"productivity","requiredEnvKeys":["ZAPIER_MCP_TOKEN"],"repo":"https://zapier.com/mcp","verified":true,"prerequisite":"Create an MCP server and pick its tools at mcp.zapier.com first; use the token from its Connect tab."},{"name":"atlassian","displayName":"Atlassian (self-host)","iconKey":"atlassian","pypiPackage":"mcp-atlassian","runtime":"python","description":"Jira and Confluence — Cloud, Server, and Data Center","category":"productivity","requiredEnvKeys":[],"optionalEnvKeys":["JIRA_URL","JIRA_USERNAME","JIRA_API_TOKEN","JIRA_PERSONAL_TOKEN","CONFLUENCE_URL","CONFLUENCE_USERNAME","CONFLUENCE_API_TOKEN"],"repo":"https://github.com/sooperset/mcp-atlassian","verified":false,"prerequisite":"Set the JIRA_* and/or CONFLUENCE_* trio for the products you use (Cloud: URL + username + API token; Server/DC: URL + personal access token)."},{"name":"trello","displayName":"Trello","iconKey":"trello","npmPackage":"@delorenj/mcp-server-trello","description":"Manage Trello boards, lists, and cards","category":"productivity","requiredEnvKeys":["TRELLO_API_KEY","TRELLO_TOKEN"],"optionalEnvKeys":["TRELLO_WORKSPACE_ID"],"repo":"https://github.com/delorenj/mcp-server-trello","verified":false,"prerequisite":"API key and token from trello.com/app-key."},{"name":"google-calendar","displayName":"Google Calendar","iconKey":"google-calendar","npmPackage":"@cocal/google-calendar-mcp","description":"Read, create, and manage Google Calendar events","category":"productivity","requiredEnvKeys":["GOOGLE_OAUTH_CREDENTIALS"],"repo":"https://github.com/nspady/google-calendar-mcp","runLocation":"host","verified":false,"auth":true,"authArgs":["auth"],"credentialFiles":[{"path":"~/.config/google-calendar-mcp/gcp-oauth.keys.json","required":true},{"path":"~/.config/google-calendar-mcp/tokens.json"}],"prerequisite":"Needs a Google OAuth client JSON (Desktop app) with the Calendar API enabled. GOOGLE_OAUTH_CREDENTIALS is the key file PATH (e.g. ~/.config/google-calendar-mcp/gcp-oauth.keys.json), not a token."},{"name":"google-docs","displayName":"Google Docs","iconKey":"google-docs","npmPackage":"@a-bonus/google-docs-mcp","description":"Read and edit Google Docs, Sheets, and Drive files","category":"productivity","requiredEnvKeys":["GOOGLE_CLIENT_ID","GOOGLE_CLIENT_SECRET"],"repo":"https://github.com/a-bonus/google-docs-mcp","runLocation":"host","verified":false,"auth":true,"authArgs":["auth"],"credentialFiles":[{"path":"~/.config/google-docs-mcp/token.json"}],"prerequisite":"Needs a Google OAuth client (ID + secret) from console.cloud.google.com with the Docs, Sheets, and Drive APIs enabled."},{"name":"workspace","displayName":"Google Workspace","pypiPackage":"workspace-mcp","runtime":"python","description":"All-in-one Google Workspace: Gmail, Drive, Calendar, Docs, Sheets, Slides, and more (120+ tools)","category":"productivity","requiredEnvKeys":["GOOGLE_OAUTH_CLIENT_ID","GOOGLE_OAUTH_CLIENT_SECRET"],"repo":"https://github.com/taylorwilsdon/google_workspace_mcp","runLocation":"host","verified":false,"prerequisite":"Needs a Google OAuth client from console.cloud.google.com with each Workspace API enabled. Browser sign-in happens in-flow on first use (port 8000) — host run recommended."},{"name":"raindrop","displayName":"Raindrop.io","npmPackage":"@adeze/raindrop-mcp","description":"Manage Raindrop.io bookmarks, collections, and tags","category":"productivity","requiredEnvKeys":["RAINDROP_ACCESS_TOKEN"],"repo":"https://github.com/adeze/raindrop-mcp","verified":false,"prerequisite":"Test token from app.raindrop.io/settings/integrations (create an app, then \\"Test token\\")."},{"name":"grafana","displayName":"Grafana","iconKey":"grafana","pypiPackage":"mcp-grafana","runtime":"python","description":"Query Grafana dashboards, datasources, alerts, and incidents","category":"infra","requiredEnvKeys":["GRAFANA_URL","GRAFANA_SERVICE_ACCOUNT_TOKEN"],"repo":"https://github.com/grafana/mcp-grafana","verified":true,"prerequisite":"Needs a reachable Grafana 9.0+ instance and a service-account token."},{"name":"pagerduty","displayName":"PagerDuty","iconKey":"pagerduty","pypiPackage":"pagerduty-mcp","runtime":"python","description":"Query PagerDuty incidents, services, and on-call schedules (writes off by default)","category":"infra","requiredEnvKeys":["PAGERDUTY_USER_API_KEY"],"repo":"https://github.com/PagerDuty/pagerduty-mcp-server","verified":true},{"name":"netlify","displayName":"Netlify","iconKey":"netlify","npmPackage":"@netlify/mcp","description":"Create, build, deploy, and manage Netlify projects","category":"infra","requiredEnvKeys":[],"optionalEnvKeys":["NETLIFY_PERSONAL_ACCESS_TOKEN"],"repo":"https://github.com/netlify/netlify-mcp","runLocation":"host","verified":true,"prerequisite":"Reuses Netlify CLI login state — run `netlify login` on host first (or set NETLIFY_PERSONAL_ACCESS_TOKEN). Requires Node 22+."},{"name":"cloudflare-bindings","displayName":"Cloudflare Bindings","iconKey":"cloudflare","url":"https://bindings.mcp.cloudflare.com/mcp","oauth":true,"bearerTokenEnvVar":"CLOUDFLARE_API_TOKEN","description":"Build with Cloudflare Workers: KV, R2, D1, and Durable Objects","category":"infra","requiredEnvKeys":["CLOUDFLARE_API_TOKEN"],"repo":"https://github.com/cloudflare/mcp-server-cloudflare","verified":true,"prerequisite":"Needs a Cloudflare API token scoped for Workers resources."},{"name":"cloudflare-observability","displayName":"Cloudflare Observability","iconKey":"cloudflare","url":"https://observability.mcp.cloudflare.com/mcp","oauth":true,"bearerTokenEnvVar":"CLOUDFLARE_API_TOKEN","description":"Debug Cloudflare Workers: logs, analytics, and errors","category":"infra","requiredEnvKeys":["CLOUDFLARE_API_TOKEN"],"repo":"https://github.com/cloudflare/mcp-server-cloudflare","verified":true,"prerequisite":"Needs a Cloudflare API token with Workers observability scopes."},{"name":"datadog","displayName":"Datadog","url":"https://mcp.datadoghq.com/v1/mcp","headerEnv":[{"header":"DD-API-KEY","env":"DD_API_KEY"},{"header":"DD-APPLICATION-KEY","env":"DD_APPLICATION_KEY"}],"description":"Query Datadog monitors, dashboards, metrics, and incidents","category":"infra","requiredEnvKeys":["DD_API_KEY","DD_APPLICATION_KEY"],"repo":"https://docs.datadoghq.com/mcp_server/","verified":true,"prerequisite":"US1 endpoint — swap the host for your region (e.g. mcp.datadoghq.eu). Needs a Datadog API key and application key."},{"name":"prometheus","displayName":"Prometheus","iconKey":"prometheus","pypiPackage":"prometheus-mcp-server","runtime":"python","description":"Run PromQL queries and explore Prometheus metrics","category":"infra","requiredEnvKeys":["PROMETHEUS_URL"],"repo":"https://github.com/pab1it0/prometheus-mcp-server","verified":false,"prerequisite":"Needs a reachable Prometheus server."},{"name":"kubernetes","displayName":"Kubernetes","iconKey":"kubernetes","npmPackage":"kubernetes-mcp-server","description":"Inspect and manage Kubernetes clusters via the native API (no kubectl needed)","category":"infra","requiredEnvKeys":[],"optionalEnvKeys":["KUBECONFIG"],"repo":"https://github.com/containers/kubernetes-mcp-server","runLocation":"host","verified":false,"prerequisite":"Needs a kubeconfig on the machine it runs on — host run recommended."},{"name":"docker","displayName":"Docker","iconKey":"docker","pypiPackage":"mcp-server-docker","runtime":"python","description":"Manage Docker containers, images, volumes, and networks","category":"infra","requiredEnvKeys":[],"optionalEnvKeys":["DOCKER_HOST"],"repo":"https://github.com/ckreiling/mcp-server-docker","runLocation":"host","verified":false,"prerequisite":"Needs access to a Docker daemon — host run recommended (DOCKER_HOST supports ssh:// remotes)."},{"name":"elevenlabs","displayName":"ElevenLabs","iconKey":"elevenlabs","pypiPackage":"elevenlabs-mcp","runtime":"python","description":"Text-to-speech, voice cloning, and audio generation via ElevenLabs","category":"ai","requiredEnvKeys":["ELEVENLABS_API_KEY"],"optionalEnvKeys":["ELEVENLABS_MCP_BASE_PATH","ELEVENLABS_MCP_OUTPUT_MODE"],"repo":"https://github.com/elevenlabs/elevenlabs-mcp","verified":true},{"name":"antv-chart","displayName":"AntV Chart","npmPackage":"@antv/mcp-server-chart","description":"Generate 25+ chart types as images via AntV","category":"ai","requiredEnvKeys":[],"repo":"https://github.com/antvis/mcp-server-chart","verified":true},{"name":"browserbase","displayName":"Browserbase","npmPackage":"@browserbasehq/mcp","description":"Cloud browser automation with Stagehand — act, extract, and observe on any site","category":"ai","requiredEnvKeys":["BROWSERBASE_API_KEY","BROWSERBASE_PROJECT_ID","GEMINI_API_KEY"],"repo":"https://github.com/browserbase/mcp-server-browserbase","verified":true,"prerequisite":"Needs a Browserbase API key + project ID, plus a Gemini API key for the default Stagehand model."},{"name":"huggingface","displayName":"Hugging Face","iconKey":"huggingface","url":"https://huggingface.co/mcp","oauth":true,"bearerTokenEnvVar":"HF_TOKEN","description":"Search Hugging Face models, datasets, papers, and Spaces","category":"ai","requiredEnvKeys":["HF_TOKEN"],"repo":"https://github.com/huggingface/hf-mcp-server","verified":true,"prerequisite":"Needs a Hugging Face access token (huggingface.co/settings/tokens, Read scope)."},{"name":"mermaid","displayName":"Mermaid","iconKey":"mermaid","npmPackage":"mcp-mermaid","description":"Generate and render Mermaid diagrams","category":"ai","requiredEnvKeys":[],"repo":"https://github.com/hustcc/mcp-mermaid","verified":false},{"name":"blender","displayName":"Blender","iconKey":"blender","pypiPackage":"blender-mcp","runtime":"python","description":"Control Blender for 3D modeling and scene creation","category":"ai","requiredEnvKeys":[],"repo":"https://github.com/ahujasid/blender-mcp","runLocation":"host","verified":false,"prerequisite":"Install the Blender MCP addon and click \\"Start MCP Server\\" inside Blender first; connects to localhost:9876 — host run required."}]'),Ml={$notes:El,schemaVersion:Pl,updatedAt:Rl,entries:Tl};var Le;(function(a){a.assertEqual=n=>{};function t(n){}a.assertIs=t;function s(n){throw new Error}a.assertNever=s,a.arrayToEnum=n=>{const i={};for(const l of n)i[l]=l;return i},a.getValidEnumValues=n=>{const i=a.objectKeys(n).filter(c=>typeof n[n[c]]!="number"),l={};for(const c of i)l[c]=n[c];return a.objectValues(l)},a.objectValues=n=>a.objectKeys(n).map(function(i){return n[i]}),a.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const i=[];for(const l in n)Object.prototype.hasOwnProperty.call(n,l)&&i.push(l);return i},a.find=(n,i)=>{for(const l of n)if(i(l))return l},a.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function r(n,i=" | "){return n.map(l=>typeof l=="string"?`'${l}'`:l).join(i)}a.joinValues=r,a.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(Le||(Le={}));var Gs;(function(a){a.mergeShapes=(t,s)=>({...t,...s})})(Gs||(Gs={}));const le=Le.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wt=a=>{switch(typeof a){case"undefined":return le.undefined;case"string":return le.string;case"number":return Number.isNaN(a)?le.nan:le.number;case"boolean":return le.boolean;case"function":return le.function;case"bigint":return le.bigint;case"symbol":return le.symbol;case"object":return Array.isArray(a)?le.array:a===null?le.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?le.promise:typeof Map<"u"&&a instanceof Map?le.map:typeof Set<"u"&&a instanceof Set?le.set:typeof Date<"u"&&a instanceof Date?le.date:le.object;default:return le.unknown}},B=Le.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class vt extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}format(t){const s=t||function(i){return i.message},r={_errors:[]},n=i=>{for(const l of i.issues)if(l.code==="invalid_union")l.unionErrors.map(n);else if(l.code==="invalid_return_type")n(l.returnTypeError);else if(l.code==="invalid_arguments")n(l.argumentsError);else if(l.path.length===0)r._errors.push(s(l));else{let c=r,d=0;for(;d<l.path.length;){const h=l.path[d];d===l.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(s(l))):c[h]=c[h]||{_errors:[]},c=c[h],d++}}};return n(this),r}static assert(t){if(!(t instanceof vt))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Le.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){const s={},r=[];for(const n of this.issues)if(n.path.length>0){const i=n.path[0];s[i]=s[i]||[],s[i].push(t(n))}else r.push(t(n));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}vt.create=a=>new vt(a);const Ja=(a,t)=>{let s;switch(a.code){case B.invalid_type:a.received===le.undefined?s="Required":s=`Expected ${a.expected}, received ${a.received}`;break;case B.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(a.expected,Le.jsonStringifyReplacer)}`;break;case B.unrecognized_keys:s=`Unrecognized key(s) in object: ${Le.joinValues(a.keys,", ")}`;break;case B.invalid_union:s="Invalid input";break;case B.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${Le.joinValues(a.options)}`;break;case B.invalid_enum_value:s=`Invalid enum value. Expected ${Le.joinValues(a.options)}, received '${a.received}'`;break;case B.invalid_arguments:s="Invalid function arguments";break;case B.invalid_return_type:s="Invalid function return type";break;case B.invalid_date:s="Invalid date";break;case B.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(s=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?s=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?s=`Invalid input: must end with "${a.validation.endsWith}"`:Le.assertNever(a.validation):a.validation!=="regex"?s=`Invalid ${a.validation}`:s="Invalid";break;case B.too_small:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?s=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:s="Invalid input";break;case B.too_big:a.type==="array"?s=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?s=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?s=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?s=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?s=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:s="Invalid input";break;case B.custom:s="Invalid input";break;case B.invalid_intersection_types:s="Intersection results could not be merged";break;case B.not_multiple_of:s=`Number must be a multiple of ${a.multipleOf}`;break;case B.not_finite:s="Number must be finite";break;default:s=t.defaultError,Le.assertNever(a)}return{message:s}};let Ll=Ja;function Il(){return Ll}const Dl=a=>{const{data:t,path:s,errorMaps:r,issueData:n}=a,i=[...s,...n.path||[]],l={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let c="";const d=r.filter(h=>!!h).slice().reverse();for(const h of d)c=h(l,{data:t,defaultError:c}).message;return{...n,path:i,message:c}};function Q(a,t){const s=Il(),r=Dl({issueData:t,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,s,s===Ja?void 0:Ja].filter(n=>!!n)});a.common.issues.push(r)}class lt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){const r=[];for(const n of s){if(n.status==="aborted")return je;n.status==="dirty"&&t.dirty(),r.push(n.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,s){const r=[];for(const n of s){const i=await n.key,l=await n.value;r.push({key:i,value:l})}return lt.mergeObjectSync(t,r)}static mergeObjectSync(t,s){const r={};for(const n of s){const{key:i,value:l}=n;if(i.status==="aborted"||l.status==="aborted")return je;i.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof l.value<"u"||n.alwaysSet)&&(r[i.value]=l.value)}return{status:t.value,value:r}}}const je=Object.freeze({status:"aborted"}),aa=a=>({status:"dirty",value:a}),dt=a=>({status:"valid",value:a}),Ys=a=>a.status==="aborted",Qs=a=>a.status==="dirty",Ut=a=>a.status==="valid",ka=a=>typeof Promise<"u"&&a instanceof Promise;var de;(function(a){a.errToObj=t=>typeof t=="string"?{message:t}:t||{},a.toString=t=>typeof t=="string"?t:t?.message})(de||(de={}));class At{constructor(t,s,r,n){this._cachedPath=[],this.parent=t,this.data=s,this._path=r,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Js=(a,t)=>{if(Ut(t))return{success:!0,data:t.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new vt(a.common.issues);return this._error=s,this._error}}};function _e(a){if(!a)return{};const{errorMap:t,invalid_type_error:s,required_error:r,description:n}=a;if(t&&(s||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(l,c)=>{const{message:d}=a;return l.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:d??r??c.defaultError}:l.code!=="invalid_type"?{message:c.defaultError}:{message:d??s??c.defaultError}},description:n}}class Te{get description(){return this._def.description}_getType(t){return wt(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:wt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new lt,ctx:{common:t.parent.common,data:t.data,parsedType:wt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const s=this._parse(t);if(ka(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){const s=this._parse(t);return Promise.resolve(s)}parse(t,s){const r=this.safeParse(t,s);if(r.success)return r.data;throw r.error}safeParse(t,s){const r={common:{issues:[],async:s?.async??!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wt(t)},n=this._parseSync({data:t,path:r.path,parent:r});return Js(r,n)}"~validate"(t){const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wt(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:s});return Ut(r)?{value:r.value}:{issues:s.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:s}).then(r=>Ut(r)?{value:r.value}:{issues:s.common.issues})}async parseAsync(t,s){const r=await this.safeParseAsync(t,s);if(r.success)return r.data;throw r.error}async safeParseAsync(t,s){const r={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wt(t)},n=this._parse({data:t,path:r.path,parent:r}),i=await(ka(n)?n:Promise.resolve(n));return Js(r,i)}refine(t,s){const r=n=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(n):s;return this._refinement((n,i)=>{const l=t(n),c=()=>i.addIssue({code:B.custom,...r(n)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(c(),!1)):l?!0:(c(),!1)})}refinement(t,s){return this._refinement((r,n)=>t(r)?!0:(n.addIssue(typeof s=="function"?s(r,n):s),!1))}_refinement(t){return new Vt({schema:this,typeName:ke.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:s=>this["~validate"](s)}}optional(){return Ct.create(this,this._def)}nullable(){return Zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mt.create(this)}promise(){return Ca.create(this,this._def)}or(t){return Na.create([this,t],this._def)}and(t){return Sa.create(this,t,this._def)}transform(t){return new Vt({..._e(this._def),schema:this,typeName:ke.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const s=typeof t=="function"?t:()=>t;return new ts({..._e(this._def),innerType:this,defaultValue:s,typeName:ke.ZodDefault})}brand(){return new nc({typeName:ke.ZodBranded,type:this,..._e(this._def)})}catch(t){const s=typeof t=="function"?t:()=>t;return new as({..._e(this._def),innerType:this,catchValue:s,typeName:ke.ZodCatch})}describe(t){const s=this.constructor;return new s({...this._def,description:t})}pipe(t){return xs.create(this,t)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ol=/^c[^\s-]{8,}$/i,$l=/^[0-9a-z]+$/,Kl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bl=/^[a-z0-9_-]{21}$/i,ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zl=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ul=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Fa;const Vl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zl=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Wl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Gl=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yl=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ql=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Dr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Jl=new RegExp(`^${Dr}$`);function Or(a){let t="[0-5]\\d";a.precision?t=`${t}\\.\\d{${a.precision}}`:a.precision==null&&(t=`${t}(\\.\\d+)?`);const s=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${s}`}function Xl(a){return new RegExp(`^${Or(a)}$`)}function ec(a){let t=`${Dr}T${Or(a)}`;const s=[];return s.push(a.local?"Z?":"Z"),a.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function tc(a,t){return!!((t==="v4"||!t)&&Vl.test(a)||(t==="v6"||!t)&&Wl.test(a))}function ac(a,t){if(!ql.test(a))return!1;try{const[s]=a.split(".");if(!s)return!1;const r=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(r));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function sc(a,t){return!!((t==="v4"||!t)&&Zl.test(a)||(t==="v6"||!t)&&Gl.test(a))}class St extends Te{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==le.string){const i=this._getOrReturnCtx(t);return Q(i,{code:B.invalid_type,expected:le.string,received:i.parsedType}),je}const r=new lt;let n;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:B.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:B.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const l=t.data.length>i.value,c=t.data.length<i.value;(l||c)&&(n=this._getOrReturnCtx(t,n),l?Q(n,{code:B.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&Q(n,{code:B.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")Ul.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"email",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Fa||(Fa=new RegExp(Hl,"u")),Fa.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"emoji",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Fl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"uuid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Bl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"nanoid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Ol.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cuid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")$l.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cuid2",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Kl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"ulid",code:B.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),Q(n,{validation:"url",code:B.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"regex",code:B.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ec(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Jl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Xl(i).test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{code:B.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?zl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"duration",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?tc(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"ip",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?ac(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"jwt",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?sc(t.data,i.version)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"cidr",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Yl.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"base64",code:B.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Ql.test(t.data)||(n=this._getOrReturnCtx(t,n),Q(n,{validation:"base64url",code:B.invalid_string,message:i.message}),r.dirty()):Le.assertNever(i);return{status:r.value,value:t.data}}_regex(t,s,r){return this.refinement(n=>t.test(n),{validation:s,code:B.invalid_string,...de.errToObj(r)})}_addCheck(t){return new St({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...de.errToObj(t)})}url(t){return this._addCheck({kind:"url",...de.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...de.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...de.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...de.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...de.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...de.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...de.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...de.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...de.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...de.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...de.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...de.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...de.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...de.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...de.errToObj(t)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...de.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s?.position,...de.errToObj(s?.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...de.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...de.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...de.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...de.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...de.errToObj(s)})}nonempty(t){return this.min(1,de.errToObj(t))}trim(){return new St({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new St({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new St({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}St.create=a=>new St({checks:[],typeName:ke.ZodString,coerce:a?.coerce??!1,..._e(a)});function rc(a,t){const s=(a.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=s>r?s:r,i=Number.parseInt(a.toFixed(n).replace(".","")),l=Number.parseInt(t.toFixed(n).replace(".",""));return i%l/10**n}class la extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==le.number){const i=this._getOrReturnCtx(t);return Q(i,{code:B.invalid_type,expected:le.number,received:i.parsedType}),je}let r;const n=new lt;for(const i of this._def.checks)i.kind==="int"?Le.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Q(r,{code:B.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?rc(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Q(r,{code:B.not_finite,message:i.message}),n.dirty()):Le.assertNever(i);return{status:n.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,de.toString(s))}gt(t,s){return this.setLimit("min",t,!1,de.toString(s))}lte(t,s){return this.setLimit("max",t,!0,de.toString(s))}lt(t,s){return this.setLimit("max",t,!1,de.toString(s))}setLimit(t,s,r,n){return new la({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:r,message:de.toString(n)}]})}_addCheck(t){return new la({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:de.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:de.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:de.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:de.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:de.toString(t)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Le.isInteger(t.value))}get isFinite(){let t=null,s=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(s===null||r.value>s)&&(s=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(s)&&Number.isFinite(t)}}la.create=a=>new la({checks:[],typeName:ke.ZodNumber,coerce:a?.coerce||!1,..._e(a)});class ca extends Te{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==le.bigint)return this._getInvalidInput(t);let r;const n=new lt;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Q(r,{code:B.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):Le.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){const s=this._getOrReturnCtx(t);return Q(s,{code:B.invalid_type,expected:le.bigint,received:s.parsedType}),je}gte(t,s){return this.setLimit("min",t,!0,de.toString(s))}gt(t,s){return this.setLimit("min",t,!1,de.toString(s))}lte(t,s){return this.setLimit("max",t,!0,de.toString(s))}lt(t,s){return this.setLimit("max",t,!1,de.toString(s))}setLimit(t,s,r,n){return new ca({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:r,message:de.toString(n)}]})}_addCheck(t){return new ca({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:de.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:de.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:de.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:de.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:de.toString(s)})}get minValue(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}}ca.create=a=>new ca({checks:[],typeName:ke.ZodBigInt,coerce:a?.coerce??!1,..._e(a)});class Xa extends Te{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==le.boolean){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.boolean,received:r.parsedType}),je}return dt(t.data)}}Xa.create=a=>new Xa({typeName:ke.ZodBoolean,coerce:a?.coerce||!1,..._e(a)});class wa extends Te{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==le.date){const i=this._getOrReturnCtx(t);return Q(i,{code:B.invalid_type,expected:le.date,received:i.parsedType}),je}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Q(i,{code:B.invalid_date}),je}const r=new lt;let n;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:B.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),Q(n,{code:B.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Le.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new wa({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:de.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:de.toString(s)})}get minDate(){let t=null;for(const s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}}wa.create=a=>new wa({checks:[],coerce:a?.coerce||!1,typeName:ke.ZodDate,..._e(a)});class Xs extends Te{_parse(t){if(this._getType(t)!==le.symbol){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.symbol,received:r.parsedType}),je}return dt(t.data)}}Xs.create=a=>new Xs({typeName:ke.ZodSymbol,..._e(a)});class er extends Te{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.undefined,received:r.parsedType}),je}return dt(t.data)}}er.create=a=>new er({typeName:ke.ZodUndefined,..._e(a)});class tr extends Te{_parse(t){if(this._getType(t)!==le.null){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.null,received:r.parsedType}),je}return dt(t.data)}}tr.create=a=>new tr({typeName:ke.ZodNull,..._e(a)});class ar extends Te{constructor(){super(...arguments),this._any=!0}_parse(t){return dt(t.data)}}ar.create=a=>new ar({typeName:ke.ZodAny,..._e(a)});class sr extends Te{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dt(t.data)}}sr.create=a=>new sr({typeName:ke.ZodUnknown,..._e(a)});class _t extends Te{_parse(t){const s=this._getOrReturnCtx(t);return Q(s,{code:B.invalid_type,expected:le.never,received:s.parsedType}),je}}_t.create=a=>new _t({typeName:ke.ZodNever,..._e(a)});class rr extends Te{_parse(t){if(this._getType(t)!==le.undefined){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.void,received:r.parsedType}),je}return dt(t.data)}}rr.create=a=>new rr({typeName:ke.ZodVoid,..._e(a)});class mt extends Te{_parse(t){const{ctx:s,status:r}=this._processInputParams(t),n=this._def;if(s.parsedType!==le.array)return Q(s,{code:B.invalid_type,expected:le.array,received:s.parsedType}),je;if(n.exactLength!==null){const l=s.data.length>n.exactLength.value,c=s.data.length<n.exactLength.value;(l||c)&&(Q(s,{code:l?B.too_big:B.too_small,minimum:c?n.exactLength.value:void 0,maximum:l?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&s.data.length<n.minLength.value&&(Q(s,{code:B.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&s.data.length>n.maxLength.value&&(Q(s,{code:B.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),s.common.async)return Promise.all([...s.data].map((l,c)=>n.type._parseAsync(new At(s,l,s.path,c)))).then(l=>lt.mergeArray(r,l));const i=[...s.data].map((l,c)=>n.type._parseSync(new At(s,l,s.path,c)));return lt.mergeArray(r,i)}get element(){return this._def.type}min(t,s){return new mt({...this._def,minLength:{value:t,message:de.toString(s)}})}max(t,s){return new mt({...this._def,maxLength:{value:t,message:de.toString(s)}})}length(t,s){return new mt({...this._def,exactLength:{value:t,message:de.toString(s)}})}nonempty(t){return this.min(1,t)}}mt.create=(a,t)=>new mt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:ke.ZodArray,..._e(t)});function Kt(a){if(a instanceof Ze){const t={};for(const s in a.shape){const r=a.shape[s];t[s]=Ct.create(Kt(r))}return new Ze({...a._def,shape:()=>t})}else return a instanceof mt?new mt({...a._def,type:Kt(a.element)}):a instanceof Ct?Ct.create(Kt(a.unwrap())):a instanceof Zt?Zt.create(Kt(a.unwrap())):a instanceof Dt?Dt.create(a.items.map(t=>Kt(t))):a}class Ze extends Te{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),s=Le.objectKeys(t);return this._cached={shape:t,keys:s},this._cached}_parse(t){if(this._getType(t)!==le.object){const h=this._getOrReturnCtx(t);return Q(h,{code:B.invalid_type,expected:le.object,received:h.parsedType}),je}const{status:r,ctx:n}=this._processInputParams(t),{shape:i,keys:l}=this._getCached(),c=[];if(!(this._def.catchall instanceof _t&&this._def.unknownKeys==="strip"))for(const h in n.data)l.includes(h)||c.push(h);const d=[];for(const h of l){const f=i[h],b=n.data[h];d.push({key:{status:"valid",value:h},value:f._parse(new At(n,b,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof _t){const h=this._def.unknownKeys;if(h==="passthrough")for(const f of c)d.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(h==="strict")c.length>0&&(Q(n,{code:B.unrecognized_keys,keys:c}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const f of c){const b=n.data[f];d.push({key:{status:"valid",value:f},value:h._parse(new At(n,b,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const h=[];for(const f of d){const b=await f.key,C=await f.value;h.push({key:b,value:C,alwaysSet:f.alwaysSet})}return h}).then(h=>lt.mergeObjectSync(r,h)):lt.mergeObjectSync(r,d)}get shape(){return this._def.shape()}strict(t){return de.errToObj,new Ze({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,r)=>{const n=this._def.errorMap?.(s,r).message??r.defaultError;return s.code==="unrecognized_keys"?{message:de.errToObj(t).message??n}:{message:n}}}:{}})}strip(){return new Ze({...this._def,unknownKeys:"strip"})}passthrough(){return new Ze({...this._def,unknownKeys:"passthrough"})}extend(t){return new Ze({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Ze({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ke.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new Ze({...this._def,catchall:t})}pick(t){const s={};for(const r of Le.objectKeys(t))t[r]&&this.shape[r]&&(s[r]=this.shape[r]);return new Ze({...this._def,shape:()=>s})}omit(t){const s={};for(const r of Le.objectKeys(this.shape))t[r]||(s[r]=this.shape[r]);return new Ze({...this._def,shape:()=>s})}deepPartial(){return Kt(this)}partial(t){const s={};for(const r of Le.objectKeys(this.shape)){const n=this.shape[r];t&&!t[r]?s[r]=n:s[r]=n.optional()}return new Ze({...this._def,shape:()=>s})}required(t){const s={};for(const r of Le.objectKeys(this.shape))if(t&&!t[r])s[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Ct;)i=i._def.innerType;s[r]=i}return new Ze({...this._def,shape:()=>s})}keyof(){return $r(Le.objectKeys(this.shape))}}Ze.create=(a,t)=>new Ze({shape:()=>a,unknownKeys:"strip",catchall:_t.create(),typeName:ke.ZodObject,..._e(t)});Ze.strictCreate=(a,t)=>new Ze({shape:()=>a,unknownKeys:"strict",catchall:_t.create(),typeName:ke.ZodObject,..._e(t)});Ze.lazycreate=(a,t)=>new Ze({shape:a,unknownKeys:"strip",catchall:_t.create(),typeName:ke.ZodObject,..._e(t)});class Na extends Te{_parse(t){const{ctx:s}=this._processInputParams(t),r=this._def.options;function n(i){for(const c of i)if(c.result.status==="valid")return c.result;for(const c of i)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const l=i.map(c=>new vt(c.ctx.common.issues));return Q(s,{code:B.invalid_union,unionErrors:l}),je}if(s.common.async)return Promise.all(r.map(async i=>{const l={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:l}),ctx:l}})).then(n);{let i;const l=[];for(const d of r){const h={...s,common:{...s.common,issues:[]},parent:null},f=d._parseSync({data:s.data,path:s.path,parent:h});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:h}),h.common.issues.length&&l.push(h.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const c=l.map(d=>new vt(d));return Q(s,{code:B.invalid_union,unionErrors:c}),je}}get options(){return this._def.options}}Na.create=(a,t)=>new Na({options:a,typeName:ke.ZodUnion,..._e(t)});function es(a,t){const s=wt(a),r=wt(t);if(a===t)return{valid:!0,data:a};if(s===le.object&&r===le.object){const n=Le.objectKeys(t),i=Le.objectKeys(a).filter(c=>n.indexOf(c)!==-1),l={...a,...t};for(const c of i){const d=es(a[c],t[c]);if(!d.valid)return{valid:!1};l[c]=d.data}return{valid:!0,data:l}}else if(s===le.array&&r===le.array){if(a.length!==t.length)return{valid:!1};const n=[];for(let i=0;i<a.length;i++){const l=a[i],c=t[i],d=es(l,c);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return s===le.date&&r===le.date&&+a==+t?{valid:!0,data:a}:{valid:!1}}class Sa extends Te{_parse(t){const{status:s,ctx:r}=this._processInputParams(t),n=(i,l)=>{if(Ys(i)||Ys(l))return je;const c=es(i.value,l.value);return c.valid?((Qs(i)||Qs(l))&&s.dirty(),{status:s.value,value:c.data}):(Q(r,{code:B.invalid_intersection_types}),je)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,l])=>n(i,l)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Sa.create=(a,t,s)=>new Sa({left:a,right:t,typeName:ke.ZodIntersection,..._e(s)});class Dt extends Te{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.array)return Q(r,{code:B.invalid_type,expected:le.array,received:r.parsedType}),je;if(r.data.length<this._def.items.length)return Q(r,{code:B.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&r.data.length>this._def.items.length&&(Q(r,{code:B.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...r.data].map((l,c)=>{const d=this._def.items[c]||this._def.rest;return d?d._parse(new At(r,l,r.path,c)):null}).filter(l=>!!l);return r.common.async?Promise.all(i).then(l=>lt.mergeArray(s,l)):lt.mergeArray(s,i)}get items(){return this._def.items}rest(t){return new Dt({...this._def,rest:t})}}Dt.create=(a,t)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:a,typeName:ke.ZodTuple,rest:null,..._e(t)})};class nr extends Te{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.map)return Q(r,{code:B.invalid_type,expected:le.map,received:r.parsedType}),je;const n=this._def.keyType,i=this._def.valueType,l=[...r.data.entries()].map(([c,d],h)=>({key:n._parse(new At(r,c,r.path,[h,"key"])),value:i._parse(new At(r,d,r.path,[h,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const d of l){const h=await d.key,f=await d.value;if(h.status==="aborted"||f.status==="aborted")return je;(h.status==="dirty"||f.status==="dirty")&&s.dirty(),c.set(h.value,f.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const d of l){const h=d.key,f=d.value;if(h.status==="aborted"||f.status==="aborted")return je;(h.status==="dirty"||f.status==="dirty")&&s.dirty(),c.set(h.value,f.value)}return{status:s.value,value:c}}}}nr.create=(a,t,s)=>new nr({valueType:t,keyType:a,typeName:ke.ZodMap,..._e(s)});class da extends Te{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.parsedType!==le.set)return Q(r,{code:B.invalid_type,expected:le.set,received:r.parsedType}),je;const n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(Q(r,{code:B.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),s.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(Q(r,{code:B.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),s.dirty());const i=this._def.valueType;function l(d){const h=new Set;for(const f of d){if(f.status==="aborted")return je;f.status==="dirty"&&s.dirty(),h.add(f.value)}return{status:s.value,value:h}}const c=[...r.data.values()].map((d,h)=>i._parse(new At(r,d,r.path,h)));return r.common.async?Promise.all(c).then(d=>l(d)):l(c)}min(t,s){return new da({...this._def,minSize:{value:t,message:de.toString(s)}})}max(t,s){return new da({...this._def,maxSize:{value:t,message:de.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}}da.create=(a,t)=>new da({valueType:a,minSize:null,maxSize:null,typeName:ke.ZodSet,..._e(t)});class ir extends Te{get schema(){return this._def.getter()}_parse(t){const{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}ir.create=(a,t)=>new ir({getter:a,typeName:ke.ZodLazy,..._e(t)});class or extends Te{_parse(t){if(t.data!==this._def.value){const s=this._getOrReturnCtx(t);return Q(s,{received:s.data,code:B.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:t.data}}get value(){return this._def.value}}or.create=(a,t)=>new or({value:a,typeName:ke.ZodLiteral,..._e(t)});function $r(a,t){return new Ht({values:a,typeName:ke.ZodEnum,..._e(t)})}class Ht extends Te{_parse(t){if(typeof t.data!="string"){const s=this._getOrReturnCtx(t),r=this._def.values;return Q(s,{expected:Le.joinValues(r),received:s.parsedType,code:B.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const s=this._getOrReturnCtx(t),r=this._def.values;return Q(s,{received:s.data,code:B.invalid_enum_value,options:r}),je}return dt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const s of this._def.values)t[s]=s;return t}get Values(){const t={};for(const s of this._def.values)t[s]=s;return t}get Enum(){const t={};for(const s of this._def.values)t[s]=s;return t}extract(t,s=this._def){return Ht.create(t,{...this._def,...s})}exclude(t,s=this._def){return Ht.create(this.options.filter(r=>!t.includes(r)),{...this._def,...s})}}Ht.create=$r;class lr extends Te{_parse(t){const s=Le.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==le.string&&r.parsedType!==le.number){const n=Le.objectValues(s);return Q(r,{expected:Le.joinValues(n),received:r.parsedType,code:B.invalid_type}),je}if(this._cache||(this._cache=new Set(Le.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const n=Le.objectValues(s);return Q(r,{received:r.data,code:B.invalid_enum_value,options:n}),je}return dt(t.data)}get enum(){return this._def.values}}lr.create=(a,t)=>new lr({values:a,typeName:ke.ZodNativeEnum,..._e(t)});class Ca extends Te{unwrap(){return this._def.type}_parse(t){const{ctx:s}=this._processInputParams(t);if(s.parsedType!==le.promise&&s.common.async===!1)return Q(s,{code:B.invalid_type,expected:le.promise,received:s.parsedType}),je;const r=s.parsedType===le.promise?s.data:Promise.resolve(s.data);return dt(r.then(n=>this._def.type.parseAsync(n,{path:s.path,errorMap:s.common.contextualErrorMap})))}}Ca.create=(a,t)=>new Ca({type:a,typeName:ke.ZodPromise,..._e(t)});class Vt extends Te{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:s,ctx:r}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:l=>{Q(r,l),l.fatal?s.abort():s.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){const l=n.transform(r.data,i);if(r.common.async)return Promise.resolve(l).then(async c=>{if(s.value==="aborted")return je;const d=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return d.status==="aborted"?je:d.status==="dirty"||s.value==="dirty"?aa(d.value):d});{if(s.value==="aborted")return je;const c=this._def.schema._parseSync({data:l,path:r.path,parent:r});return c.status==="aborted"?je:c.status==="dirty"||s.value==="dirty"?aa(c.value):c}}if(n.type==="refinement"){const l=c=>{const d=n.refinement(c,i);if(r.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?je:(c.status==="dirty"&&s.dirty(),l(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?je:(c.status==="dirty"&&s.dirty(),l(c.value).then(()=>({status:s.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ut(l))return je;const c=n.transform(l.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>Ut(l)?Promise.resolve(n.transform(l.value,i)).then(c=>({status:s.value,value:c})):je);Le.assertNever(n)}}Vt.create=(a,t,s)=>new Vt({schema:a,typeName:ke.ZodEffects,effect:t,..._e(s)});Vt.createWithPreprocess=(a,t,s)=>new Vt({schema:t,effect:{type:"preprocess",transform:a},typeName:ke.ZodEffects,..._e(s)});class Ct extends Te{_parse(t){return this._getType(t)===le.undefined?dt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ct.create=(a,t)=>new Ct({innerType:a,typeName:ke.ZodOptional,..._e(t)});class Zt extends Te{_parse(t){return this._getType(t)===le.null?dt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Zt.create=(a,t)=>new Zt({innerType:a,typeName:ke.ZodNullable,..._e(t)});class ts extends Te{_parse(t){const{ctx:s}=this._processInputParams(t);let r=s.data;return s.parsedType===le.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}ts.create=(a,t)=>new ts({innerType:a,typeName:ke.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,..._e(t)});class as extends Te{_parse(t){const{ctx:s}=this._processInputParams(t),r={...s,common:{...s.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ka(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vt(r.common.issues)},input:r.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new vt(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}as.create=(a,t)=>new as({innerType:a,typeName:ke.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,..._e(t)});class cr extends Te{_parse(t){if(this._getType(t)!==le.nan){const r=this._getOrReturnCtx(t);return Q(r,{code:B.invalid_type,expected:le.nan,received:r.parsedType}),je}return{status:"valid",value:t.data}}}cr.create=a=>new cr({typeName:ke.ZodNaN,..._e(a)});class nc extends Te{_parse(t){const{ctx:s}=this._processInputParams(t),r=s.data;return this._def.type._parse({data:r,path:s.path,parent:s})}unwrap(){return this._def.type}}class xs extends Te{_parse(t){const{status:s,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?je:i.status==="dirty"?(s.dirty(),aa(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?je:n.status==="dirty"?(s.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(t,s){return new xs({in:t,out:s,typeName:ke.ZodPipeline})}}class ss extends Te{_parse(t){const s=this._def.innerType._parse(t),r=n=>(Ut(n)&&(n.value=Object.freeze(n.value)),n);return ka(s)?s.then(n=>r(n)):r(s)}unwrap(){return this._def.innerType}}ss.create=(a,t)=>new ss({innerType:a,typeName:ke.ZodReadonly,..._e(t)});var ke;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(ke||(ke={}));const Ve=St.create,Yt=Xa.create;_t.create;const Tt=mt.create,Ba=Ze.create;Na.create;Sa.create;Dt.create;const qa=Ht.create;Ca.create;Ct.create;Zt.create;const ic=Ba({name:Ve().min(1),displayName:Ve().min(1),npmPackage:Ve().min(1).optional(),pypiPackage:Ve().min(1).optional(),runtime:qa(["node","python"]).optional(),args:Tt(Ve()).optional(),url:Ve().min(1).optional(),headerEnv:Tt(Ba({header:Ve().min(1),env:Ve().min(1)})).optional(),bearerTokenEnvVar:Ve().min(1).optional(),oauth:Yt().optional(),oauthClientId:Ve().optional(),oauthScopes:Tt(Ve()).optional(),description:Ve().min(1),category:qa(["tools","data","dev","communication","web","search","productivity","infra","ai"]),requiredEnvKeys:Tt(Ve()),optionalEnvKeys:Tt(Ve()).optional(),repo:Ve().optional(),verified:Yt(),iconKey:Ve().optional(),auth:Yt().optional(),authArgs:Tt(Ve()).optional(),credentialFiles:Tt(Ba({path:Ve().min(1),required:Yt().optional(),writeBack:Yt().optional()})).optional(),prerequisite:Ve().optional(),deprecated:Ve().optional(),advisory:Ve().optional(),runLocation:qa(["host","shared"]).optional()}).refine(a=>!!(a.npmPackage||a.pypiPackage||a.url),{message:"entry needs at least one of npmPackage / pypiPackage / url"});function oc(a){if(typeof a!="object"||a===null||Array.isArray(a))return null;const t=a;if(!Array.isArray(t.entries))return null;const s=[];let r=0;for(const n of t.entries){const i=ic.safeParse(n);i.success?s.push(i.data):r++}return{entries:s,updatedAt:typeof t.updatedAt=="string"?t.updatedAt:void 0,dropped:r}}const Aa=oc(Ml);if(!Aa||Aa.dropped>0)throw new Error("Bundled mcp-registry.json failed schema validation — fix /mcp-registry.json");const lc=Aa.entries,cc=Aa.updatedAt,rs=/\{[a-z0-9-]+\}/;function dc(a){return(a??[]).some(t=>rs.test(t))}const Kr=new Set(["pandoc","docker","kubernetes","blender","chrome-devtools","netlify","workspace","filesystem","sqlite","duckdb","git","markitdown","excel","semgrep","google-sheets","gmail","google-drive","google-calendar","google-docs","teams"]);function uc(a){if(!a.url)return a.runLocation?a.runLocation:Kr.has(a.name)?"host":void 0}[...Kr];function hc(a,t){if(a.url){const n=[...new Set([...a.requiredEnvKeys,...a.optionalEnvKeys??[],...a.bearerTokenEnvVar?[a.bearerTokenEnvVar]:[],...(a.headerEnv??[]).map(({env:i})=>i)])];return{id:t,name:a.name,type:"http",url:a.url,description:a.description,repo:a.repo,env:n.map(i=>({key:i,value:""})),...a.oauth?{oauth:!0}:{},...a.bearerTokenEnvVar?{bearerTokenEnvVar:a.bearerTokenEnvVar}:{},...a.headerEnv?.length?{headerEnv:a.headerEnv.map(({header:i,env:l})=>({key:i,value:l}))}:{}}}const s=a.runtime==="python",r=uc(a);return{id:t,name:a.name,type:s?"uvx":"npm",npmPackage:s?void 0:a.npmPackage,pypiPackage:s?a.pypiPackage:void 0,description:a.description,managed:!0,env:[...a.requiredEnvKeys,...a.optionalEnvKeys??[]].map(n=>({key:n,value:""})),repo:a.repo,...r?{runLocation:r}:{},...a.args?.length?{args:[...a.args]}:{},...a.auth?{auth:!0}:{},...a.authArgs?{authArgs:a.authArgs}:{},...a.credentialFiles?{credentialFiles:a.credentialFiles.map(n=>({...n}))}:{}}}function Lt(a,t){if(t.npmPackage!==void 0)return a.find(s=>s.npmPackage===t.npmPackage);if(t.pypiPackage!==void 0)return a.find(s=>s.pypiPackage===t.pypiPackage);if(t.url!==void 0)return a.find(s=>s.url===t.url);if(t.name!==void 0)return a.find(s=>s.name===t.name)}const ns=Oi(a=>({entries:lc,source:"bundled",updatedAt:cc,refresh:async(t=window.adfApi)=>{try{const s=await t?.getMcpRegistry?.();s&&s.entries.length>0&&a({entries:s.entries,source:s.source,updatedAt:s.updatedAt})}catch{}}})),Fr={airtable:qi,arxiv:Ui,atlassian:Vi,blender:Wi,brave:Yi,"cal-com":Ji,chrome:bo,clickhouse:eo,cloudflare:Kn,discord:$n,docker:ao,duckdb:ro,duckduckgo:io,elevenlabs:lo,github:uo,gitlab:po,gmail:fo,"google-calendar":go,"google-docs":jo,"google-drive":wo,"google-sheets":So,grafana:Ao,hubspot:Eo,huggingface:On,kagi:Ro,kubernetes:Mo,linear:Io,mermaid:Oo,mongodb:Ko,mysql:Bo,n8n:zo,netlify:Ho,notion:Zo,pagerduty:Go,pandoc:Qo,paypal:Xo,perplexity:Dn,postgresql:tl,prometheus:sl,qdrant:nl,redis:ol,searxng:cl,sentry:ul,shopify:pl,sqlite:fl,stripe:gl,supabase:bl,telegram:In,todoist:jl,trello:wl,zapier:Sl},pc=Object.keys(Fr);new Set(pc);const dr={dev:()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m9 8-4 4 4 4M15 8l4 4-4 4"})}),data:()=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("ellipse",{cx:"12",cy:"5.5",rx:"7",ry:"2.8"}),e.jsx("path",{d:"M5 5.5v13c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8v-13M5 12c0 1.5 3.1 2.8 7 2.8s7-1.3 7-2.8"})]}),communication:()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M21 11.5a8.38 8.38 0 0 1-8.5 8.5 8.5 8.5 0 0 1-3.8-.9L3 21l1.9-5.7A8.5 8.5 0 0 1 4 11.5 8.38 8.38 0 0 1 12.5 3 8.38 8.38 0 0 1 21 11.5z"})}),web:()=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M3 12h18M12 3c2.5 2.5 3.8 5.7 3.8 9s-1.3 6.5-3.8 9c-2.5-2.5-3.8-5.7-3.8-9S9.5 5.5 12 3z"})]}),tools:()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.2 5.2L3 18l3 3 6.5-6.5a4 4 0 0 0 5.2-5.2l-2.9 2.9-2.1-2.1z"})}),search:()=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]}),productivity:()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"m3 6 1.5 1.5L7 5M3 12l1.5 1.5L7 10.5M3 18l1.5 1.5L7 16.5M11 6h10M11 12h10M11 18h10"})}),infra:()=>e.jsxs("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"7",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"18",height:"7",rx:"1.5"}),e.jsx("path",{d:"M7 7.5h.01M7 16.5h.01"})]}),ai:()=>e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3zM19 16l.9 2.1L22 19l-2.1.9L19 22l-.9-2.1L16 19l2.1-.9L19 16z"})})};function Br({iconKey:a,category:t="tools",size:s=28}){const r=a?Fr[a]:void 0;if(r){const i=Math.round(s*.62);return e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] border",style:{width:s,height:s,background:"var(--adf-ui-logo-tile)",borderColor:"var(--adf-ui-logo-tile-border)"},children:e.jsx(r,{color:"default",size:i})})}const n=dr[t]??dr.tools;return e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-hover)] text-[var(--adf-ui-text-muted)]",style:{width:s,height:s,padding:Math.round(s*.22)},children:n()})}function qr(a){const t=[];for(const s of a)s.isDirectory&&s.children?t.push(...qr(s.children)):!s.isDirectory&&s.fileName.endsWith(".adf")&&t.push({filePath:s.filePath,fileName:s.fileName});return t}function mc(a,t,s,r=[]){const n=new Set([a.bearerTokenEnvVar,...(a.headerEnv??[]).map(l=>l.value)].filter(Boolean)),i=r.some(l=>n.has(l));return{name:a.name,type:a.type,npmPackage:a.npmPackage,pypiPackage:a.pypiPackage,command:a.command,args:a.args,url:a.url,oauth:Et(a,t)&&!i||void 0,envKeys:s,headers:a.headers,headerEnv:a.headerEnv,bearerTokenEnvVar:a.bearerTokenEnvVar,credentialStorage:a.credentialStorage,runLocation:a.runLocation}}function fc({server:a,registryEntry:t,onServerUpdate:s,showOAuthNote:r=!0}){const n=nt(),i=a.credentialStorage??"app",l=Et(a,t),c=Ur(a,t),d=l&&!c,h=a.npmPackage||a.pypiPackage||a.name,f=[...a.bearerTokenEnvVar?[a.bearerTokenEnvVar]:[],...(a.headerEnv??[]).map(u=>u.value).filter(Boolean)],b=[...new Set(t?[...t.requiredEnvKeys??[],...t.optionalEnvKeys??[],...f]:[...(a.env??[]).map(u=>u.key).filter(Boolean),...f])],C=t?.requiredEnvKeys??[],_=()=>{s({env:[...a.env??[],{key:"",value:""}]})},E=(u,S)=>{const O=[...a.env??[]];O[u]={...O[u],...S},s({env:O})},x=u=>{s({env:(a.env??[]).filter((S,O)=>O!==u)})},[D,k]=o.useState([]),[q,U]=o.useState([]),[L,W]=o.useState({}),[A,V]=o.useState(!1),[ie,w]=o.useState(null),[X,I]=o.useState(null),[R,K]=o.useState({}),[J,ae]=o.useState({}),[se,Y]=o.useState([]),[z,re]=o.useState(!1),[he,H]=o.useState([]),ne=o.useRef(0),xe=[...D,...q.filter(u=>!D.some(S=>S.filePath===u.filePath))],g=o.useCallback(async()=>{if(!(i!=="agent"||!h)){V(!0);try{const u=await n?.listMcpCredentialFiles({mcpServerName:a.name,npmPackage:h});k(u?.files??[])}catch{}finally{V(!1)}}},[i,a.name,h]);o.useEffect(()=>{g()},[g]);const T=o.useCallback(async()=>{re(!0);try{const S=(await n?.getTrackedDirectories())?.directories??[],O=[];for(const ue of S){const Oe=await n?.scanTrackedDirectory(ue);Oe?.files&&O.push(...qr(Oe.files))}const pe=new Set;Y(O.filter(ue=>pe.has(ue.filePath)?!1:(pe.add(ue.filePath),!0)))}catch{}finally{re(!1)}},[]);o.useEffect(()=>{i==="agent"&&T()},[i,T]);const ee=async u=>{if(h)try{const S=await n?.getMcpCredentials({filePath:u,npmPackage:h});S?.credentials&&W(O=>({...O,[u]:S.credentials}))}catch{}},j=u=>{ie===u?w(null):(w(u),L[u]||ee(u))},me=(u,S,O)=>{W(pe=>({...pe,[u]:{...pe[u]??{},[S]:Fn(pe[u]?.[S]??"",O)}}))},G=async u=>{if(h){I(u),K(S=>{const O={...S};return delete O[u],O});try{const S=L[u]??{},O=Object.entries(S).filter(([,we])=>we);if(O.length===0){K(we=>({...we,[u]:"No credential values to save"})),I(null);return}const pe=await n?.attachMcpServer({filePath:u,serverConfig:mc(a,t,b.length>0?b:O.map(([we])=>we),O.map(([we])=>we))});if(pe&&!pe.success){K(we=>({...we,[u]:pe.error??"Failed to attach server"})),I(null);return}for(const[we,Pe]of O){const Fe=await n?.setMcpCredential({filePath:u,npmPackage:h,envKey:we,value:Pe});if(Fe&&!Fe.success){K(v=>({...v,[u]:Fe.error??"Save failed"})),I(null);return}}const ue=O.map(([we])=>we),Oe=we=>we.filePath===u?{...we,hasCredentials:!0,populatedKeys:[...new Set([...we.populatedKeys,...ue])]}:we;k(we=>we.map(Oe)),U(we=>we.map(Oe)),K(we=>({...we,[u]:"ok"}))}catch(S){K(O=>({...O,[u]:String(S)}))}finally{I(null)}}},fe=()=>{ne.current+=1,H(u=>[...u,ne.current])},Ee=u=>{H(S=>S.filter(O=>O!==u))},ge=(u,S)=>{if(!S||(H(ue=>ue.filter(Oe=>Oe!==u)),xe.some(ue=>ue.filePath===S)))return;const O=se.find(ue=>ue.filePath===S),pe={filePath:S,fileName:O?.fileName??S.split("/").pop()??"unknown.adf",hasCredentials:!1,populatedKeys:[]};U(ue=>[...ue,pe]),w(S)},Ie=u=>{ae(S=>({...S,[u]:[...S[u]??[],""]}))},Ge=(u,S,O)=>{ae(pe=>{const ue=[...pe[u]??[]];return ue[S]=O,{...pe,[u]:ue}})},$e=(u,S)=>{const O=(J[u]??[])[S];ae(pe=>{const ue=[...pe[u]??[]];return ue.splice(S,1),{...pe,[u]:ue}}),O&&W(pe=>{const ue={...pe[u]??{}};return delete ue[O],{...pe,[u]:ue}})},ye=async u=>{h&&await n?.detachMcpServer({filePath:u,serverName:a.name,credentialNamespace:h}),U(S=>S.filter(O=>O.filePath!==u)),k(S=>S.filter(O=>O.filePath!==u)),ie===u&&w(null),W(S=>{const O={...S};return delete O[u],O}),ae(S=>{const O={...S};return delete O[u],O}),K(S=>{const O={...S};return delete O[u],O})},De=u=>{s({credentialStorage:u})},Be=se.filter(u=>!xe.some(S=>S.filePath===u.filePath));return e.jsxs("div",{className:"space-y-3",children:[l&&r&&e.jsxs("div",{className:"rounded-md border border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-900/20 p-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-violet-100 dark:bg-violet-900/40 text-violet-700 dark:text-violet-300 rounded font-medium",children:"Sign in"}),e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Browser OAuth"})]}),e.jsxs("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400",children:["Signed in via Settings — the token is sealed into this agent on attach."," ",c?"Or paste an API token below as a fallback.":"No per-agent credential keys to fill."]})]}),!d&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400 mb-1.5",children:"Credential Storage"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>De("app"),className:`flex-1 px-2 py-1.5 text-[11px] rounded-md border transition-colors ${i==="app"?"border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 font-medium":"border-neutral-200 dark:border-neutral-600 text-neutral-500 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-700"}`,children:"App-wide"}),e.jsx("button",{onClick:()=>De("agent"),className:`flex-1 px-2 py-1.5 text-[11px] rounded-md border transition-colors ${i==="agent"?"border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 font-medium":"border-neutral-200 dark:border-neutral-600 text-neutral-500 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-700"}`,children:"Per-agent (ADF)"})]}),e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-1",children:i==="app"?"Credentials stored in app settings, shared by all agents using this server.":"Credentials stored inside each ADF file. Different agents can have different keys."})]}),!d&&i==="app"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Environment Variables"}),e.jsx("button",{onClick:_,className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add"})]}),C.length>0&&e.jsxs("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mb-1.5",children:["Required: ",C.join(", ")]}),(a.env??[]).length>0?e.jsx("div",{className:"space-y-1.5",children:(a.env??[]).map((u,S)=>{const O=C.includes(u.key);return e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:u.key,onChange:pe=>E(S,{key:pe.target.value}),placeholder:"KEY",className:"flex-1 px-2 py-1 text-xs font-mono border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md focus:outline-none focus:border-blue-400"}),e.jsx("input",{type:"password",value:u.value,onChange:pe=>E(S,{value:pe.target.value}),placeholder:O?"(required)":"value",className:`flex-1 px-2 py-1 text-xs font-mono border rounded-md focus:outline-none focus:border-blue-400 ${O&&!u.value?"border-amber-400 dark:border-amber-600 dark:bg-neutral-700 dark:text-neutral-100":"border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100"}`}),e.jsx("button",{onClick:()=>x(S),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"×"})]},S)})}):e.jsx("p",{className:"text-[10px] text-[var(--adf-ui-text-subtle)]",children:"No environment variables. Click + Add to configure."})]}),!d&&i==="agent"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Agent Credentials"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:fe,className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add ADF"}),e.jsx("button",{onClick:g,className:"text-[11px] text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200",disabled:A,children:A?"Scanning...":"Refresh"})]})]}),b.length>0&&e.jsxs("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mb-1.5",children:["Keys: ",b.join(", "),C.length>0&&e.jsxs("span",{className:"text-amber-500",children:[" (required: ",C.join(", "),")"]})]}),xe.length===0&&he.length===0?e.jsx("div",{className:"text-center py-3",children:e.jsx("p",{className:"text-[10px] text-[var(--adf-ui-text-subtle)]",children:A?"Scanning tracked directories...":"No ADF files found. Use + Add ADF to select a file."})}):e.jsxs("div",{className:"space-y-1.5",children:[xe.map(u=>{const S=ie===u.filePath,O=L[u.filePath]??{},pe=X===u.filePath,ue=J[u.filePath]??[],Oe=new Set(ue),we=b.length>0?b:Object.keys(O).filter(Pe=>!Oe.has(Pe));return e.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-md overflow-hidden",children:[e.jsxs("button",{onClick:()=>j(u.filePath),className:"w-full flex items-center justify-between px-2.5 py-1.5 hover:bg-neutral-50 dark:hover:bg-neutral-700/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-[11px] font-medium text-neutral-600 dark:text-neutral-300 truncate",children:u.fileName}),u.hasCredentials?e.jsxs("span",{title:`Credentials stored in ADF: ${u.populatedKeys.join(", ")}`,className:"text-[11px] text-amber-500 dark:text-amber-400 shrink-0 cursor-help",children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 inline-block",children:e.jsx("path",{fillRule:"evenodd",d:"M8 1a3.5 3.5 0 0 0-3.5 3.5V7A1.5 1.5 0 0 0 3 8.5v5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 11.5 7V4.5A3.5 3.5 0 0 0 8 1Zm2 6V4.5a2 2 0 1 0-4 0V7h4Zm-1 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-[9px] ml-0.5",children:u.populatedKeys.length})]}):e.jsx("span",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] shrink-0",children:"No keys"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-[var(--adf-ui-text-subtle)]",children:S?"Hide":"Edit"}),e.jsx("span",{role:"button",onClick:Pe=>{Pe.stopPropagation(),ye(u.filePath)},className:"text-xs text-red-400 hover:text-red-600 cursor-pointer",children:"×"})]})]}),S&&e.jsxs("div",{className:"px-2.5 pb-2 border-t border-neutral-100 dark:border-neutral-700",children:[e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-1.5 mb-1 truncate",title:u.filePath,children:u.filePath}),e.jsxs("div",{className:"space-y-1.5",children:[we.map(Pe=>{const Fe=C.includes(Pe);return e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("span",{className:"text-[10px] font-mono text-neutral-500 dark:text-neutral-400 w-[120px] shrink-0 truncate",title:Pe,children:Pe}),e.jsx("input",{type:"password",value:O[Pe]??"",onChange:v=>me(u.filePath,Pe,v.target.value),placeholder:Fe?"(required)":"(optional)",className:`flex-1 px-2 py-1 text-xs font-mono border rounded-md focus:outline-none focus:border-blue-400 ${Fe&&!O[Pe]?"border-amber-400 dark:border-amber-600 dark:bg-neutral-700 dark:text-neutral-100":"border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100"}`})]},Pe)}),ue.map((Pe,Fe)=>e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:Pe,onChange:v=>Ge(u.filePath,Fe,v.target.value),placeholder:"KEY",className:"text-[10px] font-mono px-2 py-1 border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md w-[120px] shrink-0 focus:outline-none focus:border-blue-400"}),e.jsx("input",{type:"password",value:Pe?O[Pe]??"":"",onChange:v=>Pe&&me(u.filePath,Pe,v.target.value),placeholder:"value",disabled:!Pe,className:"flex-1 px-2 py-1 text-xs font-mono border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md focus:outline-none focus:border-blue-400 disabled:opacity-50"}),e.jsx("button",{onClick:()=>$e(u.filePath,Fe),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"×"})]},`extra-${Fe}`))]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("button",{onClick:()=>G(u.filePath),disabled:pe,className:"px-3 py-1 text-[11px] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text)] hover:bg-[var(--adf-ui-surface-hover)] disabled:opacity-50 rounded-md font-medium transition-colors",children:pe?"Saving...":"Save to ADF"}),e.jsx("button",{onClick:()=>Ie(u.filePath),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add Key"}),R[u.filePath]==="ok"&&e.jsx("span",{className:"text-[10px] text-green-600 dark:text-green-400",children:"Saved"}),R[u.filePath]&&R[u.filePath]!=="ok"&&e.jsx("span",{className:"text-[10px] text-red-500",children:R[u.filePath]})]})]})]},u.filePath)}),he.map(u=>e.jsx("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-md overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-1.5 px-2.5 py-1.5",children:[e.jsxs("select",{defaultValue:"",onChange:S=>ge(u,S.target.value),className:"flex-1 px-2 py-1 text-[11px] border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md focus:outline-none focus:border-blue-400 bg-white",children:[e.jsx("option",{value:"",disabled:!0,children:z?"Loading...":"Select an ADF file..."}),Be.map(S=>e.jsx("option",{value:S.filePath,children:S.fileName},S.filePath))]}),e.jsx("button",{onClick:()=>Ee(u),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"×"})]})},`pending-${u}`))]})]})]})}function xc({enabled:a,onChange:t}){return e.jsxs("label",{className:"flex items-start justify-between gap-3 text-xs text-neutral-700 dark:text-neutral-300",children:[e.jsxs("span",{children:["Browser sign-in (OAuth)",e.jsx("span",{className:"block text-[10px] text-neutral-500 dark:text-neutral-400 mt-0.5",children:"Use for servers that support MCP OAuth. Connect opens the provider’s sign-in page when authorization is needed."})]}),e.jsx("input",{type:"checkbox",checked:a,onChange:s=>t(s.target.checked),className:"mt-0.5"})]})}const zr="Runs on the host with your user account’s access — your agents drive it.",gc="Default — isolated in the shared compute container, with no access to your files. Requires Podman (a one-time setup).",vc="The command must exist inside the container (npx, uvx, node and python do). Switch to Host to run a command installed on your machine.";function is(){return"mcp:"+Math.random().toString(36).slice(2,8)}const bc=["tools","data","dev","communication","web","search","productivity","infra","ai"];function yc(a,t,s){const r=t.trim().toLowerCase(),n=a.filter(i=>(s==="all"||i.category===s)&&(!r||i.name.toLowerCase().includes(r)||i.displayName.toLowerCase().includes(r)||i.description.toLowerCase().includes(r)));return[...n.filter(i=>i.verified),...n.filter(i=>!i.verified)]}function jc(a,t){return a.filter(s=>!s.deprecated&&!t.some(r=>s.npmPackage&&r.npmPackage===s.npmPackage||s.pypiPackage&&r.pypiPackage===s.pypiPackage||s.url&&r.url===s.url))}function ur(a){const t=a.url?a.url:a.type==="custom"?a.command??"":a.type==="uvx"||a.type==="pip"?a.pypiPackage?`uvx ${a.pypiPackage}`:"":a.npmPackage?`npx ${a.npmPackage}`:"";if(!t)return"";const s=a.version&&a.version!=="unknown"?` · v${a.version}`:"";return t+s}function kc(a,t){if(!a||a.lastVerifiedAt)return{required:[],optional:[]};const s=[],r=[];for(const n of a.credentialFiles??[])t[n.path]&&(n.required?s:r).push(n.path);return{required:s,optional:r}}function Et(a,t){return!!(a?.oauth||t?.oauth)}function Ur(a,t){return Et(a,t)?!!(a?.bearerTokenEnvVar||t?.bearerTokenEnvVar):!1}function wc(a){const t=a.env??[];return!!a.bearerTokenEnvVar&&t.some(r=>r.key===a.bearerTokenEnvVar&&!!r.value)?!0:(a.headerEnv??[]).some(r=>!!r.value&&t.some(n=>n.key===r.value&&!!n.value))}function Nc(a,t,s){return!Et(a,t)||s!==!1?!1:!wc(a)}function Sc(a,t){return Et(a,t)||a.credentialStorage==="agent"?!1:(t?.requiredEnvKeys??[]).some(s=>{const r=(a.env??[]).find(n=>n.key===s);return!r||!r.value})}function Cc(a){return[...new Set([...a.requiredEnvKeys,...a.bearerTokenEnvVar?[a.bearerTokenEnvVar]:[],...(a.headerEnv??[]).map(t=>t.env)])]}function hr(a){return a==="http"?{id:is(),name:"",type:"http",url:"",headers:[],headerEnv:[],env:[]}:{id:is(),name:"",type:"custom",command:"",args:[],env:[]}}const et="w-full px-2 py-1.5 text-xs font-mono border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md focus:outline-none focus:border-blue-400",Ac=et.replace("border-neutral-300 dark:border-neutral-600","border-amber-400 dark:border-amber-500"),kt="block text-xs text-neutral-500 dark:text-neutral-400 mb-0.5";function _c(a){return a.open?e.jsx(Ec,{...a}):null}function Ec({open:a,onClose:t,editing:s,existingServers:r,hostAccessEnabled:n,onEnableHostAccess:i,onSave:l,onRemove:c,onOAuthChanged:d,onComputeNeeded:h,onEnableHostAccessNow:f,mcpOnHost:b}){const C=nt(),[_,E]=o.useState("choose"),[x,D]=o.useState(null),[k,q]=o.useState({}),[U,L]=o.useState({phase:"idle"}),[W,A]=o.useState(!1),[V,ie]=o.useState(!1),[w,X]=o.useState(!1),[I,R]=o.useState(!1),[K,J]=o.useState(null),[ae,se]=o.useState(""),[Y,z]=o.useState(""),[re,he]=o.useState("all"),[H,ne]=o.useState(!1),xe=o.useRef({}),g=o.useRef(x);g.current=x;const T=s?s.name:null,ee=o.useRef(null);o.useEffect(()=>{if(!a){ee.current=null;return}const N=ee.current;if(ee.current=T,T===null&&N!==null&&g.current?.id){ne(!0),E("form");return}ne(!1),q({}),L({phase:"idle"}),A(!1),ie(!1),X(!1),R(!1),J(null),s?(D({...s}),se((s.authArgs??[]).join(" ")),E("form")):(D(null),se(""),z(""),he("all"),E("choose"))},[a,T]);const j=N=>{const Z=zn.some(ve=>ve in N);D(ve=>ve&&{...ve,...N,...Z?{lastVerifiedAt:void 0}:{}}),Z&&L(ve=>ve.phase==="done"?{phase:"idle"}:ve)},me=()=>{const N=ae.split(/\s+/).filter(Boolean);return D(Z=>Z&&{...Z,authArgs:N}),N},{entries:G,source:fe,updatedAt:Ee}=ns(),ge=o.useMemo(()=>{if(x)return x.npmPackage?Lt(G,{npmPackage:x.npmPackage}):x.pypiPackage?Lt(G,{pypiPackage:x.pypiPackage}):x.url?Lt(G,{url:x.url}):void 0},[x,G]),Ie=o.useMemo(()=>jc(G,r),[G,r]),Ge=o.useMemo(()=>bc.filter(N=>Ie.some(Z=>Z.category===N)),[Ie]),$e=o.useMemo(()=>yc(Ie,Y,re),[Ie,Y,re]),ye=x?x.type==="http"||!!x.url:!1,De=ye&&Et(x,ge),Be=ye&&Ur(x,ge),u=x?.type==="custom",S=x?.type==="uvx"||x?.type==="pip",O=!!x&&!!x.name&&(ye?!!x.url:u?!!x.command:S?!!x.pypiPackage:!!x.npmPackage),pe=o.useMemo(()=>{if(!x||!dc(x.args))return[];const N=new RegExp(rs,"g");return[...new Set((x.args??[]).flatMap(Z=>Z.match(N)??[]))]},[x]),ue=pe.length>0,Oe=o.useMemo(()=>kc(x,k),[x,k]),we=Oe.required.length>0,Pe=Oe.optional.length>0,Fe=(N,Z)=>{if(!Z)return;const ve=new FileReader;ve.onload=()=>{const p=ve.result,F=p.slice(p.indexOf(",")+1);q(Ce=>({...Ce,[N]:{fileName:Z.name,size:Z.size,contentB64:F}}))},ve.readAsDataURL(Z)},[v,oe]=o.useState(!1);o.useEffect(()=>{v&&(oe(!1),He())},[v]);const He=async()=>{if(!x||!O||ue)return;const N=x;L({phase:"running"}),A(!1);try{const Z=new Set((x.credentialFiles??[]).map(F=>F.path)),ve=Object.entries(k).filter(([F])=>Z.has(F)).map(([F,Ce])=>({path:F,contentB64:Ce.contentB64})),p=await C?.testMcpRegistration({registration:{...x,authArgs:me()},credentialFiles:ve.length?ve:void 0});if(p?.success){const F=g.current;F&&Ya(F,N)?(j({lastVerifiedAt:Date.now(),...p.serverVersion?{version:p.serverVersion}:{}}),L({phase:"done",success:!0,tools:p.tools,notes:p.notes,authRan:p.authRan,oauthRan:p.oauthRan,location:p.location})):L({phase:"idle"}),p.oauthRan&&d?.()}else L({phase:"done",success:!1,error:p?.error??"Failed to connect",stderrTail:p?.stderrTail,notes:p?.notes,location:p?.location}),p?.computeUnavailable&&h&&h(N.name,{pinnedToContainer:N.runLocation==="shared",retry:()=>oe(!0),runOnHost:async()=>(j({runLocation:"host"}),n||!f?!0:f())})}catch(Z){L({phase:"done",success:!1,error:String(Z)})}},Ke=()=>{!x||ue||we||(l({...x,authArgs:me()}),t())},Me=async()=>{const N=!I;if(R(N),N&&K===null&&x){const Z=await C?.getMcpServerLogs({name:x.name});J(Z?.logs??[])}},tt=!!ge?.auth||!!x?.auth,at=x&&!(x.type==="http"||x.url)?e.jsxs("div",{className:"space-y-1.5 rounded-md border border-neutral-200 dark:border-neutral-700 p-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Interactive authorization (OAuth)"}),e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-0.5",children:"Enable only if the server documents a login command (e.g. npx <pkg> auth) that stores tokens for later runs — most servers don’t need this."})]}),e.jsx("input",{type:"checkbox",checked:!!x.auth,onChange:N=>j({auth:N.target.checked||void 0}),className:"mt-0.5"})]}),x.auth&&e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:kt,children:"Auth args"}),e.jsx("input",{type:"text",value:ae,onChange:N=>se(N.target.value),onBlur:me,placeholder:"auth",className:et})]}),e.jsxs("div",{children:[e.jsxs("label",{className:kt,children:["Callback port ",e.jsx("span",{className:"text-[var(--adf-ui-text-subtle)]",children:"(usually auto-detected)"})]}),e.jsx("input",{type:"number",min:1,max:65535,value:x.authPort??"",onChange:N=>j({authPort:N.target.value?parseInt(N.target.value,10):void 0}),className:et})]})]})]}):null,xt=x?e.jsxs("div",{children:[e.jsx("label",{className:kt,children:"Tool timeout (seconds)"}),e.jsx("input",{type:"number",min:1,value:x.toolCallTimeout??"",onChange:N=>{const Z=N.target.value?parseInt(N.target.value,10):void 0;j({toolCallTimeout:Z&&Z>0?Z:void 0})},placeholder:"60",className:et})]}):null;return e.jsxs(gt,{lightDismiss:!1,open:a,onClose:t,title:s?`Configure — ${s.name}`:H&&x?`Configure — ${x.name}`:"Add MCP Server",wide:!0,children:[_==="choose"&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"Pick a known server, or configure your own."}),e.jsx("input",{type:"text",autoFocus:!0,value:Y,onChange:N=>z(N.target.value),placeholder:"Search servers…",className:"w-full px-2 py-1.5 text-xs border border-neutral-300 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-100 rounded-md focus:outline-none focus:border-blue-400"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:["all",...Ge].map(N=>e.jsx("button",{onClick:()=>he(N),className:`px-2 py-0.5 text-[10px] rounded-full border transition-colors ${re===N?"border-blue-400 dark:border-blue-500 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"border-neutral-200 dark:border-neutral-700 text-neutral-500 dark:text-neutral-400 hover:border-neutral-400 dark:hover:border-neutral-500"}`,children:N==="all"?"All":N.charAt(0).toUpperCase()+N.slice(1)},N))}),e.jsxs("div",{className:"max-h-[55vh] overflow-y-auto pr-1",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:$e.map(N=>{const Z=Cc(N);return e.jsxs("button",{onClick:()=>{const ve=hc(N,is());D(ve),q({}),se((ve.authArgs??[]).join(" ")),E("form")},className:"text-left p-2.5 rounded-md border border-neutral-200 dark:border-neutral-700 hover:border-blue-400 dark:hover:border-blue-500 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Br,{iconKey:N.iconKey,category:N.category,size:26}),e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-200",children:N.displayName}),N.runtime==="python"&&e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-400 rounded font-medium",children:"Python"}),N.url&&e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-teal-100 dark:bg-teal-900/40 text-teal-600 dark:text-teal-400 rounded font-medium",children:"Remote"}),N.verified&&e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-blue-100 dark:bg-blue-900/40 text-blue-600 dark:text-blue-400 rounded font-medium",children:"Official"}),N.auth&&e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-purple-100 dark:bg-purple-900/40 text-purple-600 dark:text-purple-400 rounded font-medium",children:"OAuth"}),N.oauth&&e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-violet-100 dark:bg-violet-900/40 text-violet-700 dark:text-violet-300 rounded font-medium",children:"Sign in"})]}),e.jsx("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400 mt-0.5 line-clamp-2",children:N.description}),N.prerequisite&&e.jsx("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mt-0.5 line-clamp-2",children:N.prerequisite}),!N.prerequisite&&N.oauth&&N.bearerTokenEnvVar&&e.jsxs("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-0.5",children:["Sign in, or paste ",N.bearerTokenEnvVar]}),!N.prerequisite&&!N.oauth&&Z.length>0&&e.jsxs("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mt-0.5",children:["Requires: ",Z.join(", ")]}),N.advisory&&e.jsx("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mt-0.5 line-clamp-2",children:N.advisory})]},N.name)})}),$e.length===0&&e.jsx("p",{className:"text-[10px] text-[var(--adf-ui-text-subtle)] py-4 text-center",children:"No servers match — try a different search, or add a custom one below."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("button",{onClick:()=>{D(hr("custom")),q({}),se(""),E("form")},className:"text-left p-2.5 rounded-md border border-dashed border-neutral-300 dark:border-neutral-600 hover:border-blue-400 dark:hover:border-blue-500 transition-colors",children:[e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-200",children:"Custom server"}),e.jsx("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400 mt-0.5",children:"npm / PyPI package or a local command (STDIO)"})]}),e.jsxs("button",{onClick:()=>{D(hr("http")),q({}),se(""),E("form")},className:"text-left p-2.5 rounded-md border border-dashed border-neutral-300 dark:border-neutral-600 hover:border-blue-400 dark:hover:border-blue-500 transition-colors",children:[e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-200",children:"Remote HTTP server"}),e.jsx("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400 mt-0.5",children:"Streamable HTTP MCP endpoint"})]})]}),e.jsxs("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)]",children:[Ee?`Registry updated ${Ee} · `:"Registry · ",G.length," servers",fe==="bundled"?" · offline copy":""]})]}),_==="form"&&x&&e.jsxs("div",{className:"space-y-3",children:[H&&e.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-md border border-amber-300 dark:border-amber-800 bg-amber-50 dark:bg-amber-900/20 p-2",children:[e.jsx("p",{className:"text-[10px] text-amber-700 dark:text-amber-400",children:"This server was removed elsewhere. Saving will re-create it."}),e.jsx("button",{onClick:()=>ne(!1),className:"shrink-0 text-amber-500 hover:text-amber-700 dark:hover:text-amber-300 text-xs px-1","aria-label":"Dismiss",children:"×"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:kt,children:"Name"}),e.jsx("input",{type:"text",value:x.name,onChange:N=>j({name:N.target.value.replace(/[^a-z0-9_-]/g,"")}),placeholder:"e.g. my_server",className:et})]}),e.jsxs("div",{children:[e.jsx("label",{className:kt,children:ye?"URL":u?"Command":S?"PyPI package":"npm package"}),ye?e.jsx("input",{type:"url",value:x.url??"",onChange:N=>j({url:N.target.value}),placeholder:"https://mcp.example.com/mcp",className:et}):u?e.jsx("input",{type:"text",value:x.command??"",onChange:N=>j({command:N.target.value}),placeholder:"node, python, /path/to/binary",className:et}):S?e.jsx("input",{type:"text",value:x.pypiPackage??"",onChange:N=>j({pypiPackage:N.target.value}),placeholder:"my-mcp-package",className:et}):e.jsx("input",{type:"text",value:x.npmPackage??"",onChange:N=>j({npmPackage:N.target.value}),placeholder:"@scope/mcp-package",className:et})]})]}),ur(x)&&e.jsx("p",{className:"text-[10px] font-mono text-[var(--adf-ui-text-subtle)] truncate",children:ur(x)}),(x.description||ge?.description)&&e.jsx("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400",children:x.description??ge?.description}),ge?.prerequisite&&e.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:ge.prerequisite}),ge?.advisory&&e.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:ge.advisory}),!ye&&e.jsxs("div",{children:[e.jsxs("label",{className:kt,children:["Args ",!u&&e.jsx("span",{className:"text-[var(--adf-ui-text-subtle)]",children:"(appended after package)"})]}),e.jsxs("div",{className:"space-y-1",children:[(x.args??[]).map((N,Z)=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"text",value:N,onChange:ve=>{const p=[...x.args??[]];p[Z]=ve.target.value,j({args:p})},className:rs.test(N)?Ac:et}),e.jsx("button",{onClick:()=>j({args:(x.args??[]).filter((ve,p)=>p!==Z)}),className:"text-[var(--adf-ui-text-subtle)] hover:text-red-500 text-xs px-1",children:"x"})]},Z)),e.jsx("button",{onClick:()=>j({args:[...x.args??[],""]}),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add arg"})]}),ue&&e.jsxs("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 mt-1",children:["Replace ",pe.join(", ")," with ",pe.length===1?"a real value":"real values"," before connecting."]})]}),!ye&&(()=>{const N=b===!0&&n===!0&&x.runLocation===void 0,Z=x.runLocation==="host"||N;return e.jsxs("div",{children:[e.jsx("label",{className:kt,children:"Runs on"}),e.jsxs("div",{className:"grid grid-cols-2 gap-1 rounded-md border border-neutral-300 dark:border-neutral-600 p-0.5",children:[e.jsx("button",{onClick:()=>j({runLocation:"host"}),className:`py-1 text-[11px] rounded ${Z?"bg-amber-100 dark:bg-amber-900/40 text-amber-800 dark:text-amber-300 font-medium":"text-neutral-500 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-700"}`,children:"Host"}),e.jsx("button",{onClick:()=>j({runLocation:"shared"}),className:`py-1 text-[11px] rounded ${Z?"text-neutral-500 dark:text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-700":"bg-blue-100 dark:bg-blue-900/30 text-blue-800 dark:text-blue-300 font-medium"}`,children:"Container"})]}),e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-0.5",children:Z?zr:gc}),N&&e.jsx("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mt-0.5",children:"MCP servers on the host is on in Settings → Compute. Choose Container to keep this one in a container."}),!Z&&u&&e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-0.5",children:vc}),x.runLocation==="host"&&n===!1&&e.jsxs("p",{className:"text-[9px] text-amber-600 dark:text-amber-400 mt-0.5",children:["Host access is disabled app-wide, so this server will be containerized until it is enabled."," ",i&&e.jsx("button",{onClick:i,className:"underline font-medium hover:text-amber-700 dark:hover:text-amber-300",children:"Enable host access"})]})]})})(),e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-neutral-200 dark:border-neutral-700 p-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Available to agents"}),e.jsxs("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)] mt-0.5",children:["Any agent may attach and use this server (via mcp_install).",x.agentVisible===void 0&&e.jsxs(e.Fragment,{children:[" Default for ",ye?"remote":x.runLocation==="host"?"host":"container"," servers: ",Bn(x)?"on":"off","."]})]})]}),e.jsx("input",{type:"checkbox",checked:Ar(x),onChange:N=>j({agentVisible:N.target.checked}),className:"mt-0.5"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Environment variables"}),e.jsx("button",{onClick:()=>j({env:[...x.env??[],{key:"",value:""}]}),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add"})]}),e.jsx("div",{className:"space-y-1.5",children:(x.env??[]).map((N,Z)=>e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:N.key,placeholder:"KEY",onChange:ve=>{const p=[...x.env??[]];p[Z]={...p[Z],key:ve.target.value},j({env:p})},className:et}),e.jsx("input",{type:"password",value:N.value,placeholder:"value",onChange:ve=>{const p=[...x.env??[]];p[Z]={...p[Z],value:ve.target.value},j({env:p})},className:et}),e.jsx("button",{onClick:()=>j({env:(x.env??[]).filter((ve,p)=>p!==Z)}),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"x"})]},Z))})]}),ye&&e.jsxs("div",{className:"space-y-2",children:[!ge?.oauth&&e.jsx(xc,{enabled:!!x.oauth,onChange:N=>j({oauth:N||void 0})}),De&&e.jsxs("div",{className:"space-y-1 rounded-md border border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-900/20 p-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-violet-100 dark:bg-violet-900/40 text-violet-700 dark:text-violet-300 rounded font-medium",children:"Sign in"}),e.jsx("span",{className:"text-xs font-medium text-neutral-700 dark:text-neutral-300",children:"Browser sign-in"})]}),e.jsx("p",{className:"text-[10px] text-neutral-500 dark:text-neutral-400",children:"Sign in with your browser — click Connect to authorize. No token to paste."})]}),Be&&e.jsxs("button",{onClick:()=>X(!w),className:"flex items-center gap-1 text-[11px] text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 font-medium",children:[e.jsx("span",{className:`inline-block transition-transform text-[9px] ${w?"rotate-90":""}`,children:"▶"}),"Use an API token instead"]}),(!De||Be&&w)&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:kt,children:"Bearer token env var"}),e.jsx("input",{type:"text",value:x.bearerTokenEnvVar??"",onChange:N=>j({bearerTokenEnvVar:N.target.value}),placeholder:"MCP_BEARER_TOKEN",className:et})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Headers from environment variables"}),e.jsx("button",{onClick:()=>j({headerEnv:[...x.headerEnv??[],{key:"",value:""}]}),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add"})]}),e.jsx("div",{className:"space-y-1.5",children:(x.headerEnv??[]).map((N,Z)=>e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:N.key,placeholder:"Header",onChange:ve=>{const p=[...x.headerEnv??[]];p[Z]={...p[Z],key:ve.target.value},j({headerEnv:p})},className:et}),e.jsx("input",{type:"text",value:N.value,placeholder:"ENV_VAR",onChange:ve=>{const p=[...x.headerEnv??[]];p[Z]={...p[Z],value:ve.target.value},j({headerEnv:p})},className:et}),e.jsx("button",{onClick:()=>j({headerEnv:(x.headerEnv??[]).filter((ve,p)=>p!==Z)}),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"x"})]},Z))})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Static headers"}),e.jsx("button",{onClick:()=>j({headers:[...x.headers??[],{key:"",value:""}]}),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:"+ Add"})]}),e.jsx("div",{className:"space-y-1.5",children:(x.headers??[]).map((N,Z)=>e.jsxs("div",{className:"flex gap-1.5 items-center",children:[e.jsx("input",{type:"text",value:N.key,placeholder:"Header",onChange:ve=>{const p=[...x.headers??[]];p[Z]={...p[Z],key:ve.target.value,value:Ia(ve.target.value)?"":p[Z].value},j({headers:p})},className:et}),e.jsx("input",{type:"password",value:N.value,placeholder:Ia(N.key)?"Use env-backed headers":"Value",disabled:Ia(N.key),onChange:ve=>{const p=[...x.headers??[]];p[Z]={...p[Z],value:ve.target.value},j({headers:p})},className:et}),e.jsx("button",{onClick:()=>j({headers:(x.headers??[]).filter((ve,p)=>p!==Z)}),className:"text-xs text-red-400 hover:text-red-600 px-1",children:"x"})]},Z))})]})]}),tt&&at,!ye&&(x.credentialFiles??[]).length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"block text-xs text-neutral-500 dark:text-neutral-400",children:"Credential files"}),(x.credentialFiles??[]).map(N=>{const Z=k[N.path],ve=N.path.split("/").pop();return e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-neutral-200 dark:border-neutral-700 p-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-mono text-neutral-600 dark:text-neutral-300 truncate",children:N.path}),e.jsx("p",{className:"text-[9px] text-[var(--adf-ui-text-subtle)]",children:Z?`${Z.fileName} (${Z.size<2048?`${Z.size} B`:`${Math.round(Z.size/1024)} KiB`}) selected`:N.required?`This server needs ${ve} — choose the file to provide it.`:`${ve} — created by the server (e.g. tokens) or provide your own.`})]}),e.jsxs("div",{className:"shrink-0",children:[e.jsx("input",{ref:p=>{xe.current[N.path]=p},type:"file",className:"hidden",onChange:p=>Fe(N.path,p.target.files?.[0])}),e.jsx("button",{onClick:()=>xe.current[N.path]?.click(),className:"text-[11px] text-blue-500 hover:text-blue-700 font-medium",children:Z?"Replace…":"Choose file…"})]})]},N.path)}),we&&e.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400 mt-1",children:"Connect once to store the selected credential file before saving."}),!we&&Pe&&e.jsx("p",{className:"text-[10px] text-[var(--adf-ui-text-subtle)] mt-1",children:"Selected files are stored when you Connect — Save alone won’t store them."})]}),e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>ie(!V),className:"flex items-center gap-1 text-xs text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 font-medium",children:[e.jsx("span",{className:`inline-block transition-transform text-[9px] ${V?"rotate-90":""}`,children:"▶"}),"Advanced"]}),V&&e.jsxs("div",{className:"mt-2 space-y-3",children:[!tt&&at,xt]})]}),s&&!(De&&!Be)&&e.jsx(fc,{server:x,registryEntry:ge,onServerUpdate:j,showOAuthNote:!1}),s&&e.jsxs("div",{children:[e.jsxs("button",{onClick:Me,className:"flex items-center gap-1 text-xs text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 font-medium",children:[e.jsx("span",{className:`inline-block transition-transform text-[9px] ${I?"rotate-90":""}`,children:"▶"}),"Logs"]}),I&&e.jsx("div",{className:"mt-2",children:e.jsx(qn,{logs:K??[],serverName:x.name,onClose:()=>R(!1)})})]}),U.phase==="done"&&e.jsxs("div",{className:`rounded-md border p-2 ${U.success?"border-green-300 dark:border-green-800":"border-red-300 dark:border-red-800"}`,children:[U.success?e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:[U.oauthRan?"Signed in and connected":"Connected"," (",U.location,") — ",U.tools?.length??0," tools discovered",U.authRan?", authorization completed":""]}),(U.tools?.length??0)>0&&e.jsx("button",{onClick:()=>A(!W),className:"text-[10px] text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200 mt-0.5",children:W?"Hide tools":"Show tools"}),W&&e.jsx("p",{className:"text-[10px] font-mono text-neutral-500 dark:text-neutral-400 mt-1 max-h-32 overflow-y-auto",children:U.tools?.map(N=>N.name).join(", ")})]}):e.jsxs("div",{children:[e.jsxs("p",{className:"text-xs text-red-500 font-medium",children:["Connect failed",U.location?` (${U.location})`:""]}),U.error&&e.jsx("pre",{className:"text-[10px] font-mono text-red-500/90 whitespace-pre-wrap mt-1 max-h-40 overflow-y-auto",children:U.error}),U.stderrTail&&U.stderrTail.length>0&&e.jsx("pre",{className:"text-[10px] font-mono text-neutral-500 dark:text-neutral-400 whitespace-pre-wrap mt-1 max-h-32 overflow-y-auto",children:U.stderrTail.join(`
|
|
2
|
+
`)})]}),(U.notes?.length??0)>0&&e.jsx("ul",{className:"mt-1 space-y-0.5",children:U.notes.map((N,Z)=>e.jsxs("li",{className:"text-[9px] text-[var(--adf-ui-text-subtle)]",children:["• ",N]},Z))})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{children:[!s&&!H&&e.jsx("button",{onClick:()=>{E("choose"),D(null),q({}),L({phase:"idle"})},className:"text-[11px] text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200",children:"← Back"}),s&&c&&e.jsx("button",{onClick:()=>{c(x.id),t()},className:"text-[11px] text-red-400 hover:text-red-600",children:"Remove server"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!x.lastVerifiedAt&&U.phase!=="done"&&e.jsx(qe,{tip:"You can save without connecting; the server row will show “Not verified” until a connect succeeds.",children:e.jsx("span",{className:"text-[9px] text-[var(--adf-ui-text-subtle)]",children:"Not verified yet"})}),e.jsx("button",{onClick:He,disabled:!O||ue||U.phase==="running",className:"px-3 py-1.5 text-xs font-medium rounded-md border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text)] hover:bg-[var(--adf-ui-surface-hover)] disabled:opacity-40",children:U.phase==="running"?De?"Signing in…":x.auth?"Authorizing…":"Connecting…":De?"Sign in & Connect":"Connect"}),e.jsx("button",{onClick:Ke,disabled:!O||ue||we,className:"px-3 py-1.5 text-xs font-medium rounded-md bg-[var(--adf-ui-accent)] text-[var(--adf-ui-on-accent)] hover:bg-[var(--adf-ui-accent-hover)] disabled:opacity-40",children:"Save"})]})]})]})]})}const Pc={connected:"bg-green-500",connecting:"bg-yellow-500 animate-pulse",error:"bg-red-500",stopped:"bg-neutral-400",installing:"bg-blue-500 animate-pulse",needs_sign_in:"bg-amber-500",needs_compute:"bg-amber-500"},Rc={connected:"Connected",connecting:"Connecting...",error:"Error",stopped:"Stopped",installing:"Installing...",needs_sign_in:"Sign in needed",needs_compute:"Needs setup"};function Tc({mcpServers:a,onServersChanged:t,hostAccessEnabled:s,onEnableHostAccess:r,hostApproved:n,hostApprovedSources:i,onAllowHost:l,mcpOnHost:c,onEnableHostAccessNow:d,onAcceptMcpOnHost:h}){const f=nt(),b=o.useRef(a);b.current=a;const[C,_]=o.useState([]),E=ns(g=>g.entries),x=ns(g=>g.refresh),[D,k]=o.useState(new Set),[q,U]=o.useState({}),[L,W]=o.useState(!1),[A,V]=o.useState(null),[ie,w]=o.useState(null),[X,I]=o.useState({}),[R,K]=o.useState({}),J=o.useRef(0),ae=o.useCallback(g=>{const T=g.url?Lt(E,{url:g.url}):void 0;return Et(g,T)},[E]),se=o.useCallback(async()=>{const g=++J.current,T=b.current.filter(j=>j.type==="http"&&!!j.url&&ae(j)),ee=await Promise.all(T.map(async j=>{try{const me=await f?.mcpOAuthStatus({url:j.url});return[j.id,me?.signedIn]}catch{return[j.id,void 0]}}));g===J.current&&K(j=>{const me={...j};for(const[G,fe]of ee)fe===void 0?delete me[G]:me[G]=fe;return me})},[ae]),Y=async g=>{if(g.url){try{await f?.mcpOAuthSignOut({url:g.url})}catch{}await se()}},z=o.useCallback(async()=>{const g=await f?.getMcpServerStatus();g?.servers&&_(g.servers)},[]);o.useEffect(()=>{z()},[z]),o.useEffect(()=>{se()},[se,a]),o.useEffect(()=>{x(f)},[x,f]),o.useEffect(()=>{const g=f?.onMcpServerStatusChanged(T=>{_(ee=>{const j=ee.findIndex(me=>me.name===T.name);if(j>=0){const me=[...ee];return me[j]={...me[j],status:T.status,error:T.error,toolCount:T.toolCount??me[j].toolCount},me}return[...ee,{name:T.name,status:T.status,error:T.error,restartCount:0,toolCount:T.toolCount??0,logs:[]}]})});return()=>{g?.()}},[]),o.useEffect(()=>{const g=f?.onMcpInstallProgress(T=>{T.status==="installed"?(k(ee=>{const j=new Set(ee);return j.delete(T.package),j}),U(ee=>{const j={...ee};return delete j[T.package],j})):T.status==="error"&&(k(ee=>{const j=new Set(ee);return j.delete(T.package),j}),U(ee=>({...ee,[T.package]:T.error??"Unknown error"})))});return()=>{g?.()}},[]);const re=async g=>{const T=a.find(ee=>ee.id===g);if(window.confirm(`Remove ${T?.name??"this server"}?${T?.managed?" Its installed package is uninstalled.":""}`)){if(T?.managed){const ee=T.type==="uvx"||T.type==="pip",j=ee?T.pypiPackage:T.npmPackage;if(j)try{ee?await f?.uninstallPythonMcpPackage({package:j}):await f?.uninstallMcpPackage({package:j})}catch(me){console.warn(`[McpStatusDashboard] Uninstall failed for ${j}:`,me)}}t(b.current.filter(ee=>ee.id!==g))}},he=async g=>{const T=b.current,ee=T.some(j=>j.id===g.id);if(t(ee?T.map(j=>j.id===g.id?g:j):[...T,g]),!ee&&g.managed){const j=g.type==="uvx"||g.type==="pip",me=j?g.pypiPackage:g.npmPackage;if(me){k(G=>new Set(G).add(me));try{const G=j?await f?.installPythonMcpPackage({package:me,name:g.name}):await f?.installMcpPackage({package:me,name:g.name});G?.success&&G.installed&&t(b.current.map(fe=>fe.id===g.id&&Ya(fe,g)?{...fe,version:G.installed.version}:fe))}catch{}}}},H=async g=>{I(T=>({...T,[g.id]:{loading:!0}}));try{const T=await f?.testMcpRegistration({registration:g});if(T?.success){I(j=>({...j,[g.id]:{loading:!1,count:T.tools.length}})),t(b.current.map(j=>j.id===g.id&&Ya(j,g)?{...j,lastVerifiedAt:Date.now(),...T.serverVersion?{version:T.serverVersion}:{}}:j));const ee=C.find(j=>j.name===g.name);ee&&ee.status!=="stopped"&&(await f?.restartMcpServer({name:g.name}),await z()),se()}else if(I(ee=>({...ee,[g.id]:{loading:!1,error:T?.error??"Failed"}})),T?.computeUnavailable){let ee=g;w({name:g.name,pinnedToContainer:g.runLocation==="shared",retry:()=>{H(ee)},runOnHost:async()=>(ee={...b.current.find(me=>me.id===g.id)??g,runLocation:"host"},t(b.current.map(me=>me.id===g.id?ee:me)),s||!d?!0:d())})}}catch(T){I(ee=>({...ee,[g.id]:{loading:!1,error:String(T)}}))}},ne=a.map(g=>{const T=C.find(ee=>ee.name===g.name);return{reg:g,state:T}}),xe=A?a.find(g=>g.id===A)??null:null;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"MCP Servers"}),e.jsx("button",{onClick:()=>{V(null),W(!0)},className:"px-2.5 py-1 text-xs font-medium rounded-md bg-[var(--adf-ui-accent)] text-[var(--adf-ui-on-accent)] hover:bg-[var(--adf-ui-accent-hover)]",children:"+ Add MCP Server"})]}),e.jsx(_c,{open:L,onClose:()=>{W(!1),V(null)},editing:xe,existingServers:a,hostAccessEnabled:s,onEnableHostAccess:r,onSave:he,onRemove:re,onOAuthChanged:se,onComputeNeeded:(g,T)=>w({name:g,pinnedToContainer:T.pinnedToContainer,retry:T.retry,runOnHost:T.runOnHost}),onEnableHostAccessNow:d,mcpOnHost:c}),e.jsx(Un,{open:!!ie,servers:ie?[ie.name]:[],api:f,onClose:()=>w(null),onResolved:()=>{const g=ie;w(null),g?.retry()},runOnHost:ie?.runOnHost,acceptMcpOnHost:c&&s||ie?.pinnedToContainer?void 0:h}),ne.length===0?e.jsx("p",{className:"rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] px-4 py-6 text-center text-xs text-[var(--adf-ui-text-muted)] shadow-subtle",children:"No MCP servers configured. Use “Add MCP Server” to pick a known server or configure your own."}):e.jsx("div",{className:"space-y-3",children:ne.map(({reg:g,state:T})=>{const ee=g.npmPackage??g.pypiPackage??"",j=D.has(ee),me=q[ee],G=j?"installing":T?.status??"stopped",fe=g.npmPackage?Lt(E,{npmPackage:g.npmPackage}):g.pypiPackage?Lt(E,{pypiPackage:g.pypiPackage}):g.url?Lt(E,{url:g.url}):void 0,Ee=Sc(g,fe),ge=X[g.id],Ie=g.type==="http",Ge=Et(g,fe),$e=R[g.id];return e.jsxs("div",{className:"overflow-hidden rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] shadow-subtle",children:[e.jsxs("div",{onClick:()=>{V(g.id),W(!0)},className:"flex cursor-pointer items-center justify-between px-4 py-3 transition-colors hover:bg-[var(--adf-ui-surface-hover)]",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:`w-2 h-2 rounded-full shrink-0 ${Pc[G]??"bg-neutral-400"}`}),e.jsx(Br,{iconKey:fe?.iconKey,category:fe?.category??(Ie?"web":"tools"),size:22}),e.jsx("span",{className:"text-sm font-medium text-neutral-700 dark:text-neutral-200 truncate",children:g.name||"(unnamed)"}),e.jsxs("span",{className:"text-[10px] text-[var(--adf-ui-text-subtle)]",children:[Rc[G]??G,T?.toolCount?` · ${T.toolCount} tools`:""]}),Ie?e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-neutral-100 dark:bg-neutral-700 text-neutral-500 dark:text-neutral-400 rounded font-medium",children:"Remote"}):(()=>{const ye=Hn(g,{hostAccessEnabled:s===!0,hostApproved:n??[],hostApprovedSources:i,mcpOnHost:c});return e.jsxs(e.Fragment,{children:[e.jsx(qe,{tip:ye.runsOnHost?zr:ye.gap?"Chosen: host. Runs isolated in the shared compute container until the host is allowed.":"Runs isolated in the shared compute container (requires Podman).",children:e.jsx("span",{className:`text-[11px] px-1 py-0.5 rounded font-medium ${ye.runsOnHost?"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400"}`,children:ye.runsOnHost?"Host":"Container"})}),ye.gap&&l&&e.jsx(qe,{tip:Vn(ye.gap),children:e.jsx("button",{type:"button",onClick:De=>{De.stopPropagation(),l(g)},className:"rounded px-1 py-0.5 text-[11px] font-medium text-amber-700 hover:bg-amber-100 dark:text-amber-400 dark:hover:bg-amber-900/30",children:"Allow"})})]})})(),Ar(g)&&e.jsx(qe,{tip:"Available to agents — any agent may attach and use this server.",children:e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-400 rounded font-medium",children:"Agents"})}),Ge&&$e===!0?e.jsx(qe,{tip:"Signed in via browser OAuth. Use Sign out to clear the stored token.",children:e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-400 rounded font-medium",children:"Signed in"})}):Nc(g,fe,$e)?e.jsx(qe,{tip:"This server needs a browser sign-in — open it and click “Sign in & Connect”.",children:e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-amber-100 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400 rounded font-medium",children:"Sign in needed"})}):Ee?e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-amber-100 dark:bg-amber-900/40 text-amber-600 dark:text-amber-400 rounded font-medium",children:"Needs keys"}):g.lastVerifiedAt?null:e.jsx(qe,{tip:"This server has not completed a successful Connect yet — open it and use Connect to verify.",children:e.jsx("span",{className:"text-[9px] px-1 py-0.5 bg-neutral-100 dark:bg-neutral-700 text-[var(--adf-ui-text-subtle-on-fill)] rounded",children:"Not verified"})})]}),e.jsxs("div",{className:"flex items-center shrink-0",children:[Ge&&$e===!0&&e.jsx(qe,{tip:"Sign out — clears the stored token (re-sign-in is one click).",children:e.jsx("button",{onClick:ye=>{ye.stopPropagation(),Y(g)},className:"p-1 text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200","aria-label":"Sign out",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),e.jsx("polyline",{points:"16 17 21 12 16 7"}),e.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})}),e.jsx(qe,{tip:g.auth?"Re-authorize":"Reconnect",children:e.jsx("button",{onClick:ye=>{ye.stopPropagation(),H(g)},disabled:ge?.loading||!g.name,className:"p-1 text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200 disabled:opacity-40",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ge?.loading?"animate-spin":void 0,children:[e.jsx("path",{d:"M21 12a9 9 0 1 1-2.64-6.36"}),e.jsx("polyline",{points:"21 3 21 9 15 9"})]})})})]})]}),ge&&!ge.loading&&e.jsx("div",{className:"px-4 pb-2",children:e.jsx("span",{className:`text-[10px] ${ge.error?"text-red-500":"text-green-600 dark:text-green-400"}`,children:ge.error?ge.error:`${ge.count} tools discovered`})}),(T?.error||me)&&!ge&&e.jsx("div",{className:"px-4 pb-3",children:e.jsx("p",{className:"text-[10px] text-red-500",children:T?.error||me})})]},g.id)})})]})}function Mc({logs:a,onClose:t,adapterType:s}){const r=o.useRef(null);return o.useEffect(()=>{r.current&&(r.current.scrollTop=r.current.scrollHeight)},[a.length]),e.jsxs("div",{className:"border border-neutral-200 dark:border-neutral-700 rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-neutral-50 dark:bg-neutral-800 border-b border-neutral-200 dark:border-neutral-700",children:[e.jsxs("span",{className:"text-xs font-medium text-neutral-600 dark:text-neutral-300",children:["Logs: ",s]}),e.jsx("button",{onClick:t,className:"text-xs text-[var(--adf-ui-text-subtle)] hover:text-neutral-600 dark:hover:text-neutral-200",children:"Close"})]}),e.jsx("div",{ref:r,className:"max-h-48 overflow-y-auto bg-neutral-900 p-2",children:a.length===0?e.jsx("p",{className:"text-xs text-neutral-400 font-mono",children:"No logs yet."}):a.map((n,i)=>{const l=new Date(n.timestamp).toLocaleTimeString(),c=n.level==="error"?"text-red-400":n.level==="warn"?"text-yellow-400":n.level==="system"?"text-blue-400":"text-neutral-300";return e.jsxs("div",{className:"flex gap-2 text-[11px] font-mono leading-relaxed",children:[e.jsx("span",{className:"text-neutral-400 shrink-0",children:l}),e.jsx("span",{className:c,children:n.message})]},i)})})]})}function Lc({open:a,onClose:t,type:s,entry:r,filePath:n,agents:i,connectedPaths:l,liveStatus:c,onSaved:d}){const h=nt(),f=r?.displayName??s,b=r?.credentials??[...(r?.requiredEnvKeys??[]).map(u=>({key:u,label:u,required:!0})),...(r?.optionalEnvKeys??[]).map(u=>({key:u,label:u,required:!1}))],C=b.length===0,_=!!n,[E,x]=o.useState(n??""),[D,k]=o.useState({}),[q,U]=o.useState({}),[L,W]=o.useState([]),[A,V]=o.useState([]),[ie,w]=o.useState(""),[X,I]=o.useState({}),[R,K]=o.useState(!1),[J,ae]=o.useState(null),[se,Y]=o.useState(!1),[z,re]=o.useState(null),[he,H]=o.useState(null),[ne,xe]=o.useState(null);o.useEffect(()=>{a&&(x(n??""),k({}),U({}),V([]),w(""),I({}),ae(null),Y(!1),re(null),H(null),xe(null),n&&h?.getAdapterCredentials({filePath:n,adapterType:s}).then(u=>{if(u?.credentials){U(u.credentials),k(u.credentials);const S=u.storedKeys??Object.keys(u.credentials);W(S),V(S)}}).catch(()=>{}))},[a,n,s]);const g=A.filter(u=>!b.some(S=>S.key===u)).map(u=>({key:u,label:u,required:!1})),T=[...b,...g],ee=_||!!z,j=i.filter(u=>!l.includes(u.filePath)),me=T.filter(u=>u.required&&!(D[u.key]??"").trim()&&!L.includes(u.key)),G=!!E&&me.length===0&&!R,fe=T.filter(u=>(D[u.key]??"").trim()&&(D[u.key]??"").trim()!==(q[u.key]??"")),Ee=u=>Qa(u,i),ge=async(u,S)=>{const O=await h?.attachAdapter({filePath:u,adapterType:s,config:{enabled:!0,policy:{dm:"all",groups:"mention"}}});if(O&&!O.success){const pe=O.error??"the agent config could not be written";return Y(!0),ae(S?`The credentials are stored on ${Ee(u)}, but ${f} could not be switched on for it: ${pe}. Nothing is listening yet.`:`${f} could not be switched on for ${Ee(u)}: ${pe}.`),{ok:!1,alreadyOn:!1}}return Y(!1),{ok:!0,alreadyOn:O?.alreadyAttached??!1}},Ie=async()=>{if(!E)return;K(!0),ae(null),re(null);const u=fe;try{for(const O of u){const pe=await h?.setAdapterCredential({filePath:E,adapterType:s,envKey:O.key,value:(D[O.key]??"").trim()});if(pe&&!pe.success)throw new Error(pe.error??`Could not save ${O.label}`)}U(O=>({...O,...Object.fromEntries(u.map(pe=>[pe.key,(D[pe.key]??"").trim()]))}));const S=await ge(E,u.length>0);if(!S.ok)return;re({changed:u.length>0,alreadyOn:S.alreadyOn}),d()}catch(S){ae(S instanceof Error?S.message:String(S))}finally{K(!1)}},Ge=async()=>{if(E){K(!0),ae(null);try{const u=await ge(E,!0);u.ok&&(re({changed:!0,alreadyOn:u.alreadyOn}),d())}catch(u){ae(u instanceof Error?u.message:String(u))}finally{K(!1)}}},$e=async()=>{const u=n??E;if(u&&window.confirm(`Disconnect ${Ee(u)} from ${f}? Its stored ${f} credentials are deleted.`)){K(!0);try{const S=await h?.detachAdapter({filePath:u,adapterType:s});if(S&&!S.success)throw new Error(S.error??"Could not disconnect");d(),t()}catch(S){ae(S instanceof Error?S.message:String(S))}finally{K(!1)}}},ye=async()=>{const u=n??E;if(!u)return;if(he){H(null),xe(null);return}const S=await h?.getAdapterLogs({type:s,filePath:u});H(S?.logs??[]),xe(S?.running===!1?"This agent is not running, so it holds no logs for this channel.":null)},De=async()=>{const u=n??E;if(u){K(!0),ae(null);try{const S=await h?.restartAdapter({type:s,filePath:u});S&&!S.success?ae(S.error??`Could not restart ${f}.`):d()}finally{K(!1)}}},Be=()=>{const u=ie.trim();!u||T.some(S=>S.key===u)||(V(S=>[...S,u]),w(""))};return e.jsx(gt,{open:a,onClose:t,title:ee?`${f} on this agent`:`Connect an agent to ${f}`,wide:!0,lightDismiss:!1,children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ja,{iconKey:r?.iconKey,label:f,size:36}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:r?.tagline??r?.description}),r?.docsUrl&&e.jsx(ct,{href:r.docsUrl,label:"Full setup guide",className:"mt-0.5"})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-0.5 block text-[11px] text-[var(--adf-ui-text-muted)]",children:"Agent"}),ee?e.jsxs("div",{className:"flex items-center justify-between rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-raised)] px-2.5 py-1.5",children:[e.jsx("span",{className:"truncate text-[12px] text-[var(--adf-ui-text)]",children:Ee(n??E)}),c&&e.jsx("span",{className:`text-[10.5px] ${c.status==="connected"?"text-[var(--adf-ui-success)]":c.status==="error"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-subtle)]"}`,children:c.status})]}):e.jsxs(na,{value:E,onChange:u=>x(u.target.value),"aria-label":"Agent",children:[e.jsx("option",{value:"",disabled:!0,children:i.length===0?"No agents in tracked folders":j.length===0?"Every tracked agent is already connected":"Choose an agent…"}),j.map(u=>e.jsx("option",{value:u.filePath,children:Qa(u.filePath,i)},u.filePath))]}),!ee&&e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:"Stored in this agent's file."})]}),T.length===0&&!C&&e.jsxs("p",{className:"rounded-[var(--adf-ui-control-radius)] border border-dashed border-[var(--adf-ui-border)] px-3 py-2.5 text-[12px] text-[var(--adf-ui-text-muted)]",children:["No credentials needed. Save to switch ",f," on for the agent; pairing happens when it starts."]}),T.map(u=>{const S=g.some(ue=>ue.key===u.key),O=u.key.toLowerCase().includes("username")||u.key.toLowerCase().endsWith("_id"),pe=L.includes(u.key)&&!(q[u.key]??"");return e.jsxs("div",{children:[e.jsxs("label",{className:"mb-0.5 block text-[11px] text-[var(--adf-ui-text-muted)]",children:[u.label,!u.required&&e.jsx("span",{className:"text-[var(--adf-ui-text-subtle)]",children:" (optional)"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ze,{type:(S?!X[u.key]:!O)?"password":"text",value:D[u.key]??"",onChange:ue=>k(Oe=>({...Oe,[u.key]:ue.target.value})),placeholder:pe?"•••••••• stored on the agent":u.placeholder??u.key,className:"font-mono text-[12px]","aria-label":u.label}),S&&e.jsx($,{variant:"ghost",size:"compact",onClick:()=>I(ue=>({...ue,[u.key]:!ue[u.key]})),children:X[u.key]?"Hide":"Show"})]}),u.hint&&e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:u.hint})]},u.key)}),C&&e.jsxs("div",{children:[e.jsx("label",{className:"mb-0.5 block text-[11px] text-[var(--adf-ui-text-muted)]",children:"Add a credential key"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ze,{value:ie,onChange:u=>w(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),Be())},placeholder:"MY_CHANNEL_TOKEN",className:"font-mono text-[12px]","aria-label":"Credential key"}),e.jsx($,{variant:"secondary",size:"compact",onClick:Be,disabled:!ie.trim(),children:"+ Add key"})]}),e.jsx("p",{className:"mt-0.5 text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:"This channel is not in the registry, so name the keys its package reads."})]}),c?.error&&e.jsx("p",{className:"rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-danger-subtle)] px-2.5 py-1.5 text-[11px] text-[var(--adf-ui-danger)]",children:c.error}),J&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-danger)]",children:J}),se&&e.jsxs($,{variant:"secondary",size:"compact",onClick:()=>{Ge()},disabled:R,children:["Retry switching ",f," on"]})]}),z&&e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-success)]",children:!z.changed&&z.alreadyOn?"Nothing changed.":z.changed&&z.alreadyOn?`Credentials saved. Restart ${f} below so the agent picks them up.`:`${f} is on for this agent. It starts now if the agent is running, otherwise the next time the agent starts.`}),ee&&e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 border-t border-[var(--adf-ui-separator)] pt-2",children:[e.jsx($,{variant:"ghost",size:"compact",onClick:()=>{ye()},children:he?"Hide logs":"Logs"}),e.jsx($,{variant:"ghost",size:"compact",onClick:()=>{De()},disabled:R,children:"Restart"}),e.jsx("span",{className:"text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:"Runs on the agent hosting this channel."})]}),ne&&e.jsx("p",{className:"text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:ne}),he&&e.jsx(Mc,{logs:he,onClose:()=>{H(null),xe(null)},adapterType:s})]}),(r?.setupSteps?.length??0)>0&&e.jsxs("aside",{className:"rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-raised)] p-3",children:[e.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-[var(--adf-ui-text-muted)]",children:"Where to get this"}),e.jsx("ol",{className:"space-y-1.5 text-[11.5px] leading-4 text-[var(--adf-ui-text)]",children:r.setupSteps.map((u,S)=>e.jsxs("li",{className:"flex gap-2",children:[e.jsxs("span",{className:"shrink-0 tabular-nums text-[var(--adf-ui-text-subtle)]",children:[S+1,"."]}),e.jsxs("span",{children:[u.text,u.url&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:u.url,onClick:O=>{O.preventDefault(),window.open(u.url,"_blank","noopener,noreferrer")},className:"text-[var(--adf-ui-accent)] underline-offset-2 hover:underline",children:"Open ↗"})]})]})]},S))})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--adf-ui-separator)] pt-3",children:[ee?e.jsx($,{variant:"ghost",size:"compact",className:"text-[var(--adf-ui-danger)]",onClick:()=>{$e()},disabled:R,children:"Disconnect"}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{variant:"ghost",onClick:t,children:z?"Close":"Cancel"}),e.jsx($,{variant:"primary",onClick:()=>{Ie()},disabled:!G,loading:R,children:R?"Saving…":ee?"Save":"Connect"})]})]})]})})}const Ic={connected:"bg-green-500",connecting:"bg-yellow-500 animate-pulse",error:"bg-red-500",disconnected:"bg-neutral-400"};function Dc({adapters:a,onAdaptersChanged:t}){const s=nt(),r=o.useRef(a);r.current=a;const n=Zn(a),[i,l]=o.useState([]),[c,d]=o.useState({}),[h,f]=o.useState(!1),[b,C]=o.useState([]),[_,E]=o.useState([]),[x,D]=o.useState(null),k=o.useCallback(async()=>{const w=await s?.getAdapterStatus();w?.adapters&&C(w.adapters),E(w?.perAgent??[])},[]),q=o.useCallback(async()=>{const w=n.map(R=>R.type),X=await Promise.all(w.map(async R=>{try{return(await s?.listAdapterCredentialFiles({adapterType:R}))?.files??[]}catch{return[]}})),I={};w.forEach((R,K)=>{I[R]=X[K]}),d(I),f(!0)},[n.map(w=>w.type).join("|")]);o.useEffect(()=>{k()},[k]),o.useEffect(()=>{q()},[q]),o.useEffect(()=>{Wn(s).then(l).catch(()=>l([]))},[s]),o.useEffect(()=>{const w=s?.onAdapterStatusChanged(X=>{k()});return()=>{w?.()}},[k]);const U=async w=>{const X=Da(w.type);if(X?.builtIn)return;const I=X?.displayName??w.type,R=w.npmPackage&&w.managed?`Remove ${I} from this list and uninstall ${w.npmPackage}? Agents keep the credentials stored in their own files.`:`Remove ${I} from this list? Agents keep the credentials stored in their own files.`;window.confirm(R)&&(w.npmPackage&&w.managed&&await s?.uninstallAdapterPackage({package:w.npmPackage}),t(r.current.filter(K=>K.id!==w.id)))},L=w=>Qa(w,i),W=(w,X)=>_.find(I=>I.filePath===w)?.adapters.find(I=>I.type===X),A=Object.values(c).some(w=>w.length>0),V=x?Da(x.type):void 0,ie=x?(c[x.type]??[]).map(w=>w.filePath):[];return e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:"One agent per connection; credentials live in that agent's file."}),x&&e.jsx(Lc,{open:!0,onClose:()=>D(null),type:x.type,entry:V,filePath:x.filePath,agents:i,connectedPaths:ie,liveStatus:x.filePath?W(x.filePath,x.type):void 0,onSaved:()=>{q(),k()}}),!h&&e.jsx("div",{className:"space-y-2","aria-busy":"true",children:n.map(w=>e.jsx("div",{className:"h-[4.5rem] animate-pulse rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)]"},w.id))}),h&&!A&&e.jsxs("div",{className:"rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] p-4 shadow-subtle",children:[e.jsx("p",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:"Give an agent a place to talk"}),e.jsx("p",{className:"mt-0.5 max-w-xl text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:"Pick a channel, choose the agent, paste the token."}),e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 md:grid-cols-3",children:Gn.map(w=>e.jsxs("button",{type:"button",onClick:()=>D({type:w.type}),className:"flex items-start gap-2 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface)] p-2.5 text-left transition-colors hover:border-[var(--adf-ui-accent)] hover:bg-[var(--adf-ui-surface-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",children:[e.jsx(ja,{iconKey:w.iconKey,label:w.displayName,size:28}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[12px] font-medium text-[var(--adf-ui-text)]",children:w.displayName}),e.jsx("span",{className:"mt-0.5 line-clamp-2 block text-[10.5px] leading-4 text-[var(--adf-ui-text-muted)]",children:w.tagline??w.description})]})]},w.type))})]}),h&&A&&e.jsx("div",{className:"space-y-3",children:n.map(w=>{const X=Da(w.type),I=c[w.type]??[],R=b.find(J=>J.type===w.type),K=X?.displayName??w.type;return e.jsxs("div",{className:"overflow-hidden rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] shadow-subtle",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(ja,{iconKey:X?.iconKey,label:K,size:26}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-[var(--adf-ui-text)]",children:K}),!X?.builtIn&&w.npmPackage&&e.jsx("span",{className:"truncate font-mono text-[10px] text-[var(--adf-ui-text-subtle)]",children:w.npmPackage})]}),e.jsx("p",{className:"truncate text-[10.5px] text-[var(--adf-ui-text-subtle)]",children:X?.tagline??X?.description??`Channel type "${w.type}"`})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[!X?.builtIn&&e.jsx($,{variant:"ghost",size:"compact",className:"text-[var(--adf-ui-danger)]",onClick:()=>{U(w)},children:"Remove"}),e.jsx($,{variant:"secondary",size:"compact",onClick:()=>D({type:w.type}),children:"+ Connect an agent"})]})]}),e.jsx("div",{children:I.length===0?e.jsx("p",{className:"px-4 pb-3 text-[11px] text-[var(--adf-ui-text-subtle)]",children:"No agents connected."}):e.jsx("div",{className:"max-h-40 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse text-[11.5px]",children:[e.jsx("thead",{className:"sticky top-0 bg-[var(--adf-ui-surface)] text-left text-[10px] uppercase tracking-wide text-[var(--adf-ui-text-subtle)]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-1 font-medium",children:"Agent"}),e.jsx("th",{className:"px-2 py-1 font-medium",children:"Status"}),e.jsx("th",{className:"px-2 py-1 font-medium",children:"Credentials"}),e.jsx("th",{className:"px-4 py-1"})]})}),e.jsx("tbody",{children:I.map(J=>{const ae=W(J.filePath,w.type),se=ae?.status??"disconnected",Y=X?.requiredEnvKeys??[],z=Y.filter(H=>!J.populatedKeys.includes(H)),re=Y.length===0?J.populatedKeys.length>0?`${J.populatedKeys.length} stored`:"none needed":z.length>0?`missing ${z.join(", ")}`:`${Y.length} of ${Y.length} stored`,he=ae?ae.error?`${se}: ${ae.error}`:se:"not running";return e.jsxs("tr",{onClick:()=>D({type:w.type,filePath:J.filePath}),className:"cursor-pointer border-t border-[var(--adf-ui-separator)] transition-colors hover:bg-[var(--adf-ui-surface-hover)]",children:[e.jsx("td",{className:"px-4 py-1.5",children:e.jsxs("span",{className:"flex items-center gap-1.5 text-[var(--adf-ui-text)]",children:[e.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${z.length>0?"bg-amber-400":Ic[se]??"bg-neutral-400"}`}),e.jsx("span",{className:"truncate",children:L(J.filePath)})]})}),e.jsx("td",{className:`max-w-[18rem] truncate px-2 py-1.5 ${ae?.error?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-muted)]"}`,title:he,children:he}),e.jsx("td",{className:`px-2 py-1.5 ${z.length>0?"text-[var(--adf-ui-warning)]":"text-[var(--adf-ui-text-muted)]"}`,children:re}),e.jsx("td",{className:"px-4 py-1.5 text-right text-[var(--adf-ui-text-subtle)]",children:"Edit ›"})]},J.filePath)})})]})})}),R?.error&&!I.some(J=>W(J.filePath,w.type)?.error)&&e.jsx("p",{className:"border-t border-[var(--adf-ui-separator)] px-4 py-1.5 text-[11px] text-[var(--adf-ui-danger)]",children:R.error})]},w.id)})})]})}function Oc({loaded:a,providers:t,setProviders:s,defaultProviderId:r,setDefaultProviderId:n,flushSave:i,saveFailure:l,onOpenTemplate:c}){const d=Yn({providers:t,setProviders:s,defaultProviderId:r,setDefaultProviderId:n,flushSave:i,saveFailure:l});return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[13px] font-medium text-[var(--adf-ui-text)]",children:"Providers"}),e.jsxs("p",{className:"mt-0.5 text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:["New agents use the Default provider unless their"," ",e.jsx("button",{type:"button",onClick:c,className:"rounded underline underline-offset-2 hover:text-[var(--adf-ui-text)] focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",children:"template"})," names one."]})]}),e.jsx($,{variant:"primary",size:"compact",className:"shrink-0",onClick:d.openPicker,children:"+ Add provider"})]}),e.jsx(Qn,{...d.modalProps}),l?.panel&&e.jsx(Jn,{message:l.panel}),a?t.length===0?e.jsxs("div",{className:"rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] px-4 py-6 text-center shadow-subtle",children:[e.jsx("p",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:"No providers yet"}),e.jsx("p",{className:"mx-auto mt-1 max-w-md text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:"Sign in with a ChatGPT, Grok, or Claude subscription, paste an API key, or point at a local server like LM Studio or Ollama."}),e.jsx($,{variant:"primary",className:"mt-3",onClick:d.openPicker,children:"Choose a provider"})]}):e.jsx("div",{className:"space-y-3",children:t.map(h=>{const f=Xn(h),b=d.status[h.id],C=h.id===r,_=d.carrierCounts[h.id]??0,E=h.type==="openai-compatible"&&h.baseUrl?h.baseUrl:ei(h.type);return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>d.openRow(h.id),onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),d.openRow(h.id))},className:"flex cursor-pointer items-center justify-between gap-3 rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)] px-4 py-3 shadow-subtle transition-colors hover:bg-[var(--adf-ui-surface-hover)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e.jsx(ja,{iconKey:f?.iconKey,label:f?.label??h.name,size:26}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(qe,{tip:ai(b),children:e.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-full ${ti(b)}`})}),e.jsx("span",{className:"truncate text-[13px] font-medium text-[var(--adf-ui-text)]",children:h.name||f?.label}),C&&e.jsx(qe,{tip:"New agents start on this provider.",children:e.jsx("span",{className:"rounded bg-[var(--adf-ui-warning-subtle)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--adf-ui-warning)]",children:"Default"})}),_>0&&e.jsx(qe,{tip:`${_} agent${_===1?"":"s"} use their own key, model, params, or delay for this provider.`,children:e.jsxs("span",{className:"rounded bg-[var(--adf-ui-accent-subtle)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--adf-ui-accent)]",children:[_," override",_===1?"":"s"]})})]}),e.jsxs("p",{className:"truncate text-[11px] text-[var(--adf-ui-text-subtle)]",children:[E,h.defaultModel?` · ${h.defaultModel}`:""]}),l?.rows[h.id]&&e.jsxs("p",{role:"alert",className:"mt-0.5 text-[11px] leading-4 text-[var(--adf-ui-danger)]",children:["Not saved: ",l.rows[h.id]]})]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--adf-ui-text-subtle)]",children:"Configure ›"})]},h.id)})}):e.jsxs("div",{className:"space-y-2","aria-busy":"true",children:[e.jsx("div",{className:"h-[3.6rem] animate-pulse rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)]"}),e.jsx("div",{className:"h-[3.6rem] animate-pulse rounded-[var(--adf-ui-container-radius)] bg-[var(--adf-ui-surface)]"})]})]})}const Hr="https://github.com/christianbalevski/adf",$c=`${Hr}/releases/latest`;function Kc(a,t){if(a.status==="downloading")return`Downloading v${a.version}… ${a.percent}%`;if(a.status==="ready"||a.status==="installing")return`Restarting into v${a.version}…`;if(a.status==="error")return`Update failed: ${a.message}`;if(a.status==="available")return`v${a.version} is available.`;if(!t)return null;switch(t.outcome){case"up-to-date":return`v${t.version} is the latest version.`;case"failed":return`Could not check for updates: ${t.message}`;case"unsupported":return"Update checks only run in the installed app, not in a development build.";default:return null}}function Vr(a){window.open(a,"_blank","noopener,noreferrer")}function Fc(){const[a,t]=o.useState(null),[s,r]=o.useState({status:"idle"}),[n,i]=o.useState(!1),[l,c]=o.useState(null);o.useEffect(()=>(window.adfApi?.getUpdateState().then(r).catch(()=>{}),window.adfApi?.onUpdateState(r)),[]);const d=async()=>{i(!0),c(null);try{c(await window.adfApi.checkForUpdates())}catch(C){c({outcome:"failed",message:C instanceof Error?C.message:String(C)})}finally{i(!1)}},h=n?"Checking for updates…":Kc(s,l),f=s.status==="available"||s.status==="error"&&!!s.version,b=n||s.status==="downloading"||s.status==="ready"||s.status==="installing";return o.useEffect(()=>{let C=!0;return window.adfApi?.getAppVersion().then(_=>{C&&t(_)}).catch(()=>{C&&t("Unavailable")}),()=>{C=!1}},[]),e.jsx(Re,{children:e.jsx(ce,{label:"ADF Studio",description:e.jsxs("span",{"aria-live":"polite",children:["Version ",a??"…",h&&e.jsx("span",{className:"block",children:h})]}),children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs($,{variant:"ghost",onClick:()=>Vr($c),children:[e.jsx("span",{children:"Release notes"}),e.jsx("span",{"aria-hidden":!0,children:"↗"})]}),window.adfApi?.platform==="web"?e.jsx("span",{className:"text-xs text-[var(--adf-ui-text-muted)]",children:"Updated with the daemon"}):f?e.jsx($,{onClick:()=>{window.adfApi.downloadUpdate()},children:s.status==="error"?"Retry download":"Download and restart"}):e.jsx($,{onClick:()=>{d()},disabled:b,children:"Check for updates"})]})})})}function Bc(){return e.jsxs("div",{className:"space-y-6 text-sm text-neutral-700 dark:text-neutral-300 leading-relaxed",children:[e.jsxs("div",{className:"text-center pb-2",children:[e.jsx(Mn,{height:40,className:"mb-1"}),e.jsx("h3",{className:"text-lg font-semibold text-neutral-800 dark:text-neutral-100",children:"Agent Document Format"}),e.jsx("p",{className:"text-xs text-[var(--adf-ui-text-subtle)] mt-1",children:"An open standard for portable AI agents"})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"font-semibold text-neutral-800 dark:text-neutral-100 mb-1.5",children:"The core idea"}),e.jsxs("p",{children:["ADF is an open standard for portable AI agents. A single SQLite file (",e.jsx("strong",{children:".adf"}),") contains a complete agent: identity, memory, instructions, tools, and execution state. Move the file, you move the agent."]}),e.jsxs("p",{className:"mt-2",children:["ADF is less about what an agent can ",e.jsx("em",{children:"do"})," and more about what an agent ",e.jsx("em",{children:"is"}),". If an agent is a file with a defined shape, any runtime that implements the spec can run it, the same way any photo viewer can open a JPEG. ADF Studio is the reference implementation. The runtime, daemon, and CLI ship alongside it."]})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"font-semibold text-neutral-800 dark:text-neutral-100 mb-1.5",children:"What's inside an .adf file?"}),e.jsxs("ul",{className:"space-y-1.5 ml-1 text-xs text-neutral-600 dark:text-neutral-400",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"README"})," — the agent's public-facing description (markdown). Editable by you and the agent."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Memory"})," — the agent's private working state."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Config"})," — model, instructions, tools, triggers, security, and runtime behavior."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Loop"})," — full conversation history and context."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Inbox & outbox"})," — messages exchanged with other agents."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Files"})," — internal file storage scoped to the agent."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Timers"})," — scheduled wake-ups, from a one-off delay to a cron expression."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Identity"})," — a cryptographic DID for peer authentication."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Tasks & logs"})," — background work and operational records."]})]}),e.jsx("p",{className:"mt-2 text-xs text-neutral-500 dark:text-neutral-400",children:"Share the file, share the agent — work, memory, history, and identity all in one place."})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"font-semibold text-neutral-800 dark:text-neutral-100 mb-1.5",children:"How to use ADF"}),e.jsxs("ol",{className:"space-y-2 list-decimal list-inside text-neutral-600 dark:text-neutral-400 text-xs",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Connect a provider"})," — In Settings → Providers, add an Anthropic, OpenAI, OpenAI-compatible, OpenRouter, ChatGPT Subscription, Grok Subscription, or Claude Subscription provider."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Create or open an .adf"})," — Use ",e.jsx("em",{children:"+ New .adf"})," on the home screen, or open an existing file."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Configure the agent"})," — Set its instructions, model, and tools in the Config tab."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Run it"})," — Chat with the agent directly, or enable auto-start / autonomous mode to let it run on its own."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Track directories"})," — Add a folder to the Tracked Directories panel so the home screen sees all your .adf files at a glance."]})]})]}),e.jsxs("section",{children:[e.jsx("h4",{className:"font-semibold text-neutral-800 dark:text-neutral-100 mb-1.5",children:"What agents can do"}),e.jsxs("ul",{className:"space-y-1.5 ml-1 text-xs text-neutral-600 dark:text-neutral-400",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Code execution"})," — sandboxed JavaScript and TypeScript via ",e.jsx("code",{children:"sys_code"})," and ",e.jsx("code",{children:"sys_lambda"}),", with optional npm packages."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Lambdas"})," — scripts the runtime runs on a trigger, a timer, or a message, with no model call and no token cost."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Triggers & timers"})," — run on schedule, on file change, on inbox arrival, on tool calls, and more."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"MCP integration"})," — connect to Model Context Protocol servers for filesystem, web, GitHub, Slack, and more."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Skills"})," — drop a ",e.jsx("code",{children:"SKILL.md"})," folder into an agent to teach it a procedure; mute or remove it at any time."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Inner loops"})," — up to 16 named side loops per agent, each with its own goal and tools, sharing one file."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Compute containers"})," — run commands in a shared podman container, a container dedicated to one agent, or on the host if you allow it."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Desktop & browser"})," — a visible Linux desktop and a managed Chromium an agent can drive, and you can watch or take over."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"Channels"})," — connect agents to Telegram, Discord, Slack, WhatsApp, or email."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"ALF mesh"})," — agents message each other's inboxes over ALF (Agentic Lingua Franca) and find peers on the local network or across a tailnet."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-neutral-800 dark:text-neutral-100",children:"HTTP serving"})," — an agent can serve a site, files, or API routes, and hold WebSocket connections."]})]})]}),e.jsx("section",{children:e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:"ADF is an early public release. The format and APIs may change as the spec, runtime, and Studio evolve in the open."})}),e.jsx("section",{className:"pt-3 border-t border-neutral-200 dark:border-neutral-800",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["Created by"," ",e.jsx("span",{className:"font-medium text-neutral-700 dark:text-neutral-200",children:"Christian Balevski"}),"."]}),e.jsxs($,{onClick:()=>Vr(Hr),variant:"ghost",size:"compact",children:[e.jsx("span",{children:"github.com/christianbalevski/adf"}),e.jsx("span",{"aria-hidden":!0,children:"↗"})]})]})})]})}const qc=["standard","sandboxed","full-access"],zc="An agent uses its own provider, else its template's, else the server default.",Uc="New agents get everything in a template except its identity and history.",Hc=400,Vc=[{key:"readme",path:"README.md",rows:6},{key:"mind",path:"mind.md",rows:10},{key:"soul",path:"soul.md",rows:8}],pr=/^[A-Za-z0-9 _-]+$/,za="Use letters, digits, dashes, underscores and spaces.";function Zc(a){const t=qc.map(r=>a.find(n=>n.shipped===r)).filter(r=>!!r),s=a.filter(r=>!r.shipped).sort((r,n)=>r.name.localeCompare(n.name));return[...t,...s]}function Wc(a){return`${a.replace(/[^A-Za-z0-9 _-]/g,"").trim()||"template"} copy`}function Gc(a){return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(a<10*1024?1:0)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function $t({tone:a="neutral",children:t}){const s={neutral:"border-[var(--adf-ui-border)] text-[var(--adf-ui-text-muted)]",accent:"border-[var(--adf-ui-accent)]/40 bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)]",warning:"border-[var(--adf-ui-warning)]/40 bg-[var(--adf-ui-warning-subtle)] text-[var(--adf-ui-warning)]"};return e.jsx("span",{className:`inline-flex shrink-0 items-center rounded-full border px-1.5 py-px text-[11px] font-medium ${s[a]}`,children:t})}function Yc(){return e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0","aria-hidden":"true",children:[e.jsx("path",{d:"M12 4 2.5 20h19L12 4z"}),e.jsx("path",{d:"M12 10v4M12 17.2v.01"})]})}function mr({name:a,icon:t}){return e.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] text-[13px]",children:t||(a||"?").charAt(0).toUpperCase()})}function Qc({providers:a,defaultProviderId:t,onOpenProviders:s}){const r=nt(),n=ps(),{templates:i,folder:l,defaultId:c,migrated:d,loaded:h}=si(n),f=o.useMemo(()=>Zc(i),[i]),[b,C]=o.useState(null),[_,E]=o.useState(null),[x,D]=o.useState(null),[k,q]=o.useState(!1),[U,L]=o.useState(null),[W,A]=o.useState(null),[V,ie]=o.useState(!1),[w,X]=o.useState(!1),[I,R]=o.useState(null),[K,J]=o.useState(null),[ae,se]=o.useState(null),[Y,z]=o.useState(null),[re,he]=o.useState(null),[H,ne]=o.useState({description:"",warning:""}),[xe,g]=o.useState(null),T=o.useRef(H),ee=o.useRef(null),[j,me]=o.useState(""),{commit:G,track:fe}=Pt(),Ee=o.useCallback(y=>{fe(Promise.resolve(y?{ok:!1,error:y}:{ok:!0}))},[fe]),[ge,Ie]=Wt();o.useEffect(()=>{let y=!1;return r.getSettings().then(P=>{y||me(P?.childTemplateId??"")}).catch(()=>{}),()=>{y=!0}},[]);const Ge=y=>{const P=j;me(y),G({childTemplateId:y},()=>me(P))},$e=o.useRef(new Map),ye=o.useRef(!1),De=o.useRef(0),[Be,u]=o.useState("idle"),S=o.useCallback(()=>{$e.current.size===0&&De.current===0&&u("saved")},[]),O=o.useCallback(()=>{const y=[...$e.current.values()];$e.current.clear();for(const P of y)clearTimeout(P.timer),P.run()},[]),pe=o.useCallback((y,P)=>{const be=$e.current.get(y);be&&clearTimeout(be.timer);const Qe=setTimeout(()=>{$e.current.delete(y),P()},Hc);$e.current.set(y,{timer:Qe,run:P}),u("saving")},[]);o.useEffect(()=>()=>{O()},[O]);const ue=o.useRef(null);ue.current=b;const Oe=o.useCallback(async y=>{try{const P=await r.getTemplateContents(y);if(ue.current!==y)return;P?.success&&P.contents?(E(P.contents),D(null)):D(P?.error||"This template could not be read.")}catch(P){ue.current===y&&D(P instanceof Error?P.message:"This template could not be read.")}},[]),we=o.useCallback(async(y,P)=>{De.current++;try{const be=await P();if(!be?.success){L(be?.error||"The template could not be saved."),Ee(be?.error||"The template could not be saved.");return}L(null),Ee(null)}catch(be){L(be instanceof Error?be.message:"The template could not be saved."),Ee(be instanceof Error?be.message:"The template could not be saved.");return}finally{De.current--,S()}$e.current.size===0&&ue.current===y&&(ye.current=!1,await Oe(y))},[Oe,S,Ee]),Pe=o.useCallback(y=>{O(),ye.current=!1,L(null),D(null),u("idle"),C(y),ue.current=y,E(null),y&&(q(!0),r.getTemplateContents(y).then(P=>{ue.current===y&&(P?.success&&P.contents?E(P.contents):D(P?.error||"This template could not be read."))}).catch(P=>{ue.current===y&&D(P instanceof Error?P.message:"This template could not be read.")}).finally(()=>{ue.current===y&&q(!1)}))},[O]);o.useEffect(()=>{!h||!b||i.some(y=>y.id===b)||(C(null),E(null))},[i,h,b]),o.useEffect(()=>r.onTemplatesChanged(()=>{const P=ue.current;!P||ye.current||$e.current.size>0||Oe(P)}),[Oe]);const Fe=(y,P,be,Qe)=>{ye.current=!0,E(ot=>ot&&{...ot,files:{...ot.files,[P]:Qe}}),pe(`file:${be}`,()=>{we(y,()=>r.setTemplateFile({id:y,path:be,content:Qe}))})},v=(y,P)=>{const be={...T.current,...P};T.current=be,ne(be),pe("meta",()=>{(async()=>{De.current++;try{const Qe=await r.setTemplateMeta({id:y,description:be.description,warning:be.warning}),ot=Qe?.success?null:Qe?.error||"The notes could not be saved.";g(ot),Ee(ot)}catch(Qe){const ot=Qe instanceof Error?Qe.message:"The notes could not be saved.";g(ot),Ee(ot)}finally{De.current--,S()}})()})},oe=(y,P)=>{ye.current=!0,E(be=>be&&{...be,config:P}),pe("config",()=>{we(y,()=>r.setTemplateConfig({id:y,config:P}))})},He=async y=>{X(!0);try{const P=await r.addTemplateFiles(y);P.success?(L(null),await Oe(y)):P.error&&P.error!=="Cancelled"&&L(P.error)}finally{X(!1)}},Ke=async(y,P)=>{await Ie({title:"Remove file",body:`${P} is removed from this template. New agents no longer get it.`,confirmLabel:"Remove",danger:!0})&&(await we(y,()=>r.removeTemplateFile({id:y,path:P})),await Oe(y))},Me=o.useCallback(()=>ri.getState().refresh(n),[n]),tt=o.useCallback(async y=>{A(null),ie(!0);try{const P=await y();return P&&P.success===!1?(A(P.error||"That did not work."),!1):(await Me(),!0)}catch(P){return A(P instanceof Error?P.message:"That did not work."),!1}finally{ie(!1)}},[Me]),at=async(y,P)=>{A(null),ie(!0);try{const be=await r.createTemplate({name:y,fromId:P});if(!be.success){A(be.error||"The template could not be created.");return}J(null),se(null),await Me(),be.id&&Pe(be.id)}catch(be){A(be instanceof Error?be.message:"The template could not be created.")}finally{ie(!1)}},xt=()=>{const y=(K??"").trim();if(!y){se("Give the template a name.");return}if(!pr.test(y)){se(za);return}at(y)},N=async y=>{A(null);try{const P=await r.checkTemplateReview(y.id);P.needsReview&&P.configSummary?Ye.getState().openTemplateReview(y.id,P.configSummary,()=>{Me()},n):await Me()}catch(P){A(P instanceof Error?P.message:"This template could not be read.")}},Z=async()=>{if(!Y)return;const y=Y.name.trim();if(!y){he("Give the template a name.");return}if(!pr.test(y)){he(za);return}if(y===Y.was){z(null);return}he(null),O(),ie(!0);try{const P=await r.renameTemplate({id:Y.id,name:y});if(!P.success){he(P.error||"The template could not be renamed.");return}z(null),await Me(),P.id&&Pe(P.id)}catch(P){he(P instanceof Error?P.message:"The template could not be renamed.")}finally{ie(!1)}},ve=y=>{const P=[{label:"Rename…",onSelect:()=>{he(null),z({id:y.id,name:y.name,was:y.name})}},{label:"Make default",disabled:y.id===c,onSelect:()=>{tt(()=>r.setDefaultTemplate(y.id))}},{label:"Duplicate",onSelect:()=>{at(Wc(y.name),y.id)}},{label:"Reveal in Finder",onSelect:()=>{r.revealTemplate(y.id)}}];if(y.shipped){const be=y.shipped;P.push({label:"Reset to shipped",separatorBefore:!0,onSelect:()=>{Ie({title:"Reset template",body:`"${y.name}" goes back to the version Studio ships. Your changes to it are lost.`,confirmLabel:"Reset",danger:!0}).then(Qe=>{Qe&&tt(()=>r.resetShippedTemplate(be))})}})}return P.push({label:"Delete",danger:!0,separatorBefore:!y.shipped,onSelect:()=>{Ie({title:"Delete template",body:`"${y.name}" goes to the trash.`,confirmLabel:"Delete",danger:!0}).then(be=>{be&&tt(()=>r.deleteTemplate(y.id))})}}),P},p=async()=>{await r.templatesMigrationSeen(),await Me()},F=b?f.find(y=>y.id===b)??null:null,Ce=o.useRef(null);o.useEffect(()=>{b&&Ce.current?.scrollIntoView({block:"start"})},[b]),o.useEffect(()=>{const y=F?.id??null;if(ee.current===y)return;ee.current=y;const P={description:F?.templateDescription??"",warning:F?.warning??""};T.current=P,ne(P),g(null)},[F]);const it=e.jsxs(e.Fragment,{children:[ge,e.jsx(_r,{position:I?{x:I.x,y:I.y}:null,items:I?ve(I.template):[],onClose:()=>R(null)}),e.jsx(gt,{open:!!Y,onClose:()=>{z(null),he(null)},title:"Rename template",lightDismiss:!1,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(ze,{"aria-label":"Template name",autoFocus:!0,spellCheck:!1,placeholder:"Template name",value:Y?.name??"",onChange:y=>{const P=y.target.value;z(be=>be&&{...be,name:P}),he(null)},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),Z())}}),e.jsxs("p",{className:"text-[11px] leading-5 text-[var(--adf-ui-text-subtle)]",children:[za," This renames the file and the agent name inside it."]}),re&&e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-danger)]",role:"alert",children:re}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx($,{onClick:()=>{z(null),he(null)},variant:"ghost",size:"compact",disabled:V,children:"Cancel"}),e.jsx($,{onClick:()=>{Z()},variant:"primary",size:"compact",disabled:V,children:"Rename"})]})]})})]}),Ot=y=>e.jsx(pt,{"aria-label":`Actions for ${y.name}`,title:"Actions",disabled:V,onClick:P=>{const be=P.currentTarget.getBoundingClientRect();R({x:be.left,y:be.bottom+2,template:y})},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"5",r:"1.6"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),e.jsx("circle",{cx:"12",cy:"19",r:"1.6"})]})});if(F){const y=U??xe;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:Ce,className:"flex flex-col gap-3",children:[e.jsx("button",{type:"button",onClick:()=>Pe(null),className:"self-start rounded-[var(--adf-ui-control-radius)] text-[12px] text-[var(--adf-ui-text-muted)] outline-none hover:text-[var(--adf-ui-text)] focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",children:"← Templates"}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(mr,{name:F.name,icon:F.icon}),e.jsx("h2",{className:"min-w-0 truncate text-[15px] font-semibold text-[var(--adf-ui-text)]",children:F.name}),F.shipped&&e.jsx($t,{children:"Shipped"}),F.id===c&&e.jsx($t,{tone:"accent",children:"Default"}),!F.reviewed&&e.jsx($t,{tone:"warning",children:"Not reviewed"}),e.jsx("span",{className:"flex-1"}),e.jsx("span",{className:`min-w-0 truncate text-[11px] ${y?"text-[var(--adf-ui-danger)]":"shrink-0 text-[var(--adf-ui-text-subtle)]"}`,role:y?"alert":"status",title:y??"Edits save to the template file as you type.",children:y?`Not saved: ${y}`:Be==="saving"?"Saving…":"Edits save as you type"}),!F.reviewed&&e.jsx($,{onClick:()=>{N(F)},size:"compact",className:"shrink-0",children:"Review"}),Ot(F)]}),W&&e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-danger)]",role:"alert",children:W})]}),e.jsxs(Re,{title:`Files in ${F.name}`,description:"Starting content for a new agent's files.",children:[k&&!_&&e.jsx("p",{className:"px-4 pb-3 text-[12px] text-[var(--adf-ui-text-subtle)]",children:"Loading…"}),x&&e.jsx("p",{className:"px-4 pb-3 text-[12px] text-[var(--adf-ui-danger)]",role:"alert",children:x}),_&&e.jsxs(e.Fragment,{children:[Vc.map((P,be)=>e.jsx(ce,{label:P.path,description:"Starting content.",stacked:!0,separator:be>0,children:e.jsx(ms,{"aria-label":P.path,value:_.files[P.key]??"",onChange:Qe=>Fe(F.id,P.key,P.path,Qe.target.value),rows:P.rows,className:"font-mono text-xs resize-y"})},P.key)),e.jsxs(ce,{label:"Extra files",description:"Copied into every new agent.",stacked:!0,separator:!0,error:U,children:[_.extra.length>0&&e.jsx("ul",{className:"flex flex-col gap-1.5",children:_.extra.map(P=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-[var(--adf-ui-text)]",children:P.path}),e.jsx("span",{className:"w-16 shrink-0 text-right text-[11px] tabular-nums text-[var(--adf-ui-text-subtle)]",children:Gc(P.size)}),e.jsx($,{onClick:()=>{Ke(F.id,P.path)},variant:"ghost",size:"compact","aria-label":`Remove ${P.path}`,title:"Remove",className:"shrink-0 px-2",children:"×"})]},P.path))}),e.jsx("div",{className:_.extra.length>0?"mt-2":"",children:e.jsx($,{onClick:()=>{He(F.id)},variant:"ghost",size:"compact",disabled:w,children:w?"Adding…":"Add files…"})})]})]})]}),e.jsxs(Re,{title:"Template notes",description:"Shown wherever this template is offered. Neither line is copied into agents made from it.",children:[e.jsx(ce,{label:"Description",stacked:!0,children:e.jsx(ze,{"aria-label":"Template description",spellCheck:!1,placeholder:"What this template is for. Shown in the list and the composer chip.",value:H.description,onChange:P=>v(F.id,{description:P.target.value})})}),e.jsx(ce,{label:"Warning",stacked:!0,separator:!0,error:xe,children:e.jsx(ze,{"aria-label":"Template warning",spellCheck:!1,placeholder:"A caution shown in amber wherever this template is offered.",value:H.warning,onChange:P=>v(F.id,{warning:P.target.value})})})]}),_&&e.jsx(ni,{template:{value:_.config,onChange:P=>oe(F.id,P)}},F.id),it]})}return e.jsxs(e.Fragment,{children:[d&&e.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-[var(--adf-ui-container-radius)] border border-hairline bg-[var(--adf-ui-surface)] px-4 py-3",children:[e.jsxs("p",{className:"text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:["Your previous template was saved as ",i.find(y=>y.id===d.id)?.name??d.id,"."]}),e.jsx($,{onClick:()=>{p()},variant:"ghost",size:"compact",className:"shrink-0",children:"Dismiss"})]}),e.jsxs(Re,{title:"Templates",description:"Every agent you create starts from one of these. Open one to edit it.",children:[h?f.length===0?e.jsx("p",{className:"px-4 pb-3 text-[12px] text-[var(--adf-ui-text-subtle)]",children:"No templates in the folder."}):e.jsx("ul",{children:f.map(y=>e.jsxs("li",{className:"flex items-center gap-2 border-t border-[var(--adf-ui-separator)] px-4 py-2.5 hover:bg-[var(--adf-ui-surface-hover)]",children:[e.jsxs("button",{type:"button",onClick:()=>Pe(y.id),title:y.filePath,className:"flex min-w-0 flex-1 items-center gap-2.5 rounded-[var(--adf-ui-control-radius)] text-left outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",children:[e.jsx(mr,{name:y.name,icon:y.icon}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-[var(--adf-ui-text)]",children:y.name}),y.shipped&&e.jsx($t,{children:"Shipped"}),y.id===c&&e.jsx($t,{tone:"accent",children:"Default"}),!y.reviewed&&e.jsx($t,{tone:"warning",children:"Not reviewed"})]}),(y.templateDescription??y.description)&&e.jsx("span",{className:"mt-0.5 block truncate text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:y.templateDescription??y.description}),y.warning&&e.jsxs("span",{className:"mt-0.5 flex items-center gap-1 text-[12px] leading-5 text-[var(--adf-ui-warning)]",children:[e.jsx(Yc,{}),e.jsx("span",{className:"min-w-0 truncate",children:y.warning})]})]}),e.jsx("span",{"aria-hidden":"true",className:"shrink-0 text-[14px] text-[var(--adf-ui-text-subtle)]",children:"›"})]}),y.hasHistory&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--adf-ui-text-subtle)]",title:"This file has run. New agents start with no history either way.",children:"Has run"}),!y.reviewed&&e.jsx($,{onClick:()=>{N(y)},size:"compact",className:"shrink-0",children:"Review"}),Ot(y)]},y.id))}):e.jsx("p",{className:"px-4 pb-3 text-[12px] text-[var(--adf-ui-text-subtle)]",children:"Loading templates…"}),e.jsxs("div",{className:"border-t border-[var(--adf-ui-separator)] px-4 py-3",children:[K===null?e.jsx($,{onClick:()=>{J(""),se(null)},variant:"ghost",size:"compact",disabled:V,children:"New template…"}):e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("input",{"aria-label":"Template name",value:K,autoFocus:!0,spellCheck:!1,placeholder:"Template name",onChange:y=>{J(y.target.value),se(null)},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),xt()),y.key==="Escape"&&(y.preventDefault(),J(null),se(null))},className:"h-[var(--adf-ui-control-height-compact)] w-56 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-raised)] px-2.5 text-[12px] text-[var(--adf-ui-text)] outline-none focus:border-[var(--adf-ui-accent)] focus:ring-2 focus:ring-[var(--adf-ui-focus)]"}),e.jsx($,{onClick:xt,size:"compact",variant:"primary",disabled:V,children:"Create"}),e.jsx($,{onClick:()=>{J(null),se(null)},size:"compact",variant:"ghost",disabled:V,children:"Cancel"})]}),ae&&e.jsx("p",{className:"mt-1.5 text-[11px] text-[var(--adf-ui-danger)]",children:ae}),W&&e.jsx("p",{className:"mt-1.5 text-[11px] text-[var(--adf-ui-danger)]",role:"alert",children:W}),e.jsx("p",{className:"mt-2 text-[11px] leading-5 text-[var(--adf-ui-text-subtle)]",children:Uc}),l&&e.jsxs("p",{className:"mt-0.5 break-all text-[11px] leading-5 text-[var(--adf-ui-text-subtle)]",children:["Templates folder: ",l]})]})]}),e.jsx(Re,{title:"Applies to",description:"Agents you create in Studio always start from a template.",children:e.jsx(ce,{label:"Template for agents created by agents",description:"Agents made with sys_create_adf start from this template, without its credentials or identity. A parent that names a template .adf of its own uses that instead.",children:e.jsxs(na,{"aria-label":"Template for agents created by agents",className:"w-64",value:j,onChange:y=>Ge(y.target.value),children:[e.jsx("option",{value:"",children:"None (code defaults)"}),f.map(y=>e.jsx("option",{value:y.id,children:y.name},y.id)),j&&!f.some(y=>y.id===j)&&e.jsxs("option",{value:j,children:[j," (not in the folder)"]})]})})}),e.jsx(Re,{title:"Provider",description:zc,children:e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Server default",e.jsx(We,{tip:"A template whose Provider is Server default gives new agents this provider, with its default model as Model ID. To set it, use Make default in Settings → Providers."})]}),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:a.length===0?"None set up":(a.find(y=>y.id===t)??a[0]).name||"Unnamed"}),e.jsx($,{onClick:s,size:"compact",children:"Providers"})]})})}),it]})}const _a=[{fill:"fill-[#2a78d6] dark:fill-[#3987e5]",bg:"bg-[#2a78d6] dark:bg-[#3987e5]"},{fill:"fill-[#eb6834] dark:fill-[#d95926]",bg:"bg-[#eb6834] dark:bg-[#d95926]"},{fill:"fill-[#1baf7a] dark:fill-[#199e70]",bg:"bg-[#1baf7a] dark:bg-[#199e70]"},{fill:"fill-[#eda100] dark:fill-[#c98500]",bg:"bg-[#eda100] dark:bg-[#c98500]"},{fill:"fill-[#e87ba4] dark:fill-[#d55181]",bg:"bg-[#e87ba4] dark:bg-[#d55181]"},{fill:"fill-[#008300] dark:fill-[#008300]",bg:"bg-[#008300] dark:bg-[#008300]"},{fill:"fill-[#4a3aa7] dark:fill-[#9085e9]",bg:"bg-[#4a3aa7] dark:bg-[#9085e9]"},{fill:"fill-[#8b8b93] dark:fill-[#83838c]",bg:"bg-[#8b8b93] dark:bg-[#83838c]"}],Ua=_a.length-1;function Jc(a){return a===0?"$0":`$${a>=1?a.toFixed(2):Number(a.toPrecision(2)).toString()}`}function Xc(a){if(a<=0)return 1;const t=Math.floor(Math.log10(a)),s=Math.pow(10,t),r=a/s;return(r<=1?1:r<=2?2:r<=2.5?2.5:r<=5?5:10)*s}function ed(a){const[t,s,r]=a.split("-").map(Number);return new Date(t,s-1,r).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function td(a){const[t,s,r]=a.split("-").map(Number);return new Date(t,s-1,r).toLocaleDateString(void 0,{weekday:"short",year:"numeric",month:"short",day:"numeric"})}const st={top:8,right:8,bottom:20,left:44},Ha=3,ad=24,sd=2,rd=2;function nd({days:a,series:t,values:s,metric:r,tickEvery:n,height:i=180}){const l=o.useRef(null),[c,d]=o.useState(0),[h,f]=o.useState(null);o.useEffect(()=>{const I=l.current;if(!I)return;d(I.getBoundingClientRect().width);const R=new ResizeObserver(K=>{for(const J of K)d(J.contentRect.width)});return R.observe(I),()=>R.disconnect()},[]);const b=r==="cost"?Jc:Ft,C=r==="cost"?Nt:I=>I.toLocaleString(),_=s.map(I=>I.reduce((R,K)=>R+K,0)),E=_.reduce((I,R)=>Math.max(I,R),0),x=Xc(E/Ha),D=x*Ha,k=Math.max(0,c-st.left-st.right),q=i-st.top-st.bottom,U=st.top+q,L=a.length,W=L>0?k/L:0,A=Math.max(1,Math.min(ad,W-rd)),V=I=>U-(D>0?I/D*q:0),ie=h!=null?{day:a[h],row:s[h],total:_[h]}:null,w=h!=null?st.left+(h+.5)*W:0,X=w>c/2;return e.jsxs("div",{ref:l,className:"relative w-full select-none",children:[c>0&&e.jsxs("svg",{width:c,height:i,className:"block overflow-visible",role:"img","aria-label":`Daily ${r==="cost"?"cost":"token usage"} by model`,children:[Array.from({length:Ha},(I,R)=>{const K=x*(R+1),J=V(K);return e.jsxs("g",{children:[e.jsx("line",{x1:st.left,x2:st.left+k,y1:J,y2:J,className:"stroke-[var(--adf-ui-separator)]",strokeWidth:1,shapeRendering:"crispEdges"}),E>0&&e.jsx("text",{x:st.left-6,y:J,textAnchor:"end",dominantBaseline:"middle",className:"fill-[var(--adf-ui-text-subtle)] text-[10px] tabular-nums",children:b(K)})]},R)}),e.jsx("line",{x1:st.left,x2:st.left+k,y1:U,y2:U,className:"stroke-[var(--adf-ui-separator)]",strokeWidth:1,shapeRendering:"crispEdges"}),a.map((I,R)=>{const K=st.left+(R+.5)*W,J=K-A/2,ae=s[R];let se=0;const Y=[];ae.forEach((re,he)=>{if(re<=0)return;const H=V(se),ne=V(se+re);se+=re,Y.push({si:he,y0:H,y1:ne})});const z=h===R;return e.jsxs("g",{children:[z&&e.jsx("rect",{x:st.left+R*W,y:st.top,width:W,height:q,className:"fill-[var(--adf-ui-surface-hover)]"}),Y.map((re,he)=>{const H=he===Y.length-1,ne=re.y0-(he>0?sd:0),xe=ne-re.y1;if(xe<1)return null;const g=_a[t[re.si].color].fill;if(!H)return e.jsx("rect",{x:J,y:re.y1,width:A,height:xe,className:g},re.si);const T=Math.min(4,A/2,xe),ee=`M${J},${re.y1+T} a${T},${T} 0 0 1 ${T},-${T} h${A-2*T} a${T},${T} 0 0 1 ${T},${T} V${ne} H${J} Z`;return e.jsx("path",{d:ee,className:g},re.si)}),e.jsx("rect",{x:st.left+R*W,y:st.top,width:Math.max(W,1),height:q,fill:"transparent",onMouseEnter:()=>f(R),onMouseLeave:()=>f(re=>re===R?null:re)}),R%n===0&&e.jsx("text",{x:K,y:i-6,textAnchor:R===0&&W<40?"start":"middle",className:"fill-[var(--adf-ui-text-subtle)] text-[10px]",children:ed(I)})]},I)})]}),ie&&e.jsxs("div",{className:"pointer-events-none absolute top-0 z-10 min-w-40 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-surface-raised)] px-2.5 py-2 text-[11px] shadow-md ring-1 ring-inset ring-[var(--adf-ui-separator)]",style:{left:w,transform:X?"translateX(calc(-100% - 8px))":"translateX(8px)"},children:[e.jsx("div",{className:"mb-1 font-medium text-[var(--adf-ui-text)]",children:td(ie.day)}),ie.total===0?e.jsx("div",{className:"text-[var(--adf-ui-text-subtle)]",children:"No usage"}):e.jsxs(e.Fragment,{children:[t.map((I,R)=>{const K=ie.row[R];return K<=0?null:e.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[e.jsx("span",{className:`h-0.5 w-3 shrink-0 rounded-full ${_a[I.color].bg}`}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[var(--adf-ui-text-muted)]",children:I.label}),e.jsx("span",{className:"tabular-nums text-[var(--adf-ui-text)]",children:C(K)})]},I.key)}),e.jsxs("div",{className:"mt-1 flex items-center justify-between gap-3 border-t border-[var(--adf-ui-separator)] pt-1 text-[var(--adf-ui-text-muted)]",children:[e.jsx("span",{children:"Total"}),e.jsx("span",{className:"tabular-nums font-medium text-[var(--adf-ui-text)]",children:C(ie.total)})]})]})]})]})}function id(a=new Date){const t=a.getFullYear(),s=String(a.getMonth()+1).padStart(2,"0"),r=String(a.getDate()).padStart(2,"0");return`${t}-${s}-${r}`}function os(a){let t=!1,s=0;for(const r of a)r.cost_usd!=null&&(t=!0,s+=r.cost_usd);return t?s:null}const od=[{value:"7",label:"7d"},{value:"30",label:"30d"},{value:"90",label:"90d"}],ld={7:1,30:5,90:15},cd="__other__";function dd(a){const t=[],s=new Date;for(let r=a-1;r>=0;r--){const n=new Date(s.getFullYear(),s.getMonth(),s.getDate()-r);t.push(id(n))}return t}function fr(a){return a.input+a.output}function xr(a){const t={input:0,output:0,cacheRead:0,cacheWrite:0,cost:null};for(const s of a)t.input+=s.input,t.output+=s.output,t.cacheRead+=s.cache_read??0,t.cacheWrite+=s.cache_write??0;return t.cost=os(a),t}function ud({t:a}){return e.jsxs(e.Fragment,{children:[Ft(a.input+a.output)," tokens",a.cost!=null&&e.jsxs(e.Fragment,{children:[" · ",Nt(a.cost)]})]})}function hd({t:a,windowDays:t}){const s=[{label:"Input",value:a.input.toLocaleString()},{label:"Output",value:a.output.toLocaleString()}];return a.cacheRead>0&&s.push({label:"Cache read (of input)",value:a.cacheRead.toLocaleString()}),a.cacheWrite>0&&s.push({label:"Cache write (of input)",value:a.cacheWrite.toLocaleString()}),a.cost!=null&&s.push({label:"Cost",value:Nt(a.cost)}),e.jsxs("div",{className:"mb-3",children:[e.jsxs("div",{className:"mb-1 text-xs font-semibold text-[var(--adf-ui-text)]",children:["Last ",t," days"]}),e.jsx("dl",{className:"flex flex-wrap gap-x-6 gap-y-1 text-xs",children:s.map(r=>e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("dt",{className:"text-[var(--adf-ui-text-subtle)]",children:r.label}),e.jsx("dd",{className:"font-medium tabular-nums text-[var(--adf-ui-text)]",children:r.value})]},r.label))})]})}function pd(){const a=nt(),[t,s]=o.useState({}),[r,n]=o.useState("30"),[i,l]=o.useState("tokens"),[c,d]=o.useState(!1),[h,f]=Wt();o.useEffect(()=>{a?.getTokenUsage().then(R=>{s(R)})},[]);const b=async()=>{await f({title:"Clear usage",body:"Every token count is deleted. This cannot be undone; Download JSON keeps a copy.",confirmLabel:"Clear usage",danger:!0})&&(await a?.clearTokenUsage(),s({}))},C=async()=>{await a?.saveTokenUsageExport?.(JSON.stringify(t,null,2))},_=o.useMemo(()=>Object.keys(t).sort(),[t]),E=o.useMemo(()=>_.flatMap(R=>Object.values(t[R]).flatMap(K=>Object.values(K))),[_,t]),x=o.useMemo(()=>xr(E),[E]),D=x.cost!=null,k=o.useMemo(()=>{const R=new Map,K=new Map;for(const z of _)for(const[re,he]of Object.entries(t[z]))for(const[H,ne]of Object.entries(he)){const xe=`${re}/${H}`;R.set(xe,(R.get(xe)??0)+fr(ne)),K.has(H)||K.set(H,new Set),K.get(H).add(re)}const J=[...R.entries()].sort((z,re)=>re[1]-z[1]).map(([z])=>z),ae=J.slice(0,Ua).map((z,re)=>{const he=z.indexOf("/"),H=z.slice(0,he),ne=z.slice(he+1),xe=(K.get(ne)?.size??1)===1;return{key:z,label:xe?ne:`${H}/${ne}`,color:re}}),se=J.slice(Ua),Y=new Map;return ae.forEach((z,re)=>Y.set(z.key,re)),se.length>0&&(ae.push({key:cd,label:`Other (${se.length})`,color:Ua}),se.forEach(z=>Y.set(z,ae.length-1))),{series:ae,keyToIdx:Y}},[_,t]),q=o.useMemo(()=>dd(Number(r)),[r]),U=o.useMemo(()=>new Set(q),[q]),L=o.useMemo(()=>q.filter(R=>t[R]).flatMap(R=>Object.values(t[R]).flatMap(K=>Object.values(K))),[q,t]),W=o.useMemo(()=>xr(L),[L]),{series:A,values:V,seriesTotals:ie,unpricedModels:w}=o.useMemo(()=>{const R=k.series,K=q.map(()=>R.map(()=>0)),J=new Set;q.forEach((Y,z)=>{const re=t[Y];if(re)for(const[he,H]of Object.entries(re))for(const[ne,xe]of Object.entries(H)){const g=`${he}/${ne}`,T=k.keyToIdx.get(g);T!=null&&(i==="cost"?xe.cost_usd==null?J.add(g):K[z][T]+=xe.cost_usd:K[z][T]+=fr(xe))}});const ae=R.map((Y,z)=>K.reduce((re,he)=>re+he[z],0)),se=R.map((Y,z)=>ae[z]>0);return{series:R.filter((Y,z)=>se[z]),values:K.map(Y=>Y.filter((z,re)=>se[re])),seriesTotals:ae.filter((Y,z)=>se[z]),unpricedModels:J.size}},[q,t,k,i]),X=i==="cost"?Nt:Ft,I=o.useMemo(()=>_.filter(R=>U.has(R)).reverse(),[_,U]);return e.jsxs("div",{children:[h,e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[e.jsx("label",{className:"block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Token Usage"}),_.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[D&&e.jsx(Mt,{value:i,onChange:l,ariaLabel:"Chart metric",options:[{value:"tokens",label:"Tokens"},{value:"cost",label:"Cost"}]}),e.jsx(Mt,{value:r,onChange:n,ariaLabel:"Time window",options:od})]})]}),_.length===0?e.jsx("p",{className:"text-xs text-[var(--adf-ui-text-subtle)]",children:"No token usage recorded yet."}):e.jsxs("div",{className:"rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-canvas)] p-3 ring-1 ring-inset ring-[var(--adf-ui-separator)]",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--adf-ui-text-muted)]",children:[e.jsxs("strong",{children:["Last ",r," days:"]})," ",e.jsx(ud,{t:W}),e.jsxs("span",{className:"ml-2 text-[var(--adf-ui-text-subtle)]",children:["All time ",Ft(x.input+x.output)," tokens",x.cost!=null&&e.jsxs(e.Fragment,{children:[" · ",Nt(x.cost)]})]})]}),e.jsx(nd,{days:q,series:A,values:V,metric:i,tickEvery:ld[r]}),i==="cost"&&w>0&&e.jsxs("p",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-subtle)]",children:[w," ",w===1?"model":"models"," without pricing excluded from the cost chart."]}),A.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 text-[11px]",children:A.map((R,K)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${_a[R.color].bg}`}),e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:R.label}),e.jsx("span",{className:"tabular-nums text-[var(--adf-ui-text-subtle)]",children:X(ie[K])})]},R.key))}),e.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t border-[var(--adf-ui-separator)] pt-2",children:[e.jsx($,{variant:"ghost",size:"compact",onClick:()=>d(!c),"aria-expanded":c,children:c?"Hide breakdown":"Show breakdown"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($,{variant:"ghost",size:"compact",onClick:C,children:"Download JSON"}),e.jsx($,{variant:"ghost",size:"compact",onClick:b,className:"text-[var(--adf-ui-text-subtle)] hover:text-[var(--adf-ui-danger)]",children:"Clear history…"})]})]}),c&&(I.length===0?e.jsxs("p",{className:"mt-2 text-xs text-[var(--adf-ui-text-subtle)]",children:["No usage in the last ",r," days."]}):e.jsxs("div",{className:"mt-2 space-y-3",children:[e.jsx("div",{className:"border-t border-[var(--adf-ui-separator)] pt-2",children:e.jsx(hd,{t:W,windowDays:r})}),I.map(R=>{const K=os(Object.values(t[R]).flatMap(J=>Object.values(J)));return e.jsxs("div",{className:"border-t border-[var(--adf-ui-separator)] pt-2",children:[e.jsxs("div",{className:"mb-1 text-xs font-semibold text-[var(--adf-ui-text)]",children:[R,K!=null&&e.jsx("span",{className:"ml-2 font-normal text-[var(--adf-ui-text-muted)]",children:Nt(K)})]}),Object.entries(t[R]).map(([J,ae])=>{const se=os(Object.values(ae));return e.jsxs("div",{className:"ml-3 space-y-1",children:[e.jsxs("div",{className:"text-xs font-medium text-[var(--adf-ui-text-muted)]",children:[J,se!=null&&e.jsx("span",{className:"ml-2 font-normal text-[var(--adf-ui-text-subtle)]",children:Nt(se)})]}),Object.entries(ae).map(([Y,z])=>e.jsxs("div",{className:"ml-3 font-mono text-xs text-[var(--adf-ui-text-subtle)]",children:[Y,": ",z.input.toLocaleString()," in + ",z.output.toLocaleString()," out",z.cache_read||z.cache_write?e.jsxs(e.Fragment,{children:[" · in incl. cache ",Ft(z.cache_read??0)," read / ",Ft(z.cache_write??0)," write"]}):null,z.cost_usd!=null&&e.jsxs(e.Fragment,{children:[" · ",Nt(z.cost_usd)]})]},Y))]},J)})]},R)})]}))]})]})}function md(a){return a==="localhost"||a==="[::1]"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(a)}function fd(a){const t=/^(\d{1,3})\.(\d{1,3})\.\d{1,3}\.\d{1,3}$/.exec(a);if(t){const s=Number(t[2]);return Number(t[1])===100&&s>=64&&s<=127}return/^\[fd7a:115c:a1e0:/.test(a)}function xd(a){const t=a.trim();if(!t)return{kind:"invalid",url:null,reason:"Enter the daemon URL."};let s;try{s=new URL(t)}catch{return{kind:"invalid",url:null,reason:"This is not a URL. Example: https://adf.example.com"}}if(s.protocol!=="https:"&&s.protocol!=="http:")return{kind:"invalid",url:null,reason:"The URL must start with https:// or http://."};if(s.username||s.password)return{kind:"invalid",url:null,reason:"Put the token in the Token field, not in the URL."};if(s.search||s.hash)return{kind:"invalid",url:null,reason:"The URL must not contain ? or #."};const r=`${s.origin}${s.pathname.replace(/\/+$/,"")}`;if(s.protocol==="https:")return{kind:"https",url:r};const n=s.hostname.toLowerCase();return md(n)?{kind:"loopback",url:r}:fd(n)?{kind:"tailnet",url:r}:{kind:"insecure-http",url:r}}const Zr="Public network. The token is sent unencrypted.",gd="Public network. Anyone on it can reach the agents you share.";function vd(a){return a.remoteAccess&&a.mesh?"Remote access and agent sharing":a.mesh?"Agent sharing":"Remote access"}function bd(a,t){return`${vd(a)} paused on ${t}.`}function yd(a){return a.remoteAccess?Zr:gd}function jd(a,t){const s=a.networks.filter(i=>!i.allowed&&!!i.id),r=a.networks.filter(i=>!!i.id&&(i.allowed||s.includes(i))),n=a.allowedNetworks.filter(i=>!a.networks.some(l=>l.id===i.id));return{allow:s,labels:[...r.map(i=>i.label),...n.map(i=>i.label)],exposed:r.some(i=>i.kind==="lan"&&i.osCategory!=="private")}}function kd(a){return a.length<=1?a[0]??"":`${a.slice(0,-1).join(", ")} and ${a[a.length-1]}`}const wd={route_read:"It cannot read the route table.",no_gateway:"It cannot find the router address.",arp_read:"It cannot read the address table.",no_answer:"The router does not answer.",no_subnet:"It cannot find the subnet."};function gs(a,t="Studio"){const s=`${t} cannot identify this network.`;return a?`${s} ${wd[a.step]}`:s}function ua({id:a,title:t,icon:s,help:r,summary:n,docs:i,collapsible:l=!1,open:c=!0,children:d}){const h=e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[l&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",className:"shrink-0 text-[var(--adf-ui-text-subtle)] transition-transform group-open:rotate-90",children:e.jsx("path",{d:"m4.5 2.5 3.5 3.5-3.5 3.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),s&&e.jsx("span",{className:"shrink-0 text-[var(--adf-ui-text-muted)]",children:s}),e.jsx("h2",{className:"truncate text-[13px] font-semibold text-[var(--adf-ui-text)]",children:t}),n!=null&&e.jsx("span",{className:"ml-auto shrink-0 text-[12px] text-[var(--adf-ui-text-muted)]","data-section-summary":"",children:n}),i&&e.jsx("span",{className:n!=null?"shrink-0":"ml-auto shrink-0",children:e.jsx(ct,{href:i})})]}),f=r?e.jsx("p",{className:"px-4 pb-2.5 -mt-1 text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:r}):null,b="rounded-[var(--adf-ui-container-radius)] border border-hairline bg-[var(--adf-ui-surface)]";return l?e.jsx("section",{className:b,"data-section":a,children:e.jsxs("details",{className:"group",open:c,children:[e.jsx("summary",{className:"flex cursor-pointer select-none list-none items-center rounded-[var(--adf-ui-container-radius)] px-4 pt-3.5 pb-2.5 outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)] [&::-webkit-details-marker]:hidden",children:h}),f,d]})}):e.jsxs("section",{className:b,"data-section":a,children:[e.jsx("div",{className:"flex items-center px-4 pt-3.5 pb-2.5",children:h}),f,d]})}function ft({children:a,actions:t,separator:s=!0,className:r="",...n}){return e.jsxs("div",{...n,className:`flex items-center justify-between gap-4 px-4 py-3 ${s?"border-t border-[var(--adf-ui-separator)]":""} ${r}`,children:[e.jsx("div",{className:"min-w-0 flex-1 text-[12px]",children:a}),t&&e.jsx("div",{className:"flex shrink-0 items-center gap-1.5",children:t})]})}function vs({tone:a,children:t}){const s=a==="ok"?"bg-[var(--adf-ui-success)]":a==="busy"?"bg-[var(--adf-ui-warning)]":a==="down"?"bg-[var(--adf-ui-danger)]":"bg-[var(--adf-ui-border)]",r=a==="down"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-muted)]";return e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-[12px] font-normal ${r}`,"data-state":a,children:[e.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${s}`}),t]})}function gr({lines:a,label:t="Details"}){return a.length===0?null:e.jsxs("details",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-subtle)]",children:[e.jsx("summary",{className:"cursor-pointer select-none hover:text-[var(--adf-ui-text-muted)]",children:t}),e.jsx("dl",{className:"mt-1.5 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-0.5 break-all",children:a.map(s=>{const r=s.indexOf(": ");return r>0?e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:s.slice(0,r)}),e.jsx("dd",{children:s.slice(r+2)})]},s):e.jsx("div",{className:"col-span-2",children:s},s)})})]})}function ls(a){if(!a.enabled)return"Off.";if(a.state==="on"){const t=a.addresses.filter(s=>s.listening).map(s=>s.address);return t.length>0?`Listening on ${t.join(", ")}.`:"On."}return a.message||a.problem||"Off."}function Wr(a){return!!a&&a.enabled&&a.state==="on"}function Nd(a){return a.host!=="0.0.0.0"?a.host:!a.lanAddresses||a.lanAddresses.includes("0.0.0.0")?"all interfaces":a.lanAddresses.length>0?["127.0.0.1",...a.lanAddresses].join(", "):"127.0.0.1 only (no private network)"}const vr={"tailscale-https":0,tailnet:1,lan:2,"mdns-name":3};function cs(a){return[...a].sort((t,s)=>vr[t.kind]-vr[s.kind])}function Sd(a){try{return new URL(a).hostname.replace(/^\[|\]$/g,"").toLowerCase()}catch{return a}}function Cd(a){const t=[],s=new Set,r=cs(a.urls.filter(i=>i.kind==="tailscale-https"||i.kind==="tailnet"));if(r.length>0){t.push({title:"Tailscale",urls:r});for(const i of r)s.add(i.url)}for(const i of a.networks.filter(l=>l.kind==="lan")){const l=new Set(i.addresses.map(d=>d.toLowerCase())),c=a.urls.filter(d=>d.kind==="lan"&&!s.has(d.url)&&l.has(Sd(d.url)));if(c.length!==0){t.push({title:i.label,urls:c});for(const d of c)s.add(d.url)}}const n=cs(a.urls.filter(i=>!s.has(i.url)));return n.length>0&&t.push({title:"Other",urls:n}),t}const Ad="Some addresses use http. Anyone on those networks can read the token.";function br(a,t=Date.now()){if(a.connected)return"Connected now";if(!a.lastSeenAt)return"Never connected";const s=Date.parse(a.lastSeenAt);if(Number.isNaN(s))return`Last seen ${a.lastSeenAt}`;const r=Math.max(0,Math.round((t-s)/6e4));return`Last seen ${r<1?"just now":r<60?`${r} min ago`:r<2880?`${Math.round(r/60)} h ago`:new Date(s).toLocaleDateString()}${a.lastSeenAddress?` (${a.lastSeenAddress})`:""}`}function Gr(a,t=Date.now()){const s=Math.max(0,Math.ceil((Date.parse(a)-t)/1e3));return Number.isNaN(s)?"":`${Math.floor(s/60)}:${String(s%60).padStart(2,"0")}`}function _d(a){return a.length===6?`${a.slice(0,3)} ${a.slice(3)}`:a}const Ed=Zr;function bs(a){return a||"this server"}function Pd(a){return`Devices that can access ${bs(a)}.`}function Yr(a,t=null){const s=jd(a),r=s.allow,n=!a.enabled;if(!n&&r.length===0)return null;const i=a.networks.filter(c=>!!c.id).map(c=>c.label),l=i.length>0?` on ${kd(i)}`:"";return{enable:n,networks:r,text:`Devices that you pair${l} get full control of ${bs(t)}. This control is equal to your seed phrase.`,warning:s.exposed?Ed:null}}const Rd="Remote access stays on. To turn it off, use Devices.";function Td({turnedOn:a,allowed:t,added:s}){return a&&!s?"off":a||t?"stays":null}function Md(a,t){const s=t.find(r=>r.origin==="paired"&&!a.has(r.id));return s?`Approved: ${s.label}.`:null}function zt(a){return`Change on ${a}.`}function Va(a,t){return a?a.step==="waiting"?{kind:"ok",text:a.message??`Waiting for ${t} to allow this device…`}:a.step==="paired"?{kind:"ok",text:a.message??`Paired with ${t}.`}:a.step==="claiming"?{kind:"ok",text:"Sending the code…"}:a.message?{kind:a.code?"error":"ok",text:a.message}:null:null}function Ld(a){if(!a.available)return"Not available";const t=a.status;if(!t)return"";const s=t.devices.length,r=s>0?` · ${s} ${s===1?"device":"devices"}`:"";return`${t.enabled?"On":"Off"}${r}`}const Id="When you quit Studio, Studio stops this server. Then devices cannot connect until you start Studio again. To change this, turn on Keep running after Studio quits.";function Dd({encrypted:a}){return e.jsx("span",{className:`whitespace-nowrap rounded px-1.5 py-0.5 text-[11px] font-medium ${a?"bg-[var(--adf-ui-success-subtle,var(--adf-ui-surface-hover))] text-[var(--adf-ui-success,var(--adf-ui-text))]":"bg-[var(--adf-ui-warning-subtle)] text-[var(--adf-ui-text)]"}`,children:a?"Encrypted":"Not encrypted"})}function Od(a){navigator.clipboard?.writeText(a).catch(()=>{})}function Qr({text:a,label:t}){const[s,r]=o.useState(!1);return o.useEffect(()=>{if(!s)return;const n=setTimeout(()=>r(!1),1500);return()=>clearTimeout(n)},[s]),e.jsx($,{size:"compact",variant:"ghost",onClick:()=>{Od(a),r(!0)},"aria-label":t,className:"w-16",children:s?"Copied":"Copy"})}function $d({href:a}){return e.jsx(ct,{href:a,label:"Learn more",className:"ml-1.5 !text-[11px]"})}function Kd({status:a}){const t=Cd(a);if(t.length===0)return e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:"No address."});const s=a.urls.some(r=>!r.encrypted);return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"overflow-hidden rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)]",children:e.jsx("table",{className:"w-full border-collapse text-[12px]","aria-label":"Addresses",children:t.map((r,n)=>e.jsxs("tbody",{"data-address-group":r.title,children:[e.jsx("tr",{className:n>0?"border-t border-[var(--adf-ui-separator)]":"",children:e.jsx("th",{scope:"rowgroup",colSpan:3,className:"bg-[var(--adf-ui-surface-hover)] px-3 py-1.5 text-left text-[11px] font-semibold text-[var(--adf-ui-text-muted)]",children:r.title})}),cs(r.urls).map(i=>e.jsxs("tr",{className:"border-t border-[var(--adf-ui-separator)]","data-address":i.url,children:[e.jsx("td",{className:"w-full break-all px-3 py-1.5 font-mono text-[12px] text-[var(--adf-ui-text)]",children:i.url}),e.jsx("td",{className:"px-2 py-1.5 text-right align-middle",children:e.jsx(Dd,{encrypted:i.encrypted})}),e.jsx("td",{className:"py-1 pr-1.5 text-right align-middle",children:e.jsx(Qr,{text:i.url,label:`Copy ${i.url}`})})]},i.url))]},r.title))})}),s&&e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:Ad})]})}function Fd({devices:a,busy:t,onRemove:s,now:r}){return a.length===0?e.jsx(ft,{children:e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:"None. To add a device, click Add, then Share."})}):e.jsx("div",{children:a.map(n=>e.jsxs(ft,{"data-device":n.id,actions:e.jsx($,{size:"compact",variant:"danger",disabled:t,onClick:()=>s(n),children:"Revoke"}),children:[e.jsx("div",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:n.label}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[var(--adf-ui-text-muted)]",children:[e.jsx("span",{children:n.origin==="paired"?"Paired":"Token"}),e.jsx("span",{"aria-hidden":"true",children:"·"}),n.connected?e.jsx(vs,{tone:"ok",children:br(n,r)}):e.jsx("span",{children:br(n,r)})]})]},n.id))})}function Bd({pairing:a,fingerprint:t,now:s}){const r=a.fingerprint||t;return e.jsxs("div",{className:"space-y-1.5 rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] px-4 py-4 text-center","data-pairing-code":"",children:[e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:"Enter this code on the other device."}),e.jsx("p",{className:"font-mono text-[40px] font-semibold leading-tight tracking-[0.15em] text-[var(--adf-ui-text)]","aria-label":"Pairing code",children:_d(a.code)}),e.jsxs("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:["Expires in ",e.jsx("span",{className:"font-mono tabular-nums text-[var(--adf-ui-text)]",children:Gr(a.expiresAt,s)})," · ",a.attemptsLeft," ",a.attemptsLeft===1?"try":"tries"," left"]}),r&&e.jsxs("p",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:["Fingerprint ",e.jsx("span",{className:"font-mono",children:r})]}),a.lockedSources>0&&e.jsxs("p",{className:"text-[12px] text-[var(--adf-ui-danger)]",children:[a.lockedSources," ",a.lockedSources===1?"device is":"devices are"," locked out after 5 wrong codes."]}),a.claim&&e.jsx("p",{className:"text-[12px] font-medium text-[var(--adf-ui-text)]",children:"A device entered the code. Answer the Allow device dialog."})]})}function qd({label:a,token:t,onDone:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"text-[12px] text-[var(--adf-ui-text)]",children:["Token for ",a,". Studio shows it only one time. It is as powerful as your seed phrase."]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 break-all rounded border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] px-2 py-1 text-[12px]",children:t}),e.jsx(Qr,{text:t,label:"Copy token"}),e.jsx($,{size:"compact",variant:"primary",onClick:s,children:"Done"})]}),e.jsx("div",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:"On the other computer, click Add, then Connect, and enter the token."})]})}function zd({consent:a,busy:t,onAllow:s}){return e.jsxs("div",{className:"space-y-2 rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] px-4 py-3","data-share-consent":"",children:[e.jsxs("p",{className:"leading-5 text-[var(--adf-ui-text)]",children:[a.text,e.jsx($d,{href:Se.remoteAccessPair})]}),a.warning&&e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-danger)]",children:a.warning}),e.jsx("div",{className:"flex justify-end",children:e.jsx($,{variant:"primary",loading:t,onClick:s,children:"Allow"})})]})}function Za({title:a,children:t}){return e.jsxs("section",{className:"space-y-1.5",children:[e.jsx("h3",{className:"text-[12px] font-semibold text-[var(--adf-ui-text)]",children:a}),t]})}const yr="Share this server as",Ud="Devices see this server by this name. It is also the alias in Settings → Identity.",Hd="Enter a name.",Vd="Use 1 to 63 characters. Do not use control characters.";function Zd(a){return/1-63 characters|control or bidi/i.test(a)?Vd:a}function Wd(a){return a?.dataset?.shareLeave!==void 0}function Gd({name:a,draft:t,busy:s,note:r,onDraft:n,onSave:i}){const l=t??a;return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("label",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[e.jsx("span",{className:"text-[12px] font-medium text-[var(--adf-ui-text)]",children:yr}),e.jsx(ze,{value:l,onChange:c=>n(c.target.value),onBlur:c=>{Wd(c.relatedTarget)||i()},onKeyDown:c=>{c.key==="Enter"&&i()},disabled:s,maxLength:63,spellCheck:!1,"aria-label":yr,className:"min-w-0 flex-1"})]}),e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:Ud}),r&&e.jsx("p",{role:"status",className:`text-[11px] ${r.kind==="error"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-muted)]"}`,children:r.text})]})}function Yd({runtime:a=null,onBack:t,onDone:s}){const[r,n]=o.useState(null),[i,l]=o.useState(!1),[c,d]=o.useState(null),[h,f]=o.useState(()=>Date.now()),[b,C]=o.useState(""),[_,E]=o.useState(null),[x,D]=o.useState(null),[k,q]=o.useState(null),[U,L]=o.useState(!1),[W,A]=o.useState(!1),[V,ie]=o.useState(!1),w=o.useRef(null),X=o.useRef(!1);o.useEffect(()=>{let H=!0;window.adfApi?.getRemoteAccess?.().then(g=>{H&&n(g)}).catch(()=>{});const ne=window.adfApi?.onRemoteAccessChanged?.(g=>n(g.view)),xe=setInterval(()=>{window.adfApi?.getRemoteAccess?.().then(g=>{H&&n(g)}).catch(()=>{})},5e3);return()=>{H=!1,ne?.(),clearInterval(xe)}},[]);const I=r?.status??null;I&&w.current===null&&(w.current=new Set(I.devices.map(H=>H.id)));const R=I?Yr(I,a):null,K=I&&w.current?Md(w.current,I.devices):null,J=I?.pairing??null,ae=Td({turnedOn:W,allowed:V,added:!!K||!!_});o.useEffect(()=>()=>{window.adfApi?.leaveRemoteShare?.().catch(()=>{})},[]);const se=()=>{X.current=!0,L(!0),Y(()=>window.adfApi.openRemotePairing())};o.useEffect(()=>{!I||R||K||X.current||!Wr(I)||I.pairing||se()},[I,R,K]),o.useEffect(()=>{if(!J)return;const H=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(H)},[J]);async function Y(H){l(!0),d(null);try{const ne=await H();return ne.ok?n(ne.view):ne.code!=="cancelled"&&d(ne.error),ne.ok}catch{return d("Studio could not reach the server."),!1}finally{l(!1)}}const z=async()=>{l(!0),d(null);try{const H=await window.adfApi.shareRemoteAccess();H.turnedOn&&A(!0),H.ok?(n(H.view),ie(!0)):H.code!=="cancelled"&&d(H.error)}catch{d("Studio could not reach the server.")}finally{l(!1)}},re=async()=>{l(!0),d(null);try{const H=await window.adfApi.addRemoteDevice(b);H.ok?(n(H.view),E({label:H.device.label,token:H.token})):d(H.error)}finally{l(!1)}},he=async()=>{const H=x?.trim()??"";if(!(!I||x===null)){if(!H){q({kind:"error",text:Hd});return}if(H===I.name){D(null),q(null);return}l(!0),q(null);try{const ne=await window.adfApi.setRemoteAccess({name:H});ne.ok?(n(ne.view),D(null),q({kind:"ok",text:"Saved."})):ne.code!=="cancelled"&&q({kind:"error",text:Zd(ne.error)})}catch{q({kind:"error",text:"Studio could not reach the server."})}finally{l(!1)}}};return e.jsx(Qd,{view:r,runtime:a,busy:i,error:c,now:h,opened:U,leave:ae,approved:K,label:b,created:_,nameDraft:x,nameNote:k,onName:D,onSaveName:()=>{he()},onLabel:C,onAllow:()=>{z()},onRenew:se,onCreateToken:()=>{re()},onBack:t,onDone:s})}function Qd({view:a,runtime:t=null,busy:s,error:r,now:n,opened:i=!1,leave:l=null,approved:c,label:d,created:h,nameDraft:f=null,nameNote:b=null,onName:C=()=>{},onSaveName:_=()=>{},onLabel:E,onAllow:x,onRenew:D,onCreateToken:k,onBack:q,onDone:U}){const L=a?.status??null,W=L?Yr(L,t):null,A=L?.pairing??null,V=!!A&&Gr(A.expiresAt,n)==="0:00",ie=L&&L.firewall.state!=="ok"&&(L.firewall.message||L.firewall.commands.length>0)?L.firewall:null;return e.jsxs("div",{className:"space-y-4 text-[12px]",children:[!a&&e.jsx("p",{className:"text-[var(--adf-ui-text-muted)]",children:"Loading…"}),a&&!a.available&&e.jsx("p",{className:"text-[var(--adf-ui-text-muted)]",children:a.unavailableReason}),a?.available&&!L&&e.jsx("p",{className:"text-[var(--adf-ui-danger)]",children:a.error??"Studio could not read remote access."}),L&&e.jsx(Gd,{name:L.name,draft:f,busy:s,note:b,onDraft:C,onSave:_}),L&&W&&e.jsx(zd,{consent:W,busy:s,onAllow:x}),L?.networks.filter(w=>!w.id).map(w=>e.jsxs("p",{className:"text-[var(--adf-ui-text-muted)]",children:[gs(w.problem),e.jsx(ct,{href:Se.unidentifiedNetwork,label:"Help",className:"ml-1.5 !text-[11px]"})]},`unidentified:${w.kind}:${w.ifaces.join(",")}`)),L&&!W&&e.jsxs(e.Fragment,{children:[e.jsx(Za,{title:"Code",children:c?e.jsx("p",{className:"rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] px-4 py-3 text-[13px] font-medium text-[var(--adf-ui-text)]",children:c}):A&&!V?e.jsx(Bd,{pairing:A,fingerprint:L.fingerprint,now:n}):Wr(L)?e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] px-4 py-3",children:[e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:A?"The code expired.":i?"No code.":"Opening…"}),(A||i)&&e.jsx($,{size:"compact",disabled:s,onClick:D,children:"Renew"})]}):e.jsx("p",{className:"text-[var(--adf-ui-text-muted)]",children:ls(L)})}),ie&&e.jsx(Za,{title:"Firewall",children:e.jsxs("div",{className:`space-y-1 text-[11px] ${ie.state==="blocked"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-subtle)]"}`,children:[ie.message&&e.jsx("p",{children:ie.message}),ie.commands.length>0&&e.jsx("ul",{className:"space-y-0.5 rounded border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] px-2 py-1 font-mono text-[var(--adf-ui-text)]",children:ie.commands.map(w=>e.jsx("li",{className:"break-all",children:w},w))})]})}),e.jsx(Za,{title:"Addresses",children:e.jsx(Kd,{status:L})}),!c&&e.jsxs("details",{className:"text-[12px]",children:[e.jsx("summary",{className:"cursor-pointer select-none font-semibold text-[var(--adf-ui-text)]",children:"Token"}),e.jsx("div",{className:"mt-2 space-y-2",children:h?e.jsx(qd,{label:h.label,token:h.token,onDone:U}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-[var(--adf-ui-text-muted)]",children:"A token connects without a code. Scripts and the ADF CLI use tokens."}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("label",{className:"block flex-1 space-y-1",children:[e.jsx("span",{className:"font-medium text-[var(--adf-ui-text)]",children:"Device"}),e.jsx(ze,{value:d,onChange:w=>E(w.target.value),placeholder:"laptop-1","aria-label":"Device name",maxLength:64})]}),e.jsx($,{disabled:s,onClick:k,children:"Create"})]})]})})]})]}),r&&e.jsx("p",{role:"status",className:"text-[var(--adf-ui-danger)]",children:r}),l==="stays"&&e.jsx("p",{className:"text-[var(--adf-ui-text-muted)]",children:Rd}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--adf-ui-separator)] pt-3",children:[e.jsx($,{onClick:q,disabled:s,"data-share-leave":"",children:"Back"}),c||h?e.jsx($,{variant:"primary",onClick:U,children:"Done"}):e.jsx($,{onClick:U,disabled:s,"data-share-leave":"",children:"Cancel"})]})]})}function Jd({runtime:a=null}){const[t,s]=o.useState(null),[r,n]=o.useState(!1),[i,l]=o.useState(null),[c,d]=o.useState(()=>Date.now());o.useEffect(()=>{let b=!0;window.adfApi?.getRemoteAccess?.().then(_=>{b&&s(_)}).catch(()=>{});const C=window.adfApi?.onRemoteAccessChanged?.(_=>{s(_.view),_.notice&&l({kind:"ok",text:_.notice})});return()=>{b=!1,C?.()}},[]);const h=t?.status?.enabled===!0;o.useEffect(()=>{if(!h)return;const b=setInterval(()=>{window.adfApi?.getRemoteAccess?.().then(s).catch(()=>{}),d(Date.now())},5e3);return()=>clearInterval(b)},[h]);const f=async b=>{n(!0),l(null);try{const C=await b();C.ok?s(C.view):C.code!=="cancelled"&&l({kind:"error",text:C.error})}catch{l({kind:"error",text:"Studio could not reach the server."})}finally{n(!1)}};return e.jsx(Xd,{runtime:a,view:t,busy:r,message:i,now:c,onSwitch:b=>{f(()=>window.adfApi.setRemoteAccess({enabled:b}))},onRevoke:b=>{f(()=>window.adfApi.removeRemoteDevice(b.id))}})}function Xd({view:a,runtime:t=null,busy:s,message:r,now:n,onSwitch:i,onRevoke:l}){if(!a)return null;const c=a.status,d=c?.enabled===!0,h=d||(c?.devices.length??0)>0;return e.jsxs(ua,{id:"devices",title:"Devices",help:Pd(t),summary:Ld(a),docs:Se.remoteAccessDevices,collapsible:!0,open:h,children:[e.jsxs(ft,{actions:e.jsx(rt,{label:"Remote access",checked:d,disabled:!a.available||s||!c,onChange:i}),children:[e.jsx("div",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:"Remote access"}),e.jsxs("div",{className:"mt-0.5 leading-5 text-[var(--adf-ui-text-muted)]",children:["Devices that you pair can connect to ",bs(t),"."]}),(a.available?c?ls(c):null:a.unavailableReason)&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-subtle)]",children:a.available?c?ls(c):null:a.unavailableReason}),a.error&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-danger)]",children:a.error}),d&&a.stopsWithStudio&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-muted)]","data-stops-with-studio":"",children:Id})]}),c&&e.jsx(Fd,{devices:c.devices,busy:s,now:n,onRemove:l}),r&&e.jsx(ft,{children:e.jsx("span",{role:"status",className:r.kind==="error"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-muted)]",children:r.text})})]})}const eu={embedded:"Inside Studio (legacy)",local:Er};function ds({href:a}){return e.jsx(ct,{href:a,label:"Learn more",className:"ml-1.5 !text-[11px]"})}function tu(a){return`On ${Number.isNaN(Date.parse(a.at))?a.at:new Date(a.at).toLocaleString()}, Studio${a.version?` ${a.version}`:""} moved agents from inside Studio to the local server.`}function Wa(a){return{moved:`Moved: ${a.moved.length>0?a.moved.join(", "):"nothing"}.`,notDone:a.notDone.length>0?`Not done then, retried at each start: ${a.notDone.join(" ")}`:null}}const au={connecting:Bt.connecting,connected:Bt.connected,disconnected:Bt.retrying,failed:Bt["not-connected"]};function su(a){return a.startedBy?a.how==="spawned"?"this Studio":a.startedBy==="studio"?"Studio":a.startedBy==="cli"?"the ADF CLI":"a service":null}function ru(a){return/^Starting the ADF daemon/.test(a)?"Starting the server…":/^Waiting for the ADF daemon/.test(a)?"Waiting for the server…":/^Stopping the ADF daemon/.test(a)?"Stopping the server…":a}function nu(a){const t=a?/\(pid (\d+)\)/.exec(a):null;return t?Number(t[1]):null}function iu(a){const t=[a.progress?ru(a.progress):au[a.connection]];return a.trust?.state==="not-trusted"&&t.push("Key not trusted"),t.join(" · ")}function ou(a){const t=[],s=a.pid??nu(a.progress);s&&t.push(`PID: ${s}`);const r=su(a);return r&&t.push(`Started by: ${r}`),a.url&&t.push(`URL: ${a.url}`),a.version&&t.push(`Version: ${a.version}`),a.trust?.state==="trusted"&&t.push("Key: trusted by the owner"),a.trust?.state==="not-trusted"&&t.push("Key: not trusted. To trust it, run adf identity trust-daemon."),a.localProof&&!a.localProof.available&&t.push(`Local proof: not available (${a.localProof.problem??"unknown reason"})`),t}function Jr(a){return a==="connected"?"ok":a==="connecting"?"busy":a==="retrying"||a==="not-connected"||a==="disconnected"||a==="failed"?"down":"off"}function lu(a,t){return a?"When you quit Studio, the server and its agents keep running.":t?.startedBy==="cli"?"The ADF CLI started this server. Studio does not stop it when you quit Studio.":t?.startedBy==="service"?"A service started this server. Studio does not stop it when you quit Studio.":"When you quit Studio, Studio stops the server and its agents."}function cu(a){const t=eu[a.active.mode];return a.active.source==="env"?`${t} because ADF_STUDIO_BACKEND is set.`:a.active.source==="session"?a.active.sessionReason?`${t} for this session only: ${a.active.sessionReason}`:`${t} for this session only.`:null}function du(a,t){return!t||a.active.source==="env"||a.active.source==="session"?null:`Next launch: ${t.name}.`}function uu(a){const t=[a.address,a.fingerprint,a.version?`v${a.version}`:null].filter(s=>!!s);return a.pairingOpen&&a.action==="pair"&&t.push("Pairing open"),t.length>0?t.join(" · "):null}function ys(a){return{local:a.filter(t=>t.kind==="local"||t.kind==="embedded"),remote:a.filter(t=>t.kind==="saved")}}function hu(a){return a===0?"None":`${a} ${a===1?"server":"servers"}`}function pu({items:a,disabled:t}){const[s,r]=o.useState(null),n=o.useRef(null);if(a.length===0)return null;const i=()=>{if(s){r(null);return}const l=n.current?.getBoundingClientRect();r(l?{x:l.right,y:l.bottom+4}:{x:0,y:0})};return e.jsxs(e.Fragment,{children:[e.jsx(pt,{ref:n,"aria-label":"More","aria-haspopup":"menu","aria-expanded":s!==null,disabled:t,onClick:i,variant:s?"selected":"neutral",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),e.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}),e.jsx(mu,{items:a,position:s,onClose:()=>r(null),anchor:n})]})}function mu({items:a,position:t,onClose:s,anchor:r}){return e.jsx(_r,{position:t,onClose:s,placement:{x:"end"},label:"More",anchor:r,items:a.map(n=>({label:n.label,onSelect:n.onSelect,danger:n.danger}))})}function Xr(){return e.jsx("span",{className:"rounded bg-[var(--adf-ui-warning-subtle)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--adf-ui-text)]",children:"Not encrypted"})}function fu(a){return!a.discovery||a.discovery.problem||a.rows.some(t=>t.kind==="found")?null:"No server found yet. On the other computer, click Add, then Share."}function en({row:a,busy:t,separator:s,menu:r,onConnect:n,stateNode:i,children:l}){const c=uu(a);return e.jsxs(ft,{separator:s,"data-connection":a.id,actions:e.jsxs(e.Fragment,{children:[a.action==="connect"&&e.jsx($,{size:"compact",disabled:t,onClick:()=>n(a.id),children:"Connect"}),e.jsx(pu,{items:r,disabled:t})]}),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2.5 gap-y-1",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-[13px] font-medium text-[var(--adf-ui-text)]",children:[a.kind==="saved"?e.jsx(Pr,{size:14,className:"text-[var(--adf-ui-text-muted)]"}):e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:e.jsx(oa,{size:14})}),e.jsx("span",{className:"truncate",children:a.name})]}),i??(a.state&&e.jsx(vs,{tone:Jr(a.state),children:Bt[a.state]})),a.kind==="saved"&&!a.encrypted&&e.jsx(Xr,{})]}),c&&e.jsx("div",{className:"mt-0.5 break-all pl-[22px] font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:c}),l&&e.jsx("div",{className:"pl-[22px]",children:l})]})}function xu({rows:a,busy:t,onConnect:s,onRemove:r}){const n=ys(a).remote;return n.length===0?e.jsx(ft,{children:e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:"None. To add a server, click Add, then Connect."})}):e.jsx("div",{children:n.map(i=>e.jsx(en,{row:i,busy:t,separator:!0,onConnect:s,menu:i.removable?[{label:"Remove",onSelect:()=>r(i.id),danger:!0}]:[]},i.id))})}function gu({rows:a,backend:t,busy:s,onConnect:r,onKeepRunning:n}){const i=ys(a).local,l=i.some(f=>f.kind==="embedded"),c=t.daemon??null,d=t.active.mode==="local",h=i.find(f=>f.kind==="local");return e.jsxs(ua,{id:"local",title:"Local server",help:vu,docs:Se.backendLocalServer,collapsible:!0,open:!0,children:[i.map((f,b)=>{const C=f.kind==="local"&&!l?[{label:"Inside Studio (legacy)",onSelect:()=>r("embedded")}]:[],_=f.kind==="local"&&d&&c,E=_?[c.localProof&&!c.localProof.available?"Studio cannot show stored values or import an identity. Fix the permissions of the server's data folder. Then restart the server.":null,c.keychainProblem].filter(Boolean).join(" "):"";return e.jsx(en,{row:f,busy:s,separator:!0,menu:C,onConnect:r,stateNode:_?e.jsx(vs,{tone:Jr(c.connection),children:iu(c)}):void 0,children:_&&e.jsxs(e.Fragment,{children:[c.message&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-subtle)]",children:c.message}),E&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-danger)]",children:E}),e.jsx(gr,{lines:ou(c)})]})},f.id)}),d&&h&&e.jsxs(ft,{actions:e.jsx(rt,{label:"Keep running after Studio quits",checked:t.configured.keepDaemonRunning,disabled:s,onChange:n}),children:[e.jsx("div",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:"Keep running after Studio quits"}),e.jsxs("div",{className:"mt-0.5 leading-5 text-[var(--adf-ui-text-muted)]",children:[lu(t.configured.keepDaemonRunning,c),e.jsx(ds,{href:Se.backendQuit})]})]}),t.defaultSwitch&&e.jsxs(ft,{children:[e.jsx("div",{className:"text-[13px] font-medium text-[var(--adf-ui-text)]",children:"Default changed"}),e.jsxs("div",{className:"mt-0.5 leading-5 text-[var(--adf-ui-text-muted)]",children:[tu(t.defaultSwitch),e.jsx(ds,{href:Se.backendUpgrade})]}),Wa(t.defaultSwitch).notDone&&e.jsx("div",{className:"mt-1 text-[11px] text-[var(--adf-ui-text-subtle)]",children:Wa(t.defaultSwitch).notDone}),e.jsx(gr,{lines:[Wa(t.defaultSwitch).moved]})]})]})}const vu="The agent server on this computer.";function bu({rows:a,busy:t,onConnect:s,onRemove:r}){const n=ys(a).remote.length;return e.jsx(ua,{id:"remote",title:"Remote servers",help:yu,summary:hu(n),docs:Se.backendRemoteServers,collapsible:!0,open:n>0,children:e.jsx(xu,{rows:a,busy:t,onConnect:s,onRemove:r})})}const yu="Agent servers on other computers that this Studio connects to.";function tn({message:a}){return a?e.jsx("span",{role:"status",className:`text-[12px] ${a.kind==="error"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-text-muted)]"}`,children:a.text}):null}const ju=new Set(["remote_access_off","old_daemon"]);async function ku(a,t,s){const r=await a(s);return r.code!=="already_saved"?r:await t({title:"Replace",body:r.message,confirmLabel:"Replace",danger:!0})?a({...s,replace:!0}):null}function wu(a,t){return`The server at ${a.address} has a different fingerprint (${t}). Studio sent nothing. Select the server in the list again.`}function Nu(a){return a.filter(t=>t.kind==="found"&&!!t.url&&!!t.fingerprint).map(t=>({name:t.name,url:t.url,address:t.address??t.url,fingerprint:t.fingerprint,encrypted:t.encrypted,pairingOpen:t.pairingOpen}))}function Su({targets:a,selected:t,disabled:s,onPick:r}){return a.length===0?null:e.jsx("ul",{"aria-label":"Found",className:"divide-y divide-[var(--adf-ui-separator)] overflow-hidden rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)]",children:a.map(n=>e.jsx("li",{children:e.jsxs("button",{type:"button",disabled:s,"aria-pressed":t===n.url,onClick:()=>r(n),className:`flex w-full items-center gap-2.5 px-3 py-2 text-left ${t===n.url?"bg-[var(--adf-ui-accent-subtle)]":"hover:bg-[var(--adf-ui-surface-hover)]"}`,children:[e.jsx("span",{className:"shrink-0 text-[var(--adf-ui-text-muted)]",children:e.jsx(oa,{size:14})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[13px] font-medium text-[var(--adf-ui-text)]",children:n.name}),e.jsx("span",{className:"block break-all font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:[n.address,n.fingerprint,n.pairingOpen?"Pairing open":null].filter(Boolean).join(" · ")})]}),!n.encrypted&&e.jsx("span",{className:"shrink-0",children:e.jsx(Xr,{})})]})},`${n.fingerprint}@${n.url}`))})}const Cu="Enter a code or a token. To get a code, click Add, then Share, on the other computer.",Au="Enter the 6-digit code.";function us(a){return/^\d{6}$/.test(a.replace(/\s/g,""))}function _u(a){const t=a.message??"This server cannot pair with a code.";return a.host?.fingerprint?t:`${t} To connect without a fingerprint, enter a token.`}function Eu(a,t){const s=a.replace(/\s/g,""),r=t.trim();return s&&r?"both":r?"token":s?"code":null}function ya({label:a,children:t}){return e.jsxs("label",{className:"block space-y-1",children:[e.jsx("span",{className:"text-[12px] font-medium text-[var(--adf-ui-text)]",children:a}),t]})}function Pu({targets:a,searching:t=!1,found:s,url:r,code:n,token:i,insecure:l,trusted:c,invalid:d,empty:h,problem:f,busy:b,onPick:C,onUrl:_,onCode:E,onToken:x,onTrusted:D}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"text-[12px] font-medium text-[var(--adf-ui-text)]",children:"Found"}),e.jsx(Su,{targets:a,selected:s?.url??null,disabled:b,onPick:C}),a.length===0&&!h&&!f&&e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-subtle)]",children:t?"Searching your networks…":"No server found."}),h&&e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-subtle)]",children:h}),f&&e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-subtle)]",children:f}),s&&e.jsxs("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:[s.name," at ",s.address,", fingerprint ",s.fingerprint,"."]})]}),e.jsx(ya,{label:"Address",children:e.jsx(ze,{value:r,onChange:k=>_(k.target.value),placeholder:"https://host-1.tail1234.ts.net",spellCheck:!1,autoComplete:"off","aria-label":"Address",className:"font-mono",autoFocus:!0})}),d&&e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-danger)]",children:d}),l&&e.jsxs("label",{className:"flex items-start gap-2 text-[12px] text-[var(--adf-ui-text-muted)]",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:k=>D(k.target.checked),className:"mt-0.5 rounded text-blue-500","aria-label":"Unencrypted"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-[var(--adf-ui-text)]",children:"Unencrypted"}),e.jsx("span",{className:"block",children:"This address uses http. Anyone on this network can read the code and the token."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 min-[560px]:grid-cols-2",children:[e.jsxs(ya,{label:"Code",children:[e.jsx(ze,{value:n,onChange:k=>E(k.target.value),inputMode:"numeric",maxLength:7,placeholder:"123 456",spellCheck:!1,autoComplete:"off","aria-label":"Code","aria-invalid":!!n.trim()&&!us(n),className:"font-mono tracking-[0.15em]"}),n.trim()&&!us(n)&&e.jsx("span",{className:"block text-[11px] text-[var(--adf-ui-danger)]","data-code-help":"",children:Au})]}),e.jsx(ya,{label:"Token",children:e.jsx(ze,{type:"password",value:i,onChange:k=>x(k.target.value),spellCheck:!1,autoComplete:"off","aria-label":"Token",className:"font-mono"})})]}),e.jsxs("p",{className:"text-[12px] leading-5 text-[var(--adf-ui-text-muted)]",children:[Cu,e.jsx(ds,{href:Se.backendAddConnection})]})]})}function Ru({onClose:a,onBack:t,found:s=null}){const r=ia(g=>g.view?.rows??null),n=ia(g=>g.view?.discovery??null),i=Nu(r??[]),[l,c]=o.useState(s),[d,h]=o.useState(s?.url??""),[f,b]=o.useState(!1),[C,_]=o.useState("form"),[E,x]=o.useState(null),[D,k]=o.useState(""),[q,U]=o.useState(""),[L,W]=o.useState(!1),[A,V]=o.useState(null),[ie,w]=Wt(),X=d.trim()?xd(d):null,I=X?.kind==="insecure-http",R=r?fu({rows:r,discovery:n}):null,K=Eu(D,q);o.useEffect(()=>(window.adfApi?.startRemoteDiscovery?.().catch(()=>{}),()=>{window.adfApi?.stopRemoteDiscovery?.().catch(()=>{})}),[]),o.useEffect(()=>window.adfApi?.onRemotePairingState?.(g=>{C!=="check"||g.host&&X?.url&&g.host.url!==X.url||(x(g),g.step==="paired"&&_("done"),V(Va(g,g.host?.name??"")))}),[C,X?.url]);const J=g=>{c(g),h(g.url),b(!1),V(null)},ae=async()=>{if(X?.url){W(!0),V(null);try{const g=await ku(T=>window.adfApi.startRemotePairing(T),w,{url:X.url,allowInsecureHttp:I&&f});if(!g)return;if(l&&g.host&&g.host.fingerprint!==l.fingerprint){await window.adfApi.cancelRemotePairing(),V({kind:"error",text:wu(l,g.host.fingerprint)});return}if(x(g),g.step==="need_code"&&!g.code){_("check"),V(g.message?{kind:"ok",text:g.message}:null);return}if(g.code&&ju.has(g.code)){V({kind:"error",text:_u(g)});return}V(Va(g,g.host?.name??""))}finally{W(!1)}}},se=async()=>{W(!0);try{const g=await window.adfApi.submitRemotePairingCode(D.replace(/\s/g,""));x(g),V(Va(g,g.host?.name??""))}finally{W(!1)}},Y=async()=>{if(X?.url){W(!0),V(null);try{const g=await window.adfApi.addConnection({url:X.url,token:q,allowInsecureHttp:I&&f});g.ok?(_("done"),V({kind:"ok",text:g.notices.join(" ")})):g.code!=="cancelled"&&V({kind:"error",text:g.error})}finally{W(!1)}}},z=()=>{K==="token"?Y():K==="code"&&ae()},re=()=>{C==="check"&&window.adfApi.cancelRemotePairing(),a()},he=()=>{if(C==="check"){window.adfApi.cancelRemotePairing(),_("form"),x(null),V(null);return}t?.()},H=E?.step==="claiming"||E?.step==="waiting",ne=!!X?.url&&(!I||f),xe=us(D);return e.jsxs(gt,{open:!0,title:"Connect",onClose:re,lightDismiss:!1,wide:!0,children:[ie,e.jsxs("div",{className:"space-y-4 text-[12px]",children:[C==="form"&&e.jsx(Pu,{targets:i,searching:!!n&&!n.problem,found:l,url:d,code:D,token:q,insecure:I,trusted:f,invalid:X?.kind==="invalid"?X.reason??null:null,empty:R,problem:n?.problem??null,busy:L,onPick:J,onUrl:g=>{h(g),l&&g!==l.url&&c(null)},onCode:k,onToken:U,onTrusted:b}),C==="check"&&E?.host&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2.5 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] px-3 py-2.5",children:[e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:e.jsx(oa,{size:16})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block text-[13px] font-medium text-[var(--adf-ui-text)]",children:E.host.name}),e.jsxs("span",{className:"block break-all font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:[E.host.url," · ",E.host.fingerprint]})]})]}),e.jsxs("p",{className:"text-[var(--adf-ui-text-muted)]",children:["Check that ",E.host.name," shows fingerprint ",E.host.fingerprint,"."]}),e.jsx(ya,{label:"Code",children:e.jsx(ze,{value:D,onChange:g=>k(g.target.value),inputMode:"numeric",maxLength:7,placeholder:"123 456",disabled:H,"aria-label":"Code",className:"font-mono text-[18px] tracking-[0.2em]"})})]}),K==="both"&&C==="form"&&e.jsx("p",{className:"text-[var(--adf-ui-danger)]",children:"Enter a code or a token, not both."}),e.jsx(tn,{message:A}),e.jsx("div",{className:"flex justify-end gap-2 border-t border-[var(--adf-ui-separator)] pt-3",children:C==="done"?e.jsx($,{variant:"primary",onClick:a,children:"Done"}):e.jsxs(e.Fragment,{children:[(t||C==="check")&&e.jsx($,{onClick:he,children:"Back"}),e.jsx($,{onClick:re,children:"Cancel"}),C==="form"&&e.jsx($,{variant:"primary",disabled:!ne||(K==="code"?!xe:K!=="token"),loading:L,onClick:z,children:"Connect"}),C==="check"&&e.jsx($,{variant:"primary",disabled:!xe,loading:L||H,onClick:()=>{se()},children:"Pair"})]})})]})]})}const Tu="Connect to a remote agent server.";function Mu(a){return a?`Share ${a}.`:"Share this server."}function jr({title:a,help:t,icon:s,disabled:r,reason:n,onClick:i}){const l=e.jsxs("button",{type:"button",disabled:r,onClick:i,"data-choice":a.toLowerCase(),className:"group flex h-full w-full flex-col items-center gap-3 rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] px-4 py-5 text-center transition-colors hover:border-[var(--adf-ui-accent)] hover:bg-[var(--adf-ui-accent-subtle)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--adf-ui-accent)] disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:border-[var(--adf-ui-border)] disabled:hover:bg-[var(--adf-ui-canvas)]",children:[e.jsx("span",{className:"text-[var(--adf-ui-text-muted)] transition-colors group-hover:text-[var(--adf-ui-accent)]",children:s}),e.jsxs("span",{className:"space-y-0.5",children:[e.jsx("span",{className:"block text-[13px] font-semibold text-[var(--adf-ui-text)]",children:a}),e.jsx("span",{className:"block text-[12px] text-[var(--adf-ui-text-muted)]",children:t})]})]});return r&&n?e.jsx(qe,{tip:n,className:"flex",children:l}):l}function Lu({share:a,runtime:t=null,onConnect:s,onShare:r}){return e.jsxs("div",{className:"grid grid-cols-2 gap-3","data-add-choice":"",children:[e.jsx(jr,{title:"Connect",help:Tu,icon:e.jsx(li,{size:44}),onClick:s}),e.jsx(jr,{title:"Share",help:Mu(t),icon:e.jsx(ci,{size:44}),disabled:!a.available,reason:a.reason,onClick:r})]})}function Iu({runtime:a=null,onClose:t}){const[s,r]=o.useState("choose"),[n,i]=o.useState({available:!0,reason:null});return o.useEffect(()=>{let l=!0;return window.adfApi?.getRemoteAccess?.().then(c=>{l&&i({available:c.available,reason:c.unavailableReason})}).catch(()=>{}),()=>{l=!1}},[]),s==="connect"?e.jsx(Ru,{onClose:t,onBack:()=>r("choose")}):e.jsx(gt,{open:!0,title:s==="share"?"Share":"Add",onClose:t,lightDismiss:!1,wide:!0,children:s==="choose"?e.jsxs("div",{className:"space-y-4 text-[12px]",children:[e.jsx(Lu,{share:n,runtime:a,onConnect:()=>r("connect"),onShare:()=>r("share")}),e.jsx("div",{className:"flex justify-end border-t border-[var(--adf-ui-separator)] pt-3",children:e.jsx($,{onClick:t,children:"Cancel"})})]}):e.jsx(Yd,{runtime:a,onBack:()=>r("choose"),onDone:t})})}function Du({busy:a,message:t,onAdd:s}){return e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(tn,{message:t}),e.jsxs($,{variant:"primary",disabled:a,onClick:s,children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round","aria-hidden":"true",children:e.jsx("path",{d:"M12 5v14M5 12h14"})}),"Add"]})]})}function Ou({view:a,backend:t,busy:s,message:r,onAdd:n,onConnect:i,onRemove:l,onKeepRunning:c,onRestart:d,onOpenBrowser:h,devices:f}){const b=cu(t),C=du(t,a.next);return e.jsxs("div",{className:"space-y-5","data-connections-page":"",children:[(t.active.notices.length>0||b)&&e.jsxs("div",{role:"status",className:"rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-warning)]/30 bg-[var(--adf-ui-warning-subtle)] px-3 py-2 text-[12px] text-[var(--adf-ui-text)]",children:[b&&e.jsx("p",{children:b}),t.active.notices.map(_=>e.jsx("p",{children:_},_))]}),C&&e.jsxs("div",{role:"status",className:"flex items-center justify-between gap-3 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] px-3 py-2 text-[12px] text-[var(--adf-ui-text)]",children:[e.jsx("span",{children:C}),e.jsx($,{size:"compact",onClick:d,children:"Restart"})]}),e.jsx(Du,{busy:s,message:r,onAdd:n}),e.jsx(gu,{rows:a.rows,backend:t,busy:s,onConnect:i,onKeepRunning:c}),h&&e.jsx(ua,{id:"browser",title:"Browser Studio",children:e.jsx(ft,{separator:!1,actions:e.jsx($,{disabled:s,onClick:h,children:"Open in browser"}),children:e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:"Open this computer’s Studio in your browser, already signed in."})})}),e.jsx(bu,{rows:a.rows,busy:s,onConnect:i,onRemove:l}),f]})}function $u(){const a=ia(L=>L.view),[t,s]=o.useState(null),[r,n]=o.useState(null),[i,l]=o.useState(!1),[c,d]=o.useState(null),[h,f]=o.useState(!1),{track:b}=Pt(),C=ii(ra,fs());o.useEffect(()=>{oi();let L=!1;return window.adfApi?.getBackendSettings().then(W=>{L||s(W)}).catch(()=>{L||n("Studio could not read the connection settings.")}),()=>{L=!0}},[]);const _=t?.daemon?.connection;o.useEffect(()=>{if(_!=="connecting"&&_!=="disconnected")return;const L=setInterval(()=>{window.adfApi?.getBackendSettings().then(s).catch(()=>{})},1500);return()=>clearInterval(L)},[_]);const E=async L=>{l(!0),d(null);try{const W=await L();W.ok?(ia.getState().setView(W.view),W.notices.length>0&&d({kind:"ok",text:W.notices.join(" ")})):W.code!=="cancelled"&&d({kind:"error",text:W.error}),window.adfApi?.getBackendSettings().then(s).catch(()=>{})}catch{d({kind:"error",text:"Studio could not change the connection."})}finally{l(!1)}},x=L=>{E(()=>window.adfApi.useConnection(L))},D=L=>{E(()=>window.adfApi.removeConnection(L))},k=async()=>{l(!0),d(null);try{const L=await window.adfApi.openStudioInBrowser();d(L.success?{kind:"ok",text:"Studio opened in your browser."}:{kind:"error",text:L.error})}catch{d({kind:"error",text:"Studio could not open the browser. Check the local server and try again."})}finally{l(!1)}},q=L=>{if(!t)return;const W=t;s({...t,configured:{...t.configured,keepDaemonRunning:L}}),b(window.adfApi.setBackendSettings({keepDaemonRunning:L}).then(A=>A.ok?(s(A.view),A.notices.length>0&&d({kind:"ok",text:A.notices.join(" ")}),{ok:!0}):{ok:!1,error:A.error}),()=>s(W))};if(!a||!t)return e.jsx(ua,{id:"loading",title:"Connections",children:e.jsx(ft,{separator:!1,children:e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:r??"Loading…"})})});const U=a.rows.find(L=>L.kind==="local")?.name??(a.current.kind==="local"?a.current.name:Er);return e.jsxs(e.Fragment,{children:[e.jsx(Ou,{view:a,backend:t,busy:i,message:c,onAdd:()=>f(!0),onConnect:x,onRemove:D,onKeepRunning:q,onRestart:()=>{window.adfApi.restartStudio()},onOpenBrowser:window.adfApi.platform==="web"?void 0:()=>{k()},devices:e.jsx(Jd,{runtime:U})}),h&&e.jsx(Iu,{runtime:C,onClose:()=>f(!1)})]})}const an=[{id:"appearance",label:"Appearance",description:"Theme, avatars, chat width, font and scale.",keywords:"theme dark light font scale avatars chat width",docs:Se.settingsGeneral},{id:"notifications",label:"Notifications",description:"System notifications and the menu bar icon.",keywords:"notifications menu bar badge",docs:Se.settingsGeneral},{id:"updates",label:"Updates",description:"Version and update checks.",keywords:"update version release check",docs:Se.settingsGeneral},{id:"privacy",label:"Privacy",description:"Studio sends no telemetry.",keywords:"privacy telemetry network spell check dictionaries",docs:Se.settingsGeneral},{id:"about",label:"About",description:"Concepts and links.",keywords:"help docs github format",docs:Se.index},{id:"connection",label:"Connections",description:"Servers and devices.",keywords:"backend daemon embedded local remote server servers agent server local server remote servers url token code pair add connect share connection connections this computer runtime remotes devices revoke remote access keep running quit browser web website",docs:Se.backendConnection}],Ea=[{id:"agents",label:"Prompts",description:"Agents read these when they start.",keywords:"prompts instructions system prompt tool prompts compaction defaults",docs:Se.settingsSystemPrompt},{id:"template",label:"Agent templates",description:"What new agents start from.",keywords:"defaults template templates model tools limits new agent files readme mind sandboxed full access",docs:Se.agentTemplates},{id:"providers",label:"Providers",description:"Models, keys, and subscriptions",keywords:"anthropic claude claude code openai chatgpt grok xai openrouter gemini groq ollama lm studio local models api keys provider checks",docs:Se.settingsProviders},{id:"packages",label:"Packages",description:"Shared JavaScript packages",keywords:"npm sandbox dependencies",docs:Se.settingsPackages},{id:"mcps",label:"MCP servers",description:"External tools and services",keywords:"model context protocol integrations tools live catalogs registry",docs:Se.settingsMcp},{id:"skills",label:"Skills",description:"Catalogs the skill browser reads",keywords:"catalog registry sources install browse",docs:Se.settingsSkills},{id:"channels",label:"Channels",description:"Telegram, Discord, Slack, email, WhatsApp",keywords:"adapters messages integrations bot token",docs:Se.settingsChannels},{id:"files",label:"Files",description:"Where agents you claim are saved.",keywords:"agents folder directory files",docs:Se.settingsGeneral},{id:"identity",label:"Identity",description:"Owner and runtime identity",keywords:"did mnemonic alias delegation seed phrase owner",docs:Se.settingsIdentity},{id:"networking",label:"Networking",description:"Agent messaging",keywords:"mesh network sharing lan tailscale mdns peers runtimes servers server mesh server port firewall https allowed networks",docs:Se.settingsNetworking},{id:"compute",label:"Compute",description:"Containers and host access",keywords:"podman machine resources isolation",docs:Se.settingsCompute},{id:"usage",label:"Usage",description:"Token totals by day, provider and model.",keywords:"tokens usage cost burn",docs:Se.settingsUsage}];function Ku(){return[{scope:"studio",label:"Studio",items:an},{scope:"runtime",label:"",items:Ea}]}function Fu(a,t){return a==="backend"?"connection":a==="general"?t==="usage"?"usage":"appearance":a}function It(a,t,s){const r=a.trim();if(!/^\d+$/.test(r))return{ok:!1,error:`Enter a whole number from ${t} to ${s}.`};const n=Number(r);return n<t||n>s?{ok:!1,error:`Enter a whole number from ${t} to ${s}.`}:{ok:!0,value:n}}function Bu(a){const t=a.trim();if(!t)return{ok:!1,error:"Enter an address."};if(/^[a-z]+:\/\//i.test(t)||/[\s/?#@]/.test(t))return{ok:!1,error:"Use host:port, without http:// or a path."};const s=/^\[([0-9a-f:.]+)\](?::(\d+))?$/i.exec(t),r=/^([^:[\]]+)(?::(\d+))?$/.exec(t),n=s??r;if(!n)return{ok:!1,error:"Use host:port, for example 100.101.102.103:7295."};const i=n[1],l=n[2];if(!s&&!/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i.test(i))return{ok:!1,error:"The host has characters a host name cannot have."};if(l!==void 0){const c=Number(l);if(!Number.isInteger(c)||c<1||c>65535)return{ok:!1,error:"The port must be from 1 to 65535."}}return{ok:!0,value:t}}function sa({value:a,onCommit:t,check:s,className:r="",...n}){const[i,l]=o.useState(a),[c,d]=o.useState(null);o.useEffect(()=>{l(a),d(null)},[a]);const h=()=>{if(i===a){d(null);return}const f=s?.(i)??null;d(f),f||t(i)};return e.jsxs("span",{className:"inline-flex min-w-0 flex-col gap-1",children:[e.jsx(ze,{...n,value:i,"aria-invalid":!!c,onChange:f=>{l(f.target.value),d(null)},onBlur:h,onKeyDown:f=>{f.key==="Enter"&&h(),f.key==="Escape"&&(l(a),d(null))},className:r}),c&&e.jsx("span",{role:"alert",className:"text-[11px] text-[var(--adf-ui-danger)]",children:c})]})}const qu="Off stops agent messages, agent websites, agent APIs and messages from other servers.",zu="Agents on this server send messages to each other.",Uu="Other computers on allowed networks can reach the agents that you share.",Hu=[],Vu=new Set(["agent_state_changed","agent_joined","agent_left","lan_peer_discovered","lan_peer_expired"]);function Zu(a){return a.filter(t=>t.visibility==="lan"||t.visibility==="public")}function Wu({meshOn:a,networks:t,shared:s}){const r=[{label:"Mesh",value:a?"On":"Off",tone:a?"ok":"off"}];if(t){t.length===0&&r.push({label:"Network",value:"None",tone:"off"});for(const n of t)r.push({label:"Network",value:`${n.label} · ${n.allowed?"Allowed":n.id?"Not allowed":"Not identified"}`,tone:n.allowed?"ok":n.id?"off":"down"})}return r.push({label:"Shared",value:`${s} ${s===1?"agent":"agents"}`,tone:s>0?"ok":"off"}),r}function Gu(a){return a.length===0?null:`${a.length===1?a[0]:`${a.slice(0,-1).join(", ")} and ${a[a.length-1]}`} ${a.length===1?"is":"are"} public.`}function Yu(a,t){const s=a.waiting??{remoteAccess:!1,mesh:!1},r={remoteAccess:s.remoteAccess,mesh:s.mesh||t.length>0};return a.networks.filter(n=>!n.allowed).map(n=>{const i=[];(r.remoteAccess||r.mesh)&&i.push(bd(r,n.label));const l=n.id?Gu(t):null;l&&i.push(l);const c=!!n.id&&n.kind==="lan"&&n.osCategory!=="private";return{key:n.id??`unidentified:${n.ifaces.join(",")}`,networkId:n.id,lines:i,warning:c&&(r.remoteAccess||r.mesh)?yd(r):null,reason:n.id?null:gs(n.problem),detail:n.id?null:n.problem?.detail??null}})}function Qu(a,t){return a.warning?t.some(s=>s.networkId)?null:a.warning:null}function kr(a){return a.filter(t=>!t.id)}function sn({reason:a,detail:t}){return e.jsxs("span",{className:"block",children:[a,t?e.jsx(qe,{tip:t,className:"inline-flex",children:e.jsx(ct,{href:Se.unidentifiedNetwork,label:"Help",className:"ml-1.5 !text-[11px]"})}):e.jsx(ct,{href:Se.unidentifiedNetwork,label:"Help",className:"ml-1.5 !text-[11px]"})]})}function Ju(a){const t=[];return t.push(a.lan.length>0?`LAN ${a.lan.map(s=>s.address).join(", ")}${a.lan.every(s=>!s.allowed)?", not listening":""}`:"No LAN address"),t.push(a.tailscale==="running"?`Tailscale on${a.tailnetAddress?` (${a.tailnetAddress})`:""}`:a.tailscale==="stopped"?"Tailscale stopped":"Tailscale not installed"),t.join(" · ")}function Xu(a){return a==="tailnet"?"Tailnet":a==="manual"?"Address":"LAN"}function wr(a){if(!a)return null;try{return new URL(a).hostname.replace(/^\[|\]$/g,"").toLowerCase()}catch{return null}}function e0(a){if(!a)return null;try{return new URL(a).port||null}catch{return null}}function t0(a,t,s=[]){const r=new Set([a.host.toLowerCase(),wr(a.url)].filter(n=>!!n));return t.some(n=>{if(n.kind!=="saved")return!1;if(n.fingerprint&&a.fingerprint)return n.fingerprint===a.fingerprint;const i=wr(n.url);if(!i||!r.has(i))return!1;const l=e0(n.url);return l&&a.daemon_port&&l!==String(a.daemon_port)?!1:!(n.fingerprint&&s.some(c=>c!==a&&c.fingerprint===n.fingerprint))})}function a0(a,t){const s=a.trim().toLowerCase().replace(/^\[|\](?=:|$)/g,""),r=t.host.toLowerCase();return s===r||s===`${r}:${t.port}`||s===`[${r}]:${t.port}`}function s0(a,t){const s=[],r=new Set;for(const n of a){const i=n.source==="manual"?t.find(l=>!r.has(l)&&a0(l,n))??null:null;i&&r.add(i),s.push({kind:"found",runtime:n,address:i})}for(const n of t)r.has(n)||s.push({kind:"address",address:n});return s}function rn({href:a}){return e.jsx(ct,{href:a,label:"Learn more",className:"ml-1.5 !text-[11px]"})}function Qt({children:a,tone:t="muted"}){return e.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${t==="accent"?"bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)]":"bg-[var(--adf-ui-surface-hover)] text-[var(--adf-ui-text-muted)]"}`,children:a})}function r0({items:a,consent:t,busy:s,note:r,firewall:n,warning:i=null,onAllow:l}){const c=[i,r??n].filter(d=>!!d);return e.jsxs("div",{role:"status",className:"mb-4 overflow-hidden rounded-[var(--adf-ui-container-radius)] border border-hairline bg-[var(--adf-ui-surface)] text-[12px] text-[var(--adf-ui-text)]","data-status-card":"",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 px-4 py-3",children:[e.jsx("dl",{className:"grid grid-cols-[max-content_1fr] items-center gap-x-6 gap-y-1.5",children:a.map((d,h)=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:d.label}),e.jsxs("dd",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:`size-1.5 shrink-0 rounded-full ${d.tone==="ok"?"bg-[var(--adf-ui-success)]":d.tone==="down"?"bg-[var(--adf-ui-danger)]":"bg-[var(--adf-ui-border)]"}`}),e.jsx("span",{className:"min-w-0 break-words",children:d.value})]})]},`${d.label}:${h}`))}),e.jsx(rn,{href:Se.networkingStatus})]}),t.map(d=>e.jsxs("div",{className:"flex items-start justify-between gap-4 border-t border-[var(--adf-ui-separator)] px-4 py-2.5","data-consent":d.networkId??d.key,children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[d.lines.map(h=>e.jsx("span",{className:"block",children:h},h)),d.reason&&e.jsx("span",{className:"block text-[var(--adf-ui-text-muted)]",children:e.jsx(sn,{reason:d.reason,detail:d.detail})}),d.warning&&e.jsx("span",{className:"block text-[11px] text-[var(--adf-ui-danger)]",children:d.warning})]}),d.networkId&&e.jsx($,{size:"compact",variant:"primary",disabled:s,onClick:()=>l(d.networkId),children:"Allow"})]},d.key)),c.map(d=>e.jsx("div",{className:"border-t border-[var(--adf-ui-separator)] px-4 py-2.5 text-[11px] text-[var(--adf-ui-danger)]",children:d},d))]})}function n0(a){const t=a.trim(),s=/^.*?[.!?](?=\s|$)/s.exec(t)?.[0]??t;return/[.!?]$/.test(s)?s:`${s}.`}function i0(a){if(!a)return"Checking…";const t=a.status?.tailscale;if(!t){const s=a.unavailableReason??a.error;return s?n0(s):"Checking…"}return t.state!=="running"?"Needs Tailscale.":t.serve==="unknown"?"Tailscale did not answer.":t.serve==="on"?`On${t.httpsUrl?`: ${t.httpsUrl}`:""}.`:"Off."}function o0(a){return a.verified?`Open${a.lanIp?` on ${a.lanIp}:${a.port}`:""}.`:a.serverLanBound?a.supported&&a.ruleConfigured===!1?"Other servers find this server. They see 0 agents. Add a firewall rule for the mesh port.":a.supported&&a.ruleConfigured===null||!a.supported?a.detail:`The firewall rule exists. The mesh server does not answer on ${a.lanIp??"the LAN address"}.`:"The mesh server is not listening on a network yet."}function l0({commands:a}){return a.length===0?null:e.jsxs("div",{className:"mt-1 space-y-1",children:[e.jsx("p",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:"Run these commands in an administrator shell."}),e.jsx("pre",{className:"whitespace-pre-wrap break-all rounded border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] px-2 py-1 font-mono text-[11px] text-[var(--adf-ui-text)]",children:a.join(`
|
|
3
|
+
`)}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{size:"compact",variant:"ghost",onClick:()=>{navigator.clipboard?.writeText(a.join(`
|
|
4
|
+
`)).catch(()=>{})},children:"Copy"}),e.jsx(ct,{href:Se.meshFirewall})]})]})}function c0({lan:a,restarting:t,hostName:s}){const r=nt(),[n,i]=o.useState(null);o.useEffect(()=>{if(!a||t||s||!r?.checkLanFirewall)return;let c=!0;return r.checkLanFirewall().then(d=>{c&&i(d)}).catch(()=>{c&&i(null)}),()=>{c=!1}},[a,t,s]);const l=s?zt(s):a?n?o0(n):"Checking…":"Studio checks the firewall while Network is on.";return e.jsx(ce,{separator:!0,stacked:!0,label:"Firewall",description:l,children:n&&!n.verified&&!s&&a&&e.jsx(l0,{commands:n.commands??[]})})}function d0({remote:a,runtimeName:t,pickedMesh:s}){const r=nt(),n=Rr(ps()),{commit:i,offerUndo:l}=Pt(),[c,d]=o.useState(!0),[h,f]=o.useState(!1),[b,C]=o.useState(7295),[_,E]=o.useState([]),[x,D]=o.useState(!0),[k,q]=o.useState({running:!1,port:7295,host:"127.0.0.1"}),[U,L]=o.useState([]),[W,A]=o.useState({hostname:"",addresses:[]}),[V,ie]=o.useState(!1),[w,X]=o.useState("7295"),[I,R]=o.useState(null),[K,J]=o.useState(!1),[ae,se]=o.useState(null),[Y,z]=o.useState(null),[re,he]=o.useState(null),[H,ne]=o.useState(!1),[xe,g]=o.useState(null),[T,ee]=o.useState(!1),[j,me]=o.useState(null),[G,fe]=o.useState([]),[Ee,ge]=o.useState(!1),[Ie,Ge]=o.useState(""),[$e,ye]=o.useState(null),De=di(p=>ui(p,s).enabled),{enableMesh:Be,disableMesh:u}=hi(s),S=ia(p=>p.view?.rows)??Hu;o.useEffect(()=>{X(String(b)),R(null)},[b]),o.useEffect(()=>{let p=!0;return r?.getSettings?.().then(F=>{if(!p)return;const Ce=F;d(Ce.meshEnabled!==!1),f(!!Ce.meshLan),C(Ce.meshPort??7295),E(Ce.meshManualPeers??[]),D(Ce.tailnetDiscovery!==!1)}).catch(()=>{}),()=>{p=!1}},[]),o.useEffect(()=>{const p=()=>{r?.getMeshServerStatus?.().then(q).catch(()=>{}),r?.getMeshStatus?.().then(it=>L(it.agents)).catch(()=>{})};p(),r?.getMeshServerLanIps?.().then(A).catch(()=>{});let F;const Ce=r?.onMeshEvent?.(it=>{Vu.has(it.type)&&(clearTimeout(F),F=setTimeout(p,500))});return()=>{clearTimeout(F),Ce?.()}},[De]),o.useEffect(()=>{if(a)return;const p=()=>{window.adfApi?.getNetworkStatus?.().then(z).catch(()=>{}),window.adfApi?.getRemoteAccess?.().then(g).catch(()=>{})};p();const F=setInterval(p,1e4),Ce=window.adfApi?.onRemoteAccessChanged?.(()=>p());return()=>{clearInterval(F),Ce?.()}},[a]);const O=o.useCallback(async(p=!1)=>{const F=await r?.getDiscoveredRuntimes?.(p);F&&fe(F)},[]);o.useEffect(()=>(O(),r?.onMeshEvent?.(F=>{(F?.type==="lan_peer_discovered"||F?.type==="lan_peer_expired")&&O()})),[O]);const pe=(p,F,Ce,it)=>(F(Ce),i(p,()=>F(it))),ue=async()=>{ie(!0);try{const p=await r?.restartMeshServer();p&&q({running:p.running??!1,port:p.port??b,host:p.host??(h?"0.0.0.0":"127.0.0.1")})}finally{ie(!1)}},Oe=async()=>{const p=It(w,1,65535);if(!p.ok){R(p.error);return}if(p.value===b)return;await pe({meshPort:p.value},C,p.value,b)&&k.running&&p.value!==k.port&&await ue()},we=async p=>{J(!0),se(null);try{const F=p?await Be():await u();if(!F.success){se(F.error??`Mesh ${p?"start":"stop"} failed.`);return}const Ce=p?await r?.startMeshServer():await r?.stopMeshServer();Ce&&(q({running:Ce.running??!1,port:Ce.port??k.port,host:Ce.host??k.host}),!Ce.success&&Ce.error&&se(Ce.error))}catch(F){se(F instanceof Error?F.message:String(F))}finally{J(!1)}},Pe=async(p,F)=>{he(null),ne(!0);try{const Ce=p==="allow"?await window.adfApi.allowNetwork(F):await window.adfApi.forgetNetwork(F);Ce.ok||he(Ce.error)}catch{he("Studio could not change the allowed networks.")}finally{ne(!1),window.adfApi?.getNetworkStatus?.().then(z).catch(()=>{})}},Fe=async p=>{const F=_;E(p),await i({meshManualPeers:p},()=>E(F))},v=async()=>{const p=Bu(Ie);if(!p.ok){ye(p.error);return}Ge(""),ye(null),await Fe([..._.filter(F=>F!==p.value),p.value])},oe=p=>{const F=_;Fe(_.filter(Ce=>Ce!==p)).then(()=>l(`Removed ${p}.`,()=>{Fe(F)}))},He=async()=>{ge(!0);try{await O(!0)}finally{ge(!1)}},Ke=async p=>{ee(!0),me(null);try{const F=await window.adfApi.setRemoteTailscaleServe(p);F.ok?g(F.view):F.code!=="cancelled"&&me(F.error)}finally{ee(!1)}},Me=Zu(U),tt=U.filter(p=>p.visibility==="public").map(p=>p.handle??p.filePath),at=!a&&!!Y?.available,xt=Wu({meshOn:De,networks:at?Y.networks:null,shared:Me.length}),N=at?Yu(Y,tt):[],Z=xe?.status?.tailscale??null,ve=s0(G,_);return e.jsxs(e.Fragment,{children:[e.jsx(r0,{items:xt,consent:N,busy:H,note:re,firewall:at&&Y.firewall.state==="blocked"?Y.firewall.message:null,warning:Qu(k,N),onAllow:p=>{Pe("allow",p)}}),e.jsxs(Re,{title:"Sharing",docs:Se.settingsNetworking,children:[e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Mesh",e.jsx(We,{tip:qu})]}),description:zu,error:ae??void 0,children:e.jsx(rt,{label:"Mesh",checked:De,disabled:K,onChange:p=>{we(p)}})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Network",e.jsx(We,{tip:"The mesh listens on private networks and Tailscale. It listens only on networks that you allow. An agent with lan or public visibility also sets this switch on."})]}),description:Uu,help:V?"Restarting…":void 0,children:e.jsx(rt,{label:"Network",checked:h,disabled:V,onChange:async p=>{await pe({meshLan:p},f,p,h)&&k.running&&await ue()}})}),e.jsx(ce,{separator:!0,stacked:!0,label:e.jsxs(e.Fragment,{children:["Agents",e.jsx(We,{tip:"Agents with lan or public visibility. To set the visibility, go to Agent → Config → Messaging."})]}),description:e.jsxs(e.Fragment,{children:[Me.length," shared",e.jsx(rn,{href:Se.visibility})]}),children:Me.length>0&&e.jsx("ul",{className:"space-y-0.5 text-[12px]",children:Me.map(p=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx(Fs,{seed:Bs({did:p.did,filePath:p.filePath}),icon:p.icon,iconSeed:p.agentId||p.filePath,size:14,emojiSize:12}),$i?e.jsx("button",{type:"button",className:"font-mono text-[var(--adf-ui-accent)] hover:underline",onClick:()=>Ki({filePath:p.filePath,agentId:p.agentId??null,...p.handle?{name:p.handle}:{},...s?{runtimeId:s}:{}}),children:p.handle}):e.jsx("span",{className:"font-mono text-[var(--adf-ui-text)]",children:p.handle}),e.jsx(Qt,{children:p.visibility==="public"?"Public":"LAN"})]},p.filePath))})})]}),e.jsx(Re,{title:"Networks",description:"The networks where this server can listen. You allow each network one time.",children:a?e.jsx(ce,{label:"Networks",description:zt(t)}):!Y?.available||Y.allowedNetworks.length===0&&kr(Y.networks).length===0?e.jsx(ce,{label:"None",description:"To allow a network, use Allow in the card above."}):e.jsxs(e.Fragment,{children:[Y.allowedNetworks.map((p,F)=>e.jsx(ce,{separator:F>0,label:e.jsxs("span",{className:"flex items-center gap-2",children:[p.label,Y.networks.some(Ce=>Ce.id===p.id)&&e.jsx(Qt,{tone:"accent",children:"Current"})]}),children:e.jsx($,{size:"compact",disabled:H,onClick:()=>{Pe("forget",p.id)},children:"Remove"})},p.id)),kr(Y.networks).map((p,F)=>e.jsx(ce,{separator:Y.allowedNetworks.length>0||F>0,label:p.label,description:e.jsx(sn,{reason:gs(p.problem),detail:p.problem?.detail??null})},`unidentified:${p.kind}:${p.ifaces.join(",")}`))]})}),e.jsxs(Re,{title:"Servers",description:"Agent servers on your networks, on your tailnet, or at an address that you add. The agent count comes from the directory of each server.",children:[ve.length===0?e.jsx("p",{className:"border-t border-[var(--adf-ui-separator)] px-4 py-3 text-[12px] text-[var(--adf-ui-text-muted)]",children:"No server found."}):e.jsx("ul",{className:"divide-y divide-[var(--adf-ui-separator)] border-t border-[var(--adf-ui-separator)]",children:ve.map(p=>{const F=p.address;return e.jsxs("li",{className:"flex flex-wrap items-center gap-2 px-4 py-2.5 text-[12px]",children:[p.kind==="found"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:e.jsx(oa,{size:14})}),e.jsx("span",{className:"font-mono font-medium text-[var(--adf-ui-text)]",children:p.runtime.host}),e.jsx(Qt,{children:Xu(p.runtime.source)}),t0(p.runtime,S,G)&&e.jsx(qe,{tip:"This Studio also connects to this server (Settings → Connections).",children:e.jsx("span",{children:e.jsx(Qt,{tone:"accent",children:"Managed"})})}),p.runtime.url&&e.jsx("span",{className:"font-mono text-[11px] text-[var(--adf-ui-text-subtle)]",children:p.runtime.url.replace(/^https?:\/\//,"")}),p.runtime.agent_count===void 0?e.jsx(qe,{tip:"The server sent an announcement. Its directory did not answer. Possible causes: a firewall, a wrong network interface, or a stopped mesh server.",className:"ml-auto",children:e.jsx("span",{className:"text-[var(--adf-ui-warning)]",children:"Unreachable"})}):e.jsxs("span",{className:"ml-auto text-[var(--adf-ui-text-muted)]",children:[p.runtime.agent_count," ",p.runtime.agent_count===1?"agent":"agents"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[var(--adf-ui-text-muted)]",children:e.jsx(oa,{size:14})}),e.jsx("span",{className:"font-mono font-medium text-[var(--adf-ui-text)]",children:p.address}),e.jsx(Qt,{children:"Address"}),e.jsx("span",{className:"ml-auto text-[var(--adf-ui-text-subtle)]",children:"No answer"})]}),F&&e.jsx(pt,{onClick:()=>oe(F),"aria-label":`Remove ${F}`,variant:"danger",title:"Remove",children:"✕"})]},p.kind==="found"?`${p.runtime.runtime_id}|${p.runtime.url}`:`address:${p.address}`)})}),e.jsx(ce,{separator:!0,label:"Address",error:$e??void 0,children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ze,{"aria-label":"Address",value:Ie,"aria-invalid":!!$e,onChange:p=>{Ge(p.target.value),ye(null)},onKeyDown:p=>{p.key==="Enter"&&v()},placeholder:"host:port, e.g. 100.101.102.103:7295",spellCheck:!1,className:"!w-72 font-mono !text-[12px]"}),e.jsx($,{onClick:()=>{v()},size:"compact",children:"Add"}),e.jsx(qe,{tip:"Look on the tailnet and at the addresses again now.",children:e.jsx($,{onClick:()=>{He()},disabled:Ee,loading:Ee,size:"compact",children:"Recheck"})})]})})]}),e.jsx(Re,{children:e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer select-none px-4 py-3 text-[13px] font-semibold text-[var(--adf-ui-text)]",children:"Advanced"}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Autostart",e.jsx(We,{tip:"The mesh starts when the server starts. The Mesh switch does not change this."})]}),children:e.jsx(rt,{label:"Autostart",checked:c,onChange:p=>{pe({meshEnabled:p},d,p,c)}})}),e.jsx(ce,{separator:!0,label:"Port",description:k.running?"Apply restarts the mesh server on the new port.":"The mesh server uses this port when it starts.",error:I??void 0,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{"aria-label":"Port",inputMode:"numeric",value:w,disabled:V,"aria-invalid":!!I,onChange:p=>{X(p.target.value),R(null)},onKeyDown:p=>{p.key==="Enter"&&Oe()},className:"!w-24 !text-[12px]"}),e.jsx($,{size:"compact",disabled:V||w.trim()===String(b),onClick:()=>{Oe()},children:"Apply"})]})}),e.jsx(ce,{separator:!0,label:"Mesh server",description:k.running?`Running on ${Nd(k)}, port ${k.port}.`:"Stopped.",children:e.jsx("span",{"aria-hidden":"true",className:`block size-2 rounded-full ${k.running?"bg-[var(--adf-ui-success)]":"bg-[var(--adf-ui-danger)]"}`})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Tailscale",e.jsx(We,{tip:"Look for agent servers on the computers of your tailnet."})]}),children:e.jsx(rt,{label:"Tailscale",checked:x,onChange:p=>{D(p),i({tailnetDiscovery:p},()=>D(!p))}})}),e.jsx(ce,{separator:!0,stacked:!0,label:"Addresses",description:at?Ju(Y):W.hostname?e.jsx("span",{className:"font-mono",children:W.hostname}):void 0,help:h?void 0:"Other computers can reach these addresses when Network is on.",children:W.addresses.length>0&&e.jsx("div",{className:"space-y-1",children:W.addresses.map(p=>{const Ce=`http://${p.family==="IPv6"?`[${p.address}]`:p.address}:${k.port}`,it=k.running&&h;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"max-w-[140px] truncate rounded bg-[var(--adf-ui-surface-hover)] px-1.5 py-0.5 font-mono text-[11px] text-[var(--adf-ui-text-muted)]",title:p.iface,children:p.iface}),e.jsx("span",{className:"text-[11px] uppercase text-[var(--adf-ui-text-subtle)]",children:p.family}),it?e.jsx("a",{href:Ce,target:"_blank",rel:"noopener noreferrer",className:"truncate font-mono text-xs text-[var(--adf-ui-accent)] hover:underline",children:Ce}):e.jsx("span",{className:"truncate font-mono text-xs text-[var(--adf-ui-text-muted)]",children:p.address}),e.jsx("button",{onClick:()=>navigator.clipboard?.writeText(it?Ce:p.address),className:"ml-auto text-[11px] text-[var(--adf-ui-text-subtle)] hover:text-[var(--adf-ui-text)]",title:"Copy",children:"Copy"})]},`${p.iface}-${p.address}`)})})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["HTTPS",e.jsx(We,{tip:"tailscale serve gives this server an https address on your tailnet."})]}),description:a?zt(t):i0(xe),error:j??void 0,children:!a&&Z?.state==="running"&&Z.serve!=="unknown"&&e.jsx($,{size:"compact",disabled:T,onClick:()=>{Ke(Z.serve!=="on")},children:Z.serve==="on"?"Disable":"Enable"})}),e.jsx(c0,{lan:h||Me.length>0,restarting:V,hostName:a?t:null}),e.jsx(ce,{separator:!0,stacked:!0,label:"Endpoints",description:a?zt(t):De?`${U.length} ${U.length===1?"agent serves":"agents serve"} on the mesh.`:"Mesh is off.",children:De&&!a&&U.length>0&&e.jsx("ul",{className:"space-y-1",children:U.map(p=>{const F=k.running?Tr(k,`/agents/${encodeURIComponent(p.handle??"")}`,n?.kind==="remote"?n.url:null):null;return e.jsxs("li",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fs,{seed:Bs({did:p.did,filePath:p.filePath}),icon:p.icon,iconSeed:p.agentId||p.filePath,size:16,emojiSize:14}),e.jsx("span",{className:"truncate text-[13px] font-medium text-[var(--adf-ui-text)]",children:p.handle})]}),F&&e.jsx("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"block truncate font-mono text-[11px] text-[var(--adf-ui-accent)] hover:underline",children:F})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[p.publicEnabled&&e.jsx("span",{title:"Serves its public folder",className:"rounded bg-[var(--adf-ui-success-subtle)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-success)]",children:"Site"}),(p.apiRouteCount??0)>0&&e.jsxs("span",{className:"rounded bg-[var(--adf-ui-accent-subtle)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-accent)]",children:[p.apiRouteCount," route",p.apiRouteCount!==1?"s":""]}),(p.sharedCount??0)>0&&e.jsxs("span",{className:"rounded bg-[var(--adf-ui-surface-hover)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-text-muted)]",children:[p.sharedCount," ",p.sharedCount===1?"pattern":"patterns"]})]})]},p.filePath)})})})]})})]})}function u0(a,t,s){if(!a.running)return null;const r=[];t&&s.length>0&&r.push(`${s.length} active agent(s) may be interrupted.`);const n=a.users??[];return n.length>0&&r.push(`${n.join(", ")} also ${n.length===1?"uses":"use"} this container; ${n.length===1?"its":"their"} agents lose it until it starts again.`),r.length>0?`Stop ${a.name}? ${r.join(" ")}`:null}function h0({request:a,busy:t,onCancel:s,onConfirm:r}){if(!a)return null;const{container:n,action:i,activeAgents:l,isShared:c}=a,d=i==="rebuild",h=n.agentName||n.agentId,f=n.state==="failed";return e.jsxs(gt,{open:!0,onClose:s,title:d?`Rebuild ${n.name}?`:`Remove ${n.name}?`,children:[e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:f?d?"The last setup of this container failed and nothing is left of it. Rebuild creates a fresh container from the configured base image.":"The last setup of this container failed and nothing is left of it. Remove clears this entry.":d?"The container is deleted and recreated from the configured base image. Everything inside it is permanently lost:":"The container is permanently deleted. Everything inside it is lost:"}),f&&n.error&&e.jsx("p",{className:"mt-3 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-danger-subtle)] p-3 font-mono text-[11px] text-[var(--adf-ui-text)] break-words",children:n.error}),!f&&e.jsxs("ul",{className:"mt-3 space-y-1.5 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-danger-subtle)] p-3 text-[11px] text-[var(--adf-ui-text)]",children:[e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Workspace files"})," — everything under"," ",e.jsx("code",{className:"font-mono text-[11px]",children:"/workspace"}),h?e.jsxs(e.Fragment,{children:[" for ",h]}):null,". It is a directory inside the container, not a folder on this machine, so nothing is recoverable."]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Installed packages"})," — apt, pip, and npm installs made since the container was created."]}),e.jsxs("li",{children:[e.jsx("span",{className:"font-medium",children:"Running processes"})," — anything the agent left running, including browser sessions."]})]}),e.jsxs("p",{className:"mt-3 text-[11px] text-[var(--adf-ui-text-muted)]",children:[d&&(c||n.scope==="dedicated")?"A fresh container is created and provisioned now; this takes about a minute.":"A fresh container is created the next time the agent starts."," ","The agent definition, its identity, and the shared npm cache are not affected."]}),n.users&&n.users.length>0&&e.jsxs("p",{className:"mt-3 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-warning-subtle)] px-3 py-2 text-[11px] text-[var(--adf-ui-warning)]",children:[n.users.join(", ")," also ",n.users.length===1?"uses":"use"," this container. It is deleted anyway; the other runtime creates it again the next time it needs it."]}),l.length>0&&e.jsxs("p",{className:"mt-3 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-warning-subtle)] px-3 py-2 text-[11px] text-[var(--adf-ui-warning)]",children:[l.length," active agent",l.length===1?"":"s"," use this container and will be interrupted mid-run."]}),e.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[e.jsx($,{onClick:s,disabled:t,children:"Cancel"}),e.jsx($,{variant:"danger",loading:t,onClick:()=>r(a),children:d?"Delete and rebuild":"Delete permanently"})]})]})}function nn(a,t,s){return{dirty:s!==void 0&&s!==a,modified:a!==t}}function hs({label:a,value:t,defaultValue:s,draft:r,onDraft:n,onSave:i,onReset:l,rows:c}){const{dirty:d,modified:h}=nn(t,s,r),f=r??t;return e.jsxs("div",{children:[e.jsx(ms,{"aria-label":a,value:f,onChange:b=>n(b.target.value===t?void 0:b.target.value),rows:c,className:"font-mono text-xs resize-y"}),e.jsxs("div",{className:"mt-1.5 flex min-h-[26px] items-center gap-2",children:[d&&e.jsx("span",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:"Unsaved"}),e.jsx("span",{className:"flex-1"}),h&&!d&&e.jsx($,{onClick:l,variant:"ghost",size:"compact",children:"Reset"}),d&&e.jsxs(e.Fragment,{children:[e.jsx($,{onClick:()=>n(void 0),variant:"ghost",size:"compact",children:"Revert"}),e.jsx($,{onClick:()=>{i(f).then(b=>{b&&n(void 0)})},variant:"primary",size:"compact",children:"Save"})]})]})]})}function Nr({defaults:a,labels:t,conditions:s,values:r,drafts:n,onDraft:i,onSave:l,onReset:c,expandedKey:d,onToggle:h}){return e.jsx("div",{className:"space-y-1",children:Object.keys(a).map(f=>{const b=t[f]??f,C=s[f],_=d===f,E=r[f]??a[f]??"",{dirty:x,modified:D}=nn(E,a[f]??"",n[f]);return e.jsxs("div",{className:"overflow-hidden rounded-lg border border-[var(--adf-ui-border)]",children:[e.jsx("button",{onClick:()=>h(_?null:f),"aria-expanded":_,className:"flex w-full items-center justify-between px-3 py-2 text-left transition-colors hover:bg-[var(--adf-ui-surface-hover)]",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:_?"▼":"▶"}),e.jsx("span",{className:"text-xs font-medium text-[var(--adf-ui-text)]",children:b}),D&&e.jsx("span",{className:"rounded bg-[var(--adf-ui-warning-subtle)] px-1 py-0.5 text-[11px] text-[var(--adf-ui-warning)]",children:"Modified"}),x&&e.jsx("span",{className:"rounded bg-[var(--adf-ui-surface-hover)] px-1 py-0.5 text-[11px] text-[var(--adf-ui-text-muted)]",children:"Unsaved"})]})}),_&&e.jsxs("div",{className:"border-t border-[var(--adf-ui-separator)] px-3 pb-3",children:[C&&e.jsx("p",{className:"mt-2 text-[11px] italic text-[var(--adf-ui-text-subtle)]",children:C}),e.jsx("div",{className:"mt-2",children:e.jsx(hs,{label:`${b} instruction`,value:E,defaultValue:a[f]??"",draft:n[f],onDraft:k=>i(f,k),onSave:k=>l(f,k),onReset:()=>c(f),rows:10})})]})]},f)})})}const p0="Rebuilding adds network isolation from other agents. It erases this container's workspace files, installed packages and saved browser session; Rebuild is in the More actions menu.";function on(a){return a.endsWith("...")?"text-[var(--adf-ui-text-muted)]":"text-[var(--adf-ui-success)]"}const m0="Every agent gets the system prompt and tool instructions before its own instructions, unless its System prompt setting is No base prompt or Bare.",Sr=[...an,...Ea];function f0({section:a}){const t={appearance:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .34 1.88l.06.06-2.86 2.86-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 0-.4 1.1V21H9.55v-.09A1.7 1.7 0 0 0 8.5 19.4a1.7 1.7 0 0 0-1.88.34l-.06.06-2.86-2.86.06-.06A1.7 1.7 0 0 0 4.1 15a1.7 1.7 0 0 0-1.5-1H2.5V10h.1a1.7 1.7 0 0 0 1.5-1 1.7 1.7 0 0 0-.34-1.88l-.06-.06L6.56 4.2l.06.06A1.7 1.7 0 0 0 8.5 4.6a1.7 1.7 0 0 0 1-1.5V3h4.05v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.88-.34l.06-.06 2.86 2.86-.06.06A1.7 1.7 0 0 0 19.6 9a1.7 1.7 0 0 0 1.5 1h.1v4h-.1a1.7 1.7 0 0 0-1.7 1Z"})]}),identity:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"8",r:"4"}),e.jsx("path",{d:"M4.5 21a7.5 7.5 0 0 1 15 0"})]}),agents:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M4 17V7l4 3 4-3v10"}),e.jsx("path",{d:"M15 8h5M15 12h5M15 16h5"})]}),template:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9l-6-6Z"}),e.jsx("path",{d:"M14 3v6h6"}),e.jsx("path",{d:"M12 12v6M9 15h6"})]}),providers:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M8 12h8"}),e.jsx("path",{d:"M12 8v8"}),e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})]}),packages:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Z"}),e.jsx("path",{d:"m4.5 7.7 7.5 4.2 7.5-4.2M12 12v9"})]}),mcps:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M8 7V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M8 17v2a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-2"}),e.jsx("rect",{x:"4",y:"7",width:"16",height:"10",rx:"2"})]}),skills:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M4 5.5A2.5 2.5 0 0 1 6.5 3H19v15H6.5A2.5 2.5 0 0 0 4 20.5Z"}),e.jsx("path",{d:"M4 20.5A2.5 2.5 0 0 1 6.5 18H19v3H6.5"}),e.jsx("path",{d:"M9 7.5h6"})]}),channels:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M21 15a4 4 0 0 1-4 4H8l-5 3V7a4 4 0 0 1 4-4h10a4 4 0 0 1 4 4Z"}),e.jsx("path",{d:"M8 9h8M8 13h5"})]}),networking:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"2"}),e.jsx("path",{d:"M5.6 8.5a7.5 7.5 0 0 1 12.8 0M2.6 5.5a11.5 11.5 0 0 1 18.8 0M8.6 15.5a4 4 0 0 1 6.8 0"})]}),compute:e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),connection:e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"6",rx:"1.5"}),e.jsx("rect",{x:"4",y:"14",width:"16",height:"6",rx:"1.5"}),e.jsx("path",{d:"M8 7h.01M8 17h.01"})]}),notifications:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 8 3 8H3s3-1 3-8"}),e.jsx("path",{d:"M10.3 21a1.9 1.9 0 0 0 3.4 0"})]}),updates:e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M12 4v12"}),e.jsx("path",{d:"m6 10 6 6 6-6"}),e.jsx("path",{d:"M4 20h16"})]}),privacy:e.jsx(e.Fragment,{children:e.jsx("path",{d:"M12 3 4 6v6c0 5 3.4 8.3 8 9 4.6-.7 8-4 8-9V6l-8-3Z"})}),files:e.jsx(e.Fragment,{children:e.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"})}),usage:e.jsx(e.Fragment,{children:e.jsx("path",{d:"M4 20V10M10 20V4M16 20v-7M22 20H2"})}),about:e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 8h.01"})]})};return e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t[a]})}function x0(a,t){if(t)return`Studio's own secrets, in its settings file on this computer, not ${t}'s. ${t} keeps its secrets on that computer; nothing here moves or changes them.`;if(a.scope==="studio-copies")return`Agents run on the ADF daemon, which keeps its own secrets. Studio's settings file still holds ${a.storedSecrets} secret${a.storedSecrets===1?"":"s"} of its own (kept from Inside Studio).`}function g0({view:a,remoteName:t=null,onUseKeyring:s,onCheckAgain:r}){const[n,i]=o.useState(!1),[l,c]=o.useState(null),d=a.policy==="plaintext",h=async()=>{i(!0),c(null);try{const f=await s();c(f?.success?{ok:!0,message:`Secrets are now encrypted with the system keychain (${f.encrypted??0} encrypted). Your identity is unchanged.`}:{ok:!1,message:f?.error??"Switching to the system keychain failed. Nothing was changed."})}finally{i(!1)}};return e.jsx("div",{"data-settings-anchor":"secret-storage",children:e.jsxs(Re,{title:"Secret storage",hint:"Your owner seed phrase, this runtime's keys and app-level MCP sign-ins, as Studio stores them in adf-settings.json. Provider API keys and MCP server settings are ordinary settings and are not covered.",description:x0(a,t),docs:Se.settingsIdentity,children:[e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Stored",d?e.jsx(qt,{tone:"bad",children:"Unencrypted"}):e.jsx(qt,{tone:a.keyringAvailable?"ok":"warn",children:a.keyringAvailable?"Encrypted":"Keychain unavailable"})]}),description:d?"Unencrypted on this computer, as you chose.":"Encrypted with the system keychain.",error:d?"Anyone, and any program, that can read your files or a backup of them can copy your seed phrase and keys and act as you.":a.writesBlocked?"The system keychain is not available: Studio cannot read these secrets or save new ones until it is. Nothing is stored unencrypted.":void 0,help:d&&a.plaintextSecrets>0?`${a.plaintextSecrets} secret${a.plaintextSecrets===1?"":"s"} stored as plain text now.`:void 0,children:d&&e.jsx($,{variant:"primary",onClick:()=>{h()},disabled:n||!a.keyringAvailable,children:n?"Encrypting…":"Encrypt with Keychain"})}),d&&!a.keyringAvailable&&e.jsx(ce,{separator:!0,label:"Switch back",description:"Set up and unlock your system keychain, then check again: Encrypt with Keychain becomes available.",children:e.jsx($,{onClick:r,children:"Check Again"})}),l&&e.jsx("div",{className:`border-t border-[var(--adf-ui-separator)] px-4 py-2 text-[12px] ${l.ok?"text-[var(--adf-ui-success)]":"text-[var(--adf-ui-danger)]"}`,role:"status",children:l.message})]})})}function Ga({copyKey:a,value:t,copied:s,onCopy:r}){return e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"min-w-0 flex-1 break-all rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-canvas)] px-2 py-1.5 font-mono text-[12px] text-[var(--adf-ui-text)]",children:t??"Not generated yet"}),t&&e.jsx($,{onClick:()=>r(a,t),variant:"ghost",size:"compact",children:s===a?"Copied":"Copy"})]})}function qt({tone:a,children:t}){const s={ok:"bg-[var(--adf-ui-success-subtle)] text-[var(--adf-ui-success)]",warn:"bg-[var(--adf-ui-warning-subtle)] text-[var(--adf-ui-warning)]",bad:"bg-[var(--adf-ui-danger-subtle)] text-[var(--adf-ui-danger)]"};return e.jsx("span",{className:`ml-2 rounded px-1.5 py-0.5 text-[11px] font-medium ${s[a]}`,children:t})}function v0({remote:a,runtimeName:t}){const s=nt(),r=Rr(ps()),[n,i]=o.useState(null),[l,c]=o.useState(null),[d,h]=o.useState(null),[f,b]=o.useState(!1),[C,_]=o.useState(null),[E,x]=o.useState(null),[D,k]=o.useState(!1),[q,U]=o.useState("import"),[L,W]=o.useState(""),[A,V]=o.useState(!1),[ie,w]=o.useState(null),[X,I]=o.useState(""),[R,K]=o.useState(""),[J,ae]=o.useState(!1),se=o.useRef({owner:"",runtime:""}),{commit:Y}=Pt(),z=(G,fe)=>{const Ee=fe.trim(),ge=se.current[G],Ie=G==="owner"?I:K;if(Ee===ge){Ie(ge);return}Ie(Ee),se.current[G]=Ee,Y(G==="owner"?{ownerAlias:Ee}:{runtimeAlias:Ee},()=>{se.current[G]=ge,Ie(ge)})},[re,he]=o.useState(null),H=o.useCallback(()=>{s?.getOwnerIdentityStatus().then(i),s?.getStudioSecretStorage?.().then(he),s?.getMeshServerStatus().then(c),s?.getSettings?.().then(G=>{const fe=G;se.current={owner:fe?.ownerAlias??"",runtime:fe?.runtimeAlias??""},I(fe?.ownerAlias??""),K(fe?.runtimeAlias??""),ae(fe?.shareOwnerIdentity===!0)})},[]);o.useEffect(()=>{H()},[H]);const ne=(G,fe)=>{fe&&(navigator.clipboard.writeText(fe),h(G),setTimeout(()=>h(null),1500))},xe=async()=>{const G=await s?.revealOwnerMnemonic();_(G?.mnemonic??null),x(G?.reason??null),b(!0)},g=async()=>{await s?.confirmOwnerBackup(),b(!1),_(null),H()},[T,ee]=Wt(),j=async()=>{if(!(q==="import"&&!await ee({title:"Replace owner",body:"Your owner DID changes to the identity of this seed phrase, and every agent file you own on this computer is restamped to it. Peers that trust your current DID no longer recognise you.",confirmLabel:"Replace owner",danger:!0}))){V(!0),w(null);try{const G=q==="restore"?n?.ownerDid:void 0,fe=await s?.importOwnerMnemonic(L,G);fe?.success?(w({ok:!0,message:`Identity ${G?"restored":"imported"}. ${fe.restamped??0} agent file(s) restamped${fe.failures?.length?`, ${fe.failures.length} failed`:""}.`}),W(""),H()):w({ok:!1,message:fe?.error??"Import failed"})}finally{V(!1)}}},me=l?.running?Tr(l,"/agents",r?.kind==="remote"?r.url:null):void 0;return e.jsxs(e.Fragment,{children:[n?.restoreRequired&&e.jsx("div",{"data-settings-anchor":"restore-identity",children:e.jsx(Re,{title:"Restore identity",description:"Enter this owner's 12 words to use it here; Studio never creates a new owner or restamps your agents for this.",hint:"This computer's owner was set up in the ADF terminal, and Studio cannot read its seed phrase.",children:e.jsx(ce,{label:"Owner",description:e.jsx("span",{className:"font-mono break-all",children:n.ownerDid}),children:a?e.jsx("span",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:zt(t)}):e.jsx($,{variant:"primary",onClick:()=>{U("restore"),k(!0),w(null)},children:"Restore identity"})})})}),re&&e.jsx(g0,{view:re,remoteName:a?t:null,onCheckAgain:H,onUseKeyring:async()=>{const G=await s?.useKeyringForSecrets();return H(),G}}),e.jsxs(Re,{title:"Owner identity",hint:"Who you are. Rooted in a 12-word seed phrase generated on first launch; import the same phrase on another computer to be the same owner there. Stamped into agent files you claim or clone, and used to sign ownership attestations for your agents.",docs:Se.settingsIdentity,children:[e.jsx(ce,{label:"DID",stacked:!0,help:n&&n.legacyOwnerDids.length>0?e.jsxs(e.Fragment,{children:["Previous: ",e.jsx("span",{className:"font-mono break-all",children:n.legacyOwnerDids.join(", ")})]}):void 0,children:e.jsx(Ga,{copyKey:"owner",value:n?.ownerDid,copied:d,onCopy:ne})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Alias",e.jsx(We,{tip:"A name peers see for you. Display only: trust and allow lists always use the DID."})]}),children:e.jsx(ze,{"aria-label":"Owner alias",type:"text",value:X,maxLength:40,onChange:G=>I(G.target.value),onBlur:()=>z("owner",X),onKeyDown:G=>{G.key==="Enter"&&G.currentTarget.blur()},placeholder:"A name peers will see",className:"!w-64 !text-[12px]"})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Sharing",e.jsx(We,{tip:"Off by default. On: discoverable peers see your owner alias and can verify that your runtimes share one owner, so several computers you own read as yours. This links your runtimes together publicly."})]}),description:"Share the owner identity on the mesh.",children:e.jsx(rt,{label:"Sharing",checked:J,onChange:G=>{ae(G),Y({shareOwnerIdentity:G},()=>ae(!G))}})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Seed phrase",n?.hasMnemonic&&(n.backupConfirmed?e.jsx(qt,{tone:"ok",children:"Backed up"}):e.jsx(qt,{tone:"warn",children:"Not backed up"}))]}),children:a?e.jsx("span",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:zt(t)}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx($,{onClick:xe,disabled:!n?.hasMnemonic,variant:"primary",children:"Back up seed phrase"}),e.jsx($,{onClick:()=>{U("import"),k(!0),w(null)},children:"Import identity"})]})})]}),e.jsxs(Re,{title:"Server key",hint:"Identifies this server to other servers. Two servers never share one.",children:[e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["DID",n&&(n.runtimeDelegationValid?e.jsx(qt,{tone:"ok",children:"Delegation valid"}):e.jsx(qt,{tone:"bad",children:"No valid delegation"}))]}),stacked:!0,help:n?.runtimeDelegation||n&&n.legacyRuntimeDids.length>0?e.jsxs(e.Fragment,{children:[n?.runtimeDelegation&&e.jsxs(e.Fragment,{children:["Delegation signed by ",e.jsx("span",{className:"font-mono break-all",children:n.runtimeDelegation.issuer})," on ",new Date(n.runtimeDelegation.issued_at).toLocaleDateString(),". "]}),n&&n.legacyRuntimeDids.length>0&&e.jsxs(e.Fragment,{children:["Previous: ",e.jsx("span",{className:"font-mono break-all",children:n.legacyRuntimeDids.join(", ")})]})]}):void 0,children:e.jsx(Ga,{copyKey:"runtime",value:n?.runtimeDid,copied:d,onCopy:ne})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Alias",e.jsx(We,{tip:"Other servers see this name when this server is discoverable (Networking → Network, or Tailscale). Blank: the host name."})]}),children:e.jsx(ze,{"aria-label":"Runtime alias",type:"text",value:R,maxLength:40,onChange:G=>K(G.target.value),onBlur:()=>z("runtime",R),onKeyDown:G=>{G.key==="Enter"&&G.currentTarget.blur()},placeholder:"A name for this server",className:"!w-64 !text-[12px]"})}),!a&&e.jsx(ce,{separator:!0,stacked:!0,label:e.jsxs(e.Fragment,{children:["Directory",e.jsx(We,{tip:"Lists the agent cards that this server serves. Each requester sees only what its visibility scope allows. Other servers fetch it to find your agents."})]}),help:l?.running?void 0:"The mesh server is not running; start it in Networking to serve agent cards.",children:e.jsx(Ga,{copyKey:"directory",value:me,copied:d,onCopy:ne})})]}),e.jsx(Re,{title:"Agent identities",description:"Each agent has its own DID and keys, in its Identity tab.",hint:"To let mesh peers verify you own an agent, turn on Publish owner attestation in its Config → Security. It is off by default, so agents cannot be linked to you by card inspection.",docs:Se.identity,children:e.jsx("span",{})}),T,e.jsxs(gt,{open:f,onClose:()=>{b(!1),_(null)},title:"Back up seed phrase",children:[e.jsx("p",{className:"text-sm text-[var(--adf-ui-text-muted)] mb-3",children:"Write these 12 words down and keep them somewhere safe. Anyone with them can act as you; without them, your owner identity cannot be recovered if this computer is lost."}),C?e.jsx("div",{className:"grid grid-cols-3 gap-1.5 mb-4",children:C.split(" ").map((G,fe)=>e.jsxs("div",{className:"px-2 py-1.5 text-sm font-mono rounded bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text)]",children:[e.jsx("span",{className:"text-[11px] text-[var(--adf-ui-text-subtle)] mr-1.5 select-none",children:fe+1}),G]},fe))}):e.jsx("p",{className:"text-sm text-[var(--adf-ui-danger)] mb-4",children:E??"No seed phrase available."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx($,{onClick:()=>ne("mnemonic",C??void 0),disabled:!C,variant:"ghost",children:d==="mnemonic"?"Copied":"Copy phrase"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx($,{onClick:()=>{b(!1),_(null)},children:"Cancel"}),e.jsx($,{onClick:g,disabled:!C,variant:"primary",children:"I have written it down"})]})]})]}),e.jsxs(gt,{lightDismiss:!1,open:D,onClose:()=>k(!1),title:q==="restore"?"Restore identity":"Import identity",children:[q==="restore"?e.jsxs("p",{className:"text-sm text-[var(--adf-ui-text-muted)] mb-3",children:["Enter the 12-word seed phrase of ",e.jsx("span",{className:"font-mono break-all",children:n?.ownerDid}),", the words shown when it was created in the ADF terminal (",e.jsx("span",{className:"font-mono",children:"adf identity new"}),"). A phrase for a different owner is refused."]}):e.jsx("p",{className:"text-sm text-[var(--adf-ui-text-muted)] mb-3",children:"Enter the 12-word seed phrase from another computer. Your owner DID changes to the imported identity, and agent files you own on this computer are restamped to it."}),e.jsx(ms,{"aria-label":"Seed phrase",value:L,onChange:G=>{W(G.target.value),w(null)},rows:3,placeholder:"word1 word2 word3 ...",className:"mb-2 font-mono text-sm resize-none"}),ie&&e.jsx("p",{className:`text-xs mb-2 ${ie.ok?"text-[var(--adf-ui-success)]":"text-[var(--adf-ui-danger)]"}`,children:ie.message}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx($,{onClick:()=>k(!1),children:"Close"}),e.jsx($,{onClick:j,disabled:!L.trim()||A,loading:A,variant:"primary",children:A?q==="restore"?"Restoring...":"Importing...":q==="restore"?"Restore":"Import"})]})]})]})}function b0(){const a=nt(),[t,s]=o.useState(null),[r,n]=o.useState(""),[i,l]=o.useState(null);o.useEffect(()=>{(async()=>{const E=await a?.getSettings?.();s(Ei(E?.skillCatalogSources))})()},[]);const{commit:c,offerUndo:d}=Pt(),h=o.useCallback(async E=>{const x=t;s(E),await c({skillCatalogSources:E},()=>s(x))},[c,t]),f=o.useCallback(async E=>{const x=Pi(t??[],E);if(!x.ok){l(x.error);return}l(null),n(""),await h(x.sources)},[h,t]),b=t??[],C=b.length>=Hs,_=b.includes($a);return e.jsxs(Re,{title:"Catalog sources",description:e.jsxs(e.Fragment,{children:["Where the Skills panel's browser looks for installable skills. A catalog is discovery metadata only — installing writes ",e.jsx("span",{className:"font-mono",children:"skills/<name>/SKILL.md"})," into the open agent and nothing else. No tools, files, or approvals are ever granted by one."]}),children:[e.jsxs(ce,{label:"Sources",description:"All fetched together each time the browser opens, in this order. A name published by more than one catalog resolves to the first source that lists it.",stacked:!0,children:[t!==null&&b.length===0?e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:"No catalog sources. The skill browser will have nothing to list until you add one."}):e.jsx("ul",{className:"space-y-1",children:b.map(E=>e.jsxs("li",{className:"flex items-center gap-2 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-raised)] px-2.5 py-1.5",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-[var(--adf-ui-text)]",title:E,children:E}),E===$a&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--adf-ui-surface-hover)] px-1.5 py-0.5 text-[11px] font-medium text-[var(--adf-ui-text-subtle)]",children:"Default"}),e.jsx(pt,{onClick:()=>{const x=b;h(b.filter(D=>D!==E)).then(()=>d(`Removed ${E}.`,()=>{h(x)}))},"aria-label":`Remove catalog source ${E}`,title:"Remove source",variant:"danger",children:"✕"})]},E))}),t!==null&&!_&&!C&&e.jsx("button",{type:"button",onClick:()=>{f($a)},className:"mt-1.5 text-[11px] text-[var(--adf-ui-accent)] hover:underline cursor-pointer",children:"Add default registry"})]}),e.jsx(ce,{label:"Add a source",description:"Any https URL serving a skill catalog document. Entries that fail validation are dropped individually, and a source that cannot be reached is reported in the browser without hiding the others.",error:i,help:C?`Remove one first — at most ${Hs} catalog sources.`:void 0,separator:!0,stacked:!0,children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ze,{value:r,onChange:E=>{n(E.target.value),l(null)},onKeyDown:E=>{E.key==="Enter"&&f(r)},"aria-label":"Catalog source URL",placeholder:"https://example.com/skills/registry.json",spellCheck:!1,disabled:C,className:"!text-[12px] font-mono"}),e.jsx($,{onClick:()=>{f(r)},disabled:C,children:"Add source"})]})})]})}function y0({sandboxPackages:a,setSandboxPackages:t,sandboxMaxWorkers:s,setSandboxMaxWorkers:r}){const n=nt(),[i,l]=o.useState(""),[c,d]=o.useState(""),[h,f]=o.useState(null),[b,C]=o.useState(null),[_,E]=o.useState([]),{offerUndo:x}=Pt(),D=o.useRef(a);D.current=a;const k=o.useCallback(()=>{n?.listInstalledSandboxPackages().then(A=>{E(A?.packages??[])})},[]);o.useEffect(()=>{k()},[k]);const q=new Set(a.map(A=>A.name)),U=_.filter(A=>!q.has(A.name)),L=async()=>{if(i.trim()){if(a.some(A=>A.name===i.trim())){C("Package already added");return}f(i.trim()),C(null);try{const V=(await n?.installSandboxPackages([{name:i.trim(),version:c.trim()||"latest"}]))?.results?.[i.trim()];V?.success?(t([...a,{name:i.trim(),version:V.version??(c.trim()||"latest")}]),l(""),d(""),k()):C(V?.error??"Install failed")}catch(A){C(String(A))}f(null)}},W=A=>{t(a.filter(V=>V.name!==A.name)),x(`Removed ${A.name}. Agents that import it fail until it is back.`,()=>{D.current.some(V=>V.name===A.name)||t([...D.current,A])})};return e.jsxs(e.Fragment,{children:[e.jsx(Re,{title:"Sandbox",docs:Se.codeExecution,children:e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Workers",e.jsx(We,{tip:"Most sandbox workers running lambdas at once, across all agents. Each is a JavaScript isolate of about 5 MB; executions above the ceiling wait for a free slot. 0 is automatic: half this computer's CPU cores, from 4 to 32."})]}),description:"0 is automatic.",children:e.jsx(sa,{"aria-label":"Workers",inputMode:"numeric",value:String(s),onCommit:A=>{const V=It(A,0,256);V.ok&&r(V.value)},check:A=>{const V=It(A,0,256);return V.ok?null:V.error},className:"!w-24 !text-[12px]"})})}),e.jsxs(Re,{title:"Packages",description:"Available to every agent; pure JavaScript only.",children:[a.length>0&&e.jsx("ul",{className:"border-t border-[var(--adf-ui-separator)]",children:a.map(A=>e.jsxs("li",{className:"flex items-center justify-between gap-2 border-b border-[var(--adf-ui-separator)] px-4 py-2 last:border-b-0",children:[e.jsxs("span",{className:"min-w-0 truncate font-mono text-[12px] text-[var(--adf-ui-text)]",children:[A.name,e.jsxs("span",{className:"text-[var(--adf-ui-text-subtle)]",children:["@",A.version]})]}),e.jsx(pt,{onClick:()=>W(A),"aria-label":`Remove ${A.name}`,variant:"danger",title:"Remove",children:"×"})]},A.name))}),e.jsx(ce,{separator:!0,label:"Add",error:b,children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ze,{"aria-label":"Package name","aria-invalid":!!b,type:"text",value:i,onChange:A=>{l(A.target.value),C(null)},onKeyDown:A=>{A.key==="Enter"&&L()},placeholder:"vega-lite",spellCheck:!1,className:"!w-44 font-mono !text-[12px]"}),e.jsx(ze,{"aria-label":"Package version","aria-invalid":!!b,type:"text",value:c,onChange:A=>{d(A.target.value),C(null)},onKeyDown:A=>{A.key==="Enter"&&L()},placeholder:"latest",spellCheck:!1,className:"!w-24 font-mono !text-[12px]"}),e.jsx($,{onClick:L,disabled:!i.trim()||!!h,loading:!!h,variant:"primary",size:"compact",className:"whitespace-nowrap",children:h?"Installing...":"Install"})]})})]}),U.length>0&&e.jsx(Re,{title:"Installed by agents",description:"On disk; an agent uses one when its config lists it.",hint:"Installed by individual agents with npm_install. Promote installs one for every agent.",children:e.jsx("ul",{className:"border-t border-[var(--adf-ui-separator)]",children:U.map(A=>e.jsxs("li",{className:"flex items-center justify-between gap-2 border-b border-[var(--adf-ui-separator)] px-4 py-2 last:border-b-0",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:"truncate font-mono text-[12px] text-[var(--adf-ui-text)]",children:[A.name,e.jsxs("span",{className:"text-[var(--adf-ui-text-subtle)]",children:["@",A.version]})]}),A.installedBy&&e.jsx("span",{className:"shrink-0 rounded bg-[var(--adf-ui-surface-hover)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-text-muted)]",children:A.installedBy})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--adf-ui-text-subtle)]",children:[A.size_mb," MB"]}),e.jsx(qe,{tip:"Install for every agent",children:e.jsx($,{onClick:()=>{t([...a,{name:A.name,version:A.version}])},variant:"ghost",size:"compact",className:"whitespace-nowrap",children:"Promote"})})]})]},A.name))})})]})}function K0(){const a=fs(),[t,s]=o.useState(pi),r=qs(f=>f.requested);o.useEffect(()=>{if(r===null)return;const f=qs.getState().take();f&&s(f)},[r]);const n=a.some(f=>f.id===t)?t:ra,[i,l]=o.useState("appearance"),[c,d]=o.useState(""),h=Ea.some(f=>f.id===i);return e.jsx(mi,{runtimeId:n,children:e.jsxs(fi,{api:h?Fi(n):window.adfApi,children:[e.jsx(j0,{runtimeId:n,onPick:s,activeTab:i,setActiveTab:l,settingsSearch:c,setSettingsSearch:d},n),e.jsx(xi,{})]})})}function j0({runtimeId:a,onPick:t,activeTab:s,setActiveTab:r,settingsSearch:n,setSettingsSearch:i}){const l=nt(),{commit:c,track:d,offerUndo:h}=Pt(),[f,b]=Wt(),[C,_]=o.useState([]),[E,x]=o.useState(!1),[D,k]=o.useState(void 0),[q,U]=o.useState(""),[L,W]=o.useState(""),[A,V]=o.useState({}),[ie,w]=o.useState(null),[X,I]=o.useState({}),R=(m,M)=>I(te=>{const{[m]:Ae,...Ne}=te;return M===void 0?Ne:{...Ne,[m]:M}}),[K,J]=o.useState(!1),[ae,se]=o.useState([]),[Y,z]=o.useState([]),re=gi(),he=fs(),H=he.length>1,ne=H?he.find(m=>m.id===a)??null:re,xe=ne?.kind==="remote",g=ne?.name??"the runtime",T=Ku(),ee=a===ra?void 0:a,[j,me]=o.useState(""),[G,fe]=o.useState(!1),[Ee,ge]=o.useState(!1),[Ie,Ge]=o.useState([]),[$e,ye]=o.useState({}),De=o.useRef([]);o.useEffect(()=>{De.current=ae},[ae]);const Be=o.useRef([]),u=o.useRef({});o.useEffect(()=>{Be.current=Ie},[Ie]),o.useEffect(()=>{u.current=$e},[$e]);const[S,O]=o.useState({status:"stopped",activeAgents:[]}),[pe,ue]=o.useState("python3, python3-pip, git, curl"),[Oe,we]=o.useState(2),[Pe,Fe]=o.useState(2048),[v,oe]=o.useState("docker.io/library/node:20-alpine"),[He,Ke]=o.useState([]),[Me,tt]=o.useState(!0),[at,xt]=o.useState(!0),[N,Z]=o.useState(!0),[ve,p]=o.useState(!0),[F,Ce]=o.useState(!0),[it,Ot]=o.useState(!1),[y,P]=o.useState(null),[be,Qe]=o.useState(!1),[ot,js]=o.useState([]),[ks,ws]=o.useState(0),Ns=Ye(m=>m.theme),ln=Ye(m=>m.setTheme),cn=Ye(m=>m.chatWidth),ha=Ye(m=>m.uiFont),dn=Ye(m=>m.setUiFont),Rt=Ye(m=>m.uiFontCustom),un=Ye(m=>m.setUiFontCustom),Ss=Ye(m=>m.uiScale),hn=Ye(m=>m.setUiScale),Cs=Ye(m=>m.agentAvatars),pn=Ye(m=>m.setAgentAvatars),[As,_s]=o.useState(Rt);o.useEffect(()=>_s(Rt),[Rt]);const mn=Ye(m=>m.setChatWidth),fn=Ye(m=>m.setShowSettings),Es=Ye(m=>m.consumePendingSettingsSection),Ra=o.useRef(!1),pa=o.useRef(void 0),Gt=o.useRef(null),Ta=o.useRef({providers:[],defaultProviderId:void 0}),ma=o.useRef({providers:[],defaultProviderId:void 0,mcpServers:[],adapters:[]}),[xn,gn]=o.useState(null),fa=o.useRef(null),Ma=Sr.find(m=>m.id===s)??Sr[0],Ps=Ea.some(m=>m.id===s),Rs=Ps&&vi(ne),Ts=n.trim().toLowerCase(),xa=Ts?T.map(m=>({...m,items:m.items.filter(M=>`${M.label} ${M.description} ${M.keywords}`.toLowerCase().includes(Ts))})).filter(m=>m.items.length>0):T;o.useEffect(()=>{const m=Es();m&&r(Fu(m,Ye.getState().pendingSettingsAnchor))},[Es]),o.useEffect(()=>{fa.current?.scrollTo({top:0})},[s]);const La=Ye(m=>m.pendingSettingsAnchor);o.useEffect(()=>{if(!La)return;const m=()=>{const jt=fa.current,$s=jt?.querySelector(`[data-settings-anchor="${La}"]`);if(!jt||!$s)return!1;const Tn=$s.getBoundingClientRect().top-jt.getBoundingClientRect().top+jt.scrollTop-12;return jt.scrollTo({top:Math.max(0,Tn)}),!0};let M=0,te=0,Ae,Ne;const Ue=fa.current,Xe=()=>{Ae?.disconnect(),Ae=void 0,Ne&&clearTimeout(Ne),Ue?.removeEventListener("wheel",Xe),Ue?.removeEventListener("touchstart",Xe),Ye.getState().consumePendingSettingsAnchor()},ut=()=>{if(m()){const jt=Ue?.firstElementChild;Ue&&jt&&typeof ResizeObserver<"u"?(Ae=new ResizeObserver(()=>{m()}),Ae.observe(jt),Ue.addEventListener("wheel",Xe,{passive:!0}),Ue.addEventListener("touchstart",Xe,{passive:!0}),Ne=setTimeout(Xe,2500)):Xe();return}++M<30?te=requestAnimationFrame(ut):Xe()};return te=requestAnimationFrame(ut),()=>{cancelAnimationFrame(te),(Ae||Ne)&&Xe()}},[La,s]),o.useEffect(()=>{const m=M=>{tt(M.nativeNotificationsEnabled!==!1),xt(M.menuBarEnabled!==!1),Z(M.updateChecksEnabled!==!1),p(M.remoteCatalogsEnabled!==!1),Ce(M.providerChecksEnabled!==!1),Ot(M.spellcheckDownloadsEnabled===!0)};a!==ra&&window.adfApi?.getSettings().then(M=>m(M)).catch(M=>console.warn("[Settings] The settings of the local runtime were not read:",M)),l?.getSettings().then(M=>{const te=M.providers??[];_(te),Ta.current={providers:te,defaultProviderId:M.defaultProviderId||void 0};const Ae=M.defaultProviderId??void 0;Ae&&te.some(Ue=>Ue.id===Ae)?k(Ae):te.length>0?k(te[0].id):k(void 0),se(M.mcpServers??[]),ma.current=Mr(M),z(M.adapters??[]),U(M.globalSystemPrompt??ta),W(M.compactionPrompt??ea),V(M.toolPrompts??{...Xt,...Jt}),J(M[Ka]===!0),a===ra&&m(M),js(M.sandboxPackages??[]),ws(M.sandboxMaxWorkers??0),me(M.agentsFolder??"");const Ne=M.compute;Ne&&(fe(!!Ne.hostAccessEnabled),ge(Ne.mcpOnHost===!0),Ge(Ne.hostApproved??[]),Be.current=Ne.hostApproved??[],ye(Ne.hostApprovedSources??{}),u.current=Ne.hostApprovedSources??{},Ne.containerPackages&&ue(Ne.containerPackages.join(", ")),Ne.machineCpus&&we(Ne.machineCpus),Ne.machineMemoryMb&&Fe(Ne.machineMemoryMb),Ne.containerImage&&oe(Ne.containerImage),Ke(Ne.executionTargets??[])),Ra.current=!0,x(!0)})},[]);const Ms=o.useRef(ma.current);Ms.current={providers:C,defaultProviderId:D,mcpServers:ae,adapters:Y};const vn=async()=>{if(!Ra.current)return;const m={providers:C,defaultProviderId:D,mcpServers:ae,adapters:Y},M=await Cl(ma.current,m,async()=>await l.getSettings()),te={providers:M.providers,defaultProviderId:M.defaultProviderId},Ne=Ci(async()=>{const Ue=await l?.setSettings({providers:M.providers,defaultProviderId:M.defaultProviderId,mcpServers:M.mcpServers,adapters:M.adapters}),Xe=Mi(Ue);if(!Xe.ok)throw new Error(Xe.error)},Ta.current,te).then(Ue=>{if(Ue.saved){Ta.current=te,ma.current=M;const Xe=Ms.current,ut=Lr(m,Xe,M);Oa(ut.providers,Xe.providers)||_(ut.providers),ut.defaultProviderId!==Xe.defaultProviderId&&k(ut.defaultProviderId),Oa(ut.mcpServers,Xe.mcpServers)||se(ut.mcpServers),Oa(ut.adapters,Xe.adapters)||z(ut.adapters)}return gn(Ue.failure),Ue.saved?{ok:!0}:{ok:!1,error:Ue.error??"The settings could not be saved."}});return ht(),d(Ne)};Gt.current=vn,o.useEffect(()=>{if(Ra.current)return clearTimeout(pa.current),pa.current=setTimeout(()=>{Gt.current?.()},500),()=>clearTimeout(pa.current)},[C,D,ae,Y]),o.useEffect(()=>()=>{Gt.current&&Gt.current()},[]);const bn=o.useCallback(async()=>{clearTimeout(pa.current),await Gt.current?.()},[]),Je=(m,M,te,Ae)=>(M(te),c(m,()=>M(Ae))),bt=(m,M,te,Ae)=>(M(te),ht(),c({compute:{[m]:te}},()=>M(Ae))),yn=m=>Je({sandboxPackages:m},js,m,ot),jn=m=>Je({sandboxMaxWorkers:m},ws,m,ks),kn=async m=>{if(!await b({...ba,body:`${ba.body} ${m.name} is approved to run on the host.`}))return;const M={hostApproved:Be.current,hostApprovedSources:u.current},te=Ai(m.name,_i(m),!0,M),Ae={enabled:G,approved:M.hostApproved,sources:M.hostApprovedSources},Ne=Ue=>{Be.current=Ue.approved,u.current=Ue.sources,fe(Ue.enabled),Ge(Ue.approved),ye(Ue.sources)};Ne({enabled:!0,approved:te.hostApproved??Ae.approved,sources:te.hostApprovedSources??Ae.sources}),ht(),await c({compute:te},()=>Ne(Ae))},Ls=()=>{const m={host:G,mcp:Ee};return fe(!0),ge(!0),ht(),c({compute:{hostAccessEnabled:!0,mcpOnHost:!0}},()=>{fe(m.host),ge(m.mcp)})},Is=(m,M)=>{const te={approved:Be.current,sources:u.current},Ae=Ne=>{Be.current=Ne.approved,u.current=Ne.sources,Ge(Ne.approved),ye(Ne.sources)};return Ae({approved:m,sources:M}),ht(),c({compute:{hostApproved:m,hostApprovedSources:M}},()=>Ae(te))},wn=m=>{Je({theme:m},ln,m,Ns)},Nn=m=>{Je({agentAvatars:m},pn,m,Cs)},Sn=m=>{Je({uiFont:m},dn,m,ha)},Cn=()=>{const m=As.trim();m!==Rt&&Je({uiFontCustom:m},un,m,Rt)},An=m=>{const M=Number(m);Je({uiScale:M},hn,M,Ss)},_n=async()=>{const M=(await l?.pickDirectory?.())?.path;M&&Je({agentsFolder:M},me,M,j)},En=()=>{Je({agentsFolder:""},me,"",j)},ga=(m,M)=>{const te=m==="globalSystemPrompt"?U:W,Ae=m==="globalSystemPrompt"?q:L;return ht(),Je(m==="globalSystemPrompt"?{globalSystemPrompt:M}:{compactionPrompt:M},te,M,Ae)},yt=o.useRef(A);yt.current=A;const va=(m,M)=>{const te=yt.current,Ae={...te,[m]:M};return yt.current=Ae,ht(),Je({toolPrompts:Ae},Ne=>{yt.current=Ne,V(Ne)},Ae,te)},Ds=(m,M)=>{const te=m==="globalSystemPrompt"?q:L;ga(m,m==="globalSystemPrompt"?ta:ea).then(Ne=>{Ne&&h(`${M} reset to the default.`,()=>{ga(m,te)})})},Os=(m,M)=>{const te=yt.current[m],Ae=Xt[m]??Jt[m]??"";va(m,Ae).then(Ne=>{Ne&&te!==void 0&&h(`${M} reset to the default.`,()=>{va(m,te)})})},Pn=()=>{const m={globalSystemPrompt:q,compactionPrompt:L,toolPrompts:yt.current},M={globalSystemPrompt:ta,compactionPrompt:ea,toolPrompts:{...Xt,...Jt}},te=Ae=>{U(Ae.globalSystemPrompt),W(Ae.compactionPrompt),yt.current=Ae.toolPrompts,V(Ae.toolPrompts)};te(M),I({}),ht(),c(M,()=>te(m)).then(Ae=>{Ae&&h("Every prompt reset to the default.",()=>{te(m),c(m,()=>te(M)),ht()})})},Rn=async m=>{if(!m){Je({[Ka]:!1},J,!1,K);return}if(!await b({title:"Auto-update prompts",body:"Every prompt on this page is replaced with the current defaults now, and again whenever an update ships new ones. Your changes to them are lost.",confirmLabel:"Replace prompts",danger:!0}))return;const M=Ir(),te={auto:K,systemPrompt:q,compactionPrompt:L,toolPrompts:A};J(!0),I({}),U(M.globalSystemPrompt),W(M.compactionPrompt),yt.current=M.toolPrompts,V(M.toolPrompts),await c({...M,[Ka]:!0,[Al]:_l()},()=>{J(te.auto),U(te.systemPrompt),W(te.compactionPrompt),V(te.toolPrompts)}),ht()};return e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 overflow-hidden bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text)]",children:[e.jsxs("aside",{className:"flex w-60 shrink-0 flex-col bg-[var(--adf-ui-sidebar)] border-r border-hairline",children:[e.jsxs("div",{className:"px-4 pt-4 pb-3",children:[e.jsxs($,{onClick:()=>fn(!1),variant:"ghost",className:"group -ml-2 justify-start",children:[e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"transition-transform group-hover:-translate-x-0.5",children:e.jsx("path",{d:"m15 18-6-6 6-6"})}),"Back to app"]}),e.jsxs("div",{className:"mt-3 relative",children:[e.jsxs("svg",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--adf-ui-text-subtle)]",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m20 20-3.5-3.5"})]}),e.jsx(ze,{type:"search",value:n,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Enter"&&xa[0]?.items[0]&&r(xa[0].items[0].id)},placeholder:"Search settings","aria-label":"Search settings",className:"pl-9 text-xs"})]})]}),e.jsx("nav",{className:"flex-1 overflow-y-auto px-3 pb-4","aria-label":"Settings sections",children:xa.length>0?xa.map((m,M)=>e.jsxs("div",{className:M>0?"mt-4 pt-3 border-t border-[var(--adf-ui-separator)]":"mt-1","data-settings-scope":m.scope,children:[m.scope==="runtime"&&H?e.jsxs("div",{className:"mb-1.5 px-2","data-runtime-picker":!0,children:[e.jsx("div",{className:"mb-1 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--adf-ui-text-subtle)]",children:"Server"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[xe&&e.jsx(Pr,{}),e.jsx(na,{value:a,onChange:te=>t(te.target.value),"aria-label":"Server",className:"h-7 min-w-0 flex-1 text-xs",children:he.map(te=>e.jsx("option",{value:te.id,children:bi(te)},te.id))})]})]}):m.label&&e.jsx("div",{className:"mb-1 truncate px-2 text-[11px] font-semibold uppercase tracking-[0.12em] text-[var(--adf-ui-text-subtle)]",title:m.label,children:m.label}),e.jsx("div",{className:"space-y-0.5",children:m.items.map(te=>e.jsxs("button",{onClick:()=>r(te.id),"aria-current":s===te.id?"page":void 0,className:`flex h-8 w-full items-center gap-2.5 rounded-[var(--adf-ui-control-radius)] px-2.5 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)] ${s===te.id?"bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-text)]":"text-[var(--adf-ui-text-muted)] hover:bg-[var(--adf-ui-surface-hover)] hover:text-[var(--adf-ui-text)]"}`,children:[e.jsx("span",{className:s===te.id?"text-[var(--adf-ui-accent)]":"text-[var(--adf-ui-text-subtle)]",children:e.jsx(f0,{section:te.id})}),e.jsx("span",{className:"text-xs font-medium truncate",children:te.label})]},te.id))})]},m.scope)):e.jsx("div",{className:"px-2 py-6 text-center text-xs text-[var(--adf-ui-text-subtle)]",children:"No settings found"})})]}),e.jsx("main",{ref:fa,className:"flex-1 min-w-0 overflow-y-auto settings-content",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-8 py-9 lg:px-12",children:[e.jsxs("header",{className:"mb-7 border-b border-[var(--adf-ui-separator)] pb-5",children:[Ps&&e.jsx(yi,{}),e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-[var(--adf-ui-text)]",children:Ma.label}),e.jsx(ct,{href:Ma.docs,label:"Docs",className:"!text-[11px]"}),e.jsx("span",{className:"ml-auto",children:e.jsx(ji,{})})]}),e.jsx("p",{className:"mt-1 text-sm text-[var(--adf-ui-text-muted)]",children:Ma.description})]}),Rs&&ne&&e.jsx("p",{role:"status",className:"mb-4 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-warning)]/30 bg-[var(--adf-ui-warning-subtle)] px-3 py-2 text-[12px] text-[var(--adf-ui-text)]",children:H?`Not connected to ${ne.name}.`:`${Bt[ne.state]}.`}),e.jsx("fieldset",{disabled:Rs,className:"contents",children:e.jsxs("div",{className:"max-w-4xl space-y-5",children:[s==="appearance"&&e.jsx(e.Fragment,{children:e.jsxs(Re,{title:"Appearance",children:[e.jsx(ce,{label:"Theme",description:"Choose a light, dark, or operating-system appearance.",children:e.jsx(Mt,{value:Ns,options:[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"system",label:"System"}],onChange:wn,ariaLabel:"Theme"})}),e.jsx(ce,{label:"Agent avatars",description:"Show each agent as its orbital or as its emoji in lists, the title bar and the Mesh view.",children:e.jsx(Mt,{value:Cs,options:[{value:"orbital",label:"Orbital"},{value:"emoji",label:"Emoji"}],onChange:Nn,ariaLabel:"Agent avatars"})}),e.jsx(ce,{label:"Chat width",description:"How wide the loop thread runs when the chat is in the center stage. Comfortable caps it at a reading column; Full uses the whole stage.",help:"Only applies when the chat is in the center. In the side dock the panel is already narrow.",children:e.jsx(Mt,{value:cn,options:[{value:"comfortable",label:"Comfortable"},{value:"full",label:"Full"}],onChange:mn,ariaLabel:"Chat width"})}),e.jsx(ce,{label:"Font family",description:"Typeface for the whole interface. System and Inter Tight always work; other presets fall back to the system font if the face isn't installed.",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(na,{className:"!w-[150px]",value:ha,onChange:m=>Sn(m.target.value),"aria-label":"Font family",children:[Ii.map(m=>{const M=m.family!==null&&!Ws(m.family);return e.jsxs("option",{value:m.value,disabled:M,children:[m.label,M?" (not installed)":""]},m.value)}),e.jsx("option",{value:"custom",children:"Custom…"})]}),ha==="custom"&&e.jsx(ze,{className:"!w-[180px]",value:As,onChange:m=>_s(m.target.value),onBlur:Cn,onKeyDown:m=>{m.key==="Enter"&&m.currentTarget.blur()},placeholder:"Font family name","aria-label":"Custom font family",spellCheck:!1}),ha==="custom"&&Rt.trim()&&!Ws(Rt)&&e.jsx("span",{className:"text-[11px] text-[var(--adf-ui-warning)]",children:"Not found on this system — using the default."})]})}),e.jsx(ce,{label:"UI scale",description:"Scale the entire interface. Ctrl+= / Ctrl+- still zoom on top of this.",children:e.jsx(Mt,{value:String(Ss),options:Di.map(m=>({value:String(m),label:`${Math.round(m*100)}%`})),onChange:An,ariaLabel:"UI scale"})})]})}),s==="notifications"&&e.jsx(e.Fragment,{children:e.jsxs(Re,{title:"Notifications",children:[e.jsx(ce,{label:"System notifications",description:"Show an operating-system notification when an agent needs an approval or asks a question while Studio is not the focused app. Clicking one opens that agent.",help:"Studio never notifies twice: while a window is focused, the in-app notice and the bell badge cover it.",children:e.jsx(rt,{label:"System notifications",checked:Me,onChange:m=>{Je({nativeNotificationsEnabled:m},tt,m,Me)}})}),window.adfApi?.platform==="darwin"&&e.jsx(ce,{label:"Menu bar icon",description:"Show an ADF icon in the macOS menu bar. Its menu lists running agents and requests waiting on you, and the number beside it counts those requests. Clicking an item opens it in Studio.",children:e.jsx(rt,{label:"Menu bar icon",checked:at,onChange:m=>{Je({menuBarEnabled:m},xt,m,at)}})})]})}),s==="updates"&&e.jsxs(e.Fragment,{children:[e.jsx(Fc,{}),window.adfApi?.platform!=="web"&&e.jsx(Re,{title:"Update checks",children:e.jsx(ce,{label:"Automatic checks",description:"Ask GitHub Releases for a newer version after launch and every hour.",help:"Off: Studio never contacts GitHub for updates; nothing downloads until you click the update badge.",children:e.jsx(rt,{label:"Automatic checks",checked:N,onChange:m=>{Je({updateChecksEnabled:m},Z,m,N)}})})})]}),s==="privacy"&&e.jsx(e.Fragment,{children:e.jsxs(Re,{title:"Privacy",description:"Studio sends no telemetry.",docs:Se.settingsGeneral,children:[e.jsx(ce,{label:"Network traffic",description:e.jsxs(e.Fragment,{children:["Every connection that Studio and the server make.",e.jsx(ct,{href:ki,className:"ml-1.5 !text-[11px]"})]})}),window.adfApi?.platform==="linux"&&e.jsx(ce,{label:"Spell-check dictionaries",description:"Linux spell check needs Hunspell dictionaries, which Studio downloads from Google only when you click Download. Windows and macOS use the OS spell checker.",help:"Downloaded dictionaries stay in Studio's data folder. After you allow it, a newly added spell-check language is fetched the same way.",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($,{disabled:be,onClick:async()=>{Qe(!0),P(null);try{const m=await window.adfApi.downloadSpellcheckDictionaries();m.outcome==="downloaded"?(Ot(!0),P(`Installed: ${m.languages.join(", ")}`)):m.outcome==="failed"&&(Ot(!0),P(m.message))}finally{Qe(!1)}},children:be?"Downloading…":it?"Download again":"Download"}),e.jsx("span",{className:"text-[12px] text-[var(--adf-ui-text-muted)]",children:y??(it?"Allowed":"Not downloaded")})]})})]})}),s==="files"&&e.jsx(e.Fragment,{children:e.jsx(Re,{title:"Files",children:e.jsx(ce,{label:"Agents folder",description:"Where agents you claim are saved.",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"max-w-[280px] truncate text-[12px] text-[var(--adf-ui-text-muted)]",title:j||void 0,children:j||"Documents/adf-agents (default)"}),e.jsx($,{onClick:_n,size:"compact",children:"Choose…"}),j&&e.jsx($,{onClick:En,variant:"ghost",size:"compact",children:"Reset"})]})})})}),s==="usage"&&e.jsx("div",{"data-settings-anchor":"usage",className:"scroll-mt-4",children:e.jsx(Re,{title:"Usage",docs:Se.settingsUsage,children:e.jsx("div",{className:"px-4 pb-4",children:e.jsx(pd,{})})})}),s==="agents"&&e.jsxs(e.Fragment,{children:[e.jsxs(Re,{title:"Prompts",description:m0,docs:Se.settingsSystemPrompt,children:[e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Auto-update",e.jsx(We,{tip:"When an update ships new default prompts, replace every prompt on this page with them. Off: your prompts stay as they are; Reset all picks up the new defaults."})]}),children:e.jsx(rt,{label:"Auto-update",checked:K,onChange:m=>{Rn(m)}})}),e.jsx(ce,{separator:!0,label:"Defaults",children:e.jsx($,{onClick:Pn,variant:"ghost",size:"compact",children:"Reset all"})}),e.jsx(ce,{label:"System prompt",stacked:!0,separator:!0,children:e.jsx(hs,{label:"System prompt",value:q,defaultValue:ta,draft:X.global,onDraft:m=>R("global",m),onSave:m=>ga("globalSystemPrompt",m),onReset:()=>Ds("globalSystemPrompt","System prompt"),rows:12})}),e.jsx(ce,{label:"Compaction prompt",description:"Used when conversation history is compacted.",stacked:!0,separator:!0,children:e.jsx(hs,{label:"Compaction prompt",value:L,defaultValue:ea,draft:X.compaction,onDraft:m=>R("compaction",m),onSave:m=>ga("compactionPrompt",m),onReset:()=>Ds("compactionPrompt","Compaction prompt"),rows:8})})]}),e.jsx(Re,{title:"Tool instructions",description:"Conditional prompt sections injected based on enabled tools and features.",hint:"The ADF Shell guide lives in that tool’s own description, so it travels with the schema rather than sitting here.",docs:Se.tools,children:e.jsx("div",{className:"px-4 pb-4",children:e.jsx(Nr,{defaults:Xt,labels:zs,conditions:wi,values:A,drafts:X,onDraft:R,onSave:va,onReset:m=>Os(m,zs[m]??m),expandedKey:ie,onToggle:w})})}),e.jsx(Re,{title:"Dynamic instructions",description:"Per-turn injections: inbox status, context warnings, mesh updates, idle reminders.",hint:"Never part of the cached system prompt; {{token}} placeholders are filled at injection time. Each agent can toggle these under context.dynamic_instructions.",docs:Se.settingsSystemPrompt,children:e.jsx("div",{className:"px-4 pb-4",children:e.jsx(Nr,{defaults:Jt,labels:Us,conditions:Ni,values:A,drafts:X,onDraft:R,onSave:va,onReset:m=>Os(m,Us[m]??m),expandedKey:ie,onToggle:w})})})]}),s==="template"&&e.jsx(Qc,{providers:C,defaultProviderId:D,onOpenProviders:()=>r("providers")}),s==="identity"&&e.jsx(v0,{remote:xe,runtimeName:g}),s==="about"&&e.jsx(Bc,{}),s==="connection"&&e.jsx($u,{}),s==="packages"&&e.jsx(y0,{sandboxPackages:ot,setSandboxPackages:m=>{yn(m)},sandboxMaxWorkers:ks,setSandboxMaxWorkers:m=>{jn(m)}}),s==="providers"&&e.jsx(Re,{title:"Provider checks",children:e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Models",e.jsx(We,{tip:"Sends GET /models with each provider's key. Off = providers are contacted only when you click Test or an agent runs."})]}),description:"Test each configured provider when Home, the provider list, or an agent review opens.",children:e.jsx(rt,{label:"Models",checked:F,onChange:m=>{Je({providerChecksEnabled:m},Ce,m,F)}})})}),s==="providers"&&e.jsx(Oc,{loaded:E,providers:C,setProviders:_,defaultProviderId:D,setDefaultProviderId:k,flushSave:bn,saveFailure:xn,onOpenTemplate:()=>r("template")}),s==="mcps"&&e.jsx(Re,{title:"Catalog",children:e.jsx(ce,{label:"Live catalogs",description:"Fetch the current MCP server registry from GitHub when you open Settings → MCP servers (and the agent registry, when used). Off = only the copies bundled with this build (and the last fetched copy).",help:"Skill catalogs are listed separately under Skills and can be removed there.",children:e.jsx(rt,{label:"Live catalogs",checked:ve,onChange:m=>{Je({remoteCatalogsEnabled:m},p,m,ve)}})})}),s==="mcps"&&e.jsx(Tc,{mcpServers:ae,onServersChanged:m=>{const M=De.current,te=Si(M,m,Be.current,u.current);(te.approved.length!==Be.current.length||te.approved.some((Ne,Ue)=>Ne!==Be.current[Ue])||JSON.stringify(te.sources)!==JSON.stringify(u.current))&&Is(te.approved,te.sources),De.current=m,se(m)},hostAccessEnabled:G,hostApproved:Ie,hostApprovedSources:$e,onAllowHost:m=>{kn(m)},onEnableHostAccess:()=>{b(ba).then(m=>{m&&bt("hostAccessEnabled",fe,!0,G)})},mcpOnHost:Ee,onEnableHostAccessNow:()=>bt("hostAccessEnabled",fe,!0,G),onAcceptMcpOnHost:Ls}),s==="skills"&&e.jsx(b0,{}),s==="channels"&&e.jsx(Dc,{adapters:Y,onAdaptersChanged:z}),s==="networking"&&e.jsx(d0,{remote:xe,runtimeName:g,pickedMesh:ee}),s==="compute"&&e.jsx(e.Fragment,{children:e.jsx(k0,{computeEnvStatus:S,setComputeEnvStatus:O,computeHostAccessEnabled:G,setComputeHostAccessEnabled:m=>{bt("hostAccessEnabled",fe,m,G)},computeMcpOnHost:Ee,setComputeMcpOnHost:m=>{m?Ls():bt("mcpOnHost",ge,!1,Ee)},computeHostApproved:Ie,revokeHostServer:m=>{const M={...u.current};delete M[m],Is(Be.current.filter(te=>te!==m),M)},containerPackages:pe,setContainerPackages:m=>{bt("containerPackages",M=>ue(M.join(", ")),m.split(",").map(M=>M.trim()).filter(Boolean),pe.split(",").map(M=>M.trim()).filter(Boolean))},machineCpus:Oe,setMachineCpus:m=>{bt("machineCpus",we,m,Oe)},machineMemoryMb:Pe,setMachineMemoryMb:m=>{bt("machineMemoryMb",Fe,m,Pe)},containerImage:v,setContainerImage:m=>{bt("containerImage",oe,m,v)},executionTargets:He,setExecutionTargets:Ke})})]})}),f]})})]})}function k0({computeEnvStatus:a,setComputeEnvStatus:t,computeHostAccessEnabled:s,setComputeHostAccessEnabled:r,computeMcpOnHost:n,setComputeMcpOnHost:i,computeHostApproved:l,revokeHostServer:c,containerPackages:d,setContainerPackages:h,machineCpus:f,setMachineCpus:b,machineMemoryMb:C,setMachineMemoryMb:_,containerImage:E,setContainerImage:x,executionTargets:D,setExecutionTargets:k}){const q=nt(),[U,L]=o.useState(null),[W,A]=o.useState(!1),[V,ie]=o.useState(null),[w,X]=o.useState(null),[I,R]=o.useState([]),[K,J]=o.useState(null),[ae,se]=o.useState("all"),[Y,z]=o.useState(null),[re,he]=o.useState(null),[H,ne]=o.useState(null),[xe,g]=o.useState(!1),[T,ee]=o.useState(!1),[j,me]=o.useState({name:"",engine:"docker",containerRef:"",workdir:"/workspace",pinId:!1}),[G,fe]=o.useState(!1),[Ee,ge]=o.useState(null),{commit:Ie,offerUndo:Ge}=Pt(),[$e,ye]=Wt(),De=async v=>{v&&!await ye(ba)||r(v)},Be=async v=>{v&&!await ye(Li)||i(v)},u=async v=>{await ye({title:"Revoke host server",body:`${v} runs in the container from its next start, unless its agent has host access.`,confirmLabel:"Revoke",danger:!0})&&c(v)},S=o.useCallback(async v=>{const oe=await Ie({compute:{executionTargets:v}});return oe&&(k(v),ht()),oe},[Ie,k]),O=o.useCallback(()=>{q?.computeStatus?.().then(v=>{v&&t(v)}),q?.computeSetup?.({step:"check"}).then(v=>{v?.availability&&L(v.availability)}),q?.computeListContainers?.().then(v=>{v?.containers&&R(v.containers)})},[]);o.useEffect(()=>{O()},[]);const pe=o.useCallback(async({container:v,action:oe,isShared:He})=>{const Ke=oe==="rebuild";z(v.name),ie(null),X(Ke?`Rebuilding ${v.name}...`:`Removing ${v.name}...`);try{const Me=He?await q.computeDestroy():Ke?await q.computeRebuildContainer({name:v.name}):await q.computeDestroyContainer({name:v.name});if(!Me.success)throw new Error(Me.error??(Ke?"Rebuild failed":"Remove failed"));if(He){const at=await q.computeInit();if(!at.success)throw new Error(at.error??"Recreate failed")}const tt=He||"recreated"in Me&&Me.recreated===!0;X(Ke?tt?"Container rebuilt.":"Container removed. It will be recreated when the agent starts.":"Container deleted."),ne(null)}catch(Me){ie(Me instanceof Error?Me.message:String(Me)),X(null),ne(null)}finally{z(null),O()}},[O]),ue=async(v,oe,He)=>{A(!0),ie(null),X(`Running: ${oe}...`);try{const Ke=await q?.computeSetup?.({step:v,installCommand:He});Ke?.success?(X(`${oe} completed`),Ke.availability&&L(Ke.availability),O()):(ie(Ke?.error??`${oe} failed`),X(null))}catch(Ke){ie(String(Ke)),X(null)}finally{A(!1)}},Oe=v=>{navigator.clipboard.writeText(v),X(`Copied to clipboard: ${v}`)},we=(U?.prerequisites??[]).every(v=>v.installed),Pe=U&&!U.available,Fe=U?.available&&we&&(!U.machineRequired||U.machineRunning);return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(Re,{title:"Containers",description:"Podman containers that ADF sets up and manages; the recommended way to run agent code.",hint:`ADF manages Podman setup, container lifecycle, agent assignment, workspaces, and rebuilds.
|
|
5
|
+
|
|
6
|
+
MCP servers use the shared container by default; agents can also receive a dedicated container for stronger isolation. Installed packages and dedicated containers persist across agent restarts.`,docs:Se.settingsCompute,children:e.jsxs("div",{className:"px-4 pb-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:[I.filter(v=>v.running).length," running · ",I.length," total"]}),(a.leftRunning??[]).map(v=>e.jsxs("p",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:[v.name," was left running: ",v.reason,"."]},v.name))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mt,{ariaLabel:"Filter containers",value:ae,onChange:se,options:[{value:"all",label:"All"},{value:"running",label:"Running"},{value:"stopped",label:"Stopped"}]}),e.jsx(qe,{tip:"Refresh containers",children:e.jsx(pt,{"aria-label":"Refresh containers",onClick:O,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M13.25 5.75A5.75 5.75 0 1 0 13 10.9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.25 2.75v3h-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})})]})]}),e.jsxs("div",{className:"overflow-visible rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface)]",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(180px,1.5fr)_105px_minmax(110px,1fr)_88px] gap-3 border-b border-[var(--adf-ui-separator)] px-3 py-2 text-[11px] font-medium uppercase tracking-wide text-[var(--adf-ui-text-subtle)]",children:[e.jsx("span",{children:"Container"}),e.jsx("span",{children:"Status"}),e.jsx("span",{children:"Assigned to"}),e.jsx("span",{className:"text-right",children:"Actions"})]}),I.filter(v=>ae==="all"||(ae==="running"?v.running:!v.running)).map(v=>{const oe=v.scope==="shared"||v.name==="adf-mcp",He=Y===v.name,Ke=v.state==="failed";return e.jsxs("div",{className:"grid grid-cols-[minmax(180px,1.5fr)_105px_minmax(110px,1fr)_88px] items-center gap-3 border-b border-[var(--adf-ui-separator)] px-3 py-2.5 last:border-b-0",children:[e.jsxs("button",{className:"flex min-w-0 items-center gap-2 text-left outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)]",onClick:()=>J(v.name),children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text-muted)]",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:[e.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Z"}),e.jsx("path",{d:"m4.5 7.7 7.5 4.2 7.5-4.2M12 12v9"})]})}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-xs font-medium text-[var(--adf-ui-text)]",children:v.name}),e.jsx("span",{className:"block truncate font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:v.image||"Image unavailable"})]})]}),e.jsxs("span",{children:[Ke?e.jsx(qe,{tip:v.error??"Container setup failed",children:e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-[var(--adf-ui-danger)]",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-[var(--adf-ui-danger)]"}),"Setup failed"]})}):e.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-[var(--adf-ui-text)]",children:[e.jsx("span",{className:`size-1.5 rounded-full ${v.running?"bg-[var(--adf-ui-success)]":"bg-[var(--adf-ui-text-subtle)]"}`}),v.running?"Running":"Stopped"]}),e.jsx("span",{className:"mt-0.5 block text-[11px] text-[var(--adf-ui-text-muted)]",children:oe?"Shared":v.scope==="legacy"?"Legacy":"Dedicated"}),v.managed&&v.outdated&&e.jsx(qe,{tip:p0,children:e.jsxs("span",{className:"mt-0.5 inline-flex items-center gap-1 rounded bg-[var(--adf-ui-surface-hover)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-text-muted)]",children:[e.jsx("span",{className:"size-1 rounded-full bg-[var(--adf-ui-text-subtle)]","aria-hidden":"true"}),"Rebuild available"]})})]}),e.jsxs("span",{className:"min-w-0 text-[11px] text-[var(--adf-ui-text-muted)]",children:[e.jsx("span",{className:"block truncate",children:oe?`${a.activeAgents.length} active agents`:v.agentName||v.agentId||"Unassigned"}),v.users&&v.users.length>0&&e.jsxs("span",{className:"block truncate text-[11px]",children:["Also used by ",v.users.join(", ")]})]}),e.jsxs("div",{className:"relative flex justify-end gap-1",children:[e.jsx(qe,{tip:Ke?"Setup failed: rebuild to retry":v.managed?v.running?"Stop":"Start":"Legacy container: rebuild to migrate before managing",children:e.jsx(pt,{"aria-label":`${v.running?"Stop":"Start"} ${v.name}`,disabled:He||!v.managed||Ke,onClick:async()=>{z(v.name),ie(null);try{const Me=u0(v,oe,a.activeAgents);if(Me&&!await ye({title:`Stop ${v.name}`,body:Me,confirmLabel:"Stop",danger:!0}))return;const tt=v.running?await q.computeStopContainer({name:v.name}):await q.computeStartContainer({name:v.name});tt.success||ie(tt.error??`${v.running?"Stop":"Start"} failed`)}finally{z(null),O()}},children:v.running?e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("rect",{x:"3.5",y:"3.5",width:"9",height:"9",rx:"1.5"})}):e.jsx("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"m5 3 7.5 5L5 13V3Z"})})})}),e.jsx(qe,{tip:"More actions",children:e.jsx(pt,{"aria-label":`More actions for ${v.name}`,disabled:He,onClick:()=>he(re===v.name?null:v.name),children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"3",cy:"8",r:"1.2"}),e.jsx("circle",{cx:"8",cy:"8",r:"1.2"}),e.jsx("circle",{cx:"13",cy:"8",r:"1.2"})]})})}),re===v.name&&e.jsxs("div",{className:"absolute right-0 top-8 z-20 w-40 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-raised)] p-1 shadow-[var(--adf-ui-dialog-shadow)]",children:[e.jsx("button",{className:"w-full rounded px-2 py-1.5 text-left text-[11px] text-[var(--adf-ui-text)] hover:bg-[var(--adf-ui-surface-hover)]",onClick:()=>{J(v.name),he(null)},children:"View details"}),e.jsx("button",{className:"w-full rounded px-2 py-1.5 text-left text-[11px] text-[var(--adf-ui-warning)] hover:bg-[var(--adf-ui-surface-hover)] disabled:opacity-50",title:v.managed||oe?"Remove and recreate this container":"Remove this pre-label container so ADF recreates a managed one",onClick:()=>{he(null),ne({container:v,action:"rebuild",isShared:oe,activeAgents:oe?a.activeAgents:[]})},children:"Rebuild"}),!oe&&e.jsx("button",{className:"w-full rounded px-2 py-1.5 text-left text-[11px] text-[var(--adf-ui-danger)] hover:bg-[var(--adf-ui-danger-subtle)] disabled:opacity-50",disabled:v.running,title:v.running?"Stop the container before removing it":"Permanently delete this container",onClick:()=>{he(null),ne({container:v,action:"remove",isShared:!1,activeAgents:[]})},children:"Remove"})]})]})]},v.id||v.name)}),I.filter(v=>ae==="all"||(ae==="running"?v.running:!v.running)).length===0&&e.jsx("div",{className:"px-3 py-8 text-center text-[11px] text-[var(--adf-ui-text-muted)]",children:I.length===0?"No ADF containers yet.":`No ${ae} containers.`})]})]}),Fe&&w&&e.jsx("p",{className:`mb-3 text-[11px] font-mono ${on(w)}`,children:w}),Fe&&V&&e.jsx("p",{className:"mb-3 text-[11px] text-red-600 dark:text-red-400 font-mono",children:V}),U&&!Fe&&e.jsx(w0,{availability:U,setupBusy:W,setupLog:w,setupError:V,prereqsSatisfied:we,needsInstall:!!Pe,onRefresh:O,onInstall:v=>ue("install",v,v),onMachineInit:()=>ue("machine_init","podman machine init"),onMachineStart:()=>ue("machine_start","podman machine start"),onCopy:Oe}),Fe&&e.jsxs("p",{className:"text-[11px] text-[var(--adf-ui-success)]",children:["Podman v",U?.version," ready"]})]})}),e.jsxs(Re,{title:"Default container",description:"Applies to new containers and rebuilds.",hint:"Packages install with apt-get on Debian-based images and apk on Alpine. CPUs and Memory size the Podman machine on macOS and Windows; on Linux, containers use this computer's resources.",children:[e.jsx(ce,{label:"Image",children:e.jsx(sa,{"aria-label":"Image",value:E,onCommit:v=>x(v.trim()),check:v=>v.trim()?null:"Enter an image.",spellCheck:!1,className:"!w-72 font-mono !text-[12px]",placeholder:"docker.io/library/node:20-alpine"})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Packages",e.jsx(We,{tip:"System packages, comma-separated."})]}),children:e.jsx(sa,{"aria-label":"Packages",value:d,onCommit:h,spellCheck:!1,className:"!w-72 font-mono !text-[12px]",placeholder:"python3, python3-pip, git, curl"})}),e.jsx(ce,{separator:!0,label:"CPUs",children:e.jsx(sa,{"aria-label":"CPUs",inputMode:"numeric",value:String(f),onCommit:v=>{const oe=It(v,1,16);oe.ok&&b(oe.value)},check:v=>{const oe=It(v,1,16);return oe.ok?null:oe.error},className:"!w-24 !text-[12px]"})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["Memory",e.jsx(We,{tip:"In megabytes."})]}),children:e.jsx(sa,{"aria-label":"Memory",inputMode:"numeric",value:String(C),onCommit:v=>{const oe=It(v,512,32768);oe.ok&&_(oe.value)},check:v=>{const oe=It(v,512,32768);return oe.ok?null:oe.error},className:"!w-24 !text-[12px]"})})]}),e.jsx(Re,{className:"overflow-hidden",children:e.jsxs("button",{type:"button","aria-expanded":xe,onClick:()=>g(v=>!v),className:"flex w-full items-center justify-between gap-3 px-4 py-3 text-left",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-semibold text-[var(--adf-ui-text)]",children:"Advanced"}),e.jsx("span",{className:"mt-0.5 block text-[12px] text-[var(--adf-ui-text-muted)]",children:"Host access and custom Docker or Podman containers."})]}),e.jsxs("span",{className:"flex items-center gap-2 text-[11px] text-[var(--adf-ui-text-muted)]",children:[D.length>0||s?`${D.length+(s?1:0)+(s&&n?1:0)} configured`:"Configure",e.jsx("svg",{className:`transition-transform ${xe?"rotate-180":""}`,width:"12",height:"12",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"m4 6 4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})}),xe&&e.jsxs(e.Fragment,{children:[e.jsxs(Re,{title:"Host",children:[e.jsx(ce,{label:e.jsxs(e.Fragment,{children:["Host access",e.jsx(We,{tip:"An agent also needs its own compute.host_access, or an approved MCP server, before anything runs on the host."})]}),description:"Host execution bypasses container isolation.",children:e.jsx(rt,{label:"Host access",checked:s,onChange:v=>{De(v)}})}),e.jsx(ce,{separator:!0,label:e.jsxs(e.Fragment,{children:["MCP servers on the host",e.jsx(We,{tip:"Every MCP server runs directly on the host instead of in a container, including servers agents install. Servers set to run in the container, and all servers of agents with their own container, stay in a container. Applies only while Host access is on; turning it on turns Host access on."})]}),description:"Skips the container for MCP servers. They can read and change your files.",children:e.jsx(rt,{label:"MCP servers on the host",checked:n&&s,onChange:v=>{Be(v)}})}),s&&e.jsx(ce,{separator:!0,stacked:!0,label:e.jsxs(e.Fragment,{children:["Approved servers",e.jsx(We,{tip:"MCP servers allowed to run on the host for agents without host access. A server chosen to run on the host in Settings → MCP servers is added here."})]}),children:l.length===0?e.jsx("p",{className:"text-[12px] text-[var(--adf-ui-text-subtle)]",children:"None."}):e.jsx("ul",{className:"space-y-1",children:l.map(v=>e.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-canvas)] px-2 py-1",children:[e.jsx("span",{className:"font-mono text-[12px] text-[var(--adf-ui-text)]",children:v}),e.jsx($,{onClick:()=>{u(v)},variant:"danger",size:"compact",children:"Revoke"})]},v))})})]}),e.jsx(Re,{title:"Custom containers",description:"Docker or Podman containers you keep under your own control.",hint:"ADF runs commands in these and never starts, stops, provisions, rebuilds or removes them.",children:e.jsxs("div",{className:"px-4 pb-4",children:[e.jsx("div",{className:"flex items-start justify-end gap-3",children:e.jsx($,{size:"compact",onClick:()=>{ee(v=>!v),ge(null)},children:T?"Cancel":"Add target"})}),D.length>0&&e.jsx("div",{className:"mt-3 divide-y divide-[var(--adf-ui-separator)]",children:Ri(D).map(({target:v,alias:oe})=>e.jsxs("div",{className:"flex items-center gap-3 py-2.5",children:[e.jsx("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)]",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Z"}),e.jsx("path",{d:"m4.5 7.7 7.5 4.2 7.5-4.2M12 12v9"})]})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-medium text-[var(--adf-ui-text)]",children:v.name}),e.jsx("span",{className:"rounded bg-[var(--adf-ui-accent-subtle)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-accent)]",children:v.engine})]}),e.jsxs("p",{className:"truncate font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:[oe," · ",v.containerRef," · ",v.workdir]})]}),e.jsx($,{size:"compact",variant:"danger",onClick:async()=>{ge(null),await S(D.filter(He=>He.id!==v.id))&&Ge(`Removed ${oe}.`,()=>{q?.getSettings().then(He=>{const Ke=He?.compute?.executionTargets??[];Ke.some(Me=>Me.id===v.id)||S([...Ke,v])})})},children:"Remove"})]},v.id))}),D.length===0&&!T&&e.jsx("p",{className:"mt-3 text-[11px] italic text-[var(--adf-ui-text-subtle)]",children:"No external targets configured."}),T&&e.jsxs("div",{className:"mt-3 border-t border-[var(--adf-ui-separator)] pt-3",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:["Display name",e.jsx(ze,{className:"mt-1",value:j.name,onChange:v=>me(oe=>({...oe,name:v.target.value})),placeholder:"Local Python tools"})]}),e.jsxs("label",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:["Engine",e.jsxs(na,{className:"mt-1",value:j.engine,onChange:v=>me(oe=>({...oe,engine:v.target.value})),children:[e.jsx("option",{value:"docker",children:"Docker"}),e.jsx("option",{value:"podman",children:"Podman"})]})]}),e.jsxs("label",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:["Container name or ID",e.jsx(ze,{className:"mt-1 font-mono",value:j.containerRef,onChange:v=>me(oe=>({...oe,containerRef:v.target.value})),placeholder:"my-running-container"})]}),e.jsxs("label",{className:"text-[11px] text-[var(--adf-ui-text-muted)]",children:["Working directory",e.jsx(ze,{className:"mt-1 font-mono",value:j.workdir,onChange:v=>me(oe=>({...oe,workdir:v.target.value})),placeholder:"/workspace"})]})]}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-[11px] text-[var(--adf-ui-text-muted)]",children:[e.jsx("input",{type:"checkbox",checked:j.pinId,onChange:v=>me(oe=>({...oe,pinId:v.target.checked}))}),"Pin this container ID; do not follow the name when the container is recreated"]}),Ee&&e.jsx("p",{className:`mt-2 text-[11px] ${Ee.kind==="error"?"text-[var(--adf-ui-danger)]":"text-[var(--adf-ui-success)]"}`,children:Ee.text}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsx($,{variant:"primary",loading:G,disabled:!j.name.trim()||!j.containerRef.trim()||!j.workdir.trim(),onClick:async()=>{const v={id:`target-${crypto.randomUUID()}`,name:j.name.trim(),alias:Ti(j.name.trim(),j.engine,D),kind:"local-container",engine:j.engine,containerRef:j.containerRef.trim(),workdir:j.workdir.trim()};fe(!0),ge(null);try{const oe=await q.computeTestExecutionTarget(v);if(!oe.success){ge({kind:"error",text:oe.error??"Target test failed."});return}if(j.pinId&&oe.containerId&&(v.expectedContainerId=oe.containerId),!await S([...D,v]))return;ge({kind:"success",text:`Connected to ${oe.containerName??v.containerRef}.`}),me({name:"",engine:"docker",containerRef:"",workdir:"/workspace",pinId:!1}),ee(!1)}catch(oe){ge({kind:"error",text:oe instanceof Error?oe.message:String(oe)})}finally{fe(!1)}},children:"Test and add"})})]})]})})]}),K&&(()=>{const v=I.find(oe=>oe.name===K);return v?e.jsx(_0,{container:v,onClose:()=>J(null)}):null})(),$e,e.jsx(h0,{request:H,busy:Y===H?.container.name,onCancel:()=>ne(null),onConfirm:pe})]})}function Pa({status:a,index:t}){const s="w-4 h-4 shrink-0 rounded-full text-[11px] flex items-center justify-center font-semibold";return a==="done"?e.jsx("span",{className:`${s} bg-green-500 text-white`,children:"✓"}):a==="failed"?e.jsx("span",{className:`${s} bg-red-500 text-white`,children:"×"}):a==="in_progress"?e.jsx("span",{className:`${s} bg-blue-500 text-white animate-pulse`,children:t}):a==="blocked"?e.jsx("span",{className:`${s} bg-neutral-200 dark:bg-neutral-700 text-[var(--adf-ui-text-subtle-on-fill)]`,children:t}):e.jsx("span",{className:`${s} bg-neutral-300 dark:bg-neutral-600 text-neutral-600 dark:text-neutral-300`,children:t})}function w0({availability:a,setupBusy:t,setupLog:s,setupError:r,prereqsSatisfied:n,needsInstall:i,onRefresh:l,onInstall:c,onMachineInit:d,onMachineStart:h,onCopy:f}){const b=a.prerequisites??[],C=b.map(D=>D.installed?"done":"pending"),_=a.available?"done":n?"pending":"blocked",E=a.machineRequired?a.machineExists?"done":!a.available||!n?"blocked":"pending":"done",x=a.machineRequired?a.machineRunning?"done":a.machineExists?"pending":"blocked":"done";return e.jsxs("div",{className:"mb-4 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-warning)]/30 bg-[var(--adf-ui-warning-subtle)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h4",{className:"text-xs font-semibold text-amber-800 dark:text-amber-300",children:"Setup required"}),e.jsx($,{onClick:l,variant:"ghost",size:"compact",className:"text-[11px] text-[var(--adf-ui-warning)]",disabled:t,title:"Re-check the environment (use after installing WSL + reboot, etc.)",children:"Re-check"})]}),e.jsxs("p",{className:"text-[11px] text-amber-700 dark:text-amber-400 mb-3",children:["The compute environment runs MCP servers and agent code inside containers.",a.machineRequired&&" On macOS/Windows, a lightweight Linux VM is also required."]}),e.jsxs("div",{className:"space-y-2",children:[b.map((D,k)=>e.jsx(N0,{index:k+1,status:C[k],prereq:D,onCopy:f},D.id)),e.jsx(S0,{index:b.length+1,status:_,availability:a,needsInstall:i,setupBusy:t,onInstall:c,onCopy:f}),a.machineRequired&&e.jsxs(e.Fragment,{children:[e.jsx(C0,{index:b.length+2,status:E,setupBusy:t,onInit:d}),e.jsx(A0,{index:b.length+3,status:x,setupBusy:t,onStart:h})]})]}),s&&e.jsx("p",{className:`mt-2 text-[11px] font-mono ${on(s)}`,children:s}),r&&e.jsx("div",{className:"mt-2 p-2 rounded bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",children:e.jsx("p",{className:"text-[11px] text-red-700 dark:text-red-400 font-mono break-words",children:r})})]})}function N0({index:a,status:t,prereq:s,onCopy:r}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Pa,{status:t,index:a}),e.jsxs("span",{className:"text-xs text-neutral-700 dark:text-neutral-300 flex-1",children:["Install ",s.name]}),t!=="done"&&s.installCommand&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"text-[11px] text-amber-700 dark:text-amber-300 bg-amber-100 dark:bg-amber-900/40 px-1.5 py-0.5 rounded font-mono",children:s.installCommand}),e.jsx($,{onClick:()=>r(s.installCommand),size:"compact",className:"text-[11px]",children:"Copy"})]})]}),t!=="done"&&e.jsxs("div",{className:"ml-6 text-[11px] text-amber-700 dark:text-amber-400 space-y-0.5",children:[s.description&&e.jsx("p",{children:s.description}),s.requiresReboot&&e.jsx("p",{className:"font-semibold",children:"Reboot required after installation, then click Re-check above."}),s.docsUrl&&e.jsx("a",{href:s.docsUrl,target:"_blank",rel:"noreferrer",className:"text-blue-600 dark:text-blue-400 hover:underline",children:"Installation docs →"})]})]})}function S0({index:a,status:t,availability:s,needsInstall:r,setupBusy:n,onInstall:i,onCopy:l}){const c=s.installMethods.find(h=>h.autoRunnable),d=s.installMethods.filter(h=>!h.autoRunnable);return e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(Pa,{status:t,index:a}),e.jsxs("span",{className:"text-xs text-neutral-700 dark:text-neutral-300 flex-1",children:["Install Podman",s.available&&s.version&&e.jsxs("span",{className:"text-[var(--adf-ui-text-subtle)] ml-1",children:["v",s.version]})]}),r&&t==="pending"&&c&&e.jsx($,{onClick:()=>i(c.command),disabled:n,loading:n,variant:"primary",size:"compact",className:"text-[11px]",children:n?"Installing...":c.label})]}),t==="pending"&&!c&&d.length>0&&e.jsx("div",{className:"ml-6 space-y-1",children:d.map(h=>h.url?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-[11px] text-neutral-600 dark:text-neutral-400",children:h.label}),e.jsx($,{onClick:()=>window.open(h.url,"_blank","noopener,noreferrer"),size:"compact",className:"text-[11px]",children:"Open"})]},h.url):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("code",{className:"text-[11px] text-amber-700 dark:text-amber-300 bg-amber-100 dark:bg-amber-900/40 px-1.5 py-0.5 rounded font-mono",children:h.command}),e.jsx($,{onClick:()=>l(h.command),size:"compact",className:"text-[11px]",children:"Copy"})]},h.command))}),t==="blocked"&&e.jsx("p",{className:"ml-6 text-[11px] text-neutral-500 dark:text-neutral-400",children:"Complete the prerequisite above first."})]})}function C0({index:a,status:t,setupBusy:s,onInit:r}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pa,{status:t,index:a}),e.jsx("span",{className:"text-xs text-neutral-700 dark:text-neutral-300 flex-1",children:"Initialize Podman machine"}),t==="pending"&&e.jsx($,{onClick:r,disabled:s,loading:s,variant:"primary",size:"compact",className:"text-[11px]",children:s?"Initializing...":"Initialize"})]})}function A0({index:a,status:t,setupBusy:s,onStart:r}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pa,{status:t,index:a}),e.jsx("span",{className:"text-xs text-neutral-700 dark:text-neutral-300 flex-1",children:"Start Podman machine"}),t==="pending"&&e.jsx($,{onClick:r,disabled:s,loading:s,variant:"primary",size:"compact",className:"text-[11px]",children:s?"Starting...":"Start"})]})}function _0({container:a,onClose:t}){const s=nt(),[r,n]=o.useState("summary"),[i,l]=o.useState(null),[c,d]=o.useState([]),[h,f]=o.useState(!0),[b,C]=o.useState(null),_=o.useCallback(()=>{f(!0),C(null),Promise.all([s.computeContainerDetail({name:a.name}),s.computeExecLog({name:a.name})]).then(([k,q])=>{k?.success?l(k):C(k?.error??"Container details are unavailable."),q?.entries&&d(q.entries)}).catch(k=>C(k instanceof Error?k.message:String(k))).finally(()=>f(!1))},[a.name]);o.useEffect(()=>{_()},[_]),o.useEffect(()=>{if(!a.running||r!=="summary"&&r!=="processes")return;const k=setInterval(_,r==="processes"?5e3:1e4);return()=>clearInterval(k)},[a.running,r,_]);const E=[{id:"summary",label:"Summary"},{id:"activity",label:`Activity (${c.length})`},{id:"logs",label:"Logs"},{id:"processes",label:"Processes"},{id:"workspace",label:"Workspace"},{id:"packages",label:"Packages"},{id:"inspect",label:"Inspect"}],x=i?.overview,D="min-h-[260px] whitespace-pre-wrap break-words rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-canvas)] p-3 font-mono text-[11px] text-[var(--adf-ui-text)]";return e.jsx(gt,{open:!0,onClose:t,title:"Container details",extraWide:!0,children:e.jsxs("div",{className:"flex min-h-[560px] flex-col",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b border-[var(--adf-ui-separator)] pb-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex size-10 shrink-0 items-center justify-center rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)]",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:[e.jsx("path",{d:"m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Z"}),e.jsx("path",{d:"m4.5 7.7 7.5 4.2 7.5-4.2M12 12v9"})]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{className:"truncate text-base font-semibold text-[var(--adf-ui-text)]",children:a.name}),e.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] ${a.running?"bg-[var(--adf-ui-success-subtle)] text-[var(--adf-ui-success)]":"bg-[var(--adf-ui-canvas)] text-[var(--adf-ui-text-muted)]"}`,children:a.running?"Running":"Stopped"}),e.jsx("span",{className:"rounded bg-[var(--adf-ui-accent-subtle)] px-1.5 py-0.5 text-[11px] text-[var(--adf-ui-accent)]",children:a.scope==="dedicated"?"Dedicated":a.scope==="legacy"?"Legacy":"Shared"})]}),e.jsx("p",{className:"truncate font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:x?.image||a.image})]})]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(qe,{tip:"Refresh details",children:e.jsx(pt,{"aria-label":"Refresh container details",onClick:_,disabled:h,children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e.jsx("path",{d:"M13.25 5.75A5.75 5.75 0 1 0 13 10.9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),e.jsx("path",{d:"M13.25 2.75v3h-3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})}),e.jsx(qe,{tip:"Close",children:e.jsx(pt,{"aria-label":"Close container details",onClick:t,children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",children:e.jsx("path",{d:"m4 4 8 8M12 4l-8 8"})})})})]})]}),e.jsx("div",{className:"mt-3 flex gap-1 overflow-x-auto border-b border-[var(--adf-ui-separator)] pb-1",children:E.map(k=>e.jsx("button",{onClick:()=>n(k.id),className:`whitespace-nowrap rounded-t px-3 py-1.5 text-[11px] font-medium outline-none focus-visible:ring-2 focus-visible:ring-[var(--adf-ui-focus)] ${r===k.id?"bg-[var(--adf-ui-accent-subtle)] text-[var(--adf-ui-accent)]":"text-[var(--adf-ui-text-muted)] hover:bg-[var(--adf-ui-surface-hover)] hover:text-[var(--adf-ui-text)]"}`,children:k.label},k.id))}),e.jsxs("div",{className:"flex-1 pt-4",children:[b&&e.jsxs("div",{className:"mb-3 rounded-[var(--adf-ui-control-radius)] bg-[var(--adf-ui-danger-subtle)] px-3 py-2 text-[11px] text-[var(--adf-ui-danger)]",children:[b," ",e.jsx("button",{className:"underline",onClick:_,children:"Retry"})]}),h&&!i&&e.jsx("div",{className:"py-12 text-center text-[11px] text-[var(--adf-ui-text-muted)]",children:"Loading container details…"}),r==="summary"&&i&&a.managed&&a.outdated&&e.jsxs("div",{className:"mb-3 flex items-start gap-2 rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] bg-[var(--adf-ui-surface-hover)] px-3 py-2 text-[11px] text-[var(--adf-ui-text-muted)]",children:[e.jsx("span",{className:"mt-1 size-1.5 shrink-0 rounded-full bg-[var(--adf-ui-text-subtle)]","aria-hidden":"true"}),e.jsx("span",{className:"leading-snug",children:"Rebuild available: it adds network isolation from other agents and erases this container's workspace files, installed packages and saved browser session."})]}),r==="summary"&&i&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 max-md:grid-cols-1",children:[e.jsxs("section",{className:"rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] p-4",children:[e.jsx("h4",{className:"mb-3 text-xs font-semibold text-[var(--adf-ui-text)]",children:"Overview"}),e.jsxs("dl",{className:"grid grid-cols-[110px_minmax(0,1fr)] gap-x-3 gap-y-2 text-[11px]",children:[e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"State"}),e.jsx("dd",{children:x?.state??a.state}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Created"}),e.jsx("dd",{children:Cr(x?.createdAt??a.createdAt)}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Started"}),e.jsx("dd",{children:Cr(x?.startedAt)}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Network"}),e.jsx("dd",{className:"font-mono",children:x?.ipAddress||"—"}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"PID"}),e.jsx("dd",{children:x?.pid||"—"}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Container ID"}),e.jsx("dd",{className:"truncate font-mono",children:x?.id||a.id})]})]}),e.jsxs("section",{className:"rounded-[var(--adf-ui-container-radius)] border border-[var(--adf-ui-border)] p-4",children:[e.jsx("h4",{className:"mb-3 text-xs font-semibold text-[var(--adf-ui-text)]",children:"Assignment"}),e.jsxs("dl",{className:"grid grid-cols-[110px_minmax(0,1fr)] gap-x-3 gap-y-2 text-[11px]",children:[e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Scope"}),e.jsx("dd",{children:a.scope==="dedicated"?"Dedicated agent container":a.scope==="legacy"?"Legacy, unlabeled container":"Shared ADF container"}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Agent"}),e.jsx("dd",{children:a.agentName||a.agentId||(a.scope==="shared"?"Multiple agents":"—")}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Workspace"}),e.jsx("dd",{className:"font-mono",children:a.scope==="dedicated"?"/workspace":"/workspace/{agentId}"}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Lifecycle"}),e.jsx("dd",{children:a.managed?"Managed by ADF":"Read-only until rebuilt with ADF labels"}),e.jsx("dt",{className:"text-[var(--adf-ui-text-muted)]",children:"Command"}),e.jsx("dd",{className:"truncate font-mono",children:x?.command?.join(" ")||"—"})]})]})]}),r==="activity"&&(c.length===0?e.jsx("div",{className:"py-12 text-center text-[11px] text-[var(--adf-ui-text-muted)]",children:"No ADF compute commands recorded this session."}):e.jsx("div",{className:"space-y-2",children:[...c].reverse().map((k,q)=>e.jsxs("div",{className:"rounded-[var(--adf-ui-control-radius)] border border-[var(--adf-ui-border)] p-3",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx("span",{className:`size-1.5 rounded-full ${k.exitCode===0?"bg-[var(--adf-ui-success)]":"bg-[var(--adf-ui-danger)]"}`}),e.jsxs("span",{className:"font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:[new Date(k.timestamp).toLocaleTimeString()," · ",k.durationMs,"ms",k.exitCode!==0?` · exit ${k.exitCode}`:""]})]}),e.jsxs("pre",{className:"whitespace-pre-wrap break-all font-mono text-[11px] text-[var(--adf-ui-text)]",children:["$ ",k.command]}),k.stdout&&e.jsx("pre",{className:"mt-2 whitespace-pre-wrap border-l border-[var(--adf-ui-border)] pl-2 font-mono text-[11px] text-[var(--adf-ui-text-muted)]",children:k.stdout}),k.stderr&&e.jsx("pre",{className:"mt-2 whitespace-pre-wrap border-l border-[var(--adf-ui-danger)] pl-2 font-mono text-[11px] text-[var(--adf-ui-danger)]",children:k.stderr})]},`${k.timestamp}-${q}`))})),r==="logs"&&e.jsx("pre",{className:D,children:i?.logs||(a.running?"No container output.":"Container is stopped; showing no live output.")}),r==="processes"&&e.jsx("pre",{className:D,children:i?.processes||(a.running?"Processes unavailable.":"Container is stopped.")}),r==="workspace"&&e.jsx("pre",{className:D,children:i?.workspace||(a.running?"Workspace unavailable.":"Start the container to inspect its workspace.")}),r==="packages"&&e.jsx("pre",{className:D,children:i?.packages||(a.running?"Package information unavailable.":"Start the container to inspect packages.")}),r==="inspect"&&e.jsx("pre",{className:D,children:i?.inspect||"Inspect data unavailable."})]})]})})}function Cr(a){if(!a||/^0001-/.test(a))return"—";const t=new Date(a);return Number.isNaN(t.getTime())?a:t.toLocaleString()}export{p0 as OUTDATED_CONTAINER_ADVISORY,m0 as PROMPTS_COMPOSITION,g0 as SecretStorageGroup,K0 as SettingsPage,x0 as secretStorageDescription,on as setupLogTone};
|