@nice2dev/ui 1.0.24 β 1.0.26
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/CHANGELOG.md +57 -0
- package/dist/NiceErrorBoundary-B91z3IjT.cjs +1 -0
- package/dist/NiceErrorBoundary-CVybqo3l.js +770 -0
- package/dist/NiceErrorBoundary-D0NwBkFl.cjs +1 -0
- package/dist/NiceErrorBoundary-DQLk-68V.js +770 -0
- package/dist/NiceForm-8_p8P0uJ.js +5386 -0
- package/dist/NiceForm-BrBaLUkv.js +5386 -0
- package/dist/NiceForm-DkVFd5Z5.cjs +382 -0
- package/dist/NiceForm-DoiApS60.cjs +382 -0
- package/dist/NiceModal-C582SiK7.cjs +1 -0
- package/dist/NiceModal-CdiLaYTg.cjs +1 -0
- package/dist/NiceModal-D6Yj67eH.js +95 -0
- package/dist/NiceModal-sFJw1CWm.js +95 -0
- package/dist/NiceModuleLifecyclePanel-Bhd8VNjU.js +6856 -0
- package/dist/NiceModuleLifecyclePanel-Cn_nB4dg.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-D22ycAMQ.js +6817 -0
- package/dist/NiceModuleLifecyclePanel-shRuDyp3.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-CtyaW_b4.cjs +1 -0
- package/dist/NicePagination-Dnlho_8O.cjs +1 -0
- package/dist/NicePagination-hGlKrWYL.js +171 -0
- package/dist/NicePagination-kokSP8ls.js +171 -0
- package/dist/NicePinCodeInput-1YGb7l2o.cjs +696 -0
- package/dist/NicePinCodeInput-CZpYON--.js +13097 -0
- package/dist/NicePinCodeInput-DPUlM3E1.cjs +696 -0
- package/dist/NicePinCodeInput-xSuOVhE8.js +13097 -0
- package/dist/NiceSavedQueryPanel-C6pPtOAf.js +6893 -0
- package/dist/NiceSavedQueryPanel-DOixGvLP.cjs +596 -0
- package/dist/NiceSavedQueryPanel-DzB0g0ak.cjs +596 -0
- package/dist/NiceSavedQueryPanel-Mz4jAsGJ.js +6893 -0
- package/dist/NiceTabs-1o8cpB_-.js +1657 -0
- package/dist/NiceTabs-B-FDOecP.cjs +1 -0
- package/dist/NiceTabs-DHiA02RD.cjs +1 -0
- package/dist/NiceTabs-MBVJomax.js +1657 -0
- package/dist/NiceWindow-9zQsi0zF.cjs +1 -0
- package/dist/NiceWindow-DUOkdKuX.js +1592 -0
- package/dist/NiceWindow-Dq-xx9cw.js +1592 -0
- package/dist/NiceWindow-ZAAUD3LJ.cjs +1 -0
- package/dist/charts-B_lYNVMJ.cjs +761 -0
- package/dist/charts-CABhvyAA.js +4657 -0
- package/dist/charts-DNQXBPGB.js +4657 -0
- package/dist/charts-IP38F-wh.cjs +761 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BHZDvnBo.js +25364 -0
- package/dist/core-C7CI2mWz.js +25248 -0
- package/dist/core-C7PK1L9r.cjs +122 -0
- package/dist/core-CjUAwZ6z.cjs +122 -0
- package/dist/data-branching-BGw7O52F.js +6133 -0
- package/dist/data-branching-Bv-f_gZk.cjs +1 -0
- package/dist/data-branching-CNi8vtZ1.js +6133 -0
- package/dist/data-branching-Dz3xLUZM.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +19 -1
- package/dist/data.mjs +1 -1
- package/dist/devops-CX538_rA.js +7684 -0
- package/dist/devops-JwBTMk0A.cjs +17 -0
- package/dist/devops-ZWKP6vRh.cjs +17 -0
- package/dist/devops-draw6Jrm.js +7684 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +2 -2
- package/dist/index-BkLJ4tzy.js +68026 -0
- package/dist/index-CTe-G23X.cjs +5518 -0
- package/dist/index-CwOe80Ws.cjs +5518 -0
- package/dist/index-DGjd42Q9.js +68223 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +179 -1
- package/dist/index.mjs +822 -812
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +40 -0
- package/dist/navigation.mjs +4 -4
- package/dist/no-code-BndAN6hG.cjs +332 -0
- package/dist/no-code-CIf6wiUc.js +7133 -0
- package/dist/no-code-DKYzw5If.js +7133 -0
- package/dist/no-code-DSa5Yn6l.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +55 -55
- package/dist/style.css +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=require("react"),xe=require("./core-C7PK1L9r.cjs"),ue=["var(--color-success, #22c55e)","var(--color-primary, #3b82f6)","var(--color-warning, #f59e0b)","var(--color-accent-pink, #ec4899)","var(--color-accent, #8b5cf6)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--color-error, #ef4444)","var(--color-accent, #6366f1)","var(--nice-success, #84cc16)"],fe=24,ge=40,he=28,Re=6,Ie=4;function Be(x,j,w,P){const N=[],q=[],H=new Map;x.forEach((h,b)=>H.set(h.hash,b));const M=new Map,T=[],E=new Map;let U=0;const L=new Map;if(j.forEach(h=>{if(!h.lastCommit)return;const b=L.get(h.lastCommit)||[];b.push({type:h.isRemote?"remote":"branch",name:h.name,commit:h.lastCommit,color:h.isHead?"var(--color-success, #22c55e)":h.isRemote?"var(--text-muted, #6b7280)":"var(--color-primary, #3b82f6)"}),L.set(h.lastCommit,b)}),w.forEach(h=>{const b=L.get(h.commit)||[];b.push({type:"tag",name:h.name,commit:h.commit,color:"var(--color-warning, #f59e0b)"}),L.set(h.commit,b)}),P){const h=L.get(P)||[];h.push({type:"head",name:"HEAD",commit:P,color:"var(--color-error, #ef4444)"}),L.set(P,h)}return x.forEach((h,b)=>{let C=T.findIndex(S=>S===h.hash);C===-1&&(C=T.findIndex(S=>S===null),C===-1&&(C=T.length,T.push(null))),E.has(C)||(E.set(C,ue[U%ue.length]),U++),M.set(h.hash,C);const B=E.get(C)||ue[0];N.push({commit:h,x:C,y:b,color:B,refs:L.get(h.hash)||[]}),h.parents.forEach((S,z)=>{const v=H.get(S);if(v!==void 0){let A=M.get(S);A===void 0&&(z===0?(A=C,T[C]=S):(A=T.findIndex(Y=>Y===null),A===-1?(A=T.length,T.push(S)):T[A]=S),M.set(S,A));const G=E.get(A)||B;q.push({from:h.hash,to:S,fromX:C,fromY:b,toX:A,toY:v,color:z===0?B:G,type:z===0?C===A?"straight":"branch":"merge"})}}),(h.parents.length===0||!x.slice(b+1).some(S=>S.parents.includes(h.hash)))&&(T[C]=null)}),{nodes:N,edges:q}}const Me=({nodes:x,edges:j,selectedHash:w,compact:P,onNodeClick:N,onNodeDoubleClick:q})=>{const H=P?he:ge,M=P?Ie:Re,E=(Math.max(...x.map(b=>b.x),0)+2)*fe,U=(x.length+1)*H,L=b=>fe/2+b*fe,h=b=>H/2+b*H;return e.jsxs("svg",{width:E,height:U,style:{minWidth:E,minHeight:U,display:"block"},children:[j.map((b,C)=>{const B=L(b.fromX),S=h(b.fromY),z=L(b.toX),v=h(b.toY);if(b.type==="straight")return e.jsx("line",{x1:B,y1:S,x2:z,y2:v,stroke:b.color,strokeWidth:2},C);const A=(S+v)/2,G=`M ${B} ${S} C ${B} ${A}, ${z} ${A}, ${z} ${v}`;return e.jsx("path",{d:G,fill:"none",stroke:b.color,strokeWidth:2,strokeDasharray:b.type==="merge"?"4,2":void 0},C)}),x.map(b=>{const C=L(b.x),B=h(b.y),S=b.commit.hash===w,z=b.commit.isMerge;return e.jsxs("g",{onClick:()=>N(b.commit.hash),onDoubleClick:()=>q(b.commit.hash),style:{cursor:"pointer"},children:[S&&e.jsx("circle",{cx:C,cy:B,r:M+4,fill:"none",stroke:"var(--nice-bg, #fff)",strokeWidth:2}),e.jsx("circle",{cx:C,cy:B,r:M,fill:z?"var(--bg-elevated, #1e1e1e)":b.color,stroke:b.color,strokeWidth:z?2:0}),b.refs.length>0&&!P&&e.jsx("foreignObject",{x:C+10,y:B-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:b.refs.map((v,A)=>e.jsxs("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:500,background:`${v.color}22`,color:v.color,border:`1px solid ${v.color}44`},children:[v.type==="tag"?"π·οΈ ":v.type==="head"?"π ":"",v.name]},A))})})]},b.commit.hash)})]})},me=({commits:x,branches:j,tags:w,head:P,selectedCommit:N,branchFilter:q,authorFilter:H,dateRange:M,searchQuery:T,maxCommits:E=100,showRemotes:U=!0,showTags:L=!0,compact:h=!1,onCommitSelect:b,onCommitDoubleClick:C,onBranchCheckout:B,onBranchCreate:S,onTagCreate:z,onCherryPick:v,onRevert:A,onReset:G,onCompare:Y,onViewDiff:k,className:I,style:m,"data-testid":g})=>{const[y,J]=n.useState(N),[W,Z]=n.useState(null),[D,Q]=n.useState(!1),[O,d]=n.useState(null),l=n.useRef(null),r=N??y,o=n.useMemo(()=>{let u=x;if(q&&q.length>0){const $=new Set;j.filter(V=>q.includes(V.name)).forEach(V=>{V.lastCommit&&$.add(V.lastCommit)}),u=u.filter(V=>$.has(V.hash))}if(H&&H.length>0&&(u=u.filter($=>H.some(V=>$.author.name.toLowerCase().includes(V.toLowerCase())||$.author.email.toLowerCase().includes(V.toLowerCase())))),M&&(M.from&&(u=u.filter($=>$.date>=M.from)),M.to&&(u=u.filter($=>$.date<=M.to))),T&&T.trim()){const $=T.toLowerCase();u=u.filter(V=>V.hash.toLowerCase().includes($)||V.shortHash.toLowerCase().includes($)||V.message.toLowerCase().includes($)||V.author.name.toLowerCase().includes($))}return u.slice(0,E)},[x,q,H,M,T,E,j]),{nodes:t,edges:a}=n.useMemo(()=>Be(o,U?j:j.filter(u=>!u.isRemote),L?w:[],P),[o,j,w,P,U,L]),p=n.useMemo(()=>o.find(u=>u.hash===r),[o,r]),i=n.useCallback(u=>{if(D&&O)Y?.(O,u),Q(!1),d(null);else if(D)d(u);else{J(u);const $=o.find(V=>V.hash===u);$&&b?.($)}},[D,O,o,b,Y]),f=n.useCallback(u=>{const $=o.find(V=>V.hash===u);$&&(C?.($),k?.(u))},[o,C,k]),R=n.useCallback((u,$)=>{u.preventDefault(),Z({x:u.clientX,y:u.clientY,commit:$})},[]),re=n.useCallback(()=>Z(null),[]),X=u=>{const V=new Date().getTime()-u.getTime(),te=Math.floor(V/(1e3*60*60*24));return te===0?"Today":te===1?"Yesterday":te<7?`${te} days ago`:u.toLocaleDateString()},ee=h?he:ge;return e.jsxs("div",{className:`nice-git-graph ${I||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...m},"data-testid":g,onClick:re,children:[e.jsxs("div",{ref:l,style:{flex:1,overflow:"auto",display:"flex"},children:[e.jsx("div",{style:{flexShrink:0,borderRight:"1px solid var(--border-color, #333)"},children:e.jsx(Me,{nodes:t,edges:a,selectedHash:r,compact:h,onNodeClick:i,onNodeDoubleClick:f})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[t.map(u=>e.jsxs("div",{onClick:()=>i(u.commit.hash),onDoubleClick:()=>f(u.commit.hash),onContextMenu:$=>R($,u.commit),style:{height:ee,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:u.commit.hash===r?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderBottom:"1px solid var(--nice-bg-secondary, #2a2a2a)"},children:[u.commit.author.avatar?e.jsx("img",{src:u.commit.author.avatar,alt:"",style:{width:h?20:24,height:h?20:24,borderRadius:"50%",flexShrink:0}}):e.jsx("div",{style:{width:h?20:24,height:h?20:24,borderRadius:"50%",background:u.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:h?10:12,color:"var(--bg-primary, #fff)",fontWeight:600,flexShrink:0},children:u.commit.author.name.charAt(0).toUpperCase()}),e.jsx("div",{style:{flex:1,minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:h?12:13},children:u.commit.message}),u.commit.stats&&!h&&e.jsxs("div",{style:{display:"flex",gap:8,fontSize:11,color:"var(--text-muted, #888)",flexShrink:0},children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",u.commit.stats.additions]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",u.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:h?10:11,color:"var(--text-muted, #888)",fontFamily:"monospace",flexShrink:0},children:u.commit.shortHash}),!h&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted, #888)",flexShrink:0,width:100},children:u.commit.author.name}),e.jsx("span",{style:{fontSize:h?10:11,color:"var(--text-muted, #666)",flexShrink:0,width:h?60:80,textAlign:"right"},children:X(u.commit.date)})]},u.commit.hash)),o.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--text-muted, #666)",fontSize:13},children:"No commits match the filters"})]})]}),p&&!h&&e.jsxs("div",{style:{width:320,borderLeft:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[p.author.avatar?e.jsx("img",{src:p.author.avatar,alt:"",style:{width:32,height:32,borderRadius:"50%"}}):e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"var(--color-primary, #3b82f6)",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontWeight:600},children:p.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:p.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:p.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"var(--text-muted, #888)",fontFamily:"monospace"},children:p.hash})]}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsx("div",{style:{fontSize:14,fontWeight:500,marginBottom:8},children:p.message}),p.body&&e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #aaa)",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:p.body})]}),p.stats&&e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--border-color, #333)",display:"flex",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:20,fontWeight:600},children:p.stats.filesChanged}),e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)"},children:"files changed"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--color-success, #22c55e)"},children:["+",p.stats.additions]}),e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)"},children:"additions"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:20,fontWeight:600,color:"var(--color-error, #ef4444)"},children:["-",p.stats.deletions]}),e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)"},children:"deletions"})]})]}),e.jsxs("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[e.jsx("button",{onClick:()=>k?.(p.hash),style:{padding:"8px 12px",borderRadius:4,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"View Changes"}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>v?.(p.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Cherry Pick"}),e.jsx("button",{onClick:()=>A?.(p.hash),style:{flex:1,padding:"6px 10px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Revert"})]}),e.jsx("button",{onClick:()=>S?.(p.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Create Branch Here"}),e.jsx("button",{onClick:()=>z?.(p.hash),style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Create Tag Here"}),e.jsx("button",{onClick:()=>{Q(!0),d(p.hash)},style:{padding:"6px 10px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Compare with..."})]})]}),D&&e.jsxs("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",padding:"8px 16px",background:"var(--color-primary, #3b82f6)",borderRadius:4,fontSize:12,fontWeight:500},children:[O?`Select commit to compare with ${O.slice(0,7)}`:"Select first commit",e.jsx("button",{onClick:()=>{Q(!1),d(null)},style:{marginLeft:12,padding:"2px 8px",background:"var(--nice-overlay-light-20, rgba(255, 255, 255, 0.2))",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Cancel"})]}),W&&e.jsx("div",{style:{position:"fixed",left:W.x,top:W.y,background:"var(--bg-elevated, #252525)",border:"1px solid var(--border-color, #444)",borderRadius:6,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:160,zIndex:1e3},children:[{label:"View Changes",onClick:()=>k?.(W.commit.hash)},{label:"Cherry Pick",onClick:()=>v?.(W.commit.hash)},{label:"Revert",onClick:()=>A?.(W.commit.hash)},{divider:!0},{label:"Create Branch",onClick:()=>S?.(W.commit.hash)},{label:"Create Tag",onClick:()=>z?.(W.commit.hash)},{divider:!0},{label:"Reset Soft",onClick:()=>G?.(W.commit.hash,"soft")},{label:"Reset Mixed",onClick:()=>G?.(W.commit.hash,"mixed")},{label:"Reset Hard",onClick:()=>G?.(W.commit.hash,"hard"),danger:!0}].map((u,$)=>"divider"in u?e.jsx("div",{style:{height:1,background:"var(--bg-tertiary, #444)",margin:"4px 0"}},$):e.jsx("button",{onClick:()=>{u.onClick?.(),re()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in u&&u.danger?"var(--color-error, #ef4444)":"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:V=>{V.currentTarget.style.background="var(--bg-tertiary, #333)"},onMouseOut:V=>{V.currentTarget.style.background="transparent"},children:u.label},$))})]})},Te=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:me},Symbol.toStringTag,{value:"Module"})),be=({branches:x,currentBranch:j,defaultBranch:w="main",protectionRules:P=[],showRemotes:N=!0,selectedBranch:q,onBranchSelect:H,onCheckout:M,onCreateBranch:T,onDeleteBranch:E,onRenameBranch:U,onMerge:L,onRebase:h,onSetUpstream:b,onPush:C,onPull:B,onCompare:S,onProtectionChange:z,className:v,style:A,"data-testid":G})=>{const[Y,k]=n.useState(""),[I,m]=n.useState("all"),[g,y]=n.useState(),[J,W]=n.useState(!1),[Z,D]=n.useState(!1),[Q,O]=n.useState(!1),[d,l]=n.useState(""),[r,o]=n.useState(j||w),[t,a]=n.useState(""),[p,i]=n.useState(j||w),[f,R]=n.useState(null),re=q??g,X=n.useMemo(()=>{let c=x;if(I==="local"?c=c.filter(F=>!F.isRemote):I==="remote"?c=c.filter(F=>F.isRemote):N||(c=c.filter(F=>!F.isRemote)),Y.trim()){const F=Y.toLowerCase();c=c.filter(s=>s.name.toLowerCase().includes(F))}return c.sort((F,s)=>F.isHead?-1:s.isHead?1:F.name===w?-1:s.name===w?1:F.isRemote!==s.isRemote?F.isRemote?1:-1:F.name.localeCompare(s.name))},[x,I,N,Y,w]),ee=n.useMemo(()=>{const c=X.filter(s=>!s.isRemote),F=X.filter(s=>s.isRemote);return{local:c,remote:F}},[X]),u=n.useCallback(c=>{y(c),H?.(c)},[H]),$=n.useCallback((c,F)=>{c.preventDefault(),R({x:c.clientX,y:c.clientY,branch:F})},[]),V=n.useCallback(()=>R(null),[]),te=n.useCallback(()=>{d.trim()&&(T?.(d.trim(),r),l(""),W(!1))},[d,r,T]),ae=n.useCallback(()=>{t&&p&&t!==p&&(L?.(t,p),D(!1))},[t,p,L]),le=c=>{if(!c)return"-";const s=new Date().getTime()-c.getTime(),K=Math.floor(s/(1e3*60*60*24));return K===0?"Today":K===1?"Yesterday":K<7?`${K} days ago`:K<30?`${Math.floor(K/7)} weeks ago`:c.toLocaleDateString()},_=n.useMemo(()=>x.find(c=>c.name===re),[x,re]),ne=n.useCallback(c=>P.some(F=>new RegExp(F.pattern.replace(/\*/g,".*")).test(c)),[P]),se=ee.local,de=c=>{const F=c.name===re,s=c.isHead,K=c.name===w,oe=ne(c.name);return e.jsxs("div",{onClick:()=>u(c.name),onDoubleClick:()=>M?.(c.name),onContextMenu:ze=>$(ze,c),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",cursor:"pointer",background:F?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":s?"rgba(34, 197, 94, 0.08)":"transparent",borderLeft:s?"3px solid var(--nice-success, #22c55e)":"3px solid transparent"},children:[e.jsx("span",{style:{fontSize:16},children:c.isRemote?"βοΈ":s?"π":"πΏ"}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:s?600:400,color:s?"var(--color-success, #22c55e)":"var(--text-primary, #e0e0e0)"},children:c.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[K&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-primary-tint-15, #3b82f622)",color:"var(--color-primary, #3b82f6)",border:"1px solid #3b82f644"},children:"default"}),oe&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-warning-tint-15, #f59e0b22)",color:"var(--color-warning, #f59e0b)",border:"1px solid #f59e0b44"},children:"π protected"})]}),c.upstream&&(c.ahead||c.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"var(--text-muted, #888)"},children:[c.ahead?e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["β",c.ahead]}):null,c.behind?e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["β",c.behind]}):null]}),c.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"var(--text-muted, #666)",width:80,textAlign:"right"},children:le(c.lastCommit.date)})]},c.name)};return e.jsxs("div",{className:`nice-branch-manager ${v||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...A},"data-testid":G,onClick:V,children:[e.jsxs("div",{style:{width:350,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("span",{style:{fontSize:18},children:"π³"}),e.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Branches"}),e.jsxs("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:10,fontSize:11},children:[x.filter(c=>!c.isRemote).length," local"]})]}),e.jsx("input",{type:"text",placeholder:"Search branches...",value:Y,onChange:c=>k(c.target.value),style:{width:"100%",padding:"8px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",fontSize:12,marginBottom:8}}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","local","remote"].map(c=>e.jsx("button",{onClick:()=>m(c),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:I===c?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:c},c))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid var(--border-color, #333)",display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>W(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"+ New Branch"}),e.jsx("button",{onClick:()=>D(!0),style:{flex:1,padding:"8px 12px",borderRadius:4,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"‡ Merge"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[ee.local.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--text-muted, #888)",textTransform:"uppercase",background:"var(--bg-elevated, #252525)"},children:["Local (",ee.local.length,")"]}),ee.local.map(de)]}),N&&ee.remote.length>0&&I!=="local"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"8px 12px",fontSize:10,fontWeight:600,color:"var(--text-muted, #888)",textTransform:"uppercase",background:"var(--bg-elevated, #252525)",marginTop:8},children:["Remote (",ee.remote.length,")"]}),ee.remote.map(de)]}),X.length===0&&e.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--text-muted, #666)",fontSize:12},children:"No branches match the filter"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:_?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{padding:16,borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:_.isRemote?"βοΈ":_.isHead?"π":"πΏ"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:_.name}),_.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--text-muted, #888)"},children:_.description})]}),_.isHead&&e.jsx("span",{style:{padding:"4px 12px",borderRadius:4,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--color-success, #22c55e)",fontSize:12,fontWeight:500},children:"β Current"})]})}),e.jsxs("div",{style:{padding:16,borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:16},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)",marginBottom:4},children:"Upstream"}),e.jsx("div",{style:{fontSize:13},children:_.upstream||e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:"Not set"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)",marginBottom:4},children:"Sync Status"}),e.jsx("div",{style:{display:"flex",gap:8,fontSize:13},children:_.upstream?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["β ",_.ahead||0," ahead"]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["β ",_.behind||0," behind"]})]}):e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:"-"})})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #888)",marginBottom:4},children:"Last Commit"}),e.jsx("div",{style:{fontSize:13},children:_.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"var(--text-muted, #aaa)"},children:_.lastCommit.hash.slice(0,7)})," ",le(_.lastCommit.date)]}):e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:"-"})})]})]}),_.lastCommit&&e.jsxs("div",{style:{marginTop:16,padding:12,background:"var(--bg-elevated, #1e1e1e)",borderRadius:6,fontSize:12},children:[e.jsx("div",{style:{fontWeight:500,marginBottom:4},children:_.lastCommit.message}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:["by ",_.lastCommit.author]})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!_.isHead&&e.jsx("button",{onClick:()=>M?.(_.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"π Checkout"}),_.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>B?.(_.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"β Pull"}),e.jsx("button",{onClick:()=>C?.(_.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--color-accent, #8b5cf6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12,fontWeight:500},children:"β Push"})]}),!_.upstream&&!_.isRemote&&e.jsx("button",{onClick:()=>b?.(_.name,`origin/${_.name}`),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Set Upstream"}),e.jsx("button",{onClick:()=>{a(_.name),i(j||w),D(!0)},style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"‡ Merge into..."}),e.jsx("button",{onClick:()=>S?.(w,_.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"π Compare"}),!_.isHead&&!_.isRemote&&!ne(_.name)&&e.jsx("button",{onClick:()=>E?.(_.name),style:{padding:"10px 16px",borderRadius:6,border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"π Delete"})]})})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted, #666)",fontSize:13},children:"Select a branch to view details"})}),J&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>W(!1),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:24},onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:"Create New Branch"}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #888)",marginBottom:4},children:"Branch Name"}),e.jsx("input",{type:"text",placeholder:"feature/my-feature",value:d,onChange:c=>l(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},autoFocus:!0})]}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #888)",marginBottom:4},children:"Based on"}),e.jsx("select",{value:r,onChange:c=>o(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},children:se.map(c=>e.jsxs("option",{value:c.name,children:[c.name," ",c.isHead?"(current)":""]},c.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>W(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:te,disabled:!d.trim(),style:{padding:"10px 20px",borderRadius:6,border:"none",background:d.trim()?"var(--color-success, #22c55e)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:d.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Create Branch"})]})]})}),Z&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>D(!1),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:24},onClick:c=>c.stopPropagation(),children:[e.jsx("h3",{style:{margin:"0 0 16px",fontSize:16},children:"Merge Branches"}),e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #888)",marginBottom:4},children:"Merge from"}),e.jsxs("select",{value:t,onChange:c=>a(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:"Select branch..."}),se.map(c=>e.jsx("option",{value:c.name,children:c.name},c.name))]})]}),e.jsx("div",{style:{textAlign:"center",padding:"8px 0",color:"var(--text-muted, #888)"},children:"β into β"}),e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #888)",marginBottom:4},children:"Merge into"}),e.jsx("select",{value:p,onChange:c=>i(c.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},children:se.map(c=>e.jsxs("option",{value:c.name,children:[c.name," ",c.isHead?"(current)":""]},c.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>D(!1),style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:ae,disabled:!t||!p||t===p,style:{padding:"10px 20px",borderRadius:6,border:"none",background:t&&p&&t!==p?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:t&&p&&t!==p?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Merge"})]})]})}),f&&e.jsx("div",{style:{position:"fixed",left:f.x,top:f.y,background:"var(--bg-elevated, #252525)",border:"1px solid var(--border-color, #444)",borderRadius:6,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:160,zIndex:1e3},children:[!f.branch.isHead&&{label:"Checkout",onClick:()=>M?.(f.branch.name)},{label:"Compare",onClick:()=>S?.(w,f.branch.name)},{label:"Merge into current",onClick:()=>L?.(f.branch.name,j||w)},{divider:!0},!f.branch.isRemote&&{label:"Rename",onClick:()=>{const c=prompt("New name:",f.branch.name);c&&U?.(f.branch.name,c)}},!f.branch.isHead&&!f.branch.isRemote&&!ne(f.branch.name)&&{label:"Delete",onClick:()=>E?.(f.branch.name),danger:!0}].filter(Boolean).map((c,F)=>c?"divider"in c?e.jsx("div",{style:{height:1,background:"var(--bg-tertiary, #444)",margin:"4px 0"}},F):e.jsx("button",{onClick:()=>{c.onClick?.(),V()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in c&&c.danger?"var(--color-error, #ef4444)":"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:s=>s.currentTarget.style.background="var(--bg-tertiary, #333)",onMouseOut:s=>s.currentTarget.style.background="transparent",children:c.label},F):null)})]})},We=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:be},Symbol.toStringTag,{value:"Module"})),$e=[{target:".nice-merge-request-builder",titleKey:"tutorial.mergeRequestBuilder.intro.title",title:"Merge request builder",contentKey:"tutorial.mergeRequestBuilder.intro.content",content:"Pick source and target branches, write the title and description, add reviewers, labels and linked issues, then preview and submit.",placement:"auto"}],ve=({branches:x,users:j=[],labels:w=[],issues:P=[],templates:N=[],diff:q,currentBranch:H,defaultTargetBranch:M="main",initialSourceBranch:T,platform:E="github",onSubmit:U,onCancel:L,onBranchChange:h,onPreview:b,tutorial:C,className:B,style:S,"data-testid":z})=>{const[v,A]=n.useState(""),[G,Y]=n.useState(""),[k,I]=n.useState(T||H||""),[m,g]=n.useState(M),[y,J]=n.useState(!1),[W,Z]=n.useState([]),[D,Q]=n.useState([]),[O,d]=n.useState([]),[l,r]=n.useState([]),[o,t]=n.useState(!1),[a,p]=n.useState(!0),[i,f]=n.useState(!1),[R,re]=n.useState(!1),[X,ee]=n.useState(!1),[u,$]=n.useState(!1),V=n.useMemo(()=>k?k.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,K=>K.toUpperCase()):"",[k]),te=n.useMemo(()=>x.filter(s=>!s.isRemote),[x]),ae=n.useCallback((s,K)=>{I(s),g(K),h?.(s,K)},[h]),le=n.useCallback(()=>{if(!k||!m||!v.trim())return;const s={title:v.trim(),description:G.trim(),sourceBranch:k,targetBranch:m,isDraft:y,labels:W,reviewers:D,assignees:O,linkedIssues:l,squashCommits:o,deleteSourceBranch:a};U?.(s)},[v,G,k,m,y,W,D,O,l,o,a,U]),_=s=>{Y(s.content),$(!1)},ne=s=>{Z(K=>K.includes(s)?K.filter(oe=>oe!==s):[...K,s])},se=s=>{Q(K=>K.includes(s)?K.filter(oe=>oe!==s):[...K,s])},de=s=>{r(K=>K.includes(s)?K.filter(oe=>oe!==s):[...K,s])},c={github:{title:"Pull Request",btn:"Create Pull Request"},gitlab:{title:"Merge Request",btn:"Create Merge Request"},bitbucket:{title:"Pull Request",btn:"Create Pull Request"},azure:{title:"Pull Request",btn:"Create Pull Request"}},F=k&&m&&k!==m&&v.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${B||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",position:"relative",...S},"data-testid":z,children:[e.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:20},children:e.jsx(xe.Ll,{steps:xe.El(C,$e)})}),e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:"π"}),e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:[y?"Draft ":"",c[E].title]}),e.jsxs("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--text-muted, #888)"},children:["Create a new ",E==="gitlab"?"merge":"pull"," request"]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:20},children:[e.jsxs("div",{style:{background:"var(--bg-elevated, #252525)",borderRadius:8,padding:16,marginBottom:20},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"center"},children:[e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"var(--text-muted, #888)",marginBottom:4},children:"From"}),e.jsxs("select",{value:k,onChange:s=>ae(s.target.value,m),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},children:[e.jsx("option",{value:"",children:"Select source branch..."}),te.map(s=>e.jsx("option",{value:s.name,children:s.name},s.name))]})]}),e.jsx("div",{style:{padding:"20px 0 0"},children:e.jsx("span",{style:{fontSize:20,color:"var(--text-muted, #888)"},children:"β"})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{style:{display:"block",fontSize:11,color:"var(--text-muted, #888)",marginBottom:4},children:"Into"}),e.jsx("select",{value:m,onChange:s=>ae(k,s.target.value),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13},children:te.map(s=>e.jsx("option",{value:s.name,children:s.name},s.name))})]})]}),q&&e.jsxs("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:6,display:"flex",gap:16,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",q.additions," additions"]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",q.deletions," deletions"]}),e.jsxs("span",{style:{color:"var(--text-muted, #888)"},children:[q.changedFiles," files changed"]})]}),k===m&&k&&e.jsx("div",{style:{marginTop:12,padding:"8px 12px",background:"var(--nice-danger-tint-15, #ef444422)",color:"var(--color-error, #ef4444)",borderRadius:6,fontSize:12},children:"Source and target branches cannot be the same"})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #888)",marginBottom:6},children:"Title"}),e.jsx("input",{type:"text",value:v,onChange:s=>A(s.target.value),placeholder:V||"Enter a title...",style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",fontSize:14}}),!v&&V&&e.jsxs("button",{onClick:()=>A(V),style:{marginTop:4,padding:0,background:"none",border:"none",color:"var(--color-primary, #3b82f6)",fontSize:11,cursor:"pointer"},children:['Use suggested: "',V,'"']})]}),e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[e.jsx("label",{style:{fontSize:12,color:"var(--text-muted, #888)"},children:"Description"}),N.length>0&&e.jsx("button",{onClick:()=>$(!u),style:{padding:"4px 8px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--text-muted, #888)",fontSize:11,cursor:"pointer"},children:"π Templates"})]}),e.jsx("textarea",{value:G,onChange:s=>Y(s.target.value),placeholder:"Describe your changes...",rows:8,style:{width:"100%",padding:"12px 16px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",fontSize:13,resize:"vertical",fontFamily:"inherit"}})]}),u&&N.length>0&&e.jsxs("div",{style:{marginBottom:16,padding:12,background:"var(--bg-elevated, #252525)",borderRadius:6,border:"1px solid var(--border-color, #444)"},children:[e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #888)",marginBottom:8},children:"Select Template"}),N.map(s=>e.jsxs("button",{onClick:()=>_(s),style:{display:"block",width:"100%",padding:"8px 12px",marginBottom:4,borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:[e.jsx("div",{style:{fontWeight:500},children:s.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:s.description})]},s.id))]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16,marginBottom:20},children:[e.jsxs("div",{children:[e.jsx("button",{onClick:()=>f(!i),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"π·οΈ Labels"}),W.length>0&&e.jsxs("span",{style:{color:"var(--color-primary, #3b82f6)"},children:["(",W.length,")"]})]})}),i&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:w.map(s=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:W.includes(s.id),onChange:()=>ne(s.id)}),e.jsx("span",{style:{width:12,height:12,borderRadius:"50%",background:s.color}}),e.jsx("span",{style:{fontSize:12},children:s.name})]},s.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>re(!R),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"π₯ Reviewers"}),D.length>0&&e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["(",D.length,")"]})]})}),R&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:j.map(s=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:D.includes(s.id),onChange:()=>se(s.id)}),s.avatar?e.jsx("img",{src:s.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--text-muted, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:s.name[0]}),e.jsx("span",{style:{fontSize:12},children:s.name})]},s.id))})]}),e.jsxs("div",{children:[e.jsx("button",{onClick:()=>ee(!X),style:{width:"100%",padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",color:"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{children:"π Linked Issues"}),l.length>0&&e.jsxs("span",{style:{color:"var(--color-accent, #8b5cf6)"},children:["(",l.length,")"]})]})}),X&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:P.filter(s=>s.state==="open").map(s=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:l.includes(s.id),onChange:()=>de(s.id)}),e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted, #888)"},children:["#",s.number]}),e.jsx("span",{style:{fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.title})]},s.id))})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #252525)",cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:y,onChange:s=>J(s.target.checked)}),e.jsx("span",{children:"π Create as Draft"})]})})]}),e.jsxs("div",{style:{background:"var(--bg-elevated, #252525)",borderRadius:8,padding:16,marginBottom:20},children:[e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #888)",marginBottom:12},children:"Merge Options"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:o,onChange:s=>t(s.target.checked)}),"Squash commits on merge"]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:10,cursor:"pointer",fontSize:12},children:[e.jsx("input",{type:"checkbox",checked:a,onChange:s=>p(s.target.checked)}),"Delete source branch after merge"]})]})]}),q&&q.files.length>0&&e.jsxs("div",{style:{background:"var(--bg-elevated, #252525)",borderRadius:8,padding:16},children:[e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, #888)",marginBottom:12},children:["Changed Files (",q.changedFiles,")"]}),e.jsx("div",{style:{maxHeight:200,overflow:"auto"},children:q.files.map(s=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",borderRadius:4,fontSize:12},children:[e.jsx("span",{style:{width:12,height:12,borderRadius:2,background:s.status==="added"?"var(--color-success, #22c55e)":s.status==="deleted"?"var(--color-error, #ef4444)":s.status==="renamed"?"var(--color-primary, #3b82f6)":"var(--color-warning, #f59e0b)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:8,color:"var(--bg-primary, #fff)"},children:s.status==="added"?"+":s.status==="deleted"?"-":s.status==="renamed"?"β":"M"}),e.jsx("span",{style:{flex:1,fontFamily:"monospace",fontSize:11},children:s.path}),e.jsxs("span",{style:{color:"var(--color-success, #22c55e)",fontSize:11},children:["+",s.additions]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)",fontSize:11},children:["-",s.deletions]})]},s.path))})]})]}),e.jsxs("div",{style:{padding:"16px 20px",borderTop:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)",display:"flex",alignItems:"center",justifyContent:"flex-end",gap:12},children:[e.jsx("button",{onClick:L,style:{padding:"10px 20px",borderRadius:6,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:13},children:"Cancel"}),e.jsx("button",{onClick:()=>b?.({title:v,description:G,sourceBranch:k,targetBranch:m,isDraft:y,labels:W,reviewers:D,assignees:O,linkedIssues:l,squashCommits:o,deleteSourceBranch:a}),disabled:!F,style:{padding:"10px 20px",borderRadius:6,border:"none",background:F?"var(--bg-tertiary, #333)":"var(--bg-elevated, #222)",color:F?"var(--bg-primary, #fff)":"var(--text-muted, #666)",cursor:F?"pointer":"not-allowed",fontSize:13},children:"Preview"}),e.jsx("button",{onClick:le,disabled:!F,style:{padding:"10px 24px",borderRadius:6,border:"none",background:F?"var(--color-success, #22c55e)":"var(--bg-elevated, #222)",color:F?"var(--bg-primary, #fff)":"var(--text-muted, #666)",cursor:F?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:y?"Create Draft":c[E].btn})]})]})},Pe=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:ve},Symbol.toStringTag,{value:"Module"})),ye=({files:x,viewMode:j,showWhitespace:w,comments:P=[],selectedFile:N,showFileTree:q=!0,contextLines:H=3,baseRef:M,headRef:T,onFileSelect:E,onViewModeChange:U,onAddComment:L,onResolveComment:h,onExpandChunk:b,className:C,style:B,"data-testid":S})=>{const[z,v]=n.useState("split"),[A,G]=n.useState(!1),[Y,k]=n.useState(x[0]?.path),[I,m]=n.useState(new Set),[g,y]=n.useState(null),J=j??z,W=w??A,Z=N??Y,D=n.useMemo(()=>x.find(i=>i.path===Z),[x,Z]),Q=n.useMemo(()=>({additions:x.reduce((i,f)=>i+f.additions,0),deletions:x.reduce((i,f)=>i+f.deletions,0)}),[x]),O=n.useCallback(i=>{k(i),E?.(i)},[E]),d=n.useCallback(i=>{v(i),U?.(i)},[U]),l=n.useCallback((i,f)=>{const R=`${i}:${f}`;m(re=>{const X=new Set(re);return X.has(R)?X.delete(R):X.add(R),X}),b?.(i,f)},[b]),r=n.useMemo(()=>P.filter(i=>i.filePath===Z),[P,Z]),o=i=>{switch(i){case"added":return{icon:"+",color:"var(--color-success, #22c55e)"};case"deleted":return{icon:"-",color:"var(--color-error, #ef4444)"};case"modified":return{icon:"M",color:"var(--color-warning, #f59e0b)"};case"renamed":return{icon:"β",color:"var(--color-primary, #3b82f6)"};case"copied":return{icon:"C",color:"var(--color-accent, #8b5cf6)"}}},t=(i,f,R)=>{const re=i.type==="addition"?"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))":i.type==="deletion"?"var(--nice-danger-tint-10, rgba(239, 68, 68, 0.1))":i.type==="header"?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent",X=i.type==="addition"?"var(--nice-success-light, #4ade80)":i.type==="deletion"?"var(--nice-danger-light, #f87171)":i.type==="header"?"var(--color-primary-light, #60a5fa)":"var(--text-primary, #e0e0e0)",ee=R==="old"?i.lineNumberOld:R==="new"?i.lineNumberNew:void 0,u=W?i.content.replace(/ /g,"Β·").replace(/\t/g,"β "):i.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:re,minHeight:20,fontSize:12,fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:[ee!==void 0&&e.jsx("div",{style:{minWidth:50,padding:"0 8px",textAlign:"right",color:"var(--text-muted, #666)",background:"var(--nice-overlay-20, rgba(0, 0, 0, 0.2))",userSelect:"none",borderRight:"1px solid var(--border-color, #333)"},children:ee}),J==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:X,fontWeight:600},children:i.type==="addition"?"+":i.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:X,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:u||" "}),L&&ee&&i.type!=="header"&&e.jsx("button",{onClick:()=>y({filePath:Z,line:ee,side:R||"new",body:""}),style:{width:24,border:"none",background:"transparent",color:"var(--color-primary, #3b82f6)",cursor:"pointer",opacity:.3,transition:"opacity 0.2s"},onMouseEnter:$=>$.currentTarget.style.opacity="1",onMouseLeave:$=>$.currentTarget.style.opacity="0.3",children:"π¬"})]},`${f}-${R||"unified"}`)},a=i=>e.jsx("div",{style:{borderTop:"1px solid var(--border-color, #333)"},children:i.chunks.map((f,R)=>{const re=`${i.path}:${R}`;return I.has(re),e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>l(i.path,R),style:{padding:"6px 12px",background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderBottom:"1px solid var(--border-color, #333)",fontSize:11,color:"var(--color-primary-light, #60a5fa)",cursor:"pointer",fontFamily:"monospace"},children:["@@ -",f.oldStart,",",f.oldLines," +",f.newStart,",",f.newLines," @@"," ",f.header||""]}),f.lines.map((X,ee)=>t(X,ee))]},R)})}),p=i=>e.jsx("div",{style:{borderTop:"1px solid var(--border-color, #333)"},children:i.chunks.map((f,R)=>{const re=[],X=[];for(const u of f.lines)(u.type==="deletion"||u.type==="context")&&re.push(u),(u.type==="addition"||u.type==="context")&&X.push(u);const ee=Math.max(re.length,X.length);for(;re.length<ee;)re.push({content:"",type:"context"});for(;X.length<ee;)X.push({content:"",type:"context"});return e.jsxs("div",{children:[e.jsxs("div",{style:{padding:"6px 12px",background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderBottom:"1px solid var(--border-color, #333)",fontSize:11,color:"var(--color-primary-light, #60a5fa)",fontFamily:"monospace"},children:["@@ -",f.oldStart,",",f.oldLines," +",f.newStart,",",f.newLines," @@"," ",f.header||""]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flex:1,borderRight:"1px solid var(--border-color, #444)"},children:re.map((u,$)=>t(u,$,"old"))}),e.jsx("div",{style:{flex:1},children:X.map((u,$)=>t(u,$,"new"))})]})]},R)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${C||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...B},"data-testid":S,children:[q&&e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("span",{style:{fontSize:16},children:"π"}),e.jsx("span",{style:{fontWeight:600,fontSize:13},children:"Changed Files"}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:10,fontSize:11},children:x.length})]}),(M||T)&&e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:[M&&e.jsx("span",{children:M}),M&&T&&e.jsx("span",{style:{margin:"0 4px"},children:"β"}),T&&e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:T})]})]}),e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--border-color, #333)",display:"flex",gap:12,fontSize:12},children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",Q.additions]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",Q.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:x.map(i=>{const f=o(i.status),R=i.path===Z;return e.jsxs("div",{onClick:()=>O(i.path),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",cursor:"pointer",background:R?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:R?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("span",{style:{width:16,height:16,borderRadius:2,background:f.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--bg-primary, #fff)",fontWeight:600},children:f.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[i.additions>0&&e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",i.additions]}),i.deletions>0&&e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",i.deletions]})]})]},i.path)})})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)",display:"flex",alignItems:"center",gap:16},children:[D&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:D.oldPath&&D.oldPath!==D.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--color-error, #ef4444)"},children:D.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"var(--text-muted, #888)"},children:"β"}),e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:D.path})]}):D.path}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>d("unified"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:J==="unified"?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Unified"}),e.jsx("button",{onClick:()=>d("split"),style:{padding:"6px 12px",borderRadius:4,border:"none",background:J==="split"?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11},children:"Split"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11,color:"var(--text-muted, #888)",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:W,onChange:i=>G(i.target.checked)}),"Show whitespace"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:D?D.binary?e.jsxs("div",{style:{padding:40,textAlign:"center",color:"var(--text-muted, #888)"},children:[e.jsx("span",{style:{fontSize:48},children:"π¦"}),e.jsx("p",{children:"Binary file cannot be displayed"})]}):J==="split"?p(D):a(D):e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-muted, #666)"},children:"Select a file to view changes"})}),r.length>0&&e.jsxs("div",{style:{borderTop:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)",maxHeight:200,overflow:"auto"},children:[e.jsxs("div",{style:{padding:"8px 16px",fontSize:12,fontWeight:600,borderBottom:"1px solid var(--border-color, #333)"},children:["Comments (",r.length,")"]}),r.map(i=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--border-color, #333)",opacity:i.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[i.author.avatar?e.jsx("img",{src:i.author.avatar,alt:"",style:{width:20,height:20,borderRadius:"50%"}}):e.jsx("span",{style:{width:20,height:20,borderRadius:"50%",background:"var(--text-muted, #666)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10},children:i.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:i.author.name}),e.jsxs("span",{style:{fontSize:10,color:"var(--text-muted, #888)"},children:["Line ",i.line," (",i.side,")"]}),i.resolved&&e.jsx("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:10,background:"var(--nice-success-tint-15, #22c55e22)",color:"var(--color-success, #22c55e)"},children:"Resolved"}),h&&!i.resolved&&e.jsx("button",{onClick:()=>h(i.id),style:{marginLeft:"auto",padding:"4px 8px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:10},children:"Resolve"})]}),e.jsx("div",{style:{fontSize:12,color:"var(--text-secondary, #ccc)"},children:i.body})]},i.id))]}),g&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},onClick:()=>y(null),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:20},onClick:i=>i.stopPropagation(),children:[e.jsxs("h3",{style:{margin:"0 0 12px",fontSize:14},children:["Add comment on line ",g.line]}),e.jsx("textarea",{value:g.body,onChange:i=>y({...g,body:i.target.value}),placeholder:"Write a comment...",rows:4,style:{width:"100%",padding:12,borderRadius:6,border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:13,resize:"vertical"},autoFocus:!0}),e.jsxs("div",{style:{marginTop:12,display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>y(null),style:{padding:"8px 16px",borderRadius:4,border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:12},children:"Cancel"}),e.jsx("button",{onClick:()=>{g.body.trim()&&(L?.(g.filePath,g.line,g.side,g.body.trim()),y(null))},disabled:!g.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:g.body.trim()?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:g.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Add Comment"})]})]})})]})]})},Ne=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:ye},Symbol.toStringTag,{value:"Module"})),Ae=(x,j)=>{const P=new Date().getTime()-x.getTime(),N=Math.floor(P/(1e3*60*60*24));return N===0?"today":N===1?"yesterday":N<7?`${N} days ago`:N<30?`${Math.floor(N/7)} weeks ago`:N<365?`${Math.floor(N/30)} months ago`:`${Math.floor(N/365)} years ago`},De=x=>{const w=new Date().getTime()-x.getTime(),P=Math.floor(w/(1e3*60*60*24));return P<7?"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))":P<30?"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))":P<90?"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))":P<365?"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))":"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))"},ie=x=>{const j=["var(--color-primary, #3b82f6)","var(--color-success, #22c55e)","var(--color-warning, #f59e0b)","var(--color-error, #ef4444)","var(--color-accent, #8b5cf6)","var(--color-info, #06b6d4)","var(--color-accent-pink, #ec4899)","var(--nice-info, #14b8a6)","var(--nice-warning, #f97316)","var(--color-accent, #6366f1)"];let w=0;for(let P=0;P<x.length;P++)w=(w<<5)-w+x.charCodeAt(P),w=w&w;return j[Math.abs(w)%j.length]},je=({file:x,viewMode:j="inline",showAgeHeatmap:w=!0,showAvatars:P=!0,groupHunks:N=!0,highlightOnHover:q=!0,timeZone:H,dateRange:M,authorFilter:T,selectedLine:E,syntaxTheme:U="dark",onLineClick:L,onCommitClick:h,onAuthorClick:b,onBlameParent:C,className:B,style:S,"data-testid":z="nice-git-blame"})=>{const[v,A]=n.useState(null),[G,Y]=n.useState(null),[k,I]=n.useState(null),m=n.useMemo(()=>{const l=[];return x.hunks.forEach(r=>{r.lines.forEach(o=>{l.push(o)})}),l.sort((r,o)=>r.lineNumber-o.lineNumber)},[x.hunks]),g=n.useMemo(()=>m.filter(l=>!(M?.from&&l.commit.timestamp<M.from||M?.to&&l.commit.timestamp>M.to||T&&T.length>0&&!T.includes(l.commit.author.id))),[m,M,T]),y=n.useMemo(()=>{if(!N)return g.map(t=>({startLine:t.lineNumber,endLine:t.lineNumber,commit:t.commit,lines:[t],isFirstOfCommit:!0}));const l=[];let r=null;const o=new Set;return g.forEach(t=>{if(!r||r.commit.id!==t.commit.id){const a=!o.has(t.commit.id);o.add(t.commit.id),r={startLine:t.lineNumber,endLine:t.lineNumber,commit:t.commit,lines:[t],isFirstOfCommit:a},l.push(r)}else r.endLine=t.lineNumber,r.lines.push(t)}),l},[g,N]),J=n.useMemo(()=>{const l=new Map;return m.forEach(r=>{l.has(r.commit.author.id)||l.set(r.commit.author.id,r.commit.author)}),Array.from(l.values())},[m]),W=n.useMemo(()=>{const l=new Map;return m.forEach(r=>{l.has(r.commit.id)||l.set(r.commit.id,r.commit)}),Array.from(l.values()).sort((r,o)=>o.timestamp.getTime()-r.timestamp.getTime())},[m]),Z=n.useCallback(l=>{L?.(l)},[L]),D=n.useCallback((l,r)=>{r.stopPropagation(),G===l.id?Y(null):Y(l.id),h?.(l)},[G,h]),Q=(l,r)=>{const o=r===0,t=l.commit,a=q&&v===t.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:j==="inline"?280:40,background:a?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":w?De(t.timestamp):"transparent",borderRight:`3px solid ${ie(t.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>A(t.id),onMouseLeave:()=>A(null),onClick:p=>D(t,p),children:[o&&j==="inline"&&e.jsxs(e.Fragment,{children:[P&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:ie(t.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,color:"var(--bg-primary, #fff)",fontWeight:500,flexShrink:0},title:t.author.name,children:t.author.avatar?e.jsx("img",{src:t.author.avatar,alt:t.author.name,style:{width:"100%",height:"100%",borderRadius:"50%"}}):t.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:11,fontFamily:"monospace",color:"var(--text-muted, #6b7280)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.shortId}),e.jsx("div",{style:{fontSize:10,color:"var(--text-muted, #9ca3af)",whiteSpace:"nowrap"},children:Ae(t.timestamp)})]})]}),j==="gutter"&&o&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:ie(t.author.id),display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--bg-primary, #fff)"},title:`${t.author.name} - ${t.shortId}
|
|
2
|
+
${t.message}`,children:t.author.name[0].toUpperCase()})]})},O=l=>{if(k!==l.lineNumber||j!=="tooltip")return null;const r=l.commit;return e.jsxs("div",{style:{position:"absolute",left:60,top:-8,zIndex:100,background:"var(--text-primary, #1f2937)",border:"1px solid var(--nice-text, #374151)",borderRadius:8,padding:12,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",minWidth:320},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:ie(r.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontWeight:500},children:r.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--border-color, #e5e7eb)"},children:r.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #9ca3af)"},children:r.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"var(--color-primary-light, #60a5fa)",marginBottom:4},children:r.shortId}),e.jsx("div",{style:{fontSize:13,color:"var(--border-color, #e5e7eb)",marginBottom:8},children:r.message}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #6b7280)"},children:r.timestamp.toLocaleString()}),r.parents&&r.parents.length>0&&C&&e.jsx("button",{onClick:()=>C(r),style:{marginTop:8,padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--border-color, #e5e7eb)",fontSize:11,cursor:"pointer"},children:"β¬ Blame parent"})]})},d=l=>G!==l.id?null:e.jsx("div",{style:{background:"var(--text-primary, #1f2937)",borderBottom:"1px solid var(--nice-text, #374151)",padding:16},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12},children:[e.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:ie(l.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontSize:20,fontWeight:500,flexShrink:0},children:l.author.name[0].toUpperCase()}),e.jsxs("div",{style:{flex:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--border-color, #e5e7eb)"},children:l.author.name}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted, #6b7280)"},children:l.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"var(--color-primary-light, #60a5fa)",marginBottom:8},children:l.id}),e.jsx("div",{style:{fontSize:14,color:"var(--border-color, #e5e7eb)",marginBottom:8,lineHeight:1.5},children:l.message}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,fontSize:12,color:"var(--text-muted, #9ca3af)"},children:[e.jsxs("span",{children:["π
",l.timestamp.toLocaleString()]}),l.parents&&l.parents.length>0&&e.jsxs("span",{children:["π ",l.parents.length," parent(s)"]})]}),C&&l.parents&&l.parents.length>0&&e.jsx("button",{onClick:()=>C(l),style:{marginTop:12,padding:"6px 12px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"β¬ Blame in parent commit"})]})]})});return e.jsxs("div",{className:`nice-git-blame ${B||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:U==="dark"?"var(--bg-canvas, #0d1117)":"var(--bg-primary, #ffffff)",color:U==="dark"?"var(--text-primary, #e6edf3)":"var(--text-primary, #1f2937)",fontFamily:"system-ui, sans-serif",...S},"data-testid":z,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:U==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:16},children:"π"}),e.jsx("span",{style:{fontWeight:500},children:x.path}),e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:["at ",x.revision.substring(0,7)]})]}),e.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:[W.length," commits by ",J.length," author(s)"]})})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:U==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",flexWrap:"wrap"},children:[J.slice(0,10).map(l=>e.jsxs("div",{onClick:()=>b?.(l),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:ie(l.id)}}),e.jsx("span",{style:{fontSize:12},children:l.name})]},l.id)),J.length>10&&e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:["+",J.length-10," more"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:y.map((l,r)=>e.jsxs(n.Fragment,{children:[l.isFirstOfCommit&&G===l.commit.id&&d(l.commit),l.lines.map((o,t)=>e.jsxs("div",{onClick:()=>Z(o),onMouseEnter:()=>I(o.lineNumber),onMouseLeave:()=>I(null),style:{display:"flex",alignItems:"stretch",background:E===o.lineNumber?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":q&&v===l.commit.id?"var(--nice-primary-tint-8, rgba(59, 130, 246, 0.08))":"transparent",borderLeft:E===o.lineNumber?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",position:"relative"},children:[Q(l,t),e.jsx("div",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:50,userSelect:"none",background:U==="dark"?"var(--bg-canvas, #0d1117)":"var(--nice-bg-secondary, #f6f8fa)",borderRight:"1px solid var(--nice-border, #30363d)"},children:o.lineNumber}),e.jsx("div",{style:{flex:1,padding:"0 16px",whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:o.content}),j==="tooltip"&&O(o)]},o.lineNumber))]},`${l.commit.id}-${l.startLine}`))}),w&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,padding:"8px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:U==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:11,color:"var(--text-muted, #8b949e)"},children:[e.jsx("span",{children:"Age:"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))",borderRadius:2}}),e.jsx("span",{children:"<1 week"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))",borderRadius:2}}),e.jsx("span",{children:"<1 month"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))",borderRadius:2}}),e.jsx("span",{children:"<3 months"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))",borderRadius:2}}),e.jsx("span",{children:"<1 year"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("div",{style:{width:16,height:16,background:"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))",borderRadius:2}}),e.jsx("span",{children:">1 year"})]})]})]})},Ee=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:je},Symbol.toStringTag,{value:"Module"})),Le=x=>{if(!x.resolved)return[];switch(x.resolution){case"ours":return x.oursContent;case"theirs":return x.theirsContent;case"both":return[...x.oursContent,...x.theirsContent];case"custom":return x.customContent||[];default:return[]}},ke=({file:x,context:j,viewMode:w="split",showLineNumbers:P=!0,showBase:N=!1,currentConflictIndex:q,syntaxTheme:H="dark",onResolve:M,onResolveAll:T,onNavigateConflict:E,onSave:U,onCancel:L,className:h,style:b,"data-testid":C="nice-git-conflict-resolver"})=>{const[B,S]=n.useState(x.conflicts),[z,v]=n.useState(q??0),[A,G]=n.useState(null),[Y,k]=n.useState(""),I=n.useMemo(()=>B.filter(t=>!t.resolved).length,[B]),m=n.useMemo(()=>B.filter(t=>t.resolved).length,[B]),g=B[z],y=n.useCallback((t,a,p)=>{S(f=>f.map(R=>R.id===t?{...R,resolved:!0,resolution:a,customContent:p}:R)),G(null),M?.(t,a,p);const i=B.findIndex((f,R)=>R>z&&!f.resolved);i!==-1&&(v(i),E?.(i))},[B,z,M,E]),J=n.useCallback(t=>{S(a=>a.map(p=>p.resolved?p:{...p,resolved:!0,resolution:t})),T?.(t)},[T]),W=n.useCallback(t=>{const a=t==="prev"?Math.max(0,z-1):Math.min(B.length-1,z+1);v(a),E?.(a)},[z,B.length,E]),Z=n.useCallback(()=>{g&&(G(g.id),k(g.oursContent.join(`
|
|
3
|
+
`)))},[g]),D=n.useCallback(()=>{A&&y(A,"custom",Y.split(`
|
|
4
|
+
`))},[A,Y,y]),Q=n.useCallback(()=>{const t=x.content.split(`
|
|
5
|
+
`);let a=[],p=0;B.forEach(i=>{a=[...a,...t.slice(p,i.startLine-1)],a=[...a,...Le(i)],p=i.endLine}),a=[...a,...t.slice(p)],U?.(a.join(`
|
|
6
|
+
`))},[x.content,B,U]),O=(t,a,p,i)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${p}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${p}20`,borderBottom:"1px solid var(--nice-border, #30363d)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:p},children:t}),i&&e.jsx("button",{onClick:i,style:{padding:"4px 10px",background:p,border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:"pointer"},children:"Accept"})]}),e.jsx("div",{style:{flex:1,overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13,lineHeight:"20px"},children:a.map((f,R)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:H==="dark"?"var(--bg-canvas, #0d1117)":"var(--bg-primary, #fff)"},children:[P&&e.jsx("span",{style:{padding:"0 12px",color:"var(--nice-text-muted, #6e7681)",textAlign:"right",minWidth:40,borderRight:"1px solid var(--nice-border, #30363d)",userSelect:"none"},children:R+1}),e.jsx("span",{style:{padding:"0 12px",whiteSpace:"pre"},children:f||" "})]},R))})]}),d=()=>g?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[e.jsxs("div",{style:{background:"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))",borderLeft:"3px solid var(--nice-success, #22c55e)"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border, #30363d)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--color-success, #22c55e)",fontWeight:500},children:["β Ours (",j?.oursCommit.branch||"HEAD",")"]}),e.jsx("button",{onClick:()=>y(g.id,"ours"),style:{padding:"4px 10px",background:"var(--color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:"pointer"},children:"Accept Ours"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:g.oursContent.join(`
|
|
7
|
+
`)})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 12px",background:"var(--text-primary, #1f2937)"},children:[e.jsx("div",{style:{flex:1,height:1,background:"var(--text-secondary, #374151)"}}),e.jsx("span",{style:{color:"var(--text-muted, #9ca3af)",fontSize:11},children:"VS"}),e.jsx("div",{style:{flex:1,height:1,background:"var(--text-secondary, #374151)"}})]}),e.jsxs("div",{style:{background:"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))",borderLeft:"3px solid var(--nice-primary, #3b82f6)"},children:[e.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--nice-border, #30363d)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--color-primary, #3b82f6)",fontWeight:500},children:["β Theirs (",j?.theirsCommit.branch||"incoming",")"]}),e.jsx("button",{onClick:()=>y(g.id,"theirs"),style:{padding:"4px 10px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:"pointer"},children:"Accept Theirs"})]}),e.jsx("pre",{style:{margin:0,padding:12,fontFamily:"monospace",fontSize:13},children:g.theirsContent.join(`
|
|
8
|
+
`)})]})]}):null,l=()=>g?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[O(`β Ours (${j?.oursCommit.branch||"HEAD"})`,g.oursContent,"var(--color-success, #22c55e)",()=>y(g.id,"ours")),N&&O("Base (ancestor)",g.baseContent,"var(--text-muted, #6b7280)"),O(`β Theirs (${j?.theirsCommit.branch||"incoming"})`,g.theirsContent,"var(--color-primary, #3b82f6)",()=>y(g.id,"theirs"))]}):null,r=()=>g?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[O(`β Ours (${j?.oursCommit.branch||"HEAD"})`,g.oursContent,"var(--color-success, #22c55e)",()=>y(g.id,"ours")),O("Base",g.baseContent,"var(--text-muted, #6b7280)"),O(`β Theirs (${j?.theirsCommit.branch||"incoming"})`,g.theirsContent,"var(--color-primary, #3b82f6)",()=>y(g.id,"theirs"))]}):null,o=()=>A!==g?.id?null:e.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"80%",maxWidth:800,background:"var(--text-primary, #1f2937)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontWeight:500},children:"βοΈ Edit Resolution"}),e.jsx("button",{onClick:()=>G(null),style:{background:"transparent",border:"none",color:"var(--text-muted, #9ca3af)",cursor:"pointer",fontSize:18},children:"β"})]}),e.jsx("textarea",{value:Y,onChange:t=>k(t.target.value),style:{width:"100%",height:300,padding:16,fontFamily:"monospace",fontSize:13,background:"var(--bg-canvas, #0d1117)",color:"var(--text-primary, #e6edf3)",border:"none",resize:"none"}}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>G(null),style:{padding:"8px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:D,style:{padding:"8px 16px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save Changes"})]})]})});return e.jsxs("div",{className:`nice-git-conflict-resolver ${h||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:H==="dark"?"var(--bg-canvas, #0d1117)":"var(--bg-primary, #ffffff)",color:H==="dark"?"var(--text-primary, #e6edf3)":"var(--text-primary, #1f2937)",fontFamily:"system-ui, sans-serif",position:"relative",...b},"data-testid":C,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:H==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:18},children:"β οΈ"}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:x.path}),e.jsxs("div",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:[B.length," conflict(s) β’ ",m," resolved β’ ",I," ","remaining"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:L,style:{padding:"6px 12px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:Q,disabled:I>0,style:{padding:"6px 12px",background:I>0?"var(--text-secondary, #374151)":"var(--color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:I>0?"not-allowed":"pointer",opacity:I>0?.5:1},children:"β Save Resolved"})]})]}),j&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:H==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)",fontSize:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:"β Ours:"}),e.jsx("span",{children:j.oursCommit.branch}),e.jsxs("span",{style:{color:"var(--text-muted, #8b949e)",fontFamily:"monospace"},children:["(",j.oursCommit.shortId,")"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{color:"var(--color-primary, #3b82f6)"},children:"β Theirs:"}),e.jsx("span",{children:j.theirsCommit.branch}),e.jsxs("span",{style:{color:"var(--text-muted, #8b949e)",fontFamily:"monospace"},children:["(",j.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:H==="dark"?"var(--text-primary, #1f2937)":"var(--bg-secondary, #f0f0f0)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>W("prev"),disabled:z===0,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:z===0?"not-allowed":"pointer",opacity:z===0?.5:1},children:"β Prev"}),e.jsxs("span",{style:{padding:"0 8px"},children:["Conflict ",z+1," of ",B.length,g?.resolved&&e.jsx("span",{style:{marginLeft:8,color:"var(--color-success, #22c55e)"},children:"β Resolved"})]}),e.jsx("button",{onClick:()=>W("next"),disabled:z===B.length-1,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:z===B.length-1?"not-allowed":"pointer",opacity:z===B.length-1?.5:1},children:"Next β"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>J("ours"),disabled:I===0,style:{padding:"4px 10px",background:"var(--color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:I===0?"not-allowed":"pointer",opacity:I===0?.5:1},children:"Accept All Ours"}),e.jsx("button",{onClick:()=>J("theirs"),disabled:I===0,style:{padding:"4px 10px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:I===0?"not-allowed":"pointer",opacity:I===0?.5:1},children:"Accept All Theirs"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[g&&!g.resolved&&e.jsxs(e.Fragment,{children:[w==="inline"&&d(),w==="split"&&l(),w==="three-way"&&r()]}),g?.resolved&&e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,color:"var(--color-success, #22c55e)"},children:[e.jsx("span",{style:{fontSize:48},children:"β"}),e.jsx("span",{style:{fontSize:18},children:"Conflict Resolved"}),e.jsxs("span",{style:{color:"var(--text-muted, #8b949e)",fontSize:13},children:["Resolution: ",g.resolution]}),e.jsx("button",{onClick:()=>S(t=>t.map(a=>a.id===g.id?{...a,resolved:!1,resolution:void 0}:a)),style:{padding:"8px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"β© Re-resolve"})]})]}),g&&!g.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:H==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsx("button",{onClick:()=>y(g.id,"ours"),style:{padding:"8px 20px",background:"var(--color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer",fontWeight:500},children:"β Accept Ours"}),e.jsx("button",{onClick:()=>y(g.id,"theirs"),style:{padding:"8px 20px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer",fontWeight:500},children:"β Accept Theirs"}),e.jsx("button",{onClick:()=>y(g.id,"both"),style:{padding:"8px 20px",background:"var(--color-accent, #8b5cf6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer",fontWeight:500},children:"β Accept Both"}),e.jsx("button",{onClick:Z,style:{padding:"8px 20px",background:"var(--color-warning, #f59e0b)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer",fontWeight:500},children:"βοΈ Edit Manually"})]}),o()]})},Oe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:ke},Symbol.toStringTag,{value:"Module"})),ce={"pre-commit":{title:"Pre-commit",description:"Runs before commit is created. Good for linting and formatting.",icon:"β"},"prepare-commit-msg":{title:"Prepare Commit Message",description:"Runs before commit message editor opens. Can modify default message.",icon:"π"},"commit-msg":{title:"Commit Message",description:"Validates commit message format (e.g., conventional commits).",icon:"π¬"},"post-commit":{title:"Post-commit",description:"Runs after commit is created. Good for notifications.",icon:"π€"},"pre-push":{title:"Pre-push",description:"Runs before push. Good for running tests.",icon:"π"},"pre-rebase":{title:"Pre-rebase",description:"Runs before rebase starts.",icon:"π"},"post-merge":{title:"Post-merge",description:"Runs after merge completes. Good for dependency updates.",icon:"π"},"post-checkout":{title:"Post-checkout",description:"Runs after checkout completes.",icon:"π₯"},"pre-auto-gc":{title:"Pre-auto GC",description:"Runs before automatic garbage collection.",icon:"ποΈ"}},_e=[{id:"eslint-staged",name:"ESLint (staged files)",description:"Run ESLint on staged JavaScript/TypeScript files",icon:"π",category:"lint",hook:"pre-commit",actions:[{type:"lint",name:"ESLint",command:"npx eslint --fix",runOn:"staged",filePatterns:["*.js","*.jsx","*.ts","*.tsx"],enabled:!0,failOnError:!0}]},{id:"prettier-staged",name:"Prettier (staged files)",description:"Format staged files with Prettier",icon:"β¨",category:"lint",hook:"pre-commit",actions:[{type:"format",name:"Prettier",command:"npx prettier --write",runOn:"staged",filePatterns:["*.js","*.jsx","*.ts","*.tsx","*.css","*.json","*.md"],enabled:!0,failOnError:!1}]},{id:"jest-tests",name:"Jest Tests",description:"Run Jest tests before push",icon:"π§ͺ",category:"test",hook:"pre-push",actions:[{type:"test",name:"Jest",command:"npm test",runOn:"all",enabled:!0,failOnError:!0}]},{id:"typecheck",name:"TypeScript Check",description:"Run TypeScript compiler check",icon:"π",category:"quality",hook:"pre-commit",actions:[{type:"typecheck",name:"tsc",command:"npx tsc --noEmit",runOn:"all",enabled:!0,failOnError:!0}]},{id:"conventional-commits",name:"Conventional Commits",description:"Validate commit message format",icon:"π",category:"quality",hook:"commit-msg",actions:[{type:"custom",name:"Commitlint",command:"npx commitlint --edit $1",enabled:!0,failOnError:!0}]},{id:"secrets-scan",name:"Secret Detection",description:"Scan for accidentally committed secrets",icon:"π",category:"security",hook:"pre-commit",actions:[{type:"custom",name:"Detect Secrets",command:"npx secretlint",runOn:"staged",enabled:!0,failOnError:!0}]}],Se=({hooks:x,templates:j=_e,manager:w="husky",repoPath:P,selectedHook:N,onHookChange:q,onHookToggle:H,onActionAdd:M,onActionRemove:T,onActionUpdate:E,onInstall:U,onUninstall:L,onExport:h,className:b,style:C,"data-testid":B="nice-git-hooks"})=>{const[S,z]=n.useState(x),[v,A]=n.useState(N||null),[G,Y]=n.useState(!1),[k,I]=n.useState(null),[m,g]=n.useState(!1),y=n.useMemo(()=>S.find(o=>o.type===v),[S,v]),J=n.useCallback((o,t)=>{z(a=>a.map(p=>p.type===o?{...p,enabled:t}:p)),H?.(o,t)},[H]),W=n.useCallback(o=>{if(!v)return;const t=o?o.actions.map((a,p)=>({...a,id:crypto.randomUUID(),order:(y?.actions.length||0)+p})):[{id:crypto.randomUUID(),type:"custom",name:"New Action",command:'echo "Hello"',order:y?.actions.length||0,enabled:!0,failOnError:!0}];z(a=>a.map(p=>p.type===v?{...p,actions:[...p.actions,...t]}:p)),t.forEach(a=>M?.(v,a)),Y(!1)},[v,y,M]),Z=n.useCallback(o=>{v&&(z(t=>t.map(a=>a.type===v?{...a,actions:a.actions.filter(p=>p.id!==o)}:a)),T?.(v,o))},[v,T]),D=n.useCallback(o=>{v&&(z(t=>t.map(a=>a.type===v?{...a,actions:a.actions.map(p=>p.id===o.id?o:p)}:a)),I(null),E?.(v,o))},[v,E]),Q=n.useCallback((o,t)=>{if(!y)return;const a=[...y.actions],p=a.findIndex(f=>f.id===o);if(p===-1)return;const i=t==="up"?p-1:p+1;i<0||i>=a.length||([a[p],a[i]]=[a[i],a[p]],a.forEach((f,R)=>f.order=R),z(f=>f.map(R=>R.type===v?{...R,actions:a}:R)))},[y,v]),O=n.useCallback(o=>{const t=["#!/bin/sh",""];return o.verbose&&t.push("set -x"),t.push("# Generated by NiceGitHooks",`# Hook: ${o.type}`,""),o.actions.forEach(a=>{if(!a.enabled){t.push(`# [DISABLED] ${a.name}`);return}if(t.push(`# ${a.name}`),a.condition){const{type:i,operator:f,value:R}=a.condition;i==="branch"?(t.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),f==="equals"?t.push(`if [ "$BRANCH" != "${R}" ]; then exit 0; fi`):f==="matches"&&t.push(`if ! echo "$BRANCH" | grep -q "${R}"; then exit 0; fi`)):i==="env"&&t.push(`if [ -z "$${R}" ]; then exit 0; fi`)}let p=a.command;a.runOn==="staged"&&a.filePatterns?.length&&(a.filePatterns.map(i=>`'${i}'`).join(" "),p=`git diff --cached --name-only --diff-filter=ACM | grep -E "${a.filePatterns.join("|")}" | xargs ${p}`),t.push(p),a.failOnError&&(t.push("if [ $? -ne 0 ]; then"),t.push(` echo "β ${a.name} failed""`),t.push(" exit 1"),t.push("fi")),t.push("")}),t.push("exit 0"),t.join(`
|
|
9
|
+
`)},[]),d=o=>({lint:"π",test:"π§ͺ",format:"β¨",typecheck:"π",build:"π¨",custom:"βοΈ"})[o],l=()=>k?e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"90%",maxWidth:600,background:"var(--text-primary, #1f2937)",borderRadius:12,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:16},children:"βοΈ Edit Action"}),e.jsx("button",{onClick:()=>I(null),style:{background:"none",border:"none",color:"var(--text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:"β"})]}),e.jsxs("div",{style:{padding:20,display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #9ca3af)",marginBottom:4},children:"Name"}),e.jsx("input",{type:"text",value:k.name,onChange:o=>I({...k,name:o.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--bg-primary, #fff)"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #9ca3af)",marginBottom:4},children:"Type"}),e.jsxs("select",{value:k.type,onChange:o=>I({...k,type:o.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--bg-primary, #fff)"},children:[e.jsx("option",{value:"lint",children:"π Lint"}),e.jsx("option",{value:"test",children:"π§ͺ Test"}),e.jsx("option",{value:"format",children:"β¨ Format"}),e.jsx("option",{value:"typecheck",children:"π Typecheck"}),e.jsx("option",{value:"build",children:"π¨ Build"}),e.jsx("option",{value:"custom",children:"βοΈ Custom"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #9ca3af)",marginBottom:4},children:"Command"}),e.jsx("textarea",{value:k.command,onChange:o=>I({...k,command:o.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--bg-primary, #fff)",fontFamily:"monospace",minHeight:80,resize:"vertical"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #9ca3af)",marginBottom:4},children:"Run On"}),e.jsxs("select",{value:k.runOn||"all",onChange:o=>I({...k,runOn:o.target.value}),style:{width:"100%",padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--bg-primary, #fff)"},children:[e.jsx("option",{value:"all",children:"All files"}),e.jsx("option",{value:"staged",children:"Staged files only"}),e.jsx("option",{value:"changed",children:"Changed files"})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:12,color:"var(--text-muted, #9ca3af)",marginBottom:4},children:"File Patterns (comma-separated)"}),e.jsx("input",{type:"text",value:k.filePatterns?.join(", ")||"",onChange:o=>I({...k,filePatterns:o.target.value.split(",").map(t=>t.trim()).filter(Boolean)}),placeholder:"*.ts, *.tsx, *.js",style:{width:"100%",padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"1px solid var(--nice-text-secondary, #4b5563)",borderRadius:6,color:"var(--bg-primary, #fff)"}})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:k.enabled,onChange:o=>I({...k,enabled:o.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Enabled"})]}),e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:k.failOnError,onChange:o=>I({...k,failOnError:o.target.checked})}),e.jsx("span",{style:{fontSize:13},children:"Fail on error"})]})]})]}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>I(null),style:{padding:"8px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:()=>D(k),style:{padding:"8px 16px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})}):null,r=()=>{if(!m||!y)return null;const o=O(y);return e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100},children:e.jsxs("div",{style:{width:"90%",maxWidth:700,maxHeight:"80vh",background:"var(--text-primary, #1f2937)",borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{fontWeight:500,fontSize:16},children:["π Script Preview: ",y.type]}),e.jsx("button",{onClick:()=>g(!1),style:{background:"none",border:"none",color:"var(--text-muted, #9ca3af)",cursor:"pointer",fontSize:20},children:"β"})]}),e.jsx("pre",{style:{flex:1,margin:0,padding:20,background:"var(--bg-canvas, #0d1117)",color:"var(--text-primary, #e6edf3)",fontFamily:"monospace",fontSize:13,overflow:"auto"},children:o}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-text, #374151)",display:"flex",justifyContent:"flex-end",gap:8},children:[e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(o)},style:{padding:"8px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"π Copy"}),e.jsx("button",{onClick:()=>g(!1),style:{padding:"8px 16px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Close"})]})]})})};return e.jsxs("div",{className:`nice-git-hooks ${b||""}`,style:{display:"flex",height:"100%",background:"var(--bg-canvas, #0d1117)",color:"var(--text-primary, #e6edf3)",fontFamily:"system-ui, sans-serif",...C},"data-testid":B,children:[e.jsxs("div",{style:{width:280,borderRight:"1px solid var(--nice-border, #30363d)",display:"flex",flexDirection:"column"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",fontWeight:500},children:"πͺ Git Hooks"}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:Object.entries(ce).map(([o,t])=>{const a=S.find(f=>f.type===o),p=v===o,i=a?.actions.length||0;return e.jsxs("div",{onClick:()=>A(o),style:{padding:"12px 16px",cursor:"pointer",background:p?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:p?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:18},children:t.icon}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:500},children:t.title}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #8b949e)"},children:[i," action",i!==1?"s":""]})]}),e.jsx("button",{onClick:f=>{f.stopPropagation(),J(o,!a?.enabled)},style:{width:36,height:20,borderRadius:10,background:a?.enabled?"var(--color-success, #22c55e)":"var(--text-secondary, #374151)",border:"none",cursor:"pointer",position:"relative",transition:"background 0.2s"},children:e.jsx("div",{style:{position:"absolute",top:2,left:a?.enabled?18:2,width:16,height:16,borderRadius:"50%",background:"var(--bg-primary, #fff)",transition:"left 0.2s"}})})]},o)})}),e.jsx("div",{style:{padding:12,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:e.jsx("button",{onClick:()=>h?.(S,"husky"),style:{flex:1,padding:"8px 12px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"Export"})})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:y?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--nice-border, #30363d)",background:"var(--bg-elevated, #161b22)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:8},children:[e.jsx("span",{style:{fontSize:24},children:ce[y.type].icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:ce[y.type].title}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:ce[y.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsx("button",{onClick:()=>g(!0),style:{padding:"6px 12px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"π Preview Script"}),e.jsx("button",{onClick:()=>U?.(y.type),style:{padding:"6px 12px",background:"var(--color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"β¬οΈ Install"}),e.jsx("button",{onClick:()=>L?.(y.type),style:{padding:"6px 12px",background:"var(--color-error, #ef4444)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",fontSize:12,cursor:"pointer"},children:"β Uninstall"})]})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:16},children:y.actions.length===0?e.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:40,color:"var(--text-muted, #8b949e)"},children:[e.jsx("span",{style:{fontSize:48,marginBottom:16},children:"π"}),e.jsx("span",{children:"No actions configured"}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:"Add an action from templates or create a custom one"})]}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:y.actions.sort((o,t)=>o.order-t.order).map((o,t)=>e.jsxs("div",{style:{padding:16,background:"var(--bg-elevated, #161b22)",borderRadius:8,border:"1px solid var(--nice-border, #30363d)",opacity:o.enabled?1:.5},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:20},children:d(o.type)}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontWeight:500},children:o.name}),e.jsx("code",{style:{fontSize:11,color:"var(--text-muted, #8b949e)",background:"var(--bg-canvas, #0d1117)",padding:"2px 6px",borderRadius:4},children:o.command})]}),e.jsxs("div",{style:{display:"flex",gap:4},children:[e.jsx("button",{onClick:()=>Q(o.id,"up"),disabled:t===0,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:t===0?"not-allowed":"pointer",opacity:t===0?.5:1},children:"β"}),e.jsx("button",{onClick:()=>Q(o.id,"down"),disabled:t===y.actions.length-1,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:t===y.actions.length-1?"not-allowed":"pointer",opacity:t===y.actions.length-1?.5:1},children:"β"}),e.jsx("button",{onClick:()=>I(o),style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"βοΈ"}),e.jsx("button",{onClick:()=>Z(o.id),style:{padding:"4px 8px",background:"var(--color-error, #ef4444)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"ποΈ"})]})]}),o.filePatterns&&o.filePatterns.length>0&&e.jsxs("div",{style:{marginTop:8,fontSize:11,color:"var(--text-muted, #8b949e)"},children:["Files: ",o.filePatterns.join(", ")]}),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[o.runOn&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--color-primary-active, #1d4ed8)",borderRadius:4},children:o.runOn}),o.failOnError&&e.jsx("span",{style:{fontSize:10,padding:"2px 6px",background:"var(--color-error, #b91c1c)",borderRadius:4},children:"fail on error"})]})]},o.id))})}),e.jsxs("div",{style:{padding:16,borderTop:"1px solid var(--nice-border, #30363d)",display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>Y(!G),style:{padding:"10px 16px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer",fontWeight:500},children:"β Add from Template"}),e.jsx("button",{onClick:()=>W(),style:{padding:"10px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"βοΈ Custom Action"})]}),G&&e.jsxs("div",{style:{position:"absolute",bottom:70,left:300,width:400,maxHeight:300,overflow:"auto",background:"var(--text-primary, #1f2937)",border:"1px solid var(--nice-text, #374151)",borderRadius:8,boxShadow:"0 4px 12px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",zIndex:50},children:[j.filter(o=>o.hook===v).map(o=>e.jsxs("div",{onClick:()=>W(o),style:{padding:12,cursor:"pointer",borderBottom:"1px solid var(--nice-text, #374151)",display:"flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{fontSize:24},children:o.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500},children:o.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #8b949e)"},children:o.description})]})]},o.id)),j.filter(o=>o.hook===v).length===0&&e.jsx("div",{style:{padding:20,textAlign:"center",color:"var(--text-muted, #8b949e)"},children:"No templates for this hook type"})]})]}):e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"var(--text-muted, #8b949e)"},children:[e.jsx("span",{style:{fontSize:64,marginBottom:16},children:"πͺ"}),e.jsx("span",{style:{fontSize:18},children:"Select a hook to configure"}),e.jsx("span",{style:{fontSize:12,marginTop:4},children:"Click on a hook from the list to start editing"})]})}),l(),r()]})},Fe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:Se},Symbol.toStringTag,{value:"Module"})),He=[{target:".nice-pipeline-editor",titleKey:"tutorial.pipelineEditor.intro.title",title:"Pipeline editor",contentKey:"tutorial.pipelineEditor.intro.content",content:"Build a CI/CD pipeline from stages, jobs and steps; set triggers, variables and secrets; then validate, save and run it.",placement:"auto"}],Ge={push:"π€",pull_request:"π",schedule:"β°",manual:"π",tag:"π·οΈ",workflow_dispatch:"β‘"},qe={script:"π",action:"βοΈ",checkout:"π₯",upload_artifact:"π€",download_artifact:"π₯",docker:"π³",deploy:"π"},Ce=({pipeline:x,templates:j,runners:w,environments:P,onPipelineChange:N,onStageAdd:q,onStageRemove:H,onStageMove:M,onJobAdd:T,onJobRemove:E,onStepAdd:U,onStepRemove:L,onVariableAdd:h,onVariableRemove:b,onSecretAdd:C,onSecretRemove:B,onTemplateApply:S,onSave:z,onRun:v,onValidate:A,tutorial:G,className:Y,style:k,"data-testid":I})=>{const[m,g]=n.useState("visual"),[y,J]=n.useState(null),[W,Z]=n.useState(null),[D,Q]=n.useState(!1),O=x.stages.find(r=>r.id===y),d=O?.jobs.find(r=>r.id===W),l=n.useMemo(()=>{const r=[];return r.push(`name: ${x.name}`),r.push(""),r.push("on:"),x.triggers.forEach(o=>{r.push(` ${o}:`),(o==="push"||o==="pull_request")&&(r.push(" branches:"),r.push(` - ${x.branch||"main"}`))}),r.push(""),x.variables.length>0&&(r.push("env:"),x.variables.filter(o=>!o.isSecret).forEach(o=>{r.push(` ${o.name}: ${o.value}`)}),r.push("")),r.push("jobs:"),x.stages.forEach(o=>{o.jobs.forEach(t=>{r.push(` ${o.name.toLowerCase().replace(/\s+/g,"-")}-${t.name.toLowerCase().replace(/\s+/g,"-")}:`),r.push(` name: ${t.name}`),t.runner&&r.push(` runs-on: ${t.runner}`),o.dependsOn?.length&&r.push(` needs: [${o.dependsOn.join(", ")}]`),r.push(" steps:"),t.steps.forEach(a=>{a.type==="checkout"?r.push(" - uses: actions/checkout@v4"):a.type==="action"&&a.action?(r.push(` - uses: ${a.action}${a.actionVersion?`@${a.actionVersion}`:""}`),a.with&&Object.keys(a.with).length>0&&(r.push(" with:"),Object.entries(a.with).forEach(([p,i])=>{r.push(` ${p}: ${i}`)}))):a.type==="script"&&a.script&&(r.push(` - name: ${a.name}`),r.push(" run: |"),a.script.split(`
|
|
10
|
+
`).forEach(p=>{r.push(` ${p}`)}))})})}),r.join(`
|
|
11
|
+
`)},[x]);return e.jsxs("div",{className:`nice-pipeline-editor ${Y||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...k},"data-testid":I,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsx("span",{style:{fontSize:"20px"},children:"βοΈ"}),e.jsx("input",{type:"text",value:x.name,onChange:r=>N({...x,name:r.target.value}),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"14px",fontWeight:500,width:"250px"}})]}),e.jsx("div",{style:{flex:1}}),e.jsx(xe.Ll,{steps:xe.El(G,He)}),e.jsx("button",{onClick:()=>Q(!0),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"π Templates"}),e.jsx("button",{onClick:A,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"β Validate"}),e.jsx("button",{onClick:z,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:"πΎ Save"}),e.jsx("button",{onClick:v,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px",fontWeight:500},children:"βΆ Run Pipeline"})]}),e.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--border-color, #333)"},children:[{id:"visual",label:"π¨ Visual Editor"},{id:"yaml",label:"π YAML"},{id:"triggers",label:"β‘ Triggers"},{id:"variables",label:"π§ Variables"}].map(r=>e.jsx("button",{onClick:()=>g(r.id),style:{padding:"10px 20px",border:"none",background:m===r.id?"var(--bg-elevated, #1e1e1e)":"transparent",color:m===r.id?"var(--bg-primary, #fff)":"var(--text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:m===r.id?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:r.label},r.id))}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[m==="visual"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{width:"300px",borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:"Stages"}),e.jsx("button",{onClick:q,style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Stage"})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"8px"},children:[x.stages.map((r,o)=>e.jsxs("div",{children:[o>0&&e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"4px"},children:e.jsx("span",{style:{color:"var(--bg-tertiary, #444)"},children:"β"})}),e.jsxs("div",{onClick:()=>{J(r.id),Z(null)},style:{padding:"12px",background:y===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:y===r.id?"1px solid var(--nice-primary, #3b82f6)":"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[e.jsx("span",{style:{fontWeight:500,fontSize:"13px"},children:r.name}),e.jsxs("div",{style:{display:"flex",gap:"4px"},children:[o>0&&e.jsx("button",{onClick:t=>{t.stopPropagation(),M(r.id,"up")},style:{padding:"2px 4px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"β"}),o<x.stages.length-1&&e.jsx("button",{onClick:t=>{t.stopPropagation(),M(r.id,"down")},style:{padding:"2px 4px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:"2px",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"β"}),e.jsx("button",{onClick:t=>{t.stopPropagation(),H(r.id)},style:{padding:"2px 4px",background:"var(--color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"β"})]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:[r.jobs.length," job",r.jobs.length!==1?"s":""," β’"," ",r.parallel?"Parallel":"Sequential"]})]})]},r.id)),x.stages.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-muted, #666)",padding:"24px",fontSize:"12px"},children:"No stages yet. Add a stage to get started."})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:O?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("span",{style:{fontWeight:500},children:["Stage: ",O.name]}),e.jsx("button",{onClick:()=>T(O.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Job"})]}),e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{width:"200px",borderRight:"1px solid var(--border-color, #333)",overflow:"auto",padding:"8px"},children:O.jobs.map(r=>e.jsxs("div",{onClick:()=>Z(r.id),style:{padding:"10px",marginBottom:"4px",background:W===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--bg-elevated, #252525)",borderRadius:"6px",cursor:"pointer",border:W===r.id?"1px solid var(--nice-primary, #3b82f6)":"1px solid transparent"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:"12px",fontWeight:500},children:r.name}),e.jsx("button",{onClick:o=>{o.stopPropagation(),E(O.id,r.id)},style:{padding:"2px 4px",background:"var(--color-error, #ef4444)",border:"none",borderRadius:"2px",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"9px"},children:"β"})]}),e.jsxs("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginTop:"4px"},children:[r.steps.length," steps"]})]},r.id))}),d?e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[e.jsxs("h3",{style:{margin:0,fontSize:"14px"},children:["Job: ",d.name]}),e.jsx("button",{onClick:()=>U(O.id,d.id),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-accent, #8b5cf6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Step"})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"12px",marginBottom:"16px",padding:"12px",background:"var(--bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--text-muted, #888)",display:"block",marginBottom:"4px"},children:"Runner"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"Select runner..."}),w.map(r=>e.jsxs("option",{value:r.id,children:[r.name," (",r.os,")"]},r.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{fontSize:"11px",color:"var(--text-muted, #888)",display:"block",marginBottom:"4px"},children:"Environment"}),e.jsxs("select",{style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"",children:"No environment"}),P.map(r=>e.jsxs("option",{value:r.id,children:[r.name," ",r.protection&&"π"]},r.id))]})]})]}),d.steps.map((r,o)=>e.jsxs("div",{style:{marginBottom:"8px",padding:"12px",background:"var(--bg-elevated, #252525)",borderRadius:"8px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx("span",{style:{fontSize:"16px"},children:qe[r.type]}),e.jsx("span",{style:{fontSize:"12px",fontWeight:500,flex:1},children:r.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #888)",padding:"2px 6px",background:"var(--bg-tertiary, #333)",borderRadius:"4px"},children:r.type}),e.jsx("button",{onClick:()=>L(O.id,d.id,r.id),style:{padding:"2px 6px",background:"var(--color-error, #ef4444)",border:"none",borderRadius:"4px",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"β"})]}),r.type==="script"&&r.script&&e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"4px",fontSize:"10px",fontFamily:"monospace",overflow:"auto"},children:r.script}),r.type==="action"&&e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:["uses: ",r.action,r.actionVersion&&`@${r.actionVersion}`]})]},r.id)),d.steps.length===0&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-muted, #666)",padding:"24px",fontSize:"12px"},children:"No steps yet. Add a step to define what this job does."})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted, #666)"},children:"Select a job to edit its steps"})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted, #666)"},children:"Select a stage to view its jobs"})})]}),m==="yaml"&&e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("pre",{style:{margin:0,padding:"16px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",fontFamily:"monospace",fontSize:"12px",lineHeight:"1.6",whiteSpace:"pre-wrap"},children:l})}),m==="triggers"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:"Pipeline Triggers"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"16px"},children:["push","pull_request","schedule","manual","tag","workflow_dispatch"].map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"16px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:x.triggers.includes(r)?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:[e.jsx("input",{type:"checkbox",checked:x.triggers.includes(r),onChange:o=>{const t=o.target.checked?[...x.triggers,r]:x.triggers.filter(a=>a!==r);N({...x,triggers:t})}}),e.jsx("span",{style:{fontSize:"24px"},children:Ge[r]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"13px"},children:r.replace("_"," ")}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:[r==="push"&&"Run on push to branch",r==="pull_request"&&"Run on PR/MR",r==="schedule"&&"Run on schedule (cron)",r==="manual"&&"Manual trigger only",r==="tag"&&"Run on tag push",r==="workflow_dispatch"&&"API/UI trigger"]})]})]},r))})]}),m==="variables"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"24px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[e.jsx("h3",{style:{margin:0,fontSize:"14px"},children:"Variables & Secrets"}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:h,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"+ Add Variable"}),e.jsx("button",{onClick:C,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-warning, #f59e0b)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"π Add Secret"})]})]}),e.jsxs("div",{style:{background:"var(--bg-elevated, #252525)",borderRadius:"8px",overflow:"hidden"},children:[e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"12px"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"var(--bg-elevated, #1e1e1e)"},children:[e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:"Name"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"left",fontWeight:500},children:"Value"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"center",fontWeight:500},children:"Type"}),e.jsx("th",{style:{padding:"10px 16px",textAlign:"right",fontWeight:500},children:"Actions"})]})}),e.jsx("tbody",{children:x.variables.map(r=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border-color, #333)",fontFamily:"monospace"},children:r.name}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border-color, #333)"},children:r.isSecret?"β’β’β’β’β’β’β’β’":r.value}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border-color, #333)",textAlign:"center"},children:e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:r.isSecret?"var(--nice-warning-tint-15, #f59e0b22)":"var(--nice-primary-tint-15, #3b82f622)",color:r.isSecret?"var(--color-warning, #f59e0b)":"var(--color-primary, #3b82f6)",fontSize:"10px"},children:r.isSecret?"π Secret":"Variable"})}),e.jsx("td",{style:{padding:"10px 16px",borderBottom:"1px solid var(--border-color, #333)",textAlign:"right"},children:e.jsx("button",{onClick:()=>b(r.name),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Remove"})})]},r.name))})]}),x.variables.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--text-muted, #666)",fontSize:"12px"},children:"No variables defined"})]})]})]}),D&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"var(--bg-elevated, #252525)",borderRadius:"12px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsx("span",{style:{fontWeight:600},children:"Pipeline Templates"}),e.jsx("button",{onClick:()=>Q(!1),style:{background:"none",border:"none",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:"β"})]}),e.jsx("div",{style:{maxHeight:"60vh",overflow:"auto",padding:"16px"},children:j.map(r=>e.jsxs("div",{onClick:()=>{S(r),Q(!1)},style:{display:"flex",alignItems:"center",gap:"16px",padding:"16px",marginBottom:"8px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:"32px"},children:r.icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:"14px",marginBottom:"4px"},children:r.name}),e.jsx("div",{style:{fontSize:"12px",color:"var(--text-muted, #888)"},children:r.description}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #666)",marginTop:"4px"},children:r.category})]})]},r.id))})]})})]})},Ue=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:Ce},Symbol.toStringTag,{value:"Module"})),pe={queued:{color:"var(--text-muted, #6b7280)",icon:"β³",label:"Queued"},pending:{color:"var(--text-muted, #6b7280)",icon:"β³",label:"Pending"},waiting:{color:"var(--color-warning, #f59e0b)",icon:"βΈοΈ",label:"Waiting"},in_progress:{color:"var(--color-primary, #3b82f6)",icon:"π",label:"In Progress"},running:{color:"var(--color-primary, #3b82f6)",icon:"π",label:"Running"},completed:{color:"var(--color-success, #22c55e)",icon:"β",label:"Completed"},success:{color:"var(--color-success, #22c55e)",icon:"β",label:"Success"},failed:{color:"var(--color-error, #ef4444)",icon:"β",label:"Failed"},failure:{color:"var(--color-error, #ef4444)",icon:"β",label:"Failed"},cancelled:{color:"var(--text-muted, #6b7280)",icon:"β",label:"Cancelled"},skipped:{color:"var(--text-muted, #6b7280)",icon:"β·",label:"Skipped"}},we=({runs:x,stats:j,selectedRunId:w,onRunSelect:P,onCancel:N,onRerun:q,onRerunFromStage:H,onDownloadArtifact:M,onDownloadLogs:T,onApprove:E,onReject:U,className:L,style:h,"data-testid":b})=>{const[C,B]=n.useState("all"),[S,z]=n.useState("all"),[v,A]=n.useState(new Set),[G,Y]=n.useState(new Set),[k,I]=n.useState(null),m=x.find(d=>d.id===w),g=n.useMemo(()=>x.filter(d=>!(C!=="all"&&d.status!==C||S!=="all"&&d.branch!==S)),[x,C,S]),y=n.useMemo(()=>[...new Set(x.map(d=>d.branch))],[x]),J=d=>{if(!d)return"-";const l=Math.floor(d/1e3);if(l<60)return`${l}s`;const r=Math.floor(l/60),o=l%60;if(r<60)return`${r}m ${o}s`;const t=Math.floor(r/60),a=r%60;return`${t}h ${a}m`},W=d=>d?new Date(d).toLocaleString():"-",Z=d=>d<1024?`${d} B`:d<1024*1024?`${(d/1024).toFixed(1)} KB`:`${(d/(1024*1024)).toFixed(1)} MB`,D=d=>{A(l=>{const r=new Set(l);return r.has(d)?r.delete(d):r.add(d),r})},Q=d=>{Y(l=>{const r=new Set(l);return r.has(d)?r.delete(d):r.add(d),r})},O=()=>{if(!k||!m)return[];for(const d of m.stages)for(const l of d.jobs)if(l.id===k.jobId)return l.steps.find(o=>o.id===k.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${L||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...h},"data-testid":b,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column"},children:[j&&e.jsx("div",{style:{padding:"16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"12px",textAlign:"center"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--color-primary, #3b82f6)"},children:j.totalRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:"Total Runs"})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--color-success, #22c55e)"},children:[j.successRate.toFixed(0),"%"]}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:"Success Rate"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--color-warning, #f59e0b)"},children:J(j.avgDuration)}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:"Avg Duration"})]}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"20px",fontWeight:600,color:"var(--color-error, #ef4444)"},children:j.failedRuns}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:"Failed"})]})]})}),e.jsxs("div",{style:{padding:"12px",borderBottom:"1px solid var(--border-color, #333)",display:"flex",gap:"8px"},children:[e.jsxs("select",{value:C,onChange:d=>B(d.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"in_progress",children:"In Progress"}),e.jsx("option",{value:"completed",children:"Completed"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"cancelled",children:"Cancelled"})]}),e.jsxs("select",{value:S,onChange:d=>z(d.target.value),style:{flex:1,padding:"6px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:[e.jsx("option",{value:"all",children:"All Branches"}),y.map(d=>e.jsx("option",{value:d,children:d},d))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[g.map(d=>{const l=pe[d.status];return e.jsxs("div",{onClick:()=>P(d.id),style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",cursor:"pointer",background:w===d.id?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"6px"},children:[e.jsx("span",{style:{fontSize:"16px",animation:d.status==="in_progress"?"spin 1s linear infinite":"none"},children:l.icon}),e.jsxs("span",{style:{flex:1,fontWeight:500,fontSize:"13px"},children:[d.pipelineName," #",d.runNumber]}),e.jsx("span",{style:{padding:"2px 8px",borderRadius:"4px",background:`${l.color}22`,color:l.color,fontSize:"10px"},children:l.label})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",fontSize:"11px",color:"var(--text-muted, #888)"},children:[e.jsxs("span",{children:["π ",d.branch]}),e.jsx("span",{children:"β’"}),e.jsx("span",{children:d.commit.sha.slice(0,7)}),e.jsx("span",{children:"β’"}),e.jsx("span",{children:J(d.duration)})]}),e.jsx("div",{style:{marginTop:"6px",fontSize:"11px",color:"var(--text-muted, #666)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.commit.message})]},d.id)}),g.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--text-muted, #666)",fontSize:"12px"},children:"No pipeline runs match the filters"})]})]}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:m?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"12px"},children:[e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:"0 0 4px 0",fontSize:"16px",fontWeight:500},children:[m.pipelineName," #",m.runNumber]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",fontSize:"12px",color:"var(--text-muted, #888)"},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[m.commit.authorAvatar&&e.jsx("img",{src:m.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),m.commit.author]}),e.jsxs("span",{children:["π ",m.branch]}),e.jsxs("span",{children:["π ",m.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(m.status==="in_progress"||m.status==="queued"||m.status==="waiting")&&e.jsx("button",{onClick:()=>N(m.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Cancel"}),e.jsx("button",{onClick:()=>q(m.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Re-run"}),e.jsx("button",{onClick:()=>T(m.id),style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"π₯ Logs"})]})]}),e.jsxs("div",{style:{display:"flex",gap:"16px",fontSize:"12px"},children:[e.jsxs("span",{children:["Started: ",W(m.startedAt)]}),m.completedAt&&e.jsxs("span",{children:["Completed: ",W(m.completedAt)]}),e.jsxs("span",{children:["Duration: ",J(m.duration)]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:m.stages.map((d,l)=>{const r=pe[d.status],o=v.has(d.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>D(d.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:`2px solid ${r.color}44`},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:o?"βΌ":"βΆ"}),e.jsx("span",{style:{fontSize:"16px"},children:r.icon}),e.jsx("span",{style:{flex:1,fontWeight:500},children:d.name}),e.jsx("span",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:J(d.duration)}),d.status==="waiting"&&E&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t=>{t.stopPropagation(),E(m.id,d.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Approve"}),e.jsx("button",{onClick:t=>{t.stopPropagation(),U?.(m.id,d.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Reject"})]}),e.jsx("button",{onClick:t=>{t.stopPropagation(),H(m.id,d.id)},style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Re-run from here"})]}),o&&e.jsx("div",{style:{marginLeft:"32px",marginTop:"8px"},children:d.jobs.map(t=>{const a=pe[t.status],p=G.has(t.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>Q(t.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${a.color}`},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)",fontSize:"10px"},children:p?"βΌ":"βΆ"}),e.jsx("span",{style:{fontSize:"14px"},children:a.icon}),e.jsx("span",{style:{flex:1,fontSize:"12px"},children:t.name}),t.runner&&e.jsxs("span",{style:{fontSize:"10px",color:"var(--text-muted, #666)"},children:["π₯οΈ ",t.runner]}),e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:J(t.duration)})]}),p&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:t.steps.map(i=>{const f=pe[i.status];return e.jsxs("div",{onClick:()=>I({jobId:t.id,stepId:i.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:i.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{fontSize:"12px"},children:f.icon}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:i.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:J(i.duration)}),i.logs?.length?e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #666)"},children:"π"}):null]},i.id)})})]},t.id)})}),l<m.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"var(--bg-tertiary, #444)"},children:"β"})]},d.id)})}),m.artifacts.length>0&&e.jsxs("div",{style:{marginTop:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",color:"var(--text-muted, #888)"},children:"Artifacts"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"8px"},children:m.artifacts.map(d=>e.jsxs("div",{onClick:()=>M(d),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer"},children:[e.jsx("span",{style:{fontSize:"24px"},children:"π¦"}),e.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[e.jsx("div",{style:{fontSize:"12px",fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d.name}),e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:Z(d.size)})]}),e.jsx("span",{style:{fontSize:"16px"},children:"π₯"})]},d.id))})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted, #666)"},children:"Select a pipeline run to view details"})}),k&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"80%",height:"80%",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx("span",{style:{fontWeight:500},children:"Step Logs"}),e.jsx("button",{onClick:()=>I(null),style:{background:"none",border:"none",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:"β"})]}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"12px"},children:e.jsx("pre",{style:{margin:0,fontFamily:"monospace",fontSize:"11px",lineHeight:"1.5",whiteSpace:"pre-wrap",color:"var(--text-secondary, #d4d4d4)"},children:O().join(`
|
|
12
|
+
`)||"No logs available"})})]})}),e.jsx("style",{children:`
|
|
13
|
+
@keyframes spin {
|
|
14
|
+
from { transform: rotate(0deg); }
|
|
15
|
+
to { transform: rotate(360deg); }
|
|
16
|
+
}
|
|
17
|
+
`})]})},Ve=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:we},Symbol.toStringTag,{value:"Module"}));exports.NiceBranchManager=be;exports.NiceBranchManager$1=We;exports.NiceGitBlame=je;exports.NiceGitBlame$1=Ee;exports.NiceGitConflictResolver=ke;exports.NiceGitConflictResolver$1=Oe;exports.NiceGitDiffViewer=ye;exports.NiceGitDiffViewer$1=Ne;exports.NiceGitGraph=me;exports.NiceGitGraph$1=Te;exports.NiceGitHooks=Se;exports.NiceGitHooks$1=Fe;exports.NiceMergeRequestBuilder=ve;exports.NiceMergeRequestBuilder$1=Pe;exports.NicePipelineEditor=Ce;exports.NicePipelineEditor$1=Ue;exports.NicePipelineMonitor=we;exports.NicePipelineMonitor$1=Ve;
|