tarsk 0.5.34 → 0.5.36

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 (82) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +1283 -790
  3. package/dist/public/assets/account-view-BB-ze5ek.js +1 -0
  4. package/dist/public/assets/api-DzFQRz0u.js +1 -0
  5. package/dist/public/assets/browser-tab-B3bYbBws.js +1 -0
  6. package/dist/public/assets/commit-dialog-CJRMd4oA.js +1 -0
  7. package/dist/public/assets/context-menu-86TNA1D0.js +1 -0
  8. package/dist/public/assets/create-repo-dialog-nLnVNRqq.js +1 -0
  9. package/dist/public/assets/{dialogs-config-Ct6i8Iij.js → dialogs-config-I0_cSU2z.js} +14 -14
  10. package/dist/public/assets/diff-view-B8vWYa_2.js +3 -0
  11. package/dist/public/assets/explorer-tab-view-BGWQPnkw.js +2 -0
  12. package/dist/public/assets/explorer-tree-DrLoiF9t.js +1 -0
  13. package/dist/public/assets/explorer-view-Clm-RCAB.js +1 -0
  14. package/dist/public/assets/git-history-dialog-CcdMtW0o.js +1 -0
  15. package/dist/public/assets/git-ops-button-D9m2nmhO.js +2 -0
  16. package/dist/public/assets/history-view-Be-1C1tJ.js +7 -0
  17. package/dist/public/assets/index-DVXbmgHY.js +65 -0
  18. package/dist/public/assets/index-jIBJk8xl.css +1 -0
  19. package/dist/public/assets/mcp-server-card-bNNoXKsW.js +1 -0
  20. package/dist/public/assets/merged-pr-dialog-Fj8II9Bt.js +1 -0
  21. package/dist/public/assets/onboarding-CgP4bJ5F.js +1 -0
  22. package/dist/public/assets/project-settings-view-DixzP7KH.js +1 -0
  23. package/dist/public/assets/providers-list-view-BzSUZZyq.js +1 -0
  24. package/dist/public/assets/pull-request-dialog-ChuHHY3J.js +1 -0
  25. package/dist/public/assets/{pull-with-changes-dialog-DN0kE6os.js → pull-with-changes-dialog-Ck6aK6Q7.js} +1 -1
  26. package/dist/public/assets/push-before-pr-dialog-CbtHXjDH.js +1 -0
  27. package/dist/public/assets/radio-group-ZjNXbvW6.js +1 -0
  28. package/dist/public/assets/react-vendor-Do-APsQ6.js +16 -0
  29. package/dist/public/assets/settings-general-view-FwrdJbys.js +1 -0
  30. package/dist/public/assets/{settings-instructions-view-DULFg6dU.js → settings-instructions-view-BHzMtSvN.js} +1 -1
  31. package/dist/public/assets/settings-list-BCoqXa_X.js +1 -0
  32. package/dist/public/assets/settings-mcp-servers-view-DBD-NhPx.js +5 -0
  33. package/dist/public/assets/{settings-models-skeleton-CN2JkqZh.js → settings-models-skeleton-DsWpzWOw.js} +1 -1
  34. package/dist/public/assets/settings-models-view-vgV5YHRx.js +1 -0
  35. package/dist/public/assets/settings-rules-view-DcSXrmaq.js +8 -0
  36. package/dist/public/assets/settings-skills-view-DVGGs16n.js +2 -0
  37. package/dist/public/assets/settings-slash-commands-view-BsJw1F4p.js +1 -0
  38. package/dist/public/assets/settings-subagents-view-BgWhQ9bf.js +2 -0
  39. package/dist/public/assets/{settings-system-prompt-view-BNM_15ry.js → settings-system-prompt-view-DAAbMucD.js} +1 -1
  40. package/dist/public/assets/settings-view-DLzrbu69.js +2 -0
  41. package/dist/public/assets/skeleton-iEZ-dj1s.js +1 -0
  42. package/dist/public/assets/terminal-panel-C5qj1ctH.js +2 -0
  43. package/dist/public/assets/{ui-components-Di-9yNr4.js → ui-components-BN8dp4Bi.js} +1 -1
  44. package/dist/public/assets/{utils-DDDR42pW.js → utils-CU0c_yCM.js} +1 -1
  45. package/dist/public/assets/{whisper-wasm-Cq5Ofwpd.js → whisper-wasm-EGutPGND.js} +2 -2
  46. package/dist/public/index.html +12 -9
  47. package/package.json +1 -1
  48. package/dist/public/assets/account-view-Ds03urJE.js +0 -1
  49. package/dist/public/assets/api-BHfaVqlR.js +0 -1
  50. package/dist/public/assets/browser-tab-Qs8cnQkf.js +0 -1
  51. package/dist/public/assets/commit-dialog-D4suPxEe.js +0 -1
  52. package/dist/public/assets/context-menu-S8y0c1Fx.js +0 -1
  53. package/dist/public/assets/create-repo-dialog-DPKIg1mY.js +0 -1
  54. package/dist/public/assets/diff-view-rKDEnBLg.js +0 -3
  55. package/dist/public/assets/explorer-tab-view-JbLbPVAn.js +0 -2
  56. package/dist/public/assets/explorer-tree-Dq44yA1j.js +0 -1
  57. package/dist/public/assets/explorer-view-BMrlX2hb.js +0 -1
  58. package/dist/public/assets/git-history-dialog-CDwIqSZQ.js +0 -1
  59. package/dist/public/assets/git-ops-button-B6rEla5u.js +0 -2
  60. package/dist/public/assets/history-view-CFot099O.js +0 -7
  61. package/dist/public/assets/index-6DhhjIBL.js +0 -65
  62. package/dist/public/assets/index-sEZ3wJXu.css +0 -1
  63. package/dist/public/assets/mcp-server-card-DQY1RUPX.js +0 -1
  64. package/dist/public/assets/merged-pr-dialog-H_fuSmiF.js +0 -1
  65. package/dist/public/assets/onboarding-DHCR18iU.js +0 -1
  66. package/dist/public/assets/project-settings-view-CiefnK73.js +0 -1
  67. package/dist/public/assets/providers-list-view-DVopskGo.js +0 -1
  68. package/dist/public/assets/pull-request-dialog-Csql6eob.js +0 -1
  69. package/dist/public/assets/push-before-pr-dialog-IhdlLvWt.js +0 -1
  70. package/dist/public/assets/radio-group-BaKkAEZR.js +0 -1
  71. package/dist/public/assets/react-vendor-CjZZeCRj.js +0 -16
  72. package/dist/public/assets/settings-general-view-BMTxN35t.js +0 -1
  73. package/dist/public/assets/settings-list-Bdeuh4bJ.js +0 -1
  74. package/dist/public/assets/settings-mcp-servers-view-CRCtWjP2.js +0 -5
  75. package/dist/public/assets/settings-models-view-DosllhVB.js +0 -1
  76. package/dist/public/assets/settings-rules-view-BVWuGrnB.js +0 -8
  77. package/dist/public/assets/settings-skills-view-DYtcAu9-.js +0 -2
  78. package/dist/public/assets/settings-slash-commands-view-DFyL1W2n.js +0 -1
  79. package/dist/public/assets/settings-subagents-view-aCbK95Sk.js +0 -2
  80. package/dist/public/assets/settings-view-D5GE_CYR.js +0 -2
  81. package/dist/public/assets/skeleton-pSKdmWyJ.js +0 -1
  82. package/dist/public/assets/terminal-panel-Ds1tCgQA.js +0 -2
