tarsk 0.5.75 → 0.5.76
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/dist/public/assets/{account-view-DvyhZGLB.js → account-view-CWtpznW2.js} +1 -1
- package/dist/public/assets/browser-tab-D_5MLhxE.js +12 -0
- package/dist/public/assets/chat-dock-context-8K8Ikjgy.js +1 -0
- package/dist/public/assets/{commit-dialog-BUfbvG6F.js → commit-dialog-CSXPoomw.js} +1 -1
- package/dist/public/assets/{commit-error-dialog-D1XRPBOc.js → commit-error-dialog-CdcGI69P.js} +1 -1
- package/dist/public/assets/{commit-method-fields-CVQjrJ_O.js → commit-method-fields-BtEHb0_G.js} +1 -1
- package/dist/public/assets/{conversation-history-view-CzRrC6cJ.js → conversation-history-view-CuzU9qF6.js} +1 -1
- package/dist/public/assets/{create-project-dialog-Bqm_qC2v.js → create-project-dialog-a6Wgq-Z8.js} +1 -1
- package/dist/public/assets/{create-repo-dialog-D2H1eZic.js → create-repo-dialog-BTIQ5Nw4.js} +1 -1
- package/dist/public/assets/{diff-view-zXlCXzER.js → diff-view-DA1uT9tc.js} +2 -2
- package/dist/public/assets/{explorer-tab-view-BOc5FPFg.js → explorer-tab-view-CewTYYOm.js} +2 -2
- package/dist/public/assets/explorer-tree-C0VDhihz.js +1 -0
- package/dist/public/assets/{explorer-view-DFjt0DXO.js → explorer-view-RCfDm3p5.js} +2 -2
- package/dist/public/assets/{git-history-dialog-CFoZcBB0.js → git-history-dialog-DL0Trxiz.js} +1 -1
- package/dist/public/assets/index-B3-5kIOf.js +3658 -0
- package/dist/public/assets/merged-pr-dialog-BzND8nzx.js +1 -0
- package/dist/public/assets/{model-list-controls-CNrps9Ys.js → model-list-controls-I67L2x3H.js} +1 -1
- package/dist/public/assets/onboarding-dialog-DY8v11hv.js +1 -0
- package/dist/public/assets/{project-coding-view-DG1D8-z4.js → project-coding-view-DxOwsjtt.js} +1 -1
- package/dist/public/assets/project-danger-zone-view-CkvKOQrl.js +1 -0
- package/dist/public/assets/{project-env-vars-view-TblkryyN.js → project-env-vars-view-DYLWA7s0.js} +1 -1
- package/dist/public/assets/{project-model-aliases-view-Ct0v4NQm.js → project-model-aliases-view-DWu9khLA.js} +1 -1
- package/dist/public/assets/{project-settings-view-Dd3QPujg.js → project-settings-view-DJfmaWn6.js} +1 -1
- package/dist/public/assets/{project-tools-view-DdsKSUDp.js → project-tools-view-BEjBkghz.js} +1 -1
- package/dist/public/assets/providers-list-view-jMEPJCci.js +1 -0
- package/dist/public/assets/{pull-request-dialog-BRiR5Qz8.js → pull-request-dialog-B_JCqT53.js} +1 -1
- package/dist/public/assets/{pull-with-changes-dialog-BCIWOzvE.js → pull-with-changes-dialog-V3_km2zQ.js} +1 -1
- package/dist/public/assets/{push-before-pr-dialog-BEr0QZlO.js → push-before-pr-dialog-CarrD3y2.js} +1 -1
- package/dist/public/assets/{settings-general-view-CKvkG8C5.js → settings-general-view-BhrfHGfQ.js} +1 -1
- package/dist/public/assets/{settings-list-B9a61wMg.js → settings-list-DiiYzOxn.js} +1 -1
- package/dist/public/assets/{settings-logs-view-4Uoa1-Dx.js → settings-logs-view-DbKM1SNk.js} +2 -2
- package/dist/public/assets/settings-mcp-servers-view-4FpPIeYV.js +5 -0
- package/dist/public/assets/{settings-models-view-Ef404r4H.js → settings-models-view-CJVeo9ad.js} +1 -1
- package/dist/public/assets/settings-skills-view-DoRPGbHG.js +3 -0
- package/dist/public/assets/{settings-slack-view-C32in2Wg.js → settings-slack-view-Cc1NgVkx.js} +1 -1
- package/dist/public/assets/settings-slash-commands-view-CmlWqqmi.js +1 -0
- package/dist/public/assets/{settings-statistics-view-CxW2KB56.js → settings-statistics-view-DRuyEbcN.js} +1 -1
- package/dist/public/assets/settings-storage-view-DihbtUYb.js +1 -0
- package/dist/public/assets/{settings-subagents-view-StdmEn-E.js → settings-subagents-view-B2RvxDZI.js} +2 -2
- package/dist/public/assets/{settings-system-prompt-view-DizAjXjo.js → settings-system-prompt-view-CvVbgjNN.js} +1 -1
- package/dist/public/assets/settings-view-CPUAjTMa.js +2 -0
- package/dist/public/assets/tasks-view-CvFFLPeD.js +1 -0
- package/dist/public/assets/{terminal-panel-DSfDZzBk.js → terminal-panel-DIh6it7K.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-DNExGWVs.js → use-active-dock-panel-instance-DRfRj6MV.js} +1 -1
- package/dist/public/assets/{use-installed-ai-files-BuuVI3sM.js → use-installed-ai-files-C8nNWGC7.js} +1 -1
- package/dist/public/assets/{useBaseQuery-GJoj38pA.js → useBaseQuery-34f0-SVd.js} +1 -1
- package/dist/public/assets/{web-DyYrh5r4.js → web-Bn9n5e7r.js} +1 -1
- package/dist/public/assets/{web-CliOgvKf.js → web-C2KGFouM.js} +1 -1
- package/dist/public/assets/{web-Dzci4edU.js → web-Dk3GAfTy.js} +1 -1
- package/dist/public/assets/{web-BmpJHrzY.js → web-DycfRH4j.js} +1 -1
- package/dist/public/index.html +3 -3
- package/package.json +1 -1
- package/dist/public/assets/browser-tab-5rqpwS93.js +0 -12
- package/dist/public/assets/chat-dock-context-BJNNRoZC.js +0 -1
- package/dist/public/assets/explorer-tree-m1u3VhWL.js +0 -1
- package/dist/public/assets/index-u8UbWjXL.js +0 -3658
- package/dist/public/assets/merged-pr-dialog-BMqHRow2.js +0 -1
- package/dist/public/assets/onboarding-dialog-BFJftu2O.js +0 -1
- package/dist/public/assets/project-danger-zone-view-6HEDGyUj.js +0 -1
- package/dist/public/assets/providers-list-view-BUNk2E8O.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-CaAy6iV4.js +0 -5
- package/dist/public/assets/settings-skills-view-DLrG4E_U.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-CpBMV_5D.js +0 -1
- package/dist/public/assets/settings-storage-view-BzT8k6yE.js +0 -1
- package/dist/public/assets/settings-view-CTQgFmjM.js +0 -2
- package/dist/public/assets/tasks-view-z93aMoQp.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{Dt as n}from"./dist-CTLFS4dn.js";import{t as r}from"./button-kWtLAMpB.js";import{_r as i,a,dr as o,gr as s,hr as c,mr as l,pr as u,vr as d}from"./index-u8UbWjXL.js";var f=e(),p=t();function m(e){let t=(0,f.c)(30),{open:m,onOpenChange:h,onNewBranch:g,onJustOpen:_,newChatOnNewBranch:v,onNewChatOnNewBranchChange:y,isLoading:b,projectName:x}=e,S=b===void 0?!1:b,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(d,{children:`Pull Request Merged`}),t[0]=C):C=t[0];let w=x?` for ${x}`:``,T;t[1]===w?T=t[2]:(T=(0,p.jsxs)(i,{children:[C,(0,p.jsxs)(c,{children:[`The PR has already been merged`,w,`. Create a new branch and PR?`]})]}),t[1]=w,t[2]=T);let E;t[3]===y?E=t[4]:(E=e=>y(e===!0),t[3]=y,t[4]=E);let D;t[5]!==v||t[6]!==E?(D=(0,p.jsx)(a,{id:`new-chat-on-new-branch`,checked:v,onCheckedChange:E}),t[5]=v,t[6]=E,t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(o,{htmlFor:`new-chat-on-new-branch`,className:n.labelNormal,children:`New Chat`}),t[8]=O):O=t[8];let k;t[9]===D?k=t[10]:(k=(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,O]}),t[9]=D,t[10]=k);let A;t[11]!==S||t[12]!==_?(A=(0,p.jsx)(r,{variant:`ghost`,onClick:_,disabled:S,children:`Just Open`}),t[11]=S,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==S||t[15]!==g?(j=(0,p.jsx)(r,{onClick:g,disabled:S,children:`New Branch`}),t[14]=S,t[15]=g,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,p.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]!==M||t[21]!==k?(N=(0,p.jsxs)(s,{className:`flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[k,M]}),t[20]=M,t[21]=k,t[22]=N):N=t[22];let P;t[23]!==N||t[24]!==T?(P=(0,p.jsxs)(l,{children:[T,N]}),t[23]=N,t[24]=T,t[25]=P):P=t[25];let F;return t[26]!==h||t[27]!==m||t[28]!==P?(F=(0,p.jsx)(u,{open:m,onOpenChange:h,children:P}),t[26]=h,t[27]=m,t[28]=P,t[29]=F):F=t[29],F}export{m as MergedPRDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,N as a,rt as o}from"./dist-CTLFS4dn.js";import{a as s,r as c,t as l}from"./button-kWtLAMpB.js";import{Bn as u,Ot as d,Pn as f,Un as p,_n as m,fn as h,kn as g,q as _}from"./dist-c_QADQ5u.js";import{i as v,n as y,r as b,t as x}from"./tooltip-Db8UeYxm.js";import{Cn as S,G as C,Nt as w,V as T,jt as E,m as D,o as O,wn as k}from"./api-DX1ny6q-.js";import{n as A}from"./scroll-area-lkVMElz5.js";import{Ct as j,On as M,Rt as N,_r as P,_t as F,dr as I,dt as L,fr as R,ft as z,gr as B,hr as V,lt as H,mr as U,ot as W,pr as G,pt as K,st as q,ut as ee,vr as J}from"./index-u8UbWjXL.js";import{n as Y,t as te}from"./toggle-group-Q36wRGKA.js";import{t as ne}from"./sorting-DqwxPMRN.js";import{t as re}from"./pending-changes-Bn-0ak1d.js";function ie(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function ae(e){return[M(e.id),e.name,ie(e.name)]}function oe(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return ae(e).some(e=>n.has(e.toLowerCase()))}function se(e,t){return e.filter(e=>oe(e,t)).map(e=>e.id)}var X=t(),Z=e(n(),1),Q=r(),ce=a(`app.model-selector.ui`),le=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`;function ue({provider:e,onModelsChange:t,isLoading:n,disabled:r,displayMode:a=`grid`,autoSelectRecommended:o=!1}){let[l,u]=(0,Z.useState)([]),[f,h]=(0,Z.useState)(new Set),[g,S]=(0,Z.useState)(new Set),[T,E]=(0,Z.useState)(new Map),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(``),[j,N]=(0,Z.useState)(`alphabetical`);(0,Z.useEffect)(()=>{P()},[e]);let P=async()=>{O(!0),A(``),N(`alphabetical`);try{let t=await C(e);u(t.models);let n=new Set(t.enabledModelIds);h(n);let r=new Map,i=new Set;if(o)try{let{models:e}=await w();i=new Set(se(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){ce.error(`Failed to load recommended models:`,e)}S(i),E(r),F(n,r,t.models)}catch(t){ce.error(`Failed to load models for ${e}:`,t),u([]),h(new Set),S(new Set)}finally{O(!1)}},F=(e,n,r=l)=>{let i=new Set(e);r.forEach(e=>{n.has(e.id)&&(n.get(e.id)?i.add(e.id):i.delete(e.id))}),t?.(i)},I=e=>{E(t=>{let n=re(t,e,f);return F(f,n),n})},L=e=>{E(t=>{let n=new Map(t);return l.forEach(t=>{let r=f.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),F(f,n),n})},z=e=>M(e.id);function B(e,t=T){let n=t.has(e),r=t.get(e);return n?!!r:f.has(e)}let V=ne({models:l,query:k,sortBy:j,getDisplayName:z,getPriority:e=>+!B(e.id)}),H=j===`alphabetical`?`alphabetical`:`price`;function U(e){if(e===`alphabetical`){N(`alphabetical`);return}e===`price`&&N(`price-low`)}function G(){j!==`alphabetical`&&N(e=>e===`price-low`?`price-high`:`price-low`)}return D||n?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(d,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):l.length===0?(0,Q.jsx)(`div`,{className:`text-center py-8`,children:(0,Q.jsx)(`p`,{className:i.bodyMuted,children:`No models available for this provider.`})}):a===`compact`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:c(`flex items-center justify-between gap-3`,r&&`opacity-25`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(W,{id:`select-all-models`,disabled:r,value:l.every(e=>B(e.id)),onChange:e=>L(e),ariaLabel:`Select all models`}),(0,Q.jsx)(`label`,{htmlFor:`select-all-models`,className:c(i.body,`cursor-pointer`),children:`Select all models`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[(0,Q.jsx)(_,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,Q.jsx)(R,{placeholder:`Search models...`,value:k,onChange:e=>A(e.target.value),disabled:r,className:`pl-8 h-9`})]}),(0,Q.jsxs)(te,{type:`single`,value:H,onValueChange:U,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,Q.jsx)(Y,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:r,className:le,children:(0,Q.jsx)(p,{className:`h-4 w-4`})}),(0,Q.jsx)(Y,{value:`price`,"aria-label":`Sort by price`,disabled:r,className:le,onClick:G,children:(0,Q.jsx)(m,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsx)(b,{children:(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 overflow-hidden rounded-md border border-table-border`,children:V.length===0?(0,Q.jsx)(`div`,{className:`text-center py-4`,children:(0,Q.jsx)(`p`,{className:i.bodyMuted,children:k?`No models match your search.`:`No models available.`})}):V.map(e=>{let t=B(e.id),n=e.pricing,a=t&&g.has(e.id);return(0,Q.jsxs)(x,{children:[(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:c(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default`,r&&`opacity-25`),children:[(0,Q.jsx)(W,{id:e.id,disabled:r,value:t??!1,onChange:()=>I(e.id),ariaLabel:`${z(e)} ${t?`enabled`:`disabled`}`}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:e.id,className:c(i.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[z(e),a&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,Q.jsx)(`span`,{className:c(i.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${s(n.prompt??0)} in | ${s(n.completion??0)} out`})]})]})}),e.description&&(0,Q.jsx)(y,{side:`top`,className:`max-w-xs`,children:(0,Q.jsx)(`p`,{className:i.body,children:e.description})})]},e.id)})})})]}):null}var $=a(`app.onboarding-dialog.ui`);function de(e){let t=(0,X.c)(26),{currentStep:n}=e,r=e=>e===`provider-selection`&&n===`provider-selection`||n===`model-selection`,a=e=>n===e,o=a(`git-check`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,s;t[0]===o?s=t[1]:(s=c(`flex items-center justify-center h-8 w-8 rounded-full`,i.label,o),t[0]=o,t[1]=s);let l;t[2]===s?l=t[3]:(l=(0,Q.jsx)(`div`,{className:s,children:`1`}),t[2]=s,t[3]=l);let u=r(`provider-selection`)?`bg-primary`:`bg-muted`,d;t[4]===u?d=t[5]:(d=c(`h-0.5 flex-1`,u),t[4]=u,t[5]=d);let f;t[6]===d?f=t[7]:(f=(0,Q.jsx)(`div`,{className:d}),t[6]=d,t[7]=f);let p=a(`provider-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,m;t[8]===p?m=t[9]:(m=c(`flex items-center justify-center h-8 w-8 rounded-full`,i.label,p),t[8]=p,t[9]=m);let h;t[10]===m?h=t[11]:(h=(0,Q.jsx)(`div`,{className:m,children:`2`}),t[10]=m,t[11]=h);let g=r(`model-selection`)?`bg-primary`:`bg-muted`,_;t[12]===g?_=t[13]:(_=c(`h-0.5 flex-1`,g),t[12]=g,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,Q.jsx)(`div`,{className:_}),t[14]=_,t[15]=v);let y=a(`model-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,b;t[16]===y?b=t[17]:(b=c(`flex items-center justify-center h-8 w-8 rounded-full`,i.label,y),t[16]=y,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`div`,{className:b,children:`3`}),t[18]=b,t[19]=x);let S;return t[20]!==v||t[21]!==x||t[22]!==l||t[23]!==f||t[24]!==h?(S=(0,Q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[l,f,h,v,x]}),t[20]=v,t[21]=x,t[22]=l,t[23]=f,t[24]=h,t[25]=S):S=t[25],S}function fe(e){let t=(0,X.c)(3),{currentStep:n}=e;if(n===`provider-selection`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{children:`Select an AI Provider`}),(0,Q.jsx)(V,{children:`Choose your preferred AI provider and enter your API key.`})]}),t[0]=e):e=t[0],e}if(n===`model-selection`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{children:`Select Models`}),(0,Q.jsx)(V,{children:`Choose which models you want to use with this provider.`})]}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(J,{children:`Let's get started`}),(0,Q.jsx)(V,{children:`First, we need to check that Git is installed on your system.`})]}),t[2]=r):r=t[2],r}function pe(e){let t=(0,X.c)(7),{gitLoading:n,gitInstalled:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(d,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(F,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,Q.jsx)(f,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:c(i.label,`text-green-900`),children:`Git is installed`}),(0,Q.jsx)(`p`,{className:i.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}),t[1]=e):e=t[1],e}let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(g,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),t[2]=a):a=t[2];let o,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:i.label,children:`Git is not installed`}),s=(0,Q.jsx)(`p`,{className:i.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),t[3]=o,t[4]=s):(o=t[3],s=t[4]);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=c(i.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),t[5]=l):l=t[5];let u;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsxs)(F,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[a,(0,Q.jsxs)(`div`,{className:`flex-1`,children:[o,s,(0,Q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:l,children:[`Download Git `,(0,Q.jsx)(h,{className:`h-3 w-3`})]})]})]}),t[6]=u):u=t[6],u}function me(e){let t=(0,X.c)(16),{selectedProvider:n,onProviderChange:r,apiKey:a,onApiKeyChange:s,validatingKey:l,providerEnvValues:u,onProviderEnvChange:d,keyError:f}=e,p;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==n||t[4]!==l?(p=(0,Q.jsx)(q,{selectedProvider:n,onProviderChange:r,showApiKeyInput:!0,apiKey:a,onApiKeyChange:s,variant:`dropdown`,isLoading:l}),t[0]=a,t[1]=s,t[2]=r,t[3]=n,t[4]=l,t[5]=p):p=t[5];let m;t[6]!==d||t[7]!==u||t[8]!==n?(m=n&&L(n).map(e=>(0,Q.jsx)(j,{label:(0,Q.jsx)(I,{htmlFor:e,children:ee(e)}),control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{id:e,value:u[e]??``,onChange:t=>d(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:o(n.slug)&&e===`LOCAL_API_URL`?n.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),n.slug===`azure`&&e===z(n)||o(n.slug)&&e===`LOCAL_API_URL`?(0,Q.jsx)(`p`,{className:c(i.bodyMuted,`mt-2 break-all`),children:K(n,u)||n.api}):null]}),align:`start`},e)),t[6]=d,t[7]=u,t[8]=n,t[9]=m):m=t[9];let h;t[10]===f?h=t[11]:(h=f&&(0,Q.jsx)(F,{variant:`error`,className:`mb-0`,children:f}),t[10]=f,t[11]=h);let g;return t[12]!==p||t[13]!==m||t[14]!==h?(g=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[p,m,h]}),t[12]=p,t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function he(e){let t=(0,X.c)(4),{providerSlug:n,modelsLoading:r,onModelsChange:i}=e,a;return t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(ue,{provider:n,isLoading:r,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:i})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3],a}function ge(e){let t=(0,X.c)(32),{currentStep:n,savingOnboarding:r,gitLoading:i,validatingKey:a,apiKey:o,hasProvider:s,onSkip:c,onBack:p,onContinue:m,onValidate:h,onFinish:g}=e,_;t[0]!==n||t[1]!==c||t[2]!==r?(_=n===`provider-selection`&&(0,Q.jsx)(l,{variant:`ghost`,onClick:c,disabled:r,children:`Skip for now`}),t[0]=n,t[1]=c,t[2]=r,t[3]=_):_=t[3];let v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(`div`,{children:_}),t[4]=_,t[5]=v);let y;t[6]!==n||t[7]!==p||t[8]!==r?(y=n!==`git-check`&&(0,Q.jsx)(l,{variant:`outline`,onClick:p,disabled:r,children:`Back`}),t[6]=n,t[7]=p,t[8]=r,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==i||t[12]!==m?(b=n===`git-check`&&(0,Q.jsxs)(l,{onClick:m,disabled:i,className:`gap-2`,children:[`Continue `,(0,Q.jsx)(u,{className:`h-4 w-4`})]}),t[10]=n,t[11]=i,t[12]=m,t[13]=b):b=t[13];let x;t[14]!==o||t[15]!==n||t[16]!==s||t[17]!==h||t[18]!==a?(x=n===`provider-selection`&&(0,Q.jsx)(l,{onClick:h,disabled:a||!o.trim()||!s,className:`gap-2`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Next `,(0,Q.jsx)(u,{className:`h-4 w-4`})]})}),t[14]=o,t[15]=n,t[16]=s,t[17]=h,t[18]=a,t[19]=x):x=t[19];let S;t[20]!==n||t[21]!==g||t[22]!==r?(S=n===`model-selection`&&(0,Q.jsx)(l,{onClick:g,disabled:r,className:`gap-2`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(d,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Finish `,(0,Q.jsx)(f,{className:`h-4 w-4`})]})}),t[20]=n,t[21]=g,t[22]=r,t[23]=S):S=t[23];let C;t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[y,b,x,S]}),t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,Q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,Q.jsxs)(B,{className:`flex items-center justify-between`,children:[v,C]})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w}function _e({open:e,onOpenChange:t,onComplete:n}){let[r,i]=(0,Z.useState)(`git-check`),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)({}),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(``),[x,w]=(0,Z.useState)(new Set),[j,M]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&r===`git-check`&&R()},[e,r]),(0,Z.useEffect)(()=>{e&&r===`provider-selection`&&l.length===0&&z()},[e,r,l.length]),(0,Z.useEffect)(()=>{e&&r===`model-selection`&&d&&B()},[e,r,d]);let R=async()=>{c(!0);try{let e=await O();o(e.gitInstalled),e.gitInstalled&&i(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),o(!1)}finally{c(!1)}},z=async()=>{try{let e=await E();if(u(e),e.length>0&&!d){let t=H(e);t&&(f(t),m(t.apiKey??``),g(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},B=async()=>{if(d){M(!0);try{await C(d.name),w(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{M(!1)}}},V=async()=>{if(!d||!p.trim()){b(`Please enter an API key`);return}let e=L(d),t=e.find(e=>!h[e]?.trim());if(t){b(`Please enter ${ee(t)}`);return}v(!0),b(``);try{e.length>0&&await S(Object.fromEntries(e.map(e=>[e,h[e].trim()]))),await k(d.slug,p),i(`model-selection`)}catch(e){b(e instanceof Error?e.message:`Failed to validate API key`)}finally{v(!1)}},W=async()=>{if(d){I(!0);try{for(let e of x)await T(d.slug,e);N(),await D(),n?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{I(!1)}}},K=async()=>{I(!0);try{await D(),n?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{I(!1)}},q=e=>{f(e),m(e.apiKey??``),g(e.envValues??{}),b(``)},J=(e,t)=>{g(n=>({...n,[e]:t}))},Y=()=>{i(`provider-selection`)};function te(){r===`provider-selection`?i(`git-check`):r===`model-selection`&&i(`provider-selection`)}return(0,Q.jsx)(G,{open:e,onOpenChange:t,children:(0,Q.jsxs)(U,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,Q.jsx)(de,{currentStep:r}),(0,Q.jsx)(P,{children:(0,Q.jsx)(fe,{currentStep:r})})]}),(0,Q.jsx)(A,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`px-6 py-4`,children:[r===`git-check`&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(pe,{gitLoading:s,gitInstalled:a})}),r===`provider-selection`&&(0,Q.jsx)(me,{selectedProvider:d,onProviderChange:q,apiKey:p,onApiKeyChange:m,validatingKey:_,providerEnvValues:h,onProviderEnvChange:J,keyError:y}),r===`model-selection`&&d&&(0,Q.jsx)(he,{providerSlug:d.slug,modelsLoading:j,onModelsChange:w})]})}),(0,Q.jsx)(ge,{currentStep:r,savingOnboarding:F,gitLoading:s,validatingKey:_,apiKey:p,hasProvider:!!d,onSkip:()=>void K(),onBack:te,onContinue:Y,onValidate:()=>void V(),onFinish:()=>void W()})]})})}export{_e as OnboardingDialog,_e as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{Dt as n}from"./dist-CTLFS4dn.js";import{r}from"./store-BSzKIu5G.js";import{m as i,t as a}from"./button-kWtLAMpB.js";import{Et as o,Fn as s,St as c,Tt as l,kt as u,vt as d}from"./index-u8UbWjXL.js";var f=e(),p=t();function m(e){let t=(0,f.c)(11),{projectId:m}=e,h=s(),g;t[0]===m?g=t[1]:(g=e=>e.projects.find(e=>e.projectId===m),t[0]=m,t[1]=g);let _=r(g);if(!m){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,p.jsx)(l,{title:`No project selected`,children:`Please select a project from the sidebar to manage its danger zone.`}),t[2]=e):e=t[2],e}let v=_?.builtIn===!0,y;t[3]===_?y=t[4]:(y=_?i(_):``,t[3]=_,t[4]=y);let b=y,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(d,{title:`Danger Zone`,description:`Irreversible actions for this project.`,sticky:!1}),t[5]=x):x=t[5];let S;return t[6]!==v||t[7]!==m||t[8]!==b||t[9]!==h?(S=(0,p.jsx)(c,{loading:!1,children:(0,p.jsxs)(u,{className:`shrink-0`,children:[x,(0,p.jsx)(o,{className:`max-w-none pt-6`,children:v?(0,p.jsx)(`p`,{className:n.bodyMuted,children:`Built-in bots cannot be deleted.`}):(0,p.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[(0,p.jsx)(`p`,{className:n.bodyMuted,children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`}),(0,p.jsx)(a,{type:`button`,variant:`destructive`,onClick:()=>{h({id:m,name:b})},children:`Delete Project`})]})})]})}),t[6]=v,t[7]=m,t[8]=b,t[9]=h,t[10]=S):S=t[10],S}export{m as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{c as i,s as a}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as o,Et as s,N as c,rt as l}from"./dist-CTLFS4dn.js";import{$ as u,n as d}from"./store-BSzKIu5G.js";import{a as f,r as p,s as m,t as h}from"./button-kWtLAMpB.js";import{$ as g,Mn as _,Nt as v,Ot as y,dn as b,q as x,un as S,y as C}from"./dist-c_QADQ5u.js";import{i as w,n as ee,r as T,t as E}from"./tooltip-Db8UeYxm.js";import{B as te,Cn as ne,G as re,L as ie,Ot as ae,R as oe,V as se,W as ce,jt as le,sn as D,tt as O,wn as ue}from"./api-DX1ny6q-.js";import{t as k}from"./suspense-resource-BFrb_XJX.js";import{t as A}from"./use-suspense-resource-Dakt9lfT.js";import{n as j}from"./async-loading-fallback-V0EaQ_Kn.js";import{$n as de,Ct as M,Et as N,On as P,Qn as F,Rt as fe,Tt as pe,Xn as me,Zn as he,_t as I,ct as L,dt as R,fr as z,kt as B,mt as V,ot as H,ut as ge,vt as U,wt as W}from"./index-u8UbWjXL.js";import{t as G}from"./async-error-boundary-BX1G17o9.js";import{t as K}from"./sorting-DqwxPMRN.js";import{t as _e}from"./pending-changes-Bn-0ak1d.js";import{a as q}from"./settings-list-B9a61wMg.js";import{t as J}from"./use-deferred-search-Dgxosq55.js";import{n as Y,r as X,t as ve}from"./model-list-controls-CNrps9Ys.js";var Z=t(),Q=e(n(),1),$=r(),ye=m(p(o.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function be(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=p(ye({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,$.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var xe=c(`app.use-provider-details.hook`);function Se(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function Ce({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:n}){let r=d(),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(``),[c,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(new Set),[C,w]=(0,Q.useState)(new Map),{query:ee,setQuery:T,deferredQuery:E}=J(),[O,k]=(0,Q.useState)(`alphabetical`),[A,j]=(0,Q.useState)(`all`),[de,M]=(0,Q.useState)(!1),[N,F]=(0,Q.useState)(``),[pe,me]=(0,Q.useState)(``),[he,I]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`coding`),[z,B]=(0,Q.useState)([]),[V,H]=(0,Q.useState)(new Set),[U,W]=(0,Q.useState)(new Set),[G,q]=(0,Q.useState)(new Map),[Y,X]=(0,Q.useState)({}),ve=e=>P(e.id);(0,Q.useEffect)(()=>{(async()=>{if(g(``),n&&(t&&n.slug===t||e&&n.name===e)){a(n),I(n.apiKey??``),s(n.apiKey??``),X(n.envValues??{}),be(n.slug),Z(n.slug);return}try{let n=Se(await le(),e,t);a(n),I(n?.apiKey??``),s(n?.apiKey??``),X(n?.envValues??{}),n&&(be(n.slug),Z(n.slug))}catch(e){g(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,n]);let Z=async e=>{m(null);try{let t=await ae(e);t.status===`success`&&m(t.balance)}catch(t){xe.error(`Failed to load balance for ${e}:`,t)}};function $(){v([]),B([]),b(new Set),S(new Set),H(new Set),W(new Set),w(new Map),q(new Map)}function ye(e){return e instanceof Error?e.message:`Failed to load models from local API`}let be=async e=>{f(!0),me(``),T(``),k(`alphabetical`),j(`all`),R(`coding`);try{let[t,n]=await Promise.all([re(e),ce(e)]);v(t.models),B(n.models);let r=new Set(t.enabledModelIds);b(r),S(r);let i=new Set(n.enabledModelIds);H(i),W(i),w(new Map),q(new Map)}catch(t){xe.error(`Failed to load models for ${e}:`,t),$(),me(ye(t))}finally{f(!1)}};async function Ce(e){f(!0),me(``);try{await D(e),await be(e),r({type:u.ConfigUpdated})}catch(t){xe.error(`Failed to refresh models for ${e}:`,t),$(),me(ye(t)),f(!1)}}let we=(e,t)=>{i?.name===e&&(s(t),Ee(t))},Te=(e,t)=>{X(n=>({...n,[e]:t})),i&&(async()=>{try{await ne({[e]:t}),r({type:u.ConfigUpdated}),F(`${ge(e)} saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save provider settings`);return}l(i.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Ce(i.slug)})()},Ee=async e=>{if(!(!i||e===he))try{await ue(i.slug,e),r({type:u.ConfigUpdated}),I(e),F(`API key saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save API key`)}},De=(e,t)=>{t===`image`?q(t=>{let n=new Map(t),r=V.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Oe(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):w(t=>{let n=_e(t,e,y);return Oe(e,(n.has(e)?n.get(e):y.has(e))??!1,`coding`),n})},Oe=async(e,t,n=`coding`)=>{if(i)try{n===`image`?(t?(await te(i.slug,e),H(t=>new Set([...t,e]))):(await ie(i.slug,e),H(t=>{let n=new Set(t);return n.delete(e),n})),q(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await se(i.slug,e),b(t=>new Set([...t,e]))):(await oe(i.slug,e),b(t=>{let n=new Set(t);return n.delete(e),n})),w(t=>{let n=new Map(t);return n.delete(e),n}),fe()),r({type:u.ConfigUpdated}),F(`Model preferences saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save model changes`)}};async function ke(e,t=`coding`){let n=t===`image`?z:_,r=t===`image`?V:y;(t===`image`?q:w)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await Oe(i.id,e,t)}let Ae=o!==void 0&&o.trim().length>0;return{selectedProvider:i,error:h,balance:p,displayApiKey:o,showApiKey:de,setShowApiKey:M,providerEnvValues:Y,modelsLoading:c,modelsError:pe,saveStatus:N,modelTab:L,setModelTab:R,modelSearchQuery:ee,setModelSearchQuery:T,modelSortBy:O,setModelSortBy:k,modelFilter:A,setModelFilter:j,availableModels:_,enabledModelIds:y,pendingChanges:C,filteredAndSortedModels:(0,Q.useMemo)(()=>K({models:_,query:E,sortBy:O,getDisplayName:ve,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!x.has(e.id)}),[_,E,A,x,O,ve]),availableImageModels:z,enabledImageModelIds:V,pendingImageChanges:G,filteredAndSortedImageModels:(0,Q.useMemo)(()=>K({models:z,query:E,sortBy:O===`coding-index`||O===`intelligence-by-price`?`alphabetical`:O,getDisplayName:ve,freeOnly:A===`free`,groupByProvider:!0,getPriority:e=>+!U.has(e.id)}),[z,E,A,U,O,ve]),hasApiKey:Ae,getModelDisplayName:ve,handleUpdateKeyLocal:we,handleUpdateProviderEnv:Te,refreshLocalProviderModels:Ce,handleToggleModel:De,handleToggleAllModels:ke}}function we(e){let t=(0,Z.c)(7),{provider:n,onBack:r}=e;if(!r&&!n.url)return null;let i;t[0]===n.url?i=t[1]:(i=n.url?(0,$.jsx)(L,{url:n.url,className:p(o.compact,`p-3`)}):null,t[0]=n.url,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,$.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:r,children:[(0,$.jsx)(C,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close provider details`})]}):null,t[2]=r,t[3]=a);let s;return t[4]!==i||t[5]!==a?(s=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=s):s=t[6],s}function Te(e){let t=(0,Z.c)(6),{balance:n}=e;if(n===null)return null;let r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=p(o.compact,`inline-flex shrink-0 items-center gap-1.5 font-medium`),i=(0,$.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===n?a=t[3]:(a=f(n),t[2]=n,t[3]=a);let s;return t[4]===a?s=t[5]:(s=(0,$.jsxs)(`span`,{className:r,children:[i,`$`,a,` balance`]}),t[4]=a,t[5]=s),s}function Ee(e){let t=(0,Z.c)(8),{title:n,tooltip:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=p(o.label,`cursor-help`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(`span`,{className:i,children:n})}),t[1]=n,t[2]=a);let s;t[3]===r?s=t[4]:(s=(0,$.jsx)(ee,{children:r}),t[3]=r,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,$.jsx)(T,{children:(0,$.jsxs)(E,{children:[a,s]})}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}function De(e){let t=(0,Z.c)(10),{provider:n,displayApiKey:r,showApiKey:i,onToggleShowApiKey:a,onUpdateKey:o,providerEnvValues:s,onUpdateEnv:c,modelsLoading:u,onRefreshModels:d}=e,f;return t[0]!==r||t[1]!==u||t[2]!==d||t[3]!==a||t[4]!==c||t[5]!==o||t[6]!==n||t[7]!==s||t[8]!==i?(f=(0,$.jsx)($.Fragment,{children:n.authType===`APIKey`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(W,{children:[(0,$.jsx)(M,{label:(0,$.jsx)(Ee,{title:`API Key`,tooltip:`Your API key is stored locally and never shared.`}),control:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(v,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(z,{type:i?`text`:`password`,placeholder:n.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:r,onChange:e=>{o(n.name,e.target.value)}}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:a,disabled:!r,children:i?(0,$.jsx)(b,{className:`h-4 w-4 text-muted-foreground`}):(0,$.jsx)(S,{className:`h-4 w-4 text-muted-foreground`})})]})}),R(n).map(e=>(0,$.jsx)(M,{label:(0,$.jsx)(Ee,{title:ge(e),tooltip:e}),control:l(n.slug)&&e===`LOCAL_API_URL`?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(z,{id:e,value:s[e]??``,onChange:t=>c(e,t.target.value),placeholder:n.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,$.jsx)(T,{children:(0,$.jsxs)(E,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{d(n.slug)},disabled:u,children:u?(0,$.jsx)(y,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(g,{className:`h-4 w-4 text-muted-foreground`})})}),(0,$.jsx)(ee,{children:`Refresh models`})]})})]}):(0,$.jsx)(z,{id:e,value:s[e]??``,onChange:t=>c(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})},e))]})}):(0,$.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,$.jsx)(I,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,$.jsxs)(h,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]})}),t[0]=r,t[1]=u,t[2]=d,t[3]=a,t[4]=c,t[5]=o,t[6]=n,t[7]=s,t[8]=i,t[9]=f):f=t[9],f}function Oe(e){let t=(0,Z.c)(23),{tab:n,model:r,displayName:i,willBeEnabled:a,hasApiKey:s,showStarRating:c,onToggle:l}=e,u=r.pricing,d=n===`image`?`image-${r.id}`:r.id,m=r.id,h=!s&&`opacity-25`,g;t[0]===h?g=t[1]:(g=p(`flex cursor-default items-center space-x-3 px-3 py-2 transition-colors hover:bg-muted/30`,h),t[0]=h,t[1]=g);let _=!s,v=a??!1,y;t[2]!==r.id||t[3]!==l?(y=()=>l(r.id),t[2]=r.id,t[3]=l,t[4]=y):y=t[4];let b=`${i} ${a?`enabled`:`disabled`}`,x;t[5]!==d||t[6]!==_||t[7]!==v||t[8]!==y||t[9]!==b?(x=(0,$.jsx)(H,{id:d,disabled:_,value:v,onChange:y,ariaLabel:b}),t[5]=d,t[6]=_,t[7]=v,t[8]=y,t[9]=b,t[10]=x):x=t[10];let S;t[11]!==d||t[12]!==i||t[13]!==r.coding_index||t[14]!==u||t[15]!==c||t[16]!==n?(S=n===`coding`?(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:p(o.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[c&&(0,$.jsx)(X,{codingIndex:r.coding_index,modelName:i}),u&&(0,$.jsx)(`span`,{className:p(o.caption,`whitespace-nowrap`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${f(u.prompt??0)} in | $${f(u.completion??0)} out`})]})]}):(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:p(o.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),u&&(0,$.jsx)(`span`,{className:p(o.caption,`whitespace-nowrap flex-shrink-0`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${f(u.prompt??0)} in | $${f(u.completion??0)} out`})]}),t[11]=d,t[12]=i,t[13]=r.coding_index,t[14]=u,t[15]=c,t[16]=n,t[17]=S):S=t[17];let C;return t[18]!==r.id||t[19]!==g||t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:g,children:[x,S]},m),t[18]=r.id,t[19]=g,t[20]=x,t[21]=S,t[22]=C):C=t[22],C}function ke(e){let t=(0,Z.c)(13),{tab:n,models:r,filteredModels:i,modelsLoading:a,modelsError:c,hasApiKey:l,enabledModelIds:u,pendingChanges:d,modelSortBy:f,getModelDisplayName:m,onToggleModel:h}=e,g=n===`coding`,_=g?c?`No models loaded.`:`No models available for this provider.`:`No image models available for this provider.`,v;return t[0]!==_||t[1]!==u||t[2]!==i||t[3]!==m||t[4]!==l||t[5]!==g||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==h||t[10]!==d||t[11]!==n?(v=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:a?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(y,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):r.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:o.bodyMuted,children:_})}):(0,$.jsx)(T,{children:(0,$.jsx)(`div`,{className:p(`grid grid-cols-1 gap-0`,s.tableWrapper),children:i.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:o.bodyMuted,children:`No models matching your filters.`})}):i.map(e=>{let t=u.has(e.id),r=d.has(e.id),i=d.get(e.id),a=(r?i:t)??!1;return(0,$.jsx)(Oe,{tab:n,model:e,displayName:m(e),willBeEnabled:a,hasApiKey:l,showStarRating:g&&(f===`coding-index`||f===`intelligence-by-price`),onToggle:e=>h(e,n)},e.id)})})})}),t[0]=_,t[1]=u,t[2]=i,t[3]=m,t[4]=l,t[5]=g,t[6]=f,t[7]=r,t[8]=a,t[9]=h,t[10]=d,t[11]=n,t[12]=v):v=t[12],v}function Ae(e){let t=(0,Z.c)(22),{tab:n,showImageTab:r,modelsLoading:i,models:a,hasApiKey:o,enabledModelIds:s,pendingChanges:c,modelSearchQuery:l,onModelSearchQueryChange:u,modelSortBy:d,onModelSortByChange:f,onToggleAllModels:m}=e,h=n===`coding`,g=h?`select-all-models`:`select-all-image-models`,_=!i&&a.length>0,v=_&&!o&&`opacity-25`,y;t[0]===v?y=t[1]:(y=p(`flex flex-col gap-2 md:flex-row md:items-center`,v),t[0]=v,t[1]=y);let b;t[2]===r?b=t[3]:(b=r?(0,$.jsxs)(F,{className:`w-fit shrink-0 self-start`,children:[(0,$.jsx)(de,{value:`coding`,children:`Coding`}),(0,$.jsx)(de,{value:`image`,children:`Image`})]}):null,t[2]=r,t[3]=b);let S;t[4]!==s||t[5]!==o||t[6]!==h||t[7]!==l||t[8]!==d||t[9]!==a||t[10]!==u||t[11]!==f||t[12]!==m||t[13]!==c||t[14]!==g||t[15]!==_||t[16]!==n?(S=_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,$.jsx)(x,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,$.jsx)(z,{placeholder:`Search`,className:`pl-10 h-8`,value:l,onChange:e=>u(e.target.value),disabled:!o})]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 self-end md:ml-auto md:self-auto`,children:[(0,$.jsx)(ve,{id:g,disabled:!o,checked:a.every(e=>{let t=c.has(e.id),n=c.get(e.id);return t?n:s.has(e.id)}),onChange:e=>{m(e,n)}}),(0,$.jsx)(Y,{sortBy:d,showCodingIndex:h,showIntelligenceByPrice:h,onSortByChange:f})]})]}):null,t[4]=s,t[5]=o,t[6]=h,t[7]=l,t[8]=d,t[9]=a,t[10]=u,t[11]=f,t[12]=m,t[13]=c,t[14]=g,t[15]=_,t[16]=n,t[17]=S):S=t[17];let C;return t[18]!==y||t[19]!==b||t[20]!==S?(C=(0,$.jsxs)(`div`,{className:y,children:[b,S]}),t[18]=y,t[19]=b,t[20]=S,t[21]=C):C=t[21],C}function je(e){let t=(0,Z.c)(10),{title:n,description:r,action:i,tableHeader:a,children:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n?(s=(0,$.jsx)(U,{title:n,description:r,action:i,sticky:!1,tableHeader:a}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`div`,{className:`px-6 pb-6`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(B,{className:`shrink-0`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function Me(e){let t=(0,Z.c)(111),{selectedProviderName:n,selectedProviderSlug:r,providerData:i,onBack:a,className:o}=e,s=n===void 0?null:n,c=r===void 0?null:r,l;t[0]!==i||t[1]!==s||t[2]!==c?(l={selectedProviderName:s,selectedProviderSlug:c,providerData:i},t[0]=i,t[1]=s,t[2]=c,t[3]=l):l=t[3];let{selectedProvider:u,error:d,balance:f,displayApiKey:m,showApiKey:g,setShowApiKey:v,providerEnvValues:y,modelsLoading:b,modelsError:x,saveStatus:S,modelTab:C,setModelTab:w,modelSearchQuery:ee,setModelSearchQuery:T,modelSortBy:E,setModelSortBy:te,availableModels:ne,enabledModelIds:re,pendingChanges:ie,filteredAndSortedModels:ae,availableImageModels:oe,enabledImageModelIds:se,pendingImageChanges:ce,filteredAndSortedImageModels:le,hasApiKey:D,getModelDisplayName:O,handleUpdateKeyLocal:ue,handleUpdateProviderEnv:k,refreshLocalProviderModels:A,handleToggleModel:j,handleToggleAllModels:de}=Ce(l);if(d){let e;t[4]===o?e=t[5]:(e=p(`flex h-full min-h-0 flex-col items-center justify-center gap-4 p-6`,o),t[4]=o,t[5]=e);let n;t[6]===d?n=t[7]:(n=(0,$.jsx)(I,{variant:`error`,className:`mb-0`,children:d}),t[6]=d,t[7]=n);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(h,{variant:`outline`,size:`sm`,onClick:Ne,children:`Retry`}),t[8]=r):r=t[8];let i;return t[9]!==e||t[10]!==n?(i=(0,$.jsxs)(`div`,{className:e,children:[n,r]}),t[9]=e,t[10]=n,t[11]=i):i=t[11],i}if(!u){let e;t[12]===o?e=t[13]:(e=p(`flex h-full min-h-0 items-center justify-center`,o),t[12]=o,t[13]=e);let n=s||c?`Provider not found`:`Select a Provider`,r;t[14]===a?r=t[15]:(r=a?(0,$.jsxs)(h,{variant:`outline`,size:`sm`,onClick:a,children:[(0,$.jsx)(_,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,t[14]=a,t[15]=r);let i=a?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`,l;t[16]!==n||t[17]!==r||t[18]!==i?(l=(0,$.jsx)(pe,{title:n,action:r,children:i}),t[16]=n,t[17]=r,t[18]=i,t[19]=l):l=t[19];let u;return t[20]!==e||t[21]!==l?(u=(0,$.jsx)(`div`,{className:e,children:l}),t[20]=e,t[21]=l,t[22]=u):u=t[22],u}let M;t[23]===o?M=t[24]:(M=p(`h-full min-h-0`,o),t[23]=o,t[24]=M);let N;t[25]!==a||t[26]!==u?(N=(0,$.jsx)(we,{provider:u,onBack:a}),t[25]=a,t[26]=u,t[27]=N):N=t[27];let P;t[28]!==v||t[29]!==g?(P=()=>v(!g),t[28]=v,t[29]=g,t[30]=P):P=t[30];let F;t[31]!==m||t[32]!==ue||t[33]!==k||t[34]!==b||t[35]!==y||t[36]!==A||t[37]!==u||t[38]!==g||t[39]!==P?(F=(0,$.jsx)(`div`,{className:`pt-6`,children:(0,$.jsx)(De,{provider:u,displayApiKey:m,showApiKey:g,onToggleShowApiKey:P,onUpdateKey:ue,providerEnvValues:y,onUpdateEnv:k,modelsLoading:b,onRefreshModels:A})}),t[31]=m,t[32]=ue,t[33]=k,t[34]=b,t[35]=y,t[36]=A,t[37]=u,t[38]=g,t[39]=P,t[40]=F):F=t[40];let fe;t[41]!==u.name||t[42]!==N||t[43]!==F?(fe=(0,$.jsx)(je,{title:u.name,description:`Configure API keys and connection settings for this provider.`,action:N,children:F}),t[41]=u.name,t[42]=N,t[43]=F,t[44]=fe):fe=t[44];let L;t[45]!==T||t[46]!==te||t[47]!==w?(L=e=>{w(e),T(``),te(`alphabetical`)},t[45]=T,t[46]=te,t[47]=w,t[48]=L):L=t[48];let R;t[49]===f?R=t[50]:(R=(0,$.jsx)(Te,{balance:f}),t[49]=f,t[50]=R);let z;t[51]===u.name?z=t[52]:(z=u.name.toLowerCase(),t[51]=u.name,t[52]=z);let B=z===`openrouter`,V=C===`coding`?ne:oe,H=C===`coding`?re:se,ge=C===`coding`?ie:ce,U;t[53]!==de||t[54]!==D||t[55]!==ee||t[56]!==E||t[57]!==C||t[58]!==b||t[59]!==T||t[60]!==te||t[61]!==B||t[62]!==V||t[63]!==H||t[64]!==ge?(U=(0,$.jsx)(Ae,{tab:C,showImageTab:B,modelsLoading:b,models:V,hasApiKey:D,enabledModelIds:H,pendingChanges:ge,modelSearchQuery:ee,onModelSearchQueryChange:T,modelSortBy:E,onModelSortByChange:te,onToggleAllModels:de}),t[53]=de,t[54]=D,t[55]=ee,t[56]=E,t[57]=C,t[58]=b,t[59]=T,t[60]=te,t[61]=B,t[62]=V,t[63]=H,t[64]=ge,t[65]=U):U=t[65];let W;t[66]===x?W=t[67]:(W=x?(0,$.jsx)(I,{variant:`error`,className:`mb-4`,children:x}):null,t[66]=x,t[67]=W);let G;t[68]!==ne||t[69]!==re||t[70]!==ae||t[71]!==O||t[72]!==j||t[73]!==D||t[74]!==E||t[75]!==x||t[76]!==b||t[77]!==ie||t[78]!==u?(G=(0,$.jsx)(he,{value:`coding`,children:(0,$.jsx)(ke,{tab:`coding`,provider:u,models:ne,filteredModels:ae,modelsLoading:b,modelsError:x,hasApiKey:D,enabledModelIds:re,pendingChanges:ie,modelSortBy:E,getModelDisplayName:O,onToggleModel:j})}),t[68]=ne,t[69]=re,t[70]=ae,t[71]=O,t[72]=j,t[73]=D,t[74]=E,t[75]=x,t[76]=b,t[77]=ie,t[78]=u,t[79]=G):G=t[79];let K;t[80]!==oe||t[81]!==se||t[82]!==le||t[83]!==O||t[84]!==j||t[85]!==D||t[86]!==E||t[87]!==x||t[88]!==b||t[89]!==ce||t[90]!==u?(K=(0,$.jsx)(he,{value:`image`,children:(0,$.jsx)(ke,{tab:`image`,provider:u,models:oe,filteredModels:le,modelsLoading:b,modelsError:x,hasApiKey:D,enabledModelIds:se,pendingChanges:ce,modelSortBy:E,getModelDisplayName:O,onToggleModel:j})}),t[80]=oe,t[81]=se,t[82]=le,t[83]=O,t[84]=j,t[85]=D,t[86]=E,t[87]=x,t[88]=b,t[89]=ce,t[90]=u,t[91]=K):K=t[91];let _e;t[92]===S?_e=t[93]:(_e=S?(0,$.jsx)(I,{variant:S.includes(`error`)||S.includes(`Failed`)?`error`:`success`,className:`mt-4`,children:S}):null,t[92]=S,t[93]=_e);let q;t[94]!==R||t[95]!==U||t[96]!==W||t[97]!==G||t[98]!==K||t[99]!==_e?(q=(0,$.jsxs)(je,{title:`Models`,description:`Enable coding and image models for this provider.`,action:R,tableHeader:U,children:[W,G,K,_e]}),t[94]=R,t[95]=U,t[96]=W,t[97]=G,t[98]=K,t[99]=_e,t[100]=q):q=t[100];let J;t[101]!==C||t[102]!==q||t[103]!==L?(J=(0,$.jsx)(me,{value:C,onValueChange:L,children:q}),t[101]=C,t[102]=q,t[103]=L,t[104]=J):J=t[104];let Y;t[105]!==J||t[106]!==fe?(Y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[fe,J]})}),t[105]=J,t[106]=fe,t[107]=Y):Y=t[107];let X;return t[108]!==Y||t[109]!==M?(X=(0,$.jsx)(`div`,{className:M,children:Y}),t[108]=Y,t[109]=M,t[110]=X):X=t[110],X}function Ne(){return window.location.reload()}function Pe(e){return`providers:list:${e}`}async function Fe(){let[e,t]=await Promise.all([le(),O().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}var Ie=`grid min-h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 hover:bg-muted/30 cursor-pointer`,Le=`[&>*+*]:border-t [&>*+*]:border-table-border`;function Re(e){let t=(0,Z.c)(9),{title:n,description:r,action:i,children:a}=e,o;t[0]!==i||t[1]!==r||t[2]!==n?(o=(0,$.jsx)(U,{title:n,description:r,action:i,sticky:!1}),t[0]=i,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,$.jsx)(N,{className:`pt-6`,children:a}),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,$.jsxs)(B,{className:`shrink-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function ze(e){let t=(0,Z.c)(33),{loadVersion:n,onProviderClick:r}=e,{query:i,setQuery:a,deferredQuery:s}=J(),c;t[0]===n?c=t[1]:(c=Pe(n),t[0]=n,t[1]=c);let{providers:l,enabledModelCounts:u}=A(c,Fe),d;if(t[2]!==s||t[3]!==u||t[4]!==l){let e;t[6]===s?e=t[7]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=s,t[7]=e);let n;t[8]===u?n=t[9]:(n=(e,t)=>{let n=(u[e.slug]??0)>0,r=(u[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=u,t[9]=n),d=l.filter(He).filter(e).sort(n),t[2]=s,t[3]=u,t[4]=l,t[5]=d}else d=t[5];let f=d,m;if(t[10]!==s||t[11]!==l){let e;t[13]===s?e=t[14]:(e=e=>{let t=s.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=s,t[14]=e),m=l.filter(Ve).filter(e).sort(Be),t[10]=s,t[11]=l,t[12]=m}else m=t[12];let h=m,g;t[15]!==i||t[16]!==a?(g=(0,$.jsx)(q,{placeholder:`Search`,value:i,onChange:a,className:`mb-0 w-64`}),t[15]=i,t[16]=a,t[17]=g):g=t[17];let _;t[18]!==f||t[19]!==u||t[20]!==r||t[21]!==i?(_=f.length===0?(0,$.jsx)(`p`,{className:p(o.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,$.jsx)(`div`,{className:Le,children:f.map(e=>(0,$.jsx)(Ye,{provider:e,modelCount:u[e.slug]??0,onClick:r},e.name))}),t[18]=f,t[19]=u,t[20]=r,t[21]=i,t[22]=_):_=t[22];let v;t[23]!==g||t[24]!==_?(v=(0,$.jsx)(Re,{title:`Connected Providers`,description:`Providers you've connected with an API key or environment variable.`,action:g,children:_}),t[23]=g,t[24]=_,t[25]=v):v=t[25];let y;t[26]!==h||t[27]!==r||t[28]!==i?(y=(0,$.jsx)(Re,{title:`Available Providers`,description:`Connect additional providers by adding your API key.`,children:h.length===0?(0,$.jsx)(`p`,{className:p(o.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,$.jsx)(`div`,{className:Le,children:h.map(e=>(0,$.jsx)(Xe,{provider:e,onClick:r},e.name))})}),t[26]=h,t[27]=r,t[28]=i,t[29]=y):y=t[29];let b;return t[30]!==v||t[31]!==y?(b=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[v,y]})}),t[30]=v,t[31]=y,t[32]=b):b=t[32],b}function Be(e,t){return e.name.localeCompare(t.name)}function Ve(e){return!e.apiKey}function He(e){return e.apiKey}function Ue(){let e=(0,Z.c)(21),t=a(),{providerSlug:n}=i(),[r,o]=(0,Q.useState)(0),s=(0,Q.useRef)(n),c,l;e[0]!==r||e[1]!==n?(c=()=>{s.current&&!n&&(k(Pe(r)),o(qe)),s.current=n},l=[n,r],e[0]=r,e[1]=n,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===t?u=e[5]:(u=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=u);let d=u,f;e[6]!==r||e[7]!==t?(f=()=>{t(`/settings/providers`),k(Pe(r)),o(Ke)},e[6]=r,e[7]=t,e[8]=f):f=e[8];let p=f,m;e[9]===r?m=e[10]:(m=function(){k(Pe(r)),o(Ge)},e[9]=r,e[10]=m);let h=m;if(n){let t=decodeURIComponent(n),r;return e[11]!==p||e[12]!==t?(r=(0,$.jsx)(Me,{selectedProviderSlug:t,onBack:p}),e[11]=p,e[12]=t,e[13]=r):r=e[13],r}let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(j,{label:`Loading providers...`,size:`lg`}),e[14]=g):g=e[14];let _;e[15]!==d||e[16]!==r?(_=(0,$.jsx)(Q.Suspense,{fallback:g,children:(0,$.jsx)(ze,{loadVersion:r,onProviderClick:d},r)}),e[15]=d,e[16]=r,e[17]=_):_=e[17];let v;return e[18]!==h||e[19]!==_?(v=(0,$.jsx)(`div`,{className:`h-full min-h-0`,children:(0,$.jsx)(G,{fallbackTitle:`Failed to load providers`,onRetry:h,renderFallback:We,children:_})}),e[18]=h,e[19]=_,e[20]=v):v=e[20],v}function We(e,t){return(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(B,{className:`shrink-0`,children:[(0,$.jsx)(U,{title:`Providers`,description:`Manage your AI provider connections and API keys.`,sticky:!1}),(0,$.jsx)(`div`,{className:`flex items-center justify-center px-6 pb-6 pt-6`,children:(0,$.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,$.jsx)(I,{variant:`error`,className:`mb-4`,children:e.message}),(0,$.jsx)(h,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function Ge(e){return e+1}function Ke(e){return e+1}function qe(e){return e+1}function Je(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}function Ye(e){let t=(0,Z.c)(25),{provider:n,modelCount:r,onClick:i}=e,a;t[0]!==i||t[1]!==n?(a=function(){i(n)},t[0]=i,t[1]=n,t[2]=a):a=t[2];let s=a,c;t[3]===s?c=t[4]:(c=e=>Je(e,s),t[3]=s,t[4]=c);let l;t[5]===n?l=t[6]:(l=(0,$.jsx)(V,{provider:n}),t[5]=n,t[6]=l);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=p(o.label,`truncate leading-normal`),t[7]=u):u=t[7];let d;t[8]===n.name?d=t[9]:(d=(0,$.jsx)(`span`,{className:u,children:n.name}),t[8]=n.name,t[9]=d);let f;t[10]!==l||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[10]=l,t[11]=d,t[12]=f):f=t[12];let m;t[13]===n.isEnv?m=t[14]:(m=n.isEnv?(0,$.jsx)(be,{variant:`secondary`,className:p(o.compact,`px-2 py-0.5`),children:`Environment`}):(0,$.jsx)(be,{variant:`secondary`,className:p(o.compact,`px-2 py-0.5`),children:`API Key`}),t[13]=n.isEnv,t[14]=m);let h;t[15]===r?h=t[16]:(h=r>0&&(0,$.jsxs)(be,{variant:`default`,className:p(o.compact,`px-2 py-0.5`),children:[r,` `,r===1?`Model`:`Models`]}),t[15]=r,t[16]=h);let g;t[17]!==m||t[18]!==h?(g=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==s||t[21]!==c||t[22]!==f||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:Ie,role:`button`,tabIndex:0,onClick:s,onKeyDown:c,children:[f,g]}),t[20]=s,t[21]=c,t[22]=f,t[23]=g,t[24]=_):_=t[24],_}function Xe(e){let t=(0,Z.c)(18),{provider:n,onClick:r}=e,i;t[0]!==r||t[1]!==n?(i=function(){r(n)},t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,s;t[3]===a?s=t[4]:(s=e=>Je(e,a),t[3]=a,t[4]=s);let c;t[5]===n?c=t[6]:(c=(0,$.jsx)(V,{provider:n}),t[5]=n,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=p(o.label,`truncate leading-normal`),t[7]=l):l=t[7];let u;t[8]===n.name?u=t[9]:(u=(0,$.jsx)(`span`,{className:l,children:n.name}),t[8]=n.name,t[9]=u);let d;t[10]!==c||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12];let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{className:p(o.compact,`shrink-0 text-muted-foreground`),children:`Configure`}),t[13]=f):f=t[13];let m;return t[14]!==a||t[15]!==s||t[16]!==d?(m=(0,$.jsxs)(`div`,{className:Ie,role:`button`,tabIndex:0,onClick:a,onKeyDown:s,children:[d,f]}),t[14]=a,t[15]=s,t[16]=d,t[17]=m):m=t[17],m}export{Ue as ProvidersListView,Ue as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i}from"./dist-CTLFS4dn.js";import{r as a}from"./store-BSzKIu5G.js";import{d as o,r as s,t as c}from"./button-kWtLAMpB.js";import{$ as l,D as u,G as d,Nn as f,Pn as p,ct as m,fn as h,g,h as _,rt as v,t as y,u as b,y as x}from"./dist-c_QADQ5u.js";import{t as S}from"./dist-DoxvnNEY.js";import{i as C,n as w,r as T,t as E}from"./tooltip-Db8UeYxm.js";import{Qt as D,ft as O,i as k,mn as A}from"./api-DX1ny6q-.js";import{t as j}from"./use-toast-xpb5jNtN.js";import{n as M}from"./explorer-tab-context-BxUVwWQQ.js";import{t as N}from"./dist-CSssbxDI.js";import{$n as P,At as F,C as I,E as L,Et as R,Ft as z,Jn as B,Ln as V,Mt as H,Ot as ee,Pt as U,Qn as te,S as W,St as ne,T as re,Tt as G,Xn as K,Zn as q,cr as ie,fr as J,gt as Y,ht as ae,ir as oe,jt as X,kt as se,lr as ce,mr as le,or as ue,pr as de,rr as fe,sr as pe,tr as me,ur as he,vt as ge,w as _e,x as ve}from"./index-u8UbWjXL.js";import{t as ye}from"./delete-confirm-dialog-Dl76vaxb.js";import{t as be}from"./use-settings-page-loading-BTySlInF.js";import{n as xe}from"./settings-list-B9a61wMg.js";var Z=t(),Q=e(n(),1),$=r(),Se=`Switch`,[Ce,we]=_(Se),[Te,Ee]=Ce(Se),De=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:s,disabled:c,value:l=`on`,onCheckedChange:u,form:d,...f}=e,[p,m]=Q.useState(null),h=o(t,e=>m(e)),_=Q.useRef(!1),v=p?d||!!p.closest(`form`):!0,[x,S]=y({prop:i,defaultProp:a??!1,onChange:u,caller:Se});return(0,$.jsxs)(Te,{scope:n,checked:x,disabled:c,children:[(0,$.jsx)(b.button,{type:`button`,role:`switch`,"aria-checked":x,"aria-required":s,"data-state":Me(x),"data-disabled":c?``:void 0,disabled:c,value:l,...f,ref:h,onClick:g(e.onClick,e=>{S(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&(0,$.jsx)(je,{control:p,bubbles:!_.current,name:r,value:l,checked:x,required:s,disabled:c,form:d,style:{transform:`translateX(-100%)`}})]})});De.displayName=Se;var Oe=`SwitchThumb`,ke=Q.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Ee(Oe,n);return(0,$.jsx)(b.span,{"data-state":Me(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});ke.displayName=Oe;var Ae=`SwitchBubbleInput`,je=Q.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let s=Q.useRef(null),c=o(s,a),l=N(n),u=S(t);return Q.useEffect(()=>{let e=s.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(l!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[l,n,r]),(0,$.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:c,style:{...i.style,...u,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});je.displayName=Ae;function Me(e){return e?`checked`:`unchecked`}var Ne=De,Pe=ke,Fe=Q.forwardRef((e,t)=>{let n=(0,Z.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=s(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(Pe,{className:s(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),n[5]=o):o=n[5];let c;return n[6]!==i||n[7]!==t||n[8]!==a?(c=(0,$.jsx)(Ne,{className:a,...i,ref:t,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=c):c=n[9],c});Fe.displayName=Ne.displayName;var Ie={key:``,value:``},Le={serverType:`local`,name:``,command:``,argsText:``,serverUrl:``,transport:`sse`,oauthClientId:``,oauthClientSecret:``,oauthCallbackPort:``,defer:!0},Re=[e=>e.name,e=>e.command,e=>e.argsText,e=>e.serverUrl,e=>e.oauthClientId,e=>e.oauthClientSecret,e=>e.oauthCallbackPort];function ze(e,t){return e??t}function Be(e){return e?.url?`remote`:`local`}function Ve(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function He(e){let t={};for(let{key:n,value:r}of e)n.trim()&&(t[n.trim()]=r);return Object.keys(t).length>0?t:void 0}function Ue(e){return(e??[]).join(`
|
|
2
|
-
`)}function We(e){return e.split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(Boolean)}function Ge(e){return e===void 0?``:String(e)}function Ke(e){return{oauthClientId:ze(e?.clientId,``),oauthClientSecret:ze(e?.clientSecret,``),oauthCallbackPort:Ge(e?.callbackPort)}}function qe(e,t){return{...Le,name:e,serverType:Be(t),command:ze(t.command,``),argsText:Ue(t.args),serverUrl:ze(t.url,``),transport:ze(t.transport,`sse`),...Ke(t.oauth),defer:t.defer!==!1}}function Je(e,t,n){return JSON.stringify({name:e,type:t,config:n})}function Ye(e){if(!e)return;let t=Number.parseInt(e,10);return Number.isInteger(t)&&t>0?t:void 0}function Xe(e){let t={};for(let[n,r]of Object.entries(e))r!==``&&r!==void 0&&(t[n]=r);return t}function Ze(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function Qe(e,t,n){return e!==``||t!==``||n!==void 0}function $e(e){let t=e.oauthClientId.trim(),n=e.oauthClientSecret.trim(),r=Ye(e.oauthCallbackPort.trim());if(!Qe(t,n,r))return;let i=Xe({clientId:t,clientSecret:n,callbackPort:r});if(Object.keys(i).length!==0)return i}function et(e,t,n){return Ze({url:e.serverUrl.trim(),transport:e.transport,headers:He(n),env:He(t),oauth:$e(e),defer:e.defer?void 0:!1})}function tt(e,t){return Ze({command:e.command.trim(),args:We(e.argsText),env:He(t),defer:e.defer?void 0:!1})}function nt(e,t,n){return e.serverType===`remote`?et(e,t,n):tt(e,t)}function rt(e){let t=e.trim();if(!t)return`Server URL is required`;try{new URL(t)}catch{return`Server URL must be a valid URL`}return null}function it(e){if(!e.trim())return null;let t=Number.parseInt(e.trim(),10);return Number.isInteger(t)&&t>0?null:`OAuth callback port must be a positive integer`}function at(e){return e.oauthClientSecret.trim()&&!e.oauthClientId.trim()?`OAuth client ID is required when a client secret is set`:null}function ot(e){return rt(e.serverUrl)??it(e.oauthCallbackPort)??at(e)}function st(e){return e.trim()?null:`Command is required`}function ct(e,t){return t.name.trim()?e===`remote`?ot(t):st(t.command):`Server name is required`}function lt(e,t,n){return Re.some(t=>t(e).trim()!==``)||t.length>0||n.length>0||!e.defer}function ut(e){return e.isEditing?e.currentSnapshot!==e.originalSnapshot:lt(e.form,e.envEntries,e.headerEntries)}function dt(e){if(e.isEditing&&e.serverName)return e.installedServers.find(t=>t.name===e.serverName);if(e.initialConfig)return{name:ze(e.initialName,``),config:e.initialConfig}}function ft(e,t){return e instanceof Error?e.message:t}function pt(e,t){return e?t?`Saving...`:`Adding...`:t?`Save`:`Add`}function mt(e,t){return e?`MCP server saved · ${W(t.catalog)}`:`MCP server added · ${W(t.catalog)}`}function ht(e,t){return{title:e?t:`Add MCP Server`,description:e?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}}function gt(){let e=(0,Z.c)(7),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={env:[],header:[]},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=function(e,t){r(n=>({...n,[e]:t(n[e])}))},e[1]=i):i=e[1];let a=i,o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=function(e){a(e,_t)},e[2]=o):o=e[2];let s=o,c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=function(e,t){a(e,e=>e.filter((e,n)=>n!==t))},e[3]=c):c=e[3];let l=c,u;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e,t,n){a(e,e=>e.map((e,r)=>r===t?{...e,...n}:e))},e[4]=u):u=e[4];let d=u,f;return e[5]===n?f=e[6]:(f={lists:n,setEntryLists:r,addEntry:s,removeEntry:l,updateEntry:d},e[5]=n,e[6]=f),f}function _t(e){return[...e,Ie]}function vt(e){async function t(){if(!e.projectPath)throw Error(`No project path`);let t=await _e(e.projectPath,e.originalName||e.form.name.trim(),nt(e.form,e.envEntries,e.headerEntries));j({title:`Success`,description:mt(e.isEditing,t)}),e.onBack()}async function n(){e.setError(null);let n=ct(e.form.serverType,e.form);if(n){e.setError(n);return}e.setSaving(!0);try{await t()}catch(t){e.setError(ft(t,`Failed to save server`))}finally{e.setSaving(!1)}}async function r(){if(e.projectPath){e.setDeleting(!0);try{await ve(e.projectPath,e.originalName),j({title:`Success`,description:`MCP server removed`}),e.onBack()}catch(t){e.setError(ft(t,`Failed to delete server`))}finally{e.setDeleting(!1)}}}return{handleSave:n,handleDelete:r}}function yt(e){let{installedServers:t}=L(e.projectPath),n=!!e.serverName,[r,i]=(0,Q.useState)(Le),{lists:a,setEntryLists:o,addEntry:s,removeEntry:c,updateEntry:l}=gt(),[u,d]=(0,Q.useState)({name:``,snapshot:``}),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(n);(0,Q.useEffect)(()=>{let r=dt({isEditing:n,serverName:e.serverName,initialName:e.initialName,initialConfig:e.initialConfig,installedServers:t});r&&(i(qe(r.name,r.config)),o({env:Ve(r.config.env),header:Ve(r.config.headers)}),d({name:r.name,snapshot:Je(r.name,Be(r.config),r.config)})),(!n||r)&&y(!1)},[t,e.serverName,e.initialName,e.initialConfig,o,n]);function b(e){i(t=>({...t,...e}))}return{form:r,patchForm:b,lists:a,addEntry:s,removeEntry:c,updateEntry:l,original:u,saving:f,deleting:m,error:g,loading:v,actions:vt({projectPath:e.projectPath,isEditing:n,form:r,envEntries:a.env,headerEntries:a.header,originalName:u.name,onBack:e.onBack,setError:_,setSaving:p,setDeleting:h})}}function bt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,$.jsx)(`p`,{className:i.bodyMuted,children:`Loading server configuration...`})}),e[0]=t):t=e[0],t}function xt(e){let t=(0,Z.c)(9),{isEditing:n,name:r,onNameChange:i}=e,a=n?`Server name cannot be changed`:void 0,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==r||t[4]!==o?(s=(0,$.jsx)(J,{id:`server-name`,placeholder:`e.g. filesystem`,value:r,onChange:o,disabled:n}),t[2]=n,t[3]=r,t[4]=o,t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==s?(c=(0,$.jsx)(Y,{title:`Server name`,description:a,controlLayout:`stack`,className:`pt-6`,children:s}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function St(e){let t=(0,Z.c)(13),{form:n,onFormChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>r({command:e.target.value}),t[0]=r,t[1]=i);let a;t[2]!==n.command||t[3]!==i?(a=(0,$.jsx)(Y,{title:`Command`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsx)(J,{id:`server-command`,placeholder:`e.g. npx`,value:n.command,onChange:i})}),t[2]=n.command,t[3]=i,t[4]=a):a=t[4];let o;t[5]===r?o=t[6]:(o=e=>r({argsText:e.target.value}),t[5]=r,t[6]=o);let s;t[7]!==n.argsText||t[8]!==o?(s=(0,$.jsx)(Y,{title:`Arguments`,description:`One argument per line`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsx)(B,{id:`server-args`,placeholder:`-y
|
|
4
|
-
@modelcontextprotocol/server-filesystem
|
|
5
|
-
/path/to/dir`,value:n.argsText,onChange:o,className:`font-mono min-h-[80px] resize-none`})}),t[7]=n.argsText,t[8]=o,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,$.jsxs)($.Fragment,{children:[a,s]}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function Ct(e){let t=(0,Z.c)(19),{form:n,onFormChange:r}=e,i;t[0]===r?i=t[1]:(i=e=>r({oauthClientId:e.target.value}),t[0]=r,t[1]=i);let a;t[2]!==n.oauthClientId||t[3]!==i?(a=(0,$.jsx)(J,{id:`oauth-client-id`,placeholder:`Client ID`,value:n.oauthClientId,onChange:i,className:`font-mono`}),t[2]=n.oauthClientId,t[3]=i,t[4]=a):a=t[4];let o;t[5]===r?o=t[6]:(o=e=>r({oauthClientSecret:e.target.value}),t[5]=r,t[6]=o);let s;t[7]!==n.oauthClientSecret||t[8]!==o?(s=(0,$.jsx)(J,{id:`oauth-client-secret`,placeholder:`Client secret`,type:`password`,value:n.oauthClientSecret,onChange:o,className:`font-mono`}),t[7]=n.oauthClientSecret,t[8]=o,t[9]=s):s=t[9];let c;t[10]===r?c=t[11]:(c=e=>r({oauthCallbackPort:e.target.value}),t[10]=r,t[11]=c);let l;t[12]!==n.oauthCallbackPort||t[13]!==c?(l=(0,$.jsx)(J,{id:`oauth-callback-port`,placeholder:`Callback port (e.g. 3118)`,value:n.oauthCallbackPort,onChange:c,className:`font-mono`}),t[12]=n.oauthCallbackPort,t[13]=c,t[14]=l):l=t[14];let u;return t[15]!==a||t[16]!==s||t[17]!==l?(u=(0,$.jsx)(Y,{title:`OAuth client`,description:`Required for servers without dynamic client registration (e.g. GitHub Copilot MCP). Create an OAuth App, set callback to http://localhost:<port>/callback, then Sign in.`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a,s,l]})}),t[15]=a,t[16]=s,t[17]=l,t[18]=u):u=t[18],u}function wt(e){let t=(0,Z.c)(15),{entries:n,emptyMessage:r,keyPlaceholder:a,valuePlaceholder:o,onUpdate:s,onRemove:l}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(`p`,{className:i.caption,children:r}),t[0]=r,t[1]=e),e}let u;if(t[2]!==n||t[3]!==a||t[4]!==l||t[5]!==s||t[6]!==o){let e;t[8]!==a||t[9]!==l||t[10]!==s||t[11]!==o?(e=(e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(J,{placeholder:a,value:e.key,onChange:e=>s(t,{key:e.target.value}),className:`font-mono w-[35%]`}),(0,$.jsx)(J,{placeholder:o,value:e.value,onChange:e=>s(t,{value:e.target.value}),className:`font-mono flex-1`}),(0,$.jsx)(c,{variant:`ghost`,size:`icon`,onClick:()=>l(t),className:`h-9 w-9 flex-shrink-0`,children:(0,$.jsx)(x,{className:`h-3.5 w-3.5`})})]},t),t[8]=a,t[9]=l,t[10]=s,t[11]=o,t[12]=e):e=t[12],u=n.map(e),t[2]=n,t[3]=a,t[4]=l,t[5]=s,t[6]=o,t[7]=u}else u=t[7];let d;return t[13]===u?d=t[14]:(d=(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:u}),t[13]=u,t[14]=d),d}function Tt(e){let t=(0,Z.c)(16),{title:n,description:r,actionLabel:i,emptyMessage:a,keyPlaceholder:o,valuePlaceholder:s,entries:l,onAdd:u,onRemove:d,onUpdate:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(v,{className:`h-3 w-3 mr-1`}),t[0]=p):p=t[0];let m;t[1]!==i||t[2]!==u?(m=(0,$.jsxs)(c,{variant:`ghost`,size:`sm`,onClick:u,children:[p,i]}),t[1]=i,t[2]=u,t[3]=m):m=t[3];let h;t[4]!==a||t[5]!==l||t[6]!==o||t[7]!==d||t[8]!==f||t[9]!==s?(h=(0,$.jsx)(wt,{entries:l,emptyMessage:a,keyPlaceholder:o,valuePlaceholder:s,onUpdate:f,onRemove:d}),t[4]=a,t[5]=l,t[6]=o,t[7]=d,t[8]=f,t[9]=s,t[10]=h):h=t[10];let g;return t[11]!==r||t[12]!==m||t[13]!==h||t[14]!==n?(g=(0,$.jsx)(Y,{title:n,description:r,controlLayout:`stack`,className:`pt-6`,action:m,children:h}),t[11]=r,t[12]=m,t[13]=h,t[14]=n,t[15]=g):g=t[15],g}function Et(e){let t=(0,Z.c)(6),{serverType:n,entries:r,onAdd:i,onRemove:a,onUpdate:o}=e,s=n===`remote`?`Optional metadata for local tooling.`:void 0,c;return t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==s?(c=(0,$.jsx)(Tt,{title:`Environment variables`,description:s,actionLabel:`Add variable`,emptyMessage:`No environment variables configured`,keyPlaceholder:`KEY`,valuePlaceholder:`value`,entries:r,onAdd:i,onRemove:a,onUpdate:o}),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=c):c=t[5],c}function Dt(e){let t=(0,Z.c)(6),{defer:n,onDeferChange:r}=e,i=n?`Tool definitions load on demand via tool_search to keep the initial prompt small.`:`Tool definitions are always injected into the initial prompt, even when not used. Useful when this server's tools are needed in nearly every conversation, but they consume context.`,a;t[0]!==n||t[1]!==r?(a=(0,$.jsx)(Fe,{id:`defer-tools`,checked:n,onCheckedChange:r,"aria-label":`Deferred`}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,$.jsx)(Y,{title:`Deferred`,description:i,controlLayout:`stack`,className:`pt-6`,action:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function Ot(e){let t=(0,Z.c)(25),{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s}=e,c;t[0]===r?c=t[1]:(c=e=>r({serverUrl:e.target.value}),t[0]=r,t[1]=c);let l;t[2]!==n.serverUrl||t[3]!==c?(l=(0,$.jsx)(Y,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsx)(J,{id:`server-url`,placeholder:`https://example.com/mcp`,value:n.serverUrl,onChange:c,className:`font-mono`})}),t[2]=n.serverUrl,t[3]=c,t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=e=>r({transport:e}),t[5]=r,t[6]=u);let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(U,{children:(0,$.jsx)(z,{})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(X,{children:[(0,$.jsx)(H,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,$.jsx)(H,{value:`streamableHttp`,children:`Streamable HTTP`})]}),t[8]=f):f=t[8];let p;t[9]!==n.transport||t[10]!==u?(p=(0,$.jsx)(Y,{title:`Transport`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsxs)(F,{value:n.transport,onValueChange:u,children:[d,f]})}),t[9]=n.transport,t[10]=u,t[11]=p):p=t[11];let m;t[12]!==n||t[13]!==r?(m=(0,$.jsx)(Ct,{form:n,onFormChange:r}),t[12]=n,t[13]=r,t[14]=m):m=t[14];let h;t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==s?(h=(0,$.jsx)(Tt,{title:`HTTP headers`,description:`Optional headers for authentication.`,actionLabel:`Add header`,emptyMessage:`No headers configured`,keyPlaceholder:`Authorization`,valuePlaceholder:`Bearer ...`,entries:i,onAdd:a,onRemove:o,onUpdate:s}),t[15]=i,t[16]=a,t[17]=o,t[18]=s,t[19]=h):h=t[19];let g;return t[20]!==l||t[21]!==p||t[22]!==m||t[23]!==h?(g=(0,$.jsxs)($.Fragment,{children:[l,p,m,h]}),t[20]=l,t[21]=p,t[22]=m,t[23]=h,t[24]=g):g=t[24],g}function kt(e){let t=(0,Z.c)(18),{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s}=e,c;t[0]===r?c=t[1]:(c=e=>r({serverType:e}),t[0]=r,t[1]=c);let l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsxs)(te,{className:`grid w-full grid-cols-2`,children:[(0,$.jsx)(P,{value:`local`,children:`Local (stdio)`}),(0,$.jsx)(P,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),t[2]=l):l=t[2];let u;t[3]!==n||t[4]!==r?(u=(0,$.jsx)(q,{value:`local`,children:(0,$.jsx)(St,{form:n,onFormChange:r})}),t[3]=n,t[4]=r,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==i||t[8]!==r||t[9]!==a||t[10]!==o||t[11]!==s?(d=(0,$.jsx)(q,{value:`remote`,children:(0,$.jsx)(Ot,{form:n,onFormChange:r,headerEntries:i,onHeaderAdd:a,onHeaderRemove:o,onHeaderUpdate:s})}),t[6]=n,t[7]=i,t[8]=r,t[9]=a,t[10]=o,t[11]=s,t[12]=d):d=t[12];let f;return t[13]!==n.serverType||t[14]!==c||t[15]!==u||t[16]!==d?(f=(0,$.jsxs)(K,{value:n.serverType,onValueChange:c,className:`w-full pt-6`,children:[l,u,d]}),t[13]=n.serverType,t[14]=c,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function At(e){let t=(0,Z.c)(5),{isEditing:n,busy:r,deleting:i,onDelete:a}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`div`,{}),t[0]=e):e=t[0],e}let o=i?`Removing...`:`Remove`,s;return t[1]!==r||t[2]!==a||t[3]!==o?(s=(0,$.jsx)(c,{variant:`destructive`,onClick:a,disabled:r,children:o}),t[1]=r,t[2]=a,t[3]=o,t[4]=s):s=t[4],s}function jt(e){let t=(0,Z.c)(7),{busy:n,hasChanges:r,saving:i,isEditing:a,onSave:o}=e,s=n||!r,l;t[0]!==a||t[1]!==i?(l=pt(i,a),t[0]=a,t[1]=i,t[2]=l):l=t[2];let u;return t[3]!==o||t[4]!==s||t[5]!==l?(u=(0,$.jsx)(c,{onClick:o,disabled:s,children:l}),t[3]=o,t[4]=s,t[5]=l,t[6]=u):u=t[6],u}function Mt(e){let t=(0,Z.c)(14),{isEditing:n,busy:r,saving:i,deleting:a,hasChanges:o,onSave:s,onDelete:c}=e,l;t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==c?(l=(0,$.jsx)(At,{isEditing:n,busy:r,deleting:a,onDelete:c}),t[0]=r,t[1]=a,t[2]=n,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==o||t[7]!==n||t[8]!==s||t[9]!==i?(u=(0,$.jsx)(jt,{busy:r,hasChanges:o,saving:i,isEditing:n,onSave:s}),t[5]=r,t[6]=o,t[7]=n,t[8]=s,t[9]=i,t[10]=u):u=t[10];let d;return t[11]!==l||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`mt-6 border-t pt-4 flex items-center justify-between`,children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Nt(e){let t=(0,Z.c)(74),{projectPath:n,serverName:r,initialName:a,initialConfig:o,onBack:s}=e,c;t[0]!==o||t[1]!==a||t[2]!==s||t[3]!==n||t[4]!==r?(c={projectPath:n,serverName:r,initialName:a,initialConfig:o,onBack:s},t[0]=o,t[1]=a,t[2]=s,t[3]=n,t[4]=r,t[5]=c):c=t[5];let{form:l,patchForm:u,lists:d,addEntry:f,removeEntry:p,updateEntry:m,original:h,saving:g,deleting:_,error:v,loading:y,actions:b}=yt(c),x=!!r,S=g||_,C;t[6]!==l||t[7]!==x||t[8]!==d.env||t[9]!==d.header||t[10]!==h.snapshot?(C=ut({isEditing:x,currentSnapshot:Je(l.name.trim(),l.serverType,nt(l,d.env,d.header)),originalSnapshot:h.snapshot,form:l,envEntries:d.env,headerEntries:d.header}),t[6]=l,t[7]=x,t[8]=d.env,t[9]=d.header,t[10]=h.snapshot,t[11]=C):C=t[11];let w=C;if(y){let e;return t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(bt,{}),t[12]=e):e=t[12],e}let T;t[13]!==l.name||t[14]!==x?(T=ht(x,l.name),t[13]=l.name,t[14]=x,t[15]=T):T=t[15];let E;t[16]===T?E=t[17]:(E=(0,$.jsx)(ge,{...T,sticky:!0,className:`pr-10`}),t[16]=T,t[17]=E);let D;t[18]===u?D=t[19]:(D=e=>u({name:e}),t[18]=u,t[19]=D);let O;t[20]!==l.name||t[21]!==x||t[22]!==D?(O=(0,$.jsx)(xt,{isEditing:x,name:l.name,onNameChange:D}),t[20]=l.name,t[21]=x,t[22]=D,t[23]=O):O=t[23];let k;t[24]===f?k=t[25]:(k=()=>f(`header`),t[24]=f,t[25]=k);let A;t[26]===p?A=t[27]:(A=e=>p(`header`,e),t[26]=p,t[27]=A);let j;t[28]===m?j=t[29]:(j=(e,t)=>m(`header`,e,t),t[28]=m,t[29]=j);let M;t[30]!==l||t[31]!==d.header||t[32]!==u||t[33]!==k||t[34]!==A||t[35]!==j?(M=(0,$.jsx)(kt,{form:l,onFormChange:u,headerEntries:d.header,onHeaderAdd:k,onHeaderRemove:A,onHeaderUpdate:j}),t[30]=l,t[31]=d.header,t[32]=u,t[33]=k,t[34]=A,t[35]=j,t[36]=M):M=t[36];let N;t[37]===u?N=t[38]:(N=e=>u({defer:e}),t[37]=u,t[38]=N);let P;t[39]!==l.defer||t[40]!==N?(P=(0,$.jsx)(Dt,{defer:l.defer,onDeferChange:N}),t[39]=l.defer,t[40]=N,t[41]=P):P=t[41];let F;t[42]===f?F=t[43]:(F=()=>f(`env`),t[42]=f,t[43]=F);let I;t[44]===p?I=t[45]:(I=e=>p(`env`,e),t[44]=p,t[45]=I);let L;t[46]===m?L=t[47]:(L=(e,t)=>m(`env`,e,t),t[46]=m,t[47]=L);let R;t[48]!==l.serverType||t[49]!==d.env||t[50]!==F||t[51]!==I||t[52]!==L?(R=(0,$.jsx)(Et,{serverType:l.serverType,entries:d.env,onAdd:F,onRemove:I,onUpdate:L}),t[48]=l.serverType,t[49]=d.env,t[50]=F,t[51]=I,t[52]=L,t[53]=R):R=t[53];let z;t[54]===v?z=t[55]:(z=v&&(0,$.jsx)(`p`,{className:i.error,children:v}),t[54]=v,t[55]=z);let B;t[56]!==b.handleDelete||t[57]!==b.handleSave||t[58]!==S||t[59]!==_||t[60]!==w||t[61]!==x||t[62]!==g?(B=(0,$.jsx)(Mt,{isEditing:x,busy:S,saving:g,deleting:_,hasChanges:w,onSave:b.handleSave,onDelete:b.handleDelete}),t[56]=b.handleDelete,t[57]=b.handleSave,t[58]=S,t[59]=_,t[60]=w,t[61]=x,t[62]=g,t[63]=B):B=t[63];let V;t[64]!==M||t[65]!==P||t[66]!==R||t[67]!==z||t[68]!==B||t[69]!==O?(V=(0,$.jsxs)(`div`,{children:[O,M,P,R,z,B]}),t[64]=M,t[65]=P,t[66]=R,t[67]=z,t[68]=B,t[69]=O,t[70]=V):V=t[70];let H;return t[71]!==V||t[72]!==E?(H=(0,$.jsx)(ee,{children:(0,$.jsxs)(ae,{children:[E,V]})}),t[71]=V,t[72]=E,t[73]=H):H=t[73],H}function Pt(e){if(!e)return null;let t=new Date(e).getTime();if(Number.isNaN(t))return null;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:new Date(e).toLocaleDateString()}function Ft(e){if(!e||e.state===`missing`||e.state===`stale`)return`Refresh to load tools`;if(e.state===`needs_auth`)return`Sign in required`;if(e.state===`error`)return e.error??`Could not load tools`;let t=e.tools.length,n=t===1?`1 tool`:`${t} tools`,r=Pt(e.refreshedAt);return r?`${n} · refreshed ${r}`:n}function It(e){let t=(0,Z.c)(69),{name:n,config:r,catalog:a,remote:o,authorized:d,oauthBusy:p,refreshing:m,onEdit:h,onRefresh:g,onDelete:_,onSignIn:v,onSignOut:y}=e,[b,x]=(0,Q.useState)(!1),S;if(t[0]!==d||t[1]!==a||t[2]!==r.args||t[3]!==r.command||t[4]!==r.url||t[5]!==b||t[6]!==n||t[7]!==p||t[8]!==_||t[9]!==h||t[10]!==g||t[11]!==v||t[12]!==y||t[13]!==m||t[14]!==o){let e=a?.state===`ok`?a.tools.map(zt):[],D;t[16]!==r.args||t[17]!==r.command||t[18]!==r.url?(D=r.url?r.url:`${r.command??``} ${r.args?.join(` `)??``}`.trim(),t[16]=r.args,t[17]=r.command,t[18]=r.url,t[19]=D):D=t[19];let O=D,k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=s(i.body,`truncate`),t[20]=k):k=t[20];let A;t[21]===n?A=t[22]:(A=(0,$.jsx)(`div`,{className:k,children:n}),t[21]=n,t[22]=A);let j;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(j=s(i.compact,`truncate text-muted-foreground font-mono`),t[23]=j):j=t[23];let M;t[24]===O?M=t[25]:(M=(0,$.jsx)(`div`,{className:j,children:O}),t[24]=O,t[25]=M);let N;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(N=s(i.caption,`truncate text-muted-foreground`),t[26]=N):N=t[26];let P;t[27]===a?P=t[28]:(P=Ft(a),t[27]=a,t[28]=P);let F;t[29]===P?F=t[30]:(F=(0,$.jsx)(`div`,{className:N,children:P}),t[29]=P,t[30]=F);let I;t[31]!==h||t[32]!==A||t[33]!==M||t[34]!==F?(I=(0,$.jsxs)(`button`,{type:`button`,onClick:h,className:`min-w-0 text-left`,children:[A,M,F]}),t[31]=h,t[32]=A,t[33]=M,t[34]=F,t[35]=I):I=t[35];let L;t[36]!==d||t[37]!==p||t[38]!==v||t[39]!==y||t[40]!==o?(L=o&&(0,$.jsx)(c,{type:`button`,variant:d?`outline`:`secondary`,size:`sm`,disabled:p,onClick:()=>{d?y():v()},children:p?`Working…`:d?`Sign out`:`Sign in`}),t[36]=d,t[37]=p,t[38]=v,t[39]=y,t[40]=o,t[41]=L):L=t[41];let R=`Refresh ${n} tools`,z=m&&`animate-spin`,B;t[42]===z?B=t[43]:(B=s(`h-4 w-4`,z),t[42]=z,t[43]=B);let V;t[44]===B?V=t[45]:(V=(0,$.jsx)(l,{className:B}),t[44]=B,t[45]=V);let H;t[46]!==g||t[47]!==m||t[48]!==R||t[49]!==V?(H=(0,$.jsx)(C,{asChild:!0,children:(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:m,onClick:g,"aria-label":R,children:V})}),t[46]=g,t[47]=m,t[48]=R,t[49]=V,t[50]=H):H=t[50];let ee;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(w,{children:`Refresh tools`}),t[51]=ee):ee=t[51];let U;t[52]===H?U=t[53]:(U=(0,$.jsx)(T,{children:(0,$.jsxs)(E,{children:[H,ee]})}),t[52]=H,t[53]=U);let te=e.length>0&&(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-expanded":b,"aria-label":b?`Hide tools`:`Show tools`,onClick:()=>x(Rt),children:(0,$.jsx)(f,{className:s(`h-4 w-4 transition-transform`,b&&`rotate-180`)})}),W;t[54]!==L||t[55]!==U||t[56]!==te?(W=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[L,U,te]}),t[54]=L,t[55]=U,t[56]=te,t[57]=W):W=t[57];let ne=`Delete ${n}`,re;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(u,{className:`h-4 w-4`}),t[58]=re):re=t[58];let G;t[59]!==_||t[60]!==ne?(G=(0,$.jsx)(C,{asChild:!0,children:(0,$.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 items-center justify-center text-muted-foreground opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto can-hover:hover:bg-destructive can-hover:hover:text-destructive-foreground transition-[opacity,color,background-color]`,onClick:_,"aria-label":ne,children:re})}),t[59]=_,t[60]=ne,t[61]=G):G=t[61];let K;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(w,{children:`Remove this MCP server from the project`}),t[62]=K):K=t[62];let q;t[63]===G?q=t[64]:(q=(0,$.jsx)(T,{children:(0,$.jsxs)(E,{children:[G,K]})}),t[63]=G,t[64]=q);let ie;t[65]!==I||t[66]!==W||t[67]!==q?(ie=(0,$.jsxs)(`div`,{className:`grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3`,children:[I,W,q]}),t[65]=I,t[66]=W,t[67]=q,t[68]=ie):ie=t[68],S=(0,$.jsxs)(`div`,{className:`group px-3 py-3 hover:bg-muted/30`,children:[ie,b&&e.length>0&&(0,$.jsx)(`ul`,{className:s(i.caption,`mt-2 space-y-1 pl-1 text-muted-foreground`),children:e.map(Lt)})]}),t[0]=d,t[1]=a,t[2]=r.args,t[3]=r.command,t[4]=r.url,t[5]=b,t[6]=n,t[7]=p,t[8]=_,t[9]=h,t[10]=g,t[11]=v,t[12]=y,t[13]=m,t[14]=o,t[15]=S}else S=t[15];return S}function Lt(e){return(0,$.jsx)(`li`,{className:`font-mono truncate`,children:e},e)}function Rt(e){return!e}function zt(e){return e.name}var Bt=`https://tarsk.io/skills/mcp/`;function Vt(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function Ht(e){return typeof e.url==`string`&&e.url.trim().length>0}function Ut(){let e=a(e=>e.selectedProjectId),t=a(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:n,catalog:r,loadingConfig:o,loadInstalledServers:u}=L(t),{popularServers:g,loadingPopular:_}=re(),{openChatDockPanel:v}=V(),{setPendingExplorerPath:y,triggerExplorerRefresh:b}=M(),[x,S]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),[F,z]=(0,Q.useState)(null),[B,H]=(0,Q.useState)(null),[ee,U]=(0,Q.useState)(!1),[te,K]=(0,Q.useState)({}),[q,J]=(0,Q.useState)(null),[Y,ae]=(0,Q.useState)(null),X=(0,Q.useCallback)(async()=>{if(!t){K({});return}let e=n.filter(e=>Ht(e.config));if(e.length===0){K({});return}let r=await Promise.all(e.map(async e=>{try{let n=await O(t,e.name);return[e.name,n.authorized]}catch{return[e.name,!1]}}));K(Object.fromEntries(r))},[t,n]);(0,Q.useEffect)(()=>{X()},[X]);let Z=(0,Q.useCallback)(async e=>{if(t){U(!0);try{await ve(t,e),await u(),b(),j({title:`MCP server removed`,description:e}),H(null)}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{U(!1)}}},[t,u,b]),Se=(0,Q.useCallback)(async e=>{if(t){J(e);try{let n=await k(t,e);await X(),await u(),j({title:`Signed in`,description:n.catalog?`${e} · ${W(n.catalog)}`:`Connected to ${e}`})}catch(e){j({title:`Sign in failed`,description:e instanceof Error?e.message:`OAuth authorization failed`,variant:`destructive`})}finally{J(null)}}},[t,X,u]),Ce=(0,Q.useCallback)(async e=>{if(t){J(e);try{await A(t,e),await X(),await u(),j({title:`Signed out`,description:e})}catch(e){j({title:`Sign out failed`,description:e instanceof Error?e.message:`Failed to revoke OAuth credentials`,variant:`destructive`})}finally{J(null)}}},[t,X,u]),we=(0,Q.useCallback)(async e=>{if(t){ae(e??`all`);try{let n=await I(t,e);await u();let r=Object.values(n.catalog),[i]=r;if(i)j({title:`Tools refreshed`,description:`${i.serverName} · ${W(i)}`});else{let e=r.filter(e=>e.state===`ok`).length;j({title:`Tools refreshed`,description:`${e}/${r.length} servers loaded`})}}catch(e){j({title:`Refresh failed`,description:e instanceof Error?e.message:`Could not refresh MCP tools`,variant:`destructive`})}finally{ae(null)}}},[t,u]),Te=(0,Q.useCallback)(()=>{y(`.agents/mcp.json`),v(`explorer`)},[y,v]),Ee=(0,Q.useCallback)(async e=>{if(!t)return;let r=Vt(e);if(!n.some(t=>t.name===r||t.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){P({name:r,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),S(!0);return}try{let n=await _e(t,r,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}});await u(),b(),j({title:`MCP server installed`,description:`${e.name} · ${W(n.catalog)}`})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){j({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{let n=await _e(t,r,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}});await u(),b(),j({title:`MCP server installed`,description:`${e.name} · ${W(n.catalog)}`})}catch(e){j({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[t,n,u,b]),De=be(e,[o,_]);return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ne,{loading:De,children:(0,$.jsxs)(se,{className:`shrink-0`,children:[(0,$.jsx)(ge,{title:`Installed MCP Servers`,description:`MCP servers configured for this project.`,action:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(c,{variant:`ghost`,onClick:Te,children:`Config`}),n.length>=2&&(0,$.jsxs)(c,{variant:`ghost`,className:`gap-1`,disabled:Y!==null,onClick:()=>void we(),children:[(0,$.jsx)(l,{className:s(`h-4 w-4`,Y===`all`&&`animate-spin`)}),`Refresh all`]}),(0,$.jsxs)(me,{children:[(0,$.jsx)(he,{asChild:!0,children:(0,$.jsxs)(c,{className:`gap-1`,children:[`Add Server`,(0,$.jsx)(f,{className:`h-4 w-4 opacity-70`})]})}),(0,$.jsxs)(fe,{align:`end`,className:`w-56`,children:[(0,$.jsxs)(oe,{className:s(i.body,`gap-2`),onSelect:()=>S(!0),children:[(0,$.jsx)(m,{className:`h-4 w-4 shrink-0`}),`Manual Entry`]}),(0,$.jsxs)(pe,{children:[(0,$.jsxs)(ce,{className:s(i.body,`gap-2`),children:[(0,$.jsx)(d,{className:`h-4 w-4 shrink-0`}),`Popular`]}),(0,$.jsx)(ie,{className:`w-80 max-h-80 overflow-y-auto`,children:_?(0,$.jsx)(oe,{disabled:!0,className:i.bodyMuted,children:`Loading…`}):g.length===0?(0,$.jsx)(oe,{disabled:!0,className:i.bodyMuted,children:`No available servers`}):[...g].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=Vt(e),r=n.some(n=>n.name===t||n.name===e.id);return(0,$.jsx)(T,{children:(0,$.jsxs)(E,{children:[(0,$.jsx)(C,{asChild:!0,children:(0,$.jsxs)(oe,{className:s(i.body,`gap-2`,r&&`opacity-50 cursor-not-allowed`),onSelect:()=>{r||Ee(e)},children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),r&&(0,$.jsx)(p,{className:`h-4 w-4 shrink-0 text-muted-foreground`})]})}),(0,$.jsx)(w,{side:`right`,className:`max-w-64`,children:e.description})]})},e.id)})})]}),(0,$.jsx)(ue,{}),(0,$.jsxs)(oe,{className:s(i.body,`gap-2`),onSelect:()=>void D(Bt),children:[(0,$.jsx)(h,{className:`h-4 w-4 shrink-0`}),`Marketplace`]})]})]})]}),sticky:!1}),(0,$.jsx)(R,{className:`pt-6`,children:n.length===0?(0,$.jsx)(xe,{icon:d,title:`Connect your agent to tools, APIs, and data sources`,bordered:!1}):(0,$.jsx)(`div`,{className:`divide-y divide-table-border`,children:n.map(e=>(0,$.jsx)(It,{name:e.name,config:e.config,catalog:r[e.name],remote:Ht(e.config),authorized:te[e.name]===!0,oauthBusy:q===e.name,refreshing:Y===e.name||Y===`all`,onEdit:()=>z(e.name),onRefresh:()=>void we(e.name),onDelete:()=>H(e.name),onSignIn:()=>void Se(e.name),onSignOut:()=>void Ce(e.name)},e.name))})})]})}),(0,$.jsx)(de,{open:x,onOpenChange:e=>{S(e),e||P(null)},children:(0,$.jsx)(le,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,$.jsx)(Nt,{projectPath:t,initialName:N?.name,initialConfig:N?.config,onBack:()=>{S(!1),P(null),u(),b()}})})}),(0,$.jsx)(de,{open:F!==null,onOpenChange:e=>{e||z(null)},children:(0,$.jsx)(le,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,$.jsx)(Nt,{projectPath:t,serverName:F??void 0,onBack:()=>{z(null),u(),b()}})})}),(0,$.jsx)(ye,{open:B!==null,onOpenChange:e=>!e&&H(null),title:`Delete MCP Server`,description:`Are you sure you want to delete the server "${B}"? This action cannot be undone.`,onConfirm:()=>{B&&Z(B)},confirming:ee})]}):(0,$.jsx)(G,{children:`Select a project to manage MCP servers.`})}export{Ut as SettingsMCPServersView,Ut as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,F as a}from"./dist-CTLFS4dn.js";import{r as o}from"./store-BSzKIu5G.js";import{m as s,r as c,t as l}from"./button-kWtLAMpB.js";import{Mt as u,Nn as d,Ot as f,Yt as p,fn as m,hn as h,ot as g,rt as _,st as v,x as y}from"./dist-c_QADQ5u.js";import{i as b,n as x,r as S,t as C}from"./tooltip-Db8UeYxm.js";import{$n as w,Ii as T,Qn as E,Qt as D,T as O,Tn as k,ar as A,di as j,er as M,ii as N,ir as P,lr as F,nr as I,or as L,ri as R,sr as z,ur as B,vi as V,xi as H,zi as ee}from"./api-DX1ny6q-.js";import{t as U}from"./use-toast-xpb5jNtN.js";import{a as W,c as te,i as G,n as K,o as ne,r as re,s as ie,t as ae}from"./alert-dialog-BxMfaLuO.js";import{n as q}from"./async-loading-fallback-V0EaQ_Kn.js";import{At as oe,Et as se,Ft as ce,Jn as le,Kn as ue,Mt as de,Ot as fe,Pt as pe,St as me,Tt as he,_r as ge,_t as _e,dr as ve,fr as J,gr as ye,gt as be,hr as xe,ht as Se,i as Ce,ir as we,jt as Te,kn as Ee,kt as De,mr as Y,or as Oe,pr as X,rr as ke,tr as Ae,ur as je,vr as Me,vt as Ne}from"./index-u8UbWjXL.js";import{t as Pe}from"./delete-confirm-dialog-Dl76vaxb.js";import{t as Fe}from"./use-settings-page-loading-BTySlInF.js";import{a as Ie,i as Le,r as Re}from"./settings-list-B9a61wMg.js";import{t as ze}from"./use-deferred-search-Dgxosq55.js";import{t as Be}from"./use-installed-ai-files-BuuVI3sM.js";import{i as Ve,n as He,r as Ue,t as We}from"./slug-utils-CQ8PMWUL.js";var Z=t(),Q=e(n(),1),$=r();function Ge({threadId:e,onSkillCreated:t}){let[n,r]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(``),[s,l]=(0,Q.useState)(!1),u=Ue(n),d=He(u),f=async()=>{if(!(!d||!a.trim()||!e)){l(!0);try{let n=await O(e,u,a.trim());U({title:`Skill created`,description:`Skill '${u}' was created successfully.`}),r(``),o(``),t?.(n.path,`SKILL.md`)}catch(e){U({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{l(!1)}}};return e?(0,$.jsx)(fe,{children:(0,$.jsxs)(Se,{children:[(0,$.jsx)(Ne,{title:`Add Skill`,description:`Saved as SKILL.md in .agents/skills.`,sticky:!0,className:`pr-10`}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(be,{title:`Skill Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,$.jsx)(J,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),n?(0,$.jsxs)(`p`,{className:c(i.caption,`mt-2`),children:[`Folder name: `,(0,$.jsx)(`span`,{className:`font-mono`,children:u||`...`})]}):null]}),(0,$.jsx)(be,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,$.jsx)(le,{id:`skillDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,$.jsx)(Ve,{onContinue:()=>void f(),disabled:!d||!a.trim(),creating:s})]})]})}):(0,$.jsx)(he,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function Ke(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
|
|
2
|
-
`)}function qe(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function Je(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function Ye(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function Xe({open:e,onOpenChange:t,skill:n,catalogSourceId:r,onInstall:a}){let[o,s]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[f,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null),[x,S]=(0,Q.useState)(!1),C=Ye(n,r),T=!!C;(0,Q.useEffect)(()=>{if(!e||!n)return;let t=n,i=Ye(t,r),a=!1;async function o(){g(!0),b(null),s([]),d(null),m(``);try{if(i){let e=await M(i,t.id);if(a)return;s(e.files),d(Je(e.files))}else{if(a)return;s([`SKILL.md`]),d(`SKILL.md`),m(Ke(t))}}catch(e){if(a)return;b(e instanceof Error?e.message:`Failed to load skill files`)}finally{a||g(!1)}}return o(),()=>{a=!0}},[e,n,r]),(0,Q.useEffect)(()=>{if(!e||!n||!u||!T||!C)return;let t=n,r=u,i=!1;async function a(){v(!0),b(null);try{let e=await w(C,t.id,r);if(i)return;m(e.content)}catch(e){if(i)return;b(e instanceof Error?e.message:`Failed to load file`),m(``)}finally{i||v(!1)}}return a(),()=>{i=!0}},[e,n,u,T,C]);let E=(0,Q.useCallback)(async()=>{if(!n)return;let e=C?{...n,sourceId:C}:n;S(!0);try{await a(e),t(!1)}finally{S(!1)}},[n,C,a,t]),D=h||T&&_,O=u?qe(u):!1,k=(0,Q.useMemo)(()=>o.map(e=>(0,$.jsxs)(ue,{selected:e===u,onClick:()=>d(e),className:`gap-2 cursor-pointer`,children:[(0,$.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:c(i.caption,`truncate`),children:e})]},e)),[o,u]);return(0,$.jsx)(X,{open:e,onOpenChange:t,children:(0,$.jsxs)(Y,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,$.jsxs)(ge,{className:`border-b border-border px-6 py-4`,children:[(0,$.jsx)(Me,{children:n?.name??`Review skill`}),n?.description?(0,$.jsx)(xe,{children:n.description}):null]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,$.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,$.jsx)(`div`,{className:c(i.labelMuted,`px-3 py-2`),children:`Files`}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:h?(0,$.jsx)(q,{className:`py-8`,label:`Loading files...`}):o.length===0?(0,$.jsx)(`p`,{className:c(i.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):k})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:y?(0,$.jsx)(`p`,{className:c(i.body,`text-destructive`),children:y}):D?(0,$.jsx)(q,{className:`py-12`,label:`Loading preview...`}):O?(0,$.jsx)(Ee,{content:f,enableMermaid:!1}):(0,$.jsx)(`pre`,{className:c(i.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:f})})]}),(0,$.jsxs)(ye,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,$.jsx)(l,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,$.jsx)(l,{type:`button`,onClick:()=>void E(),disabled:x||!n,children:x?`Installing...`:`Install`})]})]})})}var Ze=new Map;function Qe(e){let t=Ze.get(e);if(t)return t;let n=P(e).finally(()=>{Ze.delete(e)});return Ze.set(e,n),n}function $e(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function et(){let e=(0,Z.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(V),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[s,c]=(0,Q.useState)(o),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(!1),p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{try{r(await A())}catch{r([])}},e[2]=p):p=e[2];let m=p,h,g;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{(async function(){let e=j();if(e.length>0)try{await L(e),R()}catch{}await m()})()},g=[m],e[3]=h,e[4]=g):(h=e[3],g=e[4]),(0,Q.useEffect)(h,g);let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a(e),T(e)},e[5]=_):_=e[5];let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(nt)),v(e.id)},e[6]=y):y=e[6];let b=y,x;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(tt)),N(e.id)},e[7]=x):x=e[7];let S=x,C;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>t.filter(t=>t.id!==e)),N(e),a(t=>t===e?(T(`default`),`default`):t)},e[8]=C):C=e[8];let w=C,E,D;e[9]===i?(E=e[10],D=e[11]):(D=()=>{if(i==="default"){c([]),u(!1),f(!1);return}let e=H(i);e?.skills?(c($e(i,e.skills)),u(!1)):(c([]),u(!0));let t=!1;return f(!!e?.skills),Qe(i).then(e=>{if(t)return;let n=$e(i,e);c(n),ee(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||c([]),U({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(u(!1),f(!1))}),()=>{t=!0}},E=[i],e[9]=i,e[10]=E,e[11]=D),(0,Q.useEffect)(D,E);let O;return e[12]!==s||e[13]!==l||e[14]!==d||e[15]!==i||e[16]!==n?(O={sources:n,selectedSourceId:i,setSelectedSourceId:v,addSource:b,updateSource:S,removeSource:w,reloadSources:m,catalogSkills:s,isLoadingCatalog:l,isRefreshingCatalog:d},e[12]=s,e[13]=l,e[14]=d,e[15]=i,e[16]=n,e[17]=O):O=e[17],O}function tt(e,t){return e.title.localeCompare(t.title)}function nt(e,t){return e.title.localeCompare(t.title)}function rt({open:e,onOpenChange:t,editingSource:n,onSourceAdded:r,onSourceUpdated:a,onSourceDeleted:o}){let[s,u]=(0,Q.useState)(``),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),S=n!=null;function C(){u(``),p(``),h(null),_(!1),y(!1),x(!1)}function w(e){e||C(),t(e)}(0,Q.useEffect)(()=>{if(e){if(n){u(n.title),p(n.url),h(null);return}u(``),p(``),h(null)}},[e,n]);async function T(){let e=s.trim(),t=d.trim();if(!e||!t){h(`Title and URL are required.`);return}_(!0),h(null);try{if(S&&n){let r=await F(n.id,e,t);a?.(r.source)}else r((await B(e,t)).source);w(!1)}catch(e){h(e instanceof Error?e.message:`Failed to verify skill source`)}finally{_(!1)}}async function D(){if(n){y(!0),h(null);try{await E(n.id),o?.(n.id),x(!1),w(!1)}catch(e){h(e instanceof Error?e.message:`Failed to delete skill source`),x(!1)}finally{y(!1)}}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(X,{open:e,onOpenChange:w,children:(0,$.jsxs)(Y,{className:`sm:max-w-lg`,children:[(0,$.jsxs)(ge,{children:[(0,$.jsx)(Me,{children:S?`Edit Skill Source`:`Add Skill Source`}),(0,$.jsx)(xe,{children:S?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,$.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ve,{htmlFor:`skill-source-title`,children:`Title`}),(0,$.jsx)(J,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>u(e.target.value),disabled:g||v,autoFocus:!0})]}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(ve,{htmlFor:`skill-source-url`,children:`URL`}),(0,$.jsx)(J,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:d,onChange:e=>p(e.target.value),disabled:g||v})]}),m?(0,$.jsx)(`p`,{className:c(i.caption,`text-destructive`),children:m}):null]}),(0,$.jsxs)(ye,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[S?(0,$.jsx)(l,{type:`button`,variant:`destructive`,onClick:()=>x(!0),disabled:g||v,children:`Delete`}):(0,$.jsx)(`div`,{className:`hidden sm:block`}),(0,$.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,$.jsx)(l,{variant:`outline`,onClick:()=>w(!1),disabled:g||v,children:`Cancel`}),(0,$.jsx)(l,{onClick:()=>void T(),disabled:g||v||!s.trim()||!d.trim(),children:g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):S?`Save Changes`:`Add Source`})]})]})]})}),(0,$.jsx)(ae,{open:b,onOpenChange:x,children:(0,$.jsxs)(G,{children:[(0,$.jsxs)(ie,{children:[(0,$.jsx)(te,{children:`Delete Skill Source`}),(0,$.jsxs)(W,{children:[`Are you sure you want to delete "`,n?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,$.jsxs)(ne,{children:[(0,$.jsx)(re,{disabled:v,children:`Cancel`}),(0,$.jsx)(K,{onClick:()=>void D(),disabled:v,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:v?`Deleting...`:`Delete`})]})]})})]})}var it=`https://tarsk.io/skills/list/`;function at(e){let t=(0,Z.c)(20),{onSelectMode:n,manualDisabled:r}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(je,{asChild:!0,children:(0,$.jsxs)(l,{className:`gap-1`,children:[`Add Skill`,(0,$.jsx)(d,{className:`h-4 w-4 opacity-70`})]})}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=c(i.body,`gap-2`),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=()=>n(`manual`),t[2]=n,t[3]=s);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(v,{className:`h-4 w-4 shrink-0`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==s?(p=(0,$.jsxs)(we,{className:o,disabled:r,onSelect:s,children:[f,`Manually Enter`]}),t[5]=r,t[6]=s,t[7]=p):p=t[7];let h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h=c(i.body,`gap-2`),t[8]=h):h=t[8];let g;t[9]===n?g=t[10]:(g=()=>n(`url`),t[9]=n,t[10]=g);let _;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(u,{className:`h-4 w-4 shrink-0`}),t[11]=_):_=t[11];let y;t[12]===g?y=t[13]:(y=(0,$.jsxs)(we,{className:h,onSelect:g,children:[_,`Via URL`]}),t[12]=g,t[13]=y);let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Oe,{}),t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=c(i.body,`gap-2`),t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsxs)(we,{className:x,onSelect:ot,children:[(0,$.jsx)(m,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),t[16]=S):S=t[16];let C;return t[17]!==p||t[18]!==y?(C=(0,$.jsxs)(Ae,{children:[a,(0,$.jsxs)(ke,{align:`end`,className:`w-44`,children:[p,y,b,S]})]}),t[17]=p,t[18]=y,t[19]=C):C=t[19],C}function ot(){D(it)}function st(e){let t=e.trim();if(!t)return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}if(t.startsWith(`tarsk://`))try{let e=new URL(`https://tarsk.invalid/${t.slice(8)}`);if(e.pathname===`/skill-install`&&e.searchParams.get(`url`))return e.searchParams.get(`url`)}catch{return null}return null}function ct(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,onSubmit:a}=e,[o,s]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(){s(``),d(null)},t[0]=f):f=t[0];let p=f,m;t[1]===r?m=t[2]:(m=function(e){e||p(),r(e)},t[1]=r,t[2]=m);let h=m,g,_;t[3]===n?(g=t[4],_=t[5]):(g=()=>{n&&p()},_=[n],t[3]=n,t[4]=g,t[5]=_),(0,Q.useEffect)(g,_);let v;t[6]!==h||t[7]!==a||t[8]!==o?(v=function(){let e=st(o);if(!e){d(`Enter a valid http(s) URL for the plugin archive or paste a tarsk:// install link.`);return}a(e),h(!1)},t[6]=h,t[7]=a,t[8]=o,t[9]=v):v=t[9];let y=v,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(ge,{children:[(0,$.jsx)(Me,{children:`Add Skill via URL`}),(0,$.jsx)(xe,{children:`Paste the URL of a plugin archive. Its skills and MCP servers are installed into this project.`})]}),t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(ve,{htmlFor:`add-skill-url`,children:`URL`}),t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[12]=S):S=t[12];let C;t[13]===y?C=t[14]:(C=e=>{e.key===`Enter`&&(e.preventDefault(),y())},t[13]=y,t[14]=C);let w;t[15]!==C||t[16]!==o?(w=(0,$.jsx)(J,{id:`add-skill-url`,placeholder:`https://example.com/my-plugin.zip`,value:o,onChange:S,autoFocus:!0,onKeyDown:C}),t[15]=C,t[16]=o,t[17]=w):w=t[17];let T;t[18]===u?T=t[19]:(T=u?(0,$.jsx)(`p`,{className:c(i.caption,`text-destructive`),children:u}):null,t[18]=u,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,$.jsx)(`div`,{className:`grid gap-4 py-2`,children:(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[x,w,T]})}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===h?D=t[24]:(D=(0,$.jsx)(l,{variant:`outline`,onClick:()=>h(!1),children:`Cancel`}),t[23]=h,t[24]=D);let O;t[25]===o?O=t[26]:(O=o.trim(),t[25]=o,t[26]=O);let k=!O,A;t[27]!==y||t[28]!==k?(A=(0,$.jsx)(l,{onClick:y,disabled:k,children:`Continue`}),t[27]=y,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==D||t[31]!==A?(j=(0,$.jsxs)(ye,{children:[D,A]}),t[30]=D,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==E||t[34]!==j?(M=(0,$.jsxs)(Y,{className:`sm:max-w-lg`,children:[b,E,j]}),t[33]=E,t[34]=j,t[35]=M):M=t[35];let N;return t[36]!==h||t[37]!==n||t[38]!==M?(N=(0,$.jsx)(X,{open:n,onOpenChange:h,children:M}),t[36]=h,t[37]=n,t[38]=M,t[39]=N):N=t[39],N}function lt(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...lt(n.children))}return t}function ut(e){return`.agents/skills/${e}/SKILL.md`}function dt(e,t){let n=t.trim();if(!n)return e;let r=n.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(r)||e.description.toLowerCase().includes(r))}function ft(e){let t=(0,Z.c)(7),{items:n,onPreview:r}=e,a;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=e=>{let t=We(e.name);return(0,$.jsxs)(`div`,{className:`group flex min-h-13 items-center gap-3 px-3 py-2`,role:`button`,tabIndex:0,onClick:()=>r(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))},children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:c(i.label,`truncate`),children:t}),(0,$.jsx)(`p`,{className:c(i.caption,`truncate`),children:e.description})]}),(0,$.jsx)(S,{delayDuration:300,children:(0,$.jsxs)(C,{children:[(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto`,"aria-label":`Install ${t}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,$.jsx)(h,{className:`h-4 w-4`})})}),(0,$.jsx)(x,{children:`Install skill`})]})})]},e.id)},t[3]=r,t[4]=e),a=n.map(e),t[0]=n,t[1]=r,t[2]=a}else a=t[2];let o;return t[5]===a?o=t[6]:(o=(0,$.jsx)(`div`,{className:`divide-y divide-table-border`,children:a}),t[5]=a,t[6]=o),o}function pt(e){let t=(0,Z.c)(21),{skills:n,threadId:r,onOpenSkill:i,onDelete:a,onAddManual:o,onAddUrl:s}=e,c=!r,l;t[0]!==o||t[1]!==s?(l=e=>{e===`manual`?o():s()},t[0]=o,t[1]=s,t[2]=l):l=t[2];let u;t[3]!==c||t[4]!==l?(u=(0,$.jsx)(Ne,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,$.jsx)(at,{manualDisabled:c,onSelectMode:l}),sticky:!1}),t[3]=c,t[4]=l,t[5]=u):u=t[5];let d;t[6]===r?d=t[7]:(d=!r&&(0,$.jsx)(_e,{children:`Select a thread to add or install skills.`}),t[6]=r,t[7]=d);let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f={icon:y,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=e=>i(e.path),t[9]=i,t[10]=p);let m;t[11]!==a||t[12]!==n||t[13]!==p?(m=(0,$.jsx)(Re,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:f,getKey:_t,renderContent:gt,onItemClick:p,itemClickLabel:ht,onDelete:a,deleteAriaLabel:mt,deleteTooltip:`Remove this skill from the project`}),t[11]=a,t[12]=n,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,$.jsxs)(se,{className:`pt-6`,children:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let g;return t[18]!==u||t[19]!==h?(g=(0,$.jsxs)(De,{className:`shrink-0`,children:[u,h]}),t[18]=u,t[19]=h,t[20]=g):g=t[20],g}function mt(e){return`Delete ${e.name}`}function ht(e){return`Open ${e.name} in Files`}function gt(e){return(0,$.jsx)(`span`,{className:c(i.body,`truncate text-left`),children:e.name})}function _t(e){return e.id}function vt(e){let t=(0,Z.c)(50),{availableSearch:n,onSearchChange:r,selectedSourceId:i,onSourceChange:a,sources:o,selectedCustomSource:s,availableCatalogLoading:c,isDefaultSource:u,filteredPopular:d,filteredCatalog:f,installedFilePaths:p,onPreviewPopular:m,onPreviewCatalog:h,onAddSource:v}=e,y;if(t[0]!==d||t[1]!==p){let e;t[3]===p?e=t[4]:(e=e=>!p.has(ut(e.id)),t[3]=p,t[4]=e),y=d.filter(e),t[0]=d,t[1]=p,t[2]=y}else y=t[2];let w=y,T;if(t[5]!==f||t[6]!==p){let e;t[8]===p?e=t[9]:(e=e=>!p.has(ut(e.id)),t[8]=p,t[9]=e),T=f.filter(e),t[5]=f,t[6]=p,t[7]=T}else T=t[7];let E=T,D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(S,{children:(0,$.jsxs)(C,{children:[(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(`span`,{className:`cursor-help`,children:`Available Skills`})}),(0,$.jsx)(x,{children:`Browse and install skills from the catalog.`})]})}),t[10]=D):D=t[10];let O;t[11]!==n||t[12]!==r?(O=(0,$.jsx)(Ie,{placeholder:`Search`,value:n,onChange:r,className:`mb-0 w-64`}),t[11]=n,t[12]=r,t[13]=O):O=t[13];let k;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(pe,{className:`w-40`,"aria-label":`Skill source`,children:(0,$.jsx)(ce,{placeholder:`Default`})}),t[14]=k):k=t[14];let A;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(de,{value:`default`,children:`Default`}),t[15]=A):A=t[15];let j;t[16]===o?j=t[17]:(j=o.map(yt),t[16]=o,t[17]=j);let M;t[18]===j?M=t[19]:(M=(0,$.jsxs)(Te,{children:[A,j]}),t[18]=j,t[19]=M);let N;t[20]!==a||t[21]!==i||t[22]!==M?(N=(0,$.jsxs)(oe,{value:i,onValueChange:a,children:[k,M]}),t[20]=a,t[21]=i,t[22]=M,t[23]=N):N=t[23];let P=s?`Edit skill source`:`Add skill source`,F;t[24]===s?F=t[25]:(F=s?(0,$.jsx)(g,{className:`h-4 w-4`}):(0,$.jsx)(_,{className:`h-4 w-4`}),t[24]=s,t[25]=F);let I;t[26]!==v||t[27]!==P||t[28]!==F?(I=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(l,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:v,"aria-label":P,children:F})}),t[26]=v,t[27]=P,t[28]=F,t[29]=I):I=t[29];let L=s?`Edit this custom skill source`:`Add a custom skill source`,R;t[30]===L?R=t[31]:(R=(0,$.jsx)(x,{children:L}),t[30]=L,t[31]=R);let z;t[32]!==I||t[33]!==R?(z=(0,$.jsx)(S,{children:(0,$.jsxs)(C,{children:[I,R]})}),t[32]=I,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==z||t[36]!==O||t[37]!==N?(B=(0,$.jsx)(Ne,{title:D,action:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[O,N,z]}),sticky:!1}),t[35]=z,t[36]=O,t[37]=N,t[38]=B):B=t[38];let V;t[39]!==E||t[40]!==c||t[41]!==w||t[42]!==n||t[43]!==u||t[44]!==h||t[45]!==m?(V=(0,$.jsx)(se,{className:`pt-6`,children:c?(0,$.jsx)(q,{className:`py-12`,label:`Loading skills...`}):u?w.length===0?(0,$.jsx)(Le,{searchQuery:n,emptyLabel:`No available skills found.`}):(0,$.jsx)(ft,{items:w,onPreview:m}):E.length===0?(0,$.jsx)(Le,{searchQuery:n,emptyLabel:`No available skills found.`}):(0,$.jsx)(ft,{items:E,onPreview:h})}),t[39]=E,t[40]=c,t[41]=w,t[42]=n,t[43]=u,t[44]=h,t[45]=m,t[46]=V):V=t[46];let H;return t[47]!==B||t[48]!==V?(H=(0,$.jsxs)(De,{className:`shrink-0`,children:[B,V]}),t[47]=B,t[48]=V,t[49]=H):H=t[49],H}function yt(e){return(0,$.jsx)(de,{value:e.id,children:e.title},e.id)}function bt(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:r,deleteConfirm:i,setDeleteConfirm:c,deleting:l,installedFilePaths:u,setInstalledFilePaths:d,loadItems:f,handleDelete:p,handleOpenInExplorer:m,triggerExplorerRefresh:h}=Be({findItems:lt,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`}),g=o(e=>e.projects),_=(0,Q.useMemo)(()=>g.find(t=>t.projectId===e)??null,[g,e]),[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)([]),[E,D]=(0,Q.useState)(!0),[O,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),{query:N,setQuery:P,deferredQuery:F}=ze(),{sources:L,selectedSourceId:R,setSelectedSourceId:B,addSource:V,updateSource:H,removeSource:ee,catalogSkills:W,isLoadingCatalog:te}=et(),G=R==="default",K=(0,Q.useMemo)(()=>a(R)?L.find(e=>e.id===R)??null:null,[R,L]);(0,Q.useEffect)(()=>{D(!0),I().then(T).catch(()=>T([])).finally(()=>D(!1))},[]);let ne=Fe(e?`${e}:${t??``}`:null,[r,E]),re=(0,Q.useCallback)(async e=>{let n=`.agents/skills/${e.id}/SKILL.md`;if(!t||u.has(n))return;let r=e.sourceId??(R==="default"?void 0:R);try{if(r)await z(t,r,e.id,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions??``),await k(t,n,r.join(`
|
|
3
|
-
`))}d(e=>new Set(e).add(n)),h(),f(),U({title:`Skill installed`,description:e.name})}catch(e){throw U({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}},[t,R,u,h,f]),ie=(0,Q.useMemo)(()=>dt(w,F),[w,F]),ae=(0,Q.useMemo)(()=>dt(W,F),[W,F]),q=!G&&te&&W.length===0;return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(me,{loading:ne,children:[(0,$.jsx)(pt,{skills:n,threadId:t,onOpenSkill:m,onDelete:c,onAddManual:()=>y(!0),onAddUrl:()=>x(!0)}),(0,$.jsx)(vt,{availableSearch:N,onSearchChange:P,selectedSourceId:R,onSourceChange:B,sources:L,selectedCustomSource:K,availableCatalogLoading:q,isDefaultSource:G,filteredPopular:ie,filteredCatalog:ae,installedFilePaths:u,onPreviewPopular:e=>A(e),onPreviewCatalog:e=>A({...e,sourceId:e.sourceId??R}),onAddSource:()=>M(!0)})]}),(0,$.jsx)(Xe,{open:O!==null,onOpenChange:e=>{e||A(null)},skill:O,catalogSourceId:G?void 0:R,onInstall:re}),(0,$.jsx)(rt,{open:j,onOpenChange:M,editingSource:K,onSourceAdded:e=>{V(e),U({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{H(e),U({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{ee(e),U({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,$.jsx)(X,{open:v,onOpenChange:y,children:(0,$.jsx)(Y,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,$.jsx)(Ge,{threadId:t,onSkillCreated:()=>{y(!1),f(),h()}})})}),(0,$.jsx)(ct,{open:b,onOpenChange:x,onSubmit:e=>C(e)}),(0,$.jsx)(Ce,{url:S,projectId:e,projectName:_?s(_):null,projects:g,onSelectProject:()=>{},onClose:()=>C(null),onInstalled:({mcpOnly:e})=>{f(),h(),U({title:e?`MCP server installed`:`Plugin installed`,description:e?`Its MCP servers were added to this project.`:`Its skills and MCP servers were added to this project.`})}}),(0,$.jsx)(Pe,{open:i!==null,onOpenChange:e=>!e&&c(null),title:`Delete Skill`,description:`Are you sure you want to delete the skill "${i?.name}"? This action cannot be undone.`,onConfirm:()=>{i&&p(i)},confirming:l})]}):(0,$.jsx)(he,{children:`Select a project to manage skills.`})}export{bt as SettingsSkillsView,bt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{Dt as r}from"./dist-CTLFS4dn.js";import{r as i}from"./store-BSzKIu5G.js";import{r as a,t as o}from"./button-kWtLAMpB.js";import{Pt as s,k as c}from"./dist-c_QADQ5u.js";import{i as l,n as u,r as d,t as f}from"./tooltip-Db8UeYxm.js";import{N as p,Rt as m,S as h,cr as g,rr as _}from"./api-DX1ny6q-.js";import{t as v}from"./use-toast-xpb5jNtN.js";import{n as y}from"./explorer-tab-context-BxUVwWQQ.js";import{Et as b,Ln as x,Ot as S,St as ee,Tt as C,_t as te,dr as w,fr as T,gt as E,ht as D,kt as O,mr as ne,pr as re,vt as k}from"./index-u8UbWjXL.js";import{t as ie}from"./delete-confirm-dialog-Dl76vaxb.js";import{n as A,t as j}from"./radio-group-Dn_pN-pn.js";import{t as M}from"./use-settings-page-loading-BTySlInF.js";import{a as N,i as P,r as ae}from"./settings-list-B9a61wMg.js";import{i as F,n as I,r as L}from"./slug-utils-CQ8PMWUL.js";var R=e(t(),1),z=n();function oe({projectId:e,threadId:t,onCommandCreated:n}){let[i,o]=(0,R.useState)(``),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(`default`),[p,m]=(0,R.useState)(!1),g=L(i),_=I(g),y=async()=>{if(!(!_||!e)){m(!0);try{await h(g,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,t??void 0),v({title:`Command created`,description:`Command '/${g}' was created successfully.`}),o(``),c(``),u(``),f(`default`),n?.(g)}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{m(!1)}}};return e?(0,z.jsx)(S,{children:(0,z.jsxs)(D,{children:[(0,z.jsx)(k,{title:`Add Slash Command`,description:`Saved as a .md file in ~/.agents/commands.`,sticky:!0,className:`pr-10`}),(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(E,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,z.jsx)(T,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:p}),i?(0,z.jsxs)(`p`,{className:a(r.caption,`mt-2`),children:[`Command: `,(0,z.jsxs)(`span`,{className:`font-mono`,children:[`/`,g||`...`]})]}):null]}),(0,z.jsx)(E,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsx)(T,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:p})}),(0,z.jsx)(E,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsx)(T,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:p})}),(0,z.jsx)(E,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,z.jsxs)(j,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:p,children:[(0,z.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,z.jsx)(A,{value:`default`,id:`mode-default`}),(0,z.jsx)(w,{htmlFor:`mode-default`,className:a(r.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,z.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,z.jsx)(A,{value:`plan`,id:`mode-plan`}),(0,z.jsx)(w,{htmlFor:`mode-plan`,className:a(r.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,z.jsx)(F,{onContinue:()=>void y(),disabled:!_,creating:p})]})]})}):(0,z.jsx)(C,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function B(){let e=i(e=>e.selectedProjectId),t=i(e=>e.selectedThreadId),{openChatDockPanel:n}=x(),{setPendingExplorerPath:S,triggerExplorerRefresh:w,setExplorerClearPath:T}=y(),[E,D]=(0,R.useState)([]),[A,j]=(0,R.useState)(!0),[F,I]=(0,R.useState)(!1),[L,B]=(0,R.useState)(null),[V,H]=(0,R.useState)(!1),[U,W]=(0,R.useState)([]),[G,K]=(0,R.useState)(!0),[q,J]=(0,R.useState)(new Map),[Y,se]=(0,R.useState)(``),X=(0,R.useCallback)(async()=>{if(!t){j(!1),D([]),J(new Map);return}j(!0);try{let e=await m(t);D(e.filter(e=>!e.isBuiltIn)),J(new Map(e.map(e=>[e.name,e.filePath])))}catch{D([]),J(new Map)}finally{j(!1)}},[t]);(0,R.useLayoutEffect)(()=>{t&&j(!0)},[e,t]),(0,R.useEffect)(()=>{X()},[X]),(0,R.useEffect)(()=>{K(!0),_().then(W).catch(()=>W([])).finally(()=>K(!1))},[]);let ce=M(e?`${e}:${t??``}`:null,[A,G]),le=(0,R.useCallback)(async e=>{H(!0);try{if(!t)return;await p(e.filePath,t),T(e.filePath),w(),J(t=>{let n=new Map(t);return n.delete(e.name),n}),v({title:`Command removed`,description:`/${e.name}`}),B(null),await X()}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{H(!1)}},[X,t,w,T]),ue=(0,R.useCallback)(e=>{S(e),n(`explorer`)},[S,n]),de=(0,R.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),Z=(0,R.useCallback)(async e=>{if(!(!t||q.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let n=`.agents/commands`;await g(t,e.gitHubRepo,e.gitHubFolder,n);let r=`${n}/${e.name}.md`;J(t=>new Map(t).set(e.name,r))}else{let n=await h(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,t);J(t=>new Map(t).set(e.name,n.filePath))}w(),X(),v({title:`Command installed`,description:`/${e.name}`})}catch(e){v({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[t,q,w,X]),Q=U.filter(e=>!q.has(e.name)),$=Y.trim()?Q.filter(e=>e.name.toLowerCase().includes(Y.toLowerCase())||e.description.toLowerCase().includes(Y.toLowerCase())):Q;return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(ee,{loading:ce,children:[(0,z.jsxs)(O,{className:`shrink-0`,children:[(0,z.jsx)(k,{title:(0,z.jsx)(d,{children:(0,z.jsxs)(f,{children:[(0,z.jsx)(l,{asChild:!0,children:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Installed Slash Commands`,(0,z.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(u,{children:`Project slash commands you run with / in chat.`})]})}),action:(0,z.jsx)(o,{onClick:()=>I(!0),disabled:!t,children:`Add Command`}),sticky:!1}),(0,z.jsxs)(b,{className:`pt-6`,children:[!t&&(0,z.jsx)(te,{children:`Select a thread to add or install slash commands.`}),(0,z.jsx)(ae,{showHeader:!1,loading:!1,items:E,emptyState:{icon:c,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},getKey:e=>e.filePath,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:e=>(0,z.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,z.jsxs)(`div`,{className:a(r.body,`truncate`),children:[`/`,e.name]}),(0,z.jsx)(`div`,{className:a(r.compact,`truncate text-muted-foreground`),children:de(e)})]}),renderMiddle:e=>e.metadata?.mode?(0,z.jsx)(`span`,{className:a(r.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,z.jsx)(`div`,{}),onItemClick:e=>ue(e.filePath),itemClickLabel:e=>`Open /${e.name} in Files`,onDelete:B,deleteAriaLabel:e=>`Delete /${e.name}`,deleteTooltip:`Remove this slash command from the project`})]})]}),(0,z.jsxs)(O,{className:`shrink-0`,children:[(0,z.jsx)(k,{title:(0,z.jsx)(d,{children:(0,z.jsxs)(f,{children:[(0,z.jsx)(l,{asChild:!0,children:(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Available Slash Commands`,(0,z.jsx)(s,{"aria-hidden":`true`,className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(u,{children:`Browse and install slash commands from the catalog.`})]})}),action:(0,z.jsx)(N,{placeholder:`Search`,value:Y,onChange:se,className:`mb-0 w-64`}),sticky:!1}),(0,z.jsx)(b,{className:`pt-6`,children:$.length===0?(0,z.jsx)(P,{searchQuery:Y,emptyLabel:`No available commands found.`}):(0,z.jsx)(`div`,{className:`divide-y divide-table-border`,children:$.map(e=>(0,z.jsxs)(`div`,{className:`group flex min-h-13 items-center justify-between gap-3 px-3 py-3 hover:bg-muted/30`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,z.jsxs)(`div`,{className:a(r.body,`truncate`),children:[`/`,e.name]}),(0,z.jsx)(`div`,{className:a(r.compact,`truncate text-muted-foreground`),children:e.description})]}),(0,z.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100`,disabled:!t,onClick:()=>void Z(e),children:`Install`})]},e.id))})})]})]}),(0,z.jsx)(re,{open:F,onOpenChange:I,children:(0,z.jsx)(ne,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,z.jsx)(oe,{projectId:e,threadId:t,onCommandCreated:()=>{I(!1),X(),w()}})})}),(0,z.jsx)(ie,{open:L!==null,onOpenChange:e=>!e&&B(null),title:`Delete Slash Command`,description:`Are you sure you want to delete "/${L?.name}"? This action cannot be undone.`,onConfirm:()=>{L&&le(L)},confirming:V})]}):(0,z.jsx)(C,{children:`Select a project to manage slash commands.`})}export{B as SettingsSlashCommandsView,B as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Dt as i,c as a}from"./dist-CTLFS4dn.js";import{W as o,Y as s,r as c}from"./store-BSzKIu5G.js";import{m as l,r as u,t as d}from"./button-kWtLAMpB.js";import{D as f,Hn as p,Ot as m,zn as h}from"./dist-c_QADQ5u.js";import{i as g,n as _,t as v}from"./tooltip-Db8UeYxm.js";import{n as y}from"./use-toast-xpb5jNtN.js";import{n as ee}from"./async-loading-fallback-V0EaQ_Kn.js";import{$ as te,Bn as ne,Et as re,N as ie,jn as ae,vt as oe}from"./index-u8UbWjXL.js";import{t as se}from"./delete-confirm-dialog-Dl76vaxb.js";import{i as ce,r as b}from"./table-A3cgauiZ.js";import{t as le}from"./settings-list-B9a61wMg.js";var x=t(),S=e(n(),1),C=r(),ue=36,de=`table-fixed`,fe=`h-9 w-48 bg-transparent py-2`,pe=`h-9 bg-transparent py-2`,me=`h-9 w-32 bg-transparent py-2`,he=`h-9 w-10 bg-transparent py-2`,ge=u(i.bodyMuted,`w-48 truncate py-1.5`),_e=u(i.body,`truncate py-1.5`),ve=u(i.bodyMuted,`w-32 truncate py-1.5`),ye=`w-10 py-1.5`,be={column:`project`,direction:`asc`};function xe(e){let t=(0,x.c)(4),n;if(t[0]!==e){let{style:r,...a}=e,o;t[2]===r?o=t[3]:(o={...r,width:`100%`},t[2]=r,t[3]=o),n=(0,C.jsx)(`table`,{...a,style:o,className:u(`w-full caption-bottom`,de,i.body,a.className)}),t[0]=e,t[1]=n}else n=t[1];return n}function Se(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`hidden`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`thead`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`[&_tr:last-child]:border-0`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`tbody`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function we(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=u(`frosted-scrollbar`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`div`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function w(e,t){return t?a(t,e):e}function T(e,t,n){switch(t){case`project`:return e.projectName;case`path`:return w(e.path,n);case`branch`:return e.branch}}function Te(e){let t=[];for(let n of e){let e=l(n);for(let r of n.threads)t.push({threadId:r.threadId,projectId:n.projectId,projectName:e,path:r.path,branch:r.currentBranch||r.title})}return t}function Ee(e,t,n,r){return[...e].sort((e,i)=>{let a=T(e,t,r).localeCompare(T(i,t,r),void 0,{sensitivity:`base`});return n===`asc`?a:-a})}function E(e){let t=(0,x.c)(17),{label:n,column:r,sortColumn:i,sortDirection:a,className:o,onSort:s}=e,c=i===r,l=a===`asc`?h:p,d=c?`text-foreground`:`text-muted-foreground`,f;t[0]===d?f=t[1]:(f=u(`inline-flex items-center gap-1 transition-colors hover:text-foreground`,d),t[0]=d,t[1]=f);let m;t[2]!==r||t[3]!==s?(m=()=>s(r),t[2]=r,t[3]=s,t[4]=m):m=t[4];let g=c?a===`asc`?`ascending`:`descending`:`none`,_;t[5]!==l||t[6]!==c?(_=c?(0,C.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):null,t[5]=l,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==n||t[9]!==f||t[10]!==m||t[11]!==g||t[12]!==_?(v=(0,C.jsxs)(`button`,{type:`button`,className:f,onClick:m,"aria-sort":g,children:[n,_]}),t[8]=n,t[9]=f,t[10]=m,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;return t[14]!==o||t[15]!==v?(y=(0,C.jsx)(ce,{className:o,children:v}),t[14]=o,t[15]=v,t[16]=y):y=t[16],y}function D(){let e=(0,x.c)(55),t=c(Fe),n=c(Pe),r=c(Ne),a=c(Me),o=c(je),l=c(Ae),p=c(ke),h=c(Oe),{handleDeleteThread:T,refreshWorkspaces:D}=ne(),{toast:O}=y(),[k,Ie]=(0,S.useState)(null),[A,Le]=(0,S.useState)(be),Re=ie()?`Finder`:`Explorer`,j,M;e[0]===D?(j=e[1],M=e[2]):(j=()=>{D()},M=[D],e[0]=D,e[1]=j,e[2]=M),(0,S.useEffect)(j,M);let N;e[3]!==n||e[4]!==t||e[5]!==A.column||e[6]!==A.direction?(N=Ee(Te(t),A.column,A.direction,n),e[3]=n,e[4]=t,e[5]=A.column,e[6]=A.direction,e[7]=N):N=e[7];let P=N,F;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){Le(t=>t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:`asc`})},e[8]=F):F=e[8];let ze=F,I;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){let{...t}=e;return(0,C.jsx)(`tr`,{...t,className:u(`group border-0 transition-colors hover:bg-muted/50`,t.className)})},e[9]=I):I=e[9];let Be=I,L;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(L={Table:xe,TableHead:Se,TableBody:Ce,TableRow:Be,Scroller:we},e[10]=L):L=e[10];let Ve=L,R;e[11]!==T||e[12]!==k?(R=function(){if(!k)return;let{projectId:e,threadId:t}=k;Ie(null),T(e,t)},e[11]=T,e[12]=k,e[13]=R):R=e[13];let He=R,z;e[14]===O?z=e[15]:(z=async function(e){try{await te(e.threadId,`.`)}catch{O({title:`Error`,description:`Failed to open folder in ${Re}.`,variant:`destructive`})}},e[14]=O,e[15]=z);let Ue=z,B;e[16]!==n||e[17]!==l||e[18]!==a||e[19]!==Ue||e[20]!==h||e[21]!==o||e[22]!==p?(B=function(e,t){let r=a.includes(t.threadId),c=s(t.threadId,o,p,h),y=l.includes(t.threadId),ee=!c&&!r&&!y,te=w(t.path,n);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{className:ge,children:t.projectName}),(0,C.jsx)(b,{className:_e,children:(0,C.jsx)(`button`,{type:`button`,className:u(i.body,`block w-full truncate text-left hover:underline`),title:`${t.path}\nOpen in ${Re}`,onClick:()=>void Ue(t),children:te})}),(0,C.jsx)(b,{className:ve,children:t.branch}),(0,C.jsx)(b,{className:ye,children:(0,C.jsx)(`div`,{className:`ml-auto flex h-7 w-7 items-center justify-center`,children:r?(0,C.jsx)(m,{className:`h-4 w-4 animate-spin text-muted-foreground`,"aria-label":`Deleting`}):ee?(0,C.jsxs)(v,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsxs)(d,{variant:`ghost`,size:`icon-sm`,className:le,onClick:e=>{e.stopPropagation(),Ie(t)},children:[(0,C.jsx)(f,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Delete workspace`})]})}),(0,C.jsx)(_,{side:`left`,children:`Delete branch and files from the repo`})]}):null})})]})},e[16]=n,e[17]=l,e[18]=a,e[19]=Ue,e[20]=h,e[21]=o,e[22]=p,e[23]=B):B=e[23];let We=B,V;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=u(`w-full caption-bottom`,de,i.body),e[24]=V):V=e[24];let H,U,W;e[25]!==A.column||e[26]!==A.direction?(H=(0,C.jsx)(E,{label:`Project`,column:`project`,sortColumn:A.column,sortDirection:A.direction,className:fe,onSort:ze}),U=(0,C.jsx)(E,{label:`Path`,column:`path`,sortColumn:A.column,sortDirection:A.direction,className:pe,onSort:ze}),W=(0,C.jsx)(E,{label:`Branch`,column:`branch`,sortColumn:A.column,sortDirection:A.direction,className:me,onSort:ze}),e[25]=A.column,e[26]=A.direction,e[27]=H,e[28]=U,e[29]=W):(H=e[27],U=e[28],W=e[29]);let G;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,C.jsx)(ce,{className:he,children:(0,C.jsx)(`span`,{className:`sr-only`,children:`Actions`})}),e[30]=G):G=e[30];let K;e[31]!==H||e[32]!==U||e[33]!==W?(K=(0,C.jsx)(`table`,{className:V,children:(0,C.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,C.jsxs)(`tr`,{children:[H,U,W,G]})})}),e[31]=H,e[32]=U,e[33]=W,e[34]=K):K=e[34];let Ge=K,Ke=P.length>0?Ge:void 0,q;e[35]===Ke?q=e[36]:(q=(0,C.jsx)(oe,{title:`Storage`,description:`Workspaces and branches stored on disk across all projects.`,tableHeader:Ke}),e[35]=Ke,e[36]=q);let J;e[37]!==r||e[38]!==We||e[39]!==P?(J=(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:r&&P.length===0?(0,C.jsx)(ee,{label:`Loading workspaces...`,size:`lg`}):P.length===0?(0,C.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,C.jsxs)(`div`,{className:`max-w-md space-y-2 text-center`,children:[(0,C.jsx)(`h3`,{className:i.emptyStateTitle,children:`No workspaces`}),(0,C.jsx)(`p`,{className:i.bodyMuted,children:`No branches or workspaces found yet.`})]})}):(0,C.jsx)(ae,{style:{height:`100%`},data:P,computeItemKey:De,itemContent:We,defaultItemHeight:ue,increaseViewportBy:ue*5,components:Ve})}),e[37]=r,e[38]=We,e[39]=P,e[40]=J):J=e[40];let Y;e[41]!==q||e[42]!==J?(Y=(0,C.jsxs)(re,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[q,J]}),e[41]=q,e[42]=J,e[43]=Y):Y=e[43];let qe=k!==null,X;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(X=e=>{e||Ie(null)},e[44]=X):X=e[44];let Z;e[45]!==n||e[46]!==k?(Z=k?`Are you sure you want to delete the workspace at "${w(k.path,n)}"? This removes the branch and all its files. This action cannot be undone.`:``,e[45]=n,e[46]=k,e[47]=Z):Z=e[47];let Q;e[48]!==He||e[49]!==qe||e[50]!==Z?(Q=(0,C.jsx)(se,{open:qe,onOpenChange:X,title:`Delete workspace?`,description:Z,onConfirm:He,confirmLabel:`Delete`,confirmingLabel:`Deleting...`}),e[48]=He,e[49]=qe,e[50]=Z,e[51]=Q):Q=e[51];let $;return e[52]!==Y||e[53]!==Q?($=(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:[Y,Q]}),e[52]=Y,e[53]=Q,e[54]=$):$=e[54],$}function De(e,t){return t.threadId}function Oe(e){return e.pendingChatMessage}function ke(e){return o(e.threadStreamingStates)}function Ae(e){return e.completedThreadIds}function je(e){return e.processingThreadIds}function Me(e){return e.deletingThreadIds}function Ne(e){return e.projectsLoading}function Pe(e){return e.cloneRootPath}function Fe(e){return e.projects}export{D as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-general-view-CKvkG8C5.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-u8UbWjXL.js","assets/react-vendor-Ee0-5T4I.js","assets/alert-dialog-BxMfaLuO.js","assets/button-kWtLAMpB.js","assets/dist-CTLFS4dn.js","assets/use-browser-overlay-block-DyprQSIG.js","assets/browser-overlay-block-CiDtkfup.js","assets/dist-c_QADQ5u.js","assets/dist-D-2G8xGB.js","assets/es2015-BlPKkFZZ.js","assets/async-loading-fallback-V0EaQ_Kn.js","assets/scroll-area-lkVMElz5.js","assets/dist-OixawqbU.js","assets/tooltip-Db8UeYxm.js","assets/dist-C2G92uPn.js","assets/dist-DoxvnNEY.js","assets/use-toast-xpb5jNtN.js","assets/chat-dock-context-BJNNRoZC.js","assets/api-DX1ny6q-.js","assets/store-BSzKIu5G.js","assets/explorer-tab-context-BxUVwWQQ.js","assets/main-tab-context-Byl1LybL.js","assets/use-suspense-resource-Dakt9lfT.js","assets/suspense-resource-BFrb_XJX.js","assets/create-project-workspace-Dv_lEfZx.js","assets/dist-DD4GtbiM.js","assets/dist-yM5kyz9Q.js","assets/dist-CHhgoHp6.js","assets/dist-DsmF-KJ-.js","assets/dist-CSssbxDI.js","assets/useBaseQuery-GJoj38pA.js","assets/chunk-QFMPRPBF-COsSkB7x.js","assets/index-BLNUy5nZ.css","assets/toggle-group-Q36wRGKA.js","assets/use-settings-page-loading-BTySlInF.js","assets/project-settings-view-Dd3QPujg.js","assets/context-menu-BcM6I0Sx.js","assets/project-coding-view-DG1D8-z4.js","assets/commit-method-fields-CVQjrJ_O.js","assets/project-env-vars-view-TblkryyN.js","assets/project-danger-zone-view-6HEDGyUj.js","assets/project-model-aliases-view-Ct0v4NQm.js","assets/project-tools-view-DdsKSUDp.js","assets/providers-list-view-BUNk2E8O.js","assets/model-list-controls-CNrps9Ys.js","assets/sorting-DqwxPMRN.js","assets/async-error-boundary-BX1G17o9.js","assets/card-B_EASkic.js","assets/settings-list-B9a61wMg.js","assets/use-deferred-search-Dgxosq55.js","assets/pending-changes-Bn-0ak1d.js","assets/settings-models-view-Ef404r4H.js","assets/table-A3cgauiZ.js","assets/settings-mcp-servers-view-CaAy6iV4.js","assets/delete-confirm-dialog-Dl76vaxb.js","assets/settings-slack-view-C32in2Wg.js","assets/settings-logs-view-4Uoa1-Dx.js","assets/settings-skills-view-DLrG4E_U.js","assets/slug-utils-CQ8PMWUL.js","assets/use-installed-ai-files-BuuVI3sM.js","assets/settings-slash-commands-view-CpBMV_5D.js","assets/radio-group-Dn_pN-pn.js","assets/settings-subagents-view-StdmEn-E.js","assets/settings-system-prompt-view-DizAjXjo.js","assets/account-view-DvyhZGLB.js","assets/conversation-history-view-CzRrC6cJ.js","assets/settings-storage-view-BzT8k6yE.js","assets/settings-statistics-view-CxW2KB56.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{c as a,o,s}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as c,N as l}from"./dist-CTLFS4dn.js";import{$ as u,n as d,r as f}from"./store-BSzKIu5G.js";import{m as p,r as m,t as h}from"./button-kWtLAMpB.js";import{A as g,C as _,Cn as v,E as y,Fn as b,G as x,I as S,In as C,Ln as w,Lt as T,Rt as E,S as D,Tt as O,U as k,b as A,dt as j,k as M,x as N,y as P,yn as F}from"./dist-c_QADQ5u.js";import{Dt as I,Jt as L,fn as R}from"./api-DX1ny6q-.js";import{n as z}from"./scroll-area-lkVMElz5.js";import{n as B}from"./async-loading-fallback-V0EaQ_Kn.js";import{Gn as V,Hn as H,Kn as U,M as W,Mn as G,Nn as K,Pn as ee,Tt as te,Un as q,er as ne}from"./index-u8UbWjXL.js";var J=t(),Y=e(n(),1),X=i(),re=(0,Y.forwardRef)(function(e,t){let n=(0,J.c)(29),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:u,className:d,onCollapse:f,onExpand:p,isMobile:h,mobileShowSidebar:g,sidebarClassName:_}=e,v=a===void 0?25:a,y=o===void 0?20:o,b=s===void 0?30:s,x=c===void 0?40:c,S=l===void 0?!1:l,C=u===void 0?0:u,w=d===void 0?``:d,T=h===void 0?!1:h,E=g===void 0?!0:g,D=T&&!E,O=T&&E,k=`h-full ${w}`,A=T?100:v,j=T?50:y,M=T?100:b,N=D&&`hidden`,P;n[0]!==_||n[1]!==N?(P=m(`border-r border-transparent`,N,_),n[0]=_,n[1]=N,n[2]=P):P=n[2];let F;n[3]!==C||n[4]!==S||n[5]!==f||n[6]!==p||n[7]!==t||n[8]!==r||n[9]!==A||n[10]!==j||n[11]!==M||n[12]!==P?(F=(0,X.jsx)(K,{ref:t,defaultSize:A,minSize:j,maxSize:M,collapsible:S,collapsedSize:C,onCollapse:f,onExpand:p,className:P,children:r}),n[3]=C,n[4]=S,n[5]=f,n[6]=p,n[7]=t,n[8]=r,n[9]=A,n[10]=j,n[11]=M,n[12]=P,n[13]=F):F=n[13];let I;n[14]===T?I=n[15]:(I=!T&&(0,X.jsx)(G,{withHandle:!0,className:`ml-[-10px]`}),n[14]=T,n[15]=I);let L=O&&`hidden`,R;n[16]===L?R=n[17]:(R=m(`overflow-hidden`,L),n[16]=L,n[17]=R);let z;n[18]!==i||n[19]!==x||n[20]!==R?(z=(0,X.jsx)(K,{minSize:x,className:R,children:i}),n[18]=i,n[19]=x,n[20]=R,n[21]=z):z=n[21];let B;n[22]!==F||n[23]!==I||n[24]!==z?(B=(0,X.jsxs)(ee,{direction:`horizontal`,className:`h-full`,children:[F,I,z]}),n[22]=F,n[23]=I,n[24]=z,n[25]=B):B=n[25];let V;return n[26]!==k||n[27]!==B?(V=(0,X.jsx)(`div`,{className:k,children:B}),n[26]=k,n[27]=B,n[28]=V):V=n[28],V});function ie(e){let t=(0,J.c)(5),{className:n}=e,r;t[0]===n?r=t[1]:(r=m(`h-4 w-4`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`path`,{d:`M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.528 2.528 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.528 2.528 0 0 1-2.52-2.523 2.528 2.528 0 0 1 2.52-2.52h6.313A2.528 2.528 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z`}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,X.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,className:r,children:i}),t[3]=r,t[4]=a),a}var Z=[{id:`skills`,label:`Skills`,icon:(0,X.jsx)(N,{className:`h-4 w-4`}),route:`/settings/skills`},{id:`slash-commands`,label:`Slash Commands`,icon:(0,X.jsx)(M,{className:`h-4 w-4`}),route:`/settings/slash-commands`},{id:`subagents`,label:`Subagents`,icon:(0,X.jsx)(D,{className:`h-4 w-4`}),route:`/settings/subagents`},{id:`system-prompt`,label:`System Prompt`,icon:(0,X.jsx)(S,{className:`h-4 w-4`}),route:`/settings/system-prompt`},{id:`mcp-servers`,label:`MCP Servers`,icon:(0,X.jsx)(x,{className:`h-4 w-4`}),route:`/settings/mcp-servers`},{id:`general`,label:`Settings`,icon:(0,X.jsx)(k,{className:`h-4 w-4`}),route:`/settings/general`},{id:`logs`,label:`Logs`,icon:(0,X.jsx)(O,{className:`h-4 w-4`}),route:`/settings/logs`},{id:`slack`,label:`Slack`,icon:(0,X.jsx)(ie,{}),route:`/settings/slack`},{id:`providers`,label:`Providers`,icon:(0,X.jsx)(F,{className:`h-4 w-4`}),route:`/settings/providers`},{id:`models`,label:`Models`,icon:(0,X.jsx)(C,{className:`h-4 w-4`}),route:`/settings/models`},{id:`model-aliases`,label:`Model Aliases`,icon:(0,X.jsx)(g,{className:`h-4 w-4`}),route:`/settings/model-aliases`},{id:`statistics`,label:`Statistics`,icon:(0,X.jsx)(b,{className:`h-4 w-4`}),route:`/settings/statistics`},{id:`history`,label:`History`,icon:(0,X.jsx)(T,{className:`h-4 w-4`}),route:`/settings/history`},{id:`storage`,label:`Storage`,icon:(0,X.jsx)(E,{className:`h-4 w-4`}),route:`/settings/storage`},{id:`account`,label:`Account`,icon:(0,X.jsx)(_,{className:`h-4 w-4`}),route:`/settings/account`}],Q=new Set([`project`,`project-coding`,`project-danger-zone`,`project-env-vars`,`project-tools`,`skills`,`slash-commands`,`subagents`,`system-prompt`,`mcp-servers`]),ae=new Set([`project`,`skills`,`mcp-servers`]),oe=new Set([`project-coding`,`project-env-vars`]),se=new Set([`system-prompt`,`project-tools`,`slash-commands`,`subagents`,`project-danger-zone`]),ce=new Set([`general`,`logs`,`slack`,`providers`,`models`,`model-aliases`,`statistics`,`history`,`storage`,`account`]);function le(e){return Q.has(e)?`project`:`general`}function $(e){let t=(0,J.c)(18),{label:n,items:r,activeTabId:i,onItemClick:a,showSeparator:o,className:s}=e,c=o===void 0?!0:o;if(r.length===0)return null;let l;t[0]===n?l=t[1]:(l=n?(0,X.jsx)(H,{className:`text-xs`,children:n}):null,t[0]=n,t[1]=l);let u;if(t[2]!==i||t[3]!==r||t[4]!==a){let e;t[6]!==i||t[7]!==a?(e=e=>(0,X.jsx)(U,{selected:i===e.id,asChild:!0,children:(0,X.jsx)(`button`,{className:`justify-start`,onClick:()=>a(e),children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,(0,X.jsx)(`span`,{children:e.label})]})})},e.id),t[6]=i,t[7]=a,t[8]=e):e=t[8],u=r.map(e),t[2]=i,t[3]=r,t[4]=a,t[5]=u}else u=t[5];let d;t[9]===u?d=t[10]:(d=(0,X.jsx)(`div`,{className:`space-y-1`,children:u}),t[9]=u,t[10]=d);let f;t[11]===c?f=t[12]:(f=c?(0,X.jsx)(V,{className:`my-2`}):null,t[11]=c,t[12]=f);let p;return t[13]!==s||t[14]!==l||t[15]!==d||t[16]!==f?(p=(0,X.jsxs)(`div`,{className:s,children:[l,d,f]}),t[13]=s,t[14]=l,t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function ue(e){let t=[...Z];if(!e)return t;let n=t.findIndex(e=>e.id===`skills`);t.splice(n,0,{id:`project`,label:`Settings`,icon:(0,X.jsx)(k,{className:`h-4 w-4`}),route:`/settings/project/${e}`});let r=t.findIndex(e=>e.id===`project`);t.splice(r+1,0,{id:`project-coding`,label:`Repo`,icon:(0,X.jsx)(v,{className:`h-4 w-4`}),route:`/settings/project/${e}/coding`});let i=t.findIndex(e=>e.id===`system-prompt`),a=i===-1?null:t.splice(i,1)[0],o=t.findIndex(e=>e.id===`slash-commands`),s=o===-1?null:t.splice(o,1)[0],c=t.findIndex(e=>e.id===`subagents`),l=c===-1?null:t.splice(c,1)[0],u=t.findIndex(e=>e.id===`mcp-servers`);return u!==-1&&t.splice(u+1,0,...a?[a]:[],{id:`project-tools`,label:`Tools`,icon:(0,X.jsx)(A,{className:`h-4 w-4`}),route:`/settings/project/${e}/tools`},...s?[s]:[],...l?[l]:[],{id:`project-env-vars`,label:`Variables`,icon:(0,X.jsx)(w,{className:`h-4 w-4`}),route:`/settings/project/${e}/env-vars`},{id:`project-danger-zone`,label:`Danger Zone`,icon:(0,X.jsx)(y,{className:`h-4 w-4`}),route:`/settings/project/${e}/danger-zone`}),t}function de(e){let t=(0,J.c)(48),{className:n,selectedProjectId:r,settingsScope:i,onResetOnboarding:a,onNavItemSelect:c}=e,l=s(),u=o(),d=(0,Y.useRef)(0),f=(0,Y.useRef)(null),p,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>()=>{f.current&&clearTimeout(f.current)},h=[],t[0]=p,t[1]=h):(p=t[0],h=t[1]),(0,Y.useEffect)(p,h);let g=q(),_;t[2]===r?_=t[3]:(_=ue(r),t[2]=r,t[3]=_);let v=_,y;t[4]!==g||t[5]!==v?(y=g?v.filter(ve):v,t[4]=g,t[5]=v,t[6]=y):y=t[6];let b=y,x;t[7]!==u.pathname||t[8]!==b?(x=function(){let e=u.pathname;if(e.endsWith(`/tools`)&&e.startsWith(`/settings/project/`))return`project-tools`;if(e.endsWith(`/model-aliases`)&&e.startsWith(`/settings/project/`))return`project-model-aliases`;if(e.endsWith(`/env-vars`)&&e.startsWith(`/settings/project/`))return`project-env-vars`;if(e.endsWith(`/coding`)&&e.startsWith(`/settings/project/`))return`project-coding`;if(e.endsWith(`/danger-zone`)&&e.startsWith(`/settings/project/`))return`project-danger-zone`;if(e.startsWith(`/settings/project/`))return`project`;for(let t of b)if(e.startsWith(t.route))return t.id;return`general`}(),t[7]=u.pathname,t[8]=b,t[9]=x):x=t[9];let S=x,C,w,T,E,D,O,k,A,j;if(t[10]!==S||t[11]!==n||t[12]!==b||t[13]!==l||t[14]!==c||t[15]!==a||t[16]!==r||t[17]!==i){w=function(e){e.id===`general`&&a&&(f.current&&clearTimeout(f.current),d.current+=1,d.current>=3?(d.current=0,a()):f.current=setTimeout(()=>{d.current=0},1500)),c?.(),l(e.route)};let e=!!r;O=!e||i!==`project`,k=e&&i!==`general`;let o=b.filter(_e);D=o.filter(ge),E=o.filter(he),T=o.filter(me);let s;t[27]===b?s=t[28]:(s=b.filter(pe),t[27]=b,t[28]=s),C=s;let u=e?[]:o.filter(fe);t[29]===n?A=t[30]:(A=m(`space-y-1`,n),t[29]=n,t[30]=A),j=u.length>0?(0,X.jsxs)(X.Fragment,{children:[u.map(e=>(0,X.jsx)(U,{selected:S===e.id,asChild:!0,children:(0,X.jsx)(`button`,{className:`justify-start`,onClick:()=>w(e),children:(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,(0,X.jsx)(`span`,{children:e.label})]})})},e.id)),(0,X.jsx)(V,{className:`my-2`})]}):null,t[10]=S,t[11]=n,t[12]=b,t[13]=l,t[14]=c,t[15]=a,t[16]=r,t[17]=i,t[18]=C,t[19]=w,t[20]=T,t[21]=E,t[22]=D,t[23]=O,t[24]=k,t[25]=A,t[26]=j}else C=t[18],w=t[19],T=t[20],E=t[21],D=t[22],O=t[23],k=t[24],A=t[25],j=t[26];let M;t[31]!==S||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==D||t[36]!==k?(M=k?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:`Project`,items:D,activeTabId:S,onItemClick:w,showSeparator:!1}),(0,X.jsx)($,{label:`Coding`,items:E,activeTabId:S,onItemClick:w,showSeparator:!1,className:`pt-3`}),(0,X.jsx)($,{label:`Advanced`,items:T,activeTabId:S,onItemClick:w,showSeparator:!1,className:`pt-3`})]}):null,t[31]=S,t[32]=w,t[33]=T,t[34]=E,t[35]=D,t[36]=k,t[37]=M):M=t[37];let N;t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==O?(N=O?(0,X.jsx)($,{items:C,activeTabId:S,onItemClick:w,showSeparator:!1}):null,t[38]=S,t[39]=C,t[40]=w,t[41]=O,t[42]=N):N=t[42];let P;return t[43]!==A||t[44]!==j||t[45]!==M||t[46]!==N?(P=(0,X.jsxs)(`div`,{className:A,children:[j,M,N]}),t[43]=A,t[44]=j,t[45]=M,t[46]=N,t[47]=P):P=t[47],P}function fe(e){return e.id!==`project`}function pe(e){return ce.has(e.id)}function me(e){return se.has(e.id)}function he(e){return oe.has(e.id)}function ge(e){return ae.has(e.id)}function _e(e){return Q.has(e.id)}function ve(e){return e.id!==`account`}var ye=l(`app.settings-view.ui`),be=[{value:`project`,label:`Project`},{value:`general`,label:`General`}],xe=`frosted-surface backdrop-blur-2xl`,Se=(0,Y.lazy)(()=>r(()=>import(`./settings-general-view-CKvkG8C5.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36]))),Ce=(0,Y.lazy)(()=>r(()=>import(`./project-settings-view-Dd3QPujg.js`),__vite__mapDeps([37,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,38,36]))),we=(0,Y.lazy)(()=>r(()=>import(`./project-coding-view-DG1D8-z4.js`),__vite__mapDeps([39,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,35,36]))),Te=(0,Y.lazy)(()=>r(()=>import(`./project-env-vars-view-TblkryyN.js`),__vite__mapDeps([41,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Ee=(0,Y.lazy)(()=>r(()=>import(`./project-danger-zone-view-6HEDGyUj.js`),__vite__mapDeps([42,2,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),De=(0,Y.lazy)(()=>r(()=>import(`./project-model-aliases-view-Ct0v4NQm.js`),__vite__mapDeps([43,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Oe=(0,Y.lazy)(()=>r(()=>import(`./project-tools-view-DdsKSUDp.js`),__vite__mapDeps([44,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),ke=(0,Y.lazy)(()=>r(()=>import(`./providers-list-view-BUNk2E8O.js`),__vite__mapDeps([45,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,46,47,48,49,50,51,52]))),Ae=(0,Y.lazy)(()=>r(()=>import(`./settings-models-view-Ef404r4H.js`),__vite__mapDeps([53,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,40,35,46,47,48,49,50,54,51]))),je=(0,Y.lazy)(()=>r(()=>import(`./settings-mcp-servers-view-CaAy6iV4.js`),__vite__mapDeps([55,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,50,49,36]))),Me=(0,Y.lazy)(()=>r(()=>import(`./settings-slack-view-C32in2Wg.js`),__vite__mapDeps([57,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))),Ne=(0,Y.lazy)(()=>r(()=>import(`./settings-logs-view-4Uoa1-Dx.js`),__vite__mapDeps([58,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35]))),Pe=(0,Y.lazy)(()=>r(()=>import(`./settings-skills-view-DLrG4E_U.js`),__vite__mapDeps([59,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,50,49,51,61,36]))),Fe=(0,Y.lazy)(()=>r(()=>import(`./settings-slash-commands-view-CpBMV_5D.js`),__vite__mapDeps([62,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,63,50,49,36]))),Ie=(0,Y.lazy)(()=>r(()=>import(`./settings-subagents-view-StdmEn-E.js`),__vite__mapDeps([64,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,60,50,49,61,36]))),Le=(0,Y.lazy)(()=>r(()=>import(`./settings-system-prompt-view-DizAjXjo.js`),__vite__mapDeps([65,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,36]))),Re=(0,Y.lazy)(()=>r(()=>import(`./account-view-DvyhZGLB.js`),__vite__mapDeps([66,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56]))),ze=(0,Y.lazy)(()=>r(()=>import(`./conversation-history-view-CzRrC6cJ.js`),__vite__mapDeps([67,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,54]))),Be=(0,Y.lazy)(()=>r(()=>import(`./settings-storage-view-BzT8k6yE.js`),__vite__mapDeps([68,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,50,49,54]))),Ve=(0,Y.lazy)(()=>r(()=>import(`./settings-statistics-view-CxW2KB56.js`),__vite__mapDeps([69,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,56,54,35]))),He=[`general`,`providers`,`models`,`model-aliases`,`skills`,`slash-commands`,`subagents`,`system-prompt`,`mcp-servers`,`slack`,`logs`,`statistics`,`history`,`storage`,`account`];function Ue(e){let t=(0,J.c)(2),{title:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(te,{title:n,children:`Content coming soon...`}),t[0]=n,t[1]=r),r}function We(e){return e.startsWith(`/settings/general`)?`general`:e.startsWith(`/settings/providers`)?`providers`:e.startsWith(`/settings/models`)?`models`:e.startsWith(`/settings/model-aliases`)?`model-aliases`:e.startsWith(`/settings/skills`)?`skills`:e.startsWith(`/settings/slash-commands`)?`slash-commands`:e.startsWith(`/settings/subagents`)?`subagents`:e.startsWith(`/settings/system-prompt`)?`system-prompt`:e.startsWith(`/settings/mcp-servers`)?`mcp-servers`:e.startsWith(`/settings/slack`)?`slack`:e.startsWith(`/settings/logs`)?`logs`:e.startsWith(`/settings/statistics`)?`statistics`:e.startsWith(`/settings/history`)?`history`:e.startsWith(`/settings/storage`)?`storage`:e.startsWith(`/settings/account`)?`account`:`general`}function Ge(e){let t=e.match(/^\/settings\/providers\/([^/]+)$/);return t?decodeURIComponent(t[1]):null}function Ke(e,t,n){return e&&He.includes(e)?e:t&&He.includes(t)?t:We(n)}function qe(e,t,n,r,i,a,o){return e?`project-tools`:t?`project-model-aliases`:n?`project-env-vars`:r?`project-coding`:i?`project-danger-zone`:a?`project`:o}function Je(e,t,n,r,i,a,o){return e?`Tools`:t?`Model Aliases`:n?`Variables`:r?`Repo`:i?`Danger Zone`:a?`Project`:Z.find(e=>e.id===o)?.label??`Settings`}function Ye(e,t){return e===`/settings`||e===`/settings/project`||[`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`,`/settings/rules`].some(t=>e.startsWith(t))||t&&e.startsWith(`/settings/account`)}function Xe(e,t){let n=!!e&&t.startsWith(`/settings/project/`),r=n&&t.endsWith(`/tools`),i=n&&t.endsWith(`/model-aliases`),a=n&&t.endsWith(`/env-vars`),o=n&&t.endsWith(`/coding`),s=n&&t.endsWith(`/danger-zone`);return{isProjectRoute:n,isProjectToolsRoute:r,isProjectModelAliasesRoute:i,isProjectEnvVarsRoute:a,isProjectCodingRoute:o,isProjectDangerZoneRoute:s,isProjectSettingsRoute:n&&!a&&!i&&!o&&!s&&!r}}function Ze(e,t){let n=(0,J.c)(5),r;n[0]!==t||n[1]!==e?(r=()=>{let n=e.current;if(!n)return;let r=function(e){if(e.key!==`Escape`)return;let n=document.activeElement;if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLElement&&n.isContentEditable){n.blur();return}t()};return n.addEventListener(`keydown`,r),()=>n.removeEventListener(`keydown`,r)},n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]===t?i=n[4]:(i=[t],n[3]=t,n[4]=i),(0,Y.useEffect)(r,i)}function Qe(e){let t=(0,J.c)(5),{selectedProjectId:n,settingsScope:r,onResetOnboarding:i,onNavItemSelect:a}=e,o=n?r:void 0,s;return t[0]!==a||t[1]!==i||t[2]!==n||t[3]!==o?(s=(0,X.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden p-2.5`,children:(0,X.jsx)(z,{className:`min-h-0 flex-1`,children:(0,X.jsx)(`div`,{className:`py-2`,children:(0,X.jsx)(de,{selectedProjectId:n,settingsScope:o,onResetOnboarding:i,onNavItemSelect:a})})})}),t[0]=a,t[1]=i,t[2]=n,t[3]=o,t[4]=s):s=t[4],s}function $e(e){let t=(0,J.c)(21),{settingsHeaderTitle:n,isProjectSettingsScope:r,selectedProject:i,selectedProjectId:a,settingsScope:o,onScopeChange:s,onRequestClose:l}=e,u;t[0]!==r||t[1]!==i?(u=r&&i?(0,X.jsx)(ne,{project:i,className:`h-7 w-7 shrink-0 rounded-md`,iconClassName:`h-3.5 w-3.5`}):(0,X.jsx)(`div`,{className:`flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border shadow-sm`,children:(0,X.jsx)(`img`,{src:`/tarsk.svg`,alt:`Tarsk`,className:`h-full w-full`})}),t[0]=r,t[1]=i,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=m(c.sectionTitle,`truncate`),t[3]=d):d=t[3];let f;t[4]===n?f=t[5]:(f=(0,X.jsx)(`span`,{className:d,children:n}),t[4]=n,t[5]=f);let p;t[6]!==u||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 electrobun-webkit-app-region-no-drag`,children:[u,f]}),t[6]=u,t[7]=f,t[8]=p):p=t[8];let g;t[9]!==s||t[10]!==a||t[11]!==o?(g=a?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 top-4 flex justify-center`,children:(0,X.jsx)(W,{className:`pointer-events-auto electrobun-webkit-app-region-no-drag`,value:o,onValueChange:s,options:be})}):null,t[9]=s,t[10]=a,t[11]=o,t[12]=g):g=t[12];let _,v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(P,{className:`h-4 w-4`}),v=(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[13]=_,t[14]=v):(_=t[13],v=t[14]);let y;t[15]===l?y=t[16]:(y=(0,X.jsx)(`div`,{className:`ml-auto flex items-center gap-2 electrobun-webkit-app-region-no-drag`,children:(0,X.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:l,children:[_,v]})}),t[15]=l,t[16]=y);let b;return t[17]!==p||t[18]!==g||t[19]!==y?(b=(0,X.jsxs)(`div`,{className:`relative flex h-14 shrink-0 items-start px-4 pt-4 pb-2 electrobun-webkit-app-region-drag`,children:[p,g,y]}),t[17]=p,t[18]=g,t[19]=y,t[20]=b):b=t[20],b}function et(e){let t=(0,J.c)(10),{isMobile:n,mobileShowSidebar:r,isProviderDetailRoute:i,activeSectionLabel:a,onShowSidebar:o}=e;if(!n||r||i)return null;let s,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(j,{className:`h-4 w-4`}),l=(0,X.jsx)(`span`,{className:`sr-only`,children:`Show settings menu`}),t[0]=s,t[1]=l):(s=t[0],l=t[1]);let u;t[2]===o?u=t[3]:(u=(0,X.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:o,children:[s,l]}),t[2]=o,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=m(c.sectionTitle,`truncate text-foreground`),t[4]=d):d=t[4];let f;t[5]===a?f=t[6]:(f=(0,X.jsx)(`span`,{className:d,children:a}),t[5]=a,t[6]=f);let p;return t[7]!==u||t[8]!==f?(p=(0,X.jsx)(`div`,{className:`px-6 pb-0 pt-6`,children:(0,X.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[u,f]})}),t[7]=u,t[8]=f,t[9]=p):p=t[9],p}function tt(e){let t=(0,J.c)(22),{isProjectToolsRoute:n,isProjectModelAliasesRoute:r,isProjectEnvVarsRoute:i,isProjectCodingRoute:a,isProjectDangerZoneRoute:o,isProjectSettingsRoute:s,projectId:c,activeTab:l,locationKey:u,onboardingResetSignal:d,handleProjectUpdated:f}=e;if(a&&c){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[0]=e):e=t[0];let n;return t[1]===c?n=t[2]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(we,{projectId:c})}),t[1]=c,t[2]=n),n}if(o&&c){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[3]=e):e=t[3];let n;return t[4]===c?n=t[5]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Ee,{projectId:c})}),t[4]=c,t[5]=n),n}if(n&&c){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[6]=e):e=t[6];let n;return t[7]!==f||t[8]!==c?(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Oe,{projectId:c,onProjectUpdated:f})}),t[7]=f,t[8]=c,t[9]=n):n=t[9],n}if(r&&c){let e;return t[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(De,{})}),t[10]=e):e=t[10],e}if(i&&c){let e;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[11]=e):e=t[11];let n;return t[12]===c?n=t[13]:(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Te,{projectId:c})}),t[12]=c,t[13]=n),n}if(s&&c){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(B,{}),t[14]=e):e=t[14];let n;return t[15]!==f||t[16]!==c?(n=(0,X.jsx)(Y.Suspense,{fallback:e,children:(0,X.jsx)(Ce,{projectId:c,onProjectUpdated:f})}),t[15]=f,t[16]=c,t[17]=n):n=t[17],n}let p;return t[18]!==l||t[19]!==u||t[20]!==d?(p=nt(l,u,d),t[18]=l,t[19]=u,t[20]=d,t[21]=p):p=t[21],p}function nt(e,t,n){return{general:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Se,{onboardingResetSignal:n})}),providers:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{label:`Loading providers...`,size:`lg`}),children:(0,X.jsx)(ke,{})}),models:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{label:`Loading models...`,size:`lg`}),children:(0,X.jsx)(Ae,{})}),"model-aliases":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(De,{})}),skills:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Pe,{},t)}),"slash-commands":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Fe,{})}),subagents:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ie,{})}),"system-prompt":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Le,{})}),"mcp-servers":(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(je,{})}),slack:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Me,{})}),logs:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ne,{})}),statistics:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Ve,{})}),history:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(ze,{})}),storage:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Be,{})}),account:(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(B,{}),children:(0,X.jsx)(Re,{})})}[e]??(0,X.jsx)(Ue,{title:`Settings`})}function rt({onRequestClose:e}){let{tab:t,projectId:n}=a(),r=s(),i=o(),c=d(),l=f(e=>e.selectedProjectId),h=f(e=>e.projects),{isProjectRoute:g,isProjectToolsRoute:_,isProjectModelAliasesRoute:v,isProjectEnvVarsRoute:y,isProjectCodingRoute:b,isProjectDangerZoneRoute:x,isProjectSettingsRoute:S}=Xe(n,i.pathname),C=Ge(i.pathname)!==null,w=Ke(new URLSearchParams(i.search).get(`tab`),t,i.pathname),T=q(),[E,D]=(0,Y.useState)(!0),[O,k]=(0,Y.useState)(0),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=qe(_,v,y,b,x,g,w),[N,P]=(0,Y.useState)(()=>le(M));(0,Y.useEffect)(()=>{P(le(M))},[M]);let F=(0,Y.useCallback)(e=>{if(P(e),e===`project`&&l){r(`/settings/project/${l}`);return}e===`general`&&r(`/settings/general`)},[r,l]),z=(0,Y.useMemo)(()=>h.find(e=>e.projectId===l)??null,[h,l]),B=N===`project`&&z!==null,V=B?`${p(z)} Settings`:`General Settings`,H=(0,Y.useMemo)(()=>Je(_,v,y,b,x,S,w),[w,b,x,y,v,S,_]),U=(0,Y.useCallback)(()=>{T&&D(!1)},[T]),W=(0,Y.useCallback)(()=>{D(!0)},[]),G=(0,Y.useCallback)(async()=>{try{await R(),k(e=>e+1)}catch(e){ye.error(`Failed to reset onboarding:`,e)}},[]),K=(0,Y.useCallback)(async()=>{L(n);try{let e=await I();c({type:u.SetProjects,projects:e.projects,cloneRootPath:e.cloneRootPath})}catch(e){throw ye.error(`Failed to refresh projects after settings update:`,e),e}},[c,n]);return(0,Y.useEffect)(()=>{if(v){r(`/settings/model-aliases`,{replace:!0});return}Ye(i.pathname,T)&&r(`/settings/general`,{replace:!0})},[v,i.pathname,r,T]),Ze(j,e),(0,X.jsxs)(`div`,{ref:j,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,className:m(`rounded-2xl border border-border shadow-lg`,xe,`flex h-full w-full flex-col overflow-hidden md:h-[95vh] md:w-[80vw] md:max-w-[1400px]`),children:[(0,X.jsx)($e,{settingsHeaderTitle:V,isProjectSettingsScope:B,selectedProject:z,selectedProjectId:l,settingsScope:N,onScopeChange:F,onRequestClose:e}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,X.jsx)(re,{ref:A,collapsible:!0,isMobile:T,mobileShowSidebar:E,sidebarClassName:m(`overflow-hidden rounded-tr-2xl`,xe),sidebar:(0,X.jsx)(Qe,{selectedProjectId:l,settingsScope:N,onResetOnboarding:G,onNavItemSelect:U}),children:(0,X.jsxs)(`div`,{className:m(`relative flex h-full min-h-0 flex-col overflow-hidden py-2.5 pl-2.5`,T?null:`ml-2.5`),children:[(0,X.jsx)(et,{isMobile:T,mobileShowSidebar:E,isProviderDetailRoute:C,activeSectionLabel:H,onShowSidebar:W}),(0,X.jsx)(tt,{isProjectToolsRoute:_,isProjectModelAliasesRoute:v,isProjectEnvVarsRoute:y,isProjectCodingRoute:b,isProjectDangerZoneRoute:x,isProjectSettingsRoute:S,projectId:n,activeTab:w,locationKey:i.key,onboardingResetSignal:O,handleProjectUpdated:K})]})})})]})}export{rt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{l as i,n as a,s as o}from"./chat-dock-context-BJNNRoZC.js";import{B as s,Dt as c,H as l,N as u,U as d,V as f,W as p,d as m,q as h}from"./dist-CTLFS4dn.js";import{$ as g,n as _,r as v}from"./store-BSzKIu5G.js";import{m as y,r as b,t as x}from"./button-kWtLAMpB.js";import{$ as S,A as C,D as w,Ot as T,Pn as E,bt as D,fn as O,it as k,mn as A,ot as j,q as ee,rt as te,v as M,wn as ne,y as N}from"./dist-c_QADQ5u.js";import{i as re,n as ie,r as ae,t as oe}from"./tooltip-Db8UeYxm.js";import{Dt as P,Jt as F,d as se,yt as ce}from"./api-DX1ny6q-.js";import{n as le,r as ue}from"./scroll-area-lkVMElz5.js";import{t as de}from"./use-toast-xpb5jNtN.js";import{t as fe}from"./suspense-resource-BFrb_XJX.js";import{t as pe}from"./use-suspense-resource-Dakt9lfT.js";import{a as I,c as me,i as he,n as L,o as ge,r as R,s as _e,t as ve}from"./alert-dialog-BxMfaLuO.js";import{$t as ye,A as be,At as z,Cn as xe,Ft as B,Gt as Se,Jn as Ce,Jt as V,Kt as we,L as Te,Mt as H,Pt as Ee,Qt as De,Rn as Oe,Tn as ke,Ut as Ae,Vn as je,Wt as Me,Xt as Ne,Yt as Pe,Zt as Fe,_n as Ie,_r as Le,a as Re,an as ze,bn as Be,cn as U,dn as Ve,dr as W,en as He,fn as Ue,fr as G,gn as We,gr as K,hn as Ge,hr as Ke,in as qe,ir as q,jt as Je,ln as Ye,mn as J,mr as Y,nn as Xe,on as Ze,or as Qe,pn as $e,pr as et,qt as tt,rn as nt,rr as rt,rt as it,sn as at,tn as ot,tr as st,un as ct,ur as lt,vn as ut,vr as dt,wn as ft,yn as pt,zn as mt,zt as ht}from"./index-u8UbWjXL.js";import{t as gt}from"./async-error-boundary-BX1G17o9.js";var X=e(n(),1),Z=t(),Q=r();function _t(e){let t=(0,Z.c)(10),{tag:n,className:r}=e,i;t[0]===r?i=t[1]:(i=b(c.compact,`inline-flex items-center gap-1 rounded-full border border-border/50 bg-background px-2 py-0.5`,r),t[0]=r,t[1]=i);let a;t[2]===n.color?a=t[3]:(a=(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:n.color}}),t[2]=n.color,t[3]=a);let o;t[4]===n.name?o=t[5]:(o=(0,Q.jsx)(`span`,{className:`truncate`,children:n.name}),t[4]=n.name,t[5]=o);let s;return t[6]!==i||t[7]!==a||t[8]!==o?(s=(0,Q.jsxs)(`span`,{className:i,children:[a,o]}),t[6]=i,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}var vt={Plan:`#EAB308`,Build:`#3B82F6`,Test:`#8B5CF6`,Review:`#F97316`,Done:`#22C55E`};function yt(e){let t=(0,Z.c)(10),{status:n,className:r}=e,i;t[0]===r?i=t[1]:(i=b(c.compact,`inline-flex items-center gap-1 rounded-full border border-border/50 bg-background px-2 py-0.5`,r),t[0]=r,t[1]=i);let a=vt[n],o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:a}}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,Q.jsx)(`span`,{className:`truncate`,children:n}),t[4]=n,t[5]=s);let l;return t[6]!==i||t[7]!==o||t[8]!==s?(l=(0,Q.jsxs)(`span`,{className:i,children:[o,s]}),t[6]=i,t[7]=o,t[8]=s,t[9]=l):l=t[9],l}var bt=u(`app.run-history-dialog`),xt={schedule:{label:`Schedule`,icon:ne},event:{label:`Event`,icon:M},manual:{label:`Manual`,icon:k}};function St(e){return new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`})}function Ct(e){let t=(0,Z.c)(6),{trigger:n}=e,r=xt[n],i=r.icon,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=b(c.compact,`inline-flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-0.5 text-muted-foreground`),t[0]=a):a=t[0];let o;t[1]===i?o=t[2]:(o=(0,Q.jsx)(i,{className:`h-3 w-3`}),t[1]=i,t[2]=o);let s;return t[3]!==r.label||t[4]!==o?(s=(0,Q.jsxs)(`span`,{className:a,children:[o,r.label]}),t[3]=r.label,t[4]=o,t[5]=s):s=t[5],s}function wt(e){let t=(0,Z.c)(23),{run:n,canOpen:r,onOpenRun:i}=e,a=r?`hover:bg-accent/40`:`cursor-default`,o;t[0]===a?o=t[1]:(o=b(`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left transition-colors`,a),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==n?(s=()=>i(n),t[2]=i,t[3]=n,t[4]=s):s=t[4];let l=!r,u,d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(D,{className:`h-4 w-4 shrink-0 text-muted-foreground`}),d=b(c.body,`min-w-0 flex-1 truncate`),t[5]=u,t[6]=d):(u=t[5],d=t[6]);let f=n.threadTitle??`Conversation deleted`,p;t[7]===f?p=t[8]:(p=(0,Q.jsx)(`span`,{className:d,children:f}),t[7]=f,t[8]=p);let m;t[9]===n.trigger?m=t[10]:(m=(0,Q.jsx)(Ct,{trigger:n.trigger}),t[9]=n.trigger,t[10]=m);let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=b(c.caption,`shrink-0 tabular-nums text-muted-foreground`),t[11]=h):h=t[11];let g;t[12]===n.createdAt?g=t[13]:(g=St(n.createdAt),t[12]=n.createdAt,t[13]=g);let _;t[14]===g?_=t[15]:(_=(0,Q.jsx)(`span`,{className:h,children:g}),t[14]=g,t[15]=_);let v;return t[16]!==_||t[17]!==o||t[18]!==s||t[19]!==l||t[20]!==p||t[21]!==m?(v=(0,Q.jsxs)(`button`,{type:`button`,className:o,onClick:s,disabled:l,children:[u,p,m,_]}),t[16]=_,t[17]=o,t[18]=s,t[19]=l,t[20]=p,t[21]=m,t[22]=v):v=t[22],v}function Tt(e){let t=(0,Z.c)(19),{open:n,onOpenChange:r,projectId:i,taskId:a,onOpenRun:o}=e,[s,l]=(0,X.useState)(null),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(null),m,h;t[0]!==n||t[1]!==i||t[2]!==a?(m=()=>{if(!n)return;let e=!1;return d(!0),p(null),Ge(i,a).then(t=>{e||l(t)}).catch(t=>{bt.error(`Failed to load task run history:`,t),e||p(t instanceof Error?t.message:String(t))}).finally(()=>{e||d(!1)}),()=>{e=!0}},h=[n,i,a],t[0]=n,t[1]=i,t[2]=a,t[3]=m,t[4]=h):(m=t[3],h=t[4]),(0,X.useEffect)(m,h);let g=!!o,_;t[5]!==r||t[6]!==o?(_=function(e){o&&(r(!1),o(e.threadId))},t[5]=r,t[6]=o,t[7]=_):_=t[7];let v=_,y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsxs)(Le,{children:[(0,Q.jsx)(dt,{children:`Run History`}),(0,Q.jsx)(Ke,{children:`Conversations created when this task ran, newest first.`})]}),t[8]=y):y=t[8];let x;t[9]!==g||t[10]!==f||t[11]!==v||t[12]!==u||t[13]!==s?(x=(0,Q.jsxs)(Y,{className:`flex max-h-[min(36rem,85vh)] flex-col sm:max-w-lg`,children:[y,u?(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}),(0,Q.jsx)(`span`,{className:c.bodyMuted,children:`Loading runs…`})]}):f?(0,Q.jsxs)(`p`,{className:b(c.bodyMuted,`py-8 text-center text-destructive`),children:[`Failed to load run history: `,f]}):s&&s.length>0?(0,Q.jsx)(ue,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`space-y-1 py-2`,children:s.map(e=>(0,Q.jsx)(wt,{run:e,canOpen:g&&!!e.threadTitle,onOpenRun:v},e.id))})}):(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`py-8 text-center`),children:`No runs yet. Runs appear here after the task is triggered by its schedule, an event, or Run Now.`})]}),t[9]=g,t[10]=f,t[11]=v,t[12]=u,t[13]=s,t[14]=x):x=t[14];let S;return t[15]!==r||t[16]!==n||t[17]!==x?(S=(0,Q.jsx)(et,{open:n,onOpenChange:r,children:x}),t[15]=r,t[16]=n,t[17]=x,t[18]=S):S=t[18],S}function Et(e){let t=(0,Z.c)(6);if(!e.show)return null;let n;return t[0]!==e.onOpenChange||t[1]!==e.onOpenRun||t[2]!==e.open||t[3]!==e.task.id||t[4]!==e.task.projectId?(n=(0,Q.jsx)(Tt,{open:e.open,onOpenChange:e.onOpenChange,projectId:e.task.projectId,taskId:e.task.id,onOpenRun:e.onOpenRun}),t[0]=e.onOpenChange,t[1]=e.onOpenRun,t[2]=e.open,t[3]=e.task.id,t[4]=e.task.projectId,t[5]=n):n=t[5],n}function Dt(e){let t=(0,Z.c)(3),{show:n,onSelect:r}=e;if(!n)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Qe,{}),t[0]=i):i=t[0];let a;return t[1]===r?a=t[2]:(a=(0,Q.jsxs)(Q.Fragment,{children:[i,(0,Q.jsx)(q,{onClick:r,children:`Run History`})]}),t[1]=r,t[2]=a),a}function Ot({task:e,disabled:t=!1,showRunHistory:n=!1,onStartInNewWorkspace:r,onMarkDone:i,onRunNow:a,onOpenRun:o}){let[s,c]=(0,X.useState)(!1),[l,u]=(0,X.useState)(!1),d=ze(e)&&!e.triggerType,f=e.status!==`Done`&&!e.triggerType,p=Ze(e),m=t||s;async function h(e){c(!0);try{await e()}finally{c(!1)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(s||e.working)&&(0,Q.jsx)(je,{size:`sm`}),(0,Q.jsxs)(st,{children:[(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsxs)(x,{variant:`ghost`,size:`icon`,className:b(`h-8 w-8 shrink-0`,e.working&&`text-primary`),disabled:m,children:[(0,Q.jsx)(A,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Task actions`})]})}),(0,Q.jsxs)(rt,{align:`end`,children:[p&&(0,Q.jsx)(q,{onClick:()=>void h(()=>a(e)),children:`Run Now`}),d&&(0,Q.jsx)(q,{onClick:()=>void h(()=>r(e)),children:`Start in a new workspace`}),f&&(0,Q.jsx)(q,{onClick:()=>void h(()=>i(e)),children:`Mark as Done`}),(0,Q.jsx)(Dt,{show:n,onSelect:()=>u(!0)})]})]})]}),(0,Q.jsx)(Et,{show:n,open:l,onOpenChange:u,task:e,onOpenRun:o})]})}function kt(e){return!!(e.tags&&e.tags.length>0)}function At(e){return e.status!==`Ready`||e.modified||kt(e)||U(e)}function jt(e){let t=(0,Z.c)(14),{task:n,className:r}=e,i;t[0]===n.status?i=t[1]:(i=n.status!==`Ready`&&(0,Q.jsx)(yt,{status:n.status}),t[0]=n.status,t[1]=i);let a;t[2]===n.modified?a=t[3]:(a=n.modified&&(0,Q.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-brand/15 px-2 py-0.5 text-[11px] font-medium leading-none text-brand`,children:`modified`}),t[2]=n.modified,t[3]=a);let o;t[4]===n?o=t[5]:(o=U(n)&&(0,Q.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-red-500/15 px-2 py-0.5 text-[11px] font-medium leading-none text-red-600 dark:text-red-400`,children:`paused`}),t[4]=n,t[5]=o);let s;t[6]===n.tags?s=t[7]:(s=n.tags?.map(function(e){return(0,Q.jsx)(_t,{tag:e},e.id)}),t[6]=n.tags,t[7]=s);let c;return t[8]!==r||t[9]!==i||t[10]!==a||t[11]!==o||t[12]!==s?(c=(0,Q.jsxs)(`div`,{className:r,children:[i,a,o,s]}),t[8]=r,t[9]=i,t[10]=a,t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function Mt(e){let t=(0,Z.c)(10),{task:n,onThreadSelect:r}=e;if(!n.threadId||!r)return null;let i=n.threadId,a;t[0]!==r||t[1]!==i?(a=()=>r(i),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(O,{className:`h-4 w-4`}),s=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Open chat`}),t[3]=o,t[4]=s):(o=t[3],s=t[4]);let c;t[5]===a?c=t[6]:(c=(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:a,children:[o,s]})}),t[5]=a,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(ie,{children:`Open chat`}),t[7]=l):l=t[7];let u;return t[8]===c?u=t[9]:(u=(0,Q.jsxs)(oe,{children:[c,l]}),t[8]=c,t[9]=u),u}function Nt(e){let t=(0,Z.c)(51),{task:n,now:r,onOpenEdit:i,showRunHistory:a,onThreadSelect:o,onStartInNewWorkspace:s,onMarkDone:l,onRunNow:u,onOpenRun:d}=e,f;t[0]!==r||t[1]!==n?(f=at(n,r),t[0]=r,t[1]=n,t[2]=f):f=t[2];let p=f,m;t[3]!==i||t[4]!==n?(m=()=>i(n),t[3]=i,t[4]=n,t[5]=m):m=t[5];let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=b(c.label,`truncate leading-normal`),t[6]=h):h=t[6];let g;t[7]===n.title?g=t[8]:(g=(0,Q.jsx)(`p`,{className:h,children:n.title}),t[7]=n.title,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=b(c.caption,`mt-1 line-clamp-2 break-all text-muted-foreground max-sm:hidden`),t[9]=_):_=t[9];let v;t[10]===n.description?v=t[11]:(v=(0,Q.jsx)(`p`,{className:_,children:n.description}),t[10]=n.description,t[11]=v);let y;t[12]===p?y=t[13]:(y=p&&(0,Q.jsx)(`p`,{className:b(c.caption,`mt-1 text-muted-foreground`),children:p}),t[12]=p,t[13]=y);let x;t[14]===n?x=t[15]:(x=At(n)&&(0,Q.jsx)(jt,{task:n,className:`mt-2 flex flex-wrap gap-1`}),t[14]=n,t[15]=x);let S;t[16]!==m||t[17]!==g||t[18]!==v||t[19]!==y||t[20]!==x?(S=(0,Q.jsxs)(`button`,{type:`button`,className:`col-start-1 row-start-1 block min-w-0 overflow-hidden text-left sm:flex-1`,onClick:m,children:[g,v,y,x]}),t[16]=m,t[17]=g,t[18]=v,t[19]=y,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==i||t[23]!==n?(C=()=>i(n),t[22]=i,t[23]=n,t[24]=C):C=t[24];let w;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(w=b(c.caption,`line-clamp-4 break-all text-muted-foreground`),t[25]=w):w=t[25];let T;t[26]===n.description?T=t[27]:(T=(0,Q.jsx)(`p`,{className:w,children:n.description}),t[26]=n.description,t[27]=T);let E;t[28]!==C||t[29]!==T?(E=(0,Q.jsx)(`button`,{type:`button`,className:`col-span-2 row-start-2 block min-w-0 overflow-hidden text-left sm:hidden`,onClick:C,children:T}),t[28]=C,t[29]=T,t[30]=E):E=t[30];let D;t[31]===n?D=t[32]:(D=At(n)&&(0,Q.jsx)(jt,{task:n,className:`col-span-2 row-start-3 flex min-w-0 flex-wrap gap-1 sm:hidden`}),t[31]=n,t[32]=D);let O;t[33]!==o||t[34]!==n?(O=(0,Q.jsx)(Mt,{task:n,onThreadSelect:o}),t[33]=o,t[34]=n,t[35]=O):O=t[35];let k;t[36]!==l||t[37]!==d||t[38]!==u||t[39]!==s||t[40]!==a||t[41]!==n?(k=(0,Q.jsx)(Ot,{task:n,showRunHistory:a,onStartInNewWorkspace:s,onMarkDone:l,onRunNow:u,onOpenRun:d}),t[36]=l,t[37]=d,t[38]=u,t[39]=s,t[40]=a,t[41]=n,t[42]=k):k=t[42];let A;t[43]!==O||t[44]!==k?(A=(0,Q.jsxs)(`div`,{className:`col-start-2 row-start-1 flex shrink-0 items-center gap-1.5 self-start`,children:[O,k]}),t[43]=O,t[44]=k,t[45]=A):A=t[45];let j;return t[46]!==E||t[47]!==D||t[48]!==A||t[49]!==S?(j=(0,Q.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] grid-rows-[auto_auto] gap-x-2 gap-y-1 px-4 py-3 hover:bg-accent/40 sm:flex sm:items-start sm:gap-4`,children:[S,E,D,A]}),t[46]=E,t[47]=D,t[48]=A,t[49]=S,t[50]=j):j=t[50],j}function Pt(e){let t=(0,Z.c)(28),{onSearchTermChange:n}=e,[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s;t[0]===n?s=t[1]:(s=function(e){o(e),n(e)},t[0]=n,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=function(){o(``),n(``),i(!1)},t[2]=n,t[3]=l);let u=l,d;t[4]!==u||t[5]!==r?(d=()=>{r?u():i(!0)},t[4]=u,t[5]=r,t[6]=d):d=t[6];let f,p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(ee,{className:`h-4 w-4`}),p=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Search tasks`}),t[7]=f,t[8]=p):(f=t[7],p=t[8]);let m;t[9]!==r||t[10]!==d?(m=(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:d,"aria-expanded":r,children:[f,p]})}),t[9]=r,t[10]=d,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ie,{children:`Search tasks`}),t[12]=h):h=t[12];let g;t[13]===m?g=t[14]:(g=(0,Q.jsxs)(oe,{children:[m,h]}),t[13]=m,t[14]=g);let _=r?`ml-1 w-44 opacity-100`:`w-0 opacity-0`,v;t[15]===_?v=t[16]:(v=b(`overflow-hidden transition-[width,opacity] duration-200`,_),t[15]=_,t[16]=v);let y;t[17]!==u||t[18]!==c||t[19]!==r||t[20]!==a?(y=r&&(0,Q.jsx)(G,{type:`search`,value:a,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Escape`&&u()},placeholder:`Search`,"aria-label":`Search tasks`,autoFocus:!0,className:`h-8 min-w-44 px-2`}),t[17]=u,t[18]=c,t[19]=r,t[20]=a,t[21]=y):y=t[21];let S;t[22]!==v||t[23]!==y?(S=(0,Q.jsx)(`div`,{className:v,children:y}),t[22]=v,t[23]=y,t[24]=S):S=t[24];let C;return t[25]!==S||t[26]!==g?(C=(0,Q.jsxs)(`div`,{className:`flex items-center`,children:[g,S]}),t[25]=S,t[26]=g,t[27]=C):C=t[27],C}function Ft(e){let t=(0,Z.c)(16),{projectTags:n,hiddenTagIds:r,onToggleHiddenTag:i,onSearchTermChange:a,isRefreshing:o,onRefresh:s,onManageTags:c}=e,{setActions:l}=be(),u;if(t[0]!==r||t[1]!==n){let e;t[3]===r?e=t[4]:(e=function(e){return r.has(e.id)},t[3]=r,t[4]=e),u=n.some(e),t[0]=r,t[1]=n,t[2]=u}else u=t[2];let d=u,f,p;return t[5]!==d||t[6]!==r||t[7]!==o||t[8]!==c||t[9]!==s||t[10]!==a||t[11]!==i||t[12]!==n||t[13]!==l?(f=()=>(l((0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{onSearchTermChange:a}),(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,onClick:()=>s(),disabled:o,children:[(0,Q.jsx)(S,{className:b(`h-4 w-4`,o&&`animate-spin`)}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Refresh tasks`})]})}),(0,Q.jsx)(ie,{children:`Refresh`})]}),(0,Q.jsxs)(st,{children:[(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`relative`,children:[(0,Q.jsx)(C,{className:`h-4 w-4`}),d&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -right-1 -top-1 h-1.5 w-1.5 rounded-full bg-primary`})]}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Filter and manage tags`})]})})}),(0,Q.jsx)(ie,{children:`Tags`})]}),(0,Q.jsxs)(rt,{align:`end`,className:`max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto`,children:[n.length===0?(0,Q.jsx)(q,{disabled:!0,className:`text-muted-foreground`,children:`No tags yet`}):n.map(function(e){let t=!r.has(e.id);return(0,Q.jsxs)(q,{className:`[&_svg]:size-6`,onSelect:function(t){t.preventDefault(),i(e.id)},children:[(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:b(`flex h-7 w-7 shrink-0 items-center justify-center rounded-full border shadow-sm`,t?`border-transparent bg-foreground text-background`:`border-border bg-muted`),children:t&&(0,Q.jsx)(E,{className:`h-6 w-6`})})]},e.id)}),(0,Q.jsx)(Qe,{}),(0,Q.jsxs)(q,{onClick:c,children:[(0,Q.jsx)(j,{className:`h-4 w-4`}),`Edit Tags`]})]})]})]})),()=>l(null)),p=[l,n,r,d,i,o,s,c,a],t[5]=d,t[6]=r,t[7]=o,t[8]=c,t[9]=s,t[10]=a,t[11]=i,t[12]=n,t[13]=l,t[14]=f,t[15]=p):(f=t[14],p=t[15]),(0,X.useEffect)(f,p),null}function It({selectedTags:e,existingTags:t,onChange:n,placeholder:r=`Add tags...`,allowCreate:i=!0,className:a}){let[o,u]=(0,X.useState)(``),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(0),v=(0,X.useRef)(null),y=(0,X.useMemo)(()=>new Set(e.map(e=>l(e.name))),[e]),S=e.length>=10,C=(0,X.useMemo)(()=>{let e=o.trim(),n=e.toLowerCase(),r=new Map;for(let e of t){let t=l(e.name);y.has(t)||r.set(t,{name:e.name,color:e.color})}for(let e of s){let t=l(e);!y.has(t)&&!r.has(t)&&r.set(t,{name:e,color:f(t)})}let a=(n?[...r.values()].filter(e=>e.name.toLowerCase().includes(n)):[...r.values()]).map(e=>({name:e.name,color:e.color,isCreate:!1}));if(e&&i&&!S){let t=d(e),n=l(t),i=y.has(n)||r.has(n),o=!p(t);!i&&o&&a.push({name:t,color:f(n),isCreate:!0})}return a},[o,t,y,S]);(0,X.useEffect)(()=>{_(0)},[o]),(0,X.useEffect)(function(){if(!m||S)return;let e=requestAnimationFrame(function(){v.current?.focus()});return function(){cancelAnimationFrame(e)}},[m,S]);function w(r){if(S)return;let i=d(r),a=l(i);if(y.has(a))return;let o=t.find(e=>l(e.name)===a)??{id:`new:${a}`,name:i,color:f(a)};n([...e,o]),u(``)}function T(t){n(e.filter(e=>e.id!==t.id))}function E(e){let t=e.currentTarget;t.scrollHeight>t.clientHeight&&e.stopPropagation()}function D(t){if(t.key===`ArrowDown`)t.preventDefault(),m||h(!0),_(e=>(e+1)%Math.max(C.length,1));else if(t.key===`ArrowUp`)t.preventDefault(),_(e=>(e-1+C.length)%Math.max(C.length,1));else if(t.key===`Enter`){t.preventDefault();let e=C[g];e&&w(e.name)}else t.key===`Backspace`&&!o&&e.length>0?T(e[e.length-1]):t.key===`Escape`&&(h(!1),v.current?.blur())}return(0,Q.jsxs)(xe,{open:m,onOpenChange:function(e){h(e),e||u(``)},children:[(0,Q.jsxs)(`div`,{className:b(`flex flex-wrap items-center gap-1.5`,a),children:[e.map(function(e){return(0,Q.jsxs)(st,{children:[(0,Q.jsx)(lt,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-full outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,Q.jsx)(_t,{tag:e,className:`cursor-pointer transition-colors hover:border-border hover:bg-muted/40`})})}),(0,Q.jsx)(rt,{align:`start`,sideOffset:6,children:(0,Q.jsx)(q,{onSelect:()=>T(e),children:`Delete`})})]},e.id)}),(0,Q.jsx)(ae,{children:(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(ke,{asChild:!0,children:(0,Q.jsx)(x,{type:`button`,variant:`outline`,size:`icon-xs`,disabled:S,"aria-label":S?`Max 10 tags`:`Add tag`,className:b(`h-6 w-6 rounded-full border-dashed text-muted-foreground`,S&&`opacity-50`),children:(0,Q.jsx)(te,{className:`h-3 w-3`})})})}),(0,Q.jsx)(ie,{children:`Add Tag`})]})})]}),(0,Q.jsxs)(ft,{align:`start`,className:`w-72 p-0`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsx)(`div`,{className:`border-b border-border p-2`,children:(0,Q.jsx)(`input`,{ref:v,type:`text`,value:o,onChange:function(e){u(e.target.value)},onKeyDown:D,placeholder:S?`Max 10 tags`:r,disabled:S,className:b(c.body,`w-full rounded-md border border-input bg-background px-3 py-2 outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`)})}),(0,Q.jsx)(`div`,{className:`overflow-y-auto overscroll-contain`,style:{maxHeight:220},onWheel:E,onTouchMove:E,children:C.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-3 py-4 text-center`),children:S?`Tag limit reached`:`No tags found`}):C.map(function(e,t){return(0,Q.jsxs)(`button`,{type:`button`,className:b(c.body,`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-accent`,g===t&&`bg-accent`),onClick:function(){w(e.name),h(!1)},children:[(0,Q.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),e.isCreate?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Create`}),(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.name})]}):(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.isCreate?`create:${e.name}`:e.name)})})]})]})}var Lt=[{value:`0`,label:`Sunday`},{value:`1`,label:`Monday`},{value:`2`,label:`Tuesday`},{value:`3`,label:`Wednesday`},{value:`4`,label:`Thursday`},{value:`5`,label:`Friday`},{value:`6`,label:`Saturday`}],Rt=Array.from({length:60},function(e,t){return{value:String(t),label:String(t).padStart(2,`0`)}});function $(e,t){return{...e,...t}}function zt(e){let t=(0,Z.c)(7),{value:n,onChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(W,{htmlFor:`schedule-once-at`,children:`Run at`}),t[0]=i):i=t[0];let a;t[1]!==r||t[2]!==n?(a=e=>r($(n,{scheduledAtLocal:e.target.value})),t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]!==a||t[5]!==n.scheduledAtLocal?(o=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[i,(0,Q.jsx)(G,{id:`schedule-once-at`,type:`datetime-local`,value:n.scheduledAtLocal,onChange:a})]}),t[4]=a,t[5]=n.scheduledAtLocal,t[6]=o):o=t[6],o}function Bt(e){let t=e.trim();if(t===``)return NaN;let n=Number(t);return Number.isNaN(n)?NaN:n}function Vt(e){return Math.min(m,Math.max(1,e))}function Ht(e){let t=(0,Z.c)(9),{value:n,onChange:r}=e,i;t[0]!==r||t[1]!==n?(i=n.preset===`weekly`&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(W,{children:`Day`}),(0,Q.jsxs)(z,{value:String(n.dayOfWeek),onValueChange:e=>r($(n,{dayOfWeek:Number(e)})),children:[(0,Q.jsx)(Ee,{children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(Je,{children:Lt.map(function(e){return(0,Q.jsx)(H,{value:e.value,children:e.label},e.value)})})]})]}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]!==r||t[4]!==n?(a=n.preset===`interval`?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(W,{htmlFor:`schedule-interval-minutes`,children:`Minutes`}),(0,Q.jsx)(G,{id:`schedule-interval-minutes`,type:`number`,min:1,max:m,step:1,placeholder:`5`,value:Number.isNaN(n.presetIntervalMinutes)?``:String(n.presetIntervalMinutes),onChange:e=>r($(n,{presetIntervalMinutes:Bt(e.target.value)})),onBlur:()=>{let e=n.presetIntervalMinutes;!Number.isNaN(e)&&e!==Vt(e)&&r($(n,{presetIntervalMinutes:Vt(e)}))}})]}):n.preset===`hourly`?(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(W,{children:`Minute`}),(0,Q.jsxs)(z,{value:String(n.presetMinute),onValueChange:e=>r($(n,{presetMinute:Number(e)})),children:[(0,Q.jsx)(Ee,{children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(Je,{children:Rt.map(function(e){return(0,Q.jsx)(H,{value:e.value,children:e.label},e.value)})})]})]}):(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(W,{htmlFor:`schedule-time`,children:`Time`}),(0,Q.jsx)(G,{id:`schedule-time`,type:`time`,value:n.presetTime,onChange:e=>r($(n,{presetTime:e.target.value}))})]}),t[3]=r,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==i||t[7]!==a?(o=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[i,a]}),t[6]=i,t[7]=a,t[8]=o):o=t[8],o}var Ut=`once`,Wt=`event`;function Gt(e){let t=(0,Z.c)(22),{value:n,onChange:r,error:i,showRemove:a,onRemove:o}=e,s=a===void 0?!1:a,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(W,{children:`Trigger`}),t[0]=c):c=t[0];let l=n.kind===`event`?Wt:n.scheduleMode===`once`?Ut:n.preset,u;t[1]!==r||t[2]!==n?(u=e=>{r(e===Wt?$(n,{kind:`event`}):e===Ut?$(n,{kind:`schedule`,scheduleMode:`once`}):$(n,{kind:`schedule`,scheduleMode:`repeating`,preset:e}))},t[1]=r,t[2]=n,t[3]=u):u=t[3];let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ee,{children:(0,Q.jsx)(B,{})}),t[4]=d):d=t[4];let f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(Je,{children:[(0,Q.jsx)(H,{value:Ut,children:`Once`}),(0,Q.jsx)(H,{value:`interval`,children:`Interval`}),(0,Q.jsx)(H,{value:`hourly`,children:`Hourly`}),(0,Q.jsx)(H,{value:`daily`,children:`Daily`}),(0,Q.jsx)(H,{value:`weekdays`,children:`Weekdays`}),(0,Q.jsx)(H,{value:`weekly`,children:`Weekly`}),(0,Q.jsx)(H,{value:Wt,children:`Event`})]}),t[5]=f):f=t[5];let p;t[6]!==l||t[7]!==u?(p=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[c,(0,Q.jsxs)(z,{value:l,onValueChange:u,children:[d,f]})]}),t[6]=l,t[7]=u,t[8]=p):p=t[8];let m;t[9]!==i||t[10]!==r||t[11]!==n?(m=n.kind===`event`?(0,Q.jsx)(qt,{value:n,onChange:r,error:i}):n.scheduleMode===`once`?(0,Q.jsx)(zt,{value:n,onChange:r}):(0,Q.jsx)(Ht,{value:n,onChange:r}),t[9]=i,t[10]=r,t[11]=n,t[12]=m):m=t[12];let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`grid flex-1 gap-3 sm:grid-cols-2`,children:[p,m]}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;t[16]!==o||t[17]!==s?(g=s&&(0,Q.jsxs)(x,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:()=>o?.(),children:[(0,Q.jsx)(N,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Remove trigger`})]}),t[16]=o,t[17]=s,t[18]=g):g=t[18];let _;return t[19]!==g||t[20]!==h?(_=(0,Q.jsx)(`div`,{className:`space-y-3`,children:(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[h,g]})}),t[19]=g,t[20]=h,t[21]=_):_=t[21],_}function Kt(e){return!!(e&&De(e))}function qt(e){let t=(0,Z.c)(16),{value:n,onChange:r,error:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(W,{htmlFor:`event-key`,children:`Event Key`}),t[0]=a):a=t[0];let o=n.eventKey,s;t[1]===i?s=t[2]:(s=Kt(i),t[1]=i,t[2]=s);let l;t[3]!==r||t[4]!==n?(l=e=>r($(n,{eventKey:e.target.value})),t[3]=r,t[4]=n,t[5]=l):l=t[5];let u;t[6]!==s||t[7]!==l||t[8]!==n.eventKey?(u=(0,Q.jsx)(G,{id:`event-key`,value:o,placeholder:`door.opened`,"aria-invalid":s,onChange:l}),t[6]=s,t[7]=l,t[8]=n.eventKey,t[9]=u):u=t[9];let d;t[10]!==i||t[11]!==n.eventKey?(d=Kt(i)?(0,Q.jsx)(`p`,{className:b(c.caption,`text-destructive`),children:i}):(0,Q.jsxs)(`p`,{className:b(c.caption,`text-muted-foreground`),children:[`Test in chat with `,(0,Q.jsxs)(`code`,{children:[`/send-event `,n.eventKey.trim()||`event.key`]})]}),t[10]=i,t[11]=n.eventKey,t[12]=d):d=t[12];let f;return t[13]!==u||t[14]!==d?(f=(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[a,u,d]}),t[13]=u,t[14]=d,t[15]=f):f=t[15],f}function Jt(e){let t=(0,Z.c)(3),{error:n,kind:r}=e;if(!n||r===`event`)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=b(c.caption,`text-destructive`),t[0]=i):i=t[0];let a;return t[1]===n?a=t[2]:(a=(0,Q.jsx)(`p`,{className:i,children:n}),t[1]=n,t[2]=a),a}function Yt(e){let t=(0,Z.c)(20),{value:n,onChange:r,onTriggerRemoved:i,showRemoveControl:a,error:o}=e,s=a===void 0?!1:a,l=o===void 0?null:o,u;t[0]!==r||t[1]!==i||t[2]!==n?(u=()=>{r($(n,{kind:`manual`})),i?.()},t[0]=r,t[1]=i,t[2]=n,t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==n?(d=(0,Q.jsx)(Gt,{value:n,onChange:r,error:l,showRemove:s,onRemove:u}),t[4]=l,t[5]=r,t[6]=s,t[7]=u,t[8]=n,t[9]=d):d=t[9];let f;t[10]!==l||t[11]!==n.kind?(f=(0,Q.jsx)(Jt,{error:l,kind:n.kind}),t[10]=l,t[11]=n.kind,t[12]=f):f=t[12];let p;t[13]!==r||t[14]!==n?(p=n.kind!==`manual`&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.kind!==`event`&&(0,Q.jsxs)(`p`,{className:b(c.caption,`text-muted-foreground`),children:[`Timezone: `,n.timezone]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsx)(Re,{id:`trigger-paused`,checked:!n.enabled,onCheckedChange:e=>{r($(n,{enabled:e!==!0}))}}),(0,Q.jsx)(W,{htmlFor:`trigger-paused`,className:c.caption,children:`Paused`})]})]}),t[13]=r,t[14]=n,t[15]=p):p=t[15];let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4 rounded-lg border border-border p-4`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var Xt=u(`app.task-list.add-dialog`);function Zt({open:e,automationsOnly:t,projectId:n,projectTags:r,thread:i,getTriggerValidationError:a,onOpenChange:o,onTaskCreated:s,onTaskUpdated:c}){let[l,u]=(0,X.useState)(``),[d,f]=(0,X.useState)([]),[p,m]=(0,X.useState)(tt),[h,g]=(0,X.useState)(!0),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e&&(u(``),f([]),m(t?V():tt()),g(!t))},[e,t]);let w=(0,X.useCallback)((e,t)=>{u(n=>t?.replace||!n.trim()?e:`${n.trimEnd()} ${e}`)},[]);function E(){return!!(l.trim()||d.length||!h&&JSON.stringify(p)!==JSON.stringify(V()))}function D(e){if(e){o(!0);return}if(E()){b(!0);return}v(null),o(!1)}function O(){b(!1),o(!1)}async function k(e){e.preventDefault(),await A()&&b(!1)}async function A(){if(!l.trim())return!1;let e=a(h,p);if(e)return v(e),!1;v(null),C(!0);try{let e=Me({description:l,tagNames:d.map(e=>e.name),triggerCollapsed:h,triggerForm:p,thread:we({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})}),t=await ct(n,e.description,e.context);return s(t),o(!1),$e(n,t.id,{...e.context,expectedTitle:t.title}).then(c).catch(e=>Xt.error(`Failed to generate task title:`,e)),u(``),f([]),v(null),!0}catch(e){return v(Pe(e,`Failed to add task`)),Xt.error(`Failed to add task:`,e),!1}finally{C(!1)}}return(0,Q.jsxs)(et,{open:e,onOpenChange:D,children:[(0,Q.jsxs)(Y,{className:`max-w-2xl flex flex-col overflow-hidden max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:max-h-[calc(100svh-2rem)]`,children:[(0,Q.jsx)(Le,{className:`shrink-0`,children:(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsx)(dt,{className:`w-fit cursor-help`,children:t?`Add Automation`:`New Task`})}),(0,Q.jsx)(ie,{side:`top`,className:`max-w-xs`,children:`A title will be generated automatically from your description.`})]})}),(0,Q.jsx)(ue,{type:`auto`,className:`min-h-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`py-2 pl-1`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(Ce,{placeholder:`Describe what needs to be done...`,value:l,onChange:e=>u(e.target.value),rows:12,className:`max-h-[min(16rem,40svh)] resize-none pe-12 pb-10 text-base sm:max-h-none`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,Q.jsx)(It,{selectedTags:d,existingTags:r,onChange:f,allowCreate:!1,className:`absolute bottom-3 start-3 max-w-[calc(100%-4rem)]`}),(0,Q.jsx)(`div`,{className:`absolute bottom-3 end-3`,children:(0,Q.jsx)(it,{onTranscript:w,threadId:i.selectedThreadId??void 0,provider:i.selectedThreadModel?.provider,model:i.selectedThreadModel?.id,children:({onClick:e,disabled:t,icon:n,label:r,isRecording:i,isTranscribing:a})=>(0,Q.jsx)(x,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":r,onClick:e,disabled:t||S,className:i||a?`text-destructive`:void 0,children:n})})})]}),!h&&(0,Q.jsx)(Yt,{value:p,onChange:e=>{m(e),v(null)},showRemoveControl:!0,onTriggerRemoved:()=>{g(!0),m(tt())},error:_})]})}),(0,Q.jsxs)(K,{className:`shrink-0`,children:[t&&h&&(0,Q.jsx)(x,{type:`button`,variant:`outline`,disabled:S,onClick:()=>{g(!1),m(V())},children:`Add automation`}),(0,Q.jsxs)(x,{onClick:()=>void A(),disabled:S||!l.trim(),children:[`Add`,S?(0,Q.jsx)(T,{className:`ml-1 h-3 w-3 animate-spin`}):null]})]})]}),(0,Q.jsx)(ve,{open:y,onOpenChange:b,children:(0,Q.jsxs)(he,{children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(me,{children:`Save your task?`}),(0,Q.jsx)(I,{children:`You have unsaved changes. Would you like to save them before closing?`})]}),(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(R,{children:`Keep editing`}),(0,Q.jsx)(L,{onClick:O,children:`Discard`}),(0,Q.jsx)(L,{onClick:k,children:`Save`})]})]})})]})}function Qt(e){let t=(0,Z.c)(6),[n,r]=(0,X.useState)(``),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=[],t[0]=i):i=t[0];let[a,o]=(0,X.useState)(i),[s,c]=(0,X.useState)(tt),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(null);if(e!==d&&(f(e),e)){let t=ye(e);r(e.description),o(e.tags??[]),c(t),u(!Fe(t))}let p;return t[1]!==n||t[2]!==a||t[3]!==l||t[4]!==s?(p={description:n,setDescription:r,editTags:a,setEditTags:o,editTriggerForm:s,setEditTriggerForm:c,editTriggerCollapsed:l,setEditTriggerCollapsed:u},t[1]=n,t[2]=a,t[3]=l,t[4]=s,t[5]=p):p=t[5],p}var $t=u(`app.task-list.edit-dialog`);function en({task:e,automationsOnly:t,projectId:n,projectTags:r,thread:i,getTriggerValidationError:a,onOpenChange:o,onTaskSaved:s,onTaskDeleted:c}){let{description:l,setDescription:u,editTags:d,setEditTags:f,editTriggerForm:p,setEditTriggerForm:m,editTriggerCollapsed:h,setEditTriggerCollapsed:g}=Qt(e),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,C]=(0,X.useState)(!1);function w(){return e?Se({task:e,description:l,tagNames:d.map(e=>e.name),triggerForm:p,thread:we({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})}).kind!==`unchanged`:!1}function E(e){if(e){o(!0);return}if(w()){C(!0);return}v(null),o(!1)}function D(){C(!1),o(!1)}async function O(e){e.preventDefault(),await A()&&C(!1)}function k(){if(!l.trim()||!e)return!1;let t=a(!Fe(p),p);return t?(v(t),!1):!0}async function A(){if(!k())return!1;v(null),b(!0);try{return await j(),!0}catch(e){return ee(e),!1}finally{b(!1)}}async function j(){if(!e)return;let t=Se({task:e,description:l,tagNames:d.map(e=>e.name),triggerForm:p,thread:we({selectedThreadId:i.selectedThreadId,selectedThreadModel:i.selectedThreadModel,selectedThread:i.selectedThread})});if(t.kind===`unchanged`){o(!1);return}let r=await pt(n,e.id,t.payload),a=e.status===`Done`!=(r.status===`Done`);s(r,{tagsChanged:t.tagsChanged,completedChanged:a}),o(!1)}function ee(e){v(Pe(e,`Failed to save task`)),$t.error(`Failed to save task:`,e)}async function te(){if(e){b(!0);try{await Ue(n,e.id),c(e.id),o(!1)}catch(e){$t.error(`Failed to delete task:`,e)}finally{b(!1)}}}return(0,Q.jsxs)(et,{open:e!==null,onOpenChange:E,children:[(0,Q.jsxs)(Y,{className:`max-w-2xl flex flex-col overflow-hidden max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:max-h-[calc(100svh-2rem)]`,children:[(0,Q.jsx)(Le,{className:`shrink-0`,children:(0,Q.jsx)(dt,{children:t?`Edit Automation`:`Edit Task`})}),(0,Q.jsx)(ue,{type:`auto`,className:`min-h-0 flex-1`,children:(0,Q.jsxs)(`div`,{className:`py-2 pl-1`,children:[(0,Q.jsx)(Ce,{placeholder:`Describe what needs to be done...`,value:l,onChange:e=>u(e.target.value),rows:12,className:`max-h-[min(16rem,40svh)] resize-none text-base sm:max-h-none`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&A()}}),(0,Q.jsx)(`div`,{className:`mt-4`,children:(0,Q.jsx)(It,{selectedTags:d,existingTags:r,onChange:f,allowCreate:!1})}),!h&&(0,Q.jsx)(Yt,{value:p,onChange:e=>{m(e),v(null)},showRemoveControl:!0,onTriggerRemoved:()=>{g(!0),m(tt()),v(null)},error:_})]})}),(0,Q.jsxs)(K,{className:`flex-row shrink-0 justify-between gap-2 sm:justify-between sm:gap-0`,children:[(0,Q.jsx)(x,{variant:`destructive`,onClick:()=>void te(),disabled:y,children:`Delete`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&h&&(0,Q.jsx)(x,{type:`button`,variant:`outline`,disabled:y,onClick:()=>{g(!1),m(V())},children:`Add automation`}),(0,Q.jsxs)(x,{onClick:()=>void A(),disabled:y||!l.trim(),className:`w-auto`,children:[`Save`,y?(0,Q.jsx)(T,{className:`ml-1 h-3 w-3 animate-spin`}):null]})]})]})]}),(0,Q.jsx)(ve,{open:S,onOpenChange:C,children:(0,Q.jsxs)(he,{children:[(0,Q.jsxs)(_e,{children:[(0,Q.jsx)(me,{children:`Save your changes?`}),(0,Q.jsx)(I,{children:`You have unsaved changes. Would you like to save them before closing?`})]}),(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(R,{children:`Keep editing`}),(0,Q.jsx)(L,{onClick:D,children:`Discard`}),(0,Q.jsx)(L,{onClick:O,children:`Save`})]})]})})]})}function tn({open:e,onOpenChange:t,projectId:n,tags:r,onTagsChanged:i}){let[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(null);function S(e){o(e.id),l(e.name),_(null)}function C(){o(null),l(``),_(null)}async function D(){let e=u.trim();if(e){h(!0),_(null);try{let t=await Ye(n,e);i([...r,t]),d(``)}catch(e){_(e instanceof Error?e.message:`Failed to create tag`)}finally{h(!1)}}}async function O(e){let t=s.trim();if(t){p(!0),_(null);try{let a=await Ie(n,e,t);i(r.map(e=>e.id===a.id?{...e,name:a.name,color:a.color}:e)),C()}catch(e){_(e instanceof Error?e.message:`Failed to rename tag`)}finally{p(!1)}}}async function k(e){p(!0),_(null);try{await Ve(n,e),i(r.filter(t=>t.id!==e)),y(null),a===e&&C()}catch(e){_(e instanceof Error?e.message:`Failed to delete tag`)}finally{p(!1)}}return(0,Q.jsx)(et,{open:e,onOpenChange:t,children:(0,Q.jsxs)(Y,{className:`flex max-h-[min(36rem,85vh)] flex-col sm:max-w-md`,children:[(0,Q.jsx)(Le,{children:(0,Q.jsx)(dt,{children:`Manage Tags`})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 py-2`,children:[(0,Q.jsx)(G,{value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&D(),e.key===`Escape`&&d(``)},placeholder:`New tag name...`,className:`h-8 flex-1`,disabled:m}),(0,Q.jsx)(x,{size:`sm`,className:`h-8 shrink-0 bg-foreground text-background hover:bg-foreground/90`,onClick:()=>void D(),disabled:m||!u.trim(),children:m?(0,Q.jsx)(T,{className:`h-3.5 w-3.5 animate-spin`}):`Add`})]}),r.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`py-4 text-center`),children:`No tags yet. Create one above to get started.`}):(0,Q.jsx)(le,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(`div`,{className:`space-y-1 py-2 pr-3`,children:r.map(e=>{let t=a===e.id,n=v===e.id;return(0,Q.jsx)(`div`,{className:b(`group flex items-center gap-2 rounded-md px-2 py-1.5 hover:bg-accent/40`,!t&&!n&&!f&&`cursor-pointer`),onClick:()=>{!f&&!t&&!n&&S(e)},children:t?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{value:s,onChange:e=>l(e.target.value),onKeyDown:t=>{t.key===`Enter`&&O(e.id),t.key===`Escape`&&C()},className:`h-8 flex-1 text-sm`,autoFocus:!0,disabled:f}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>void O(e.id),disabled:f||!s.trim(),children:f?(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(E,{className:`h-4 w-4`})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:C,disabled:f,children:(0,Q.jsx)(N,{className:`h-4 w-4`})})]}):n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:b(c.body,`flex-1 truncate`),children:[`Delete `,e.name,`? Removes from `,e.taskCount,` `,e.taskCount===1?`task`:`tasks`,`.`]}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-destructive hover:text-destructive`,onClick:()=>void k(e.id),disabled:f,children:f?(0,Q.jsx)(T,{className:`h-4 w-4 animate-spin`}):(0,Q.jsx)(E,{className:`h-4 w-4`})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>y(null),disabled:f,children:(0,Q.jsx)(N,{className:`h-4 w-4`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`h-2.5 w-2.5 shrink-0 rounded-full`,style:{backgroundColor:e.color}}),(0,Q.jsx)(`span`,{className:b(c.body,`min-w-0 flex-1 truncate`),children:e.name}),(0,Q.jsxs)(`span`,{className:b(c.caption,`shrink-0 text-muted-foreground`),children:[e.taskCount,` `,e.taskCount===1?`task`:`tasks`]}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-destructive opacity-0 pointer-events-none transition-opacity can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto can-hover:hover:text-destructive`,onClick:t=>{t.stopPropagation(),y(e.id)},disabled:f,"aria-label":`Delete ${e.name}`,children:(0,Q.jsx)(w,{className:`h-3.5 w-3.5`})})]})},e.id)})})}),g&&(0,Q.jsx)(`p`,{className:b(c.caption,`text-destructive`),children:g})]})})}var nn=u(`app.task-list.sync`);function rn({projectId:e,initialTasks:t,refreshTrigger:n,project:r,onRefreshTags:i}){let a=_(),[o,s]=(0,X.useState)(t),[c,l]=(0,X.useState)(!1),u=(0,X.useRef)(n??0),d=(0,X.useRef)({}),f=r?.tasksModifiedCount??0,p=(0,X.useCallback)(async function(){l(!0);try{await se(e),s(await We(e)),qe(e),i(),F();let t=await P();a({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){nn.error(`Failed to refresh project tasks:`,e)}finally{l(!1)}},[e,a,i]);(0,X.useEffect)(()=>{n==null||n===u.current||(u.current=n,p())},[n,p]),(0,X.useEffect)(()=>{let t=d.current[e]??0;if(f===0){d.current[e]=0;return}t!==f&&(d.current[e]=f,f>t&&p())},[f,e,p]);let m=o.some(e=>e.working);return(0,X.useEffect)(()=>{if(!m)return;let t=setInterval(async()=>{try{s(await We(e))}catch(e){nn.error(`Failed to poll project tasks:`,e)}},2e3);return()=>clearInterval(t)},[m,e]),(0,X.useEffect)(()=>{s(t)},[t]),{tasks:o,setTasks:s,isRefreshing:c,handleRefreshTasks:p}}var an=u(`app.task-list.ui`);function on(e){let t=(0,Z.c)(15),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,i]=(0,X.useState)(n),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let[o,s]=(0,X.useState)(a),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1),f,p;t[2]===e?(f=t[3],p=t[4]):(f=()=>{J(e).then(i).catch(cn)},p=[e],t[2]=e,t[3]=f,t[4]=p),(0,X.useEffect)(f,p);let m;t[5]===e?m=t[6]:(m=function(){J(e).then(i).catch(sn)},t[5]=e,t[6]=m);let h=m,g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=function(e){s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[7]=g):g=t[7];let _=g,v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(){d(!0)},t[8]=v):v=t[8];let y=v,b;return t[9]!==o||t[10]!==u||t[11]!==r||t[12]!==h||t[13]!==c?(b={projectTags:r,setProjectTags:i,hiddenTagIds:o,setHiddenTagIds:s,searchTerm:c,setSearchTerm:l,manageTagsOpen:u,setManageTagsOpen:d,refreshProjectTags:h,toggleHiddenTag:_,openManageTags:y},t[9]=o,t[10]=u,t[11]=r,t[12]=h,t[13]=c,t[14]=b):b=t[14],b}function sn(e){return an.error(`Failed to refresh project tags:`,e)}function cn(e){return an.error(`Failed to fetch project tags:`,e)}function ln(e){let t=(0,Z.c)(15),n=v(hn),r=v(mn),i=v(pn),a=v(fn),o=v(dn),s=v(un),c,l;if(t[0]!==e||t[1]!==n||t[2]!==r){let i;t[5]===e?i=t[6]:(i=t=>t.projectId===e,t[5]=e,t[6]=i),c=n.find(i),l=c?.threads.find(e=>e.threadId===r),t[0]=e,t[1]=n,t[2]=r,t[3]=c,t[4]=l}else c=t[3],l=t[4];let u=l,d=r?s[r]:void 0,f;return t[7]!==a||t[8]!==i||t[9]!==c||t[10]!==o||t[11]!==u||t[12]!==r||t[13]!==d?(f={project:c,selectedThreadId:r,selectedThread:u,selectedThreadModel:d,processingThreadIds:i,pendingChatMessage:a,queuedChatMessages:o},t[7]=a,t[8]=i,t[9]=c,t[10]=o,t[11]=u,t[12]=r,t[13]=d,t[14]=f):f=t[14],f}function un(e){return e.projectModelSelections}function dn(e){return e.queuedChatMessages}function fn(e){return e.pendingChatMessage}function pn(e){return e.processingThreadIds}function mn(e){return e.selectedThreadId}function hn(e){return e.projects}function gn(){let e=(0,Z.c)(3),{modelAliases:t,isLoading:n}=ht(),r;return e[0]!==t||e[1]!==n?(r=function(e,r){if(e)return null;let i=ot(r);if(i)return Ne(i);if(n)return null;let a=He(r,t);return a?Ne(a):null},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function _n(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Q.jsxs)(`div`,{className:`text-center`,children:[(0,Q.jsx)(je,{className:`mx-auto`}),(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`mt-2`),children:`Loading tasks`})]})}),e[0]=t):t=e[0],t}function vn(e){let t=(0,Z.c)(5),{projectId:n,resourceKey:r,children:i}=e,a;t[0]===n?a=t[1]:(a=function(){return Xe(n)},t[0]=n,t[1]=a);let o=pe(r,a),s;return t[2]!==i||t[3]!==o?(s=i(o),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function yn({projectId:e,children:t}){let[n,r]=(0,X.useState)(0),i=nt(e,n),a=(0,X.useRef)(null);a.current!==i&&(a.current=i,fe(i));function o(){fe(i),r(function(e){return e+1})}return(0,Q.jsx)(gt,{fallbackTitle:`Failed to load tasks`,onRetry:o,children:(0,Q.jsx)(X.Suspense,{fallback:(0,Q.jsx)(_n,{}),children:(0,Q.jsx)(vn,{projectId:e,resourceKey:i,children:t},i)})},e)}var bn=u(`app.task-list.ui`);function xn(e){let t=(0,Z.c)(127),{projectId:n,onThreadSelect:r,initialTasks:a,refreshTrigger:s,automationsOnly:l}=e,u=l===void 0?!1:l,d=_(),{project:f,selectedThreadId:p,selectedThread:m,selectedThreadModel:h}=ln(n),[v,S]=(0,X.useState)(!1),[C,w]=(0,X.useState)(null),{projectTags:T,setProjectTags:E,hiddenTagIds:D,setHiddenTagIds:O,searchTerm:k,setSearchTerm:A,manageTagsOpen:j,setManageTagsOpen:ee,refreshProjectTags:M,toggleHiddenTag:ne,openManageTags:N}=on(n),ae;t[0]!==a||t[1]!==f||t[2]!==n||t[3]!==M||t[4]!==s?(ae={projectId:n,initialTasks:a,refreshTrigger:s,project:f,onRefreshTags:M},t[0]=a,t[1]=f,t[2]=n,t[3]=M,t[4]=s,t[5]=ae):ae=t[5];let{tasks:P,setTasks:F,isRefreshing:se,handleRefreshTasks:ce}=rn(ae),ue=mt(Oe,u),fe;t[6]!==ue||t[7]!==u?(fe=u?new Date(ue):void 0,t[6]=ue,t[7]=u,t[8]=fe):fe=t[8];let pe=fe,I=gn(),me=i(),he;t[9]===me?he=t[10]:(he=function(){me.invalidateQueries({queryKey:o.conversations.unreadAll()})},t[9]=me,t[10]=he);let L=he,ge;t[11]!==M||t[12]!==F||t[13]!==P?(ge=function(e){let t=P.find(t=>t.id===e.id);F(t=>t.map(t=>t.id===e.id?e:t)),t&&t.status===`Done`!=(e.status===`Done`)&&M()},t[11]=M,t[12]=F,t[13]=P,t[14]=ge):ge=t[14];let R=ge,_e;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_e=function(e){w({task:e})},t[15]=_e):_e=t[15];let ve=_e,ye;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ye=function(){w(null)},t[16]=ye):ye=t[16];let be=ye,z;t[17]!==n||t[18]!==M||t[19]!==F?(z=function(e){F(t=>[...t,e]),qe(n),M()},t[17]=n,t[18]=M,t[19]=F,t[20]=z):z=t[20];let xe=z,B;t[21]!==n||t[22]!==F?(B=function(e){F(t=>t.map(t=>t.id===e.id?e:t)),qe(n)},t[21]=n,t[22]=F,t[23]=B):B=t[23];let Se=B,Ce;t[24]!==n||t[25]!==M||t[26]!==F?(Ce=function(e,t){F(t=>t.map(t=>t.id===e.id?e:t)),qe(n),(t.tagsChanged||t.completedChanged)&&M()},t[24]=n,t[25]=M,t[26]=F,t[27]=Ce):Ce=t[27];let V=Ce,we;t[28]!==n||t[29]!==M||t[30]!==F?(we=function(e){F(t=>t.filter(t=>t.id!==e)),qe(n),M()},t[28]=n,t[29]=M,t[30]=F,t[31]=we):we=t[31];let H=we,Ee;t[32]!==n||t[33]!==O||t[34]!==E||t[35]!==F?(Ee=function(e){let t=Be(e),r=new Set(t.map(function(e){return e.id}));E(t),O(function(e){return new Set([...e].filter(e=>r.has(e)))}),We(n).then(F).catch(Sn)},t[32]=n,t[33]=O,t[34]=E,t[35]=F,t[36]=Ee):Ee=t[36];let De=Ee,ke;t[37]!==d||t[38]!==R||t[39]!==n||t[40]!==L?(ke=async function(e){try{await Te({projectId:n,dispatch:d,onUpdate:R},e),L()}catch(e){let t=e;de({title:`Could not start the task`,description:t instanceof Error?t.message:String(t),variant:`destructive`})}},t[37]=d,t[38]=R,t[39]=n,t[40]=L,t[41]=ke):ke=t[41];let je=ke,Me;t[42]!==R||t[43]!==n||t[44]!==L?(Me=async function(e){R(await ut(n,e.id)),qe(n),L()},t[42]=R,t[43]=n,t[44]=L,t[45]=Me):Me=t[45];let Ne=Me,Pe;t[46]!==d||t[47]!==r||t[48]!==n?(Pe=async function(e){r?await r(e):d({type:g.SelectThread,threadId:e,projectId:n})},t[46]=d,t[47]=r,t[48]=n,t[49]=Pe):Pe=t[49];let Fe=Pe,Ie;t[50]!==R||t[51]!==n?(Ie=async function(e){R(await pt(n,e.id,{status:`Done`,working:!1})),qe(n)},t[50]=R,t[51]=n,t[52]=Ie):Ie=t[52];let Le=Ie,Re;t[53]!==m||t[54]!==p||t[55]!==h?(Re={selectedThreadId:p,selectedThreadModel:h,selectedThread:m},t[53]=m,t[54]=p,t[55]=h,t[56]=Re):Re=t[56];let ze=Re,U,Ve,W,He,Ue,G;if(t[57]!==pe||t[58]!==u||t[59]!==Le||t[60]!==Fe||t[61]!==ce||t[62]!==Ne||t[63]!==je||t[64]!==D||t[65]!==se||t[66]!==r||t[67]!==N||t[68]!==f||t[69]!==T||t[70]!==k||t[71]!==A||t[72]!==P||t[73]!==ne){let{viewTasks:e,visibleTasks:n,emptyListMessage:i,noMatchMessage:a}=Ae(P,{automationsOnly:u,hiddenTagIds:D,searchTerm:k,projectName:f?y(f):void 0});Ue=`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,t[80]!==ce||t[81]!==D||t[82]!==se||t[83]!==N||t[84]!==T||t[85]!==A||t[86]!==ne?(G=(0,Q.jsx)(Ft,{projectTags:T,hiddenTagIds:D,onToggleHiddenTag:ne,onSearchTermChange:A,isRefreshing:se,onRefresh:ce,onManageTags:N}),t[80]=ce,t[81]=D,t[82]=se,t[83]=N,t[84]=T,t[85]=A,t[86]=ne,t[87]=G):G=t[87],U=le,He=`min-h-0 min-w-0 flex-1 overflow-hidden`,Ve=`pb-14`,W=e.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-4 py-8 text-center`),children:i}):n.length===0?(0,Q.jsx)(`p`,{className:b(c.bodyMuted,`px-4 py-8 text-center`),children:a}):(0,Q.jsx)(`div`,{className:`min-w-0 w-full divide-y divide-border`,children:n.map(function(e){return(0,Q.jsx)(Nt,{task:e,now:pe,onOpenEdit:ve,showRunHistory:u,onThreadSelect:r,onStartInNewWorkspace:je,onMarkDone:Le,onRunNow:Ne,onOpenRun:Fe},e.id)})}),t[57]=pe,t[58]=u,t[59]=Le,t[60]=Fe,t[61]=ce,t[62]=Ne,t[63]=je,t[64]=D,t[65]=se,t[66]=r,t[67]=N,t[68]=f,t[69]=T,t[70]=k,t[71]=A,t[72]=P,t[73]=ne,t[74]=U,t[75]=Ve,t[76]=W,t[77]=He,t[78]=Ue,t[79]=G}else U=t[74],Ve=t[75],W=t[76],He=t[77],Ue=t[78],G=t[79];let K;t[88]!==Ve||t[89]!==W?(K=(0,Q.jsx)(`div`,{className:Ve,children:W}),t[88]=Ve,t[89]=W,t[90]=K):K=t[90];let Ge;t[91]!==U||t[92]!==He||t[93]!==K?(Ge=(0,Q.jsx)(U,{className:He,children:K}),t[91]=U,t[92]=He,t[93]=K,t[94]=Ge):Ge=t[94];let Ke;t[95]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Q.jsxs)(oe,{children:[(0,Q.jsx)(re,{asChild:!0,children:(0,Q.jsxs)(x,{size:`icon`,className:`absolute bottom-6 right-6 z-10 h-10 w-10 rounded-full shadow-lg`,onClick:()=>S(!0),children:[(0,Q.jsx)(te,{className:`h-5 w-5`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`New task`})]})}),(0,Q.jsx)(ie,{children:`New task`})]}),t[95]=Ke):Ke=t[95];let q;t[96]!==v||t[97]!==u||t[98]!==I||t[99]!==xe||t[100]!==Se||t[101]!==n||t[102]!==T||t[103]!==ze?(q=(0,Q.jsx)(Zt,{open:v,automationsOnly:u,projectId:n,projectTags:T,thread:ze,getTriggerValidationError:I,onOpenChange:S,onTaskCreated:xe,onTaskUpdated:Se}),t[96]=v,t[97]=u,t[98]=I,t[99]=xe,t[100]=Se,t[101]=n,t[102]=T,t[103]=ze,t[104]=q):q=t[104];let Je=C?.task??null,Ye;t[105]!==u||t[106]!==I||t[107]!==H||t[108]!==V||t[109]!==n||t[110]!==T||t[111]!==Je||t[112]!==ze?(Ye=(0,Q.jsx)(en,{task:Je,automationsOnly:u,projectId:n,projectTags:T,thread:ze,getTriggerValidationError:I,onOpenChange:be,onTaskSaved:V,onTaskDeleted:H}),t[105]=u,t[106]=I,t[107]=H,t[108]=V,t[109]=n,t[110]=T,t[111]=Je,t[112]=ze,t[113]=Ye):Ye=t[113];let J;t[114]!==De||t[115]!==j||t[116]!==n||t[117]!==T||t[118]!==ee?(J=(0,Q.jsx)(tn,{open:j,onOpenChange:ee,projectId:n,tags:T,onTagsChanged:De}),t[114]=De,t[115]=j,t[116]=n,t[117]=T,t[118]=ee,t[119]=J):J=t[119];let Y;return t[120]!==Ue||t[121]!==G||t[122]!==Ge||t[123]!==q||t[124]!==Ye||t[125]!==J?(Y=(0,Q.jsxs)(`div`,{className:Ue,children:[G,Ge,Ke,q,Ye,J]}),t[120]=Ue,t[121]=G,t[122]=Ge,t[123]=q,t[124]=Ye,t[125]=J,t[126]=Y):Y=t[126],Y}function Sn(e){return bn.error(`Failed to refresh tasks after tag change:`,e)}function Cn(e){let t=(0,Z.c)(5),n;t[0]===e?n=t[1]:(n=function(t){return(0,Q.jsx)(xn,{...e,initialTasks:t})},t[0]=e,t[1]=n);let r=n,i;return t[2]!==e.projectId||t[3]!==r?(i=(0,Q.jsx)(yn,{projectId:e.projectId,children:r}),t[2]=e.projectId,t[3]=r,t[4]=i):i=t[4],i}var wn=u(`app.tasks-view.ui`);async function Tn(){return F(),P()}function En(e,t,n,r,i){r===t&&i===n||e({type:g.SelectThread,threadId:t,projectId:n})}async function Dn(e){try{let t=await ce();e({type:g.SetProcessingThreads,threadIds:t})}catch(e){wn.error(`Failed to fetch processing threads after thread selection:`,e)}}function On(e){let t=(0,Z.c)(16),{projectId:n,refreshTrigger:r,view:i}=e,o=i===void 0?`tasks`:i,s=_(),c=v(jn),l=v(An),u=v(kn),{expandWindow:d,hasOpenWindows:f}=a(),p,m;t[0]===s?(p=t[1],m=t[2]):(p=()=>{let e=!1;return(async()=>{try{let t=await Tn();e||s({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){let t=e;wn.error(`Failed to refresh projects on tasks view mount:`,t)}})(),()=>{e=!0}},m=[s],t[0]=s,t[1]=p,t[2]=m),(0,X.useEffect)(p,m);let y;t[3]!==s||t[4]!==d||t[5]!==f||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==l?(y=async function(e){if(!c.find(e=>e.projectId===n))return;f&&d(h);let t=null;try{t=await Tn(),s({type:g.SetProjects,projects:t.projects,cloneRootPath:t.cloneRootPath})}catch(e){let t=e;wn.error(`Failed to refresh projects for thread selection:`,t)}t&&!t.projects.find(e=>e.projectId===n)?.threads.find(t=>t.threadId===e)||(En(s,e,n,l,u),await Dn(s))},t[3]=s,t[4]=d,t[5]=f,t[6]=n,t[7]=c,t[8]=u,t[9]=l,t[10]=y):y=t[10];let b=y,x=o===`automations`,S;return t[11]!==b||t[12]!==n||t[13]!==r||t[14]!==x?(S=(0,Q.jsx)(`div`,{className:`relative flex h-full min-w-0 flex-col overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:(0,Q.jsx)(Cn,{projectId:n,refreshTrigger:r,onThreadSelect:b,automationsOnly:x})})}),t[11]=b,t[12]=n,t[13]=r,t[14]=x,t[15]=S):S=t[15],S}function kn(e){return e.selectedProjectId}function An(e){return e.selectedThreadId}function jn(e){return e.projects}export{On as TasksView};
|