tarsk 0.5.40 → 0.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +224 -15
- package/dist/public/assets/{account-view-BT90zNSx.js → account-view-D-dJ0y-D.js} +1 -1
- package/dist/public/assets/{api-DWU0D34A.js → api-DJaJqkc6.js} +1 -1
- package/dist/public/assets/{browser-tab-Bp486a9f.js → browser-tab-D7wEj-BD.js} +1 -1
- package/dist/public/assets/{commit-dialog-90PGbqs8.js → commit-dialog-DdhGDH4F.js} +1 -1
- package/dist/public/assets/{context-menu-C7FTMa2c.js → context-menu-asf2g-KX.js} +1 -1
- package/dist/public/assets/{create-repo-dialog-BkUdww3q.js → create-repo-dialog-Bltp6PKZ.js} +1 -1
- package/dist/public/assets/{dialogs-config-DZKtVbNK.js → dialogs-config-B-LZ4nOb.js} +1 -1
- package/dist/public/assets/{diff-view-B4G8vqZa.js → diff-view-Bi545EPj.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-DEQFid8r.js → explorer-tab-view-B-P555GE.js} +2 -2
- package/dist/public/assets/{explorer-tree-CPHGgahA.js → explorer-tree-CyXhVrI7.js} +1 -1
- package/dist/public/assets/{explorer-view-BTvhSMDQ.js → explorer-view-BAHDhIGN.js} +1 -1
- package/dist/public/assets/{git-history-dialog-Bqv0bD41.js → git-history-dialog-Bci_iQmi.js} +1 -1
- package/dist/public/assets/{git-ops-button-BnVMlOO3.js → git-ops-button-1lum9QXI.js} +2 -2
- package/dist/public/assets/{history-view-jX3PPID6.js → history-view-CAkN8PCo.js} +1 -1
- package/dist/public/assets/index-BLO68CQl.js +69 -0
- package/dist/public/assets/{mcp-server-card-CTCrhFIS.js → mcp-server-card-DQUpkDFV.js} +1 -1
- package/dist/public/assets/{merged-pr-dialog-B2qqrQ1g.js → merged-pr-dialog-tHPrJ2CK.js} +1 -1
- package/dist/public/assets/{onboarding-CxtzQldG.js → onboarding-Bbvb7kO4.js} +1 -1
- package/dist/public/assets/{project-settings-view-ZJjQbFbQ.js → project-settings-view-BRkHOq_q.js} +1 -1
- package/dist/public/assets/{providers-list-view-BH13AB_H.js → providers-list-view-Dex879vv.js} +1 -1
- package/dist/public/assets/{pull-request-dialog-ZzVXh6M9.js → pull-request-dialog-WHdmrW83.js} +1 -1
- package/dist/public/assets/{pull-with-changes-dialog-LUgd2a4S.js → pull-with-changes-dialog-Ck3OwINV.js} +1 -1
- package/dist/public/assets/{push-before-pr-dialog-CFmgu9H_.js → push-before-pr-dialog-Bvqvz04U.js} +1 -1
- package/dist/public/assets/{radio-group-Bd8YbtFD.js → radio-group-B0xvu5B9.js} +1 -1
- package/dist/public/assets/{react-vendor-Ba8DSNiO.js → react-vendor-D8PTA4EX.js} +1 -1
- package/dist/public/assets/{settings-general-view-C8muiP_K.js → settings-general-view-lUxshNA9.js} +1 -1
- package/dist/public/assets/{settings-instructions-view-CV7lRPuw.js → settings-instructions-view-C57XGLha.js} +1 -1
- package/dist/public/assets/{settings-list-CKPEGohm.js → settings-list-CHGKmGl_.js} +1 -1
- package/dist/public/assets/{settings-mcp-servers-view-3gN9ly3z.js → settings-mcp-servers-view-DpqkhrgB.js} +1 -1
- package/dist/public/assets/{settings-models-skeleton-l966LEN8.js → settings-models-skeleton-ClrbJy_p.js} +1 -1
- package/dist/public/assets/{settings-models-view-CAMouMhE.js → settings-models-view-QPEdnibD.js} +1 -1
- package/dist/public/assets/{settings-rules-view-BnazfbJb.js → settings-rules-view-WJU--cRq.js} +1 -1
- package/dist/public/assets/{settings-skills-view-DpzKFcpf.js → settings-skills-view-mgHy4G_g.js} +1 -1
- package/dist/public/assets/{settings-slash-commands-view-Drje2Dl4.js → settings-slash-commands-view-LB5tVqy1.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-D05kHO1W.js → settings-subagents-view-QR2qlA_y.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-DQmSdSnp.js → settings-system-prompt-view-Dl66VFaj.js} +1 -1
- package/dist/public/assets/{settings-view-B6e0GfSv.js → settings-view-BlVJv4Pz.js} +2 -2
- package/dist/public/assets/{skeleton-qzmFgKhS.js → skeleton-K-fVduHt.js} +1 -1
- package/dist/public/assets/{terminal-panel-BzCO142Q.js → terminal-panel-BGQxckfH.js} +1 -1
- package/dist/public/assets/{ui-components-f8jJJzEo.js → ui-components-C4RrfJEJ.js} +1 -1
- package/dist/public/assets/{utils-BlXPFbY9.js → utils-B7FQXlI6.js} +1 -1
- package/dist/public/index.html +6 -6
- package/dist/recommended-models.txt +1 -1
- package/package.json +1 -1
- package/dist/public/assets/index-DjD2SPNZ.js +0 -65
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ar as t,Ba as n,Ca as r,Dr as i,G as a,Ii as o,Mr as s,Or as c,Q as l,Ta as u,Ua as d,Ut as f,Va as p,c as m,ci as h,co as ee,fr as g,ga as _,ha as v,hr as y,it as b,ji as x,jr as S,kn as C,kt as w,pr as T,sa as E,so as D,ui as O,wi as k,xa as A,xo as j,yo as M}from"./dialogs-config-DZKtVbNK.js";import{C as N}from"./react-vendor-Ba8DSNiO.js";import{t as P}from"./monaco-CZnIWXyV.js";import{c as F}from"./onboarding-CxtzQldG.js";import{O as I,a as te,l as ne,n as L,o as re}from"./history-view-jX3PPID6.js";import{n as ie}from"./utils-BlXPFbY9.js";import{A as ae,D as oe,O as se,a as ce,i as le,j as ue,k as de,n as fe,p as pe,r as me,u as he}from"./index-DjD2SPNZ.js";import{a as R,n as z,r as ge,t as _e}from"./context-menu-C7FTMa2c.js";var B=e(j(),1),V=M(),H=x();function ve(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:k.sectionTitle,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,H.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,H.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,H.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,H.jsx)(m,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,H.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,H.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 ye(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 be={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},U={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function W(e){return O(O(k.compact,`status-badge font-mono font-semibold`),be[e]??`text-orange-500`)}function G(e){return U[e]??`M`}var xe=I(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,H.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,H.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),K=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),q=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,V.c)(32),{treeData:r,files:i,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:c}=e,l;t[0]===i?l=t[1]:(l=i.reduce(we,0),t[0]=i,t[1]=l);let u=l,f;t[2]===i?f=t[3]:(f=i.reduce(X,0),t[2]=i,t[3]=f);let m=f,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(k.compact,`text-muted-foreground`),t[4]=h):h=t[4];let ee=i.length,g=i.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=O(k.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=O(k.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==i.length||t[8]!==g||t[9]!==u||t[10]!==m?(y=(0,H.jsx)(xe,{v0:h,v1:ee,v2:g,v3:_,v4:u,v5:v,v6:m}),t[7]=i.length,t[8]=g,t[9]=u,t[10]=m,t[11]=y):y=t[11];let b=y;if(a){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=O(k.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===a?n=t[14]:(n=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:e,children:a})}),t[13]=a,t[14]=n);let r;return t[15]!==b||t[16]!==n?(r=(0,H.jsx)(K,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:n})}),t[15]=b,t[16]=n,t[17]=r):r=t[17],r}if(i.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:O(k.compact,k.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===b?n=t[20]:(n=(0,H.jsx)(Se,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:e})}),t[19]=b,t[20]=n),n}let x;t[21]!==i||t[22]!==s||t[23]!==c||t[24]!==o?(x=(e,t)=>{let{isOpen:r,toggle:a}=t,l=!!e.children,u=(0,H.jsxs)(F,{onClick:()=>{l?a():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===o,className:`gap-1.5`,children:[l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(D,{className:O(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,H.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!l&&e.status&&(0,H.jsx)(`span`,{className:W(e.status),children:G(e.status)})]});return l?u:(0,H.jsxs)(_e,{children:[(0,H.jsx)(R,{asChild:!0,children:u}),(0,H.jsx)(z,{children:(0,H.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&c?.(i[e.fileIndex])},children:[(0,H.jsx)(E,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=i,t[22]=s,t[23]=c,t[24]=o,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==r?(S=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(oe,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:x})}),t[26]=x,t[27]=r,t[28]=S):S=t[28];let C;return t[29]!==b||t[30]!==S?(C=(0,H.jsx)(q,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:S})}),t[29]=b,t[30]=S,t[31]=C):C=t[31],C};function J(e){return e.type===`add`}function Y(e,t){return e+t.changes.filter(J).length}function we(e,t){return e+t.hunks.reduce(Y,0)}function Te(e){return e.type===`delete`}function Ee(e,t){return e+t.changes.filter(Te).length}function X(e,t){return e+t.hunks.reduce(Ee,0)}function De(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(fe,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Oe(e){let n=(0,V.c)(36),{open:r,lineNumber:a,lineContent:o,initialComment:l,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,ee]=(0,B.useState)((l===void 0?``:l)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let y=v,b;n[5]===p?b=n[6]:(b=e=>{e||p()},n[5]=p,n[6]=b);let x;n[7]===a?x=n[8]:(x=(0,H.jsx)(S,{children:(0,H.jsxs)(s,{children:[`Comment on line `,a]})}),n[7]=a,n[8]=x);let C;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=O(k.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),n[9]=C):C=n[9];let w=o||` `,T;n[10]===w?T=n[11]:(T=(0,H.jsx)(`div`,{className:C,children:w}),n[10]=w,n[11]=T);let E;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>ee(e.target.value),n[12]=E):E=n[12];let D;n[13]!==y||n[14]!==m?(D=(0,H.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:E,onKeyDown:y,rows:12,className:`resize-none text-base`}),n[13]=y,n[14]=m,n[15]=D):D=n[15];let A;n[16]!==u||n[17]!==f?(A=u&&f&&(0,H.jsx)(h,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[16]=u,n[17]=f,n[18]=A):A=n[18];let j;n[19]===m?j=n[20]:(j=m.trim(),n[19]=m,n[20]=j);let M=!j,N;n[21]!==_||n[22]!==M?(N=(0,H.jsx)(h,{size:`sm`,onClick:_,disabled:M,children:`Save`}),n[21]=_,n[22]=M,n[23]=N):N=n[23];let P;n[24]!==A||n[25]!==N?(P=(0,H.jsxs)(t,{className:`gap-2 sm:gap-0`,children:[A,N]}),n[24]=A,n[25]=N,n[26]=P):P=n[26];let F;n[27]!==D||n[28]!==P||n[29]!==x||n[30]!==T?(F=(0,H.jsxs)(c,{className:`max-w-2xl`,children:[x,T,D,P]}),n[27]=D,n[28]=P,n[29]=x,n[30]=T,n[31]=F):F=n[31];let I;return n[32]!==r||n[33]!==F||n[34]!==b?(I=(0,H.jsx)(i,{open:r,onOpenChange:b,children:F}),n[32]=r,n[33]=F,n[34]=b,n[35]=I):I=n[35],I}function ke(e,t){return`git-diff:${e}:${t}`}function Ae({threadId:e,onExit:t,loadVersion:n}){let i=te(ke(e,n),()=>b(e)),s=ae(),c=ue(e=>e.diffComments),d=ue(e=>e.projectModelSelections),{resolvedTheme:p}=ie(),m=pe(),[x,S]=(0,B.useState)(i.files||[]),[E,j]=(0,B.useState)(null),[M,F]=(0,B.useState)(0),[I,ne]=(0,B.useState)(!1),[L,re]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(!1),[fe,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ge=(0,B.useCallback)(e=>{F(e),m&&R(!1)},[m]),_e=(0,B.useCallback)(()=>{R(!0)},[]),V=m&&!fe,ve=m&&fe,be=m&&!fe,U=(0,B.useMemo)(()=>c[e]??[],[c,e]),W=(0,B.useCallback)(t=>{let n=c[e]??[],r=typeof t==`function`?t(n):t;s({type:de.SetDiffComments,threadId:e,comments:r})},[s,e,c]),[G,xe]=(0,B.useState)(null),[K,Se]=(0,B.useState)(null),[q,J]=(0,B.useState)(null),Y=(0,B.useRef)(null),we=(0,B.useRef)(U),Te=(0,B.useRef)(G),Ee=(0,B.useRef)({isFullView:I,selectedFileIndex:M,files:x}),X=(0,B.useRef)({original:[],modified:[]}),Ae=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=U},[U]),(0,B.useEffect)(()=>{Te.current=G},[G]),(0,B.useEffect)(()=>{Ee.current={isFullView:I,selectedFileIndex:M,files:x}},[I,M,x]);let je=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Me=(0,B.useCallback)(async()=>{if(e){j(null);try{S((await b(e)).files||[]),F(0)}catch(e){j(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ne=(0,B.useCallback)(async t=>{try{await f(e,t.path),await Me()}catch(e){j(e instanceof Error?e.message:`Failed to revert file`)}},[e,Me]),Pe=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((c[e]??[]).length>0){Pe.current=!0;return}w(e).then(t=>{t.diffComments&&t.diffComments.length>0&&s({type:de.SetDiffComments,threadId:e,comments:t.diffComments}),Pe.current=!0}).catch(()=>{Pe.current=!0})},[e]),(0,B.useEffect)(()=>{Pe.current&&C(e,{diffComments:U}).catch(()=>{})},[e,U]);let Fe=(0,B.useMemo)(()=>ye(x),[x]),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}},Ie=(e,t,n)=>e.split(`
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ar as t,Ba as n,Ca as r,Dr as i,G as a,Ii as o,Mr as s,Or as c,Q as l,Ta as u,Ua as d,Ut as f,Va as p,c as m,ci as h,co as ee,fr as g,ga as _,ha as v,hr as y,it as b,ji as x,jr as S,kn as C,kt as w,pr as T,sa as E,so as D,ui as O,wi as k,xa as A,xo as j,yo as M}from"./dialogs-config-B-LZ4nOb.js";import{C as N}from"./react-vendor-D8PTA4EX.js";import{t as P}from"./monaco-CZnIWXyV.js";import{c as F}from"./onboarding-Bbvb7kO4.js";import{O as I,a as te,l as ne,n as L,o as re}from"./history-view-CAkN8PCo.js";import{n as ie}from"./utils-B7FQXlI6.js";import{A as ae,D as oe,O as se,a as ce,i as le,j as ue,k as de,n as fe,p as pe,r as me,u as he}from"./index-BLO68CQl.js";import{a as R,n as z,r as ge,t as _e}from"./context-menu-asf2g-KX.js";var B=e(j(),1),V=M(),H=x();function ve(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:k.sectionTitle,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,H.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,H.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,H.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,H.jsx)(m,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,H.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,H.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 ye(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 be={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},U={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function W(e){return O(O(k.compact,`status-badge font-mono font-semibold`),be[e]??`text-orange-500`)}function G(e){return U[e]??`M`}var xe=I(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,H.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,H.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),K=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),q=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,V.c)(32),{treeData:r,files:i,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:c}=e,l;t[0]===i?l=t[1]:(l=i.reduce(we,0),t[0]=i,t[1]=l);let u=l,f;t[2]===i?f=t[3]:(f=i.reduce(X,0),t[2]=i,t[3]=f);let m=f,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(k.compact,`text-muted-foreground`),t[4]=h):h=t[4];let ee=i.length,g=i.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=O(k.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=O(k.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==i.length||t[8]!==g||t[9]!==u||t[10]!==m?(y=(0,H.jsx)(xe,{v0:h,v1:ee,v2:g,v3:_,v4:u,v5:v,v6:m}),t[7]=i.length,t[8]=g,t[9]=u,t[10]=m,t[11]=y):y=t[11];let b=y;if(a){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=O(k.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===a?n=t[14]:(n=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:e,children:a})}),t[13]=a,t[14]=n);let r;return t[15]!==b||t[16]!==n?(r=(0,H.jsx)(K,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:n})}),t[15]=b,t[16]=n,t[17]=r):r=t[17],r}if(i.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:O(k.compact,k.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===b?n=t[20]:(n=(0,H.jsx)(Se,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:e})}),t[19]=b,t[20]=n),n}let x;t[21]!==i||t[22]!==s||t[23]!==c||t[24]!==o?(x=(e,t)=>{let{isOpen:r,toggle:a}=t,l=!!e.children,u=(0,H.jsxs)(F,{onClick:()=>{l?a():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===o,className:`gap-1.5`,children:[l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(D,{className:O(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,H.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!l&&e.status&&(0,H.jsx)(`span`,{className:W(e.status),children:G(e.status)})]});return l?u:(0,H.jsxs)(_e,{children:[(0,H.jsx)(R,{asChild:!0,children:u}),(0,H.jsx)(z,{children:(0,H.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&c?.(i[e.fileIndex])},children:[(0,H.jsx)(E,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=i,t[22]=s,t[23]=c,t[24]=o,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==r?(S=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(oe,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:x})}),t[26]=x,t[27]=r,t[28]=S):S=t[28];let C;return t[29]!==b||t[30]!==S?(C=(0,H.jsx)(q,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:S})}),t[29]=b,t[30]=S,t[31]=C):C=t[31],C};function J(e){return e.type===`add`}function Y(e,t){return e+t.changes.filter(J).length}function we(e,t){return e+t.hunks.reduce(Y,0)}function Te(e){return e.type===`delete`}function Ee(e,t){return e+t.changes.filter(Te).length}function X(e,t){return e+t.hunks.reduce(Ee,0)}function De(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(fe,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Oe(e){let n=(0,V.c)(36),{open:r,lineNumber:a,lineContent:o,initialComment:l,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,ee]=(0,B.useState)((l===void 0?``:l)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let y=v,b;n[5]===p?b=n[6]:(b=e=>{e||p()},n[5]=p,n[6]=b);let x;n[7]===a?x=n[8]:(x=(0,H.jsx)(S,{children:(0,H.jsxs)(s,{children:[`Comment on line `,a]})}),n[7]=a,n[8]=x);let C;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=O(k.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),n[9]=C):C=n[9];let w=o||` `,T;n[10]===w?T=n[11]:(T=(0,H.jsx)(`div`,{className:C,children:w}),n[10]=w,n[11]=T);let E;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>ee(e.target.value),n[12]=E):E=n[12];let D;n[13]!==y||n[14]!==m?(D=(0,H.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:E,onKeyDown:y,rows:12,className:`resize-none text-base`}),n[13]=y,n[14]=m,n[15]=D):D=n[15];let A;n[16]!==u||n[17]!==f?(A=u&&f&&(0,H.jsx)(h,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[16]=u,n[17]=f,n[18]=A):A=n[18];let j;n[19]===m?j=n[20]:(j=m.trim(),n[19]=m,n[20]=j);let M=!j,N;n[21]!==_||n[22]!==M?(N=(0,H.jsx)(h,{size:`sm`,onClick:_,disabled:M,children:`Save`}),n[21]=_,n[22]=M,n[23]=N):N=n[23];let P;n[24]!==A||n[25]!==N?(P=(0,H.jsxs)(t,{className:`gap-2 sm:gap-0`,children:[A,N]}),n[24]=A,n[25]=N,n[26]=P):P=n[26];let F;n[27]!==D||n[28]!==P||n[29]!==x||n[30]!==T?(F=(0,H.jsxs)(c,{className:`max-w-2xl`,children:[x,T,D,P]}),n[27]=D,n[28]=P,n[29]=x,n[30]=T,n[31]=F):F=n[31];let I;return n[32]!==r||n[33]!==F||n[34]!==b?(I=(0,H.jsx)(i,{open:r,onOpenChange:b,children:F}),n[32]=r,n[33]=F,n[34]=b,n[35]=I):I=n[35],I}function ke(e,t){return`git-diff:${e}:${t}`}function Ae({threadId:e,onExit:t,loadVersion:n}){let i=te(ke(e,n),()=>b(e)),s=ae(),c=ue(e=>e.diffComments),d=ue(e=>e.projectModelSelections),{resolvedTheme:p}=ie(),m=pe(),[x,S]=(0,B.useState)(i.files||[]),[E,j]=(0,B.useState)(null),[M,F]=(0,B.useState)(0),[I,ne]=(0,B.useState)(!1),[L,re]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(!1),[fe,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ge=(0,B.useCallback)(e=>{F(e),m&&R(!1)},[m]),_e=(0,B.useCallback)(()=>{R(!0)},[]),V=m&&!fe,ve=m&&fe,be=m&&!fe,U=(0,B.useMemo)(()=>c[e]??[],[c,e]),W=(0,B.useCallback)(t=>{let n=c[e]??[],r=typeof t==`function`?t(n):t;s({type:de.SetDiffComments,threadId:e,comments:r})},[s,e,c]),[G,xe]=(0,B.useState)(null),[K,Se]=(0,B.useState)(null),[q,J]=(0,B.useState)(null),Y=(0,B.useRef)(null),we=(0,B.useRef)(U),Te=(0,B.useRef)(G),Ee=(0,B.useRef)({isFullView:I,selectedFileIndex:M,files:x}),X=(0,B.useRef)({original:[],modified:[]}),Ae=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=U},[U]),(0,B.useEffect)(()=>{Te.current=G},[G]),(0,B.useEffect)(()=>{Ee.current={isFullView:I,selectedFileIndex:M,files:x}},[I,M,x]);let je=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Me=(0,B.useCallback)(async()=>{if(e){j(null);try{S((await b(e)).files||[]),F(0)}catch(e){j(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ne=(0,B.useCallback)(async t=>{try{await f(e,t.path),await Me()}catch(e){j(e instanceof Error?e.message:`Failed to revert file`)}},[e,Me]),Pe=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((c[e]??[]).length>0){Pe.current=!0;return}w(e).then(t=>{t.diffComments&&t.diffComments.length>0&&s({type:de.SetDiffComments,threadId:e,comments:t.diffComments}),Pe.current=!0}).catch(()=>{Pe.current=!0})},[e]),(0,B.useEffect)(()=>{Pe.current&&C(e,{diffComments:U}).catch(()=>{})},[e,U]);let Fe=(0,B.useMemo)(()=>ye(x),[x]),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}},Ie=(e,t,n)=>e.split(`
|
|
2
2
|
`).slice(t-1,n).join(`
|
|
3
3
|
`),Le=e=>{let t=Z(e);return t?t.startLine<=1:!0},Re=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=x[M],ze=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Be=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!Ae.current)return;let e=Y.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Ee.current,i=we.current,a=Te.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:P.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:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?X.current.original:X.current.modified,m=e.deltaDecorations(p,d);r===`original`?X.current.original=m:X.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,U,G,M,I,Q]),(0,B.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[M]),(0,B.useEffect)(()=>()=>{Ae.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let Ve=(0,B.useCallback)(e=>{Y.current=e;let t=e=>e===P.MouseTargetType.GUTTER_GLYPH_MARGIN||e===P.MouseTargetType.GUTTER_LINE_NUMBERS||e===P.MouseTargetType.GUTTER_LINE_DECORATIONS||e===P.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}=Ee.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=we.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?J(f):Se({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{Y.current===e&&$()},150)},[$]),He=(0,B.useCallback)(e=>{if(K&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:M,lineNumber:K.lineNumber,lineContent:K.lineContent,comment:e,side:K.side};W(e=>[...e,t]),Se(null)}else q&&(W(t=>t.map(t=>t.id===q.id?{...t,comment:e}:t)),J(null))},[K,q,Q,M,W]),Ue=(0,B.useCallback)(()=>{q&&(W(e=>e.filter(e=>e.id!==q.id)),J(null))},[q,W]),We=(0,B.useCallback)(e=>{if(U.length===0)return;let t=(e%U.length+U.length)%U.length,n=U[t];xe(t),F(n.fileIndex),m&&R(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=x[n.fileIndex];if(!t)return;let r=I?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)},[U,x,I,$,m]),Ge=(0,B.useCallback)(()=>{We((G??0)-1)},[We,G]),Ke=(0,B.useCallback)(()=>{We((G??-1)+1)},[We,G]),qe=(0,B.useCallback)(async()=>{let n=d[e];if(!n)try{let e=await l(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:n}=await a(e,U);W([]),s({type:de.SetPendingChatMessage,message:{threadId:e,message:n,model:r,provider:i}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[U,d,s,e,t,W]),Je={readOnly:!0,renderSideBySide:!m,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Le(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(le,{direction:`horizontal`,children:[(0,H.jsx)(me,{ref:z,defaultSize:m?100:25,minSize:m?50:12,maxSize:m?100:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:O(`border-r border-transparent`,V&&`hidden`),children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(Ce,{treeData:Fe,files:x,error:E,selectedFileIndex:M,onFileSelect:ge,onRevertFile:Ne})})}),!m&&(0,H.jsx)(De,{isOpen:!L}),(0,H.jsx)(me,{className:O(`overflow-hidden bg-transparent`,ve&&`hidden`),children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(ce,{className:O(`bg-transparent`,L&&`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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[be?(0,H.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:_e,children:[(0,H.jsx)(v,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:je,children:[L?(0,H.jsx)(v,{className:`h-4 w-4`}):(0,H.jsx)(_,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:O(k.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:O(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(h,{variant:`ghost`,size:`sm`,onClick:()=>ne(e=>!e),disabled:!Q,className:O(k.compact,`h-8 gap-1 px-2`),children:I?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(A,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{className:`h-3 w-3`}),` Show full file`]})}),U.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ge,disabled:(G??0)===0,children:(0,H.jsx)(ee,{className:`h-3 w-3`})})}),(0,H.jsx)(T,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:O(k.caption,`whitespace-nowrap`),children:U.length===1?`1 Comment`:`Comment ${(G??0)+1} of ${U.length}`}),(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(G??0)===U.length-1,children:(0,H.jsx)(D,{className:`h-3 w-3`})})}),(0,H.jsx)(T,{children:`Next comment`})]})]}),U.length>0&&(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsxs)(h,{size:`sm`,onClick:qe,className:O(k.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(r,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(T,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(N,{height:`100%`,language:Re(Q?.path||``),original:ze,modified:Be,theme:p===`dark`?`vs-dark`:`vs-light`,onMount:Ve,options:Je},`diff-${M}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[oe&&(0,H.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,H.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>se(!1),children:[(0,H.jsx)(o,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(he,{})]}),!oe&&(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsxs)(h,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>se(!0),children:[(0,H.jsx)(r,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(T,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,H.jsx)(Oe,{open:K!==null||q!==null,lineNumber:q?.lineNumber??K?.lineNumber??0,lineContent:q?.lineContent??K?.lineContent??``,initialComment:q?.comment,isEditing:q!==null,onSave:He,onDelete:Ue,onClose:()=>{Se(null),J(null)}},`${q?.id??``}-${K?.lineNumber??``}-${K?.side??``}`)]})}function je(e){let t=(0,V.c)(11),[n,r]=(0,B.useState)(0),i;t[0]!==n||t[1]!==e.threadId?(i=function(){re(ke(e.threadId,n)),r(Me)},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,H.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,H.jsx)(B.Suspense,{fallback:o,children:(0,H.jsx)(Ae,{...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,H.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:a,children:c}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function Me(e){return e+1}export{je as DiffView,je as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as ee,ji as t,ui as n,wi as r,xo as i,yo as a}from"./dialogs-config-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-CyXhVrI7.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BLO68CQl.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CAkN8PCo.js","assets/dialogs-config-B-LZ4nOb.js","assets/onboarding-Bbvb7kO4.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-D8PTA4EX.js","assets/utils-B7FQXlI6.js","assets/index-jIBJk8xl.css","assets/api-DJaJqkc6.js","assets/context-menu-asf2g-KX.js","assets/ui-components-C4RrfJEJ.js","assets/explorer-view-BAHDhIGN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as ee,ji as t,ui as n,wi as r,xo as i,yo as a}from"./dialogs-config-B-LZ4nOb.js";import{r as o}from"./monaco-CZnIWXyV.js";import{l as s,u as c}from"./history-view-CAkN8PCo.js";import{C as l,i as u,j as d,n as f,p,r as m}from"./index-BLO68CQl.js";var h=a(),g=e(i(),1),_=t(),v=(0,g.lazy)(()=>o(()=>import(`./explorer-tree-CyXhVrI7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>o(()=>import(`./explorer-view-BAHDhIGN.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(44),t=d(x),i=p(),[a,o]=(0,g.useState)(null),[b,S]=(0,g.useState)(!0),{pendingExplorerPath:C,setPendingExplorerPath:w,explorerClearPath:T,setExplorerClearPath:E}=l(),D;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{S(!0)},e[0]=D):D=e[0];let O;e[1]===t?O=e[2]:(O=[t],e[1]=t,e[2]=O),(0,g.useEffect)(D,O);let k;e[3]===i?k=e[4]:(k=e=>{o(e),i&&S(!1)},e[3]=i,e[4]=k);let A=k,j;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{S(!0)},e[5]=j):j=e[5];let M=j,N,P;e[6]!==i||e[7]!==C||e[8]!==w?(N=()=>{C&&(o({name:C.split(`/`).pop()??C,path:C,type:`file`}),i&&S(!1),w(null))},P=[i,C,w],e[6]=i,e[7]=C,e[8]=w,e[9]=N,e[10]=P):(N=e[9],P=e[10]),(0,g.useEffect)(N,P);let F,I;e[11]!==T||e[12]!==i||e[13]!==a||e[14]!==E?(F=()=>{T&&(a&&(a.path===T||a.path.startsWith(T+`/`))&&(o(null),i&&S(!0)),E(null))},I=[T,i,a,E],e[11]=T,e[12]=i,e[13]=a,e[14]=E,e[15]=F,e[16]=I):(F=e[15],I=e[16]),(0,g.useEffect)(F,I);let L=i&&!b,R=i&&b,z=i?100:25,B=i?50:15,V=i?100:50,H=L&&`hidden`,U;e[17]===H?U=e[18]:(U=n(`overflow-hidden border-r border-border`,H),e[17]=H,e[18]=U);let W;e[19]!==A||e[20]!==a?.path||e[21]!==t?(W=(0,_.jsx)(ee,{className:`h-full`,children:t?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(c,{}),children:(0,_.jsx)(v,{threadId:t,selectedPath:a?.path??null,onNodeSelect:A})}):(0,_.jsx)(`p`,{className:n(r.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=A,e[20]=a?.path,e[21]=t,e[22]=W):W=e[22];let G;e[23]!==V||e[24]!==U||e[25]!==W||e[26]!==z||e[27]!==B?(G=(0,_.jsx)(m,{defaultSize:z,minSize:B,maxSize:V,className:U,children:W}),e[23]=V,e[24]=U,e[25]=W,e[26]=z,e[27]=B,e[28]=G):G=e[28];let K;e[29]===i?K=e[30]:(K=!i&&(0,_.jsx)(f,{withHandle:!0}),e[29]=i,e[30]=K);let q=R&&`hidden`,J;e[31]===q?J=e[32]:(J=n(`overflow-hidden`,q),e[31]=q,e[32]=J);let Y;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,_.jsx)(s,{}),e[33]=Y):Y=e[33];let X=i&&!b,Z;e[34]!==a||e[35]!==X?(Z=(0,_.jsx)(g.Suspense,{fallback:Y,children:(0,_.jsx)(y,{selectedFile:a,showTreeBackButton:X,onShowTree:M})}),e[34]=a,e[35]=X,e[36]=Z):Z=e[36];let Q;e[37]!==J||e[38]!==Z?(Q=(0,_.jsx)(m,{className:J,children:Z}),e[37]=J,e[38]=Z,e[39]=Q):Q=e[39];let $;return e[40]!==G||e[41]!==K||e[42]!==Q?($=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(u,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[G,K,Q]})}),e[40]=G,e[41]=K,e[42]=Q,e[43]=$):$=e[43],$}function x(e){return e.selectedThreadId}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Er as n,Ua as r,Va as i,ji as a,lo as o,ra as s,so as c,ui as l,wi as u,xo as d,yo as f}from"./dialogs-config-DZKtVbNK.js";import{c as p}from"./onboarding-CxtzQldG.js";import{A as m,I as h,M as g,N 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-jX3PPID6.js";import{C as T,E,b as D,x as ee,y as O}from"./index-DjD2SPNZ.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-C7FTMa2c.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-DWU0D34A.js";import{t as z}from"./ui-components-f8jJJzEo.js";var B=f(),V=e(d(),1),H=a(),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 a;n[3]===r?a=n[4]:(a=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.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,H.jsx)(s,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=l(`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`,r),n[4]=r,n[5]=o);let c;return n[6]!==i||n[7]!==t||n[8]!==o?(c=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,H.jsx)(z.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});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 a;n[3]===r?a=n[4]:(a=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=l(u.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 a;n[3]===r?a=n[4]:(a=l(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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 a;n[3]===r?a=n[4]:(a=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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 a;n[3]===r?a=n[4]:(a=l(l(u.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=l(u.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};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 i=(0,B.c)(38),{items:a,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;i[0]===s?x=i[1]:(x=function(){h.current||(h.current=!0,s())},i[0]=s,i[1]=x);let S=x,C;i[2]!==b||i[3]!==a?(C=Q(a,re(b),b),i[2]=b,i[3]=a,i[4]=C):C=i[4];let w=C,T,E;i[5]!==c||i[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],i[5]=c,i[6]=v,i[7]=T,i[8]=E):(T=i[7],E=i[8]),(0,V.useEffect)(T,E);let k;i[9]===c?k=i[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},i[9]=c,i[10]=k);let A=k,j;i[11]!==c||i[12]!==d?(j=function(e){d(e),_(!1),c(!1),y(``)},i[11]=c,i[12]=d,i[13]=j):j=i[13];let M=j,N;i[14]===S?N=i[15]:(N=e=>{S(),y(e.target.value)},i[14]=S,i[15]=N);let P;i[16]!==v||i[17]!==S||i[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(n,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),i[16]=v,i[17]=S,i[18]=N,i[19]=P):P=i[19];let F;i[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=l(u.compact,`py-4`),i[20]=F):F=i[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;i[21]===I?L=i[22]:(L=(0,H.jsx)(K,{className:F,children:I}),i[21]=I,i[22]=L);let R;if(i[23]!==M||i[24]!==w){let e;i[26]===M?e=i[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)(r,{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:l(u.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),i[26]=M,i[27]=e),R=w.map(e),i[23]=M,i[24]=w,i[25]=R}else R=i[25];let z;i[28]===R?z=i[29]:(z=(0,H.jsx)(q,{children:R}),i[28]=R,i[29]=z);let W;i[30]!==L||i[31]!==z?(W=(0,H.jsx)(D,{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]})})}),i[30]=L,i[31]=z,i[32]=W):W=i[32];let J;return i[33]!==A||i[34]!==g||i[35]!==W||i[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),i[33]=A,i[34]=g,i[35]=W,i[36]=P,i[37]=J):J=i[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:n,level:a,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=u.has(n.path),D=f===n.path,ee=m?.dirPath===n.path&&E;return n.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:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(n)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(o,{className:`h-3 w-3`}):(0,H.jsx)(c,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(i,{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:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,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)(i,{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:n.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:n.path,version:d(n.path),children:n=>(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)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),n.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,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(n.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(n.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),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:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:()=>g(n),children:[(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,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:n.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:n,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)(r,{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)(x,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(_,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(b,{children:`Cancel`}),(0,H.jsx)(m,{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:n,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
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Er as n,Ua as r,Va as i,ji as a,lo as o,ra as s,so as c,ui as l,wi as u,xo as d,yo as f}from"./dialogs-config-B-LZ4nOb.js";import{c as p}from"./onboarding-Bbvb7kO4.js";import{A as m,I as h,M as g,N 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-CAkN8PCo.js";import{C as T,E,b as D,x as ee,y as O}from"./index-BLO68CQl.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-asf2g-KX.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-DJaJqkc6.js";import{t as z}from"./ui-components-C4RrfJEJ.js";var B=f(),V=e(d(),1),H=a(),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 a;n[3]===r?a=n[4]:(a=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.forwardRef((e,t)=>{let n=(0,B.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,H.jsx)(s,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=l(`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`,r),n[4]=r,n[5]=o);let c;return n[6]!==i||n[7]!==t||n[8]!==o?(c=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,H.jsx)(z.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});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 a;n[3]===r?a=n[4]:(a=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=l(u.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 a;n[3]===r?a=n[4]:(a=l(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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 a;n[3]===r?a=n[4]:(a=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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 a;n[3]===r?a=n[4]:(a=l(l(u.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});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=l(u.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};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 i=(0,B.c)(38),{items:a,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;i[0]===s?x=i[1]:(x=function(){h.current||(h.current=!0,s())},i[0]=s,i[1]=x);let S=x,C;i[2]!==b||i[3]!==a?(C=Q(a,re(b),b),i[2]=b,i[3]=a,i[4]=C):C=i[4];let w=C,T,E;i[5]!==c||i[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],i[5]=c,i[6]=v,i[7]=T,i[8]=E):(T=i[7],E=i[8]),(0,V.useEffect)(T,E);let k;i[9]===c?k=i[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},i[9]=c,i[10]=k);let A=k,j;i[11]!==c||i[12]!==d?(j=function(e){d(e),_(!1),c(!1),y(``)},i[11]=c,i[12]=d,i[13]=j):j=i[13];let M=j,N;i[14]===S?N=i[15]:(N=e=>{S(),y(e.target.value)},i[14]=S,i[15]=N);let P;i[16]!==v||i[17]!==S||i[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(n,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),i[16]=v,i[17]=S,i[18]=N,i[19]=P):P=i[19];let F;i[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=l(u.compact,`py-4`),i[20]=F):F=i[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;i[21]===I?L=i[22]:(L=(0,H.jsx)(K,{className:F,children:I}),i[21]=I,i[22]=L);let R;if(i[23]!==M||i[24]!==w){let e;i[26]===M?e=i[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)(r,{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:l(u.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),i[26]=M,i[27]=e),R=w.map(e),i[23]=M,i[24]=w,i[25]=R}else R=i[25];let z;i[28]===R?z=i[29]:(z=(0,H.jsx)(q,{children:R}),i[28]=R,i[29]=z);let W;i[30]!==L||i[31]!==z?(W=(0,H.jsx)(D,{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]})})}),i[30]=L,i[31]=z,i[32]=W):W=i[32];let J;return i[33]!==A||i[34]!==g||i[35]!==W||i[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),i[33]=A,i[34]=g,i[35]=W,i[36]=P,i[37]=J):J=i[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:n,level:a,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=u.has(n.path),D=f===n.path,ee=m?.dirPath===n.path&&E;return n.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:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(n)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(o,{className:`h-3 w-3`}):(0,H.jsx)(c,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(i,{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:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,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)(i,{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:n.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:n.path,version:d(n.path),children:n=>(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)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),n.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,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(n.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(n.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),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:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:()=>g(n),children:[(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,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:n.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:n,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)(r,{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)(x,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(_,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(b,{children:`Cancel`}),(0,H.jsx)(m,{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:n,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 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Wa as n,ci as r,gi as i,ha as a,hi as o,ji as s,ui as c,wi as l,xo as u,yo as d}from"./dialogs-config-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Wa as n,ci as r,gi as i,ha as a,hi as o,ji as s,ui as c,wi as l,xo as u,yo as d}from"./dialogs-config-B-LZ4nOb.js";import{S as f}from"./react-vendor-D8PTA4EX.js";import{O as p,a as m,l as h,n as g,o as _}from"./history-view-CAkN8PCo.js";import{n as v}from"./utils-B7FQXlI6.js";import{E as y,a as b,j as x,w as S}from"./index-BLO68CQl.js";import{a as C,c as w,i as T}from"./api-DJaJqkc6.js";var E=d(),D=s(),O=e(u(),1),k=p(e=>(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,D.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),A=p(e=>(0,D.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,D.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})})]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`]}),j=function({selectedFile:e,showTreeBackButton:i=!1,onShowTree:s}){let{resolvedTheme:u}=v(),d=x(e=>e.selectedThreadId),p=(0,O.useRef)(null),[m,C]=(0,O.useState)(null),[T,E]=(0,O.useState)(!1),[j,L]=(0,O.useState)(`edit`),[B,V]=(0,O.useState)(0),H=e?o(e.path,e.name):null,U=e?.type===`file`&&d&&!H?e:null,W=m?.content??``,G=m?.original??``,K=U?`${d}:${U.path}:${B}`:null;(0,O.useEffect)(()=>()=>{p.current&&=(p.current.getModel()?.dispose(),p.current.dispose(),null)},[]),(0,O.useEffect)(()=>{e?.type===`file`?L(M(e.path)?`view`:`edit`):L(`edit`),C(null)},[e?.path,d]);async function q(){if(!(!d||!e)){E(!0);try{await w(d,e.path,W),C({content:W,original:W}),y({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){y({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{E(!1)}}}function J(){!d||!U||(_(P(d,U.path)),C(null),V(e=>e+1))}return d?(0,D.jsx)(A,{v0:(0,D.jsxs)(b,{className:`justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[i&&s?(0,D.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:s,children:[(0,D.jsx)(a,{className:`h-4 w-4`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:c(l.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,D.jsx)(`span`,{className:c(l.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),U&&m?(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[M(U.path)?(0,D.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,D.jsx)(r,{size:`sm`,variant:j===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`view`),children:`View`}),(0,D.jsx)(r,{size:`sm`,variant:j===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`edit`),children:`Edit`})]}):null,(0,D.jsxs)(r,{size:`sm`,onClick:()=>void q(),disabled:T||!W||W===G,children:[T?(0,D.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),v1:U?(0,D.jsxs)(g,{fallbackTitle:`Failed to load file`,onRetry:J,children:[(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(F,{threadId:d,path:U.path,onContentReady:C},K??void 0)}),m?M(U.path)&&j===`view`?(0,D.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,D.jsx)(S,{content:W,enableMermaid:!0})}):(0,D.jsx)(f,{height:`100%`,language:N(U.path),value:W,onChange:e=>C(t=>t&&{...t,content:e??``}),onMount:e=>{p.current=e},theme:u===`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,D.jsx)(h,{})]}):e?.type===`file`&&H===`image`?(0,D.jsx)(g,{fallbackTitle:`Failed to load image`,onRetry:()=>{!d||!e||_(I(d,e.path))},children:(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(R,{threadId:d,path:e.path,alt:e.name})})}):e?.type===`file`&&H===`video`?(0,D.jsx)(g,{fallbackTitle:`Failed to load video`,onRetry:()=>{!d||!e||_(I(d,e.path))},children:(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(z,{threadId:d,path:e.path})})}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,D.jsx)(n,{className:`h-10 w-10 text-muted-foreground/50`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:c(l.label,`text-muted-foreground`),children:`No file selected`}),(0,D.jsx)(`p`,{className:c(l.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})}):(0,D.jsx)(k,{v0:(0,D.jsx)(n,{className:`h-8 w-8 text-muted-foreground`}),v1:l.bodyMuted})};function M(e){return i(e)===`md`}function N(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`}[i(e)]??`plaintext`}function P(e,t){return`explorer-file:${e}:${t}`}function F(e){let t=(0,E.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=P(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>C(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=m(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,O.useLayoutEffect)(c,l),null}function I(e,t){return`explorer-media:${e}:${t}`}function L(e,t){let n=(0,E.c)(11),r;n[0]!==t||n[1]!==e?(r=I(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>T(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=m(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,O.useEffect)(c,l),s}function R(e){let t=(0,E.c)(3),{threadId:n,path:r,alt:i}=e,a=L(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,D.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function z(e){let t=(0,E.c)(2),{threadId:n,path:r}=e,i=L(n,r),a;return t[0]===i?a=t[1]:(a=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,D.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{j as default};
|
package/dist/public/assets/{git-history-dialog-Bqv0bD41.js → git-history-dialog-Bci_iQmi.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ar as e,Dr as t,Ea as n,Mr as r,Or as i,ci as a,ji as o,jr as s,kr as c,ui as l,wi as u,yo as d}from"./dialogs-config-
|
|
1
|
+
import{Ar as e,Dr as t,Ea as n,Mr as r,Or as i,ci as a,ji as o,jr as s,kr as c,ui as l,wi as u,yo as d}from"./dialogs-config-B-LZ4nOb.js";var f=d(),p=o();function m(o){let d=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=o,S;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(r,{children:`Commit History`}),d[0]=S):S=d[0];let C;d[1]===x?C=d[2]:(C=(0,p.jsxs)(s,{children:[S,(0,p.jsxs)(c,{children:[`Recent commits on branch `,x]})]}),d[1]=x,d[2]=C);let w;d[3]===v?w=d[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:l(u.bodyMuted,`text-center py-8`),children:`No commits found`}),d[3]=v,d[4]=w);let T;d[5]===y?T=d[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(n,{className:`h-4 w-4 animate-spin inline`})}),d[5]=y,d[6]=T);let E;d[7]!==_.length||d[8]!==v.length||d[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:l(u.caption,`p-3 text-center`),children:`Scroll to load more`}),d[7]=_.length,d[8]=v.length,d[9]=y,d[10]=E):E=d[10];let D;d[11]!==w||d[12]!==T||d[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),d[11]=w,d[12]=T,d[13]=E,d[14]=D):D=d[14];let O;d[15]!==b||d[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),d[15]=b,d[16]=D,d[17]=O):O=d[17];let k;d[18]===g?k=d[19]:(k=(0,p.jsx)(e,{children:(0,p.jsx)(a,{onClick:()=>g(!1),children:`Close`})}),d[18]=g,d[19]=k);let A;d[20]!==C||d[21]!==O||d[22]!==k?(A=(0,p.jsxs)(i,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),d[20]=C,d[21]=O,d[22]=k,d[23]=A):A=d[23];let j;return d[24]!==g||d[25]!==m||d[26]!==A?(j=(0,p.jsx)(t,{open:m,onOpenChange:g,children:A}),d[24]=g,d[25]=m,d[26]=A,d[27]=j):j=d[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:l(u.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:l(u.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:u.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bi as t,C as n,Ea as r,Fa as i,Ht as a,Ia as ee,It as o,J as s,Ja as c,Jt as l,K as u,Kt as te,Lt as ne,Ra as d,Rt as re,St as ie,Vt as f,Wt as ae,Xn as p,Ya as m,Yn as h,_o as g,ar as _,at as oe,ci as se,cr as v,er as y,fr as ce,hr as le,ir as b,ja as ue,ji as x,ki as de,lo as fe,mr as pe,pr as me,st as he,ui as ge,wi as _e,xo as S,yo as ve,zt as ye}from"./dialogs-config-DZKtVbNK.js";import{r as C}from"./monaco-CZnIWXyV.js";import{A as w,E as T,_ as be,f as E,g as D,h as xe,j as O,k,m as Se,v as Ce}from"./index-DjD2SPNZ.js";var A=e(S(),1),j=x();function we(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 M(e,t){return t?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(g,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,j.jsx)(d,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(c,{className:`h-3.5 w-3.5`}):(0,j.jsx)(ee,{className:`h-3.5 w-3.5`})}function Te(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 N(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 P(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ee=ve();function De(e){let n=(0,Ee.c)(87),{branchStatus:a,remoteUrl:o,hasRemoteBranch:s,hasUnpushedCommits:l,canCreateRepo:u,repoUrl:te,isRefreshing:ne,isBrandState:d,gitUser:re,isDirectCommitMode:ie,isLoading:f,isLoadingHistory:ae,onFetch:p,onPull:h,onPush:_,onOpenHistory:oe,onCreatePR:v,onCreateRepo:y,onViewInGitHub:b,onOpenChange:x,layout:de}=e,he=de===void 0?`bar`:de,S=he===`bar`&&`w-8 rounded-l-none`,ve=he===`menu`&&`w-full justify-start gap-2 rounded-md`,ye=d&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,C;n[0]!==S||n[1]!==ve||n[2]!==ye?(C=ge(`h-8 px-1`,S,ve,ye),n[0]=S,n[1]=ve,n[2]=ye,n[3]=C):C=n[3];let w;n[4]===ne?w=n[5]:(w=ne?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(fe,{className:`h-3.5 w-3.5`}),n[4]=ne,n[5]=w);let T;n[6]===he?T=n[7]:(T=he===`menu`&&(0,j.jsx)(`span`,{children:`More git actions`}),n[6]=he,n[7]=T);let E;n[8]!==f||n[9]!==C||n[10]!==w||n[11]!==T?(E=(0,j.jsx)(Ce,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:C,disabled:f,children:[w,T]})}),n[8]=f,n[9]=C,n[10]=w,n[11]=T,n[12]=E):E=n[12];let O;n[13]!==a||n[14]!==o?(O=a===`Behind`&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,o?`origin`:`remote`]}),n[13]=a,n[14]=o,n[15]=O):O=n[15];let k;n[16]===re?k=n[17]:(k=re&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-muted-foreground`),children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,re]}),n[16]=re,n[17]=k);let A;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(be,{}),n[18]=A):A=n[18];let we;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,j.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),n[19]=we):we=n[19];let M;n[20]!==f||n[21]!==p?(M=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:p,disabled:f,children:[we,`Fetch`]})}),n[20]=f,n[21]=p,n[22]=M):M=n[22];let Te;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,j.jsx)(me,{side:`right`,children:`Download latest information from remote without merging changes`}),n[23]=Te):Te=n[23];let N;n[24]===M?N=n[25]:(N=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[M,Te]})}),n[24]=M,n[25]=N);let P;n[26]!==s||n[27]!==f||n[28]!==h?(P=()=>{s&&!f&&h()},n[26]=s,n[27]=f,n[28]=h,n[29]=P):P=n[29];let De=!s||f?`opacity-50 cursor-not-allowed`:``,Oe;n[30]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,j.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),n[30]=Oe):Oe=n[30];let F;n[31]!==P||n[32]!==De?(F=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:P,className:De,children:[Oe,`Pull`]})}),n[31]=P,n[32]=De,n[33]=F):F=n[33];let I=s?`Pull latest changes from remote`:`No remote branch to pull from`,L;n[34]===I?L=n[35]:(L=(0,j.jsx)(me,{side:`right`,children:I}),n[34]=I,n[35]=L);let R;n[36]!==F||n[37]!==L?(R=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[F,L]})}),n[36]=F,n[37]=L,n[38]=R):R=n[38];let z;n[39]!==s||n[40]!==f||n[41]!==_?(z=!s&&(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:_,disabled:f,children:[(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,j.jsx)(me,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[39]=s,n[40]=f,n[41]=_,n[42]=z):z=n[42];let B;n[43]!==l||n[44]!==f||n[45]!==_?(B=()=>{l&&!f&&_()},n[43]=l,n[44]=f,n[45]=_,n[46]=B):B=n[46];let ke=!l||f?`opacity-50 cursor-not-allowed`:``,Ae;n[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),n[47]=Ae):Ae=n[47];let V;n[48]!==B||n[49]!==ke?(V=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:B,className:ke,children:[Ae,`Push Commits`]})}),n[48]=B,n[49]=ke,n[50]=V):V=n[50];let je=l?f?`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[51]===je?H=n[52]:(H=(0,j.jsx)(me,{side:`right`,children:je}),n[51]=je,n[52]=H);let U;n[53]!==V||n[54]!==H?(U=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[V,H]})}),n[53]=V,n[54]=H,n[55]=U):U=n[55];let Me=f||ae,Ne;n[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[56]=Ne):Ne=n[56];let W;n[57]!==oe||n[58]!==Me?(W=(0,j.jsxs)(D,{onClick:oe,disabled:Me,children:[Ne,`History`]}),n[57]=oe,n[58]=Me,n[59]=W):W=n[59];let G;n[60]!==ie||n[61]!==f||n[62]!==v?(G=!ie&&(0,j.jsxs)(D,{onClick:v,disabled:f,children:[(0,j.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[60]=ie,n[61]=f,n[62]=v,n[63]=G):G=n[63];let K;n[64]!==u||n[65]!==f||n[66]!==y?(K=u&&(0,j.jsxs)(D,{onClick:y,disabled:f,children:[(0,j.jsx)(i,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[64]=u,n[65]=f,n[66]=y,n[67]=K):K=n[67];let q;n[68]!==f||n[69]!==b||n[70]!==te?(q=te&&(0,j.jsxs)(D,{onClick:b,disabled:f,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[68]=f,n[69]=b,n[70]=te,n[71]=q):q=n[71];let J;n[72]!==k||n[73]!==N||n[74]!==R||n[75]!==z||n[76]!==U||n[77]!==W||n[78]!==G||n[79]!==K||n[80]!==q||n[81]!==O?(J=(0,j.jsxs)(xe,{align:`end`,children:[O,k,A,N,R,z,U,W,G,K,q]}),n[72]=k,n[73]=N,n[74]=R,n[75]=z,n[76]=U,n[77]=W,n[78]=G,n[79]=K,n[80]=q,n[81]=O,n[82]=J):J=n[82];let Y;return n[83]!==x||n[84]!==J||n[85]!==E?(Y=(0,j.jsxs)(Se,{onOpenChange:x,children:[E,J]}),n[83]=x,n[84]=J,n[85]=E,n[86]=Y):Y=n[86],Y}function Oe(){return{autoGenerateCommitMessage:h(),autoGeneratePRInfo:p(),privateRepositoryDefault:y()}}function F(e){e.autoGenerateCommitMessage!==void 0&&b(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&_(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&v(e.privateRepositoryDefault)}function I(e){return e?!0:(T({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function L(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function R(e,t,n){let[r,i]=(0,A.useState)(!1),[a,ee]=(0,A.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:L(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await s(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var z=(0,A.lazy)(()=>C(()=>import(`./commit-dialog-90PGbqs8.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,A.lazy)(()=>C(()=>import(`./pull-request-dialog-ZzVXh6M9.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),ke=(0,A.lazy)(()=>C(()=>import(`./create-repo-dialog-BkUdww3q.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Ae=(0,A.lazy)(()=>C(()=>import(`./git-history-dialog-Bqv0bD41.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,A.lazy)(()=>C(()=>import(`./push-before-pr-dialog-CFmgu9H_.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),je=(0,A.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-LUgd2a4S.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),H=(0,A.lazy)(()=>C(()=>import(`./merged-pr-dialog-B2qqrQ1g.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function U(){return null}function Me({projectId:e,threadId:t,layout:r=`bar`}){let i=w(),ee=O(e=>e.projectModelSelections[t]),s=O(t=>t.projects.find(t=>t.projectId===e)),[c,u]=(0,A.useState)(!1),[d,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(!1),[v,y]=(0,A.useState)(``),[b,ue]=(0,A.useState)(``),[x,fe]=(0,A.useState)(``),[_e,S]=(0,A.useState)(!1),[ve,C]=(0,A.useState)(null),be=(0,A.useRef)(!1),D=(0,A.useRef)(!1),xe=(0,A.useRef)(b),Se=(0,A.useRef)(x);xe.current=b,Se.current=x;let[Ce,Ee]=(0,A.useState)(!1),[L,Me]=(0,A.useState)([]),[Ne,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)([]),[q,J]=(0,A.useState)(!1),[Y,Pe]=(0,A.useState)(!1),[Fe,Ie]=(0,A.useState)(``),[Le,Re]=(0,A.useState)(``),[ze,Be]=(0,A.useState)(``),[Ve,He]=(0,A.useState)(!1),[Ue,We]=(0,A.useState)(!1),[Ge,Ke]=(0,A.useState)(!1),[qe,Je]=(0,A.useState)(!1),X=E(),{fetchUnifiedStatus:Ye}=X,Z=R(t,e,ee);async function Q(){te();let e=await ie();i({type:k.SetProjects,projects:e.projects})}let[$,Xe]=(0,A.useState)(()=>Oe()),Ze=s?.commitMethod===de.Direct;(0,A.useEffect)(()=>{Y&&s?.name&&!Fe&&Ie(s.name)},[Y,s?.name,Fe]),(0,A.useEffect)(()=>{F($)},[$]);function Qe(){Ve||(He(!0),he().then(e=>Be(e)).catch(()=>{}))}(0,A.useEffect)(()=>{if(!m){D.current=!1;return}if(m&&$.autoGenerateCommitMessage&&!v.trim()&&t&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}e()}},[m,$.autoGenerateCommitMessage,t,Z.generateCommitMessageWithAI,v]),(0,A.useEffect)(()=>{if(!g){be.current=!1;return}if(g&&$.autoGeneratePRInfo&&!xe.current.trim()&&!Se.current.trim()&&t&&!be.current){be.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}e()}},[g,$.autoGeneratePRInfo,t,Z.generatePRInfoWithAI]),(0,A.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Je(!0),d&&X.prExists&&X.prState===`OPEN`&&p(!1)},[X.prExists,X.prState,t,d]),(0,A.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[d]);async function $e(){if(v.trim()&&I(t))try{u(!0),await o(t,v),y(``),h(!1),await X.fetchUnifiedStatus(!0),Q(),T({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ge&&(Ke(!1),await at())}catch(e){console.error(`Failed to commit:`,e),T({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function et(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await lt();return}if(X.hasChanges){h(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await l(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){_(!0);return}if(X.hasUnpushedCommits&&X.prExists){await rt();return}}async function tt(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}async function nt(){if(I(t))try{u(!0),await ye(t),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function rt(){if(I(t))try{u(!0),await a(t),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?T({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):T({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),T({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function it(){if(I(t)){if(X.hasChanges){We(!0);return}await at()}}async function at(){try{u(!0),await f(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),T({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function ot(){We(!1),Ke(!0),h(!0)}async function st(){We(!1),await at()}async function ct(){if(t)try{u(!0);let e=await ne(t);te();let n=await ie();i({type:k.SetProjects,projects:n.projects}),T({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Je(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),T({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{u(!1)}}async function lt(){if(I(t))try{u(!0),await ae(t),await X.fetchUnifiedStatus(!0),Q(),T({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),T({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function ut(){if(I(t))try{u(!0),p(!0);let e=await re(t,b,x);e.prUrl&&await l(e.prUrl),ue(``),fe(``),_(!1),await X.fetchUnifiedStatus(!0),Q();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);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`)?(_(!1),pt({title:b,description:x})):(p(!1),T({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function dt(){if(I(t))try{u(!0);let e=await n(t,Fe,Le,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{l(e.repoUrl)},3e3),Ie(``),Re(``),Pe(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function ft(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}async function pt(e){let n=e??ve;if(!(!t||!n))try{u(!0),p(!0);try{await a(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){T({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ae(t),await a(t)}catch{throw e}}else throw e}let e=await re(t,n.title,n.description);e.prUrl&&await l(e.prUrl),ue(``),fe(``),C(null),S(!1),await X.fetchUnifiedStatus(!0),Q();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);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`;p(!1),T({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function mt(){if(I(t))try{W(!0);let e=await oe(t,100);Me(e),K(e.slice(0,10)),Ee(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{W(!1)}}function ht(){q||(J(!0),setTimeout(()=>{let e=G.length+10;K(L.slice(0,e)),J(!1)},300))}function gt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&G.length<L.length&&!q&&ht()}let _t=P(X);function vt(){X.repoUrl&&l(X.repoUrl)}function yt(){S(!1),C(null)}function bt(){Je(!1),X.fetchUnifiedStatus(!0)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:ge(`flex items-center gap-0`,r===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:ge(`h-8 gap-1.5`,r===`bar`&&`rounded-r-none border-r-0`,r===`menu`&&`rounded-md border`,_t&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:N(X,c,d),onClick:et,children:[M(X,d),we(X,d)]})}),(0,j.jsx)(me,{children:Te(X)})]})}),(0,j.jsx)(De,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:_t,gitUser:ze,isDirectCommitMode:Ze,isLoading:c||d,isLoadingHistory:Ne,onFetch:()=>void nt(),onPull:()=>void it(),onPush:()=>void rt(),onOpenHistory:()=>void mt(),onCreatePR:()=>_(!0),onCreateRepo:()=>Pe(!0),onViewInGitHub:vt,onOpenChange:e=>{e&&(Qe(),Ye(!0))},layout:r})]}),m&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(z,{open:m,onOpenChange:h,commitMessage:v,onCommitMessageChange:y,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Xe(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:c,onGenerateMessage:tt,onCommit:$e,currentBranch:X.currentBranch})}),g&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(B,{open:g,onOpenChange:_,prTitle:b,onPrTitleChange:ue,prDescription:x,onPrDescriptionChange:fe,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ft,onCreatePR:ut,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Xe(t=>({...t,autoGeneratePRInfo:e}))})}),_e&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(V,{open:_e,onOpenChange:S,isLoading:c,onPushAndCreatePR:pt,onCancel:yt})}),Y&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(ke,{open:Y,onOpenChange:Pe,repoName:Fe,onRepoNameChange:Ie,repoDescription:Le,onRepoDescriptionChange:Re,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Xe(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:dt})}),Ce&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Ae,{open:Ce,onOpenChange:Ee,commits:L,displayedCommits:G,isLoadingMore:q,onScroll:gt,currentBranch:X.currentBranch})}),Ue&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(je,{open:Ue,onOpenChange:We,onCommitFirst:ot,onStashAndPull:st,onCancel:()=>We(!1),isLoading:c})}),qe&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(H,{open:qe,onOpenChange:Je,onNewBranch:ct,onJustOpen:bt,isLoading:c})})]})}export{Me as GitOpsButton};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-DdhGDH4F.js","assets/index-BLO68CQl.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-CAkN8PCo.js","assets/dialogs-config-B-LZ4nOb.js","assets/onboarding-Bbvb7kO4.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-D8PTA4EX.js","assets/utils-B7FQXlI6.js","assets/index-jIBJk8xl.css","assets/pull-request-dialog-WHdmrW83.js","assets/create-repo-dialog-Bltp6PKZ.js","assets/git-history-dialog-Bci_iQmi.js","assets/push-before-pr-dialog-Bvqvz04U.js","assets/pull-with-changes-dialog-Ck3OwINV.js","assets/merged-pr-dialog-tHPrJ2CK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bi as t,C as n,Ea as r,Fa as i,Ht as a,Ia as ee,It as o,J as s,Ja as c,Jt as l,K as u,Kt as te,Lt as ne,Ra as d,Rt as re,St as ie,Vt as f,Wt as ae,Xn as p,Ya as m,Yn as h,_o as g,ar as _,at as oe,ci as se,cr as v,er as y,fr as ce,hr as le,ir as b,ja as ue,ji as x,ki as de,lo as fe,mr as pe,pr as me,st as he,ui as ge,wi as _e,xo as S,yo as ve,zt as ye}from"./dialogs-config-B-LZ4nOb.js";import{r as C}from"./monaco-CZnIWXyV.js";import{A as w,E as T,_ as be,f as E,g as D,h as xe,j as O,k,m as Se,v as Ce}from"./index-BLO68CQl.js";var A=e(S(),1),j=x();function we(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 M(e,t){return t?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(g,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,j.jsx)(d,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(c,{className:`h-3.5 w-3.5`}):(0,j.jsx)(ee,{className:`h-3.5 w-3.5`})}function Te(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 N(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 P(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ee=ve();function De(e){let n=(0,Ee.c)(87),{branchStatus:a,remoteUrl:o,hasRemoteBranch:s,hasUnpushedCommits:l,canCreateRepo:u,repoUrl:te,isRefreshing:ne,isBrandState:d,gitUser:re,isDirectCommitMode:ie,isLoading:f,isLoadingHistory:ae,onFetch:p,onPull:h,onPush:_,onOpenHistory:oe,onCreatePR:v,onCreateRepo:y,onViewInGitHub:b,onOpenChange:x,layout:de}=e,he=de===void 0?`bar`:de,S=he===`bar`&&`w-8 rounded-l-none`,ve=he===`menu`&&`w-full justify-start gap-2 rounded-md`,ye=d&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,C;n[0]!==S||n[1]!==ve||n[2]!==ye?(C=ge(`h-8 px-1`,S,ve,ye),n[0]=S,n[1]=ve,n[2]=ye,n[3]=C):C=n[3];let w;n[4]===ne?w=n[5]:(w=ne?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(fe,{className:`h-3.5 w-3.5`}),n[4]=ne,n[5]=w);let T;n[6]===he?T=n[7]:(T=he===`menu`&&(0,j.jsx)(`span`,{children:`More git actions`}),n[6]=he,n[7]=T);let E;n[8]!==f||n[9]!==C||n[10]!==w||n[11]!==T?(E=(0,j.jsx)(Ce,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:C,disabled:f,children:[w,T]})}),n[8]=f,n[9]=C,n[10]=w,n[11]=T,n[12]=E):E=n[12];let O;n[13]!==a||n[14]!==o?(O=a===`Behind`&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,o?`origin`:`remote`]}),n[13]=a,n[14]=o,n[15]=O):O=n[15];let k;n[16]===re?k=n[17]:(k=re&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-muted-foreground`),children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,re]}),n[16]=re,n[17]=k);let A;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(be,{}),n[18]=A):A=n[18];let we;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,j.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),n[19]=we):we=n[19];let M;n[20]!==f||n[21]!==p?(M=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:p,disabled:f,children:[we,`Fetch`]})}),n[20]=f,n[21]=p,n[22]=M):M=n[22];let Te;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,j.jsx)(me,{side:`right`,children:`Download latest information from remote without merging changes`}),n[23]=Te):Te=n[23];let N;n[24]===M?N=n[25]:(N=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[M,Te]})}),n[24]=M,n[25]=N);let P;n[26]!==s||n[27]!==f||n[28]!==h?(P=()=>{s&&!f&&h()},n[26]=s,n[27]=f,n[28]=h,n[29]=P):P=n[29];let De=!s||f?`opacity-50 cursor-not-allowed`:``,Oe;n[30]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,j.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),n[30]=Oe):Oe=n[30];let F;n[31]!==P||n[32]!==De?(F=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:P,className:De,children:[Oe,`Pull`]})}),n[31]=P,n[32]=De,n[33]=F):F=n[33];let I=s?`Pull latest changes from remote`:`No remote branch to pull from`,L;n[34]===I?L=n[35]:(L=(0,j.jsx)(me,{side:`right`,children:I}),n[34]=I,n[35]=L);let R;n[36]!==F||n[37]!==L?(R=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[F,L]})}),n[36]=F,n[37]=L,n[38]=R):R=n[38];let z;n[39]!==s||n[40]!==f||n[41]!==_?(z=!s&&(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:_,disabled:f,children:[(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,j.jsx)(me,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[39]=s,n[40]=f,n[41]=_,n[42]=z):z=n[42];let B;n[43]!==l||n[44]!==f||n[45]!==_?(B=()=>{l&&!f&&_()},n[43]=l,n[44]=f,n[45]=_,n[46]=B):B=n[46];let ke=!l||f?`opacity-50 cursor-not-allowed`:``,Ae;n[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),n[47]=Ae):Ae=n[47];let V;n[48]!==B||n[49]!==ke?(V=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:B,className:ke,children:[Ae,`Push Commits`]})}),n[48]=B,n[49]=ke,n[50]=V):V=n[50];let je=l?f?`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[51]===je?H=n[52]:(H=(0,j.jsx)(me,{side:`right`,children:je}),n[51]=je,n[52]=H);let U;n[53]!==V||n[54]!==H?(U=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[V,H]})}),n[53]=V,n[54]=H,n[55]=U):U=n[55];let Me=f||ae,Ne;n[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[56]=Ne):Ne=n[56];let W;n[57]!==oe||n[58]!==Me?(W=(0,j.jsxs)(D,{onClick:oe,disabled:Me,children:[Ne,`History`]}),n[57]=oe,n[58]=Me,n[59]=W):W=n[59];let G;n[60]!==ie||n[61]!==f||n[62]!==v?(G=!ie&&(0,j.jsxs)(D,{onClick:v,disabled:f,children:[(0,j.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[60]=ie,n[61]=f,n[62]=v,n[63]=G):G=n[63];let K;n[64]!==u||n[65]!==f||n[66]!==y?(K=u&&(0,j.jsxs)(D,{onClick:y,disabled:f,children:[(0,j.jsx)(i,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[64]=u,n[65]=f,n[66]=y,n[67]=K):K=n[67];let q;n[68]!==f||n[69]!==b||n[70]!==te?(q=te&&(0,j.jsxs)(D,{onClick:b,disabled:f,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[68]=f,n[69]=b,n[70]=te,n[71]=q):q=n[71];let J;n[72]!==k||n[73]!==N||n[74]!==R||n[75]!==z||n[76]!==U||n[77]!==W||n[78]!==G||n[79]!==K||n[80]!==q||n[81]!==O?(J=(0,j.jsxs)(xe,{align:`end`,children:[O,k,A,N,R,z,U,W,G,K,q]}),n[72]=k,n[73]=N,n[74]=R,n[75]=z,n[76]=U,n[77]=W,n[78]=G,n[79]=K,n[80]=q,n[81]=O,n[82]=J):J=n[82];let Y;return n[83]!==x||n[84]!==J||n[85]!==E?(Y=(0,j.jsxs)(Se,{onOpenChange:x,children:[E,J]}),n[83]=x,n[84]=J,n[85]=E,n[86]=Y):Y=n[86],Y}function Oe(){return{autoGenerateCommitMessage:h(),autoGeneratePRInfo:p(),privateRepositoryDefault:y()}}function F(e){e.autoGenerateCommitMessage!==void 0&&b(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&_(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&v(e.privateRepositoryDefault)}function I(e){return e?!0:(T({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function L(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function R(e,t,n){let[r,i]=(0,A.useState)(!1),[a,ee]=(0,A.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:L(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await s(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var z=(0,A.lazy)(()=>C(()=>import(`./commit-dialog-DdhGDH4F.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,A.lazy)(()=>C(()=>import(`./pull-request-dialog-WHdmrW83.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),ke=(0,A.lazy)(()=>C(()=>import(`./create-repo-dialog-Bltp6PKZ.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Ae=(0,A.lazy)(()=>C(()=>import(`./git-history-dialog-Bci_iQmi.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,A.lazy)(()=>C(()=>import(`./push-before-pr-dialog-Bvqvz04U.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),je=(0,A.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-Ck3OwINV.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),H=(0,A.lazy)(()=>C(()=>import(`./merged-pr-dialog-tHPrJ2CK.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function U(){return null}function Me({projectId:e,threadId:t,layout:r=`bar`}){let i=w(),ee=O(e=>e.projectModelSelections[t]),s=O(t=>t.projects.find(t=>t.projectId===e)),[c,u]=(0,A.useState)(!1),[d,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(!1),[v,y]=(0,A.useState)(``),[b,ue]=(0,A.useState)(``),[x,fe]=(0,A.useState)(``),[_e,S]=(0,A.useState)(!1),[ve,C]=(0,A.useState)(null),be=(0,A.useRef)(!1),D=(0,A.useRef)(!1),xe=(0,A.useRef)(b),Se=(0,A.useRef)(x);xe.current=b,Se.current=x;let[Ce,Ee]=(0,A.useState)(!1),[L,Me]=(0,A.useState)([]),[Ne,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)([]),[q,J]=(0,A.useState)(!1),[Y,Pe]=(0,A.useState)(!1),[Fe,Ie]=(0,A.useState)(``),[Le,Re]=(0,A.useState)(``),[ze,Be]=(0,A.useState)(``),[Ve,He]=(0,A.useState)(!1),[Ue,We]=(0,A.useState)(!1),[Ge,Ke]=(0,A.useState)(!1),[qe,Je]=(0,A.useState)(!1),X=E(),{fetchUnifiedStatus:Ye}=X,Z=R(t,e,ee);async function Q(){te();let e=await ie();i({type:k.SetProjects,projects:e.projects})}let[$,Xe]=(0,A.useState)(()=>Oe()),Ze=s?.commitMethod===de.Direct;(0,A.useEffect)(()=>{Y&&s?.name&&!Fe&&Ie(s.name)},[Y,s?.name,Fe]),(0,A.useEffect)(()=>{F($)},[$]);function Qe(){Ve||(He(!0),he().then(e=>Be(e)).catch(()=>{}))}(0,A.useEffect)(()=>{if(!m){D.current=!1;return}if(m&&$.autoGenerateCommitMessage&&!v.trim()&&t&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}e()}},[m,$.autoGenerateCommitMessage,t,Z.generateCommitMessageWithAI,v]),(0,A.useEffect)(()=>{if(!g){be.current=!1;return}if(g&&$.autoGeneratePRInfo&&!xe.current.trim()&&!Se.current.trim()&&t&&!be.current){be.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}e()}},[g,$.autoGeneratePRInfo,t,Z.generatePRInfoWithAI]),(0,A.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Je(!0),d&&X.prExists&&X.prState===`OPEN`&&p(!1)},[X.prExists,X.prState,t,d]),(0,A.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[d]);async function $e(){if(v.trim()&&I(t))try{u(!0),await o(t,v),y(``),h(!1),await X.fetchUnifiedStatus(!0),Q(),T({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ge&&(Ke(!1),await at())}catch(e){console.error(`Failed to commit:`,e),T({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function et(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await lt();return}if(X.hasChanges){h(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await l(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){_(!0);return}if(X.hasUnpushedCommits&&X.prExists){await rt();return}}async function tt(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}async function nt(){if(I(t))try{u(!0),await ye(t),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function rt(){if(I(t))try{u(!0),await a(t),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?T({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):T({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),T({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function it(){if(I(t)){if(X.hasChanges){We(!0);return}await at()}}async function at(){try{u(!0),await f(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),T({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function ot(){We(!1),Ke(!0),h(!0)}async function st(){We(!1),await at()}async function ct(){if(t)try{u(!0);let e=await ne(t);te();let n=await ie();i({type:k.SetProjects,projects:n.projects}),T({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Je(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),T({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{u(!1)}}async function lt(){if(I(t))try{u(!0),await ae(t),await X.fetchUnifiedStatus(!0),Q(),T({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),T({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function ut(){if(I(t))try{u(!0),p(!0);let e=await re(t,b,x);e.prUrl&&await l(e.prUrl),ue(``),fe(``),_(!1),await X.fetchUnifiedStatus(!0),Q();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);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`)?(_(!1),pt({title:b,description:x})):(p(!1),T({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function dt(){if(I(t))try{u(!0);let e=await n(t,Fe,Le,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{l(e.repoUrl)},3e3),Ie(``),Re(``),Pe(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function ft(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}async function pt(e){let n=e??ve;if(!(!t||!n))try{u(!0),p(!0);try{await a(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){T({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ae(t),await a(t)}catch{throw e}}else throw e}let e=await re(t,n.title,n.description);e.prUrl&&await l(e.prUrl),ue(``),fe(``),C(null),S(!1),await X.fetchUnifiedStatus(!0),Q();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);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`;p(!1),T({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function mt(){if(I(t))try{W(!0);let e=await oe(t,100);Me(e),K(e.slice(0,10)),Ee(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{W(!1)}}function ht(){q||(J(!0),setTimeout(()=>{let e=G.length+10;K(L.slice(0,e)),J(!1)},300))}function gt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&G.length<L.length&&!q&&ht()}let _t=P(X);function vt(){X.repoUrl&&l(X.repoUrl)}function yt(){S(!1),C(null)}function bt(){Je(!1),X.fetchUnifiedStatus(!0)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:ge(`flex items-center gap-0`,r===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:ge(`h-8 gap-1.5`,r===`bar`&&`rounded-r-none border-r-0`,r===`menu`&&`rounded-md border`,_t&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:N(X,c,d),onClick:et,children:[M(X,d),we(X,d)]})}),(0,j.jsx)(me,{children:Te(X)})]})}),(0,j.jsx)(De,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:_t,gitUser:ze,isDirectCommitMode:Ze,isLoading:c||d,isLoadingHistory:Ne,onFetch:()=>void nt(),onPull:()=>void it(),onPush:()=>void rt(),onOpenHistory:()=>void mt(),onCreatePR:()=>_(!0),onCreateRepo:()=>Pe(!0),onViewInGitHub:vt,onOpenChange:e=>{e&&(Qe(),Ye(!0))},layout:r})]}),m&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(z,{open:m,onOpenChange:h,commitMessage:v,onCommitMessageChange:y,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Xe(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:c,onGenerateMessage:tt,onCommit:$e,currentBranch:X.currentBranch})}),g&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(B,{open:g,onOpenChange:_,prTitle:b,onPrTitleChange:ue,prDescription:x,onPrDescriptionChange:fe,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ft,onCreatePR:ut,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Xe(t=>({...t,autoGeneratePRInfo:e}))})}),_e&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(V,{open:_e,onOpenChange:S,isLoading:c,onPushAndCreatePR:pt,onCancel:yt})}),Y&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(ke,{open:Y,onOpenChange:Pe,repoName:Fe,onRepoNameChange:Ie,repoDescription:Le,onRepoDescriptionChange:Re,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Xe(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:dt})}),Ce&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Ae,{open:Ce,onOpenChange:Ee,commits:L,displayedCommits:G,isLoadingMore:q,onScroll:gt,currentBranch:X.currentBranch})}),Ue&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(je,{open:Ue,onOpenChange:We,onCommitFirst:ot,onStashAndPull:st,onCancel:()=>We(!1),isLoading:c})}),qe&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(H,{open:qe,onOpenChange:Je,onNewBranch:ct,onJustOpen:bt,isLoading:c})})]})}export{Me as GitOpsButton};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$r as n,Br as r,Ci as i,Ea as a,Fr as o,Gr as s,Hr as c,Ii as l,Ir as u,Jr as d,Lr as f,Ni as p,Nr as m,Pr as h,Qa as g,Qr as _,Rr as v,Sr as y,Ui as b,Ur as x,Vr as S,Wr as C,Xr as w,_ as T,ai as E,bo as D,br as O,c as ee,ci as k,co as te,fr as ne,gr as A,hr as re,ii as j,ji as M,l as N,li as ie,lo as ae,mr as oe,ni as se,oi as ce,oo as le,pr as ue,qr as de,ri as fe,rt as pe,s as me,si as P,so as he,ti as ge,u as _e,ui as F,uo as ve,vr as ye,wi as I,xo as be,xr as xe,yo as Se,yr as Ce,zr as we}from"./dialogs-config-
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$r as n,Br as r,Ci as i,Ea as a,Fr as o,Gr as s,Hr as c,Ii as l,Ir as u,Jr as d,Lr as f,Ni as p,Nr as m,Pr as h,Qa as g,Qr as _,Rr as v,Sr as y,Ui as b,Ur as x,Vr as S,Wr as C,Xr as w,_ as T,ai as E,bo as D,br as O,c as ee,ci as k,co as te,fr as ne,gr as A,hr as re,ii as j,ji as M,l as N,li as ie,lo as ae,mr as oe,ni as se,oi as ce,oo as le,pr as ue,qr as de,ri as fe,rt as pe,s as me,si as P,so as he,ti as ge,u as _e,ui as F,uo as ve,vr as ye,wi as I,xo as be,xr as xe,yo as Se,yr as Ce,zr as we}from"./dialogs-config-B-LZ4nOb.js";var Te=e(D(),1),L=Se(),R=e(be(),1),z=M(),Ee=`AlertDialog`,[De,Oe]=ce(Ee,[c]),B=c(),ke=e=>{let{__scopeAlertDialog:t,...n}=e,r=B(t);return(0,z.jsx)(v,{...r,...n,modal:!0})};ke.displayName=Ee;var Ae=`AlertDialogTrigger`,je=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...i}=e,a=B(n);return(0,z.jsx)(r,{...a,...i,ref:t})});je.displayName=Ae;var Me=`AlertDialogPortal`,Ne=e=>{let{__scopeAlertDialog:t,...n}=e,r=B(t);return(0,z.jsx)(f,{...r,...n})};Ne.displayName=Me;var Pe=`AlertDialogOverlay`,Fe=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(u,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogContent`,[Le,Re]=De(Ie),ze=se(`AlertDialogContent`),Be=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=B(n),o=R.useRef(null),s=p(t,o),c=R.useRef(null);return(0,z.jsx)(S,{contentName:Ie,titleName:Ve,docsSlug:`alert-dialog`,children:(0,z.jsx)(Le,{scope:n,cancelRef:c,children:(0,z.jsxs)(h,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:P(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,z.jsx)(ze,{children:r}),(0,z.jsx)(Ye,{contentRef:o})]})})})});Be.displayName=Ie;var Ve=`AlertDialogTitle`,He=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(we,{...i,...r,ref:t})});He.displayName=Ve;var Ue=`AlertDialogDescription`,We=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(o,{...i,...r,ref:t})});We.displayName=Ue;var Ge=`AlertDialogAction`,Ke=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(m,{...i,...r,ref:t})});Ke.displayName=Ge;var qe=`AlertDialogCancel`,Je=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Re(qe,n),a=B(n),o=p(t,i);return(0,z.jsx)(m,{...a,...r,ref:o})});Je.displayName=qe;var Ye=({contentRef:e})=>{let t=`\`${Ie}\` requires a description for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
You can add a description to the \`${Ie}\` by passing a \`${Ue}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
4
|
|