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
@@ -0,0 +1 @@
1
+ import{$i as e,Br as t,Fs as n,Ii as r,Io as i,Is as a,Lr as o,Pi as s,Rr as c,bo as l,fs as u,zr as d}from"./dialogs-config-86QTDk4G.js";import{I as f}from"./history-view-BsN806ip.js";var p=a(),m=n(),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(n){let a=(0,p.c)(18),{name:f,description:g,installed:_,onClick:v,onOpen:y,onUninstall:b,showInstalledControls:x}=n,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;a[0]===Symbol.for(`react.memo_cache_sentinel`)?(E=r(u.label,`truncate`),a[0]=E):E=a[0];let D;a[1]!==_||a[2]!==S?(D=_&&S&&(0,m.jsx)(d,{delayDuration:300,children:(0,m.jsxs)(o,{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)(i,{className:`h-2.5 w-2.5 text-green-600 dark:text-green-400`})})}),(0,m.jsx)(c,{children:`Installed`})]})}),a[1]=_,a[2]=S,a[3]=D):D=a[3];let O;a[4]!==_||a[5]!==y||a[6]!==b||a[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)(o,{children:[(0,m.jsx)(t,{asChild:!0,children:(0,m.jsx)(s,{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)(o,{children:[(0,m.jsx)(t,{asChild:!0,children:(0,m.jsx)(s,{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`})]})})]}),a[4]=_,a[5]=y,a[6]=b,a[7]=S,a[8]=O):O=a[8];let k;a[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=r(u.caption,`line-clamp-3`),a[9]=k):k=a[9];let A;return a[10]!==g||a[11]!==f||a[12]!==C||a[13]!==w||a[14]!==T||a[15]!==D||a[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}),a[10]=g,a[11]=f,a[12]=C,a[13]=w,a[14]=T,a[15]=D,a[16]=O,a[17]=A):A=a[17],A};export{g as t};
@@ -0,0 +1 @@
1
+ import{Fs as e,Is as t,Pi 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-86QTDk4G.js";import{a as d}from"./onboarding-DCrFdRM5.js";var f=t(),p=e();function m(e){let t=(0,f.c)(30),{open:m,onOpenChange:h,onNewBranch:g,onJustOpen:_,newChatOnNewBranch:v,onNewChatOnNewBranchChange:y,isLoading:b,projectName:x}=e,S=b===void 0?!1:b,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(s,{children:`Pull Request Merged`}),t[0]=C):C=t[0];let w=x?` for ${x}`:``,T;t[1]===w?T=t[2]:(T=(0,p.jsxs)(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.`]})]}),t[1]=w,t[2]=T);let E;t[3]===y?E=t[4]:(E=e=>y(e===!0),t[3]=y,t[4]=E);let D;t[5]!==v||t[6]!==E?(D=(0,p.jsx)(d,{id:`new-chat-on-new-branch`,checked:v,onCheckedChange:E}),t[5]=v,t[6]=E,t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(i,{htmlFor:`new-chat-on-new-branch`,className:o.labelNormal,children:`New Chat`}),t[8]=O):O=t[8];let k;t[9]===D?k=t[10]:(k=(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,O]}),t[9]=D,t[10]=k);let A;t[11]!==S||t[12]!==_?(A=(0,p.jsx)(n,{variant:`ghost`,onClick:_,disabled:S,children:`Just Open`}),t[11]=S,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==S||t[15]!==g?(j=(0,p.jsx)(n,{onClick:g,disabled:S,children:`New Branch`}),t[14]=S,t[15]=g,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,p.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]!==M||t[21]!==k?(N=(0,p.jsxs)(c,{className:`flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[k,M]}),t[20]=M,t[21]=k,t[22]=N):N=t[22];let P;t[23]!==N||t[24]!==T?(P=(0,p.jsxs)(a,{children:[T,N]}),t[23]=N,t[24]=T,t[25]=P):P=t[25];let F;return t[26]!==h||t[27]!==m||t[28]!==P?(F=(0,p.jsx)(r,{open:m,onOpenChange:h,children:P}),t[26]=h,t[27]=m,t[28]=P,t[29]=F):F=t[29],F}export{m as MergedPRDialog};
@@ -0,0 +1 @@
1
+ import{Br as e,Fs as t,Is as n,Lr as r,Rr as i,fs as a,ra as o,zr as s}from"./dialogs-config-86QTDk4G.js";import{r as c}from"./onboarding-DCrFdRM5.js";var l=n(),u=t();function d(t){let n=(0,l.c)(9),{codingIndex:d,modelName:f}=t,p=c(d);if(p===0)return null;let m;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[1,2,3,4,5],n[0]=m):m=n[0];let h;n[1]===p?h=n[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))})}),n[1]=p,n[2]=h);let g;n[3]!==d||n[4]!==f?(g=(0,u.jsx)(i,{children:(0,u.jsxs)(`p`,{className:a.body,children:[f,` was indexed `,d,` for coding intelligence`]})}),n[3]=d,n[4]=f,n[5]=g):g=n[5];let _;return n[6]!==h||n[7]!==g?(_=(0,u.jsx)(s,{children:(0,u.jsxs)(r,{children:[h,g]})}),n[6]=h,n[7]=g,n[8]=_):_=n[8],_}export{d as t};
@@ -0,0 +1 @@
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,Fs as o,G as s,Ho as c,Ii as l,Io as u,Is as d,Jr as f,Ko as p,Li as m,Lr as h,Mi as g,Ni as _,Pi as v,Qr as y,Rr as b,Rs 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 ee,Xr as k,Yr as A,Zr as j,as as M,bo as N,c as P,ei as F,fa as te,fs as I,h as ne,ii as L,jo as re,jt as ie,ki as ae,kt as oe,n as R,ni as se,on as z,os as ce,r as B,ri as le,ti as V,vi as ue,vo as de,wo as fe,y as pe,yo as me,zr as H}from"./dialogs-config-86QTDk4G.js";import{I as U,_ as he,d as ge,f as _e,h as ve,m as ye,p as be,x as W}from"./history-view-BsN806ip.js";var G=d(),K=e(x(),1),q=o(),J=K.forwardRef((e,t)=>{let n=(0,G.c)(23),r,i,a,o,s,c,u,d,f;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6],u=n[7],d=n[8],f=n[9]):({className:i,selected:c,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]=c,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]!==c?(_=l(l(I.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`,c&&!o&&`bg-sidebar-accent text-sidebar-accent-foreground font-medium`,c&&o&&`font-bold text-foreground`,i),n[10]=i,n[11]=o,n[12]=c,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,q.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});J.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=K.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,q.jsx)(k.div,{"data-orientation":a,...o,...i,ref:t})});Te.displayName=Se;function Ee(e){return we.includes(e)}var De=Te,Oe=K.forwardRef((e,t)=>{let n=(0,G.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,c=o===void 0?!0:o,u=s===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,d;n[5]!==r||n[6]!==u?(d=l(`shrink-0 bg-border`,u,r),n[5]=r,n[6]=u,n[7]=d):d=n[7];let f;return n[8]!==c||n[9]!==s||n[10]!==i||n[11]!==t||n[12]!==d?(f=(0,q.jsx)(De,{ref:t,decorative:c,orientation:s,className:d,...i}),n[8]=c,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 M(e.slug)?ce({...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=p(`app.provider-selector.ui`);function Be(e){let t=(0,G.c)(17),{url:n,className:r,children:i,showIcon:a,variant:o}=e,s=a===void 0?!0:a,c=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 z(d)}catch(e){let t=e;ze.error(`Failed to open provider website:`,t)}},t[2]=d,t[3]=f);let p=f,m=c===`link`&&I.caption,h=c===`link`&&`text-brand hover:underline inline-flex items-center gap-1`,g=c===`inline`&&`inline hover:underline`,_;t[4]!==r||t[5]!==m||t[6]!==h||t[7]!==g?(_=l(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,q.jsxs)(q.Fragment,{children:[`Visit provider website`,s&&(0,q.jsx)(N,{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,q.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,G.c)(10),{provider:n,size:r}=e,i=r===void 0?`md`:r,[a,o]=(0,K.useState)(!1),s=i===`sm`?`h-6 w-6`:`h-8 w-8`,c=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=l(`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]!==c||t[4]!==a||t[5]!==n?(f=a?(0,q.jsx)(fe,{className:l(u,`text-muted-foreground`)}):(0,q.jsx)(`img`,{src:oe(n.slug),alt:`${n.name} logo`,className:l(c,`dark:invert`),onError:()=>o(!0)}),t[2]=u,t[3]=c,t[4]=a,t[5]=n,t[6]=f):f=t[6];let p;return t[7]!==d||t[8]!==f?(p=(0,q.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,G.c)(10),{provider:n,recommended:r}=e,i=r===void 0?!1:r,a;t[0]===n?a=t[1]:(a=(0,q.jsx)(Ve,{provider:n,size:`sm`}),t[0]=n,t[1]=a);let o;t[2]===n.name?o=t[3]:(o=(0,q.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,q.jsx)(`span`,{className:l(I.caption,`text-muted-foreground flex-shrink-0`),children:`(Recommended)`}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,q.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]=c):c=t[9],c}function Ue(e){let t=(0,G.c)(8),{providers:n}=e,r,i,a;if(t[0]!==n){let{recommended:e,others:o}=Ie(n);r=e&&(0,q.jsx)(be,{value:e.name,children:(0,q.jsx)(He,{provider:e,recommended:!0})},e.name),i=e&&o.length>0&&(0,q.jsx)(ye,{}),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,q.jsxs)(q.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,q.jsx)(be,{value:e.name,children:(0,q.jsx)(He,{provider:e})},e.name)}function Ge(e){let t=(0,G.c)(17),{providers:n,selectedProvider:r,onProviderChange:i}=e,a,o,s,c;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,q.jsx)(J,{selected:r?.name===e.name,asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,className:`justify-start w-full`,onClick:()=>i(e),children:[(0,q.jsx)(Ve,{provider:e}),(0,q.jsx)(`span`,{className:`truncate`,children:e.name}),n&&(0,q.jsx)(`span`,{className:l(I.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,q.jsx)(Oe,{className:`my-2`});let p;t[10]===f?p=t[11]:(p=e=>f(e),t[10]=f,t[11]=p),c=u.map(p),t[0]=i,t[1]=n,t[2]=r?.name,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else a=t[3],o=t[4],s=t[5],c=t[6];let u;return t[12]!==a||t[13]!==o||t[14]!==s||t[15]!==c?(u=(0,q.jsxs)(`div`,{className:a,children:[o,s,c]}),t[12]=a,t[13]=o,t[14]=s,t[15]=c,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,K.useState)([]),[f,p]=(0,K.useState)(!1);if((0,K.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,q.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,q.jsx)(r,{className:`h-4 w-4 animate-spin text-muted-foreground`})});let m=(0,q.jsxs)(q.Fragment,{children:[e?.url&&(0,q.jsx)(Be,{url:e.url}),i&&e&&(0,q.jsx)(qe,{provider:e,value:a??e.apiKey??``,onChange:o,isLoading:s})]});return l===`list`?(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&(0,q.jsx)(`p`,{className:I.error,children:c}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(A,{children:`AI Provider`}),(0,q.jsx)(Ge,{providers:u,selectedProvider:e,onProviderChange:t})]}),m]}):(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[c&&(0,q.jsx)(`p`,{className:I.error,children:c}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,q.jsx)(A,{children:`AI Provider`}),(0,q.jsxs)(ge,{value:e?.name??``,onValueChange:e=>{let n=u.find(t=>t.name===e);n&&t(n)},children:[(0,q.jsx)(ve,{children:e?(0,q.jsx)(He,{provider:e}):`Select a provider`}),(0,q.jsx)(_e,{children:(0,q.jsx)(Ue,{providers:u})})]})]}),m]})}function qe(e){let t=(0,G.c)(24),{provider:n,value:r,onChange:a,isLoading:o}=e,[s,c]=(0,K.useState)(!1);if(n.authType!==`APIKey`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,q.jsx)(W,{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,q.jsxs)(`div`,{className:`space-y-2 text-center`,children:[e,(0,q.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,q.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,q.jsx)(H,{children:(0,q.jsxs)(h,{children:[(0,q.jsx)(i,{asChild:!0,children:(0,q.jsx)(A,{htmlFor:`api-key`,className:`cursor-help`,children:`API Key`})}),(0,q.jsx)(b,{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,q.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 m;t[7]!==o||t[8]!==d||t[9]!==f||t[10]!==p||t[11]!==r?(m=(0,q.jsx)(j,{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]=m):m=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,q.jsx)(me,{className:`h-4 w-4 text-muted-foreground`}):(0,q.jsx)(de,{className:`h-4 w-4 text-muted-foreground`}),t[15]=s,t[16]=y);let x;t[17]!==g||t[18]!==_||t[19]!==y?(x=(0,q.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]=x):x=t[20];let S;return t[21]!==x||t[22]!==m?(S=(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,(0,q.jsxs)(`div`,{className:`relative`,children:[u,m,x]})]}),t[21]=x,t[22]=m,t[23]=S):S=t[23],S}var Y=`Checkbox`,[Je,Ye]=g(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]=ae({prop:n,defaultProp:i??!1,onChange:c,caller:Y}),[m,h]=K.useState(null),[g,_]=K.useState(null),v=K.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,q.jsx)(Xe,{scope:t,...b,children:ot(d)?d(b):r})}var $e=`CheckboxTrigger`,et=K.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),g=K.useRef(c);return K.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,q.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:_(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:_(n,e=>{d(e=>X(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});et.displayName=$e;var tt=K.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,q.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,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(et,{...d,ref:t,__scopeCheckbox:n}),e&&(0,q.jsx)(at,{__scopeCheckbox:n})]})})});tt.displayName=Y;var nt=`CheckboxIndicator`,rt=K.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ze(nt,n);return(0,q.jsx)(ue,{present:r||X(a.checked)||a.checked===!0,children:(0,q.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=K.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:p,setBubbleInput:m}=Ze(it,e),h=E(n,m),g=he(a),_=f(r);K.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=K.useRef(X(a)?!1:a);return(0,q.jsx)(w.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...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=K.forwardRef((e,t)=>{let n=(0,G.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=l(`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,q.jsx)(rt,{className:l(`flex items-center justify-center text-current`),children:(0,q.jsx)(u,{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,q.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=U(e=>(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:e.v0}),{name:`ModelSelector_1`,portals:[`v0`]}),yt=U(e=>(0,q.jsx)(`div`,{className:`text-center py-8`,children:(0,q.jsx)(`p`,{className:e.v0,children:`No models available for this provider.`})}),{name:`ModelSelector_2`}),bt=U(e=>(0,q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,q.jsxs)(`div`,{className:e.v0,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[e.v1,(0,q.jsx)(`label`,{htmlFor:`select-all-models`,className:e.v2,children:`Select all models`})]}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[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:o=`grid`,autoSelectRecommended:c=!1}){let[u,d]=(0,K.useState)([]),[f,p]=(0,K.useState)(new Set),[g,_]=(0,K.useState)(new Set),[v,y]=(0,K.useState)(new Map),[x,S]=(0,K.useState)(!1),[w,T]=(0,K.useState)(``),[E,D]=(0,K.useState)(`alphabetical`);(0,K.useEffect)(()=>{O()},[e]);let O=async()=>{S(!0),T(``),D(`alphabetical`);try{let t=await s(e);d(t.models);let n=new Set(t.enabledModelIds);p(n);let r=new Map,i=new Set;if(c)try{let{models:e}=await ie();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),k(n,r,t.models)}catch(t){St.error(`Failed to load models for ${e}:`,t),d([]),p(new Set),_(new Set)}finally{S(!1)}},k=(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)},A=e=>{y(t=>{let n=_t(t,e,f);return k(f,n),n})},M=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)}),k(f,n),n})},N=e=>xe(e.id);function P(e,t=v){let n=t.has(e),r=t.get(e);return n?!!r:f.has(e)}let F=gt({models:u,query:w,sortBy:E,getDisplayName:N,getPriority:e=>+!P(e.id)}),ne=E===`alphabetical`?`alphabetical`:`price`;function L(e){if(e===`alphabetical`){D(`alphabetical`);return}e===`price`&&D(`price-low`)}function re(){E!==`alphabetical`&&D(e=>e===`price-low`?`price-high`:`price-low`)}return x||n?(0,q.jsx)(vt,{v0:(0,q.jsx)(r,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):u.length===0?(0,q.jsx)(yt,{v0:I.bodyMuted}):o===`compact`?(0,q.jsx)(bt,{v0:l(`flex items-center justify-between gap-3`,a&&`opacity-25`),v1:(0,q.jsx)(Z,{id:`select-all-models`,disabled:a,checked:u.every(e=>P(e.id)),onCheckedChange:e=>M(e===!0)}),v2:l(I.body,`cursor-pointer`),v3:(0,q.jsx)(te,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),v4:(0,q.jsx)(j,{placeholder:`Search models...`,value:w,onChange:e=>T(e.target.value),disabled:a,className:`pl-8 h-9`}),v5:(0,q.jsxs)(R,{type:`single`,value:ne,onValueChange:L,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,q.jsx)(B,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:a,className:Ct,children:(0,q.jsx)(ee,{className:`h-4 w-4`})}),(0,q.jsx)(B,{value:`price`,"aria-label":`Sort by price`,disabled:a,className:Ct,onClick:re,children:(0,q.jsx)(C,{className:`h-4 w-4`})})]}),v6:(0,q.jsx)(H,{children:(0,q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:F.length===0?(0,q.jsx)(`div`,{className:`text-center py-4`,children:(0,q.jsx)(`p`,{className:I.bodyMuted,children:w?`No models match your search.`:`No models available.`})}):F.map(e=>{let t=P(e.id),n=e.pricing,r=t&&g.has(e.id);return(0,q.jsxs)(h,{children:[(0,q.jsx)(i,{asChild:!0,children:(0,q.jsxs)(`div`,{className:l(`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,q.jsx)(Z,{id:e.id,disabled:a,checked:t??!1,onCheckedChange:()=>A(e.id),className:`mt-0`}),(0,q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,q.jsxs)(`label`,{htmlFor:e.id,className:l(I.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[N(e),r&&(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,q.jsx)(`span`,{className:l(I.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${m(n.prompt??0)} in | ${m(n.completion??0)} out`})]})]})}),e.description&&(0,q.jsx)(b,{side:`top`,className:`max-w-xs`,children:(0,q.jsx)(`p`,{className:I.body,children:e.description})})]},e.id)})})})}):null},St=p(`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}),$=p(`app.onboarding-dialog.ui`);function Tt({open:e,onOpenChange:t,onComplete:i}){let[o,d]=(0,K.useState)(`git-check`),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)([]),[b,x]=(0,K.useState)(null),[C,w]=(0,K.useState)(``),[E,D]=(0,K.useState)({}),[O,ee]=(0,K.useState)(!1),[k,j]=(0,K.useState)(``),[te,ie]=(0,K.useState)(new Set),[ae,oe]=(0,K.useState)(!1),[R,z]=(0,K.useState)(!1);(0,K.useEffect)(()=>{e&&o===`git-check`&&ce()},[e,o]),(0,K.useEffect)(()=>{e&&o===`provider-selection`&&g.length===0&&B()},[e,o,g.length]),(0,K.useEffect)(()=>{e&&o===`model-selection`&&b&&ue()},[e,o,b]);let ce=async()=>{h(!0);try{let e=await ne();p(e.gitInstalled),e.gitInstalled&&d(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),p(!1)}finally{h(!1)}},B=async()=>{try{let e=await n();if(_(e),e.length>0&&!b){let t=Le(e);t&&(x(t),w(t.apiKey??``),D(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},ue=async()=>{if(b){oe(!0);try{await s(b.name),ie(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{oe(!1)}}},de=async()=>{if(!b||!C.trim()){j(`Please enter an API key`);return}let e=Me(b),t=e.find(e=>!E[e]?.trim());if(t){j(`Please enter ${Ne(t)}`);return}ee(!0),j(``);try{e.length>0&&await S(Object.fromEntries(e.map(e=>[e,E[e].trim()]))),await a(b.slug,C),d(`model-selection`)}catch(e){j(e instanceof Error?e.message:`Failed to validate API key`)}finally{ee(!1)}},fe=async()=>{if(b){z(!0);try{for(let e of te)await T(b.slug,e);await pe(),i?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{z(!1)}}},me=async()=>{z(!0);try{await pe(),i?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{z(!1)}},H=e=>{x(e),w(e.apiKey??``),D(e.envValues??{}),j(``)},U=(e,t)=>{D(n=>({...n,[e]:t}))};return(0,q.jsx)(y,{open:e,onOpenChange:t,children:(0,q.jsxs)(F,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[(0,q.jsx)(`div`,{className:l(`flex items-center justify-center h-8 w-8 rounded-full`,I.label,o===`git-check`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`1`}),(0,q.jsx)(`div`,{className:l(`h-0.5 flex-1`,o===`provider-selection`||o===`model-selection`?`bg-primary`:`bg-muted`)}),(0,q.jsx)(`div`,{className:l(`flex items-center justify-center h-8 w-8 rounded-full`,I.label,o===`provider-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`2`}),(0,q.jsx)(`div`,{className:l(`h-0.5 flex-1`,o===`model-selection`?`bg-primary`:`bg-muted`)}),(0,q.jsx)(`div`,{className:l(`flex items-center justify-center h-8 w-8 rounded-full`,I.label,o===`model-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`3`})]}),(0,q.jsxs)(le,{children:[o===`git-check`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(L,{children:`Let's get started`}),(0,q.jsx)(V,{children:`First, we need to check that Git is installed on your system.`})]}),o===`provider-selection`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(L,{children:`Select an AI Provider`}),(0,q.jsx)(V,{children:`Choose your preferred AI provider and enter your API key.`})]}),o===`model-selection`&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(L,{children:`Select Models`}),(0,q.jsx)(V,{children:`Choose which models you want to use with this provider.`})]})]})]}),(0,q.jsx)(P,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,q.jsxs)(`div`,{className:`px-6 py-4`,children:[o===`git-check`&&(0,q.jsx)(`div`,{className:`space-y-4`,children:m?(0,q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,q.jsx)(r,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):f?(0,q.jsxs)(W,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,q.jsx)(u,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:l(I.label,`text-green-900`),children:`Git is installed`}),(0,q.jsx)(`p`,{className:I.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}):(0,q.jsxs)(W,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[(0,q.jsx)(re,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`p`,{className:I.label,children:`Git is not installed`}),(0,q.jsx)(`p`,{className:I.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),(0,q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:l(I.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),children:[`Download Git `,(0,q.jsx)(N,{className:`h-3 w-3`})]})]})]})}),o===`provider-selection`&&(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(Ke,{selectedProvider:b,onProviderChange:H,showApiKeyInput:!0,apiKey:C,onApiKeyChange:w,variant:`dropdown`,isLoading:O}),b&&Me(b).map(e=>(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(A,{htmlFor:e,children:Ne(e)}),(0,q.jsx)(`input`,{id:e,value:E[e]??``,onChange:t=>U(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:M(b.slug)&&e===`LOCAL_API_URL`?b.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),b.slug===`azure`&&e===Ae(b)||M(b.slug)&&e===`LOCAL_API_URL`?(0,q.jsx)(`p`,{className:l(I.bodyMuted,`break-all`),children:Pe(b,E)||b.api}):null]},e)),k&&(0,q.jsx)(W,{variant:`error`,className:`mb-0`,children:k})]}),o===`model-selection`&&b&&(0,q.jsx)(`div`,{className:`space-y-4`,children:(0,q.jsx)(xt,{provider:b.slug,isLoading:ae,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:ie})})]})}),(0,q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,q.jsxs)(se,{className:`flex items-center justify-between`,children:[(0,q.jsx)(`div`,{children:o===`provider-selection`&&(0,q.jsx)(v,{variant:`ghost`,onClick:()=>me(),disabled:R,children:`Skip for now`})}),(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[o!==`git-check`&&(0,q.jsx)(v,{variant:`outline`,onClick:()=>{o===`provider-selection`?d(`git-check`):o===`model-selection`&&d(`provider-selection`)},disabled:R,children:`Back`}),o===`git-check`&&(0,q.jsxs)(v,{onClick:()=>{d(`provider-selection`)},disabled:m,className:`gap-2`,children:[`Continue `,(0,q.jsx)(c,{className:`h-4 w-4`})]}),o===`provider-selection`&&(0,q.jsx)(v,{onClick:de,disabled:O||!C.trim()||!b,className:`gap-2`,children:O?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(r,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,q.jsxs)(q.Fragment,{children:[`Next `,(0,q.jsx)(c,{className:`h-4 w-4`})]})}),o===`model-selection`&&(0,q.jsx)(v,{onClick:fe,disabled:R,className:`gap-2`,children:R?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(r,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,q.jsxs)(q.Fragment,{children:[`Finish `,(0,q.jsx)(u,{className:`h-4 w-4`})]})})]})]})})]})})}export{Z as a,Me as c,J 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 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,As as n,Ba as r,Bn as i,Ds as a,Es as o,Fo as s,Gi as c,Ii as l,Is as u,Ki as d,Ko as f,Ln as p,Ns as m,Os as h,Pi as g,Ps as _,Rn as v,Sa as y,St as b,Ts as x,Un as ee,Vn as te,Wn as ne,Yr as S,Zr as C,es as w,fs as T,js as re,ks as E,ss as D,vo as O,wt as ie,yo as k}from"./dialogs-config-DAMqiy-4.js";import{Ft as ae,f as A,g as j,h as M,m as oe,p as se}from"./react-vendor-U9lUQswz.js";import{D as ce,E as le,S as ue,T as de,b as N,d as P,f as fe,g as F,h as pe,m as I,p as L}from"./history-view-lvvTzW7O.js";import{a as R,u as z}from"./onboarding-dys9Rwb5.js";import{B,H as me}from"./index-C_iiobDl.js";import{n as he,t as ge}from"./radio-group-C6EDTFov.js";var V=_(),H=e(u(),1),U=m(),_e=M,ve=H.forwardRef((e,t)=>{let n=(0,V.c)(9),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=l(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(oe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ve.displayName=`AccordionItem`;var ye=H.forwardRef((e,t)=>{let n=(0,V.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=l(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,i),n[4]=i,n[5]=o);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(s,{className:`h-4 w-4 shrink-0 transition-transform duration-200`}),n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(u=(0,U.jsx)(se,{className:`flex`,children:(0,U.jsxs)(j,{ref:t,className:o,...a,children:[r,c]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=u):u=n[11],u});ye.displayName=j.displayName;var be=H.forwardRef((e,t)=>{let n=(0,V.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=l(T.body,`overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`),n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s=l(`pb-4 pt-0`,i),n[5]=i,n[6]=s);let c;n[7]!==r||n[8]!==s?(c=(0,U.jsx)(`div`,{className:s,children:r}),n[7]=r,n[8]=s,n[9]=c):c=n[9];let u;return n[10]!==a||n[11]!==t||n[12]!==c?(u=(0,U.jsx)(A,{ref:t,className:o,...a,children:c}),n[10]=a,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});be.displayName=A.displayName;var W=f(`app.project-model-aliases-section.ui`),G=`__unspecified__`;function K(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?z(e.id).localeCompare(z(t.id)):n})}function xe({value:e,onChange:r,disabled:i=!1}){let[s,c]=(0,H.useState)([]),[u,d]=(0,H.useState)(!0);(0,H.useEffect)(()=>{let e=!1;async function n(){d(!0);try{let n=await t();if(e)return;c(K(Object.values(n).flat()))}catch(t){W.error(`Failed to load enabled models:`,t),e||c([])}finally{e||d(!1)}}return n(),()=>{e=!0}},[]);let f=(0,H.useMemo)(()=>{let e=new Map;for(let t of s){let n=t.provider??`other`,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[s]);function p(t,n){let i={...e};if(n===G){delete i[t],r(i);return}let a=E(n);a&&(i[t]=a,r(i))}return(0,U.jsx)(`div`,{className:`space-y-4`,children:h.map(t=>{let r=e[t],c=r?n(r):G;return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(S,{htmlFor:`model-alias-${t}`,className:T.label,children:a[t]}),(0,U.jsx)(`p`,{className:l(T.caption,`mt-1`),children:o[t]})]}),(0,U.jsxs)(P,{value:c,onValueChange:e=>p(t,e),disabled:i||u,children:[(0,U.jsx)(pe,{id:`model-alias-${t}`,children:(0,U.jsx)(F,{placeholder:u?`Loading models...`:`Unspecified`})}),(0,U.jsxs)(fe,{children:[(0,U.jsx)(L,{value:G,children:`Unspecified`}),s.length>0&&(0,U.jsx)(I,{}),[...f.entries()].map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:l(T.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:e}),t.map(t=>{let r=n({provider:t.provider??e,model:t.id});return(0,U.jsx)(L,{value:r,children:z(t.id)},r)})]},e))]})]})]},t)})})}var q=D();function Se(e){let t=(0,V.c)(9),{disabledTools:n,onChange:r,disabled:i}=e,a=i===void 0?!1:i,o;t[0]!==n||t[1]!==r?(o=function(e,t){let i=e.toLowerCase();if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==a||t[4]!==n||t[5]!==s?(c=q.map(e=>{let t=!n.includes(e.name),r=`project-tool-${e.name}`;return(0,U.jsxs)(`div`,{className:l(`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-50`),children:[(0,U.jsx)(R,{id:r,checked:t,onCheckedChange:t=>s(e.name,t===!0),disabled:a,className:`mt-0`}),(0,U.jsx)(`label`,{htmlFor:r,className:l(T.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1`),children:e.displayName})]},e.name)}),t[3]=a,t[4]=n,t[5]=s,t[6]=c):c=t[6];let u;return t[7]===c?u=t[8]:(u=(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:c}),t[7]=c,t[8]=u),u}function Ce(e){let t=(0,V.c)(20),{entry:n,index:r,loading:i,onValueChange:a}=e,o=w(n.name),[s,c]=(0,H.useState)(!1),u=n.value.length>0||n.hasExistingValue,d=n.hasExistingValue&&!n.value?`••••••••`:`value`;(0,H.useEffect)(()=>{o||c(!1)},[o]);let f=C,p=o&&!s?`password`:`text`,m=n.value,h;t[0]!==r||t[1]!==a?(h=e=>a(r,e.target.value),t[0]=r,t[1]=a,t[2]=h):h=t[2];let _=l(`font-mono`,o&&`pr-10`),v;t[3]!==f||t[4]!==n.value||t[5]!==i||t[6]!==d||t[7]!==p||t[8]!==h||t[9]!==_?(v=(0,U.jsx)(f,{type:p,placeholder:d,value:m,onChange:h,className:_,disabled:i}),t[3]=f,t[4]=n.value,t[5]=i,t[6]=d,t[7]=p,t[8]=h,t[9]=_,t[10]=v):v=t[10];let y;t[11]!==u||t[12]!==o||t[13]!==i||t[14]!==c||t[15]!==s?(y=o&&(0,U.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>c(we),disabled:i||!u,children:s?(0,U.jsx)(k,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(O,{className:`h-4 w-4 text-muted-foreground`})}),t[11]=u,t[12]=o,t[13]=i,t[14]=c,t[15]=s,t[16]=y):y=t[16];let b;return t[17]!==v||t[18]!==y?(b=(0,U.jsxs)(`div`,{className:`relative flex-1`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function we(e){return!e}function Te({projectId:e,onProjectUpdated:n}){let a=ae(),[o,s]=(0,H.useState)(``),[u,f]=(0,H.useState)(``),[m,h]=(0,H.useState)(``),[_,w]=(0,H.useState)(x.PullRequest),[E,D]=(0,H.useState)(``),[O,k]=(0,H.useState)(!1),[A,j]=(0,H.useState)(!1),[M,oe]=(0,H.useState)(!1),[se,P]=(0,H.useState)(``),[fe,F]=(0,H.useState)(``),[pe,I]=(0,H.useState)(``),[L,z]=(0,H.useState)(``),[V,W]=(0,H.useState)(x.PullRequest),[G,K]=(0,H.useState)(!0),[q,we]=(0,H.useState)([]),[Te,Ee]=(0,H.useState)(!0),[De,Oe]=(0,H.useState)([]),[J,Y]=(0,H.useState)([]),[ke,Ae]=(0,H.useState)([]),[X,je]=(0,H.useState)({}),[Me,Ne]=(0,H.useState)({}),[Z,Pe]=(0,H.useState)([]),[Fe,Ie]=(0,H.useState)([]),[Q,Le]=(0,H.useState)(!0),[Re,ze]=(0,H.useState)(!0),$=(0,H.useCallback)(async()=>{if(e){oe(!0);try{let t=await b(e),n=await ie(e),r=t.name??``,i=t.setupScript??``,a=t.validationScript??``,o=t.runCommand??``,c=t.commitMethod??x.PullRequest,l=t.allowAllCommands!==!1,u=t.allowedCommandPatterns??[],d=n.vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0})),p=t.modelAliases??{},m=t.disabledTools??[],g=t.useBuiltInBrowser!==!1;s(r),f(i),D(a),h(o),w(c),K(l),we(u),Y(d),je(p),Pe(m),Le(g),P(r),F(i),I(a),z(o),W(c),Ee(l),Oe(u),Ae(d),Ne(p),Ie(m),ze(g)}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{oe(!1)}}},[e]);(0,H.useEffect)(()=>{$()},[$]);function Be(){Y(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function Ve(e,t){Y(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function He(e,t){Y(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function Ue(e){Y(t=>t.filter((t,n)=>n!==e))}function We(){if(J.length!==ke.length)return!0;for(let e=0;e<J.length;e+=1){let t=J[e],n=ke[e];if(!n||t.name!==n.name||t.value!==n.value||t.hasExistingValue!==n.hasExistingValue)return!0}return!1}function Ge(){return JSON.stringify(X)!==JSON.stringify(Me)}function Ke(){return JSON.stringify([...Z].sort())!==JSON.stringify([...Fe].sort())}return e?(0,U.jsx)(ce,{children:(0,U.jsxs)(le,{children:[(0,U.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,U.jsx)(g,{onClick:async()=>{if(e){k(!0);try{if(o!==se&&await te(e,o),u!==fe&&await ee(e,u.trim()||null,!1),E!==pe&&await i(e,{validationScript:E.trim()||null}),m!==L&&await ne(e,m.trim()||null),_!==V&&await i(e,{commitMethod:_}),(G!==Te||JSON.stringify(q)!==JSON.stringify(De))&&await i(e,{allowAllCommands:G,allowedCommandPatterns:q}),Ge()){let n=Object.keys(X).length>0?X:void 0;if(n){let e=await t();re(n,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await i(e,{modelAliases:n??null})}if(Ke()&&await i(e,{disabledTools:Z.length>0?Z:null}),Q!==Re&&await i(e,{useBuiltInBrowser:Q}),We()){let t=J.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),n=t.find((e,n)=>t.findIndex(t=>t.name===e.name)!==n);if(n)throw Error(`Duplicate environment variable name: ${n.name}`);let r=t.find(e=>!e.hasExistingValue&&!e.value.trim());if(r)throw Error(`Value is required for environment variable: ${r.name}`);await v(e,t.map(e=>({name:e.name,value:e.value.trim()||void 0})))}P(o),F(u),I(E),z(m),W(_),Ee(G),Oe(q),Ne(X),Ie(Z),ze(Q),Ae(J.map(e=>({...e,value:``}))),n&&await n(),await $(),a(`/`)}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{k(!1)}}},disabled:O||M,children:O?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):M?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(N,{title:`Project Name`,children:(0,U.jsx)(C,{id:`projectName`,value:o,onChange:e=>s(e.target.value),placeholder:`Enter project name`,disabled:M})}),(0,U.jsx)(N,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,U.jsx)(me,{id:`setupScript`,value:u,onChange:e=>f(e.target.value),placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,U.jsx)(N,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,U.jsx)(me,{id:`validationScript`,value:E,onChange:e=>D(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,U.jsx)(N,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,action:(0,U.jsx)(g,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){j(!0);try{let t=await p(e);t.runCommand?(h(t.runCommand),B({title:`Success`,description:`Suggested: ${t.runCommand}`})):B({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{j(!1)}}},disabled:A||M,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(c,{className:`h-3 w-3`}),`Suggest`]})}),children:(0,U.jsx)(C,{id:`runCommand`,value:m,onChange:e=>h(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono`,disabled:M})}),(0,U.jsx)(N,{title:`Commit Method`,description:_===x.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,children:(0,U.jsxs)(ge,{value:_,onValueChange:e=>w(e),className:`flex gap-4`,disabled:M,children:[(0,U.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,U.jsx)(he,{value:x.PullRequest,id:`commit-pr`}),(0,U.jsx)(S,{htmlFor:`commit-pr`,className:l(T.labelNormal,`cursor-pointer`),children:`Pull Requests`})]}),(0,U.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,U.jsx)(he,{value:x.Direct,id:`commit-direct`}),(0,U.jsx)(S,{htmlFor:`commit-direct`,className:l(T.labelNormal,`cursor-pointer`),children:`Direct Commits`})]})]})}),(0,U.jsxs)(N,{title:`Confirm Commands`,description:`When checked, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(R,{id:`confirmCommands`,checked:!G,onCheckedChange:e=>K(e!==!0),disabled:M}),(0,U.jsx)(S,{htmlFor:`confirmCommands`,className:T.labelNormal,children:`Require approval for bash commands, skill scripts, and browser shell calls`})]}),!G&&q.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,U.jsx)(S,{children:`Allowed command patterns`}),(0,U.jsx)(`ul`,{className:`space-y-1`,children:q.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,U.jsx)(`code`,{className:l(T.mono,T.bodyMuted),children:e}),(0,U.jsx)(g,{type:`button`,variant:`ghost`,size:`sm`,disabled:M||O,onClick:()=>we(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})]}),(0,U.jsx)(N,{title:`Environment Variables`,description:`Stored encrypted in the Tarsk database and injected when the agent runs bash commands or MCP tools.`,action:(0,U.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:Be,disabled:M,children:[(0,U.jsx)(y,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:J.length===0?(0,U.jsx)(`p`,{className:T.caption,children:`No environment variables configured`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:J.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(C,{placeholder:`API_KEY`,value:e.name,onChange:e=>Ve(t,e.target.value),className:`font-mono w-[35%]`,disabled:M}),(0,U.jsx)(Ce,{entry:e,index:t,loading:M,onValueChange:He}),(0,U.jsx)(g,{variant:`ghost`,size:`icon`,onClick:()=>Ue(t),className:`h-9 w-9 flex-shrink-0`,disabled:M||O,children:(0,U.jsx)(d,{className:`h-3.5 w-3.5`})})]},t))})}),(0,U.jsx)(_e,{type:`single`,collapsible:!0,children:(0,U.jsxs)(ve,{value:`advanced`,className:`border-b-0`,children:[(0,U.jsx)(ye,{className:l(T.sectionTitle,`text-2xl hover:no-underline py-0`),children:`Advanced`}),(0,U.jsxs)(be,{children:[(0,U.jsx)(N,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md.`,className:`pt-2`,children:(0,U.jsx)(xe,{value:X,onChange:je,disabled:M||O})}),(0,U.jsx)(N,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,className:`pt-6`,children:(0,U.jsx)(Se,{disabledTools:Z,onChange:Pe,disabled:M||O})}),(0,U.jsx)(N,{title:`Use Built In Browser`,description:`When enabled, Tarsk shows the Browser tab for this project and opens detected dev URLs there. When disabled, the Browser tab is hidden and dev URLs open in your system browser instead.`,className:`pt-6`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(R,{id:`useBuiltInBrowser`,checked:Q,onCheckedChange:e=>Le(e===!0),disabled:M||O}),(0,U.jsx)(S,{htmlFor:`useBuiltInBrowser`,className:T.labelNormal,children:`Use Built In Browser`})]})})]})]})})]})]})}):(0,U.jsx)(de,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{Te as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,As as n,Ba as r,Bn as i,Ds as a,Fo as o,Fs as s,Gi as c,Ii as l,Is as u,Ki as d,Ko as f,Ln as p,Ms as m,Ns as h,Os as g,Pi as _,Rn as v,Rs as y,Sa as b,St as ee,Un as te,Vn as ne,Wn as re,Yr as x,Zr as S,es as C,fs as w,js as T,ks as E,ss as D,vo as O,wt as ie,yo as k}from"./dialogs-config-86QTDk4G.js";import{Ft as ae,f as A,g as j,h as M,m as oe,p as se}from"./react-vendor-DK2COBjg.js";import{D as ce,E as le,S as ue,T as de,b as N,d as P,f as fe,g as F,h as pe,m as I,p as L}from"./history-view-BsN806ip.js";import{a as R,u as z}from"./onboarding-DCrFdRM5.js";import{B,H as me}from"./index-C2iIghSR.js";import{n as he,t as ge}from"./radio-group-C7-1cZ2t.js";var V=u(),H=e(y(),1),U=s(),_e=M,ve=H.forwardRef((e,t)=>{let n=(0,V.c)(9),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=l(`border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,U.jsx)(oe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ve.displayName=`AccordionItem`;var ye=H.forwardRef((e,t)=>{let n=(0,V.c)(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let s;n[4]===i?s=n[5]:(s=l(`flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180`,i),n[4]=i,n[5]=s);let c;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,U.jsx)(o,{className:`h-4 w-4 shrink-0 transition-transform duration-200`}),n[6]=c):c=n[6];let u;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==s?(u=(0,U.jsx)(se,{className:`flex`,children:(0,U.jsxs)(j,{ref:t,className:s,...a,children:[r,c]})}),n[7]=r,n[8]=a,n[9]=t,n[10]=s,n[11]=u):u=n[11],u});ye.displayName=j.displayName;var be=H.forwardRef((e,t)=>{let n=(0,V.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=l(w.body,`overflow-hidden transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down`),n[4]=o):o=n[4];let s;n[5]===i?s=n[6]:(s=l(`pb-4 pt-0`,i),n[5]=i,n[6]=s);let c;n[7]!==r||n[8]!==s?(c=(0,U.jsx)(`div`,{className:s,children:r}),n[7]=r,n[8]=s,n[9]=c):c=n[9];let u;return n[10]!==a||n[11]!==t||n[12]!==c?(u=(0,U.jsx)(A,{ref:t,className:o,...a,children:c}),n[10]=a,n[11]=t,n[12]=c,n[13]=u):u=n[13],u});be.displayName=A.displayName;var W=f(`app.project-model-aliases-section.ui`),G=`__unspecified__`;function K(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?z(e.id).localeCompare(z(t.id)):n})}function xe({value:e,onChange:r,disabled:i=!1}){let[a,o]=(0,H.useState)([]),[s,c]=(0,H.useState)(!0);(0,H.useEffect)(()=>{let e=!1;async function n(){c(!0);try{let n=await t();if(e)return;o(K(Object.values(n).flat()))}catch(t){W.error(`Failed to load enabled models:`,t),e||o([])}finally{e||c(!1)}}return n(),()=>{e=!0}},[]);let u=(0,H.useMemo)(()=>{let e=new Map;for(let t of a){let n=t.provider??`other`,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[a]);function d(t,n){let i={...e};if(n===G){delete i[t],r(i);return}let a=T(n);a&&(i[t]=a,r(i))}return(0,U.jsx)(`div`,{className:`space-y-4`,children:n.map(t=>{let n=e[t],r=n?m(n):G;return(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(x,{htmlFor:`model-alias-${t}`,className:w.label,children:E[t]}),(0,U.jsx)(`p`,{className:l(w.caption,`mt-1`),children:g[t]})]}),(0,U.jsxs)(P,{value:r,onValueChange:e=>d(t,e),disabled:i||s,children:[(0,U.jsx)(pe,{id:`model-alias-${t}`,children:(0,U.jsx)(F,{placeholder:s?`Loading models...`:`Unspecified`})}),(0,U.jsxs)(fe,{children:[(0,U.jsx)(L,{value:G,children:`Unspecified`}),a.length>0&&(0,U.jsx)(I,{}),[...u.entries()].map(([e,t])=>(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:l(w.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:e}),t.map(t=>{let n=m({provider:t.provider??e,model:t.id});return(0,U.jsx)(L,{value:n,children:z(t.id)},n)})]},e))]})]})]},t)})})}var q=D();function Se(e){let t=(0,V.c)(9),{disabledTools:n,onChange:r,disabled:i}=e,a=i===void 0?!1:i,o;t[0]!==n||t[1]!==r?(o=function(e,t){let i=e.toLowerCase();if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]!==a||t[4]!==n||t[5]!==s?(c=q.map(e=>{let t=!n.includes(e.name),r=`project-tool-${e.name}`;return(0,U.jsxs)(`div`,{className:l(`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-50`),children:[(0,U.jsx)(R,{id:r,checked:t,onCheckedChange:t=>s(e.name,t===!0),disabled:a,className:`mt-0`}),(0,U.jsx)(`label`,{htmlFor:r,className:l(w.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1`),children:e.displayName})]},e.name)}),t[3]=a,t[4]=n,t[5]=s,t[6]=c):c=t[6];let u;return t[7]===c?u=t[8]:(u=(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:c}),t[7]=c,t[8]=u),u}function Ce(e){let t=(0,V.c)(20),{entry:n,index:r,loading:i,onValueChange:a}=e,o=C(n.name),[s,c]=(0,H.useState)(!1),u=n.value.length>0||n.hasExistingValue,d=n.hasExistingValue&&!n.value?`••••••••`:`value`;(0,H.useEffect)(()=>{o||c(!1)},[o]);let f=S,p=o&&!s?`password`:`text`,m=n.value,h;t[0]!==r||t[1]!==a?(h=e=>a(r,e.target.value),t[0]=r,t[1]=a,t[2]=h):h=t[2];let g=l(`font-mono`,o&&`pr-10`),v;t[3]!==f||t[4]!==n.value||t[5]!==i||t[6]!==d||t[7]!==p||t[8]!==h||t[9]!==g?(v=(0,U.jsx)(f,{type:p,placeholder:d,value:m,onChange:h,className:g,disabled:i}),t[3]=f,t[4]=n.value,t[5]=i,t[6]=d,t[7]=p,t[8]=h,t[9]=g,t[10]=v):v=t[10];let y;t[11]!==u||t[12]!==o||t[13]!==i||t[14]!==c||t[15]!==s?(y=o&&(0,U.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>c(we),disabled:i||!u,children:s?(0,U.jsx)(k,{className:`h-4 w-4 text-muted-foreground`}):(0,U.jsx)(O,{className:`h-4 w-4 text-muted-foreground`})}),t[11]=u,t[12]=o,t[13]=i,t[14]=c,t[15]=s,t[16]=y):y=t[16];let b;return t[17]!==v||t[18]!==y?(b=(0,U.jsxs)(`div`,{className:`relative flex-1`,children:[v,y]}),t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function we(e){return!e}function Te({projectId:e,onProjectUpdated:n}){let o=ae(),[s,u]=(0,H.useState)(``),[f,m]=(0,H.useState)(``),[g,y]=(0,H.useState)(``),[C,T]=(0,H.useState)(a.PullRequest),[E,D]=(0,H.useState)(``),[O,k]=(0,H.useState)(!1),[A,j]=(0,H.useState)(!1),[M,oe]=(0,H.useState)(!1),[se,P]=(0,H.useState)(``),[fe,F]=(0,H.useState)(``),[pe,I]=(0,H.useState)(``),[L,z]=(0,H.useState)(``),[V,W]=(0,H.useState)(a.PullRequest),[G,K]=(0,H.useState)(!0),[q,we]=(0,H.useState)([]),[Te,Ee]=(0,H.useState)(!0),[De,Oe]=(0,H.useState)([]),[J,Y]=(0,H.useState)([]),[ke,Ae]=(0,H.useState)([]),[X,je]=(0,H.useState)({}),[Me,Ne]=(0,H.useState)({}),[Z,Pe]=(0,H.useState)([]),[Fe,Ie]=(0,H.useState)([]),[Q,Le]=(0,H.useState)(!0),[Re,ze]=(0,H.useState)(!0),$=(0,H.useCallback)(async()=>{if(e){oe(!0);try{let t=await ee(e),n=await ie(e),r=t.name??``,i=t.setupScript??``,o=t.validationScript??``,s=t.runCommand??``,c=t.commitMethod??a.PullRequest,l=t.allowAllCommands!==!1,d=t.allowedCommandPatterns??[],f=n.vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0})),p=t.modelAliases??{},h=t.disabledTools??[],g=t.useBuiltInBrowser!==!1;u(r),m(i),D(o),y(s),T(c),K(l),we(d),Y(f),je(p),Pe(h),Le(g),P(r),F(i),I(o),z(s),W(c),Ee(l),Oe(d),Ae(f),Ne(p),Ie(h),ze(g)}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{oe(!1)}}},[e]);(0,H.useEffect)(()=>{$()},[$]);function Be(){Y(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function Ve(e,t){Y(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function He(e,t){Y(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function Ue(e){Y(t=>t.filter((t,n)=>n!==e))}function We(){if(J.length!==ke.length)return!0;for(let e=0;e<J.length;e+=1){let t=J[e],n=ke[e];if(!n||t.name!==n.name||t.value!==n.value||t.hasExistingValue!==n.hasExistingValue)return!0}return!1}function Ge(){return JSON.stringify(X)!==JSON.stringify(Me)}function Ke(){return JSON.stringify([...Z].sort())!==JSON.stringify([...Fe].sort())}return e?(0,U.jsx)(ce,{children:(0,U.jsxs)(le,{children:[(0,U.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,U.jsx)(_,{onClick:async()=>{if(e){k(!0);try{if(s!==se&&await ne(e,s),f!==fe&&await te(e,f.trim()||null,!1),E!==pe&&await i(e,{validationScript:E.trim()||null}),g!==L&&await re(e,g.trim()||null),C!==V&&await i(e,{commitMethod:C}),(G!==Te||JSON.stringify(q)!==JSON.stringify(De))&&await i(e,{allowAllCommands:G,allowedCommandPatterns:q}),Ge()){let n=Object.keys(X).length>0?X:void 0;if(n){let e=await t();h(n,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await i(e,{modelAliases:n??null})}if(Ke()&&await i(e,{disabledTools:Z.length>0?Z:null}),Q!==Re&&await i(e,{useBuiltInBrowser:Q}),We()){let t=J.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),n=t.find((e,n)=>t.findIndex(t=>t.name===e.name)!==n);if(n)throw Error(`Duplicate environment variable name: ${n.name}`);let r=t.find(e=>!e.hasExistingValue&&!e.value.trim());if(r)throw Error(`Value is required for environment variable: ${r.name}`);await v(e,t.map(e=>({name:e.name,value:e.value.trim()||void 0})))}P(s),F(f),I(E),z(g),W(C),Ee(G),Oe(q),Ne(X),Ie(Z),ze(Q),Ae(J.map(e=>({...e,value:``}))),n&&await n(),await $(),o(`/`)}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{k(!1)}}},disabled:O||M,children:O?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):M?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})}),(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(N,{title:`Project Name`,children:(0,U.jsx)(S,{id:`projectName`,value:s,onChange:e=>u(e.target.value),placeholder:`Enter project name`,disabled:M})}),(0,U.jsx)(N,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,U.jsx)(me,{id:`setupScript`,value:f,onChange:e=>m(e.target.value),placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,U.jsx)(N,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,U.jsx)(me,{id:`validationScript`,value:E,onChange:e=>D(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:M})}),(0,U.jsx)(N,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,action:(0,U.jsx)(_,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){j(!0);try{let t=await p(e);t.runCommand?(y(t.runCommand),B({title:`Success`,description:`Suggested: ${t.runCommand}`})):B({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){B({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{j(!1)}}},disabled:A||M,children:A?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(r,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(c,{className:`h-3 w-3`}),`Suggest`]})}),children:(0,U.jsx)(S,{id:`runCommand`,value:g,onChange:e=>y(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono`,disabled:M})}),(0,U.jsx)(N,{title:`Commit Method`,description:C===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,children:(0,U.jsxs)(ge,{value:C,onValueChange:e=>T(e),className:`flex gap-4`,disabled:M,children:[(0,U.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,U.jsx)(he,{value:a.PullRequest,id:`commit-pr`}),(0,U.jsx)(x,{htmlFor:`commit-pr`,className:l(w.labelNormal,`cursor-pointer`),children:`Pull Requests`})]}),(0,U.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,U.jsx)(he,{value:a.Direct,id:`commit-direct`}),(0,U.jsx)(x,{htmlFor:`commit-direct`,className:l(w.labelNormal,`cursor-pointer`),children:`Direct Commits`})]})]})}),(0,U.jsxs)(N,{title:`Confirm Commands`,description:`When checked, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(R,{id:`confirmCommands`,checked:!G,onCheckedChange:e=>K(e!==!0),disabled:M}),(0,U.jsx)(x,{htmlFor:`confirmCommands`,className:w.labelNormal,children:`Require approval for bash commands, skill scripts, and browser shell calls`})]}),!G&&q.length>0&&(0,U.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[(0,U.jsx)(x,{children:`Allowed command patterns`}),(0,U.jsx)(`ul`,{className:`space-y-1`,children:q.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,U.jsx)(`code`,{className:l(w.mono,w.bodyMuted),children:e}),(0,U.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,disabled:M||O,onClick:()=>we(t=>t.filter(t=>t!==e)),children:`Remove`})]},e))})]})]}),(0,U.jsx)(N,{title:`Environment Variables`,description:`Stored encrypted in the Tarsk database and injected when the agent runs bash commands or MCP tools.`,action:(0,U.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:Be,disabled:M,children:[(0,U.jsx)(b,{className:`h-3 w-3 mr-1`}),`Add variable`]}),children:J.length===0?(0,U.jsx)(`p`,{className:w.caption,children:`No environment variables configured`}):(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:J.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(S,{placeholder:`API_KEY`,value:e.name,onChange:e=>Ve(t,e.target.value),className:`font-mono w-[35%]`,disabled:M}),(0,U.jsx)(Ce,{entry:e,index:t,loading:M,onValueChange:He}),(0,U.jsx)(_,{variant:`ghost`,size:`icon`,onClick:()=>Ue(t),className:`h-9 w-9 flex-shrink-0`,disabled:M||O,children:(0,U.jsx)(d,{className:`h-3.5 w-3.5`})})]},t))})}),(0,U.jsx)(_e,{type:`single`,collapsible:!0,children:(0,U.jsxs)(ve,{value:`advanced`,className:`border-b-0`,children:[(0,U.jsx)(ye,{className:l(w.sectionTitle,`text-2xl hover:no-underline py-0`),children:`Advanced`}),(0,U.jsxs)(be,{children:[(0,U.jsx)(N,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md.`,className:`pt-2`,children:(0,U.jsx)(xe,{value:X,onChange:je,disabled:M||O})}),(0,U.jsx)(N,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,className:`pt-6`,children:(0,U.jsx)(Se,{disabledTools:Z,onChange:Pe,disabled:M||O})}),(0,U.jsx)(N,{title:`Use Built In Browser`,description:`When enabled, Tarsk shows the Browser tab for this project and opens detected dev URLs there. When disabled, the Browser tab is hidden and dev URLs open in your system browser instead.`,className:`pt-6`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(R,{id:`useBuiltInBrowser`,checked:Q,onCheckedChange:e=>Le(e===!0),disabled:M||O}),(0,U.jsx)(x,{htmlFor:`useBuiltInBrowser`,className:w.labelNormal,children:`Use Built In Browser`})]})})]})]})})]})]})}):(0,U.jsx)(de,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`})}export{Te as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,At as n,B as r,Ba as i,Bi as a,Br as o,Cn as s,G as c,H as l,Ii as u,Is as d,Ko as f,Li as p,Lr as m,Ms as h,Ns as g,Ot as _,Pi as v,Po as y,Ps as b,Ro as x,Rr as S,Sn as C,So as w,U as ee,V as te,W as ne,Wa as re,Wo as ie,Ya as ae,Zr as T,as as oe,bo as E,fa as se,fn as ce,fs as D,kt as O,ma as le,ra as ue,va as de,vo as fe,wo as pe,xn as me,yo as he,zr as k}from"./dialogs-config-DAMqiy-4.js";import{Ft as ge,It as _e}from"./react-vendor-U9lUQswz.js";import{C as A,D as ve,E as ye,S as be,T as xe,a as Se,b as Ce,d as we,f as Te,g as Ee,h as De,i as j,n as Oe,o as M,p as ke,r as N,x as P}from"./history-view-lvvTzW7O.js";import{a as F,c as Ae,i as je,n as Me,o as Ne,s as Pe,u as Fe}from"./onboarding-dys9Rwb5.js";import{t as I}from"./skeleton-rEPpLCqo.js";import{i as Ie,n as Le,r as Re,t as ze}from"./tabs-D57g7ER1.js";import{t as Be}from"./use-deferred-search-Bi99md6l.js";import{t as Ve}from"./model-star-rating-C4Ugsik_.js";var L=b(),R=e(d(),1),z=g(),B=a(u(D.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function V(e){let t=(0,L.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=u(B({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,z.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var He=f(`app.provider-details-view.ui`);function Ue(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function We({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:a,onBack:d,className:f}){let[g,b]=(0,R.useState)(null),[x,ae]=(0,R.useState)(``),[E,O]=(0,R.useState)(!1),[pe,ge]=(0,R.useState)(null),[_e,Se]=(0,R.useState)(``),[j,Oe]=(0,R.useState)([]),[M,N]=(0,R.useState)(new Set),[I,L]=(0,R.useState)(new Set),[B,V]=(0,R.useState)(new Map),{query:We,setQuery:H,deferredQuery:U}=Be(),[W,G]=(0,R.useState)(`alphabetical`),[K,Ge]=(0,R.useState)(`all`),[Ke,qe]=(0,R.useState)(!1),[q,J]=(0,R.useState)(``),[Je,Y]=(0,R.useState)(``),[Ye,Xe]=(0,R.useState)(``),[Ze,Qe]=(0,R.useState)(`coding`),[X,$e]=(0,R.useState)([]),[et,tt]=(0,R.useState)(new Set),[nt,rt]=(0,R.useState)(new Set),[it,Z]=(0,R.useState)(new Map),[at,ot]=(0,R.useState)({}),Q=e=>Fe(e.id);(0,R.useEffect)(()=>{(async()=>{if(Se(``),a&&(t&&a.slug===t||e&&a.name===e)){b(a),Xe(a.apiKey??``),ae(a.apiKey??``),ot(a.envValues??{}),ut(a.slug),st(a.slug);return}try{let r=Ue(await n(),e,t);b(r),Xe(r?.apiKey??``),ae(r?.apiKey??``),ot(r?.envValues??{}),r&&(ut(r.slug),st(r.slug))}catch(e){Se(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,a]);let st=async e=>{ge(null);try{let t=await _(e);t.status===`success`&&ge(t.balance)}catch(t){He.error(`Failed to load balance for ${e}:`,t)}};function ct(){Oe([]),$e([]),N(new Set),L(new Set),tt(new Set),rt(new Set),V(new Map),Z(new Map)}function lt(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ut=async e=>{O(!0),Y(``),H(``),G(`alphabetical`),Ge(`all`),Qe(`coding`);try{let[t,n]=await Promise.all([c(e),ne(e)]);Oe(t.models),$e(n.models);let r=new Set(t.enabledModelIds);N(r),L(r);let i=new Set(n.enabledModelIds);tt(i),rt(i),V(new Map),Z(new Map)}catch(t){He.error(`Failed to load models for ${e}:`,t),ct(),Y(lt(t))}finally{O(!1)}};async function dt(e){O(!0),Y(``);try{await ce(e),await ut(e)}catch(t){He.error(`Failed to refresh models for ${e}:`,t),ct(),Y(lt(t)),O(!1)}}let ft=(e,t)=>{g?.name===e&&(ae(t),mt(t))},pt=(e,t)=>{ot(n=>({...n,[e]:t})),g&&(async()=>{try{await C({[e]:t}),J(`${Pe(e)} saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save provider settings`);return}oe(g.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await dt(g.slug)})()},mt=async e=>{if(!(!g||e===Ye))try{await s(g.slug,e),Xe(e),J(`API key saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save API key`)}},ht=(e,t)=>{t===`image`?Z(t=>{let n=new Map(t),r=et.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),_t(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):V(t=>{let n=je(t,e,M);return _t(e,(n.has(e)?n.get(e):M.has(e))??!1,`coding`),n})};async function gt(e,t){if(!(!g||!oe(g.slug)))try{await me(g.slug,e,{reasoningEffort:t}),Oe(n=>n.map(n=>n.id===e?{...n,settings:{...n.settings,reasoningEffort:t}}:n))}catch(e){J(e instanceof Error?e.message:`Failed to save model settings`)}}let _t=async(e,t,n=`coding`)=>{if(g)try{n===`image`?(t?(await l(g.slug,e),tt(t=>new Set([...t,e]))):(await r(g.slug,e),tt(t=>{let n=new Set(t);return n.delete(e),n})),Z(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ee(g.slug,e),N(t=>new Set([...t,e]))):(await te(g.slug,e),N(t=>{let n=new Set(t);return n.delete(e),n})),V(t=>{let n=new Map(t);return n.delete(e),n})),J(`Model preferences saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save model changes`)}};async function vt(e,t=`coding`){let n=t===`image`?X:j,r=t===`image`?et:M;(t===`image`?Z:V)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await _t(i.id,e,t)}let $=x!==void 0&&x.trim().length>0,yt=(0,R.useMemo)(()=>Me({models:j,query:U,sortBy:W,getDisplayName:Q,freeOnly:K===`free`,groupByProvider:!0,getPriority:e=>+!I.has(e.id)}),[j,U,K,I,W,Q]),bt=(0,R.useMemo)(()=>Me({models:X,query:U,sortBy:W===`coding-index`||W===`intelligence-by-price`?`alphabetical`:W,getDisplayName:Q,freeOnly:K===`free`,groupByProvider:!0,getPriority:e=>+!nt.has(e.id)}),[X,U,K,nt,W,Q]);return _e?(0,z.jsxs)(`div`,{className:u(`flex flex-1 flex-col items-center justify-center gap-4 p-6`,f),children:[(0,z.jsx)(P,{variant:`error`,className:`mb-0`,children:_e}),(0,z.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):g?(0,z.jsx)(ve,{className:f,children:(0,z.jsxs)(ye,{children:[d?(0,z.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(v,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:d,children:[(0,z.jsx)(y,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Back to providers`})]}),(0,z.jsx)(`button`,{type:`button`,className:u(D.sectionTitle,`min-w-0 flex-1 truncate border-0 bg-transparent p-0 text-left text-foreground cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm`),onClick:d,children:`Providers`})]}):null,(0,z.jsx)(be,{title:g.name,description:`Configure API keys and models for this provider.`}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2`,children:pe===null?(0,z.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,z.jsxs)(`span`,{className:u(D.compact,`font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`),children:[(0,z.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,p(pe),` `,`balance`]})}),g.url?(0,z.jsx)(Ne,{url:g.url,className:u(D.compact,`p-3`)}):(0,z.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,z.jsx)(Ce,{title:`API Key`,description:`Your API key is stored locally and never shared.`,children:g.authType===`APIKey`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(re,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(T,{type:Ke?`text`:`password`,placeholder:g.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:x,onChange:e=>{ft(g.name,e.target.value)}}),(0,z.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:()=>qe(!Ke),disabled:!x,children:Ke?(0,z.jsx)(he,{className:`h-4 w-4 text-muted-foreground`}):(0,z.jsx)(fe,{className:`h-4 w-4 text-muted-foreground`})})]}),(0,z.jsx)(`div`,{className:`space-y-4 mt-4`,children:Ae(g).map(e=>(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(k,{children:(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(`span`,{className:u(D.label,`cursor-help`),children:Pe(e)})}),(0,z.jsx)(S,{children:e})]})}),oe(g.slug)&&e===`LOCAL_API_URL`?(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(T,{id:e,value:at[e]??``,onChange:t=>pt(e,t.target.value),placeholder:g.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,z.jsx)(k,{children:(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.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:()=>{dt(g.slug)},disabled:E,children:E?(0,z.jsx)(i,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,z.jsx)(de,{className:`h-4 w-4 text-muted-foreground`})})}),(0,z.jsx)(S,{children:`Refresh models`})]})})]}):(0,z.jsx)(T,{id:e,value:at[e]??``,onChange:t=>pt(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})]},e))})]}):(0,z.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,z.jsx)(P,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,z.jsxs)(v,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,g.name]})]})}),(0,z.jsx)(A,{title:`Models`}),Je?(0,z.jsx)(P,{variant:`error`,className:`mb-4`,children:Je}):null,(0,z.jsxs)(ze,{value:Ze,onValueChange:e=>{Qe(e),H(``),G(`alphabetical`)},children:[(0,z.jsxs)(Re,{className:`mb-4`,children:[(0,z.jsx)(Ie,{value:`coding`,children:`Coding`}),g?.name.toLowerCase()===`openrouter`&&(0,z.jsx)(Ie,{value:`image`,children:`Image`})]}),(0,z.jsx)(Le,{value:`coding`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!E&&j.length>0&&(0,z.jsxs)(`div`,{className:u(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,z.jsx)(F,{id:`select-all-models`,disabled:!$,checked:j.every(e=>{let t=B.has(e.id),n=B.get(e.id);return t?n:M.has(e.id)}),onCheckedChange:e=>{vt(e===!0,`coding`)}}),(0,z.jsx)(`label`,{htmlFor:`select-all-models`,className:u(D.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,z.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,z.jsx)(T,{placeholder:`Search models...`,className:`pl-10 h-8`,value:We,onChange:e=>H(e.target.value),disabled:!$})]}),(0,z.jsx)(k,{children:(0,z.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`alphabetical`),children:(0,z.jsx)(ie,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort A–Z`})]}),(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`price-low`||W===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`price-low`),children:(0,z.jsx)(w,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort by price`})]}),(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`coding-index`),children:(0,z.jsx)(ue,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort by coding intelligence`})]}),(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`intelligence-by-price`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`intelligence-by-price`),children:(0,z.jsx)(le,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort by price/intelligence`})]})]})})]})]}),E?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):j.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:Je?`No models loaded.`:`No models available for this provider.`})}):(0,z.jsx)(k,{children:(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:yt.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No models matching your filters.`})}):yt.map(e=>{let t=M.has(e.id),n=B.has(e.id),r=B.get(e.id),i=n?r:t,a=e.pricing;return(0,z.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,z.jsx)(F,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>ht(e.id,`coding`),className:`mt-0`}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,z.jsx)(`label`,{htmlFor:e.id,className:u(D.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[g&&oe(g.slug)&&i&&(e.supportedReasoningEfforts?.length??0)>0&&(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(e.supportedReasoningEfforts?.length??0)===1?(0,z.jsxs)(`label`,{className:u(D.caption,`flex items-center gap-1.5 text-muted-foreground cursor-pointer`),children:[(0,z.jsx)(F,{checked:e.settings?.reasoningEffort!==`off`&&e.settings?.reasoningEffort!==void 0,onCheckedChange:t=>{let n=e.supportedReasoningEfforts?.[0];n&&gt(e.id,t===!0?n:`off`)},"aria-label":`Enable reasoning for ${Q(e)}`}),`Reasoning`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:u(D.caption,`text-muted-foreground`),children:`Reasoning`}),(0,z.jsxs)(we,{value:e.settings?.reasoningEffort??`off`,onValueChange:t=>{gt(e.id,t)},children:[(0,z.jsx)(De,{className:`h-7 w-[7.5rem] text-xs`,"aria-label":`Reasoning effort for ${Q(e)}`,children:(0,z.jsx)(Ee,{})}),(0,z.jsxs)(Te,{children:[(0,z.jsx)(ke,{value:`off`,children:h(`off`)}),e.supportedReasoningEfforts?.map(e=>(0,z.jsx)(ke,{value:e,children:h(e)},e))]})]})]})})}),(0,z.jsx)(S,{children:`Control reasoning/thinking parameters for this model. Choose Off if the model does not support reasoning.`})]}),(W===`coding-index`||W===`intelligence-by-price`)&&(0,z.jsx)(Ve,{codingIndex:e.coding_index,modelName:Q(e)}),a&&(0,z.jsx)(`span`,{className:u(D.caption,`whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${p(a.prompt??0)} in | $${p(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,z.jsx)(Le,{value:`image`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!E&&X.length>0&&(0,z.jsxs)(`div`,{className:u(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,z.jsx)(F,{id:`select-all-image-models`,disabled:!$,checked:X.every(e=>{let t=it.has(e.id),n=it.get(e.id);return t?n:et.has(e.id)}),onCheckedChange:e=>{vt(e===!0,`image`)}}),(0,z.jsx)(`label`,{htmlFor:`select-all-image-models`,className:u(D.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,z.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,z.jsx)(T,{placeholder:`Search models...`,className:`pl-10 h-8`,value:We,onChange:e=>H(e.target.value),disabled:!$})]}),(0,z.jsx)(k,{children:(0,z.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`alphabetical`),children:(0,z.jsx)(ie,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort A–Z`})]}),(0,z.jsxs)(m,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:W===`price-low`||W===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`price-low`),children:(0,z.jsx)(w,{className:`h-4 w-4`})})}),(0,z.jsx)(S,{children:`Sort by price`})]})]})})]})]}),E?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):X.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No image models available for this provider.`})}):(0,z.jsx)(k,{children:(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:bt.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No models matching your filters.`})}):bt.map(e=>{let t=et.has(e.id),n=it.has(e.id),r=it.get(e.id),i=n?r:t,a=e.pricing;return(0,z.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,z.jsx)(F,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>ht(e.id,`image`),className:`mt-0`}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,z.jsx)(`label`,{htmlFor:`image-${e.id}`,className:u(D.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),a&&(0,z.jsx)(`span`,{className:u(D.caption,`whitespace-nowrap flex-shrink-0`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${p(a.prompt??0)} in | $${p(a.completion??0)} out`})]})]},e.id)})})})]})})]}),q?(0,z.jsx)(P,{variant:q.includes(`error`)||q.includes(`Failed`)?`error`:`success`,children:q}):null]})]})}):(0,z.jsx)(`div`,{className:u(`flex flex-1 items-center justify-center`,f),children:(0,z.jsx)(xe,{title:e||t?`Provider not found`:`Select a Provider`,action:d?(0,z.jsxs)(v,{variant:`outline`,size:`sm`,onClick:d,children:[(0,z.jsx)(y,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,children:d?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`})})}function H(e){return`providers:list:${e}`}async function U(){let[e,r]=await Promise.all([n(),t().catch(()=>({}))]),i={};for(let[e,t]of Object.entries(r))i[e]=t.length;return{providers:e,enabledModelCounts:i}}function W(){let e=(0,L.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,z.jsx)(A,{title:`Connected Providers`}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsxs)(`div`,{children:[n,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`})]})]}),i=(0,z.jsx)(A,{title:`Available Providers`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[t,(0,z.jsxs)(`div`,{className:`space-y-8`,children:[r,(0,z.jsxs)(`div`,{children:[i,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`})]})]})]})]})}),e[4]=a):a=e[4],a}function G(e){let t=(0,L.c)(40),{loadVersion:n,onProviderClick:r}=e,{query:i,setQuery:a,deferredQuery:o}=Be(),s;t[0]===n?s=t[1]:(s=H(n),t[0]=n,t[1]=s);let{providers:c,enabledModelCounts:l}=Se(s,U),d;if(t[2]!==o||t[3]!==l||t[4]!==c){let e;t[6]===o?e=t[7]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=o,t[7]=e);let n;t[8]===l?n=t[9]:(n=(e,t)=>{let n=(l[e.slug]??0)>0,r=(l[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=l,t[9]=n),d=c.filter(Ke).filter(e).sort(n),t[2]=o,t[3]=l,t[4]=c,t[5]=d}else d=t[5];let f=d,p;if(t[10]!==o||t[11]!==c){let e;t[13]===o?e=t[14]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=o,t[14]=e),p=c.filter(Ge).filter(e).sort(K),t[10]=o,t[11]=c,t[12]=p}else p=t[12];let m=p,h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),t[16]=g):g=t[16];let _;t[17]===a?_=t[18]:(_=e=>a(e.target.value),t[17]=a,t[18]=_);let v;t[19]!==i||t[20]!==_?(v=(0,z.jsx)(`div`,{className:`mb-6`,children:(0,z.jsxs)(`div`,{className:`relative`,children:[g,(0,z.jsx)(T,{placeholder:`Search providers...`,className:`pl-10`,value:i,onChange:_})]})}),t[19]=i,t[20]=_,t[21]=v):v=t[21];let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,z.jsx)(A,{title:`Connected Providers`}),t[22]=y):y=t[22];let b;t[23]!==f||t[24]!==l||t[25]!==r||t[26]!==i?(b=(0,z.jsxs)(`section`,{children:[y,f.length===0?(0,z.jsx)(`p`,{className:u(D.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:f.map(e=>(0,z.jsx)(Ye,{provider:e,isConnected:!0,modelCount:l[e.slug]??0,onClick:r},e.name))})]}),t[23]=f,t[24]=l,t[25]=r,t[26]=i,t[27]=b):b=t[27];let x;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,z.jsx)(A,{title:`Available Providers`}),t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==l||t[31]!==r||t[32]!==i?(S=(0,z.jsxs)(`section`,{children:[x,m.length===0?(0,z.jsx)(`p`,{className:u(D.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:m.map(e=>(0,z.jsx)(Ye,{provider:e,modelCount:l[e.slug]??0,onClick:r},e.name))})]}),t[29]=m,t[30]=l,t[31]=r,t[32]=i,t[33]=S):S=t[33];let C;t[34]!==S||t[35]!==b?(C=(0,z.jsxs)(`div`,{className:`space-y-8`,children:[b,S]}),t[34]=S,t[35]=b,t[36]=C):C=t[36];let w;return t[37]!==C||t[38]!==v?(w=(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[h,v,C]})}),t[37]=C,t[38]=v,t[39]=w):w=t[39],w}function K(e,t){return e.name.localeCompare(t.name)}function Ge(e){return!e.apiKey}function Ke(e){return e.apiKey}function qe(){let e=(0,L.c)(21),t=ge(),{providerSlug:n}=_e(),[r,i]=(0,R.useState)(0),a=(0,R.useRef)(n),o,s;e[0]!==r||e[1]!==n?(o=()=>{a.current&&!n&&(M(H(r)),i(Y)),a.current=n},s=[n,r],e[0]=r,e[1]=n,e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,R.useEffect)(o,s);let c;e[4]===t?c=e[5]:(c=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=c);let l=c,u;e[6]!==r||e[7]!==t?(u=()=>{t(`/settings/providers`),M(H(r)),i(Je)},e[6]=r,e[7]=t,e[8]=u):u=e[8];let d=u,f;e[9]===r?f=e[10]:(f=function(){M(H(r)),i(J)},e[9]=r,e[10]=f);let p=f;if(n){let t=decodeURIComponent(n),r;return e[11]!==d||e[12]!==t?(r=(0,z.jsx)(We,{selectedProviderSlug:t,onBack:d}),e[11]=d,e[12]=t,e[13]=r):r=e[13],r}let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(W,{}),e[14]=m):m=e[14];let h;e[15]!==l||e[16]!==r?(h=(0,z.jsx)(R.Suspense,{fallback:m,children:(0,z.jsx)(G,{loadVersion:r,onProviderClick:l},r)}),e[15]=l,e[16]=r,e[17]=h):h=e[17];let g;return e[18]!==p||e[19]!==h?(g=(0,z.jsx)(Oe,{fallbackTitle:`Failed to load providers`,onRetry:p,renderFallback:q,children:h}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}function q(e,t){return(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,z.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,z.jsx)(P,{variant:`error`,className:`mb-4`,children:e.message}),(0,z.jsx)(v,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function J(e){return e+1}function Je(e){return e+1}function Y(e){return e+1}function Ye(e){let t=(0,L.c)(28),{provider:n,isConnected:r,modelCount:i,onClick:a}=e,o=r===void 0?!1:r,s=i===void 0?0:i,[c,l]=(0,R.useState)(!1),d;t[0]!==a||t[1]!==n?(d=()=>a(n),t[0]=a,t[1]=n,t[2]=d):d=t[2];let f;t[3]!==c||t[4]!==n.name||t[5]!==n.slug?(f=(0,z.jsx)(`div`,{className:`flex-shrink-0 h-10 w-10 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:c?(0,z.jsx)(pe,{className:`h-5 w-5 text-muted-foreground`}):(0,z.jsx)(`img`,{src:O(n.slug),alt:`${n.name} logo`,className:`h-6 w-6 dark:invert`,onError:()=>l(!0)})}),t[3]=c,t[4]=n.name,t[5]=n.slug,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=u(D.label,`truncate`),t[7]=p):p=t[7];let m;t[8]===n.name?m=t[9]:(m=(0,z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,z.jsx)(`span`,{className:p,children:n.name})}),t[8]=n.name,t[9]=m);let h;t[10]===o?h=t[11]:(h=!o&&(0,z.jsxs)(`div`,{className:u(D.compact,`flex items-center gap-1 text-muted-foreground mt-0.5`),children:[(0,z.jsx)(E,{className:`h-3 w-3`}),(0,z.jsx)(`span`,{children:`Click to configure`})]}),t[10]=o,t[11]=h);let g;t[12]!==m||t[13]!==h?(g=(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==f||t[16]!==g?(_=(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[f,g]}),t[15]=f,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==s||t[20]!==n.isEnv?(v=o&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[n.isEnv?(0,z.jsxs)(V,{variant:`secondary`,className:u(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(ae,{className:`h-3 w-3`}),`Environment`]}):(0,z.jsxs)(V,{variant:`secondary`,className:u(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(re,{className:`h-3 w-3`}),`API Key`]}),s>0&&(0,z.jsxs)(V,{variant:`default`,className:u(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(x,{className:`h-3 w-3`}),s,` `,s===1?`Model`:`Models`]})]}),t[18]=o,t[19]=s,t[20]=n.isEnv,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==_?(y=(0,z.jsxs)(j,{className:`p-4 flex flex-col gap-3`,children:[_,v]}),t[22]=v,t[23]=_,t[24]=y):y=t[24];let b;return t[25]!==y||t[26]!==d?(b=(0,z.jsx)(N,{className:`cursor-pointer transition-all hover:border-primary/50 hover:shadow-md`,onClick:d,children:y}),t[25]=y,t[26]=d,t[27]=b):b=t[27],b}export{qe as ProvidersListView,qe as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,At as n,B as r,Ba as i,Bi as a,Br as o,Cn as s,Fs as c,G as l,H as u,Ii as d,Is as f,Ko as p,Li as m,Lr as h,Ot as g,Pi as _,Po as v,Ps as y,Ro as b,Rr as x,Rs as S,Sn as C,So as w,U as ee,V as te,W as ne,Wa as re,Wo as ie,Ya as ae,Zr as T,as as oe,bo as E,fa as se,fn as ce,fs as D,kt as O,ma as le,ra as ue,va as de,vo as fe,wo as pe,xn as me,yo as he,zr as k}from"./dialogs-config-86QTDk4G.js";import{Ft as ge,It as _e}from"./react-vendor-DK2COBjg.js";import{C as A,D as ve,E as ye,S as be,T as xe,a as Se,b as Ce,d as we,f as Te,g as Ee,h as De,i as j,n as Oe,o as M,p as ke,r as N,x as P}from"./history-view-BsN806ip.js";import{a as F,c as Ae,i as je,n as Me,o as Ne,s as Pe,u as Fe}from"./onboarding-DCrFdRM5.js";import{t as I}from"./skeleton-BvvAbfo4.js";import{i as Ie,n as Le,r as Re,t as ze}from"./tabs-0fGgot48.js";import{t as Be}from"./use-deferred-search-DOfdC3JO.js";import{t as Ve}from"./model-star-rating-DrR6jzjq.js";var L=f(),R=e(S(),1),z=c(),B=a(d(D.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function V(e){let t=(0,L.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=d(B({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,z.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var He=p(`app.provider-details-view.ui`);function Ue(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function We({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:a,onBack:c,className:f}){let[p,b]=(0,R.useState)(null),[S,ae]=(0,R.useState)(``),[E,O]=(0,R.useState)(!1),[pe,ge]=(0,R.useState)(null),[_e,Se]=(0,R.useState)(``),[j,Oe]=(0,R.useState)([]),[M,N]=(0,R.useState)(new Set),[I,L]=(0,R.useState)(new Set),[B,V]=(0,R.useState)(new Map),{query:We,setQuery:H,deferredQuery:U}=Be(),[W,G]=(0,R.useState)(`alphabetical`),[K,Ge]=(0,R.useState)(`all`),[Ke,qe]=(0,R.useState)(!1),[q,J]=(0,R.useState)(``),[Je,Y]=(0,R.useState)(``),[Ye,Xe]=(0,R.useState)(``),[Ze,Qe]=(0,R.useState)(`coding`),[X,$e]=(0,R.useState)([]),[et,tt]=(0,R.useState)(new Set),[nt,rt]=(0,R.useState)(new Set),[it,Z]=(0,R.useState)(new Map),[at,ot]=(0,R.useState)({}),Q=e=>Fe(e.id);(0,R.useEffect)(()=>{(async()=>{if(Se(``),a&&(t&&a.slug===t||e&&a.name===e)){b(a),Xe(a.apiKey??``),ae(a.apiKey??``),ot(a.envValues??{}),ut(a.slug),st(a.slug);return}try{let r=Ue(await n(),e,t);b(r),Xe(r?.apiKey??``),ae(r?.apiKey??``),ot(r?.envValues??{}),r&&(ut(r.slug),st(r.slug))}catch(e){Se(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,a]);let st=async e=>{ge(null);try{let t=await g(e);t.status===`success`&&ge(t.balance)}catch(t){He.error(`Failed to load balance for ${e}:`,t)}};function ct(){Oe([]),$e([]),N(new Set),L(new Set),tt(new Set),rt(new Set),V(new Map),Z(new Map)}function lt(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ut=async e=>{O(!0),Y(``),H(``),G(`alphabetical`),Ge(`all`),Qe(`coding`);try{let[t,n]=await Promise.all([l(e),ne(e)]);Oe(t.models),$e(n.models);let r=new Set(t.enabledModelIds);N(r),L(r);let i=new Set(n.enabledModelIds);tt(i),rt(i),V(new Map),Z(new Map)}catch(t){He.error(`Failed to load models for ${e}:`,t),ct(),Y(lt(t))}finally{O(!1)}};async function dt(e){O(!0),Y(``);try{await ce(e),await ut(e)}catch(t){He.error(`Failed to refresh models for ${e}:`,t),ct(),Y(lt(t)),O(!1)}}let ft=(e,t)=>{p?.name===e&&(ae(t),mt(t))},pt=(e,t)=>{ot(n=>({...n,[e]:t})),p&&(async()=>{try{await C({[e]:t}),J(`${Pe(e)} saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save provider settings`);return}oe(p.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await dt(p.slug)})()},mt=async e=>{if(!(!p||e===Ye))try{await s(p.slug,e),Xe(e),J(`API key saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save API key`)}},ht=(e,t)=>{t===`image`?Z(t=>{let n=new Map(t),r=et.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),_t(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):V(t=>{let n=je(t,e,M);return _t(e,(n.has(e)?n.get(e):M.has(e))??!1,`coding`),n})};async function gt(e,t){if(!(!p||!oe(p.slug)))try{await me(p.slug,e,{reasoningEffort:t}),Oe(n=>n.map(n=>n.id===e?{...n,settings:{...n.settings,reasoningEffort:t}}:n))}catch(e){J(e instanceof Error?e.message:`Failed to save model settings`)}}let _t=async(e,t,n=`coding`)=>{if(p)try{n===`image`?(t?(await u(p.slug,e),tt(t=>new Set([...t,e]))):(await r(p.slug,e),tt(t=>{let n=new Set(t);return n.delete(e),n})),Z(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ee(p.slug,e),N(t=>new Set([...t,e]))):(await te(p.slug,e),N(t=>{let n=new Set(t);return n.delete(e),n})),V(t=>{let n=new Map(t);return n.delete(e),n})),J(`Model preferences saved successfully`),setTimeout(()=>J(``),3e3)}catch(e){J(e instanceof Error?e.message:`Failed to save model changes`)}};async function vt(e,t=`coding`){let n=t===`image`?X:j,r=t===`image`?et:M;(t===`image`?Z:V)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await _t(i.id,e,t)}let $=S!==void 0&&S.trim().length>0,yt=(0,R.useMemo)(()=>Me({models:j,query:U,sortBy:W,getDisplayName:Q,freeOnly:K===`free`,groupByProvider:!0,getPriority:e=>+!I.has(e.id)}),[j,U,K,I,W,Q]),bt=(0,R.useMemo)(()=>Me({models:X,query:U,sortBy:W===`coding-index`||W===`intelligence-by-price`?`alphabetical`:W,getDisplayName:Q,freeOnly:K===`free`,groupByProvider:!0,getPriority:e=>+!nt.has(e.id)}),[X,U,K,nt,W,Q]);return _e?(0,z.jsxs)(`div`,{className:d(`flex flex-1 flex-col items-center justify-center gap-4 p-6`,f),children:[(0,z.jsx)(P,{variant:`error`,className:`mb-0`,children:_e}),(0,z.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):p?(0,z.jsx)(ve,{className:f,children:(0,z.jsxs)(ye,{children:[c?(0,z.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-center gap-2`,children:[(0,z.jsxs)(_,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground`,onClick:c,children:[(0,z.jsx)(v,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Back to providers`})]}),(0,z.jsx)(`button`,{type:`button`,className:d(D.sectionTitle,`min-w-0 flex-1 truncate border-0 bg-transparent p-0 text-left text-foreground cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 rounded-sm`),onClick:c,children:`Providers`})]}):null,(0,z.jsx)(be,{title:p.name,description:`Configure API keys and models for this provider.`}),(0,z.jsxs)(`div`,{className:`space-y-6`,children:[(0,z.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,z.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2`,children:pe===null?(0,z.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,z.jsxs)(`span`,{className:d(D.compact,`font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`),children:[(0,z.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,m(pe),` `,`balance`]})}),p.url?(0,z.jsx)(Ne,{url:p.url,className:d(D.compact,`p-3`)}):(0,z.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,z.jsx)(Ce,{title:`API Key`,description:`Your API key is stored locally and never shared.`,children:p.authType===`APIKey`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(re,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,z.jsx)(T,{type:Ke?`text`:`password`,placeholder:p.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:S,onChange:e=>{ft(p.name,e.target.value)}}),(0,z.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>qe(!Ke),disabled:!S,children:Ke?(0,z.jsx)(he,{className:`h-4 w-4 text-muted-foreground`}):(0,z.jsx)(fe,{className:`h-4 w-4 text-muted-foreground`})})]}),(0,z.jsx)(`div`,{className:`space-y-4 mt-4`,children:Ae(p).map(e=>(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(k,{children:(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(`span`,{className:d(D.label,`cursor-help`),children:Pe(e)})}),(0,z.jsx)(x,{children:e})]})}),oe(p.slug)&&e===`LOCAL_API_URL`?(0,z.jsxs)(`div`,{className:`relative`,children:[(0,z.jsx)(T,{id:e,value:at[e]??``,onChange:t=>pt(e,t.target.value),placeholder:p.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,z.jsx)(k,{children:(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{dt(p.slug)},disabled:E,children:E?(0,z.jsx)(i,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,z.jsx)(de,{className:`h-4 w-4 text-muted-foreground`})})}),(0,z.jsx)(x,{children:`Refresh models`})]})})]}):(0,z.jsx)(T,{id:e,value:at[e]??``,onChange:t=>pt(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})]},e))})]}):(0,z.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,z.jsx)(P,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,z.jsxs)(_,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,p.name]})]})}),(0,z.jsx)(A,{title:`Models`}),Je?(0,z.jsx)(P,{variant:`error`,className:`mb-4`,children:Je}):null,(0,z.jsxs)(ze,{value:Ze,onValueChange:e=>{Qe(e),H(``),G(`alphabetical`)},children:[(0,z.jsxs)(Re,{className:`mb-4`,children:[(0,z.jsx)(Ie,{value:`coding`,children:`Coding`}),p?.name.toLowerCase()===`openrouter`&&(0,z.jsx)(Ie,{value:`image`,children:`Image`})]}),(0,z.jsx)(Le,{value:`coding`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!E&&j.length>0&&(0,z.jsxs)(`div`,{className:d(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,z.jsx)(F,{id:`select-all-models`,disabled:!$,checked:j.every(e=>{let t=B.has(e.id),n=B.get(e.id);return t?n:M.has(e.id)}),onCheckedChange:e=>{vt(e===!0,`coding`)}}),(0,z.jsx)(`label`,{htmlFor:`select-all-models`,className:d(D.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,z.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,z.jsx)(T,{placeholder:`Search models...`,className:`pl-10 h-8`,value:We,onChange:e=>H(e.target.value),disabled:!$})]}),(0,z.jsx)(k,{children:(0,z.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`alphabetical`),children:(0,z.jsx)(ie,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort A–Z`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`price-low`||W===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`price-low`),children:(0,z.jsx)(w,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort by price`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`coding-index`),children:(0,z.jsx)(ue,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort by coding intelligence`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`intelligence-by-price`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`intelligence-by-price`),children:(0,z.jsx)(le,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort by price/intelligence`})]})]})})]})]}),E?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):j.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:Je?`No models loaded.`:`No models available for this provider.`})}):(0,z.jsx)(k,{children:(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:yt.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No models matching your filters.`})}):yt.map(e=>{let t=M.has(e.id),n=B.has(e.id),r=B.get(e.id),i=n?r:t,a=e.pricing;return(0,z.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,z.jsx)(F,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>ht(e.id,`coding`),className:`mt-0`}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,z.jsx)(`label`,{htmlFor:e.id,className:d(D.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[p&&oe(p.slug)&&i&&(e.supportedReasoningEfforts?.length??0)>0&&(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(e.supportedReasoningEfforts?.length??0)===1?(0,z.jsxs)(`label`,{className:d(D.caption,`flex items-center gap-1.5 text-muted-foreground cursor-pointer`),children:[(0,z.jsx)(F,{checked:e.settings?.reasoningEffort!==`off`&&e.settings?.reasoningEffort!==void 0,onCheckedChange:t=>{let n=e.supportedReasoningEfforts?.[0];n&&gt(e.id,t===!0?n:`off`)},"aria-label":`Enable reasoning for ${Q(e)}`}),`Reasoning`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:d(D.caption,`text-muted-foreground`),children:`Reasoning`}),(0,z.jsxs)(we,{value:e.settings?.reasoningEffort??`off`,onValueChange:t=>{gt(e.id,t)},children:[(0,z.jsx)(De,{className:`h-7 w-[7.5rem] text-xs`,"aria-label":`Reasoning effort for ${Q(e)}`,children:(0,z.jsx)(Ee,{})}),(0,z.jsxs)(Te,{children:[(0,z.jsx)(ke,{value:`off`,children:y(`off`)}),e.supportedReasoningEfforts?.map(e=>(0,z.jsx)(ke,{value:e,children:y(e)},e))]})]})]})})}),(0,z.jsx)(x,{children:`Control reasoning/thinking parameters for this model. Choose Off if the model does not support reasoning.`})]}),(W===`coding-index`||W===`intelligence-by-price`)&&(0,z.jsx)(Ve,{codingIndex:e.coding_index,modelName:Q(e)}),a&&(0,z.jsx)(`span`,{className:d(D.caption,`whitespace-nowrap`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${m(a.prompt??0)} in | $${m(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,z.jsx)(Le,{value:`image`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!E&&X.length>0&&(0,z.jsxs)(`div`,{className:d(`flex flex-col gap-3 md:flex-row md:items-center md:justify-between`,!$&&`opacity-25`),children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,z.jsx)(F,{id:`select-all-image-models`,disabled:!$,checked:X.every(e=>{let t=it.has(e.id),n=it.get(e.id);return t?n:et.has(e.id)}),onCheckedChange:e=>{vt(e===!0,`image`)}}),(0,z.jsx)(`label`,{htmlFor:`select-all-image-models`,className:d(D.body,`whitespace-nowrap`,$?`cursor-pointer`:`cursor-not-allowed`),children:`Select all models`})]}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 md:flex-row md:items-center md:flex-1 md:min-w-0 md:justify-end`,children:[(0,z.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,z.jsx)(T,{placeholder:`Search models...`,className:`pl-10 h-8`,value:We,onChange:e=>H(e.target.value),disabled:!$})]}),(0,z.jsx)(k,{children:(0,z.jsxs)(`div`,{className:`flex items-center self-end rounded-md border border-border p-0.5 flex-shrink-0 md:self-auto`,children:[(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`alphabetical`),children:(0,z.jsx)(ie,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort A–Z`})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(o,{asChild:!0,children:(0,z.jsx)(_,{type:`button`,variant:W===`price-low`||W===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>G(`price-low`),children:(0,z.jsx)(w,{className:`h-4 w-4`})})}),(0,z.jsx)(x,{children:`Sort by price`})]})]})})]})]}),E?(0,z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,z.jsx)(i,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):X.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No image models available for this provider.`})}):(0,z.jsx)(k,{children:(0,z.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:bt.length===0?(0,z.jsx)(`div`,{className:`text-center py-8`,children:(0,z.jsx)(`p`,{className:D.bodyMuted,children:`No models matching your filters.`})}):bt.map(e=>{let t=et.has(e.id),n=it.has(e.id),r=it.get(e.id),i=n?r:t,a=e.pricing;return(0,z.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,z.jsx)(F,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>ht(e.id,`image`),className:`mt-0`}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,z.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,z.jsx)(`label`,{htmlFor:`image-${e.id}`,className:d(D.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:Q(e)})}),a&&(0,z.jsx)(`span`,{className:d(D.caption,`whitespace-nowrap flex-shrink-0`),children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${m(a.prompt??0)} in | $${m(a.completion??0)} out`})]})]},e.id)})})})]})})]}),q?(0,z.jsx)(P,{variant:q.includes(`error`)||q.includes(`Failed`)?`error`:`success`,children:q}):null]})]})}):(0,z.jsx)(`div`,{className:d(`flex flex-1 items-center justify-center`,f),children:(0,z.jsx)(xe,{title:e||t?`Provider not found`:`Select a Provider`,action:c?(0,z.jsxs)(_,{variant:`outline`,size:`sm`,onClick:c,children:[(0,z.jsx)(v,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,children:c?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`})})}function H(e){return`providers:list:${e}`}async function U(){let[e,r]=await Promise.all([n(),t().catch(()=>({}))]),i={};for(let[e,t]of Object.entries(r))i[e]=t.length;return{providers:e,enabledModelCounts:i}}function W(){let e=(0,L.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,z.jsx)(A,{title:`Connected Providers`}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsxs)(`div`,{children:[n,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`})]})]}),i=(0,z.jsx)(A,{title:`Available Providers`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[t,(0,z.jsxs)(`div`,{className:`space-y-8`,children:[r,(0,z.jsxs)(`div`,{children:[i,(0,z.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:[(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`}),(0,z.jsx)(I,{className:`h-24 rounded-lg`})]})]})]})]})}),e[4]=a):a=e[4],a}function G(e){let t=(0,L.c)(40),{loadVersion:n,onProviderClick:r}=e,{query:i,setQuery:a,deferredQuery:o}=Be(),s;t[0]===n?s=t[1]:(s=H(n),t[0]=n,t[1]=s);let{providers:c,enabledModelCounts:l}=Se(s,U),u;if(t[2]!==o||t[3]!==l||t[4]!==c){let e;t[6]===o?e=t[7]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=o,t[7]=e);let n;t[8]===l?n=t[9]:(n=(e,t)=>{let n=(l[e.slug]??0)>0,r=(l[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=l,t[9]=n),u=c.filter(Ke).filter(e).sort(n),t[2]=o,t[3]=l,t[4]=c,t[5]=u}else u=t[5];let f=u,p;if(t[10]!==o||t[11]!==c){let e;t[13]===o?e=t[14]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=o,t[14]=e),p=c.filter(Ge).filter(e).sort(K),t[10]=o,t[11]=c,t[12]=p}else p=t[12];let m=p,h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),t[15]=h):h=t[15];let g;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,z.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),t[16]=g):g=t[16];let _;t[17]===a?_=t[18]:(_=e=>a(e.target.value),t[17]=a,t[18]=_);let v;t[19]!==i||t[20]!==_?(v=(0,z.jsx)(`div`,{className:`mb-6`,children:(0,z.jsxs)(`div`,{className:`relative`,children:[g,(0,z.jsx)(T,{placeholder:`Search providers...`,className:`pl-10`,value:i,onChange:_})]})}),t[19]=i,t[20]=_,t[21]=v):v=t[21];let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,z.jsx)(A,{title:`Connected Providers`}),t[22]=y):y=t[22];let b;t[23]!==f||t[24]!==l||t[25]!==r||t[26]!==i?(b=(0,z.jsxs)(`section`,{children:[y,f.length===0?(0,z.jsx)(`p`,{className:d(D.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:f.map(e=>(0,z.jsx)(Ye,{provider:e,isConnected:!0,modelCount:l[e.slug]??0,onClick:r},e.name))})]}),t[23]=f,t[24]=l,t[25]=r,t[26]=i,t[27]=b):b=t[27];let x;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,z.jsx)(A,{title:`Available Providers`}),t[28]=x):x=t[28];let S;t[29]!==m||t[30]!==l||t[31]!==r||t[32]!==i?(S=(0,z.jsxs)(`section`,{children:[x,m.length===0?(0,z.jsx)(`p`,{className:d(D.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3`,children:m.map(e=>(0,z.jsx)(Ye,{provider:e,modelCount:l[e.slug]??0,onClick:r},e.name))})]}),t[29]=m,t[30]=l,t[31]=r,t[32]=i,t[33]=S):S=t[33];let C;t[34]!==S||t[35]!==b?(C=(0,z.jsxs)(`div`,{className:`space-y-8`,children:[b,S]}),t[34]=S,t[35]=b,t[36]=C):C=t[36];let w;return t[37]!==C||t[38]!==v?(w=(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[h,v,C]})}),t[37]=C,t[38]=v,t[39]=w):w=t[39],w}function K(e,t){return e.name.localeCompare(t.name)}function Ge(e){return!e.apiKey}function Ke(e){return e.apiKey}function qe(){let e=(0,L.c)(21),t=ge(),{providerSlug:n}=_e(),[r,i]=(0,R.useState)(0),a=(0,R.useRef)(n),o,s;e[0]!==r||e[1]!==n?(o=()=>{a.current&&!n&&(M(H(r)),i(Y)),a.current=n},s=[n,r],e[0]=r,e[1]=n,e[2]=o,e[3]=s):(o=e[2],s=e[3]),(0,R.useEffect)(o,s);let c;e[4]===t?c=e[5]:(c=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=c);let l=c,u;e[6]!==r||e[7]!==t?(u=()=>{t(`/settings/providers`),M(H(r)),i(Je)},e[6]=r,e[7]=t,e[8]=u):u=e[8];let d=u,f;e[9]===r?f=e[10]:(f=function(){M(H(r)),i(J)},e[9]=r,e[10]=f);let p=f;if(n){let t=decodeURIComponent(n),r;return e[11]!==d||e[12]!==t?(r=(0,z.jsx)(We,{selectedProviderSlug:t,onBack:d}),e[11]=d,e[12]=t,e[13]=r):r=e[13],r}let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(W,{}),e[14]=m):m=e[14];let h;e[15]!==l||e[16]!==r?(h=(0,z.jsx)(R.Suspense,{fallback:m,children:(0,z.jsx)(G,{loadVersion:r,onProviderClick:l},r)}),e[15]=l,e[16]=r,e[17]=h):h=e[17];let g;return e[18]!==p||e[19]!==h?(g=(0,z.jsx)(Oe,{fallbackTitle:`Failed to load providers`,onRetry:p,renderFallback:q,children:h}),e[18]=p,e[19]=h,e[20]=g):g=e[20],g}function q(e,t){return(0,z.jsx)(ve,{children:(0,z.jsxs)(ye,{children:[(0,z.jsx)(be,{title:`Providers`,description:`Manage your AI provider connections and API keys.`}),(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center py-16`,children:(0,z.jsxs)(`div`,{className:`text-center max-w-md`,children:[(0,z.jsx)(P,{variant:`error`,className:`mb-4`,children:e.message}),(0,z.jsx)(_,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function J(e){return e+1}function Je(e){return e+1}function Y(e){return e+1}function Ye(e){let t=(0,L.c)(28),{provider:n,isConnected:r,modelCount:i,onClick:a}=e,o=r===void 0?!1:r,s=i===void 0?0:i,[c,l]=(0,R.useState)(!1),u;t[0]!==a||t[1]!==n?(u=()=>a(n),t[0]=a,t[1]=n,t[2]=u):u=t[2];let f;t[3]!==c||t[4]!==n.name||t[5]!==n.slug?(f=(0,z.jsx)(`div`,{className:`flex-shrink-0 h-10 w-10 rounded-full bg-muted flex items-center justify-center overflow-hidden`,children:c?(0,z.jsx)(pe,{className:`h-5 w-5 text-muted-foreground`}):(0,z.jsx)(`img`,{src:O(n.slug),alt:`${n.name} logo`,className:`h-6 w-6 dark:invert`,onError:()=>l(!0)})}),t[3]=c,t[4]=n.name,t[5]=n.slug,t[6]=f):f=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=d(D.label,`truncate`),t[7]=p):p=t[7];let m;t[8]===n.name?m=t[9]:(m=(0,z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,z.jsx)(`span`,{className:p,children:n.name})}),t[8]=n.name,t[9]=m);let h;t[10]===o?h=t[11]:(h=!o&&(0,z.jsxs)(`div`,{className:d(D.compact,`flex items-center gap-1 text-muted-foreground mt-0.5`),children:[(0,z.jsx)(E,{className:`h-3 w-3`}),(0,z.jsx)(`span`,{children:`Click to configure`})]}),t[10]=o,t[11]=h);let g;t[12]!==m||t[13]!==h?(g=(0,z.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[m,h]}),t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==f||t[16]!==g?(_=(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[f,g]}),t[15]=f,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==s||t[20]!==n.isEnv?(v=o&&(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[n.isEnv?(0,z.jsxs)(V,{variant:`secondary`,className:d(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(ae,{className:`h-3 w-3`}),`Environment`]}):(0,z.jsxs)(V,{variant:`secondary`,className:d(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(re,{className:`h-3 w-3`}),`API Key`]}),s>0&&(0,z.jsxs)(V,{variant:`default`,className:d(D.compact,`gap-1 px-2 py-0.5`),children:[(0,z.jsx)(b,{className:`h-3 w-3`}),s,` `,s===1?`Model`:`Models`]})]}),t[18]=o,t[19]=s,t[20]=n.isEnv,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==_?(y=(0,z.jsxs)(j,{className:`p-4 flex flex-col gap-3`,children:[_,v]}),t[22]=v,t[23]=_,t[24]=y):y=t[24];let x;return t[25]!==y||t[26]!==u?(x=(0,z.jsx)(N,{className:`cursor-pointer transition-all hover:border-primary/50 hover:shadow-md`,onClick:u,children:y}),t[25]=y,t[26]=u,t[27]=x):x=t[27],x}export{qe as ProvidersListView,qe as default};
@@ -0,0 +1 @@
1
+ import{Ba as e,Br as t,Fs as n,Is as r,Lr as ee,Pi as i,Qr as a,Rr as te,Yr as o,Zr as s,aa as c,ei as l,fs as u,ii as d,ni as f,ri as p,ti as ne,zr as re}from"./dialogs-config-86QTDk4G.js";import{a as ie}from"./onboarding-DCrFdRM5.js";import{H as ae}from"./index-C2iIghSR.js";var m=r(),h=n();function g(n){let r=(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;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,h.jsx)(d,{children:`Create Pull Request`}),r[0]=k):k=r[0];let A;r[1]===E?A=r[2]:(A=(0,h.jsxs)(p,{children:[k,(0,h.jsxs)(ne,{children:[`Create a pull request for branch `,E]})]}),r[1]=E,r[2]=A);let j;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(o,{htmlFor:`pr-title`,children:`Title`}),r[3]=j):j=r[3];let M=E||`Enter PR title...`,N;r[4]===y?N=r[5]:(N=e=>y(e.target.value),r[4]=y,r[5]=N);let P;r[6]!==v||r[7]!==M||r[8]!==N?(P=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(s,{id:`pr-title`,placeholder:M,value:v,onChange:N})]}),r[6]=v,r[7]=M,r[8]=N,r[9]=P):P=r[9];let F;r[10]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,h.jsx)(o,{htmlFor:`pr-description`,children:`Description`}),r[10]=F):F=r[10];let I;r[11]===x?I=r[12]:(I=e=>x(e.target.value),r[11]=x,r[12]=I);let L;r[13]!==b||r[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`}),r[13]=b,r[14]=I,r[15]=L):L=r[15];let R=S||C,z;r[16]===S?z=r[17]:(z=S?(0,h.jsx)(e,{className:`h-3.5 w-3.5 animate-spin`}):(0,h.jsx)(c,{className:`h-3.5 w-3.5`}),r[16]=S,r[17]=z);let B;r[18]!==w||r[19]!==R||r[20]!==z?(B=(0,h.jsx)(t,{asChild:!0,children:(0,h.jsx)(i,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:w,disabled:R,children:z})}),r[18]=w,r[19]=R,r[20]=z,r[21]=B):B=r[21];let V=S?`Generating PR description...`:`Generate PR title and description with AI`,H;r[22]===V?H=r[23]:(H=(0,h.jsx)(te,{children:V}),r[22]=V,r[23]=H);let U;r[24]!==B||r[25]!==H?(U=(0,h.jsx)(re,{children:(0,h.jsxs)(ee,{children:[B,H]})}),r[24]=B,r[25]=H,r[26]=U):U=r[26];let W;r[27]!==U||r[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]})]}),r[27]=U,r[28]=L,r[29]=W):W=r[29];let G;r[30]!==W||r[31]!==P?(G=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[P,W]}),r[30]=W,r[31]=P,r[32]=G):G=r[32];let K;r[33]===O?K=r[34]:(K=e=>O(e===!0),r[33]=O,r[34]=K);let q;r[35]!==D||r[36]!==K?(q=(0,h.jsx)(ie,{id:`auto-generate-pr`,checked:D,onCheckedChange:K}),r[35]=D,r[36]=K,r[37]=q):q=r[37];let J;r[38]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,h.jsx)(o,{htmlFor:`auto-generate-pr`,className:u.labelNormal,children:`Auto generate PR title and description`}),r[38]=J):J=r[38];let Y;r[39]===q?Y=r[40]:(Y=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[q,J]}),r[39]=q,r[40]=Y);let X=C?`Creating...`:`Create PR`,Z;r[41]!==C||r[42]!==T||r[43]!==X?(Z=(0,h.jsx)(f,{children:(0,h.jsx)(i,{onClick:T,disabled:C,children:X})}),r[41]=C,r[42]=T,r[43]=X,r[44]=Z):Z=r[44];let Q;r[45]!==G||r[46]!==A||r[47]!==Y||r[48]!==Z?(Q=(0,h.jsxs)(l,{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]}),r[45]=G,r[46]=A,r[47]=Y,r[48]=Z,r[49]=Q):Q=r[49];let $;return r[50]!==_||r[51]!==g||r[52]!==Q?($=(0,h.jsx)(a,{open:g,onOpenChange:_,children:Q}),r[50]=_,r[51]=g,r[52]=Q,r[53]=$):$=r[53],$}export{g as PullRequestDialog};
@@ -0,0 +1 @@
1
+ import{Fs as e,Is as t,Pi 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-86QTDk4G.js";import{x as p}from"./history-view-BsN806ip.js";var m=t(),h=e();function g(e){let t=(0,m.c)(27),{open:g,onOpenChange:_,onCommitFirst:v,onStashAndPull:y,onCancel:b,isLoading:x}=e,S=x===void 0?!1:x,C;t[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.`})]}),t[0]=C):C=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,h.jsx)(`div`,{className:s.bodyMuted,children:`Choose how you want to proceed:`}),t[1]=w):w=t[1];let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,h.jsx)(r,{className:`h-4 w-4 mr-2`}),t[2]=T):T=t[2];let E;t[3]!==S||t[4]!==v?(E=(0,h.jsxs)(n,{onClick:v,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[T,`Commit changes first, then pull`]}),t[3]=S,t[4]=v,t[5]=E):E=t[5];let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsx)(l,{className:`h-4 w-4 mr-2`}),t[6]=D):D=t[6];let O;t[7]!==S||t[8]!==y?(O=(0,h.jsxs)(n,{onClick:y,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[D,`Stash changes → Pull → Restore changes`]}),t[7]=S,t[8]=y,t[9]=O):O=t[9];let k;t[10]!==E||t[11]!==O?(k=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[E,O]}),t[10]=E,t[11]=O,t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,h.jsx)(`strong`,{children:`Commit first:`}),t[13]=A):A=t[13];let j;t[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.`]}),t[14]=j):j=t[14];let M;t[15]===k?M=t[16]:(M=(0,h.jsx)(`div`,{className:`py-4`,children:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[w,k,j]})}),t[15]=k,t[16]=M);let N;t[17]!==S||t[18]!==b?(N=(0,h.jsx)(u,{children:(0,h.jsx)(n,{variant:`ghost`,onClick:b,disabled:S,children:`Cancel`})}),t[17]=S,t[18]=b,t[19]=N):N=t[19];let P;t[20]!==M||t[21]!==N?(P=(0,h.jsxs)(o,{className:`sm:max-w-[425px]`,children:[C,M,N]}),t[20]=M,t[21]=N,t[22]=P):P=t[22];let F;return t[23]!==_||t[24]!==g||t[25]!==P?(F=(0,h.jsx)(i,{open:g,onOpenChange:_,children:P}),t[23]=_,t[24]=g,t[25]=P,t[26]=F):F=t[26],F}export{g as PullWithChangesDialog};
@@ -0,0 +1 @@
1
+ import{Fs as e,Is as t,Pi as n,Qr as r,ei as i,ii as a,ni as o,ri as s,ti as c}from"./dialogs-config-86QTDk4G.js";var l=t(),u=e();function d(e){let t=(0,l.c)(15),{open:d,onOpenChange:f,isLoading:p,onPushAndCreatePR:m,onCancel:h}=e,g;t[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?`})]}),t[0]=g):g=t[0];let _;t[1]!==p||t[2]!==h?(_=(0,u.jsx)(n,{variant:`outline`,onClick:h,disabled:p,children:`Cancel`}),t[1]=p,t[2]=h,t[3]=_):_=t[3];let v=p?`Pushing...`:`Push & Create PR`,y;t[4]!==p||t[5]!==m||t[6]!==v?(y=(0,u.jsx)(n,{onClick:m,disabled:p,children:v}),t[4]=p,t[5]=m,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==_||t[9]!==y?(b=(0,u.jsxs)(i,{children:[g,(0,u.jsxs)(o,{children:[_,y]})]}),t[8]=_,t[9]=y,t[10]=b):b=t[10];let x;return t[11]!==f||t[12]!==d||t[13]!==b?(x=(0,u.jsx)(r,{open:d,onOpenChange:f,children:b}),t[11]=f,t[12]=d,t[13]=b,t[14]=x):x=t[14],x}export{d as PushBeforePRDialog};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Do as t,Fs as n,Ii as r,Is as i,Rs as a}from"./dialogs-config-86QTDk4G.js";import{_ as o,v as s,y as c}from"./react-vendor-DK2COBjg.js";var l=i(),u=e(a(),1),d=n(),f=u.forwardRef((e,t)=>{let n=(0,l.c)(9),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(`grid gap-2`,i),n[3]=i,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,d.jsx)(c,{className:o,...a,ref:t}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});f.displayName=c.displayName;var p=u.forwardRef((e,n)=>{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=r(`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]!==n||i[8]!==u?(p=(0,d.jsx)(s,{ref:n,className:u,...c,children:f}),i[6]=c,i[7]=n,i[8]=u,i[9]=p):p=i[9],p});p.displayName=s.displayName;export{p as n,f as t};