@nice2dev/ui 1.0.10 → 1.0.12
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/README.md +44 -0
- package/dist/NiceErrorBoundary-BZEHCXNM.cjs +1 -0
- package/dist/NiceErrorBoundary-D6jw6wwD.js +762 -0
- package/dist/NiceErrorBoundary-DT5XPTeu.cjs +1 -0
- package/dist/NiceErrorBoundary-SqPtbIxK.js +762 -0
- package/dist/NiceForm-BgR-m8T9.cjs +382 -0
- package/dist/NiceForm-CI_vgkD4.cjs +382 -0
- package/dist/NiceForm-DYKciCeR.js +5131 -0
- package/dist/NiceForm-t9zdH8kU.js +5343 -0
- package/dist/NiceForm.css +1 -1
- package/dist/NiceModal-Br3J9jOV.cjs +1 -0
- package/dist/NiceModal-DQ7u-xVm.cjs +1 -0
- package/dist/NiceModal-DVAsBzHP.js +95 -0
- package/dist/NiceModal-IkSunDgK.js +95 -0
- package/dist/NiceModuleLifecyclePanel-Cj4x54sw.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-D-xBAp1_.js +5228 -0
- package/dist/NiceModuleLifecyclePanel-D3azLDdj.js +5249 -0
- package/dist/NiceModuleLifecyclePanel-DEfAIhFf.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-CbB5P1N_.js +171 -0
- package/dist/NicePagination-DDFkSRr9.js +171 -0
- package/dist/NicePagination-DGHtXqy1.cjs +1 -0
- package/dist/NicePagination-UGjzvRUS.cjs +1 -0
- package/dist/NicePinCodeInput-BhIABBTV.cjs +419 -0
- package/dist/NicePinCodeInput-BmRO9HSQ.js +11830 -0
- package/dist/NicePinCodeInput-D91uvVsF.cjs +419 -0
- package/dist/NicePinCodeInput-jMNfPqOx.js +11866 -0
- package/dist/NicePinCodeInput.css +1 -1
- package/dist/NiceSavedQueryPanel-7nZe46t8.cjs +596 -0
- package/dist/NiceSavedQueryPanel-BSGzs7Oc.js +6449 -0
- package/dist/NiceSavedQueryPanel-BkYRk5cX.js +6441 -0
- package/dist/NiceSavedQueryPanel-CmFSi21-.cjs +596 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceTabs-BeaxZzAO.js +1636 -0
- package/dist/NiceTabs-C4H5un8J.cjs +1 -0
- package/dist/NiceTabs-DcbYFIWR.cjs +1 -0
- package/dist/NiceTabs-DlsCMth_.js +1622 -0
- package/dist/NiceWindow-BNrA5Dxq.js +1409 -0
- package/dist/NiceWindow-Bga9fOkg.js +1409 -0
- package/dist/NiceWindow-CbzJmurQ.cjs +1 -0
- package/dist/NiceWindow-CxWTj5xH.cjs +1 -0
- package/dist/charts-BcvKWYUl.cjs +759 -0
- package/dist/charts-DZvmvfhM.js +4621 -0
- package/dist/charts-F_b5-OR8.js +4621 -0
- package/dist/charts-e10jGjuF.cjs +759 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-B4b1BmHt.js +22177 -0
- package/dist/core-CSfXTICE.cjs +96 -0
- package/dist/core-CjmLbclt.cjs +96 -0
- package/dist/core-ClmvtMVZ.js +22253 -0
- package/dist/data-branching-B_9C6-hE.cjs +1 -0
- package/dist/data-branching-BmCKIXgr.js +6121 -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 +2 -2
- package/dist/data.mjs +1 -1
- package/dist/devops-BL39OCVh.js +7660 -0
- package/dist/devops-CkuTC7RJ.cjs +17 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +92 -6
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +2 -2
- package/dist/index-BU6KCDpP.js +57872 -0
- package/dist/index-D7i7sZGV.cjs +5194 -0
- package/dist/index-DlHlXz8e.js +57319 -0
- package/dist/index-Dx726U90.cjs +5192 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +448 -20
- package/dist/index.mjs +881 -868
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.mjs +24 -24
- package/dist/no-code-Bb3QFKdm.cjs +332 -0
- package/dist/no-code-snLY0d6I.js +7065 -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 +81 -81
- package/dist/vendor-DF586kuF.js +271 -0
- package/dist/vendor-DHEorsoy.cjs +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),i=require("react"),pe=["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)"],xe=24,ue=40,fe=28,ze=6,Re=4;function Ie(x,y,z,N){const P=[],q=[],G=new Map;x.forEach((h,m)=>G.set(h.hash,m));const M=new Map,T=[],L=new Map;let U=0;const F=new Map;if(y.forEach(h=>{if(!h.lastCommit)return;const m=F.get(h.lastCommit)||[];m.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)"}),F.set(h.lastCommit,m)}),z.forEach(h=>{const m=F.get(h.commit)||[];m.push({type:"tag",name:h.name,commit:h.commit,color:"var(--color-warning, #f59e0b)"}),F.set(h.commit,m)}),N){const h=F.get(N)||[];h.push({type:"head",name:"HEAD",commit:N,color:"var(--color-error, #ef4444)"}),F.set(N,h)}return x.forEach((h,m)=>{let w=T.findIndex(C=>C===h.hash);w===-1&&(w=T.findIndex(C=>C===null),w===-1&&(w=T.length,T.push(null))),L.has(w)||(L.set(w,pe[U%pe.length]),U++),M.set(h.hash,w);const B=L.get(w)||pe[0];P.push({commit:h,x:w,y:m,color:B,refs:F.get(h.hash)||[]}),h.parents.forEach((C,j)=>{const v=G.get(C);if(v!==void 0){let W=M.get(C);W===void 0&&(j===0?(W=w,T[w]=C):(W=T.findIndex(A=>A===null),W===-1?(W=T.length,T.push(C)):T[W]=C),M.set(C,W));const V=L.get(W)||B;q.push({from:h.hash,to:C,fromX:w,fromY:m,toX:W,toY:v,color:j===0?B:V,type:j===0?w===W?"straight":"branch":"merge"})}}),(h.parents.length===0||!x.slice(m+1).some(C=>C.parents.includes(h.hash)))&&(T[w]=null)}),{nodes:P,edges:q}}const Be=({nodes:x,edges:y,selectedHash:z,compact:N,onNodeClick:P,onNodeDoubleClick:q})=>{const G=N?fe:ue,M=N?Re:ze,L=(Math.max(...x.map(m=>m.x),0)+2)*xe,U=(x.length+1)*G,F=m=>xe/2+m*xe,h=m=>G/2+m*G;return e.jsxs("svg",{width:L,height:U,style:{minWidth:L,minHeight:U,display:"block"},children:[y.map((m,w)=>{const B=F(m.fromX),C=h(m.fromY),j=F(m.toX),v=h(m.toY);if(m.type==="straight")return e.jsx("line",{x1:B,y1:C,x2:j,y2:v,stroke:m.color,strokeWidth:2},w);const W=(C+v)/2,V=`M ${B} ${C} C ${B} ${W}, ${j} ${W}, ${j} ${v}`;return e.jsx("path",{d:V,fill:"none",stroke:m.color,strokeWidth:2,strokeDasharray:m.type==="merge"?"4,2":void 0},w)}),x.map(m=>{const w=F(m.x),B=h(m.y),C=m.commit.hash===z,j=m.commit.isMerge;return e.jsxs("g",{onClick:()=>P(m.commit.hash),onDoubleClick:()=>q(m.commit.hash),style:{cursor:"pointer"},children:[C&&e.jsx("circle",{cx:w,cy:B,r:M+4,fill:"none",stroke:"var(--nice-bg, #fff)",strokeWidth:2}),e.jsx("circle",{cx:w,cy:B,r:M,fill:j?"var(--bg-elevated, #1e1e1e)":m.color,stroke:m.color,strokeWidth:j?2:0}),m.refs.length>0&&!N&&e.jsx("foreignObject",{x:w+10,y:B-8,width:200,height:16,children:e.jsx("div",{style:{display:"flex",gap:4,whiteSpace:"nowrap"},children:m.refs.map((v,W)=>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]},W))})})]},m.commit.hash)})]})},ge=({commits:x,branches:y,tags:z,head:N,selectedCommit:P,branchFilter:q,authorFilter:G,dateRange:M,searchQuery:T,maxCommits:L=100,showRemotes:U=!0,showTags:F=!0,compact:h=!1,onCommitSelect:m,onCommitDoubleClick:w,onBranchCheckout:B,onBranchCreate:C,onTagCreate:j,onCherryPick:v,onRevert:W,onReset:V,onCompare:A,onViewDiff:D,className:b,style:S,"data-testid":u})=>{const[k,E]=i.useState(P),[_,K]=i.useState(null),[O,Y]=i.useState(!1),[X,d]=i.useState(null),r=i.useRef(null),a=P??k,o=i.useMemo(()=>{let f=x;if(q&&q.length>0){const I=new Set;y.filter(J=>q.includes(J.name)).forEach(J=>{J.lastCommit&&I.add(J.lastCommit)}),f=f.filter(J=>I.has(J.hash))}if(G&&G.length>0&&(f=f.filter(I=>G.some(J=>I.author.name.toLowerCase().includes(J.toLowerCase())||I.author.email.toLowerCase().includes(J.toLowerCase())))),M&&(M.from&&(f=f.filter(I=>I.date>=M.from)),M.to&&(f=f.filter(I=>I.date<=M.to))),T&&T.trim()){const I=T.toLowerCase();f=f.filter(J=>J.hash.toLowerCase().includes(I)||J.shortHash.toLowerCase().includes(I)||J.message.toLowerCase().includes(I)||J.author.name.toLowerCase().includes(I))}return f.slice(0,L)},[x,q,G,M,T,L,y]),{nodes:t,edges:p}=i.useMemo(()=>Ie(o,U?y:y.filter(f=>!f.isRemote),F?z:[],N),[o,y,z,N,U,F]),c=i.useMemo(()=>o.find(f=>f.hash===a),[o,a]),n=i.useCallback(f=>{if(O&&X)A?.(X,f),Y(!1),d(null);else if(O)d(f);else{E(f);const I=o.find(J=>J.hash===f);I&&m?.(I)}},[O,X,o,m,A]),g=i.useCallback(f=>{const I=o.find(J=>J.hash===f);I&&(w?.(I),D?.(f))},[o,w,D]),R=i.useCallback((f,I)=>{f.preventDefault(),K({x:f.clientX,y:f.clientY,commit:I})},[]),ee=i.useCallback(()=>K(null),[]),Z=f=>{const J=new Date().getTime()-f.getTime(),te=Math.floor(J/(1e3*60*60*24));return te===0?"Today":te===1?"Yesterday":te<7?`${te} days ago`:f.toLocaleDateString()},Q=h?fe:ue;return e.jsxs("div",{className:`nice-git-graph ${b||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...S},"data-testid":u,onClick:ee,children:[e.jsxs("div",{ref:r,style:{flex:1,overflow:"auto",display:"flex"},children:[e.jsx("div",{style:{flexShrink:0,borderRight:"1px solid var(--border-color, #333)"},children:e.jsx(Be,{nodes:t,edges:p,selectedHash:a,compact:h,onNodeClick:n,onNodeDoubleClick:g})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[t.map(f=>e.jsxs("div",{onClick:()=>n(f.commit.hash),onDoubleClick:()=>g(f.commit.hash),onContextMenu:I=>R(I,f.commit),style:{height:Q,padding:"0 12px",display:"flex",alignItems:"center",gap:12,cursor:"pointer",background:f.commit.hash===a?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderBottom:"1px solid var(--nice-bg-secondary, #2a2a2a)"},children:[f.commit.author.avatar?e.jsx("img",{src:f.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:f.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:h?10:12,color:"var(--bg-primary, #fff)",fontWeight:600,flexShrink:0},children:f.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:f.commit.message}),f.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:["+",f.commit.stats.additions]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",f.commit.stats.deletions]})]}),e.jsx("code",{style:{fontSize:h?10:11,color:"var(--text-muted, #888)",fontFamily:"monospace",flexShrink:0},children:f.commit.shortHash}),!h&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted, #888)",flexShrink:0,width:100},children:f.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:Z(f.commit.date)})]},f.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"})]})]}),c&&!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:[c.author.avatar?e.jsx("img",{src:c.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:c.author.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,fontSize:13},children:c.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:c.author.email})]})]}),e.jsx("code",{style:{fontSize:11,color:"var(--text-muted, #888)",fontFamily:"monospace"},children:c.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:c.message}),c.body&&e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #aaa)",whiteSpace:"pre-wrap",maxHeight:120,overflow:"auto"},children:c.body})]}),c.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:c.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:["+",c.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:["-",c.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:()=>D?.(c.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?.(c.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:()=>W?.(c.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:()=>C?.(c.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:()=>j?.(c.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:()=>{Y(!0),d(c.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..."})]})]}),O&&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:[X?`Select commit to compare with ${X.slice(0,7)}`:"Select first commit",e.jsx("button",{onClick:()=>{Y(!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"})]}),_&&e.jsx("div",{style:{position:"fixed",left:_.x,top:_.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:()=>D?.(_.commit.hash)},{label:"Cherry Pick",onClick:()=>v?.(_.commit.hash)},{label:"Revert",onClick:()=>W?.(_.commit.hash)},{divider:!0},{label:"Create Branch",onClick:()=>C?.(_.commit.hash)},{label:"Create Tag",onClick:()=>j?.(_.commit.hash)},{divider:!0},{label:"Reset Soft",onClick:()=>V?.(_.commit.hash,"soft")},{label:"Reset Mixed",onClick:()=>V?.(_.commit.hash,"mixed")},{label:"Reset Hard",onClick:()=>V?.(_.commit.hash,"hard"),danger:!0}].map((f,I)=>"divider"in f?e.jsx("div",{style:{height:1,background:"var(--bg-tertiary, #444)",margin:"4px 0"}},I):e.jsx("button",{onClick:()=>{f.onClick?.(),ee()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in f&&f.danger?"var(--color-error, #ef4444)":"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:J=>{J.currentTarget.style.background="var(--bg-tertiary, #333)"},onMouseOut:J=>{J.currentTarget.style.background="transparent"},children:f.label},I))})]})},Me=Object.freeze(Object.defineProperty({__proto__:null,NiceGitGraph:ge},Symbol.toStringTag,{value:"Module"})),he=({branches:x,currentBranch:y,defaultBranch:z="main",protectionRules:N=[],showRemotes:P=!0,selectedBranch:q,onBranchSelect:G,onCheckout:M,onCreateBranch:T,onDeleteBranch:L,onRenameBranch:U,onMerge:F,onRebase:h,onSetUpstream:m,onPush:w,onPull:B,onCompare:C,onProtectionChange:j,className:v,style:W,"data-testid":V})=>{const[A,D]=i.useState(""),[b,S]=i.useState("all"),[u,k]=i.useState(),[E,_]=i.useState(!1),[K,O]=i.useState(!1),[Y,X]=i.useState(!1),[d,r]=i.useState(""),[a,o]=i.useState(y||z),[t,p]=i.useState(""),[c,n]=i.useState(y||z),[g,R]=i.useState(null),ee=q??u,Z=i.useMemo(()=>{let l=x;if(b==="local"?l=l.filter(s=>!s.isRemote):b==="remote"?l=l.filter(s=>s.isRemote):P||(l=l.filter(s=>!s.isRemote)),A.trim()){const s=A.toLowerCase();l=l.filter($=>$.name.toLowerCase().includes(s))}return l.sort((s,$)=>s.isHead?-1:$.isHead?1:s.name===z?-1:$.name===z?1:s.isRemote!==$.isRemote?s.isRemote?1:-1:s.name.localeCompare($.name))},[x,b,P,A,z]),Q=i.useMemo(()=>{const l=Z.filter($=>!$.isRemote),s=Z.filter($=>$.isRemote);return{local:l,remote:s}},[Z]),f=i.useCallback(l=>{k(l),G?.(l)},[G]),I=i.useCallback((l,s)=>{l.preventDefault(),R({x:l.clientX,y:l.clientY,branch:s})},[]),J=i.useCallback(()=>R(null),[]),te=i.useCallback(()=>{d.trim()&&(T?.(d.trim(),a),r(""),_(!1))},[d,a,T]),ce=i.useCallback(()=>{t&&c&&t!==c&&(F?.(t,c),O(!1))},[t,c,F]),ae=l=>{if(!l)return"-";const $=new Date().getTime()-l.getTime(),re=Math.floor($/(1e3*60*60*24));return re===0?"Today":re===1?"Yesterday":re<7?`${re} days ago`:re<30?`${Math.floor(re/7)} weeks ago`:l.toLocaleDateString()},H=i.useMemo(()=>x.find(l=>l.name===ee),[x,ee]),ie=i.useCallback(l=>N.some(s=>new RegExp(s.pattern.replace(/\*/g,".*")).test(l)),[N]),ne=Q.local,se=l=>{const s=l.name===ee,$=l.isHead,re=l.name===z,Ce=ie(l.name);return e.jsxs("div",{onClick:()=>f(l.name),onDoubleClick:()=>M?.(l.name),onContextMenu:we=>I(we,l),style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",cursor:"pointer",background:s?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":$?"rgba(34, 197, 94, 0.08)":"transparent",borderLeft:$?"3px solid var(--nice-success, #22c55e)":"3px solid transparent"},children:[e.jsx("span",{style:{fontSize:16},children:l.isRemote?"☁️":$?"📍":"🌿"}),e.jsx("span",{style:{flex:1,fontSize:13,fontWeight:$?600:400,color:$?"var(--color-success, #22c55e)":"var(--text-primary, #e0e0e0)"},children:l.name}),e.jsxs("div",{style:{display:"flex",gap:4},children:[re&&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"}),Ce&&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"})]}),l.upstream&&(l.ahead||l.behind)&&e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10,color:"var(--text-muted, #888)"},children:[l.ahead?e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["↑",l.ahead]}):null,l.behind?e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["↓",l.behind]}):null]}),l.lastCommit&&e.jsx("span",{style:{fontSize:10,color:"var(--text-muted, #666)",width:80,textAlign:"right"},children:ae(l.lastCommit.date)})]},l.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",...W},"data-testid":V,onClick:J,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(l=>!l.isRemote).length," local"]})]}),e.jsx("input",{type:"text",placeholder:"Search branches...",value:A,onChange:l=>D(l.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(l=>e.jsx("button",{onClick:()=>S(l),style:{flex:1,padding:"6px 0",borderRadius:4,border:"none",background:b===l?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:11,textTransform:"capitalize"},children:l},l))})]}),e.jsxs("div",{style:{padding:8,borderBottom:"1px solid var(--border-color, #333)",display:"flex",gap:8},children:[e.jsx("button",{onClick:()=>_(!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:()=>O(!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:[Q.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 (",Q.local.length,")"]}),Q.local.map(se)]}),P&&Q.remote.length>0&&b!=="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 (",Q.remote.length,")"]}),Q.remote.map(se)]}),Z.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:H?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:H.isRemote?"☁️":H.isHead?"📍":"🌿"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:600},children:H.name}),H.description&&e.jsx("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--text-muted, #888)"},children:H.description})]}),H.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:H.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:H.upstream?e.jsxs(e.Fragment,{children:[e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["↑ ",H.ahead||0," ahead"]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["↓ ",H.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:H.lastCommit?e.jsxs(e.Fragment,{children:[e.jsx("code",{style:{fontSize:11,color:"var(--text-muted, #aaa)"},children:H.lastCommit.hash.slice(0,7)})," ",ae(H.lastCommit.date)]}):e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:"-"})})]})]}),H.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:H.lastCommit.message}),e.jsxs("div",{style:{fontSize:11,color:"var(--text-muted, #888)"},children:["by ",H.lastCommit.author]})]})]}),e.jsx("div",{style:{padding:16},children:e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:8},children:[!H.isHead&&e.jsx("button",{onClick:()=>M?.(H.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"}),H.upstream&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>B?.(H.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:()=>w?.(H.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"})]}),!H.upstream&&!H.isRemote&&e.jsx("button",{onClick:()=>m?.(H.name,`origin/${H.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:()=>{p(H.name),n(y||z),O(!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:()=>C?.(z,H.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"}),!H.isHead&&!H.isRemote&&!ie(H.name)&&e.jsx("button",{onClick:()=>L?.(H.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"})}),E&&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:()=>_(!1),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:24},onClick:l=>l.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:l=>r(l.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:a,onChange:l=>o(l.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:ne.map(l=>e.jsxs("option",{value:l.name,children:[l.name," ",l.isHead?"(current)":""]},l.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>_(!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"})]})]})}),K&&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:()=>O(!1),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:24},onClick:l=>l.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:l=>p(l.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..."}),ne.map(l=>e.jsx("option",{value:l.name,children:l.name},l.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:c,onChange:l=>n(l.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:ne.map(l=>e.jsxs("option",{value:l.name,children:[l.name," ",l.isHead?"(current)":""]},l.name))})]}),e.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[e.jsx("button",{onClick:()=>O(!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:ce,disabled:!t||!c||t===c,style:{padding:"10px 20px",borderRadius:6,border:"none",background:t&&c&&t!==c?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:t&&c&&t!==c?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Merge"})]})]})}),g&&e.jsx("div",{style:{position:"fixed",left:g.x,top:g.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:[!g.branch.isHead&&{label:"Checkout",onClick:()=>M?.(g.branch.name)},{label:"Compare",onClick:()=>C?.(z,g.branch.name)},{label:"Merge into current",onClick:()=>F?.(g.branch.name,y||z)},{divider:!0},!g.branch.isRemote&&{label:"Rename",onClick:()=>{const l=prompt("New name:",g.branch.name);l&&U?.(g.branch.name,l)}},!g.branch.isHead&&!g.branch.isRemote&&!ie(g.branch.name)&&{label:"Delete",onClick:()=>L?.(g.branch.name),danger:!0}].filter(Boolean).map((l,s)=>l?"divider"in l?e.jsx("div",{style:{height:1,background:"var(--bg-tertiary, #444)",margin:"4px 0"}},s):e.jsx("button",{onClick:()=>{l.onClick?.(),J()},style:{display:"block",width:"100%",padding:"8px 12px",border:"none",background:"transparent",color:"danger"in l&&l.danger?"var(--color-error, #ef4444)":"var(--bg-primary, #fff)",textAlign:"left",cursor:"pointer",fontSize:12},onMouseOver:$=>$.currentTarget.style.background="var(--bg-tertiary, #333)",onMouseOut:$=>$.currentTarget.style.background="transparent",children:l.label},s):null)})]})},Te=Object.freeze(Object.defineProperty({__proto__:null,NiceBranchManager:he},Symbol.toStringTag,{value:"Module"})),me=({branches:x,users:y=[],labels:z=[],issues:N=[],templates:P=[],diff:q,currentBranch:G,defaultTargetBranch:M="main",initialSourceBranch:T,platform:L="github",onSubmit:U,onCancel:F,onBranchChange:h,onPreview:m,className:w,style:B,"data-testid":C})=>{const[j,v]=i.useState(""),[W,V]=i.useState(""),[A,D]=i.useState(T||G||""),[b,S]=i.useState(M),[u,k]=i.useState(!1),[E,_]=i.useState([]),[K,O]=i.useState([]),[Y,X]=i.useState([]),[d,r]=i.useState([]),[a,o]=i.useState(!1),[t,p]=i.useState(!0),[c,n]=i.useState(!1),[g,R]=i.useState(!1),[ee,Z]=i.useState(!1),[Q,f]=i.useState(!1),I=i.useMemo(()=>A?A.replace(/^(feature|bugfix|hotfix|release)\//,"").replace(/[-_]/g," ").replace(/\b\w/g,$=>$.toUpperCase()):"",[A]),J=i.useMemo(()=>x.filter(s=>!s.isRemote),[x]),te=i.useCallback((s,$)=>{D(s),S($),h?.(s,$)},[h]),ce=i.useCallback(()=>{if(!A||!b||!j.trim())return;const s={title:j.trim(),description:W.trim(),sourceBranch:A,targetBranch:b,isDraft:u,labels:E,reviewers:K,assignees:Y,linkedIssues:d,squashCommits:a,deleteSourceBranch:t};U?.(s)},[j,W,A,b,u,E,K,Y,d,a,t,U]),ae=s=>{V(s.content),f(!1)},H=s=>{_($=>$.includes(s)?$.filter(re=>re!==s):[...$,s])},ie=s=>{O($=>$.includes(s)?$.filter(re=>re!==s):[...$,s])},ne=s=>{r($=>$.includes(s)?$.filter(re=>re!==s):[...$,s])},se={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"}},l=A&&b&&A!==b&&j.trim();return e.jsxs("div",{className:`nice-merge-request-builder ${w||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...B},"data-testid":C,children:[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:[u?"Draft ":"",se[L].title]}),e.jsxs("p",{style:{margin:"4px 0 0",fontSize:12,color:"var(--text-muted, #888)"},children:["Create a new ",L==="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:A,onChange:s=>te(s.target.value,b),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..."}),J.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:b,onChange:s=>te(A,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:J.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"]})]}),A===b&&A&&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:j,onChange:s=>v(s.target.value),placeholder:I||"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}}),!j&&I&&e.jsxs("button",{onClick:()=>v(I),style:{marginTop:4,padding:0,background:"none",border:"none",color:"var(--color-primary, #3b82f6)",fontSize:11,cursor:"pointer"},children:['Use suggested: "',I,'"']})]}),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"}),P.length>0&&e.jsx("button",{onClick:()=>f(!Q),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:W,onChange:s=>V(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"}})]}),Q&&P.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"}),P.map(s=>e.jsxs("button",{onClick:()=>ae(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:()=>n(!c),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"}),E.length>0&&e.jsxs("span",{style:{color:"var(--color-primary, #3b82f6)"},children:["(",E.length,")"]})]})}),c&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:z.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:E.includes(s.id),onChange:()=>H(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:()=>R(!g),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"}),K.length>0&&e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["(",K.length,")"]})]})}),g&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:y.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:K.includes(s.id),onChange:()=>ie(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:()=>Z(!ee),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"}),d.length>0&&e.jsxs("span",{style:{color:"var(--color-accent, #8b5cf6)"},children:["(",d.length,")"]})]})}),ee&&e.jsx("div",{style:{marginTop:8,padding:8,background:"var(--bg-tertiary, #333)",borderRadius:6,maxHeight:200,overflow:"auto"},children:N.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:d.includes(s.id),onChange:()=>ne(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:u,onChange:s=>k(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:a,onChange:s=>o(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:t,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:F,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:()=>m?.({title:j,description:W,sourceBranch:A,targetBranch:b,isDraft:u,labels:E,reviewers:K,assignees:Y,linkedIssues:d,squashCommits:a,deleteSourceBranch:t}),disabled:!l,style:{padding:"10px 20px",borderRadius:6,border:"none",background:l?"var(--bg-tertiary, #333)":"var(--bg-elevated, #222)",color:l?"var(--bg-primary, #fff)":"var(--text-muted, #666)",cursor:l?"pointer":"not-allowed",fontSize:13},children:"Preview"}),e.jsx("button",{onClick:ce,disabled:!l,style:{padding:"10px 24px",borderRadius:6,border:"none",background:l?"var(--color-success, #22c55e)":"var(--bg-elevated, #222)",color:l?"var(--bg-primary, #fff)":"var(--text-muted, #666)",cursor:l?"pointer":"not-allowed",fontSize:13,fontWeight:500},children:u?"Create Draft":se[L].btn})]})]})},We=Object.freeze(Object.defineProperty({__proto__:null,NiceMergeRequestBuilder:me},Symbol.toStringTag,{value:"Module"})),be=({files:x,viewMode:y,showWhitespace:z,comments:N=[],selectedFile:P,showFileTree:q=!0,contextLines:G=3,baseRef:M,headRef:T,onFileSelect:L,onViewModeChange:U,onAddComment:F,onResolveComment:h,onExpandChunk:m,className:w,style:B,"data-testid":C})=>{const[j,v]=i.useState("split"),[W,V]=i.useState(!1),[A,D]=i.useState(x[0]?.path),[b,S]=i.useState(new Set),[u,k]=i.useState(null),E=y??j,_=z??W,K=P??A,O=i.useMemo(()=>x.find(n=>n.path===K),[x,K]),Y=i.useMemo(()=>({additions:x.reduce((n,g)=>n+g.additions,0),deletions:x.reduce((n,g)=>n+g.deletions,0)}),[x]),X=i.useCallback(n=>{D(n),L?.(n)},[L]),d=i.useCallback(n=>{v(n),U?.(n)},[U]),r=i.useCallback((n,g)=>{const R=`${n}:${g}`;S(ee=>{const Z=new Set(ee);return Z.has(R)?Z.delete(R):Z.add(R),Z}),m?.(n,g)},[m]),a=i.useMemo(()=>N.filter(n=>n.filePath===K),[N,K]),o=n=>{switch(n){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=(n,g,R)=>{const ee=n.type==="addition"?"var(--nice-success-tint-10, rgba(34, 197, 94, 0.1))":n.type==="deletion"?"var(--nice-danger-tint-10, rgba(239, 68, 68, 0.1))":n.type==="header"?"var(--nice-primary-tint-10, rgba(59, 130, 246, 0.1))":"transparent",Z=n.type==="addition"?"var(--nice-success-light, #4ade80)":n.type==="deletion"?"var(--nice-danger-light, #f87171)":n.type==="header"?"var(--color-primary-light, #60a5fa)":"var(--text-primary, #e0e0e0)",Q=R==="old"?n.lineNumberOld:R==="new"?n.lineNumberNew:void 0,f=_?n.content.replace(/ /g,"·").replace(/\t/g,"→ "):n.content;return e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:ee,minHeight:20,fontSize:12,fontFamily:'"JetBrains Mono", "Fira Code", monospace'},children:[Q!==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:Q}),E==="unified"&&e.jsx("div",{style:{width:20,textAlign:"center",color:Z,fontWeight:600},children:n.type==="addition"?"+":n.type==="deletion"?"-":" "}),e.jsx("div",{style:{flex:1,padding:"0 8px",color:Z,whiteSpace:"pre",overflow:"hidden",textOverflow:"ellipsis"},children:f||" "}),F&&Q&&n.type!=="header"&&e.jsx("button",{onClick:()=>k({filePath:K,line:Q,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:I=>I.currentTarget.style.opacity="1",onMouseLeave:I=>I.currentTarget.style.opacity="0.3",children:"💬"})]},`${g}-${R||"unified"}`)},p=n=>e.jsx("div",{style:{borderTop:"1px solid var(--border-color, #333)"},children:n.chunks.map((g,R)=>{const ee=`${n.path}:${R}`;return b.has(ee),e.jsxs("div",{children:[e.jsxs("div",{onClick:()=>r(n.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:["@@ -",g.oldStart,",",g.oldLines," +",g.newStart,",",g.newLines," @@"," ",g.header||""]}),g.lines.map((Z,Q)=>t(Z,Q))]},R)})}),c=n=>e.jsx("div",{style:{borderTop:"1px solid var(--border-color, #333)"},children:n.chunks.map((g,R)=>{const ee=[],Z=[];for(const f of g.lines)(f.type==="deletion"||f.type==="context")&&ee.push(f),(f.type==="addition"||f.type==="context")&&Z.push(f);const Q=Math.max(ee.length,Z.length);for(;ee.length<Q;)ee.push({content:"",type:"context"});for(;Z.length<Q;)Z.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:["@@ -",g.oldStart,",",g.oldLines," +",g.newStart,",",g.newLines," @@"," ",g.header||""]}),e.jsxs("div",{style:{display:"flex"},children:[e.jsx("div",{style:{flex:1,borderRight:"1px solid var(--border-color, #444)"},children:ee.map((f,I)=>t(f,I,"old"))}),e.jsx("div",{style:{flex:1},children:Z.map((f,I)=>t(f,I,"new"))})]})]},R)})});return e.jsxs("div",{className:`nice-git-diff-viewer ${w||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",fontFamily:"system-ui, sans-serif",...B},"data-testid":C,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:["+",Y.additions]}),e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",Y.deletions]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:x.map(n=>{const g=o(n.status),R=n.path===K;return e.jsxs("div",{onClick:()=>X(n.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:g.color,display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--bg-primary, #fff)",fontWeight:600},children:g.icon}),e.jsx("span",{style:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path.split("/").pop()}),e.jsxs("div",{style:{display:"flex",gap:4,fontSize:10},children:[n.additions>0&&e.jsxs("span",{style:{color:"var(--color-success, #22c55e)"},children:["+",n.additions]}),n.deletions>0&&e.jsxs("span",{style:{color:"var(--color-error, #ef4444)"},children:["-",n.deletions]})]})]},n.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:[O&&e.jsx("div",{style:{flex:1,fontSize:13,fontFamily:"monospace"},children:O.oldPath&&O.oldPath!==O.path?e.jsxs(e.Fragment,{children:[e.jsx("span",{style:{color:"var(--color-error, #ef4444)"},children:O.oldPath}),e.jsx("span",{style:{margin:"0 8px",color:"var(--text-muted, #888)"},children:"→"}),e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:O.path})]}):O.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:E==="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:E==="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:_,onChange:n=>V(n.target.checked)}),"Show whitespace"]})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:O?O.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"})]}):E==="split"?c(O):p(O):e.jsx("div",{style:{padding:40,textAlign:"center",color:"var(--text-muted, #666)"},children:"Select a file to view changes"})}),a.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 (",a.length,")"]}),a.map(n=>e.jsxs("div",{style:{padding:12,borderBottom:"1px solid var(--border-color, #333)",opacity:n.resolved?.5:1},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[n.author.avatar?e.jsx("img",{src:n.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:n.author.name[0]}),e.jsx("span",{style:{fontSize:12,fontWeight:500},children:n.author.name}),e.jsxs("span",{style:{fontSize:10,color:"var(--text-muted, #888)"},children:["Line ",n.line," (",n.side,")"]}),n.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&&!n.resolved&&e.jsx("button",{onClick:()=>h(n.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:n.body})]},n.id))]}),u&&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:()=>k(null),children:e.jsxs("div",{style:{width:400,background:"var(--bg-elevated, #252525)",borderRadius:8,padding:20},onClick:n=>n.stopPropagation(),children:[e.jsxs("h3",{style:{margin:"0 0 12px",fontSize:14},children:["Add comment on line ",u.line]}),e.jsx("textarea",{value:u.body,onChange:n=>k({...u,body:n.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:()=>k(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:()=>{u.body.trim()&&(F?.(u.filePath,u.line,u.side,u.body.trim()),k(null))},disabled:!u.body.trim(),style:{padding:"8px 16px",borderRadius:4,border:"none",background:u.body.trim()?"var(--color-primary, #3b82f6)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:u.body.trim()?"pointer":"not-allowed",fontSize:12,fontWeight:500},children:"Add Comment"})]})]})})]})]})},$e=Object.freeze(Object.defineProperty({__proto__:null,NiceGitDiffViewer:be},Symbol.toStringTag,{value:"Module"})),Ne=(x,y)=>{const N=new Date().getTime()-x.getTime(),P=Math.floor(N/(1e3*60*60*24));return P===0?"today":P===1?"yesterday":P<7?`${P} days ago`:P<30?`${Math.floor(P/7)} weeks ago`:P<365?`${Math.floor(P/30)} months ago`:`${Math.floor(P/365)} years ago`},Pe=x=>{const z=new Date().getTime()-x.getTime(),N=Math.floor(z/(1e3*60*60*24));return N<7?"var(--nice-primary-tint-30, rgba(59, 130, 246, 0.3))":N<30?"var(--nice-success-tint-30, rgba(34, 197, 94, 0.3))":N<90?"var(--nice-warning-tint-30, rgba(234, 179, 8, 0.3))":N<365?"var(--nice-warning-tint-30, rgba(249, 115, 22, 0.3))":"var(--nice-danger-tint-30, rgba(239, 68, 68, 0.3))"},oe=x=>{const y=["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 z=0;for(let N=0;N<x.length;N++)z=(z<<5)-z+x.charCodeAt(N),z=z&z;return y[Math.abs(z)%y.length]},ve=({file:x,viewMode:y="inline",showAgeHeatmap:z=!0,showAvatars:N=!0,groupHunks:P=!0,highlightOnHover:q=!0,timeZone:G,dateRange:M,authorFilter:T,selectedLine:L,syntaxTheme:U="dark",onLineClick:F,onCommitClick:h,onAuthorClick:m,onBlameParent:w,className:B,style:C,"data-testid":j="nice-git-blame"})=>{const[v,W]=i.useState(null),[V,A]=i.useState(null),[D,b]=i.useState(null),S=i.useMemo(()=>{const r=[];return x.hunks.forEach(a=>{a.lines.forEach(o=>{r.push(o)})}),r.sort((a,o)=>a.lineNumber-o.lineNumber)},[x.hunks]),u=i.useMemo(()=>S.filter(r=>!(M?.from&&r.commit.timestamp<M.from||M?.to&&r.commit.timestamp>M.to||T&&T.length>0&&!T.includes(r.commit.author.id))),[S,M,T]),k=i.useMemo(()=>{if(!P)return u.map(t=>({startLine:t.lineNumber,endLine:t.lineNumber,commit:t.commit,lines:[t],isFirstOfCommit:!0}));const r=[];let a=null;const o=new Set;return u.forEach(t=>{if(!a||a.commit.id!==t.commit.id){const p=!o.has(t.commit.id);o.add(t.commit.id),a={startLine:t.lineNumber,endLine:t.lineNumber,commit:t.commit,lines:[t],isFirstOfCommit:p},r.push(a)}else a.endLine=t.lineNumber,a.lines.push(t)}),r},[u,P]),E=i.useMemo(()=>{const r=new Map;return S.forEach(a=>{r.has(a.commit.author.id)||r.set(a.commit.author.id,a.commit.author)}),Array.from(r.values())},[S]),_=i.useMemo(()=>{const r=new Map;return S.forEach(a=>{r.has(a.commit.id)||r.set(a.commit.id,a.commit)}),Array.from(r.values()).sort((a,o)=>o.timestamp.getTime()-a.timestamp.getTime())},[S]),K=i.useCallback(r=>{F?.(r)},[F]),O=i.useCallback((r,a)=>{a.stopPropagation(),V===r.id?A(null):A(r.id),h?.(r)},[V,h]),Y=(r,a)=>{const o=a===0,t=r.commit,p=q&&v===t.id;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0 12px",minWidth:y==="inline"?280:40,background:p?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":z?Pe(t.timestamp):"transparent",borderRight:`3px solid ${oe(t.author.id)}`,cursor:"pointer",transition:"background 0.15s"},onMouseEnter:()=>W(t.id),onMouseLeave:()=>W(null),onClick:c=>O(t,c),children:[o&&y==="inline"&&e.jsxs(e.Fragment,{children:[N&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(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:Ne(t.timestamp)})]})]}),y==="gutter"&&o&&e.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:oe(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()})]})},X=r=>{if(D!==r.lineNumber||y!=="tooltip")return null;const a=r.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:oe(a.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontWeight:500},children:a.author.name[0].toUpperCase()}),e.jsxs("div",{children:[e.jsx("div",{style:{fontWeight:500,color:"var(--border-color, #e5e7eb)"},children:a.author.name}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #9ca3af)"},children:a.author.email})]})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:12,color:"var(--color-primary-light, #60a5fa)",marginBottom:4},children:a.shortId}),e.jsx("div",{style:{fontSize:13,color:"var(--border-color, #e5e7eb)",marginBottom:8},children:a.message}),e.jsx("div",{style:{fontSize:11,color:"var(--text-muted, #6b7280)"},children:a.timestamp.toLocaleString()}),a.parents&&a.parents.length>0&&w&&e.jsx("button",{onClick:()=>w(a),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=r=>V!==r.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:oe(r.author.id),display:"flex",alignItems:"center",justifyContent:"center",color:"var(--bg-primary, #fff)",fontSize:20,fontWeight:500,flexShrink:0},children:r.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:r.author.name}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted, #6b7280)"},children:r.author.email})]}),e.jsx("div",{style:{fontFamily:"monospace",fontSize:13,color:"var(--color-primary-light, #60a5fa)",marginBottom:8},children:r.id}),e.jsx("div",{style:{fontSize:14,color:"var(--border-color, #e5e7eb)",marginBottom:8,lineHeight:1.5},children:r.message}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,fontSize:12,color:"var(--text-muted, #9ca3af)"},children:[e.jsxs("span",{children:["📅 ",r.timestamp.toLocaleString()]}),r.parents&&r.parents.length>0&&e.jsxs("span",{children:["👆 ",r.parents.length," parent(s)"]})]}),w&&r.parents&&r.parents.length>0&&e.jsx("button",{onClick:()=>w(r),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",...C},"data-testid":j,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:[_.length," commits by ",E.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:[E.slice(0,10).map(r=>e.jsxs("div",{onClick:()=>m?.(r),style:{display:"flex",alignItems:"center",gap:6,cursor:"pointer"},children:[e.jsx("div",{style:{width:12,height:12,borderRadius:"50%",background:oe(r.id)}}),e.jsx("span",{style:{fontSize:12},children:r.name})]},r.id)),E.length>10&&e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:["+",E.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:k.map((r,a)=>e.jsxs(i.Fragment,{children:[r.isFirstOfCommit&&V===r.commit.id&&d(r.commit),r.lines.map((o,t)=>e.jsxs("div",{onClick:()=>K(o),onMouseEnter:()=>b(o.lineNumber),onMouseLeave:()=>b(null),style:{display:"flex",alignItems:"stretch",background:L===o.lineNumber?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":q&&v===r.commit.id?"var(--nice-primary-tint-8, rgba(59, 130, 246, 0.08))":"transparent",borderLeft:L===o.lineNumber?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent",position:"relative"},children:[Y(r,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}),y==="tooltip"&&X(o)]},o.lineNumber))]},`${r.commit.id}-${r.startLine}`))}),z&&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"})]})]})]})},Ae=Object.freeze(Object.defineProperty({__proto__:null,NiceGitBlame:ve},Symbol.toStringTag,{value:"Module"})),De=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[]}},ye=({file:x,context:y,viewMode:z="split",showLineNumbers:N=!0,showBase:P=!1,currentConflictIndex:q,syntaxTheme:G="dark",onResolve:M,onResolveAll:T,onNavigateConflict:L,onSave:U,onCancel:F,className:h,style:m,"data-testid":w="nice-git-conflict-resolver"})=>{const[B,C]=i.useState(x.conflicts),[j,v]=i.useState(q??0),[W,V]=i.useState(null),[A,D]=i.useState(""),b=i.useMemo(()=>B.filter(t=>!t.resolved).length,[B]),S=i.useMemo(()=>B.filter(t=>t.resolved).length,[B]),u=B[j],k=i.useCallback((t,p,c)=>{C(g=>g.map(R=>R.id===t?{...R,resolved:!0,resolution:p,customContent:c}:R)),V(null),M?.(t,p,c);const n=B.findIndex((g,R)=>R>j&&!g.resolved);n!==-1&&(v(n),L?.(n))},[B,j,M,L]),E=i.useCallback(t=>{C(p=>p.map(c=>c.resolved?c:{...c,resolved:!0,resolution:t})),T?.(t)},[T]),_=i.useCallback(t=>{const p=t==="prev"?Math.max(0,j-1):Math.min(B.length-1,j+1);v(p),L?.(p)},[j,B.length,L]),K=i.useCallback(()=>{u&&(V(u.id),D(u.oursContent.join(`
|
|
3
|
+
`)))},[u]),O=i.useCallback(()=>{W&&k(W,"custom",A.split(`
|
|
4
|
+
`))},[W,A,k]),Y=i.useCallback(()=>{const t=x.content.split(`
|
|
5
|
+
`);let p=[],c=0;B.forEach(n=>{p=[...p,...t.slice(c,n.startLine-1)],p=[...p,...De(n)],c=n.endLine}),p=[...p,...t.slice(c)],U?.(p.join(`
|
|
6
|
+
`))},[x.content,B,U]),X=(t,p,c,n)=>e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,borderLeft:`3px solid ${c}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",background:`${c}20`,borderBottom:"1px solid var(--nice-border, #30363d)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:500,color:c},children:t}),n&&e.jsx("button",{onClick:n,style:{padding:"4px 10px",background:c,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:p.map((g,R)=>e.jsxs("div",{style:{display:"flex",alignItems:"stretch",background:G==="dark"?"var(--bg-canvas, #0d1117)":"var(--bg-primary, #fff)"},children:[N&&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:g||" "})]},R))})]}),d=()=>u?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 (",y?.oursCommit.branch||"HEAD",")"]}),e.jsx("button",{onClick:()=>k(u.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:u.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 (",y?.theirsCommit.branch||"incoming",")"]}),e.jsx("button",{onClick:()=>k(u.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:u.theirsContent.join(`
|
|
8
|
+
`)})]})]}):null,r=()=>u?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[X(`← Ours (${y?.oursCommit.branch||"HEAD"})`,u.oursContent,"var(--color-success, #22c55e)",()=>k(u.id,"ours")),P&&X("Base (ancestor)",u.baseContent,"var(--text-muted, #6b7280)"),X(`→ Theirs (${y?.theirsCommit.branch||"incoming"})`,u.theirsContent,"var(--color-primary, #3b82f6)",()=>k(u.id,"theirs"))]}):null,a=()=>u?e.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden"},children:[X(`← Ours (${y?.oursCommit.branch||"HEAD"})`,u.oursContent,"var(--color-success, #22c55e)",()=>k(u.id,"ours")),X("Base",u.baseContent,"var(--text-muted, #6b7280)"),X(`→ Theirs (${y?.theirsCommit.branch||"incoming"})`,u.theirsContent,"var(--color-primary, #3b82f6)",()=>k(u.id,"theirs"))]}):null,o=()=>W!==u?.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:()=>V(null),style:{background:"transparent",border:"none",color:"var(--text-muted, #9ca3af)",cursor:"pointer",fontSize:18},children:"✕"})]}),e.jsx("textarea",{value:A,onChange:t=>D(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:()=>V(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:O,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:G==="dark"?"var(--bg-canvas, #0d1117)":"var(--bg-primary, #ffffff)",color:G==="dark"?"var(--text-primary, #e6edf3)":"var(--text-primary, #1f2937)",fontFamily:"system-ui, sans-serif",position:"relative",...m},"data-testid":w,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:G==="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) • ",S," resolved • ",b," ","remaining"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:F,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:Y,disabled:b>0,style:{padding:"6px 12px",background:b>0?"var(--text-secondary, #374151)":"var(--color-success, #22c55e)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:b>0?"not-allowed":"pointer",opacity:b>0?.5:1},children:"✓ Save Resolved"})]})]}),y&&e.jsxs("div",{style:{display:"flex",gap:24,padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:G==="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:y.oursCommit.branch}),e.jsxs("span",{style:{color:"var(--text-muted, #8b949e)",fontFamily:"monospace"},children:["(",y.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:y.theirsCommit.branch}),e.jsxs("span",{style:{color:"var(--text-muted, #8b949e)",fontFamily:"monospace"},children:["(",y.theirsCommit.shortId,")"]})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px",borderBottom:"1px solid var(--nice-border, #30363d)",background:G==="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:()=>_("prev"),disabled:j===0,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:j===0?"not-allowed":"pointer",opacity:j===0?.5:1},children:"← Prev"}),e.jsxs("span",{style:{padding:"0 8px"},children:["Conflict ",j+1," of ",B.length,u?.resolved&&e.jsx("span",{style:{marginLeft:8,color:"var(--color-success, #22c55e)"},children:"✓ Resolved"})]}),e.jsx("button",{onClick:()=>_("next"),disabled:j===B.length-1,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:j===B.length-1?"not-allowed":"pointer",opacity:j===B.length-1?.5:1},children:"Next →"})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("button",{onClick:()=>E("ours"),disabled:b===0,style:{padding:"4px 10px",background:"var(--color-success, #22c55e)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:b===0?"not-allowed":"pointer",opacity:b===0?.5:1},children:"Accept All Ours"}),e.jsx("button",{onClick:()=>E("theirs"),disabled:b===0,style:{padding:"4px 10px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",fontSize:11,cursor:b===0?"not-allowed":"pointer",opacity:b===0?.5:1},children:"Accept All Theirs"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[u&&!u.resolved&&e.jsxs(e.Fragment,{children:[z==="inline"&&d(),z==="split"&&r(),z==="three-way"&&a()]}),u?.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: ",u.resolution]}),e.jsx("button",{onClick:()=>C(t=>t.map(p=>p.id===u.id?{...p,resolved:!1,resolution:void 0}:p)),style:{padding:"8px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"↩ Re-resolve"})]})]}),u&&!u.resolved&&e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,padding:"12px 16px",borderTop:"1px solid var(--nice-border, #30363d)",background:G==="dark"?"var(--bg-elevated, #161b22)":"var(--nice-bg-secondary, #f6f8fa)"},children:[e.jsx("button",{onClick:()=>k(u.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:()=>k(u.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:()=>k(u.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:K,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()]})},Le=Object.freeze(Object.defineProperty({__proto__:null,NiceGitConflictResolver:ye},Symbol.toStringTag,{value:"Module"})),le={"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:"🗑️"}},Ee=[{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}]}],je=({hooks:x,templates:y=Ee,manager:z="husky",repoPath:N,selectedHook:P,onHookChange:q,onHookToggle:G,onActionAdd:M,onActionRemove:T,onActionUpdate:L,onInstall:U,onUninstall:F,onExport:h,className:m,style:w,"data-testid":B="nice-git-hooks"})=>{const[C,j]=i.useState(x),[v,W]=i.useState(P||null),[V,A]=i.useState(!1),[D,b]=i.useState(null),[S,u]=i.useState(!1),k=i.useMemo(()=>C.find(o=>o.type===v),[C,v]),E=i.useCallback((o,t)=>{j(p=>p.map(c=>c.type===o?{...c,enabled:t}:c)),G?.(o,t)},[G]),_=i.useCallback(o=>{if(!v)return;const t=o?o.actions.map((p,c)=>({...p,id:crypto.randomUUID(),order:(k?.actions.length||0)+c})):[{id:crypto.randomUUID(),type:"custom",name:"New Action",command:'echo "Hello"',order:k?.actions.length||0,enabled:!0,failOnError:!0}];j(p=>p.map(c=>c.type===v?{...c,actions:[...c.actions,...t]}:c)),t.forEach(p=>M?.(v,p)),A(!1)},[v,k,M]),K=i.useCallback(o=>{v&&(j(t=>t.map(p=>p.type===v?{...p,actions:p.actions.filter(c=>c.id!==o)}:p)),T?.(v,o))},[v,T]),O=i.useCallback(o=>{v&&(j(t=>t.map(p=>p.type===v?{...p,actions:p.actions.map(c=>c.id===o.id?o:c)}:p)),b(null),L?.(v,o))},[v,L]),Y=i.useCallback((o,t)=>{if(!k)return;const p=[...k.actions],c=p.findIndex(g=>g.id===o);if(c===-1)return;const n=t==="up"?c-1:c+1;n<0||n>=p.length||([p[c],p[n]]=[p[n],p[c]],p.forEach((g,R)=>g.order=R),j(g=>g.map(R=>R.type===v?{...R,actions:p}:R)))},[k,v]),X=i.useCallback(o=>{const t=["#!/bin/sh",""];return o.verbose&&t.push("set -x"),t.push("# Generated by NiceGitHooks",`# Hook: ${o.type}`,""),o.actions.forEach(p=>{if(!p.enabled){t.push(`# [DISABLED] ${p.name}`);return}if(t.push(`# ${p.name}`),p.condition){const{type:n,operator:g,value:R}=p.condition;n==="branch"?(t.push("BRANCH=$(git rev-parse --abbrev-ref HEAD)"),g==="equals"?t.push(`if [ "$BRANCH" != "${R}" ]; then exit 0; fi`):g==="matches"&&t.push(`if ! echo "$BRANCH" | grep -q "${R}"; then exit 0; fi`)):n==="env"&&t.push(`if [ -z "$${R}" ]; then exit 0; fi`)}let c=p.command;p.runOn==="staged"&&p.filePatterns?.length&&(p.filePatterns.map(n=>`'${n}'`).join(" "),c=`git diff --cached --name-only --diff-filter=ACM | grep -E "${p.filePatterns.join("|")}" | xargs ${c}`),t.push(c),p.failOnError&&(t.push("if [ $? -ne 0 ]; then"),t.push(` echo "❌ ${p.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],r=()=>D?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:()=>b(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:D.name,onChange:o=>b({...D,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:D.type,onChange:o=>b({...D,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:D.command,onChange:o=>b({...D,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:D.runOn||"all",onChange:o=>b({...D,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:D.filePatterns?.join(", ")||"",onChange:o=>b({...D,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:D.enabled,onChange:o=>b({...D,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:D.failOnError,onChange:o=>b({...D,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:()=>b(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:()=>O(D),style:{padding:"8px 16px",background:"var(--color-primary, #3b82f6)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})}):null,a=()=>{if(!S||!k)return null;const o=X(k);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: ",k.type]}),e.jsx("button",{onClick:()=>u(!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:()=>u(!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 ${m||""}`,style:{display:"flex",height:"100%",background:"var(--bg-canvas, #0d1117)",color:"var(--text-primary, #e6edf3)",fontFamily:"system-ui, sans-serif",...w},"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(le).map(([o,t])=>{const p=C.find(g=>g.type===o),c=v===o,n=p?.actions.length||0;return e.jsxs("div",{onClick:()=>W(o),style:{padding:"12px 16px",cursor:"pointer",background:c?"var(--nice-primary-tint-15, rgba(59, 130, 246, 0.15))":"transparent",borderLeft:c?"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:[n," action",n!==1?"s":""]})]}),e.jsx("button",{onClick:g=>{g.stopPropagation(),E(o,!p?.enabled)},style:{width:36,height:20,borderRadius:10,background:p?.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:p?.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?.(C,"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:k?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:le[k.type].icon}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:18,fontWeight:500},children:le[k.type].title}),e.jsx("div",{style:{fontSize:12,color:"var(--text-muted, #8b949e)"},children:le[k.type].description})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,marginTop:12},children:[e.jsx("button",{onClick:()=>u(!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?.(k.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:()=>F?.(k.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:k.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:k.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:()=>Y(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:()=>Y(o.id,"down"),disabled:t===k.actions.length-1,style:{padding:"4px 8px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:t===k.actions.length-1?"not-allowed":"pointer",opacity:t===k.actions.length-1?.5:1},children:"↓"}),e.jsx("button",{onClick:()=>b(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:()=>K(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:()=>A(!V),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:()=>_(),style:{padding:"10px 16px",background:"var(--text-secondary, #374151)",border:"none",borderRadius:6,color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"⚙️ Custom Action"})]}),V&&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:[y.filter(o=>o.hook===v).map(o=>e.jsxs("div",{onClick:()=>_(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)),y.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"})]})}),r(),a()]})},Oe=Object.freeze(Object.defineProperty({__proto__:null,NiceGitHooks:je},Symbol.toStringTag,{value:"Module"})),_e={push:"📤",pull_request:"🔀",schedule:"⏰",manual:"👆",tag:"🏷️",workflow_dispatch:"⚡"},Fe={script:"📜",action:"⚙️",checkout:"📥",upload_artifact:"📤",download_artifact:"📥",docker:"🐳",deploy:"🚀"},ke=({pipeline:x,templates:y,runners:z,environments:N,onPipelineChange:P,onStageAdd:q,onStageRemove:G,onStageMove:M,onJobAdd:T,onJobRemove:L,onStepAdd:U,onStepRemove:F,onVariableAdd:h,onVariableRemove:m,onSecretAdd:w,onSecretRemove:B,onTemplateApply:C,onSave:j,onRun:v,onValidate:W,className:V,style:A,"data-testid":D})=>{const[b,S]=i.useState("visual"),[u,k]=i.useState(null),[E,_]=i.useState(null),[K,O]=i.useState(!1),Y=x.stages.find(r=>r.id===u),X=Y?.jobs.find(r=>r.id===E),d=i.useMemo(()=>{const r=[];return r.push(`name: ${x.name}`),r.push(""),r.push("on:"),x.triggers.forEach(a=>{r.push(` ${a}:`),(a==="push"||a==="pull_request")&&(r.push(" branches:"),r.push(` - ${x.branch||"main"}`))}),r.push(""),x.variables.length>0&&(r.push("env:"),x.variables.filter(a=>!a.isSecret).forEach(a=>{r.push(` ${a.name}: ${a.value}`)}),r.push("")),r.push("jobs:"),x.stages.forEach(a=>{a.jobs.forEach(o=>{r.push(` ${a.name.toLowerCase().replace(/\s+/g,"-")}-${o.name.toLowerCase().replace(/\s+/g,"-")}:`),r.push(` name: ${o.name}`),o.runner&&r.push(` runs-on: ${o.runner}`),a.dependsOn?.length&&r.push(` needs: [${a.dependsOn.join(", ")}]`),r.push(" steps:"),o.steps.forEach(t=>{t.type==="checkout"?r.push(" - uses: actions/checkout@v4"):t.type==="action"&&t.action?(r.push(` - uses: ${t.action}${t.actionVersion?`@${t.actionVersion}`:""}`),t.with&&Object.keys(t.with).length>0&&(r.push(" with:"),Object.entries(t.with).forEach(([p,c])=>{r.push(` ${p}: ${c}`)}))):t.type==="script"&&t.script&&(r.push(` - name: ${t.name}`),r.push(" run: |"),t.script.split(`
|
|
10
|
+
`).forEach(p=>{r.push(` ${p}`)}))})})}),r.join(`
|
|
11
|
+
`)},[x]);return e.jsxs("div",{className:`nice-pipeline-editor ${V||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...A},"data-testid":D,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=>P({...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("button",{onClick:()=>O(!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:W,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:j,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:()=>S(r.id),style:{padding:"10px 20px",border:"none",background:b===r.id?"var(--bg-elevated, #1e1e1e)":"transparent",color:b===r.id?"var(--bg-primary, #fff)":"var(--text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:b===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:[b==="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,a)=>e.jsxs("div",{children:[a>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:()=>{k(r.id),_(null)},style:{padding:"12px",background:u===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:u===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:[a>0&&e.jsx("button",{onClick:o=>{o.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:"↑"}),a<x.stages.length-1&&e.jsx("button",{onClick:o=>{o.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:o=>{o.stopPropagation(),G(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:Y?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: ",Y.name]}),e.jsx("button",{onClick:()=>T(Y.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:Y.jobs.map(r=>e.jsxs("div",{onClick:()=>_(r.id),style:{padding:"10px",marginBottom:"4px",background:E===r.id?"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))":"var(--bg-elevated, #252525)",borderRadius:"6px",cursor:"pointer",border:E===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:a=>{a.stopPropagation(),L(Y.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))}),X?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: ",X.name]}),e.jsx("button",{onClick:()=>U(Y.id,X.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..."}),z.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"}),N.map(r=>e.jsxs("option",{value:r.id,children:[r.name," ",r.protection&&"🔒"]},r.id))]})]})]}),X.steps.map((r,a)=>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:Fe[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:()=>F(Y.id,X.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)),X.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"})})]}),b==="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:d})}),b==="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:a=>{const o=a.target.checked?[...x.triggers,r]:x.triggers.filter(t=>t!==r);P({...x,triggers:o})}}),e.jsx("span",{style:{fontSize:"24px"},children:_e[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))})]}),b==="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:w,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:()=>m(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"})]})]})]}),K&&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:()=>O(!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:y.map(r=>e.jsxs("div",{onClick:()=>{C(r),O(!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))})]})})]})},He=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineEditor:ke},Symbol.toStringTag,{value:"Module"})),de={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"}},Se=({runs:x,stats:y,selectedRunId:z,onRunSelect:N,onCancel:P,onRerun:q,onRerunFromStage:G,onDownloadArtifact:M,onDownloadLogs:T,onApprove:L,onReject:U,className:F,style:h,"data-testid":m})=>{const[w,B]=i.useState("all"),[C,j]=i.useState("all"),[v,W]=i.useState(new Set),[V,A]=i.useState(new Set),[D,b]=i.useState(null),S=x.find(d=>d.id===z),u=i.useMemo(()=>x.filter(d=>!(w!=="all"&&d.status!==w||C!=="all"&&d.branch!==C)),[x,w,C]),k=i.useMemo(()=>[...new Set(x.map(d=>d.branch))],[x]),E=d=>{if(!d)return"-";const r=Math.floor(d/1e3);if(r<60)return`${r}s`;const a=Math.floor(r/60),o=r%60;if(a<60)return`${a}m ${o}s`;const t=Math.floor(a/60),p=a%60;return`${t}h ${p}m`},_=d=>d?new Date(d).toLocaleString():"-",K=d=>d<1024?`${d} B`:d<1024*1024?`${(d/1024).toFixed(1)} KB`:`${(d/(1024*1024)).toFixed(1)} MB`,O=d=>{W(r=>{const a=new Set(r);return a.has(d)?a.delete(d):a.add(d),a})},Y=d=>{A(r=>{const a=new Set(r);return a.has(d)?a.delete(d):a.add(d),a})},X=()=>{if(!D||!S)return[];for(const d of S.stages)for(const r of d.jobs)if(r.id===D.jobId)return r.steps.find(o=>o.id===D.stepId)?.logs||[];return[]};return e.jsxs("div",{className:`nice-pipeline-monitor ${F||""}`,style:{display:"flex",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...h},"data-testid":m,children:[e.jsxs("div",{style:{width:"400px",borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column"},children:[y&&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:y.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:[y.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:E(y.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:y.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:w,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:C,onChange:d=>j(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"}),k.map(d=>e.jsx("option",{value:d,children:d},d))]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto"},children:[u.map(d=>{const r=de[d.status];return e.jsxs("div",{onClick:()=>N(d.id),style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",cursor:"pointer",background:z===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:r.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:`${r.color}22`,color:r.color,fontSize:"10px"},children:r.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:E(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)}),u.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:S?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:[S.pipelineName," #",S.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:[S.commit.authorAvatar&&e.jsx("img",{src:S.commit.authorAvatar,alt:"",style:{width:"16px",height:"16px",borderRadius:"50%"}}),S.commit.author]}),e.jsxs("span",{children:["🔀 ",S.branch]}),e.jsxs("span",{children:["📝 ",S.commit.sha.slice(0,7)]})]})]}),e.jsxs("div",{style:{display:"flex",gap:"8px"},children:[(S.status==="in_progress"||S.status==="queued"||S.status==="waiting")&&e.jsx("button",{onClick:()=>P(S.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(S.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(S.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: ",_(S.startedAt)]}),S.completedAt&&e.jsxs("span",{children:["Completed: ",_(S.completedAt)]}),e.jsxs("span",{children:["Duration: ",E(S.duration)]})]})]}),e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[e.jsx("div",{style:{marginBottom:"24px"},children:S.stages.map((d,r)=>{const a=de[d.status],o=v.has(d.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>O(d.id),style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",cursor:"pointer",border:`2px solid ${a.color}44`},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)"},children:o?"▼":"▶"}),e.jsx("span",{style:{fontSize:"16px"},children:a.icon}),e.jsx("span",{style:{flex:1,fontWeight:500},children:d.name}),e.jsx("span",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:E(d.duration)}),d.status==="waiting"&&L&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t=>{t.stopPropagation(),L(S.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?.(S.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(),G(S.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 p=de[t.status],c=V.has(t.id);return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{onClick:()=>Y(t.id),style:{display:"flex",alignItems:"center",gap:"10px",padding:"10px 12px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"6px",cursor:"pointer",borderLeft:`3px solid ${p.color}`},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)",fontSize:"10px"},children:c?"▼":"▶"}),e.jsx("span",{style:{fontSize:"14px"},children:p.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:E(t.duration)})]}),c&&e.jsx("div",{style:{marginLeft:"24px",marginTop:"4px"},children:t.steps.map(n=>{const g=de[n.status];return e.jsxs("div",{onClick:()=>b({jobId:t.id,stepId:n.id}),style:{display:"flex",alignItems:"center",gap:"8px",padding:"8px 10px",marginBottom:"2px",background:"transparent",borderRadius:"4px",cursor:n.logs?.length?"pointer":"default"},children:[e.jsx("span",{style:{fontSize:"12px"},children:g.icon}),e.jsx("span",{style:{flex:1,fontSize:"11px"},children:n.name}),e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #888)"},children:E(n.duration)}),n.logs?.length?e.jsx("span",{style:{fontSize:"10px",color:"var(--text-muted, #666)"},children:"📄"}):null]},n.id)})})]},t.id)})}),r<S.stages.length-1&&e.jsx("div",{style:{marginLeft:"24px",padding:"4px 0",color:"var(--bg-tertiary, #444)"},children:"↓"})]},d.id)})}),S.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:S.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:K(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"})}),D&&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:()=>b(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:X().join(`
|
|
12
|
+
`)||"No logs available"})})]})}),e.jsx("style",{children:`
|
|
13
|
+
@keyframes spin {
|
|
14
|
+
from { transform: rotate(0deg); }
|
|
15
|
+
to { transform: rotate(360deg); }
|
|
16
|
+
}
|
|
17
|
+
`})]})},Ge=Object.freeze(Object.defineProperty({__proto__:null,NicePipelineMonitor:Se},Symbol.toStringTag,{value:"Module"}));exports.NiceBranchManager=he;exports.NiceBranchManager$1=Te;exports.NiceGitBlame=ve;exports.NiceGitBlame$1=Ae;exports.NiceGitConflictResolver=ye;exports.NiceGitConflictResolver$1=Le;exports.NiceGitDiffViewer=be;exports.NiceGitDiffViewer$1=$e;exports.NiceGitGraph=ge;exports.NiceGitGraph$1=Me;exports.NiceGitHooks=je;exports.NiceGitHooks$1=Oe;exports.NiceMergeRequestBuilder=me;exports.NiceMergeRequestBuilder$1=We;exports.NicePipelineEditor=ke;exports.NicePipelineEditor$1=He;exports.NicePipelineMonitor=Se;exports.NicePipelineMonitor$1=Ge;
|
package/dist/devops.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./devops-CkuTC7RJ.cjs");exports.NiceBranchManager=e.NiceBranchManager;exports.NiceGitBlame=e.NiceGitBlame;exports.NiceGitConflictResolver=e.NiceGitConflictResolver;exports.NiceGitDiffViewer=e.NiceGitDiffViewer;exports.NiceGitGraph=e.NiceGitGraph;exports.NiceGitHooks=e.NiceGitHooks;exports.NiceMergeRequestBuilder=e.NiceMergeRequestBuilder;exports.NicePipelineEditor=e.NicePipelineEditor;exports.NicePipelineMonitor=e.NicePipelineMonitor;
|
package/dist/devops.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as a, a as c, b as s, c as r, d as t, e as N, f as o, g as l, h as n } from "./devops-
|
|
1
|
+
import { N as a, a as c, b as s, c as r, d as t, e as N, f as o, g as l, h as n } from "./devops-BL39OCVh.js";
|
|
2
2
|
export {
|
|
3
3
|
a as NiceBranchManager,
|
|
4
4
|
c as NiceGitBlame,
|
package/dist/editors.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./NiceTabs-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./NiceTabs-C4H5un8J.cjs"),i=require("./NiceForm-CI_vgkD4.cjs"),e=require("./NicePinCodeInput-BhIABBTV.cjs");exports.NiceCheckbox=c.NiceCheckbox;exports.NiceColorPicker=c.NiceColorPicker;exports.NiceNumberInput=c.NiceNumberInput;exports.NiceSelect=c.NiceSelect;exports.NiceTextInput=c.NiceTextInput;exports.NiceToggle=c.NiceToggle;exports.MASK_PRESETS=i.MASK_PRESETS;exports.NiceAutocomplete=i.NiceAutocomplete;exports.NiceCountryPicker=i.NiceCountryPicker;exports.NiceDatePicker=i.NiceDatePicker;exports.NiceDateTimePicker=i.NiceDateTimePicker;exports.NiceFileUpload=i.NiceFileUpload;exports.NiceForm=i.NiceForm;exports.NiceMaskedInput=i.NiceMaskedInput;exports.NicePasswordInput=i.NicePasswordInput;exports.NicePhoneInput=i.NicePhoneInput;exports.NiceRadioGroup=i.NiceRadioGroup;exports.NiceRating=i.NiceRating;exports.NiceSlider=i.NiceSlider;exports.NiceTagBox=i.NiceTagBox;exports.NiceTextArea=i.NiceTextArea;exports.NiceTimePicker=i.NiceTimePicker;exports.NICE_COLOR_PRESET_KEYS=e.NICE_COLOR_PRESET_KEYS;exports.NiceAccountPicker=e.NiceAccountPicker;exports.NiceAddressInput=e.NiceAddressInput;exports.NiceCalendar=e.NiceCalendar;exports.NiceCodeEditor=e.NiceCodeEditor;exports.NiceCodeEditorAI=e.NiceCodeEditorAI;exports.NiceColorPalette=e.NiceColorPalette;exports.NiceContactPicker=e.NiceContactPicker;exports.NiceCropEditor=e.NiceCropEditor;exports.NiceCurrencyInput=e.NiceCurrencyInput;exports.NiceDateRangeBox=e.NiceDateRangeBox;exports.NiceDocumentEditor=e.NiceDocumentEditor;exports.NiceDropDownBox=e.NiceDropDownBox;exports.NiceEmojiPicker=e.NiceEmojiPicker;exports.NiceGradientPicker=e.NiceGradientPicker;exports.NiceHtmlEditor=e.NiceHtmlEditor;exports.NiceHtmlEditorAI=e.NiceHtmlEditorAI;exports.NiceImageAnnotator=e.NiceImageAnnotator;exports.NiceImageEditor=e.NiceImageEditor;exports.NiceInputOtp=e.NiceInputOtp;exports.NiceInvoiceLineEditor=e.NiceInvoiceLineEditor;exports.NiceKnob=e.NiceKnob;exports.NiceLookup=e.NiceLookup;exports.NiceMarkdownEditor=e.NiceMarkdownEditor;exports.NiceMention=e.NiceMention;exports.NicePDFAnnotationEditor=e.NicePDFAnnotationEditor;exports.NicePickList=e.NicePickList;exports.NicePinCodeInput=e.NicePinCodeInput;exports.NiceRangeSlider=e.NiceRangeSlider;exports.NiceScannerControl=e.NiceScannerControl;exports.NiceSignature=e.NiceSignature;exports.NiceSignaturePad=e.NiceSignaturePad;exports.NiceTaxRatePicker=e.NiceTaxRatePicker;exports.NiceTreeSelect=e.NiceTreeSelect;exports.NiceVatInput=e.NiceVatInput;exports.NiceWiki=e.NiceWiki;
|
package/dist/editors.d.ts
CHANGED
|
@@ -137,6 +137,24 @@ declare interface CustomEmoji {
|
|
|
137
137
|
url: string;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/** Dropdown horizontal alignment relative to the trigger. */
|
|
141
|
+
declare type DropdownAlign = 'auto' | 'left' | 'right';
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Dual-visibility props shared by NiceCountryPicker & NiceLanguagePicker.
|
|
145
|
+
* "InValue" controls trigger rendering, "InMenu" controls dropdown options.
|
|
146
|
+
*/
|
|
147
|
+
declare interface DualVisibilityProps {
|
|
148
|
+
/** Show flag inside the trigger (selected value). Default: true */
|
|
149
|
+
showFlagInValue?: boolean;
|
|
150
|
+
/** Show flag inside dropdown options. Default: true */
|
|
151
|
+
showFlagInMenu?: boolean;
|
|
152
|
+
/** Show display text (country name / language name) inside the trigger. Default: false (compact) */
|
|
153
|
+
showTextInValue?: boolean;
|
|
154
|
+
/** Show display text inside dropdown options. Default: true */
|
|
155
|
+
showTextInMenu?: boolean;
|
|
156
|
+
}
|
|
157
|
+
|
|
140
158
|
declare interface EllipseAnnotation extends AnnotationBase {
|
|
141
159
|
tool: 'ellipse';
|
|
142
160
|
}
|
|
@@ -449,6 +467,18 @@ declare interface NiceCodeEditorAIRef extends NiceCodeEditorRef {
|
|
|
449
467
|
dismissCompletion: () => void;
|
|
450
468
|
}
|
|
451
469
|
|
|
470
|
+
declare interface NiceCodeEditorLspConfig {
|
|
471
|
+
/**
|
|
472
|
+
* Language Server Protocol bridge configuration.
|
|
473
|
+
* url: WebSocket endpoint of the LSP server
|
|
474
|
+
* language: Monaco language id
|
|
475
|
+
* initOptions: Optional initialization options for the LSP
|
|
476
|
+
*/
|
|
477
|
+
url: string;
|
|
478
|
+
language: string;
|
|
479
|
+
initOptions?: any;
|
|
480
|
+
}
|
|
481
|
+
|
|
452
482
|
declare interface NiceCodeEditorOptions {
|
|
453
483
|
/** Read only mode */
|
|
454
484
|
readOnly?: boolean;
|
|
@@ -563,6 +593,10 @@ export declare interface NiceCodeEditorProps {
|
|
|
563
593
|
showToolbar?: boolean;
|
|
564
594
|
/** Show status bar at bottom */
|
|
565
595
|
showStatusBar?: boolean;
|
|
596
|
+
/**
|
|
597
|
+
* LSP bridge configuration. If provided, connects Monaco to the LSP server for enhanced language features.
|
|
598
|
+
*/
|
|
599
|
+
lsp?: NiceCodeEditorLspConfig;
|
|
566
600
|
/** Additional CSS class */
|
|
567
601
|
className?: string;
|
|
568
602
|
/** Test ID */
|
|
@@ -725,7 +759,7 @@ declare type NiceCountdownFormat =
|
|
|
725
759
|
|
|
726
760
|
export declare const NiceCountryPicker: default_2.FC<NiceCountryPickerProps>;
|
|
727
761
|
|
|
728
|
-
export declare interface NiceCountryPickerProps extends NiceFormFieldProps {
|
|
762
|
+
export declare interface NiceCountryPickerProps extends NiceFormFieldProps, DualVisibilityProps {
|
|
729
763
|
/** Selected country code */
|
|
730
764
|
value?: string;
|
|
731
765
|
/** Default country code (uncontrolled) */
|
|
@@ -738,10 +772,36 @@ export declare interface NiceCountryPickerProps extends NiceFormFieldProps {
|
|
|
738
772
|
showSearch?: boolean;
|
|
739
773
|
/** Search placeholder */
|
|
740
774
|
searchPlaceholder?: string;
|
|
741
|
-
/**
|
|
775
|
+
/**
|
|
776
|
+
* @deprecated Use `showDialCodeInValue` and `showDialCodeInMenu` for fine-grained control.
|
|
777
|
+
* When set, applies to both trigger and menu (legacy behaviour).
|
|
778
|
+
*/
|
|
742
779
|
showDialCode?: boolean;
|
|
743
|
-
/**
|
|
780
|
+
/**
|
|
781
|
+
* @deprecated Use `showFlagInValue` and `showFlagInMenu` for fine-grained control.
|
|
782
|
+
* When set, applies to both trigger and menu (legacy behaviour).
|
|
783
|
+
*/
|
|
744
784
|
showFlag?: boolean;
|
|
785
|
+
/** Show dial code in trigger (selected value). Default: false (compact) */
|
|
786
|
+
showDialCodeInValue?: boolean;
|
|
787
|
+
/** Show dial code in dropdown options. Default: true */
|
|
788
|
+
showDialCodeInMenu?: boolean;
|
|
789
|
+
/** Show ISO 3166-1 alpha-2 code (e.g. "PL") in trigger. Default: false. */
|
|
790
|
+
showCodeInValue?: boolean;
|
|
791
|
+
/** Show ISO 3166-1 alpha-2 code (e.g. "PL") in dropdown options. Default: false. */
|
|
792
|
+
showCodeInMenu?: boolean;
|
|
793
|
+
/**
|
|
794
|
+
* Compact mode: minimal trigger width (flag + chevron only) and smart
|
|
795
|
+
* dropdown alignment. Equivalent to setting all `*InValue` props to
|
|
796
|
+
* false (except flag) and ignoring `controlWidth`. Default: false.
|
|
797
|
+
*/
|
|
798
|
+
compact?: boolean;
|
|
799
|
+
/**
|
|
800
|
+
* Dropdown horizontal alignment relative to the trigger. `'auto'` picks
|
|
801
|
+
* the side with more available viewport space (right-edge preferred).
|
|
802
|
+
* Default: `'auto'` in compact mode, `'left'` otherwise.
|
|
803
|
+
*/
|
|
804
|
+
dropdownAlign?: DropdownAlign;
|
|
745
805
|
/** Filter to only show certain countries */
|
|
746
806
|
countries?: string[];
|
|
747
807
|
/** Priority countries shown at top */
|
|
@@ -876,6 +936,16 @@ export declare interface NiceDatePickerProps extends NiceFormFieldProps {
|
|
|
876
936
|
* to the browser locale (`navigator.language`).
|
|
877
937
|
*/
|
|
878
938
|
displayLocale?: string;
|
|
939
|
+
/**
|
|
940
|
+
* Enable date-shortcut keys (default: `true`):
|
|
941
|
+
* - `T` — set to today
|
|
942
|
+
* - `+`/`=` then `1` (or any digit) — today + N days
|
|
943
|
+
* - `-` then `1` — today - N days
|
|
944
|
+
* - `+`/`-` then `M` — ± 1 month
|
|
945
|
+
* - `+`/`-` then `Y` — ± 1 year
|
|
946
|
+
* Only fires for date / datetime / month presets.
|
|
947
|
+
*/
|
|
948
|
+
keyboardShortcuts?: boolean;
|
|
879
949
|
}
|
|
880
950
|
|
|
881
951
|
export declare const NiceDateRangeBox: default_2.FC<NiceDateRangeBoxProps>;
|
|
@@ -1844,10 +1914,26 @@ export declare interface NicePickListProps<T = unknown> extends NiceBaseProps {
|
|
|
1844
1914
|
keyField?: string;
|
|
1845
1915
|
/** Label extractor */
|
|
1846
1916
|
labelField?: string;
|
|
1847
|
-
/** Custom item renderer */
|
|
1848
|
-
renderItem?: (item: T) => default_2.ReactNode;
|
|
1849
|
-
/** Enable filtering/search */
|
|
1917
|
+
/** Custom item renderer (receives item + side hint). */
|
|
1918
|
+
renderItem?: (item: T, side?: 'left' | 'right') => default_2.ReactNode;
|
|
1919
|
+
/** Enable filtering/search (legacy, equivalent to `searchable: 'both'`). */
|
|
1850
1920
|
filterable?: boolean;
|
|
1921
|
+
/**
|
|
1922
|
+
* Enable a search input on either or both columns.
|
|
1923
|
+
* `true` is equivalent to `'both'`. Default: `false`.
|
|
1924
|
+
*/
|
|
1925
|
+
searchable?: boolean | 'left' | 'right' | 'both';
|
|
1926
|
+
/** Optional grouping function. When provided, items are grouped under non-interactive headers. */
|
|
1927
|
+
groupBy?: (item: T) => string;
|
|
1928
|
+
/** Allow drag-and-drop reordering inside the right column. */
|
|
1929
|
+
sortable?: boolean;
|
|
1930
|
+
/** Show “move all” shortcut buttons (default: true). */
|
|
1931
|
+
bulkActions?: boolean | {
|
|
1932
|
+
moveAll?: boolean;
|
|
1933
|
+
removeAll?: boolean;
|
|
1934
|
+
};
|
|
1935
|
+
/** Maximum number of items allowed on the right side. Extra moves are blocked. */
|
|
1936
|
+
maxRight?: number;
|
|
1851
1937
|
/** Source list header */
|
|
1852
1938
|
sourceHeader?: default_2.ReactNode;
|
|
1853
1939
|
/** Target list header */
|
package/dist/editors.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { N as a, a as c, b as s, c as N, d as o, e as t } from "./NiceTabs-
|
|
2
|
-
import { M as n, N as d, a as p, b as u, c as P, d as k, e as E, f as l, g as I, h as m, i as C, j as g, k as S, l as x, m as A, n as T } from "./NiceForm-
|
|
3
|
-
import { N as R, a as b, b as f, c as M, d as h, e as w, f as B, g as F, h as L, i as _, j, k as y, l as G, m as H, n as K, o as O, p as v, q, r as z, s as U, t as V, u as W, v as Y, w as J, x as Q, y as X, z as Z, A as $, B as ee, C as ie, D as ae, E as ce, F as se, G as Ne, H as oe, I as te } from "./NicePinCodeInput-
|
|
1
|
+
import { N as a, a as c, b as s, c as N, d as o, e as t } from "./NiceTabs-DlsCMth_.js";
|
|
2
|
+
import { M as n, N as d, a as p, b as u, c as P, d as k, e as E, f as l, g as I, h as m, i as C, j as g, k as S, l as x, m as A, n as T } from "./NiceForm-t9zdH8kU.js";
|
|
3
|
+
import { N as R, a as b, b as f, c as M, d as h, e as w, f as B, g as F, h as L, i as _, j, k as y, l as G, m as H, n as K, o as O, p as v, q, r as z, s as U, t as V, u as W, v as Y, w as J, x as Q, y as X, z as Z, A as $, B as ee, C as ie, D as ae, E as ce, F as se, G as Ne, H as oe, I as te } from "./NicePinCodeInput-jMNfPqOx.js";
|
|
4
4
|
export {
|
|
5
5
|
n as MASK_PRESETS,
|
|
6
6
|
R as NICE_COLOR_PRESET_KEYS,
|
package/dist/feedback.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NiceErrorBoundary-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NiceErrorBoundary-DT5XPTeu.cjs"),i=require("./NiceModal-DQ7u-xVm.cjs");exports.NiceAlert=e.NiceAlert;exports.NiceConfirmDialog=e.NiceConfirmDialog;exports.NiceCookieConsent=e.NiceCookieConsent;exports.NiceDrawer=e.NiceDrawer;exports.NiceErrorBoundary=e.NiceErrorBoundary;exports.NiceLoginForm=e.NiceLoginForm;exports.NiceOfflineBanner=e.NiceOfflineBanner;exports.NiceRetryPanel=e.NiceRetryPanel;exports.NiceTimeoutFeedback=e.NiceTimeoutFeedback;exports.NiceToastContainer=e.NiceToastContainer;exports.alertIcons=e.alertIcons;exports.useNiceToast=e.useNiceToast;exports.NiceModal=i.NiceModal;
|