tarsk 0.5.59 → 0.5.60
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 +862 -144
- package/dist/public/assets/account-view-DPM8TZiH.js +1 -0
- package/dist/public/assets/api-BcqwPTwD.js +1 -0
- package/dist/public/assets/{async-error-boundary-CaRNnJZe.js → async-error-boundary-B56Jpu_o.js} +1 -1
- package/dist/public/assets/browser-tab-k2H96rcs.js +8 -0
- package/dist/public/assets/{card-DFACZp3F.js → card-C2MSBS4a.js} +1 -1
- package/dist/public/assets/commit-dialog-CPsT5k3n.js +1 -0
- package/dist/public/assets/context-menu-7zA2_Vvh.js +1 -0
- package/dist/public/assets/create-repo-dialog-wC-DyHKe.js +1 -0
- package/dist/public/assets/dialogs-config-C7xqDv5K.js +51 -0
- package/dist/public/assets/diff-view-dAnk7skm.js +4 -0
- package/dist/public/assets/{explorer-tab-context-DCq1BBX_.js → explorer-tab-context-gi63e_bv.js} +1 -1
- package/dist/public/assets/explorer-tab-view-ai_mDxBQ.js +2 -0
- package/dist/public/assets/explorer-tree-BZFGE0sU.js +1 -0
- package/dist/public/assets/explorer-view-D6MhosMA.js +75 -0
- package/dist/public/assets/git-history-dialog-Dd_DmfZC.js +1 -0
- package/dist/public/assets/git-ops-button-BhHIYXxb.js +2 -0
- package/dist/public/assets/history-view-DVqIaJOR.js +16 -0
- package/dist/public/assets/index-CyxfX_DC.css +1 -0
- package/dist/public/assets/index-D2AOIdVd.js +75 -0
- package/dist/public/assets/mcp-server-card-CuBKoFtN.js +1 -0
- package/dist/public/assets/merged-pr-dialog-M4vwv3lT.js +1 -0
- package/dist/public/assets/model-list-controls-DBAyi2PU.js +1 -0
- package/dist/public/assets/{monaco-CMkNoWsM.js → monaco-D3l3Gbj2.js} +1 -1
- package/dist/public/assets/onboarding-BpwQ9yz5.js +1 -0
- package/dist/public/assets/project-env-vars-view-Cs3LO_18.js +1 -0
- package/dist/public/assets/project-model-aliases-view-Z5b4ZC1k.js +1 -0
- package/dist/public/assets/project-settings-view-BOO6FS8b.js +1 -0
- package/dist/public/assets/project-tools-view-cjwDYCta.js +1 -0
- package/dist/public/assets/providers-list-view-BBGnB3Rq.js +1 -0
- package/dist/public/assets/pull-request-dialog-VOoEmwTG.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-CoHIwHJZ.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-9fV4cFz5.js +1 -0
- package/dist/public/assets/react-vendor-XZeum4Wo.js +14 -0
- package/dist/public/assets/settings-general-view-CDr9M3SH.js +1 -0
- package/dist/public/assets/settings-instructions-view-B2mWcZiS.js +1 -0
- package/dist/public/assets/settings-list-JqM9DgX9.js +1 -0
- package/dist/public/assets/settings-logs-view-BjlFrCXc.js +5 -0
- package/dist/public/assets/settings-mcp-servers-view-BmVtKqmN.js +5 -0
- package/dist/public/assets/settings-models-view-E-HNZWxO.js +1 -0
- package/dist/public/assets/settings-rules-view-CdOk3Osl.js +8 -0
- package/dist/public/assets/settings-skills-view-Cn-GySxU.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-CqYBr6_A.js +1 -0
- package/dist/public/assets/settings-statistics-view-B92b4bKS.js +1 -0
- package/dist/public/assets/settings-subagents-view-AL0iV3gX.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-B6CBgNW3.js +1 -0
- package/dist/public/assets/settings-telegram-view-DHQxRoFn.js +1 -0
- package/dist/public/assets/settings-view-CBLOR6Gr.js +2 -0
- package/dist/public/assets/{skeleton-DBWV1Usf.js → skeleton-CK0EzL_G.js} +1 -1
- package/dist/public/assets/slug-utils-CdbHvCiP.js +1 -0
- package/dist/public/assets/tasks-view-D1nPjESr.js +2 -0
- package/dist/public/assets/{terminal-panel-Dlon-VDl.js → terminal-panel-m9GEHtY2.js} +2 -2
- package/dist/public/assets/{ui-components-Dd2afm0c.js → ui-components-BuIiDdYp.js} +1 -1
- package/dist/public/assets/{use-deferred-search-Cu-o4nau.js → use-deferred-search-hIqqinof.js} +1 -1
- package/dist/public/assets/use-installed-ai-files-C1Uta9US.js +1 -0
- package/dist/public/assets/{use-settings-page-loading-D1JlmLmD.js → use-settings-page-loading-DtwNt6_e.js} +1 -1
- package/dist/public/assets/{utils-Dt07QR3w.js → utils-B1IYtes_.js} +1 -1
- package/dist/public/assets/{web-CdkfJJZ3.js → web-BF1VNxf3.js} +1 -1
- package/dist/public/assets/{web-DeCAC9ap.js → web-BGxrdTO9.js} +1 -1
- package/dist/public/assets/{web-DsLUxLTR.js → web-DrKfK3e-.js} +1 -1
- package/dist/public/assets/{web-CiaJzwav.js → web-LjAIxEG5.js} +1 -1
- package/dist/public/index.html +9 -9
- package/package.json +1 -1
- package/dist/public/assets/account-view-Cc6oDwk4.js +0 -1
- package/dist/public/assets/api-CtfZCd77.js +0 -1
- package/dist/public/assets/browser-tab-BfAt-Sho.js +0 -8
- package/dist/public/assets/commit-dialog-Ck0r2v9S.js +0 -1
- package/dist/public/assets/context-menu-CBvTcHUI.js +0 -1
- package/dist/public/assets/create-repo-dialog-CBvRaov7.js +0 -1
- package/dist/public/assets/dialogs-config-C2KFQf9x.js +0 -51
- package/dist/public/assets/diff-view-DDECIdhE.js +0 -4
- package/dist/public/assets/explorer-tab-view-72Krb0Ir.js +0 -2
- package/dist/public/assets/explorer-tree-CcFgAYMn.js +0 -1
- package/dist/public/assets/explorer-view-DsNxf6nu.js +0 -75
- package/dist/public/assets/git-history-dialog--akFTQOd.js +0 -1
- package/dist/public/assets/git-ops-button-CKGLh3Zk.js +0 -2
- package/dist/public/assets/history-view-IcXfB6BD.js +0 -15
- package/dist/public/assets/index-BmpLvHah.js +0 -75
- package/dist/public/assets/index-r8I03VVW.css +0 -1
- package/dist/public/assets/mcp-server-card-DDmDAlY8.js +0 -1
- package/dist/public/assets/merged-pr-dialog-CiwhRqFv.js +0 -1
- package/dist/public/assets/model-list-controls-D5IaOffK.js +0 -1
- package/dist/public/assets/onboarding-CFIVEI92.js +0 -1
- package/dist/public/assets/project-settings-view-Klpu7p3U.js +0 -1
- package/dist/public/assets/providers-list-view-Df-ONKwe.js +0 -1
- package/dist/public/assets/pull-request-dialog-DVYZgMuN.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CHHJ0gpA.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-DoNMB3C8.js +0 -1
- package/dist/public/assets/react-vendor-tSKmVA4e.js +0 -14
- package/dist/public/assets/settings-general-view-yDDYKQmO.js +0 -1
- package/dist/public/assets/settings-instructions-view-y9bUZtKn.js +0 -1
- package/dist/public/assets/settings-list-j_NDw-aW.js +0 -1
- package/dist/public/assets/settings-logs-view-BzrjJRk6.js +0 -5
- package/dist/public/assets/settings-mcp-servers-view-NuKeyQ92.js +0 -5
- package/dist/public/assets/settings-models-view-64UG4njI.js +0 -1
- package/dist/public/assets/settings-rules-view-DdxIfxki.js +0 -8
- package/dist/public/assets/settings-skills-view-DoVxhA-A.js +0 -3
- package/dist/public/assets/settings-slash-commands-view-vm0HNVw1.js +0 -1
- package/dist/public/assets/settings-statistics-view-CKc3bD1x.js +0 -1
- package/dist/public/assets/settings-subagents-view-DuHK-7uc.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-1clIREZ5.js +0 -1
- package/dist/public/assets/settings-telegram-view-DCPC5GxD.js +0 -1
- package/dist/public/assets/settings-view-BweC2YuW.js +0 -2
- package/dist/public/assets/slug-utils-D8SJJo7H.js +0 -1
- package/dist/public/assets/tasks-view-Cg9N8GZb.js +0 -2
- package/dist/public/assets/use-installed-ai-files-X8NXRdGD.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bo as t,Br as n,Cn as r,Hr as i,I as a,Qa as o,Rt as s,Uo as c,Us as l,Vo as u,Wt as d,Zr as f,_o as p,bs as m,ca as h,do as g,f as _,g as v,h as y,il as b,m as x,nl as S,tl as C,u as w,ua as T,uo as E,xa as D,xc as O,xo as k,xr as A,xs as j,yo as M}from"./dialogs-config-C7xqDv5K.js";import{f as N}from"./react-vendor-XZeum4Wo.js";import{At as P,Dt as F,En as I,Ht as L,Ot as ee,Tt as R,Vt as te,f as ne,p as z,zt as B}from"./history-view-DVqIaJOR.js";import{u as V}from"./onboarding-BpwQ9yz5.js";import{n as re}from"./utils-B1IYtes_.js";import{A as H,C as ie,F as ae,S as oe,Y as se,Z as ce,b as U,j as le,x as W}from"./index-D2AOIdVd.js";import{a as G,n as K,r as q,t as J}from"./context-menu-7zA2_Vvh.js";import{t as Y}from"./async-error-boundary-B56Jpu_o.js";import{n as X}from"./monaco-D3l3Gbj2.js";var Z=e(b(),1),Q=S(),$=C();function ue(e){let t=(0,Q.c)(12),{children:n,title:r,subtitle:i,headerAction:o,footer:s}=e,c;t[0]!==o||t[1]!==i||t[2]!==r?(c=(r||i||o)&&(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[(r||o)&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2`,children:r&&(0,$.jsx)(`span`,{className:O.sectionTitle,children:r})}),o&&(0,$.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:o})]}),i]}),t[0]=o,t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===n?l=t[5]:(l=(0,$.jsx)(a,{className:`min-h-0 flex-1`,children:n}),t[4]=n,t[5]=l);let u;t[6]===s?u=t[7]:(u=s&&(0,$.jsx)(`div`,{className:`border-t border-sidebar-border`,children:s}),t[6]=s,t[7]=u);let d;return t[8]!==c||t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-col`,children:[c,l,u]}),t[8]=c,t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function de(e){let t=(0,Q.c)(30),{node:n,level:r,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u}=e,d=!!(n.children&&n.children.length>0),f,p,m;if(t[0]!==a||t[1]!==u||t[2]!==d||t[3]!==r||t[4]!==n||t[5]!==l||t[6]!==c||t[7]!==i){f=u?.has(n.id)||(c[n.id]??a);let e;t[11]!==n.id||t[12]!==l?(e=()=>l(n.id),t[11]=n.id,t[12]=l,t[13]=e):e=t[13];let o=e;p=`min-w-0`,m=i(n,{isOpen:f,level:r,toggle:o,hasChildren:d}),t[0]=a,t[1]=u,t[2]=d,t[3]=r,t[4]=n,t[5]=l,t[6]=c,t[7]=i,t[8]=f,t[9]=p,t[10]=m}else f=t[8],p=t[9],m=t[10];let h;t[14]!==s||t[15]!==a||t[16]!==u||t[17]!==d||t[18]!==o||t[19]!==f||t[20]!==r||t[21]!==n.children||t[22]!==l||t[23]!==c||t[24]!==i?(h=d&&f&&(0,$.jsx)(`div`,{style:{paddingLeft:o},className:s,children:n.children.map(e=>(0,$.jsx)(de,{node:e,level:r+1,renderNode:i,defaultOpen:a,indent:o,childContainerClassName:s,openState:c,onToggle:l,forceOpenIds:u},e.id))}),t[14]=s,t[15]=a,t[16]=u,t[17]=d,t[18]=o,t[19]=f,t[20]=r,t[21]=n.children,t[22]=l,t[23]=c,t[24]=i,t[25]=h):h=t[25];let g;return t[26]!==p||t[27]!==m||t[28]!==h?(g=(0,$.jsxs)(`div`,{className:p,children:[m,h]}),t[26]=p,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}function fe(e){let t=(0,Q.c)(31),{nodes:n,renderNode:r,resetKey:i,defaultOpen:a,forceOpenIds:o,initialOpenIds:s,indent:c,childContainerClassName:l,className:u}=e,d=a===void 0?!1:a,f=c===void 0?16:c,p;t[0]===s?p=t[1]:(p=()=>{let e={};if(s)for(let t of s)e[t]=!0;return e},t[0]=s,t[1]=p);let[m,h]=(0,Z.useState)(p),[g,_]=(0,Z.useState)(i);if(i!==g){_(i);let e={};if(s)for(let t of s)e[t]=!0;h(e)}let v;t[2]===o?v=t[3]:(v=o?new Set(o):void 0,t[2]=o,t[3]=v);let y=v,b,x;t[4]===o?(b=t[5],x=t[6]):(b=()=>{o?.length&&h(e=>{let t={...e},n=!1;for(let e of o)t[e]!==!0&&(t[e]=!0,n=!0);return n?t:e})},x=[o],t[4]=o,t[5]=b,t[6]=x),(0,Z.useEffect)(b,x);let S;t[7]===d?S=t[8]:(S=e=>{h(t=>({...t,[e]:!(t[e]??d)}))},t[7]=d,t[8]=S);let C=S,w;t[9]===u?w=t[10]:(w=T(`min-w-0`,u),t[9]=u,t[10]=w);let E;if(t[11]!==l||t[12]!==d||t[13]!==y||t[14]!==C||t[15]!==f||t[16]!==n||t[17]!==m||t[18]!==r){let e;t[20]!==l||t[21]!==d||t[22]!==y||t[23]!==C||t[24]!==f||t[25]!==m||t[26]!==r?(e=e=>(0,$.jsx)(de,{node:e,level:0,renderNode:r,defaultOpen:d,indent:f,childContainerClassName:l,openState:m,onToggle:C,forceOpenIds:y},e.id),t[20]=l,t[21]=d,t[22]=y,t[23]=C,t[24]=f,t[25]=m,t[26]=r,t[27]=e):e=t[27],E=n.map(e),t[11]=l,t[12]=d,t[13]=y,t[14]=C,t[15]=f,t[16]=n,t[17]=m,t[18]=r,t[19]=E}else E=t[19];let D;return t[28]!==w||t[29]!==E?(D=(0,$.jsx)(`div`,{className:w,children:E}),t[28]=w,t[29]=E,t[30]=D):D=t[30],D}function pe(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 me={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},he={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function ge(e){return T(T(O.compact,`status-badge font-mono font-semibold`),me[e]??`text-orange-500`)}function _e(e){return he[e]??`M`}function ve(e){let n=(0,Q.c)(22),{treeData:r,files:i,error:a,selectedFileIndex:s,onFileSelect:l,onRevertFile:d}=e,{setStats:f}=H(),p;n[0]===i?p=n[1]:(p=i.reduce(Se,0),n[0]=i,n[1]=p);let h=p,g;n[2]===i?g=n[3]:(g=i.reduce(ye,0),n[2]=i,n[3]=g);let _=g,v,y;if(n[4]!==i.length||n[5]!==f||n[6]!==h||n[7]!==_?(v=()=>{f({fileCount:i.length,additions:h,deletions:_})},y=[i.length,h,_,f],n[4]=i.length,n[5]=f,n[6]=h,n[7]=_,n[8]=v,n[9]=y):(v=n[8],y=n[9]),(0,Z.useEffect)(v,y),a){let e;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(e=T(O.compact,`text-destructive text-center`),n[10]=e):e=n[10];let t;return n[11]===a?t=n[12]:(t=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:e,children:a})})}),n[11]=a,n[12]=t),t}if(i.length===0){let e;return n[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,$.jsx)(`p`,{className:T(O.compact,O.bodyMuted,`text-center`),children:`No changes to review`})})}),n[13]=e):e=n[13],e}let b;n[14]!==i||n[15]!==l||n[16]!==d||n[17]!==s?(b=(e,n)=>{let{isOpen:r,toggle:a}=n,f=!!e.children,p=(0,$.jsxs)(V,{onClick:()=>{f?a():e.fileIndex!==void 0&&l(e.fileIndex)},selected:!f&&e.fileIndex===s,className:`gap-1.5`,children:[f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(m,{className:T(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,$.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,$.jsx)(t,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,$.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!f&&e.status&&(0,$.jsx)(`span`,{className:ge(e.status),children:_e(e.status)})]});return f?p:(0,$.jsxs)(J,{children:[(0,$.jsx)(G,{asChild:!0,children:(0,$.jsx)(`div`,{children:p})}),(0,$.jsx)(K,{children:(0,$.jsxs)(q,{onClick:()=>{e.fileIndex!==void 0&&d?.(i[e.fileIndex])},children:[(0,$.jsx)(o,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},n[14]=i,n[15]=l,n[16]=d,n[17]=s,n[18]=b):b=n[18];let x;return n[19]!==b||n[20]!==r?(x=(0,$.jsx)(ue,{children:(0,$.jsx)(`div`,{className:`px-1 pt-3 pb-2`,children:(0,$.jsx)(fe,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:b})})}),n[19]=b,n[20]=r,n[21]=x):x=n[21],x}function ye(e,t){return e+t.hunks.reduce(be,0)}function be(e,t){return e+t.changes.filter(xe).length}function xe(e){return e.type===`delete`}function Se(e,t){return e+t.hunks.reduce(Ce,0)}function Ce(e,t){return e+t.changes.filter(we).length}function we(e){return e.type===`add`}function Te(e){let t=(0,Q.c)(36),{open:n,lineNumber:r,lineContent:i,initialComment:a,isEditing:o,onSave:s,onDelete:c,onClose:l}=e,[u,d]=(0,Z.useState)((a===void 0?``:a)??``),f;t[0]!==s||t[1]!==u?(f=()=>{u.trim()&&s(u.trim())},t[0]=s,t[1]=u,t[2]=f):f=t[2];let p=f,m;t[3]===p?m=t[4]:(m=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),p())},t[3]=p,t[4]=m);let g=m,b;t[5]===l?b=t[6]:(b=e=>{e||l()},t[5]=l,t[6]=b);let S;t[7]===r?S=t[8]:(S=(0,$.jsx)(y,{children:(0,$.jsxs)(v,{children:[`Comment on line `,r]})}),t[7]=r,t[8]=S);let C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=T(O.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=C):C=t[9];let E=i||` `,D;t[10]===E?D=t[11]:(D=(0,$.jsx)(`div`,{className:C,children:E}),t[10]=E,t[11]=D);let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>d(e.target.value),t[12]=k):k=t[12];let A;t[13]!==g||t[14]!==u?(A=(0,$.jsx)(ae,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:u,onChange:k,onKeyDown:g,rows:12,className:`resize-none text-base`}),t[13]=g,t[14]=u,t[15]=A):A=t[15];let j;t[16]!==o||t[17]!==c?(j=o&&c&&(0,$.jsx)(h,{variant:`destructive`,size:`sm`,onClick:c,className:`mr-auto`,children:`Delete`}),t[16]=o,t[17]=c,t[18]=j):j=t[18];let M;t[19]===u?M=t[20]:(M=u.trim(),t[19]=u,t[20]=M);let N=!M,P;t[21]!==p||t[22]!==N?(P=(0,$.jsx)(h,{size:`sm`,onClick:p,disabled:N,children:`Save`}),t[21]=p,t[22]=N,t[23]=P):P=t[23];let F;t[24]!==j||t[25]!==P?(F=(0,$.jsxs)(x,{className:`gap-2 sm:gap-0`,children:[j,P]}),t[24]=j,t[25]=P,t[26]=F):F=t[26];let I;t[27]!==A||t[28]!==F||t[29]!==S||t[30]!==D?(I=(0,$.jsxs)(_,{className:`max-w-2xl`,children:[S,D,A,F]}),t[27]=A,t[28]=F,t[29]=S,t[30]=D,t[31]=I):I=t[31];let L;return t[32]!==n||t[33]!==I||t[34]!==b?(L=(0,$.jsx)(w,{open:n,onOpenChange:b,children:I}),t[32]=n,t[33]=I,t[34]=b,t[35]=L):L=t[35],L}function Ee(e){let t=te(),n=L(e=>e.diffComments),i=(0,Z.useMemo)(()=>n[e]??[],[n,e]),a=(0,Z.useCallback)(r=>{let i=n[e]??[],a=typeof r==`function`?r(i):r;t({type:I.SetDiffComments,threadId:e,comments:a})},[t,e,n]),o=(0,Z.useRef)(!1);return(0,Z.useEffect)(()=>{if((n[e]??[]).length>0){o.current=!0;return}r(e).then(n=>{n.diffComments&&n.diffComments.length>0&&t({type:I.SetDiffComments,threadId:e,comments:n.diffComments}),o.current=!0}).catch(()=>{o.current=!0})},[e]),(0,Z.useEffect)(()=>{o.current&&A(e,{diffComments:i}).catch(()=>{})},[e,i]),{comments:i,setComments:a}}function De(e,t){return`git-diff:${e}:${t}`}function Oe(){return Error(`Loading review changes timed out. Please try again.`)}async function ke(e,t=15e3){return Promise.race([n(e),new Promise((e,n)=>{window.setTimeout(()=>n(Oe()),t)})])}var Ae=2;function je(e,t){return t<=0?{min:e,max:e}:{min:e,max:e+t-1}}function Me(e,t){return{startLine:Math.max(1,e-Ae),endLine:t+Ae}}function Ne(e){if(e.hunks.length===0)return null;let t=1/0,n=0,r=1/0,i=0;for(let a of e.hunks){let e=je(a.oldStart,a.oldLines),o=je(a.newStart,a.newLines);t=Math.min(t,e.min),n=Math.max(n,e.max),r=Math.min(r,o.min),i=Math.max(i,o.max)}return t===1/0||r===1/0?null:{original:Me(t,n),modified:Me(r,i)}}function Pe(e,t,n){if(e.length===0)return``;let r=e.endsWith(`
|
|
2
|
+
`),i=e.split(`
|
|
3
|
+
`);return r&&i.length>0&&i[i.length-1]===``&&i.pop(),i.slice(Math.max(0,t-1),Math.max(t-1,n)).join(`
|
|
4
|
+
`)}function Fe(e){let t=Ne(e);return t?t.original.startLine<=1||t.modified.startLine<=1:!0}function Ie(e,t){return t?e-t.startLine+1:e}function Le(e,t){return t?t.startLine+e-1:e}function Re(e){return{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`}function ze(e){let t=(0,Q.c)(33),{comments:n,activeCommentIndex:r,isFullView:i,selectedFileIndex:a,files:o,selectedFile:s,onLineGutterClick:c}=e,l=(0,Z.useRef)(null),u=(0,Z.useRef)(n),d=(0,Z.useRef)(r),f;t[0]!==o||t[1]!==i||t[2]!==a?(f={isFullView:i,selectedFileIndex:a,files:o},t[0]=o,t[1]=i,t[2]=a,t[3]=f):f=t[3];let p=(0,Z.useRef)(f),m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m={original:[],modified:[]},t[4]=m):m=t[4];let h=(0,Z.useRef)(m),g=(0,Z.useRef)(!0),_,v;t[5]===n?(_=t[6],v=t[7]):(_=()=>{u.current=n},v=[n],t[5]=n,t[6]=_,t[7]=v),(0,Z.useEffect)(_,v);let y,b;t[8]===r?(y=t[9],b=t[10]):(y=()=>{d.current=r},b=[r],t[8]=r,t[9]=y,t[10]=b),(0,Z.useEffect)(y,b);let x,S;t[11]!==o||t[12]!==i||t[13]!==a?(x=()=>{p.current={isFullView:i,selectedFileIndex:a,files:o}},S=[i,a,o],t[11]=o,t[12]=i,t[13]=a,t[14]=x,t[15]=S):(x=t[14],S=t[15]),(0,Z.useEffect)(x,S);let C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{if(!g.current)return;let e=l.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=p.current,i=u.current,a=d.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Ne(o),c=s?r===`original`?s.original:s.modified:null,l=i.filter(e=>e.fileIndex===n&&e.side===r),u=new Set(l.map(e=>Ie(e.lineNumber,c))),d=e.getModel()?.getLineCount()??0,f=[];for(let e=1;e<=d;e++)u.has(e)||f.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:X.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let p=l.map(e=>{let t=Ie(e.lineNumber,c);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:X.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(Ve);f.push(...p);let m=r===`original`?h.current.original:h.current.modified,g=e.deltaDecorations(m,f);r===`original`?h.current.original=g:h.current.modified=g};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},t[16]=C):C=t[16];let w=C,T;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{w()},t[17]=T):T=t[17];let E;t[18]!==r||t[19]!==n||t[20]!==i||t[21]!==s||t[22]!==a?(E=[w,n,r,a,i,s],t[18]=r,t[19]=n,t[20]=i,t[21]=s,t[22]=a,t[23]=E):E=t[23],(0,Z.useEffect)(T,E);let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>()=>{l.current=null,h.current={original:[],modified:[]}},t[24]=D):D=t[24];let O;t[25]===a?O=t[26]:(O=[a],t[25]=a,t[26]=O),(0,Z.useEffect)(D,O);let k,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>()=>{g.current=!1,l.current&&=(l.current.getOriginalEditor().getModel()?.dispose(),l.current.getModifiedEditor().getModel()?.dispose(),l.current.dispose(),null),h.current={original:[],modified:[]}},A=[],t[27]=k,t[28]=A):(k=t[27],A=t[28]),(0,Z.useEffect)(k,A);let j;t[29]===c?j=t[30]:(j=e=>{l.current=e;let t=Be,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}=p.current,l=s[o];if(!l)return;let d=a?null:Ne(l),f=Le(i,d?n===`original`?d.original:d.modified:null),m=e.getModel()?.getLineContent(i)??``;c({existing:u.current.find(e=>e.fileIndex===o&&e.lineNumber===f&&e.side===n),lineNumber:f,lineContent:m,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{l.current===e&&w()},150)},t[29]=c,t[30]=j);let M=j,N;return t[31]===M?N=t[32]:(N={diffEditorRef:l,applyAllDecorations:w,handleEditorDidMount:M},t[31]=M,t[32]=N),N}function Be(e){return e===X.MouseTargetType.GUTTER_GLYPH_MARGIN||e===X.MouseTargetType.GUTTER_LINE_NUMBERS||e===X.MouseTargetType.GUTTER_LINE_DECORATIONS||e===X.MouseTargetType.GUTTER_VIEW_ZONE}function Ve(e){return e!==null}var He=B(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Ue=B(e=>(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,$.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,$.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),We=function(e){let t=(0,Q.c)(5),{onRetry:n}=e,[r,i]=(0,Z.useState)(!1),a,o;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=window.setTimeout(()=>{i(!0)},15e3);return()=>{window.clearTimeout(e)}},o=[],t[0]=a,t[1]=o):(a=t[0],o=t[1]),(0,Z.useEffect)(a,o),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(He,{v0:(0,$.jsx)(R,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let s;return t[3]===n?s=t[4]:(s=(0,$.jsx)(Ue,{v0:O.bodyMuted,v1:(0,$.jsx)(h,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=s),s},Ge=B(e=>(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,$.jsx)(`div`,{className:e.v0,children:e.v1}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,$.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),Ke=function(e){let t=(0,Q.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=Je(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=T(O.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,$.jsx)(Ge,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function qe(e,t,n){return`git-media:${e}:${t}:${n}`}function Je(e,t,n){let r=(0,Q.c)(13),a;r[0]!==t||r[1]!==e||r[2]!==n?(a=qe(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=a):a=r[3];let o;r[4]!==t||r[5]!==e||r[6]!==n?(o=()=>i(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=o):o=r[7];let s=ne(a,o),c;r[8]===s?c=r[9]:(c=URL.createObjectURL(s),r[8]=s,r[9]=c);let l=c,u,d;return r[10]===l?(u=r[11],d=r[12]):(u=()=>()=>{URL.revokeObjectURL(l)},d=[l],r[10]=l,r[11]=u,r[12]=d),(0,Z.useEffect)(u,d),l}function Ye(e){let t=(0,Q.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(R,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,$.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,$.jsx)(Z.Suspense,{fallback:e,children:(0,$.jsx)(Ke,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(R,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,$.jsx)(`div`,{className:`flex-1`,children:(0,$.jsx)(Z.Suspense,{fallback:o,children:(0,$.jsx)(Ke,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,$.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,$.jsx)(R,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,$.jsx)(Ke,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,$.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,$.jsx)(Z.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Xe(e){let t=(0,Q.c)(63),{threadId:n,selectedFile:r,selectedFileIndex:i,isImageFile:a,diffOriginal:o,diffModified:s,resolvedTheme:c,onEditorMount:l,diffEditorOptions:u,isPanelCollapsed:d,showTreeBackButton:f,onShowTree:_,onTogglePanel:v,isFullView:y,onToggleFullView:b,comments:x,activeCommentIndex:S,onPrevComment:C,onNextComment:w,onFixComments:A,isChatOpen:I,onOpenChat:L,onCloseChat:R}=e,te=d&&`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`,ne;t[0]===te?ne=t[1]:(ne=T(`bg-transparent`,te),t[0]=te,t[1]=ne);let z;t[2]!==d||t[3]!==_||t[4]!==v||t[5]!==f?(z=f?(0,$.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:_,children:[(0,$.jsx)(E,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,$.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:v,children:[d?(0,$.jsx)(E,{className:`h-4 w-4`}):(0,$.jsx)(g,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),t[2]=d,t[3]=_,t[4]=v,t[5]=f,t[6]=z):z=t[6];let B;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(B=T(O.label,`text-foreground`),t[7]=B):B=t[7];let V=r?r.path:`Review Changes`,re;t[8]===V?re=t[9]:(re=(0,$.jsx)(`span`,{className:B,children:V}),t[8]=V,t[9]=re);let H;t[10]!==z||t[11]!==re?(H=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[z,re]}),t[10]=z,t[11]=re,t[12]=H):H=t[12];let ie=d&&`ml-0`,ae=!d&&`ml-auto`,oe;t[13]!==ie||t[14]!==ae?(oe=T(`flex items-center gap-2`,ie,ae,`md:ml-auto`),t[13]=ie,t[14]=ae,t[15]=oe):oe=t[15];let se;t[16]!==y||t[17]!==a||t[18]!==b||t[19]!==r?(se=!a&&(0,$.jsx)(h,{variant:`ghost`,size:`sm`,onClick:b,disabled:!r,className:T(O.compact,`h-8 gap-1 px-2`),children:y?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(p,{className:`h-3 w-3`}),` Show changes only`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(k,{className:`h-3 w-3`}),` Show full file`]})}),t[16]=y,t[17]=a,t[18]=b,t[19]=r,t[20]=se):se=t[20];let U;t[21]!==S||t[22]!==x.length||t[23]!==w||t[24]!==C?(U=x.length>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsxs)(F,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:C,disabled:(S??0)===0,children:(0,$.jsx)(j,{className:`h-3 w-3`})})}),(0,$.jsx)(ee,{children:`Previous comment`})]}),(0,$.jsx)(`span`,{className:T(O.caption,`whitespace-nowrap`),children:x.length===1?`1 Comment`:`Comment ${(S??0)+1} of ${x.length}`}),(0,$.jsxs)(F,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:w,disabled:(S??0)===x.length-1,children:(0,$.jsx)(m,{className:`h-3 w-3`})})}),(0,$.jsx)(ee,{children:`Next comment`})]})]}),t[21]=S,t[22]=x.length,t[23]=w,t[24]=C,t[25]=U):U=t[25];let W;t[26]!==x.length||t[27]!==A?(W=x.length>0&&(0,$.jsxs)(F,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsxs)(h,{size:`sm`,onClick:A,className:T(O.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,$.jsx)(M,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,$.jsx)(ee,{children:`Send all comments to Tarsk for resolution`})]}),t[26]=x.length,t[27]=A,t[28]=W):W=t[28];let G;t[29]!==oe||t[30]!==se||t[31]!==U||t[32]!==W?(G=(0,$.jsxs)(`div`,{className:oe,children:[se,U,W]}),t[29]=oe,t[30]=se,t[31]=U,t[32]=W,t[33]=G):G=t[33];let K;t[34]!==G||t[35]!==ne||t[36]!==H?(K=(0,$.jsxs)(ce,{className:ne,children:[H,G]}),t[34]=G,t[35]=ne,t[36]=H,t[37]=K):K=t[37];let q;t[38]!==u||t[39]!==s||t[40]!==o||t[41]!==a||t[42]!==l||t[43]!==c||t[44]!==r||t[45]!==i||t[46]!==n?(q=a&&r?(0,$.jsx)(Ye,{threadId:n,file:r}):(0,$.jsx)(N,{height:`100%`,language:Re(r?.path||``),original:o,modified:s,theme:c===`dark`?`vs-dark`:`vs-light`,onMount:l,options:u},`diff-${i}`),t[38]=u,t[39]=s,t[40]=o,t[41]=a,t[42]=l,t[43]=c,t[44]=r,t[45]=i,t[46]=n,t[47]=q):q=t[47];let J;t[48]!==I||t[49]!==R?(J=I&&(0,$.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,$.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,$.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:R,children:[(0,$.jsx)(D,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,$.jsx)(le,{})]}),t[48]=I,t[49]=R,t[50]=J):J=t[50];let Y;t[51]!==I||t[52]!==L?(Y=!I&&(0,$.jsxs)(F,{children:[(0,$.jsx)(P,{asChild:!0,children:(0,$.jsxs)(h,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:L,children:[(0,$.jsx)(M,{className:`h-5 w-5`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,$.jsx)(ee,{children:`Chat about this diff`})]}),t[51]=I,t[52]=L,t[53]=Y):Y=t[53];let X;t[54]!==J||t[55]!==Y?(X=(0,$.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[J,Y]}),t[54]=J,t[55]=Y,t[56]=X):X=t[56];let Z;t[57]!==q||t[58]!==X?(Z=(0,$.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[q,X]}),t[57]=q,t[58]=X,t[59]=Z):Z=t[59];let ue;return t[60]!==K||t[61]!==Z?(ue=(0,$.jsxs)(`div`,{className:`diff-editor-panel flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[K,Z]}),t[60]=K,t[61]=Z,t[62]=ue):ue=t[62],ue}function Ze(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(U,{withHandle:!0,className:`z-10 shrink-0`}),e[0]=t):t=e[0],t}function Qe(e){let t=(0,Q.c)(8),{isMobile:n,mobileShowTree:r,panelRef:i,onPanelCollapse:a,onPanelExpand:o,fileTreePanel:s,diffEditorPanel:c}=e,l;return t[0]!==c||t[1]!==s||t[2]!==n||t[3]!==r||t[4]!==a||t[5]!==o||t[6]!==i?(l=(0,$.jsx)(`div`,{className:`diff-body flex min-h-0 w-full flex-1 overflow-hidden`,children:n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:T(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,!r&&`hidden`),children:s}),(0,$.jsx)(`div`,{className:T(`flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,r&&`hidden`),children:c})]}):(0,$.jsxs)(oe,{direction:`horizontal`,children:[(0,$.jsx)(W,{ref:i,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:a,onExpand:o,className:`overflow-hidden border-r border-transparent`,children:s}),(0,$.jsx)(Ze,{}),(0,$.jsx)(W,{className:`overflow-hidden border-l border-border bg-transparent`,children:c})]})}),t[0]=c,t[1]=s,t[2]=n,t[3]=r,t[4]=a,t[5]=o,t[6]=i,t[7]=l):l=t[7],l}var $e=l(`app.diff-view.ui`);function et({threadId:e,onExit:t,loadVersion:r,cachedState:i,onCachedStateChange:a}){let o=ne(De(e,r),()=>ke(e)),c=te(),l=L(e=>e.projectModelSelections),{resolvedTheme:u}=re(),p=ie(),{fetchUnifiedStatus:m}=se(),[h,g]=(0,Z.useState)(i?.files??o.files??[]),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(i?.selectedFileIndex??0),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!0),k=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{g(o.files??[]),b(e=>{let t=i?.selectedFileIndex??e,n=Math.max((o.files?.length??1)-1,0);return Math.min(t,n)})},[i?.selectedFileIndex,o.files]),(0,Z.useEffect)(()=>{O(!0)},[e]);let A=(0,Z.useCallback)(e=>{b(e),p&&O(!1)},[p]);(0,Z.useEffect)(()=>{a&&a(e=>{let t=h,n=Math.max(t.length-1,0),r=Math.min(y,n);return e?.files===t&&e.selectedFileIndex===r?e:{files:t,selectedFileIndex:r}})},[h,a,y]);let j=(0,Z.useCallback)(()=>{O(!0)},[]),M=p&&!D,{comments:N,setComments:P}=Ee(e),[F,ee]=(0,Z.useState)(null),[R,z]=(0,Z.useState)(null),[B,V]=(0,Z.useState)(null),H=(0,Z.useCallback)(()=>{k.current&&(C?k.current.expand():k.current.collapse())},[C]),ae=(0,Z.useCallback)(async()=>{if(e){v(null);try{g((await n(e)).files||[]),b(0)}catch(e){v(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),oe=(0,Z.useCallback)(async t=>{try{await f(e,t.path),await Promise.all([ae(),m(!0)])}catch(e){v(e instanceof Error?e.message:`Failed to revert file`)}},[e,ae,m]),ce=(0,Z.useMemo)(()=>pe(h),[h]),U=h[y],le=U?.isBinary??!1,W=U?x?U.oldContent:(()=>{let e=Ne(U);return e?Pe(U.oldContent,e.original.startLine,e.original.endLine):U.oldContent})():``,G=U?x?U.newContent:(()=>{let e=Ne(U);return e?Pe(U.newContent,e.modified.startLine,e.modified.endLine):U.newContent})():``,{diffEditorRef:K,applyAllDecorations:q,handleEditorDidMount:J}=ze({comments:N,activeCommentIndex:F,isFullView:x,selectedFileIndex:y,files:h,selectedFile:U,onLineGutterClick:(0,Z.useCallback)(({existing:e,lineNumber:t,lineContent:n,side:r})=>{e?V(e):z({lineNumber:t,lineContent:n,side:r})},[])}),Y=(0,Z.useCallback)(e=>{if(R&&U){let t={id:`comment-${Date.now()}`,filePath:U.path,fileIndex:y,lineNumber:R.lineNumber,lineContent:R.lineContent,comment:e,side:R.side};P(e=>[...e,t]),z(null)}else B&&(P(t=>t.map(t=>t.id===B.id?{...t,comment:e}:t)),V(null))},[R,B,U,y,P]),X=(0,Z.useCallback)(()=>{B&&(P(e=>e.filter(e=>e.id!==B.id)),V(null))},[B,P]),Q=(0,Z.useCallback)(e=>{if(N.length===0)return;let t=(e%N.length+N.length)%N.length,n=N[t];ee(t),b(n.fileIndex),p&&O(!1),setTimeout(()=>{let e=K.current;if(!e)return;let t=h[n.fileIndex];if(!t)return;let r=x?null:Ne(t),i=r?n.side===`original`?r.original:r.modified:null,a=Ie(n.lineNumber,i);(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,a)),q()},100)},[N,h,x,q,p]),ue=(0,Z.useCallback)(()=>{Q((F??0)-1)},[Q,F]),de=(0,Z.useCallback)(()=>{Q((F??-1)+1)},[Q,F]),fe=(0,Z.useCallback)(async()=>{let n=l[e];if(!n)try{let e=await d(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{$e.error(`No models available to process comments`);return}}catch(e){$e.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:n}=await s(e,N);P([]),c({type:I.SetPendingChatMessage,message:{threadId:e,message:n,model:r,provider:i}}),t()}catch(e){$e.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[N,l,c,e,t,P]),me={readOnly:!0,renderSideBySide:!p,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:U&&(x||Fe(U))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,$.jsxs)(`div`,{className:`diff-view-root flex h-full min-h-0 w-full flex-col`,children:[(0,$.jsx)(Qe,{isMobile:p,mobileShowTree:D,panelRef:k,onPanelCollapse:()=>w(!0),onPanelExpand:()=>w(!1),fileTreePanel:(0,$.jsx)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col overflow-hidden`,children:(0,$.jsx)(ve,{treeData:ce,files:h,error:_,selectedFileIndex:y,onFileSelect:A,onRevertFile:oe})}),diffEditorPanel:(0,$.jsx)(Xe,{threadId:e,selectedFile:U,selectedFileIndex:y,isImageFile:le,diffOriginal:W,diffModified:G,resolvedTheme:u,onEditorMount:J,diffEditorOptions:me,isPanelCollapsed:C,showTreeBackButton:M,onShowTree:j,onTogglePanel:H,isFullView:x,onToggleFullView:()=>S(e=>!e),comments:N,activeCommentIndex:F,onPrevComment:ue,onNextComment:de,onFixComments:fe,isChatOpen:T,onOpenChat:()=>E(!0),onCloseChat:()=>E(!1)})}),(0,$.jsx)(Te,{open:R!==null||B!==null,lineNumber:B?.lineNumber??R?.lineNumber??0,lineContent:B?.lineContent??R?.lineContent??``,initialComment:B?.comment,isEditing:B!==null,onSave:Y,onDelete:X,onClose:()=>{z(null),V(null)}},`${B?.id??``}-${R?.lineNumber??``}-${R?.side??``}`)]})}function tt(e){let t=(0,Q.c)(23),[n,r]=(0,Z.useState)(0),[i,a]=(0,Z.useState)(0),o=(0,Z.useRef)(0),s=!!e.cachedState,c;t[0]===e.threadId?c=t[1]:(c=()=>{r(t=>(z(De(e.threadId,t)),t+1)),a(rt)},t[0]=e.threadId,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(0),r(0),o.current=0},t[2]=u):u=t[2];let d;t[3]===e.threadId?d=t[4]:(d=[e.threadId],t[3]=e.threadId,t[4]=d),(0,Z.useEffect)(u,d);let f,p;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(f=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(z(De(e.threadId,t)),t+1)),a(nt))},p=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=f,t[8]=p):(f=t[7],p=t[8]),(0,Z.useEffect)(f,p);let m=`${e.threadId}:${i}`,h;t[9]!==l||t[10]!==s?(h=s?null:(0,$.jsx)(We,{onRetry:l}),t[9]=l,t[10]=s,t[11]=h):h=t[11];let g=`${e.threadId}:${n}`,_;t[12]!==n||t[13]!==e||t[14]!==g?(_=(0,$.jsx)(et,{...e,loadVersion:n},g),t[12]=n,t[13]=e,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==h||t[17]!==_?(v=(0,$.jsx)(Z.Suspense,{fallback:h,children:_}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;return t[19]!==l||t[20]!==m||t[21]!==v?(y=(0,$.jsx)(Y,{fallbackTitle:`Failed to load review changes`,onRetry:l,children:v},m),t[19]=l,t[20]=m,t[21]=v,t[22]=y):y=t[22],y}function nt(e){return e+1}function rt(e){return e+1}export{tt as DiffView,tt as default};
|
package/dist/public/assets/{explorer-tab-context-DCq1BBX_.js → explorer-tab-context-gi63e_bv.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{il as t,nl as n,tl as r}from"./dialogs-config-C7xqDv5K.js";var i=n(),a=e(t(),1),o=r(),s=(0,a.createContext)(null);function c(e){let t=(0,i.c)(8),{children:n}=e,[r,c]=(0,a.useState)(null),[u,d]=(0,a.useState)(0),[f,p]=(0,a.useState)(null),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{d(l)},t[0]=m):m=t[0];let h=m,g;t[1]!==f||t[2]!==u||t[3]!==r?(g={pendingExplorerPath:r,setPendingExplorerPath:c,explorerRefreshTick:u,triggerExplorerRefresh:h,explorerClearPath:f,setExplorerClearPath:p},t[1]=f,t[2]=u,t[3]=r,t[4]=g):g=t[4];let _=g,v;return t[5]!==n||t[6]!==_?(v=(0,o.jsx)(s.Provider,{value:_,children:n}),t[5]=n,t[6]=_,t[7]=v):v=t[7],v}function l(e){return e+1}function u(){let e=(0,a.useContext)(s);if(!e)throw Error(`useExplorerTab must be used within an ExplorerTabProvider`);return e}export{u as n,c as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-BZFGE0sU.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-D2AOIdVd.js","assets/history-view-DVqIaJOR.js","assets/dialogs-config-C7xqDv5K.js","assets/onboarding-BpwQ9yz5.js","assets/explorer-tab-context-gi63e_bv.js","assets/react-vendor-XZeum4Wo.js","assets/monaco-D3l3Gbj2.js","assets/monaco-Br_kD0ds.css","assets/utils-B1IYtes_.js","assets/index-CyxfX_DC.css","assets/api-BcqwPTwD.js","assets/explorer-file-drop-DaQtKkIj.js","assets/async-error-boundary-B56Jpu_o.js","assets/card-C2MSBS4a.js","assets/context-menu-7zA2_Vvh.js","assets/ui-components-BuIiDdYp.js","assets/explorer-view-D6MhosMA.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Co as t,Ea as n,I as r,il as i,tl as a,ua as o,xc as s}from"./dialogs-config-C7xqDv5K.js";import{D as ee,E as c,Et as l,Ht as te,M as u,O as d,T as f,Tt as ne,ir as p,j as re,w as m}from"./history-view-DVqIaJOR.js";import{n as h}from"./explorer-tab-context-gi63e_bv.js";import{C as g,J as _,S as v,b as y,x as b}from"./index-D2AOIdVd.js";import{t as x}from"./async-error-boundary-B56Jpu_o.js";import{d as S}from"./api-BcqwPTwD.js";import{i as C,n as w,r as T,t as E}from"./explorer-file-drop-DaQtKkIj.js";var D=e(i(),1),O=a(),ie=(0,D.lazy)(()=>p(()=>import(`./explorer-tree-BZFGE0sU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))),ae=(0,D.lazy)(()=>p(()=>import(`./explorer-view-D6MhosMA.js`),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,14,15])));function k(){let e=te(e=>e.selectedThreadId),i=g(),[a,p]=(0,D.useState)(null),[k,A]=(0,D.useState)(!0),[j,M]=(0,D.useState)(null),[N,P]=(0,D.useState)(!1),[F,I]=(0,D.useState)(!1),L=(0,D.useRef)(0),{pendingExplorerPath:R,setPendingExplorerPath:z,explorerClearPath:B,setExplorerClearPath:V,triggerExplorerRefresh:H}=h();(0,D.useEffect)(()=>{function e(e){C(e.dataTransfer)&&e.preventDefault()}return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]),(0,D.useEffect)(()=>{A(!0)},[e]);let U=(0,D.useCallback)(e=>{p(e),i&&A(!1)},[i]),W=(0,D.useCallback)(()=>{A(!0)},[]),G=(0,D.useCallback)(e=>{p(e),i&&A(!1)},[i]);(0,D.useEffect)(()=>{R&&(p({name:R.split(`/`).pop()??R,path:R,type:`file`}),i&&A(!1),z(null))},[i,R,z]),(0,D.useEffect)(()=>{B&&(a&&(a.path===B||a.path.startsWith(B+`/`))&&(p(null),i&&A(!0)),V(null))},[B,i,a,V]);function K(){L.current=0,I(!1)}function q(e){C(e.dataTransfer)&&(L.current+=1,I(!0))}function oe(e){C(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function se(e){C(e.dataTransfer)&&(L.current=Math.max(0,L.current-1),L.current===0&&I(!1))}function ce(e){if(!C(e.dataTransfer))return;e.preventDefault(),K();let{files:t,skippedFolders:n}=T(e.dataTransfer);n>0&&u({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),t.length!==0&&M({files:t,dirPath:``})}let J=(0,D.useCallback)((e,t)=>{L.current=0,I(!1),M({files:e,dirPath:t})},[]);async function le(){if(!(!j||!e||N)){P(!0);try{let t=await Promise.allSettled(j.files.map(t=>S(e,j.dirPath,t))),n=t.filter(e=>e.status===`rejected`),r=t.length-n.length;if(r>0&&H(),n.length===0)u({title:r===1?`File copied`:`Files copied`,description:`Copied ${w(j.files)} into ${E(j.dirPath)}.`});else{let e=n[0].reason;u({title:r>0?`Some files were not copied`:`Copy failed`,description:e instanceof Error?e.message:`Failed to copy the dropped file.`,variant:`destructive`})}}finally{P(!1),M(null)}}}let Y={onDragEnter:q,onDragOver:oe,onDragLeave:se,onDrop:ce},X=F?(0,O.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-50 flex items-center justify-center bg-background/70`,children:(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border-2 border-dashed border-primary bg-background px-6 py-4`,children:[(0,O.jsx)(n,{className:`h-4 w-4 text-primary`}),(0,O.jsx)(`span`,{className:s.label,children:`Drop files to copy them into the repository`})]})}):null,Z=(0,O.jsx)(r,{className:`h-full`,children:e?(0,O.jsx)(_,{threadId:e,children:(0,O.jsx)(x,{fallbackTitle:`Failed to load files`,children:(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(l,{}),children:(0,O.jsx)(ie,{threadId:e,selectedPath:a?.path??null,onNodeSelect:U,onFilesDrop:J})})})}):(0,O.jsx)(`p`,{className:o(s.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),Q=(0,O.jsx)(D.Suspense,{fallback:(0,O.jsx)(ne,{}),children:(0,O.jsx)(ae,{selectedFile:a,showTreeBackButton:i&&!k,onShowTree:W,onFileCreated:G})}),$=(0,O.jsx)(m,{open:j!==null,onOpenChange:e=>{!e&&!N&&M(null)},children:(0,O.jsxs)(ee,{children:[(0,O.jsxs)(re,{children:[`Copy `,j&&j.files.length>1?`files`:`file`]}),(0,O.jsx)(d,{children:j?`Copy ${w(j.files)} into ${E(j.dirPath)}?`:null}),(0,O.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,O.jsx)(c,{disabled:N,children:`Cancel`}),(0,O.jsxs)(f,{disabled:N,onClick:e=>{e.preventDefault(),le()},children:[N?(0,O.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Copy`]})]})]})});return i?(0,O.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,...Y,children:[X,$,(0,O.jsx)(`div`,{className:o(`flex-1 min-h-0 overflow-hidden`,!k&&`hidden`),children:Z}),(0,O.jsx)(`div`,{className:o(`flex-1 min-h-0 overflow-hidden`,k&&`hidden`),children:Q})]}):(0,O.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,...Y,children:[X,$,(0,O.jsxs)(v,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[(0,O.jsx)(b,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:Z}),(0,O.jsx)(y,{withHandle:!0}),(0,O.jsx)(b,{className:`overflow-hidden`,children:Q})]})]})}export{k as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bo as t,Ja as n,Ss as r,Uo as i,Vo as a,bs as o,c as s,il as c,nl as l,tl as u,ua as d,xc as f}from"./dialogs-config-C7xqDv5K.js";import{D as p,E as m,Et as h,M as g,O as _,T as v,f as y,j as b,p as x,w as S,wt as C}from"./history-view-DVqIaJOR.js";import{u as w}from"./onboarding-BpwQ9yz5.js";import{n as T}from"./explorer-tab-context-gi63e_bv.js";import{B as ee,G as E,U as D,W as te,Y as O}from"./index-D2AOIdVd.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-7zA2_Vvh.js";import{t as P}from"./async-error-boundary-B56Jpu_o.js";import{l as F,n as I,o as L,r as R,s as z,t as B}from"./api-BcqwPTwD.js";import{i as V,r as ne}from"./explorer-file-drop-DaQtKkIj.js";import{t as H}from"./ui-components-BuIiDdYp.js";var U=l(),W=e(c(),1),G=u(),re=W.forwardRef((e,t)=>{let n=(0,U.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=d(`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,G.jsx)(H,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});re.displayName=H.displayName;var K=W.forwardRef((e,t)=>{let r=(0,U.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,G.jsx)(n,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),r[3]=o):o=r[3];let s;r[4]===i?s=r[5]:(s=d(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),r[4]=i,r[5]=s);let c;return r[6]!==a||r[7]!==t||r[8]!==s?(c=(0,G.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,G.jsx)(H.Input,{ref:t,className:s,...a})]}),r[6]=a,r[7]=t,r[8]=s,r[9]=c):c=r[9],c});K.displayName=H.Input.displayName;var q=W.forwardRef((e,t)=>{let n=(0,U.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=d(`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,G.jsx)(H.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=H.List.displayName;var J=W.forwardRef((e,t)=>{let n=(0,U.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=d(f.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,G.jsx)(H.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});J.displayName=H.Empty.displayName;var Y=W.forwardRef((e,t)=>{let n=(0,U.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=d(`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,G.jsx)(H.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=H.Group.displayName;var ie=W.forwardRef((e,t)=>{let n=(0,U.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=d(`-mx-1 h-px bg-divider`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,G.jsx)(H.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ie.displayName=H.Separator.displayName;var ae=W.forwardRef((e,t)=>{let n=(0,U.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=d(d(f.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,G.jsx)(H.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ae.displayName=H.Item.displayName;var oe=e=>{let t=(0,U.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=d(f.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,G.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};oe.displayName=`CommandShortcut`;var X=100,se=500;function Z(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ce(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function le(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ce(n,t)&&(r.push(n.node),r.length>=se))break;return r.sort((e,t)=>ue(e,t,n)).slice(0,X)}function ue(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 de(e){let n=(0,U.c)(38),{items:r,isReady:i,onRequestIndex:a,onOpenChange:o,onSelect:c}=e,l=i===void 0?!1:i,u=(0,W.useRef)(null),p=(0,W.useRef)(!1),m=(0,W.useRef)(!1),[h,g]=(0,W.useState)(!1),[_,v]=(0,W.useState)(``),y=(0,W.useDeferredValue)(_),b;n[0]===a?b=n[1]:(b=function(){m.current||(m.current=!0,a())},n[0]=a,n[1]=b);let x=b,S;n[2]!==y||n[3]!==r?(S=le(r,Z(y),y),n[2]=y,n[3]=r,n[4]=S):S=n[4];let C=S,w,T;n[5]!==o||n[6]!==_?(w=()=>{let e=_.trim().length>0;g(e),p.current!==e&&(p.current=e,o(e))},T=[o,_],n[5]=o,n[6]=_,n[7]=w,n[8]=T):(w=n[7],T=n[8]),(0,W.useEffect)(w,T);let O;n[9]===o?O=n[10]:(O=function(e){e||v(``),g(e),o(e),e&&requestAnimationFrame(()=>u.current?.focus())},n[9]=o,n[10]=O);let k=O,A;n[11]!==o||n[12]!==c?(A=function(e){c(e),g(!1),o(!1),v(``)},n[11]=o,n[12]=c,n[13]=A):A=n[13];let j=A,M;n[14]===x?M=n[15]:(M=e=>{x(),v(e.target.value)},n[14]=x,n[15]=M);let N;n[16]!==_||n[17]!==x||n[18]!==M?(N=(0,G.jsx)(E,{asChild:!0,children:(0,G.jsx)(`div`,{className:`bg-transparent`,children:(0,G.jsx)(s,{ref:u,value:_,onPointerDown:x,onChange:M,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),n[16]=_,n[17]=x,n[18]=M,n[19]=N):N=n[19];let P;n[20]===Symbol.for(`react.memo_cache_sentinel`)?(P=d(f.compact,`py-4`),n[20]=P):P=n[20];let F=l?`No matches found.`:`Indexing files and folders...`,I;n[21]===F?I=n[22]:(I=(0,G.jsx)(J,{className:P,children:F}),n[21]=F,n[22]=I);let L;if(n[23]!==j||n[24]!==C){let e;n[26]===j?e=n[27]:(e=e=>(0,G.jsxs)(ae,{value:e.path,onSelect:()=>j(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,G.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}):(0,G.jsx)(ee,{filename:e.name}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`truncate`,children:e.name}),(0,G.jsx)(`div`,{className:d(f.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),n[26]=j,n[27]=e),L=C.map(e),n[23]=j,n[24]=C,n[25]=L}else L=n[25];let R;n[28]===L?R=n[29]:(R=(0,G.jsx)(Y,{children:L}),n[28]=L,n[29]=R);let z;n[30]!==I||n[31]!==R?(z=(0,G.jsx)(te,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:Q,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,G.jsx)(re,{shouldFilter:!1,children:(0,G.jsxs)(q,{children:[I,R]})})}),n[30]=I,n[31]=R,n[32]=z):z=n[32];let B;return n[33]!==k||n[34]!==h||n[35]!==z||n[36]!==N?(B=(0,G.jsxs)(D,{open:h,onOpenChange:k,children:[N,z]}),n[33]=k,n[34]=h,n[35]=z,n[36]=N,n[37]=B):B=n[37],B}function Q(e){return e.preventDefault()}function fe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function pe(e){let t=(0,U.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=fe(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=()=>L(n,r).then(me),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=y(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,G.jsx)(G.Fragment,{children:l}),t[10]=l,t[11]=u),u}function me(e){return e.entries}function he(e){let t=(0,U.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,W.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,W.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,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,G.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:$}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,G.jsxs)(w,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function $(e){return e.stopPropagation()}function ge(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}function _e(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}var ve=(0,W.memo)(function e({node:n,level:s,threadId:c,selectedPath:l,expandedPaths:u,getDirVersion:f,renamingPath:p,newItemIn:m,onToggleFolder:h,onSelectNode:_,onStartRename:v,onCommitRename:y,onCancelRename:b,onDelete:x,onOpen:S,onCopyReference:T,onNewFile:E,onNewFolder:D,onCommitNewItem:te,onCancelNewItem:O,dropTargetPath:P,onFolderDropTargetChange:F,onFilesDrop:I}){let L=u.has(n.path),R=p===n.path,z=m?.dirPath===n.path&&L,B=P===n.path;return n.type===`folder`?(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(w,{level:s,basePadding:10,selected:l===n.path,className:d(n.ignored&&`opacity-50`,B&&`bg-sidebar-accent text-sidebar-accent-foreground ring-1 ring-primary`),onClick:e=>{e.stopPropagation(),h(n)},onDragOver:e=>{V(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`copy`,B||F(n.path))},onDragLeave:e=>{V(e.dataTransfer)&&(e.currentTarget.contains(e.relatedTarget)||B&&F(null))},onDrop:e=>{if(!V(e.dataTransfer))return;e.preventDefault(),e.stopPropagation(),F(null);let{files:t,skippedFolders:r}=ne(e.dataTransfer);r>0&&g({title:`Folders skipped`,description:`Only files can be copied. Drop individual files instead of folders.`}),t.length>0&&I(t,n.path)},children:[(0,G.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:L?(0,G.jsx)(r,{className:`h-3 w-3`}):(0,G.jsx)(o,{className:`h-3 w-3`})}),R?(0,G.jsxs)(G.Fragment,{children:[L?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?y(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?y(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,G.jsxs)(G.Fragment,{children:[L?(0,G.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,G.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})]}),L&&(0,G.jsx)(`div`,{children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(C,{}),children:(0,G.jsx)(pe,{threadId:c,dirPath:n.path,version:f(n.path),children:n=>(0,G.jsxs)(G.Fragment,{children:[z&&(0,G.jsx)(he,{defaultValue:``,level:s+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,G.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:te,onCancel:O}),n.map(t=>(0,G.jsx)(e,{node:t,level:s+1,threadId:c,selectedPath:l,expandedPaths:u,getDirVersion:f,renamingPath:p,newItemIn:m,onToggleFolder:h,onSelectNode:_,onStartRename:v,onCommitRename:y,onCancelRename:b,onDelete:x,onOpen:S,onCopyReference:T,onNewFile:E,onNewFolder:D,onCommitNewItem:te,onCancelNewItem:O,dropTargetPath:P,onFolderDropTargetChange:F,onFilesDrop:I},t.path))]})})})})]})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>S(n),children:`Open`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>E(n.path),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>D(n.path),children:`New Folder...`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>T(n),children:`Copy Reference`}),(0,G.jsx)(M,{onSelect:()=>v(n),children:`Rename...`}),(0,G.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,children:(0,G.jsxs)(w,{level:s,basePadding:22,selected:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:()=>_(n),children:[(0,G.jsx)(ee,{filename:n.name}),R?(0,G.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?y(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?y(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,G.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>S(n),children:`Open`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>E(_e(n.path)),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>D(_e(n.path)),children:`New Folder...`}),(0,G.jsx)(A,{}),(0,G.jsx)(M,{onSelect:()=>T(n),children:`Copy Reference`}),(0,G.jsx)(M,{onSelect:()=>v(n),children:`Rename...`}),(0,G.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),ye=new Map;function be({threadId:e,selectedPath:n,onNodeSelect:r,onFilesDrop:a}){let[o,s]=(0,W.useState)(()=>new Map([[``,0]])),[c,l]=(0,W.useState)(new Set),[u,d]=(0,W.useState)(null),[f,y]=(0,W.useState)(null),[C,w]=(0,W.useState)(null),[ee,E]=(0,W.useState)(null),[D,te]=(0,W.useState)(!1),[A,V]=(0,W.useState)([]),[ne,H]=(0,W.useState)(!1),[U,re]=(0,W.useState)(!1),K=(0,W.useRef)(null),q=(0,W.useRef)(0),J=(0,W.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ie,setExplorerClearPath:ae}=T(),{fetchUnifiedStatus:oe}=O(),X=(0,W.useMemo)(()=>`${e}:${Y}`,[Y,e]),se=(0,W.useCallback)(e=>{(0,W.startTransition)(()=>{te(t=>t===e?t:e)})},[]),Z=(0,W.useCallback)(async()=>{if(!e)return;let t=ye.get(X);if(t){V(t),H(!0);return}if(K.current!==X){K.current=X,V([]),H(!1);try{let t=ge((await L(e,``,!0)).entries);ye.set(X,t),V(t),H(!0)}catch{V([]),H(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),ce=(0,W.useCallback)(()=>{re(!0)},[]),le=(0,W.useCallback)(()=>{ye.delete(X),V([]),H(!1)},[X]),ue=(0,W.useCallback)(()=>{le(),U&&Z()},[le,Z,U]),Q=(0,W.useCallback)(e=>o.get(e)??0,[o]),me=(0,W.useCallback)(e=>{s(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,W.useCallback)(t=>{e&&(x(fe(e,t,Q(t))),me(t))},[me,Q,e]),be=(0,W.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);l(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,W.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(s(new Map([[``,0]])),l(new Set),d(null),y(null),q.current=Y)},[Y,e]),(0,W.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,s(t=>{let n=new Set([``]);for(let e of c)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;x(fe(e,i,n)),r.set(i,n+1)}return r}))},[Y,c,e]),(0,W.useEffect)(()=>{V([]),H(!1),re(!1),K.current=null},[X]),(0,W.useEffect)(()=>{!U||!e||Z()},[Z,U,e]),(0,W.useEffect)(()=>{if(!ie||!e)return;let t=ie.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){l(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ie,e]);function xe(e){c.has(e.path)?l(t=>{let n=new Set(t);return n.delete(e.path),n}):(l(t=>new Set(t).add(e.path)),s(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function Se(e){w(e)}async function Ce(t){try{await z(e,t.path)}catch{g({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function we(e){try{await navigator.clipboard.writeText(e.path);let t=g({title:`Copied`,description:`Reference copied to clipboard.`});window.setTimeout(()=>{t.dismiss()},2e3)}catch{g({title:`Error`,description:`Failed to copy reference for "${e.name}"`,variant:`destructive`})}}async function Te(){if(!C)return;let t=C;w(null);try{await R(e,t.path),ae(t.path),$(_e(t.path)),ue(),oe(!0),l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(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{g({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function Ee(e){y(null),d(e.path)}async function De(t,n){if(n===t.name){d(null);return}d(null);try{await F(e,t.path,n),$(_e(t.path)),ue(),oe(!0),t.type===`folder`&&(l(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),s(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{g({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Oe(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),y({dirPath:e,type:`file`})}function ke(e){d(null),c.has(e)||(l(t=>new Set(t).add(e)),s(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),y({dirPath:e,type:`folder`})}async function Ae(t){if(!f)return;let{dirPath:n,type:r}=f;y(null);try{r===`file`?await B(e,n,t):await I(e,n,t),$(n),ue(),oe(!0)}catch{g({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function je(){y(null)}let Me=(0,W.useCallback)((e,t)=>{a?.(e,t)},[a]);function Ne(e){be(e),e.type===`file`&&r(e)}let Pe=f?.dirPath===``?(0,G.jsx)(he,{defaultValue:``,level:0,basePadding:f.type===`folder`?10:22,icon:f.type===`folder`?(0,G.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,G.jsx)(i,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:Ae,onCancel:je}):null;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(S,{open:C!==null,onOpenChange:e=>!e&&w(null),children:(0,G.jsxs)(p,{children:[(0,G.jsx)(b,{children:`Move to Trash`}),(0,G.jsxs)(_,{children:[`Move “`,C?.name,`” to trash?`]}),(0,G.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,G.jsx)(m,{children:`Cancel`}),(0,G.jsx)(v,{onClick:()=>void Te(),children:`Move to Trash`})]})]})}),(0,G.jsx)(`div`,{className:`border-b border-border px-2 py-2`,children:(0,G.jsx)(`div`,{className:`flex items-center gap-1`,children:(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(de,{items:A,isReady:ne,onRequestIndex:ce,onOpenChange:se,onSelect:e=>Ne(e)},X)})})}),(0,G.jsxs)(N,{children:[(0,G.jsx)(k,{asChild:!0,disabled:D,children:(0,G.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,G.jsx)(P,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,G.jsx)(W.Suspense,{fallback:(0,G.jsx)(h,{}),children:(0,G.jsx)(pe,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,G.jsxs)(G.Fragment,{children:[Pe,t.map(t=>(0,G.jsx)(ve,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:c,getDirVersion:Q,renamingPath:u,newItemIn:f,onToggleFolder:xe,onSelectNode:r,onStartRename:Ee,onCommitRename:De,onCancelRename:()=>d(null),onDelete:Se,onOpen:Ce,onCopyReference:we,onNewFile:Oe,onNewFolder:ke,onCommitNewItem:Ae,onCancelNewItem:je,dropTargetPath:ee,onFolderDropTargetChange:E,onFilesDrop:Me},t.path))]})})})})})}),(0,G.jsxs)(j,{children:[(0,G.jsx)(M,{onSelect:()=>Oe(``),children:`New File...`}),(0,G.jsx)(M,{onSelect:()=>ke(``),children:`New Folder...`})]})]})]})}export{be as default};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Co as t,Cs as n,Go as r,Ko as i,Us as a,Yt as o,ca as s,cc as c,es as l,fs as u,il as d,io as ee,lc as f,nl as p,no as te,pi as m,tl as h,ua as g,uo as ne,xc as _}from"./dialogs-config-C7xqDv5K.js";import{d as re}from"./react-vendor-XZeum4Wo.js";import{F as ie,G as ae,Ht as v,L as oe,M as y,R as se,Tt as b,f as x,p as S,zt as C}from"./history-view-DVqIaJOR.js";import{n as w}from"./explorer-tab-context-gi63e_bv.js";import{n as T}from"./utils-B1IYtes_.js";import{X as ce,Z as le}from"./index-D2AOIdVd.js";import{t as E}from"./async-error-boundary-B56Jpu_o.js";import{a as D,c as ue,i as O,o as k,s as de,t as fe,u as pe}from"./api-BcqwPTwD.js";var A=p(),j=h(),M=e(d(),1),N=C(e=>(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,j.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),P=C(e=>(0,j.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[e.v0,(0,j.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,j.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),F=function({selectedFile:e,showTreeBackButton:r=!1,onShowTree:a,onFileCreated:l}){let{resolvedTheme:d}=T(),f=v(e=>e.selectedThreadId),{triggerExplorerRefresh:p}=w(),h=(0,M.useRef)(null),x=(0,M.useRef)(null),C=(0,M.useRef)(!1),[D,O]=(0,M.useState)(null),[k,A]=(0,M.useState)(!1),[F,I]=(0,M.useState)(!1),[W,G]=(0,M.useState)(`edit`),[_e,ve]=(0,M.useState)(0),[K,ye]=(0,M.useState)(null),[q,J]=(0,M.useState)(!1),be=e?.path??null;(0,M.useEffect)(()=>{f&&o(f).then(ye).catch(()=>{})},[f]);let xe=async()=>{if(!(!K||q)){J(!0);try{await navigator.clipboard.writeText(K),y({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(e){H(`Failed to copy explorer folder path`,{threadId:f,folderPath:K},e),y({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{J(!1)}}},Se=async()=>{if(f)try{await de(f,`.`)}catch(e){H(`Failed to open explorer repository folder`,{threadId:f,folderPath:K},e),y({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},Ce=(0,M.useCallback)(async e=>{if(f)try{let t=await R(f,e);await fe(f,``,t);let n={name:t,path:t,type:`file`};x.current=t,C.current=!0,l?.(n),p(),y({title:`Created`,description:`${t} created successfully.`})}catch(t){H(`Failed to create explorer file`,{threadId:f,extension:e},t),y({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[f,l,p]),Y=e?c(e.path,e.name):null,X=e?.type===`file`&&f&&!Y?e:null,Z=X?`${f}:${X.path}:${_e}`:null,Q=D&&D.key===Z?D:null,$=Q?.content??``,we=Q?.original??``;(0,M.useEffect)(()=>()=>{h.current&&=(h.current.getModel()?.dispose(),h.current.dispose(),null)},[]),(0,M.useEffect)(()=>{e?.type===`file`?x.current===e.path?(x.current=null,G(`edit`)):G(z(e.path)?`view`:`edit`):G(`edit`)},[be,f]);async function Te(){if(!(!f||!e||!Z)){A(!0);try{await pe(f,e.path,$),O({key:Z,content:$,original:$}),y({title:`Saved`,description:`${e.name} saved successfully.`})}catch(t){H(`Failed to save explorer file`,{threadId:f,path:e.path},t),y({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}finally{A(!1)}}}async function Ee(){if(!(!f||!e||F)){I(!0);try{if(!m()){if(typeof window>`u`)return;let t=document.querySelector(`[data-markdown-print-content]`);if(!(t instanceof HTMLElement)){y({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}let n=`<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>${e.name??`Markdown document`}</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
color-scheme: light;
|
|
10
|
+
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
11
|
+
line-height: 1.5;
|
|
12
|
+
}
|
|
13
|
+
* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
}
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
background: white;
|
|
19
|
+
color: black;
|
|
20
|
+
}
|
|
21
|
+
.markdown-print-shell {
|
|
22
|
+
max-width: 900px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
padding: 32px;
|
|
25
|
+
}
|
|
26
|
+
img, video, svg {
|
|
27
|
+
max-width: 100%;
|
|
28
|
+
height: auto;
|
|
29
|
+
}
|
|
30
|
+
pre {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
overflow-wrap: anywhere;
|
|
33
|
+
border: 1px solid #d4d4d8;
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
padding: 12px;
|
|
36
|
+
background: #f4f4f5;
|
|
37
|
+
}
|
|
38
|
+
code {
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
overflow-wrap: anywhere;
|
|
41
|
+
}
|
|
42
|
+
table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
border-collapse: collapse;
|
|
45
|
+
}
|
|
46
|
+
th, td {
|
|
47
|
+
border: 1px solid #d4d4d8;
|
|
48
|
+
padding: 8px;
|
|
49
|
+
text-align: left;
|
|
50
|
+
}
|
|
51
|
+
@page {
|
|
52
|
+
margin: 0.75in;
|
|
53
|
+
}
|
|
54
|
+
@media print {
|
|
55
|
+
body {
|
|
56
|
+
-webkit-print-color-adjust: exact;
|
|
57
|
+
print-color-adjust: exact;
|
|
58
|
+
}
|
|
59
|
+
.markdown-print-shell {
|
|
60
|
+
max-width: none;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
</head>
|
|
66
|
+
<body>
|
|
67
|
+
<main class="markdown-print-shell">${t.innerHTML}</main>
|
|
68
|
+
<script>
|
|
69
|
+
window.addEventListener("load", () => {
|
|
70
|
+
window.focus();
|
|
71
|
+
window.print();
|
|
72
|
+
}, { once: true });
|
|
73
|
+
<\/script>
|
|
74
|
+
</body>
|
|
75
|
+
</html>`,r=window.open(``,`_blank`,`noopener,noreferrer`);if(!r){y({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`});return}r.document.open(),r.document.write(n),r.document.close();return}y({title:`PDF created`,description:`Opened ${(await ue(f,e.path)).outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}catch(t){H(`Failed to print markdown file as PDF`,{threadId:f,path:e.path},t),y({title:`PDF export failed`,description:t instanceof Error?t.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}finally{I(!1)}}}function De(){!f||!X||(S(V(f,X.path)),ve(e=>e+1))}return f?(0,j.jsx)(P,{v0:(0,j.jsxs)(le,{className:`justify-between print:hidden`,children:[(0,j.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[r&&a?(0,j.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,j.jsx)(ne,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,j.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(`span`,{className:g(_.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,j.jsx)(`span`,{className:g(_.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,j.jsxs)(`div`,{className:`flex gap-2`,children:[X&&Q?(0,j.jsxs)(j.Fragment,{children:[z(X.path)?(0,j.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,j.jsx)(s,{size:`sm`,variant:W===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>G(`view`),children:`View`}),(0,j.jsx)(s,{size:`sm`,variant:W===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>G(`edit`),children:`Edit`})]}):null,z(X.path)&&W===`view`?(0,j.jsxs)(s,{size:`sm`,variant:`outline`,onClick:()=>void Ee(),disabled:F,children:[F?(0,j.jsx)(t,{className:`h-4 w-4 animate-spin`}):(0,j.jsx)(te,{className:`h-4 w-4`}),F?`Printing…`:`Print`]}):null,(0,j.jsxs)(s,{size:`sm`,onClick:()=>void Te(),disabled:k||!$||$===we,children:[k?(0,j.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,j.jsxs)(ie,{children:[(0,j.jsx)(ae,{asChild:!0,children:(0,j.jsxs)(s,{size:`sm`,className:`gap-1.5`,children:[(0,j.jsx)(ee,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,j.jsx)(oe,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,j.jsxs)(se,{onSelect:()=>void Ce(t),children:[(0,j.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:X?(0,j.jsxs)(E,{fallbackTitle:`Failed to load file`,onRetry:De,children:[(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(me,{threadId:f,path:X.path,contentKey:Z??``,onContentReady:O},Z??void 0)}),Q?z(X.path)&&W===`view`?(0,j.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,j.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,j.jsx)(ce,{content:$,enableMermaid:!0})})}):(0,j.jsx)(re,{height:`100%`,language:B(X.path),value:$,onChange:e=>O(t=>t&&{...t,content:e??``}),onMount:e=>{h.current=e,C.current&&(C.current=!1,e.focus())},theme:d===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:14,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,j.jsx)(b,{})]},Z??void 0):e?.type===`file`&&Y===`image`?(0,j.jsx)(E,{fallbackTitle:`Failed to load image`,onRetry:()=>{!f||!e||S(U(f,e.path))},children:(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(he,{threadId:f,path:e.path,alt:e.name})})},e.path):e?.type===`file`&&Y===`video`?(0,j.jsx)(E,{fallbackTitle:`Failed to load video`,onRetry:()=>{!f||!e||S(U(f,e.path))},children:(0,j.jsx)(M.Suspense,{fallback:(0,j.jsx)(b,{}),children:(0,j.jsx)(ge,{threadId:f,path:e.path})})},e.path):(0,j.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,j.jsx)(`h2`,{className:g(_.pageTitle,`text-foreground`),children:`File Explorer`}),(0,j.jsx)(`p`,{className:g(_.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,j.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:K?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,onClick:()=>void Se(),className:g(_.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:K,children:K}),(0,j.jsxs)(s,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void xe(),disabled:q,children:[q?(0,j.jsx)(n,{className:`h-3.5 w-3.5`}):(0,j.jsx)(u,{className:`h-3.5 w-3.5`}),(0,j.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,j.jsx)(`p`,{className:g(_.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,j.jsx)(N,{v0:(0,j.jsx)(i,{className:`h-8 w-8 text-muted-foreground`}),v1:_.bodyMuted})},I=a(`explorer.preview`),L=[{label:`Markdown`,ext:`md`,icon:i},{label:`TypeScript`,ext:`ts`,icon:l},{label:`Text`,ext:`txt`,icon:r}];async function R(e,t){try{let n=await k(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function z(e){return f(e)===`md`}function B(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`}[f(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function me(e){let t=(0,A.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=V(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=async()=>{try{return await D(n,r)}catch(e){let t=e;throw H(`Failed to load explorer file preview`,{threadId:n,path:r},t),t}},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=x(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,M.useLayoutEffect)(l,u),null}function H(e,t,n){I.error(e,{...t,error:n})}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,A.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=async()=>{try{return await O(e,t)}catch(n){let r=n;throw H(`Failed to load explorer media preview`,{threadId:e,path:t},r),r}},n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=x(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,M.useEffect)(c,l),s}function he(e){let t=(0,A.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,j.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 ge(e){let t=(0,A.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,j.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Co as e,ca as t,f as n,g as r,h as i,m as a,nl as o,p as s,tl as c,u as l,ua as u,xc as d}from"./dialogs-config-C7xqDv5K.js";var f=o(),p=c();function m(o){let c=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=o,S;c[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(r,{children:`Commit History`}),c[0]=S):S=c[0];let C;c[1]===x?C=c[2]:(C=(0,p.jsxs)(i,{children:[S,(0,p.jsxs)(s,{children:[`Recent commits on branch `,x]})]}),c[1]=x,c[2]=C);let w;c[3]===v?w=c[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:u(d.bodyMuted,`text-center py-8`),children:`No commits found`}),c[3]=v,c[4]=w);let T;c[5]===y?T=c[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(e,{className:`h-4 w-4 animate-spin inline`})}),c[5]=y,c[6]=T);let E;c[7]!==_.length||c[8]!==v.length||c[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:u(d.caption,`p-3 text-center`),children:`Scroll to load more`}),c[7]=_.length,c[8]=v.length,c[9]=y,c[10]=E):E=c[10];let D;c[11]!==w||c[12]!==T||c[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),c[11]=w,c[12]=T,c[13]=E,c[14]=D):D=c[14];let O;c[15]!==b||c[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),c[15]=b,c[16]=D,c[17]=O):O=c[17];let k;c[18]===g?k=c[19]:(k=(0,p.jsx)(a,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),c[18]=g,c[19]=k);let A;c[20]!==C||c[21]!==O||c[22]!==k?(A=(0,p.jsxs)(n,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),c[20]=C,c[21]=O,c[22]=k,c[23]=A):A=c[23];let j;return c[24]!==g||c[25]!==m||c[26]!==A?(j=(0,p.jsx)(l,{open:m,onOpenChange:g,children:A}),c[24]=g,c[25]=m,c[26]=A,c[27]=j):j=c[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:u(d.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:u(d.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:d.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-CPsT5k3n.js","assets/index-D2AOIdVd.js","assets/rolldown-runtime-aKtaBQYM.js","assets/history-view-DVqIaJOR.js","assets/dialogs-config-C7xqDv5K.js","assets/onboarding-BpwQ9yz5.js","assets/explorer-tab-context-gi63e_bv.js","assets/react-vendor-XZeum4Wo.js","assets/monaco-D3l3Gbj2.js","assets/monaco-Br_kD0ds.css","assets/utils-B1IYtes_.js","assets/index-CyxfX_DC.css","assets/pull-request-dialog-VOoEmwTG.js","assets/create-repo-dialog-wC-DyHKe.js","assets/git-history-dialog-Dd_DmfZC.js","assets/push-before-pr-dialog-9fV4cFz5.js","assets/pull-with-changes-dialog-CoHIwHJZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Co as t,Ea as n,Fc as r,Gr as i,Io as a,Jr as o,Lo as s,Lr as c,Mo as l,On as u,Qr as d,Rr as f,Ur as p,Us as m,Vr as h,Xr as g,Yr as _,Zt as v,ba as y,ca as ee,cs as b,eo as x,fn as S,il as C,jn as w,js as T,ks as E,nl as D,os as O,qr as k,tl as A,ua as j,xc as te,xr as ne,ys as M,zo as re,zr as N}from"./dialogs-config-C7xqDv5K.js";import{At as ie,B as ae,Dt as P,En as oe,F as se,G as ce,Ht as F,L as le,M as I,Ot as L,R,V as ue,Vt as de,ir as z,kt as B}from"./history-view-DVqIaJOR.js";import{u as fe}from"./onboarding-BpwQ9yz5.js";import{D as pe,E as me,M as he,N as ge,O as _e,T as ve,Y as V}from"./index-D2AOIdVd.js";var ye=D(),H=e(C(),1),U=A();function W(e){return!e.hasChanges&&e.defaultBranchBehind>0}function G(e){return e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits}function be(e){return e.hasUnpushedCommits&&e.prExists}function xe(e,t){return t?`Creating PR`:e.hasChanges?`Commit`:be(e)?`Update PR`:G(e)?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:W(e)?`Sync`:`Commit`}function K(e,t,n=!1){return t||n||e.hasChanges||be(e)||G(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||!e.hasChanges&&!e.hasUnpushedCommits&&!W(e)?null:W(e)?(0,U.jsx)(T,{className:`h-3.5 w-3.5`}):(0,U.jsx)(s,{className:`h-3.5 w-3.5`})}function Se(e){if(e.hasChanges)return e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`;if(be(e))return`Update pull request with unpushed commits`;if(G(e))return`View pull request in GitHub`;if(e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges)return`Create pull request for committed changes`;if(W(e)){let t=e.defaultBranch??`main`,n=`${e.defaultBranchBehind} commit${e.defaultBranchBehind===1?``:`s`} behind origin/${t}`,r=e.defaultBranchAhead>0?`, ${e.defaultBranchAhead} commit${e.defaultBranchAhead===1?``:`s`} ahead`:``;return e.currentBranch===e.defaultBranch?`Your branch is ${n}${r}. Click to pull the latest changes.`:`Your branch "${e.currentBranch}" is ${n}${r}. Click to rebase onto the latest ${t}.`}return`No actions available`}function Ce(e,t,n=!1){return t||n?!0:G(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges||W(e)?!1:!e.hasChanges&&!e.hasUnpushedCommits}function we(e){return e.hasChanges||G(e)||be(e)||W(e)||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}function Te(e){let r=(0,ye.c)(104),{branchStatus:i,remoteUrl:o,hasRemoteBranch:c,hasUnpushedCommits:u,canCreateRepo:d,repoUrl:f,isRefreshing:p,isCreatingPR:m,hasChanges:h,commitsAheadOfDefault:g,prExists:_,defaultBranch:v,defaultBranchAhead:S,defaultBranchBehind:C,gitUser:w,isDirectCommitMode:D,autoGenerateCommitMessage:k,isLoading:A,isLoadingHistory:ne,isQuickCommitting:re,onFetch:N,onPull:oe,onPush:F,onOpenHistory:I,onCreatePR:de,onCreateRepo:z,onViewInGitHub:fe,onQuickCommit:pe,onSyncWithDefault:me,onOpenChange:he,open:ge,layout:ve}=e,V=m===void 0?!1:m,H=ve===void 0?`bar`:ve,W=!!v&&!!o&&C>0,G=!h&&!A,be;r[0]!==V||r[1]!==p?(be=V||p?(0,U.jsx)(t,{className:`h-4 w-4 shrink-0 animate-spin`}):(0,U.jsx)(M,{className:`h-4 w-4 shrink-0`}),r[0]=V,r[1]=p,r[2]=be):be=r[2];let xe=be,K;r[3]!==V||r[4]!==A||r[5]!==p||r[6]!==H||r[7]!==xe?(K=(0,U.jsx)(ce,{asChild:!0,children:H===`sidebar`?(0,U.jsx)(ee,{variant:`ghost`,size:`icon-sm`,className:`shrink-0 text-muted-foreground`,disabled:A||V,"aria-label":`Git Ops`,children:xe}):H===`bar`?(0,U.jsx)(`button`,{type:`button`,className:`flex h-full shrink-0 items-center rounded-r-full pr-3 pl-0.5 disabled:opacity-50`,disabled:A||V,"aria-label":`Git Ops`,children:V||p?(0,U.jsx)(t,{className:j(_e,`animate-spin`)}):(0,U.jsx)(M,{className:_e})}):(0,U.jsxs)(ee,{variant:`outline`,size:`sm`,className:`h-8 w-full justify-start gap-2 rounded-md px-1`,disabled:A||V,children:[(0,U.jsx)(`span`,{children:`Git Ops`}),V||p?(0,U.jsx)(t,{className:`h-3.5 w-3.5 animate-spin`}):(0,U.jsx)(M,{className:`h-3.5 w-3.5`})]})}),r[3]=V,r[4]=A,r[5]=p,r[6]=H,r[7]=xe,r[8]=K):K=r[8];let Se=H===`sidebar`?`start`:`end`,Ce;r[9]!==i||r[10]!==o?(Ce=i===`Behind`&&(0,U.jsxs)(`div`,{className:j(te.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,o?`origin`:`remote`]}),r[9]=i,r[10]=o,r[11]=Ce):Ce=r[11];let we;r[12]===w?we=r[13]:(we=w&&(0,U.jsxs)(`div`,{className:j(te.compact,`px-2 py-1 text-muted-foreground`),children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,w]}),r[12]=w,r[13]=we);let Te;r[14]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,U.jsx)(ae,{}),r[14]=Te):Te=r[14];let Ee;r[15]!==G||r[16]!==v||r[17]!==S||r[18]!==C||r[19]!==h||r[20]!==me||r[21]!==W?(Ee=W&&(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:()=>{G&&me()},className:G?``:`opacity-50 cursor-not-allowed`,children:[(0,U.jsx)(x,{className:`h-3.5 w-3.5 mr-2`}),`Sync with `,v,(0,U.jsxs)(`span`,{className:`ml-auto flex items-center gap-2 pl-3 text-xs tabular-nums text-muted-foreground`,children:[S>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(E,{className:`h-3 w-3`}),S]}),C>0&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,U.jsx)(T,{className:`h-3 w-3`}),C]})]})]})}),(0,U.jsx)(L,{side:`right`,children:h?`Commit or stash changes before syncing with the default branch`:`Pull latest changes from origin/${v} onto your current branch`})]})}),r[15]=G,r[16]=v,r[17]=S,r[18]=C,r[19]=h,r[20]=me,r[21]=W,r[22]=Ee):Ee=r[22];let q;r[23]!==k||r[24]!==h||r[25]!==A||r[26]!==re||r[27]!==pe?(q=h&&k&&(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:pe,disabled:A||re,children:[re?(0,U.jsx)(t,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,U.jsx)(y,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,U.jsx)(ue,{children:`⌘⇧C`})]})}),(0,U.jsx)(L,{side:`right`,children:`Generate the commit message and commit`})]})}),r[23]=k,r[24]=h,r[25]=A,r[26]=re,r[27]=pe,r[28]=q):q=r[28];let J;r[29]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,U.jsx)(b,{className:`h-3.5 w-3.5 mr-2`}),r[29]=J):J=r[29];let Y;r[30]!==A||r[31]!==N?(Y=(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:N,disabled:A,children:[J,`Fetch`]})}),r[30]=A,r[31]=N,r[32]=Y):Y=r[32];let De;r[33]===Symbol.for(`react.memo_cache_sentinel`)?(De=(0,U.jsx)(L,{side:`right`,children:`Download latest information from remote without merging changes`}),r[33]=De):De=r[33];let Oe;r[34]===Y?Oe=r[35]:(Oe=(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[Y,De]})}),r[34]=Y,r[35]=Oe);let X;r[36]!==c||r[37]!==A||r[38]!==oe?(X=()=>{c&&!A&&oe()},r[36]=c,r[37]=A,r[38]=oe,r[39]=X):X=r[39];let ke=!c||A?`opacity-50 cursor-not-allowed`:``,Ae;r[40]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,U.jsx)(T,{className:`h-3.5 w-3.5 mr-2`}),r[40]=Ae):Ae=r[40];let je;r[41]!==X||r[42]!==ke?(je=(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:X,className:ke,children:[Ae,`Pull`]})}),r[41]=X,r[42]=ke,r[43]=je):je=r[43];let Me=c?`Pull latest changes from remote`:`No remote branch to pull from`,Z;r[44]===Me?Z=r[45]:(Z=(0,U.jsx)(L,{side:`right`,children:Me}),r[44]=Me,r[45]=Z);let Ne;r[46]!==je||r[47]!==Z?(Ne=(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[je,Z]})}),r[46]=je,r[47]=Z,r[48]=Ne):Ne=r[48];let Pe;r[49]!==c||r[50]!==A||r[51]!==F?(Pe=!c&&(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:F,disabled:A,children:[(0,U.jsx)(n,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,U.jsx)(L,{side:`right`,children:`Create remote branch and push local commits`})]})}),r[49]=c,r[50]=A,r[51]=F,r[52]=Pe):Pe=r[52];let Fe;r[53]!==u||r[54]!==A||r[55]!==F?(Fe=()=>{u&&!A&&F()},r[53]=u,r[54]=A,r[55]=F,r[56]=Fe):Fe=r[56];let Ie=!u||A?`opacity-50 cursor-not-allowed`:``,Q;r[57]===Symbol.for(`react.memo_cache_sentinel`)?(Q=(0,U.jsx)(n,{className:`h-3.5 w-3.5 mr-2`}),r[57]=Q):Q=r[57];let Le;r[58]!==Fe||r[59]!==Ie?(Le=(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsxs)(R,{onClick:Fe,className:Ie,children:[Q,`Push Commits`]})}),r[58]=Fe,r[59]=Ie,r[60]=Le):Le=r[60];let Re=u?A?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,ze;r[61]===Re?ze=r[62]:(ze=(0,U.jsx)(L,{side:`right`,children:Re}),r[61]=Re,r[62]=ze);let $;r[63]!==Le||r[64]!==ze?($=(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[Le,ze]})}),r[63]=Le,r[64]=ze,r[65]=$):$=r[65];let Be=A||ne,Ve;r[66]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,U.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),r[66]=Ve):Ve=r[66];let He;r[67]!==I||r[68]!==Be?(He=(0,U.jsxs)(R,{onClick:I,disabled:Be,children:[Ve,`History`]}),r[67]=I,r[68]=Be,r[69]=He):He=r[69];let Ue;r[70]!==g||r[71]!==h||r[72]!==D||r[73]!==A||r[74]!==de||r[75]!==_?(Ue=!D&&g&&!_&&!h&&(0,U.jsxs)(R,{onClick:de,disabled:A,children:[(0,U.jsx)(s,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,U.jsx)(ue,{children:`⌘⇧P`})]}),r[70]=g,r[71]=h,r[72]=D,r[73]=A,r[74]=de,r[75]=_,r[76]=Ue):Ue=r[76];let We;r[77]!==d||r[78]!==A||r[79]!==z?(We=d&&(0,U.jsxs)(R,{onClick:z,disabled:A,children:[(0,U.jsx)(a,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),r[77]=d,r[78]=A,r[79]=z,r[80]=We):We=r[80];let Ge;r[81]!==A||r[82]!==fe||r[83]!==f?(Ge=f&&(0,U.jsxs)(R,{onClick:fe,disabled:A,children:[(0,U.jsx)(O,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`,(0,U.jsx)(ue,{children:`⌘⇧G`})]}),r[81]=A,r[82]=fe,r[83]=f,r[84]=Ge):Ge=r[84];let Ke;r[85]!==q||r[86]!==Oe||r[87]!==Ne||r[88]!==Pe||r[89]!==$||r[90]!==He||r[91]!==Ue||r[92]!==We||r[93]!==Ge||r[94]!==Se||r[95]!==Ce||r[96]!==we||r[97]!==Ee?(Ke=(0,U.jsxs)(le,{align:Se,children:[Ce,we,Te,Ee,q,Oe,Ne,Pe,$,He,Ue,We,Ge]}),r[85]=q,r[86]=Oe,r[87]=Ne,r[88]=Pe,r[89]=$,r[90]=He,r[91]=Ue,r[92]=We,r[93]=Ge,r[94]=Se,r[95]=Ce,r[96]=we,r[97]=Ee,r[98]=Ke):Ke=r[98];let qe;return r[99]!==he||r[100]!==ge||r[101]!==Ke||r[102]!==K?(qe=(0,U.jsxs)(se,{open:ge,onOpenChange:he,children:[K,Ke]}),r[99]=he,r[100]=ge,r[101]=Ke,r[102]=K,r[103]=qe):qe=r[103],qe}var Ee=(0,H.lazy)(()=>z(()=>import(`./commit-dialog-CPsT5k3n.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),q=(0,H.lazy)(()=>z(()=>import(`./pull-request-dialog-VOoEmwTG.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),J=(0,H.lazy)(()=>z(()=>import(`./create-repo-dialog-wC-DyHKe.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Y=(0,H.lazy)(()=>z(()=>import(`./git-history-dialog-Dd_DmfZC.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,4,2]))),De=(0,H.lazy)(()=>z(()=>import(`./push-before-pr-dialog-9fV4cFz5.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,4,2]))),Oe=(0,H.lazy)(()=>z(()=>import(`./pull-with-changes-dialog-CoHIwHJZ.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,3,2,4])));function X(){return null}function ke(e){let t=(0,ye.c)(65),{isLoading:n,currentBranch:r,commit:i,pullRequest:a,pushBeforePR:o,createRepo:s,history:c,pullWithChanges:l}=e,u;t[0]!==i.autoGenerate||t[1]!==i.isGenerating||t[2]!==i.isOpen||t[3]!==i.message||t[4]!==i.onAutoGenerateChange||t[5]!==i.onCommit||t[6]!==i.onGenerateMessage||t[7]!==i.onMessageChange||t[8]!==i.onOpenChange||t[9]!==r||t[10]!==n?(u=i.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(Ee,{open:i.isOpen,onOpenChange:i.onOpenChange,commitMessage:i.message,onCommitMessageChange:i.onMessageChange,autoGenerateCommitMessage:i.autoGenerate,onAutoGenerateChange:i.onAutoGenerateChange,isGeneratingMessage:i.isGenerating,isLoading:n,onGenerateMessage:i.onGenerateMessage,onCommit:i.onCommit,currentBranch:r})}),t[0]=i.autoGenerate,t[1]=i.isGenerating,t[2]=i.isOpen,t[3]=i.message,t[4]=i.onAutoGenerateChange,t[5]=i.onCommit,t[6]=i.onGenerateMessage,t[7]=i.onMessageChange,t[8]=i.onOpenChange,t[9]=r,t[10]=n,t[11]=u):u=t[11];let d;t[12]!==r||t[13]!==n||t[14]!==a.autoGenerate||t[15]!==a.description||t[16]!==a.isGeneratingInfo||t[17]!==a.isOpen||t[18]!==a.onAutoGenerateChange||t[19]!==a.onCreatePR||t[20]!==a.onDescriptionChange||t[21]!==a.onGenerateInfo||t[22]!==a.onOpenChange||t[23]!==a.onTitleChange||t[24]!==a.title?(d=a.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(q,{open:a.isOpen,onOpenChange:a.onOpenChange,prTitle:a.title,onPrTitleChange:a.onTitleChange,prDescription:a.description,onPrDescriptionChange:a.onDescriptionChange,isGeneratingPRInfo:a.isGeneratingInfo,isLoading:n,onGeneratePRInfo:a.onGenerateInfo,onCreatePR:a.onCreatePR,currentBranch:r,autoGeneratePRInfo:a.autoGenerate,onAutoGeneratePRInfoChange:a.onAutoGenerateChange})}),t[12]=r,t[13]=n,t[14]=a.autoGenerate,t[15]=a.description,t[16]=a.isGeneratingInfo,t[17]=a.isOpen,t[18]=a.onAutoGenerateChange,t[19]=a.onCreatePR,t[20]=a.onDescriptionChange,t[21]=a.onGenerateInfo,t[22]=a.onOpenChange,t[23]=a.onTitleChange,t[24]=a.title,t[25]=d):d=t[25];let f;t[26]!==n||t[27]!==o.isOpen||t[28]!==o.onCancel||t[29]!==o.onOpenChange||t[30]!==o.onPushAndCreatePR?(f=o.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(De,{open:o.isOpen,onOpenChange:o.onOpenChange,isLoading:n,onPushAndCreatePR:o.onPushAndCreatePR,onCancel:o.onCancel})}),t[26]=n,t[27]=o.isOpen,t[28]=o.onCancel,t[29]=o.onOpenChange,t[30]=o.onPushAndCreatePR,t[31]=f):f=t[31];let p;t[32]!==s.description||t[33]!==s.isOpen||t[34]!==s.isPrivate||t[35]!==s.name||t[36]!==s.onCreateRepo||t[37]!==s.onDescriptionChange||t[38]!==s.onNameChange||t[39]!==s.onOpenChange||t[40]!==s.onPrivateChange||t[41]!==n?(p=s.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(J,{open:s.isOpen,onOpenChange:s.onOpenChange,repoName:s.name,onRepoNameChange:s.onNameChange,repoDescription:s.description,onRepoDescriptionChange:s.onDescriptionChange,isPrivateRepo:s.isPrivate,onPrivateRepoChange:s.onPrivateChange,isLoading:n,onCreateRepo:s.onCreateRepo})}),t[32]=s.description,t[33]=s.isOpen,t[34]=s.isPrivate,t[35]=s.name,t[36]=s.onCreateRepo,t[37]=s.onDescriptionChange,t[38]=s.onNameChange,t[39]=s.onOpenChange,t[40]=s.onPrivateChange,t[41]=n,t[42]=p):p=t[42];let m;t[43]!==r||t[44]!==c.commits||t[45]!==c.displayedCommits||t[46]!==c.isLoadingMore||t[47]!==c.isOpen||t[48]!==c.onOpenChange||t[49]!==c.onScroll?(m=c.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(Y,{open:c.isOpen,onOpenChange:c.onOpenChange,commits:c.commits,displayedCommits:c.displayedCommits,isLoadingMore:c.isLoadingMore,onScroll:c.onScroll,currentBranch:r})}),t[43]=r,t[44]=c.commits,t[45]=c.displayedCommits,t[46]=c.isLoadingMore,t[47]=c.isOpen,t[48]=c.onOpenChange,t[49]=c.onScroll,t[50]=m):m=t[50];let h;t[51]!==n||t[52]!==l.isOpen||t[53]!==l.onCancel||t[54]!==l.onCommitFirst||t[55]!==l.onOpenChange||t[56]!==l.onStashAndPull?(h=l.isOpen&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(X,{}),children:(0,U.jsx)(Oe,{open:l.isOpen,onOpenChange:l.onOpenChange,onCommitFirst:l.onCommitFirst,onStashAndPull:l.onStashAndPull,onCancel:l.onCancel,isLoading:n})}),t[51]=n,t[52]=l.isOpen,t[53]=l.onCancel,t[54]=l.onCommitFirst,t[55]=l.onOpenChange,t[56]=l.onStashAndPull,t[57]=h):h=t[57];let g;return t[58]!==u||t[59]!==d||t[60]!==f||t[61]!==p||t[62]!==m||t[63]!==h?(g=(0,U.jsxs)(U.Fragment,{children:[u,d,f,p,m,h]}),t[58]=u,t[59]=d,t[60]=f,t[61]=p,t[62]=m,t[63]=h,t[64]=g):g=t[64],g}function Ae(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}var je=m(`app.use-ai-generation.hook`);function Me(e,t,n){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),s=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:Ae(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,H.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=s();return await f(e,n,t)}catch(e){return je.error(`Failed to generate commit message:`,e),I({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,H.useCallback)(async()=>{if(!e)return null;try{o(!0);let{provider:t,model:n}=s();return await N(e,n,t)}catch(e){return je.error(`Failed to generate PR info:`,e),I({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{o(!1)}},[e,n])}}function Z(e){return e?!0:(I({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}async function Ne(e,t,n,r){r&&(await ne(e,{title:r}),n({type:oe.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}var Pe=2e3,Fe=6;function Ie(e,t){let n=0;e.current!==null&&clearInterval(e.current),e.current=setInterval(async()=>{if(n++,n>=Fe){e.current!==null&&(clearInterval(e.current),e.current=null);return}await t(!0)},Pe)}var Q=m(`app.git-ops-button.ui`),Le=10;function Re(e){let{projectId:t,threadId:n,projectName:r,dispatch:a,aiGeneration:s,unifiedGitStatus:l}=e,[f,m]=(0,H.useState)(!1),[y,ee]=(0,H.useState)(!1),[b,x]=(0,H.useState)(!1),[C,T]=(0,H.useState)(!1),[E,D]=(0,H.useState)(``),[O,A]=(0,H.useState)(``),[j,te]=(0,H.useState)(``),[ne,M]=(0,H.useState)(!1),[re,N]=(0,H.useState)(null),ie=(0,H.useRef)(!1),ae=(0,H.useRef)(!1),P=(0,H.useRef)(O),se=(0,H.useRef)(j);P.current=O,se.current=j;let[ce,F]=(0,H.useState)(!1),[le,L]=(0,H.useState)([]),[R,ue]=(0,H.useState)(!1),[de,z]=(0,H.useState)([]),[B,fe]=(0,H.useState)(!1),[pe,me]=(0,H.useState)(!1),[_e,ve]=(0,H.useState)(``),[V,ye]=(0,H.useState)(``),[U,W]=(0,H.useState)(``),[G,be]=(0,H.useState)(!1),[xe,K]=(0,H.useState)(!1),[Se,Ce]=(0,H.useState)(!1),[we,Te]=(0,H.useState)(!1),Ee=(0,H.useRef)(!1),q=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{q.current!==null&&(clearInterval(q.current),q.current=null)},[]);async function J(){u();let e=await S();a({type:oe.SetProjects,projects:e.projects})}let[Y,De]=(0,H.useState)(()=>he());(0,H.useEffect)(()=>{pe&&r&&!_e&&ve(r)},[pe,r,_e]),(0,H.useEffect)(()=>{ge(Y)},[Y]);function Oe(){G||(be(!0),v().then(e=>W(e)).catch(()=>{}))}function X(e){Te(e),e&&(Oe(),l.fetchUnifiedStatus(!0))}(0,H.useEffect)(()=>{y&&l.prExists&&l.prState===`OPEN`&&ee(!1)},[l.prExists,l.prState,y]),(0,H.useEffect)(()=>{if(!y)return;let e=setTimeout(()=>{ee(!1)},15e3);return()=>clearTimeout(e)},[y]),(0,H.useEffect)(()=>{let e=l.prExists&&l.prState===`OPEN`&&!l.hasChanges&&!l.hasUnpushedCommits;e&&!Ee.current&&J(),Ee.current=e},[l.hasChanges,l.hasUnpushedCommits,l.prExists,l.prState]);async function ke(){if(E.trim()&&Z(n))try{m(!0),await i(n,E),D(``),x(!1),await l.fetchUnifiedStatus(!0),J(),I({title:`Changes committed successfully`,description:`Your changes have been committed to '${l.currentBranch}'.`}),Se&&(Ce(!1),await $())}catch(e){Q.error(`Failed to commit:`,e),I({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{m(!1)}}async function Ae(){if(!Z(n))return;let e=l.prUrl;if(!e)try{e=(await p(n)).url}catch(e){Q.error(`Failed to fetch pull request URL:`,e),I({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to fetch pull request URL`,variant:`destructive`});return}if(!e){I({title:`Could not open pull request`,description:`Pull request URL is unavailable. Try refreshing git status.`,variant:`destructive`});return}try{await w(e)}catch(e){Q.error(`Failed to open pull request:`,e),I({title:`Could not open pull request`,description:e instanceof Error?e.message:`Failed to open URL in browser`,variant:`destructive`})}}async function je(){if(l.hasChanges){x(!0);return}if(l.hasUnpushedCommits&&l.prExists){await Re();return}if(l.prExists&&l.prState===`OPEN`&&!l.hasChanges&&!l.hasUnpushedCommits){await Ae();return}if(l.commitsAheadOfDefault&&!l.prExists&&!l.hasChanges){T(!0);return}if(l.defaultBranchBehind>0){await He();return}}async function Me(){let e=await s.generateCommitMessageWithAI();e&&D(e)}async function Pe(){if(Z(n))try{m(!0);let e=await s.generateCommitMessageWithAI();if(!e){I({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await i(n,e),await l.fetchUnifiedStatus(!0),J(),I({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){Q.error(`Quick commit failed:`,e),I({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{m(!1)}}async function Fe(){if(Z(n))try{m(!0),await o(n),await l.fetchUnifiedStatus()}catch(e){Q.error(`Failed to fetch:`,e)}finally{m(!1)}}async function Re(){if(Z(n))try{m(!0),await g(n),await l.fetchUnifiedStatus(!0),J(),l.hasRemoteBranch?I({title:`Branch pushed successfully`,description:`Your branch '${l.currentBranch}' has been pushed to the remote.`}):I({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){Q.error(`Failed to push:`,e),I({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{m(!1)}}async function ze(){if(Z(n)){if(l.hasChanges){K(!0);return}await $()}}async function $(){try{m(!0),await _(n),await l.fetchUnifiedStatus(!0),J(),I({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){Q.error(`Failed to pull:`,e),I({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{m(!1)}}function Be(){K(!1),Ce(!0),x(!0)}async function Ve(){K(!1),await $()}async function He(){if(Z(n))try{m(!0),await d(n),await l.fetchUnifiedStatus(!0),J(),I({title:`Branch synced successfully`,description:`Your branch '${l.currentBranch}' has been synced with the latest changes`})}catch(e){Q.error(`[sync] ✗ Failed to sync branch:`,e),I({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{m(!1)}}async function Ue(){if(Z(n))try{m(!0),ee(!0);let e=await k(n,O,j);await Ne(n,t,a,e.title??O),e.prUrl&&await w(e.prUrl),A(``),te(``),T(!1),await l.fetchUnifiedStatus(!0),J(),Ie(q,l.fetchUnifiedStatus)}catch(e){Q.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`)?(T(!1),Ke({title:O,description:j})):(ee(!1),I({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{m(!1)}}async function We(){if(Z(n))try{m(!0);let e=await c(n,_e,V,Y.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{w(e.repoUrl)},3e3),ve(``),ye(``),me(!1),await l.fetchUnifiedStatus(),J()}catch(e){Q.error(`Failed to create repo:`,e)}finally{m(!1)}}async function Ge(){let e=await s.generatePRInfoWithAI();e&&(A(e.title),te(e.description),I({title:`Success`,description:`PR title and description generated`}))}async function Ke(e){let r=e??re;if(!(!n||!r))try{m(!0),ee(!0);try{await g(n)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){I({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await d(n),await g(n)}catch{throw e}}else throw e}let e=await k(n,r.title,r.description);await Ne(n,t,a,e.title??r.title),e.prUrl&&await w(e.prUrl),A(``),te(``),N(null),M(!1),await l.fetchUnifiedStatus(!0),J(),Ie(q,l.fetchUnifiedStatus)}catch(e){Q.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;ee(!1),I({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{m(!1)}}async function qe(){if(Z(n))try{ue(!0);let e=await h(n,100);L(e),z(e.slice(0,Le)),F(!0)}catch(e){Q.error(`Failed to fetch git history:`,e)}finally{ue(!1)}}function Je(){B||(fe(!0),setTimeout(()=>{let e=de.length+Le;z(le.slice(0,e)),fe(!1)},300))}function Ye(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&de.length<le.length&&!B&&Je()}function Xe(){l.repoUrl&&w(l.repoUrl)}function Ze(){M(!1),N(null)}return{isLoading:f,isCreatingPR:y,isCommitDialogOpen:b,setIsCommitDialogOpen:x,isPRDialogOpen:C,setIsPRDialogOpen:T,commitMessage:E,setCommitMessage:D,prTitle:O,setPrTitle:A,prDescription:j,setPrDescription:te,isPushBeforePRDialogOpen:ne,setIsPushBeforePRDialogOpen:M,prGenerationRef:ie,commitGenerationRef:ae,prTitleRef:P,prDescriptionRef:se,isHistoryDialogOpen:ce,setIsHistoryDialogOpen:F,commits:le,displayedCommits:de,isLoadingHistory:R,isLoadingMore:B,isRepoDialogOpen:pe,setIsRepoDialogOpen:me,repoName:_e,setRepoName:ve,repoDescription:V,setRepoDescription:ye,gitUser:U,isPullWithChangesDialogOpen:xe,setIsPullWithChangesDialogOpen:K,isGitOpsMenuOpen:we,userPrefs:Y,setUserPrefsState:De,handleGitOpsMenuOpenChange:X,handleCommit:ke,handleOpenPullRequest:Ae,handleMainButtonClick:je,handleGenerateCommitMessage:Me,handleQuickCommit:Pe,handleFetch:Fe,handlePush:Re,handlePull:ze,handleSyncBranch:He,handleCreatePR:Ue,handleCreateRepo:We,handleGeneratePRInfo:Ge,handlePushAndCreatePR:Ke,handleOpenHistory:qe,handleScroll:Ye,handleViewInGitHub:Xe,handleCancelPushBeforePR:Ze,handleCommitFirstAndPull:Be,handleStashAndPull:Ve}}function ze(e){let t=(0,ye.c)(29),{threadId:n,aiGeneration:r,isCommitDialogOpen:i,commitMessage:a,setCommitMessage:o,autoGenerateCommitMessage:s,commitGenerationRef:c,isPRDialogOpen:l,prTitleRef:u,prDescriptionRef:d,setPrTitle:f,setPrDescription:p,autoGeneratePRInfo:m,prGenerationRef:h}=e,g;t[0]!==r||t[1]!==s||t[2]!==c||t[3]!==a||t[4]!==i||t[5]!==o||t[6]!==n?(g=()=>{if(!i){c.current=!1;return}i&&s&&!a.trim()&&n&&!c.current&&(c.current=!0,(async function(){let e=await r.generateCommitMessageWithAI();e&&o(e)})())},t[0]=r,t[1]=s,t[2]=c,t[3]=a,t[4]=i,t[5]=o,t[6]=n,t[7]=g):g=t[7];let _;t[8]!==r.generateCommitMessageWithAI||t[9]!==s||t[10]!==a||t[11]!==i||t[12]!==n?(_=[i,s,n,r.generateCommitMessageWithAI,a],t[8]=r.generateCommitMessageWithAI,t[9]=s,t[10]=a,t[11]=i,t[12]=n,t[13]=_):_=t[13],(0,H.useEffect)(g,_);let v;t[14]!==r||t[15]!==m||t[16]!==l||t[17]!==d||t[18]!==h||t[19]!==u||t[20]!==p||t[21]!==f||t[22]!==n?(v=()=>{if(!l){h.current=!1;return}l&&m&&!u.current.trim()&&!d.current.trim()&&n&&!h.current&&(h.current=!0,(async function(){let e=await r.generatePRInfoWithAI();e&&(f(e.title),p(e.description))})())},t[14]=r,t[15]=m,t[16]=l,t[17]=d,t[18]=h,t[19]=u,t[20]=p,t[21]=f,t[22]=n,t[23]=v):v=t[23];let y;t[24]!==r.generatePRInfoWithAI||t[25]!==m||t[26]!==l||t[27]!==n?(y=[l,m,n,r.generatePRInfoWithAI],t[24]=r.generatePRInfoWithAI,t[25]=m,t[26]=l,t[27]=n,t[28]=y):y=t[28],(0,H.useEffect)(v,y)}function $(e){let{unifiedGitStatus:t,autoGenerateCommitMessage:n,isLoading:r,isCreatingPR:i,isDirectCommitMode:a,onQuickCommit:o,onCreatePR:s,onViewInGitHub:c,onOpenGitOpsMenu:l}=e,u=(0,H.useRef)(o),d=(0,H.useRef)(s),f=(0,H.useRef)(c),p=(0,H.useRef)(l);u.current=o,d.current=s,f.current=c,p.current=l,(0,H.useEffect)(()=>{function e(e){let o=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(o===`c`){t.hasChanges&&n&&!r&&(e.preventDefault(),u.current());return}if(o===`p`){t.commitsAheadOfDefault&&!t.prExists&&!t.hasChanges&&!r&&!a&&(e.preventDefault(),d.current());return}if(o===`g`){t.repoUrl&&!r&&(e.preventDefault(),f.current());return}o===`b`&&!r&&!i&&(e.preventDefault(),p.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t.commitsAheadOfDefault,t.hasChanges,t.prExists,t.repoUrl,n,r,i,a])}function Be(e){let t=(0,ye.c)(168),{projectId:n,threadId:i,layout:a}=e,o=a===void 0?`bar`:a,s=de(),c;t[0]===i?c=t[1]:(c=e=>e.projectModelSelections[i],t[0]=i,t[1]=c);let l=F(c),u;t[2]===n?u=t[3]:(u=e=>e.projects.find(e=>e.projectId===n),t[2]=n,t[3]=u);let d=F(u),f=V(),p=Me(i,n,l),m=d?.commitMethod===r.Direct,h=d?.name,g;t[4]!==p||t[5]!==s||t[6]!==n||t[7]!==h||t[8]!==i||t[9]!==f?(g={projectId:n,threadId:i,projectName:h,dispatch:s,aiGeneration:p,unifiedGitStatus:f},t[4]=p,t[5]=s,t[6]=n,t[7]=h,t[8]=i,t[9]=f,t[10]=g):g=t[10];let _=Re(g),v;t[11]!==_.commitGenerationRef||t[12]!==_.commitMessage||t[13]!==_.isCommitDialogOpen||t[14]!==_.isPRDialogOpen||t[15]!==_.prDescriptionRef||t[16]!==_.prGenerationRef||t[17]!==_.prTitleRef||t[18]!==_.setCommitMessage||t[19]!==_.setPrDescription||t[20]!==_.setPrTitle||t[21]!==_.userPrefs.autoGenerateCommitMessage||t[22]!==_.userPrefs.autoGeneratePRInfo||t[23]!==p||t[24]!==i?(v={threadId:i,aiGeneration:p,isCommitDialogOpen:_.isCommitDialogOpen,commitMessage:_.commitMessage,setCommitMessage:_.setCommitMessage,autoGenerateCommitMessage:_.userPrefs.autoGenerateCommitMessage,commitGenerationRef:_.commitGenerationRef,isPRDialogOpen:_.isPRDialogOpen,prTitleRef:_.prTitleRef,prDescriptionRef:_.prDescriptionRef,setPrTitle:_.setPrTitle,setPrDescription:_.setPrDescription,autoGeneratePRInfo:_.userPrefs.autoGeneratePRInfo,prGenerationRef:_.prGenerationRef},t[11]=_.commitGenerationRef,t[12]=_.commitMessage,t[13]=_.isCommitDialogOpen,t[14]=_.isPRDialogOpen,t[15]=_.prDescriptionRef,t[16]=_.prGenerationRef,t[17]=_.prTitleRef,t[18]=_.setCommitMessage,t[19]=_.setPrDescription,t[20]=_.setPrTitle,t[21]=_.userPrefs.autoGenerateCommitMessage,t[22]=_.userPrefs.autoGeneratePRInfo,t[23]=p,t[24]=i,t[25]=v):v=t[25],ze(v);let y;t[26]===_?y=t[27]:(y=()=>_.setIsPRDialogOpen(!0),t[26]=_,t[27]=y);let b;t[28]===_?b=t[29]:(b=()=>{_.isLoading||_.isCreatingPR||_.handleGitOpsMenuOpenChange(!0)},t[28]=_,t[29]=b);let x;t[30]!==_.handleQuickCommit||t[31]!==_.handleViewInGitHub||t[32]!==_.isCreatingPR||t[33]!==_.isLoading||t[34]!==_.userPrefs.autoGenerateCommitMessage||t[35]!==m||t[36]!==y||t[37]!==b||t[38]!==f?(x={unifiedGitStatus:f,autoGenerateCommitMessage:_.userPrefs.autoGenerateCommitMessage,isLoading:_.isLoading,isCreatingPR:_.isCreatingPR,isDirectCommitMode:m,onQuickCommit:_.handleQuickCommit,onCreatePR:y,onViewInGitHub:_.handleViewInGitHub,onOpenGitOpsMenu:b},t[30]=_.handleQuickCommit,t[31]=_.handleViewInGitHub,t[32]=_.isCreatingPR,t[33]=_.isLoading,t[34]=_.userPrefs.autoGenerateCommitMessage,t[35]=m,t[36]=y,t[37]=b,t[38]=f,t[39]=x):x=t[39],$(x);let S;if(t[40]!==_||t[41]!==p.isGeneratingMessage||t[42]!==m||t[43]!==o||t[44]!==f){let e=we(f),n=Ce(f,_.isLoading,_.isCreatingPR),r=_.isLoading||_.isCreatingPR,i=n&&!r,a;t[46]!==_.isCreatingPR||t[47]!==f?(a=xe(f,_.isCreatingPR),t[46]=_.isCreatingPR,t[47]=f,t[48]=a):a=t[48];let s=a,c;t[49]!==_.isCreatingPR||t[50]!==_.isLoading||t[51]!==f?(c=K(f,_.isCreatingPR,_.isLoading)??(0,U.jsx)(re,{className:`h-4 w-4 shrink-0`}),t[49]=_.isCreatingPR,t[50]=_.isLoading,t[51]=f,t[52]=c):c=t[52];let l=c,u=f.defaultBranch??null,d=p.isGeneratingMessage&&_.isLoading,h,g,v,y,b,x;t[53]===_?(h=t[54],g=t[55],v=t[56],y=t[57],b=t[58],x=t[59]):(h=()=>void _.handleFetch(),g=()=>void _.handlePull(),v=()=>void _.handlePush(),y=()=>void _.handleOpenHistory(),b=()=>_.setIsPRDialogOpen(!0),x=()=>_.setIsRepoDialogOpen(!0),t[53]=_,t[54]=h,t[55]=g,t[56]=v,t[57]=y,t[58]=b,t[59]=x);let C,w;t[60]===_?(C=t[61],w=t[62]):(C=()=>void _.handleQuickCommit(),w=()=>void _.handleSyncBranch(),t[60]=_,t[61]=C,t[62]=w);let T;t[63]!==_.gitUser||t[64]!==_.handleGitOpsMenuOpenChange||t[65]!==_.handleViewInGitHub||t[66]!==_.isCreatingPR||t[67]!==_.isGitOpsMenuOpen||t[68]!==_.isLoading||t[69]!==_.isLoadingHistory||t[70]!==_.userPrefs.autoGenerateCommitMessage||t[71]!==m||t[72]!==o||t[73]!==u||t[74]!==d||t[75]!==h||t[76]!==g||t[77]!==v||t[78]!==y||t[79]!==b||t[80]!==x||t[81]!==C||t[82]!==w||t[83]!==f.canCreateRepo||t[84]!==f.commitsAheadOfDefault||t[85]!==f.defaultBranchAhead||t[86]!==f.defaultBranchBehind||t[87]!==f.hasChanges||t[88]!==f.hasRemoteBranch||t[89]!==f.hasUnpushedCommits||t[90]!==f.isRefreshing||t[91]!==f.prExists||t[92]!==f.remoteUrl||t[93]!==f.repoUrl||t[94]!==f.status?(T=(0,U.jsx)(Te,{branchStatus:f.status,remoteUrl:f.remoteUrl,hasRemoteBranch:f.hasRemoteBranch,hasUnpushedCommits:f.hasUnpushedCommits,canCreateRepo:f.canCreateRepo,repoUrl:f.repoUrl,isRefreshing:f.isRefreshing,isCreatingPR:_.isCreatingPR,hasChanges:f.hasChanges,commitsAheadOfDefault:f.commitsAheadOfDefault,prExists:f.prExists,defaultBranch:u,defaultBranchAhead:f.defaultBranchAhead,defaultBranchBehind:f.defaultBranchBehind,gitUser:_.gitUser,isDirectCommitMode:m,autoGenerateCommitMessage:_.userPrefs.autoGenerateCommitMessage,isLoading:_.isLoading,isLoadingHistory:_.isLoadingHistory,isQuickCommitting:d,onFetch:h,onPull:g,onPush:v,onOpenHistory:y,onCreatePR:b,onCreateRepo:x,onViewInGitHub:_.handleViewInGitHub,onQuickCommit:C,onSyncWithDefault:w,open:_.isGitOpsMenuOpen,onOpenChange:_.handleGitOpsMenuOpenChange,layout:o}),t[63]=_.gitUser,t[64]=_.handleGitOpsMenuOpenChange,t[65]=_.handleViewInGitHub,t[66]=_.isCreatingPR,t[67]=_.isGitOpsMenuOpen,t[68]=_.isLoading,t[69]=_.isLoadingHistory,t[70]=_.userPrefs.autoGenerateCommitMessage,t[71]=m,t[72]=o,t[73]=u,t[74]=d,t[75]=h,t[76]=g,t[77]=v,t[78]=y,t[79]=b,t[80]=x,t[81]=C,t[82]=w,t[83]=f.canCreateRepo,t[84]=f.commitsAheadOfDefault,t[85]=f.defaultBranchAhead,t[86]=f.defaultBranchBehind,t[87]=f.hasChanges,t[88]=f.hasRemoteBranch,t[89]=f.hasUnpushedCommits,t[90]=f.isRefreshing,t[91]=f.prExists,t[92]=f.remoteUrl,t[93]=f.repoUrl,t[94]=f.status,t[95]=T):T=t[95];let E=T;S=o===`sidebar`?(0,U.jsxs)(`div`,{className:`flex w-full min-w-0 items-center`,children:[(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(fe,{asChild:!0,className:`min-w-0 flex-1`,children:(0,U.jsx)(`button`,{type:`button`,className:j(`min-w-0 w-full justify-start`,e&&`border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground dark:bg-brand dark:hover:bg-brand/90`,e&&i&&`cursor-default opacity-50 hover:bg-brand hover:text-brand-foreground`,!e&&i&&`cursor-default`),disabled:r,"aria-disabled":n,onClick:n?void 0:_.handleMainButtonClick,children:(0,U.jsxs)(`span`,{className:j(`flex min-w-0 flex-1 items-center gap-2`,!e&&i&&`text-muted-foreground opacity-50`,e&&`font-medium`),children:[l,(0,U.jsx)(`span`,{className:j(te.body,`truncate`),children:s})]})})})}),(0,U.jsx)(L,{side:`right`,children:Se(f)})]})}),E]}):o===`bar`?(0,U.jsxs)(`div`,{className:j(ve,pe,me,`group min-w-0 gap-0 px-0`,e&&`border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground dark:bg-brand dark:hover:bg-brand/90`,e&&i&&`cursor-default opacity-50 hover:bg-brand hover:text-brand-foreground`),children:[(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:j(te.compact,`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-full pl-3 pr-0.5 disabled:opacity-50`,i&&`cursor-default`),disabled:r,"aria-disabled":n,onClick:n?void 0:_.handleMainButtonClick,children:(0,U.jsxs)(`span`,{className:j(`inline-flex min-w-0 items-center gap-1.5 truncate`,e&&`font-medium`,!e&&i&&`opacity-50`),children:[l,(0,U.jsx)(`span`,{className:`truncate`,children:s})]})})}),(0,U.jsx)(L,{side:`top`,children:Se(f)})]})}),E]}):(0,U.jsxs)(`div`,{className:j(`flex w-full flex-col gap-1 items-stretch [&_button]:w-full [&_button]:justify-start`),children:[(0,U.jsx)(B,{children:(0,U.jsxs)(P,{children:[(0,U.jsx)(ie,{asChild:!0,children:(0,U.jsx)(ee,{variant:`outline`,size:`sm`,className:j(`h-8 gap-1.5 rounded-md border`,e&&`border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground dark:bg-brand dark:hover:bg-brand/90`,i&&`cursor-default hover:bg-background hover:text-foreground`),disabled:r,"aria-disabled":n,onClick:n?void 0:_.handleMainButtonClick,children:(0,U.jsxs)(`span`,{className:j(`inline-flex items-center gap-1.5`,i&&`text-muted-foreground opacity-50`),children:[l,s]})})}),(0,U.jsx)(L,{children:Se(f)})]})}),E]}),t[40]=_,t[41]=p.isGeneratingMessage,t[42]=m,t[43]=o,t[44]=f,t[45]=S}else S=t[45];let C;t[96]===_?C=t[97]:(C=e=>_.setUserPrefsState(t=>({...t,autoGenerateCommitMessage:e})),t[96]=_,t[97]=C);let w;t[98]!==_.commitMessage||t[99]!==_.handleCommit||t[100]!==_.handleGenerateCommitMessage||t[101]!==_.isCommitDialogOpen||t[102]!==_.setCommitMessage||t[103]!==_.setIsCommitDialogOpen||t[104]!==_.userPrefs.autoGenerateCommitMessage||t[105]!==p.isGeneratingMessage||t[106]!==C?(w={isOpen:_.isCommitDialogOpen,onOpenChange:_.setIsCommitDialogOpen,message:_.commitMessage,onMessageChange:_.setCommitMessage,autoGenerate:_.userPrefs.autoGenerateCommitMessage,onAutoGenerateChange:C,isGenerating:p.isGeneratingMessage,onGenerateMessage:_.handleGenerateCommitMessage,onCommit:_.handleCommit},t[98]=_.commitMessage,t[99]=_.handleCommit,t[100]=_.handleGenerateCommitMessage,t[101]=_.isCommitDialogOpen,t[102]=_.setCommitMessage,t[103]=_.setIsCommitDialogOpen,t[104]=_.userPrefs.autoGenerateCommitMessage,t[105]=p.isGeneratingMessage,t[106]=C,t[107]=w):w=t[107];let T;t[108]===_?T=t[109]:(T=e=>_.setUserPrefsState(t=>({...t,autoGeneratePRInfo:e})),t[108]=_,t[109]=T);let E;t[110]!==_.handleCreatePR||t[111]!==_.handleGeneratePRInfo||t[112]!==_.isPRDialogOpen||t[113]!==_.prDescription||t[114]!==_.prTitle||t[115]!==_.setIsPRDialogOpen||t[116]!==_.setPrDescription||t[117]!==_.setPrTitle||t[118]!==_.userPrefs.autoGeneratePRInfo||t[119]!==p.isGeneratingPRInfo||t[120]!==T?(E={isOpen:_.isPRDialogOpen,onOpenChange:_.setIsPRDialogOpen,title:_.prTitle,onTitleChange:_.setPrTitle,description:_.prDescription,onDescriptionChange:_.setPrDescription,isGeneratingInfo:p.isGeneratingPRInfo,onGenerateInfo:_.handleGeneratePRInfo,onCreatePR:_.handleCreatePR,autoGenerate:_.userPrefs.autoGeneratePRInfo,onAutoGenerateChange:T},t[110]=_.handleCreatePR,t[111]=_.handleGeneratePRInfo,t[112]=_.isPRDialogOpen,t[113]=_.prDescription,t[114]=_.prTitle,t[115]=_.setIsPRDialogOpen,t[116]=_.setPrDescription,t[117]=_.setPrTitle,t[118]=_.userPrefs.autoGeneratePRInfo,t[119]=p.isGeneratingPRInfo,t[120]=T,t[121]=E):E=t[121];let D;t[122]===_?D=t[123]:(D=()=>_.handlePushAndCreatePR(),t[122]=_,t[123]=D);let O;t[124]!==_.handleCancelPushBeforePR||t[125]!==_.isPushBeforePRDialogOpen||t[126]!==_.setIsPushBeforePRDialogOpen||t[127]!==D?(O={isOpen:_.isPushBeforePRDialogOpen,onOpenChange:_.setIsPushBeforePRDialogOpen,onPushAndCreatePR:D,onCancel:_.handleCancelPushBeforePR},t[124]=_.handleCancelPushBeforePR,t[125]=_.isPushBeforePRDialogOpen,t[126]=_.setIsPushBeforePRDialogOpen,t[127]=D,t[128]=O):O=t[128];let k;t[129]===_?k=t[130]:(k=e=>_.setUserPrefsState(t=>({...t,privateRepositoryDefault:e})),t[129]=_,t[130]=k);let A;t[131]!==_.handleCreateRepo||t[132]!==_.isRepoDialogOpen||t[133]!==_.repoDescription||t[134]!==_.repoName||t[135]!==_.setIsRepoDialogOpen||t[136]!==_.setRepoDescription||t[137]!==_.setRepoName||t[138]!==_.userPrefs.privateRepositoryDefault||t[139]!==k?(A={isOpen:_.isRepoDialogOpen,onOpenChange:_.setIsRepoDialogOpen,name:_.repoName,onNameChange:_.setRepoName,description:_.repoDescription,onDescriptionChange:_.setRepoDescription,isPrivate:_.userPrefs.privateRepositoryDefault,onPrivateChange:k,onCreateRepo:_.handleCreateRepo},t[131]=_.handleCreateRepo,t[132]=_.isRepoDialogOpen,t[133]=_.repoDescription,t[134]=_.repoName,t[135]=_.setIsRepoDialogOpen,t[136]=_.setRepoDescription,t[137]=_.setRepoName,t[138]=_.userPrefs.privateRepositoryDefault,t[139]=k,t[140]=A):A=t[140];let ne;t[141]!==_.commits||t[142]!==_.displayedCommits||t[143]!==_.handleScroll||t[144]!==_.isHistoryDialogOpen||t[145]!==_.isLoadingMore||t[146]!==_.setIsHistoryDialogOpen?(ne={isOpen:_.isHistoryDialogOpen,onOpenChange:_.setIsHistoryDialogOpen,commits:_.commits,displayedCommits:_.displayedCommits,isLoadingMore:_.isLoadingMore,onScroll:_.handleScroll},t[141]=_.commits,t[142]=_.displayedCommits,t[143]=_.handleScroll,t[144]=_.isHistoryDialogOpen,t[145]=_.isLoadingMore,t[146]=_.setIsHistoryDialogOpen,t[147]=ne):ne=t[147];let M;t[148]===_?M=t[149]:(M=()=>_.setIsPullWithChangesDialogOpen(!1),t[148]=_,t[149]=M);let N;t[150]!==_.handleCommitFirstAndPull||t[151]!==_.handleStashAndPull||t[152]!==_.isPullWithChangesDialogOpen||t[153]!==_.setIsPullWithChangesDialogOpen||t[154]!==M?(N={isOpen:_.isPullWithChangesDialogOpen,onOpenChange:_.setIsPullWithChangesDialogOpen,onCommitFirst:_.handleCommitFirstAndPull,onStashAndPull:_.handleStashAndPull,onCancel:M},t[150]=_.handleCommitFirstAndPull,t[151]=_.handleStashAndPull,t[152]=_.isPullWithChangesDialogOpen,t[153]=_.setIsPullWithChangesDialogOpen,t[154]=M,t[155]=N):N=t[155];let ae;t[156]!==_.isLoading||t[157]!==w||t[158]!==E||t[159]!==O||t[160]!==A||t[161]!==ne||t[162]!==N||t[163]!==f.currentBranch?(ae=(0,U.jsx)(ke,{isLoading:_.isLoading,currentBranch:f.currentBranch,commit:w,pullRequest:E,pushBeforePR:O,createRepo:A,history:ne,pullWithChanges:N}),t[156]=_.isLoading,t[157]=w,t[158]=E,t[159]=O,t[160]=A,t[161]=ne,t[162]=N,t[163]=f.currentBranch,t[164]=ae):ae=t[164];let oe;return t[165]!==S||t[166]!==ae?(oe=(0,U.jsxs)(U.Fragment,{children:[S,ae]}),t[165]=S,t[166]=ae,t[167]=oe):oe=t[167],oe}export{Be as GitOpsButton};
|