@@ -1 +0,0 @@
1
- import{$n as e,Fi as ee,Qn as t,Xr as n,Zn as r,_r as i,br as a,er as o,fr as s,gi as c,gr as l,hr as u,la as d,li as f,no as p,vr as m,yr as te}from"./dialogs-config-Ct6i8Iij.js";import{n as ne}from"./onboarding-DHCR18iU.js";import{D as h}from"./index-6DhhjIBL.js";var g=p(),_=c();function v(c){let p=(0,g.c)(57),{open:v,onOpenChange:y,commitMessage:b,onCommitMessageChange:x,autoGenerateCommitMessage:S,onAutoGenerateChange:C,isGeneratingMessage:w,isLoading:T,onGenerateMessage:E,onCommit:D,currentBranch:O}=c,k;p[0]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(a,{children:`Commit Changes`}),p[0]=k):k=p[0];let A;p[1]===O?A=p[2]:(A=(0,_.jsxs)(te,{children:[k,(0,_.jsxs)(i,{children:[`Enter a commit message for your changes on branch `,O]})]}),p[1]=O,p[2]=A);let j;p[3]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,_.jsx)(s,{htmlFor:`commit-message`,children:`Commit Message`}),p[3]=j):j=p[3];let M;p[4]===x?M=p[5]:(M=e=>x(e.target.value),p[4]=x,p[5]=M);let N;p[6]!==b||p[7]!==M?(N=(0,_.jsx)(h,{id:`commit-message`,placeholder:`Enter commit message...`,value:b,onChange:M,rows:4,className:`pr-10`}),p[6]=b,p[7]=M,p[8]=N):N=p[8];let P=w||T,F;p[9]===w?F=p[10]:(F=w?(0,_.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,_.jsx)(ee,{className:`h-3.5 w-3.5`}),p[9]=w,p[10]=F);let I;p[11]!==E||p[12]!==P||p[13]!==F?(I=(0,_.jsx)(o,{asChild:!0,children:(0,_.jsx)(n,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:E,disabled:P,children:F})}),p[11]=E,p[12]=P,p[13]=F,p[14]=I):I=p[14];let L=w?`Generating commit message...`:`Generate commit message with AI`,R;p[15]===L?R=p[16]:(R=(0,_.jsx)(t,{children:L}),p[15]=L,p[16]=R);let z;p[17]!==R||p[18]!==I?(z=(0,_.jsx)(e,{children:(0,_.jsxs)(r,{children:[I,R]})}),p[17]=R,p[18]=I,p[19]=z):z=p[19];let B;p[20]!==z||p[21]!==N?(B=(0,_.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,_.jsxs)(`div`,{className:`relative`,children:[N,z]})]}),p[20]=z,p[21]=N,p[22]=B):B=p[22];let V;p[23]===C?V=p[24]:(V=e=>C(e===!0),p[23]=C,p[24]=V);let H;p[25]!==S||p[26]!==V?(H=(0,_.jsx)(ne,{id:`auto-generate`,checked:S,onCheckedChange:V}),p[25]=S,p[26]=V,p[27]=H):H=p[27];let U;p[28]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,_.jsx)(s,{htmlFor:`auto-generate`,className:f.labelNormal,children:`Auto generate commit messages`}),p[28]=U):U=p[28];let W;p[29]===H?W=p[30]:(W=(0,_.jsxs)(`div`,{className:`flex items-center gap-2`,children:[H,U]}),p[29]=H,p[30]=W);let G;p[31]!==B||p[32]!==W?(G=(0,_.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[B,W]}),p[31]=B,p[32]=W,p[33]=G):G=p[33];let K;p[34]===y?K=p[35]:(K=()=>y(!1),p[34]=y,p[35]=K);let q;p[36]!==T||p[37]!==K?(q=(0,_.jsx)(n,{variant:`outline`,onClick:K,disabled:T,children:`Cancel`}),p[36]=T,p[37]=K,p[38]=q):q=p[38];let J;p[39]!==b||p[40]!==T?(J=T||!b.trim(),p[39]=b,p[40]=T,p[41]=J):J=p[41];let Y=T?`Committing...`:`Commit`,X;p[42]!==D||p[43]!==J||p[44]!==Y?(X=(0,_.jsx)(n,{onClick:D,disabled:J,children:Y}),p[42]=D,p[43]=J,p[44]=Y,p[45]=X):X=p[45];let Z;p[46]!==q||p[47]!==X?(Z=(0,_.jsxs)(m,{children:[q,X]}),p[46]=q,p[47]=X,p[48]=Z):Z=p[48];let Q;p[49]!==G||p[50]!==A||p[51]!==Z?(Q=(0,_.jsxs)(l,{children:[A,G,Z]}),p[49]=G,p[50]=A,p[51]=Z,p[52]=Q):Q=p[52];let $;return p[53]!==y||p[54]!==v||p[55]!==Q?($=(0,_.jsx)(u,{open:v,onOpenChange:y,children:Q}),p[53]=y,p[54]=v,p[55]=Q,p[56]=$):$=p[56],$}export{v as CommitDialog};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qr as t,Wa as n,gi as r,io as i,li as a,no as o,qa as s,za as c}from"./dialogs-config-Ct6i8Iij.js";import{_ as l,b as u,d,f,g as p,h as m,m as h,p as g,u as _,v,x as y,y as b}from"./react-vendor-CjZZeCRj.js";var x=o(),S=e(i(),1),C=r(),w=l,T=y,E=S.forwardRef((e,r)=>{let i=(0,x.c)(14),o,s,c,l;i[0]===e?(o=i[1],s=i[2],c=i[3],l=i[4]):({className:s,inset:c,children:o,...l}=e,i[0]=e,i[1]=o,i[2]=s,i[3]=c,i[4]=l);let d;i[5]!==s||i[6]!==c?(d=t(t(a.body,`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`),c&&`pl-8`,s),i[5]=s,i[6]=c,i[7]=d):d=i[7];let f;i[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,C.jsx)(n,{className:`ml-auto h-4 w-4`}),i[8]=f):f=i[8];let p;return i[9]!==o||i[10]!==l||i[11]!==r||i[12]!==d?(p=(0,C.jsxs)(u,{ref:r,className:d,...l,children:[o,f]}),i[9]=o,i[10]=l,i[11]=r,i[12]=d,i[13]=p):p=i[13],p});E.displayName=u.displayName;var D=S.forwardRef((e,n)=>{let r=(0,x.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(b,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});D.displayName=b.displayName;var O=S.forwardRef((e,n)=>{let r=(0,x.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(m,{children:(0,C.jsx)(d,{ref:n,className:o,...a})}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});O.displayName=d.displayName;var k=S.forwardRef((e,n)=>{let r=(0,x.c)(11),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:i,inset:o,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let c;r[4]!==i||r[5]!==o?(c=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),o&&`pl-8`,i),r[4]=i,r[5]=o,r[6]=c):c=r[6];let l;return r[7]!==s||r[8]!==n||r[9]!==c?(l=(0,C.jsx)(f,{ref:n,className:c,...s}),r[7]=s,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});k.displayName=f.displayName;var A=S.forwardRef((e,n)=>{let r=(0,x.c)(14),i,o,c,l;r[0]===e?(i=r[1],o=r[2],c=r[3],l=r[4]):({className:c,children:o,checked:i,...l}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=c,r[4]=l);let u;r[5]===c?u=r[6]:(u=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),c),r[5]=c,r[6]=u);let d;r[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(s,{className:`h-4 w-4`})})}),r[7]=d):d=r[7];let f;return r[8]!==i||r[9]!==o||r[10]!==l||r[11]!==n||r[12]!==u?(f=(0,C.jsxs)(_,{ref:n,className:u,checked:i,...l,children:[d,o]}),r[8]=i,r[9]=o,r[10]=l,r[11]=n,r[12]=u,r[13]=f):f=r[13],f});A.displayName=_.displayName;var j=S.forwardRef((e,n)=>{let r=(0,x.c)(12),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:o,children:i,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let l;r[4]===o?l=r[5]:(l=t(t(a.body,`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`),o),r[4]=o,r[5]=l);let u;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,C.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,C.jsx)(g,{children:(0,C.jsx)(c,{className:`h-2 w-2 fill-current`})})}),r[6]=u):u=r[6];let d;return r[7]!==i||r[8]!==s||r[9]!==n||r[10]!==l?(d=(0,C.jsxs)(p,{ref:n,className:l,...s,children:[u,i]}),r[7]=i,r[8]=s,r[9]=n,r[10]=l,r[11]=d):d=r[11],d});j.displayName=p.displayName;var M=S.forwardRef((e,n)=>{let r=(0,x.c)(11),i,o,s;r[0]===e?(i=r[1],o=r[2],s=r[3]):({className:i,inset:o,...s}=e,r[0]=e,r[1]=i,r[2]=o,r[3]=s);let c;r[4]!==i||r[5]!==o?(c=t(t(a.body,`px-2 py-1.5 font-semibold text-foreground`),o&&`pl-8`,i),r[4]=i,r[5]=o,r[6]=c):c=r[6];let l;return r[7]!==s||r[8]!==n||r[9]!==c?(l=(0,C.jsx)(h,{ref:n,className:c,...s}),r[7]=s,r[8]=n,r[9]=c,r[10]=l):l=r[10],l});M.displayName=h.displayName;var N=S.forwardRef((e,n)=>{let r=(0,x.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=t(`-mx-1 my-1 h-px bg-border`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,C.jsx)(v,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});N.displayName=v.displayName;var P=e=>{let n=(0,x.c)(8),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 o;n[3]===r?o=n[4]:(o=t(a.compact,`ml-auto tracking-widest text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==o?(s=(0,C.jsx)(`span`,{className:o,...i}),n[5]=i,n[6]=o,n[7]=s):s=n[7],s};P.displayName=`ContextMenuShortcut`;export{T as a,N as i,O as n,k as r,w as t};
@@ -1 +0,0 @@
1
- import{Xr as e,_r as t,br as n,fr as r,gi as i,gr as a,hr as o,li as s,mr as c,no as l,vr as u,yr as d}from"./dialogs-config-Ct6i8Iij.js";import{n as f}from"./onboarding-DHCR18iU.js";import{D as p}from"./index-6DhhjIBL.js";var m=l(),h=i();function g(i){let l=(0,m.c)(48),{open:g,onOpenChange:_,repoName:v,onRepoNameChange:y,repoDescription:b,onRepoDescriptionChange:x,isPrivateRepo:S,onPrivateRepoChange:C,isLoading:w,onCreateRepo:T}=i,E;l[0]!==_||l[1]!==x||l[2]!==y?(E=e=>{e||(y(``),x(``)),_(e)},l[0]=_,l[1]=x,l[2]=y,l[3]=E):E=l[3];let D;l[4]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsxs)(d,{children:[(0,h.jsx)(n,{children:`Create GitHub Repository`}),(0,h.jsx)(t,{children:`Create a new GitHub repository and push your local repository`})]}),l[4]=D):D=l[4];let O;l[5]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,h.jsx)(r,{htmlFor:`repo-name`,children:`Repository Name (optional)`}),l[5]=O):O=l[5];let k;l[6]===y?k=l[7]:(k=e=>y(e.target.value),l[6]=y,l[7]=k);let A;l[8]!==v||l[9]!==k?(A=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[O,(0,h.jsx)(c,{id:`repo-name`,placeholder:`Leave empty to use current folder name`,value:v,onChange:k})]}),l[8]=v,l[9]=k,l[10]=A):A=l[10];let j;l[11]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsx)(r,{htmlFor:`repo-description`,children:`Description (optional)`}),l[11]=j):j=l[11];let M;l[12]===x?M=l[13]:(M=e=>x(e.target.value),l[12]=x,l[13]=M);let N;l[14]!==b||l[15]!==M?(N=(0,h.jsxs)(`div`,{className:`grid gap-2`,children:[j,(0,h.jsx)(p,{id:`repo-description`,placeholder:`Enter repository description...`,value:b,onChange:M,rows:3})]}),l[14]=b,l[15]=M,l[16]=N):N=l[16];let P;l[17]===C?P=l[18]:(P=e=>C(e===!0),l[17]=C,l[18]=P);let F;l[19]!==S||l[20]!==P?(F=(0,h.jsx)(f,{id:`repo-private`,checked:S,onCheckedChange:P}),l[19]=S,l[20]=P,l[21]=F):F=l[21];let I;l[22]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,h.jsx)(r,{htmlFor:`repo-private`,className:s.labelNormal,children:`Private repository`}),l[22]=I):I=l[22];let L;l[23]===F?L=l[24]:(L=(0,h.jsxs)(`div`,{className:`flex items-center gap-2`,children:[F,I]}),l[23]=F,l[24]=L);let R;l[25]!==L||l[26]!==A||l[27]!==N?(R=(0,h.jsxs)(`div`,{className:`grid gap-4 py-4`,children:[A,N,L]}),l[25]=L,l[26]=A,l[27]=N,l[28]=R):R=l[28];let z;l[29]===_?z=l[30]:(z=()=>_(!1),l[29]=_,l[30]=z);let B;l[31]!==w||l[32]!==z?(B=(0,h.jsx)(e,{variant:`outline`,onClick:z,disabled:w,children:`Cancel`}),l[31]=w,l[32]=z,l[33]=B):B=l[33];let V=w?`Creating...`:`Create & Push`,H;l[34]!==w||l[35]!==T||l[36]!==V?(H=(0,h.jsx)(e,{onClick:T,disabled:w,children:V}),l[34]=w,l[35]=T,l[36]=V,l[37]=H):H=l[37];let U;l[38]!==B||l[39]!==H?(U=(0,h.jsxs)(u,{children:[B,H]}),l[38]=B,l[39]=H,l[40]=U):U=l[40];let W;l[41]!==R||l[42]!==U?(W=(0,h.jsxs)(a,{children:[D,R,U]}),l[41]=R,l[42]=U,l[43]=W):W=l[43];let G;return l[44]!==g||l[45]!==E||l[46]!==W?(G=(0,h.jsx)(o,{open:g,onOpenChange:E,children:W}),l[44]=g,l[45]=E,l[46]=W,l[47]=G):G=l[47],G}export{g as CreateRepoDialog};
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$i as t,Ca as n,Ea as r,Ga as i,Hn as a,Ki as o,Qn as s,Qr as c,Wa as l,Wt as u,Xr as d,Zn as f,aa as p,br as m,bt as h,ca as g,ea as _,er as v,gi as y,gr as b,hr as x,in as S,io as C,li as w,lr as T,mt as E,no as D,sa as O,st as k,vr as A,wa as j,xi as ee,yr as te}from"./dialogs-config-Ct6i8Iij.js";import{C as M}from"./react-vendor-CjZZeCRj.js";import{t as N}from"./monaco-CZnIWXyV.js";import{u as P}from"./onboarding-DHCR18iU.js";import{a as F,l as ne,n as I,o as re}from"./history-view-CFot099O.js";import{n as ie}from"./utils-DDDR42pW.js";import{A as ae,D as oe,E as se,O as ce,d as le,i as ue,k as de,n as L,o as fe,r as pe}from"./index-6DhhjIBL.js";import{a as R,n as z,r as B,t as me}from"./context-menu-S8y0c1Fx.js";var V=e(C(),1),H=D(),U=y();function W(e){let t=(0,H.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,U.jsx)(`span`,{className:w.sectionTitle,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,U.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,U.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,U.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(0,U.jsx)(T,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,U.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=d);let f;return t[13]!==l||t[14]!==u||t[15]!==d?(f=(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[l,u,d]}),t[13]=l,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function he(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var G={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},K={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function q(e){return c(c(w.compact,`status-badge font-mono font-semibold`),G[e]??`text-orange-500`)}function J(e){return K[e]??`M`}function ge(e){let t=(0,H.c)(38),{treeData:i,files:a,error:s,selectedFileIndex:u,onFileSelect:d,onRevertFile:f}=e,p;t[0]===a?p=t[1]:(p=a.reduce(ye,0),t[0]=a,t[1]=p);let m=p,h;t[2]===a?h=t[3]:(h=a.reduce(_e,0),t[2]=a,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=c(w.compact,`text-muted-foreground`),t[4]=_):_=t[4];let v=a.length===1?``:`s`,y;t[5]!==a.length||t[6]!==v?(y=(0,U.jsxs)(`span`,{className:_,children:[a.length,` file`,v]}),t[5]=a.length,t[6]=v,t[7]=y):y=t[7];let b;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(b=c(w.compact,`text-green-500`),t[8]=b):b=t[8];let x;t[9]===m?x=t[10]:(x=(0,U.jsxs)(`span`,{className:b,children:[`+`,m]}),t[9]=m,t[10]=x);let S;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(S=c(w.compact,`text-red-500`),t[11]=S):S=t[11];let C;t[12]===g?C=t[13]:(C=(0,U.jsxs)(`span`,{className:S,children:[`-`,g]}),t[12]=g,t[13]=C);let T;t[14]!==y||t[15]!==x||t[16]!==C?(T=(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[y,x,C]}),t[14]=y,t[15]=x,t[16]=C,t[17]=T):T=t[17];let E=T;if(s){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=c(w.compact,`text-destructive text-center`),t[18]=e):e=t[18];let n;t[19]===s?n=t[20]:(n=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:e,children:s})}),t[19]=s,t[20]=n);let r;return t[21]!==E||t[22]!==n?(r=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:n}),t[21]=E,t[22]=n,t[23]=r):r=t[23],r}if(a.length===0){let e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,U.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,U.jsx)(`p`,{className:c(w.compact,w.bodyMuted,`text-center`),children:`No changes to review`})}),t[24]=e):e=t[24];let n;return t[25]===E?n=t[26]:(n=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:e}),t[25]=E,t[26]=n),n}let D;t[27]!==a||t[28]!==d||t[29]!==f||t[30]!==u?(D=(e,t)=>{let{isOpen:i,toggle:s}=t,p=!!e.children,m=(0,U.jsxs)(P,{onClick:()=>{p?s():e.fileIndex!==void 0&&d(e.fileIndex)},selected:!p&&e.fileIndex===u,className:`gap-1.5`,children:[p?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{className:c(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,i&&`rotate-90`)}),i?(0,U.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,U.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,U.jsx)(r,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!p&&e.status&&(0,U.jsx)(`span`,{className:q(e.status),children:J(e.status)})]});return p?m:(0,U.jsxs)(me,{children:[(0,U.jsx)(R,{asChild:!0,children:m}),(0,U.jsx)(z,{children:(0,U.jsxs)(B,{onClick:()=>{e.fileIndex!==void 0&&f?.(a[e.fileIndex])},children:[(0,U.jsx)(o,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[27]=a,t[28]=d,t[29]=f,t[30]=u,t[31]=D):D=t[31];let O;t[32]!==D||t[33]!==i?(O=(0,U.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,U.jsx)(se,{nodes:i,defaultOpen:!0,resetKey:i,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:D})}),t[32]=D,t[33]=i,t[34]=O):O=t[34];let k;return t[35]!==E||t[36]!==O?(k=(0,U.jsx)(W,{title:`Review Changes`,headerAction:E,children:O}),t[35]=E,t[36]=O,t[37]=k):k=t[37],k}function _e(e,t){return e+t.hunks.reduce(ve,0)}function ve(e,t){return e+t.changes.filter(Y).length}function Y(e){return e.type===`delete`}function ye(e,t){return e+t.hunks.reduce(be,0)}function be(e,t){return e+t.changes.filter(xe).length}function xe(e){return e.type===`add`}function Se(e){let t=(0,H.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,U.jsx)(L,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Ce(e){let t=(0,H.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:o,onSave:s,onDelete:l,onClose:u}=e,[f,p]=(0,V.useState)((a===void 0?``:a)??``),h;t[0]!==s||t[1]!==f?(h=()=>{f.trim()&&s(f.trim())},t[0]=s,t[1]=f,t[2]=h):h=t[2];let g=h,_;t[3]===g?_=t[4]:(_=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),g())},t[3]=g,t[4]=_);let v=_,y;t[5]===u?y=t[6]:(y=e=>{e||u()},t[5]=u,t[6]=y);let S;t[7]===r?S=t[8]:(S=(0,U.jsx)(te,{children:(0,U.jsxs)(m,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=c(w.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let T=i||` `,E;t[10]===T?E=t[11]:(E=(0,U.jsx)(`div`,{className:C,children:T}),t[10]=T,t[11]=E);let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>p(e.target.value),t[12]=D):D=t[12];let O;t[13]!==v||t[14]!==f?(O=(0,U.jsx)(oe,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:f,onChange:D,onKeyDown:v,rows:12,className:`resize-none text-base`}),t[13]=v,t[14]=f,t[15]=O):O=t[15];let k;t[16]!==o||t[17]!==l?(k=o&&l&&(0,U.jsx)(d,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[16]=o,t[17]=l,t[18]=k):k=t[18];let j;t[19]===f?j=t[20]:(j=f.trim(),t[19]=f,t[20]=j);let ee=!j,M;t[21]!==g||t[22]!==ee?(M=(0,U.jsx)(d,{size:`sm`,onClick:g,disabled:ee,children:`Save`}),t[21]=g,t[22]=ee,t[23]=M):M=t[23];let N;t[24]!==k||t[25]!==M?(N=(0,U.jsxs)(A,{className:`gap-2 sm:gap-0`,children:[k,M]}),t[24]=k,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==O||t[28]!==N||t[29]!==S||t[30]!==E?(P=(0,U.jsxs)(b,{className:`max-w-2xl`,children:[S,E,O,N]}),t[27]=O,t[28]=N,t[29]=S,t[30]=E,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==y?(F=(0,U.jsx)(x,{open:n,onOpenChange:y,children:P}),t[32]=n,t[33]=P,t[34]=y,t[35]=F):F=t[35],F}function we(e,t){return`git-diff:${e}:${t}`}function Te({threadId:e,onExit:n,loadVersion:r}){let o=F(we(e,r),()=>h(e)),m=de(),y=ae(e=>e.diffComments),b=ae(e=>e.projectModelSelections),{resolvedTheme:x}=ie(),[C,T]=(0,V.useState)(o.files||[]),[D,A]=(0,V.useState)(null),[j,te]=(0,V.useState)(0),[P,ne]=(0,V.useState)(!1),[I,re]=(0,V.useState)(!1),[oe,se]=(0,V.useState)(!1),L=(0,V.useRef)(null),R=(0,V.useMemo)(()=>y[e]??[],[y,e]),z=(0,V.useCallback)(t=>{let n=y[e]??[],r=typeof t==`function`?t(n):t;m({type:ce.SetDiffComments,threadId:e,comments:r})},[m,e,y]),[B,me]=(0,V.useState)(null),[H,W]=(0,V.useState)(null),[G,K]=(0,V.useState)(null),q=(0,V.useRef)(null),J=(0,V.useRef)(R),_e=(0,V.useRef)(B),ve=(0,V.useRef)({isFullView:P,selectedFileIndex:j,files:C}),Y=(0,V.useRef)({original:[],modified:[]}),ye=(0,V.useRef)(!0);(0,V.useEffect)(()=>{J.current=R},[R]),(0,V.useEffect)(()=>{_e.current=B},[B]),(0,V.useEffect)(()=>{ve.current={isFullView:P,selectedFileIndex:j,files:C}},[P,j,C]);let be=(0,V.useCallback)(()=>{L.current&&(I?L.current.expand():L.current.collapse())},[I]),xe=(0,V.useCallback)(async()=>{if(e){A(null);try{T((await h(e)).files||[]),te(0)}catch(e){A(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Te=(0,V.useCallback)(async t=>{try{await S(e,t.path),await xe()}catch(e){A(e instanceof Error?e.message:`Failed to revert file`)}},[e,xe]),X=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if((y[e]??[]).length>0){X.current=!0;return}u(e).then(t=>{t.diffComments&&t.diffComments.length>0&&m({type:ce.SetDiffComments,threadId:e,comments:t.diffComments}),X.current=!0}).catch(()=>{X.current=!0})},[e]),(0,V.useEffect)(()=>{X.current&&a(e,{diffComments:R}).catch(()=>{})},[e,R]);let Ee=(0,V.useMemo)(()=>he(C),[C]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},De=(e,t,n)=>e.split(`
2
- `).slice(t-1,n).join(`
3
- `),Oe=e=>{let t=Z(e);return t?t.startLine<=1:!0},ke=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=C[j],Ae=Q?P?Q.oldContent:(()=>{let e=Z(Q);return e?De(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,je=Q?P?Q.newContent:(()=>{let e=Z(Q);return e?De(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,V.useCallback)(()=>{if(!ye.current)return;let e=q.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=ve.current,i=J.current,a=_e.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:N.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:N.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?Y.current.original:Y.current.modified,m=e.deltaDecorations(p,d);r===`original`?Y.current.original=m:Y.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,V.useEffect)(()=>{$()},[$,R,B,j,P,Q]),(0,V.useEffect)(()=>()=>{q.current=null,Y.current={original:[],modified:[]}},[j]),(0,V.useEffect)(()=>()=>{ye.current=!1,q.current&&=(q.current.getOriginalEditor().getModel()?.dispose(),q.current.getModifiedEditor().getModel()?.dispose(),q.current.dispose(),null),Y.current={original:[],modified:[]}},[]);let Me=(0,V.useCallback)(e=>{q.current=e;let t=e=>e===N.MouseTargetType.GUTTER_GLYPH_MARGIN||e===N.MouseTargetType.GUTTER_LINE_NUMBERS||e===N.MouseTargetType.GUTTER_LINE_DECORATIONS||e===N.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=ve.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=J.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?K(f):W({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{q.current===e&&$()},150)},[$]),Ne=(0,V.useCallback)(e=>{if(H&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:j,lineNumber:H.lineNumber,lineContent:H.lineContent,comment:e,side:H.side};z(e=>[...e,t]),W(null)}else G&&(z(t=>t.map(t=>t.id===G.id?{...t,comment:e}:t)),K(null))},[H,G,Q,j,z]),Pe=(0,V.useCallback)(()=>{G&&(z(e=>e.filter(e=>e.id!==G.id)),K(null))},[G,z]),Fe=(0,V.useCallback)(e=>{if(R.length===0)return;let t=(e%R.length+R.length)%R.length,n=R[t];me(t),te(n.fileIndex),setTimeout(()=>{let e=q.current;if(!e)return;let t=C[n.fileIndex];if(!t)return;let r=P?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[R,C,P,$]),Ie=(0,V.useCallback)(()=>{Fe((B??0)-1)},[Fe,B]),Le=(0,V.useCallback)(()=>{Fe((B??-1)+1)},[Fe,B]),Re=(0,V.useCallback)(async()=>{let t=b[e];if(!t)try{let e=await E(),n=Object.values(e).flat();if(n.length>0)t=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=t.id,i=t.provider;try{let{prompt:t}=await k(e,R);z([]),m({type:ce.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),n()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[R,b,m,e,n,z]),ze={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(P||Oe(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,U.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,U.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,U.jsxs)(ue,{direction:`horizontal`,children:[(0,U.jsx)(pe,{ref:L,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent`,children:(0,U.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,U.jsx)(ge,{treeData:Ee,files:C,error:D,selectedFileIndex:j,onFileSelect:te,onRevertFile:Te})})}),(0,U.jsx)(Se,{isOpen:!I}),(0,U.jsx)(pe,{className:`overflow-hidden bg-transparent`,children:(0,U.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,U.jsxs)(fe,{className:c(`bg-transparent`,I&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:be,children:[I?(0,U.jsx)(t,{className:`h-4 w-4`}):(0,U.jsx)(_,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,U.jsx)(`span`,{className:c(w.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,U.jsxs)(`div`,{className:c(`flex items-center gap-2`,I&&`ml-0`,!I&&`ml-auto`,`md:ml-auto`),children:[(0,U.jsx)(d,{variant:`ghost`,size:`sm`,onClick:()=>ne(e=>!e),disabled:!Q,className:c(w.compact,`h-8 gap-1 px-2`),children:P?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(p,{className:`h-3 w-3`}),` Show changes only`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(g,{className:`h-3 w-3`}),` Show full file`]})}),R.length>0&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ie,disabled:(B??0)===0,children:(0,U.jsx)(i,{className:`h-3 w-3`})})}),(0,U.jsx)(s,{children:`Previous comment`})]}),(0,U.jsx)(`span`,{className:c(w.caption,`whitespace-nowrap`),children:R.length===1?`1 Comment`:`Comment ${(B??0)+1} of ${R.length}`}),(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Le,disabled:(B??0)===R.length-1,children:(0,U.jsx)(l,{className:`h-3 w-3`})})}),(0,U.jsx)(s,{children:`Next comment`})]})]}),R.length>0&&(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(d,{size:`sm`,onClick:Re,className:c(w.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,U.jsx)(O,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,U.jsx)(s,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,U.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,U.jsx)(M,{height:`100%`,language:ke(Q?.path||``),original:Ae,modified:je,theme:x===`dark`?`vs-dark`:`vs-light`,onMount:Me,options:ze},`diff-${j}`),(0,U.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[oe&&(0,U.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,U.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,U.jsxs)(d,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>se(!1),children:[(0,U.jsx)(ee,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,U.jsx)(le,{})]}),!oe&&(0,U.jsxs)(f,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(d,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>se(!0),children:[(0,U.jsx)(O,{className:`h-5 w-5`}),(0,U.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,U.jsx)(s,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,U.jsx)(Ce,{open:H!==null||G!==null,lineNumber:G?.lineNumber??H?.lineNumber??0,lineContent:G?.lineContent??H?.lineContent??``,initialComment:G?.comment,isEditing:G!==null,onSave:Ne,onDelete:Pe,onClose:()=>{W(null),K(null)}},`${G?.id??``}-${H?.lineNumber??``}-${H?.side??``}`)]})}function X(e){let t=(0,H.c)(11),[n,r]=(0,V.useState)(0),i;t[0]!==n||t[1]!==e.threadId?(i=function(){re(we(e.threadId,n)),r(Ee)},t[0]=n,t[1]=e.threadId,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,U.jsx)(ne,{}),t[3]=o):o=t[3];let s=`${e.threadId}:${n}`,c;t[4]!==n||t[5]!==e||t[6]!==s?(c=(0,U.jsx)(V.Suspense,{fallback:o,children:(0,U.jsx)(Te,{...e,loadVersion:n},s)}),t[4]=n,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,U.jsx)(I,{fallbackTitle:`Failed to load review changes`,onRetry:a,children:c}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function Ee(e){return e+1}export{X as DiffView,X as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-Dq44yA1j.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-6DhhjIBL.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CFot099O.js","assets/dialogs-config-Ct6i8Iij.js","assets/onboarding-DHCR18iU.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-CjZZeCRj.js","assets/utils-DDDR42pW.js","assets/index-sEZ3wJXu.css","assets/api-BHfaVqlR.js","assets/context-menu-S8y0c1Fx.js","assets/ui-components-Di-9yNr4.js","assets/explorer-view-BMrlX2hb.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Qr as t,gi as n,io as r,li as i,lr as a,no as o}from"./dialogs-config-Ct6i8Iij.js";import{r as s}from"./monaco-CZnIWXyV.js";import{l as c,u as l}from"./history-view-CFot099O.js";import{A as u,S as d,i as f,n as p,r as m}from"./index-6DhhjIBL.js";var h=o(),g=e(r(),1),_=n(),v=(0,g.lazy)(()=>s(()=>import(`./explorer-tree-Dq44yA1j.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>s(()=>import(`./explorer-view-BMrlX2hb.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(18),n=u(x),[r,o]=(0,g.useState)(null),{pendingExplorerPath:s,setPendingExplorerPath:b,explorerClearPath:S,setExplorerClearPath:C}=d(),w,T;e[0]!==s||e[1]!==b?(w=()=>{s&&b(null)},T=[s,b],e[0]=s,e[1]=b,e[2]=w,e[3]=T):(w=e[2],T=e[3]),(0,g.useEffect)(w,T);let E,D;e[4]!==S||e[5]!==C?(E=()=>{S&&(o(e=>e&&(e.path===S||e.path.startsWith(S+`/`)?null:e)),C(null))},D=[S,C],e[4]=S,e[5]=C,e[6]=E,e[7]=D):(E=e[6],D=e[7]),(0,g.useEffect)(E,D);let O;e[8]!==r?.path||e[9]!==n?(O=(0,_.jsx)(m,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,_.jsx)(a,{className:`h-full`,children:n?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(l,{}),children:(0,_.jsx)(v,{threadId:n,selectedPath:r?.path??null,onNodeSelect:o})}):(0,_.jsx)(`p`,{className:t(i.caption,`px-3 py-4 text-center`),children:`No thread selected.`})})}),e[8]=r?.path,e[9]=n,e[10]=O):O=e[10];let k;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,_.jsx)(p,{withHandle:!0}),e[11]=k):k=e[11];let A;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,_.jsx)(c,{}),e[12]=A):A=e[12];let j;e[13]===r?j=e[14]:(j=(0,_.jsx)(m,{className:`overflow-hidden`,children:(0,_.jsx)(g.Suspense,{fallback:A,children:(0,_.jsx)(y,{selectedFile:r})})}),e[13]=r,e[14]=j);let M;return e[15]!==O||e[16]!==j?(M=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[O,k,j]})}),e[15]=O,e[16]=j,e[17]=M):M=e[17],M}function x(e){return e.selectedThreadId}export{b as default};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ca as t,Ea as n,Hi as r,Ka as i,Qr as a,Wa as o,gi as s,io as c,li as l,mr as u,no as d,wa as f}from"./dialogs-config-Ct6i8Iij.js";import{u as p}from"./onboarding-DHCR18iU.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-CFot099O.js";import{S as T,T as E,b as D,v as ee,y as O}from"./index-6DhhjIBL.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-S8y0c1Fx.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-BHfaVqlR.js";import{t as z}from"./ui-components-Di-9yNr4.js";var B=d(),V=e(c(),1),H=s(),U=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.c)(10),i,o;n[0]===e?(i=n[1],o=n[2]):({className:i,...o}=e,n[0]=e,n[1]=i,n[2]=o);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,H.jsx)(r,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=s):s=n[3];let c;n[4]===i?c=n[5]:(c=a(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),n[4]=i,n[5]=c);let l;return n[6]!==o||n[7]!==t||n[8]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[s,(0,H.jsx)(z.Input,{ref:t,className:c,...o})]}),n[6]=o,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});W.displayName=z.Input.displayName;var G=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.List,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=a(l.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Group,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});q.displayName=z.Group.displayName;var J=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Separator,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});J.displayName=z.Separator.displayName;var Y=V.forwardRef((e,t)=>{let n=(0,B.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 o;n[3]===r?o=n[4]:(o=a(a(l.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=o);let s;return n[5]!==i||n[6]!==t||n[7]!==o?(s=(0,H.jsx)(z.Item,{ref:t,className:o,...i}),n[5]=i,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});Y.displayName=z.Item.displayName;var te=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(l.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function ae(e){let r=(0,B.c)(38),{items:i,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:d}=e,f=o===void 0?!1:o,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;r[0]===s?x=r[1]:(x=function(){h.current||(h.current=!0,s())},r[0]=s,r[1]=x);let S=x,C;r[2]!==b||r[3]!==i?(C=Q(i,re(b),b),r[2]=b,r[3]=i,r[4]=C):C=r[4];let w=C,T,E;r[5]!==c||r[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],r[5]=c,r[6]=v,r[7]=T,r[8]=E):(T=r[7],E=r[8]),(0,V.useEffect)(T,E);let k;r[9]===c?k=r[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},r[9]=c,r[10]=k);let A=k,j;r[11]!==c||r[12]!==d?(j=function(e){d(e),_(!1),c(!1),y(``)},r[11]=c,r[12]=d,r[13]=j):j=r[13];let M=j,N;r[14]===S?N=r[15]:(N=e=>{S(),y(e.target.value)},r[14]=S,r[15]=N);let P;r[16]!==v||r[17]!==S||r[18]!==N?(P=(0,H.jsx)(D,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(u,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),r[16]=v,r[17]=S,r[18]=N,r[19]=P):P=r[19];let F;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=a(l.compact,`py-4`),r[20]=F):F=r[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;r[21]===I?L=r[22]:(L=(0,H.jsx)(K,{className:F,children:I}),r[21]=I,r[22]=L);let R;if(r[23]!==M||r[24]!==w){let e;r[26]===M?e=r[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:a(l.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),r[26]=M,r[27]=e),R=w.map(e),r[23]=M,r[24]=w,r[25]=R}else R=r[25];let z;r[28]===R?z=r[29]:(z=(0,H.jsx)(q,{children:R}),r[28]=R,r[29]=z);let W;r[30]!==L||r[31]!==z?(W=(0,H.jsx)(O,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),r[30]=L,r[31]=z,r[32]=W):W=r[32];let J;return r[33]!==A||r[34]!==g||r[35]!==W||r[36]!==P?(J=(0,H.jsxs)(ee,{open:g,onOpenChange:A,children:[P,W]}),r[33]=A,r[34]=g,r[35]=W,r[36]=P,r[37]=J):J=r[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,V.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:r,level:a,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=l.has(r.path),D=d===r.path,ee=m?.dirPath===r.path&&E;return r.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:a,basePadding:10,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(r)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(i,{className:`h-3 w-3`}):(0,H.jsx)(o,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:s,dirPath:r.path,version:u(r.path),children:r=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:a+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),r.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(r.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(r.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:a,basePadding:22,selected:c===r.path,className:r.ignored?`opacity-50`:void 0,onClick:()=>g(r),children:[(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(r,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(r,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(r),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(r),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:r,onNodeSelect:i}){let[a,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>a.get(e)??0,[a]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[J,e]);function ue(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function be(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&i(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,H.jsxs)(H.Fragment,{children:[we,t.map(t=>(0,H.jsx)(fe,{node:t,level:0,threadId:e,selectedPath:r,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:i,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},t.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Da as t,Qr as n,Xr as r,gi as i,io as a,la as o,li as s,no as c}from"./dialogs-config-Ct6i8Iij.js";import{S as l}from"./react-vendor-CjZZeCRj.js";import{a as u,l as d,n as f,o as p}from"./history-view-CFot099O.js";import{n as m}from"./utils-DDDR42pW.js";import{A as h,C as g,T as _,o as v}from"./index-6DhhjIBL.js";import{a as y,c as b,i as x}from"./api-BHfaVqlR.js";var S=c(),C=e(a(),1),w=i(),T=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),E=new Set([`mp4`,`webm`,`mov`,`avi`]);function D(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return T.has(t)?`image`:E.has(t)?`video`:null}function O(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function k(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]??`plaintext`}function A(e,t){return`explorer-file:${e}:${t}`}function j(e){let t=(0,S.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=A(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>x(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=u(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,C.useLayoutEffect)(c,l),null}function M({selectedFile:e}){let{resolvedTheme:i}=m(),a=h(e=>e.selectedThreadId),c=(0,C.useRef)(null),[u,x]=(0,C.useState)(null),[S,T]=(0,C.useState)(!1),[E,M]=(0,C.useState)(`edit`),[N,P]=(0,C.useState)(0),F=e?.type===`file`&&a&&!D(e.path)?e:null,I=u?.content??``,L=u?.original??``,R=F?`${a}:${F.path}:${N}`:null;(0,C.useEffect)(()=>()=>{c.current&&=(c.current.getModel()?.dispose(),c.current.dispose(),null)},[]),(0,C.useEffect)(()=>{e?.type===`file`?M(O(e.path)?`view`:`edit`):M(`edit`),x(null)},[e?.path,a]);async function z(){if(!(!a||!e)){T(!0);try{await b(a,e.path,I),x({content:I,original:I}),_({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{T(!1)}}}function B(){!a||!F||(p(A(a,F.path)),x(null),P(e=>e+1))}return a?(0,w.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,w.jsxs)(v,{className:`justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col`,children:[(0,w.jsx)(`span`,{className:n(s.label,`text-foreground`),children:e?e.name:`Select a file to edit`}),(0,w.jsx)(`span`,{className:n(s.compact,`text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]}),F&&u?(0,w.jsxs)(`div`,{className:`flex gap-2`,children:[O(F.path)?(0,w.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,w.jsx)(r,{size:`sm`,variant:E===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`view`),children:`View`}),(0,w.jsx)(r,{size:`sm`,variant:E===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>M(`edit`),children:`Edit`})]}):null,(0,w.jsxs)(r,{size:`sm`,onClick:()=>void z(),disabled:S||!I||I===L,children:[S?(0,w.jsx)(o,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),(0,w.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,w.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:F?(0,w.jsxs)(f,{fallbackTitle:`Failed to load file`,onRetry:B,children:[(0,w.jsx)(C.Suspense,{fallback:(0,w.jsx)(d,{}),children:(0,w.jsx)(j,{threadId:a,path:F.path,onContentReady:x},R??void 0)}),u?O(F.path)&&E===`view`?(0,w.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,w.jsx)(g,{content:I,enableMermaid:!0})}):(0,w.jsx)(l,{height:`100%`,language:k(F.path),value:I,onChange:e=>x(t=>t&&{...t,content:e??``}),onMount:e=>{c.current=e},theme:i===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,w.jsx)(d,{})]}):e?.type===`file`&&D(e.path)===`image`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,w.jsx)(`img`,{src:y(a,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e?.type===`file`&&D(e.path)===`video`?(0,w.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,w.jsx)(`video`,{src:y(a,e.path),controls:!0,className:`max-w-full max-h-full`})}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,w.jsx)(t,{className:`h-10 w-10 text-muted-foreground/50`}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`p`,{className:n(s.label,`text-muted-foreground`),children:`No file selected`}),(0,w.jsx)(`p`,{className:n(s.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})})})]}):(0,w.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,w.jsx)(t,{className:`h-8 w-8 text-muted-foreground`}),(0,w.jsx)(`p`,{className:s.bodyMuted,children:`Select a thread to browse its files`})]})}export{M as default};
@@ -1 +0,0 @@
1
- import{Qr as e,Xr as t,_r as n,br as r,gi as i,gr as a,hr as o,la as s,li as c,no as l,vr as u,yr as d}from"./dialogs-config-Ct6i8Iij.js";var f=l(),p=i();function m(i){let l=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=i,S;l[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(r,{children:`Commit History`}),l[0]=S):S=l[0];let C;l[1]===x?C=l[2]:(C=(0,p.jsxs)(d,{children:[S,(0,p.jsxs)(n,{children:[`Recent commits on branch `,x]})]}),l[1]=x,l[2]=C);let w;l[3]===v?w=l[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:e(c.bodyMuted,`text-center py-8`),children:`No commits found`}),l[3]=v,l[4]=w);let T;l[5]===y?T=l[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(s,{className:`h-4 w-4 animate-spin inline`})}),l[5]=y,l[6]=T);let E;l[7]!==_.length||l[8]!==v.length||l[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:e(c.caption,`p-3 text-center`),children:`Scroll to load more`}),l[7]=_.length,l[8]=v.length,l[9]=y,l[10]=E):E=l[10];let D;l[11]!==w||l[12]!==T||l[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),l[11]=w,l[12]=T,l[13]=E,l[14]=D):D=l[14];let O;l[15]!==b||l[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),l[15]=b,l[16]=D,l[17]=O):O=l[17];let k;l[18]===g?k=l[19]:(k=(0,p.jsx)(u,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),l[18]=g,l[19]=k);let A;l[20]!==C||l[21]!==O||l[22]!==k?(A=(0,p.jsxs)(a,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),l[20]=C,l[21]=O,l[22]=k,l[23]=A):A=l[23];let j;return l[24]!==g||l[25]!==m||l[26]!==A?(j=(0,p.jsx)(o,{open:m,onOpenChange:g,children:A}),l[24]=g,l[25]=m,l[26]=A,l[27]=j):j=l[27],j}function h(t){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:e(c.label,`break-words`),children:t.message}),(0,p.jsxs)(`p`,{className:e(c.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:c.mono,children:t.hash.substring(0,7)}),` •`,` `,t.author,` • `,new Date(t.date).toLocaleDateString()]})]},t.hash)}export{m as GitHistoryDialog};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-D4suPxEe.js","assets/index-6DhhjIBL.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CFot099O.js","assets/dialogs-config-Ct6i8Iij.js","assets/onboarding-DHCR18iU.js","assets/whisper-wasm-Cq5Ofwpd.js","assets/react-vendor-CjZZeCRj.js","assets/utils-DDDR42pW.js","assets/index-sEZ3wJXu.css","assets/pull-request-dialog-Csql6eob.js","assets/create-repo-dialog-DPKIg1mY.js","assets/git-history-dialog-CDwIqSZQ.js","assets/push-before-pr-dialog-IhdlLvWt.js","assets/pull-with-changes-dialog-DN0kE6os.js","assets/merged-pr-dialog-H_fuSmiF.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$n as t,$t as n,C as r,Ct as i,Ka as ee,Lt as a,Ma as te,Qn as ne,Qr as o,Qt as s,Ti as c,Xr as re,Zn as ie,Zt as ae,an as oe,b as l,ct as u,d,en as se,eo as f,er as ce,gi as p,h as m,io as h,ja as g,la as le,li as _,ln as v,ma as ue,mi as y,nn as de,no as b,rn as x,sn as fe,u as S,ut as pe,va as me,xa as C,xt as w,y as T,ya as he,z as E}from"./dialogs-config-Ct6i8Iij.js";import{r as D}from"./monaco-CZnIWXyV.js";import{A as ge,O,T as k,_ as _e,f as A,g as ve,h as j,k as M,m as ye,p as be}from"./index-6DhhjIBL.js";var N=e(h(),1),P=p();function xe(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function F(e,t){return t?(0,P.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(f,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,P.jsx)(C,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,P.jsx)(g,{className:`h-3.5 w-3.5`}):(0,P.jsx)(he,{className:`h-3.5 w-3.5`})}function Se(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function I(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function L(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ce=b();function R(e){let n=(0,Ce.c)(80),{branchStatus:r,remoteUrl:i,hasRemoteBranch:a,hasUnpushedCommits:s,canCreateRepo:ae,repoUrl:oe,isRefreshing:l,isBrandState:u,gitUser:d,isDirectCommitMode:se,isLoading:p,isLoadingHistory:m,onFetch:h,onPull:v,onPush:y,onOpenHistory:de,onCreatePR:b,onCreateRepo:x,onViewInGitHub:fe,onOpenChange:S}=e,pe=`h-8 w-8 rounded-l-none px-1${u?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,C;n[0]===l?C=n[1]:(C=l?(0,P.jsx)(le,{className:`h-3.5 w-3.5 animate-spin`}):(0,P.jsx)(ee,{className:`h-3.5 w-3.5`}),n[0]=l,n[1]=C);let w;n[2]!==p||n[3]!==pe||n[4]!==C?(w=(0,P.jsx)(_e,{asChild:!0,children:(0,P.jsx)(re,{variant:`outline`,size:`sm`,className:pe,disabled:p,children:C})}),n[2]=p,n[3]=pe,n[4]=C,n[5]=w):w=n[5];let T;n[6]!==r||n[7]!==i?(T=r===`Behind`&&(0,P.jsxs)(`div`,{className:o(_.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,i?`origin`:`remote`]}),n[6]=r,n[7]=i,n[8]=T):T=n[8];let E;n[9]===d?E=n[10]:(E=d&&(0,P.jsxs)(`div`,{className:o(_.compact,`px-2 py-1 text-muted-foreground`),children:[(0,P.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,d]}),n[9]=d,n[10]=E);let D;n[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,P.jsx)(ve,{}),n[11]=D):D=n[11];let ge;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,P.jsx)(te,{className:`h-3.5 w-3.5 mr-2`}),n[12]=ge):ge=n[12];let O;n[13]!==p||n[14]!==h?(O=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:h,disabled:p,children:[ge,`Fetch`]})}),n[13]=p,n[14]=h,n[15]=O):O=n[15];let k;n[16]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,P.jsx)(ne,{side:`right`,children:`Download latest information from remote without merging changes`}),n[16]=k):k=n[16];let A;n[17]===O?A=n[18]:(A=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[O,k]})}),n[17]=O,n[18]=A);let M;n[19]!==a||n[20]!==p||n[21]!==v?(M=()=>{a&&!p&&v()},n[19]=a,n[20]=p,n[21]=v,n[22]=M):M=n[22];let N=!a||p?`opacity-50 cursor-not-allowed`:``,xe;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,P.jsx)(f,{className:`h-3.5 w-3.5 mr-2`}),n[23]=xe):xe=n[23];let F;n[24]!==M||n[25]!==N?(F=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:M,className:N,children:[xe,`Pull`]})}),n[24]=M,n[25]=N,n[26]=F):F=n[26];let Se=a?`Pull latest changes from remote`:`No remote branch to pull from`,I;n[27]===Se?I=n[28]:(I=(0,P.jsx)(ne,{side:`right`,children:Se}),n[27]=Se,n[28]=I);let L;n[29]!==F||n[30]!==I?(L=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[F,I]})}),n[29]=F,n[30]=I,n[31]=L):L=n[31];let R;n[32]!==a||n[33]!==p||n[34]!==y?(R=!a&&(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:y,disabled:p,children:[(0,P.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,P.jsx)(ne,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[32]=a,n[33]=p,n[34]=y,n[35]=R):R=n[35];let z;n[36]!==s||n[37]!==p||n[38]!==y?(z=()=>{s&&!p&&y()},n[36]=s,n[37]=p,n[38]=y,n[39]=z):z=n[39];let we=!s||p?`opacity-50 cursor-not-allowed`:``,B;n[40]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,P.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),n[40]=B):B=n[40];let V;n[41]!==z||n[42]!==we?(V=(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(j,{onClick:z,className:we,children:[B,`Push Commits`]})}),n[41]=z,n[42]=we,n[43]=V):V=n[43];let Te=s?p?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;n[44]===Te?H=n[45]:(H=(0,P.jsx)(ne,{side:`right`,children:Te}),n[44]=Te,n[45]=H);let U;n[46]!==V||n[47]!==H?(U=(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[V,H]})}),n[46]=V,n[47]=H,n[48]=U):U=n[48];let Ee=p||m,De;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,P.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[49]=De):De=n[49];let W;n[50]!==de||n[51]!==Ee?(W=(0,P.jsxs)(j,{onClick:de,disabled:Ee,children:[De,`History`]}),n[50]=de,n[51]=Ee,n[52]=W):W=n[52];let G;n[53]!==se||n[54]!==p||n[55]!==b?(G=!se&&(0,P.jsxs)(j,{onClick:b,disabled:p,children:[(0,P.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[53]=se,n[54]=p,n[55]=b,n[56]=G):G=n[56];let K;n[57]!==ae||n[58]!==p||n[59]!==x?(K=ae&&(0,P.jsxs)(j,{onClick:x,disabled:p,children:[(0,P.jsx)(me,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[57]=ae,n[58]=p,n[59]=x,n[60]=K):K=n[60];let q;n[61]!==p||n[62]!==fe||n[63]!==oe?(q=oe&&(0,P.jsxs)(j,{onClick:fe,disabled:p,children:[(0,P.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[61]=p,n[62]=fe,n[63]=oe,n[64]=q):q=n[64];let J;n[65]!==A||n[66]!==L||n[67]!==R||n[68]!==U||n[69]!==W||n[70]!==G||n[71]!==K||n[72]!==q||n[73]!==T||n[74]!==E?(J=(0,P.jsxs)(ye,{align:`end`,children:[T,E,D,A,L,R,U,W,G,K,q]}),n[65]=A,n[66]=L,n[67]=R,n[68]=U,n[69]=W,n[70]=G,n[71]=K,n[72]=q,n[73]=T,n[74]=E,n[75]=J):J=n[75];let Y;return n[76]!==S||n[77]!==w||n[78]!==J?(Y=(0,P.jsxs)(be,{onOpenChange:S,children:[w,J]}),n[76]=S,n[77]=w,n[78]=J,n[79]=Y):Y=n[79],Y}function z(){return{autoGenerateCommitMessage:S(),autoGeneratePRInfo:d(),privateRepositoryDefault:m()}}function we(e){e.autoGenerateCommitMessage!==void 0&&T(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&l(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&r(e.privateRepositoryDefault)}function B(e){return e?!0:(k({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function V(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function Te(e,t,n){let[r,i]=(0,N.useState)(!1),[ee,a]=(0,N.useState)(!1),te=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:V(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:ee,generateCommitMessageWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=te();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,N.useCallback)(async()=>{if(!e)return null;try{a(!0);let{provider:t,model:n}=te();return await pe(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),k({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{a(!1)}},[e,n])}}var H=(0,N.lazy)(()=>D(()=>import(`./commit-dialog-D4suPxEe.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),U=(0,N.lazy)(()=>D(()=>import(`./pull-request-dialog-Csql6eob.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Ee=(0,N.lazy)(()=>D(()=>import(`./create-repo-dialog-DPKIg1mY.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),De=(0,N.lazy)(()=>D(()=>import(`./git-history-dialog-CDwIqSZQ.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),W=(0,N.lazy)(()=>D(()=>import(`./push-before-pr-dialog-IhdlLvWt.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),G=(0,N.lazy)(()=>D(()=>import(`./pull-with-changes-dialog-DN0kE6os.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),K=(0,N.lazy)(()=>D(()=>import(`./merged-pr-dialog-H_fuSmiF.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function q(){return null}function J({projectId:e,threadId:r}){let ee=M(),te=ge(e=>e.projectModelSelections[r]),o=ge(t=>t.projects.find(t=>t.projectId===e)),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(!1),[f,p]=(0,N.useState)(!1),[m,h]=(0,N.useState)(!1),[g,le]=(0,N.useState)(``),[_,ue]=(0,N.useState)(``),[b,S]=(0,N.useState)(``),[pe,me]=(0,N.useState)(!1),[C,T]=(0,N.useState)(null),he=(0,N.useRef)(!1),D=(0,N.useRef)(!1),_e=(0,N.useRef)(_),ve=(0,N.useRef)(b);_e.current=_,ve.current=b;let[j,ye]=(0,N.useState)(!1),[be,Ce]=(0,N.useState)([]),[V,J]=(0,N.useState)(!1),[Y,Oe]=(0,N.useState)([]),[ke,Ae]=(0,N.useState)(!1),[je,Me]=(0,N.useState)(!1),[Ne,Pe]=(0,N.useState)(``),[Fe,Ie]=(0,N.useState)(``),[Le,Re]=(0,N.useState)(``),[ze,Be]=(0,N.useState)(!1),[Ve,He]=(0,N.useState)(!1),[Ue,We]=(0,N.useState)(!1),[Ge,Ke]=(0,N.useState)(!1),X=A(),{fetchUnifiedStatus:qe}=X,Z=Te(r,e,te);async function Q(){fe();let e=await a();ee({type:O.SetProjects,projects:e.projects})}let[$,Je]=(0,N.useState)(()=>z()),Ye=o?.commitMethod===y.Direct;(0,N.useEffect)(()=>{je&&o?.name&&!Ne&&Pe(o.name)},[je,o?.name,Ne]),(0,N.useEffect)(()=>{we($)},[$]);function Xe(){ze||(Be(!0),i().then(e=>Re(e)).catch(()=>{}))}(0,N.useEffect)(()=>{if(!f){D.current=!1;return}if(f&&$.autoGenerateCommitMessage&&!g.trim()&&r&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}e()}},[f,$.autoGenerateCommitMessage,r,Z.generateCommitMessageWithAI,g]),(0,N.useEffect)(()=>{if(!m){he.current=!1;return}if(m&&$.autoGeneratePRInfo&&!_e.current.trim()&&!ve.current.trim()&&r&&!he.current){he.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),S(e.description),k({title:`Success`,description:`PR title and description generated`}))}e()}},[m,$.autoGeneratePRInfo,r,Z.generatePRInfoWithAI]),(0,N.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Ke(!0),u&&X.prExists&&X.prState===`OPEN`&&d(!1)},[X.prExists,X.prState,r,u]),(0,N.useEffect)(()=>{if(!u)return;let e=setTimeout(()=>{d(!1)},15e3);return()=>clearTimeout(e)},[u]);async function Ze(){if(g.trim()&&B(r))try{l(!0),await ae(r,g),le(``),p(!1),await X.fetchUnifiedStatus(!0),Q(),k({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ue&&(We(!1),await rt())}catch(e){console.error(`Failed to commit:`,e),k({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{l(!1)}}async function Qe(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await st();return}if(X.hasChanges){p(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await v(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){h(!0);return}if(X.hasUnpushedCommits&&X.prExists){await tt();return}}async function $e(){let e=await Z.generateCommitMessageWithAI();e&&le(e)}async function et(){if(B(r))try{l(!0),await se(r),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{l(!1)}}async function tt(){if(B(r))try{l(!0),await x(r),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?k({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):k({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),k({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{l(!1)}}async function nt(){if(B(r)){if(X.hasChanges){He(!0);return}await rt()}}async function rt(){try{l(!0),await de(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),k({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{l(!1)}}function it(){He(!1),We(!0),p(!0)}async function at(){He(!1),await rt()}async function ot(){if(r)try{l(!0);let e=await s(r);fe();let t=await a();ee({type:O.SetProjects,projects:t.projects}),k({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Ke(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),k({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{l(!1)}}async function st(){if(B(r))try{l(!0),await oe(r),await X.fetchUnifiedStatus(!0),Q(),k({title:`Branch synced successfully`,description:`Your branch '${X.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),k({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{l(!1)}}async function ct(){if(B(r))try{l(!0),d(!0);let e=await n(r,_,b);e.prUrl&&await v(e.prUrl),ue(``),S(``),h(!1),await X.fetchUnifiedStatus(!0),Q();let t=0,i=setInterval(async()=>{if(t++,t>=6){clearInterval(i);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(h(!1),dt({title:_,description:b})):(d(!1),k({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{l(!1)}}async function lt(){if(B(r))try{l(!0);let e=await E(r,Ne,Fe,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{v(e.repoUrl)},3e3),Pe(``),Ie(``),Me(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{l(!1)}}async function ut(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),S(e.description),k({title:`Success`,description:`PR title and description generated`}))}async function dt(e){let t=e??C;if(!(!r||!t))try{l(!0),d(!0);try{await x(r)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){k({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await oe(r),await x(r)}catch{throw e}}else throw e}let e=await n(r,t.title,t.description);e.prUrl&&await v(e.prUrl),ue(``),S(``),T(null),me(!1),await X.fetchUnifiedStatus(!0),Q();let i=0,ee=setInterval(async()=>{if(i++,i>=6){clearInterval(ee);return}await X.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;d(!1),k({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{l(!1)}}async function ft(){if(B(r))try{J(!0);let e=await w(r,100);Ce(e),Oe(e.slice(0,10)),ye(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{J(!1)}}function pt(){ke||(Ae(!0),setTimeout(()=>{let e=Y.length+10;Oe(be.slice(0,e)),Ae(!1)},300))}function mt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&Y.length<be.length&&!ke&&pt()}let ht=L(X);function gt(){X.repoUrl&&v(X.repoUrl)}function _t(){me(!1),T(null)}function vt(){Ke(!1),X.fetchUnifiedStatus(!0)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-0`,children:[(0,P.jsx)(t,{children:(0,P.jsxs)(ie,{children:[(0,P.jsx)(ce,{asChild:!0,children:(0,P.jsxs)(re,{variant:`outline`,size:`sm`,className:`h-8 rounded-r-none border-r-0 gap-1.5${ht?` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`:``}`,disabled:I(X,c,u),onClick:Qe,children:[F(X,u),xe(X,u)]})}),(0,P.jsx)(ne,{children:Se(X)})]})}),(0,P.jsx)(R,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:ht,gitUser:Le,isDirectCommitMode:Ye,isLoading:c||u,isLoadingHistory:V,onFetch:()=>void et(),onPull:()=>void nt(),onPush:()=>void tt(),onOpenHistory:()=>void ft(),onCreatePR:()=>h(!0),onCreateRepo:()=>Me(!0),onViewInGitHub:gt,onOpenChange:e=>{e&&(Xe(),qe(!0))}})]}),f&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(H,{open:f,onOpenChange:p,commitMessage:g,onCommitMessageChange:le,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Je(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:c,onGenerateMessage:$e,onCommit:Ze,currentBranch:X.currentBranch})}),m&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(U,{open:m,onOpenChange:h,prTitle:_,onPrTitleChange:ue,prDescription:b,onPrDescriptionChange:S,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ut,onCreatePR:ct,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Je(t=>({...t,autoGeneratePRInfo:e}))})}),pe&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(W,{open:pe,onOpenChange:me,isLoading:c,onPushAndCreatePR:dt,onCancel:_t})}),je&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(Ee,{open:je,onOpenChange:Me,repoName:Ne,onRepoNameChange:Pe,repoDescription:Fe,onRepoDescriptionChange:Ie,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Je(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:lt})}),j&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(De,{open:j,onOpenChange:ye,commits:be,displayedCommits:Y,isLoadingMore:ke,onScroll:mt,currentBranch:X.currentBranch})}),Ve&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(G,{open:Ve,onOpenChange:He,onCommitFirst:it,onStashAndPull:at,onCancel:()=>He(!1),isLoading:c})}),Ge&&(0,P.jsx)(N.Suspense,{fallback:(0,P.jsx)(q,{}),children:(0,P.jsx)(K,{open:Ge,onOpenChange:Ke,onNewBranch:ot,onJustOpen:vt,isLoading:c})})]})}export{J as GitOpsButton};
@@ -1,7 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$n as n,Ar as r,Br as i,Cr as a,Dr as o,Er as s,Fa as c,Fr as l,Ga as u,Gr as d,Ir as f,Jr as p,Ka as m,Kr as h,Mr as g,N as _,Nr as v,Oi as y,Or as b,Qn as x,Qr as S,Rr as C,Sr as w,Tr as T,Ua as E,Ur as D,Vr as O,Wa as ee,Wr as k,Xr as A,Yr as j,Zn as M,Zr as N,ar as te,ci as P,dr as F,er as ne,gi as I,io as L,ir as R,jr as re,kr as ie,la as ae,li as z,lr as oe,no as se,or as ce,qa as le,qr as B,ro as ue,rr as de,s as fe,sr as pe,tr as me,ur as he,vi as V,wr as ge,xi as _e,xr as ve,yt as ye}from"./dialogs-config-Ct6i8Iij.js";var H=se(),U=e(L(),1),W=I(),be=`AlertDialog`,[xe,Se]=p(be,[r]),G=r(),Ce=e=>{let{__scopeAlertDialog:t,...n}=e,r=G(t);return(0,W.jsx)(s,{...r,...n,modal:!0})};Ce.displayName=be;var we=`AlertDialogTrigger`,Te=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(b,{...i,...r,ref:t})});Te.displayName=we;var Ee=`AlertDialogPortal`,De=e=>{let{__scopeAlertDialog:t,...n}=e,r=G(t);return(0,W.jsx)(T,{...r,...n})};De.displayName=Ee;var Oe=`AlertDialogOverlay`,ke=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(ge,{...i,...r,ref:t})});ke.displayName=Oe;var K=`AlertDialogContent`,[Ae,je]=xe(K),Me=k(`AlertDialogContent`),Ne=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=G(n),o=U.useRef(null),s=V(t,o),c=U.useRef(null);return(0,W.jsx)(ie,{contentName:K,titleName:Pe,docsSlug:`alert-dialog`,children:(0,W.jsx)(Ae,{scope:n,cancelRef:c,children:(0,W.jsxs)(w,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:j(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,W.jsx)(Me,{children:r}),(0,W.jsx)(He,{contentRef:o})]})})})});Ne.displayName=K;var Pe=`AlertDialogTitle`,Fe=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(o,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogDescription`,Le=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(a,{...i,...r,ref:t})});Le.displayName=Ie;var Re=`AlertDialogAction`,ze=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=G(n);return(0,W.jsx)(ve,{...i,...r,ref:t})});ze.displayName=Re;var Be=`AlertDialogCancel`,Ve=U.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=je(Be,n),a=G(n),o=V(t,i);return(0,W.jsx)(ve,{...a,...r,ref:o})});Ve.displayName=Be;var He=({contentRef:e})=>{let t=`\`${K}\` requires a description for the component to be accessible for screen reader users.
2
-
3
- You can add a description to the \`${K}\` by passing a \`${Ie}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
4
-
5
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${K}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
6
-
7
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return U.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Ue=Ce,We=De,Ge=ke,Ke=Ne,qe=ze,Je=Ve,Ye=Fe,Xe=Le,Ze=Ue,Qe=We,$e=U.forwardRef((e,t)=>{let n=(0,H.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=S(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Ge,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$e.displayName=Ge.displayName;var et=U.forwardRef((e,t)=>{let n=(0,H.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]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)($e,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=S(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,W.jsxs)(Qe,{children:[a,(0,W.jsx)(Ke,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});et.displayName=Ke.displayName;var tt=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=S(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};tt.displayName=`AlertDialogHeader`;var nt=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=S(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,W.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};nt.displayName=`AlertDialogFooter`;var rt=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Ye,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});rt.displayName=Ye.displayName;var it=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Xe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});it.displayName=Xe.displayName;var at=U.forwardRef((e,t)=>{let n=(0,H.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=S(N(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(qe,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});at.displayName=qe.displayName;var ot=U.forwardRef((e,t)=>{let n=(0,H.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=S(N({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Je,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ot.displayName=Je.displayName;function st(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ct(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lt(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(P.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ut(e){let t=(0,H.c)(16),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=S(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=S(z.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]!==c||t[5]!==n?(l=(0,W.jsx)(`h1`,{className:c,children:n}),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u;t[7]===r?u=t[8]:(u=r?(0,W.jsx)(`p`,{className:z.pageSubtitle,children:r}):null,t[7]=r,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,W.jsxs)(`div`,{children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;return t[12]!==i||t[13]!==s||t[14]!==d?(f=(0,W.jsxs)(`div`,{className:s,children:[d,i]}),t[12]=i,t[13]=s,t[14]=d,t[15]=f):f=t[15],f}function dt(e){let t=(0,H.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(z.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,W.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function ft(e){let t=(0,H.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=S(a===`hint`?z.hintBanner:a===`success`?S(z.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?S(z.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):z.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,W.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function pt(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function mt(e){let t=(0,H.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,W.jsx)(`h2`,{className:S(z.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,W.jsx)(`p`,{className:z.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,W.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,W.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,W.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ht(e){let t=(0,H.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=S(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,W.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function gt(e){let t=(0,H.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,W.jsx)(dt,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,W.jsx)(`p`,{className:z.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==l?(u=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[l,i]}),t[7]=i,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==u?(d=(0,W.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}var _t=e(ue(),1);function vt(e){let t=U.useRef({value:e,previous:e});return U.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yt=[` `,`Enter`,`ArrowUp`,`ArrowDown`],bt=[` `,`Enter`],q=`Select`,[xt,St,Ct]=fe(q),[wt,Tt]=p(q,[Ct,pe]),Et=pe(),[Dt,J]=wt(q),[Ot,kt]=wt(q),At=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:f,disabled:p,required:m,form:g}=e,_=Et(t),[v,y]=U.useState(null),[b,x]=U.useState(null),[S,C]=U.useState(!1),w=F(l),[T,E]=d({prop:r,defaultProp:i??!1,onChange:a,caller:q}),[D,O]=d({prop:o,defaultProp:s,onChange:c,caller:q}),ee=U.useRef(null),k=v?g||!!v.closest(`form`):!0,[A,j]=U.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,W.jsx)(ce,{..._,children:(0,W.jsxs)(Dt,{required:m,scope:t,trigger:v,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:h(),value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:ee,disabled:p,children:[(0,W.jsx)(xt.Provider,{scope:t,children:(0,W.jsx)(Ot,{scope:e.__scopeSelect,onNativeOptionAdd:U.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:U.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,W.jsxs)(Cn,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:f,value:D,onChange:e=>O(e.target.value),disabled:p,form:g,children:[D===void 0?(0,W.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};At.displayName=q;var jt=`SelectTrigger`,Mt=U.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Et(n),o=J(jt,n),s=o.disabled||r,c=V(t,o.onTriggerChange),l=St(n),u=U.useRef(`touch`),[d,f,p]=Tn(e=>{let t=l().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,W.jsx)(de,{asChild:!0,...a,children:(0,W.jsx)(O.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":wn(o.value)?``:void 0,...i,ref:c,onClick:j(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:j(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:j(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&yt.includes(e.key)&&(m(),e.preventDefault())})})})});Mt.displayName=jt;var Nt=`SelectValue`,Pt=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=J(Nt,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=V(t,c.onValueNodeChange);return B(()=>{l(u)},[l,u]),(0,W.jsx)(O.span,{...s,ref:d,style:{pointerEvents:`none`},children:wn(c.value)?(0,W.jsx)(W.Fragment,{children:o}):a})});Pt.displayName=Nt;var Ft=`SelectIcon`,It=U.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,W.jsx)(O.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});It.displayName=Ft;var Lt=`SelectPortal`,Rt=e=>(0,W.jsx)(l,{asChild:!0,...e});Rt.displayName=Lt;var Y=`SelectContent`,zt=U.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=U.useState();if(B(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?_t.createPortal((0,W.jsx)(Bt,{scope:e.__scopeSelect,children:(0,W.jsx)(xt.Slot,{scope:e.__scopeSelect,children:(0,W.jsx)(`div`,{children:e.children})})}),t):null}return(0,W.jsx)(Ut,{...e,ref:t})});zt.displayName=Y;var X=10,[Bt,Z]=wt(Y),Vt=`SelectContentImpl`,Ht=D(`SelectContent.RemoveScroll`),Ut=U.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:y,...b}=e,x=J(Y,n),[S,w]=U.useState(null),[T,E]=U.useState(null),D=V(t,e=>w(e)),[O,ee]=U.useState(null),[k,A]=U.useState(null),M=St(n),[N,te]=U.useState(!1),P=U.useRef(!1);U.useEffect(()=>{if(S)return re(S)},[S]),v();let F=U.useCallback(e=>{let[t,...n]=M().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[M,T]),ne=U.useCallback(()=>F([O,S]),[F,O,S]);U.useEffect(()=>{N&&ne()},[N,ne]);let{onOpenChange:I,triggerPointerDownPosRef:L}=x;U.useEffect(()=>{if(S){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():S.contains(n.target)||I(!1),document.removeEventListener(`pointermove`,t),L.current=null};return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[S,I,L]),U.useEffect(()=>{let e=()=>I(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[I]);let[R,ie]=Tn(e=>{let t=M().filter(e=>!e.disabled),n=En(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ae=U.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&(ee(e),r&&(P.current=!0))},[x.value]),z=U.useCallback(()=>S?.focus(),[S]),oe=U.useCallback((e,t,n)=>{let r=!P.current&&!n;(x.value!==void 0&&x.value===t||r)&&A(e)},[x.value]),se=r===`popper`?qt:Gt,ce=se===qt?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:m,sticky:h,hideWhenDetached:_,avoidCollisions:y}:{};return(0,W.jsx)(Bt,{scope:n,content:S,viewport:T,onViewportChange:E,itemRefCallback:ae,selectedItem:O,onItemLeave:z,itemTextRefCallback:oe,focusSelectedItem:ne,selectedItemText:k,position:r,isPositioned:N,searchRef:R,children:(0,W.jsx)(g,{as:Ht,allowPinchZoom:!0,children:(0,W.jsx)(f,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:j(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,W.jsx)(C,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,W.jsx)(se,{role:`listbox`,id:x.contentId,"data-state":x.open?`open`:`closed`,dir:x.dir,onContextMenu:e=>e.preventDefault(),...b,...ce,onPlaced:()=>te(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:j(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ie(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=M().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})});Ut.displayName=Vt;var Wt=`SelectItemAlignedPosition`,Gt=U.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=J(Y,n),o=Z(Y,n),[s,c]=U.useState(null),[l,u]=U.useState(null),d=V(t,e=>u(e)),f=St(n),p=U.useRef(!1),m=U.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=U.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=he(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-X,d=he(a,[X,Math.max(X,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-X*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=c-E,O=g.offsetHeight/2,ee=g.offsetTop+O,k=m+v+ee,A=x-k;if(k<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,h.scrollTop=k-E+h.offsetTop}s.style.margin=`${X}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);B(()=>y(),[y]);let[b,x]=U.useState();return B(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,W.jsx)(Jt,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:U.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,W.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,W.jsx)(O.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Gt.displayName=Wt;var Kt=`SelectPopperPosition`,qt=U.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=Et(n);return(0,W.jsx)(te,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});qt.displayName=Kt;var[Jt,Yt]=wt(Y,{}),Xt=`SelectViewport`,Zt=U.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Xt,n),o=Yt(Xt,n),s=V(t,a.onViewportChange),c=U.useRef(0);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,W.jsx)(xt.Slot,{scope:n,children:(0,W.jsx)(O.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:j(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Zt.displayName=Xt;var Qt=`SelectGroup`,[$t,en]=wt(Qt),tn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=h();return(0,W.jsx)($t,{scope:n,id:i,children:(0,W.jsx)(O.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});tn.displayName=Qt;var nn=`SelectLabel`,rn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=en(nn,n);return(0,W.jsx)(O.div,{id:i.id,...r,ref:t})});rn.displayName=nn;var an=`SelectItem`,[on,sn]=wt(an),cn=U.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=J(an,n),c=Z(an,n),l=s.value===r,[u,d]=U.useState(a??``),[f,p]=U.useState(!1),m=V(t,e=>c.itemRefCallback?.(e,r,i)),g=h(),_=U.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,W.jsx)(on,{scope:n,value:r,disabled:i,textId:g,isSelected:l,onItemTextChange:U.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,W.jsx)(xt.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,W.jsx)(O.div,{role:`option`,"aria-labelledby":g,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:j(o.onFocus,()=>p(!0)),onBlur:j(o.onBlur,()=>p(!1)),onClick:j(o.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:j(o.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:j(o.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:j(o.onPointerMove,e=>{_.current=e.pointerType,i?c.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:j(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:j(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(bt.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});cn.displayName=an;var ln=`SelectItemText`,un=U.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=J(ln,n),s=Z(ln,n),c=sn(ln,n),l=kt(ln,n),[u,d]=U.useState(null),f=V(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=U.useMemo(()=>(0,W.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return B(()=>(h(m),()=>g(m)),[h,g,m]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(O.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?_t.createPortal(a.children,o.valueNode):null]})});un.displayName=ln;var dn=`SelectItemIndicator`,fn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return sn(dn,n).isSelected?(0,W.jsx)(O.span,{"aria-hidden":!0,...r,ref:t}):null});fn.displayName=dn;var pn=`SelectScrollUpButton`,mn=U.forwardRef((e,t)=>{let n=Z(pn,e.__scopeSelect),r=Yt(pn,e.__scopeSelect),[i,a]=U.useState(!1),o=V(t,r.onScrollButtonChange);return B(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,W.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});mn.displayName=pn;var hn=`SelectScrollDownButton`,gn=U.forwardRef((e,t)=>{let n=Z(hn,e.__scopeSelect),r=Yt(hn,e.__scopeSelect),[i,a]=U.useState(!1),o=V(t,r.onScrollButtonChange);return B(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,W.jsx)(_n,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});gn.displayName=hn;var _n=U.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Z(`SelectScrollButton`,n),o=U.useRef(null),s=St(n),c=U.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return U.useEffect(()=>()=>c(),[c]),B(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,W.jsx)(O.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:j(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:j(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:j(i.onPointerLeave,()=>{c()})})}),vn=`SelectSeparator`,yn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,W.jsx)(O.div,{"aria-hidden":!0,...r,ref:t})});yn.displayName=vn;var bn=`SelectArrow`,xn=U.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Et(n),a=J(bn,n),o=Z(bn,n);return a.open&&o.position===`popper`?(0,W.jsx)(R,{...i,...r,ref:t}):null});xn.displayName=bn;var Sn=`SelectBubbleInput`,Cn=U.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=U.useRef(null),a=V(r,i),o=vt(t);return U.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,W.jsx)(O.select,{...n,style:{...me,...n.style},ref:a,defaultValue:t})});Cn.displayName=Sn;function wn(e){return e===``||e===void 0}function Tn(e){let t=i(e),n=U.useRef(``),r=U.useRef(0),a=U.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),o=U.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return U.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function En(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Dn(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Dn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var On=At,kn=Mt,An=Pt,jn=It,Mn=Rt,Nn=zt,Pn=Zt,Fn=rn,In=cn,Ln=un,Rn=fn,zn=mn,Bn=gn,Vn=yn,Hn=On,Un=An,Wn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(jn,{asChild:!0,children:(0,W.jsx)(m,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,W.jsxs)(kn,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Wn.displayName=kn.displayName;var Gn=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=S(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(E,{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,W.jsx)(zn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Gn.displayName=zn.displayName;var Kn=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=S(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(m,{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,W.jsx)(Bn,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Kn.displayName=Bn.displayName;var qn=U.forwardRef((e,t)=>{let n=(0,H.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=S(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,W.jsx)(Gn,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,f;n[9]===d?f=n[10]:(f=S(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,W.jsx)(Pn,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,W.jsx)(Kn,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,W.jsx)(Mn,{children:(0,W.jsxs)(Nn,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});qn.displayName=Nn.displayName;var Jn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Fn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Jn.displayName=Fn.displayName;var Yn=U.forwardRef((e,t)=>{let n=(0,H.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]===i?o=n[5]:(o=S(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,W.jsx)(Rn,{children:(0,W.jsx)(le,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,W.jsx)(Ln,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,W.jsxs)(In,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});Yn.displayName=In.displayName;var Xn=U.forwardRef((e,t)=>{let n=(0,H.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=S(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Vn.displayName;function Zn(e){let t=(0,H.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=S(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=S(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,W.jsx)(ae,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,W.jsx)(`p`,{className:S(z.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,W.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==s||t[12]!==d?(f=(0,W.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=f):f=t[13],f}function Qn(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map($n)}),e[0]=t):t=e[0],t}function $n(e){return(0,W.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function er(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var tr=new Map;function nr(e,t){let n=tr.get(e);return n||(n={promise:t().catch(t=>{throw tr.delete(e),t})},tr.set(e,n)),n.promise}function rr(e){tr.delete(e)}function ir(e){for(let t of tr.keys())t.startsWith(e)&&tr.delete(t)}function ar(e,t){return(0,U.use)(nr(e,t))}var or=U.forwardRef((e,t)=>{let n=(0,H.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=S(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});or.displayName=`Card`;var sr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sr.displayName=`CardHeader`;var cr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.sectionTitle,`leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});cr.displayName=`CardTitle`;var lr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});lr.displayName=`CardDescription`;var ur=U.forwardRef((e,t)=>{let n=(0,H.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=S(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ur.displayName=`CardContent`;var dr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dr.displayName=`CardFooter`;var fr=class extends U.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(or,{className:`max-w-md`,children:[(0,W.jsx)(sr,{children:(0,W.jsx)(cr,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,W.jsxs)(ur,{className:`space-y-4`,children:[(0,W.jsx)(`p`,{className:z.body,children:e.message}),(0,W.jsx)(A,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},pr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`w-full caption-bottom`,z.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,W.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});pr.displayName=`Table`;var mr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});mr.displayName=`TableHeader`;var hr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});hr.displayName=`TableBody`;var gr=U.forwardRef((e,t)=>{let n=(0,H.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=S(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});gr.displayName=`TableFooter`;var _r=U.forwardRef((e,t)=>{let n=(0,H.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=S(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_r.displayName=`TableRow`;var Q=U.forwardRef((e,t)=>{let n=(0,H.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=S(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=U.forwardRef((e,t)=>{let n=(0,H.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=S(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var vr=U.forwardRef((e,t)=>{let n=(0,H.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=S(z.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,W.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});vr.displayName=`TableCaption`;var yr=t({ConversationHistoryView:()=>Dr,default:()=>Dr}),br=`__ALL_PROJECTS__`;function xr(e){let t=(0,H.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,W.jsx)(W.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,W.jsxs)(W.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function Sr(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function Cr(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ye(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function wr(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function Tr(e,t){if(e.type===`thread`)return await ye(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await Cr(n.threads);return{threadId:e.projectId,...r}}return{threadId:br,...await Cr(t.flatMap(e=>e.threads))}}function Er(e){let t=(0,H.c)(45),{scope:r,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:s}=e,l;t[0]!==a||t[1]!==r?(l=wr(r,a),t[0]=a,t[1]=r,t[2]=l):l=t[2];let d;t[3]!==i||t[4]!==r?(d=()=>Tr(r,i),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f=ar(l,d),p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(e){return new Date(e).toLocaleString()},t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e,t){let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},t[7]=h):h=t[7];let g=h,_;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=_):_=t[8];let v=_,y;t[9]!==o||t[10]!==f.messages||t[11]!==s?(y=function(){f.messages&&o<f.messages.length-1&&s(o+1)},t[9]=o,t[10]=f.messages,t[11]=s,t[12]=y):y=t[12];let b=y,C;t[13]!==o||t[14]!==s?(C=function(){o>0&&s(o-1)},t[13]=o,t[14]=s,t[15]=C):C=t[15];let w=C;if(!f.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,W.jsx)(`h3`,{className:z.emptyStateTitle,children:`No history`}),(0,W.jsx)(`p`,{className:z.bodyMuted,children:`No conversation history found for this thread.`})]})}),t[16]=e):e=t[16],e}let T=o===0,E;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,W.jsx)(u,{className:`h-4 w-4 mr-1`}),t[17]=E):E=t[17];let D;t[18]!==w||t[19]!==T?(D=(0,W.jsx)(A,{variant:`outline`,size:`sm`,onClick:w,disabled:T,children:E}),t[18]=w,t[19]=T,t[20]=D):D=t[20];let O=o>=f.messages.length-1,k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,W.jsx)(ee,{className:`h-4 w-4 ml-1`}),t[21]=k):k=t[21];let j;t[22]!==b||t[23]!==O?(j=(0,W.jsx)(A,{variant:`outline`,size:`sm`,onClick:b,disabled:O,children:k}),t[22]=b,t[23]=O,t[24]=j):j=t[24];let N;t[25]!==D||t[26]!==j?(N=(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,j]}),t[25]=D,t[26]=j,t[27]=N):N=t[27];let te=o+1,P;t[28]!==f.messages.length||t[29]!==te?(P=(0,W.jsxs)(`div`,{className:z.bodyMuted,children:[te,` of `,f.messages.length,` messages`]}),t[28]=f.messages.length,t[29]=te,t[30]=P):P=t[30];let F;t[31]!==N||t[32]!==P?(F=(0,W.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,W.jsx)(mr,{children:(0,W.jsxs)(_r,{children:[(0,W.jsx)(Q,{children:`Prompt`}),(0,W.jsx)(Q,{children:`Answer`}),(0,W.jsx)(Q,{className:`w-24`,children:`Model`}),(0,W.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,W.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,W.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,W.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[34]=I):I=t[34];let L;if(t[35]!==o||t[36]!==f.messages){let e;t[38]===o?e=t[39]:(e=(e,t)=>{let{inputTokens:r,outputTokens:i}=v(e);return(0,W.jsxs)(_r,{className:t===o?`bg-muted/50`:``,children:[(0,W.jsx)($,{className:`max-w-md`,children:(0,W.jsx)(`div`,{className:z.body,children:(0,W.jsx)(xr,{text:e.request.message})})}),(0,W.jsx)($,{className:`max-w-md`,children:e.response?(0,W.jsx)(`div`,{className:z.body,children:(0,W.jsx)(xr,{text:e.response.content})}):(0,W.jsx)(`span`,{className:S(z.bodyMuted,`italic`),children:`No response`})}),(0,W.jsx)($,{children:(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(c,{className:`h-3 w-3 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,W.jsx)($,{className:S(z.caption,`text-right`),children:e.response?(0,W.jsx)(n,{children:(0,W.jsxs)(M,{children:[(0,W.jsx)(ne,{asChild:!0,children:(0,W.jsx)(`div`,{className:`cursor-help`,children:g(e.timestamp,e.response.completedAt).display})}),(0,W.jsx)(x,{children:(0,W.jsx)(`p`,{children:g(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,W.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:i>0?i.toLocaleString():`-`}),(0,W.jsx)($,{className:S(z.bodyMuted,`text-right`),children:m(e.timestamp)})]},e.id)},t[38]=o,t[39]=e),L=f.messages.map(e),t[35]=o,t[36]=f.messages,t[37]=L}else L=t[37];let R;t[40]===L?R=t[41]:(R=(0,W.jsx)(oe,{className:`h-full`,children:(0,W.jsx)(`div`,{className:`py-4`,children:(0,W.jsxs)(pr,{children:[I,(0,W.jsx)(hr,{children:L})]})})}),t[40]=L,t[41]=R);let re;return t[42]!==F||t[43]!==R?(re=(0,W.jsxs)(W.Fragment,{children:[F,R]}),t[42]=F,t[43]=R,t[44]=re):re=t[44],re}var Dr=(0,U.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,U.useState)(0),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(0),[v,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(null),C=(0,U.useMemo)(()=>l?{type:`thread`,threadId:l}:s===br?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,l]),w=C?wr(C,h):null;(0,U.useEffect)(()=>{e&&n?n.type===`thread`?(u(n.id),c(``),o(0)):n.type===`project`&&(c(n.id),u(``),o(0)):e&&!n?(c(br),u(``),o(0)):e||(u(``),c(``),o(0),S(null),b(null))},[e,n]);let T=e=>{u(e),c(``),o(0),b(null),S(null)},E=e=>{c(e),u(``),o(0),b(null),S(null)},D=(0,U.useCallback)(()=>{if(l){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===l),t=r.find(e=>e.threads.some(e=>e.threadId===l)),n=e?Sr(e,t?.name??t?.projectId??``):l;return{options:{threadId:l},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(s&&s!==br){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[r,s,l]),O=(0,U.useCallback)(async()=>{let e=D();m(!0),S(null);try{await _(e.options),w&&rr(w),b(w),o(0),f(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{m(!1)}},[D,w]);function ee(){C&&rr(wr(C,h)),g(e=>e+1),b(null),S(null)}let k=D();if(!e)return null;let j=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Hn,{value:s,onValueChange:E,children:[(0,W.jsx)(Wn,{className:`w-48`,children:(0,W.jsx)(Un,{placeholder:`Select project`})}),(0,W.jsxs)(qn,{children:[(0,W.jsx)(Yn,{value:br,children:`All Projects`}),r.map(e=>(0,W.jsx)(Yn,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,W.jsxs)(Hn,{value:l,onValueChange:T,children:[(0,W.jsx)(Wn,{className:`w-48`,children:(0,W.jsx)(Un,{placeholder:`Select thread`})}),(0,W.jsx)(qn,{children:r.flatMap(e=>e.threads.map(t=>(0,W.jsx)(Yn,{value:t.threadId,children:Sr(t,e.name??e.projectId)},t.threadId)))})]}),(0,W.jsxs)(A,{variant:`outline`,size:`sm`,onClick:()=>f(!0),disabled:p,children:[(0,W.jsx)(y,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),M=(0,W.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,W.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,W.jsx)(ut,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[j,i?null:(0,W.jsx)(A,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,W.jsx)(_e,{})})]})})}),(0,W.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,W.jsxs)(or,{className:`max-w-md`,children:[(0,W.jsx)(sr,{children:(0,W.jsx)(cr,{className:`text-destructive`,children:`Error`})}),(0,W.jsxs)(ur,{className:`space-y-4`,children:[(0,W.jsx)(`p`,{children:x}),(0,W.jsx)(A,{onClick:()=>S(null),children:`Dismiss`})]})]})}):v&&v===w?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,W.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,W.jsx)(`h3`,{className:z.emptyStateTitle,children:`No history`}),(0,W.jsx)(`p`,{className:z.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,W.jsx)(fr,{fallbackTitle:`Failed to load conversation history`,onRetry:ee,children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`}),children:(0,W.jsx)(Er,{scope:C,projects:r,loadVersion:h,currentPromptIndex:a,onPromptIndexChange:o},w??void 0)})}):(0,W.jsx)(Zn,{label:`Loading conversation history...`,size:`lg`})})]});return(0,W.jsxs)(W.Fragment,{children:[i?(0,W.jsx)(pt,{children:(0,W.jsx)(st,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:M})}):(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:M}),(0,W.jsx)(Ze,{open:d,onOpenChange:f,children:(0,W.jsxs)(et,{children:[(0,W.jsxs)(tt,{children:[(0,W.jsx)(rt,{children:k.title}),(0,W.jsx)(it,{children:k.description})]}),(0,W.jsxs)(nt,{children:[(0,W.jsx)(ot,{disabled:p,children:`Cancel`}),(0,W.jsx)(at,{onClick:e=>{e.preventDefault(),O()},disabled:p,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:p?`Clearing...`:`Clear`})]})]})})]})});export{ot as A,dt as C,pt as D,st as E,rt as F,it as M,nt as N,Ze as O,tt as P,ut as S,mt as T,vt as _,ar as a,gt as b,er as c,Hn as d,qn as f,Un as g,Wn as h,ur as i,et as j,at as k,Zn as l,Xn as m,fr as n,rr as o,Yn as p,or as r,ir as s,yr as t,Qn as u,ct as v,ht as w,ft as x,lt as y};