tarsk 0.5.53 → 0.5.55

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.
Files changed (80) hide show
  1. package/dist/index.js +2305 -1255
  2. package/dist/public/assets/{account-view-5qdPli2O.js → account-view-CkhRveFm.js} +1 -1
  3. package/dist/public/assets/{api-DM6LtnPA.js → api-BUjKoVUu.js} +1 -1
  4. package/dist/public/assets/browser-tab-DbT2QjH_.js +8 -0
  5. package/dist/public/assets/commit-dialog-DRMKciNP.js +1 -0
  6. package/dist/public/assets/context-menu-DO3hiSAo.js +1 -0
  7. package/dist/public/assets/create-repo-dialog-CXiWjkFb.js +1 -0
  8. package/dist/public/assets/dialogs-config-86QTDk4G.js +51 -0
  9. package/dist/public/assets/{diff-view-DxSswxah.js → diff-view-D_xoUbUb.js} +2 -2
  10. package/dist/public/assets/{explorer-tab-view-DMt-0Zcl.js → explorer-tab-view-JIMdE8cA.js} +2 -2
  11. package/dist/public/assets/{explorer-tree-D3nyQX1f.js → explorer-tree-B60M0QAV.js} +1 -1
  12. package/dist/public/assets/{explorer-view-BRBtKxsw.js → explorer-view-BBaEk8i9.js} +2 -2
  13. package/dist/public/assets/git-history-dialog-DfzFi0Nx.js +1 -0
  14. package/dist/public/assets/git-ops-button-C_4iUio-.js +2 -0
  15. package/dist/public/assets/history-view-BsN806ip.js +9 -0
  16. package/dist/public/assets/index-C2iIghSR.js +81 -0
  17. package/dist/public/assets/mcp-server-card-DUJUtQq-.js +1 -0
  18. package/dist/public/assets/merged-pr-dialog-DVNtED4V.js +1 -0
  19. package/dist/public/assets/model-star-rating-DrR6jzjq.js +1 -0
  20. package/dist/public/assets/onboarding-DCrFdRM5.js +1 -0
  21. package/dist/public/assets/{project-settings-view-XGHhtLr_.js → project-settings-view-DRL5CTSQ.js} +1 -1
  22. package/dist/public/assets/{providers-list-view-Cbndeobz.js → providers-list-view-DkmgzncX.js} +1 -1
  23. package/dist/public/assets/pull-request-dialog-CPjzwrdo.js +1 -0
  24. package/dist/public/assets/pull-with-changes-dialog-DLfDpEEX.js +1 -0
  25. package/dist/public/assets/push-before-pr-dialog-v-3J53Hw.js +1 -0
  26. package/dist/public/assets/radio-group-C7-1cZ2t.js +1 -0
  27. package/dist/public/assets/{react-vendor-U9lUQswz.js → react-vendor-DK2COBjg.js} +5 -5
  28. package/dist/public/assets/settings-general-view-BZZs0t0d.js +1 -0
  29. package/dist/public/assets/{settings-instructions-view-CRUCeWUk.js → settings-instructions-view-CE-ugC91.js} +1 -1
  30. package/dist/public/assets/{settings-list-BapKAJV3.js → settings-list-CICo_cz2.js} +1 -1
  31. package/dist/public/assets/settings-mcp-servers-view-DKviDm0q.js +5 -0
  32. package/dist/public/assets/{settings-models-skeleton-B7TMwjxe.js → settings-models-skeleton-MXSIpmT8.js} +1 -1
  33. package/dist/public/assets/{settings-models-view-ObE_ktqH.js → settings-models-view-DWqPx-2m.js} +1 -1
  34. package/dist/public/assets/settings-rules-view-Cq-60UOT.js +8 -0
  35. package/dist/public/assets/{settings-skills-view-MZQjnD_g.js → settings-skills-view-B6srjIvU.js} +3 -3
  36. package/dist/public/assets/settings-slash-commands-view-j8NdZX1V.js +1 -0
  37. package/dist/public/assets/settings-subagents-view-4LusGYrq.js +2 -0
  38. package/dist/public/assets/{settings-system-prompt-view-CZe9uYNN.js → settings-system-prompt-view-DPMiLsrM.js} +1 -1
  39. package/dist/public/assets/{settings-view-BQL9vEvw.js → settings-view-0Idf-mDz.js} +2 -2
  40. package/dist/public/assets/skeleton-BvvAbfo4.js +1 -0
  41. package/dist/public/assets/slug-utils-jE4NOx-f.js +1 -0
  42. package/dist/public/assets/tabs-0fGgot48.js +1 -0
  43. package/dist/public/assets/tasks-view-DD03SZ7R.js +3 -0
  44. package/dist/public/assets/{terminal-panel-CrBP1KEj.js → terminal-panel-D6RjOZfD.js} +2 -2
  45. package/dist/public/assets/{ui-components-BPFbmhJA.js → ui-components-BJRW2LJq.js} +1 -1
  46. package/dist/public/assets/{use-deferred-search-Bi99md6l.js → use-deferred-search-DOfdC3JO.js} +1 -1
  47. package/dist/public/assets/{utils-C-7eVelM.js → utils-DPYK-CSn.js} +1 -1
  48. package/dist/public/assets/{vosk-speech-DC3I453R.js → vosk-speech-Ce0kC8Ck.js} +1 -1
  49. package/dist/public/assets/{web-CHeXRjkl.js → web-BFYPtzjF.js} +1 -1
  50. package/dist/public/assets/{web-DbVs7vzI.js → web-Cp_I5n5Z.js} +1 -1
  51. package/dist/public/assets/{web-GowI_ZaX.js → web-DGEc3VyT.js} +1 -1
  52. package/dist/public/assets/{web-t7m2rd8w.js → web-DLSR_y_6.js} +1 -1
  53. package/dist/public/index.html +7 -7
  54. package/package.json +2 -1
  55. package/dist/public/assets/browser-tab-B9KCHZ2L.js +0 -8
  56. package/dist/public/assets/commit-dialog-DeVXqj1Z.js +0 -1
  57. package/dist/public/assets/context-menu-CHJI6MbC.js +0 -1
  58. package/dist/public/assets/create-repo-dialog-ByIjJnh7.js +0 -1
  59. package/dist/public/assets/dialogs-config-DAMqiy-4.js +0 -51
  60. package/dist/public/assets/git-history-dialog-DJfkffd6.js +0 -1
  61. package/dist/public/assets/git-ops-button-0DrfLBkC.js +0 -2
  62. package/dist/public/assets/history-view-lvvTzW7O.js +0 -9
  63. package/dist/public/assets/index-C_iiobDl.js +0 -81
  64. package/dist/public/assets/mcp-server-card-DPMxJJU6.js +0 -1
  65. package/dist/public/assets/merged-pr-dialog-BC9NMIet.js +0 -1
  66. package/dist/public/assets/model-star-rating-C4Ugsik_.js +0 -1
  67. package/dist/public/assets/onboarding-dys9Rwb5.js +0 -1
  68. package/dist/public/assets/pull-request-dialog-kuaKjUle.js +0 -1
  69. package/dist/public/assets/pull-with-changes-dialog-CoxkFsGu.js +0 -1
  70. package/dist/public/assets/push-before-pr-dialog-C4cbgPuA.js +0 -1
  71. package/dist/public/assets/radio-group-C6EDTFov.js +0 -1
  72. package/dist/public/assets/settings-general-view-BHj9qn0K.js +0 -1
  73. package/dist/public/assets/settings-mcp-servers-view-M2DQPcpo.js +0 -5
  74. package/dist/public/assets/settings-rules-view-BhRBowk9.js +0 -8
  75. package/dist/public/assets/settings-slash-commands-view-BYHthCEM.js +0 -1
  76. package/dist/public/assets/settings-subagents-view-CmrFQcUF.js +0 -2
  77. package/dist/public/assets/skeleton-rEPpLCqo.js +0 -1
  78. package/dist/public/assets/slug-utils-DZ59sTAJ.js +0 -1
  79. package/dist/public/assets/tabs-D57g7ER1.js +0 -1
  80. package/dist/public/assets/tasks-view-Bn9GiPNp.js +0 -3
