trident-git 0.3.0 → 0.4.0
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +12 -12
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +3 -3
- package/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/credentials/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/custom-scripts/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/fs/route.js +1 -1
- package/.next/server/app/api/fs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/action/route.js +1 -1
- package/.next/server/app/api/git/action/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repos/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repos/route.js +1 -1
- package/.next/server/app/api/repos/route.js.nft.json +1 -1
- package/.next/server/app/api/repos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/.next/server/app/credentials/page.js +2 -4
- package/.next/server/app/credentials/page.js.nft.json +1 -1
- package/.next/server/app/credentials/page_client-reference-manifest.js +1 -1
- package/.next/server/app/credentials.html +1 -1
- package/.next/server/app/credentials.rsc +4 -4
- package/.next/server/app/credentials.segments/_full.segment.rsc +4 -4
- package/.next/server/app/credentials.segments/_head.segment.rsc +1 -1
- package/.next/server/app/credentials.segments/_index.segment.rsc +3 -3
- package/.next/server/app/credentials.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/credentials.segments/credentials/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/credentials.segments/credentials.segment.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +14 -13
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +6 -5
- package/.next/server/app/index.segments/_full.segment.rsc +14 -13
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +4 -2
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/changes/page.js +2 -2
- package/.next/server/app/workspace/changes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/changes.html +1 -1
- package/.next/server/app/workspace/changes.rsc +6 -6
- package/.next/server/app/workspace/changes.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace/changes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/changes.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/changes.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/changes.segments/workspace/changes/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/changes.segments/workspace/changes.segment.rsc +1 -1
- package/.next/server/app/workspace/changes.segments/workspace.segment.rsc +3 -3
- package/.next/server/app/workspace/custom-scripts/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/custom-scripts.html +1 -1
- package/.next/server/app/workspace/custom-scripts.rsc +6 -6
- package/.next/server/app/workspace/custom-scripts.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace/custom-scripts.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/custom-scripts.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/custom-scripts.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/custom-scripts.segments/workspace/custom-scripts.segment.rsc +1 -1
- package/.next/server/app/workspace/custom-scripts.segments/workspace.segment.rsc +3 -3
- package/.next/server/app/workspace/history/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/history.html +1 -1
- package/.next/server/app/workspace/history.rsc +6 -6
- package/.next/server/app/workspace/history.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace/history.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/history.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/history.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/history.segments/workspace/history/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/history.segments/workspace/history.segment.rsc +1 -1
- package/.next/server/app/workspace/history.segments/workspace.segment.rsc +3 -3
- package/.next/server/app/workspace/page.js +2 -2
- package/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/settings.html +1 -1
- package/.next/server/app/workspace/settings.rsc +6 -6
- package/.next/server/app/workspace/settings.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace/settings.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/settings.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/settings.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/settings.segments/workspace/settings/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/settings.segments/workspace/settings.segment.rsc +1 -1
- package/.next/server/app/workspace/settings.segments/workspace.segment.rsc +3 -3
- package/.next/server/app/workspace/stashes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspace/stashes.html +1 -1
- package/.next/server/app/workspace/stashes.rsc +6 -6
- package/.next/server/app/workspace/stashes.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace/stashes.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace/stashes.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace/stashes.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace/stashes.segments/workspace/stashes/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace/stashes.segments/workspace/stashes.segment.rsc +1 -1
- package/.next/server/app/workspace/stashes.segments/workspace.segment.rsc +3 -3
- package/.next/server/app/workspace.html +1 -1
- package/.next/server/app/workspace.rsc +6 -6
- package/.next/server/app/workspace.segments/_full.segment.rsc +6 -6
- package/.next/server/app/workspace.segments/_head.segment.rsc +1 -1
- package/.next/server/app/workspace.segments/_index.segment.rsc +3 -3
- package/.next/server/app/workspace.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/workspace.segments/workspace/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/workspace.segments/workspace.segment.rsc +3 -3
- package/.next/server/app-paths-manifest.json +12 -12
- package/.next/server/chunks/392.js +1 -1
- package/.next/server/chunks/455.js +3 -0
- package/.next/server/chunks/471.js +4 -4
- package/.next/server/chunks/557.js +1 -1
- package/.next/server/chunks/739.js +6 -4
- package/.next/server/chunks/781.js +1 -1
- package/.next/server/chunks/946.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{131-7599c38c2eb54305.js → 131-4e059eb668f6734a.js} +1 -1
- package/.next/static/chunks/147-64f7ae9eceb783be.js +8 -0
- package/.next/static/chunks/26-71a5a763fed8540a.js +1 -0
- package/.next/static/chunks/{772-b39107b40c31b6b6.js → 437-856aae031cb5746d.js} +3 -3
- package/.next/static/chunks/app/credentials/page-98f6c498c4356393.js +1 -0
- package/.next/static/chunks/app/page-b6a88311748e2958.js +1 -0
- package/.next/static/chunks/app/workspace/changes/page-332cb9b7837d465b.js +3 -0
- package/.next/static/css/c4117eb58c7d0642.css +1 -0
- package/package.json +1 -1
- package/public/github.png +0 -0
- package/.next/static/chunks/147-d4cb3e03218d75df.js +0 -6
- package/.next/static/chunks/26-0e6386c43f055f59.js +0 -1
- package/.next/static/chunks/app/credentials/page-9d0b6c0a8cf1ce2f.js +0 -1
- package/.next/static/chunks/app/page-157b05e7d700b845.js +0 -1
- package/.next/static/chunks/app/workspace/changes/page-e8bc3001e0ce1bb9.js +0 -3
- package/.next/static/css/aba7f1cbfd108b5e.css +0 -1
- /package/.next/static/{rozD2mKp-fnaizXZhYJKN → IsI_X7X1cKXUpjpCKYBiv}/_buildManifest.js +0 -0
- /package/.next/static/{rozD2mKp-fnaizXZhYJKN → IsI_X7X1cKXUpjpCKYBiv}/_ssgManifest.js +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
"use strict";exports.id=739,exports.ids=[739],exports.modules={1739:(a,b,c)=>{c.d(b,{u:()=>E});var d=c(8249),e=c(4626),f=c(7484);function g(a){let b=0x811c9dc5;for(let c=0;c<a.length;c++)b^=a.charCodeAt(c),b=Math.imul(b,0x1000193);return b>>>0}var h=c(4490);function i({children:a,items:b,containerClassName:c="w-full"}){let[e,g]=(0,f.useState)(!1),[i,j]=(0,f.useState)({x:0,y:0}),k=(0,f.useRef)(null),l=(0,f.useRef)(null),m=(a,b)=>{let c=!!a.children?.length;return(0,d.jsxs)("li",{className:(0,h.cn)(c&&"relative group/submenu"),children:[(0,d.jsxs)("a",{onClick:b=>{b.stopPropagation(),a.disabled||c||(a.onClick?.(),g(!1))},className:(0,h.cn)("whitespace-nowrap",a.danger&&"text-error",a.disabled&&"opacity-40 pointer-events-none",c&&"flex items-center justify-between gap-3"),children:[(0,d.jsx)("span",{children:a.labelNode??a.label}),c&&(0,d.jsx)("i",{className:"iconoir-nav-arrow-right text-[12px]","aria-hidden":"true"})]}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"hidden group-hover/submenu:block absolute left-full top-0 h-full w-3"}),(0,d.jsx)("ul",{className:"hidden group-hover/submenu:block absolute left-[calc(100%-1px)] top-0 menu !m-0 p-2 shadow-lg bg-base-100 rounded-box border border-base-200 min-w-[220px] z-[10000] [&:before]:hidden",children:a.children.map((a,c)=>m(a,`${b}-${c}`))})]})]},b)};return(0,d.jsxs)("div",{ref:l,className:c,onContextMenu:a=>{a.preventDefault(),a.stopPropagation(),j({x:a.clientX,y:a.clientY}),g(!0)},children:[a,e&&(0,d.jsx)("ul",{ref:k,className:"fixed z-[9999] menu p-2 shadow-lg bg-base-100 rounded-box border border-base-200",style:{left:`${i.x}px`,top:`${i.y}px`},children:b.map((a,b)=>m(a,`menu-${b}`))})]})}function j({text:a,searchQuery:b}){if(!b||!a)return(0,d.jsx)(d.Fragment,{children:a});let c=b.toLowerCase(),e=a.toLowerCase(),f=[],g=0,h=e.indexOf(c);for(;-1!==h;)h>g&&f.push({text:a.slice(g,h),highlighted:!1}),f.push({text:a.slice(h,h+c.length),highlighted:!0}),g=h+c.length,h=e.indexOf(c,g);return(g<a.length&&f.push({text:a.slice(g),highlighted:!1}),0===f.length)?(0,d.jsx)(d.Fragment,{children:a}):(0,d.jsx)(d.Fragment,{children:f.map((a,b)=>a.highlighted?(0,d.jsx)("mark",{className:"bg-warning text-warning-content rounded-sm px-0.5",children:a.text},b):(0,d.jsx)("span",{children:a.text},b))})}let k=(0,f.forwardRef)(function({commits:a,onSelectCommit:b,onResetToCommit:c,onRevertCommit:e,onCreateTag:k,onCherryPickCommit:l,onCherryPickSelectedCommits:m,onRewordCommit:n,selectedHash:o,selectedHashes:p,onEndReached:q,isLoadingMore:r,currentBranch:s,hiddenBranches:t,localBranches:u=[],trackingInfo:v,getBranchTagContextMenuItems:w},x){let y=(0,f.useCallback)(a=>a.startsWith("refs/heads/")?a.slice(11):a.startsWith("refs/remotes/")?a.slice(13):a.startsWith("remotes/")?a.slice(8):a,[]),z=(0,f.useCallback)(a=>a.startsWith("tag:")?a.replace(/^tag:\s*/,"").trim():a,[]),A=(0,f.useMemo)(()=>(function(a,b={}){let c=[],d=new Set(b.localBranches??[]),e=[],f=[],h=[];function i(){for(let a=0;a<e.length;a++)if(null===e[a])return a;return e.length}function j(a){let b,c=h[a],d=c?(b=g(c),`hsl(${b%360} 82% 52%)`):f[a]??`hsl(${47*a%360} 78% 56%)`;return f[a]=d,d}return a.forEach((a,b)=>{var g;let k=e.indexOf(a.hash);for(-1===k&&(k=i());e.length<=k;)e.push(null),h.push(null),f.push(void 0);let l=function(a,b){if(0===a.length)return null;let c=a.find(a=>b.has(a));return c||a[0]}((g=a.refs)?g.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(a=>a.trim()).filter(Boolean).map(a=>a.replace(/^HEAD\s*->\s*/,"").trim()).map(a=>a.startsWith("refs/heads/")?a.slice(11):a.startsWith("refs/remotes/")?a.slice(13):a.startsWith("remotes/")?a.slice(8):a).filter(a=>!a.startsWith("tag:")).filter(a=>"HEAD"!==a).filter(a=>!/\/HEAD$/.test(a)):[],d);if(l){let a=function(a,b){let c,d;if(b.has(a))return a;let e=-1===(d=(c=a.startsWith("remotes/")?a.slice(8):a).indexOf("/"))?null:c.slice(d+1);return e&&b.has(e)?e:a}(l,d);(function(a,b,c){return!b||c.has(a)&&!c.has(b)})(a,h[k],d)&&(h[k]=a)}let m=j(k),n={...a,x:k,y:b,color:m,paths:[],isMerge:a.parents.length>1};for(let a=0;a<e.length;a++)a!==k&&null!==e[a]&&n.paths.push({x1:a,y1:b,x2:a,y2:b+1,color:j(a),type:"straight"});e[k]=null;let o=a.parents;if(o.length>0){let a=o[0],c=e.indexOf(a);-1!==c?n.paths.push({x1:k,y1:b,x2:c,y2:b+1,color:m,type:"merge"}):(e[k]=a,n.paths.push({x1:k,y1:b,x2:k,y2:b+1,color:m,type:"straight"}));for(let a=1;a<o.length;a++){let c=o[a],d=e.indexOf(c);if(-1!==d)n.paths.push({x1:k,y1:b,x2:d,y2:b+1,color:j(d),type:"fork"});else{let a=i();for(;e.length<=a;)e.push(null),h.push(null),f.push(void 0);e[a]=c,n.paths.push({x1:k,y1:b,x2:a,y2:b+1,color:j(a),type:"fork"})}}}null===e[k]&&(h[k]=null,f[k]=void 0),c.push(n)}),c})(a,{localBranches:u}),[a,u]),B=(0,f.useRef)(null),C=(0,f.useRef)(null),[D,E]=(0,f.useState)(!1),[F,G]=(0,f.useState)("");(0,f.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"f"===a.key&&(a.preventDefault(),E(!0),setTimeout(()=>C.current?.focus(),0)),"Escape"===a.key&&D&&(E(!1),G(""))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[D]);let H=(0,f.useCallback)(()=>{E(!1),G("")},[]);if((0,f.useImperativeHandle)(x,()=>({scrollToCommit:a=>{if(!A||0===A.length)return!1;let b=A.findIndex(b=>b.hash===a);if(-1===b)return!1;if(B.current){let a=24*b-B.current.clientHeight/2+12;B.current.scrollTop=Math.max(0,a)}return!0}}),[A]),!A||0===A.length)return null;let I=(Math.max(...A.map(a=>a.x),0)+1)*12+20,J=24*A.length;return(0,d.jsxs)("div",{className:"flex flex-col h-full bg-base-100 overflow-hidden font-mono text-sm select-none",children:[D&&(0,d.jsxs)("div",{className:"sticky top-0 z-30 bg-base-100 border-b border-base-300 px-2 py-2 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"opacity-50",children:"\uD83D\uDD0D"}),(0,d.jsx)("input",{ref:C,type:"text",placeholder:"Search in commits...",value:F,onChange:a=>G(a.target.value),className:"input input-bordered input-sm flex-1 text-sm",autoFocus:!0}),(0,d.jsx)("div",{className:"tooltip tooltip-left z-50","data-tip":"Close search (Esc)",children:(0,d.jsx)("button",{onClick:H,className:"btn btn-ghost btn-sm btn-square",children:"✖️"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto h-full max-w-full px-2",onScroll:a=>{let{scrollTop:b,clientHeight:c,scrollHeight:d}=a.currentTarget;d-b-c<100&&q?.()},ref:B,children:(0,d.jsxs)("div",{className:"relative min-w-full",style:{height:J},children:[(0,d.jsxs)("svg",{width:I,height:J,className:"absolute top-0 left-0 pointer-events-none z-10",children:[A.map(a=>(0,d.jsx)("g",{children:a.paths.map((a,b)=>{let c=12*a.x1+6,e=24*a.y1+12,f=12*a.x2+6,g=24*a.y2+12,h="";if("straight"===a.type)h=`M ${c} ${e} L ${f} ${g}`;else{let a=e+12,b=g-12;h=`M ${c} ${e} C ${c} ${a}, ${f} ${b}, ${f} ${g}`}return(0,d.jsx)("path",{d:h,stroke:a.color,strokeWidth:2,fill:"none",strokeLinecap:"round"},b)})},a.hash)),A.map(a=>(0,d.jsx)("circle",{cx:12*a.x+6,cy:24*a.y+12,r:3,fill:a.color,stroke:a.color,strokeWidth:2},`dot-${a.hash}`))]}),(0,d.jsxs)("div",{style:{width:"100%"},children:[A.map(a=>{let f=p?p.has(a.hash):o===a.hash,q=p?.size??+!!o,r=[{label:"Reset to here",onClick:()=>c?.(a.hash)}];if(e&&r.push({label:"Revert commit",onClick:()=>e(a.hash,a.message)}),k&&r.push({label:"Create tag",onClick:()=>k(a.hash)}),l&&r.push({label:"Cherry-pick commit",onClick:()=>l(a.hash,a.message)}),m&&q>1&&f&&r.push({label:`Cherry-pick ${q} selected commits`,onClick:m}),n&&u&&u.length>0){let b=a.refs?a.refs.replace(/[()]/g,"").split(",").map(a=>a.trim()):[],c=null;for(let a of b){let b=a.replace(/^HEAD\s*->\s*/,"");if(u.includes(b)&&(c=b,s&&b===s))break}c&&r.push({label:"Reword commit",onClick:()=>n(a.hash,a.message,a.body??"",c)})}let x=(()=>{if(!a.refs)return[];let b=a.refs.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(a=>{let b=a.startsWith("HEAD -> "),c=y(a.replace(/^HEAD\s*->\s*/,"").trim());return{raw:a,name:c,isHead:b}}),c=[],d=new Set,e=a=>t&&(t.has(a)||t.has(`remotes/${a}`));return b.forEach((a,f)=>{if(!d.has(f)&&u.includes(a.name)&&!e(a.name)){let e=v?.[a.name];if(e&&e.upstream){let g=y(e.upstream.trim()),h=new Set([g,y(`remotes/${g}`),y(`refs/remotes/${g}`)]),i=b.findIndex((a,b)=>b!==f&&!d.has(b)&&h.has(a.name));if(-1!==i){let e=b[i],h=g.split("/")[0];c.push({displayName:`${a.name} (${h})`,primaryRef:a.name,secondaryRef:e.name,isHead:a.isHead}),d.add(f),d.add(i);return}}}}),b.forEach((a,b)=>{!d.has(b)&&(e(a.name)||c.push({displayName:z(a.name),primaryRef:a.name,isHead:a.isHead}))}),c})();return(0,d.jsx)(i,{items:r,children:(0,d.jsxs)("div",{className:(0,h.cn)("flex items-center hover:bg-base-200 border-b border-base-200 last:border-0 cursor-pointer transition-colors text-xs",f&&"bg-primary/10"),style:{height:24},onClick:c=>b?.(a.hash,{isMultiSelect:c.metaKey||c.ctrlKey,isRangeSelect:c.shiftKey}),children:[(0,d.jsx)("div",{style:{width:I,flexShrink:0}}),(0,d.jsxs)("div",{className:"flex flex-1 gap-4 overflow-hidden pr-4 items-center",children:[(0,d.jsxs)("div",{className:"flex-1 truncate flex items-center gap-2",children:[x.map((a,b)=>{let c=s&&(a.primaryRef===s||a.isHead&&a.primaryRef===s),e=a.primaryRef.startsWith("tag:")?{textColor:"#374151",backgroundColor:"#e5e7eb"}:function(a){let b,c,d,e,f,h,i,j,k,l=g(a),m=l%360,n=72+(l>>>9)%20,o=84+(l>>>17)%8,p=1.05/((k=function({r:a,g:b,b:c}){let d=a=>{let b=a/255;return b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4)};return .2126*d(a)+.7152*d(b)+.0722*d(c)}((c=n/100*(1-Math.abs(2*(b=o/100)-1)),e=c*(1-Math.abs((d=m/60)%2-1)),f=0,h=0,i=0,d>=0&&d<1?(f=c,h=e):d>=1&&d<2?(f=e,h=c):d>=2&&d<3?(h=c,i=e):d>=3&&d<4?(h=e,i=c):d>=4&&d<5?(f=e,i=c):(f=c,i=e),{r:Math.round((f+(j=b-c/2))*255),g:Math.round((h+j)*255),b:Math.round((i+j)*255)})))+.05)>=(k+.05)/.05?"#ffffff":"#111827";return{backgroundColor:`hsl(${m} ${n}% ${o}%)`,textColor:p}}(a.primaryRef),f=(0,d.jsx)("span",{className:(0,h.cn)("text-[10px] px-1.5 rounded-full whitespace-nowrap shrink-0",c&&"font-bold"),style:{color:e.textColor,backgroundColor:e.backgroundColor},title:a.displayName,children:(0,d.jsx)(j,{text:a.displayName,searchQuery:F})}),k=w?.(a.primaryRef)||[];return 0===k.length?(0,d.jsx)("span",{className:"shrink-0",children:f},b):(0,d.jsx)(i,{items:k,containerClassName:"inline-flex shrink-0",children:f},b)}),(0,d.jsx)("span",{className:(0,h.cn)("truncate min-w-0 max-w-[600px]",f?"font-semibold":""),title:a.message,children:(0,d.jsx)(j,{text:a.message,searchQuery:F})})]}),(0,d.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:(0,d.jsx)(j,{text:a.author_name,searchQuery:F})}),(0,d.jsx)("div",{className:"w-20 truncate opacity-50 font-mono text-right",children:(0,d.jsx)(j,{text:a.hash.substring(0,7),searchQuery:F})}),(0,d.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:new Date(a.date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]})]})},a.hash)}),r&&(0,d.jsxs)("div",{className:"flex items-center justify-center py-8 border-b border-base-300",children:[(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"}),(0,d.jsx)("span",{className:"ml-2 text-sm opacity-70",children:"Loading more commits..."})]})]})]})})]})});var l=c(8696),m=c(7532),n=c(5048),o=c(8550),p=c(3381);async function q(a){try{return await navigator.clipboard.writeText(a),!0}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.left="-9999px",document.body.appendChild(b),b.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(b)}}}let r={isOpen:!1,executionId:null,scriptName:"",branchRef:"",output:"",status:"idle",error:null};function s({status:a}){switch(a){case"A":return(0,d.jsx)("i",{className:"iconoir-plus-circle text-[16px] text-success","aria-hidden":"true"});case"D":return(0,d.jsx)("i",{className:"iconoir-minus-circle text-[16px] text-error","aria-hidden":"true"});case"M":return(0,d.jsx)("i",{className:"iconoir-edit-pencil text-[16px] text-warning","aria-hidden":"true"});default:return(0,d.jsx)("i",{className:"iconoir-page text-[16px] opacity-50","aria-hidden":"true"})}}function t({node:a,selectedFile:b,expandedFolders:c,onToggleFolder:e,onSelectFile:f,depth:g=0}){let i=Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0,d=b.children.size>0;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)});return(0,d.jsx)(d.Fragment,{children:i.map(a=>{if(a.children.size>0){let h=c.has(a.path);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors opacity-80",style:{paddingLeft:`${12*g+8}px`},onClick:()=>e(a.path),title:a.path,children:[(0,d.jsx)("span",{className:"text-[10px] opacity-70",children:h?"▼":"▶"}),(0,d.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate flex-1",children:a.name})]}),h&&(0,d.jsx)(t,{node:a,selectedFile:b,expandedFolders:c,onToggleFolder:e,onSelectFile:f,depth:g+1})]},a.path)}if(!a.file)return null;let i=a.file;return(0,d.jsxs)("div",{className:(0,h.cn)("flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors",b===i.path&&"bg-base-200 font-medium"),style:{paddingLeft:`${12*g+8}px`},onClick:()=>f(i.path),title:i.path,children:[(0,d.jsx)(s,{status:i.status}),(0,d.jsx)("span",{className:"truncate flex-1 font-mono",children:a.name})]},a.path)})})}function u({repoPath:a,commitHash:b,filePath:c,splitView:g}){let{data:i,isLoading:j}=(0,e.st)(a,b,c),{resolvedTheme:k}=(0,l.D)(),[o,p]=(0,f.useState)(!1);if(j)return(0,d.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!i)return(0,d.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"No diff available"});if((0,h.u)(c))return(0,d.jsx)(n.K,{filePath:c,imageDiff:i.imageDiff});if((0,h.kO)(c,i.left,i.right))return(0,d.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"Binary file - diff not available"});let q=i.diff||"",r=q.length,s=(0,h.tq)(q);return(r>102400||s>3e3)&&!o?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-8",children:[(0,d.jsx)("i",{className:"iconoir-warning-triangle text-[32px] text-warning","aria-hidden":"true"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,d.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(r/1024),"KB, ~",s," changed lines) and may freeze your browser if rendered."]})]}),(0,d.jsx)("button",{className:"btn btn-outline",onClick:()=>p(!0),children:"Show Diff Anyway"})]}):(0,d.jsx)("div",{className:"overflow-auto h-full",children:(0,d.jsx)(m.O,{oldValue:i.left||"",newValue:i.right||"",splitView:g,useDarkTheme:"dark"===k})})}function v({repoPath:a,commitHash:b}){let{data:c,isLoading:g}=(0,e.gg)(a,b),[h,i]=(0,f.useState)(null),[j,k]=(0,f.useState)({}),l=(0,f.useMemo)(()=>(function(a){let b={name:"",path:"",children:new Map};for(let c of a){let a=c.path.split("/").filter(Boolean),d=b,e="";for(let b=0;b<a.length;b++){let f=a[b];e=e?`${e}/${f}`:f,d.children.has(f)||d.children.set(f,{name:f,path:e,children:new Map}),d=d.children.get(f),b===a.length-1&&(d.file=c)}}return b})(c?.files??[]),[c?.files]),m=(0,f.useMemo)(()=>(function a(b){let c=[];return Array.from(b.children.values()).forEach(b=>{b.children.size>0&&(c.push(b.path),c.push(...a(b)))}),c})(l),[l]),n=(0,f.useMemo)(()=>j[b]??new Set,[j,b]),[o,p]=(0,f.useState)(()=>!0),q=(0,f.useMemo)(()=>{let a=new Set;return m.forEach(b=>{n.has(b)||a.add(b)}),h&&(function(a){let b=a.split("/").filter(Boolean),c=[];for(let a=1;a<b.length;a++)c.push(b.slice(0,a).join("/"));return c})(h).forEach(b=>a.add(b)),a},[m,n,h]),r=(0,f.useCallback)(a=>{k(c=>{let d=new Set(c[b]??new Set);return d.has(a)?d.delete(a):d.add(a),{...c,[b]:d}})},[b]);return g?(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):c&&0!==c.files.length?(0,d.jsxs)("div",{className:"flex h-full",children:[(0,d.jsxs)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30 shrink-0",children:[(0,d.jsxs)("div",{className:"px-3 py-2 text-xs font-bold opacity-70 border-b border-base-300 bg-base-100",children:[c.files.length," file",1!==c.files.length?"s":""," changed"]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:(0,d.jsx)("div",{className:"p-1",children:(0,d.jsx)(t,{node:l,selectedFile:h,expandedFolders:q,onToggleFolder:r,onSelectFile:i})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-hidden",children:h?(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsxs)("div",{className:"px-4 py-2 text-xs font-mono opacity-70 border-b border-base-300 bg-base-100 shrink-0 truncate flex items-center justify-between",children:[(0,d.jsx)("span",{className:"truncate",children:h}),(0,d.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[(0,d.jsx)("label",{htmlFor:"commit-diff-split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,d.jsx)("input",{type:"checkbox",id:"commit-diff-split-view",checked:o,onChange:a=>p(a.target.checked),className:"toggle toggle-xs toggle-primary"})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto diff-viewer-wrapper",children:(0,d.jsx)(u,{repoPath:a,commitHash:b,filePath:h,splitView:o})})]}):(0,d.jsx)("div",{className:"flex items-center justify-center h-full opacity-70 text-sm",children:"Select a file to view changes"})})]}):(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-50",children:"No changes in this commit"})}function w(a,b=""){let c={name:"",children:new Map};for(let d of a){let a=d.split("/"),e=c;for(let c=0;c<a.length;c++){let f=a[c];e.children.has(f)||e.children.set(f,{name:f,children:new Map}),e=e.children.get(f),c===a.length-1&&(e.fullPath=b?`${b}/${d}`:d)}}return c}function x(a,b,c){if(b[a])return b[a];let d=a.split("/");for(let a=d.length-1;a>0;a--){let c=d.slice(0,a).join("/");if(b[c])return b[c]}if(c){let a=c.split("/");for(let c=a.length;c>0;c--){let d=a.slice(0,c).join("/");if(b[d])return b[d]}}return null}function y({name:a,groupPath:b,icon:c,isExpanded:e,onToggle:f,visibilityMap:g,onToggleVisibility:i,depth:j=0}){let k=g[b],l=b.includes("/")?b.split("/").slice(0,-1).join("/"):void 0,m=l?g[l]:null,n=k||m,o=!k&&null!==m;return(0,d.jsxs)("div",{className:(0,h.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors font-medium"),style:{paddingLeft:`${12*j+8}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",onClick:f,children:[(0,d.jsx)("span",{className:"text-xs opacity-70",children:e?"▼":"▶"}),(0,d.jsx)("span",{className:"shrink-0",children:c}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",children:a})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(z,{type:"visible",isActive:"visible"===k||o&&"visible"===n,isInherited:o&&"visible"===n,onClick:a=>{a.stopPropagation(),i(b,"visible")},showOnHover:"visible"===k||o&&"visible"===n}),(0,d.jsx)(z,{type:"hidden",isActive:"hidden"===k||o&&"hidden"===n,isInherited:o&&"hidden"===n,onClick:a=>{a.stopPropagation(),i(b,"hidden")},showOnHover:"hidden"===k||o&&"hidden"===n})]})]})}function z({type:a,isActive:b,isInherited:c,onClick:e,showOnHover:f}){return(0,d.jsx)("button",{className:(0,h.cn)("p-0.5 rounded hover:bg-base-300 transition-colors shrink-0 cursor-pointer text-xs",b&&"bg-primary/10",c&&"opacity-50",!b&&!f&&"opacity-0 group-hover:opacity-100"),onClick:e,title:"visible"===a?b?"Remove visible filter":"Show only this branch":b?"Remove hide filter":"Hide this branch",children:"visible"===a?(0,d.jsx)("i",{className:"iconoir-eye text-[14px]","aria-hidden":"true"}):(0,d.jsx)("i",{className:"iconoir-eye-closed text-[14px]","aria-hidden":"true"})})}function A(a){return Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0&&!a.fullPath,d=b.children.size>0&&!b.fullPath;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)})}function B(a,b,c=""){let d=[];for(let e of A(a)){if(void 0!==e.fullPath){d.push(e.fullPath);continue}let a=c?`${c}/${e.name}`:e.name;b.has(a)&&d.push(...B(e,b,a))}return d}function C(a){let b=[];for(let c of A(a)){if(c.fullPath){b.push(c.fullPath);continue}b.push(...C(c))}return b}function D({node:a,currentBranch:b,expandedFolders:c,onToggleFolder:e,onCheckout:f,onCheckoutToLocal:g,onCreateBranch:j,onDeleteBranch:k,onRenameBranch:l,onRenameRemoteBranch:m,onRebase:n,onMerge:o,onPushToRemote:p,onPullFromRemote:q,getBranchContextMenuItems:r,onBranchClick:s,onBranchContextMenu:t,onDeleteBranchGroup:u,selectedBranches:v,visibilityMap:w,onToggleVisibility:y,parentPath:A="",depth:B=0,groupPath:E,isRemote:F=!1,trackingInfo:G}){let H=Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0&&!a.fullPath,d=b.children.size>0&&!b.fullPath;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)});return(0,d.jsx)(d.Fragment,{children:H.map(a=>{let H=void 0!==a.fullPath,I=a.children.size>0&&!H,J=a.fullPath||(A?`${A}/${a.name}`:a.name),K=c.has(J),L=H&&a.fullPath===b,M=w[J],N=x(J,w,E),O=!M&&null!==N;if(I){let x=C(a).filter(a=>a!==b);return(0,d.jsxs)("div",{children:[(0,d.jsx)(i,{items:[{label:"Delete",onClick:()=>u(x),danger:!0,disabled:0===x.length}],children:(0,d.jsxs)("div",{className:(0,h.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors opacity-70 select-none"),style:{paddingLeft:`${12*B+8}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0",onClick:()=>e(J),children:[(0,d.jsx)("span",{className:"text-xs opacity-70",children:K?"▼":"▶"}),(0,d.jsx)("i",{className:"iconoir-folder text-[16px] shrink-0","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",children:a.name})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(z,{type:"visible",isActive:"visible"===M||O&&"visible"===N,isInherited:O&&"visible"===N,onClick:a=>{a.stopPropagation(),y(J,"visible")},showOnHover:"visible"===M||O&&"visible"===N}),(0,d.jsx)(z,{type:"hidden",isActive:"hidden"===M||O&&"hidden"===N,isInherited:O&&"hidden"===N,onClick:a=>{a.stopPropagation(),y(J,"hidden")},showOnHover:"hidden"===M||O&&"hidden"===N})]})]})}),K&&(0,d.jsx)(D,{node:a,currentBranch:b,expandedFolders:c,onToggleFolder:e,onCheckout:f,onCheckoutToLocal:g,onCreateBranch:j,onDeleteBranch:k,onRenameBranch:l,onRenameRemoteBranch:m,onRebase:n,onMerge:o,onPushToRemote:p,onPullFromRemote:q,getBranchContextMenuItems:r,onBranchClick:s,onBranchContextMenu:t,onDeleteBranchGroup:u,selectedBranches:v,visibilityMap:w,onToggleVisibility:y,parentPath:J,depth:B+1,groupPath:E,isRemote:F,trackingInfo:G})]},J)}let P=!F&&a.fullPath?G?.[a.fullPath]:void 0,Q=P&&(P.ahead>0||P.behind>0),R=r({branchRef:a.fullPath,branchLeafName:a.name,currentBranch:b,isRemote:F,selectedBranchRefs:v.has(a.fullPath)?Array.from(v):[a.fullPath]}),S=v.has(a.fullPath);return(0,d.jsx)(i,{items:R,children:(0,d.jsxs)("div",{className:(0,h.cn)("group flex items-center gap-2 px-2 py-1.5 text-sm rounded-md cursor-pointer transition-colors select-none",!S&&"hover:bg-base-200",S&&"bg-primary/10 hover:bg-primary/20",L&&"bg-base-200 font-medium text-primary"),style:{paddingLeft:`${12*B+8}px`},onContextMenu:()=>t?.(a.fullPath),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",onClick:b=>s?.(a.fullPath,{isMultiSelect:b.metaKey||b.ctrlKey,isRangeSelect:b.shiftKey}),onDoubleClick:()=>!L&&f(a.fullPath),children:[L?(0,d.jsx)("span",{className:"w-3 h-3 flex items-center justify-center shrink-0",children:(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary"})}):F?(0,d.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50 shrink-0","aria-hidden":"true"}):(0,d.jsx)("i",{className:"iconoir-git-branch text-[14px] opacity-50 shrink-0","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",title:a.fullPath,children:a.name}),Q&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs opacity-70 shrink-0",title:`${P.ahead} ahead, ${P.behind} behind ${P.upstream}`,children:[P.ahead>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,d.jsx)("i",{className:"iconoir-arrow-up text-[12px]","aria-hidden":"true"}),(0,d.jsx)("span",{children:P.ahead})]}),P.behind>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,d.jsx)("i",{className:"iconoir-arrow-down text-[12px]","aria-hidden":"true"}),(0,d.jsx)("span",{children:P.behind})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(z,{type:"visible",isActive:"visible"===M||O&&"visible"===N,isInherited:O&&"visible"===N,onClick:a=>{a.stopPropagation(),y(J,"visible")},showOnHover:"visible"===M||O&&"visible"===N}),(0,d.jsx)(z,{type:"hidden",isActive:"hidden"===M||O&&"hidden"===N,isInherited:O&&"hidden"===N,onClick:a=>{a.stopPropagation(),y(J,"hidden")},showOnHover:"hidden"===M||O&&"hidden"===N})]})]})},a.fullPath)})})}function E({repoPath:a}){let{data:b}=(0,e.t0)();(0,e.Y5)();let[c,g]=(0,f.useState)(100),{data:j,isLoading:l,isError:m,error:n,refetch:s,isFetching:t}=(0,e._X)(a,c),{data:u,isLoading:z}=(0,e._6)(a),{data:A}=(0,e.en)(a),[E,F]=(0,f.useState)(null),[G,H]=(0,f.useState)([]),[I,J]=(0,f.useState)(null),K=(0,f.useCallback)(a=>{F(a),H(a?[a]:[]),J(a)},[]),{mutateAsync:L}=(0,e.a3)(),[M,N]=(0,f.useState)(!1),[O,P]=(0,f.useState)(""),[Q,R]=(0,f.useState)(null),[S,T]=(0,f.useState)(!1),[U,V]=(0,f.useState)(!1),[W,X]=(0,f.useState)(null),[Y,Z]=(0,f.useState)(""),[$,_]=(0,f.useState)(!1),[aa,ab]=(0,f.useState)(!1),[ac,ad]=(0,f.useState)(!1),[ae,af]=(0,f.useState)([]),[ag,ah]=(0,f.useState)(!1),[ai,aj]=(0,f.useState)(!1),[ak,al]=(0,f.useState)(!1),[am,an]=(0,f.useState)(null),[ao,ap]=(0,f.useState)(!1),[aq,ar]=(0,f.useState)(!1),[as,at]=(0,f.useState)(!1),[au,av]=(0,f.useState)([]),[aw,ax]=(0,f.useState)(!1),[ay,az]=(0,f.useState)(!1),[aA,aB]=(0,f.useState)(!1),[aC,aD]=(0,f.useState)(!1),[aE,aF]=(0,f.useState)(null),[aG,aH]=(0,f.useState)(null),[aI,aJ]=(0,f.useState)(""),[aK,aL]=(0,f.useState)(!1),[aM,aN]=(0,f.useState)(!1),[aO,aP]=(0,f.useState)(!1),[aQ,aR]=(0,f.useState)(null),[aS,aT]=(0,f.useState)(""),[aU,aV]=(0,f.useState)(!1),[aW,aX]=(0,f.useState)(!1),[aY,aZ]=(0,f.useState)(null),[a$,a_]=(0,f.useState)(!1),[a0,a1]=(0,f.useState)(!1),[a2,a3]=(0,f.useState)("origin"),[a4,a5]=(0,f.useState)(""),[a6,a7]=(0,f.useState)(!1),[a8,a9]=(0,f.useState)(!1),[ba,bb]=(0,f.useState)(null),[bc,bd]=(0,f.useState)(null),[be,bf]=(0,f.useState)(!0),[bg,bh]=(0,f.useState)(!1),[bi,bj]=(0,f.useState)("checking"),bk=(0,f.useCallback)(()=>{a9(!1),bb(null),bd(null),bj("checking")},[]),[bl,bm]=(0,f.useState)(!1),[bn,bo]=(0,f.useState)(null),[bp,bq]=(0,f.useState)(null),[br,bs]=(0,f.useState)(!1),[bt,bu]=(0,f.useState)(!1),[bv,bw]=(0,f.useState)(!1),[bx,by]=(0,f.useState)(""),[bz,bA]=(0,f.useState)(!1),[bB,bC]=(0,f.useState)("checking"),bD=(0,f.useCallback)(()=>{bm(!1),bo(null),bq(null),bC("checking")},[]),[bE,bF]=(0,f.useState)(!1),[bG,bH]=(0,f.useState)(null),[bI,bJ]=(0,f.useState)([]),[bK,bL]=(0,f.useState)(""),[bM,bN]=(0,f.useState)([]),[bO,bP]=(0,f.useState)(""),[bQ,bR]=(0,f.useState)(null),[bS,bT]=(0,f.useState)(!1),[bU,bV]=(0,f.useState)(!1),[bW,bX]=(0,f.useState)(!0),[bY,bZ]=(0,f.useState)(!1),[b$,b_]=(0,f.useState)(""),[b0,b1]=(0,f.useState)(!1),[b2,b3]=(0,f.useState)(null),[b4,b5]=(0,f.useState)(!1),[b6,b7]=(0,f.useState)(!1),[b8,b9]=(0,f.useState)(!1),[ca,cb]=(0,f.useState)(null),[cc,cd]=(0,f.useState)([]),[ce,cf]=(0,f.useState)(""),[cg,ch]=(0,f.useState)([]),[ci,cj]=(0,f.useState)(""),[ck,cl]=(0,f.useState)(null),[cm,cn]=(0,f.useState)(!0),[co,cp]=(0,f.useState)(!1),[cq,cr]=(0,f.useState)(null),[cs,ct]=(0,f.useState)(!1),[cu,cv]=(0,f.useState)(!1),[cw,cx]=(0,f.useState)(!1),[cy,cz]=(0,f.useState)(!1),[cA,cB]=(0,f.useState)(null),[cC,cD]=(0,f.useState)(""),[cE,cF]=(0,f.useState)(!1),[cG,cH]=(0,f.useState)(!1),[cI,cJ]=(0,f.useState)(null),[cK,cL]=(0,f.useState)(!1),[cM,cN]=(0,f.useState)(!1),[cO,cP]=(0,f.useState)(null),[cQ,cR]=(0,f.useState)(!1),[cS,cT]=(0,f.useState)(!1),[cU,cV]=(0,f.useState)(null),[cW,cX]=(0,f.useState)(""),[cY,cZ]=(0,f.useState)(""),[c$,c_]=(0,f.useState)(!1),c0=(0,f.useRef)(null),[c1,c2]=(0,f.useState)(null),[c3,c4]=(0,f.useState)([]),[c5,c6]=(0,f.useState)(null),[c7,c8]=(0,f.useState)(!1),c9=(0,f.useRef)(null),[da,db]=(0,f.useState)(r),[dc,dd]=(0,f.useState)(!1),[de,df]=(0,f.useState)(!1),[dg,dh]=(0,f.useState)(!1),di="starting"===da.status||"running"===da.status,dj="completed"===da.status||"failed"===da.status||"canceled"===da.status,dk=(0,f.useCallback)(()=>{aD(!1),aF(null),aH(null),aJ(""),aL(!1)},[]),dl=(0,f.useCallback)(()=>{aP(!1),aR(null),aT("")},[]),dm=(0,f.useCallback)(()=>{aX(!1),aZ(null)},[]),dn=(0,f.useCallback)(()=>{a1(!1),a3("origin"),a5("")},[]),dp=(0,f.useCallback)(()=>{cT(!1),cV(null),cX(""),cZ("")},[]),dq=(0,f.useCallback)(()=>{if(ay){az(!1),av([]);return}if(cy)return void cz(!1);if(M){N(!1),R(null);return}if(U){V(!1),X(null),Z(""),_(!1);return}if(b8)return void b9(!1);if(bE)return void bF(!1);if(bl)return void bD();if(a8)return void bk();if(aC)return void dk();if(aO)return void dl();if(aW)return void dm();if(a0)return void dn();if(as){at(!1),av([]);return}if(ac){ad(!1),af([]),ah(!1);return}if(ak){al(!1),an(null),ap(!1);return}if(cS)return void dp();if(cG)return void cH(!1);if(cM){cN(!1),cP(null);return}c7?c8(!1):da.isOpen&&dj&&(db(r),dh(!1),dd(!1))},[ay,cy,M,U,b8,bE,bD,bl,bk,a8,aC,dk,aO,dl,aW,dm,a0,dn,as,ac,ak,cS,dp,cG,cM,c7,da.isOpen,dj]),dr=cG||cM||cS||ac||ak||ay||as||aC||aO||aW||a0||a8||bl||bE||b8||M||U||cy||c7||da.isOpen;(0,o.v)(dr,dq);let[ds,dt]=(0,f.useState)(300),[du,dv]=(0,f.useState)(!1),dw=(0,f.useRef)(null),[dx,dy]=(0,f.useState)(.28),[dz,dA]=(0,f.useState)(!1),dB=(0,f.useRef)(null);(0,f.useRef)(!1);let dC=(0,f.useCallback)(a=>{a.preventDefault(),dv(!0),dw.current={startY:a.clientY,startHeight:ds}},[ds]),dD=(0,f.useCallback)(a=>{a.preventDefault(),dA(!0)},[]),dE=(0,f.useMemo)(()=>u?.branches?w(u.branches):null,[u?.branches]),dF=(0,f.useMemo)(()=>{if(!u?.remotes)return null;var a=u.remotes;let b=new Map;for(let[c,d]of Object.entries(a))b.set(c,w(d,`remotes/${c}`));return b},[u?.remotes]);(0,f.useMemo)(()=>{let a=new Set;for(let b of u?.branches??[])a.add(b);for(let[b,c]of Object.entries(u?.remotes??{}))for(let d of c)a.add(`remotes/${b}/${d}`);return a},[u?.branches,u?.remotes]);let dG=(0,f.useMemo)(()=>new Set(c3),[c3]),dH=(0,e.GK)(a),dI=(0,e.Lp)(),dJ=(0,f.useMemo)(()=>(dH?.customScripts??[]).filter(a=>"branch"===a.target&&"run-bash-script"===a.action&&a.name.trim().length>0&&a.content.trim().length>0),[dH?.customScripts]),[dK,dL]=(0,f.useState)(!0),[dM,dN]=(0,f.useState)(!0),[dO,dP]=(0,f.useState)({}),[dQ,dR]=(0,f.useState)(new Set),dS=(0,f.useMemo)(()=>{let a=[];if(dK&&dE&&a.push(...B(dE,dQ)),dM&&dF)for(let[b,c]of Array.from(dF.entries())){let d=`__remotes__/${b}`;dQ.has(d)&&a.push(...B(c,dQ,`remotes/${b}`))}return a},[dQ,dE,dK,dF,dM]);(0,f.useRef)(null);let dT=(0,f.useCallback)(b=>{dI.mutate({path:a,updates:b})},[a,dI]),dU=(0,f.useCallback)(()=>{let a=!dK;dL(a),dT({localGroupExpanded:a})},[dK,dT]),dV=(0,f.useCallback)(()=>{let a=!dM;dN(a),dT({remotesGroupExpanded:a})},[dM,dT]),dW=(0,f.useCallback)(a=>{dR(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),dT({expandedFolders:Array.from(c)}),c})},[dT]),dX=(0,f.useCallback)((a,b)=>{dP(c=>{let d={...c};d[a]===b?delete d[a]:d[a]=b;let e={};return Object.entries(d).forEach(([a,b])=>{("visible"===b||"hidden"===b)&&(e[a]=b)}),dT({visibilityMap:e}),d})},[dT]),dY=(0,f.useCallback)(()=>{dP({}),dT({visibilityMap:{}})},[dT]),dZ=(0,f.useCallback)((a,b)=>{let c=x(a,dO);if(c)return c;if(b){let b=a.split("/");if(b.length>=2&&"remotes"===b[0]){let a=b[1],c=dO[`__remotes__/${a}`];if(c)return c;let d=dO.__remotes__;if(d)return d}}else{let a=dO.__local__;if(a)return a}return null},[dO]),d$=(0,f.useMemo)(()=>{if(!j?.all||!u?.branches||!u?.branchCommits)return j?.all||[];let a=Object.values(dO).some(a=>"visible"===a),b=Object.values(dO).some(a=>"hidden"===a);if(!a&&!b)return j.all;let c=[...u.branches.map(a=>({branch:a,isRemote:!1}))];if(u.remotes)for(let[a,b]of Object.entries(u.remotes))for(let d of b)c.push({branch:`remotes/${a}/${d}`,isRemote:!0});let d=new Set,e=new Set,f=new Set;for(let{branch:a,isRemote:b}of c){let c=dZ(a,b);"visible"===c?d.add(a):"hidden"===c?e.add(a):f.add(a)}let g=new Map(j.all.map(a=>[a.hash,a])),h=(a,b)=>{let c=[a];for(;c.length>0;){let a=c.pop();if(b.has(a))continue;let d=g.get(a);if(d)for(let e of(b.add(a),d.parents||[]))b.has(e)||c.push(e)}},i=new Set;for(let a of d){let b=u.branchCommits[a];b&&h(b,i)}if(a)return j.all.filter(a=>i.has(a.hash));if(b){let a=new Set;for(let b of f){let c=u.branchCommits[b];c&&h(c,a)}return j.all.filter(b=>a.has(b.hash))}return j.all},[j?.all,u?.branches,u?.branchCommits,u?.remotes,dO,dZ]),d_=(0,f.useMemo)(()=>new Set(G),[G]),d0=(0,f.useMemo)(()=>d$.map(a=>a.hash),[d$]),d1=(0,f.useCallback)((a,b)=>{let c=b?.isRangeSelect??!1,d=b?.isMultiSelect??!1;if(c){let b=I??E??a,c=d0.indexOf(b),d=d0.indexOf(a);if(-1!==c&&-1!==d){let[e,f]=c<d?[c,d]:[d,c];H(d0.slice(e,f+1)),F(a),J(b);return}}if(d){if(d_.has(a)){let b=G.filter(b=>b!==a);H(b),F(c=>c!==a?c:b.length>0?b[b.length-1]:null),I===a&&J(b.length>0?b[b.length-1]:null)}else H([...G,a]),F(a),J(a);return}K(a)},[d0,d_,G,E,I,K]),d2=(0,f.useMemo)(()=>d$.filter(a=>d_.has(a.hash)).reverse(),[d$,d_]),d3=(0,f.useMemo)(()=>Object.values(dO).some(a=>"visible"===a||"hidden"===a),[dO]),d4=(0,f.useMemo)(()=>{let a=new Set;if(u?.branches)for(let b of u.branches)"hidden"===dZ(b,!1)&&a.add(b);if(u?.remotes)for(let[b,c]of Object.entries(u.remotes))for(let d of c){let c=`remotes/${b}/${d}`;"hidden"===dZ(c,!0)&&a.add(c)}return a},[u?.branches,u?.remotes,dZ]),d5=(0,f.useCallback)(a=>{if(!u?.branchCommits)return;let b=u.branchCommits[a];if(b){if(j?.all?.some(a=>a.hash===b)&&c0.current&&c0.current.scrollToCommit(b))return void K(b);c2(b),K(b)}},[u?.branchCommits,j?.all,K]),d6=(0,f.useCallback)((a,b)=>{let c=b?.isRangeSelect??!1,d=b?.isMultiSelect??!1;if(c){let b=c5??a,c=dS.indexOf(b),d=dS.indexOf(a);if(-1!==c&&-1!==d){let[e,f]=c<d?[c,d]:[d,c],g=dS.slice(e,f+1);dG.has(a)?c4(c3.filter(a=>!g.includes(a))):c4(Array.from(new Set([...c3,...g]))),c6(b)}else c4([a]),c6(a);return}if(d){dG.has(a)?c4(c3.filter(b=>b!==a)):c4([...c3,a]),c6(a);return}c4([a]),c6(a),d5(a)},[c5,dS,d5,c3,dG]),d7=(0,f.useCallback)(a=>{dG.has(a)||(c4([a]),c6(a))},[dG]),d8=(0,f.useCallback)(async(b,c)=>{dh(!1),dd(!1),db({isOpen:!0,executionId:null,scriptName:b.name,branchRef:c,output:"",status:"starting",error:null});try{let d=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:a,branchRef:c,scriptContent:b.content})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to start script execution");let f=[];e.previousBranch&&e.checkedOutBranch&&e.previousBranch!==e.checkedOutBranch&&f.push(`[info] Checked out ${e.checkedOutBranch} (from ${e.previousBranch})`),db(a=>({...a,executionId:e.executionId,output:[f.join("\n"),e.output].filter(Boolean).join("\n"),status:e.status,error:null}))}catch(a){db(b=>({...b,status:"failed",error:a.message,output:b.output?`${b.output}
|
|
2
|
-
[error] ${a.message}`:`[error] ${a.message}`}))}},[a]),
|
|
3
|
-
[error] ${a.message}`})),
|
|
1
|
+
"use strict";exports.id=739,exports.ids=[739],exports.modules={1739:(a,b,c)=>{c.d(b,{u:()=>F});var d=c(8249),e=c(4626),f=c(5023),g=c(7484);function h(a){let b=0x811c9dc5;for(let c=0;c<a.length;c++)b^=a.charCodeAt(c),b=Math.imul(b,0x1000193);return b>>>0}var i=c(4490);function j({children:a,items:b,containerClassName:c="w-full"}){let[e,f]=(0,g.useState)(!1),[h,j]=(0,g.useState)({x:0,y:0}),k=(0,g.useRef)(null),l=(0,g.useRef)(null),m=(a,b)=>{let c=!!a.children?.length;return(0,d.jsxs)("li",{className:(0,i.cn)(c&&"relative group/submenu"),children:[(0,d.jsxs)("a",{onClick:b=>{b.stopPropagation(),a.disabled||c||(a.onClick?.(),f(!1))},className:(0,i.cn)("whitespace-nowrap",a.danger&&"text-error",a.disabled&&"opacity-40 pointer-events-none",c&&"flex items-center justify-between gap-3"),children:[(0,d.jsx)("span",{children:a.labelNode??a.label}),c&&(0,d.jsx)("i",{className:"iconoir-nav-arrow-right text-[12px]","aria-hidden":"true"})]}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"hidden group-hover/submenu:block absolute left-full top-0 h-full w-3"}),(0,d.jsx)("ul",{className:"hidden group-hover/submenu:block absolute left-[calc(100%-1px)] top-0 menu !m-0 p-2 shadow-lg bg-base-100 rounded-box border border-base-200 min-w-[220px] z-[10000] [&:before]:hidden",children:a.children.map((a,c)=>m(a,`${b}-${c}`))})]})]},b)};return(0,d.jsxs)("div",{ref:l,className:c,onContextMenu:a=>{a.preventDefault(),a.stopPropagation(),j({x:a.clientX,y:a.clientY}),f(!0)},children:[a,e&&(0,d.jsx)("ul",{ref:k,className:"fixed z-[9999] menu p-2 shadow-lg bg-base-100 rounded-box border border-base-200",style:{left:`${h.x}px`,top:`${h.y}px`},children:b.map((a,b)=>m(a,`menu-${b}`))})]})}function k({text:a,searchQuery:b}){if(!b||!a)return(0,d.jsx)(d.Fragment,{children:a});let c=b.toLowerCase(),e=a.toLowerCase(),f=[],g=0,h=e.indexOf(c);for(;-1!==h;)h>g&&f.push({text:a.slice(g,h),highlighted:!1}),f.push({text:a.slice(h,h+c.length),highlighted:!0}),g=h+c.length,h=e.indexOf(c,g);return(g<a.length&&f.push({text:a.slice(g),highlighted:!1}),0===f.length)?(0,d.jsx)(d.Fragment,{children:a}):(0,d.jsx)(d.Fragment,{children:f.map((a,b)=>a.highlighted?(0,d.jsx)("mark",{className:"bg-warning text-warning-content rounded-sm px-0.5",children:a.text},b):(0,d.jsx)("span",{children:a.text},b))})}let l=(0,g.forwardRef)(function({commits:a,onSelectCommit:b,onResetToCommit:c,onRevertCommit:e,onCreateTag:f,onCherryPickCommit:l,onCherryPickSelectedCommits:m,onRewordCommit:n,selectedHash:o,selectedHashes:p,onEndReached:q,isLoadingMore:r,currentBranch:s,hiddenBranches:t,localBranches:u=[],trackingInfo:v,getBranchTagContextMenuItems:w},x){let y=(0,g.useCallback)(a=>a.startsWith("refs/heads/")?a.slice(11):a.startsWith("refs/remotes/")?a.slice(13):a.startsWith("remotes/")?a.slice(8):a,[]),z=(0,g.useCallback)(a=>a.startsWith("tag:")?a.replace(/^tag:\s*/,"").trim():a,[]),A=(0,g.useMemo)(()=>(function(a,b={}){let c=[],d=new Set(b.localBranches??[]),e=[],f=[],g=[];function i(){for(let a=0;a<e.length;a++)if(null===e[a])return a;return e.length}function j(a){let b,c=g[a],d=c?(b=h(c),`hsl(${b%360} 82% 52%)`):f[a]??`hsl(${47*a%360} 78% 56%)`;return f[a]=d,d}return a.forEach((a,b)=>{var h;let k=e.indexOf(a.hash);for(-1===k&&(k=i());e.length<=k;)e.push(null),g.push(null),f.push(void 0);let l=function(a,b){if(0===a.length)return null;let c=a.find(a=>b.has(a));return c||a[0]}((h=a.refs)?h.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(a=>a.trim()).filter(Boolean).map(a=>a.replace(/^HEAD\s*->\s*/,"").trim()).map(a=>a.startsWith("refs/heads/")?a.slice(11):a.startsWith("refs/remotes/")?a.slice(13):a.startsWith("remotes/")?a.slice(8):a).filter(a=>!a.startsWith("tag:")).filter(a=>"HEAD"!==a).filter(a=>!/\/HEAD$/.test(a)):[],d);if(l){let a=function(a,b){let c,d;if(b.has(a))return a;let e=-1===(d=(c=a.startsWith("remotes/")?a.slice(8):a).indexOf("/"))?null:c.slice(d+1);return e&&b.has(e)?e:a}(l,d);(function(a,b,c){return!b||c.has(a)&&!c.has(b)})(a,g[k],d)&&(g[k]=a)}let m=j(k),n={...a,x:k,y:b,color:m,paths:[],isMerge:a.parents.length>1};for(let a=0;a<e.length;a++)a!==k&&null!==e[a]&&n.paths.push({x1:a,y1:b,x2:a,y2:b+1,color:j(a),type:"straight"});e[k]=null;let o=a.parents;if(o.length>0){let a=o[0],c=e.indexOf(a);-1!==c?n.paths.push({x1:k,y1:b,x2:c,y2:b+1,color:m,type:"merge"}):(e[k]=a,n.paths.push({x1:k,y1:b,x2:k,y2:b+1,color:m,type:"straight"}));for(let a=1;a<o.length;a++){let c=o[a],d=e.indexOf(c);if(-1!==d)n.paths.push({x1:k,y1:b,x2:d,y2:b+1,color:j(d),type:"fork"});else{let a=i();for(;e.length<=a;)e.push(null),g.push(null),f.push(void 0);e[a]=c,n.paths.push({x1:k,y1:b,x2:a,y2:b+1,color:j(a),type:"fork"})}}}null===e[k]&&(g[k]=null,f[k]=void 0),c.push(n)}),c})(a,{localBranches:u}),[a,u]),B=(0,g.useRef)(null),C=(0,g.useRef)(null),[D,E]=(0,g.useState)(!1),[F,G]=(0,g.useState)("");(0,g.useEffect)(()=>{let a=a=>{(a.metaKey||a.ctrlKey)&&"f"===a.key&&(a.preventDefault(),E(!0),setTimeout(()=>C.current?.focus(),0)),"Escape"===a.key&&D&&(E(!1),G(""))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[D]);let H=(0,g.useCallback)(()=>{E(!1),G("")},[]);if((0,g.useImperativeHandle)(x,()=>({scrollToCommit:a=>{if(!A||0===A.length)return!1;let b=A.findIndex(b=>b.hash===a);if(-1===b)return!1;if(B.current){let a=24*b-B.current.clientHeight/2+12;B.current.scrollTop=Math.max(0,a)}return!0}}),[A]),!A||0===A.length)return null;let I=(Math.max(...A.map(a=>a.x),0)+1)*12+20,J=24*A.length;return(0,d.jsxs)("div",{className:"flex flex-col h-full bg-base-100 overflow-hidden font-mono text-sm select-none",children:[D&&(0,d.jsxs)("div",{className:"sticky top-0 z-30 bg-base-100 border-b border-base-300 px-2 py-2 flex items-center gap-2",children:[(0,d.jsx)("span",{className:"opacity-50",children:"\uD83D\uDD0D"}),(0,d.jsx)("input",{ref:C,type:"text",placeholder:"Search in commits...",value:F,onChange:a=>G(a.target.value),className:"input input-bordered input-sm flex-1 text-sm",autoFocus:!0}),(0,d.jsx)("div",{className:"tooltip tooltip-left z-50","data-tip":"Close search (Esc)",children:(0,d.jsx)("button",{onClick:H,className:"btn btn-ghost btn-sm btn-square",children:"✖️"})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto h-full max-w-full px-2",onScroll:a=>{let{scrollTop:b,clientHeight:c,scrollHeight:d}=a.currentTarget;d-b-c<100&&q?.()},ref:B,children:(0,d.jsxs)("div",{className:"relative min-w-full",style:{height:J},children:[(0,d.jsxs)("svg",{width:I,height:J,className:"absolute top-0 left-0 pointer-events-none z-10",children:[A.map(a=>(0,d.jsx)("g",{children:a.paths.map((a,b)=>{let c=12*a.x1+6,e=24*a.y1+12,f=12*a.x2+6,g=24*a.y2+12,h="";if("straight"===a.type)h=`M ${c} ${e} L ${f} ${g}`;else{let a=e+12,b=g-12;h=`M ${c} ${e} C ${c} ${a}, ${f} ${b}, ${f} ${g}`}return(0,d.jsx)("path",{d:h,stroke:a.color,strokeWidth:2,fill:"none",strokeLinecap:"round"},b)})},a.hash)),A.map(a=>(0,d.jsx)("circle",{cx:12*a.x+6,cy:24*a.y+12,r:3,fill:a.color,stroke:a.color,strokeWidth:2},`dot-${a.hash}`))]}),(0,d.jsxs)("div",{style:{width:"100%"},children:[A.map(a=>{let g=p?p.has(a.hash):o===a.hash,q=p?.size??+!!o,r=[{label:"Reset to here",onClick:()=>c?.(a.hash)}];if(e&&r.push({label:"Revert commit",onClick:()=>e(a.hash,a.message)}),f&&r.push({label:"Create tag",onClick:()=>f(a.hash)}),l&&r.push({label:"Cherry-pick commit",onClick:()=>l(a.hash,a.message)}),m&&q>1&&g&&r.push({label:`Cherry-pick ${q} selected commits`,onClick:m}),n&&u&&u.length>0){let b=a.refs?a.refs.replace(/[()]/g,"").split(",").map(a=>a.trim()):[],c=null;for(let a of b){let b=a.replace(/^HEAD\s*->\s*/,"");if(u.includes(b)&&(c=b,s&&b===s))break}c&&r.push({label:"Reword commit",onClick:()=>n(a.hash,a.message,a.body??"",c)})}let x=(()=>{if(!a.refs)return[];let b=a.refs.replace(/^\s*\((.*)\)\s*$/,"$1").split(",").map(a=>{let b=a.startsWith("HEAD -> "),c=y(a.replace(/^HEAD\s*->\s*/,"").trim());return{raw:a,name:c,isHead:b}}),c=[],d=new Set,e=a=>t&&(t.has(a)||t.has(`remotes/${a}`));return b.forEach((a,f)=>{if(!d.has(f)&&u.includes(a.name)&&!e(a.name)){let e=v?.[a.name];if(e&&e.upstream){let g=y(e.upstream.trim()),h=new Set([g,y(`remotes/${g}`),y(`refs/remotes/${g}`)]),i=b.findIndex((a,b)=>b!==f&&!d.has(b)&&h.has(a.name));if(-1!==i){let e=b[i],h=g.split("/")[0];c.push({displayName:`${a.name} (${h})`,primaryRef:a.name,secondaryRef:e.name,isHead:a.isHead}),d.add(f),d.add(i);return}}}}),b.forEach((a,b)=>{!d.has(b)&&(e(a.name)||c.push({displayName:z(a.name),primaryRef:a.name,isHead:a.isHead}))}),c})();return(0,d.jsx)(j,{items:r,children:(0,d.jsxs)("div",{className:(0,i.cn)("flex items-center hover:bg-base-200 border-b border-base-200 last:border-0 cursor-pointer transition-colors text-xs",g&&"bg-primary/10"),style:{height:24},onClick:c=>b?.(a.hash,{isMultiSelect:c.metaKey||c.ctrlKey,isRangeSelect:c.shiftKey}),children:[(0,d.jsx)("div",{style:{width:I,flexShrink:0}}),(0,d.jsxs)("div",{className:"flex flex-1 gap-4 overflow-hidden pr-4 items-center",children:[(0,d.jsxs)("div",{className:"flex-1 truncate flex items-center gap-2",children:[x.map((a,b)=>{let c=s&&(a.primaryRef===s||a.isHead&&a.primaryRef===s),e=a.primaryRef.startsWith("tag:")?{textColor:"#374151",backgroundColor:"#e5e7eb"}:function(a){let b,c,d,e,f,g,i,j,k,l=h(a),m=l%360,n=72+(l>>>9)%20,o=84+(l>>>17)%8,p=1.05/((k=function({r:a,g:b,b:c}){let d=a=>{let b=a/255;return b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4)};return .2126*d(a)+.7152*d(b)+.0722*d(c)}((c=n/100*(1-Math.abs(2*(b=o/100)-1)),e=c*(1-Math.abs((d=m/60)%2-1)),f=0,g=0,i=0,d>=0&&d<1?(f=c,g=e):d>=1&&d<2?(f=e,g=c):d>=2&&d<3?(g=c,i=e):d>=3&&d<4?(g=e,i=c):d>=4&&d<5?(f=e,i=c):(f=c,i=e),{r:Math.round((f+(j=b-c/2))*255),g:Math.round((g+j)*255),b:Math.round((i+j)*255)})))+.05)>=(k+.05)/.05?"#ffffff":"#111827";return{backgroundColor:`hsl(${m} ${n}% ${o}%)`,textColor:p}}(a.primaryRef),f=(0,d.jsx)("span",{className:(0,i.cn)("text-[10px] px-1.5 rounded-full whitespace-nowrap shrink-0",c&&"font-bold"),style:{color:e.textColor,backgroundColor:e.backgroundColor},title:a.displayName,children:(0,d.jsx)(k,{text:a.displayName,searchQuery:F})}),g=w?.(a.primaryRef)||[];return 0===g.length?(0,d.jsx)("span",{className:"shrink-0",children:f},b):(0,d.jsx)(j,{items:g,containerClassName:"inline-flex shrink-0",children:f},b)}),(0,d.jsx)("span",{className:(0,i.cn)("truncate min-w-0 max-w-[600px]",g?"font-semibold":""),title:a.message,children:(0,d.jsx)(k,{text:a.message,searchQuery:F})})]}),(0,d.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:(0,d.jsx)(k,{text:a.author_name,searchQuery:F})}),(0,d.jsx)("div",{className:"w-20 truncate opacity-50 font-mono text-right",children:(0,d.jsx)(k,{text:a.hash.substring(0,7),searchQuery:F})}),(0,d.jsx)("div",{className:"w-32 truncate opacity-70 text-right",children:new Date(a.date).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]})]})},a.hash)}),r&&(0,d.jsxs)("div",{className:"flex items-center justify-center py-8 border-b border-base-300",children:[(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"}),(0,d.jsx)("span",{className:"ml-2 text-sm opacity-70",children:"Loading more commits..."})]})]})]})})]})});var m=c(8696),n=c(7532),o=c(5048),p=c(8550),q=c(3381);async function r(a){try{return await navigator.clipboard.writeText(a),!0}catch{let b=document.createElement("textarea");b.value=a,b.style.position="fixed",b.style.left="-9999px",document.body.appendChild(b),b.select();try{return document.execCommand("copy"),!0}catch{return!1}finally{document.body.removeChild(b)}}}let s={isOpen:!1,executionId:null,scriptName:"",branchRef:"",output:"",status:"idle",error:null};function t({status:a}){switch(a){case"A":return(0,d.jsx)("i",{className:"iconoir-plus-circle text-[16px] text-success","aria-hidden":"true"});case"D":return(0,d.jsx)("i",{className:"iconoir-minus-circle text-[16px] text-error","aria-hidden":"true"});case"M":return(0,d.jsx)("i",{className:"iconoir-edit-pencil text-[16px] text-warning","aria-hidden":"true"});default:return(0,d.jsx)("i",{className:"iconoir-page text-[16px] opacity-50","aria-hidden":"true"})}}function u({node:a,selectedFile:b,expandedFolders:c,onToggleFolder:e,onSelectFile:f,depth:g=0}){let h=Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0,d=b.children.size>0;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)});return(0,d.jsx)(d.Fragment,{children:h.map(a=>{if(a.children.size>0){let h=c.has(a.path);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors opacity-80",style:{paddingLeft:`${12*g+8}px`},onClick:()=>e(a.path),title:a.path,children:[(0,d.jsx)("span",{className:"text-[10px] opacity-70",children:h?"▼":"▶"}),(0,d.jsx)("i",{className:"iconoir-folder text-[14px] opacity-70","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate flex-1",children:a.name})]}),h&&(0,d.jsx)(u,{node:a,selectedFile:b,expandedFolders:c,onToggleFolder:e,onSelectFile:f,depth:g+1})]},a.path)}if(!a.file)return null;let h=a.file;return(0,d.jsxs)("div",{className:(0,i.cn)("flex items-center gap-2 px-2 py-1.5 text-xs rounded cursor-pointer hover:bg-base-200 transition-colors",b===h.path&&"bg-base-200 font-medium"),style:{paddingLeft:`${12*g+8}px`},onClick:()=>f(h.path),title:h.path,children:[(0,d.jsx)(t,{status:h.status}),(0,d.jsx)("span",{className:"truncate flex-1 font-mono",children:a.name})]},a.path)})})}function v({repoPath:a,commitHash:b,filePath:c,splitView:f}){let{data:h,isLoading:j}=(0,e.st)(a,b,c),{resolvedTheme:k}=(0,m.D)(),[l,p]=(0,g.useState)(!1);if(j)return(0,d.jsx)("div",{className:"flex items-center justify-center p-8",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})});if(!h)return(0,d.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"No diff available"});if((0,i.u)(c))return(0,d.jsx)(o.K,{filePath:c,imageDiff:h.imageDiff});if((0,i.kO)(c,h.left,h.right))return(0,d.jsx)("div",{className:"flex items-center justify-center p-8 opacity-50",children:"Binary file - diff not available"});let q=h.diff||"",r=q.length,s=(0,i.tq)(q);return(r>102400||s>3e3)&&!l?(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center p-8",children:[(0,d.jsx)("i",{className:"iconoir-warning-triangle text-[32px] text-warning","aria-hidden":"true"}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Large Diff Detected"}),(0,d.jsxs)("p",{className:"opacity-70",children:["This diff is large (",Math.round(r/1024),"KB, ~",s," changed lines) and may freeze your browser if rendered."]})]}),(0,d.jsx)("button",{className:"btn btn-outline",onClick:()=>p(!0),children:"Show Diff Anyway"})]}):(0,d.jsx)("div",{className:"overflow-auto h-full",children:(0,d.jsx)(n.O,{oldValue:h.left||"",newValue:h.right||"",splitView:f,useDarkTheme:"dark"===k})})}function w({repoPath:a,commitHash:b}){let{data:c,isLoading:f}=(0,e.gg)(a,b),[h,j]=(0,g.useState)(null),[k,l]=(0,g.useState)(!1),[m,n]=(0,g.useState)({}),o=(0,g.useMemo)(()=>(function(a){let b={name:"",path:"",children:new Map};for(let c of a){let a=c.path.split("/").filter(Boolean),d=b,e="";for(let b=0;b<a.length;b++){let f=a[b];e=e?`${e}/${f}`:f,d.children.has(f)||d.children.set(f,{name:f,path:e,children:new Map}),d=d.children.get(f),b===a.length-1&&(d.file=c)}}return b})(c?.files??[]),[c?.files]),q=(0,g.useMemo)(()=>(function a(b){let c=[];return Array.from(b.children.values()).forEach(b=>{b.children.size>0&&(c.push(b.path),c.push(...a(b)))}),c})(o),[o]),r=(0,g.useMemo)(()=>m[b]??new Set,[m,b]),[s,t]=(0,g.useState)(()=>!0);(0,p.v)(k,()=>l(!1));let w=(0,g.useMemo)(()=>{let a=new Set;return q.forEach(b=>{r.has(b)||a.add(b)}),h&&(function(a){let b=a.split("/").filter(Boolean),c=[];for(let a=1;a<b.length;a++)c.push(b.slice(0,a).join("/"));return c})(h).forEach(b=>a.add(b)),a},[q,r,h]),x=(0,g.useCallback)(a=>{n(c=>{let d=new Set(c[b]??new Set);return d.has(a)?d.delete(a):d.add(a),{...c,[b]:d}})},[b]);return f?(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):c&&0!==c.files.length?(0,d.jsxs)("div",{className:(0,i.cn)("flex h-full",k&&"fixed inset-0 z-[80] h-auto bg-base-100 shadow-2xl"),children:[(0,d.jsxs)("div",{className:"w-64 border-r border-base-300 flex flex-col bg-base-200/30 shrink-0",children:[(0,d.jsxs)("div",{className:"px-3 py-2 text-xs font-bold opacity-70 border-b border-base-300 bg-base-100",children:[c.files.length," file",1!==c.files.length?"s":""," changed"]}),(0,d.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:(0,d.jsx)("div",{className:"p-1",children:(0,d.jsx)(u,{node:o,selectedFile:h,expandedFolders:w,onToggleFolder:x,onSelectFile:j})})})]}),(0,d.jsx)("div",{className:"flex-1 overflow-hidden",children:h?(0,d.jsxs)("div",{className:"h-full flex flex-col",children:[(0,d.jsxs)("div",{className:"px-4 py-2 text-xs font-mono opacity-70 border-b border-base-300 bg-base-100 shrink-0 truncate flex items-center justify-between",children:[(0,d.jsx)("span",{className:"truncate",children:h}),(0,d.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-4",children:[(0,d.jsx)("label",{htmlFor:"commit-diff-split-view",className:"text-[10px] uppercase tracking-wider font-bold cursor-pointer opacity-70",children:"Split View"}),(0,d.jsx)("input",{type:"checkbox",id:"commit-diff-split-view",checked:s,onChange:a=>t(a.target.checked),className:"toggle toggle-xs toggle-primary"}),(0,d.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs btn-square",onClick:()=>l(a=>!a),"aria-label":k?"Exit full-page diff view":"Expand diff viewer to full page",title:k?"Exit full-page diff view":"Expand diff viewer to full page",children:(0,d.jsx)("i",{className:(0,i.cn)(k?"iconoir-collapse":"iconoir-maximize","text-[14px]"),"aria-hidden":"true"})})]})]}),(0,d.jsx)("div",{className:"flex-1 overflow-auto diff-viewer-wrapper",children:(0,d.jsx)(v,{repoPath:a,commitHash:b,filePath:h,splitView:s})})]}):(0,d.jsx)("div",{className:"flex items-center justify-center h-full opacity-70 text-sm",children:"Select a file to view changes"})})]}):(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-50",children:"No changes in this commit"})}function x(a,b=""){let c={name:"",children:new Map};for(let d of a){let a=d.split("/"),e=c;for(let c=0;c<a.length;c++){let f=a[c];e.children.has(f)||e.children.set(f,{name:f,children:new Map}),e=e.children.get(f),c===a.length-1&&(e.fullPath=b?`${b}/${d}`:d)}}return c}function y(a,b,c){if(b[a])return b[a];let d=a.split("/");for(let a=d.length-1;a>0;a--){let c=d.slice(0,a).join("/");if(b[c])return b[c]}if(c){let a=c.split("/");for(let c=a.length;c>0;c--){let d=a.slice(0,c).join("/");if(b[d])return b[d]}}return null}function z({name:a,groupPath:b,icon:c,isExpanded:e,onToggle:f,visibilityMap:g,onToggleVisibility:h,depth:j=0}){let k=g[b],l=b.includes("/")?b.split("/").slice(0,-1).join("/"):void 0,m=l?g[l]:null,n=k||m,o=!k&&null!==m;return(0,d.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors font-medium"),style:{paddingLeft:`${12*j+8}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",onClick:f,children:[(0,d.jsx)("span",{className:"text-xs opacity-70",children:e?"▼":"▶"}),(0,d.jsx)("span",{className:"shrink-0",children:c}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",children:a})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(A,{type:"visible",isActive:"visible"===k||o&&"visible"===n,isInherited:o&&"visible"===n,onClick:a=>{a.stopPropagation(),h(b,"visible")},showOnHover:"visible"===k||o&&"visible"===n}),(0,d.jsx)(A,{type:"hidden",isActive:"hidden"===k||o&&"hidden"===n,isInherited:o&&"hidden"===n,onClick:a=>{a.stopPropagation(),h(b,"hidden")},showOnHover:"hidden"===k||o&&"hidden"===n})]})]})}function A({type:a,isActive:b,isInherited:c,onClick:e,showOnHover:f}){return(0,d.jsx)("button",{className:(0,i.cn)("p-0.5 rounded hover:bg-base-300 transition-colors shrink-0 cursor-pointer text-xs",b&&"bg-primary/10",c&&"opacity-50",!b&&!f&&"opacity-0 group-hover:opacity-100"),onClick:e,title:"visible"===a?b?"Remove visible filter":"Show only this branch":b?"Remove hide filter":"Hide this branch",children:"visible"===a?(0,d.jsx)("i",{className:"iconoir-eye text-[14px]","aria-hidden":"true"}):(0,d.jsx)("i",{className:"iconoir-eye-closed text-[14px]","aria-hidden":"true"})})}function B(a){return Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0&&!a.fullPath,d=b.children.size>0&&!b.fullPath;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)})}function C(a,b,c=""){let d=[];for(let e of B(a)){if(void 0!==e.fullPath){d.push(e.fullPath);continue}let a=c?`${c}/${e.name}`:e.name;b.has(a)&&d.push(...C(e,b,a))}return d}function D(a){let b=[];for(let c of B(a)){if(c.fullPath){b.push(c.fullPath);continue}b.push(...D(c))}return b}function E({node:a,currentBranch:b,expandedFolders:c,onToggleFolder:e,onCheckout:f,onCheckoutToLocal:g,onCreateBranch:h,onDeleteBranch:k,onRenameBranch:l,onRenameRemoteBranch:m,onRebase:n,onMerge:o,onPushToRemote:p,onPullFromRemote:q,getBranchContextMenuItems:r,onBranchClick:s,onBranchContextMenu:t,onDeleteBranchGroup:u,selectedBranches:v,visibilityMap:w,onToggleVisibility:x,parentPath:z="",depth:B=0,groupPath:C,isRemote:F=!1,trackingInfo:G}){let H=Array.from(a.children.values()).sort((a,b)=>{let c=a.children.size>0&&!a.fullPath,d=b.children.size>0&&!b.fullPath;return c&&!d?-1:!c&&d?1:a.name.localeCompare(b.name)});return(0,d.jsx)(d.Fragment,{children:H.map(a=>{let H=void 0!==a.fullPath,I=a.children.size>0&&!H,J=a.fullPath||(z?`${z}/${a.name}`:a.name),K=c.has(J),L=H&&a.fullPath===b,M=w[J],N=y(J,w,C),O=!M&&null!==N;if(I){let y=D(a).filter(a=>a!==b);return(0,d.jsxs)("div",{children:[(0,d.jsx)(j,{items:[{label:"Delete",onClick:()=>u(y),danger:!0,disabled:0===y.length}],children:(0,d.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-1 px-2 py-1.5 text-sm rounded-md cursor-pointer hover:bg-base-200 transition-colors opacity-70 select-none"),style:{paddingLeft:`${12*B+8}px`},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 flex-1 min-w-0",onClick:()=>e(J),children:[(0,d.jsx)("span",{className:"text-xs opacity-70",children:K?"▼":"▶"}),(0,d.jsx)("i",{className:"iconoir-folder text-[16px] shrink-0","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",children:a.name})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(A,{type:"visible",isActive:"visible"===M||O&&"visible"===N,isInherited:O&&"visible"===N,onClick:a=>{a.stopPropagation(),x(J,"visible")},showOnHover:"visible"===M||O&&"visible"===N}),(0,d.jsx)(A,{type:"hidden",isActive:"hidden"===M||O&&"hidden"===N,isInherited:O&&"hidden"===N,onClick:a=>{a.stopPropagation(),x(J,"hidden")},showOnHover:"hidden"===M||O&&"hidden"===N})]})]})}),K&&(0,d.jsx)(E,{node:a,currentBranch:b,expandedFolders:c,onToggleFolder:e,onCheckout:f,onCheckoutToLocal:g,onCreateBranch:h,onDeleteBranch:k,onRenameBranch:l,onRenameRemoteBranch:m,onRebase:n,onMerge:o,onPushToRemote:p,onPullFromRemote:q,getBranchContextMenuItems:r,onBranchClick:s,onBranchContextMenu:t,onDeleteBranchGroup:u,selectedBranches:v,visibilityMap:w,onToggleVisibility:x,parentPath:J,depth:B+1,groupPath:C,isRemote:F,trackingInfo:G})]},J)}let P=!F&&a.fullPath?G?.[a.fullPath]:void 0,Q=P&&(P.ahead>0||P.behind>0),R=r({branchRef:a.fullPath,branchLeafName:a.name,currentBranch:b,isRemote:F,selectedBranchRefs:v.has(a.fullPath)?Array.from(v):[a.fullPath]}),S=v.has(a.fullPath);return(0,d.jsx)(j,{items:R,children:(0,d.jsxs)("div",{className:(0,i.cn)("group flex items-center gap-2 px-2 py-1.5 text-sm rounded-md cursor-pointer transition-colors select-none",!S&&"hover:bg-base-200",S&&"bg-primary/10 hover:bg-primary/20",L&&"bg-base-200 font-medium text-primary"),style:{paddingLeft:`${12*B+8}px`},onContextMenu:()=>t?.(a.fullPath),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",onClick:b=>s?.(a.fullPath,{isMultiSelect:b.metaKey||b.ctrlKey,isRangeSelect:b.shiftKey}),onDoubleClick:()=>!L&&f(a.fullPath),children:[L?(0,d.jsx)("span",{className:"w-3 h-3 flex items-center justify-center shrink-0",children:(0,d.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary"})}):F?(0,d.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50 shrink-0","aria-hidden":"true"}):(0,d.jsx)("i",{className:"iconoir-git-branch text-[14px] opacity-50 shrink-0","aria-hidden":"true"}),(0,d.jsx)("span",{className:"truncate min-w-0 flex-1",title:a.fullPath,children:a.name}),Q&&(0,d.jsxs)("span",{className:"flex items-center gap-1 text-xs opacity-70 shrink-0",title:`${P.ahead} ahead, ${P.behind} behind ${P.upstream}`,children:[P.ahead>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,d.jsx)("i",{className:"iconoir-arrow-up text-[12px]","aria-hidden":"true"}),(0,d.jsx)("span",{children:P.ahead})]}),P.behind>0&&(0,d.jsxs)("span",{className:"flex items-center gap-0.5 text-xs",children:[(0,d.jsx)("i",{className:"iconoir-arrow-down text-[12px]","aria-hidden":"true"}),(0,d.jsx)("span",{children:P.behind})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5 ml-auto",children:[(0,d.jsx)(A,{type:"visible",isActive:"visible"===M||O&&"visible"===N,isInherited:O&&"visible"===N,onClick:a=>{a.stopPropagation(),x(J,"visible")},showOnHover:"visible"===M||O&&"visible"===N}),(0,d.jsx)(A,{type:"hidden",isActive:"hidden"===M||O&&"hidden"===N,isInherited:O&&"hidden"===N,onClick:a=>{a.stopPropagation(),x(J,"hidden")},showOnHover:"hidden"===M||O&&"hidden"===N})]})]})},a.fullPath)})})}function F({repoPath:a}){(0,f.jE)();let{data:b}=(0,e.t0)();(0,e.Y5)();let[c,h]=(0,g.useState)(100),{data:k,isLoading:m,isError:n,error:o,refetch:t,isFetching:u}=(0,e._X)(a,c),{data:v,isLoading:A}=(0,e._6)(a),{data:B}=(0,e.en)(a),[F,G]=(0,g.useState)(null),[H,I]=(0,g.useState)([]),[J,K]=(0,g.useState)(null),L=(0,g.useCallback)(a=>{G(a),I(a?[a]:[]),K(a)},[]),{mutateAsync:M}=(0,e.a3)(),[N,O]=(0,g.useState)(!1),[P,Q]=(0,g.useState)(""),[R,S]=(0,g.useState)(null),[T,U]=(0,g.useState)(!1),[V,W]=(0,g.useState)(!1),[X,Y]=(0,g.useState)(null),[Z,$]=(0,g.useState)(""),[_,aa]=(0,g.useState)(!1),[ab,ac]=(0,g.useState)(!1),[ad,ae]=(0,g.useState)(!1),[af,ag]=(0,g.useState)([]),[ah,ai]=(0,g.useState)(!1),[aj,ak]=(0,g.useState)(!1),[al,am]=(0,g.useState)(!1),[an,ao]=(0,g.useState)(null),[ap,aq]=(0,g.useState)(!1),[ar,as]=(0,g.useState)(!1),[at,au]=(0,g.useState)(!1),[av,aw]=(0,g.useState)([]),[ax,ay]=(0,g.useState)(!1),[az,aA]=(0,g.useState)(!1),[aB,aC]=(0,g.useState)(!1),[aD,aE]=(0,g.useState)(!1),[aF,aG]=(0,g.useState)(null),[aH,aI]=(0,g.useState)(null),[aJ,aK]=(0,g.useState)(""),[aL,aM]=(0,g.useState)(!1),[aN,aO]=(0,g.useState)(!1),[aP,aQ]=(0,g.useState)(!1),[aR,aS]=(0,g.useState)(null),[aT,aU]=(0,g.useState)(""),[aV,aW]=(0,g.useState)(!1),[aX,aY]=(0,g.useState)(!1),[aZ,a$]=(0,g.useState)(null),[a_,a0]=(0,g.useState)(!1),[a1,a2]=(0,g.useState)(!1),[a3,a4]=(0,g.useState)("origin"),[a5,a6]=(0,g.useState)(""),[a7,a8]=(0,g.useState)(!1),[a9,ba]=(0,g.useState)(!1),[bb,bc]=(0,g.useState)(null),[bd,be]=(0,g.useState)(null),[bf,bg]=(0,g.useState)(!0),[bh,bi]=(0,g.useState)(!1),[bj,bk]=(0,g.useState)("checking"),bl=(0,g.useCallback)(()=>{ba(!1),bc(null),be(null),bk("checking")},[]),[bm,bn]=(0,g.useState)(!1),[bo,bp]=(0,g.useState)(null),[bq,br]=(0,g.useState)(null),[bs,bt]=(0,g.useState)(!1),[bu,bv]=(0,g.useState)(!1),[bw,bx]=(0,g.useState)(!1),[by,bz]=(0,g.useState)(""),[bA,bB]=(0,g.useState)(!1),[bC,bD]=(0,g.useState)("checking"),bE=(0,g.useCallback)(()=>{bn(!1),bp(null),br(null),bD("checking")},[]),[bF,bG]=(0,g.useState)(!1),[bH,bI]=(0,g.useState)(null),[bJ,bK]=(0,g.useState)([]),[bL,bM]=(0,g.useState)(""),[bN,bO]=(0,g.useState)([]),[bP,bQ]=(0,g.useState)(""),[bR,bS]=(0,g.useState)(null),[bT,bU]=(0,g.useState)(!1),[bV,bW]=(0,g.useState)(!1),[bX,bY]=(0,g.useState)(!0),[bZ,b$]=(0,g.useState)(!1),[b_,b0]=(0,g.useState)(""),[b1,b2]=(0,g.useState)(!1),[b3,b4]=(0,g.useState)(null),[b5,b6]=(0,g.useState)(!1),[b7,b8]=(0,g.useState)(!1),[b9,ca]=(0,g.useState)(!1),[cb,cc]=(0,g.useState)(null),[cd,ce]=(0,g.useState)([]),[cf,cg]=(0,g.useState)(""),[ch,ci]=(0,g.useState)([]),[cj,ck]=(0,g.useState)(""),[cl,cm]=(0,g.useState)(null),[cn,co]=(0,g.useState)(!0),[cp,cq]=(0,g.useState)(!1),[cr,cs]=(0,g.useState)(null),[ct,cu]=(0,g.useState)(!1),[cv,cw]=(0,g.useState)(!1),[cx,cy]=(0,g.useState)(!1),[cz,cA]=(0,g.useState)(!1),[cB,cC]=(0,g.useState)(null),[cD,cE]=(0,g.useState)(""),[cF,cG]=(0,g.useState)(!1),[cH,cI]=(0,g.useState)(!1),[cJ,cK]=(0,g.useState)(null),[cL,cM]=(0,g.useState)(!1),[cN,cO]=(0,g.useState)(!1),[cP,cQ]=(0,g.useState)(null),[cR,cS]=(0,g.useState)(!1),[cT,cU]=(0,g.useState)(!1),[cV,cW]=(0,g.useState)(null),[cX,cY]=(0,g.useState)(""),[cZ,c$]=(0,g.useState)(""),[c_,c0]=(0,g.useState)(!1),c1=(0,g.useRef)(null),[c2,c3]=(0,g.useState)(null),[c4,c5]=(0,g.useState)([]),[c6,c7]=(0,g.useState)(null),[c8,c9]=(0,g.useState)(!1),da=(0,g.useRef)(null),[db,dc]=(0,g.useState)(s),[dd,de]=(0,g.useState)(!1),[df,dg]=(0,g.useState)(!1),[dh,di]=(0,g.useState)(!1),dj="starting"===db.status||"running"===db.status,dk="completed"===db.status||"failed"===db.status||"canceled"===db.status,dl=(0,g.useCallback)(()=>{aE(!1),aG(null),aI(null),aK(""),aM(!1)},[]),dm=(0,g.useCallback)(()=>{aQ(!1),aS(null),aU("")},[]),dn=(0,g.useCallback)(()=>{aY(!1),a$(null)},[]),dp=(0,g.useCallback)(()=>{a2(!1),a4("origin"),a6("")},[]),dq=(0,g.useCallback)(()=>{cU(!1),cW(null),cY(""),c$("")},[]),dr=(0,g.useCallback)(()=>{if(az){aA(!1),aw([]);return}if(cz)return void cA(!1);if(N){O(!1),S(null);return}if(V){W(!1),Y(null),$(""),aa(!1);return}if(b9)return void ca(!1);if(bF)return void bG(!1);if(bm)return void bE();if(a9)return void bl();if(aD)return void dl();if(aP)return void dm();if(aX)return void dn();if(a1)return void dp();if(at){au(!1),aw([]);return}if(ad){ae(!1),ag([]),ai(!1);return}if(al){am(!1),ao(null),aq(!1);return}if(cT)return void dq();if(cH)return void cI(!1);if(cN){cO(!1),cQ(null);return}c8?c9(!1):db.isOpen&&dk&&(dc(s),di(!1),de(!1))},[az,cz,N,V,b9,bF,bE,bm,bl,a9,aD,dl,aP,dm,aX,dn,a1,dp,at,ad,al,cT,dq,cH,cN,c8,db.isOpen,dk]),ds=cH||cN||cT||ad||al||az||at||aD||aP||aX||a1||a9||bm||bF||b9||N||V||cz||c8||db.isOpen;(0,p.v)(ds,dr);let[dt,du]=(0,g.useState)(300),[dv,dw]=(0,g.useState)(!1),dx=(0,g.useRef)(null),[dy,dz]=(0,g.useState)(.28),[dA,dB]=(0,g.useState)(!1),dC=(0,g.useRef)(null);(0,g.useRef)(!1);let dD=(0,g.useCallback)(a=>{a.preventDefault(),dw(!0),dx.current={startY:a.clientY,startHeight:dt}},[dt]),dE=(0,g.useCallback)(a=>{a.preventDefault(),dB(!0)},[]),dF=(0,g.useMemo)(()=>v?.branches?x(v.branches):null,[v?.branches]),dG=(0,g.useMemo)(()=>{if(!v?.remotes)return null;var a=v.remotes;let b=new Map;for(let[c,d]of Object.entries(a))b.set(c,x(d,`remotes/${c}`));return b},[v?.remotes]);(0,g.useMemo)(()=>{let a=new Set;for(let b of v?.branches??[])a.add(b);for(let[b,c]of Object.entries(v?.remotes??{}))for(let d of c)a.add(`remotes/${b}/${d}`);return a},[v?.branches,v?.remotes]);let dH=(0,g.useMemo)(()=>new Set(c4),[c4]),dI=(0,e.GK)(a),dJ=(0,e.Lp)(),dK=(0,g.useMemo)(()=>(dI?.customScripts??[]).filter(a=>"branch"===a.target&&"run-bash-script"===a.action&&a.name.trim().length>0&&a.content.trim().length>0),[dI?.customScripts]),[dL,dM]=(0,g.useState)(!0),[dN,dO]=(0,g.useState)(!0),[dP,dQ]=(0,g.useState)({}),[dR,dS]=(0,g.useState)(new Set),dT=(0,g.useMemo)(()=>{let a=[];if(dL&&dF&&a.push(...C(dF,dR)),dN&&dG)for(let[b,c]of Array.from(dG.entries())){let d=`__remotes__/${b}`;dR.has(d)&&a.push(...C(c,dR,`remotes/${b}`))}return a},[dR,dF,dL,dG,dN]);(0,g.useRef)(null);let dU=(0,g.useCallback)(b=>{dJ.mutate({path:a,updates:b})},[a,dJ]),dV=(0,g.useCallback)(()=>{let a=!dL;dM(a),dU({localGroupExpanded:a})},[dL,dU]),dW=(0,g.useCallback)(()=>{let a=!dN;dO(a),dU({remotesGroupExpanded:a})},[dN,dU]),dX=(0,g.useCallback)(a=>{dS(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),dU({expandedFolders:Array.from(c)}),c})},[dU]),dY=(0,g.useCallback)((a,b)=>{dQ(c=>{let d={...c};d[a]===b?delete d[a]:d[a]=b;let e={};return Object.entries(d).forEach(([a,b])=>{("visible"===b||"hidden"===b)&&(e[a]=b)}),dU({visibilityMap:e}),d})},[dU]),dZ=(0,g.useCallback)(()=>{dQ({}),dU({visibilityMap:{}})},[dU]),d$=(0,g.useCallback)((a,b)=>{let c=y(a,dP);if(c)return c;if(b){let b=a.split("/");if(b.length>=2&&"remotes"===b[0]){let a=b[1],c=dP[`__remotes__/${a}`];if(c)return c;let d=dP.__remotes__;if(d)return d}}else{let a=dP.__local__;if(a)return a}return null},[dP]),d_=(0,g.useMemo)(()=>{if(!k?.all||!v?.branches||!v?.branchCommits)return k?.all||[];let a=Object.values(dP).some(a=>"visible"===a),b=Object.values(dP).some(a=>"hidden"===a);if(!a&&!b)return k.all;let c=[...v.branches.map(a=>({branch:a,isRemote:!1}))];if(v.remotes)for(let[a,b]of Object.entries(v.remotes))for(let d of b)c.push({branch:`remotes/${a}/${d}`,isRemote:!0});let d=new Set,e=new Set,f=new Set;for(let{branch:a,isRemote:b}of c){let c=d$(a,b);"visible"===c?d.add(a):"hidden"===c?e.add(a):f.add(a)}let g=new Map(k.all.map(a=>[a.hash,a])),h=(a,b)=>{let c=[a];for(;c.length>0;){let a=c.pop();if(b.has(a))continue;let d=g.get(a);if(d)for(let e of(b.add(a),d.parents||[]))b.has(e)||c.push(e)}},i=new Set;for(let a of d){let b=v.branchCommits[a];b&&h(b,i)}if(a)return k.all.filter(a=>i.has(a.hash));if(b){let a=new Set;for(let b of f){let c=v.branchCommits[b];c&&h(c,a)}return k.all.filter(b=>a.has(b.hash))}return k.all},[k?.all,v?.branches,v?.branchCommits,v?.remotes,dP,d$]),d0=(0,g.useMemo)(()=>new Set(H),[H]),d1=(0,g.useMemo)(()=>d_.map(a=>a.hash),[d_]),d2=(0,g.useMemo)(()=>F?k?.all.find(a=>a.hash===F):null,[k?.all,F]),d3=(0,g.useCallback)((a,b)=>{let c=b?.isRangeSelect??!1,d=b?.isMultiSelect??!1;if(c){let b=J??F??a,c=d1.indexOf(b),d=d1.indexOf(a);if(-1!==c&&-1!==d){let[e,f]=c<d?[c,d]:[d,c];I(d1.slice(e,f+1)),G(a),K(b);return}}if(d){if(d0.has(a)){let b=H.filter(b=>b!==a);I(b),G(c=>c!==a?c:b.length>0?b[b.length-1]:null),J===a&&K(b.length>0?b[b.length-1]:null)}else I([...H,a]),G(a),K(a);return}L(a)},[d1,d0,H,F,J,L]),d4=(0,g.useMemo)(()=>d_.filter(a=>d0.has(a.hash)).reverse(),[d_,d0]),d5=(0,g.useMemo)(()=>Object.values(dP).some(a=>"visible"===a||"hidden"===a),[dP]),d6=(0,g.useMemo)(()=>{let a=new Set;if(v?.branches)for(let b of v.branches)"hidden"===d$(b,!1)&&a.add(b);if(v?.remotes)for(let[b,c]of Object.entries(v.remotes))for(let d of c){let c=`remotes/${b}/${d}`;"hidden"===d$(c,!0)&&a.add(c)}return a},[v?.branches,v?.remotes,d$]),d7=(0,g.useCallback)(a=>{if(!v?.branchCommits)return;let b=v.branchCommits[a];if(b){if(k?.all?.some(a=>a.hash===b)&&c1.current&&c1.current.scrollToCommit(b))return void L(b);c3(b),L(b)}},[v?.branchCommits,k?.all,L]),d8=(0,g.useCallback)((a,b)=>{let c=b?.isRangeSelect??!1,d=b?.isMultiSelect??!1;if(c){let b=c6??a,c=dT.indexOf(b),d=dT.indexOf(a);if(-1!==c&&-1!==d){let[e,f]=c<d?[c,d]:[d,c],g=dT.slice(e,f+1);dH.has(a)?c5(c4.filter(a=>!g.includes(a))):c5(Array.from(new Set([...c4,...g]))),c7(b)}else c5([a]),c7(a);return}if(d){dH.has(a)?c5(c4.filter(b=>b!==a)):c5([...c4,a]),c7(a);return}c5([a]),c7(a),d7(a)},[c6,dT,d7,c4,dH]),d9=(0,g.useCallback)(a=>{dH.has(a)||(c5([a]),c7(a))},[dH]),ea=(0,g.useCallback)(async(b,c)=>{di(!1),de(!1),dc({isOpen:!0,executionId:null,scriptName:b.name,branchRef:c,output:"",status:"starting",error:null});try{let d=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"start",repoPath:a,branchRef:c,scriptContent:b.content})}),e=await d.json();if(!d.ok)throw Error(e.error||"Failed to start script execution");let f=[];e.previousBranch&&e.checkedOutBranch&&e.previousBranch!==e.checkedOutBranch&&f.push(`[info] Checked out ${e.checkedOutBranch} (from ${e.previousBranch})`),dc(a=>({...a,executionId:e.executionId,output:[f.join("\n"),e.output].filter(Boolean).join("\n"),status:e.status,error:null}))}catch(a){dc(b=>({...b,status:"failed",error:a.message,output:b.output?`${b.output}
|
|
2
|
+
[error] ${a.message}`:`[error] ${a.message}`}))}},[a]),eb=(0,g.useCallback)(async()=>{if(db.executionId&&dj){de(!0);try{let a=await fetch("/api/custom-scripts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:"cancel",executionId:db.executionId})}),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to cancel script execution");dc(a=>({...a,output:b.output,status:b.status})),"running"!==b.status&&"starting"!==b.status&&de(!1)}catch(a){dc(b=>({...b,output:`${b.output}
|
|
3
|
+
[error] ${a.message}`})),de(!1)}}},[db.executionId,dj]),ec=(0,g.useCallback)(async()=>{if(df)return;dg(!0);let a=await r(db.output);dg(!1),di(a),a&&setTimeout(()=>di(!1),1500)},[df,db.output]),ed=a=>{let b=a.filter(a=>a!==eT);0!==b.length&&(ag(b),ai(!1),ae(!0))},ee=a=>{ed([a])},ef=(0,g.useCallback)(()=>{am(!1),ao(null),aq(!1)},[]),eg=(0,g.useCallback)(a=>{a&&(ao(a),aq(!1),am(!0))},[]),eh=async()=>{if(0!==af.length){ak(!0);try{let b=new Map,c=(a,c,d)=>{b.has(a)||b.set(a,{branchRef:c,run:d})},e=new Set;if(ah)for(let a of af){if(a.startsWith("remotes/"))continue;let b=v?.trackingInfo?.[a];b?.upstream&&e.add(b.upstream)}for(let b of e){let[d,...e]=b.split("/"),f=e.join("/");if(d&&f){let b=`${d}/${f}`;c(`remote:${b}`,b,()=>M({repoPath:a,action:"delete-remote-branch",data:{remote:d,branch:f},suppressErrorToast:!0}))}}for(let b of af){if(b.startsWith("remotes/")){let d=b.split("/");if(d.length>=3){let b=d[1],e=d.slice(2).join("/"),f=`${b}/${e}`;c(`remote:${f}`,f,()=>M({repoPath:a,action:"delete-remote-branch",data:{remote:b,branch:e},suppressErrorToast:!0}))}continue}c(`local:${b}`,b,()=>M({repoPath:a,action:"delete-branch",data:{branch:b},suppressErrorToast:!0}))}let f=Array.from(b.values()),g=(await Promise.allSettled(f.map(a=>a.run()))).flatMap((a,b)=>{if("fulfilled"===a.status)return[];let c=f[b].branchRef;return console.error(`Failed to delete branch "${c}":`,a.reason),[c]});g.length>0&&(0,q.oR)({type:"error",title:1===g.length?"Failed to Delete 1 Branch":`Failed to Delete ${g.length} Branches`,description:(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{children:"The following branches could not be deleted:"}),(0,d.jsx)("ul",{className:"mt-1 max-h-40 overflow-y-auto list-disc pl-5",children:g.map(a=>(0,d.jsx)("li",{className:"break-all",children:a},a))})]}),duration:1e4}),ae(!1),ag([]),ai(!1),c5([]),c7(null)}catch(a){console.error(a)}finally{ak(!1)}}},ei=async()=>{if(an){as(!0);try{if(await M({repoPath:a,action:"delete-tag",data:{tag:an}}),ap&&eV)try{await M({repoPath:a,action:"delete-remote-tag",data:{remote:eV,tag:an}})}catch(a){console.error("Failed to delete remote tag:",a)}ef()}catch(a){console.error(a)}finally{as(!1)}}},ej=a=>{aG(a),aI(null),aK(a),aM(!1),aE(!0)},ek=a=>{let b=a.split("/");if(b.length<3||"remotes"!==b[0])return;let c=b[1],d=b.slice(2).join("/");c&&d&&(aG(a),aI({remote:c,branch:d}),aK(d),aM(!1),aE(!0))},el=async()=>{if(aF&&aJ){if(aH?aH.branch===aJ:aF===aJ)return void dl();aO(!0);try{aH?await M({repoPath:a,action:"rename-remote-branch",data:{remote:aH.remote,oldName:aH.branch,newName:aJ}}):await M({repoPath:a,action:"rename-branch",data:{oldName:aF,newName:aJ,renameTrackingRemote:aL}}),dl()}catch(a){console.error(a)}finally{aO(!1)}}},em=async()=>{if(!aR)return;let b=aR.trim(),c=aT.trim();if(b&&c){if(b===c)return void dm();aW(!0);try{await M({repoPath:a,action:"rename-remote",data:{oldName:b,newName:c}}),dm()}catch(a){console.error(a)}finally{aW(!1)}}},en=async()=>{if(!aZ)return;let b=aZ.trim();if(b){a0(!0);try{await M({repoPath:a,action:"delete-remote",data:{name:b}}),dn()}catch(a){console.error(a)}finally{a0(!1)}}},eo=async()=>{let b=a3.trim(),c=a5.trim();if(b&&c){a8(!0);try{await M({repoPath:a,action:"add-remote",data:{name:b,url:c}}),dp()}catch(a){console.error(a)}finally{a8(!1)}}},ep=({sourceBranch:a,targetBranch:b})=>{bc(a),be(b),bg(!0),bk("checking"),ba(!0)},eq=async()=>{if(bb&&bd){bi(!0);try{await M({repoPath:a,action:"checkout",data:{branch:bb}}),await M({repoPath:a,action:"rebase",data:{ontoBranch:bd,stashChanges:bf}}),bl()}catch(a){console.error(a)}finally{bi(!1)}}},er=({sourceBranch:a,targetBranch:b})=>{bp(b),br(a),bt(!1),bv(!1),bx(!1),bz(""),bD("checking"),bn(!0)},es=(0,g.useCallback)(b=>{if(bv(b),b){if(!bq)return void bz("");(async()=>{try{let b=await M({repoPath:a,action:"get-latest-commit-message",data:{branch:bq}});bz("string"==typeof b?.message?b.message:"")}catch(a){console.error(a),bz("")}})()}},[bq,a,M]),et=async()=>{if(bo&&bq){bB(!0);try{await M({repoPath:a,action:"checkout",data:{branch:bo}}),await M({repoPath:a,action:"merge",data:{targetBranch:bq,rebaseBeforeMerge:bs,squash:bu,fastForward:bw,squashMessage:bu?by:void 0}}),bE()}catch(a){console.error(a)}finally{bB(!1)}}},eu=async b=>{bI(b),b4(null),bK([]),bO([]),bM(""),bQ(""),bS(null),bU(!1),bW(!1),bY(!0),b$(!1),b0(""),bG(!0),b6(!0);try{let c=await M({repoPath:a,action:"get-remotes",data:{}});if(!c.remotes||0===c.remotes.length){b4("No remote repository configured. Please add a remote first."),b6(!1);return}bK(c.remotes);let d=await M({repoPath:a,action:"get-tracking-branch",data:{branch:b}});bS(d.tracking);let e=d.tracking?.remote,f=e&&c.remotes.includes(e)?e:c.remotes[0];bM(f),b8(!0);let g=await M({repoPath:a,action:"get-remote-branches",data:{remote:f}});bO(g.branches||[]),d.tracking?.remote===f&&d.tracking?.branch?bQ(d.tracking.branch):(g.branches?.includes(b),bQ(b))}catch(a){console.error(a),b4(a.message||"Failed to load remote information")}finally{b6(!1),b8(!1)}},ev=async b=>{bM(b),b8(!0),bO([]);try{let c=await M({repoPath:a,action:"get-remote-branches",data:{remote:b}});bO(c.branches||[]),bR?.remote===b&&bR?.branch?bQ(bR.branch):bQ(bH||"")}catch(a){console.error(a),b4(a.message||"Failed to load remote branches")}finally{b8(!1)}},ew=(0,g.useCallback)(b=>{if(b$(b),b){if(!bH)return void b0("");(async()=>{try{let b=await M({repoPath:a,action:"get-latest-commit-message",data:{branch:bH}});b0("string"==typeof b?.message?b.message:"")}catch(a){console.error(a),b0("")}})()}},[bH,a,M]),ex=async()=>{if(bH&&bL&&bP){b2(!0),b4(null);try{let b=!bN.includes(bP)||bR?.remote!==bL||bR?.branch!==bP;await M({repoPath:a,action:"push-to-remote",data:{localBranch:bH,remote:bL,remoteBranch:bP,rebaseFirst:!bV&&bT,forcePush:bV,pushLocalOnlyTags:bX,setUpstream:b,squash:bZ,squashMessage:b_}}),await M({repoPath:a,action:"fetch",data:{remote:bL}}),bG(!1),bI(null)}catch(a){console.error(a),b4(a.message||"Failed to push to remote")}finally{b2(!1)}}},ey=async b=>{cc(b),cs(null),ce([]),ci([]),cg(""),ck(""),cm(null),co(!0),ca(!0),cu(!0);try{let c=await M({repoPath:a,action:"get-remotes",data:{}});if(!c.remotes||0===c.remotes.length){cs("No remote repository configured. Please add a remote first."),cu(!1);return}ce(c.remotes);let d=await M({repoPath:a,action:"get-tracking-branch",data:{branch:b}});cm(d.tracking);let e=d.tracking?.remote,f=e&&c.remotes.includes(e)?e:c.remotes[0];cg(f),cw(!0);let g=await M({repoPath:a,action:"get-remote-branches",data:{remote:f}});ci(g.branches||[]),d.tracking?.remote===f&&d.tracking?.branch?ck(d.tracking.branch):ck("")}catch(a){console.error(a),cs(a.message||"Failed to load remote information")}finally{cu(!1),cw(!1)}},ez=async b=>{cg(b),cw(!0),ci([]),ck("");try{let c=await M({repoPath:a,action:"get-remote-branches",data:{remote:b}});ci(c.branches||[]),cl?.remote===b&&cl?.branch?ck(cl.branch):ck("")}catch(a){console.error(a),cs(a.message||"Failed to load remote branches")}finally{cw(!1)}},eA=async()=>{if(cb&&cf&&cj){cq(!0),cs(null);try{await M({repoPath:a,action:"pull-from-remote",data:{localBranch:cb,remote:cf,remoteBranch:cj,rebase:cn}}),ca(!1),cc(null)}catch(a){console.error(a),cs(a.message||"Failed to pull from remote")}finally{cq(!1)}}},eB=a=>{cC(a),cE(a.split("/").slice(2).join("/")),cA(!0)},eC=async()=>{if(cB&&cD){cG(!0);try{await M({repoPath:a,action:"checkout-to-local",data:{remoteBranch:cB,localBranch:cD}}),cA(!1),cC(null),cE("")}catch(a){console.error(a)}finally{cG(!1)}}},eD=async()=>{cy(!0);try{await M({repoPath:a,action:"fetch",data:{allRemotes:!0}})}catch(a){console.error(a)}finally{cy(!1)}},eE=async b=>{try{await M({repoPath:a,action:"fetch",data:{remote:b}})}catch(a){console.error(a)}},eF=async b=>{try{await M({repoPath:a,action:"checkout",data:{branch:b}})}catch(a){console.error(a)}},eG=async a=>{cK(a),cI(!0)},eH=async()=>{if(cJ){cM(!0);try{await M({repoPath:a,action:"reset",data:{commitHash:cJ,mode:"hard"}}),cI(!1),cK(null)}catch(a){console.error(a)}finally{cM(!1)}}},eI=async()=>{if(cP){cS(!0);try{await M({repoPath:a,action:"revert",data:{commitHash:cP.hash}}),cO(!1),cQ(null)}catch(a){console.error(a)}finally{cS(!1)}}},eJ=async()=>{if(cV&&cX.trim()){c0(!0);try{let b,c;await M({repoPath:a,action:"reword",data:{commitHash:cV.hash,message:(b=cX.trim(),(c=cZ.replace(/\r\n/g,"\n")).trim()?`${b}
|
|
4
4
|
|
|
5
|
-
${c}`:b),branch:cU.branch}}),dp()}catch(a){console.error(a)}finally{c_(!1)}}},eI=a=>{if(!(a instanceof Error))return!1;let b=a.message.toLowerCase();return b.includes("cherry-pick")&&b.includes("already in progress")},eJ=a=>{if(!(a instanceof Error))return!1;let b=a.message.toLowerCase();return b.includes("could not apply")||b.includes("conflict")||b.includes("cherry-pick --continue")},eK=(0,f.useCallback)(async b=>{1===b.length?await L({repoPath:a,action:"cherry-pick",data:{commitHash:b[0]}}):await L({repoPath:a,action:"cherry-pick-multiple",data:{commitHashes:b}})},[a,L]),eL=(0,f.useCallback)(async()=>{try{await L({repoPath:a,action:"cherry-pick-abort"})}catch(a){console.error(a)}finally{at(!1),az(!1),av([])}},[a,L]),eM=async()=>{if(0!==au.length){ax(!0);try{let a=au.map(a=>a.hash);await eK(a),at(!1),av([])}catch(a){eI(a)?(at(!1),az(!0)):eJ(a)&&await eL(),console.error(a)}finally{ax(!1)}}},eN=async()=>{if(0===au.length)return void az(!1);aB(!0);try{await L({repoPath:a,action:"cherry-pick-abort"});let b=au.map(a=>a.hash);await eK(b),az(!1),av([])}catch(a){eI(a)?az(!0):eJ(a)&&await eL(),console.error(a)}finally{aB(!1)}},eO=async()=>{if(O){T(!0);try{await L({repoPath:a,action:"branch",data:{branch:O,fromRef:Q||void 0}}),N(!1),P(""),R(null)}catch(a){console.error(a)}finally{T(!1)}}},eP=a=>{R(a||null),N(!0)},eQ=async()=>{if(W&&Y.trim()){ab(!0);try{await L({repoPath:a,action:"create-tag",data:{tagName:Y.trim(),commitHash:W,pushToRemote:$}}),V(!1),X(null),Z(""),_(!1)}catch(a){console.error(a)}finally{ab(!1)}}},eR=u?.current,eS=u?.trackingInfo,eT=(0,f.useMemo)(()=>Object.keys(u?.remoteUrls??{}).sort((a,b)=>"origin"===a?-1:"origin"===b?1:a.localeCompare(b)),[u?.remoteUrls])[0]||null,eU=(0,f.useMemo)(()=>{let a=[];for(let b of ae){if(b.startsWith("remotes/"))continue;let c=eS?.[b]?.upstream;c&&a.push(c)}return Array.from(new Set(a))},[ae,eS]),eV=(0,f.useMemo)(()=>!aE||aG?null:eS?.[aE]??null,[aE,aG,eS]),eW=A?.files?.length,eX=eR||(z?"Loading branches...":"Detached HEAD"),eY=eR&&"number"==typeof eW&&eW>0?`${eR} (${eW})`:eX,eZ=(0,f.useMemo)(()=>{if(!eR)return null;let a=eS?.[eR];if(!a?.upstream)return null;let b=a.upstream.indexOf("/");return b<=0?null:{upstream:a.upstream,remote:a.upstream.slice(0,b),branch:a.upstream.slice(b+1)}},[eR,eS]),e$=(0,f.useMemo)(()=>z?"Loading branches...":eR?eZ?null:`Branch "${eR}" has no tracking remote branch`:"Not on a local branch",[eR,eZ,z]),e_=(0,f.useMemo)(()=>z?"Loading branches...":eR?null:"Not on a local branch",[eR,z]),e0=a=>{let b=function(a,b){let{branchRef:c,branchLeafName:e,currentBranch:f,isRemote:g,selectedBranchRefs:h}=a,i=!g&&c===f,j=h&&h.length>0?h:[c],k=j.length>1,l=[];return i||g||l.push({label:"Checkout",onClick:()=>b.onCheckout(c)}),g&&l.push({label:"Checkout to local",onClick:()=>b.onCheckoutToLocal(c)}),l.push({label:"Create Branch",onClick:()=>b.onCreateBranch(c)}),g||l.push({label:"Rename Branch",onClick:()=>b.onRenameBranch(c)}),g&&l.push({label:"Rename branch",onClick:()=>b.onRenameRemoteBranch(c)}),g||l.push({label:"Push to Remote",onClick:()=>b.onPushToRemote(c)}),g||l.push({label:"Pull from Remote",onClick:()=>b.onPullFromRemote(c)}),!i&&f&&(l.push({label:`Rebase ${f} onto ${e}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Rebase ",(0,d.jsx)("span",{className:"font-bold",children:f})," onto ",e]}),onClick:()=>b.onRebase({sourceBranch:f,targetBranch:c})}),l.push({label:`Rebase ${e} onto ${f}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Rebase ",e," onto ",(0,d.jsx)("span",{className:"font-bold",children:f})]}),onClick:()=>b.onRebase({sourceBranch:c,targetBranch:f})}),l.push({label:`Merge ${f} into ${e}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Merge ",(0,d.jsx)("span",{className:"font-bold",children:f})," into ",e]}),onClick:()=>b.onMerge({sourceBranch:f,targetBranch:c})}),l.push({label:`Merge ${e} into ${f}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Merge ",e," into ",(0,d.jsx)("span",{className:"font-bold",children:f})]}),onClick:()=>b.onMerge({sourceBranch:c,targetBranch:f})})),i||(k?l.push({label:`Delete Selected Branches (${j.length})`,onClick:()=>b.onDeleteBranches(j),danger:!0}):l.push({label:g?"Delete Remote Branch":"Delete Branch",onClick:()=>b.onDeleteBranch(c),danger:!0})),l}(a,{onCheckout:eD,onCheckoutToLocal:ez,onCreateBranch:eP,onDeleteBranch:ec,onDeleteBranches:eb,onRenameBranch:eh,onRenameRemoteBranch:ei,onRebase:en,onMerge:ep,onPushToRemote:es,onPullFromRemote:ew});return dJ.length>0&&b.push({label:"Custom scripts",children:dJ.map(b=>({label:b.name,onClick:()=>{d8(b,a.branchRef)}}))}),b},e1=(0,f.useMemo)(()=>new Set(u?.branches??[]),[u?.branches]),e2=(0,f.useMemo)(()=>{let a=new Map;if(!u?.remotes)return a;for(let[b,c]of Object.entries(u.remotes))for(let d of c)a.set(`${b}/${d}`,`remotes/${b}/${d}`);return a},[u?.remotes]),e3=(0,f.useMemo)(()=>dE?C(dE).filter(a=>a!==eR):[],[dE,eR]),e4=(0,d.jsxs)("div",{className:"w-[22rem] max-w-[calc(100vw-2rem)] flex flex-col border border-base-300 bg-base-100 rounded-box shadow-xl overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-4 border-b border-base-300 flex items-center justify-between bg-base-100 h-[57px] shrink-0",children:[(0,d.jsx)("h2",{className:"font-bold text-lg",children:"Branches"}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[d3&&(0,d.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Clear filters",children:(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:dY,children:(0,d.jsx)("i",{className:"iconoir-filter text-[16px]","aria-hidden":"true"})})}),(0,d.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Create Branch",children:(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>eP(),children:(0,d.jsx)("i",{className:"iconoir-plus-circle text-[16px]","aria-hidden":"true"})})})]})]}),(0,d.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,d.jsxs)("div",{className:"p-2 space-y-0.5",children:[dE&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{items:[{label:"Delete",onClick:()=>eb(e3),danger:!0,disabled:0===e3.length}],children:(0,d.jsx)(y,{name:"Branches",groupPath:"__local__",icon:(0,d.jsx)("i",{className:"iconoir-git-branch text-[14px]","aria-hidden":"true"}),isExpanded:dK,onToggle:dU,visibilityMap:dO,onToggleVisibility:dX})}),dK&&(0,d.jsx)(D,{node:dE,currentBranch:u?.current,expandedFolders:dQ,onToggleFolder:dW,onCheckout:eD,onCheckoutToLocal:ez,onCreateBranch:()=>eP(),onDeleteBranch:ec,onRenameBranch:eh,onRenameRemoteBranch:ei,onRebase:en,onMerge:ep,onPushToRemote:es,onPullFromRemote:ew,getBranchContextMenuItems:e0,onBranchClick:d6,onBranchContextMenu:d7,onDeleteBranchGroup:eb,selectedBranches:dG,visibilityMap:dO,onToggleVisibility:dX,depth:1,groupPath:"__local__",trackingInfo:u?.trackingInfo})]}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i,{items:[{label:"Fetch from all remotes",onClick:eB},{label:"Add remote",onClick:()=>{a3("origin"),a5(""),a1(!0)}}],children:(0,d.jsx)(y,{name:"Remotes",groupPath:"__remotes__",icon:(0,d.jsx)("i",{className:"iconoir-globe text-[14px]","aria-hidden":"true"}),isExpanded:dM,onToggle:dV,visibilityMap:dO,onToggleVisibility:dX})}),dM&&z&&!dF&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsx)("span",{children:"Loading remotes..."})]}),dM&&dF&&Array.from(dF.entries()).map(([a,b])=>{let c=`__remotes__/${a}`,e=dQ.has(c);return(0,d.jsxs)("div",{children:[(0,d.jsx)(i,{items:[{label:`Fetch from ${a}`,onClick:()=>eC(a)},{label:"Rename",onClick:()=>{aR(a),aT(a),aP(!0)}},{label:"Delete",onClick:()=>{a&&(aZ(a),aX(!0))},danger:!0}],children:(0,d.jsx)(y,{name:a,groupPath:c,icon:(0,d.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50","aria-hidden":"true"}),isExpanded:e,onToggle:()=>dW(c),visibilityMap:dO,onToggleVisibility:dX,depth:1})}),e&&(0,d.jsx)(D,{node:b,currentBranch:u?.current,expandedFolders:dQ,onToggleFolder:dW,onCheckout:eD,onCheckoutToLocal:ez,onCreateBranch:()=>eP(),onDeleteBranch:ec,onRenameBranch:eh,onRenameRemoteBranch:ei,onRebase:en,onMerge:ep,onPushToRemote:es,onPullFromRemote:ew,getBranchContextMenuItems:e0,onBranchClick:d6,onBranchContextMenu:d7,onDeleteBranchGroup:eb,selectedBranches:dG,visibilityMap:dO,onToggleVisibility:dX,depth:2,groupPath:c,isRemote:!0,trackingInfo:u?.trackingInfo})]},a)})]})]})})]});return l&&100===c?(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):m?(0,d.jsxs)("div",{className:"flex items-center justify-center p-8 h-full flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-error font-medium",children:"Error Loading History"}),(0,d.jsx)("p",{className:"text-sm opacity-70",children:n?.message||"An unknown error occurred"}),(0,d.jsxs)("button",{onClick:()=>s(),className:"btn btn-outline btn-sm",children:[(0,d.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):j?(0,d.jsxs)("div",{className:"flex h-full overflow-hidden",children:[cG&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Reset to Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to hard reset the current branch to commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cI?.substring(0,7)}),"?",(0,d.jsx)("br",{}),(0,d.jsx)("span",{className:"text-error font-bold",children:"Warning: This will discard all local changes and commits after this point. This action cannot be undone."})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>cH(!1),disabled:cK,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:eF,disabled:cK,children:[cK&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reset"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>cH(!1),children:"close"})})]}),cM&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Revert Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to revert commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cO?.hash.substring(0,7)})," on ",(0,d.jsx)("span",{className:"font-bold break-all",children:u?.current||"current"}),"?"]}),cO?.message&&(0,d.jsx)("div",{className:"rounded border border-base-300 bg-base-200/40 px-3 py-2 text-xs break-words",children:cO.message}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{cN(!1),cP(null)},disabled:cQ,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eG,disabled:cQ,children:[cQ&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Revert"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{cN(!1),cP(null)},children:"close"})})]}),cS&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Reword Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Reword commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cU?.hash.substring(0,7)})," on branch ",(0,d.jsx)("span",{className:"font-bold",children:cU?.branch}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm mb-3",value:cW,onChange:a=>cX(a.target.value),autoFocus:!0,onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&cW.trim()&&!c$&&(a.preventDefault(),eH())},placeholder:"Commit subject",disabled:c$}),(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full h-32 font-mono text-sm",value:cY,onChange:a=>cZ(a.target.value),onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&cW.trim()&&!c$&&(a.preventDefault(),eH())},placeholder:"Commit message body (optional)",disabled:c$}),cU?.branch!==u?.current&&(0,d.jsx)("div",{className:"alert alert-warning text-xs mt-2 py-2",children:(0,d.jsxs)("span",{children:["This will briefly checkout ",(0,d.jsx)("b",{children:cU?.branch})," to amend the commit."]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dp,disabled:c$,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eH,disabled:!cW.trim()||c$,children:[c$&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reword"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dp,children:"close"})})]}),ac&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:ae.length>1?"Delete Branches":"Delete Branch"}),ae.length>1?(0,d.jsxs)("div",{className:"py-4 space-y-3",children:[(0,d.jsxs)("p",{className:"break-words",children:["Are you sure you want to delete ",(0,d.jsxs)("span",{className:"font-bold",children:[ae.length," selected branches"]}),"? This action cannot be undone."]}),(0,d.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:ae.map(a=>(0,d.jsx)("div",{className:"text-xs min-w-0 break-all",children:a.startsWith("remotes/")?a.slice(8):a},a))})]}):(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the branch ",(0,d.jsx)("span",{className:"font-bold break-all",children:ae[0]?.startsWith("remotes/")?ae[0].slice(8):ae[0]}),"? This action cannot be undone."]}),eU.length>0&&(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ag,onChange:a=>ah(a.target.checked),disabled:ai}),(0,d.jsx)("span",{className:"label-text break-words whitespace-normal",children:1===eU.length?(0,d.jsxs)(d.Fragment,{children:["Delete tracking remote branch ",(0,d.jsx)("span",{className:"font-mono opacity-70 break-all",children:eU[0]})]}):(0,d.jsxs)(d.Fragment,{children:["Delete ",eU.length," tracking remote branches"]})})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{ad(!1),af([]),ah(!1)},disabled:ai,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:ef,disabled:ai,children:[ai&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{ad(!1),af([]),ah(!1)},children:"close"})})]}),ak&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Delete Tag"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the tag ",(0,d.jsx)("span",{className:"font-bold break-all",children:am}),"? This action cannot be undone."]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ao,onChange:a=>ap(a.target.checked),disabled:aq||!eT}),(0,d.jsx)("span",{className:"label-text break-words whitespace-normal",children:eT?(0,d.jsxs)(d.Fragment,{children:["Also delete from remote ",(0,d.jsx)("span",{className:"font-mono opacity-70",children:eT})]}):"No remote configured"})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:ed,disabled:aq,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:eg,disabled:aq||!am,children:[aq&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:ed,children:"close"})})]}),as&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick"}),(0,d.jsx)("p",{className:"text-sm opacity-70 mt-1",children:au.length>1?"Apply selected commits from oldest to newest":"Apply changes from the selected commit"}),1===au.length?(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure to apply ",(0,d.jsx)("span",{className:"font-bold font-mono break-all",children:au[0]?.hash})," ",(0,d.jsx)("span",{className:"font-bold break-words",children:au[0]?.message})," to ",(0,d.jsx)("span",{className:"font-bold break-all",children:u?.current||"current"})," branch?"]}):(0,d.jsxs)("div",{className:"py-4 space-y-3",children:[(0,d.jsxs)("p",{className:"break-words",children:["Are you sure to apply ",(0,d.jsxs)("span",{className:"font-bold",children:[au.length," selected commits"]})," to ",(0,d.jsx)("span",{className:"font-bold break-all",children:u?.current||"current"})," branch?"]}),(0,d.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:au.map(a=>(0,d.jsxs)("div",{className:"text-xs min-w-0",children:[(0,d.jsx)("span",{className:"font-mono opacity-70",children:a.hash.slice(0,7)})," ",(0,d.jsx)("span",{className:"break-words",children:a.message})]},a.hash))})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{at(!1),av([])},disabled:aw,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eM,disabled:aw,children:[aw&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{at(!1),av([])},children:"close"})})]}),ay&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick In Progress"}),(0,d.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Another cherry-pick operation is currently in progress."}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Abort the in-progress cherry-pick and continue with ",au.length>1?"the selected commits":"this commit","?"]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{az(!1),av([])},disabled:aA,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-warning",onClick:()=>void eN(),disabled:aA,children:[aA&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Abort and Continue"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{az(!1),av([])},children:"close"})})]}),aC&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:aG?"Rename Remote Branch":"Rename Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for the branch ",(0,d.jsx)("span",{className:"font-bold break-all",children:aE}),". Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:aI,onChange:a=>aJ((0,h.L9)(a.target.value)),placeholder:"New branch name",disabled:aM,autoFocus:!0,onKeyDown:a=>{let b="Enter"===a.key&&(a.metaKey||a.ctrlKey),c=aG?aI===aG.branch:aI===aE;b&&aI&&!c&&!aM&&ej()}}),!aG&&eV?.upstream&&(0,d.jsx)("div",{className:"form-control mt-2",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aK,onChange:a=>aL(a.target.checked),disabled:aM}),(0,d.jsxs)("span",{className:"label-text break-words whitespace-normal",children:["Also rename tracking remote branch ",(0,d.jsx)("span",{className:"font-mono opacity-70 break-all",children:eV.upstream})]})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dk,disabled:aM,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:ej,disabled:!aI||(aG?aI===aG.branch:aI===aE)||aM,children:[aM&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dk,children:"close"})})]}),aO&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Rename Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for remote ",(0,d.jsx)("span",{className:"font-bold break-all",children:aQ}),". Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:aS,onChange:a=>aT(a.target.value),placeholder:"New remote name",disabled:aU,autoFocus:!0,onKeyDown:a=>{let b="Enter"===a.key&&(a.metaKey||a.ctrlKey),c=aS.trim(),d=c===(aQ??"").trim();b&&c&&!d&&!aU&&ek()}}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dl,disabled:aU,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:ek,disabled:!aS.trim()||aS.trim()===(aQ??"").trim()||aU,children:[aU&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dl,children:"close"})})]}),aW&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Delete Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete remote ",(0,d.jsx)("span",{className:"font-bold break-all",children:aY}),"? This removes all tracking branches for that remote."]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dm,disabled:a$,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:el,disabled:!aY||a$,children:[a$&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dm,children:"close"})})]}),a0&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Add Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Add a new remote by providing a name and URL. Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"label pt-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote name"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:a2,onChange:a=>a3(a.target.value),placeholder:"origin",disabled:a6,autoFocus:!0})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"label pt-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote URL"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:a4,onChange:a=>a5(a.target.value),placeholder:"https://github.com/owner/repo.git",disabled:a6,onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&a2.trim()&&a4.trim()&&!a6&&em()}})]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dn,disabled:a6,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:em,disabled:!a2.trim()||!a4.trim()||a6,children:[a6&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Add"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dn,children:"close"})})]}),a8&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Rebase"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Copy commits from one branch to another.",(0,d.jsx)("br",{}),"Are you sure to rebase ",(0,d.jsx)("span",{className:"font-bold break-all",children:ba})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bc}),"?"]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:be,onChange:a=>bf(a.target.checked),disabled:bg}),(0,d.jsx)("span",{className:"label-text",children:"Stash and reapply local changes"})]})}),!be&&(0,d.jsx)("p",{className:"text-xs text-warning mt-2 ml-6",children:"Warning: All local changes will be discarded."}),"checking"===bi?(0,d.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsxs)("span",{children:["Checking conflicts for rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:ba})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bc}),"..."]})]}):"no-conflict"===bi?(0,d.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["No conflict: rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:ba})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bc})," will not cause conflicts."]})]}):(0,d.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["Conflicts detected: rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:ba})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bc})," will cause conflicts."]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:bk,disabled:bg,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eo,disabled:bg,children:[bg&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:bk,children:"close"})})]}),bl&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Merge"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Merge branch into another one.",(0,d.jsx)("br",{}),"Are you sure to merge ",(0,d.jsx)("span",{className:"font-bold break-all",children:bp})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bn}),"?"]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:br,onChange:a=>bs(a.target.checked),disabled:bz}),(0,d.jsx)("span",{className:"label-text",children:"Rebase before merge"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bt,onChange:a=>eq(a.target.checked),disabled:bz}),(0,d.jsx)("span",{className:"label-text",children:"Squash before merge"})]})}),bt&&(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full mt-2",placeholder:"Commit message for squash merge",value:bx,onChange:a=>by(a.target.value),disabled:bz,autoFocus:!0}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bv,onChange:a=>bw(a.target.checked),disabled:bz}),(0,d.jsx)("span",{className:"label-text",children:"Fast forward merge"})]})}),"checking"===bB?(0,d.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsxs)("span",{children:["Checking conflicts for merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bp})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bn}),"..."]})]}):"no-conflict"===bB?(0,d.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["No conflict: merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bp})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bn})," will not cause conflicts."]})]}):(0,d.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["Conflicts detected: merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bp})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bn})," will cause conflicts."]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:bD,disabled:bz,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:er,disabled:bz,children:[bz&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:bD,children:"close"})})]}),bE&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Push to Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Push ",(0,d.jsx)("span",{className:"font-bold break-all",children:bG})," to a remote repository."]}),b2&&0===bI.length?(0,d.jsxs)("div",{className:"alert alert-error",children:[(0,d.jsx)("span",{className:"text-xl",children:"⚠️"}),(0,d.jsx)("span",{children:b2})]}):b4?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,d.jsx)("select",{className:"select select-bordered w-64",value:bK,onChange:a=>et(a.target.value),disabled:b0,children:bI.map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Branch"})}),(0,d.jsxs)("div",{className:"flex flex-col items-end gap-1 w-64",children:[b6?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-full",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,d.jsxs)("select",{className:"select select-bordered w-full",value:bO,onChange:a=>bP(a.target.value),disabled:b0,children:[bG&&!bM.includes(bG)&&(0,d.jsxs)("option",{value:bG,children:[bG," (new)"]}),bM.map(a=>(0,d.jsxs)("option",{value:a,children:[a,bQ?.remote===bK&&bQ?.branch===a?" (tracking)":""]},a))]}),bO&&!bM.includes(bO)&&(0,d.jsx)("div",{className:"label",children:(0,d.jsx)("span",{className:"label-text-alt text-warning",children:"New branch will be created"})})]})]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bS,onChange:a=>bT(a.target.checked),disabled:b0||bU}),(0,d.jsx)("span",{className:"label-text",children:"Rebase onto remote branch before pushing"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm checkbox-error",checked:bU,onChange:a=>bV(a.target.checked),disabled:b0}),(0,d.jsx)("span",{className:"label-text text-error",children:"Force push"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bW,onChange:a=>bX(a.target.checked),disabled:b0}),(0,d.jsx)("span",{className:"label-text",children:"Push all tags"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bY,onChange:a=>eu(a.target.checked),disabled:b0}),(0,d.jsx)("span",{className:"label-text",children:"Squash local commits before push"})]})}),bY&&(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full",placeholder:"Commit message for squash",value:b$,onChange:a=>b_(a.target.value),disabled:b0,autoFocus:!0}),b2&&(0,d.jsx)("div",{className:"alert alert-error text-sm",children:(0,d.jsx)("span",{children:b2})})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>bF(!1),disabled:b0,children:"Cancel"}),bI.length>0&&(0,d.jsxs)("button",{className:"btn btn-primary",onClick:ev,disabled:b0||!bK||!bO,children:[b0&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Push"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>bF(!1),children:"close"})})]}),b8&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Pull from Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Pull changes from a remote branch into ",(0,d.jsx)("span",{className:"font-bold break-all",children:ca}),"."]}),cq&&0===cc.length?(0,d.jsx)("div",{className:"alert alert-error",children:(0,d.jsx)("span",{children:cq})}):cs?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,d.jsx)("select",{className:"select select-bordered w-64",value:ce,onChange:a=>ex(a.target.value),disabled:co,children:cc.map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Branch"})}),cu?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-64",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,d.jsx)("select",{className:"select select-bordered w-64",value:ci,onChange:a=>cj(a.target.value),disabled:co,children:cg.map(a=>(0,d.jsxs)("option",{value:a,children:[a,ck?.remote===ce&&ck?.branch===a?" (tracking)":""]},a))})]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:cm,onChange:a=>cn(a.target.checked),disabled:co}),(0,d.jsx)("span",{className:"label-text",children:"Rebase onto remote branch"})]})}),cq&&(0,d.jsx)("div",{className:"alert alert-error text-sm",children:(0,d.jsx)("span",{children:cq})})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>b9(!1),disabled:co,children:"Cancel"}),cc.length>0&&(0,d.jsxs)("button",{className:"btn btn-primary",onClick:ey,disabled:co||!ce||!ci,children:[co&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Pull"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>b9(!1),children:"close"})})]}),U&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Create Tag"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a new tag at commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:W?.substring(0,7)}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono",value:Y,onChange:a=>Z(a.target.value),placeholder:"Tag name",disabled:aa,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&Y.trim()&&!aa&&eQ()}}),(0,d.jsx)("div",{className:"form-control mt-3",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:$,onChange:a=>_(a.target.checked),disabled:aa}),(0,d.jsx)("span",{className:"label-text",children:"Push tag to remote after creation"})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{V(!1),X(null),Z(""),_(!1)},disabled:aa,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eQ,disabled:!Y.trim()||aa,children:[aa&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Create"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{V(!1),X(null),Z(""),_(!1)},children:"close"})})]}),M&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Create New Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a new branch from"," ",(0,d.jsx)("span",{className:"font-bold break-all",children:Q?Q.replace(/^remotes\//,""):"current HEAD"}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:O,onChange:a=>P((0,h.L9)(a.target.value)),placeholder:"Branch name",disabled:S,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&O&&!S&&eO()}}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{N(!1),R(null)},disabled:S,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eO,disabled:!O||S,children:[S&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Create & Checkout"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{N(!1),R(null)},children:"close"})})]}),cy&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Checkout to Local Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a local branch from ",(0,d.jsx)("span",{className:"font-bold break-all",children:cA?.replace(/^remotes\//,"")})," and set up tracking."]}),(0,d.jsxs)("div",{className:"form-control w-full",children:[(0,d.jsx)("label",{className:"label",children:(0,d.jsx)("span",{className:"label-text",children:"Local Branch Name"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:cC,onChange:a=>cD((0,h.L9)(a.target.value)),placeholder:"Local branch name",disabled:cE,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&cC&&!cE&&eA()}})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>cz(!1),disabled:cE,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eA,disabled:!cC||cE,children:[cE&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Checkout"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>cz(!1),children:"close"})})]}),da.isOpen&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box max-w-4xl",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("h3",{className:"font-bold text-lg truncate",children:["Custom Script: ",da.scriptName]}),(0,d.jsxs)("p",{className:"text-xs opacity-70 mt-1 break-all",children:["Branch: ",da.branchRef]})]}),(0,d.jsx)("span",{className:(0,h.cn)("badge badge-sm shrink-0","running"===da.status||"starting"===da.status?"badge-info":"completed"===da.status?"badge-success":"failed"===da.status?"badge-error":"canceled"===da.status?"badge-warning":"badge-ghost"),children:da.status})]}),(0,d.jsx)("div",{className:"mt-4 border border-base-300 rounded bg-base-200/40",children:(0,d.jsx)("pre",{className:"p-3 font-mono text-xs overflow-auto max-h-[50vh] whitespace-pre-wrap break-words",children:da.output||"Waiting for output..."})}),da.error&&(0,d.jsx)("div",{className:"alert alert-error py-2 mt-3",children:(0,d.jsx)("span",{children:da.error})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsxs)("button",{className:"btn btn-warning",onClick:()=>void d9(),disabled:!di||dc,children:[dc&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Cancel"]}),(0,d.jsxs)("button",{className:"btn btn-outline",onClick:()=>void ea(),disabled:de,children:[de&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),dg?"Copied":"Copy"]}),(0,d.jsx)("button",{className:"btn btn-primary",onClick:()=>{db(r),dh(!1),dd(!1)},disabled:!dj,children:"Done"})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:a=>{dj?(db(r),dh(!1),dd(!1)):a.preventDefault()},children:"close"})})]}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 bg-base-100",children:[(0,d.jsx)("div",{className:"h-[57px] flex items-center px-6 border-b border-base-300 shrink-0",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("h1",{className:"font-bold text-lg",children:"History"}),(0,d.jsxs)("div",{className:"relative",ref:c9,children:[(0,d.jsxs)("button",{className:"btn btn-sm gap-2 max-w-[24rem]",onClick:()=>c8(a=>!a),title:eY,children:[(0,d.jsx)("span",{className:"truncate",children:eY}),(0,d.jsx)("i",{className:(0,h.cn)("iconoir-nav-arrow-down text-[16px] shrink-0 transition-transform",c7&&"rotate-180"),"aria-hidden":"true"})]}),c7&&(0,d.jsx)("div",{className:"absolute left-0 top-full mt-2 z-50",children:e4})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>void eB(),disabled:cw||b8||bE,title:"Fetch latest changes from all remotes",children:[cw?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-refresh text-[16px]","aria-hidden":"true"}),"Fetch"]}),(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{eR&&!e$&&ew(eR)},disabled:!!e$||b8||bE,title:e$||`Pull from ${eZ?.upstream}`,children:[cs?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-arrow-down text-[16px]","aria-hidden":"true"}),"Pull"]}),(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{eR&&!e_&&es(eR)},disabled:!!e_||b8||bE,title:e_||(eZ?`Push to ${eZ.upstream}`:"Push current branch to remote"),children:[b4?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-arrow-up text-[16px]","aria-hidden":"true"}),"Push"]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-hidden relative",children:d3&&z?(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg opacity-50"})}):(0,d.jsx)(k,{ref:c0,commits:d$,selectedHash:E||void 0,selectedHashes:d_,onSelectCommit:d1,onResetToCommit:eE,onRevertCommit:(a,b)=>{cP({hash:a,message:b}),cN(!0)},onCreateTag:a=>{X(a),Z(""),_(!1),V(!0)},onCherryPickCommit:(a,b)=>{av([{hash:a,message:b}]),at(!0)},onCherryPickSelectedCommits:()=>{d2.length<2||(av(d2.map(a=>({hash:a.hash,message:a.message}))),at(!0))},onRewordCommit:(a,b,c,d)=>{cV({hash:a,subject:b,body:c,branch:d}),cX(b),cZ(c),cT(!0)},localBranches:u?.branches||[],trackingInfo:u?.trackingInfo,onEndReached:()=>{!t&&j.all.length>=c&&g(a=>a+50)},isLoadingMore:t&&c>100,currentBranch:u?.current,hiddenBranches:d4,getBranchTagContextMenuItems:a=>{if(a.startsWith("tag:")){let b=a.replace(/^tag:\s*/,"").trim();return b?[{label:"Delete Tag",onClick:()=>ee(b),danger:!0}]:null}if(e1.has(a))return e0({branchRef:a,branchLeafName:a.split("/").pop()||a,currentBranch:eR,isRemote:!1});let b=e2.get(a);return b?e0({branchRef:b,branchLeafName:b.split("/").pop()||a,currentBranch:eR,isRemote:!0}):null}})}),E&&(0,d.jsxs)("div",{className:"flex flex-col overflow-hidden border-t border-base-300 bg-base-200/30",style:{height:ds},children:[(0,d.jsx)("div",{className:(0,h.cn)("h-1.5 cursor-ns-resize flex items-center justify-center hover:bg-base-200 transition-colors group shrink-0",du&&"bg-base-200"),onMouseDown:dC,children:(0,d.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-content/20 transition-colors"})}),(0,d.jsxs)("div",{className:"flex flex-row items-center py-2 px-4 border-b border-base-300 bg-base-100 shrink-0 justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"text-sm font-bold truncate",children:j.all.find(a=>a.hash===E)?.message}),(0,d.jsx)("span",{className:"text-xs font-mono opacity-50 shrink-0",children:E.substring(0,7)})]}),(0,d.jsx)("div",{className:"flex items-center gap-1 shrink-0",children:(0,d.jsx)("button",{className:"ml-2 btn btn-ghost btn-xs btn-square",onClick:()=>K(null),title:"Close",children:"✕"})})]}),(0,d.jsxs)("div",{ref:dB,className:"flex-1 overflow-hidden bg-base-100 grid",style:{gridTemplateRows:`${dx}fr 6px ${1-dx}fr`},children:[(0,d.jsxs)("div",{className:"border-b border-base-300 bg-base-100 min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-3 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60",children:"Message"}),(0,d.jsx)("div",{className:"px-4 pb-3 overflow-auto flex-1 min-h-0",children:(0,d.jsx)("div",{className:"text-xs opacity-70 whitespace-pre-wrap font-mono",children:j.all.find(a=>a.hash===E)?.body||"No additional message"})})]}),(0,d.jsx)("div",{className:(0,h.cn)("cursor-ns-resize flex items-center justify-center hover:bg-base-200/60 transition-colors",dz&&"bg-base-200/60"),onMouseDown:dD,children:(0,d.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300"})}),(0,d.jsxs)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-2 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60 border-b border-base-300 bg-base-100 shrink-0",children:"Changes"}),(0,d.jsx)("div",{className:"flex-1 min-h-0",children:(0,d.jsx)(v,{repoPath:a,commitHash:E})})]})]})]})]})]}):(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-70",children:"No history data available"})}}};
|
|
5
|
+
${c}`:b),branch:cV.branch}}),dq()}catch(a){console.error(a)}finally{c0(!1)}}},eK=a=>{if(!(a instanceof Error))return!1;let b=a.message.toLowerCase();return b.includes("cherry-pick")&&b.includes("already in progress")},eL=a=>{if(!(a instanceof Error))return!1;let b=a.message.toLowerCase();return b.includes("could not apply")||b.includes("conflict")||b.includes("cherry-pick --continue")},eM=(0,g.useCallback)(async b=>{1===b.length?await M({repoPath:a,action:"cherry-pick",data:{commitHash:b[0]}}):await M({repoPath:a,action:"cherry-pick-multiple",data:{commitHashes:b}})},[a,M]),eN=(0,g.useCallback)(async()=>{try{await M({repoPath:a,action:"cherry-pick-abort"})}catch(a){console.error(a)}finally{au(!1),aA(!1),aw([])}},[a,M]),eO=async()=>{if(0!==av.length){ay(!0);try{let a=av.map(a=>a.hash);await eM(a),au(!1),aw([])}catch(a){eK(a)?(au(!1),aA(!0)):eL(a)&&await eN(),console.error(a)}finally{ay(!1)}}},eP=async()=>{if(0===av.length)return void aA(!1);aC(!0);try{await M({repoPath:a,action:"cherry-pick-abort"});let b=av.map(a=>a.hash);await eM(b),aA(!1),aw([])}catch(a){eK(a)?aA(!0):eL(a)&&await eN(),console.error(a)}finally{aC(!1)}},eQ=async()=>{if(P){U(!0);try{await M({repoPath:a,action:"branch",data:{branch:P,fromRef:R||void 0}}),O(!1),Q(""),S(null)}catch(a){console.error(a)}finally{U(!1)}}},eR=a=>{S(a||null),O(!0)},eS=async()=>{if(X&&Z.trim()){ac(!0);try{await M({repoPath:a,action:"create-tag",data:{tagName:Z.trim(),commitHash:X,pushToRemote:_}}),W(!1),Y(null),$(""),aa(!1)}catch(a){console.error(a)}finally{ac(!1)}}},eT=v?.current,eU=v?.trackingInfo,eV=(0,g.useMemo)(()=>Object.keys(v?.remoteUrls??{}).sort((a,b)=>"origin"===a?-1:"origin"===b?1:a.localeCompare(b)),[v?.remoteUrls])[0]||null,eW=(0,g.useMemo)(()=>{let a=[];for(let b of af){if(b.startsWith("remotes/"))continue;let c=eU?.[b]?.upstream;c&&a.push(c)}return Array.from(new Set(a))},[af,eU]),eX=(0,g.useMemo)(()=>!aF||aH?null:eU?.[aF]??null,[aF,aH,eU]),eY=B?.files?.length,eZ=eT||(A?"Loading branches...":"Detached HEAD"),e$=eT&&"number"==typeof eY&&eY>0?`${eT} (${eY})`:eZ,e_=(0,g.useMemo)(()=>{if(!eT)return null;let a=eU?.[eT];if(!a?.upstream)return null;let b=a.upstream.indexOf("/");return b<=0?null:{upstream:a.upstream,remote:a.upstream.slice(0,b),branch:a.upstream.slice(b+1)}},[eT,eU]),e0=(0,g.useMemo)(()=>A?"Loading branches...":eT?e_?null:`Branch "${eT}" has no tracking remote branch`:"Not on a local branch",[eT,e_,A]),e1=(0,g.useMemo)(()=>A?"Loading branches...":eT?null:"Not on a local branch",[eT,A]),e2=a=>{let b=function(a,b){let{branchRef:c,branchLeafName:e,currentBranch:f,isRemote:g,selectedBranchRefs:h}=a,i=!g&&c===f,j=h&&h.length>0?h:[c],k=j.length>1,l=[];return i||g||l.push({label:"Checkout",onClick:()=>b.onCheckout(c)}),g&&l.push({label:"Checkout to local",onClick:()=>b.onCheckoutToLocal(c)}),l.push({label:"Create Branch",onClick:()=>b.onCreateBranch(c)}),g||l.push({label:"Rename Branch",onClick:()=>b.onRenameBranch(c)}),g&&l.push({label:"Rename branch",onClick:()=>b.onRenameRemoteBranch(c)}),g||l.push({label:"Push to Remote",onClick:()=>b.onPushToRemote(c)}),g||l.push({label:"Pull from Remote",onClick:()=>b.onPullFromRemote(c)}),!i&&f&&(l.push({label:`Rebase ${f} onto ${e}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Rebase ",(0,d.jsx)("span",{className:"font-bold",children:f})," onto ",e]}),onClick:()=>b.onRebase({sourceBranch:f,targetBranch:c})}),l.push({label:`Rebase ${e} onto ${f}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Rebase ",e," onto ",(0,d.jsx)("span",{className:"font-bold",children:f})]}),onClick:()=>b.onRebase({sourceBranch:c,targetBranch:f})}),l.push({label:`Merge ${f} into ${e}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Merge ",(0,d.jsx)("span",{className:"font-bold",children:f})," into ",e]}),onClick:()=>b.onMerge({sourceBranch:f,targetBranch:c})}),l.push({label:`Merge ${e} into ${f}`,labelNode:(0,d.jsxs)(d.Fragment,{children:["Merge ",e," into ",(0,d.jsx)("span",{className:"font-bold",children:f})]}),onClick:()=>b.onMerge({sourceBranch:c,targetBranch:f})})),i||(k?l.push({label:`Delete Selected Branches (${j.length})`,onClick:()=>b.onDeleteBranches(j),danger:!0}):l.push({label:g?"Delete Remote Branch":"Delete Branch",onClick:()=>b.onDeleteBranch(c),danger:!0})),l}(a,{onCheckout:eF,onCheckoutToLocal:eB,onCreateBranch:eR,onDeleteBranch:ee,onDeleteBranches:ed,onRenameBranch:ej,onRenameRemoteBranch:ek,onRebase:ep,onMerge:er,onPushToRemote:eu,onPullFromRemote:ey});return dK.length>0&&b.push({label:"Custom scripts",children:dK.map(b=>({label:b.name,onClick:()=>{ea(b,a.branchRef)}}))}),b},e3=(0,g.useMemo)(()=>new Set(v?.branches??[]),[v?.branches]),e4=(0,g.useMemo)(()=>{let a=new Map;if(!v?.remotes)return a;for(let[b,c]of Object.entries(v.remotes))for(let d of c)a.set(`${b}/${d}`,`remotes/${b}/${d}`);return a},[v?.remotes]),e5=(0,g.useMemo)(()=>dF?D(dF).filter(a=>a!==eT):[],[dF,eT]),e6=(0,d.jsxs)("div",{className:"w-[22rem] max-w-[calc(100vw-2rem)] flex flex-col border border-base-300 bg-base-100 rounded-box shadow-xl overflow-hidden",children:[(0,d.jsxs)("div",{className:"px-4 border-b border-base-300 flex items-center justify-between bg-base-100 h-[57px] shrink-0",children:[(0,d.jsx)("h2",{className:"font-bold text-lg",children:"Branches"}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[d5&&(0,d.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Clear filters",children:(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:dZ,children:(0,d.jsx)("i",{className:"iconoir-filter text-[16px]","aria-hidden":"true"})})}),(0,d.jsx)("div",{className:"tooltip tooltip-left z-20","data-tip":"Create Branch",children:(0,d.jsx)("button",{className:"btn btn-ghost btn-xs btn-square",onClick:()=>eR(),children:(0,d.jsx)("i",{className:"iconoir-plus-circle text-[16px]","aria-hidden":"true"})})})]})]}),(0,d.jsx)("div",{className:"max-h-[70vh] overflow-auto",children:(0,d.jsxs)("div",{className:"p-2 space-y-0.5",children:[dF&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j,{items:[{label:"Delete",onClick:()=>ed(e5),danger:!0,disabled:0===e5.length}],children:(0,d.jsx)(z,{name:"Branches",groupPath:"__local__",icon:(0,d.jsx)("i",{className:"iconoir-git-branch text-[14px]","aria-hidden":"true"}),isExpanded:dL,onToggle:dV,visibilityMap:dP,onToggleVisibility:dY})}),dL&&(0,d.jsx)(E,{node:dF,currentBranch:v?.current,expandedFolders:dR,onToggleFolder:dX,onCheckout:eF,onCheckoutToLocal:eB,onCreateBranch:()=>eR(),onDeleteBranch:ee,onRenameBranch:ej,onRenameRemoteBranch:ek,onRebase:ep,onMerge:er,onPushToRemote:eu,onPullFromRemote:ey,getBranchContextMenuItems:e2,onBranchClick:d8,onBranchContextMenu:d9,onDeleteBranchGroup:ed,selectedBranches:dH,visibilityMap:dP,onToggleVisibility:dY,depth:1,groupPath:"__local__",trackingInfo:v?.trackingInfo})]}),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j,{items:[{label:"Fetch from all remotes",onClick:eD},{label:"Add remote",onClick:()=>{a4("origin"),a6(""),a2(!0)}}],children:(0,d.jsx)(z,{name:"Remotes",groupPath:"__remotes__",icon:(0,d.jsx)("i",{className:"iconoir-globe text-[14px]","aria-hidden":"true"}),isExpanded:dN,onToggle:dW,visibilityMap:dP,onToggleVisibility:dY})}),dN&&A&&!dG&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-2 py-2 text-sm opacity-70",style:{paddingLeft:"20px"},children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsx)("span",{children:"Loading remotes..."})]}),dN&&dG&&Array.from(dG.entries()).map(([a,b])=>{let c=`__remotes__/${a}`,e=dR.has(c);return(0,d.jsxs)("div",{children:[(0,d.jsx)(j,{items:[{label:`Fetch from ${a}`,onClick:()=>eE(a)},{label:"Rename",onClick:()=>{aS(a),aU(a),aQ(!0)}},{label:"Delete",onClick:()=>{a&&(a$(a),aY(!0))},danger:!0}],children:(0,d.jsx)(z,{name:a,groupPath:c,icon:(0,d.jsx)("i",{className:"iconoir-globe text-[14px] opacity-50","aria-hidden":"true"}),isExpanded:e,onToggle:()=>dX(c),visibilityMap:dP,onToggleVisibility:dY,depth:1})}),e&&(0,d.jsx)(E,{node:b,currentBranch:v?.current,expandedFolders:dR,onToggleFolder:dX,onCheckout:eF,onCheckoutToLocal:eB,onCreateBranch:()=>eR(),onDeleteBranch:ee,onRenameBranch:ej,onRenameRemoteBranch:ek,onRebase:ep,onMerge:er,onPushToRemote:eu,onPullFromRemote:ey,getBranchContextMenuItems:e2,onBranchClick:d8,onBranchContextMenu:d9,onDeleteBranchGroup:ed,selectedBranches:dH,visibilityMap:dP,onToggleVisibility:dY,depth:2,groupPath:c,isRemote:!0,trackingInfo:v?.trackingInfo})]},a)})]})]})})]});return m&&100===c?(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner text-base-content/50"})}):n?(0,d.jsxs)("div",{className:"flex items-center justify-center p-8 h-full flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-error font-medium",children:"Error Loading History"}),(0,d.jsx)("p",{className:"text-sm opacity-70",children:o?.message||"An unknown error occurred"}),(0,d.jsxs)("button",{onClick:()=>t(),className:"btn btn-outline btn-sm",children:[(0,d.jsx)("i",{className:"iconoir-refresh-circle text-[16px] mr-1","aria-hidden":"true"}),"Try Again"]})]}):k?(0,d.jsxs)("div",{className:"flex h-full overflow-hidden",children:[cH&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Reset to Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to hard reset the current branch to commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cJ?.substring(0,7)}),"?",(0,d.jsx)("br",{}),(0,d.jsx)("span",{className:"text-error font-bold",children:"Warning: This will discard all local changes and commits after this point. This action cannot be undone."})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>cI(!1),disabled:cL,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:eH,disabled:cL,children:[cL&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reset"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>cI(!1),children:"close"})})]}),cN&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Revert Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to revert commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cP?.hash.substring(0,7)})," on ",(0,d.jsx)("span",{className:"font-bold break-all",children:v?.current||"current"}),"?"]}),cP?.message&&(0,d.jsx)("div",{className:"rounded border border-base-300 bg-base-200/40 px-3 py-2 text-xs break-words",children:cP.message}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{cO(!1),cQ(null)},disabled:cR,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eI,disabled:cR,children:[cR&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Revert"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{cO(!1),cQ(null)},children:"close"})})]}),cT&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Reword Commit"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Reword commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:cV?.hash.substring(0,7)})," on branch ",(0,d.jsx)("span",{className:"font-bold",children:cV?.branch}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono text-sm mb-3",value:cX,onChange:a=>cY(a.target.value),autoFocus:!0,onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&cX.trim()&&!c_&&(a.preventDefault(),eJ())},placeholder:"Commit subject",disabled:c_}),(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full h-32 font-mono text-sm",value:cZ,onChange:a=>c$(a.target.value),onKeyDown:a=>{(a.metaKey||a.ctrlKey)&&"Enter"===a.key&&cX.trim()&&!c_&&(a.preventDefault(),eJ())},placeholder:"Commit message body (optional)",disabled:c_}),cV?.branch!==v?.current&&(0,d.jsx)("div",{className:"alert alert-warning text-xs mt-2 py-2",children:(0,d.jsxs)("span",{children:["This will briefly checkout ",(0,d.jsx)("b",{children:cV?.branch})," to amend the commit."]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dq,disabled:c_,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eJ,disabled:!cX.trim()||c_,children:[c_&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Reword"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dq,children:"close"})})]}),ad&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:af.length>1?"Delete Branches":"Delete Branch"}),af.length>1?(0,d.jsxs)("div",{className:"py-4 space-y-3",children:[(0,d.jsxs)("p",{className:"break-words",children:["Are you sure you want to delete ",(0,d.jsxs)("span",{className:"font-bold",children:[af.length," selected branches"]}),"? This action cannot be undone."]}),(0,d.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:af.map(a=>(0,d.jsx)("div",{className:"text-xs min-w-0 break-all",children:a.startsWith("remotes/")?a.slice(8):a},a))})]}):(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the branch ",(0,d.jsx)("span",{className:"font-bold break-all",children:af[0]?.startsWith("remotes/")?af[0].slice(8):af[0]}),"? This action cannot be undone."]}),eW.length>0&&(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ah,onChange:a=>ai(a.target.checked),disabled:aj}),(0,d.jsx)("span",{className:"label-text break-words whitespace-normal",children:1===eW.length?(0,d.jsxs)(d.Fragment,{children:["Delete tracking remote branch ",(0,d.jsx)("span",{className:"font-mono opacity-70 break-all",children:eW[0]})]}):(0,d.jsxs)(d.Fragment,{children:["Delete ",eW.length," tracking remote branches"]})})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{ae(!1),ag([]),ai(!1)},disabled:aj,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:eh,disabled:aj,children:[aj&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{ae(!1),ag([]),ai(!1)},children:"close"})})]}),al&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Delete Tag"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete the tag ",(0,d.jsx)("span",{className:"font-bold break-all",children:an}),"? This action cannot be undone."]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:ap,onChange:a=>aq(a.target.checked),disabled:ar||!eV}),(0,d.jsx)("span",{className:"label-text break-words whitespace-normal",children:eV?(0,d.jsxs)(d.Fragment,{children:["Also delete from remote ",(0,d.jsx)("span",{className:"font-mono opacity-70",children:eV})]}):"No remote configured"})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:ef,disabled:ar,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:ei,disabled:ar||!an,children:[ar&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:ef,children:"close"})})]}),at&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick"}),(0,d.jsx)("p",{className:"text-sm opacity-70 mt-1",children:av.length>1?"Apply selected commits from oldest to newest":"Apply changes from the selected commit"}),1===av.length?(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure to apply ",(0,d.jsx)("span",{className:"font-bold font-mono break-all",children:av[0]?.hash})," ",(0,d.jsx)("span",{className:"font-bold break-words",children:av[0]?.message})," to ",(0,d.jsx)("span",{className:"font-bold break-all",children:v?.current||"current"})," branch?"]}):(0,d.jsxs)("div",{className:"py-4 space-y-3",children:[(0,d.jsxs)("p",{className:"break-words",children:["Are you sure to apply ",(0,d.jsxs)("span",{className:"font-bold",children:[av.length," selected commits"]})," to ",(0,d.jsx)("span",{className:"font-bold break-all",children:v?.current||"current"})," branch?"]}),(0,d.jsx)("div",{className:"max-h-44 overflow-auto rounded border border-base-300 bg-base-200/40 p-2 space-y-1",children:av.map(a=>(0,d.jsxs)("div",{className:"text-xs min-w-0",children:[(0,d.jsx)("span",{className:"font-mono opacity-70",children:a.hash.slice(0,7)})," ",(0,d.jsx)("span",{className:"break-words",children:a.message})]},a.hash))})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{au(!1),aw([])},disabled:ax,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eO,disabled:ax,children:[ax&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{au(!1),aw([])},children:"close"})})]}),az&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Cherry Pick In Progress"}),(0,d.jsx)("p",{className:"text-sm opacity-70 mt-1",children:"Another cherry-pick operation is currently in progress."}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Abort the in-progress cherry-pick and continue with ",av.length>1?"the selected commits":"this commit","?"]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{aA(!1),aw([])},disabled:aB,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-warning",onClick:()=>void eP(),disabled:aB,children:[aB&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Abort and Continue"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{aA(!1),aw([])},children:"close"})})]}),aD&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:aH?"Rename Remote Branch":"Rename Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for the branch ",(0,d.jsx)("span",{className:"font-bold break-all",children:aF}),". Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:aJ,onChange:a=>aK((0,i.L9)(a.target.value)),placeholder:"New branch name",disabled:aN,autoFocus:!0,onKeyDown:a=>{let b="Enter"===a.key&&(a.metaKey||a.ctrlKey),c=aH?aJ===aH.branch:aJ===aF;b&&aJ&&!c&&!aN&&el()}}),!aH&&eX?.upstream&&(0,d.jsx)("div",{className:"form-control mt-2",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start items-start gap-2 min-w-0",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:aL,onChange:a=>aM(a.target.checked),disabled:aN}),(0,d.jsxs)("span",{className:"label-text break-words whitespace-normal",children:["Also rename tracking remote branch ",(0,d.jsx)("span",{className:"font-mono opacity-70 break-all",children:eX.upstream})]})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dl,disabled:aN,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:el,disabled:!aJ||(aH?aJ===aH.branch:aJ===aF)||aN,children:[aN&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dl,children:"close"})})]}),aP&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Rename Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Enter a new name for remote ",(0,d.jsx)("span",{className:"font-bold break-all",children:aR}),". Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:aT,onChange:a=>aU(a.target.value),placeholder:"New remote name",disabled:aV,autoFocus:!0,onKeyDown:a=>{let b="Enter"===a.key&&(a.metaKey||a.ctrlKey),c=aT.trim(),d=c===(aR??"").trim();b&&c&&!d&&!aV&&em()}}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dm,disabled:aV,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:em,disabled:!aT.trim()||aT.trim()===(aR??"").trim()||aV,children:[aV&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Rename"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dm,children:"close"})})]}),aX&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Delete Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Are you sure you want to delete remote ",(0,d.jsx)("span",{className:"font-bold break-all",children:aZ}),"? This removes all tracking branches for that remote."]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dn,disabled:a_,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-error",onClick:en,disabled:!aZ||a_,children:[a_&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Delete"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dn,children:"close"})})]}),a1&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Add Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Add a new remote by providing a name and URL. Press ",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Cmd"}),"+",(0,d.jsx)("kbd",{className:"kbd kbd-sm",children:"Enter"})," to confirm."]}),(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"label pt-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote name"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:a3,onChange:a=>a4(a.target.value),placeholder:"origin",disabled:a7,autoFocus:!0})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"label pt-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote URL"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:a5,onChange:a=>a6(a.target.value),placeholder:"https://github.com/owner/repo.git",disabled:a7,onKeyDown:a=>{"Enter"===a.key&&(a.metaKey||a.ctrlKey)&&a3.trim()&&a5.trim()&&!a7&&eo()}})]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:dp,disabled:a7,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eo,disabled:!a3.trim()||!a5.trim()||a7,children:[a7&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Add"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:dp,children:"close"})})]}),a9&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Rebase"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Copy commits from one branch to another.",(0,d.jsx)("br",{}),"Are you sure to rebase ",(0,d.jsx)("span",{className:"font-bold break-all",children:bb})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bd}),"?"]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bf,onChange:a=>bg(a.target.checked),disabled:bh}),(0,d.jsx)("span",{className:"label-text",children:"Stash and reapply local changes"})]})}),!bf&&(0,d.jsx)("p",{className:"text-xs text-warning mt-2 ml-6",children:"Warning: All local changes will be discarded."}),"checking"===bj?(0,d.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsxs)("span",{children:["Checking conflicts for rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:bb})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bd}),"..."]})]}):"no-conflict"===bj?(0,d.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["No conflict: rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:bb})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bd})," will not cause conflicts."]})]}):(0,d.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["Conflicts detected: rebasing ",(0,d.jsx)("span",{className:"font-bold break-all",children:bb})," onto ",(0,d.jsx)("span",{className:"font-bold break-all",children:bd})," will cause conflicts."]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:bl,disabled:bh,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eq,disabled:bh,children:[bh&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:bl,children:"close"})})]}),bm&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Merge"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Merge branch into another one.",(0,d.jsx)("br",{}),"Are you sure to merge ",(0,d.jsx)("span",{className:"font-bold break-all",children:bq})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bo}),"?"]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bs,onChange:a=>bt(a.target.checked),disabled:bA}),(0,d.jsx)("span",{className:"label-text",children:"Rebase before merge"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bu,onChange:a=>es(a.target.checked),disabled:bA}),(0,d.jsx)("span",{className:"label-text",children:"Squash before merge"})]})}),bu&&(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full mt-2",placeholder:"Commit message for squash merge",value:by,onChange:a=>bz(a.target.value),disabled:bA,autoFocus:!0}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bw,onChange:a=>bx(a.target.checked),disabled:bA}),(0,d.jsx)("span",{className:"label-text",children:"Fast forward merge"})]})}),"checking"===bC?(0,d.jsxs)("div",{className:"alert alert-info text-sm mt-4 py-2",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),(0,d.jsxs)("span",{children:["Checking conflicts for merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bq})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bo}),"..."]})]}):"no-conflict"===bC?(0,d.jsxs)("div",{className:"alert alert-success text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-check-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["No conflict: merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bq})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bo})," will not cause conflicts."]})]}):(0,d.jsxs)("div",{className:"alert alert-warning text-sm mt-4 py-2",children:[(0,d.jsx)("i",{className:"iconoir-warning-circle-solid text-[18px]","aria-hidden":"true"}),(0,d.jsxs)("span",{children:["Conflicts detected: merging ",(0,d.jsx)("span",{className:"font-bold break-all",children:bq})," into ",(0,d.jsx)("span",{className:"font-bold break-all",children:bo})," will cause conflicts."]})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:bE,disabled:bA,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:et,disabled:bA,children:[bA&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Confirm"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:bE,children:"close"})})]}),bF&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Push to Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Push ",(0,d.jsx)("span",{className:"font-bold break-all",children:bH})," to a remote repository."]}),b3&&0===bJ.length?(0,d.jsxs)("div",{className:"alert alert-error",children:[(0,d.jsx)("span",{className:"text-xl",children:"⚠️"}),(0,d.jsx)("span",{children:b3})]}):b5?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,d.jsx)("select",{className:"select select-bordered w-64",value:bL,onChange:a=>ev(a.target.value),disabled:b1,children:bJ.map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Branch"})}),(0,d.jsxs)("div",{className:"flex flex-col items-end gap-1 w-64",children:[b7?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-full",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,d.jsxs)("select",{className:"select select-bordered w-full",value:bP,onChange:a=>bQ(a.target.value),disabled:b1,children:[bH&&!bN.includes(bH)&&(0,d.jsxs)("option",{value:bH,children:[bH," (new)"]}),bN.map(a=>(0,d.jsxs)("option",{value:a,children:[a,bR?.remote===bL&&bR?.branch===a?" (tracking)":""]},a))]}),bP&&!bN.includes(bP)&&(0,d.jsx)("div",{className:"label",children:(0,d.jsx)("span",{className:"label-text-alt text-warning",children:"New branch will be created"})})]})]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bT,onChange:a=>bU(a.target.checked),disabled:b1||bV}),(0,d.jsx)("span",{className:"label-text",children:"Rebase onto remote branch before pushing"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm checkbox-error",checked:bV,onChange:a=>bW(a.target.checked),disabled:b1}),(0,d.jsx)("span",{className:"label-text text-error",children:"Force push"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bX,onChange:a=>bY(a.target.checked),disabled:b1}),(0,d.jsx)("span",{className:"label-text",children:"Push all tags"})]})}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:bZ,onChange:a=>ew(a.target.checked),disabled:b1}),(0,d.jsx)("span",{className:"label-text",children:"Squash local commits before push"})]})}),bZ&&(0,d.jsx)("textarea",{className:"textarea textarea-bordered w-full",placeholder:"Commit message for squash",value:b_,onChange:a=>b0(a.target.value),disabled:b1,autoFocus:!0}),b3&&(0,d.jsx)("div",{className:"alert alert-error text-sm",children:(0,d.jsx)("span",{children:b3})})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>bG(!1),disabled:b1,children:"Cancel"}),bJ.length>0&&(0,d.jsxs)("button",{className:"btn btn-primary",onClick:ex,disabled:b1||!bL||!bP,children:[b1&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Push"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>bG(!1),children:"close"})})]}),b9&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Pull from Remote"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Pull changes from a remote branch into ",(0,d.jsx)("span",{className:"font-bold break-all",children:cb}),"."]}),cr&&0===cd.length?(0,d.jsx)("div",{className:"alert alert-error",children:(0,d.jsx)("span",{children:cr})}):ct?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg"})}):(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Repository"})}),(0,d.jsx)("select",{className:"select select-bordered w-64",value:cf,onChange:a=>ez(a.target.value),disabled:cp,children:cd.map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),(0,d.jsxs)("div",{className:"form-control w-full flex flex-row items-center justify-between gap-4",children:[(0,d.jsx)("label",{className:"label flex-shrink-0",children:(0,d.jsx)("span",{className:"label-text",children:"Remote Branch"})}),cv?(0,d.jsxs)("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-base-200 opacity-70 w-64",children:[(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Loading branches..."]}):(0,d.jsx)("select",{className:"select select-bordered w-64",value:cj,onChange:a=>ck(a.target.value),disabled:cp,children:ch.map(a=>(0,d.jsxs)("option",{value:a,children:[a,cl?.remote===cf&&cl?.branch===a?" (tracking)":""]},a))})]}),(0,d.jsx)("div",{className:"form-control",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:cn,onChange:a=>co(a.target.checked),disabled:cp}),(0,d.jsx)("span",{className:"label-text",children:"Rebase onto remote branch"})]})}),cr&&(0,d.jsx)("div",{className:"alert alert-error text-sm",children:(0,d.jsx)("span",{children:cr})})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>ca(!1),disabled:cp,children:"Cancel"}),cd.length>0&&(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eA,disabled:cp||!cf||!cj,children:[cp&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Pull"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>ca(!1),children:"close"})})]}),V&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Create Tag"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a new tag at commit ",(0,d.jsx)("span",{className:"font-mono bg-base-200 px-1 rounded",children:X?.substring(0,7)}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full font-mono",value:Z,onChange:a=>$(a.target.value),placeholder:"Tag name",disabled:ab,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&Z.trim()&&!ab&&eS()}}),(0,d.jsx)("div",{className:"form-control mt-3",children:(0,d.jsxs)("label",{className:"label cursor-pointer justify-start gap-2",children:[(0,d.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:_,onChange:a=>aa(a.target.checked),disabled:ab}),(0,d.jsx)("span",{className:"label-text",children:"Push tag to remote after creation"})]})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{W(!1),Y(null),$(""),aa(!1)},disabled:ab,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eS,disabled:!Z.trim()||ab,children:[ab&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Create"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{W(!1),Y(null),$(""),aa(!1)},children:"close"})})]}),N&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Create New Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a new branch from"," ",(0,d.jsx)("span",{className:"font-bold break-all",children:R?R.replace(/^remotes\//,""):"current HEAD"}),"."]}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:P,onChange:a=>Q((0,i.L9)(a.target.value)),placeholder:"Branch name",disabled:T,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&P&&!T&&eQ()}}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>{O(!1),S(null)},disabled:T,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eQ,disabled:!P||T,children:[T&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Create & Checkout"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>{O(!1),S(null)},children:"close"})})]}),cz&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box",children:[(0,d.jsx)("h3",{className:"font-bold text-lg",children:"Checkout to Local Branch"}),(0,d.jsxs)("p",{className:"py-4 break-words",children:["Create a local branch from ",(0,d.jsx)("span",{className:"font-bold break-all",children:cB?.replace(/^remotes\//,"")})," and set up tracking."]}),(0,d.jsxs)("div",{className:"form-control w-full",children:[(0,d.jsx)("label",{className:"label",children:(0,d.jsx)("span",{className:"label-text",children:"Local Branch Name"})}),(0,d.jsx)("input",{type:"text",className:"input input-bordered w-full",value:cD,onChange:a=>cE((0,i.L9)(a.target.value)),placeholder:"Local branch name",disabled:cF,autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&cD&&!cF&&eC()}})]}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsx)("button",{className:"btn",onClick:()=>cA(!1),disabled:cF,children:"Cancel"}),(0,d.jsxs)("button",{className:"btn btn-primary",onClick:eC,disabled:!cD||cF,children:[cF&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"})," Checkout"]})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:()=>cA(!1),children:"close"})})]}),db.isOpen&&(0,d.jsxs)("dialog",{className:"modal modal-open",children:[(0,d.jsxs)("div",{className:"modal-box max-w-4xl",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)("h3",{className:"font-bold text-lg truncate",children:["Custom Script: ",db.scriptName]}),(0,d.jsxs)("p",{className:"text-xs opacity-70 mt-1 break-all",children:["Branch: ",db.branchRef]})]}),(0,d.jsx)("span",{className:(0,i.cn)("badge badge-sm shrink-0","running"===db.status||"starting"===db.status?"badge-info":"completed"===db.status?"badge-success":"failed"===db.status?"badge-error":"canceled"===db.status?"badge-warning":"badge-ghost"),children:db.status})]}),(0,d.jsx)("div",{className:"mt-4 border border-base-300 rounded bg-base-200/40",children:(0,d.jsx)("pre",{className:"p-3 font-mono text-xs overflow-auto max-h-[50vh] whitespace-pre-wrap break-words",children:db.output||"Waiting for output..."})}),db.error&&(0,d.jsx)("div",{className:"alert alert-error py-2 mt-3",children:(0,d.jsx)("span",{children:db.error})}),(0,d.jsxs)("div",{className:"modal-action",children:[(0,d.jsxs)("button",{className:"btn btn-warning",onClick:()=>void eb(),disabled:!dj||dd,children:[dd&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),"Cancel"]}),(0,d.jsxs)("button",{className:"btn btn-outline",onClick:()=>void ec(),disabled:df,children:[df&&(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}),dh?"Copied":"Copy"]}),(0,d.jsx)("button",{className:"btn btn-primary",onClick:()=>{dc(s),di(!1),de(!1)},disabled:!dk,children:"Done"})]})]}),(0,d.jsx)("form",{method:"dialog",className:"modal-backdrop",children:(0,d.jsx)("button",{onClick:a=>{dk?(dc(s),di(!1),de(!1)):a.preventDefault()},children:"close"})})]}),(0,d.jsxs)("div",{className:"flex-1 flex flex-col min-w-0 bg-base-100",children:[(0,d.jsx)("div",{className:"h-[57px] flex items-center px-6 border-b border-base-300 shrink-0",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,d.jsx)("h1",{className:"font-bold text-lg",children:"History"}),(0,d.jsxs)("div",{className:"relative",ref:da,children:[(0,d.jsxs)("button",{className:"btn btn-sm gap-2 max-w-[24rem]",onClick:()=>c9(a=>!a),title:e$,children:[(0,d.jsx)("span",{className:"truncate",children:e$}),(0,d.jsx)("i",{className:(0,i.cn)("iconoir-nav-arrow-down text-[16px] shrink-0 transition-transform",c8&&"rotate-180"),"aria-hidden":"true"})]}),c8&&(0,d.jsx)("div",{className:"absolute left-0 top-full mt-2 z-50",children:e6})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>void eD(),disabled:cx||b9||bF,title:"Fetch latest changes from all remotes",children:[cx?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-refresh text-[16px]","aria-hidden":"true"}),"Fetch"]}),(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{eT&&!e0&&ey(eT)},disabled:!!e0||b9||bF,title:e0||`Pull from ${e_?.upstream}`,children:[ct?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-arrow-down text-[16px]","aria-hidden":"true"}),"Pull"]}),(0,d.jsxs)("button",{className:"btn btn-sm gap-2",onClick:()=>{eT&&!e1&&eu(eT)},disabled:!!e1||b9||bF,title:e1||(e_?`Push to ${e_.upstream}`:"Push current branch to remote"),children:[b5?(0,d.jsx)("span",{className:"loading loading-spinner loading-xs"}):(0,d.jsx)("i",{className:"iconoir-arrow-up text-[16px]","aria-hidden":"true"}),"Push"]})]})]})}),(0,d.jsx)("div",{className:"flex-1 overflow-hidden relative",children:d5&&A?(0,d.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,d.jsx)("span",{className:"loading loading-spinner loading-lg opacity-50"})}):(0,d.jsx)(l,{ref:c1,commits:d_,selectedHash:F||void 0,selectedHashes:d0,onSelectCommit:d3,onResetToCommit:eG,onRevertCommit:(a,b)=>{cQ({hash:a,message:b}),cO(!0)},onCreateTag:a=>{Y(a),$(""),aa(!1),W(!0)},onCherryPickCommit:(a,b)=>{aw([{hash:a,message:b}]),au(!0)},onCherryPickSelectedCommits:()=>{d4.length<2||(aw(d4.map(a=>({hash:a.hash,message:a.message}))),au(!0))},onRewordCommit:(a,b,c,d)=>{cW({hash:a,subject:b,body:c,branch:d}),cY(b),c$(c),cU(!0)},localBranches:v?.branches||[],trackingInfo:v?.trackingInfo,onEndReached:()=>{!u&&k.all.length>=c&&h(a=>a+50)},isLoadingMore:u&&c>100,currentBranch:v?.current,hiddenBranches:d6,getBranchTagContextMenuItems:a=>{if(a.startsWith("tag:")){let b=a.replace(/^tag:\s*/,"").trim();return b?[{label:"Delete Tag",onClick:()=>eg(b),danger:!0}]:null}if(e3.has(a))return e2({branchRef:a,branchLeafName:a.split("/").pop()||a,currentBranch:eT,isRemote:!1});let b=e4.get(a);return b?e2({branchRef:b,branchLeafName:b.split("/").pop()||a,currentBranch:eT,isRemote:!0}):null}})}),F&&(0,d.jsxs)("div",{className:"flex flex-col overflow-hidden border-t border-base-300 bg-base-200/30",style:{height:dt},children:[(0,d.jsx)("div",{className:(0,i.cn)("h-1.5 cursor-ns-resize flex items-center justify-center hover:bg-base-200 transition-colors group shrink-0",dv&&"bg-base-200"),onMouseDown:dD,children:(0,d.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300 group-hover:bg-base-content/20 transition-colors"})}),(0,d.jsxs)("div",{className:"flex flex-row items-center py-2 px-4 border-b border-base-300 bg-base-100 shrink-0 justify-between gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[(0,d.jsx)("span",{className:"text-sm font-bold truncate",children:d2?.message}),(0,d.jsx)("span",{className:"text-xs font-mono opacity-50 shrink-0",children:F.substring(0,7)})]}),(0,d.jsx)("div",{className:"flex items-center gap-1 shrink-0",children:(0,d.jsx)("button",{className:"ml-2 btn btn-ghost btn-xs btn-square",onClick:()=>L(null),title:"Close",children:"✕"})})]}),(0,d.jsxs)("div",{ref:dC,className:"flex-1 overflow-hidden bg-base-100 grid",style:{gridTemplateRows:`${dy}fr 6px ${1-dy}fr`},children:[(0,d.jsxs)("div",{className:"border-b border-base-300 bg-base-100 min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-3 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60",children:"Message"}),(0,d.jsx)("div",{className:"px-4 pb-3 overflow-auto flex-1 min-h-0",children:(0,d.jsx)("div",{className:"text-xs opacity-70 whitespace-pre-wrap font-mono",children:d2?(d2.body?.trim()?`${d2.message}
|
|
6
|
+
|
|
7
|
+
${d2.body}`:d2.message).replace(/\r\n/g,"\n").replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n"):"No additional message"})})]}),(0,d.jsx)("div",{className:(0,i.cn)("cursor-ns-resize flex items-center justify-center hover:bg-base-200/60 transition-colors",dA&&"bg-base-200/60"),onMouseDown:dE,children:(0,d.jsx)("div",{className:"w-8 h-1 rounded-full bg-base-300"})}),(0,d.jsxs)("div",{className:"flex-1 overflow-hidden min-h-0 flex flex-col",children:[(0,d.jsx)("div",{className:"px-4 pt-2 pb-1 text-[10px] uppercase tracking-wider font-bold opacity-60 border-b border-base-300 bg-base-100 shrink-0",children:"Changes"}),(0,d.jsx)("div",{className:"flex-1 min-h-0",children:(0,d.jsx)(w,{repoPath:a,commitHash:F})})]})]})]})]})]}):(0,d.jsx)("div",{className:"flex items-center justify-center p-8 h-full opacity-70",children:"No history data available"})}}};
|