@@ -1 +0,0 @@
1
- import{$i as e,Br as t,Ii as n,Io as r,Lr as i,Ns as a,Pi as o,Ps as s,Rr as c,bo as l,fs as u,zr as d}from"./dialogs-config-DAMqiy-4.js";import{I as f}from"./history-view-lvvTzW7O.js";var p=s(),m=a(),h=f(e=>(0,m.jsxs)(`div`,{className:e.v0,onClick:e.v1,role:e.v2,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,m.jsx)(`span`,{className:e.v3,children:e.v4}),e.v5]}),e.v6]}),(0,m.jsx)(`p`,{className:e.v7,children:e.v8})]}),{name:`ServerCard_1`,portals:[`v4`,`v5`,`v6`,`v8`]}),g=function(a){let s=(0,p.c)(18),{name:f,description:g,installed:_,onClick:v,onOpen:y,onUninstall:b,showInstalledControls:x}=a,S=x===void 0?!0:x,C=`flex flex-col gap-2 p-2.5 rounded-lg border border-border bg-card text-left transition-colors w-full ${_?``:`hover:bg-accent/50 cursor-pointer`}`,w=_?void 0:v,T=_?void 0:`button`,E;s[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=n(u.label,`truncate`),s[0]=E):E=s[0];let D;s[1]!==_||s[2]!==S?(D=_&&S&&(0,m.jsx)(d,{delayDuration:300,children:(0,m.jsxs)(i,{children:[(0,m.jsx)(t,{asChild:!0,children:(0,m.jsx)(`span`,{className:`flex-shrink-0 h-4 w-4 rounded-full bg-green-500/15 flex items-center justify-center`,children:(0,m.jsx)(r,{className:`h-2.5 w-2.5 text-green-600 dark:text-green-400`})})}),(0,m.jsx)(c,{children:`Installed`})]})}),s[1]=_,s[2]=S,s[3]=D):D=s[3];let O;s[4]!==_||s[5]!==y||s[6]!==b||s[7]!==S?(O=_&&S&&(0,m.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[y&&(0,m.jsx)(d,{delayDuration:300,children:(0,m.jsxs)(i,{children:[(0,m.jsx)(t,{asChild:!0,children:(0,m.jsx)(o,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),y()},children:(0,m.jsx)(l,{className:`h-3.5 w-3.5`})})}),(0,m.jsx)(c,{children:`Open in Explorer`})]})}),b&&(0,m.jsx)(d,{delayDuration:300,children:(0,m.jsxs)(i,{children:[(0,m.jsx)(t,{asChild:!0,children:(0,m.jsx)(o,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),b()},className:`text-destructive hover:text-destructive`,children:(0,m.jsx)(e,{className:`h-3.5 w-3.5`})})}),(0,m.jsx)(c,{children:`Remove`})]})})]}),s[4]=_,s[5]=y,s[6]=b,s[7]=S,s[8]=O):O=s[8];let k;s[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=n(u.caption,`line-clamp-3`),s[9]=k):k=s[9];let A;return s[10]!==g||s[11]!==f||s[12]!==C||s[13]!==w||s[14]!==T||s[15]!==D||s[16]!==O?(A=(0,m.jsx)(h,{v0:C,v1:w,v2:T,v3:E,v4:f,v5:D,v6:O,v7:k,v8:g}),s[10]=g,s[11]=f,s[12]=C,s[13]=w,s[14]=T,s[15]=D,s[16]=O,s[17]=A):A=s[17],A};export{g as t};
@@ -1 +0,0 @@
1
- import{Ns as e,Pi as t,Ps as n,Qr as r,Yr as i,ei as a,fs as o,ii as s,ni as c,ri as l,ti as u}from"./dialogs-config-DAMqiy-4.js";import{a as d}from"./onboarding-dys9Rwb5.js";var f=n(),p=e();function m(e){let n=(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;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(s,{children:`Pull Request Merged`}),n[0]=C):C=n[0];let w=x?` for ${x}`:``,T;n[1]===w?T=n[2]:(T=(0,p.jsxs)(l,{children:[C,(0,p.jsxs)(u,{children:[`As the pull request has been merged`,w,`, a new branch will be created from the current checkout.`]})]}),n[1]=w,n[2]=T);let E;n[3]===y?E=n[4]:(E=e=>y(e===!0),n[3]=y,n[4]=E);let D;n[5]!==v||n[6]!==E?(D=(0,p.jsx)(d,{id:`new-chat-on-new-branch`,checked:v,onCheckedChange:E}),n[5]=v,n[6]=E,n[7]=D):D=n[7];let O;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(i,{htmlFor:`new-chat-on-new-branch`,className:o.labelNormal,children:`New Chat`}),n[8]=O):O=n[8];let k;n[9]===D?k=n[10]:(k=(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,O]}),n[9]=D,n[10]=k);let A;n[11]!==S||n[12]!==_?(A=(0,p.jsx)(t,{variant:`ghost`,onClick:_,disabled:S,children:`Just Open`}),n[11]=S,n[12]=_,n[13]=A):A=n[13];let j;n[14]!==S||n[15]!==g?(j=(0,p.jsx)(t,{onClick:g,disabled:S,children:`New Branch`}),n[14]=S,n[15]=g,n[16]=j):j=n[16];let M;n[17]!==j||n[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]}),n[17]=j,n[18]=A,n[19]=M):M=n[19];let N;n[20]!==M||n[21]!==k?(N=(0,p.jsxs)(c,{className:`flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[k,M]}),n[20]=M,n[21]=k,n[22]=N):N=n[22];let P;n[23]!==N||n[24]!==T?(P=(0,p.jsxs)(a,{children:[T,N]}),n[23]=N,n[24]=T,n[25]=P):P=n[25];let F;return n[26]!==h||n[27]!==m||n[28]!==P?(F=(0,p.jsx)(r,{open:m,onOpenChange:h,children:P}),n[26]=h,n[27]=m,n[28]=P,n[29]=F):F=n[29],F}export{m as MergedPRDialog};
@@ -1 +0,0 @@
1
- import{Br as e,Lr as t,Ns as n,Ps as r,Rr as i,fs as a,ra as o,zr as s}from"./dialogs-config-DAMqiy-4.js";import{r as c}from"./onboarding-dys9Rwb5.js";var l=r(),u=n();function d(n){let r=(0,l.c)(9),{codingIndex:d,modelName:f}=n,p=c(d);if(p===0)return null;let m;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[1,2,3,4,5],r[0]=m):m=r[0];let h;r[1]===p?h=r[2]:(h=(0,u.jsx)(e,{asChild:!0,children:(0,u.jsx)(`div`,{className:`flex items-center gap-0.5`,children:m.map(e=>(0,u.jsx)(o,{className:`h-3 w-3 ${e<=p?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),r[1]=p,r[2]=h);let g;r[3]!==d||r[4]!==f?(g=(0,u.jsx)(i,{children:(0,u.jsxs)(`p`,{className:a.body,children:[f,` was indexed `,d,` for coding intelligence`]})}),r[3]=d,r[4]=f,r[5]=g):g=r[5];let _;return r[6]!==h||r[7]!==g?(_=(0,u.jsx)(s,{children:(0,u.jsxs)(t,{children:[h,g]})}),r[6]=h,r[7]=g,r[8]=_):_=r[8],_}export{d as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{At as n,Ba as r,Br as i,Cn as a,G as o,Ho as s,Ii as c,Io as l,Is as u,Jr as d,Ko as f,Li as p,Lr as m,Mi as h,Ni as g,Ns as _,Pi as v,Ps as y,Qr as b,Rr as x,Sn as S,So as C,Ti as w,U as T,Ui as E,Vi as D,Wa as O,Wo as k,Xr as A,Yr as j,Zr as M,as as N,bo as P,c as F,ei as I,fa as ee,fs as L,h as te,ii as R,jo as ne,jt as re,ki as ie,kt as ae,n as z,ni as oe,on as B,os as se,r as V,ri as ce,ti as H,vi as le,vo as ue,wo as de,y as fe,yo as pe,zr as U}from"./dialogs-config-DAMqiy-4.js";import{I as W,_ as me,d as he,f as ge,h as _e,m as ve,p as ye,x as G}from"./history-view-lvvTzW7O.js";var K=y(),q=e(u(),1),J=_(),be=q.forwardRef((e,t)=>{let n=(0,K.c)(23),r,i,a,o,s,l,u,d,f;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],l=n[6],u=n[7],d=n[8],f=n[9]):({className:i,selected:l,noBackground:o,level:a,basePadding:r,indentSize:d,asChild:f,style:u,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=l,n[7]=u,n[8]=d,n[9]=f);let p=d===void 0?20:d,m=f===void 0?!1:f,h=a===void 0?void 0:(r??12)+a*p,g=m?D:`div`,_;n[10]!==i||n[11]!==o||n[12]!==l?(_=c(c(L.body,`flex items-center gap-2 w-full min-w-0 justify-start text-left touch-manipulation px-3 py-2 cursor-pointer rounded-full transition-colors group overflow-hidden`),`can-hover:hover:bg-sidebar-accent can-hover:hover:text-sidebar-accent-foreground`,l&&!o&&`bg-sidebar-accent text-sidebar-accent-foreground font-medium`,l&&o&&`font-bold text-foreground`,i),n[10]=i,n[11]=o,n[12]=l,n[13]=_):_=n[13];let v=h===void 0?void 0:`${h}px`,y;n[14]!==u||n[15]!==v?(y={paddingLeft:v,...u},n[14]=u,n[15]=v,n[16]=y):y=n[16];let b;return n[17]!==g||n[18]!==s||n[19]!==t||n[20]!==_||n[21]!==y?(b=(0,J.jsx)(g,{ref:t,className:_,style:y,...s}),n[17]=g,n[18]=s,n[19]=t,n[20]=_,n[21]=y,n[22]=b):b=n[22],b});be.displayName=`StandardListItem`;function xe(e){if(!e)return`Unknown Model`;let t=(e.split(`/`).filter(Boolean).pop()??e).replace(/[-_]+/g,` `).trim();return t?t.split(/\s+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):e}var Se=`Separator`,Ce=`horizontal`,we=[`horizontal`,`vertical`],Te=q.forwardRef((e,t)=>{let{decorative:n,orientation:r=Ce,...i}=e,a=Ee(r)?r:Ce,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,J.jsx)(A.div,{"data-orientation":a,...o,...i,ref:t})});Te.displayName=Se;function Ee(e){return we.includes(e)}var De=Te,Oe=q.forwardRef((e,t)=>{let n=(0,K.c)(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:r,orientation:a,decorative:o,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=a===void 0?`horizontal`:a,l=o===void 0?!0:o,u=s===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,d;n[5]!==r||n[6]!==u?(d=c(`shrink-0 bg-border`,u,r),n[5]=r,n[6]=u,n[7]=d):d=n[7];let f;return n[8]!==l||n[9]!==s||n[10]!==i||n[11]!==t||n[12]!==d?(f=(0,J.jsx)(De,{ref:t,decorative:l,orientation:s,className:d,...i}),n[8]=l,n[9]=s,n[10]=i,n[11]=t,n[12]=d,n[13]=f):f=n[13],f});Oe.displayName=De.displayName;function ke(e){return`${e.slug.toUpperCase().replace(/-/g,`_`)}_API_URL`}function Ae(e){let t=e.env??[];return t.find(e=>/resource_name$/i.test(e))??t[0]??``}function je(e){if(e.apiKeyEnv)return e.apiKeyEnv;if(e.keyName)return e.keyName;let t=e.env??[];return t.find(e=>/api_key$/i.test(e))??t[t.length-1]??``}function Me(e){let t=je(e);return(e.env??[]).filter(e=>e!==t)}function Ne(e){return e===`LOCAL_API_URL`?`URL`:e.replace(/^AZURE_/,``).replace(/_/g,` `).toLowerCase().replace(/\b\w/g,e=>e.toUpperCase())}function Pe(e,t){let n=ke(e),r=t[n]??e.envValues?.[n]??``;if(r)return r;if(e.slug===`azure`){let n=Ae(e),r=t[n]??e.envValues?.[n]??``;if(r)return`https://${r}.openai.azure.com/openai/v1`}return N(e.slug)?se({...e.envValues,...t}):e.api.replace(/\$\{([A-Z0-9_]+)\}/gi,(n,r)=>t[r]??e.envValues?.[r]??``)}function Fe(e){return e.slug.toLowerCase()===`openrouter`||e.name.toLowerCase()===`openrouter`}function Ie(e){return{recommended:e.find(Fe)??null,others:e.filter(e=>!Fe(e)).sort((e,t)=>e.name.localeCompare(t.name))}}function Le(e){let{recommended:t,others:n}=Ie(e);return t??n[0]??null}function Re(e){try{let t=new URL(e),n=t.hostname.split(`.`),r=n.length<=2?t.hostname:n.slice(-2).join(`.`);return`${t.protocol}//${r}`}catch{return e}}var ze=f(`app.provider-selector.ui`);function Be(e){let t=(0,K.c)(17),{url:n,className:r,children:i,showIcon:a,variant:o}=e,s=a===void 0?!0:a,l=o===void 0?`link`:o,u;t[0]===n?u=t[1]:(u=Re(n),t[0]=n,t[1]=u);let d=u,f;t[2]===d?f=t[3]:(f=async function(e){e.preventDefault(),e.stopPropagation();try{await B(d)}catch(e){let t=e;ze.error(`Failed to open provider website:`,t)}},t[2]=d,t[3]=f);let p=f,m=l===`link`&&L.caption,h=l===`link`&&`text-brand hover:underline inline-flex items-center gap-1`,g=l===`inline`&&`inline hover:underline`,_;t[4]!==r||t[5]!==m||t[6]!==h||t[7]!==g?(_=c(m,h,g,r),t[4]=r,t[5]=m,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v;t[9]!==i||t[10]!==s?(v=i??(0,J.jsxs)(J.Fragment,{children:[`Visit provider website`,s&&(0,J.jsx)(P,{className:`h-3.5 w-3.5`})]}),t[9]=i,t[10]=s,t[11]=v):v=t[11];let y;return t[12]!==p||t[13]!==d||t[14]!==_||t[15]!==v?(y=(0,J.jsx)(`a`,{href:d,onClick:p,className:_,children:v}),t[12]=p,t[13]=d,t[14]=_,t[15]=v,t[16]=y):y=t[16],y}function Ve(e){let t=(0,K.c)(10),{provider:n,size:r}=e,i=r===void 0?`md`:r,[a,o]=(0,q.useState)(!1),s=i===`sm`?`h-6 w-6`:`h-8 w-8`,l=i===`sm`?`h-4 w-4`:`h-5 w-5`,u=i===`sm`?`h-4 w-4`:`h-5 w-5`,d;t[0]===s?d=t[1]:(d=c(`flex-shrink-0 rounded-full bg-muted flex items-center justify-center overflow-hidden`,s),t[0]=s,t[1]=d);let f;t[2]!==u||t[3]!==l||t[4]!==a||t[5]!==n?(f=a?(0,J.jsx)(de,{className:c(u,`text-muted-foreground`)}):(0,J.jsx)(`img`,{src:ae(n.slug),alt:`${n.name} logo`,className:c(l,`dark:invert`),onError:()=>o(!0)}),t[2]=u,t[3]=l,t[4]=a,t[5]=n,t[6]=f):f=t[6];let p;return t[7]!==d||t[8]!==f?(p=(0,J.jsx)(`div`,{className:d,children:f}),t[7]=d,t[8]=f,t[9]=p):p=t[9],p}function He(e){let t=(0,K.c)(10),{provider:n,recommended:r}=e,i=r===void 0?!1:r,a;t[0]===n?a=t[1]:(a=(0,J.jsx)(Ve,{provider:n,size:`sm`}),t[0]=n,t[1]=a);let o;t[2]===n.name?o=t[3]:(o=(0,J.jsx)(`span`,{className:`truncate`,children:n.name}),t[2]=n.name,t[3]=o);let s;t[4]===i?s=t[5]:(s=i&&(0,J.jsx)(`span`,{className:c(L.caption,`text-muted-foreground flex-shrink-0`),children:`(Recommended)`}),t[4]=i,t[5]=s);let l;return t[6]!==a||t[7]!==o||t[8]!==s?(l=(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9],l}function Ue(e){let t=(0,K.c)(8),{providers:n}=e,r,i,a;if(t[0]!==n){let{recommended:e,others:o}=Ie(n);r=e&&(0,J.jsx)(ye,{value:e.name,children:(0,J.jsx)(He,{provider:e,recommended:!0})},e.name),i=e&&o.length>0&&(0,J.jsx)(ve,{}),a=o.map(We),t[0]=n,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];let o;return t[4]!==r||t[5]!==i||t[6]!==a?(o=(0,J.jsxs)(J.Fragment,{children:[r,i,a]}),t[4]=r,t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function We(e){return(0,J.jsx)(ye,{value:e.name,children:(0,J.jsx)(He,{provider:e})},e.name)}function Ge(e){let t=(0,K.c)(17),{providers:n,selectedProvider:r,onProviderChange:i}=e,a,o,s,l;if(t[0]!==i||t[1]!==n||t[2]!==r?.name){let{recommended:e,others:u}=Ie(n),d;t[7]!==i||t[8]!==r?.name?(d=function(e,t){let n=t===void 0?!1:t;return(0,J.jsx)(be,{selected:r?.name===e.name,asChild:!0,children:(0,J.jsxs)(`button`,{type:`button`,className:`justify-start w-full`,onClick:()=>i(e),children:[(0,J.jsx)(Ve,{provider:e}),(0,J.jsx)(`span`,{className:`truncate`,children:e.name}),n&&(0,J.jsx)(`span`,{className:c(L.caption,`text-muted-foreground flex-shrink-0`),children:`(Recommended)`})]})},e.name)},t[7]=i,t[8]=r?.name,t[9]=d):d=t[9];let f=d;a=`space-y-1`,o=e&&f(e,!0),s=e&&u.length>0&&(0,J.jsx)(Oe,{className:`my-2`});let p;t[10]===f?p=t[11]:(p=e=>f(e),t[10]=f,t[11]=p),l=u.map(p),t[0]=i,t[1]=n,t[2]=r?.name,t[3]=a,t[4]=o,t[5]=s,t[6]=l}else a=t[3],o=t[4],s=t[5],l=t[6];let u;return t[12]!==a||t[13]!==o||t[14]!==s||t[15]!==l?(u=(0,J.jsxs)(`div`,{className:a,children:[o,s,l]}),t[12]=a,t[13]=o,t[14]=s,t[15]=l,t[16]=u):u=t[16],u}function Ke({selectedProvider:e,onProviderChange:t,showApiKeyInput:i=!0,apiKey:a,onApiKeyChange:o,isLoading:s,error:c,variant:l=`dropdown`}){let[u,d]=(0,q.useState)([]),[f,p]=(0,q.useState)(!1);if((0,q.useEffect)(()=>{(async()=>{p(!0);try{let r=await n();if(d(r),r.length>0&&!e){let e=Le(r);e&&t(e)}}catch(e){ze.error(`Failed to load providers:`,e)}finally{p(!1)}})()},[e,t]),f)return(0,J.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,J.jsx)(r,{className:`h-4 w-4 animate-spin text-muted-foreground`})});let m=(0,J.jsxs)(J.Fragment,{children:[e?.url&&(0,J.jsx)(Be,{url:e.url}),i&&e&&(0,J.jsx)(qe,{provider:e,value:a??e.apiKey??``,onChange:o,isLoading:s})]});return l===`list`?(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&(0,J.jsx)(`p`,{className:L.error,children:c}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(j,{children:`AI Provider`}),(0,J.jsx)(Ge,{providers:u,selectedProvider:e,onProviderChange:t})]}),m]}):(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&(0,J.jsx)(`p`,{className:L.error,children:c}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(j,{children:`AI Provider`}),(0,J.jsxs)(he,{value:e?.name??``,onValueChange:e=>{let n=u.find(t=>t.name===e);n&&t(n)},children:[(0,J.jsx)(_e,{children:e?(0,J.jsx)(He,{provider:e}):`Select a provider`}),(0,J.jsx)(ge,{children:(0,J.jsx)(Ue,{providers:u})})]})]}),m]})}function qe(e){let t=(0,K.c)(24),{provider:n,value:r,onChange:a,isLoading:o}=e,[s,c]=(0,q.useState)(!1);if(n.authType!==`APIKey`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(G,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),t[0]=e):e=t[0];let r;return t[1]===n.name?r=t[2]:(r=(0,J.jsxs)(`div`,{className:`space-y-2 text-center`,children:[e,(0,J.jsxs)(v,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]}),t[1]=n.name,t[2]=r),r}let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,J.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,J.jsx)(U,{children:(0,J.jsxs)(m,{children:[(0,J.jsx)(i,{asChild:!0,children:(0,J.jsx)(j,{htmlFor:`api-key`,className:`cursor-help`,children:`API Key`})}),(0,J.jsx)(x,{children:`Your API key is stored locally and never shared.`})]})})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(O,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),t[4]=u):u=t[4];let d=s?`text`:`password`,f=n.keyName??`Enter API Key`,p;t[5]===a?p=t[6]:(p=e=>a?.(e.target.value),t[5]=a,t[6]=p);let h;t[7]!==o||t[8]!==d||t[9]!==f||t[10]!==p||t[11]!==r?(h=(0,J.jsx)(M,{id:`api-key`,type:d,placeholder:f,className:`pl-10 pr-10`,value:r,onChange:p,disabled:o}),t[7]=o,t[8]=d,t[9]=f,t[10]=p,t[11]=r,t[12]=h):h=t[12];let g;t[13]===s?g=t[14]:(g=()=>c(!s),t[13]=s,t[14]=g);let _=(o??!1)||!r,y;t[15]===s?y=t[16]:(y=s?(0,J.jsx)(pe,{className:`h-4 w-4 text-muted-foreground`}):(0,J.jsx)(ue,{className:`h-4 w-4 text-muted-foreground`}),t[15]=s,t[16]=y);let b;t[17]!==g||t[18]!==_||t[19]!==y?(b=(0,J.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:g,disabled:_,children:y}),t[17]=g,t[18]=_,t[19]=y,t[20]=b):b=t[20];let S;return t[21]!==b||t[22]!==h?(S=(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,(0,J.jsxs)(`div`,{className:`relative`,children:[u,h,b]})]}),t[21]=b,t[22]=h,t[23]=S):S=t[23],S}var Y=`Checkbox`,[Je,Ye]=h(Y),[Xe,Ze]=Je(Y);function Qe(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ie({prop:n,defaultProp:i??!1,onChange:c,caller:Y}),[m,h]=q.useState(null),[g,_]=q.useState(null),v=q.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:X(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,J.jsx)(Xe,{scope:t,...b,children:ot(d)?d(b):r})}var $e=`CheckboxTrigger`,et=q.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Ze($e,e),h=E(i,u),_=q.useRef(c);return q.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,J.jsx)(w.button,{type:`button`,role:`checkbox`,"aria-checked":X(c)?`mixed`:c,"aria-required":l,"data-state":st(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:g(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:g(n,e=>{d(e=>X(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});et.displayName=$e;var tt=q.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,J.jsx)(Qe,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(et,{...d,ref:t,__scopeCheckbox:n}),e&&(0,J.jsx)(at,{__scopeCheckbox:n})]})})});tt.displayName=Y;var nt=`CheckboxIndicator`,rt=q.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ze(nt,n);return(0,J.jsx)(le,{present:r||X(a.checked)||a.checked===!0,children:(0,J.jsx)(w.span,{"data-state":st(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});rt.displayName=nt;var it=`CheckboxBubbleInput`,at=q.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:f,bubbleInput:p,setBubbleInput:m}=Ze(it,e),h=E(n,m),g=me(a),_=d(r);q.useEffect(()=>{let e=p;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(g!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=X(a),n.call(e,X(a)?!1:a),e.dispatchEvent(t)}},[p,g,a,i]);let v=q.useRef(X(a)?!1:a);return(0,J.jsx)(w.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:f,...t,tabIndex:-1,ref:h,style:{...t.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});at.displayName=it;function ot(e){return typeof e==`function`}function X(e){return e===`indeterminate`}function st(e){return X(e)?`indeterminate`:e?`checked`:`unchecked`}var Z=q.forwardRef((e,t)=>{let n=(0,K.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=c(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(rt,{className:c(`flex items-center justify-center text-current`),children:(0,J.jsx)(l,{className:`h-4 w-4`})}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,J.jsx)(tt,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Z.displayName=tt.displayName;function ct(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function lt(e){return[xe(e.id),e.name,ct(e.name)]}function ut(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return lt(e).some(e=>n.has(e.toLowerCase()))}function dt(e,t){return e.filter(e=>ut(e,t)).map(e=>e.id)}function ft(e){return e==null?0:e<20?1:e<30?2:e<40?3:e<50?4:5}function Q(e){return e.pricing?((e.pricing.prompt??0)+(e.pricing.completion??0))/2:null}function pt(e,t,n){let r=t.toLowerCase(),i=n(e);return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)||i.toLowerCase().includes(r)}function mt(e){return e.pricing?.prompt===0&&e.pricing?.completion===0}function ht(e,t,n){let{sortBy:r,getDisplayName:i,getPriority:a,groupByProvider:o}=n;if(o){let n=(e.provider??``).toLowerCase(),r=(t.provider??``).toLowerCase();if(n!==r)return n.localeCompare(r)}if(a){let n=a(e),r=a(t);if(n!==r)return n-r}if(r===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:(Q(e)??0)-(Q(t)??0):n?-1:1}if(r===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=Q(e)??0;return(Q(t)??0)-r}if(r===`coding-index`){let n=e.coding_index!==void 0&&e.coding_index!==null;return n===(t.coding_index!==void 0&&t.coding_index!==null)?e.coding_index==null||t.coding_index==null?0:t.coding_index-e.coding_index:n?-1:1}if(r===`intelligence-by-price`){let n=ft(e.coding_index),r=ft(t.coding_index),i=n>0;if(i!==r>0)return i?-1:1;if(r!==n)return r-n;let a=Q(e),o=Q(t),s=a!==null;return s===(o!==null)?a===null||o===null?0:a-o:s?-1:1}return i(e).localeCompare(i(t))}function gt(e){let{models:t,query:n,sortBy:r,getDisplayName:i,getPriority:a,freeOnly:o,groupByProvider:s}=e;return t.filter(e=>!(!pt(e,n,i)||o&&!mt(e))).sort((e,t)=>ht(e,t,{sortBy:r,getDisplayName:i,getPriority:a,groupByProvider:s}))}function _t(e,t,n){let r=new Map(e),i=n.has(t),a=r.has(t),o=r.get(t),s=!(a?o:i);return s===i?r.delete(t):r.set(t,s),r}var vt=W(e=>(0,J.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:e.v0}),{name:`ModelSelector_1`,portals:[`v0`]}),yt=W(e=>(0,J.jsx)(`div`,{className:`text-center py-8`,children:(0,J.jsx)(`p`,{className:e.v0,children:`No models available for this provider.`})}),{name:`ModelSelector_2`}),bt=W(e=>(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsxs)(`div`,{className:e.v0,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.v1,(0,J.jsx)(`label`,{htmlFor:`select-all-models`,className:e.v2,children:`Select all models`})]}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,J.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[e.v3,e.v4]}),e.v5]})]}),e.v6]}),{name:`ModelSelector_3`,portals:[`v1`,`v3`,`v4`,`v5`,`v6`]}),xt=function({provider:e,onModelsChange:t,isLoading:n,disabled:a,displayMode:s=`grid`,autoSelectRecommended:l=!1}){let[u,d]=(0,q.useState)([]),[f,h]=(0,q.useState)(new Set),[g,_]=(0,q.useState)(new Set),[v,y]=(0,q.useState)(new Map),[b,S]=(0,q.useState)(!1),[w,T]=(0,q.useState)(``),[E,D]=(0,q.useState)(`alphabetical`);(0,q.useEffect)(()=>{O()},[e]);let O=async()=>{S(!0),T(``),D(`alphabetical`);try{let t=await o(e);d(t.models);let n=new Set(t.enabledModelIds);h(n);let r=new Map,i=new Set;if(l)try{let{models:e}=await re();i=new Set(dt(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){St.error(`Failed to load recommended models:`,e)}_(i),y(r),A(n,r,t.models)}catch(t){St.error(`Failed to load models for ${e}:`,t),d([]),h(new Set),_(new Set)}finally{S(!1)}},A=(e,n,r=u)=>{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)},j=e=>{y(t=>{let n=_t(t,e,f);return A(f,n),n})},N=e=>{y(t=>{let n=new Map(t);return u.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)}),A(f,n),n})},P=e=>xe(e.id);function F(e,t=v){let n=t.has(e),r=t.get(e);return n?!!r:f.has(e)}let I=gt({models:u,query:w,sortBy:E,getDisplayName:P,getPriority:e=>+!F(e.id)}),te=E===`alphabetical`?`alphabetical`:`price`;function R(e){if(e===`alphabetical`){D(`alphabetical`);return}e===`price`&&D(`price-low`)}function ne(){E!==`alphabetical`&&D(e=>e===`price-low`?`price-high`:`price-low`)}return b||n?(0,J.jsx)(vt,{v0:(0,J.jsx)(r,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):u.length===0?(0,J.jsx)(yt,{v0:L.bodyMuted}):s===`compact`?(0,J.jsx)(bt,{v0:c(`flex items-center justify-between gap-3`,a&&`opacity-25`),v1:(0,J.jsx)(Z,{id:`select-all-models`,disabled:a,checked:u.every(e=>F(e.id)),onCheckedChange:e=>N(e===!0)}),v2:c(L.body,`cursor-pointer`),v3:(0,J.jsx)(ee,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),v4:(0,J.jsx)(M,{placeholder:`Search models...`,value:w,onChange:e=>T(e.target.value),disabled:a,className:`pl-8 h-9`}),v5:(0,J.jsxs)(z,{type:`single`,value:te,onValueChange:R,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,J.jsx)(V,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:a,className:Ct,children:(0,J.jsx)(k,{className:`h-4 w-4`})}),(0,J.jsx)(V,{value:`price`,"aria-label":`Sort by price`,disabled:a,className:Ct,onClick:ne,children:(0,J.jsx)(C,{className:`h-4 w-4`})})]}),v6:(0,J.jsx)(U,{children:(0,J.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:I.length===0?(0,J.jsx)(`div`,{className:`text-center py-4`,children:(0,J.jsx)(`p`,{className:L.bodyMuted,children:w?`No models match your search.`:`No models available.`})}):I.map(e=>{let t=F(e.id),n=e.pricing,r=t&&g.has(e.id);return(0,J.jsxs)(m,{children:[(0,J.jsx)(i,{asChild:!0,children:(0,J.jsxs)(`div`,{className:c(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,a&&`opacity-25`),children:[(0,J.jsx)(Z,{id:e.id,disabled:a,checked:t??!1,onCheckedChange:()=>j(e.id),className:`mt-0`}),(0,J.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,J.jsxs)(`label`,{htmlFor:e.id,className:c(L.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[P(e),r&&(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,J.jsx)(`span`,{className:c(L.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${p(n.prompt??0)} in | ${p(n.completion??0)} out`})]})]})}),e.description&&(0,J.jsx)(x,{side:`top`,className:`max-w-xs`,children:(0,J.jsx)(`p`,{className:L.body,children:e.description})})]},e.id)})})})}):null},St=f(`app.model-selector.ui`),Ct=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,wt=t({OnboardingDialog:()=>Tt,default:()=>Tt}),$=f(`app.onboarding-dialog.ui`);function Tt({open:e,onOpenChange:t,onComplete:i}){let[u,d]=(0,q.useState)(`git-check`),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)([]),[y,x]=(0,q.useState)(null),[C,w]=(0,q.useState)(``),[E,D]=(0,q.useState)({}),[O,k]=(0,q.useState)(!1),[A,M]=(0,q.useState)(``),[ee,re]=(0,q.useState)(new Set),[ie,ae]=(0,q.useState)(!1),[z,B]=(0,q.useState)(!1);(0,q.useEffect)(()=>{e&&u===`git-check`&&se()},[e,u]),(0,q.useEffect)(()=>{e&&u===`provider-selection`&&g.length===0&&V()},[e,u,g.length]),(0,q.useEffect)(()=>{e&&u===`model-selection`&&y&&le()},[e,u,y]);let se=async()=>{h(!0);try{let e=await te();p(e.gitInstalled),e.gitInstalled&&d(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),p(!1)}finally{h(!1)}},V=async()=>{try{let e=await n();if(_(e),e.length>0&&!y){let t=Le(e);t&&(x(t),w(t.apiKey??``),D(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},le=async()=>{if(y){ae(!0);try{await o(y.name),re(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{ae(!1)}}},ue=async()=>{if(!y||!C.trim()){M(`Please enter an API key`);return}let e=Me(y),t=e.find(e=>!E[e]?.trim());if(t){M(`Please enter ${Ne(t)}`);return}k(!0),M(``);try{e.length>0&&await S(Object.fromEntries(e.map(e=>[e,E[e].trim()]))),await a(y.slug,C),d(`model-selection`)}catch(e){M(e instanceof Error?e.message:`Failed to validate API key`)}finally{k(!1)}},de=async()=>{if(y){B(!0);try{for(let e of ee)await T(y.slug,e);await fe(),i?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{B(!1)}}},pe=async()=>{B(!0);try{await fe(),i?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{B(!1)}},U=e=>{x(e),w(e.apiKey??``),D(e.envValues??{}),M(``)},W=(e,t)=>{D(n=>({...n,[e]:t}))};return(0,J.jsx)(b,{open:e,onOpenChange:t,children:(0,J.jsxs)(I,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,J.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[(0,J.jsx)(`div`,{className:c(`flex items-center justify-center h-8 w-8 rounded-full`,L.label,u===`git-check`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`1`}),(0,J.jsx)(`div`,{className:c(`h-0.5 flex-1`,u===`provider-selection`||u===`model-selection`?`bg-primary`:`bg-muted`)}),(0,J.jsx)(`div`,{className:c(`flex items-center justify-center h-8 w-8 rounded-full`,L.label,u===`provider-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`2`}),(0,J.jsx)(`div`,{className:c(`h-0.5 flex-1`,u===`model-selection`?`bg-primary`:`bg-muted`)}),(0,J.jsx)(`div`,{className:c(`flex items-center justify-center h-8 w-8 rounded-full`,L.label,u===`model-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`3`})]}),(0,J.jsxs)(ce,{children:[u===`git-check`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(R,{children:`Let's get started`}),(0,J.jsx)(H,{children:`First, we need to check that Git is installed on your system.`})]}),u===`provider-selection`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(R,{children:`Select an AI Provider`}),(0,J.jsx)(H,{children:`Choose your preferred AI provider and enter your API key.`})]}),u===`model-selection`&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(R,{children:`Select Models`}),(0,J.jsx)(H,{children:`Choose which models you want to use with this provider.`})]})]})]}),(0,J.jsx)(F,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,J.jsxs)(`div`,{className:`px-6 py-4`,children:[u===`git-check`&&(0,J.jsx)(`div`,{className:`space-y-4`,children:m?(0,J.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,J.jsx)(r,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):f?(0,J.jsxs)(G,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,J.jsx)(l,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:c(L.label,`text-green-900`),children:`Git is installed`}),(0,J.jsx)(`p`,{className:L.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}):(0,J.jsxs)(G,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[(0,J.jsx)(ne,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),(0,J.jsxs)(`div`,{className:`flex-1`,children:[(0,J.jsx)(`p`,{className:L.label,children:`Git is not installed`}),(0,J.jsx)(`p`,{className:L.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),(0,J.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:c(L.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),children:[`Download Git `,(0,J.jsx)(P,{className:`h-3 w-3`})]})]})]})}),u===`provider-selection`&&(0,J.jsxs)(`div`,{className:`space-y-4`,children:[(0,J.jsx)(Ke,{selectedProvider:y,onProviderChange:U,showApiKeyInput:!0,apiKey:C,onApiKeyChange:w,variant:`dropdown`,isLoading:O}),y&&Me(y).map(e=>(0,J.jsxs)(`div`,{className:`space-y-2`,children:[(0,J.jsx)(j,{htmlFor:e,children:Ne(e)}),(0,J.jsx)(`input`,{id:e,value:E[e]??``,onChange:t=>W(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:N(y.slug)&&e===`LOCAL_API_URL`?y.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),y.slug===`azure`&&e===Ae(y)||N(y.slug)&&e===`LOCAL_API_URL`?(0,J.jsx)(`p`,{className:c(L.bodyMuted,`break-all`),children:Pe(y,E)||y.api}):null]},e)),A&&(0,J.jsx)(G,{variant:`error`,className:`mb-0`,children:A})]}),u===`model-selection`&&y&&(0,J.jsx)(`div`,{className:`space-y-4`,children:(0,J.jsx)(xt,{provider:y.slug,isLoading:ie,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:re})})]})}),(0,J.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,J.jsxs)(oe,{className:`flex items-center justify-between`,children:[(0,J.jsx)(`div`,{children:u===`provider-selection`&&(0,J.jsx)(v,{variant:`ghost`,onClick:()=>pe(),disabled:z,children:`Skip for now`})}),(0,J.jsxs)(`div`,{className:`flex gap-3`,children:[u!==`git-check`&&(0,J.jsx)(v,{variant:`outline`,onClick:()=>{u===`provider-selection`?d(`git-check`):u===`model-selection`&&d(`provider-selection`)},disabled:z,children:`Back`}),u===`git-check`&&(0,J.jsxs)(v,{onClick:()=>{d(`provider-selection`)},disabled:m,className:`gap-2`,children:[`Continue `,(0,J.jsx)(s,{className:`h-4 w-4`})]}),u===`provider-selection`&&(0,J.jsx)(v,{onClick:ue,disabled:O||!C.trim()||!y,className:`gap-2`,children:O?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,J.jsxs)(J.Fragment,{children:[`Next `,(0,J.jsx)(s,{className:`h-4 w-4`})]})}),u===`model-selection`&&(0,J.jsx)(v,{onClick:de,disabled:z,className:`gap-2`,children:z?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(r,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,J.jsxs)(J.Fragment,{children:[`Finish `,(0,J.jsx)(l,{className:`h-4 w-4`})]})})]})]})})]})})}export{Z as a,Me as c,be as d,_t as i,Oe as l,gt as n,Be as o,ft as r,Ne as s,wt as t,xe as u};
@@ -1 +0,0 @@
1
- import{Ba as e,Br as ee,Lr as t,Ns as n,Pi as r,Ps as i,Qr as te,Rr as a,Yr as o,Zr as ne,aa as s,ei as c,fs as l,ii as u,ni as d,ri as f,ti as p,zr as re}from"./dialogs-config-DAMqiy-4.js";import{a as ie}from"./onboarding-dys9Rwb5.js";import{H as ae}from"./index-C_iiobDl.js";var m=i(),h=n();function g(n){let i=(0,m.c)(54),{open:g,onOpenChange:_,prTitle:v,onPrTitleChange:y,prDescription:b,onPrDescriptionChange:x,isGeneratingPRInfo:S,isLoading:C,onGeneratePRInfo:w,onCreatePR:T,currentBranch:E,autoGeneratePRInfo:D,onAutoGeneratePRInfoChange:O}=n,k;i[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,h.jsx)(u,{children:`Create Pull Request`}),i[0]=k):k=i[0];let A;i[1]===E?A=i[2]:(A=(0,h.jsxs)(f,{children:[k,(0,h.jsxs)(p,{children:[`Create a pull request for branch `,E]})]}),i[1]=E,i[2]=A);let j;i[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(o,{htmlFor:`pr-title`,children:`Title`}),i[3]=j):j=i[3];let M=E||`Enter PR title...`,N;i[4]===y?N=i[5]:(N=e=>y(e.target.value),i[4]=y,i[5]=N);let P;i[6]!==v||i[7]!==M||i[8]!==N?(P=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(ne,{id:`pr-title`,placeholder:M,value:v,onChange:N})]}),i[6]=v,i[7]=M,i[8]=N,i[9]=P):P=i[9];let F;i[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsx)(o,{htmlFor:`pr-description`,children:`Description`}),i[10]=F):F=i[10];let I;i[11]===x?I=i[12]:(I=e=>x(e.target.value),i[11]=x,i[12]=I);let L;i[13]!==b||i[14]!==I?(L=(0,h.jsx)(ae,{id:`pr-description`,placeholder:`Enter PR description...`,value:b,onChange:I,className:`pr-10 h-full min-h-[14rem] resize-none`}),i[13]=b,i[14]=I,i[15]=L):L=i[15];let R=S||C,z;i[16]===S?z=i[17]:(z=S?(0,h.jsx)(e,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(s,{className:`h-3.5 w-3.5`}),i[16]=S,i[17]=z);let B;i[18]!==w||i[19]!==R||i[20]!==z?(B=(0,h.jsx)(ee,{asChild:!0,children:(0,h.jsx)(r,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:w,disabled:R,children:z})}),i[18]=w,i[19]=R,i[20]=z,i[21]=B):B=i[21];let V=S?`Generating PR description...`:`Generate PR title and description with AI`,H;i[22]===V?H=i[23]:(H=(0,h.jsx)(a,{children:V}),i[22]=V,i[23]=H);let U;i[24]!==B||i[25]!==H?(U=(0,h.jsx)(re,{children:(0,h.jsxs)(t,{children:[B,H]})}),i[24]=B,i[25]=H,i[26]=U):U=i[26];let W;i[27]!==U||i[28]!==L?(W=(0,h.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[F,(0,h.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[L,U]})]}),i[27]=U,i[28]=L,i[29]=W):W=i[29];let G;i[30]!==W||i[31]!==P?(G=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[P,W]}),i[30]=W,i[31]=P,i[32]=G):G=i[32];let K;i[33]===O?K=i[34]:(K=e=>O(e===!0),i[33]=O,i[34]=K);let q;i[35]!==D||i[36]!==K?(q=(0,h.jsx)(ie,{id:`auto-generate-pr`,checked:D,onCheckedChange:K}),i[35]=D,i[36]=K,i[37]=q):q=i[37];let J;i[38]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,h.jsx)(o,{htmlFor:`auto-generate-pr`,className:l.labelNormal,children:`Auto generate PR title and description`}),i[38]=J):J=i[38];let Y;i[39]===q?Y=i[40]:(Y=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,J]}),i[39]=q,i[40]=Y);let X=C?`Creating...`:`Create PR`,Z;i[41]!==C||i[42]!==T||i[43]!==X?(Z=(0,h.jsx)(d,{children:(0,h.jsx)(r,{onClick:T,disabled:C,children:X})}),i[41]=C,i[42]=T,i[43]=X,i[44]=Z):Z=i[44];let Q;i[45]!==G||i[46]!==A||i[47]!==Y||i[48]!==Z?(Q=(0,h.jsxs)(c,{className:`flex max-w-2xl flex-col 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:overflow-y-auto 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:h-[min(36rem,85dvh)]`,children:[A,G,Y,Z]}),i[45]=G,i[46]=A,i[47]=Y,i[48]=Z,i[49]=Q):Q=i[49];let $;return i[50]!==_||i[51]!==g||i[52]!==Q?($=(0,h.jsx)(te,{open:g,onOpenChange:_,children:Q}),i[50]=_,i[51]=g,i[52]=Q,i[53]=$):$=i[53],$}export{g as PullRequestDialog};
@@ -1 +0,0 @@
1
- import{Ns as e,Pi as t,Ps as n,Qa as r,Qr as i,Zi as a,ei as o,fs as s,ii as c,ja as l,ni as u,ri as d,ti as f}from"./dialogs-config-DAMqiy-4.js";import{x as p}from"./history-view-lvvTzW7O.js";var m=n(),h=e();function g(e){let n=(0,m.c)(27),{open:g,onOpenChange:_,onCommitFirst:v,onStashAndPull:y,onCancel:b,isLoading:x}=e,S=x===void 0?!1:x,C;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,h.jsxs)(d,{children:[(0,h.jsxs)(c,{className:`flex items-center gap-2`,children:[(0,h.jsx)(a,{className:`h-5 w-5 text-amber-500`}),`Uncommitted Changes Detected`]}),(0,h.jsx)(f,{children:`You have uncommitted changes. You need to handle them before pulling from the remote branch.`})]}),n[0]=C):C=n[0];let w;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,h.jsx)(`div`,{className:s.bodyMuted,children:`Choose how you want to proceed:`}),n[1]=w):w=n[1];let T;n[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,h.jsx)(r,{className:`h-4 w-4 mr-2`}),n[2]=T):T=n[2];let E;n[3]!==S||n[4]!==v?(E=(0,h.jsxs)(t,{onClick:v,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[T,`Commit changes first, then pull`]}),n[3]=S,n[4]=v,n[5]=E):E=n[5];let D;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsx)(l,{className:`h-4 w-4 mr-2`}),n[6]=D):D=n[6];let O;n[7]!==S||n[8]!==y?(O=(0,h.jsxs)(t,{onClick:y,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[D,`Stash changes → Pull → Restore changes`]}),n[7]=S,n[8]=y,n[9]=O):O=n[9];let k;n[10]!==E||n[11]!==O?(k=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[E,O]}),n[10]=E,n[11]=O,n[12]=k):k=n[12];let A;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,h.jsx)(`strong`,{children:`Commit first:`}),n[13]=A):A=n[13];let j;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsxs)(p,{variant:`hint`,className:`mt-4 mb-0`,children:[A,` Safe option, preserves changes in your commit history.`,(0,h.jsx)(`br`,{}),(0,h.jsx)(`strong`,{children:`Stash and pull:`}),` Temporary option, changes will be restored after pulling.`]}),n[14]=j):j=n[14];let M;n[15]===k?M=n[16]:(M=(0,h.jsx)(`div`,{className:`py-4`,children:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[w,k,j]})}),n[15]=k,n[16]=M);let N;n[17]!==S||n[18]!==b?(N=(0,h.jsx)(u,{children:(0,h.jsx)(t,{variant:`ghost`,onClick:b,disabled:S,children:`Cancel`})}),n[17]=S,n[18]=b,n[19]=N):N=n[19];let P;n[20]!==M||n[21]!==N?(P=(0,h.jsxs)(o,{className:`sm:max-w-[425px]`,children:[C,M,N]}),n[20]=M,n[21]=N,n[22]=P):P=n[22];let F;return n[23]!==_||n[24]!==g||n[25]!==P?(F=(0,h.jsx)(i,{open:g,onOpenChange:_,children:P}),n[23]=_,n[24]=g,n[25]=P,n[26]=F):F=n[26],F}export{g as PullWithChangesDialog};
@@ -1 +0,0 @@
1
- import{Ns as e,Pi as t,Ps as n,Qr as r,ei as i,ii as a,ni as o,ri as s,ti as c}from"./dialogs-config-DAMqiy-4.js";var l=n(),u=e();function d(e){let n=(0,l.c)(15),{open:d,onOpenChange:f,isLoading:p,onPushAndCreatePR:m,onCancel:h}=e,g;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,u.jsxs)(s,{children:[(0,u.jsx)(a,{children:`Push Branch First`}),(0,u.jsx)(c,{children:`Your branch needs to be pushed to the remote before creating a pull request. Would you like to push it now?`})]}),n[0]=g):g=n[0];let _;n[1]!==p||n[2]!==h?(_=(0,u.jsx)(t,{variant:`outline`,onClick:h,disabled:p,children:`Cancel`}),n[1]=p,n[2]=h,n[3]=_):_=n[3];let v=p?`Pushing...`:`Push & Create PR`,y;n[4]!==p||n[5]!==m||n[6]!==v?(y=(0,u.jsx)(t,{onClick:m,disabled:p,children:v}),n[4]=p,n[5]=m,n[6]=v,n[7]=y):y=n[7];let b;n[8]!==_||n[9]!==y?(b=(0,u.jsxs)(i,{children:[g,(0,u.jsxs)(o,{children:[_,y]})]}),n[8]=_,n[9]=y,n[10]=b):b=n[10];let x;return n[11]!==f||n[12]!==d||n[13]!==b?(x=(0,u.jsx)(r,{open:d,onOpenChange:f,children:b}),n[11]=f,n[12]=d,n[13]=b,n[14]=x):x=n[14],x}export{d as PushBeforePRDialog};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Do as t,Ii as n,Is as r,Ns as i,Ps as a}from"./dialogs-config-DAMqiy-4.js";import{_ as o,v as s,y as c}from"./react-vendor-U9lUQswz.js";var l=a(),u=e(r(),1),d=i(),f=u.forwardRef((e,t)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`grid gap-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,d.jsx)(c,{className:o,...a,ref:t}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});f.displayName=c.displayName;var p=u.forwardRef((e,r)=>{let i=(0,l.c)(10),a,c;i[0]===e?(a=i[1],c=i[2]):({className:a,...c}=e,i[0]=e,i[1]=a,i[2]=c);let u;i[3]===a?u=i[4]:(u=n(`aspect-square h-4 w-4 rounded-full border border-brand text-brand ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,a),i[3]=a,i[4]=u);let f;i[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,d.jsx)(o,{className:`flex items-center justify-center`,children:(0,d.jsx)(t,{className:`h-2.5 w-2.5 fill-current text-current`})}),i[5]=f):f=i[5];let p;return i[6]!==c||i[7]!==r||i[8]!==u?(p=(0,d.jsx)(s,{ref:r,className:u,...c,children:f}),i[6]=c,i[7]=r,i[8]=u,i[9]=p):p=i[9],p});p.displayName=s.displayName;export{p as n,f as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ao as t,Ba as n,Ii as r,Is as i,Ko as a,Na as o,Ns as s,Oo as c,Pi as l,Ps as u,Z as ee,Zn as te,Zr as ne,fs as d,ga as re,jo as ie,n as ae,r as f,tr as oe,zn as p}from"./dialogs-config-DAMqiy-4.js";import{a as se,i as ce,o as m,r as le,s as h}from"./react-vendor-U9lUQswz.js";import{C as ue,D as de,E as fe,S as pe,b as g}from"./history-view-lvvTzW7O.js";import{n as me}from"./utils-C-7eVelM.js";import{a as he,t as ge,x as _e}from"./index-C_iiobDl.js";var ve=u(),_=e(i(),1),v=s(),ye=_.forwardRef((e,t)=>{let n=(0,ve.c)(11),i,a;n[0]===e?(i=n[1],a=n[2]):({className:i,...a}=e,n[0]=e,n[1]=i,n[2]=a);let o;n[3]===i?o=n[4]:(o=r(`relative flex w-full touch-none select-none items-center`,i),n[3]=i,n[4]=o);let s,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,v.jsx)(h,{className:`relative h-2 w-full grow overflow-hidden rounded-full bg-secondary`,children:(0,v.jsx)(ce,{className:`absolute h-full bg-primary`})}),c=(0,v.jsx)(m,{className:`block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`}),n[5]=s,n[6]=c):(s=n[5],c=n[6]);let l;return n[7]!==a||n[8]!==t||n[9]!==o?(l=(0,v.jsxs)(se,{ref:t,className:o,...a,children:[s,c]}),n[7]=a,n[8]=t,n[9]=o,n[10]=l):l=n[10],l});ye.displayName=se.displayName;var y=a(`app.use-maximum-turn-count.hook`),b=50;function be(){let[e,t]=(0,_.useState)(b),[n,r]=(0,_.useState)(b.toString()),[i,a]=(0,_.useState)(!0),[o,s]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.maximumTurnCount),r(n.maximumTurnCount.toString()))}catch(e){y.error(`Failed to load maximum turn count:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);function c(e){r(e)}async function l(e){s(!0);try{let n=await p({maximumTurnCount:e});t(n.maximumTurnCount),r(n.maximumTurnCount.toString())}catch(e){throw y.error(`Failed to update maximum turn count:`,e),e}finally{s(!1)}}function u(){r(e.toString())}return{defaultMaximumTurnCount:b,draftMaximumTurnCount:n,isLoading:i,isSaving:o,maximumTurnCount:e,resetDraftMaximumTurnCount:u,setDraftMaximumTurnCount:c,updateMaximumTurnCount:l}}function x(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}var xe=a(`app.use-screen-recording-permission.hook`),Se={isMacOS:!1,granted:!1,available:!1,message:``};function Ce(){return{...Se,isMacOS:x()}}function we(){let[e,t]=(0,_.useState)(Ce),[n,r]=(0,_.useState)(!0),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=(0,_.useCallback)(async()=>{r(!0),a(null);try{t(await te(`api/system-permissions/screen-recording`))}catch(e){a(e instanceof Error?e.message:`Failed to check screen recording permission`),t(e=>({...Se,isMacOS:e?.isMacOS??x(),message:`Unable to check permission status.`}))}finally{r(!1)}},[]);return(0,_.useEffect)(()=>{u()},[u]),{status:e,isLoading:n,error:i,isOpeningSettings:o,openSettingsError:c,refresh:u,openSystemSettings:(0,_.useCallback)(async()=>{s(!0),l(null);try{let e=await oe(`api/system-permissions/screen-recording/open-settings`,{});if(!e.success){let t=e.message||`Failed to open System Settings`;xe.error(`[useScreenRecordingPermission] ${t}`,e.error),l(t)}}catch(e){let t=e instanceof Error?e.message:`Failed to open System Settings`;xe.error(`[useScreenRecordingPermission] Error opening System Settings:`,e),l(t)}finally{s(!1)}},[])}}var Te=a(`app.use-server-bind-mode.hook`),Ee=`local`,S=`tarsk-server-bind-mode-changed`;function C(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(S)===`true`}catch{return!1}}function De(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(S,`true`):sessionStorage.removeItem(S)}catch{}}function Oe(){let[e,t]=(0,_.useState)(Ee),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1),[u,te]=(0,_.useState)(C);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.serverBindMode),r(n.serverBindMode),a(n.networkAddresses))}catch(e){Te.error(`Failed to load server bind mode:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function ne(e){l(!0);try{let n=await p({serverBindMode:e});t(n.serverBindMode),a(n.networkAddresses),te(!0),De(!0)}catch(e){throw Te.error(`Failed to update server bind mode:`,e),e}finally{l(!1)}}let d=n!==null&&e!==n;return{defaultServerBindMode:Ee,hasServerBindModeChanged:d,isLoading:o,isSaving:c,needsRestart:d||u,networkAddresses:i,serverBindMode:e,updateServerBindMode:ne}}var w=a(`app.use-betterstack-logging.hook`);function ke(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=!1;async function n(){try{let n=await ee();e||(t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost))}catch(e){w.error(`Failed to load Better Stack logging setting:`,e)}finally{e||s(!1)}}return n(),()=>{e=!0}},[]);async function u(e){l(!0);try{let n=await p({betterStackLoggingEnabled:e});t(n.betterStackLoggingEnabled),r(n.betterStackEnvConfigured),a(n.betterStackIngestingHost)}catch(e){throw w.error(`Failed to update Better Stack logging setting:`,e),e}finally{l(!1)}}return{ingestingHost:i,isEnabled:e,isEnvConfigured:n,isLoading:o,isSaving:c,updateIsEnabled:u}}var Ae=[{value:`local`,label:`No`},{value:`network`,label:`Yes`}],je=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],Me=[{value:`no`,label:`No`},{value:`yes`,label:`Yes`}],Ne=[`462`,`8100`].includes(typeof document<`u`?document.location.port:``)?`462`:`641`,Pe=600;function Fe(e){let i=(0,ve.c)(150),{onboardingResetSignal:a}=e,s=a===void 0?0:a,[u,ee]=(0,_.useState)(!1),{theme:te,setTheme:oe}=me(),{scale:p,updateScale:se,resetScale:ce,min:m,max:h,default:y}=ge(),{defaultMaximumTurnCount:b,draftMaximumTurnCount:x,isLoading:xe,isSaving:Se,resetDraftMaximumTurnCount:Ce,setDraftMaximumTurnCount:Te,updateMaximumTurnCount:Ee}=be(),{status:S,isLoading:C,isOpeningSettings:De,openSettingsError:w,refresh:Fe,openSystemSettings:ze}=we(),{isLoading:Be,isSaving:Ve,needsRestart:T,networkAddresses:E,serverBindMode:D,updateServerBindMode:He}=Oe(),{isEnabled:Ue,isLoading:We,isSaving:Ge,updateIsEnabled:Ke}=_e(),{isEnabled:qe,isLoading:Je,isSaving:Ye,updateIsEnabled:Xe}=he(),{isEnabled:O,isEnvConfigured:k,ingestingHost:Ze,isLoading:Qe,isSaving:$e,updateIsEnabled:et}=ke(),tt,nt;i[0]===s?(tt=i[1],nt=i[2]):(tt=()=>{if(s===0)return;ee(!0);let e=setTimeout(()=>{ee(!1)},Pe);return()=>{clearTimeout(e)}},nt=[s],i[0]=s,i[1]=tt,i[2]=nt),(0,_.useEffect)(tt,nt);let rt;i[3]===Te?rt=i[4]:(rt=function(e){Te(e.target.value)},i[3]=Te,i[4]=rt);let it=rt,at;i[5]!==b||i[6]!==x||i[7]!==Ce||i[8]!==Ee?(at=async function(){let e=Number.parseInt(x,10),t=Number.isFinite(e)&&e>0?e:b;try{await Ee(t)}catch{Ce()}},i[5]=b,i[6]=x,i[7]=Ce,i[8]=Ee,i[9]=at):at=i[9];let ot=at,st;i[10]===se?st=i[11]:(st=function(e){e.length>0&&se(e[0])},i[10]=se,i[11]=st);let ct=st,lt=u&&`animate-headline-reset`,A;i[12]===lt?A=i[13]:(A=r(lt),i[12]=lt,i[13]=A);let j;i[14]===A?j=i[15]:(j=(0,v.jsx)(pe,{title:`General`,description:`Customize the appearance and behavior of Tarsk.`,titleClassName:A}),i[14]=A,i[15]=j);let ut,dt;i[16]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,v.jsx)(re,{className:`h-3.5 w-3.5`}),dt=(0,v.jsx)(`span`,{className:`sr-only`,children:`Reset font size to default`}),i[16]=ut,i[17]=dt):(ut=i[16],dt=i[17]);let M;i[18]===ce?M=i[19]:(M=(0,v.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:ce,children:[ut,dt]}),i[18]=ce,i[19]=M);let N;i[20]===p?N=i[21]:(N=(0,v.jsxs)(`span`,{className:`${d.mono} tabular-nums w-12 text-right`,children:[p,`%`]}),i[20]=p,i[21]=N);let P;i[22]!==M||i[23]!==N?(P=(0,v.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[M,N]}),i[22]=M,i[23]=N,i[24]=P):P=i[24];let F;i[25]===m?F=i[26]:(F=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-8 text-right`,children:[m,`%`]}),i[25]=m,i[26]=F);let I;i[27]===p?I=i[28]:(I=[p],i[27]=p,i[28]=I);let L;i[29]!==ct||i[30]!==h||i[31]!==m||i[32]!==I?(L=(0,v.jsx)(ye,{value:I,min:m,max:h,step:5,onValueChange:ct,"aria-label":`Font size`}),i[29]=ct,i[30]=h,i[31]=m,i[32]=I,i[33]=L):L=i[33];let ft;i[34]===h?ft=i[35]:(ft=(0,v.jsxs)(`span`,{className:`${d.bodyMuted} w-9`,children:[h,`%`]}),i[34]=h,i[35]=ft);let R;i[36]!==F||i[37]!==L||i[38]!==ft?(R=(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[F,L,ft]}),i[36]=F,i[37]=L,i[38]=ft,i[39]=R):R=i[39];let z;i[40]!==y||i[41]!==p?(z=p!==y&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-2`,children:[`Font size has been changed from the default (`,y,`%).`]}),i[40]=y,i[41]=p,i[42]=z):z=i[42];let B;i[43]!==P||i[44]!==R||i[45]!==z?(B=(0,v.jsxs)(g,{title:`Font Size`,description:`Adjust the text size across the entire application.`,action:P,children:[R,z]}),i[43]=P,i[44]=R,i[45]=z,i[46]=B):B=i[46];let V;i[47]===oe?V=i[48]:(V=e=>{(e===`light`||e===`dark`||e===`system`)&&oe(e)},i[47]=oe,i[48]=V);let pt;i[49]===Symbol.for(`react.memo_cache_sentinel`)?(pt=je.map(Re),i[49]=pt):pt=i[49];let H;i[50]!==V||i[51]!==te?(H=(0,v.jsx)(g,{title:`Appearance`,description:`Choose your preferred color scheme.`,children:(0,v.jsx)(ae,{type:`single`,value:te,onValueChange:V,"aria-label":`Appearance`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:pt})}),i[50]=V,i[51]=te,i[52]=H):H=i[52];let U;i[53]===ot?U=i[54]:(U=()=>{ot()},i[53]=ot,i[54]=U);let mt=xe||Se,W;i[55]!==x||i[56]!==it||i[57]!==U||i[58]!==mt?(W=(0,v.jsx)(ne,{type:`number`,min:1,step:1,value:x,onChange:it,onBlur:U,disabled:mt,"aria-label":`Maximum turn count`,className:`w-28 text-right font-mono tabular-nums flex-shrink-0`}),i[55]=x,i[56]=it,i[57]=U,i[58]=mt,i[59]=W):W=i[59];let G;i[60]===b?G=i[61]:(G=(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Default: `,b,` turns.`]}),i[60]=b,i[61]=G);let K;i[62]!==W||i[63]!==G?(K=(0,v.jsx)(g,{title:`Maximum Turn Count`,description:`Set how many turns a long-running agent chat can take before Tarsk asks whether to continue.`,action:W,children:G}),i[62]=W,i[63]=G,i[64]=K):K=i[64];let ht=Ue?`on`:`off`,q;i[65]===Ke?q=i[66]:(q=e=>{e&&Ke(e===`on`)},i[65]=Ke,i[66]=q);let gt=We||Ge,_t,vt;i[67]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,v.jsx)(f,{value:`off`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`Off`}),vt=(0,v.jsx)(f,{value:`on`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`On`}),i[67]=_t,i[68]=vt):(_t=i[67],vt=i[68]);let J;i[69]!==ht||i[70]!==q||i[71]!==gt?(J=(0,v.jsx)(g,{title:`AI Voice Cleanup`,description:`After stopping voice recording, run the transcription through AI to remove filler words, false starts, and repetitions.`,children:(0,v.jsxs)(ae,{type:`single`,value:ht,onValueChange:q,disabled:gt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`AI Voice Cleanup`,children:[_t,vt]})}),i[69]=ht,i[70]=q,i[71]=gt,i[72]=J):J=i[72];let yt=qe?`on`:`off`,Y;i[73]===Xe?Y=i[74]:(Y=e=>{e&&Xe(e===`on`)},i[73]=Xe,i[74]=Y);let bt=Je||Ye,xt,St;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(xt=(0,v.jsx)(f,{value:`off`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`Off`}),St=(0,v.jsx)(f,{value:`on`,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:`On`}),i[75]=xt,i[76]=St):(xt=i[75],St=i[76]);let X;i[77]!==yt||i[78]!==Y||i[79]!==bt?(X=(0,v.jsx)(g,{title:`Daily Spend`,description:`Show an estimated daily spend counter in the chat header.`,children:(0,v.jsxs)(ae,{type:`single`,value:yt,onValueChange:Y,disabled:bt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`Daily Spend`,children:[xt,St]})}),i[77]=yt,i[78]=Y,i[79]=bt,i[80]=X):X=i[80];let Ct;i[81]!==De||i[82]!==C||i[83]!==ze||i[84]!==Fe||i[85]!==w||i[86]!==S?.granted||i[87]!==S?.isMacOS||i[88]!==S?.message?(Ct=S?.isMacOS&&(0,v.jsx)(g,{title:`Screen & System Audio Recording`,description:`Tarsk needs this macOS permission to capture screen content for browser tools and screen sharing features.`,action:(0,v.jsx)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:(0,v.jsxs)(l,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,onClick:()=>void Fe(),disabled:C,children:[C?(0,v.jsx)(n,{className:`h-3.5 w-3.5 animate-spin`}):(0,v.jsx)(re,{className:`h-3.5 w-3.5`}),(0,v.jsx)(`span`,{className:`sr-only`,children:`Refresh permission status`})]})}),children:(0,v.jsx)(`div`,{className:`flex items-center gap-3`,children:!C&&S?.granted?(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(t,{className:`h-4 w-4 text-green-500`}),(0,v.jsx)(`span`,{className:r(d.body,`text-green-600 dark:text-green-400`),children:`Permission granted`})]}):C?null:(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsx)(c,{className:`h-4 w-4 text-amber-500`}),(0,v.jsx)(`span`,{className:r(d.body,`text-amber-600 dark:text-amber-400`),children:`Permission not granted`})]}),(0,v.jsx)(`p`,{className:d.bodyMuted,children:S?.message??`Tarsk needs Screen & System Audio Recording permission to use browser tools.`}),(0,v.jsx)(l,{size:`sm`,onClick:()=>void ze(),disabled:De,className:`w-fit`,children:De?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(n,{className:`h-4 w-4 mr-2 animate-spin`}),`Opening Settings...`]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o,{className:`h-4 w-4 mr-2`}),`Open System Settings`]})}),w&&(0,v.jsxs)(`div`,{className:`flex items-start gap-2 p-3 rounded-md bg-destructive/10 text-destructive`,children:[(0,v.jsx)(ie,{className:`h-4 w-4 mt-0.5 flex-shrink-0`}),(0,v.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,v.jsx)(`p`,{className:d.body,children:`Failed to open System Settings`}),(0,v.jsx)(`p`,{className:d.bodyMuted,children:w}),(0,v.jsxs)(`p`,{className:d.bodyMuted,children:[`Please open it manually:`,` `,(0,v.jsx)(`strong`,{children:`System Settings > Privacy & Security > Screen & System Audio Recording`})]})]})]})]})})}),i[81]=De,i[82]=C,i[83]=ze,i[84]=Fe,i[85]=w,i[86]=S?.granted,i[87]=S?.isMacOS,i[88]=S?.message,i[89]=Ct):Ct=i[89];let wt,Tt;i[90]===Symbol.for(`react.memo_cache_sentinel`)?(wt=(0,v.jsx)(ue,{title:`Mobile & Network Access`,className:`mb-1`}),Tt=(0,v.jsx)(`p`,{className:r(d.bodyMuted,`mb-3`),children:`Allow the Tarsk mobile app or other web browsers to access Tarsk on the wifi network.`}),i[90]=wt,i[91]=Tt):(wt=i[90],Tt=i[91]);let Et=Be||Ve,Dt;i[92]===He?Dt=i[93]:(Dt=e=>{(e===`local`||e===`network`)&&He(e)},i[92]=He,i[93]=Dt);let Ot;i[94]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=Ae.map(Le),i[94]=Ot):Ot=i[94];let Z;i[95]!==D||i[96]!==Et||i[97]!==Dt?(Z=(0,v.jsx)(ae,{type:`single`,value:D,disabled:Et,onValueChange:Dt,"aria-label":`Server bind mode`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:Ot}),i[95]=D,i[96]=Et,i[97]=Dt,i[98]=Z):Z=i[98];let kt;i[99]!==T||i[100]!==E||i[101]!==D?(kt=D===`network`&&E.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Available on the network at:`,` `,(0,v.jsxs)(`span`,{className:d.mono,children:[`http://`,E[0],`:`,Ne]})]}),T&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-1`,children:`You will need to restart for this setting to take effect.`})]}),i[99]=T,i[100]=E,i[101]=D,i[102]=kt):kt=i[102];let At;i[103]!==E||i[104]!==D?(At=D===`network`&&E.length===0&&(0,v.jsx)(`p`,{className:`${d.bodyMuted} mt-3`,children:`No network IP addresses were detected on this computer.`}),i[103]=E,i[104]=D,i[105]=At):At=i[105];let jt;i[106]!==T||i[107]!==D?(jt=T&&D===`local`&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[(0,v.jsx)(`br`,{}),`You will need to restart for this setting to take effect.`]}),i[106]=T,i[107]=D,i[108]=jt):jt=i[108];let Mt;i[109]!==Z||i[110]!==kt||i[111]!==At||i[112]!==jt?(Mt=(0,v.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[wt,Tt,Z,kt,At,jt]}),i[109]=Z,i[110]=kt,i[111]=At,i[112]=jt,i[113]=Mt):Mt=i[113];let Nt;i[114]!==E||i[115]!==D?(Nt=D===`network`&&E.length>0&&(0,v.jsxs)(`div`,{className:`hidden md:flex flex-col items-center gap-2 flex-shrink-0`,children:[(0,v.jsx)(le,{value:`http://${E[0]}:${Ne}`,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`}),(0,v.jsx)(`p`,{className:`${d.compact} text-muted-foreground text-center`,children:`Scan with the Tarsk Mobile App`})]}),i[114]=E,i[115]=D,i[116]=Nt):Nt=i[116];let Pt;i[117]!==Mt||i[118]!==Nt?(Pt=(0,v.jsxs)(`div`,{className:`flex items-start gap-6`,children:[Mt,Nt]}),i[117]=Mt,i[118]=Nt,i[119]=Pt):Pt=i[119];let Ft=O?`yes`:`no`,It;i[120]===et?It=i[121]:(It=e=>{(e===`yes`||e===`no`)&&et(e===`yes`)},i[120]=et,i[121]=It);let Lt=Qe||$e,Rt;i[122]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=Me.map(Ie),i[122]=Rt):Rt=i[122];let zt;i[123]!==Ft||i[124]!==It||i[125]!==Lt?(zt=(0,v.jsx)(ae,{type:`single`,value:Ft,onValueChange:It,disabled:Lt,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,"aria-label":`Better Stack logging`,children:Rt}),i[123]=Ft,i[124]=It,i[125]=Lt,i[126]=zt):zt=i[126];let Bt;i[127]!==Ze||i[128]!==O||i[129]!==k?(Bt=O&&k&&Ze&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Ingesting host:`,` `,(0,v.jsx)(`span`,{className:d.mono,children:Ze})]}),i[127]=Ze,i[128]=O,i[129]=k,i[130]=Bt):Bt=i[130];let Vt;i[131]!==O||i[132]!==k?(Vt=O&&!k&&(0,v.jsxs)(`p`,{className:`${d.bodyMuted} mt-3`,children:[`Logging requires the`,` `,(0,v.jsx)(`span`,{className:d.mono,children:`BETTERSTACK_SOURCE_TOKEN`}),` and`,` `,(0,v.jsx)(`span`,{className:d.mono,children:`BETTERSTACK_INGESTING_HOST`}),` environment variables to be set. Restart Tarsk after configuring them.`]}),i[131]=O,i[132]=k,i[133]=Vt):Vt=i[133];let Q;i[134]!==zt||i[135]!==Bt||i[136]!==Vt?(Q=(0,v.jsxs)(g,{title:`Logging`,description:`Send application logs to Better Stack for remote monitoring and debugging.`,children:[zt,Bt,Vt]}),i[134]=zt,i[135]=Bt,i[136]=Vt,i[137]=Q):Q=i[137];let $;i[138]!==B||i[139]!==H||i[140]!==K||i[141]!==J||i[142]!==X||i[143]!==Ct||i[144]!==Pt||i[145]!==Q?($=(0,v.jsxs)(`div`,{className:`space-y-8`,children:[B,H,K,J,X,Ct,Pt,Q]}),i[138]=B,i[139]=H,i[140]=K,i[141]=J,i[142]=X,i[143]=Ct,i[144]=Pt,i[145]=Q,i[146]=$):$=i[146];let Ht;return i[147]!==$||i[148]!==j?(Ht=(0,v.jsx)(de,{children:(0,v.jsxs)(fe,{children:[j,$]})}),i[147]=$,i[148]=j,i[149]=Ht):Ht=i[149],Ht}function Ie(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function Le(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}function Re(e){return(0,v.jsx)(f,{value:e.value,"aria-label":e.label,className:`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm dark:data-[state=on]:bg-background dark:data-[state=on]:text-foreground`,children:e.label},e.value)}export{Fe as default};
@@ -1,5 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ii as r,Is as i,Ki as a,Lr as o,M as s,Ns as c,Pi as l,Ps as u,Qr as d,Rr as f,Sa as p,Zr as m,_t as h,bn as g,ei as _,fs as v,ft as y,ua as b,zr as x}from"./dialogs-config-DAMqiy-4.js";import{A as ee,C as S,D as te,E as C,F as w,M as T,N as E,O as D,P as O,S as ne,T as k,b as A,d as j,f as M,g as N,h as P,j as F,k as I,p as L,y as R}from"./history-view-lvvTzW7O.js";import{B as z,H as B,L as V,P as re,W as H}from"./index-C_iiobDl.js";import{t as U}from"./skeleton-rEPpLCqo.js";import{i as W,n as G,r as ie,t as ae}from"./tabs-D57g7ER1.js";import{i as oe,n as se,r as ce,t as K}from"./settings-list-BapKAJV3.js";import{t as le}from"./mcp-server-card-DPMxJJU6.js";var q=u(),J=e(i(),1);function ue(e){let[t,n]=(0,J.useState)([]),[r,i]=(0,J.useState)(!1),a=(0,J.useCallback)(async()=>{if(e){i(!0);try{let t=await y(e);n(Object.entries(t.servers??{}).map(([e,t])=>({name:e,config:t})))}catch{n([])}finally{i(!1)}}},[e]);return(0,J.useEffect)(()=>{a()},[a]),{installedServers:t,loadingConfig:r,loadInstalledServers:a}}function de(){let e=(0,q.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,J.useState)(t),i,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{h().then(r).catch(()=>r([]))},a=[],e[1]=i,e[2]=a):(i=e[1],a=e[2]),(0,J.useEffect)(i,a);let o;return e[3]===n?o=e[4]:(o={popularServers:n},e[3]=n,e[4]=o),o}async function Y(e,t,n){await g(e,t,n)}async function fe(e,t){await s(e,t)}var X=c();function Z(e){return e?.url?`remote`:`local`}function pe(e){return Object.entries(e??{}).map(([e,t])=>({key:e,value:t}))}function Q({projectPath:e,serverName:t,initialName:n,initialConfig:r,onBack:i}){let{installedServers:o}=ue(e),s=!!t,[c,u]=(0,J.useState)(`local`),[d,f]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),[_,y]=(0,J.useState)(``),[b,x]=(0,J.useState)(``),[ee,S]=(0,J.useState)(`sse`),[C,w]=(0,J.useState)([]),[T,E]=(0,J.useState)([]),[D,O]=(0,J.useState)(!1),[k,F]=(0,J.useState)(!1),[I,V]=(0,J.useState)(null),[re,H]=(0,J.useState)(s),[U,oe]=(0,J.useState)(``),[se,ce]=(0,J.useState)(``);function K(e,t){let n=Z(t);u(n),f(e),g(t.command??``),y((t.args??[]).join(`
2
- `)),x(t.url??``),S(t.transport??`sse`),w(pe(t.env)),E(pe(t.headers)),oe(e),ce(JSON.stringify({name:e,type:n,config:t}))}(0,J.useEffect)(()=>{if(s&&t){let e=o.find(e=>e.name===t);e&&(K(e.name,e.config),H(!1))}else r&&K(n??``,r),H(!1)},[o,t,s,r,n]);let le=(0,J.useCallback)(()=>{w(e=>[...e,{key:``,value:``}])},[]),q=(0,J.useCallback)(e=>{w(t=>t.filter((t,n)=>n!==e))},[]),de=(0,J.useCallback)((e,t)=>{w(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),Q=(0,J.useCallback)((e,t)=>{w(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]),$=(0,J.useCallback)(()=>{E(e=>[...e,{key:``,value:``}])},[]),me=(0,J.useCallback)(e=>{E(t=>t.filter((t,n)=>n!==e))},[]),he=(0,J.useCallback)((e,t)=>{E(n=>n.map((n,r)=>r===e?{...n,key:t}:n))},[]),ge=(0,J.useCallback)((e,t)=>{E(n=>n.map((n,r)=>r===e?{...n,value:t}:n))},[]);function _e(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 ve(){let e=_e(C);if(c===`remote`){let t=_e(T);return{url:b.trim(),transport:ee,...t?{headers:t}:{},...e?{env:e}:{}}}let t=_.split(`
3
- `).map(e=>e.trim()).filter(Boolean);return{command:h.trim(),args:t,...e?{env:e}:{}}}let ye=JSON.stringify({name:d.trim(),type:c,config:ve()}),be=async()=>{V(null);let t=d.trim();if(!t){V(`Server name is required`);return}if(c===`remote`){if(!b.trim()){V(`Server URL is required`);return}try{new URL(b.trim())}catch{V(`Server URL must be a valid URL`);return}}else if(!h.trim()){V(`Command is required`);return}O(!0);try{if(!e)throw Error(`No project path`);await Y(e,U||t,ve()),z({title:`Success`,description:s?`MCP server configuration saved`:`MCP server added`}),i()}catch(e){V(e instanceof Error?e.message:`Failed to save server`)}finally{O(!1)}},xe=async()=>{if(e){F(!0);try{await fe(e,U),z({title:`Success`,description:`MCP server removed`}),i()}catch(e){V(e instanceof Error?e.message:`Failed to delete server`)}finally{F(!1)}}},Se=s?ye!==se:d.trim()!==``||h.trim()!==``||_.trim()!==``||b.trim()!==``||C.length>0||T.length>0;return re?(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,X.jsx)(`p`,{className:v.bodyMuted,children:`Loading server configuration...`})}):(0,X.jsx)(te,{children:(0,X.jsxs)(R,{children:[(0,X.jsx)(ne,{title:s?d:`Add MCP Server`,description:s?`Edit MCP Server configuration.`:`Configure a new MCP Server.`}),(0,X.jsxs)(`div`,{className:`space-y-6`,children:[(0,X.jsx)(A,{title:`Server name`,description:s?`Server name cannot be changed`:void 0,children:(0,X.jsx)(m,{id:`server-name`,placeholder:`e.g. filesystem`,value:d,onChange:e=>f(e.target.value),disabled:s})}),(0,X.jsxs)(ae,{value:c,onValueChange:e=>u(e),className:`w-full`,children:[(0,X.jsxs)(ie,{className:`grid w-full grid-cols-2`,children:[(0,X.jsx)(W,{value:`local`,children:`Local (stdio)`}),(0,X.jsx)(W,{value:`remote`,children:`Remote (HTTP/SSE)`})]}),(0,X.jsxs)(G,{value:`local`,className:`space-y-6 mt-6`,children:[(0,X.jsx)(A,{title:`Command`,children:(0,X.jsx)(m,{id:`server-command`,placeholder:`e.g. npx`,value:h,onChange:e=>g(e.target.value)})}),(0,X.jsx)(A,{title:`Arguments`,description:`One argument per line`,children:(0,X.jsx)(B,{id:`server-args`,placeholder:`-y
4
- @modelcontextprotocol/server-filesystem
5
- /path/to/dir`,value:_,onChange:e=>y(e.target.value),className:`font-mono min-h-[80px] resize-none`})})]}),(0,X.jsxs)(G,{value:`remote`,className:`space-y-6 mt-6`,children:[(0,X.jsx)(A,{title:`Server URL`,description:`Paste the MCP endpoint URL from your provider.`,children:(0,X.jsx)(m,{id:`server-url`,placeholder:`https://example.com/mcp`,value:b,onChange:e=>x(e.target.value),className:`font-mono`})}),(0,X.jsx)(A,{title:`Transport`,children:(0,X.jsxs)(j,{value:ee,onValueChange:e=>S(e),children:[(0,X.jsx)(P,{children:(0,X.jsx)(N,{})}),(0,X.jsxs)(M,{children:[(0,X.jsx)(L,{value:`sse`,children:`SSE (Server-Sent Events)`}),(0,X.jsx)(L,{value:`streamableHttp`,children:`Streamable HTTP`})]})]})}),(0,X.jsx)(A,{title:`HTTP headers`,description:`Optional headers for authentication.`,action:(0,X.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:$,children:[(0,X.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add header`]}),children:T.length===0?(0,X.jsx)(`p`,{className:v.caption,children:`No headers configured`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:T.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(m,{placeholder:`Authorization`,value:e.key,onChange:e=>he(t,e.target.value),className:`font-mono w-[35%]`}),(0,X.jsx)(m,{placeholder:`Bearer ...`,value:e.value,onChange:e=>ge(t,e.target.value),className:`font-mono flex-1`}),(0,X.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>me(t),className:`h-9 w-9 flex-shrink-0`,children:(0,X.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})})]})]}),(0,X.jsx)(A,{title:`Environment variables`,description:c===`remote`?`Optional metadata for local tooling.`:void 0,action:(0,X.jsxs)(l,{variant:`ghost`,size:`sm`,onClick:le,children:[(0,X.jsx)(p,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:C.length===0?(0,X.jsx)(`p`,{className:v.caption,children:`No environment variables configured`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:C.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(m,{placeholder:`KEY`,value:e.key,onChange:e=>de(t,e.target.value),className:`font-mono w-[35%]`}),(0,X.jsx)(m,{placeholder:`value`,value:e.value,onChange:e=>Q(t,e.target.value),className:`font-mono flex-1`}),(0,X.jsx)(l,{variant:`ghost`,size:`icon`,onClick:()=>q(t),className:`h-9 w-9 flex-shrink-0`,children:(0,X.jsx)(a,{className:`h-3.5 w-3.5`})})]},t))})}),I&&(0,X.jsx)(`p`,{className:v.error,children:I}),(0,X.jsxs)(`div`,{className:`border-t pt-4 flex items-center justify-between`,children:[s&&(0,X.jsx)(l,{variant:`destructive`,onClick:xe,disabled:k||D,children:k?`Removing...`:`Remove`}),!s&&(0,X.jsx)(`div`,{}),(0,X.jsx)(l,{onClick:be,disabled:D||k||!Se,children:D?s?`Saving...`:`Adding...`:s?`Save`:`Add`})]})]})]})})}function $(e){return e.name.toLowerCase().replace(/\s+/g,`-`)}function me(e){return e.url?e.url:`${e.command??``} ${e.args?.join(` `)??``}`.trim()}function he(){let e=H(e=>e.selectedProjectId),i=H(e=>e.projects).find(t=>t.projectId===e)?.projectPath,{installedServers:a,loadingConfig:s,loadInstalledServers:c}=ue(i),{popularServers:u}=de(),{setActiveMainTab:p}=V(),{setPendingExplorerPath:m,triggerExplorerRefresh:h}=re(),[g,y]=(0,J.useState)(!1),[A,j]=(0,J.useState)(null),[M,N]=(0,J.useState)(null),[P,L]=(0,J.useState)(null),[R,B]=(0,J.useState)(!1),[W,G]=(0,J.useState)(``),ie=(0,J.useCallback)(async e=>{if(i){B(!0);try{await fe(i,e),await c(),h(),z({title:`MCP server removed`,description:e}),L(null)}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to remove server`,variant:`destructive`})}finally{B(!1)}}},[i,c,h]),ae=(0,J.useCallback)(()=>{m(`.agents/mcp.json`),p(`explorer`)},[m,p]),q=(0,J.useCallback)(async e=>{if(!i)return;let t=$(e);if(!a.some(n=>n.name===t||n.name===e.id)){if(e.url!==void 0){if(!e.url.trim()){j({name:t,config:{url:``,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}}),y(!0);return}try{await Y(i,t,{url:e.url,transport:e.transport??`sse`,...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),h(),z({title:`MCP server installed`,description:e.name})}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}return}if(!e.command){z({title:`Error`,description:`This server is missing install configuration.`,variant:`destructive`});return}try{await Y(i,t,{command:e.command,args:e.args??[],...Object.keys(e.env??{}).length>0?{env:e.env}:{}}),await c(),h(),z({title:`MCP server installed`,description:e.name})}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to install server`,variant:`destructive`})}}},[i,a,c,h]),Z=W.trim()?u.filter(e=>e.name.toLowerCase().includes(W.toLowerCase())||e.description.toLowerCase().includes(W.toLowerCase())):u;return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(te,{children:(0,X.jsxs)(C,{children:[(0,X.jsx)(ne,{title:`MCP Servers`,description:`Manage Model Context Protocol servers for your project.`,action:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(l,{variant:`ghost`,onClick:ae,children:`Config`}),(0,X.jsx)(l,{onClick:()=>y(!0),children:`Add Server`})]})}),(0,X.jsx)(S,{title:`Installed`}),s?(0,X.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,X.jsx)(U,{className:`h-12 w-full`}),(0,X.jsx)(U,{className:`h-12 w-full`})]}):a.length===0?(0,X.jsx)(K,{icon:b,title:`No MCP servers installed`,description:`Add an MCP server to extend agent capabilities.`}):(0,X.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:a.map((e,i)=>(0,X.jsxs)(`div`,{className:r(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,i>0&&`border-t border-border`),children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>N(e.name),className:`min-w-0 text-left`,children:[(0,X.jsx)(`div`,{className:r(v.body,`truncate`),children:e.name}),(0,X.jsx)(`div`,{className:r(v.compact,`truncate text-muted-foreground font-mono`),children:me(e.config)})]}),(0,X.jsx)(`div`,{className:`shrink-0`}),(0,X.jsx)(x,{children:(0,X.jsxs)(o,{children:[(0,X.jsx)(n,{asChild:!0,children:(0,X.jsx)(l,{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:()=>L(e.name),"aria-label":`Delete ${e.name}`,children:(0,X.jsx)(t,{className:`h-4 w-4`})})}),(0,X.jsx)(f,{children:`Remove this MCP server from the project`})]})})]},e.name))}),(0,X.jsx)(S,{title:`Available`,className:`mb-0`}),(0,X.jsx)(oe,{placeholder:`Search available servers...`,value:W,onChange:G}),u.length===0?(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsx)(U,{className:`h-20 w-full`}),(0,X.jsx)(U,{className:`h-20 w-full`})]}):Z.length===0?(0,X.jsx)(ce,{searchQuery:W,emptyLabel:`No available servers found.`}):(0,X.jsx)(se,{children:Z.map(e=>{let t=$(e),n=a.some(n=>n.name===t||n.name===e.id);return(0,X.jsx)(le,{name:e.name,description:e.description,installed:n,onClick:()=>{n||q(e)},showInstalledControls:!1},e.id)})})]})}),(0,X.jsx)(d,{open:g,onOpenChange:e=>{y(e),e||j(null)},children:(0,X.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,X.jsx)(Q,{projectPath:i,initialName:A?.name,initialConfig:A?.config,onBack:()=>{y(!1),j(null),c(),h()}})})}),(0,X.jsx)(d,{open:M!==null,onOpenChange:e=>{e||N(null)},children:(0,X.jsx)(_,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,X.jsx)(Q,{projectPath:i,serverName:M??void 0,onBack:()=>{N(null),c(),h()}})})}),(0,X.jsx)(D,{open:P!==null,onOpenChange:e=>!e&&L(null),children:(0,X.jsxs)(F,{children:[(0,X.jsxs)(O,{children:[(0,X.jsx)(w,{children:`Delete MCP Server`}),(0,X.jsxs)(T,{children:[`Are you sure you want to delete the server "`,P,`"? This action cannot be undone.`]})]}),(0,X.jsxs)(E,{children:[(0,X.jsx)(ee,{children:`Cancel`}),(0,X.jsx)(I,{onClick:()=>P&&void ie(P),disabled:R,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:R?`Deleting...`:`Delete`})]})]})})]}):(0,X.jsx)(k,{children:`Select a project to manage MCP servers.`})}export{he as SettingsMCPServersView,he as default};
@@ -1,8 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ct as r,Ii as i,Is as a,Lr as o,Ns as s,P as c,Pi as l,Ps as u,Qr as d,R as f,Rr as p,Zr as m,ei as ee,fs as h,nn as te,pa as ne,vt as re,wn as g,zr as _,zt as v}from"./dialogs-config-DAMqiy-4.js";import{n as y,t as b}from"./react-vendor-U9lUQswz.js";import{A as ie,C as x,D as S,E as ae,F as oe,M as se,N as ce,O as le,P as ue,S as C,T as w,b as T,j as de,k as fe,x as pe,y as E}from"./history-view-lvvTzW7O.js";import{B as D,H as O,L as me,P as he,W as k}from"./index-C_iiobDl.js";import{t as A}from"./skeleton-rEPpLCqo.js";import{t as ge}from"./use-deferred-search-Bi99md6l.js";import{i as j,n as M,r as N,t as P}from"./settings-list-BapKAJV3.js";import{t as F}from"./mcp-server-card-DPMxJJU6.js";import{i as I,n as L,r as R,t as _e}from"./slug-utils-DZ59sTAJ.js";var z=u(),B=e(a(),1),V=s(),H=B.forwardRef((e,t)=>{let n=(0,z.c)(10),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`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]=o);let s;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,V.jsx)(y,{className:i(`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]=s):s=n[5];let c;return n[6]!==a||n[7]!==t||n[8]!==o?(c=(0,V.jsx)(b,{className:o,...a,ref:t,children:s}),n[6]=a,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});H.displayName=b.displayName;function ve({threadId:e,onRuleCreated:t}){let[n,r]=(0,B.useState)(``),[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),d=R(n),f=L(d),p=async()=>{if(!(!f||!e)){u(!0);try{let n=`---
2
- description: ${a.trim()}
3
- alwaysApply: ${s}
4
- ---
5
-
6
- Place your rule instructions here as markdown.
7
- `;await g(e,`.agents/rules/${d}.md`,n),D({title:`Rule created`,description:`Rule '${d}' was created successfully.`}),r(``),o(``),c(!1),t?.(d)}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{u(!1)}}};return e?(0,V.jsx)(S,{children:(0,V.jsxs)(E,{children:[(0,V.jsx)(C,{title:`Add Rule`,description:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(T,{title:`Rule Name`,children:[(0,V.jsx)(m,{id:`ruleName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:l}),n?(0,V.jsxs)(`p`,{className:i(h.caption,`mt-2`),children:[`File name: `,(0,V.jsxs)(`span`,{className:`font-mono`,children:[d||`...`,`.md`]})]}):null]}),(0,V.jsx)(T,{title:`Description`,children:(0,V.jsx)(O,{id:`ruleDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:l})}),(0,V.jsx)(T,{title:`Always Apply`,description:s?`This rule will be automatically added to context for all conversations.`:`Only the rule description will be added to context, allowing the agent to read the rule file when needed.`,action:(0,V.jsx)(H,{id:`alwaysApply`,checked:s,onCheckedChange:c,disabled:l})}),(0,V.jsx)(I,{onContinue:()=>void p(),disabled:!f||!a.trim(),creating:l})]})]})}):(0,V.jsx)(w,{title:`No thread selected`,children:`Please select a thread to add a rule.`})}function U(e){let t=[];for(let n of e)n.type===`file`&&n.path.startsWith(`.agents/rules/`)&&t.push(n),n.children&&n.children.length>0&&t.push(...U(n.children));return t}function W(){let e=k(e=>e.selectedProjectId),a=k(e=>e.selectedThreadId),{setActiveMainTab:s}=me(),{setPendingExplorerPath:u,triggerExplorerRefresh:m,setExplorerClearPath:y}=he(),[b,T]=(0,B.useState)([]),[E,O]=(0,B.useState)(!1),[I,L]=(0,B.useState)(!1),[R,z]=(0,B.useState)(null),[H,W]=(0,B.useState)(!1),[G,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(new Set),{query:Y,setQuery:X,deferredQuery:Z}=ge(),Q=(0,B.useCallback)(async()=>{if(e){O(!0);try{let t=U(await r(e));if(a)try{let e=U(await v(a)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}T(t),J(new Set(t.map(e=>e.path)))}catch{T([]),J(new Set)}finally{O(!1)}}},[e,a]);(0,B.useEffect)(()=>{Q()},[Q]),(0,B.useEffect)(()=>{re().then(K).catch(()=>K([]))},[]);let ye=(0,B.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;W(!0);try{try{await c(e,r)}catch{if(a)await f(a,r);else throw Error(`No thread selected to delete from`)}y(r),m(),J(e=>{let t=new Set(e);return t.delete(r),t}),D({title:`Rule removed`,description:n}),z(null),await Q()}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove rule`,variant:`destructive`})}finally{W(!1)}},[e,a,Q,m,y]),be=(0,B.useCallback)(e=>{u(e),s(`explorer`)},[u,s]),xe=(0,B.useCallback)(async e=>{let t=`.agents/rules/${e.name}.md`;if(!(!a||q.has(t)))try{e.gitHubRepo&&e.gitHubFolder?await te(a,e.gitHubRepo,e.gitHubFolder,`.agents/rules`):await g(a,t,[`---`,`description: ${e.description}`,`alwaysApply: ${e.alwaysApply??!1}`,`---`,``,e.content].join(`
8
- `)),J(e=>new Set(e).add(t)),m(),Q(),D({title:`Rule installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install rule`,variant:`destructive`})}},[a,q,m,Q]),$=(0,B.useMemo)(()=>Z.trim()?G.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):G,[G,Z]);return e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(S,{children:(0,V.jsxs)(ae,{children:[(0,V.jsx)(C,{title:`Rules`,description:`Manage agent rules. Rules define coding standards and project-wide guidelines.`,action:(0,V.jsx)(l,{onClick:()=>L(!0),disabled:!a,children:`Add Rule`})}),!a&&(0,V.jsx)(pe,{children:`Select a thread to add or install rules.`}),(0,V.jsx)(x,{title:`Installed`}),E?(0,V.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,V.jsx)(A,{className:`h-12 w-full`}),(0,V.jsx)(A,{className:`h-12 w-full`})]}):b.length===0?(0,V.jsx)(P,{icon:ne,title:`No rules installed`,description:`Add rules to enforce coding standards and project conventions.`}):(0,V.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:b.map((e,r)=>(0,V.jsxs)(`div`,{className:i(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,r>0&&`border-t border-border`),children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>be(e.path),className:i(h.body,`truncate text-left`),children:e.name.replace(/\.mdc$/i,``)}),(0,V.jsx)(_,{children:(0,V.jsxs)(o,{children:[(0,V.jsx)(n,{asChild:!0,children:(0,V.jsx)(l,{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:()=>z(e),"aria-label":`Delete ${e.name.replace(/\.mdc$/i,``)}`,children:(0,V.jsx)(t,{className:`h-4 w-4`})})}),(0,V.jsx)(p,{children:`Remove this rule from the project`})]})})]},e.id))}),(0,V.jsx)(x,{title:`Available`,className:`mb-0`}),(0,V.jsx)(j,{placeholder:`Search available rules...`,value:Y,onChange:X}),G.length===0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(A,{className:`h-20 w-full`}),(0,V.jsx)(A,{className:`h-20 w-full`})]}):$.length===0?(0,V.jsx)(N,{searchQuery:Y,emptyLabel:`No available rules found.`}):(0,V.jsx)(M,{children:$.map(e=>{let t=`.agents/rules/${e.name}.md`,n=q.has(t);return(0,V.jsx)(F,{name:_e(e.name),description:e.description,installed:n,onClick:()=>{n||xe(e)},showInstalledControls:!1},e.id)})})]})}),(0,V.jsx)(d,{open:I,onOpenChange:L,children:(0,V.jsx)(ee,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,V.jsx)(ve,{threadId:a,onRuleCreated:()=>{L(!1),Q(),m()}})})}),(0,V.jsx)(le,{open:R!==null,onOpenChange:e=>!e&&z(null),children:(0,V.jsxs)(de,{children:[(0,V.jsxs)(ue,{children:[(0,V.jsx)(oe,{children:`Delete Rule`}),(0,V.jsxs)(se,{children:[`Are you sure you want to delete the rule "`,R?.name,`"? This action cannot be undone.`]})]}),(0,V.jsxs)(ce,{children:[(0,V.jsx)(ie,{children:`Cancel`}),(0,V.jsx)(fe,{onClick:()=>R&&void ye(R),disabled:H,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:H?`Deleting...`:`Delete`})]})]})})]}):(0,V.jsx)(w,{children:`Select a project to manage rules.`})}export{W as SettingsRulesView,W as default};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,E as r,I as i,Ii as a,Is as o,Lr as s,Ns as c,Pi as l,Pt as u,Qr as d,Rr as f,Yr as p,Zr as m,bt as h,ei as g,fs as _,nn as v,ta as y,zr as b}from"./dialogs-config-DAMqiy-4.js";import{A as ee,C as x,D as S,E as te,F as ne,M as re,N as C,O as ie,P as ae,S as w,T,b as E,j as D,k as O,x as oe,y as k}from"./history-view-lvvTzW7O.js";import{B as A,L as j,P as M,W as N}from"./index-C_iiobDl.js";import{t as P}from"./skeleton-rEPpLCqo.js";import{n as F,t as I}from"./radio-group-C6EDTFov.js";import{i as se,n as ce,r as L,t as le}from"./settings-list-BapKAJV3.js";import{t as ue}from"./mcp-server-card-DPMxJJU6.js";import{i as R,n as z,r as B}from"./slug-utils-DZ59sTAJ.js";var V=e(o(),1),H=c();function de({projectId:e,threadId:t,onCommandCreated:n}){let[i,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(`default`),[h,g]=(0,V.useState)(!1),v=B(i),y=z(v),b=async()=>{if(!(!y||!e)){g(!0);try{await r(v,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:d===`plan`?`plan`:void 0},`project`,t??void 0),A({title:`Command created`,description:`Command '/${v}' was created successfully.`}),o(``),c(``),u(``),f(`default`),n?.(v)}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{g(!1)}}};return e?(0,H.jsx)(S,{children:(0,H.jsxs)(k,{children:[(0,H.jsx)(w,{title:`Add Slash Command`,description:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`}),(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsxs)(E,{title:`Command Name`,children:[(0,H.jsx)(m,{id:`commandName`,value:i,onChange:e=>o(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,H.jsxs)(`p`,{className:a(_.caption,`mt-2`),children:[`Command: `,(0,H.jsxs)(`span`,{className:`font-mono`,children:[`/`,v||`...`]})]}):null]}),(0,H.jsx)(E,{title:`Description`,children:(0,H.jsx)(m,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,H.jsx)(E,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,children:(0,H.jsx)(m,{id:`argumentHint`,value:l,onChange:e=>u(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,H.jsx)(E,{title:`Mode`,description:d==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,children:(0,H.jsxs)(I,{value:d,onValueChange:e=>f(e),className:`flex gap-4`,disabled:h,children:[(0,H.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,H.jsx)(F,{value:`default`,id:`mode-default`}),(0,H.jsx)(p,{htmlFor:`mode-default`,className:a(_.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,H.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,H.jsx)(F,{value:`plan`,id:`mode-plan`}),(0,H.jsx)(p,{htmlFor:`mode-plan`,className:a(_.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,H.jsx)(R,{onContinue:()=>void b(),disabled:!y,creating:h})]})]})}):(0,H.jsx)(T,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function U(){let e=N(e=>e.selectedProjectId),o=N(e=>e.selectedThreadId),{setActiveMainTab:c}=j(),{setPendingExplorerPath:p,triggerExplorerRefresh:m,setExplorerClearPath:E}=M(),[k,F]=(0,V.useState)([]),[I,R]=(0,V.useState)(!1),[z,B]=(0,V.useState)(!1),[U,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(!1),[q,J]=(0,V.useState)([]),[Y,X]=(0,V.useState)(new Map),[Z,fe]=(0,V.useState)(``),Q=(0,V.useCallback)(async()=>{if(o){R(!0);try{let e=await u(o);F(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{F([]),X(new Map)}finally{R(!1)}}},[o]);(0,V.useEffect)(()=>{Q()},[Q]),(0,V.useEffect)(()=>{h().then(J).catch(()=>J([]))},[]);let pe=(0,V.useCallback)(async e=>{K(!0);try{await i(e.filePath),E(e.filePath),m(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),A({title:`Command removed`,description:`/${e.name}`}),W(null),await Q()}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{K(!1)}},[Q,m,E]),me=(0,V.useCallback)(e=>{p(e),c(`explorer`)},[p,c]),he=(0,V.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),ge=(0,V.useCallback)(async e=>{if(!(!o||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let t=`.agents/commands`;await v(o,e.gitHubRepo,e.gitHubFolder,t);let n=`${t}/${e.name}.md`;X(t=>new Map(t).set(e.name,n))}else{let t=await r(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,o);X(n=>new Map(n).set(e.name,t.filePath))}m(),Q(),A({title:`Command installed`,description:`/${e.name}`})}catch(e){A({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[o,Y,m,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{children:(0,H.jsxs)(te,{children:[(0,H.jsx)(w,{title:`Slash Commands`,description:`Manage slash commands. Commands are quick actions available via / in chat.`,action:(0,H.jsx)(l,{onClick:()=>B(!0),disabled:!o,children:`Add Command`})}),!o&&(0,H.jsx)(oe,{children:`Select a thread to add or install slash commands.`}),(0,H.jsx)(x,{title:`Installed`}),I?(0,H.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,H.jsx)(P,{className:`h-12 w-full`}),(0,H.jsx)(P,{className:`h-12 w-full`})]}):k.length===0?(0,H.jsx)(le,{icon:y,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`}):(0,H.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:k.map((e,r)=>(0,H.jsxs)(`div`,{className:a(`group grid min-h-13 grid-cols-[minmax(0,1fr)_auto_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,r>0&&`border-t border-border`),children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>me(e.filePath),className:`min-w-0 text-left`,children:[(0,H.jsxs)(`div`,{className:a(_.body,`truncate`),children:[`/`,e.name]}),(0,H.jsx)(`div`,{className:a(_.compact,`truncate text-muted-foreground`),children:he(e)})]}),e.metadata?.mode?(0,H.jsx)(`span`,{className:a(_.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,H.jsx)(`div`,{}),(0,H.jsx)(b,{children:(0,H.jsxs)(s,{children:[(0,H.jsx)(n,{asChild:!0,children:(0,H.jsx)(l,{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:()=>W(e),"aria-label":`Delete /${e.name}`,children:(0,H.jsx)(t,{className:`h-4 w-4`})})}),(0,H.jsx)(f,{children:`Remove this slash command from the project`})]})})]},e.filePath))}),(0,H.jsx)(x,{title:`Available`,className:`mb-0`}),(0,H.jsx)(se,{placeholder:`Search available commands...`,value:Z,onChange:fe}),q.length===0?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(P,{className:`h-20 w-full`}),(0,H.jsx)(P,{className:`h-20 w-full`})]}):$.length===0?(0,H.jsx)(L,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,H.jsx)(ce,{children:$.map(e=>{let t=Y.has(e.name);return(0,H.jsx)(ue,{name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||ge(e)},showInstalledControls:!1},e.id)})})]})}),(0,H.jsx)(d,{open:z,onOpenChange:B,children:(0,H.jsx)(g,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,H.jsx)(de,{projectId:e,threadId:o,onCommandCreated:()=>{B(!1),Q(),m()}})})}),(0,H.jsx)(ie,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,H.jsxs)(D,{children:[(0,H.jsxs)(ae,{children:[(0,H.jsx)(ne,{children:`Delete Slash Command`}),(0,H.jsxs)(re,{children:[`Are you sure you want to delete "/`,U?.name,`"? This action cannot be undone.`]})]}),(0,H.jsxs)(C,{children:[(0,H.jsx)(ee,{children:`Cancel`}),(0,H.jsx)(O,{onClick:()=>U&&void pe(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,H.jsx)(T,{children:`Select a project to manage slash commands.`})}export{U as SettingsSlashCommandsView,U as default};
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Br as n,Ct as r,Ii as i,Is as a,Ji as o,Lr as s,Ns as c,O as l,P as u,Pi as d,Qr as f,R as p,Rr as m,Zr as h,ei as ee,fs as g,gt as te,nn as ne,wn as re,zr as _,zt as v}from"./dialogs-config-DAMqiy-4.js";import{A as ie,C as y,D as b,E as ae,F as oe,M as se,N as ce,O as le,P as ue,S as x,T as S,b as C,j as de,k as w,x as T,y as E}from"./history-view-lvvTzW7O.js";import{B as D,H as O,L as fe,P as pe,W as k}from"./index-C_iiobDl.js";import{t as A}from"./skeleton-rEPpLCqo.js";import{i as j,n as M,r as N,t as P}from"./settings-list-BapKAJV3.js";import{t as F}from"./mcp-server-card-DPMxJJU6.js";import{i as I,n as L,r as R}from"./slug-utils-DZ59sTAJ.js";var z=e(a(),1),B=c();function me({threadId:e,onAgentCreated:t}){let[n,r]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1),f=R(n),p=L(f),m=async()=>{if(!(!p||!a.trim()||!e)){d(!0);try{let n=await l(e,f,a.trim(),s.trim()||void 0);D({title:`Agent created`,description:`Agent '${f}' was created successfully.`}),r(``),o(``),c(``),t?.(n.path,`AGENTS.md`)}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{d(!1)}}};return e?(0,B.jsx)(b,{children:(0,B.jsxs)(E,{children:[(0,B.jsx)(x,{title:`Add Agent`,description:`Create a new agent. The agent will be saved as an AGENTS.md file in the .agents folder.`}),(0,B.jsxs)(`div`,{className:`space-y-6`,children:[(0,B.jsxs)(C,{title:`Agent Name`,children:[(0,B.jsx)(h,{id:`agentName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:u}),n?(0,B.jsxs)(`p`,{className:i(g.caption,`mt-2`),children:[`Folder name: `,(0,B.jsx)(`span`,{className:`font-mono`,children:f||`...`})]}):null]}),(0,B.jsx)(C,{title:`Description`,children:(0,B.jsx)(O,{id:`agentDescription`,value:a,onChange:e=>o(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:u})}),(0,B.jsx)(C,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,children:(0,B.jsx)(h,{id:`agentTools`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g. read grep glob`,disabled:u})}),(0,B.jsx)(I,{onContinue:()=>void m(),disabled:!p||!a.trim(),creating:u})]})]})}):(0,B.jsx)(S,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function V(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...V(n.children));return t}function H(){let e=k(e=>e.selectedProjectId),a=k(e=>e.selectedThreadId),{setActiveMainTab:c}=fe(),{setPendingExplorerPath:l,triggerExplorerRefresh:h,setExplorerClearPath:C}=pe(),[E,O]=(0,z.useState)([]),[I,L]=(0,z.useState)(!1),[R,H]=(0,z.useState)(!1),[U,W]=(0,z.useState)(null),[G,K]=(0,z.useState)(!1),[q,J]=(0,z.useState)([]),[Y,X]=(0,z.useState)(new Set),[Z,he]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(e){L(!0);try{let t=V(await r(e));if(a)try{let e=V(await v(a)),n=new Set(t.map(e=>e.path));for(let r of e)n.has(r.path)||t.push(r)}catch{}t.sort((e,t)=>e.name.localeCompare(t.name)),O(t),X(new Set(t.map(e=>`${e.path}/AGENT.md`)))}catch{O([]),X(new Set)}finally{L(!1)}}},[e,a]);(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{te().then(J).catch(()=>J([]))},[]);let ge=(0,z.useCallback)(async t=>{if(!e)return;let n=t.name,r=t.path;K(!0);try{try{await u(e,r)}catch{if(a)await p(a,r);else throw Error(`No thread selected to delete from`)}C(r),h(),X(e=>{let t=new Set(e);return t.delete(`${r}/AGENT.md`),t}),D({title:`Agent removed`,description:n}),W(null),await Q()}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to remove agent`,variant:`destructive`})}finally{K(!1)}},[e,a,Q,h,C]),_e=(0,z.useCallback)(e=>{l(`${e}/AGENT.md`),c(`explorer`)},[l,c]),ve=(0,z.useCallback)(async e=>{let t=`.agents/agents/${e.id}/AGENT.md`;if(!(!a||Y.has(t)))try{if(e.gitHubRepo&&e.gitHubFolder)await ne(a,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let n=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&n.push(`tools: ${e.tools}`),n.push(`---`,``,e.systemPrompt),await re(a,t,n.join(`
2
- `))}X(e=>new Set(e).add(t)),h(),Q(),D({title:`Agent installed`,description:e.name})}catch(e){D({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[a,Y,h,Q]),$=Z.trim()?q.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):q;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(b,{children:(0,B.jsxs)(ae,{children:[(0,B.jsx)(x,{title:`Subagents`,description:`Manage subagents. Subagents are specialized agents for focused tasks.`,action:(0,B.jsx)(d,{onClick:()=>H(!0),disabled:!a,children:`Add Subagent`})}),!a&&(0,B.jsx)(T,{children:`Select a thread to add or install subagents.`}),(0,B.jsx)(y,{title:`Installed`}),I?(0,B.jsxs)(`div`,{className:`space-y-3 mb-8`,children:[(0,B.jsx)(A,{className:`h-12 w-full`}),(0,B.jsx)(A,{className:`h-12 w-full`})]}):E.length===0?(0,B.jsx)(P,{icon:o,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`}):(0,B.jsx)(`div`,{className:`mb-8 overflow-hidden rounded-md border border-border`,children:E.map((e,r)=>(0,B.jsxs)(`div`,{className:i(`group grid min-h-13 grid-cols-[minmax(0,1fr)_1.75rem] items-center gap-3 px-3 py-3 hover:bg-muted/30`,r>0&&`border-t border-border`),children:[(0,B.jsx)(`button`,{type:`button`,onClick:()=>_e(e.path),className:i(g.body,`truncate text-left`),children:e.name}),(0,B.jsx)(_,{children:(0,B.jsxs)(s,{children:[(0,B.jsx)(n,{asChild:!0,children:(0,B.jsx)(d,{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:()=>W(e),"aria-label":`Delete ${e.name}`,children:(0,B.jsx)(t,{className:`h-4 w-4`})})}),(0,B.jsx)(m,{children:`Remove this subagent from the project`})]})})]},e.id))}),(0,B.jsx)(y,{title:`Available`,className:`mb-0`}),(0,B.jsx)(j,{placeholder:`Search available subagents...`,value:Z,onChange:he}),q.length===0?(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(A,{className:`h-20 w-full`}),(0,B.jsx)(A,{className:`h-20 w-full`})]}):$.length===0?(0,B.jsx)(N,{searchQuery:Z,emptyLabel:`No available subagents found.`}):(0,B.jsx)(M,{children:$.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=Y.has(t);return(0,B.jsx)(F,{name:e.name,description:e.description,installed:n,onClick:()=>{n||ve(e)},showInstalledControls:!1},e.id)})})]})}),(0,B.jsx)(f,{open:R,onOpenChange:H,children:(0,B.jsx)(ee,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(me,{threadId:a,onAgentCreated:()=>{H(!1),Q(),h()}})})}),(0,B.jsx)(le,{open:U!==null,onOpenChange:e=>!e&&W(null),children:(0,B.jsxs)(de,{children:[(0,B.jsxs)(ue,{children:[(0,B.jsx)(oe,{children:`Delete Subagent`}),(0,B.jsxs)(se,{children:[`Are you sure you want to delete the subagent "`,U?.name,`"? This action cannot be undone.`]})]}),(0,B.jsxs)(ce,{children:[(0,B.jsx)(ie,{children:`Cancel`}),(0,B.jsx)(w,{onClick:()=>U&&void ge(U),disabled:G,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:G?`Deleting...`:`Delete`})]})]})})]}):(0,B.jsx)(S,{children:`Select a project to manage subagents.`})}export{H as SettingsSubagentsView,H as default};
@@ -1 +0,0 @@
1
- import{Ii as e,Ns as t,Ps as n}from"./dialogs-config-DAMqiy-4.js";var r=n(),i=t();function a(t){let n=(0,r.c)(8),a,o;n[0]===t?(a=n[1],o=n[2]):({className:a,...o}=t,n[0]=t,n[1]=a,n[2]=o);let s;n[3]===a?s=n[4]:(s=e(`animate-pulse rounded-md bg-muted`,a),n[3]=a,n[4]=s);let c;return n[5]!==o||n[6]!==s?(c=(0,i.jsx)(`div`,{className:s,...o}),n[5]=o,n[6]=s,n[7]=c):c=n[7],c}export{a as t};
@@ -1 +0,0 @@
1
- import{Ba as e,No as t,Ns as n,Pi as r,Ps as i}from"./dialogs-config-DAMqiy-4.js";var a=i(),o=n();function s(n){let i=(0,a.c)(6),{onContinue:s,disabled:c,creating:l}=n,u=c||l,d;i[0]===l?d=i[1]:(d=l?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,o.jsxs)(o.Fragment,{children:[`Continue`,(0,o.jsx)(t,{className:`ml-2 h-4 w-4`})]}),i[0]=l,i[1]=d);let f;return i[2]!==s||i[3]!==u||i[4]!==d?(f=(0,o.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,o.jsx)(r,{onClick:s,disabled:u,children:d})}),i[2]=s,i[3]=u,i[4]=d,i[5]=f):f=i[5],f}function c(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function l(e){return e.replace(/-/g,` `).split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function u(e){return e.length>0&&e.length<=64}export{s as i,u as n,c as r,l as t};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ii as t,Is as n,Ns as r,Ps as i}from"./dialogs-config-DAMqiy-4.js";import{c as a,d as o,l as s,u as c}from"./react-vendor-U9lUQswz.js";var l=i(),u=e(n(),1),d=r(),f=c,p=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground`,i),r[3]=i,r[4]=o);let c;return r[5]!==a||r[6]!==n||r[7]!==o?(c=(0,d.jsx)(s,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=c):c=r[8],c});p.displayName=s.displayName;var m=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let s;r[3]===i?s=r[4]:(s=t(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-base font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm`,i),r[3]=i,r[4]=s);let c;return r[5]!==a||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(o,{ref:n,className:s,...a}),r[5]=a,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});m.displayName=o.displayName;var h=u.forwardRef((e,n)=>{let r=(0,l.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let s;r[3]===i?s=r[4]:(s=t(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i),r[3]=i,r[4]=s);let c;return r[5]!==o||r[6]!==n||r[7]!==s?(c=(0,d.jsx)(a,{ref:n,className:s,...o}),r[5]=o,r[6]=n,r[7]=s,r[8]=c):c=r[8],c});h.displayName=a.displayName;export{m as i,h as n,p as r,f as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dialogs-config-DAMqiy-4.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Br as n,D as r,Dt as i,Fo as a,Ii as o,Is as s,Kn as c,Ko as l,Lr as u,Lt as d,Ns as f,Pi as p,Ps as m,Qr as h,Rr as g,Sa as ee,Xn as _,Yn as v,Zn as y,bo as te,c as ne,ei as re,er as b,fs as x,ii as ie,ni as S,ri as C,rn as w,tr as T,xt as E}from"./dialogs-config-DAMqiy-4.js";import{r as D}from"./monaco-CZnIWXyV.js";import{a as O,l as k,n as A,o as j,s as M}from"./history-view-lvvTzW7O.js";import{A as N,D as P,E as F,H as I,K as L,L as R,T as z,U as ae,W as B}from"./index-C_iiobDl.js";var V=e(s(),1),H=m();async function U(e){return y(`api/projects/${_(e)}/tasks`)}async function oe(e,t,n){return T(`api/projects/${_(e)}/tasks`,{description:t,threadId:n?.threadId,provider:n?.provider,model:n?.model})}async function W(e,t,n){return b(`api/projects/${_(e)}/tasks/${_(t)}`,n)}async function se(e,t){await v(`api/projects/${_(e)}/tasks/${_(t)}`)}function G(e,t){return`project-tasks:${e}:${t}`}function K(e){return e.status===`Done`?`Done`:e.working?`Working`:`Ready`}function q(e){return e.status!==`Done`&&!e.working}function ce(e,t){if(t)return t;let n=e?.threads.map(e=>e.title)??[],r=/^thread-(\d+)$/i,i=0;for(let e of n){let t=e.match(r);t&&(i=Math.max(i,parseInt(t[1],10)))}return`thread-${i+1}`}async function le(e){w(),M(`projects:bootstrap:`);let t=await i();e({type:L.SetProjects,projects:t.projects}),e({type:L.SetProjectsLoading,projectsLoading:!1})}async function J(e){let t=await U(e),n=t.filter(e=>e.threadId&&e.status!==`Done`),r=[...t];return await Promise.all(n.map(async t=>{try{await d(t.threadId)}catch(n){if(n instanceof Error&&n.message.includes(`not found`)){let n=await W(e,t.id,{status:`Done`}),i=r.findIndex(e=>e.id===t.id);i!==-1&&(r[i]=n)}}})),r}async function ue(e,t){let n=e.getReader(),r=new TextDecoder,i=``,a=null;try{for(;;){let{done:e,value:o}=await n.read();if(e)break;i+=r.decode(o,{stream:!0});let s=i.split(`
3
- `);i=s.pop()??``;for(let e of s){let n=e.trim();if(n)try{let e=JSON.parse(n);e.type===`progress`&&typeof e.threadId==`string`&&!a&&(a=e.threadId,t(a))}catch{}}}}catch{}return a}function de(e){return[...e].sort((e,t)=>e.status===`Done`&&t.status!==`Done`?1:e.status!==`Done`&&t.status===`Done`||e.working&&!t.working?-1:!e.working&&t.working?1:new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}var Y=l(`app.task-agent-run.ui`);async function fe(e,t){let n=await d(t),r=n.model,i=n.modelProvider;if(r&&i)return{model:r,provider:i};try{let t=(await y(`api/threads?projectId=${encodeURIComponent(e)}`)||[]).map(e=>{let t=e;return{model:t.model??void 0,modelProvider:t.modelProvider??void 0}}).find(e=>e.model&&e.modelProvider);if(t?.model&&t.modelProvider)return{model:t.model,provider:t.modelProvider}}catch(e){Y.error(`Failed to get project threads:`,e)}return null}function X(e,t,n,r){e({type:L.SetProjectModel,threadId:t,model:{id:n,provider:r,name:n,description:``}}),c(t,{model:n,modelProvider:r})}async function pe(e,t,n,r,i,a){i||a(await W(e,t.id,{status:n,working:!0,threadId:r}))}var Z=f();function me({task:e,disabled:n=!1,onImplementInNewThread:r,onImplementInThisThread:i,onMarkDone:s}){let[c,l]=(0,V.useState)(!1),u=K(e),d=q(e),f=e.status!==`Done`,m=n||c||!d&&!f;async function h(e){l(!0);try{await e()}finally{l(!1)}}return(0,Z.jsxs)(z,{children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsxs)(p,{variant:`outline`,size:`sm`,className:o(`shrink-0 gap-1.5`,e.working&&`border-primary/50`),disabled:m,children:[(c||e.working)&&(0,Z.jsx)(t,{className:`h-3.5 w-3.5 animate-spin`}),(0,Z.jsx)(`span`,{children:u}),!m&&(0,Z.jsx)(a,{className:`h-3.5 w-3.5 opacity-60`})]})}),(0,Z.jsxs)(F,{align:`end`,children:[d&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(P,{onClick:()=>void h(()=>r(e)),children:`Implement in New Thread`}),(0,Z.jsx)(P,{onClick:()=>void h(()=>i(e)),children:`Implement in this thread`})]}),f&&(0,Z.jsx)(P,{onClick:()=>void h(()=>s(e)),children:`Mark done`})]})]})}var Q=l(`app.task-list.ui`);function he({projectId:e,onThreadSelect:i,initialTasks:a}){let s=ae(),c=B(e=>e.projects),l=B(e=>e.selectedThreadId),d=B(e=>e.processingThreadIds),f=B(e=>e.pendingChatMessage),m=B(e=>e.queuedChatMessages),_=B(e=>e.projectModelSelections),v=c.find(t=>t.projectId===e),y=v?.threads.find(e=>e.threadId===l),b=l?_[l]:void 0,[w,T]=(0,V.useState)(a),[E,D]=(0,V.useState)(!1),[O,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(``),[M,N]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!w.some(e=>e.working))return;let t=setInterval(async()=>{try{let n=await U(e);T(n),n.some(e=>e.working)||clearInterval(t)}catch(e){Q.error(`Failed to poll project tasks:`,e)}},2e3);return()=>clearInterval(t)},[w,e]),(0,V.useEffect)(()=>{T(a)},[a]),(0,V.useEffect)(()=>{E&&j(``)},[E]);function P(e){T(t=>t.map(t=>t.id===e.id?e:t))}function F(e){j(e.description),k({task:e})}function R(){k(null),j(``)}async function z(){if(A.trim()){N(!0);try{let t=await oe(e,A,{threadId:l??void 0,provider:b?.provider??y?.modelProvider,model:b?.id??y?.model});T(e=>[...e,t]),D(!1),j(``)}finally{N(!1)}}}async function H(){if(!(!A.trim()||!O)){N(!0);try{let t=await W(e,O.task.id,{description:A,threadId:l??void 0,provider:b?.provider??y?.modelProvider,model:b?.id??y?.model});T(e=>e.map(e=>e.id===t.id?t:e)),R()}finally{N(!1)}}}async function G(){if(O){N(!0);try{await se(e,O.task.id),T(e=>e.filter(e=>e.id!==O.task.id)),R()}finally{N(!1)}}}async function K(t){let n=await r(e);if(!n)return;let a=null,o=null,c=await ue(n,n=>{o||(o=n,s({type:L.AddCreatingThread,projectId:e,threadId:n,title:ce(v)}),s({type:L.AddProcessingThread,threadId:n})),W(e,t.id,{status:`Build`,working:!0,threadId:n}).then(e=>{a=e,P(e)})});if(!c){o&&(s({type:L.RemoveCreatingThread,projectId:e,threadId:o}),s({type:L.RemoveProcessingThread,threadId:o}));return}s({type:L.RemoveProcessingThread,threadId:c});try{await le(s)}catch(e){Q.error(`Failed to refresh projects after task thread creation:`,e)}await pe(e,t,`Build`,c,a,P);let l=await fe(e,c);if(!l){Q.error(`No model configuration found. Please configure a model and provider for this project first.`);return}X(s,c,l.model,l.provider),i?await i(c):s({type:L.SelectThread,threadId:c,projectId:e}),s({type:L.SetPendingChatMessage,message:{threadId:c,message:t.description,model:l.model,provider:l.provider}})}async function q(t){if(!l){Q.error(`No selected thread found for project task implementation.`);return}let n=await fe(e,l);if(!n){Q.error(`No model configuration found. Please configure a model and provider for this project first.`);return}if(X(s,l,n.model,n.provider),P(await W(e,t.id,{status:`Build`,working:!0,threadId:l})),i?await i(l):s({type:L.SelectThread,threadId:l,projectId:e}),d.includes(l)||f?.threadId===l||m.some(e=>e.threadId===l)){s({type:L.EnqueueChatMessage,message:{id:crypto.randomUUID(),threadId:l,paneId:`primary`,message:t.description,model:n.model,attachments:[],provider:n.provider}});return}s({type:L.SetPendingChatMessage,message:{threadId:l,message:t.description,model:n.model,provider:n.provider}})}async function J(t){P(await W(e,t.id,{status:`Done`,working:!1}))}let Y=de(w);return(0,Z.jsxs)(`div`,{className:`relative flex h-full min-h-0 min-w-0 flex-col overflow-hidden`,children:[(0,Z.jsx)(ne,{className:`min-h-0 min-w-0 flex-1 overflow-hidden pb-24`,children:Y.length===0?(0,Z.jsx)(`p`,{className:o(x.bodyMuted,`px-4 py-8 text-center`),children:`No tasks yet. Add one to get started.`}):(0,Z.jsx)(`div`,{className:`min-w-0 w-full divide-y divide-border`,children:Y.map(e=>(0,Z.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:[(0,Z.jsxs)(`button`,{type:`button`,className:`col-start-1 row-start-1 block min-w-0 overflow-hidden text-left sm:flex-1`,onClick:()=>F(e),children:[(0,Z.jsx)(`p`,{className:o(x.label,`truncate`),children:e.title}),(0,Z.jsx)(`p`,{className:o(x.caption,`mt-1 line-clamp-2 break-all text-muted-foreground max-sm:hidden`),children:e.description})]}),(0,Z.jsx)(`button`,{type:`button`,className:`col-span-2 row-start-2 block min-w-0 overflow-hidden text-left sm:hidden`,onClick:()=>F(e),children:(0,Z.jsx)(`p`,{className:o(x.caption,`line-clamp-4 break-all text-muted-foreground`),children:e.description})}),(0,Z.jsxs)(`div`,{className:`col-start-2 row-start-1 flex shrink-0 items-center gap-1.5 self-start`,children:[e.threadId&&i&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(n,{asChild:!0,children:(0,Z.jsxs)(p,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0`,onClick:()=>i(e.threadId),children:[(0,Z.jsx)(te,{className:`h-4 w-4`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Open thread`})]})}),(0,Z.jsx)(g,{children:`Open thread`})]}),(0,Z.jsx)(me,{task:e,onImplementInNewThread:K,onImplementInThisThread:q,onMarkDone:J})]})]},e.id))})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(n,{asChild:!0,children:(0,Z.jsxs)(p,{size:`icon`,className:`absolute bottom-6 right-6 z-10 h-14 w-14 rounded-full shadow-lg`,onClick:()=>D(!0),children:[(0,Z.jsx)(ee,{className:`h-6 w-6`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Add task`})]})}),(0,Z.jsx)(g,{children:`Add task`})]}),(0,Z.jsx)(h,{open:E,onOpenChange:D,children:(0,Z.jsxs)(re,{className:`sm:max-w-2xl`,children:[(0,Z.jsx)(C,{children:(0,Z.jsx)(ie,{children:`Add Task`})}),(0,Z.jsxs)(`div`,{className:`py-2`,children:[(0,Z.jsx)(I,{placeholder:`Describe what needs to be done...`,value:A,onChange:e=>j(e.target.value),rows:12,className:`resize-none text-base`,autoFocus:!0,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&z()}}),(0,Z.jsx)(`p`,{className:o(x.caption,`mt-1.5`),children:`A title will be generated automatically from your description.`})]}),(0,Z.jsx)(S,{children:(0,Z.jsx)(p,{onClick:()=>void z(),disabled:M||!A.trim(),children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Generating title...`]}):`Add`})})]})}),(0,Z.jsx)(h,{open:O!==null,onOpenChange:e=>!e&&R(),children:(0,Z.jsxs)(re,{className:`max-w-2xl flex-col 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:overflow-y-auto 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,Z.jsx)(C,{children:(0,Z.jsx)(ie,{children:`Edit Task`})}),(0,Z.jsx)(`div`,{className:`py-2`,children:(0,Z.jsx)(I,{placeholder:`Describe what needs to be done...`,value:A,onChange:e=>j(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)&&H()}})}),(0,Z.jsxs)(S,{className:`flex-row justify-between gap-2 sm:gap-0`,children:[(0,Z.jsx)(p,{variant:`destructive`,onClick:()=>void G(),disabled:M,children:`Delete`}),(0,Z.jsx)(p,{onClick:()=>void H(),disabled:M||!A.trim(),className:`w-auto`,children:M?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(t,{className:`mr-1 h-3 w-3 animate-spin`}),`Saving...`]}):`Save`})]})]})})]})}function ge(e){let t=(0,H.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({projectId:r,loadVersion:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=G(r,n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;t[7]===r?o=t[8]:(o=()=>J(r),t[7]=r,t[8]=o);let s=O(a,o),c;return t[9]!==s||t[10]!==r||t[11]!==i?(c=(0,Z.jsx)(he,{projectId:r,initialTasks:s,...i}),t[9]=s,t[10]=r,t[11]=i,t[12]=c):c=t[12],c}function _e(e){let t=(0,H.c)(18),n,r;t[0]===e?(n=t[1],r=t[2]):({refreshTrigger:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,[a,o]=(0,V.useState)(0),s,c;t[3]!==n.projectId||t[4]!==i?(s=()=>{i!==0&&o(e=>(j(G(n.projectId,e)),e+1))},c=[i,n.projectId],t[3]=n.projectId,t[4]=i,t[5]=s,t[6]=c):(s=t[5],c=t[6]),(0,V.useEffect)(s,c);let l;t[7]!==a||t[8]!==n.projectId?(l=function(){j(G(n.projectId,a)),o(ve)},t[7]=a,t[8]=n.projectId,t[9]=l):l=t[9];let u=l,d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(k,{className:`h-64`}),t[10]=d):d=t[10];let f=`${n.projectId}:${a}`,p;t[11]!==a||t[12]!==n||t[13]!==f?(p=(0,Z.jsx)(V.Suspense,{fallback:d,children:(0,Z.jsx)(ge,{...n,loadVersion:a},f)}),t[11]=a,t[12]=n,t[13]=f,t[14]=p):p=t[14];let m;return t[15]!==u||t[16]!==p?(m=(0,Z.jsx)(A,{fallbackTitle:`Failed to load tasks`,onRetry:u,children:p}),t[15]=u,t[16]=p,t[17]=m):m=t[17],m}function ve(e){return e+1}var $=l(`app.tasks-view.ui`);function ye({projectId:e,refreshTrigger:t}){let n=ae(),r=B(e=>e.projects),i=B(e=>e.selectedThreadId),a=B(e=>e.selectedProjectId),{setActiveMainTab:o}=R();async function s(t){if(r.find(t=>t.projectId===e)){o(`chat`);try{let{getProjects:r,invalidateProjectsCache:o}=await D(async()=>{let{getProjects:e,invalidateProjectsCache:t}=await import(`./dialogs-config-DAMqiy-4.js`).then(e=>e.f);return{getProjects:e,invalidateProjectsCache:t}},__vite__mapDeps([0,1]));o();let s=await r();n({type:L.SetProjects,projects:s.projects});let c=s.projects.find(t=>t.projectId===e);if(c&&c.threads.find(e=>e.threadId===t)){(i!==t||a!==e)&&n({type:L.SelectThread,threadId:t,projectId:e});try{let e=await E();n({type:L.SetProcessingThreads,threadIds:e})}catch(e){$.error(`Failed to fetch processing threads after thread selection:`,e)}}}catch(r){$.error(`Failed to refresh projects for thread selection:`,r),(i!==t||a!==e)&&n({type:L.SelectThread,threadId:t,projectId:e});try{let e=await E();n({type:L.SetProcessingThreads,threadIds:e})}catch(e){$.error(`Failed to fetch processing threads after fallback thread selection:`,e)}}}}return(0,Z.jsx)(`div`,{className:`relative flex h-full min-w-0 flex-col overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`min-w-0 flex-1 overflow-hidden pt-8`,children:(0,Z.jsx)(_e,{projectId:e,refreshTrigger:t,onThreadSelect:s})})})}export{ye as TasksView};